query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return a custom 404 error. | def page_not_found(e):
return 'Sorry, Nothing at this URL.', 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def error_404(error):\n return '404 Error'",
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def error_not_found(error):\n return 'No page here, dood. 404!', 404",
"def not_found(self, error):\n return jsonify({'error': 'NO... | [
"0.81155777",
"0.8041831",
"0.7739811",
"0.7737286",
"0.7717209",
"0.7688699",
"0.7671161",
"0.76105595",
"0.76020473",
"0.7570478",
"0.7552754",
"0.75454265",
"0.75192803",
"0.7474545",
"0.7457752",
"0.7455727",
"0.7455212",
"0.7450199",
"0.74426883",
"0.742785",
"0.7405555"... | 0.72543144 | 43 |
pad a sequence of data specified by a given max_length list, int > array | def paddingSequence(X_train, X_test, maxLen=30):
#######equalize list of seq
X_train = pad_sequences(X_train, maxLen, padding='post', truncating='post')
X_test = pad_sequences(X_test, maxLen, padding='post', truncating='post')
return X_train, X_test | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_sequence(self, arr, max_length_tweet):\n # padding a list of indices with 0 until a maximum length (max_length_tweet)\n if max_length_tweet>len(arr):\n trailing_zeros = [0]*(max_length_tweet-len(arr))\n arr.extend(trailing_zeros)\n return arr[:max_length_tweet]",
... | [
"0.81016314",
"0.79266065",
"0.77404624",
"0.7690541",
"0.7676706",
"0.76214975",
"0.7527646",
"0.7444111",
"0.72843784",
"0.7280581",
"0.72568583",
"0.7182862",
"0.7176686",
"0.71321",
"0.7129026",
"0.7092075",
"0.7076387",
"0.7069801",
"0.70455825",
"0.70083386",
"0.699498"... | 0.6865131 | 26 |
Env wrapper that returns a previous observation with probability `p` and the current observation with a probability `1p`. `last_k` previous observations are stored. | def __init__(self, env: gym.Env, sticky_probability: float, last_k: int):
super().__init__(self, env)
if 1 >= sticky_probability >= 0:
self._sticky_probability = sticky_probability
else:
raise ValueError(
f"sticky_probability = {sticky_probability} is not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prior_predictive(self):\n cfg = self.config\n n = cfg['batch_size'] * cfg['q/n_samples']\n n_samples = cfg['q/n_samples']\n with util.get_or_create_scope('model', reuse=True):\n h_prior = tf.cast(self.p_h_L.sample(n), cfg['dtype'])\n h_prior = tf.reshape(\n h_prior, [cfg['q/n_sam... | [
"0.58422875",
"0.54212475",
"0.52596",
"0.5250174",
"0.5237888",
"0.52241963",
"0.51826686",
"0.51438004",
"0.5091699",
"0.5071481",
"0.50413746",
"0.5002886",
"0.49614602",
"0.49575868",
"0.49465007",
"0.49387398",
"0.49345186",
"0.4924787",
"0.4917048",
"0.49155378",
"0.490... | 0.54807967 | 1 |
Create a JSON configuration file | def create_config_file(name):
config = {}
config['name'] = name
to_dir = os.getcwd() + '/' + name
with open(os.path.join(to_dir, 'configuration.json'), 'w') as config_file:
json.dump(config, config_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createConfig():\n\twith open(configPath, 'w', encoding='utf-8') as file:\n\t\tjson.dump(default_config, file, indent=3)",
"def save_config_to_json(config, filename):\n with open(filename, 'w+') as f:\n json.dump(vars(config), f)",
"def write_to_json(config: dict, filename: str):\n\n with open(... | [
"0.79925877",
"0.75612205",
"0.7511189",
"0.75044733",
"0.72702944",
"0.7265625",
"0.7182749",
"0.715349",
"0.7092775",
"0.707714",
"0.70369494",
"0.69433916",
"0.6888235",
"0.68808824",
"0.6878264",
"0.68310314",
"0.68270767",
"0.68089056",
"0.67931706",
"0.6792589",
"0.6791... | 0.79342985 | 1 |
Test that N/A values (None, numpy.nan) are handled consistently when using CSV vs Arrow as a prediction payload format. 1. Make CSV and Arrow prediction payloads from the same dataframe 2. Read both payloads 3. Assert the resulting dataframes are equal | def test_read_structured_input_arrow_csv_na_consistency(tmp_path):
# arrange
df = pd.DataFrame({"col_int": [1, np.nan, None], "col_obj": ["a", np.nan, None]})
csv_filename = os.path.join(tmp_path, "X.csv")
with open(csv_filename, "w") as f:
f.write(df.to_csv(index=False))
arrow_filename =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_build_dataframe(self):\n insert_good_data()\n dataframe = get_dataframe()\n # 1 2 3\n self.assertIs(type(dataframe['Total'][0]), numpy.float64)\n self.assertIs(type(dataframe['InvoiceDate'][0]), str)\n self.assertIs(type(dataframe['Count'][0]), numpy.int64)\n ... | [
"0.61763406",
"0.6114238",
"0.6098677",
"0.60721225",
"0.607004",
"0.60079575",
"0.59785664",
"0.59550744",
"0.59273005",
"0.5888702",
"0.58884233",
"0.5882254",
"0.5847906",
"0.58434826",
"0.58389467",
"0.5829927",
"0.5829745",
"0.5829139",
"0.5826037",
"0.58072144",
"0.5796... | 0.8162266 | 0 |
Returns the cross entropy for the given `logits` and `labels`. | def setup_loss(logits, labels):
predictions = tf.nn.softmax(logits)
cost = tf.losses.softmax_cross_entropy(onehot_labels=labels,
logits=logits,
)
return predictions, cost | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_entropy_loss(self, logits, labels):\n return F.cross_entropy(logits, labels)",
"def softmax_cross_entropy_loss(logit, labels):\n p = softmax(logit)\n loss_i = - labels * np.log(p + 1e-8)\n return np.mean(loss_i)",
"def loss(logits, labels):\n labels = tf.to_int64(labels)\n# labels =... | [
"0.85329103",
"0.78234965",
"0.7710926",
"0.7591083",
"0.75721323",
"0.75721323",
"0.75562805",
"0.7552464",
"0.7445488",
"0.7412907",
"0.73658127",
"0.7359791",
"0.7329148",
"0.72940445",
"0.7279801",
"0.7266132",
"0.72471684",
"0.7246889",
"0.7220879",
"0.72125256",
"0.7212... | 0.70683247 | 32 |
Returns the learning rate during training based on the current epoch. | def get_lr(curr_epoch, hparams, iteration=None):
assert iteration is not None
batches_per_epoch = int(hparams.train_size / hparams.batch_size)
lr = cosine_lr(hparams.lr, curr_epoch, iteration, batches_per_epoch,
hparams.num_epochs)
return lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)",
"def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)",
"def __learning_rate(self, lr0, epoch):\n \n ... | [
"0.889373",
"0.864617",
"0.864617",
"0.8347587",
"0.808271",
"0.7976919",
"0.78345776",
"0.7733169",
"0.75359875",
"0.7415178",
"0.74070424",
"0.7342057",
"0.7311969",
"0.7279861",
"0.7237017",
"0.72271466",
"0.72149163",
"0.71686745",
"0.7139177",
"0.7139177",
"0.71343726",
... | 0.65126944 | 74 |
Creates and saves a User with the given username, email and password. | def _create_user(self, email, username, password,
is_staff, is_superuser, **extra_fields):
now = timezone.now()
# if not username:
# raise ValueError('The given username must be set')
email = self.normalize_email(email)
user = self.model(username=username... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se... | [
"0.86018157",
"0.84706366",
"0.8462776",
"0.8417308",
"0.8413365",
"0.839183",
"0.8346418",
"0.83453476",
"0.8314481",
"0.8306914",
"0.8288764",
"0.827679",
"0.8270353",
"0.82577944",
"0.8213095",
"0.81978804",
"0.8175898",
"0.81719273",
"0.8164025",
"0.8162915",
"0.8138058",... | 0.0 | -1 |
Map into the Profile model. | def parse(self):
details = self.details()
return Profile(
book_id=self.book_id,
title=self.title(),
user_id=self.user_id(),
username=self.username(),
summary=self.summary(),
published=self.published(),
updated=self.upda... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_profile(self) -> Profile:\n return Profile(**{**self.profile, **self.contact})",
"def _profile_to_InstagramUser(profile: Dict[str, Any]) -> _InstagramUser:\n # Navigate to the user JSON that is coincidentally used by the provided API methods\n user = profile['users'][0]['user']\... | [
"0.6386944",
"0.6078071",
"0.5955639",
"0.59452206",
"0.5924131",
"0.5893735",
"0.58359146",
"0.5818783",
"0.58164734",
"0.5816099",
"0.56320775",
"0.56275004",
"0.5618273",
"0.55763835",
"0.5563363",
"0.5558556",
"0.55290043",
"0.5456606",
"0.54563314",
"0.54117835",
"0.5393... | 0.65340567 | 0 |
Check if two points 'point' to the same point. | def __eq__(self, rhs):
return self.x == rhs.x and self.y == rhs.y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _point_equal(a,b):\n return np.array_equal(a._Point__loc, b._Point__loc)",
"def __eq__(self, secondPoint):\n return self.xCoordinate == secondPoint.xCoordinate and self.yCoordinate == secondPoint.yCoordinate",
"def sameLocation(self, other):\n if not isinstance(other,Point):\n r... | [
"0.7738884",
"0.7630163",
"0.75458723",
"0.7507236",
"0.74646354",
"0.7366843",
"0.72879654",
"0.7230881",
"0.71916497",
"0.7021775",
"0.70010066",
"0.69988114",
"0.6980971",
"0.69447684",
"0.69423074",
"0.6922803",
"0.6887719",
"0.68692786",
"0.68417424",
"0.6823753",
"0.680... | 0.6565101 | 40 |
Get Pt as numpy array. | def np(self):
return np.array([self.x, self.y]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dlib_point_to_np_array(point: dlib.point):\n return np.array([point.x, point.y])",
"def t2np(v):\n return (v.data).cpu().numpy()",
"def md_point_to_np_array(point: dict):\n return np.array([point[\"x\"], point[\"y\"]])",
"def AsNumpy(self):\n return np.array([\n self._center[0], se... | [
"0.67304754",
"0.66762954",
"0.66032225",
"0.634031",
"0.6317778",
"0.6309739",
"0.62842506",
"0.6168719",
"0.61543065",
"0.6075997",
"0.6056005",
"0.6040111",
"0.6038248",
"0.60333204",
"0.59668833",
"0.5956905",
"0.5941488",
"0.594069",
"0.592537",
"0.59135854",
"0.59005666... | 0.6592524 | 3 |
Get the distance between the player and the goal. | def player_goal_distance(self) -> float:
route = self.best_route
return sum(route.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distMe_Players(self, player):\n return self.playerPos.distance(player)",
"def get_distance(self):\n print(\"voici la distance à l'obstacle\")",
"def distance_to_current_waypoint(self):\n next_waypoint = self.vehicle.commands.next\n if next_waypoint == 1:\n return None... | [
"0.7473132",
"0.7293953",
"0.7254824",
"0.7148412",
"0.7128136",
"0.71275765",
"0.7054903",
"0.68885946",
"0.6857143",
"0.68300825",
"0.6792063",
"0.6770327",
"0.67508197",
"0.6718603",
"0.67152125",
"0.66675186",
"0.66256315",
"0.66200554",
"0.66099554",
"0.66027814",
"0.655... | 0.82236296 | 0 |
Test the case that Auth0 returns json without an access key | def test_new_token_malformed_resp(db, mocker):
settings.AUTH0_CLIENT = "123"
settings.AUTH0_SECRET = "abc"
class Resp:
def json(self):
return {"notvalid": None}
def content(self):
return "blah"
def raise_for_status(self):
pass
mock = mocker... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_test_no_auth():\n # Permission check is not applicable here\n return jsonify({\"answer\": 42})",
"def test_invalid_access_key(self):\r\n data = {\r\n \"EdX-ID\": self.receipt_id,\r\n \"Result\": \"Testing\",\r\n \"Reason\": \"Testing\",\r\n \"Mess... | [
"0.68301845",
"0.67362094",
"0.6731003",
"0.66733056",
"0.6644412",
"0.66375613",
"0.663029",
"0.6622536",
"0.6601812",
"0.65738106",
"0.65738106",
"0.6570111",
"0.6558032",
"0.65231293",
"0.6517943",
"0.6509028",
"0.6487858",
"0.6475346",
"0.6441348",
"0.6441348",
"0.6439401... | 0.0 | -1 |
Test that no token is fetched when there is not enough config | def test_new_token_insuficient_config(db, mocker):
settings.AUTH0_CLIENT = None
mock = mocker.patch("creator.authentication.requests.post")
assert get_token("my_aud") is None
assert mock.call_count == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_token_get_all(self):\n response = self.app.get('/api/v3/users')\n self.assertEqual(response.status_code, 401)",
"def test_no_token_auth_required(self, client):\n assert_hook_status(client, status=401)",
"def test_missing_token(self):\n ConnectorTelegram({}, opsdroid=OpsD... | [
"0.71030533",
"0.7093617",
"0.6954731",
"0.68749434",
"0.68542343",
"0.68245643",
"0.67864007",
"0.6760013",
"0.6729617",
"0.6728336",
"0.67073685",
"0.66850024",
"0.66672915",
"0.66597193",
"0.6608426",
"0.65870893",
"0.65839183",
"0.6570184",
"0.65669554",
"0.65669554",
"0.... | 0.718768 | 0 |
The creation timestamp of a CertificateIssuanceConfig. | def create_time(self) -> str:
return pulumi.get(self, "create_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_timestamp(self):\n\n return self.get_signingTime()",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n ... | [
"0.75563693",
"0.7485385",
"0.7485385",
"0.7485385",
"0.7162051",
"0.7075112",
"0.7075112",
"0.7075112",
"0.70109284",
"0.6970187",
"0.69627196",
"0.69609106",
"0.6876807",
"0.6876807",
"0.6876807",
"0.6859561",
"0.6859561",
"0.68426657",
"0.68318677",
"0.6739961",
"0.6627407... | 0.6722326 | 34 |
A userdefined name of the certificate issuance config. CertificateIssuanceConfig names must be unique globally and match pattern `projects//locations//certificateIssuanceConfigs/`. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_certificate_issuance_config_output(certificate_issuance_config_id: Optional[pulumi.Input[str]] = None,\n location: Optional[pulumi.Input[str]] = None,\n project: Optional[pulumi.Input[Optional[str]]] = None,\n ... | [
"0.61326957",
"0.5638635",
"0.55700773",
"0.5549022",
"0.54405814",
"0.5380444",
"0.5368658",
"0.53381824",
"0.53381824",
"0.53057086",
"0.5272185",
"0.5266923",
"0.52655244",
"0.5196403",
"0.51251894",
"0.5121793",
"0.50983804",
"0.5064935",
"0.5045498",
"0.50395834",
"0.502... | 0.0 | -1 |
The last update timestamp of a CertificateIssuanceConfig. | def update_time(self) -> str:
return pulumi.get(self, "update_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_update_time(self):\n return self._last_update_time",
"def thisUpdate(self) -> datetime:\n this_update = self['tbs_cert_list']['this_update'].native\n return this_update",
"def last_update(self):\n # get modification time of QWC2 themes config file\n config_updated_at... | [
"0.70002806",
"0.695427",
"0.6888416",
"0.68704057",
"0.68698895",
"0.68135715",
"0.6774717",
"0.6774717",
"0.67425",
"0.67425",
"0.66539323",
"0.6635681",
"0.6635294",
"0.66305935",
"0.6594932",
"0.6583277",
"0.6538762",
"0.6524823",
"0.6524823",
"0.65207016",
"0.65207016",
... | 0.6284703 | 39 |
Set the learning rate of a given `model` generated by `fe.build`. | def set_lr(model: Union[tf.keras.Model, torch.nn.Module], lr: float, weight_decay: Optional[float] = None):
assert hasattr(model, "fe_compiled") and model.fe_compiled, "set_lr only accept models from fe.build"
if isinstance(model, tf.keras.Model):
# when using decoupled weight decay like SGDW or AdamW, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def assign_learning_rate(session, lr_update, lr_placeholder, new_lr):\n session.run(lr_update, feed_dict={lr_placeholder: new_lr})",
"def adjust_learning_rate(optimizer, epoch, model_type):\n if model_type == 1:\n if epo... | [
"0.71395046",
"0.70618266",
"0.6917554",
"0.68914354",
"0.6872831",
"0.6862473",
"0.68475896",
"0.67931026",
"0.6760157",
"0.6728568",
"0.6724322",
"0.67154443",
"0.6710236",
"0.6707238",
"0.6705722",
"0.6688397",
"0.668348",
"0.6672866",
"0.6672866",
"0.6665554",
"0.6663909"... | 0.71793497 | 0 |
Get the amount of coin in the address passed in. Always returns a single float. | def get_balance(self, crypto, address, confirmations=1):
raise NotImplementedError(
"This service does not support getting address balances. "
"Or rather it has no defined 'get_balance' method."
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBtcInWallet(address):\n btc = 'https://blockchain.info/q/addressbalance/' + address\n check = requests.get(btc)\n value = int((check.content)) / 100000000.0\n return value",
"def get_address_balance(litecoinaddress):\n total_balance = 0\n unspent = list_unspent(litecoinaddress)\n for bloc... | [
"0.7205577",
"0.71354717",
"0.6937523",
"0.68846685",
"0.68304414",
"0.68096286",
"0.6396666",
"0.62455636",
"0.61095047",
"0.6093223",
"0.6065655",
"0.60491633",
"0.6025227",
"0.60169697",
"0.6006699",
"0.6005902",
"0.5985519",
"0.5955521",
"0.59548277",
"0.5950082",
"0.5943... | 0.53218186 | 96 |
Get block based on either block height, block number or get the latest block. Only one of the previous arguments must be passed on. | def get_block(self, crypto, block_height='', block_number='', latest=False):
raise NotImplementedError(
"This service does not support getting getting block data. "
"Or rather it has no defined 'get_block' method."
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_block_at_height(height, headers):\n if height == 0:\n print('retrieving genesis block...')\n return GENESIS_DICTIONARY\n\n else:\n height_bottom = headers[0]['height'] # TODO can pass in height_bottom as an argument to save recompute\n result = hea... | [
"0.72756964",
"0.7181289",
"0.7142906",
"0.6979643",
"0.6786556",
"0.67289954",
"0.6712528",
"0.66829705",
"0.6668895",
"0.6605809",
"0.65997833",
"0.65225774",
"0.6509247",
"0.6488133",
"0.6473838",
"0.64637846",
"0.6461936",
"0.6452231",
"0.6438939",
"0.64360714",
"0.641553... | 0.76772964 | 0 |
A new graph is generated when the user toggles between the Line, Area, and Candlesticks radio buttons. This function deletes the previous graph after the new one is generated. | def remove_old_graphs(self):
widgets = self.winfo_children()
graph_frames = []
for widget in widgets:
if type(widget) == tk.Frame:
graph_frames.append(widget)
for frame in range(len(graph_frames) - 1):
graph_frames[frame].destroy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_graph(self):\n #self.time = 0#\n \n # values of microcontroller\n #if self.graf_t.buffer_info()[1] != 0:\n for a in range(self.graf_t.buffer_info()[1]):\n self.graf_t.pop()\n \n for a in range(self.graf_r.buffer_info()[1]):\n self... | [
"0.6685514",
"0.63651407",
"0.6362829",
"0.6317258",
"0.6301736",
"0.6233415",
"0.6069716",
"0.60677135",
"0.60390854",
"0.60253495",
"0.59355724",
"0.5927729",
"0.592492",
"0.58967906",
"0.58572817",
"0.5855828",
"0.5855741",
"0.58446515",
"0.5837996",
"0.5828073",
"0.582635... | 0.6271218 | 5 |
Drop samples by sample identifiers. | def drop_sample_by_id(
self, ids: AnyGenericIdentifier, **kwargs
) -> Optional[AnyGenericIdentifier]:
target_ids = np.asarray(ids)
if self.xsid.isin(target_ids).sum() == len(target_ids):
return self._remove_samples_by_id(target_ids, **kwargs)
else:
raise Value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_samples_by_id(\n self, ids: AnyGenericIdentifier, **kwargs\n ) -> Optional[AnyGenericIdentifier]:\n tmp_ids = np.asarray(ids, dtype=self.__internal_samples.index.dtype)\n if len(tmp_ids) > 0:\n self.__internal_samples.drop(tmp_ids, inplace=True)\n return self._... | [
"0.74150854",
"0.7046915",
"0.6834506",
"0.6785585",
"0.64242166",
"0.62633795",
"0.62346476",
"0.6174152",
"0.6078232",
"0.6041745",
"0.6000368",
"0.5999657",
"0.59908336",
"0.5947375",
"0.59472364",
"0.5927663",
"0.59003496",
"0.5890255",
"0.5872719",
"0.581554",
"0.5750582... | 0.7465148 | 0 |
Convert a motor step position to absolute mm. | def step2mm(step):
return step / KST101.STEPS_PER_MM | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mm2step(pos):\n return pos * KST101.STEPS_PER_MM",
"def convertDistance(self, mm):\n\t\treturn mm/(self.microstep)",
"def mm_to_m(millimeters):\n return millimeters / 1000.0",
"def m_to_mm(meters):\n return meters * 1000.0",
"def m_to_mm(): \n # Set blender unit in mm\n bpy.cont... | [
"0.6836627",
"0.6787957",
"0.5954462",
"0.58978343",
"0.58848786",
"0.58125484",
"0.5806784",
"0.5804882",
"0.57508826",
"0.57389694",
"0.57245016",
"0.56991845",
"0.5651881",
"0.56379604",
"0.56360954",
"0.5566998",
"0.55438864",
"0.5540775",
"0.55354816",
"0.551437",
"0.549... | 0.69749653 | 0 |
Get the raw status field. | def get_raw_status(self):
self.__param_lock.acquire()
status = self.__status
self.__param_lock.release()
return status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return STATUS[self.fields['status']]",
"def GetStatus(self):\r\n return self.status",
"def _get_status(self):\n return self.__status",
"def _get_status(self):\n return u'%s' % (self.get_status_display())",
"def get_status(self):\n return self.status",
"def g... | [
"0.7672218",
"0.7490699",
"0.748032",
"0.744804",
"0.7430829",
"0.7430829",
"0.7430829",
"0.74069136",
"0.73661876",
"0.7363749",
"0.7335432",
"0.7310167",
"0.72708374",
"0.72313976",
"0.7231174",
"0.72055376",
"0.7177862",
"0.7118792",
"0.7111588",
"0.70912224",
"0.70912224"... | 0.7841977 | 0 |
Returns true if the motor is currently moving. | def is_moving(self):
is_moving = self.get_raw_status() & self.STATUS_MOVING
return bool(is_moving) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_is_moving(self):\r\n return self._arm.get_is_moving()",
"def is_moving(self):\n return self.gripper_io.get_signal_value(\"is_moving\")",
"def is_moving(self):\n return self.steps < self.max_steps",
"def _ismoving(self):\n return self.dp.state()==PyTango.DevState.MOVING",
... | [
"0.8021455",
"0.7990758",
"0.78967416",
"0.7811878",
"0.77514744",
"0.77400964",
"0.76786697",
"0.73820573",
"0.7361447",
"0.72986686",
"0.72636473",
"0.7260419",
"0.7147643",
"0.71316934",
"0.7110344",
"0.6996685",
"0.69554687",
"0.6842992",
"0.6811508",
"0.6785885",
"0.6743... | 0.8182077 | 0 |
Show info about user. | def __repr__(self):
return f"<User_id= {self.user_id} user_name= {self.user_name}>" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_user_info(self):\n name = self.get_user_name()\n print(f'Name: {name.title()}')\n print(f'Age: {self.age}')\n print(f'Gender: {self.gender.title()}')\n print(f'Mobile: {self.m_number}')",
"def show_user_info(user_id):\n\n user = User.query.get_or_404(user_id)\n r... | [
"0.87687427",
"0.799944",
"0.7912591",
"0.78403974",
"0.78403974",
"0.78004324",
"0.77459043",
"0.7667942",
"0.7643837",
"0.7636991",
"0.7602529",
"0.7601002",
"0.7550209",
"0.754345",
"0.75432116",
"0.7477506",
"0.74669594",
"0.7454454",
"0.74496824",
"0.7417272",
"0.7417272... | 0.0 | -1 |
Returns True if each item in seq matches each corresponding item from the current position onward. | def confirm_next(self, seq):
for n, i in enumerate(seq):
try:
if self.items[self.pos + n] != i:
return False
except IndexError:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(self, seq):\n return (len(seq) == 4 and \n self.mScalar == seq[0] and self.mVector[0] == seq[1] and\n self.mVector[1] == seq[2] and self.mVector[2] == seq[3])",
"def all_equal(sequence):\n return all(x == sequence[0] for x in sequence)",
"def __eq__(self, seq... | [
"0.7007871",
"0.7005903",
"0.69616514",
"0.68548906",
"0.67441154",
"0.672275",
"0.66735566",
"0.66549057",
"0.65945804",
"0.6587169",
"0.6583016",
"0.65333325",
"0.6494529",
"0.64806014",
"0.6478558",
"0.6420472",
"0.6414683",
"0.63779235",
"0.63549644",
"0.63287604",
"0.628... | 0.6947311 | 3 |
Testspecific qvalues accessor for the comparison of both sets of groups. | def _qval_pairs(self, idx0, idx1, method="fdr_bh"):
return self._correction_pairs(idx0=idx0, idx1=idx1, method=method) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other: 'MultiChoiceQuestionGroup') -> DataFrame:\n results = {}\n for key in self._item_dict.keys():\n results[key] = self[key] > other[key]\n return DataFrame(results)",
"def __lt__(self, other: 'MultiChoiceQuestionGroup') -> DataFrame:\n return other.__gt... | [
"0.62772256",
"0.6115704",
"0.58211607",
"0.5820011",
"0.58127975",
"0.57256657",
"0.57033193",
"0.56805307",
"0.56415606",
"0.5618301",
"0.56171364",
"0.5555912",
"0.5525421",
"0.5520053",
"0.5510492",
"0.5485959",
"0.54560566",
"0.54541695",
"0.54465777",
"0.54465014",
"0.5... | 0.0 | -1 |
Save path to json. | def save_json(self, data, json_path=None):
if json_path is None:
json_path = self.json_path
with open(json_path, encoding='utf-8', mode='w') as f:
json.dump(data, f, indent=4, ensure_ascii=False)
print(json_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, path):\n if not is_dry():\n with open(path, 'w') as f:\n json.dump(self.to_dict(), f, indent=4)\n return path",
"def save(self, path: str):\n with open(path, 'w', encoding='utf-8') as f:\n f.write(self.to_json())",
"def save(self, json_pa... | [
"0.8444213",
"0.8268647",
"0.79312813",
"0.79311424",
"0.7910115",
"0.7910115",
"0.7910115",
"0.7838634",
"0.7793213",
"0.77437556",
"0.77021885",
"0.7681351",
"0.7650982",
"0.7599761",
"0.75222033",
"0.7377841",
"0.7377841",
"0.7377841",
"0.7326697",
"0.7326697",
"0.7319312"... | 0.8115855 | 2 |
GET request on /roster endpoint. | async def get_roster(
self,
payload: Union[dict, List[dict]],
concurrent_tasks: Optional[int] = 10,
sort: Optional[str] = None,
) -> Union[List[Dict[str, Any]], List[List[Dict[str, Any]]]]:
return await self._get("/roster", payload, concurrent_tasks, sort) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_roster(self, jid: typing.Union[JID, str], **send_kwargs) -> Iq:\n if self.granted_privileges[\"roster\"] not in (\"get\", \"both\"):\n log.error(\"The server did not grant us privileges to get rosters\")\n raise ValueError\n else:\n return await self._ma... | [
"0.72268814",
"0.662058",
"0.6105378",
"0.6005037",
"0.59981555",
"0.5978701",
"0.59154546",
"0.5782593",
"0.5743144",
"0.5709528",
"0.5699877",
"0.5687611",
"0.5644765",
"0.5632288",
"0.5629523",
"0.5617395",
"0.5580365",
"0.5559719",
"0.55595094",
"0.5537139",
"0.55300033",... | 0.6545795 | 2 |
Fills the displacement vectors with imposed and computed values. | def complete_disp(IBC, nodes, UG):
nnodes = nodes.shape[0]
UC = np.zeros([nnodes, 3], dtype=np.float)
for row in range(nnodes):
for col in range(3):
cons = IBC[row, col]
if cons == -1:
UC[row, col] = 0.0
else:
UC[row, col] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_vectors(self):\n # use random numbers for generating plot data:\n random.seed(9) # fix the seed for testing\n for index in range(self.npoints):\n self.vector_x.append(index) # x coordinates\n for y in range(self.ncurves):\n sel... | [
"0.6862203",
"0.6270894",
"0.61910266",
"0.5874732",
"0.5741658",
"0.57296383",
"0.56971866",
"0.5690983",
"0.56731373",
"0.5668631",
"0.56114703",
"0.5599689",
"0.5554304",
"0.5542041",
"0.55314684",
"0.552489",
"0.5515316",
"0.550882",
"0.55070776",
"0.54658276",
"0.5463818... | 0.0 | -1 |
Wraps hidden states in new Tensors, to detach them from their history. | def repackage_hidden(h):
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach_hidden(hidden: Any) -> Any:\n return apply_to_tensor(hidden, Tensor.detach)",
"def reset_hidden(self, hidden, reset_flags):\n # detach it from history (pytorch mechanics)\n if self.rnn_type in ['lstm', 'mylstm']:\n h = Variable(hidden[0].data)\n c = Variable(hidd... | [
"0.6896774",
"0.6564761",
"0.6440056",
"0.63181335",
"0.62956357",
"0.61828166",
"0.61425817",
"0.61264986",
"0.61264986",
"0.6120289",
"0.6029193",
"0.60253143",
"0.6020807",
"0.5987143",
"0.5969475",
"0.5969475",
"0.5932672",
"0.5932672",
"0.591887",
"0.5889544",
"0.5871412... | 0.555539 | 40 |
Indicator that subplot has no layers. | def empty(self):
return len(self.layers) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_arguments(self):\n fig = plt.figure()\n ax = fig.add_subplot(projection='ternary')\n lines = ax.plot()\n assert lines == []",
"def oiDataIsNull(self):\n self.charts_1.getGV().hide()\n self.charts_2.getGV().hide()",
"def isscalar(self):\n return not s... | [
"0.65501446",
"0.62779915",
"0.6195725",
"0.6091727",
"0.60703593",
"0.60156053",
"0.5949347",
"0.5874869",
"0.58582",
"0.5817451",
"0.57758826",
"0.5755941",
"0.57396364",
"0.570806",
"0.5685906",
"0.5680052",
"0.56657314",
"0.5643927",
"0.5640388",
"0.56380016",
"0.56324893... | 0.658061 | 0 |
Get dictionary with default parameters corresponding to given mode. | def get_defaults(cls, mode):
mode_defaults = getattr(cls, f"{mode.upper()}_DEFAULTS")
defaults = PlotConfig({**cls.COMMON_DEFAULTS, **mode_defaults})
return defaults | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDefaultParameterValues(self):\r\n dct = {}\r\n self.initializeRoadRunnerModel()\r\n self.roadrunnerModel.reset()\r\n for parameterName in self.parametersToFit:\r\n dct[parameterName] = self.roadrunnerModel.model[parameterName]\r\n return dct",
"def defaults() ... | [
"0.6622207",
"0.65702045",
"0.6535674",
"0.6516511",
"0.64357203",
"0.64187336",
"0.6382547",
"0.6349992",
"0.6341253",
"0.62935245",
"0.6264641",
"0.6236438",
"0.61953825",
"0.6156402",
"0.6131508",
"0.6121125",
"0.6118047",
"0.60627514",
"0.6037397",
"0.60161936",
"0.599709... | 0.7112436 | 0 |
Append colorbar to the subplot on the right. | def add_colorbar(self, image, width=0.2, pad=None, color='black', position='right', fake=False, **kwargs):
divider = axes_grid1.make_axes_locatable(image.axes)
cax = divider.append_axes(position=position, size=width, pad=pad)
if fake:
cax.set_axis_off()
return None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_colorbar(self, fig, ax, norm, colormap, label=\"\"):\n import matplotlib as mpl\n pos = ax.get_position()\n cpos = [pos.x1 + 0.025, pos.y0 + 0.0125,\n 0.015, pos.height * 0.8] # this list defines (left, bottom, width, height\n cax = fig.add_axes(cp... | [
"0.7491936",
"0.7491936",
"0.73847526",
"0.73757035",
"0.73671067",
"0.7358732",
"0.7303938",
"0.72572565",
"0.7119308",
"0.7072971",
"0.68705446",
"0.6862511",
"0.6758612",
"0.6751871",
"0.6475311",
"0.64403844",
"0.6317786",
"0.62895775",
"0.6274293",
"0.62497246",
"0.62136... | 0.7022516 | 10 |
Validate that data dimensionality is correct for given plot mode. | def parse_array(data, mode):
if data.ndim == 1:
if mode == 'image':
return data.reshape(-1, 1)
if mode == 'curve':
return (range(len(data)), data)
if mode == 'loss':
return (data, None)
if data.ndim == 3:
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_dimensionality(self):\r\n\r\n if self.time.ndim != 1:\r\n raise ValueError(\"time array must be one-dimensional\")\r\n npoints = self.data.shape[-1]\r\n if npoints != len(self.time):\r\n raise ValueError(\"mismatch of time and data dimensions\")",
"def _ch... | [
"0.6658219",
"0.66115004",
"0.6391469",
"0.6341775",
"0.6337157",
"0.6330942",
"0.62742263",
"0.6267604",
"0.6212718",
"0.62105066",
"0.61228627",
"0.61180484",
"0.6103872",
"0.60918903",
"0.60803264",
"0.599353",
"0.59342146",
"0.58855337",
"0.5884172",
"0.58802974",
"0.5843... | 0.0 | -1 |
Get object bounding box in inches. | def get_bbox(self, obj):
renderer = self.figure.canvas.get_renderer()
transformer = self.figure.dpi_scale_trans.inverted()
return obj.get_window_extent(renderer=renderer).transformed(transformer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundingBox(self):\n pmodel = (glm.vec3(1, -self.y_sign, 0)\n * self.model.pos * self.transform.scale)\n x, y, _ = self.transform.pos + pmodel\n y += -self.y_sign * self.font.table['ascent'] * self.transform.scale[1]\n return x, y, self.pixwidth(), self.pixheight()",
... | [
"0.7321456",
"0.7208627",
"0.7094755",
"0.70528084",
"0.70528084",
"0.7015852",
"0.7013305",
"0.6966215",
"0.69601953",
"0.6880392",
"0.6877142",
"0.6863765",
"0.68466276",
"0.67882174",
"0.67840785",
"0.67840785",
"0.67565984",
"0.6751967",
"0.67462975",
"0.6729085",
"0.6721... | 0.73806584 | 0 |
Get dictionary with default parameters corresponding to given mode. | def get_defaults(cls, mode):
mode_defaults = getattr(cls, f"{mode.upper()}_DEFAULTS")
defaults = PlotConfig({**cls.COMMON_DEFAULTS, **mode_defaults})
return defaults | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDefaultParameterValues(self):\r\n dct = {}\r\n self.initializeRoadRunnerModel()\r\n self.roadrunnerModel.reset()\r\n for parameterName in self.parametersToFit:\r\n dct[parameterName] = self.roadrunnerModel.model[parameterName]\r\n return dct",
"def defaults() ... | [
"0.6622207",
"0.65702045",
"0.6535674",
"0.6516511",
"0.64357203",
"0.64187336",
"0.6382547",
"0.6349992",
"0.6341253",
"0.62935245",
"0.6264641",
"0.6236438",
"0.61953825",
"0.6156402",
"0.6131508",
"0.6121125",
"0.6118047",
"0.60627514",
"0.6037397",
"0.60161936",
"0.599709... | 0.7112436 | 1 |
The algorithm property of the JWT, present in the token's header. | def alg(self) -> t.Optional[str]:
return self._alg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def algorithm(self) -> str:\n return self.auth_type.name",
"def key_algorithm(self) -> str:\n return pulumi.get(self, \"key_algorithm\")",
"def algorithm(self) -> str:\n return pulumi.get(self, \"algorithm\")",
"def algorithm(self) -> str:\n return pulumi.get(self, \"algorithm\")"... | [
"0.7788023",
"0.724771",
"0.7117834",
"0.7117834",
"0.6965216",
"0.68153304",
"0.67992514",
"0.67043966",
"0.66818166",
"0.6673668",
"0.6673668",
"0.6673668",
"0.6673668",
"0.6631527",
"0.6631527",
"0.64808285",
"0.6408746",
"0.6167961",
"0.60400337",
"0.60400337",
"0.6030945... | 0.6263383 | 17 |
The header of the JWT. | def header(self) -> dict:
return {"typ": self.typ, "alg": self._alg} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_jwt_header(self):\n if self.jwt_header:\n return self.jwt_header\n self.jwt_header = self.get_jwt_token_from_secret_file(str(self.jwtfile))\n return self.jwt_header",
"def get_authorization_header(self):\n return {\"Authorization\": \"Bearer {}\".format(self.get_jwt... | [
"0.8436427",
"0.79764926",
"0.79137087",
"0.78064805",
"0.77825725",
"0.74781436",
"0.74537694",
"0.7445296",
"0.7445296",
"0.7445296",
"0.7399845",
"0.7382716",
"0.73600197",
"0.73512626",
"0.7339005",
"0.7318806",
"0.72931683",
"0.72931683",
"0.7254742",
"0.72409415",
"0.72... | 0.6993704 | 28 |
The issuer property of the JWT. | def iss(self) -> t.Optional[int]:
return self.claims.get("iss") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issuer(self) -> str:\n return self._issuer",
"def issuer(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"issuer\")",
"def issuer(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"issuer\")",
"def issuer(self) -> pulumi.Input[str]:\n return pulumi.get(s... | [
"0.835587",
"0.80799645",
"0.80615586",
"0.80058664",
"0.7740773",
"0.75403756",
"0.7509347",
"0.7363411",
"0.7363411",
"0.73131746",
"0.7257645",
"0.71792614",
"0.71792614",
"0.7094954",
"0.6783554",
"0.67626977",
"0.6753589",
"0.6716641",
"0.67098683",
"0.66446966",
"0.6644... | 0.6604931 | 21 |
The expiration time property of the JWT. | def exp(self) -> t.Optional[int]:
return self.claims.get("exp") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expiration_time(self) -> str:\n return pulumi.get(self, \"expiration_time\")",
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> str:\n return pulumi... | [
"0.8452978",
"0.8098315",
"0.8098315",
"0.8098315",
"0.7991697",
"0.79220504",
"0.79109377",
"0.78451395",
"0.78079146",
"0.77680236",
"0.77680236",
"0.7696627",
"0.7696627",
"0.7690996",
"0.7578736",
"0.74577767",
"0.7348282",
"0.7184964",
"0.7178381",
"0.713914",
"0.7100190... | 0.63440484 | 58 |
The "issued at" time property of the JWT. | def iat(self) -> t.Optional[int]:
return self.claims.get("iat") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_issued_at(include_issued_at):\n iat = None\n if include_issued_at:\n iat = time.time()\n return iat",
"def token_expiry_date(self):\n return self.__token_expiry_date",
"def expiration_time(self) -> str:\n return pulumi.get(self, \"expiration_time\")",
"d... | [
"0.71110594",
"0.7070343",
"0.69566137",
"0.6796135",
"0.6796135",
"0.6796135",
"0.6706147",
"0.6680635",
"0.6670677",
"0.6574447",
"0.6548008",
"0.6548008",
"0.6548008",
"0.6541552",
"0.6541552",
"0.6527178",
"0.6495312",
"0.6495312",
"0.64618343",
"0.64618343",
"0.64618343"... | 0.6616375 | 9 |
The max age property of the JWT. | def max_age(self) -> t.Optional[int]:
if not self.iat or not self.exp:
return None
return self.exp - self.iat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_age(self):\n return self._max_age",
"def max_age(self):\n return self._max_age",
"def max_age(self) -> typing.Optional[jsii.Number]:\n return self._values.get('max_age')",
"def max_age(self):\n\n return self._max_age",
"def max_age(self) -> Optional[pulumi.Input[int]]:\n... | [
"0.84404695",
"0.84404695",
"0.8376547",
"0.83404607",
"0.7991144",
"0.7862956",
"0.7787322",
"0.75152975",
"0.7384729",
"0.73049575",
"0.7296827",
"0.7287585",
"0.72140723",
"0.7051064",
"0.70335853",
"0.7006728",
"0.7004616",
"0.69854665",
"0.6965686",
"0.6965686",
"0.69656... | 0.7772079 | 7 |
Returns whether this JWT has been signed. | def is_signed(self) -> bool:
return self.signed is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid(self):\n return self.is_signed and not self.is_expired",
"def authenticated(self):\n return self.token is not None",
"def is_authenticated(self):\n return bool(get_auth_token())",
"def check(self, request, consumer, token, signature):\r\n built = self.sign(request, co... | [
"0.67773134",
"0.67657745",
"0.67343867",
"0.66329306",
"0.6559227",
"0.6557845",
"0.64588183",
"0.6397874",
"0.6384703",
"0.6366098",
"0.6342457",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649",
"0.6337649"... | 0.74498427 | 0 |
Change the active device to the specified id. | def set_device(num):
safe_call(backend.get().af_set_device(num)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_partially_update_device_by_id(self):\n pass",
"def test_update_device_by_id(self):\n pass",
"def script_set_device(self,udid=None):\n self.desired_caps['udid'] = udid;",
"def device_id(self, device_id):\n\n self._device_id = device_id",
"def device_id(self, device_id):\... | [
"0.64794147",
"0.64731795",
"0.64723504",
"0.6425086",
"0.6425086",
"0.6111617",
"0.61042994",
"0.60775876",
"0.602966",
"0.5991812",
"0.5934229",
"0.5890665",
"0.5784412",
"0.57452834",
"0.5743974",
"0.57170796",
"0.56902623",
"0.56617516",
"0.5649953",
"0.5649953",
"0.56499... | 0.6061122 | 8 |
Get the raw device pointer of an array | def get_device_ptr(a):
ptr = ct.c_void_p(0)
safe_call(backend.get().af_get_device_ptr(ct.pointer(ptr), a.arr))
return ptr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device():\n c_dev = ct.c_int(0)\n safe_call(backend.get().af_get_device(ct.pointer(c_dev)))\n return c_dev.value",
"def dataPointer( cls, instance ):\n try:\n return long(instance.__array_interface__['data'][0])\n except AttributeError:\n insta... | [
"0.6149462",
"0.6083934",
"0.60753775",
"0.6059077",
"0.6059077",
"0.6059077",
"0.6059077",
"0.6059077",
"0.6051239",
"0.60167783",
"0.59694695",
"0.5934218",
"0.5870799",
"0.57828134",
"0.5776091",
"0.5770843",
"0.57103986",
"0.5691612",
"0.5680142",
"0.564842",
"0.5645468",... | 0.7616781 | 0 |
checks if user has access to protected data | def isSuper(self):
user = self.getSession()
return self.pipe.auth.isSuper(user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user_has_access(self):\n return self.user_has_access(users.get_current_user())",
"def is_access_allowed(self, user_id):\n ### DATABASE CODE GOES HERE\n return False",
"def has_access(self, user):\n if user.is_superuser:\n return True\n return self.user_obje... | [
"0.77658725",
"0.77231264",
"0.7512203",
"0.74774003",
"0.7345427",
"0.7301951",
"0.72769403",
"0.72682554",
"0.72673184",
"0.72673184",
"0.7262562",
"0.72251576",
"0.7220765",
"0.71790546",
"0.7166986",
"0.714387",
"0.7058735",
"0.7046586",
"0.7046586",
"0.7046586",
"0.70446... | 0.0 | -1 |
If this request connected to the database, close the connection. | def close_db(e=None):
db = g.pop('db', None)
if db is not None:
db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection(self):\n if self.cursor is None and self.database is None:\n # if we don't have an open connection, do nothing\n return\n self.cursor.close()\n self.database.close()",
"def close_connection(self):\r\n if self.conn:\r\n self.conn.cl... | [
"0.7909081",
"0.78437674",
"0.77779657",
"0.77692723",
"0.77130044",
"0.7696115",
"0.76471436",
"0.7638434",
"0.76133895",
"0.76087016",
"0.7602806",
"0.7589563",
"0.7583817",
"0.75653946",
"0.7535055",
"0.75241536",
"0.75241536",
"0.75223124",
"0.7520047",
"0.75128347",
"0.7... | 0.0 | -1 |
Only set friend shared each other | def ReorganizeFriendList(self):
with sqlite3.connect(self.DBname) as conn:
c = conn.cursor()
c.execute("select ZID, FRIENDS from user_info")
user_list = c.fetchall()
for user, friends in user_list:
out = set()
friends = [x.strip() f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_requested_friends_asymmetrical(self):\n u = AppUser(id = 1)\n u.django_user = User.objects.create(username='Testuser')\n u.save()\n f = AppUser(id = 2)\n f.django_user = User.objects.create(username='Testuser2')\n f.save()\n \n f.requested_friends.ad... | [
"0.6349015",
"0.6242519",
"0.6191666",
"0.6125471",
"0.60922015",
"0.6055634",
"0.6042841",
"0.59734774",
"0.5909863",
"0.58413565",
"0.5804734",
"0.5765589",
"0.57583666",
"0.5683953",
"0.5657898",
"0.55813086",
"0.55286247",
"0.5477948",
"0.5470345",
"0.5440596",
"0.5440596... | 0.50130594 | 48 |
Determine whether 2digit numbers num and den share a nonzero digit | def share_nonzero_digit(num, den):
num_str = str(num)
den_str = str(den)
if "0" in num_str and "0" in den_str:
return False
return num_str[0] in den_str or num_str[1] in den_str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exactly_two_same_digits(num):\n output = False\n digits = [int(i) for i in str(num)]\n for i, dig in enumerate(digits[:-2]):\n if i == 0:\n if dig == digits[i + 1] and dig != digits[i + 2]:\n output = True\n else:\n if (dig != digits[i - 1] \n ... | [
"0.66573215",
"0.6440557",
"0.63306004",
"0.6274526",
"0.6208678",
"0.6078219",
"0.60541683",
"0.5835755",
"0.5834841",
"0.57886094",
"0.57733285",
"0.57666516",
"0.5715078",
"0.5679442",
"0.56535006",
"0.56464976",
"0.5630134",
"0.5628537",
"0.562554",
"0.5621497",
"0.560313... | 0.86455107 | 0 |
For two 2digit numbers num and den sharing a nonzero digit, determines whether these digits can cancel and maintain the value of num/den | def can_cancel(num, den):
num_str = str(num)
den_str = str(den)
if num_str[0] == den_str[0] and den_str[1] != "0":
return num / den == int(num_str[1]) / int(den_str[1])
elif num_str[0] == den_str[1] and den_str[0] != "0":
return num / den == int(num_str[1]) / int(den_str[0])
elif num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def share_nonzero_digit(num, den):\n num_str = str(num)\n den_str = str(den)\n if \"0\" in num_str and \"0\" in den_str:\n return False\n return num_str[0] in den_str or num_str[1] in den_str",
"def meets_criteria2(num):\n output = True\n if not exactly_two_same_digits(num):\n out... | [
"0.7365665",
"0.6274122",
"0.5855416",
"0.5721313",
"0.5691259",
"0.5678599",
"0.5591612",
"0.5562553",
"0.5546962",
"0.55303293",
"0.5479697",
"0.54369766",
"0.5415545",
"0.5414511",
"0.53287137",
"0.5327776",
"0.5327163",
"0.53035915",
"0.5295303",
"0.5291806",
"0.52812845"... | 0.80766606 | 0 |
Set the selected pin to the specified value. | async def analog_write(self, pin, value):
if PrivateConstants.ANALOG_MESSAGE + pin < 0xf0:
command = [PrivateConstants.ANALOG_MESSAGE + pin, value & 0x7f,
(value >> 7) & 0x7f]
await self._send_command(command)
else:
await self.extended_analog(pi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Set(self,value):\n self.Bus.Write_uInt8(self.Address,0x50+self.Pin,value)",
"def light_set(self, pin='D13', value='0'):\n self.bridge.put(str(pin), str(value))",
"def setValue(self,selected):\n self['input'].setValue(selected)",
"def set_pin(self, pin):\n if pin not in range(0... | [
"0.7193859",
"0.70859087",
"0.7048325",
"0.6868551",
"0.68374014",
"0.66054875",
"0.6522551",
"0.64153075",
"0.6409337",
"0.6404513",
"0.6392403",
"0.63905966",
"0.63905966",
"0.63905966",
"0.63816094",
"0.63649386",
"0.6356947",
"0.6335871",
"0.631347",
"0.63113594",
"0.6289... | 0.0 | -1 |
Number of nodes in the tree. | def nbr_nodes(tree_depth):
return 2**(tree_depth+1)-1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self):\n return self.__tree.node_count",
"def numNodes(self):\n res = 0\n for n in self.iternodes():\n res += 1\n return res",
"def number_of_nodes(self):\n return int(self._data['number_of_nodes'])",
"def node_count(self):\n return self._root.co... | [
"0.87771",
"0.876103",
"0.87113464",
"0.8688446",
"0.8679165",
"0.8642875",
"0.85500014",
"0.85063654",
"0.8487128",
"0.8469054",
"0.84642124",
"0.84633803",
"0.8463188",
"0.84412813",
"0.84390837",
"0.84262526",
"0.8424474",
"0.8424474",
"0.83696264",
"0.8285416",
"0.8208172... | 0.80256987 | 29 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
print... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81920755",
"0.8093736",
"0.8028212",
"0.8017333",
"0.79923165",
"0.7989431",
"0.79789335",
"0.7974398",
"0.795948",
"0.79555666",
"0.7935652",
"0.7932704",
"0.7932632",
"0.7929465",
"0.7924336",
"0.7922666",
"0.79221356",
"0.7921299",
"0.79209703",
"0.7920307",
"0.7916008"... | 0.7898432 | 27 |
Gets list of supported targets | def targets():
return [
# C++
CppDistribTest("linux", "x64", "debian10", "cmake", presubmit=True),
CppDistribTest(
"linux", "x64", "debian10", "cmake_as_submodule", presubmit=True
),
CppDistribTest(
"linux",
"x64",
"debian10",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targets(self): # type: () -> t.List[HostConfig]\n return self.host_settings.targets",
"def Targets(self):\n return self._targets",
"def targets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['PlanTargetsArgs']]]]:\n return pulumi.get(self, \"targets\")",
"def GetTargets(self):... | [
"0.72934294",
"0.7170951",
"0.70300204",
"0.69690996",
"0.68751216",
"0.66563004",
"0.6650485",
"0.66132474",
"0.6546181",
"0.65401113",
"0.6532755",
"0.65121025",
"0.6491082",
"0.64473706",
"0.64282554",
"0.6410013",
"0.63991743",
"0.63772464",
"0.6374726",
"0.63458115",
"0.... | 0.57538307 | 58 |
Return whether GridPegSoltairePuzzle self is equivalent to other. | def __eq__(self, other):
return (type(other) == type(self) and
self._marker == other._marker and self._marker_set == other._marker_set) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n for i in range(len(self.puzzle)):\n for j in range(len(self.puzzle[0])):\n if(self.puzzle[i][j] != other.puzzle[i][j]):\n return False\n return True",
"def __eq__(self, other):\n return np.all(self.grid == other.grid) an... | [
"0.77467674",
"0.72473675",
"0.7091989",
"0.7090356",
"0.7059059",
"0.7032807",
"0.7032807",
"0.70283085",
"0.70041233",
"0.695015",
"0.6942698",
"0.6874389",
"0.68624955",
"0.6795316",
"0.67761964",
"0.677543",
"0.676424",
"0.676424",
"0.676424",
"0.6762798",
"0.6761212",
... | 0.0 | -1 |
Return True if the current Puzzle configuration is solved, False otherwise. | def is_solved(self):
marker = self._marker
count = 0
for row in marker:
for piece in row:
if piece == "*":
count += 1
if count == 1:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_solution(self) -> bool:\n if self in [self.SATISFIED, self.ALL_SOLUTIONS, self.OPTIMAL_SOLUTION]:\n return True\n return False",
"def has_solution(self) -> bool:\n pass",
"def is_solution(self):\n # Only need to check the length because the configuration expansion ass... | [
"0.8056841",
"0.7820166",
"0.7622578",
"0.74919087",
"0.72833914",
"0.7133834",
"0.7041643",
"0.7030809",
"0.69712925",
"0.69409835",
"0.69181734",
"0.6907065",
"0.68737966",
"0.6844877",
"0.6832382",
"0.6808089",
"0.6780048",
"0.6780048",
"0.6780048",
"0.6772169",
"0.6755689... | 0.577148 | 77 |
An index generated by pd.date_range has the expected spacing. | def test_timestamp_spacing_date_range(times):
assert_series_equal(
time.spacing(times, times.freq),
pd.Series(True, index=times)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sparse_index(self):\n freq = 'MS'\n index = pd.date_range(start=\"2000-1-1\", freq=\"B\", periods=1000)\n tl = formatter.TimestampLocator(plot_index, freq=freq)\n test = tl._process(0, 900)\n new_ind = index[test]\n assert np.all(new_ind.day < 5)\n\n freq =... | [
"0.594955",
"0.57676065",
"0.57454824",
"0.56609684",
"0.5629476",
"0.5626083",
"0.55236256",
"0.5503637",
"0.5435363",
"0.54065204",
"0.5398519",
"0.5369331",
"0.5366041",
"0.5346253",
"0.5321032",
"0.5305558",
"0.5295049",
"0.5264819",
"0.5261607",
"0.526003",
"0.52450097",... | 0.66547287 | 0 |
The timestamp following a missing timestamp will be marked False. | def test_timestamp_spacing_one_missing(times):
assert_series_equal(
time.spacing(times[[0, 2, 3]], times.freq),
pd.Series([True, False, True], index=times[[0, 2, 3]])
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_timestamp(self):\n return (self.data_type() & 0x100 == 0x100) and (self.raw_data_length() >= 8)",
"def _check_timestamp(self, timestamp):\n if timestamp is None:\n return True\n if not isinstance(timestamp, float):\n return False\n\n # is it sufficiently ... | [
"0.7021854",
"0.66847306",
"0.6541325",
"0.6368851",
"0.6344318",
"0.63075995",
"0.6265858",
"0.62603235",
"0.6252339",
"0.6240467",
"0.61980355",
"0.6196868",
"0.6191898",
"0.6170375",
"0.6160861",
"0.6144225",
"0.61175257",
"0.6069309",
"0.603114",
"0.60243654",
"0.6023172"... | 0.6139558 | 16 |
Every day shifted 1 hour later yields a series with shift of 60 for each day. | def test_shift_ruptures_positive_shift(midday):
shifted = _shift_between(
midday, 60,
start='2020-01-01',
end='2020-02-29'
)
expected_shift_mask = pd.Series(False, index=midday.index)
expected_shift_mask['2020-01-01':'2020-02-29'] = True
shift_mask, shift_amounts = time.shift... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clock_time(self):\n return self._shifted_time % (24*3600)",
"def leftshift_series(series):\n leftshifted_x = [(series.index[idx] - series.index[0]).days for idx in range(len(series.index))]\n return pd.Series(data=series.values, index=leftshifted_x)",
"def _impute_border_hours(self, temp):\n ... | [
"0.57503337",
"0.56835794",
"0.56729597",
"0.56554955",
"0.5636705",
"0.5479708",
"0.53868276",
"0.5313823",
"0.53083855",
"0.52954924",
"0.5258472",
"0.52422124",
"0.5221235",
"0.51568735",
"0.5085136",
"0.5058662",
"0.5041355",
"0.5035909",
"0.50331247",
"0.5031881",
"0.498... | 0.49100053 | 28 |
Check if the ROUTE distance between two points is bigger than "distance" | def is_distance_ahead(point_a, point_b, distance):
global world
_, route = interpolate_trajectory(world, [point_a.location, point_b.location])
return distance < estimate_route_distance(route) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_closeby(self, lat1, lon1, lat2, lon2, distance=0.5):\n\n distance = geopy.distance.distance((lat1, lon1), (lat2, lon2)).km < distance\t \n \n return(distance)",
"def distance_checker(xyz1, xyz2):\n return math.sqrt((xyz1[0] - xyz2[0])**2 + (xyz1[1] - xyz2[1])**2 +\n ... | [
"0.71559966",
"0.7049637",
"0.67982703",
"0.6675229",
"0.66263634",
"0.6581571",
"0.65747935",
"0.6574042",
"0.6527007",
"0.6495636",
"0.6478092",
"0.6452156",
"0.64212453",
"0.64027286",
"0.6394226",
"0.63671064",
"0.6354219",
"0.63526696",
"0.63488084",
"0.6269557",
"0.6264... | 0.68502766 | 2 |
Check if the ROUTE distance between two points is bigger than "distance" | def is_straight_ahead(point_a, point_b, distance):
_, route_initial = interpolate_trajectory(world, [point_a.location, point_b.location])
if estimate_route_distance(route_initial) < distance or \
estimate_route_distance(route_initial) > 3*distance:
print ("Rejected because it is too small")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_closeby(self, lat1, lon1, lat2, lon2, distance=0.5):\n\n distance = geopy.distance.distance((lat1, lon1), (lat2, lon2)).km < distance\t \n \n return(distance)",
"def distance_checker(xyz1, xyz2):\n return math.sqrt((xyz1[0] - xyz2[0])**2 + (xyz1[1] - xyz2[1])**2 +\n ... | [
"0.7156624",
"0.70515615",
"0.685148",
"0.67991465",
"0.66268826",
"0.6582166",
"0.65753245",
"0.65724915",
"0.6525669",
"0.6497752",
"0.6476741",
"0.6453214",
"0.6422529",
"0.64047444",
"0.6396985",
"0.6369356",
"0.63562405",
"0.6356098",
"0.63490796",
"0.62721014",
"0.62680... | 0.6675838 | 4 |
Check if the ROUTE distance between two points is bigger than "distance" | def is_one_turn_ahead(point_a, point_b, distance):
_, route_initial = interpolate_trajectory(world, [point_a.location, point_b.location])
if estimate_route_distance(route_initial) < distance or \
estimate_route_distance(route_initial) > 3*distance:
print ("Rejected because it is too small")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_closeby(self, lat1, lon1, lat2, lon2, distance=0.5):\n\n distance = geopy.distance.distance((lat1, lon1), (lat2, lon2)).km < distance\t \n \n return(distance)",
"def distance_checker(xyz1, xyz2):\n return math.sqrt((xyz1[0] - xyz2[0])**2 + (xyz1[1] - xyz2[1])**2 +\n ... | [
"0.7155734",
"0.7050317",
"0.68512577",
"0.67986465",
"0.66771615",
"0.66252226",
"0.65809566",
"0.657341",
"0.6526702",
"0.64965945",
"0.6478163",
"0.645426",
"0.6421344",
"0.6403816",
"0.6395753",
"0.63677984",
"0.6354648",
"0.6354611",
"0.6347117",
"0.62711185",
"0.6266364... | 0.6576399 | 7 |
Test error in registration of user e.g user already exists | def test_user_exists_error(self):
user = {
'username': 'chris',
'email': 'mainachris@gmail.com',
'password': 'password123',
'confirm-password': 'password123'
}
res = self.app.post('/register', data=user)
self.assertEqual(res.status_code, 20... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_registration_when_user_already_exists(self):\n # register the user the first time\n self.register_user()\n # register the same user the second time\n result = self.client().post(AuthTestCase.registration, data=self.user)\n response_result = json.loads(result.data.decode(... | [
"0.83140033",
"0.82111377",
"0.7915327",
"0.78639746",
"0.78182834",
"0.7794197",
"0.77612704",
"0.76888245",
"0.76729584",
"0.7583401",
"0.7566561",
"0.7556901",
"0.7513701",
"0.74555695",
"0.74524283",
"0.74242926",
"0.73865944",
"0.7369721",
"0.73225236",
"0.7264133",
"0.7... | 0.76722425 | 9 |
Test is shoppingitems page is accessible | def test_shoppingitems_page(self):
# register and login a user
self.app.post('/register', data=self.user_reg_details)
self.app.post('/login', data=self.user_login_details)
# send a GET request
res = self.app.get('/shoppingitems/Easter')
self.assertEqual(res.status_code, 2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_shoppinglist_page(self):\n # register and login a user\n self.app.post('/register', data=self.user_reg_details)\n self.app.post('/login', data=self.user_login_details)\n # send a GET request\n res = self.app.get('/shoppinglist')\n self.assertEqual(res.status_code,... | [
"0.7563833",
"0.70784",
"0.6995761",
"0.6849791",
"0.6800137",
"0.6797828",
"0.67814416",
"0.6730364",
"0.6657221",
"0.663558",
"0.6627246",
"0.6626104",
"0.6626104",
"0.66007507",
"0.6593794",
"0.6593091",
"0.6576001",
"0.655483",
"0.6417026",
"0.63924617",
"0.6383639",
"0... | 0.77414215 | 0 |
Test is shoppingitems creation with special characters raises an error | def test_shoppingitems_creation_with_error(self):
# register and login a user
self.app.post('/register', data=self.user_reg_details)
self.app.post('/login', data=self.user_login_details)
# create a shopping list
self.shopping_class_obj.create_list(
'Easter', 'maina@gm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_shoppinglist_creation_with_error(self):\n res = self.app.post(\n '/shoppinglist', data={'name': 'Easter!'})\n self.assertEqual(res.status_code, 200)\n response = self.shopping_class_obj.create_list(\n 'Easter!', 'maina@gmail.com')\n self.assertIn(\"No spec... | [
"0.75265205",
"0.74732584",
"0.69962466",
"0.69336724",
"0.685219",
"0.67232794",
"0.6677641",
"0.65856296",
"0.6506702",
"0.64734185",
"0.64224136",
"0.63782465",
"0.6328122",
"0.6280224",
"0.62284166",
"0.62242836",
"0.6160709",
"0.6154644",
"0.6150757",
"0.61482954",
"0.61... | 0.785362 | 0 |
Add an edge to a graph or subgraph | def add_edge(graph, tail_node, head_node, label="[0%]", style="solid, bold", color="black", constraint="true"):
edge = Edge(tail_node, head_node, label=label, style=style, color=color, constraint="true")
graph.add_edge(edge)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, edge):\n self[edge[0]][edge[1]] = edge\n self[edge[1]][edge[0]] = edge",
"def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_destination()\n #weightEdge = WeightedEdge(src, dest, edge.get_total_distance(), edge.get_outdoor_distance())\n ... | [
"0.8393084",
"0.82283896",
"0.8201113",
"0.8199258",
"0.81298053",
"0.812428",
"0.81159806",
"0.8096995",
"0.80484855",
"0.8039142",
"0.802469",
"0.7985509",
"0.79755217",
"0.7939436",
"0.793937",
"0.790578",
"0.7882143",
"0.7845602",
"0.782705",
"0.78174055",
"0.7800455",
... | 0.0 | -1 |
Get the bb of a node_name | def get_bb(node_name):
return int(re.search(r'\d+', re.search(r'block_\d+', node_name).group()).group()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BB ( self ) :\n return self.__bb",
"def BB ( self ) :\n return self.__bb",
"def get_bb(self,bbname, mol = False):\n lines = self.mfp.get_bb(bbname)\n return lines",
"def update_node_name(node_name, bb):\n node_number = int(re.search(r'\\d+', re.search(r'block_\\d+', node_na... | [
"0.66499287",
"0.66499287",
"0.6578319",
"0.581693",
"0.581363",
"0.5779847",
"0.55945545",
"0.5552834",
"0.5506352",
"0.55034417",
"0.54981905",
"0.5404942",
"0.5396745",
"0.5337385",
"0.5336068",
"0.5300939",
"0.52775645",
"0.5273038",
"0.5228449",
"0.521782",
"0.521583",
... | 0.77513236 | 0 |
Generate a polar tth corr map directly for all panels | def polar_tth_corr_map_rygg_pinhole(tth, eta, instrument, absorption_length,
pinhole_thickness, pinhole_radius,
num_phi_elements=60):
panels = list(instrument.detectors.values())
return calc_tth_rygg_pinhole(panels, absorption_length, tth, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correlation_map(self,property_list):\n\t\tself.property_existence(property_list)\n\n\t\tfig, ax = plt.subplots()\n\t\tcorr = self.df[property_list].corr()\n\t\tsns.heatmap(corr, mask=np.zeros_like(corr, dtype=np.bool), cmap=sns.diverging_palette(220, 10, \n\t\t\tas_cmap=True), annot=True, ax=ax)\n\t\tfig.tight... | [
"0.6007513",
"0.5876065",
"0.5769552",
"0.57296973",
"0.57121176",
"0.56763726",
"0.5667984",
"0.564799",
"0.55785215",
"0.55728304",
"0.55616057",
"0.5536332",
"0.55219084",
"0.54839826",
"0.54424584",
"0.54251313",
"0.5423645",
"0.54188794",
"0.54133356",
"0.5410115",
"0.54... | 0.62137616 | 0 |
Creates a course with 3 orphan modules, one of which has a child that's also in the course tree. | def create_course_with_orphans(self, default_store):
course = CourseFactory.create(default_store=default_store)
# create chapters and add them to course tree
chapter1 = self.store.create_child(self.user.id, course.location, 'chapter', "Chapter1")
self.store.publish(chapter1.location, se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_course(self):\r\n super(TestOrphan, self)._create_course()\r\n\r\n self._create_item('chapter', 'Chapter1', {}, {'display_name': 'Chapter 1'}, 'course', 'runid')\r\n self._create_item('chapter', 'Chapter2', {}, {'display_name': 'Chapter 2'}, 'course', 'runid')\r\n self._crea... | [
"0.68607956",
"0.6608762",
"0.6544574",
"0.64357287",
"0.6068295",
"0.6061504",
"0.5966545",
"0.5892435",
"0.5871874",
"0.5817131",
"0.57982886",
"0.5791605",
"0.5782526",
"0.5780918",
"0.5668452",
"0.56496084",
"0.55987984",
"0.55903774",
"0.55850106",
"0.5564612",
"0.555590... | 0.6869201 | 0 |
Asserts that we have the expected count of orphans for a given course_key | def assertOrphanCount(self, course_key, number):
self.assertEqual(len(self.store.get_orphans(course_key)), number) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_split_orphan(self):\r\n orphans = self.split_mongo.get_orphans(self.split_course_key)\r\n self.assertEqual(len(orphans), 3, \"Wrong # {}\".format(orphans))\r\n location = self.split_course_key.make_usage_key('chapter', 'OrphanChapter')\r\n self.assertIn(location, orphans)\r\n ... | [
"0.6290156",
"0.608903",
"0.5951875",
"0.554769",
"0.554297",
"0.5534803",
"0.5441433",
"0.54222894",
"0.53685665",
"0.5353749",
"0.5353749",
"0.5326985",
"0.52949494",
"0.5293539",
"0.52470016",
"0.52079386",
"0.5205678",
"0.51956",
"0.51882374",
"0.51851887",
"0.5149998",
... | 0.8105335 | 0 |
Test that auth restricts get and delete appropriately | def test_not_permitted(self, default_store):
course = self.create_course_with_orphans(default_store)
orphan_url = reverse_course_url('orphan_handler', course.id)
test_user_client, test_user = self.create_non_staff_authed_user_client()
CourseEnrollment.enroll(test_user, course.id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unauthenticated_get(self):\n url = reverse('edit-list')\n\n response = self.client.get(url)\n self.assertEqual(403, response.status_code)\n self.assertEqual('Forbidden', response.status_text)\n self.assertTrue(\n 'credentials were not provided.' in response.da... | [
"0.75319856",
"0.7424455",
"0.73408103",
"0.7208054",
"0.7112452",
"0.70674604",
"0.70493424",
"0.7007222",
"0.6995473",
"0.6993244",
"0.69699675",
"0.69343144",
"0.6933057",
"0.69326437",
"0.6920444",
"0.6877365",
"0.687599",
"0.6850054",
"0.68386906",
"0.6830981",
"0.682741... | 0.0 | -1 |
Returns the name of this format model. | def getName(self) -> unicode:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n return self._name(self.model).decode(\"utf-8\")",
"def name(self) -> str:\n return self._model.name",
"def getName(self):\n return _libsbml.Model_getName(self)",
"def getName(self):\n return _libsbml.ModelCreator_getName(self)",
"def model_name(self) -> ... | [
"0.83283556",
"0.82092303",
"0.8112546",
"0.8056994",
"0.7982692",
"0.7910697",
"0.7873992",
"0.7844478",
"0.782266",
"0.7734807",
"0.75381947",
"0.752336",
"0.7502532",
"0.7502187",
"0.74671507",
"0.7458952",
"0.7458952",
"0.7458952",
"0.7458153",
"0.74411404",
"0.74411404",... | 0.0 | -1 |
Returns the number of rows in the model. | def getNumRows(self) -> int:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_rows(self):\n return self._num_rows",
"def row_count(self) -> int:\n return len(self.rows)",
"def row_count(self) -> int:\n return len(self.rows)",
"def num_rows(self):\n return len(self.rows)",
"def row_count(self):\n return self.__row_count",
"def num_rows... | [
"0.85382944",
"0.84325254",
"0.84325254",
"0.83518374",
"0.8345603",
"0.8314205",
"0.82892334",
"0.8265968",
"0.8252321",
"0.82438457",
"0.8191325",
"0.81005234",
"0.8068524",
"0.8025643",
"0.802367",
"0.7993545",
"0.78939414",
"0.78501284",
"0.78151244",
"0.77863514",
"0.773... | 0.84989536 | 1 |
Returns a list of unused valid fields for this model a list of unused valid fields for this model | def getUnusedFactories(self) -> List[ghidra.app.util.viewer.field.FieldFactory]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_empty_fields(self):\n return [f for f in self.__dict__ if not self.__dict__[f]]",
"def get_empty_required_fields(self):\n empty_fields = self.get_empty_fields()\n return [f for f in empty_fields if f in self.REQUIRED_FIELDS]",
"def non_state_fields(self):\n field_names = set... | [
"0.7349878",
"0.71116936",
"0.6933336",
"0.6869725",
"0.65557534",
"0.65378433",
"0.64126915",
"0.6377505",
"0.63303965",
"0.63166696",
"0.6255121",
"0.62054867",
"0.6173498",
"0.6118625",
"0.6111624",
"0.6110761",
"0.6106005",
"0.60930705",
"0.60926163",
"0.6092295",
"0.6057... | 0.6034354 | 22 |
Returns the width of this model | def getWidth(self) -> int:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_width ( self ):\n return self.width",
"def get_width(self):\n return self.width",
"def width(cls):\n return cls._width",
"def width(self):\n return self.__width",
"def width(self):\n return self.__width",
"def width(self):\n return self.__width",
"def w... | [
"0.85976875",
"0.8570635",
"0.8530061",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8508681",
"0.8502479",
"0.8459751",
"0.84591776",
"0.84591776",
"0.84591776",
"0.8457638",... | 0.7756753 | 98 |
Sets the base id for this model. Each row in a model gets an id which must be unique across all models. id the base id for this format. | def setBaseRowID(self, id: int) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\n self.id = id_",
"def set_id(self, id_):\n\n self.id_ = id_",
"def setID(self, id):\... | [
"0.6845537",
"0.68056786",
"0.67752975",
"0.6616676",
"0.6573813",
"0.655814",
"0.6558015",
"0.6530799",
"0.6508139",
"0.6508139",
"0.6508139",
"0.6508139",
"0.6508139",
"0.64869297",
"0.64869297",
"0.64869297",
"0.6480976",
"0.6470111",
"0.6470111",
"0.6470111",
"0.6470111",... | 0.7768307 | 0 |
Initializes the "head" of the LinkedList. | def __init__(self):
self.head = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, head=None):\n\n self.head = head",
"def __init__(self):\n try:\n self.head=None\n\n except Exception as error:\n print (f\"There is error in __init__ of LinkedList, the error {error}\")",
"def __init__(self, head=None):\r\n self.head = head",... | [
"0.7965818",
"0.790706",
"0.787146",
"0.77850586",
"0.77850586",
"0.77850586",
"0.77850586",
"0.77311087",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"0.76762205",
"... | 0.77008694 | 10 |
Inserts at the start of the LinkedList. | def insert_start(self, data):
if self.head is None:
self.head = ListNode(data)
else:
temp = self.head
self.head = ListNode(data)
self.head.next = temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _first_insert(self, e):\n self._start = self._Node(e, None, None)\n self._start._prev = self._start\n self._start._next = self._start\n self._size += 1",
"def insert_first(self, item):\n if self.is_empty():\n self._first = item\n self._rest = LinkedListRec([None])\n ... | [
"0.7641221",
"0.7611075",
"0.74270654",
"0.7361757",
"0.72824967",
"0.72736365",
"0.72346425",
"0.7151362",
"0.7131744",
"0.7113231",
"0.70936376",
"0.70571244",
"0.6987067",
"0.69847274",
"0.69678026",
"0.69668454",
"0.69642395",
"0.69482046",
"0.69171953",
"0.6913917",
"0.6... | 0.81024736 | 0 |
Inserts at the end of the LinkedList. | def insert_end(self, data):
if self.head is None:
self.head = ListNode(data)
else:
temp = self.head
while temp.next is not None:
temp = temp.next
temp.next = ListNode(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insertAfter(self,p,e):\r\n \r\n if p == self.tail: #if p is the tail node\r\n e.prev = p #link e to p\r\n p.next = e #link p to e\r\n self.tail = e #set e to be the 'new' tail node\r\n \r\n else:\r\n e.next = p.next #link e to next nod... | [
"0.7420986",
"0.72702175",
"0.71244717",
"0.7027539",
"0.6993729",
"0.69688106",
"0.69421405",
"0.6920485",
"0.6872743",
"0.6851306",
"0.6816791",
"0.67921424",
"0.6716298",
"0.66644937",
"0.66349274",
"0.6625815",
"0.66023135",
"0.6585094",
"0.65703344",
"0.65688545",
"0.652... | 0.7885683 | 0 |
Formatted string representation of the LinkedList. | def __str__(self):
result = ""
temp = self.head
while temp is not None:
result += str(temp.data) + " -> "
temp = temp.next
return result[0:-4] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"LinkedList([{}],{}/{})\".format(self.cur_node, self.cur_pos, self.length)",
"def __str__(self):\n reprStr = ''\n currNode = self.head\n while currNode:\n reprStr = reprStr + str(currNode.count) + ' ' + str(currNode.data) + '\\n'\n c... | [
"0.78330487",
"0.7736664",
"0.7709272",
"0.7617314",
"0.7617314",
"0.75514346",
"0.75399464",
"0.7514752",
"0.7483276",
"0.74713516",
"0.74674237",
"0.74573004",
"0.74351996",
"0.7422269",
"0.73398143",
"0.7318582",
"0.7285701",
"0.7266567",
"0.7252506",
"0.72502023",
"0.7218... | 0.7222265 | 20 |
Gets the id of this CreateCcRuleResponse. Rule ID. | def id(self):
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule_id(self) -> str:\n return pulumi.get(self, \"rule_id\")",
"def getId(self):\n return _libsbml.Rule_getId(self)",
"def get_rule_id(self):\n from .osid_errors import IllegalState\n # Someday I'll have a real implementation, but for now I just:\n raise IllegalState()",
... | [
"0.7270283",
"0.7106906",
"0.6510583",
"0.6458946",
"0.6458946",
"0.6458946",
"0.6458946",
"0.6437092",
"0.5946193",
"0.5946193",
"0.59140694",
"0.59140694",
"0.58002925",
"0.575879",
"0.575879",
"0.5636206",
"0.56116116",
"0.56003135",
"0.5576802",
"0.5433717",
"0.5433717",
... | 0.0 | -1 |
Sets the id of this CreateCcRuleResponse. Rule ID. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule_id(self, rule_id):\n\n self._rule_id = rule_id",
"def rule_id(self, rule_id):\n if self.local_vars_configuration.client_side_validation and rule_id is None: # noqa: E501\n raise ValueError(\"Invalid value for `rule_id`, must not be `None`\") # noqa: E501\n\n self._rule_... | [
"0.6763874",
"0.65677536",
"0.57124186",
"0.5681829",
"0.56382966",
"0.56165016",
"0.5594762",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
"0.55003273",
... | 0.0 | -1 |
Gets the policyid of this CreateCcRuleResponse. Policy ID. | def policyid(self):
return self._policyid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self... | [
"0.71869653",
"0.70272726",
"0.66735554",
"0.65377337",
"0.6409638",
"0.61068887",
"0.58747417",
"0.5775966",
"0.5775966",
"0.57558006",
"0.5664476",
"0.5654184",
"0.5654184",
"0.5654184",
"0.56081605",
"0.5586304",
"0.55531263",
"0.55446535",
"0.5529159",
"0.55233705",
"0.55... | 0.7301752 | 0 |
Sets the policyid of this CreateCcRuleResponse. Policy ID. | def policyid(self, policyid):
self._policyid = policyid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_id(self, policy_id):\n\n self._policy_id = policy_id",
"def policy_id(self, policy_id):\n\n self._policy_id = policy_id",
"def rule_id(self, rule_id):\n if self.local_vars_configuration.client_side_validation and rule_id is None: # noqa: E501\n raise ValueError(\"Inv... | [
"0.68123084",
"0.68123084",
"0.54625875",
"0.5370309",
"0.52680314",
"0.5140868",
"0.50436664",
"0.49458042",
"0.49458042",
"0.47753757",
"0.47435704",
"0.46656474",
"0.4633625",
"0.46130386",
"0.45901033",
"0.45841998",
"0.4564423",
"0.45584872",
"0.45259494",
"0.45065802",
... | 0.6867485 | 0 |
Sets the action of this CreateCcRuleResponse. | def action(self, action):
self._action = action | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAction(self, action):\n self.action = action\n return self",
"def set_action(self, action):\n self._action = action\n return self",
"def action(self, action):\n allowed_values = [\"APPLY\", \"PRECHECK\"]\n if action not in allowed_values:\n raise Valu... | [
"0.5740242",
"0.55543965",
"0.53980976",
"0.52404845",
"0.52404845",
"0.5120677",
"0.5100687",
"0.5100687",
"0.5100687",
"0.5100687",
"0.5100687",
"0.5100687",
"0.5069118",
"0.50683737",
"0.5046312",
"0.504063",
"0.49563912",
"0.4946187",
"0.47646853",
"0.4764047",
"0.4764047... | 0.50210416 | 16 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, CreateCcRuleResponse):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84560555",
"0.83913696",
"0.8143685",
"0.81403786",
"0.8131871",
"0.8093231",
"0.80915105",
"0.80915105",
"0.80915105",
"0.8084564",
"0.8084564",
"0.8075547",
"0.8075547",
"0.8065006"
] | 0.0 | -1 |
Plot the grid lines. | def plot_grid(self, **kwargs):
if 'ax' in kwargs:
ax = kwargs.pop('ax')
else:
ax = self.ax
col = self.get_grid_line_collection(**kwargs)
if col is not None:
ax.add_collection(col)
ax.set_xlim(self.extent[0], self.extent[1])
ax.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_lines(self):\n self.plot(3)",
"def draw_grid(plt):\n x0, x1, x2, x3 = 0, 3057, 6508, 9860\n y0, y1, y2, y3, y4, y5, y6, y7, y8 = 0, 1535, 2041, 2547, 3053, 3559, 4257, 5303, 6978\n alpha, linewidth = 0.3, 0.5\n\n # Vertical Lines\n plt.plot((x0, x0), (y0, y8), 'black', alpha=alpha,... | [
"0.77306366",
"0.7440607",
"0.71641326",
"0.71400976",
"0.70725334",
"0.7071036",
"0.706398",
"0.70392907",
"0.70115954",
"0.69848794",
"0.69813",
"0.69724023",
"0.6855517",
"0.68539494",
"0.67763984",
"0.67680395",
"0.6744388",
"0.67417234",
"0.6659664",
"0.6651281",
"0.6644... | 0.6760518 | 16 |
This function reconstructs a Plan object given its attributes in the form of a Protobuf message | def unbufferize(worker: AbstractWorker, protobuf_plan: PlanPB) -> "Plan":
id_ = sy.serde.protobuf.proto.get_protobuf_id(protobuf_plan.id)
role = sy.serde.protobuf.serde._unbufferize(worker, protobuf_plan.role)
name = protobuf_plan.name
tags = set(protobuf_plan.tags) if protobuf_plan.ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bufferize(worker: AbstractWorker, plan: \"Plan\") -> PlanPB:\n if not plan.is_built:\n raise RuntimeError(\"A Plan needs to be built before being serialized.\")\n\n protobuf_plan = PlanPB()\n\n sy.serde.protobuf.proto.set_protobuf_id(protobuf_plan.id, plan.id)\n\n protobu... | [
"0.63206017",
"0.61841536",
"0.5835459",
"0.5790261",
"0.569005",
"0.55401856",
"0.5442663",
"0.54380345",
"0.54332626",
"0.5409316",
"0.540098",
"0.5369381",
"0.53568256",
"0.5352154",
"0.534639",
"0.5332706",
"0.5300507",
"0.5285836",
"0.5265404",
"0.5259517",
"0.52550447",... | 0.6413197 | 0 |
str, programm release date | def set_date(self, date):
self.date = date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_release_date ():\n fname = os.path.join(\"doc\", \"changelog.txt\")\n release_date = \"unknown\"\n with open(fname) as fd:\n # the release date is on the first line\n line = fd.readline()\n mo = release_ro.search(line)\n if mo:\n release_date = mo.groups(1)\n... | [
"0.7408091",
"0.7198261",
"0.7160273",
"0.6860224",
"0.6607413",
"0.65098083",
"0.6507584",
"0.6457579",
"0.64545375",
"0.6396257",
"0.6379055",
"0.6310433",
"0.6278051",
"0.62684923",
"0.6254182",
"0.6254182",
"0.6232508",
"0.62040883",
"0.6202938",
"0.62020254",
"0.61583054... | 0.0 | -1 |
str, programm release date | def get_date(self):
return self.date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_release_date ():\n fname = os.path.join(\"doc\", \"changelog.txt\")\n release_date = \"unknown\"\n with open(fname) as fd:\n # the release date is on the first line\n line = fd.readline()\n mo = release_ro.search(line)\n if mo:\n release_date = mo.groups(1)\n... | [
"0.74083066",
"0.7198372",
"0.7159767",
"0.68597376",
"0.66077125",
"0.6509285",
"0.6507849",
"0.64564747",
"0.6454136",
"0.6396293",
"0.63795567",
"0.6310078",
"0.6277594",
"0.6267627",
"0.6254642",
"0.6254642",
"0.62316066",
"0.6203986",
"0.62028855",
"0.620112",
"0.6158232... | 0.0 | -1 |
list of str, fk filenames | def set_fnames(self, fnames):
self.fnames = fnames[:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filenames(self):\n pass",
"def get_file_names(self, prediction=False):\n if prediction is False:\n filename_list = []\n for objects in self.bucket.objects.filter(Prefix=self.training_data_dir):\n filename = str(objects.key).split('/')[-1]\n if... | [
"0.67755556",
"0.6628222",
"0.6548546",
"0.64015895",
"0.6263758",
"0.61676055",
"0.61512816",
"0.61504734",
"0.6148894",
"0.6131899",
"0.61317396",
"0.6121811",
"0.61206263",
"0.6073157",
"0.6062771",
"0.60525453",
"0.60513395",
"0.60458434",
"0.60267854",
"0.60214454",
"0.6... | 0.0 | -1 |
list of str, fk filenames | def get_fnames(self):
return self.fnames[:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filenames(self):\n pass",
"def get_file_names(self, prediction=False):\n if prediction is False:\n filename_list = []\n for objects in self.bucket.objects.filter(Prefix=self.training_data_dir):\n filename = str(objects.key).split('/')[-1]\n if... | [
"0.6774875",
"0.6627188",
"0.65489256",
"0.63998985",
"0.626276",
"0.6166085",
"0.6150616",
"0.61502004",
"0.61491835",
"0.613219",
"0.6131962",
"0.6120628",
"0.6119466",
"0.6073022",
"0.60615385",
"0.605201",
"0.605102",
"0.6045804",
"0.6026361",
"0.602079",
"0.6012861",
"... | 0.0 | -1 |
Asserts that a check of the given lines with the given local bear either yields or does not yield any results. | def check_validity(self,
local_bear,
lines,
filename=None,
valid=True,
force_linebreaks=True,
create_tempfile=True,
tempfile_kwargs={}):
assert isinsta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_lines(self, lines: Sequence[str], needed_lines: NeedLines, ignore_spaces: bool = True) -> None:\n if ignore_spaces:\n lines = [vdns.common.compact_spaces(x) for x in lines]\n needed_lines0 = needed_lines\n needed_lines = []\n for line in needed_lines0:\... | [
"0.6415525",
"0.6258591",
"0.6175178",
"0.606589",
"0.60321593",
"0.5958627",
"0.5910324",
"0.5549529",
"0.5541374",
"0.5513141",
"0.5494467",
"0.54903716",
"0.5461839",
"0.53709966",
"0.53559434",
"0.5304975",
"0.52981645",
"0.529743",
"0.5291794",
"0.5274744",
"0.5261919",
... | 0.67332256 | 0 |
The object returns itself because it is implementing a __next__ method and does not need any additional state for iteration. | def __iter__(self):
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n return self.next()",
"def __next__(self):\n return self.next()",
"def __next__(self):\n return self.next()",
"def __next__(self):\n return self.next()",
"def __iter__(self):\n return self._next()",
"def __iter__(self):\n return self._next()"... | [
"0.88203764",
"0.8761689",
"0.8761689",
"0.8761689",
"0.87397534",
"0.87397534",
"0.87397534",
"0.8671067",
"0.8639678",
"0.8631748",
"0.8509479",
"0.8500059",
"0.84445626",
"0.84445626",
"0.84445626",
"0.84445626",
"0.84445626",
"0.84445626",
"0.84445626",
"0.84134924",
"0.8... | 0.8154327 | 43 |
Does `filename` appear to be an image file? | def is_image_file(filename):
img_types = [".jpg", ".jpeg", ".png", ".gif"]
ext = os.path.splitext(filename)[1].lower()
return ext in img_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_image_file(filename):\n return has_file_allowed_extension(filename, IMG_EXTENSIONS)",
"def is_image(filename: str) -> str:\n extension = filename.rsplit(\".\", 1)[-1].lower()\n assert (\n extension in image_extensions\n ), f\"Invalid image: {filename}. Allowed extensions: {image_extensi... | [
"0.79731274",
"0.7787988",
"0.7554723",
"0.7551654",
"0.7491204",
"0.7436177",
"0.73284477",
"0.7307106",
"0.7300574",
"0.7212581",
"0.71505696",
"0.7064782",
"0.7023415",
"0.69625264",
"0.6875895",
"0.6828818",
"0.6813273",
"0.6765537",
"0.66755134",
"0.65713376",
"0.6497355... | 0.77121425 | 2 |
Function will replace spaces in a string with '%20'. Assumes that the string has sufficient space at the end to hold the extra characters Runs in O(n) time since we just iterate throught the string. | def urlify(char_array: list or str, true_length: int) -> list:
if type(char_array) is str:
char_array = list(char_array)
# Index of new end
new_end = (count_spaces(char_array, true_length) * 2) + true_length - 1
if new_end < len(char_array) - 1:
char_array = char_array[:new_end + 1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def URLify(s):\n\n # Without any additional libraries and by doing it in an array as intended by the writer.\n return ''.join('%20' if c == ' ' else c for c in s.strip())\n\n # Time Complexity: O(n)\n # Space Complexity: O(1)",
"def make_spaces_ascii(artist_str):\n while artist_str.find(' ') != ... | [
"0.6961475",
"0.6925711",
"0.67736304",
"0.65099347",
"0.6290201",
"0.59334224",
"0.58078074",
"0.5657619",
"0.5639636",
"0.55906504",
"0.5579616",
"0.5522704",
"0.54756975",
"0.5459403",
"0.54427254",
"0.54386735",
"0.5425617",
"0.53992987",
"0.5357473",
"0.5351122",
"0.5350... | 0.51240116 | 34 |
Gets the artist for the specific song instance | def artist(self) -> str:
return self._artist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_artist(self):\n return self._artist",
"def get_artist(self) -> Optional[str]:\n return self.artist",
"def artist(self, q, page=None):\r\n return self.get('artist', q, page)",
"def _get_artist(self):\n artists = FileRecord.query(FileRecord.artist).distinct().filter(\n ... | [
"0.7880977",
"0.7503582",
"0.7362446",
"0.7290549",
"0.72895736",
"0.72466034",
"0.72391135",
"0.71693665",
"0.707334",
"0.70518917",
"0.70236444",
"0.698136",
"0.6962645",
"0.69252944",
"0.6911314",
"0.6911314",
"0.68798584",
"0.6842157",
"0.6547474",
"0.6468637",
"0.6422587... | 0.7123093 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.