query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
b4b2e6722cb4aa210b0d7028c114d5f4 | f6c149fa8ba78f958ef4a23876f83bcb | returns true if it's there, false if not | i = 1;
while(UnitBuff("player", i)) do
if (string.find(UnitBuff("player", i), buffstring)) then
return true;
end
i = i + 1;
end
return false;
end | 1 |
59e3318f6ea3fc0d229938fd16a0259b | cd0eaaedf0611b0fc92a740a6a1fbf8e | 根据属性,拿到set方法,并把值set到对象中 | String firstChar = propertyName.substring(0, 1).toUpperCase();
String setter = "set" + firstChar + propertyName.substring(1);
try {
Method method = obj.getClass().getMethod(setter, value.getClass());
method.invoke(obj, value);
} catch (Exception e) {
l... | 1 |
a963628a07479e42df5f49736bf1950b | 2e93a0e140e9a96416e4a72489e2ba33 | Sets the IdAuteur | class Article
public function setAuteur($auteur)
{
if (is_string($auteur))
{
$this->_auteur = $auteur;
}
} | 0 |
e59187dbd27afac7e6128de5725e350e | 4777d632101823b2100d1e8e4b99a875 | We assume `a` contains tf tensors of same shape (maybe scalars) and we stack them together.
The dimensions of the elements of `a` will correspond to a group of indices
of the result starting at `start_index`. | def _prepare_indices(idx0, idx1, idx2, idx3):
len0 = idx0.shape.as_list()[0]
len1 = idx1.shape.as_list()[0]
len3 = idx3.shape.as_list()[0]
idx0 = tf.repeat(idx0, len1 * len3)
idx1 = tf.tile(tf.repeat(idx1, len3), [len0])
idx2 = tf.tile(tf.repeat(idx2, len3), [len0])
idx3 = tf.tile(idx3, [len0 * len1])
r... | 0 |
53866f420dd663778a3a82116fb01cd7 | 4a8a471e704609cddd3d8c9bffc05ab6 | Initialize button object and set alignment | class LineEditAndButton(QtGui.QHBoxLayout):
def init_layout(self):
some_btn = QtGui.QPushButton('Print')
self.some_le = QtGui.QLineEdit(self.obj_name)
some_btn.clicked.connect(self.get_value)
self.addWidget(self.some_le)
self.addWidget(some_btn)
return self | 0 |
664e7360d3aa0e5f70fd957dc8592c90 | 5dfb3593911d5cda68f9bc6deca6ab6b | 根据path获取contours数组 | contours = []
bound = []
for img_path in img_path_list:
contours.append(find_contor(img_path))
for counto in contours:
bound.append(boundingRect(counto))
bouy = np.array(bound)
return bouy | 1 |
1097b676a3d0fd2cbeb6de0789f3febe | 22b6a49c267a658187184604da998003 | Get the inverse of a symbolic 4x4 Homogeneous transform | def homoinverse(homomatrix4):
rotmat = homomatrix4[:3, :3]
tranvec = homomatrix4[:3, 3]
invmatrix4 = np.eye(4,4)
invmatrix4[:3, :3] = np.transpose(rotmat)
invmatrix4[:3, 3] = -np.dot(np.transpose(rotmat), tranvec)
return invmatrix4 | 1 |
b15dba1b50a9837faaf01f523786ae8b | 61e00f8b5dbcffb153503582ffba6b63 | 定时器3中断 | void _int_(12) isr_T3(void)
{
putChar('3');
IFS0bits.T3IF = 0;
} | 1 |
7ba7a2ee8292f11c34fad28119975bb8 | 090234f4e8f9440f4278917b0b7a229f | Allows selecting an interrupt handler for PD2 at application runtime | void PD4_SetInterruptHandler(void (* interruptHandler)(void))
{
PD4_InterruptHandler = interruptHandler;
} | 0 |
690605b10c13760c1d9bcc62e7a37b66 | f5fc5fdfe0ac094369b0482941a52a6f | 将计算结果从小数(浮点型)转化成分数(字符串) | float result_f=0.0f;
if(denominator>0){
result_f=((float)numerator/denominator)*100;
}
BigDecimal big_decimal = new BigDecimal(result_f);
result_f = big_decimal.setScale(fix_num, BigDecimal.ROUND_HALF_UP).floatValue();
return String.valueOf(result_f);
} | 0 |
73c2eaafaef2dcd9f504f89402295ddc | 5c20cd5318cc25f18cc7a6bdfece8937 | 目标对象值发生变化,通知所有观察者 | function observer(oldVal, newVal) {
targetObj2.name = newVal
console.info('targetObj2的name属性的值改变为 ' + newVal);
} | 0 |
89d90ee758d5777133ea27802f0c6c28 | e602a4b79f18cabef271feecab8d91b6 | @brief Função auxiliar recursiva para aplicar uma função a todos os elementos da árvore InOrder | listf(NODE *p, void (*f)(NODE *))
{
if (p->n_op == CM) {
listf(p->n_left, f);
(*f)(p->n_right);
} else
(*f)(p);
} | 1 |
94d5c02528af612ae729725088ca7ca0 | 2a37fa84d62b922eef6322b9e6c50687 | Метод возвращает имя пользователя для вывода в админке.
Если не подключен пакет пользователей - выводится дефолтное имя. | {
$userHelper = self::get();
if ($userId == -1 && !Yii::$app->user->isGuest) {
return self::getUserInstance()->{$userHelper->usernameField};
} else {
$username = call_user_func([$userHelper->userClass, 'find'])
->select([$userHelper->usernameField])
... | 1 |
6b34e997e714df291122678014e9a916 | f12dbd775f3753b1ca892cab624282d1 | Test that image object plan execution and re-initialization
works when the image is moving around. This simulates an
update that involves BE cloning. | mImage2 = mImage1.clone()
mImage2.setXY0(Point2I(11, 23))
testCase.assertEqual(mImage2.getBBox(), Box2I(Point2I(11, 23), Extent2I(200, 100)))
testCase.assertEqual(mImage1.getBBox(), Box2I(Point2I(1000, 2000), Extent2I(200, 100)))
testCase.assertTrue(np.all([s.getBBox() == mImage1.getBBox() for s in ... | 1 |
b236a772beedf7b71840cb5db6f2e501 | 722863b59e9a6c0c8566f3d51b852b4d | Check to see if one of the sql keywords is in the log item | {
const string word = "and|exec|insert|select|delete|update|chr|mid|master|or|truncate|char|declare|join|cmd|master|drop|create|exists|asc(|while|xp_cmdshell|add|ch|ch(|waitfor|sleep";
if (inText == null)
return false;
return word.Split('|').Any(i => (inText.T... | 1 |
a3ebe66519f08f5fa057d85446540390 | 87823356bca280e6ec76275698c2fa62 | Coroutine used for fade transitions of any length. Good for respawns, retries, and cutscene cues. | public class MovementPressKey : MonoBehaviour
private IEnumerator FadeAwayCoroutine(SpriteRenderer spriteRenderer, float duration)
{
float counter = 0;
spriteRenderer.color = spriteColor;
while (counter < duration)
{
counter += Time.deltaTime;
float alpha = Ma... | 1 |
b5321e9c8a873d09db586fa4d014948c | d01ab0e1e48ab0665538180543f15a19 | 根据会员工号和疗休养点编号获取余额是否足够支付 | public Map isEnoughByAccountType(String accountTypeNum,String money,String regulationId); | 0 |
1ba81211eac516bec6d349e29dc05907 | 37b6e1cb20d2d857556b3644e6e3909b | Setter for falling stroke by function. | if (jsBase == null) {
this.fallingStroke = null;
this.fallingStroke1 = null;
this.fallingStroke2 = null;
this.fallingStroke = fallingStroke;
this.thickness = thickness;
this.dashpattern = dashpattern;
this.lineJoin = lineJoin;
... | 1 |
d25b582d07aa391bf25f33d7eedc086e | 5939cc0b936b59f45c7ae0507011682f | Gets the number of messages in a specified conversation that match a
specified filter constraint. | public function getConversationMessageCount($conversationId); | 0 |
4db22d6e1ad53b73491a97e6e34f10d3 | 3276902d1433b1834822f5e19ab2e97e | Sliding transition for lateral modals on enter. | return animation(
animate(
'{{ duration }} {{ delay }}',
keyframes([
style({
opacity: 1,
transform: 'translate3d({{ a }}, 0, 0)',
offset: 0
}),
style({
opacity: 0,
transform: 'translate3d({{ b }}, 0, 0)',
offset: 1
... | 1 |
36acc8052f423ba2ba879a95eb8595f2 | 2cf03fff80363061365a1ab5aae3a5f5 | Run cleanup, increment the current state, then run init | class Autorun(State):
def run(self) -> 'Autorun':
self.data.next_generation()
return self | 0 |
afbd1e945897a0baeea26a22af297765 | 5500c390dff58dc243c808a805fab671 | Draw a filled polygon with given corner coordinates in window coordinates
using the current color.
(Both arrays must be of equal size.)
The graph position is unchanged. | double[] x = new double[xCoords.size()];
double[] y = new double[yCoords.size()];
for (int i = 0; i < xCoords.size(); i++) {
x[i] = xCoords.get(i);
y[i] = yCoords.get(i);
}
if (isFill) {
g.strokePolygon(x, y, edges);
g.fillPolygon(x... | 1 |
12f4579f171c37aac602d3513ba851f6 | 1f26c9f5c4994dc9e636e583e002b6d6 | 获取我的权限列表 | getMyPermission () {
let that = this
app.wxrequest({
url: useUrl.managerAuthorityPage,
data: {
session_key: app.gs(),
group_id: that.data.id
},
success (res) {
wx.hideLoading()
if (res.data.code === 200) {
that.setData({
setTop: parse... | 0 |
fe2d3cc37136789edd0cc3a3ef0764df | f62b8c116b748be5de3e1459780e64e1 | Stores history for checking in test. | class TestAdd(unittest.TestCase):
def test_history(self):
self.cl.save_history(self.cl.filter_blacklist(self.posts))
with open(self.cl.history_filename) as f:
content = []
for line in f.readlines():
content.append(line.strip())
self.assertEqual(content, ['... | 1 |
eb0ff9d7442b2668cc6e2da4c101910c | 2e60a0d19efd28f2cfb7f1a745782d8c | 矩形框选放大 | mouseModeSelectorZoomRect(): void {
this.mouseMode = 'zoomRect';
} | 1 |
de742285f319fd92a9c850e1af826481 | 43b56825e4b94ef8c5612ba4afbcbbea | class label is last entry | wstring ALL_RIS_TXT::First_Label() { return L"#905: ^D1^11\n"; } | 0 |
c53625c477ab281964914ddc88a2e4c9 | b1863870ca054bc992dae78adb5e4ad1 | Don't move, just cover the current node again. | class DCAMctsagent(RaveMctsagent):
def move(self, move):
self.dead.discard(move)
super().move(move) | 0 |
96c07edc142a722f6e55ba7a48c1cfe4 | d3412edca51dac366c0f5660288e224e | List of accepted max rating string names. | {
return [
self::CSCF_RATING_CSCF12,
self::CSCF_RATING_CSCF16,
self::CSCF_RATING_CSCF18,
self::CSCF_RATING_CSCF6,
self::CSCF_RATING_CSCF9,
self::CSCF_RATING_CSCF_A,
self::CSCF_RATING_CSCF_AL,
self::CSCF_RATING_CS... | 1 |
ef9cd54046b4e44163650551b15cf081 | 9f044edb2e2fd705160d483ecef1f77e | zwraca rok studiów studenta | public class Student
public int getYearOfStudy() {
return yearOfStudy;
} | 1 |
19c4fa0e6fb22f70b1dca8d25458082e | 1a341bd45f77a6d4cbdde16fb6049f73 | as a first filter when adding ifs, avoid adding duplicates
further filtering will be done by the dynform_InitializeIfs() function | void pushif(void)
{
IFSTRUCT *p;
global_flag++;
p = xalloc(sizeof(IFSTRUCT));
global_flag--;
p->link = ifs;
p->iflevel = ifskip;
p->elsetaken = elsetaken;
elsetaken = FALSE;
ifs = p;
} | 0 |
e0ee332727ff635d475231c8a4c6c176 | 348390eac6640af22625f9c18aa11ca8 | Expand curie to uri based on the context given
parmas
======
curie: curie to be expanded (e.g. bts:BiologicalEntity)
context_info: jsonld context specifying prefix-uri relation (e.g. {"bts":
"http://schema.biothings.io/"}) | class Manager:
def normalize_curie(
self, curie: str, *, sep: str = ":", use_preferred: bool = False
) -> Optional[str]:
prefix, identifier = self.parse_curie(curie, sep=sep, use_preferred=use_preferred)
return _safe_curie_to_str(prefix, identifier) | 0 |
f14ebc4b3d2266050401db460c614be6 | 2a58fa00fd9bc54b68dcb794e2b6ae82 | Remove frontmatter from the input | $front_matter = barefoot_rob_frontmatter($front_matter);
if (in_array($front_matter['posttype'], ['article', 'journal'])) {
return "---\n" . Yaml::dump($front_matter) . "---\n" . $content . "\n";
} else {
$front_matter['content'] = $content;
return Yaml::dump(array($front_matter), 2, 2);
... | 0 |
5c1242df07f23b45368de13b2f10239b | f35c9a00d79f5702e0f1883ec3f273a1 | metodo para obtener las deducciones que hay en la base de datos | public List<Deduction> listDeDuction(); | 1 |
bb043958b3154159f6c16174faa6b743 | 25416a16598b13a5a7892af9bc7904b7 | 获取固定长度的字符,不足后面补0 | public class StringUtils
public static String fixStrTail(String str, Integer length) {
char[] charArray = str.toCharArray();
int len = charArray.length;
StringBuilder result = new StringBuilder();
for (int n = 0; n < length; n++) {
if (n < len) {
result.append(charArray[n]);
} else {
result.append... | 1 |
898ab663b109c62954bafc9506c6cc83 | fbc3d4d5d9086fa2c1b7cf72712747b0 | Clear <language_code> value | void unsetMsgLanguageCode(); | 1 |
4a177e5d44eb9f4ed89b84e313ab2289 | 4ca77e787dcbbb8b839adca95f004186 | Retorna uma lista com a previsão de chegada dos veículos de cada uma das linhas que atendem ao ponto de parada informado. | namespace moovit_interview
public class Poller : IPoller
public List<LineEta> GetStopArrivals(int stopId)
{
var result = new List<LineEta>();
if (!_stops.ContainsKey(stopId)) return result;
lock (_locker)
{
foreach (KeyValuePair<string, DateTi... | 1 |
14e8eb6b1037230e4c9711ca9a93c18a | 1ec55af17a12f846d2c54f2e08c063cb | Set up the short description of the engine service. | public class Service extends JavaScriptObject
public final native void setDescription(String description) ; | 1 |
8d02f03fc998848f4ad2d108a8956481 | e3fe9c998e23540bdbc26f91815ce4da | ガード待機状態でなければ何もしない | {
bool GuardCondition (HandEventBase e) { return true; }
} | 0 |
e216a1d5cc6e6e3ea533750c83095c48 | a17884cf0d3124063bbf980daff4df2f | Wait until the element is not displayed or visible. | class BaseElement
def wait_until_not_visible
wait_for_visibility(false) { DriverManager.driver.find_element(@by, @locator).displayed? }
end | 1 |
ed4a6cf84cd781d25c8b0be7d09ec080 | 7a397a790fa114d59ed48826ce7c4f01 | Imports a signed server certificate into the enclosure. | namespace MimeKit.Cryptography public abstract class SecureMimeContext : CryptographyContext
public abstract void Import (X509Crl crl); | 0 |
7849172c12bf9b3b2815a09c2fdf6b5a | 7810b749b7abbd21efd962ad6d364299 | this function does a selection sort of the array by price. | void sortPrice(Item inventory[])
{
Item temp;
bool swap;
do {
swap = false;
for (int i = 0; i < SIZE - 1; ++i) {
if (inventory[i].price > inventory[i + 1].price) {
temp = inventory[i];
inventory[i] = inventory[i + 1];
inventory[i + 1] = temp;
swap = true;
}
}
} while (swap);
} | 0 |
a911717dec1831260125e7fea1e1f27f | 3c57c9e55a4786f896edefa4b5ad9042 | Sets the auto update flag | public class UpdateTask
extends SingletonTask<String, Integer, ResultAndError<AppInstallStatus>>
implements TableStateListener, InstallCancelled
public void setAsAutoUpdate() {
wasTriggeredByAutoUpdate = true;
} | 1 |
486a6497dc3f7fa5ee077a808cdb9fd8 | 84135101ab1c038bcacfb36ff84f8950 | 是否在乘坐旅行服务 | namespace PSC2013.ES.Library.PopulationData
public bool IsTravelling()
{
return ((_data1 & MASK_TRAVELLING) == 8);
} | 1 |
9e2c4022b4e47f17de8394d78b774795 | 334cbe72580032f10e0a867bf831ad4d | Returns the text of current JavaScript alert.<br>
<br>
This keyword will fail if no alert is present. Note that following
keywords will fail unless the alert is confirmed by the keywords 'Alert
Should Be Present' or `Confirm Action`. | String alertMsg = browser.getObjectText(".class", "Html.DIV", ".id",
"NOTSET");
return alertMsg;
} | 0 |
79b86f5f63e16cba61f9d61fd2b7ad8a | 276ef2d9d60f1574912cfa35b9839785 | cписок стран для заданой категории | {
$countries = $this->cache->get('cat_countries_' . $cat_id);
if (!$countries)
{
$countries = $this->db->select('country_title, country_id')->distinct()
->join('items', 'item_country_id = country_id')->where('item_category... | 1 |
0fda35e9824e8647ba9fc0539b6c3087 | a7537fb1f10058d9d93bce32ec0344bb | Do a full "computerdump", dump CPU register contents
to screen, and print memory map. | def memDump():
dataMem.dumpMemory()
registers.dumpMemory()
instructMem.dumpMemory()
print fetchUnit.pc
print "\n" | 1 |
2a63b53525d48fae4388056877ef5042 | 68c20861c4927ae27b02541288186752 | ===================================================================================================
Init
=================================================================================================== | function PANEL:Init()
// setup
self:SetSize( 256, 32 );
self:AlignTop( 32 );
self:AlignLeft( -255 );
// disable mouse
self:SetMouseInputEnabled( false );
// defaults
self.TargetY = 0;
self.Text = "";
end | 1 |
be030b7f0b65ff24143a6c73f8110784 | 7ac908eccdb2bccdcb2096050be03166 | "The interface on which this entry's equivalence
is effective. The interface identified by a
particular value of this index is the same
interface as identified by the same value of
ifIndex." | class Interface(Base):
def InterfaceIndex(self):
return self._get_attribute('interfaceIndex') | 1 |
6cee13ffcecfebc8d21d41bb08c622e9 | cd8d523699d05fc3d3a70e6088415061 | Test object construction with a string | item = value.allocate_object(size=8, object_type=value.ObjectType.OBJ_STRING)
assert item.object_type == value.ObjectType.OBJ_STRING
assert item.obj == [None] * 8 | 1 |
2c3e8e7a69b7af2c3fb2195745fadee2 | ae6102d5b2a4598d324c75bf8bfdc8b4 | 获取区代的业绩数据 | {
M()->execute('truncate table `dms_'.$this->name.'_业绩`');
$users = M('会员')->select();
$branch = $this->getBranch();
$model = M($this->name.'_业绩');
foreach($branch as $region)
{
if(M('会员')->where($this->name.'_'.$region.'区本期业绩>0')->find())
{
throw_exception('目前有会员'.$this->name.'_'.$re... | 0 |
669f9fbd8274a645819208684f31e83d | 2bebd63577f4a112eaff7d55414e90af | sets date and time as time stamp, e.g. System.currentTimeMillis() | Calendar cal = Calendar.getInstance();
Date now = cal.getTime();
this.ts = new Timestamp(now.getTime());
} | 1 |
3eeb647f0b88673907c6c72d1af95e78 | 4d87fdd1ed799f0e1ed9763211716417 | 测试srandmember命令 | redisClusterContext *cc = redisClusterContextInit();
assert(cc);
int status;
status = redisClusterSetOptionAddNodes(cc, CLUSTER_NODE);
ASSERT_MSG(status == REDIS_OK, cc->errstr);
status = redisClusterConnect2(cc);
ASSERT_MSG(status == REDIS_OK, cc->errstr);
status = redisClusterAppendCom... | 0 |
76b71eb1bc80e6036941e41352fb4e49 | e15eabb8f35a9fdf515d84b19d8249dd | Добавление всех узлов в базу данных из XML | tx, err := db.Begin()
Utils.CheckError(err)
stmt, err := tx.Prepare("insert into public.games_sections " +
"(id, name_section,count_goods,parent_folder) values ($1,$2,$3,'0') " +
"ON CONFLICT (id) DO UPDATE SET name_section = $2, count_goods = $3, parent_folder = '0' ")
Utils.CheckError(err)
defer stmt.Close()... | 1 |
ce6720d50c32048952d9178b5fdb7a48 | c1f090ebe5ddddc15102070a35944505 | 获取合并行的html队列 | namespace ZKWeb.Plugins.Finance.Payment.src.Components.PaymentTransactionHandlers.Bases public abstract class MergedTransactionHandlerBase : IPaymentTransactionHandler
public abstract void GetResultHtml(PaymentTransaction transaction, IList<HtmlString> html); | 1 |
26b13bef6613d172f02fd7dbb3c8d2e3 | 2667bd905c0d2dd459bb87c3ffa5c14a | 将一个php数组保存为一个文件 | class FileManage
public function arrayWrite($array, $path)
{
$str = '';
foreach ($array as $k => $v) {
if (empty($str)) {
$str = "'$k' => '" . $v . "'" . ',';
} else {
$str = $str . "\n" . "'$k' => '" . $v . "'" . ',';
}
}
... | 1 |
5c31f0b5f3465928c992a7acb2f7dada | 73682ca8befb477bd1a7ee04c00e4eca | Преобразует многомерный массив в плоский | function array_multi2single($array)
{
static $result_array = array();
foreach ($array as $value) {
if (is_array($value)) {
array_multi2single($value);
} else
$result_array [] = $value;
}
return $result_array;
} | 1 |
978852f281a6a5f598c9be0424617e38 | beeeab02044167ec8a51c0852d2a6ed9 | 標準偏差(サンプル). | def sample_std_err
sample_std_dev / Math.sqrt(length)
end | 0 |
12cbb3e67cdac2a4c3a35c54272a7221 | f5cd0d1281cb07dcb7414ece52b81469 | 创建文档,如果创建失败则返回null | {
MemoryStream ms = new MemoryStream();
Package package = Package.Open(ms, FileMode.Create, FileAccess.ReadWrite);
PostCreation(ref package);
DocX document = DocX.Load(ms);
document.filename = filename;
return document;
} | 0 |
f45d52771c6f79b12cdbf4b6a70b8d75 | 99963df7c5f176d2f907bbb1c401cf1a | Calculates the relative X position of all the actors to a given actor. | public double getRelativeX(); | 0 |
9882d74c9e6c80111491ca45e702aaa7 | f60f409c2ae88039caedd14d2be5cea9 | 触发数据库变更监听事件 | class Db
public static function trigger($event, Connection $connection, $params = [])
{
$result = [];
if (isset(self::$events[$event])) {
$callbacks = self::$events[$event];
foreach ($callbacks as $k => $callback) {
if (is_string($callback) && !empty($callback)) {
$class = [$callback, 'handler'];
... | 1 |
aa48a5e1efb06a78d0ded5061d2676c3 | 0c296993e7cd70fb538c491dc533b45e | Returns the "has many items" property for the given array instance. | if ($property === 'hasAndBelongsToMany') {
return array();
}
$schema = $this->schema();
if (isset($schema[$property]) && method_exists($this, 'get' . $property)) {
return $this->{'get'.$property}();
}
} | 0 |
0fbb1c1b377130ab2242faf4c4a23502 | 50703c588a8e7c3554fd66efa0addb60 | 获取生成的巡检结果文件 | class Excel:
# 初始化读取excel文件
def save(self, save_file_name, timestamp):
save_dir = os.path.join(TEST_REPORT_FILE_DIR, get_chinese_date())
if not os.path.exists(save_dir):
os.mkdir(save_dir)
save_file = os.path.join(save_dir, save_file_name + "_" + timestamp + ".xlsx")
sel... | 1 |
959c03d22c639b94832c8cdafdf3d46f | 3bfe7d82f9543e173b35e67ce440e2d8 | Проверка возможности добавить войска | var f = source.troops
var e = 0
for country in targets:
e += country.troops
return (f>=(2*e+len(targets)) | 1 |
209917a5b3f51a6717dc16c701d5cc31 | 1092c552c6b625c10521fe688e248bd3 | Imputes na's of column according to distribution | def knn_impute(df: pd.DataFrame, keep_na_indicator: bool = True) -> pd.DataFrame:
na_columns = df.columns[df.isna().any().sort_values()].tolist()
for column in na_columns:
columns_used_to_impute = [col for col in df.columns if (col not in na_columns or col == column)]
if keep_na_indicator is Tru... | 0 |
010f20adde17356b60b34ab04b986f8c | 920fb5281d49ba1db5a467f7a258ae17 | Set the default products per page. | class Stacc_Recommender_Model_Sync extends Mage_Core_Model_Abstract
public function setProductsPerPage($productsPerPage)
{
if ($productsPerPage) {
$this->_productsPerPage = $productsPerPage;
}
} | 1 |
6a858f1774761549bb47a8cd5e25d938 | c0eccef6db3c475006d4408550414bc8 | Check if signal recording manager configuration is valid | int result = 0;
assert(result == OK);
result &= checkCycle(config);
FOR_TRACES(trace, config->traces) {
result &= checkChannel(trace, config);
}
return result;
} | 1 |
ebc67673c8b5f9388ddcfbdd17ecdcbe | 1a8757ca8354de159f54b0ce2a4b32f9 | 接受组队邀请并入队 | {
if (null == Singleton<ObjManager>.GetInstance().MainPlayer)
{
return;
}
if (GlobeVar.INVALID_ID != GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID)
{
if (GameManager.gameManager.PlayerDataPool.TeamInfo.IsFull())
{
r... | 0 |
dd4dc29305d367c009e4cdb7d743168d | 2a25b245371c4e5cd5d3b71d88fa6043 | loads the robot list from a data file | f = open(fnam, 'rb')
lst = pickle.load(f);
f.close()
return lst | 1 |
00873bf82b892a5fa2cda4164a2bf48d | 7f3d7a71ba2b85968d87be59a0240171 | Decides whether to increase or decrease card count based on card
value. Otherwise, keeps card count the same. | class Table:
def update_counts(self, card):
count = card.get_numerical_value()
if count in [2, 3, 4, 5, 6]:
self.running_count += 1
elif count in [10, 11]:
self.running_count -= 1 | 1 |
5cfd18048bffd80878aa00d25f7c9eba | 5b2e2eef8ce338fc61b8039e5b61b2cd | 根据维度id集合查询 | List getDimListByString(String dim_str, String hocId, String roleId); | 0 |
0ba37aebf4c41174d0eb804479c4384d | 2c7447593afd084dc6f3bf026eac7aec | 移动主题到另一个板块 | public ActionForward moveThemesToForum(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ThemeForm formbean=(ThemeForm)form;
Integer[] ids=formbean.getThemeIds();
Integer forumId=formbean.getForumId();
if(forumId!=... | 1 |
93de45c5f508b9c1db6bc134206edf77 | f191403d1b76dfd9c0ae4d6cf44bdc33 | 在父界面中执行公式 | {
try
{
int rowIndex = Convert.ToInt32(textEdit.Name.ToString().Substring(6, 2));
int columnIndex = Convert.ToInt32(textEdit.Name.ToString().Substring(8, 2));
double val = 0;
string calcFormula = C... | 1 |
4da337ab358617dd40ac1bc3a5a764a5 | cd36399827eb50a6cd8a94b219245b10 | Main function to call the function to read a csv file | ReadAndParseCsvFile sfcf = new ReadAndParseCsvFile();
String useFile = (args.length == 0 ? "Document.txt" : args[0]);
sfcf.execute(useFile);
} | 1 |
4a68913c485dd23ff1a1c3655fa97c62 | 817644fee4df21465b1ec235a771da36 | 获取表单分页详细信息 | public class SystemService
public static string GetDetailPageConfig(string view)
{
var config = DB.From<CFConfiguration>().Where(CFConfiguration._.View == view)
.Select(CFConfiguration._.Form)
.ToFirst();
if (config == null) return "null";
if (config.Form.IsNullOrEmpt... | 0 |
87bea4b8366fd56797312bfaec8cccfe | 72b4e386a1a066f7c50db9e43d6dd1e5 | Find the zip code of the first result | zip_location_list = zipcodes.matching(zipcode)
try:
first_location = zip_location_list.pop()
lat = float(first_location.get("lat"))
lon = float(first_location.get("long"))
except Exception:
return None, None
return lat, lon | 0 |
bf8c621dd665ca43c75f3dde0f026e5b | f2f1013f1a48ee97492a36f608de583d | Verify the form and type of an IssuedCurrency at runtime. | public void verify(LedgerTransaction tx) {
final CommandWithParties<Commands> commandBase = requireSingleCommand(tx.getCommands(), Commands.class);
final Commands commandData = commandBase.getValue();
if (commandData.equals(new Commands.PaymentRequest())) {
final CommandWithParties<Commands.Paym... | 0 |
00e9ec944338dcb306c9fa289ae31087 | 99e3256f4b6056a389289eeb1c323913 | Gets total number of send requests for time series data sent to Predix. | public Long getTotalSentDones(); | 0 |
361ca810b9fa3abe0654be5e87831e64 | e1230328f5fccb9b3389324772db72cf | 인터럽트 발생 여부 설정 | void configure_external_interrupts(regflag mode) {
if (mode == on)
INTCONbits.INTE = 1;
else
INTCONbits.INTE = 0;
} | 1 |
ad60d44341302446e591e6ecbaade399 | 2457dc8eaa25002743a70f1293dfbf0e | 添加一条电子围栏信息 | @RestController("AdminElectricFenceController")
@RequestMapping("/admin/electricFence/")
public class ElectricFenceController extends BaseController
@RequestMapping(value = "saveElectricFence.action", method = RequestMethod.POST)
public ResponseResult saveElectricFence(ElectricFenceQueryForm electricFenceQueryForm) {
... | 1 |
b2cad32efdf12f67137628dd9780e7c1 | 8923973f58a2d877f67414cf8a76acc2 | Calculate the inverse relative distance between earth and sun from
day of the year.
Based on FAO equation 23 in Allen et al (1998). | {
$res = 0.0003 * sin(deg2rad($this->normalizeAngle(329.7 + 44.43 * $julian_year)));
$res += 0.0003 * sin(deg2rad($this->normalizeAngle(352.5 + 1079.97 * $julian_year)));
$res += 0.0004 * sin(deg2rad($this->normalizeAngle(21.1 + 720.02 * $julian_year)));
$res += 0.0004 * sin(deg2rad(... | 0 |
6875bba6d52d3902bb8eec2075b49ce5 | f179befe286865b991a7d79efb15214b | Compute change between first week (baseline) and all following weeks. | f_date = pd.to_datetime(df.columns.T[-wks_prior])
s_date = f_date + timedelta(7)
normalized = df.loc[:,s_date:].sub(df.loc[:,f_date],axis='rows')
return normalized | 1 |
366866ec561f6f66440e4bc9253658f2 | bec6f3505604965fb1eba53a329527ba | функция формирования случайного ряда чисел, указанной длины из заданного диапазона | randomarray = []
for i in range(length):
randomint = random.randint(rangeL, rangeR)
randomarray.append(randomint)
return randomarray | 1 |
ea33441379ebebf9816edabb10dfee50 | 36708eae1e22dee2cf73617e70004e39 | Creates a new instance of the <see cref="MySqlConnection"/> class using
the provider connection string. | {
var dbConnection = CreateConnection(providerName);
dbConnection.ConnectionString = connectionString;
return dbConnection;
} | 0 |
379b7664819e4047377b4fc3a1c3b323 | adf333b1e04a63f12b5d9534b805d81c | Функция вычеркивания строки и столбца | void strikeout (char sud[9][9][10], int str, int col) {
int i, j;
char num=sud[str][col][0];
for (i=0; i<9; i++) {
sud[str][i][num]=0;
}
for (j=0; j<9; j++) {
sud[j][col][num]=0;
}
for (i=((int)str/3)*3; i<((int)str/3)*3+3; i++){
for (j=((int)col/3)*3; j<((int)col/3)... | 1 |
45e86aa9c11e85a39f864f8ba426eff6 | 6cb13147d105718e5e329b48dfb83749 | Дешифрует текст шифром Цезаря | self.klar_tekst_start = text
self.crypto = ""
for letter in text:
position = self.find_key(letter)
temp = (position + self.key -
self.first_key) % self.alphabet_lenght + self.first_key
self.crypto += self.alphabet_dict[temp]
return ... | 0 |
4d6e041ba7c3b99c6a604d95916338f3 | 915bf1badc0b8b93d644f10b23a9cb48 | 商家订单状态统计 | class Statistics extends Admin
public function order_statistics() {
$map = "order_state in (2,3,4,5,7) and seller_id = ".session("sellerid");
$min_date = I("min_date");
$max_date = I("max_date");
if (!empty($min_date)){
$map .= " and date_add >= ".strtotime($min_date);
}
if(!empty($max_date)){
$map .=... | 1 |
1497a452a59657e5ec8aa22c905f9464 | c211383ebc5a49c3e0a8a773ff687794 | Get the command hash of the last queued command, if any. | def get_current_hash():
return current_hash | 0 |
24ab30e3522ff7c864feb9ca827ca6f1 | 93f50351178b03f34732b45a650f644b | Created by Tiffany Jiang on 2017-06-07
Moves a course in an existing course plan to a different term/year | for (int i = 0; i < semesters.size(); i++) {
if (semesters.get(i).getSemNumber() == newSemester.getSemNumber()) {
semesters.set(i, newSemester);
}
}
return new Plan(this.description, this.tags, semesters);
} | 0 |
513ae215b44f05eb92109ae2ab31a645 | 21717333af3679b9cc646d4eafec6805 | Compute the 1D hough entropy | unsigned int width,
unsigned int height,
unsigned int width_step,
unsigned int r_min,
unsigned int r_max )
{
if ( ! img_data || ! height || ! width || ! r_min)
{
*err_stream << "Error : bad params in int c_hough :: compute_hough_transform( const unsigned char ... | 0 |
5d61c36b6bfa6a1b64aa4c395c7c9b3d | 6d348b537da317cd276d1721fee3e064 | 找出可以排班的员工 | {
$info['min_time']=$request->input("min_time")?strtotime(getTimeStamp($request->input("min_time"))):1420041600;
$info['max_time']=$request->input("max_time")?strtotime(getTimeStamp($request->input("max_time")))+3600*24-1:time();
$info['area']=$request->input("area")?$request->input("area"):... | 1 |
ee510f766cf0a091ead29d12801ea25c | 44edabf5210f5fad08b909e32b778d1f | Shows the add component view. | {
$this->view = new View("add_row", "default");
$this->view->base_uri = $this->base_uri;
$this->view->setDefaultView("components" . DS . "modules" . DS . "liquid" . DS);
Loader::loadHelpers($this, array("Form", "Html", "Widget"));
if (!empty($vars)) {
if (empty($v... | 1 |
a81d4175c4bce64c0f67b507daeb4c2a | 52a4d140096370db520525749a11cb12 | 获取url资源中的单个匹配值 | namespace Panto.Framework
public class RegexHelper
public static string GetRegexValue(string body, string pattern)
{
var list = GetRegexValues(body, pattern);
if (list.Count == 0)
return string.Empty;
return list[0];
} | 1 |
ad710d3189bada7edcae0a3ed0989931 | 917ab38c8749b51865c1b5a3a9102722 | Does this object need a mapping? | {
return !UnChanged( ObjectManager.GetObject( Attributes.Id ) as ExternalMappingObject );
} | 1 |
380a6068ed818755cf3755d27b458f94 | 7bf3df263d49b5d6721cc86f8289d587 | Save photos sort | class ArticleController extends FM_Admin_Controller_Action
public function sphotoleftAction(){
global $db;
if($this->id > 0){
$request = $this->getRequest();
$photo_id = (INT) $request->getParam('pid',0);
$sort_order = (INT) $request->getParam('sort',0);... | 1 |
d8b3d02be0db395eebdbc6d0dfb80c04 | 6719c5310c05426ea48b71d8ebe8a507 | Base Attack Speed of the champion. | {
unsigned int aspeed;
aspeed = (unsigned int)thisnpc->atkspeed;
if(aspeed == 0)
{
aspeed = 100;
}
if(Status->Haste_up!=0xff)
{
aspeed += MagicStatus[Status->Haste_up].Value;
}
if(Status->Haste_down!=0xff)
{
aspeed -= MagicStatus[Status->Haste_down].Value;... | 1 |
3390adccb4975bdc9fd6161ecc2fb9d1 | d5fb4adfba70448d3f084305849992cf | Sets the language based on URL path | {
$language = self::getLangByUrl($url);
self::$current = ($language === null) ? self::getDefaultLang() : $language;
Yii::$app->language = self::$current->local;
} | 1 |
701456b4e00db4a2e7602b0e5e302546 | 76056a164b32232554a5e92bd110b224 | Note: this is a test which checks to see if an error is raised. | def test_value_error():
try:
converter.get_rate(rates, "EUR", "AUD")
except ValueError:
assert True | 1 |
85c5b4833c6eb22a48ee890fec289a70 | 40b1e44b026464f288d4d7f8ae1bb1c6 | Передача автомобиля на другой аккаунт | {
global $control;
global $config;
global $sql;
$TypeID = intval($control->params['typeID']);
if (!$TypeID)
$TypeID = 1;
$this->_createTransport(array("user" => $control->user,
"TypeID" => $TypeID,
"TripID" => intval($control->params['tripID']),
"RegNum" => $control->user->nickname
));
... | 0 |
7a8d8677a11123c9337003fdd4c68ab5 | 0d8b0b7bb180b2d8b09e4af3033bb57e | Test invalid timestamp in one of the transactions. | {
$this->setExpectedException(
'InvalidArgumentException',
'Invalid opcode',
150450008
);
$parameters = [
'opcode' => 'abc',
'start' => '2013-01-01T12:00:00+0800',
'end' => '2013-01-02T12:00:00+0800'
];
$... | 0 |
83c3b837b3d223fe281b97c155f46d18 | d010c15be047c2e950ce8ebc68e54c2e | Returns the value of the '<em><b>Ent id</b></em>' attribute.
<!-- begin-user-doc -->
<p>
If the meaning of the '<em>Ent id</em>' attribute isn't clear,
there really should be more of a description here...
</p>
<!-- end-user-doc --> | String getEntName(); | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.