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 |
|---|---|---|---|---|---|---|
loads the input string into a json object, and write that object to 'actual path', returns the json object | def parseAndSaveValueTree( input, actual_path ):
root = json.loads( input )
fout = file( actual_path, 'wt' )
valueTreeToString( fout, root )
fout.close()
return root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_write_to_json():\r\n tmp_dir = os.getcwd()\r\n json_content = '{ \"name\":\"John\", \"age\":30}'\r\n directory = os.path.join(tmp_dir, 'inputspec.json')\r\n write_to_json(directory, json_content) \r\n with open(directory) as json_file:\r\n data = json.load(json_file)\r\n json_stri... | [
"0.67256683",
"0.6223714",
"0.59513927",
"0.58972603",
"0.58937496",
"0.58563566",
"0.58393383",
"0.58184296",
"0.5794447",
"0.57876223",
"0.5785455",
"0.5772184",
"0.57503694",
"0.5746324",
"0.5711803",
"0.57045794",
"0.56989497",
"0.56903565",
"0.56841874",
"0.56707436",
"0... | 0.6568059 | 1 |
Number of seconds in a day = 86400 | def time_analysis(self, time_points, plot=False, interval=1800):
first_day = int(min(time_points)/86400)
dyn_cl = dynamic_clusters()
for t in time_points:
day = int(t/86400)-first_day+1
#print day
time_in_day = t%86400 #in seconds
dyn_cl.add_el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_seconds_in_days(days):\n return int(days * 86400)",
"def calculate_days(time):\n return int(time / 86400)",
"def daysToSeconds(dayInt):\n return dayInt * 24 * 60 * 60",
"def total_seconds(dt):\n return ((24.0 * 60 * 60 * dt.days + dt.seconds) * 10 ** 6 + dt.microseconds) / 10 ** 6",... | [
"0.78322047",
"0.7669997",
"0.72789645",
"0.72605044",
"0.71967256",
"0.70403594",
"0.69336665",
"0.6905637",
"0.6737519",
"0.6710355",
"0.6690475",
"0.66812146",
"0.6679686",
"0.6657958",
"0.6653663",
"0.6596503",
"0.65039814",
"0.64805216",
"0.64296263",
"0.6386751",
"0.638... | 0.0 | -1 |
Returns an item from dataset | def __getitem__(self, idx):
text, label = self.data[idx]
ids = self.get_ids(text)
return {"ids": ids, "label": label} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, item):\n return self.default_dataset[item]",
"def __getitem__(self, index):\n return self.dataset[index]",
"def __getitem__(self, item):\r\n\r\n return self.data.__getitem__(item)",
"def __getitem__(self, item):\n return self.get_data(stock=item)",
"def get... | [
"0.7331154",
"0.73001236",
"0.70782506",
"0.7059737",
"0.704616",
"0.70335186",
"0.70335186",
"0.70335186",
"0.7004931",
"0.6967193",
"0.696698",
"0.6906114",
"0.6874898",
"0.681933",
"0.68029433",
"0.68029433",
"0.68029433",
"0.6767995",
"0.67607844",
"0.6752889",
"0.6744572... | 0.0 | -1 |
Collate function for PyTorch dataloaders This function is required to pad the sequences in batch | def collator(self, batch):
# Retrieve data from batch
ids = [item["ids"] for item in batch]
label = [item["label"] for item in batch]
# Sort the list
ids, label = map(
list,
zip(
*sorted(
zip(ids, label), key=lambda _t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _collate_fn(batch):\n def _pad(seqs, dtype=torch.float32):\n \"\"\" Pads a batch of sequences of varying seq_len. \"\"\"\n assert len(seqs) > 0 and all(x.shape[1:] == seqs[0].shape[1:] for x in seqs)\n lens = torch.LongTensor([len(x) for x in seqs])\n max_seq_len = torch.max(lens)\n\n # padded_... | [
"0.73158294",
"0.72303694",
"0.720215",
"0.70178246",
"0.6988935",
"0.6987654",
"0.6984616",
"0.69347256",
"0.69314164",
"0.6929743",
"0.6866151",
"0.6806713",
"0.6755359",
"0.6730519",
"0.67249703",
"0.6670702",
"0.6653288",
"0.66521674",
"0.6634389",
"0.6608294",
"0.6605508... | 0.0 | -1 |
slices num_start_samples and last num_end_samples from input_tensor. | def _get_values_from_start_and_end(self, input_tensor, num_start_samples,
num_end_samples, total_num_samples):
input_length = tf.shape(input=input_tensor)[0]
start_positions = tf.less(tf.range(input_length), num_start_samples)
end_positions = tf.greater_equ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slice(ds, timedelta_input, timedelta_output, to_predict, stepwidth, input_sampling, output_sampling):\n\n inputs = []\n outputs = []\n\n start_input_frame = ds.index[0]\n while start_input_frame + timedelta_input + timedelta_output <= ds.index[-1]:\n\n end_input_frame = start_input_frame + ... | [
"0.6398423",
"0.6301577",
"0.62422544",
"0.6207991",
"0.6033701",
"0.6001836",
"0.5863664",
"0.57697195",
"0.5736534",
"0.5735169",
"0.5735169",
"0.5695087",
"0.56871474",
"0.56835836",
"0.5664265",
"0.5650765",
"0.56340563",
"0.5613769",
"0.561273",
"0.55625796",
"0.55528635... | 0.6243149 | 2 |
Get a model by name from models. | def get_model(*, name: str) -> typing.Optional[typing.Type]:
return getattr(open_alchemy.models, name, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_by_name(cls, name):\n model_name = inflection.camelize(name) # class name of the model to use\n model = cls.models[model_name]\n return model",
"def get_model_by_name(self, model_name):\n models = ModelDirectory.get_model_by_name(model_name, pipeline=self)\n retu... | [
"0.82309574",
"0.7897367",
"0.789289",
"0.7651126",
"0.7275857",
"0.724759",
"0.7227102",
"0.71979",
"0.7093092",
"0.6934342",
"0.68831646",
"0.6882101",
"0.68638235",
"0.681084",
"0.67527384",
"0.6750112",
"0.66995806",
"0.669248",
"0.6669996",
"0.66521996",
"0.65691143",
... | 0.7608497 | 4 |
Get the schema of a model by name from models. | def get_model_schema(*, name: str) -> typing.Optional[types.Schema]:
model = get_model(name=name)
if model is None:
return None
return model._schema # pylint: disable=protected-access | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema(self, name):\n return model.Schema(self, name)",
"def get_model(*, name: str) -> typing.Optional[typing.Type]:\n return getattr(open_alchemy.models, name, None)",
"def get_model_by_name(self, model_name):\n models = ModelDirectory.get_model_by_name(model_name, pipeline=self)\n ... | [
"0.69659853",
"0.6304998",
"0.6245256",
"0.62337494",
"0.6099817",
"0.60613036",
"0.5975672",
"0.59240985",
"0.5892701",
"0.5835488",
"0.5833662",
"0.583204",
"0.58270544",
"0.5781039",
"0.57488984",
"0.57172143",
"0.57025635",
"0.5699908",
"0.5598855",
"0.5534844",
"0.551866... | 0.73033065 | 0 |
Given an example, returns the index of the top prediction. | def _predict_and_return_argmax_label(self, example):
model_out = self._model.predict([example])
softmax = list(model_out)[0]['preds']
argmax = np.argmax(softmax)
return self._model.output_spec()['preds'].vocab[argmax] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_top_predictions(self, predictions):\n scores = predictions.get_field(\"scores\")\n keep = torch.nonzero(scores > self.confidence_threshold).squeeze(1)\n predictions = predictions[keep]\n scores = predictions.get_field(\"scores\")\n _, idx = scores.sort(0, descending=Tr... | [
"0.62452763",
"0.62452763",
"0.62452763",
"0.60676634",
"0.5989437",
"0.58734274",
"0.5791014",
"0.57429034",
"0.570899",
"0.56964386",
"0.56548774",
"0.5654801",
"0.56219155",
"0.56219155",
"0.56219155",
"0.5609417",
"0.5579979",
"0.555093",
"0.5547673",
"0.5547556",
"0.5507... | 0.59843737 | 5 |
Tests the case when there no counterfactuals in the database. | def test_no_counterfactuals_found(self):
threshold = 4.0
self._config['Regression threshold'] = str(threshold)
self._example = {'x_1': 1.0, 'x_2': 1.0}
output = self._gen.generate(
example=self._example,
model=self._model,
dataset=self._dataset,
config=self._config)
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_one_in_db(self):\n q = self.generate_query('view_manager_report', ())\n res = self.execute_query(q)\n expected = []\n assert len(res) == 0, f'There is suppose to be an empty summary {res}'\n assert res == expected, f'The result is suppose to be empty {res}'",
"def t... | [
"0.7155767",
"0.6894186",
"0.6736307",
"0.66639924",
"0.65927976",
"0.6542009",
"0.6449499",
"0.64324975",
"0.6413866",
"0.64134836",
"0.6337504",
"0.633629",
"0.6330963",
"0.62947977",
"0.6268821",
"0.62683177",
"0.62500495",
"0.623947",
"0.6233725",
"0.62260556",
"0.6161695... | 0.631646 | 13 |
Immutable. The resource name of the backend environment where the key material for all CryptoKeyVersions associated with this CryptoKey reside and where all related cryptographic operations are performed. Only applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC, with the resource name in the format `... | def crypto_key_backend(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "crypto_key_backend") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kms_key_version_name(self) -> str:\n return pulumi.get(self, \"kms_key_version_name\")",
"def name(self):\n return self._env_name",
"def key_name(self) -> str:\n return pulumi.get(self, \"key_name\")",
"def kms_key_name(self) -> str:\n return pulumi.get(self, \"kms_key_name\")... | [
"0.6074543",
"0.53154606",
"0.52248967",
"0.52245873",
"0.52245873",
"0.52245873",
"0.5222759",
"0.5211067",
"0.5203351",
"0.5180378",
"0.5178732",
"0.51735216",
"0.5171954",
"0.5117935",
"0.51177925",
"0.51157355",
"0.5091082",
"0.5063385",
"0.5055134",
"0.5055134",
"0.50315... | 0.0 | -1 |
next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours. If rotation_period is set, next_rotation_time must also be set. Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted. | def rotation_period(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "rotation_period") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_key_rotation_date(self, next_key_rotation_date):\n if (self._configuration.client_side_validation and\n next_key_rotation_date is not None and next_key_rotation_date < 0): # noqa: E501\n raise ValueError(\"Invalid value for `next_key_rotation_date`, must be a value greate... | [
"0.69202644",
"0.59437287",
"0.57274806",
"0.54584885",
"0.5338199",
"0.52847797",
"0.5236162",
"0.52021384",
"0.52021384",
"0.5055989",
"0.50530267",
"0.4900865",
"0.4881133",
"0.48766458",
"0.48431367",
"0.48349738",
"0.478002",
"0.47434768",
"0.4723008",
"0.4714412",
"0.47... | 0.57929075 | 2 |
The time at which this CryptoKey was created. | def create_time(self) -> pulumi.Output[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_time(self) -> str:\n return pulumi.get(self, \"creation_time\")",
"def creation_time(self) -> str:\n return pulumi.get(self, \"creation_time\")",
"def creation_time(self) -> str:\n return pulumi.get(se... | [
"0.8119994",
"0.78333074",
"0.78333074",
"0.78333074",
"0.77597255",
"0.77597255",
"0.77597255",
"0.77542686",
"0.77542686",
"0.77542686",
"0.7657691",
"0.7632575",
"0.7632575",
"0.7632575",
"0.7632575",
"0.7632575",
"0.7632575",
"0.7632575",
"0.7632575",
"0.7632575",
"0.7632... | 0.6968153 | 70 |
Immutable. The resource name of the backend environment where the key material for all CryptoKeyVersions associated with this CryptoKey reside and where all related cryptographic operations are performed. Only applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC, with the resource name in the format `... | def crypto_key_backend(self) -> pulumi.Output[str]:
return pulumi.get(self, "crypto_key_backend") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kms_key_version_name(self) -> str:\n return pulumi.get(self, \"kms_key_version_name\")",
"def name(self):\n return self._env_name",
"def key_name(self) -> str:\n return pulumi.get(self, \"key_name\")",
"def kms_key_name(self) -> str:\n return pulumi.get(self, \"kms_key_name\")... | [
"0.6074543",
"0.53154606",
"0.52248967",
"0.52245873",
"0.52245873",
"0.52245873",
"0.5211067",
"0.5203351",
"0.5180378",
"0.5178732",
"0.51735216",
"0.5171954",
"0.5117935",
"0.51177925",
"0.51157355",
"0.5091082",
"0.5063385",
"0.5055134",
"0.5055134",
"0.50315326",
"0.5025... | 0.5222759 | 6 |
The resource name for this CryptoKey in the format `projects//locations//keyRings//cryptoKeys/`. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_name(self) -> str:\n return pulumi.get(self, \"key_name\")",
"def kms_key_name(self) -> str:\n return pulumi.get(self, \"kms_key_name\")",
"def kms_key_name(self) -> str:\n return pulumi.get(self, \"kms_key_name\")",
"def kms_key_name(self) -> str:\n return pulumi.get(self... | [
"0.6939809",
"0.68586695",
"0.68586695",
"0.68586695",
"0.66053355",
"0.6600515",
"0.6504073",
"0.64139056",
"0.64043695",
"0.6384725",
"0.6384725",
"0.635146",
"0.6345613",
"0.6328873",
"0.6312036",
"0.6308279",
"0.63072455",
"0.6306778",
"0.6306778",
"0.6291313",
"0.6266739... | 0.0 | -1 |
next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours. If rotation_period is set, next_rotation_time must also be set. Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted. | def rotation_period(self) -> pulumi.Output[str]:
return pulumi.get(self, "rotation_period") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_key_rotation_date(self, next_key_rotation_date):\n if (self._configuration.client_side_validation and\n next_key_rotation_date is not None and next_key_rotation_date < 0): # noqa: E501\n raise ValueError(\"Invalid value for `next_key_rotation_date`, must be a value greate... | [
"0.6921117",
"0.5942846",
"0.5790339",
"0.54565567",
"0.5337661",
"0.52842206",
"0.5234462",
"0.52015394",
"0.52015394",
"0.50538373",
"0.50518584",
"0.49000585",
"0.48790583",
"0.48761037",
"0.48417535",
"0.483141",
"0.47794032",
"0.47424516",
"0.47236624",
"0.4712896",
"0.4... | 0.5724867 | 3 |
plot the training history from a a tensorflow project. | def plot_history(model_file):
with h5py.File(model_file, 'r') as f:
print("keys: %s" % f.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_training(history: tf.keras.callbacks.History) -> None:\n hist = history.history\n\n if \"loss\" not in hist:\n print(\"Error: 'loss' values not found in the history\")\n return\n\n # plot training\n plt.figure(figsize=(14, 4))\n plt.subplot(121)\n plt.plot(hist[\"loss\"], l... | [
"0.71314675",
"0.7130952",
"0.6858491",
"0.68078613",
"0.6801595",
"0.67823356",
"0.67551917",
"0.6726375",
"0.66388524",
"0.66155493",
"0.6613517",
"0.66095895",
"0.65821105",
"0.6552887",
"0.65378743",
"0.6486414",
"0.63384265",
"0.6279699",
"0.6219405",
"0.6210748",
"0.618... | 0.5687699 | 55 |
Test API can get all categories (GET request). | def test_get_categories(self):
res = self.client().get('/categories')
data = json.loads(res.data)
self.assertEqual(res.status_code, 200)
self.assertEqual(data['success'], True)
self.assertTrue(len(data['categories'])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_all_categories(self):\n response = self.client.get('/api/v1/categories',\n headers=self.attendant_headers)\n self.assertEqual(response.status_code, 200)",
"def test_get_all_categories(self):\n login = self.autheniticate()\n token = json.l... | [
"0.8913982",
"0.85682416",
"0.85104936",
"0.8501755",
"0.8380937",
"0.8360935",
"0.829501",
"0.7893596",
"0.7893596",
"0.7877061",
"0.7868084",
"0.77602345",
"0.77246004",
"0.7668903",
"0.7626901",
"0.76239324",
"0.76133144",
"0.7596516",
"0.7480586",
"0.7458937",
"0.74284315... | 0.8427802 | 4 |
Test API for exected errors in get categories end point | def test_404_if_categories_url(self):
res = self.client().get('/categories/')
data = json.loads(res.data)
self.assertEqual(res.status_code, 404)
self.assertEqual(data['success'], False)
self.assertEqual(data['message'], "Resource Not Found.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_questions_by_category_failure(self):\n\n response = self.client().get('/categories/10/questions')\n body = json.loads(response.data)\n\n self.assertEqual(response.status_code, 404)\n self.assertEqual(body['success'], False)\n self.assertNotEqual(len(body['message']), 're... | [
"0.7766824",
"0.75165856",
"0.7481711",
"0.7465298",
"0.74478316",
"0.7370847",
"0.73646003",
"0.73605645",
"0.73219633",
"0.72993606",
"0.72991806",
"0.7297474",
"0.7277399",
"0.727482",
"0.72570044",
"0.7216054",
"0.7154997",
"0.7153083",
"0.7142064",
"0.7101459",
"0.708060... | 0.72765666 | 13 |
TEST API to post a question with URL that is not allowed | def test_405_create_question_not_allowed(self):
res = self.client().post('/questions/95',
json={
"question": "What is chemical \
composition of water",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post_invalid_data_question(self):\n\n response = self.post_question(self.invalid_question)\n\n self.assertEqual(response.status_code, 400)",
"def test_post_question(self):\n response = self.app.post(\n \"/api/v2/questions\", headers=self.headers, data=json.dumps(self.ques... | [
"0.69736975",
"0.6829877",
"0.6745695",
"0.66465354",
"0.6512102",
"0.6510603",
"0.647551",
"0.64748585",
"0.6406284",
"0.63875794",
"0.63839096",
"0.63802254",
"0.63767767",
"0.63683575",
"0.63532585",
"0.62969697",
"0.6277592",
"0.6273051",
"0.6273051",
"0.62493044",
"0.622... | 0.70382047 | 0 |
Test API to get error if request category do not exist | def test_get_404_if_category_do_not_exist(self):
res = self.client().get('/categories/10/questions')
data = json.loads(res.data)
self.assertEqual(res.status_code, 404)
self.assertEqual(data['success'], False)
self.assertEqual(data['message'], "Resource Not Found.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_questions_by_category_failure(self):\n\n response = self.client().get('/categories/10/questions')\n body = json.loads(response.data)\n\n self.assertEqual(response.status_code, 404)\n self.assertEqual(body['success'], False)\n self.assertNotEqual(len(body['message']), 're... | [
"0.7801562",
"0.7635796",
"0.7592893",
"0.7585621",
"0.757465",
"0.7555331",
"0.7469336",
"0.7364538",
"0.7353223",
"0.7322306",
"0.7314716",
"0.7299143",
"0.7282807",
"0.7282157",
"0.72706395",
"0.72591376",
"0.69266313",
"0.6846525",
"0.6837669",
"0.6830053",
"0.6826354",
... | 0.76558286 | 1 |
Compute the residual activation for either the bias or the specified synapse. | def compute_residual(self, augmented_data, bias=None, synapse=None, bkgd=None):
N = self.N
T = augmented_data["T"]
F = augmented_data["F"]
W = self.weight_model.W
assert bias is not None or synapse is not None
n_pre, n_post = self._get_n(bias, synapse)
# compute... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _residual_conditional(self, x, y):\n h = x\n h = self.b1(h, y)\n h = self.activation(h)\n h = self._upsample_conv(h, self.c1) if self.upsample else self.c1(h)\n h = self.b2(h, y)\n h = self.activation(h)\n h = self.c2(h)\n\n return h",
"def _residual(se... | [
"0.66266346",
"0.64367056",
"0.6363776",
"0.6360704",
"0.6217522",
"0.5983217",
"0.59514165",
"0.58521676",
"0.578881",
"0.5781729",
"0.572319",
"0.5719403",
"0.5561563",
"0.5553582",
"0.55464333",
"0.54401934",
"0.5411634",
"0.5337757",
"0.5290858",
"0.5231098",
"0.52251184"... | 0.65329283 | 1 |
Check if a cookie belongs to an admin. | def check_is_admin(cookie):
return ';admin=true;' in cookie | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isAdmin():\n\tif 'username' in session and session['username'] == 'admin':\n\t\treturn True\n\telse:\n\t\treturn False",
"def user_is_admin(user):\n return user in admins",
"def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')",
"async def is_admin(ctx):\n ... | [
"0.73039424",
"0.71584827",
"0.7152261",
"0.71180886",
"0.7055976",
"0.7051051",
"0.69924986",
"0.69816065",
"0.69806427",
"0.69778067",
"0.69679797",
"0.6959401",
"0.6919211",
"0.690156",
"0.68937665",
"0.68888205",
"0.6888003",
"0.688069",
"0.6872552",
"0.686421",
"0.686264... | 0.88378686 | 0 |
Find an author filtering by its id. | def find_by_id(cls, author_id):
try:
author = cls.db.newsdb.find_one({'_id': ObjectId(str(author_id))})
if author is not None:
author = AuthorModel(author['name'], str(author['_id']))
except InvalidId:
author = None
return author | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAuthorByID(id: int) -> Author:\n if not id:\n abort(400)\n author = Author.query.get(id)\n if not author:\n abort(404, \"Author is not found\")\n return author.serialize()",
"def get_author_by_id(self, id_num):\n\n cur = self.conn.cursor()\n query = 'SELECT author_i... | [
"0.70193875",
"0.69206274",
"0.6507975",
"0.63866985",
"0.62656254",
"0.6044836",
"0.60154885",
"0.60046273",
"0.59360933",
"0.5899211",
"0.58920836",
"0.5891988",
"0.58422047",
"0.58422047",
"0.58212465",
"0.5784771",
"0.57741094",
"0.57559925",
"0.57280236",
"0.56905645",
"... | 0.7531766 | 0 |
Encodes a picture in PNG. | def encode_png(track_metadata):
print("---- Encoding", track_metadata.file_name, "to PNG...")
# First step: OptiPNG.
new_file_name = track_metadata.file_name + ".png"
optipng_command = ["optipng", "-o7", "-strip", "all", "-snip", "-out", new_file_name, track_metadata.file_name]
print(optipng_command)
process = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jpeg_to_png(img: bytes) -> bytes:\n im = Image.open(BytesIO(img))\n width = 240\n height = int(im.size[1] * (240 / im.size[0]))\n im = im.convert(\"RGB\").resize((width, height))\n stream = BytesIO()\n im.save(stream, format=\"PNG\")\n return stream.getvalue()",
"def encode_image(self, i... | [
"0.70238346",
"0.68059456",
"0.66910887",
"0.65075713",
"0.6490932",
"0.6362139",
"0.63501203",
"0.6288207",
"0.6234699",
"0.6222067",
"0.61603814",
"0.6148813",
"0.6126176",
"0.61154884",
"0.6076154",
"0.60518354",
"0.60459554",
"0.6040901",
"0.60402936",
"0.602476",
"0.6019... | 0.64133924 | 5 |
Init the WindowCovering Class. | def __init__(
self, plm, address, cat, subcat, product_key=None, description=None, model=None
):
Device.__init__(
self, plm, address, cat, subcat, product_key, description, model
)
self._stateList[0x01] = Cover(
self._address,
"coverOpenLevel",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.window = Tk() # The main window\n self.__initialize_variables__() # Initialize the variables\n self.__initialize_menu__() # Initialize the Menu\n self.__initialize_status_bar__()\n self.__initialize_gui__() # Initialize the GUI widgets",... | [
"0.6743704",
"0.6717993",
"0.66916996",
"0.66435754",
"0.66388917",
"0.66207594",
"0.6608951",
"0.6592452",
"0.65906817",
"0.6444072",
"0.6423846",
"0.64215636",
"0.6397306",
"0.6392454",
"0.6386095",
"0.63827425",
"0.63741344",
"0.63722247",
"0.6320398",
"0.6258166",
"0.6253... | 0.0 | -1 |
Integer type used by ``CSR`` data. Sparse ``CSR`` matrices can contain at most ``2idxint_size`` nonzeros elements. | def idxint_size(self):
from .core import data
return data.base.idxint_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_scipy_index_typing(sparse_matrix):\n\n int_max = np.iinfo(MKL.MKL_INT_NUMPY).max\n if (sparse_matrix.nnz > int_max) or (max(sparse_matrix.shape) > int_max):\n msg = \"MKL interface is {t} and cannot hold matrix {m}\\n\".format(m=repr(sparse_matrix), t=MKL.MKL_INT_NUMPY)\n msg += \"Tr... | [
"0.58542836",
"0.5850885",
"0.5507139",
"0.55057424",
"0.53648454",
"0.53563046",
"0.5269566",
"0.52501446",
"0.5246889",
"0.524618",
"0.5153443",
"0.5144022",
"0.51399034",
"0.5124796",
"0.5095699",
"0.5082873",
"0.50771564",
"0.50197995",
"0.5014201",
"0.50036913",
"0.49769... | 0.5605299 | 2 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Order):
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.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
String representation of the transform. | def __repr__(self):
return "{}(value={})".format(self.__class__.__name__, self.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n format_string = self.__class__.__name__ + '('\n for t in self.transforms:\n format_string += f'\\n {t}'\n format_string += '\\n)'\n return format_string",
"def __str__(self):\n names = [self.name]\n names += [_callable_name(transform) ... | [
"0.75291336",
"0.7338223",
"0.7003522",
"0.690618",
"0.67028147",
"0.6667577",
"0.6622841",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0... | 0.0 | -1 |
String representation of the transform. | def __repr__(self):
return "{}(value={})".format(self.__class__.__name__, self.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n format_string = self.__class__.__name__ + '('\n for t in self.transforms:\n format_string += f'\\n {t}'\n format_string += '\\n)'\n return format_string",
"def __str__(self):\n names = [self.name]\n names += [_callable_name(transform) ... | [
"0.75291336",
"0.7338223",
"0.7003522",
"0.690618",
"0.67028147",
"0.6667577",
"0.6622841",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0... | 0.0 | -1 |
String representation of the transform. | def __repr__(self):
return "{}".format(self.__class__.__name__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n format_string = self.__class__.__name__ + '('\n for t in self.transforms:\n format_string += f'\\n {t}'\n format_string += '\\n)'\n return format_string",
"def __str__(self):\n names = [self.name]\n names += [_callable_name(transform) ... | [
"0.75291336",
"0.7338223",
"0.7003522",
"0.690618",
"0.67028147",
"0.6667577",
"0.6622841",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0.65933496",
"0... | 0.0 | -1 |
Get a list of word lists from given list of words of the given length. Returns list of lists or None if length of given list is less than given length. | def get_phrase_list(self, words, length):
if len(words) >= length:
return [words[i:i+length] for i in range(len(words) - length + 1)]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def easy_words(a_list):\n\n easy_list = [word for word in a_list if len(word) in range(4,7)]\n return easy_list",
"def hard_words(a_list):\n\n return [word for word in a_list if len(word) > 7]",
"def get_words(filename, wordlength):\r\n lines = load_lines(filename)\r\n wlist = [w for w in lines ... | [
"0.6546789",
"0.65173537",
"0.65165776",
"0.6513591",
"0.6484576",
"0.62821686",
"0.6182719",
"0.6164395",
"0.61270535",
"0.5997273",
"0.5965274",
"0.5960986",
"0.59513617",
"0.59046817",
"0.5848427",
"0.5756921",
"0.57434124",
"0.57303333",
"0.5670121",
"0.5668006",
"0.56522... | 0.71047616 | 0 |
Extract entities from tweet as text and return an entity dict. | def get_entities(self, text):
extractor = twitter_text.Extractor(text)
entities = {}
entities['user_mentions'] = []
for um in extractor.extract_mentioned_screen_names_with_indices():
entities['user_mentions'].append(um)
entities['hashtags'] = []
for ht in e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_tweet(tweet):\n d = {}\n d['hastags'] = [hashtag['text'] for hashtag in tweet['entities']['hashtags']]\n d['text'] = tweet['text']\n d['user'] = tweet['user']['screen_name']\n d['user_loc'] = tweet['user']['location']\n return d",
"def _get_entities(self, text, language=''):\n bo... | [
"0.7163616",
"0.70839727",
"0.70036346",
"0.68618387",
"0.6622903",
"0.66093665",
"0.65984255",
"0.6520099",
"0.6395295",
"0.6331853",
"0.62736267",
"0.6144974",
"0.6093043",
"0.60862595",
"0.60741085",
"0.6070696",
"0.6049883",
"0.6030686",
"0.60216916",
"0.5991131",
"0.5897... | 0.7987244 | 0 |
Slice the PDB file from residue ``start`` to residue ``stop`` where stop is INCLUSIVE Returns np.ndarray of shape (N, 15) of dtype=str where N is the number of atoms that compose the residue range. | def slice_pdb(self, start, stop):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _trim_start_end(data: pd.DataFrame, start: int, end: int):\n start_idx = data.loc[:, \"start_locus\"].searchsorted(start)\n end_idx = data.loc[:, \"start_locus\"].searchsorted(end, side=\"right\")\n return data.iloc[start_idx:end_idx, :]",
"def build_slices(start: Sequence[int], stop: Sequence[int] ... | [
"0.5702292",
"0.55593574",
"0.54967946",
"0.5490665",
"0.543095",
"0.54012644",
"0.54000926",
"0.539916",
"0.5375521",
"0.5348228",
"0.53296596",
"0.52915376",
"0.5247933",
"0.52435577",
"0.52367103",
"0.52294683",
"0.52173406",
"0.51852584",
"0.51783127",
"0.51773906",
"0.50... | 0.71454847 | 0 |
Get output filename template for format. | def get_template(self, format):
for pattern, converter in self._patterns:
if converter.format == format:
template = pattern.generate('{name}')
if template:
return template
return '{name}' f'.{format}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_template_filename(self):\n _format = self.cfg.get('mutations', 'format')\n if _format == 'pdf':\n tf = 'PDFTemplate.bt'\n elif _format == 'png':\n tf = 'PNG12Template.bt'\n\n module_dir = os.path.dirname(os.path.abspath(__file__))\n\n return os.path... | [
"0.76487124",
"0.7485142",
"0.7478703",
"0.7468869",
"0.717704",
"0.7169842",
"0.700266",
"0.69933915",
"0.6981283",
"0.69616824",
"0.6914643",
"0.6879603",
"0.6829703",
"0.68107957",
"0.67992496",
"0.67655617",
"0.6728994",
"0.66414756",
"0.6628191",
"0.6625138",
"0.66180015... | 0.7496139 | 1 |
Ensure dictionary encoder labels are returned sorted | def test_dict_labels_sorted(self):
le = {3: "a", 2: "c", 1: "b"}
oz = ClassificationScoreVisualizer(GaussianNB(), encoder=le)
npt.assert_array_equal(oz._labels(), ["b", "c", "a"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_labels(self):\n normalized_encoder = {}\n normalized_decoder = {}\n decoder = dict(self.tree.nodes(data=\"name\"))\n encoder = dict([(value, key) for key, value in decoder.items()])\n\n leaf_nodes = [node[0] for node in self.tree.out_degree(self.tree.nodes()) if node[1... | [
"0.6201525",
"0.5995317",
"0.598976",
"0.5878736",
"0.5865258",
"0.58634645",
"0.584119",
"0.58251524",
"0.58160883",
"0.57951283",
"0.5764054",
"0.5741479",
"0.57197803",
"0.571861",
"0.56800306",
"0.56673956",
"0.56570596",
"0.56496453",
"0.5636579",
"0.56079656",
"0.560789... | 0.77027303 | 0 |
Get the app_config.yaml for default application needs 1. Set function variables 2. Read the YAML file 3. Return a dictionary of the contents | def get_default_app_config():
# 1. Set function variables
file_location = str(APP_DIR) + '/application/static/app_config.yaml'
# 2. Read the YAML file
yaml_dict = read_yaml(file_location)
# 3. Return a dictionary of the contents
return yaml_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config() -> dict:\n try: \n with open(\"config.yaml\", \"rb\") as yaml_file:\n config = yaml.load(yaml_file, Loader=yaml.FullLoader)\n return config\n except (FileNotFoundError):\n logger.error(\"Could not load the application config file.\")\n return {}",
... | [
"0.8288024",
"0.8119227",
"0.76034844",
"0.75623",
"0.7522903",
"0.7418594",
"0.7333753",
"0.7287419",
"0.7244445",
"0.72259295",
"0.7162807",
"0.7069585",
"0.7029109",
"0.70020026",
"0.6991378",
"0.6976634",
"0.6957481",
"0.6922012",
"0.6879575",
"0.6879258",
"0.6878876",
... | 0.8843971 | 0 |
Read and return the YAML dict in the file location | def read_yaml(file_location):
with open(file_location, 'r') as stream:
try:
yaml_dict = yaml.load(stream, Loader=yaml.SafeLoader)
except yaml.YAMLError as e:
logger.error(e)
return yaml_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_yaml_file(filepath: str) -> Dict:\n return yaml.safe_load(read_file(filepath))",
"def read_config() -> dict:\n with Path(\"config.yaml\").open(\"r\") as file_pointer:\n try:\n return yaml.safe_load(file_pointer)\n except yaml.YAMLError as e:\n logging.error(e)",... | [
"0.759243",
"0.75183564",
"0.743243",
"0.73257357",
"0.7286708",
"0.72731036",
"0.72633284",
"0.7197643",
"0.71799684",
"0.71573913",
"0.7143258",
"0.713992",
"0.7136086",
"0.7128368",
"0.7115038",
"0.71093214",
"0.7101437",
"0.70997053",
"0.70577663",
"0.704494",
"0.70169413... | 0.7267285 | 6 |
Escape the string with the supplied function. The function is expected to take an arbitrary string, then return it with all special characters escaped and ready for passing to the command interpreter. After calling this function, the next call to str() will return the escaped string. | def escape(self, escape_func, quote_func=quote_spaces):
if self.is_literal():
return escape_func(self.data)
elif ' ' in self.data or '\t' in self.data:
return quote_func(self.data)
else:
return self.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape_string(text):\n return escape(text)",
"def _escape(s):\n assert isinstance(s, str), \\\n \"expected %s but got %s; value=%s\" % (type(str), type(s), s)\n s = s.replace(\"\\\\\", \"\\\\\\\\\")\n s = s.replace(\"\\n\", \"\\\\n\")\n s = s.replace(\"\\t\", \"\\\\t\")\n s = s.replace(\",\", ... | [
"0.78236073",
"0.6914006",
"0.685613",
"0.6712803",
"0.66270393",
"0.6603785",
"0.6498684",
"0.6478015",
"0.64697385",
"0.6415594",
"0.64000726",
"0.63349926",
"0.63226914",
"0.6292137",
"0.62896633",
"0.6157335",
"0.61490804",
"0.61439914",
"0.6135253",
"0.6128144",
"0.61137... | 0.64833534 | 7 |
Determines if the string s requires further expansion. Due to the implementation of ListSubber expand will call itself 2 additional times for an already expanded string. This method is used to determine if a string is already fully expanded and if so exit the loop early to prevent these recursive calls. | def expanded(self, s):
if not is_String(s) or isinstance(s, CmdStringHolder):
return False
s = str(s) # in case it's a UserString
return _separate_args.findall(s) is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand(self) -> bool:\n self.__build_iteration()\n return len(self.__trees.keys()) == 0",
"def is_expandable(self) -> bool:\n if self._is_expandable is False:\n return self._is_expandable\n elif self.parse_grammar:\n return True\n elif self.segments an... | [
"0.6171038",
"0.6109091",
"0.60169923",
"0.59473646",
"0.5829965",
"0.57881844",
"0.5753471",
"0.56674725",
"0.5637924",
"0.5562003",
"0.5455472",
"0.54426134",
"0.53587943",
"0.5309808",
"0.52773035",
"0.522618",
"0.5181424",
"0.5179465",
"0.51638067",
"0.51443434",
"0.51245... | 0.68825835 | 0 |
Return an integer (broadcasted) valuation of x. Input x must be float32 or float64. | def rank(x):
x = asanyarray(x)
if x.dtype.type is float64:
value = _rank(x)
elif x.dtype.type is float32:
value = _rankf(x)
else:
raise TypeError("%s not in (float64, float32)" % x.dtype)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(cls, x):\n return np.maximum(0, np.minimum(1, 0.2*x + 0.5))",
"def get_i(self, x):\n return (x - self.__xmin) * (self.__width - 1) // (self.__xmax - self.__xmin)",
"def calculate_value(self, x: np.array) -> np.array:\n pass",
"def get_result(self, x):\n return self.i*x",... | [
"0.642496",
"0.63849723",
"0.63603836",
"0.6349625",
"0.6288522",
"0.6180796",
"0.61380905",
"0.61380905",
"0.61259884",
"0.6098477",
"0.6064956",
"0.6062511",
"0.6041411",
"0.60260904",
"0.6014335",
"0.5997265",
"0.59946537",
"0.59850824",
"0.597165",
"0.5959835",
"0.5934623... | 0.0 | -1 |
Return the order distance from float64 x to float64 y | def _floatdiff(x, y):
rankx = _rank(x)
ranky = _rank(y)
return _diff(rankx, ranky) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dist(self,x, y):\n\n x1, y1 = x\n x2, y2 = y\n return np.sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2))",
"def distance(self, x: int, y: int) -> float:\n return math.sqrt((x - self.x) ** 2 + (y - self.y) ** 2)",
"def dist(x, y):\n dx = x[0] - y[0]\n dy = x[1] ... | [
"0.7211161",
"0.7161189",
"0.7139409",
"0.7123245",
"0.7105878",
"0.6947398",
"0.69145316",
"0.68679214",
"0.6860378",
"0.683358",
"0.6826744",
"0.68225163",
"0.6816968",
"0.67356527",
"0.6727091",
"0.6678646",
"0.6665459",
"0.6655285",
"0.66527474",
"0.6636007",
"0.6568847",... | 0.6453754 | 32 |
Return the order distance from float32 x to float32 y | def _floatdifff(x, y):
rankx = _rankf(x)
ranky = _rankf(y)
return _difff(rankx, ranky) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, x: int, y: int) -> float:\n return math.sqrt((x - self.x) ** 2 + (y - self.y) ** 2)",
"def distance_to(self, x, y):\n\t\tdx = x - self.x\n\t\tdy = y - self.y\n\t\treturn math.sqrt((dx**2)+(dy**2))",
"def dist(self,x, y):\n\n x1, y1 = x\n x2, y2 = y\n return np.sqr... | [
"0.703354",
"0.6897764",
"0.6807558",
"0.6752578",
"0.66626596",
"0.66416335",
"0.6594259",
"0.6527434",
"0.6459107",
"0.6452112",
"0.64303774",
"0.6419601",
"0.6398172",
"0.6356921",
"0.6349424",
"0.6314981",
"0.6290956",
"0.6285438",
"0.62820977",
"0.62751853",
"0.62748665"... | 0.0 | -1 |
Determines if there is any overlap for a set of spheres | def _check_overlap(self, points, radius):
dists = distance.cdist(points, points, 'euclidean')
dists = dists[np.nonzero(dists)]
return np.any(dists < 2.0 * radius) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _intersected(positions, radius):\n P1 = positions[0]\n P2 = positions[1]\n P3 = positions[2]\n temp1 = P2 - P1\n e_x = temp1 / np.linalg.norm(temp1)\n temp2 = P3 - P1\n i = np.dot(e_x, temp2)\n temp3 = temp2 - i * e_x\n e_y = temp3 / np.linalg.norm... | [
"0.68703675",
"0.65346265",
"0.640801",
"0.6404149",
"0.63301796",
"0.62730634",
"0.6253626",
"0.62496436",
"0.6233539",
"0.6183988",
"0.6179826",
"0.6161296",
"0.61591285",
"0.6132462",
"0.61284155",
"0.61213976",
"0.6108121",
"0.6082444",
"0.60719913",
"0.601815",
"0.599528... | 0.63474834 | 4 |
Instantiates room class with correct size and seats. | def create_room(cls, filepath):
with open(filepath, 'r') as f:
f_raw = f.read()
rm = cls()
rm._update_size(f_raw)
rm._add_seats(f_raw)
rm._add_seat_specifiers(f_raw)
return rm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_room(self):\r\n return Room()",
"def alloc(cls, room_setting) -> 'Room':\n # build full role list\n roles = []\n roles.extend([Role.WOLF] * room_setting['wolf_num'])\n roles.extend([Role.CITIZEN] * room_setting['citizen_num'])\n roles.extend(Role.from_option(room... | [
"0.7112003",
"0.6659768",
"0.6642154",
"0.6437831",
"0.64253527",
"0.64140606",
"0.6370894",
"0.6368129",
"0.63565534",
"0.63321203",
"0.62653",
"0.62168074",
"0.62146676",
"0.6202642",
"0.6163989",
"0.6158893",
"0.6137022",
"0.6130841",
"0.61292833",
"0.60971713",
"0.6024043... | 0.64004844 | 6 |
Checks if an string is a valid IP | def is_valid_ip(addr):
try:
socket.inet_aton(addr)
except socket.error:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_ipaddress(str_ip: str) -> bool:\n try:\n ipaddress.ip_address(str_ip)\n return True\n except ValueError:\n return False",
"def is_ip(string):\n return ipv4.is_ip(string) or ipv6.is_ip(string)",
"def is_ip(value):\n try:\n IP(value)\n except ValueError:\n ... | [
"0.8432014",
"0.8395799",
"0.7975387",
"0.790139",
"0.77903074",
"0.7786871",
"0.77834773",
"0.7704797",
"0.7671193",
"0.76676226",
"0.7662319",
"0.7658113",
"0.7638045",
"0.76351607",
"0.7613925",
"0.75110185",
"0.74708486",
"0.7470602",
"0.74609965",
"0.74030775",
"0.739083... | 0.7398593 | 20 |
Iterates all successor atoms connected to given atom. | def iterate_connected_atoms(self, atom):
successors_iter = self._execution_graph.successors_iter
return _depth_first_iterate(
self._execution_graph, {
co.FLOW: successors_iter,
co.TASK: successors_iter,
co.RETRY: successors_iter,
},... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def successor(self, state):\n for direct in self.direction :\n newState = state.move(direct)\n if newState :\n yield (None, newState)",
"def iter_next_atoms(self, atom=None):\n if atom is None:\n return iter_utils.unique_seen(self.browse_atoms_for_exe... | [
"0.6513067",
"0.6403368",
"0.636138",
"0.6059985",
"0.5846734",
"0.58120924",
"0.5788682",
"0.5768992",
"0.5756145",
"0.56459326",
"0.5607793",
"0.55902",
"0.55776715",
"0.55636036",
"0.5545623",
"0.55388427",
"0.5516621",
"0.55050546",
"0.5455694",
"0.54491234",
"0.5398607",... | 0.73879033 | 0 |
Gets the state of a given atom (from the backend storage unit). | def get_state(self, atom):
return self._storage.get_atom_state(atom.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_atom_state(self, atom_name):\n source, _clone = self._atomdetail_by_name(atom_name)\n return source.state",
"def get_state(self, uid):\n with self._directory_lock:\n return self._directory[uid]",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\... | [
"0.69925636",
"0.5954553",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.594953",
"0.59... | 0.8119373 | 0 |
Reroot a tree between a give node and its parent. | def root_above(node, name=None):
# walk down from self node
left = walk_copy(node, node.parent)
# walk up from parent node
right = walk_copy(node.parent, node)
# set basal branch lengths to be half of the original, i.e., midpoint
left.length = right.length = node.length / 2
# create new r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parent_assigment():\n builder = TreeBuilder()\n builder.create_root(0)\n builder.add_child(2, move=True)\n builder.add_child(13)\n builder.move_to_parent()\n builder.add_child(7)\n\n t = builder.build()\n\n assert t.parent is None\n assert t[0].parent == t\n assert t[1].paren... | [
"0.68858314",
"0.64718103",
"0.642249",
"0.6385413",
"0.6381746",
"0.6353983",
"0.6332923",
"0.62463576",
"0.620016",
"0.61922896",
"0.61676645",
"0.61606437",
"0.61405426",
"0.6138119",
"0.61142033",
"0.6039022",
"0.60051936",
"0.6004119",
"0.60008645",
"0.59573907",
"0.5936... | 0.62639475 | 7 |
Create an Apachestyle password hash. This is basically just a simplfified interface to apachelib.password for use in generating htaccess files. Valid ctypes are crypt, sha and md5. | def hash_password(passwd, ctype="crypt"):
if ctype is "crypt":
from apachelib.password import crypt_password
return crypt_password(passwd)
elif ctype is "sha":
from apachelib.password import sha_password
return sha_password(passwd)
elif ctype is "md5":
from apachelib.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_pass(password, salt):\n return hashlib.pbkdf2_hmac('sha512', password.encode(), salt, 100000)",
"def hashPassword(passwd):\r\n \r\n return hashlib.sha224(passwd).hexdigest()",
"def hash_password(password):\r\n salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')\r\n pwdha... | [
"0.7003393",
"0.6988002",
"0.6928529",
"0.6884202",
"0.6884202",
"0.6884202",
"0.68275356",
"0.682356",
"0.68225414",
"0.6791371",
"0.67701423",
"0.6767131",
"0.67525303",
"0.6733553",
"0.6726589",
"0.6706386",
"0.67037225",
"0.6651411",
"0.6645955",
"0.66450185",
"0.6629888"... | 0.7362848 | 0 |
Remove a SizeGroup from the project. Note that this doesn't remove the widgets from the sizegroup. | def remove_sizegroup(self, sizegroup):
self.sizegroups.remove(sizegroup)
self.emit('remove-sizegroup', sizegroup) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_group():\n _id = request.form['_id']\n data, code, message = FIELD_SERVICE.remove_group(_id)\n return __result(data, code, message)",
"def slotDelete(self):\n item = self.groupListBox.item((self.groupListBox.currentItem()))\n group = item.text().ascii()\n Group.Sequencer(... | [
"0.6484616",
"0.6147702",
"0.601694",
"0.59556997",
"0.58583",
"0.58347404",
"0.58286095",
"0.5763573",
"0.5685702",
"0.56625384",
"0.56575876",
"0.5625066",
"0.56161183",
"0.55508155",
"0.54975885",
"0.5467939",
"0.5463571",
"0.5419239",
"0.5393362",
"0.5374217",
"0.53465044... | 0.8322592 | 0 |
Check if there are any commands in the undo stack. | def has_undo(self):
return self._current_undo_command != -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undo_stack_not_empty(self):\n return self.undo_stack.stack_not_empty()",
"def has_commands(self) -> bool:\n return len(self.commands) > 0",
"def canUndo(self):\n return self._index > 0",
"def has_redo(self):\n return self._current_undo_command + 1 != len(self._commands)",
"d... | [
"0.7691589",
"0.7123444",
"0.7063447",
"0.7060208",
"0.67944515",
"0.66322464",
"0.6575193",
"0.6546306",
"0.64904016",
"0.6447479",
"0.63553",
"0.63228846",
"0.61926156",
"0.61926156",
"0.6179679",
"0.6153126",
"0.6105479",
"0.6105479",
"0.60647804",
"0.6051087",
"0.60212696... | 0.76078385 | 1 |
Check if there are any commands in the redo stack. | def has_redo(self):
return self._current_undo_command + 1 != len(self._commands) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canRedo(self):\n return self._index < len(self._commands)",
"def has_commands(self) -> bool:\n return len(self.commands) > 0",
"def can_redo(self) -> bool:\n\n return self.position < len(self.history) - 1",
"def undo_stack_not_empty(self):\n return self.undo_stack.stack_not_em... | [
"0.7488757",
"0.7130528",
"0.705497",
"0.68767244",
"0.68025815",
"0.6769421",
"0.67669165",
"0.66729945",
"0.6573221",
"0.6573221",
"0.65471345",
"0.6460022",
"0.6355706",
"0.6266418",
"0.6239108",
"0.6239108",
"0.6198674",
"0.6163735",
"0.6157643",
"0.6149139",
"0.614755",
... | 0.7874611 | 0 |
Get the current redo command description. | def get_redo_info(self):
if self.has_redo():
return self._commands[self._current_undo_command + 1].description
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_description(self):\n return self['command_name']",
"def get_undo_info(self):\n if self.has_undo():\n return self._commands[self._current_undo_command].description\n return None",
"def pop_redo(self):\n if self.has_redo():\n cmd = self._commands[self._c... | [
"0.72621584",
"0.6762427",
"0.65703106",
"0.6521586",
"0.6405202",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.63182056",
"0.62986314",
"0.6231213",
"0.6231213",
"... | 0.8327532 | 0 |
Remove the widget from the current selection. This might emit a selectionchanged signal. | def remove(self, widget, emit_signal=True):
if widget not in self._selection:
return
refresh_selected_nodes(widget)
self._selection.remove(widget)
if emit_signal:
self.selection_changed() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deselect_selected_widget(self) -> None:\n if self.selected_widget is not None:\n self.handles.remove_selected_widget_handles()\n self.selected_widget = None\n self.attr_frame.update(self.selected_widget)",
"def delete_selection(self):\n assert len(self.selection... | [
"0.8118124",
"0.7525685",
"0.6882451",
"0.66998047",
"0.6698724",
"0.6694516",
"0.66866076",
"0.6635822",
"0.64801097",
"0.64374864",
"0.636563",
"0.6328299",
"0.6292681",
"0.6284533",
"0.6270572",
"0.6257519",
"0.6244877",
"0.6064279",
"0.6021653",
"0.5965383",
"0.5961764",
... | 0.8474104 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l) // n * n + n - 1, n):
if len(l[i:i + n]):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.0 | -1 |
Generate a distribution of value at log scale around mean_scale | def rand_scale_log_normal(mean_scale, one_sigma_at_scale):
log_sigma = math.log(one_sigma_at_scale)
return mean_scale*math.exp(random.normalvariate(0.0, log_sigma)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sampler(self, mean, log_var):\n eps = torch.randn_like(mean).to(self.device)\n z = torch.exp(0.5*log_var) * eps + mean\n return z",
"def loguniform_dist(low, high, base=10):\n return ExponentiateDistribution(sp_uniform(low, high - low), base=base)",
"def logistic_log_pdf(x: JaxArray... | [
"0.72332907",
"0.70803094",
"0.70667666",
"0.70076627",
"0.6880286",
"0.680574",
"0.67798686",
"0.677927",
"0.6757918",
"0.6755539",
"0.6751315",
"0.67479265",
"0.6732749",
"0.66909933",
"0.66693336",
"0.6661849",
"0.6650324",
"0.66226184",
"0.6580182",
"0.6580182",
"0.658018... | 0.77951986 | 0 |
Checks if the given resource class attribute is a collection resource attribute. | def is_collection(cls, attr):
return cls._attributes[attr].kind == ResourceAttributeKinds.COLLECTION | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_resource(cls, attr):\n return cls._attributes[attr].kind \\\n in [ResourceAttributeKinds.MEMBER,\n ResourceAttributeKinds.COLLECTION]",
"def is_collection(obj):\n return type(obj) in COLLECTIONS_SET",
"def is_collection_subclass(obj):\n #TODO add UserDict\n... | [
"0.7512374",
"0.6675775",
"0.6403263",
"0.6302588",
"0.6201079",
"0.61626357",
"0.57151306",
"0.55506986",
"0.5498639",
"0.5381917",
"0.52743983",
"0.52050835",
"0.51535946",
"0.5115045",
"0.511316",
"0.5051032",
"0.50288546",
"0.4991826",
"0.49807593",
"0.4963643",
"0.495923... | 0.84112686 | 0 |
Returns a dictionary mapping the attribute names of the given | def get_attributes(cls):
return cls._attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _attrs_map(self) -> \"dict[int, str]\":\n return {i: attr.name for i, attr in enumerate(self._attrs())}",
"def _get_attribute_dic(self, attrs):\n attr_dic = {}\n for attr_pair in attrs:\n attr_dic[attr_pair[0]] = attr_pair[1]\n return attr_dic",
"def get_attributes(se... | [
"0.7952509",
"0.7643066",
"0.74456847",
"0.7258862",
"0.72117114",
"0.71999085",
"0.71527404",
"0.7140451",
"0.7120132",
"0.7114459",
"0.7042364",
"0.70258874",
"0.6943029",
"0.6925513",
"0.69242495",
"0.6918856",
"0.67364424",
"0.6682014",
"0.6661952",
"0.6656818",
"0.660492... | 0.0 | -1 |
Gets the chebi of this CompoundInfoIdentifiers. | def chebi(self):
return self._chebi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obtem_ciclo_in(self):\n\n return self.ciclo_in",
"def icx(self) -> int:\n return self._icx",
"def cisid(self):\n return self._cisid",
"def bic(self):\n if hasattr(self, '_bic'):\n return self._bic\n else:\n self._bic = self.k * np.log(self.data['n... | [
"0.5982249",
"0.593267",
"0.58943814",
"0.5860985",
"0.5602366",
"0.55442077",
"0.5541036",
"0.55300653",
"0.5460631",
"0.5446391",
"0.5446323",
"0.5442885",
"0.5429051",
"0.5389399",
"0.53831744",
"0.5371793",
"0.5343235",
"0.5340355",
"0.53214806",
"0.5311838",
"0.5308601",... | 0.74371856 | 0 |
Gets the mychem_info of this CompoundInfoIdentifiers. | def mychem_info(self):
return self._mychem_info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mychem_info(self, mychem_info):\n\n self._mychem_info = mychem_info",
"def get_mol_info(self):\n return",
"def pubchem(self):\n return self._pubchem",
"def cmid(self):\n return self[\"cmid\"]",
"def get_coulomb_info(self):\n return",
"def getInfo(self):\n ret... | [
"0.61632156",
"0.59161484",
"0.5825422",
"0.5796069",
"0.5726885",
"0.5686033",
"0.55943227",
"0.55533034",
"0.5511014",
"0.54930747",
"0.54425555",
"0.53391033",
"0.533289",
"0.5241448",
"0.5238748",
"0.52244544",
"0.5199093",
"0.5187534",
"0.5186067",
"0.51711094",
"0.51625... | 0.8286394 | 0 |
Create the index page. | def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:]
template = loader.get_template('polls/index.html')
context = {'latest_question_list': latest_question_list, }
return HttpResponse(template.render(context, request)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n\n return {\n 'page': 'index',\n }",
"def index():\n return render_template(\"index.html\",\n title='Index')",
"def index():\n return render_template('index.html')",
"def index():\r\n return render_template('index.html')",
"def i... | [
"0.782788",
"0.7670835",
"0.75808257",
"0.7578521",
"0.75700676",
"0.75700676",
"0.75700676",
"0.75515646",
"0.75515646",
"0.7547543",
"0.7530295",
"0.7497089",
"0.7488716",
"0.74755496",
"0.74755496",
"0.74740994",
"0.7471232",
"0.745537",
"0.7403838",
"0.73960316",
"0.73823... | 0.0 | -1 |
Gets the currently playing song. | def get_currently_playing(self):
return requests.get(
f"{API_URL}/me/player/currently-playing",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {self.access_token}"
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cur_song(self):\n if self._cur_song is None:\n self.restart()\n return self._cur_song",
"async def get_now_playing(self) -> models.MediaItem: # FIXME: Maybe want to abstract MediaItem out\n return await self._pytheos.api.player.get_now_playing_media(self.id)",
"def get_n... | [
"0.7999101",
"0.78060657",
"0.7144427",
"0.69675887",
"0.69615",
"0.68961376",
"0.6858216",
"0.6847958",
"0.68394667",
"0.6811677",
"0.67517906",
"0.6744791",
"0.6736351",
"0.6697418",
"0.6687871",
"0.6663954",
"0.6644427",
"0.6632569",
"0.65956944",
"0.65908676",
"0.6575432"... | 0.7350294 | 2 |
Verify a given StreamAlert Athena table exists. | def check_table_exists(self, table_name):
query_success, query_resp = self.run_athena_query(
query='SHOW TABLES LIKE \'{}\';'.format(table_name),
database=self.DATABASE_STREAMALERT
)
if query_success and query_resp['ResultSet']['Rows']:
return True
L... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_table_exists(self):\n query_result = [{'alerts': True}]\n self.client.athena_client = MockAthenaClient(results=query_result)\n\n result = self.client.check_table_exists('unit-test')\n assert_true(result)\n\n generated_results_key = 'unit-testing/{}'.format(datetime... | [
"0.785302",
"0.71963096",
"0.71212554",
"0.69332486",
"0.6705361",
"0.6654779",
"0.661809",
"0.6613061",
"0.6593077",
"0.65154326",
"0.6503146",
"0.6500852",
"0.648272",
"0.6476876",
"0.6452689",
"0.6439928",
"0.6413171",
"0.63934433",
"0.6374866",
"0.63568383",
"0.6284899",
... | 0.83428353 | 0 |
Get the SQS URL for Athena bucket s3 notifications | def setup(self):
region = self.config['global']['account']['region']
self.sqs_client = boto3.client('sqs', region_name=region)
self.athena_sqs_url = self.sqs_client.list_queues(
QueueNamePrefix=self.QUEUENAME
)['QueueUrls'][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_s3_url(iid):\n return \"http://%s.s3-website.%s.amazonaws.com/%s\" % (\n BUCKET_NAME,\n AWS_CLIENT_CONFIG['region_name'],\n iid\n )",
"def get_s3_url(self, bucket=None, region=None):\n \n if bucket is None:\n bucket = self.AWS_S3_BUCKET\n \n ... | [
"0.7134451",
"0.6746839",
"0.67014647",
"0.66929257",
"0.6610239",
"0.6574489",
"0.64580905",
"0.6392141",
"0.6265416",
"0.62616575",
"0.6225564",
"0.6173248",
"0.6164725",
"0.5975101",
"0.59089816",
"0.59063363",
"0.59035134",
"0.58641565",
"0.5857158",
"0.5850068",
"0.58500... | 0.0 | -1 |
Test default product price being 10. | def test_default_product_price(self):
prod = Product('Test Product')
self.assertEqual(prod.price, 10) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_product_price(self):\r\n prod = Product('Test Product')\r\n self.assertEqual(prod.price, 10)",
"def test_default_product_price(self):\n prod = product('Test Product')\n self.assertEqual(prod.price, 10)\n self.assertEqual(prod.weight, 20)",
"def test_default_p... | [
"0.87333673",
"0.8610413",
"0.8580199",
"0.7287374",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.7263497",
"0.717852",
"0.6858057",
"0.6813622",
"0.67408824",
"0.67408824",
"0.6709257",
"0.6688696",
"0.66599596",
"0.6654696",
"0.6654... | 0.8738257 | 7 |
Return the sequence of ngrams from the source iterator. | def build_ngrams(tokens, n=2):
ngrams = zip(*(islice(group, idx, None) for idx, group in enumerate(tee(tokens, n))))
return ngrams | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n return self.ngrams()",
"def __iter__(self):\n return self.root.ngrams()",
"def extract_ngrams(self, sequence):\n sequence = self.prefix + sequence + self.suffix\n for i, event in enumerate(sequence[self.n:], self.n):\n yield event, sequence[i-self.n:... | [
"0.7459115",
"0.73518085",
"0.7348717",
"0.69573367",
"0.6782112",
"0.66389537",
"0.65920067",
"0.64288414",
"0.6400771",
"0.6382921",
"0.63693655",
"0.63583654",
"0.6291355",
"0.62850034",
"0.62539387",
"0.62292004",
"0.6211746",
"0.6167697",
"0.608409",
"0.60630494",
"0.605... | 0.578046 | 32 |
Gets the color of this Border. | def color(self):
return self.container['color'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def borderColor( self ):\n return self._borderColor",
"def border_color(self) -> int:\n return self._border_color",
"def border_color(self):\n return self._border_rgba",
"def border_color(self):\n if self.has_border:\n return Color(self._border_actor.GetProperty().GetCo... | [
"0.838778",
"0.8312679",
"0.8244084",
"0.8053312",
"0.77918226",
"0.7720178",
"0.7720178",
"0.76940954",
"0.765093",
"0.765093",
"0.765093",
"0.7647774",
"0.7635175",
"0.7628017",
"0.7575632",
"0.7514103",
"0.746279",
"0.7417188",
"0.7417188",
"0.7391515",
"0.7367226",
"0.7... | 0.6883954 | 30 |
Gets the border_type of this Border. | def border_type(self):
return self.container['border_type'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_current_border_type(self):\n border_type = None\n if self.radio_button.isChecked():\n border_type = cv2.BORDER_CONSTANT\n elif self.radio_button2.isChecked():\n border_type = cv2.BORDER_REPLICATE\n elif self.radio_button3.isChecked():\n border_t... | [
"0.74442786",
"0.6669417",
"0.65848345",
"0.6561529",
"0.65112704",
"0.64829284",
"0.64829284",
"0.6384549",
"0.62086326",
"0.61164486",
"0.6045356",
"0.599585",
"0.5933394",
"0.5914833",
"0.58138937",
"0.58138937",
"0.58138937",
"0.5793292",
"0.56463",
"0.5645189",
"0.561799... | 0.86150444 | 0 |
Sets the border_type of this Border. | def border_type(self, border_type):
self.container['border_type'] = border_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def border_type(self):\n return self.container['border_type']",
"def set_border_width(self, width):\n self._border.set_border_width(width)\n self._border_width = width",
"def set_border(self, color: tuple = (0, 0, 0, 255), width: int = 1):\n self.border_color = color\n self.b... | [
"0.6473928",
"0.59496564",
"0.5891179",
"0.57286805",
"0.5655116",
"0.5600376",
"0.5526804",
"0.5526804",
"0.5490651",
"0.54879457",
"0.54860646",
"0.5462281",
"0.54602176",
"0.5450605",
"0.54421926",
"0.5432004",
"0.5392566",
"0.5318965",
"0.52812064",
"0.5277778",
"0.517013... | 0.850068 | 0 |
Gets the line_style of this Border. | def line_style(self):
return self.container['line_style'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_styles (self):\n return self._line_styles",
"def line_style(self, line_style=None):\n\n if line_style is None:\n return self._line_style\n else:\n if not isinstance(line_style, str):\n raise TypeError(\"Line style must be str, not '%s'\" % line_s... | [
"0.75714827",
"0.7322469",
"0.67106134",
"0.6676015",
"0.6461091",
"0.6356543",
"0.634824",
"0.6169874",
"0.609533",
"0.60761803",
"0.60250807",
"0.60250807",
"0.593056",
"0.59279037",
"0.5899835",
"0.58462214",
"0.58462214",
"0.58359545",
"0.5823512",
"0.5808883",
"0.5773731... | 0.8360202 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Border):
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.8456063",
"0.83918154",
"0.8144437",
"0.8140196",
"0.8132038",
"0.8093834",
"0.80918837",
"0.80918837",
"0.80918837",
"0.80852824",
"0.80852824",
"0.807626",
"0.807626",
"0.80657643"
] | 0.0 | -1 |
Returns a function that returns True when a number, x, is between the min and the max, otherwise False | def between(min, max):
def func(x):
return min <= x <= max
return func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def between(x, val1, val2):\n\treturn max(val1, val2) > x > min(val1, val2)",
"def bounds(x, xMin, xMax):\n if (x < xMin):\n x = xMin\n elif (x > xMax):\n x = xMax\n return(x)",
"def isInRange(val, minv, maxv):\n\treturn val >= minv and val <= maxv",
"def in_range(x, a, b):\n return... | [
"0.8178",
"0.7697419",
"0.7613802",
"0.7596197",
"0.7559074",
"0.74551415",
"0.74369055",
"0.7242014",
"0.7141678",
"0.71027523",
"0.7044552",
"0.70325136",
"0.70203424",
"0.6979103",
"0.6938201",
"0.6919412",
"0.68297416",
"0.6801495",
"0.67799956",
"0.6727597",
"0.6726335",... | 0.8035443 | 1 |
Returns True if all the characters in the string are comprised of digits [09], pound ( ) or star ( ), otherwise False | def is_digit_pound_star(string):
return all([char.isdigit() or char in ('#', '*') for char in string]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_right_symbols(string):\n for letter in string:\n if letter in \"$#@\":\n return True\n # End of the loop, we still didn't see any numbers, else we \n # woud have exited the function\n print(\"Your password needs to contain one of those symbols: $#@\")\n return False",
"de... | [
"0.71644783",
"0.7070652",
"0.70606464",
"0.6980603",
"0.69447327",
"0.69088006",
"0.6894829",
"0.6857313",
"0.674419",
"0.6633162",
"0.6624315",
"0.6602388",
"0.6592311",
"0.6587429",
"0.65425277",
"0.65224105",
"0.65126234",
"0.6506785",
"0.6436171",
"0.6428618",
"0.6398788... | 0.8349278 | 0 |
Returns a numpy 2d array representing the ice to contour for the given config. | def grid(config, keep_flag_values=True, treat_coast_as_land=False):
if config.get('daily', False) and config.get('median', False):
start_year, end_year = config['range']
gridset = sid.extent_daily_median(config['hemi'],
start_year,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cntr_points(self, contour, img_size):\n res_arr = []\n # for each row\n for row in range(img_size):\n tmp_arr = []\n # for each column\n for col in range(img_size):\n # if point in contour\n if cv2.pointPolygonTest(contour,... | [
"0.5621567",
"0.56097174",
"0.5550245",
"0.5413701",
"0.5399551",
"0.5340533",
"0.5315892",
"0.5315892",
"0.528273",
"0.52460283",
"0.5230506",
"0.5118397",
"0.5104906",
"0.5088502",
"0.507436",
"0.5066148",
"0.5063148",
"0.5054553",
"0.49497315",
"0.49435",
"0.4926403",
"0... | 0.0 | -1 |
Convert landlike values to land. Returns a copy of the given data where any gridcells with a value in land_like_vals is replaced with land_val. For drawing monthly polylines, we treat land and coast as the same thing. | def _data_massage_land_like(data, land_val=LAND, land_like_vals=[COAST]):
land_like = np.in1d(data, land_like_vals).reshape(data.shape)
return np.where(land_like, land_val, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_land(self, hard_coded_script=None):\n if hard_coded_script is not None:\n # if script to select characters from is hardcoded only take characters from this script regardless of which\n # country the land being painted is within\n for cell in self.cells.keys():\n ... | [
"0.5335857",
"0.53330266",
"0.51588714",
"0.5143716",
"0.48970535",
"0.4872766",
"0.4808741",
"0.47741193",
"0.47735545",
"0.47683516",
"0.47528407",
"0.46907613",
"0.46677044",
"0.46574843",
"0.4632379",
"0.46047768",
"0.4581934",
"0.45711994",
"0.4569815",
"0.45351446",
"0.... | 0.7997546 | 0 |
This function returns the nth value in a sum series. 'n' being it's input integer. 'x' being it's first value and 'y' it's second. | def other_series(n, x, y):
if n == 0:
return x
elif n == 1:
return y
else:
return other_series(n-1, x, y) + other_series(n-2, x, y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_series(n, x = 0, y = 1):\n\n lst = []\n # Append the list at the i index\n for i in range(n):\n if(i == 0):\n lst.append(x)\n elif(i == 1):\n lst.append(y)\n elif(i > 1):\n lst.append((lst[i - 2] + lst[i - 1]))\n nth = lst[i]\n return... | [
"0.8265045",
"0.8003039",
"0.79264474",
"0.74925494",
"0.74632436",
"0.73635286",
"0.73578066",
"0.72145236",
"0.71769965",
"0.71584576",
"0.69851184",
"0.6982123",
"0.69547695",
"0.6901262",
"0.68534535",
"0.6816009",
"0.67345506",
"0.65764654",
"0.6432735",
"0.63214874",
"0... | 0.7552295 | 3 |
Serializes this instance to a JSON string. | def to_json_string(self):
return json.dumps(dataclasses.asdict(self), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.88999254",
"0.8837045",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.87147456",
"0.8637419",
"0.8619328",
"0.8598524",
"0.8572258",
"0.8568808",
"0.8568808",
"0.8446259",
"0.8446259",
"0.8446259",
... | 0.0 | -1 |
Serializes this instance to a Python dictionary. | def to_dict(self):
output = copy.deepcopy(self.__dict__)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return dumpd(self)",
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def to_dict(self):\n return to_dict(self.__dict__)",
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return s... | [
"0.8421195",
"0.84043926",
"0.8362277",
"0.83090377",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.82829785",
"0.8236021",
"0.82179517",
"0.82133806",
"0.82032114",
"0.8181652",
"0.8179579",
"0.81732064",
"0.81534773",
"0.8118078",
"0.8090142",
"0.... | 0.0 | -1 |
Serializes this instance to a JSON string. | def to_json_string(self):
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self) -> str:\n return json.dumps(self.__dict__)",
"def serialize(self):\n return json.dumps(self.as_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> str:\n return json.dumps(self.to_dict())",
"def to_json(self) -> st... | [
"0.88999254",
"0.8837045",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.8805053",
"0.87147456",
"0.8637419",
"0.8619328",
"0.8598524",
"0.8572258",
"0.8568808",
"0.8568808",
"0.8446259",
"0.8446259",
"0.8446259",
... | 0.0 | -1 |
Gets a collection of `InputExample`s for the train set. | def get_train_examples(self, data_dir):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_inputs(self, example):\n return example",
"def get_train_examples(self):\n raise NotImplementedError()",
"def get_train_examples(self, input_file):\r\n raise NotImplementedError()",
"def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in en... | [
"0.73499966",
"0.7173421",
"0.7126833",
"0.65602446",
"0.64204013",
"0.64052176",
"0.63422555",
"0.6290186",
"0.6282746",
"0.625262",
"0.62499267",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0.62466323",
"0... | 0.6192528 | 35 |
Gets a collection of `InputExample`s for the dev set. | def get_dev_examples(self, data_dir):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dev_examples(self, input_file):\r\n raise NotImplementedError()",
"def get_train_inputs(self, example):\n return example",
"def get_examples(self, env):\n return self.fam.c_get_examples(self, env)",
"def get_dev_examples(self):\n raise NotImplementedError()",
"def _create_ex... | [
"0.6808781",
"0.65892154",
"0.65570337",
"0.6550629",
"0.64273113",
"0.63810956",
"0.62559575",
"0.6191911",
"0.6113954",
"0.60946536",
"0.6055742",
"0.60524946",
"0.59929484",
"0.59929484",
"0.59929484",
"0.59929484",
"0.59929484",
"0.59929484",
"0.59929484",
"0.59929484",
"... | 0.5919036 | 30 |
Returns True if the path is valid from the current node position or False otherwise | def is_path_valid(self,path):
null_state=[0 for i in range(len(self.node_names))]
null_state_matrix=np.matrix(null_state).T
new_state=np.matrix(self.state).T
for index,edge in enumerate(path):
#print index
#print edge
edge_position=self.edges.index(edg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_path(self, path: []) -> bool:\n if not path:\n return True\n\n if len(path) == 1:\n return self.contains_vertex(path[0])\n\n i = 0\n j = 1\n while j < len(path):\n if path[j] not in self.adj_list[path[i]]:\n return Fals... | [
"0.73826545",
"0.72639185",
"0.7195065",
"0.70296586",
"0.69636863",
"0.67928785",
"0.6786323",
"0.66549635",
"0.6625065",
"0.66118425",
"0.65545315",
"0.65288675",
"0.6511632",
"0.6454299",
"0.64465696",
"0.6443826",
"0.6439577",
"0.6435393",
"0.6382641",
"0.6379812",
"0.637... | 0.76453304 | 0 |
Checks that data is not changed for the first closed path found. Returns True if data==data after moving around the closed path, False otherwise. Starting point is current_node | def check_closed_path(self):
temp_data=self.data
path=self.get_path(self.current_node,self.current_node)
if self.is_path_valid(path):
pass
else:
print("Path is not valid, graph definition is broken")
raise
out=temp_data==self.data
out_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_recurrent(self):\n G = self._get_recurrence_graph()\n # C = G.strongly_connected_components()\n first_component = next(nx.strongly_connected_components(G))\n abs_numbers = {abs(x) for x in first_component}\n # return sorted(list(set([abs(x) for x in C[0]]))) == \\\n ... | [
"0.60923976",
"0.6071266",
"0.6061803",
"0.6057873",
"0.60539556",
"0.60369587",
"0.5970202",
"0.5904765",
"0.58929324",
"0.58816034",
"0.58525264",
"0.58504",
"0.584496",
"0.583019",
"0.583019",
"0.583019",
"0.58099115",
"0.580115",
"0.5798618",
"0.5791039",
"0.5787569",
"... | 0.7567156 | 0 |
Given a customer id and a date message. Return the message, the main feeling and the emotions names and rates. | def get_emotion_date(id_user: int, date_message: datetime.datetime):
# Query to select the emotion and the rate of a user at a give date
mycursor.execute(f"""SELECT Emotion.nom_emotion, Emotion.rate_emotion
FROM User LEFT JOIN Daily_message on Daily_message.id_user = User.id_user
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def read_messages(id_user: int, date: Optional[datetime.datetime] = None):\n # Check if the date is given or not\n if date:\n mycursor.execute(f\"\"\"SELECT * FROM Daily_message \n WHERE id_user = {id_user}\n AND date_message = '{date}'\"\"\"... | [
"0.54106104",
"0.53628945",
"0.52908003",
"0.528489",
"0.51975524",
"0.5157272",
"0.51061064",
"0.50011015",
"0.49999964",
"0.4997713",
"0.49843815",
"0.49834582",
"0.4961871",
"0.49301404",
"0.4924637",
"0.49158132",
"0.49133378",
"0.48975998",
"0.487003",
"0.48600465",
"0.4... | 0.63624537 | 0 |
Checks to see if a user has this message. | def has_message(self, character):
messages = get_messages(character)
messages = [ message[MESSAGE].id for message in messages ]
if self.message.id in messages:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_user(self, user): # pylint: disable=unused-argument\r\n return False",
"def has_user(self):\n\t\treturn len( self.a_token ) > 0 and len( self.a_secret ) > 0",
"def hasUser(self, id):\n try:\n self.getUser(id)\n return True\n except KeyError:\n retu... | [
"0.7716402",
"0.71434",
"0.70900714",
"0.69371533",
"0.69144",
"0.6892923",
"0.6861886",
"0.6846339",
"0.68240535",
"0.68146676",
"0.6808213",
"0.67256224",
"0.66321266",
"0.66079754",
"0.65523326",
"0.65482193",
"0.6526536",
"0.6512283",
"0.65047",
"0.64958555",
"0.6440854",... | 0.6717808 | 12 |
Compute a columnwise two point derivative | def two_pt_deriv(tseries):
dy = tseries.diff(2).shift(-1)
dx = pd.Series(tseries.index).diff(2).shift(-1)
return dy.apply(lambda x: x.values / dx.values, axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivatives(x_p, y_p):\r\n # set up the matrix equation\r\n n = x_p.shape[0]\r\n M = np.zeros( [n,n] )\r\n d = np.zeros( [n,1] )\r\n \r\n # fill in the constants where they can be\r\n for i in np.arange(1,n-1 ): # for all but the first and last row\r\n M[i,i-1 ] = ( x_p[i] - x_p[i-... | [
"0.71178526",
"0.69272935",
"0.69237393",
"0.67812395",
"0.6621284",
"0.66185516",
"0.6533492",
"0.6533492",
"0.6533375",
"0.6525556",
"0.65158296",
"0.65038645",
"0.6500095",
"0.64921296",
"0.6462247",
"0.6435429",
"0.64307964",
"0.64096475",
"0.6405511",
"0.6396413",
"0.638... | 0.67631936 | 4 |
Initializes all the attributes of a Neural Network object | def __init__(self, netSize):
# TRY THIS FOR RANDOM!
#
#
#
self.biases = [self.randomArray(i, 1) for i in netSize[1:]] # Biases do not exist for the first layer ! Those are inputs.
self.netSize = netSize
#Initialize Weights
#This initializes the weights for each layer based on t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.topology = None\n self.learningRate = None\n self.momentum = None\n self.name = None\n self.size = None\n #self._hiddenActiv_fun_key = None\n #self._outActiv_fun_key = None\n #self.output_activation = None\n #self.hidden_acti... | [
"0.757918",
"0.7466897",
"0.7454284",
"0.7448913",
"0.74208635",
"0.7308732",
"0.72702533",
"0.7266554",
"0.7265684",
"0.7220891",
"0.7167719",
"0.7119762",
"0.7110364",
"0.7094354",
"0.70691323",
"0.7068245",
"0.7055415",
"0.70379025",
"0.7007916",
"0.69958955",
"0.69809294"... | 0.7181007 | 10 |
Creates an array of zeroes with specified dimensions | def array (self, length, width):
return [[0 for i in range(width)] for j in range(length)] #List comprehensions (Works like two for loops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initalize_with_zeros(dim):\n return np.zeros((dim, 1)), 0.0",
"def zeros(dim):\n\n return np.zeros(dim, dtype='uint8')",
"def matZeros(shape):\n return [[0 for y in range(shape[1])] \\\n for x in range(shape[0])]",
"def zeros(shape, dtype=None):\n\n return full(shape, 0, dtype)",
"de... | [
"0.80720776",
"0.79910487",
"0.7800127",
"0.7705183",
"0.76541394",
"0.76202357",
"0.74942774",
"0.7424594",
"0.7395434",
"0.73787457",
"0.7378386",
"0.7369177",
"0.73355037",
"0.7305291",
"0.72439414",
"0.72324413",
"0.7221382",
"0.7198468",
"0.71924585",
"0.7170428",
"0.717... | 0.0 | -1 |
This simply returns the value of our sigmoid function | def sigmoidArray(self, x):
numRows = len(x)
numCols = len(x[0])
return [[self.sigmoid(x[j][i]) for i in range(numCols)] for j in range(numRows)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(value):\n return 1.0 / (1.0 + math.exp(-value))",
"def sigmoid(x):\r\n return 1 ... | [
"0.85256183",
"0.84686184",
"0.84686184",
"0.84682834",
"0.84524685",
"0.8413482",
"0.8404144",
"0.8395439",
"0.83948785",
"0.83915544",
"0.83914274",
"0.83914274",
"0.83914274",
"0.83914274",
"0.83914274",
"0.83914274",
"0.83835536",
"0.83654255",
"0.8361889",
"0.8361889",
"... | 0.0 | -1 |
Compares the quota usage in the provided AbsoluteLimits. | def _compare_quota_usage(self, old_usage, new_usage, expect_diff=True):
# For a resize, instance usage shouldn't change.
self.assertEqual(old_usage['totalInstancesUsed'],
new_usage['totalInstancesUsed'],
'totalInstancesUsed does not match')
# For... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_within_quotas(\n self, requests: Sequence[RequestedQuota], timestamp: Optional[Timestamp] = None\n ) -> Tuple[Timestamp, Sequence[GrantedQuota]]:\n raise NotImplementedError()",
"def __ge__(self, other):\n extremes = self._numerator * other.denominator()\n means = other.n... | [
"0.5585655",
"0.55408514",
"0.54217476",
"0.52968216",
"0.52919036",
"0.528751",
"0.52812916",
"0.52579385",
"0.5187048",
"0.5157344",
"0.5156284",
"0.51517034",
"0.51237553",
"0.51236606",
"0.5121862",
"0.51024026",
"0.50794137",
"0.5051632",
"0.5039611",
"0.5030834",
"0.502... | 0.605653 | 0 |
Compute the 2d planview projection of area of polygon. The last point should not be repeated. Points are represented as (x, y, z) triples. | def polygon_area_2d(polygon):
return geometry.gmPolygonArea(polygon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polygon_area(ppath): # pragma: no cover\n v_ = ppath.vertices\n if len(v_) < 3:\n return 0.0\n x_ = v_[:, 1] - v_[:, 1].mean()\n y_ = v_[:, 0] - v_[:, 0].mean()\n correction = x_[-1] * y_[0] - y_[-1] * x_[0]\n main_area = np.dot(x_[:-1], y_[1:]) - np.dot(y_[:-1], x_[1:])\n return 0... | [
"0.6278647",
"0.62592435",
"0.615552",
"0.599304",
"0.59736884",
"0.5937404",
"0.5907365",
"0.59035474",
"0.58873886",
"0.58869046",
"0.58161867",
"0.5787581",
"0.57770455",
"0.5761289",
"0.57594526",
"0.57417035",
"0.57195246",
"0.5694026",
"0.56449425",
"0.56354564",
"0.563... | 0.64978117 | 0 |
Determines whether a point pt is on the line defined by p1 and p2. If p1 and p2 are equal within tol, this function may fail. Points are represented as (x, y, z) triples. | def on_line_2d(p1, p2, pt, tol=None):
if tol is None:
tol = get_tol_2d()
return geometry.gmOnLineWithTol(p1, p2, pt, tol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_point_on_line(point, line, tol=0.0):\n d = distance_point_line(point, line)\n return d <= tol",
"def is_on_line(p0, p1, p2, threshold = 0.01):\n p0, p1, p2 = map(lambda tup : np.array(tup[:2]), [p0, p1, p2])\n p1 -= p0\n p2 -= p0\n return abs((p1[0] / p1[1]) - (p2[0] / p2[1])) < threshol... | [
"0.76189196",
"0.73657006",
"0.72076005",
"0.70648324",
"0.70077527",
"0.69340825",
"0.6926088",
"0.6922854",
"0.685894",
"0.6720597",
"0.6690552",
"0.6665522",
"0.66225433",
"0.6565142",
"0.6523567",
"0.6510564",
"0.6391002",
"0.6385",
"0.6311969",
"0.62888914",
"0.6280078",... | 0.6941079 | 5 |
Tests whether a point is on the same side of a line as a reference point, or on the line itself. Assumes reference_point is not on the line (within tol). Points are represented as (x, y, z) triples. | def inside_or_on_line_2d(p1, p2, reference_point, pt, tol=None):
if tol is None:
tol = get_tol_2d()
return geometry.gmInsideOrOnLineWithTol(p1, p2, reference_point, pt, tol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_point_on_line(point, line, tol=0.0):\n d = distance_point_line(point, line)\n return d <= tol",
"def inside_of_line_2d(pt1, pt2, reference_point, pt, tol=None):\r\n if tol is None:\r\n tol = get_tol_2d()\r\n return geometry.gmInsideOfLineWithTol(pt1, pt2, reference_point, pt, tol)",
"... | [
"0.71606946",
"0.6793397",
"0.64484173",
"0.63999796",
"0.6361008",
"0.62922925",
"0.6263737",
"0.62290245",
"0.62049687",
"0.6154206",
"0.6149698",
"0.6100681",
"0.6071826",
"0.5998668",
"0.5986444",
"0.5958222",
"0.5956532",
"0.59325963",
"0.5873165",
"0.58472866",
"0.58096... | 0.680826 | 1 |
Tests whether a point is on the same side of a line as another point. Assumes reference_point is not on the line (within tol). Points are represented as (x, y, z) triples. | def inside_of_line_2d(pt1, pt2, reference_point, pt, tol=None):
if tol is None:
tol = get_tol_2d()
return geometry.gmInsideOfLineWithTol(pt1, pt2, reference_point, pt, tol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_point_on_line(point, line, tol=0.0):\n d = distance_point_line(point, line)\n return d <= tol",
"def inside_or_on_line_2d(p1, p2, reference_point, pt, tol=None):\r\n if tol is None:\r\n tol = get_tol_2d()\r\n return geometry.gmInsideOrOnLineWithTol(p1, p2, reference_point, pt, tol)",
... | [
"0.72202367",
"0.6812142",
"0.6577592",
"0.655708",
"0.64811605",
"0.6476953",
"0.6416038",
"0.6395197",
"0.63682914",
"0.6231086",
"0.6215987",
"0.62051535",
"0.61671454",
"0.6143577",
"0.6141982",
"0.6125084",
"0.61095905",
"0.60841167",
"0.60741806",
"0.60181713",
"0.60052... | 0.6856059 | 1 |
Tests whether two points are equal to within tolerance. Points are represented as (x, y, z) triples. | def equal_points_2d(p1, p2, tol=None):
if tol is None:
tol = get_tol_2d()
return geometry.gmEqualPointsXY(p1, p2, tol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approx_eq(x, y, tolerance=1e-15):\n return abs(x - y) < tolerance",
"def approx_eq(x, y, tolerance = 0.000001):\n\treturn abs(x - y) < tolerance",
"def IsApproximatelyEqual(x, y, epsilon):\n # Check absolute precision.\n if -epsilon <= x - y <= epsilon:\n return True\n\n # Is x or y too ... | [
"0.67942303",
"0.6775216",
"0.6666116",
"0.6657528",
"0.6634444",
"0.658396",
"0.65597373",
"0.65597373",
"0.6543186",
"0.65058345",
"0.64889735",
"0.6488207",
"0.64641845",
"0.6444757",
"0.64233494",
"0.6420534",
"0.64170897",
"0.637392",
"0.63714737",
"0.6243911",
"0.621862... | 0.6884697 | 0 |
Tests whether pt is on the line segment defined by pt1 and pt2. Points are represented as (x, y, z) triples. | def on_line_and_between_endpoints_2d(pt1, pt2, pt, tol=None):
if tol is None:
tol = get_tol_2d()
return geometry.gmOnLineAndBetweenEndpointsWithTol(pt1, pt2, pt, tol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPointOnLine(node1, node2, point):\n m, b, d = geometry.lineSpec(node1, node2)\n if d == -1: # if two nodes are the same\n if node1 == point:\n return True\n else:\n return False\n else:\n if m == True: # parallel to y axis\n ... | [
"0.73231405",
"0.7282912",
"0.723982",
"0.7223311",
"0.7108988",
"0.70953757",
"0.70592695",
"0.7058627",
"0.7003406",
"0.69622123",
"0.69482034",
"0.6882417",
"0.68217635",
"0.68212765",
"0.68096787",
"0.68079436",
"0.6770083",
"0.67513764",
"0.6739109",
"0.6691163",
"0.6643... | 0.7282344 | 2 |
Computes the cross product of two points. Points are represented as (x, y, z) triples. | def cross_2d(origin, a, b):
return geometry.gmCross2D(origin, a, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )",
"def cross_product(p0,p1,p2):\n\treturn (((p1[0]-p0[0])*(p2[1]-p0[1]))-((p2[0]-p0[0])*(p1[1]-p0[1])))",
"def crossProduc... | [
"0.768028",
"0.7640519",
"0.7530705",
"0.7495768",
"0.7412133",
"0.7390931",
"0.73895144",
"0.73361033",
"0.7324387",
"0.7308877",
"0.72916734",
"0.72532153",
"0.72347593",
"0.72310704",
"0.7201172",
"0.7178708",
"0.7161169",
"0.7138592",
"0.7103409",
"0.7099777",
"0.70903033... | 0.6257996 | 46 |
Get the closest distance from pt to the line defined by pt1 and pt2. Unlike distance_to_line_segment_2d, points outside the line segment defined by pt1 and pt2 will be considered when finding the closest distance to pt. Points are represented as (x, y, z) triples. | def distance_to_line_2d(pt1, pt2, pt, tol=None):
if tol is None:
tol = get_tol_2d()
return geometry.gm2DDistanceToLineWithTol(pt1, pt2, pt, tol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_to_line_segment_2d(pt1, pt2, pt, tol=None):\r\n if tol is None:\r\n tol = get_tol_2d()\r\n return geometry.gm2DDistanceToLineSegmentWithTol(pt1, pt2, pt, tol)",
"def find_closest_pt_on_segment_2d(pt1, pt2, pt, tol=None):\r\n if tol is None:\r\n tol = get_tol_2d()\r\n return... | [
"0.7893652",
"0.76820993",
"0.767087",
"0.75213945",
"0.74758786",
"0.7378801",
"0.7350677",
"0.7307005",
"0.7270144",
"0.7205404",
"0.7203808",
"0.71905786",
"0.7172129",
"0.7111912",
"0.709697",
"0.7088243",
"0.7072708",
"0.7059955",
"0.7057612",
"0.70487237",
"0.7031816",
... | 0.79312575 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.