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 |
|---|---|---|---|---|---|---|
Set normal probability density function | def set_density(self, theta, scale):
self.density = Normal(self.mean(theta), scale) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_pdf(x: torch.Tensor) -> torch.Tensor:\n return torch.exp(-(x ** 2 / 2)) / np.sqrt(2 * np.pi)",
"def probability_density(self, X):\n raise NotImplementedError",
"def normal_distr(x, mu, sigma, s=1):\n \n return s * 1/(sigma * torch.sqrt(torch.tensor(2 * np.pi))) * torch.exp((-1/2) * (... | [
"0.67801833",
"0.6755923",
"0.67078704",
"0.67059124",
"0.6578981",
"0.6533579",
"0.652303",
"0.6458603",
"0.6429473",
"0.6385546",
"0.6385546",
"0.6345143",
"0.63312536",
"0.6304768",
"0.62980795",
"0.62917155",
"0.62680686",
"0.62666124",
"0.62543845",
"0.62536865",
"0.6244... | 0.7097677 | 0 |
Set the parameters of of normal probability density function | def set_density_params(self, theta, scale=None):
self.density.loc = self.mean(theta)
if scale is not None:
self.density.scale = scale | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_parameters(self):\n logger.info('===== Initialize %s with normal distribution =====' % self.__class__.__name__)\n for n, p in self.named_parameters():\n init_like_transformer_xl(n, p, std=0.02)",
"def set_density(self, theta, scale):\n self.density = Normal(self.mean(the... | [
"0.70059043",
"0.6926919",
"0.633595",
"0.6330357",
"0.62646884",
"0.6241562",
"0.6241562",
"0.6224037",
"0.6224037",
"0.60877436",
"0.60753626",
"0.6030707",
"0.60169643",
"0.59793794",
"0.5979102",
"0.5979102",
"0.5975218",
"0.5975218",
"0.5973638",
"0.5953766",
"0.5940995"... | 0.6777002 | 2 |
Get the number of significant decimals | def get_significant_decimals(a: float, b: float, operator: str) -> int:
a = str(a)
b = str(b)
decimal_regex = r'(?<=\.)[0]*[1-9]+'
a_dec = re.search(decimal_regex, a)
b_dec = re.search(decimal_regex, b)
a_dec = a_dec.end()- a_dec.start() if a_dec else 0
b_dec = b_dec.end()- b_dec.start(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_sigfigs(x):\n sigfig_re = re.compile(\"([0-9.]+)\")\n m = sigfig_re.search(\"{:e}\".format(float(x))) # turn to scientific form\n\n if m:\n val = m.group(1).replace(\".\", \"\")\n while val[-1:] == '0': # remove all trailing zeros\n val = val[0:-1]\n return len(v... | [
"0.7420559",
"0.67916536",
"0.6755642",
"0.6587748",
"0.6565861",
"0.6366491",
"0.6333529",
"0.63089216",
"0.62499017",
"0.6234093",
"0.6065148",
"0.60396826",
"0.60212463",
"0.6004238",
"0.5991197",
"0.59855926",
"0.5971467",
"0.59665966",
"0.5928815",
"0.5908326",
"0.588904... | 0.6086487 | 10 |
Test string to list with default delimiter (comma). | def test_string_to_list_string(self):
assert_equals(
str_to_list('a, b, c'),
['a', 'b', 'c']
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_string_to_list_string(self):\n assert_equals(\n str_to_list('a, b, c'),\n ['a', 'b', 'c']\n )",
"def test_string_to_list_string_delimiter(self):\n assert_equals(\n str_to_list(' a | b | c ', delimiter='|'),\n ['a', 'b', 'c']\n )",
... | [
"0.7599828",
"0.73749596",
"0.73197794",
"0.7104217",
"0.70850724",
"0.69901824",
"0.69228685",
"0.6868293",
"0.6827386",
"0.68251467",
"0.68251467",
"0.68128663",
"0.6805993",
"0.6741072",
"0.6619719",
"0.6602993",
"0.65685004",
"0.6544581",
"0.65275055",
"0.65158194",
"0.65... | 0.7516786 | 1 |
Test generating job id with returning successful job set to True a job that is running. | def test_gen_job_id_return_success_true_running(self, mock_reattach_job):
job_id = 'running'
mock_reattach_job.side_effect = [
FakeRunningJob(job_id=job_id, status='FAILED'),
FakeRunningJob(job_id=job_id+'-1', status='KILLED'),
FakeRunningJob(job_id=job_id+'-2', sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gen_job_id_return_success_true(self, mock_reattach_job):\n\n job_id = 'return-successful-true'\n\n mock_reattach_job.side_effect = [\n FakeRunningJob(job_id=job_id, status='FAILED'),\n FakeRunningJob(job_id=job_id+'-1', status='KILLED'),\n FakeRunningJob(job_... | [
"0.78725076",
"0.76736796",
"0.7493212",
"0.71150243",
"0.7052669",
"0.6964573",
"0.68550575",
"0.68537855",
"0.68313116",
"0.6746439",
"0.6732427",
"0.67050314",
"0.67045784",
"0.66047156",
"0.6602651",
"0.65895987",
"0.6550436",
"0.6549443",
"0.6527391",
"0.65093195",
"0.64... | 0.78671706 | 1 |
Test generating job id with returning successful job set to True. | def test_gen_job_id_return_success_true(self, mock_reattach_job):
job_id = 'return-successful-true'
mock_reattach_job.side_effect = [
FakeRunningJob(job_id=job_id, status='FAILED'),
FakeRunningJob(job_id=job_id+'-1', status='KILLED'),
FakeRunningJob(job_id=job_id+'-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gen_job_id_with_return_success_false(self, mock_reattach_job):\n\n job_id = 'return-successful-false'\n\n mock_reattach_job.side_effect = [\n FakeRunningJob(job_id=job_id, status='FAILED'),\n FakeRunningJob(job_id=job_id+'-1', status='KILLED'),\n FakeRunningJ... | [
"0.7564261",
"0.74883693",
"0.7390486",
"0.7016395",
"0.68192",
"0.67902786",
"0.66288406",
"0.6501989",
"0.6498588",
"0.6440645",
"0.6356046",
"0.6341766",
"0.63193315",
"0.62934905",
"0.6233492",
"0.62061447",
"0.6195039",
"0.6178637",
"0.61620325",
"0.6161178",
"0.61561114... | 0.78779596 | 0 |
Test generating job id with returning successful job set to False. | def test_gen_job_id_with_return_success_false(self, mock_reattach_job):
job_id = 'return-successful-false'
mock_reattach_job.side_effect = [
FakeRunningJob(job_id=job_id, status='FAILED'),
FakeRunningJob(job_id=job_id+'-1', status='KILLED'),
FakeRunningJob(job_id=jo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gen_job_id_return_success_true(self, mock_reattach_job):\n\n job_id = 'return-successful-true'\n\n mock_reattach_job.side_effect = [\n FakeRunningJob(job_id=job_id, status='FAILED'),\n FakeRunningJob(job_id=job_id+'-1', status='KILLED'),\n FakeRunningJob(job_... | [
"0.7741159",
"0.7461373",
"0.73588055",
"0.6930334",
"0.6583131",
"0.65478027",
"0.65010905",
"0.64234984",
"0.63584983",
"0.62917596",
"0.62569994",
"0.6226213",
"0.6140012",
"0.60707146",
"0.60637915",
"0.6037563",
"0.6029693",
"0.6025145",
"0.5995659",
"0.59863645",
"0.596... | 0.76607066 | 1 |
Test generating job id with returning successful job set to False with a job that is running. | def test_gen_job_id_with_return_success_false_with_running(self, mock_reattach_job):
job_id = 'return-successful-false-running'
mock_reattach_job.side_effect = [
FakeRunningJob(job_id=job_id, status='FAILED'),
FakeRunningJob(job_id=job_id+'-1', status='KILLED'),
Fak... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gen_job_id_return_success_true(self, mock_reattach_job):\n\n job_id = 'return-successful-true'\n\n mock_reattach_job.side_effect = [\n FakeRunningJob(job_id=job_id, status='FAILED'),\n FakeRunningJob(job_id=job_id+'-1', status='KILLED'),\n FakeRunningJob(job_... | [
"0.79073787",
"0.7863281",
"0.7777591",
"0.70760703",
"0.68380785",
"0.67975783",
"0.6749784",
"0.67238766",
"0.6715908",
"0.67016995",
"0.6580349",
"0.6573049",
"0.6571408",
"0.654079",
"0.6522122",
"0.64691615",
"0.643991",
"0.6415732",
"0.64026153",
"0.6357849",
"0.6337188... | 0.78893054 | 1 |
Check if this image is a valid Cloud Optimized GeoTiff. | def validateCOG(self, check_tiled=True, full_check=False, strict=True, warn=True):
from osgeo_utils.samples.validate_cloud_optimized_geotiff import validate
warnings, errors, details = validate(
self._largeImagePath,
check_tiled=check_tiled,
full_check=full_check,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _image_is_large_enough(im):\n return (im.shape[0] >= MIN_DIM) and (im.shape[1] >= MIN_DIM)",
"def is_depth_image(self):\n return False",
"def image_check(kwargs) -> bool:\n\n # Kwarg argument check\n return kwarg_check(\n kwargs=kwargs,\n options=[\n \"min_captured_... | [
"0.5987881",
"0.5779735",
"0.5730866",
"0.56918925",
"0.5638255",
"0.5636361",
"0.5578449",
"0.55775106",
"0.5574633",
"0.5539387",
"0.5539387",
"0.55163896",
"0.5516275",
"0.5502651",
"0.546829",
"0.54644793",
"0.54386574",
"0.5435139",
"0.5420467",
"0.5416232",
"0.53532124"... | 0.6501267 | 0 |
Entropy{p1, p2, ..., pk} = (\sum_{i=1}(pilog_4(pi))) where p = the probability of kth label (i.e., probability of "unacc", "acc".. etc.) | def find_entropy(examples_set):
pk = find_probabilities_of_labels(examples_set)
result = 0
for p in pk:
if p != 0:
result = result + (p * math.log(p, 2.0))
result = -result
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entropy(self, rows):\n label_count = defaultdict(int)\n total_count = 0\n for row in rows:\n label = row[self.target_attribute]\n label_count[label] += 1\n total_count += 1\n return sum([-(float(label_count[label]) /\n total_... | [
"0.7328616",
"0.71650124",
"0.7097766",
"0.706306",
"0.70323503",
"0.70218766",
"0.6994249",
"0.6939835",
"0.69396365",
"0.69038767",
"0.68861264",
"0.68860614",
"0.688081",
"0.68786895",
"0.6860839",
"0.6857505",
"0.6842906",
"0.6841679",
"0.6830465",
"0.68263215",
"0.682534... | 0.7049804 | 4 |
Returns the index of the attribute given a list of attributes. | def get_index(attribute, attributes):
for i in range(14):
if attribute == attributes[i]:
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attribute_idx(data, stimulus_idx, attribute):\n attribute_names = data['stimuli'][stimulus_idx]['dimnames']\n for attribute_idx, attribute_str in enumerate(attribute_names):\n if attribute_str == attribute:\n return attribute_idx\n\n raise KeyError('Attribute {} for stimulus_ids ... | [
"0.73938876",
"0.72550905",
"0.69739354",
"0.6962037",
"0.6157904",
"0.5883374",
"0.56698936",
"0.5663685",
"0.56469834",
"0.5610526",
"0.5521971",
"0.5484828",
"0.5475316",
"0.5472528",
"0.54595095",
"0.5449486",
"0.54472905",
"0.5440559",
"0.5406396",
"0.5391892",
"0.538325... | 0.80519223 | 0 |
Return the average minutes of delays in each month | def avg_mins_by_month(db: str)-> List[tuple]:
query = """SELECT month, AVG(minutes)
FROM delays
GROUP BY month
ORDER BY CASE
WHEN month = 'sept2017' THEN 1
WHEN month = 'oct2017' THEN 2
WHEN month = 'nov2017' THEN 3
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obtain_monthly_mean(data=pd.DataFrame()):\n return data.resample(\"MS\").mean()",
"def averageTime(self):\n \n pass",
"def average_monthly(X, daysPassedMonth, daysPerMonth):\n \n NumberCombinations = np.shape(X)[0]\n X_average=np.zeros((NumberCombinations, 24*12))\n for combination ... | [
"0.6415436",
"0.64030516",
"0.616808",
"0.61372477",
"0.59920913",
"0.59920913",
"0.59920913",
"0.59679264",
"0.59148836",
"0.5846982",
"0.5832878",
"0.58218294",
"0.58129346",
"0.58070534",
"0.5757412",
"0.5682873",
"0.5660415",
"0.56571954",
"0.5655737",
"0.56556123",
"0.56... | 0.6766947 | 0 |
Writes a file to the git database and produces its git hash. | def _git_intern_file(self, file_contents, cwd, commit_hash):
cmd = 'hash-object -t blob -w --stdin'.split(' ')
stdin = self.api.m.raw_io.input(file_contents)
stdout = self.api.m.raw_io.output()
step_name = 'Hashing modified DEPS file with revision ' + commit_hash
step_result = self.api.m.git(*cmd, c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file(self, filename, contents):\n blob = self.repo.create_blob(contents)\n self.index.add(pygit2.IndexEntry(filename, blob, pygit2.GIT_FILEMODE_BLOB))",
"def commit(hashes_file, bitcoin_key):\n logentry = LogEntry()\n\n for line in open(hashes_file):\n logentry.add_sha256(unh... | [
"0.6597363",
"0.6380266",
"0.6364687",
"0.6328963",
"0.62690824",
"0.62345916",
"0.61473936",
"0.6108748",
"0.60977906",
"0.6085713",
"0.6074401",
"0.60660505",
"0.6026786",
"0.60245496",
"0.5995089",
"0.5989244",
"0.5989244",
"0.59781533",
"0.5956775",
"0.5951876",
"0.592963... | 0.686036 | 0 |
Convert underlying query compilers data to ``pandas.DataFrame``. Returns pandas.DataFrame The QueryCompiler converted to pandas. | def to_pandas(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_dataframe(self) -> \"pd.DataFrame\":\n import pandas as pd\n\n df = pd.DataFrame([row.as_series() for row in self.rows])\n return df",
"def to_pandas_df(self):\n data = self._get_data(pd=True)\n return data",
"def to_pandas(self):\n # TODO Add type translation.\... | [
"0.7178566",
"0.7074102",
"0.7027044",
"0.7026306",
"0.70097536",
"0.69882536",
"0.6868304",
"0.6771064",
"0.67515075",
"0.67194295",
"0.6719048",
"0.67129284",
"0.67118466",
"0.66970575",
"0.6681513",
"0.66803813",
"0.66692424",
"0.66164184",
"0.6548798",
"0.6543395",
"0.650... | 0.63851786 | 29 |
Fill null elements of `self` with value in the same location in `other`. If axes are not equal, perform frames alignment first. | def combine_first(self, other, **kwargs): # noqa: PR02
return BinaryDefault.register(pandas.DataFrame.combine_first)(
self, other=other, **kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _merge_inplace(self, other):\n if other is None:\n yield\n else:\n # don't include indexes in priority_vars, because we didn't align\n # first\n priority_vars = OrderedDict(\n (k, v) for k, v in self.variables.items() if k not in self.dim... | [
"0.6012547",
"0.57464975",
"0.5619093",
"0.5563153",
"0.5557716",
"0.555148",
"0.5465113",
"0.54503524",
"0.5358417",
"0.530338",
"0.52908725",
"0.5289391",
"0.5281142",
"0.5274167",
"0.525185",
"0.52477515",
"0.5211381",
"0.51700735",
"0.51383066",
"0.51355696",
"0.5130268",... | 0.0 | -1 |
Get column data by label as pandas.Series. | def _get_column_as_pandas_series(self, key):
result = self.getitem_array([key]).to_pandas().squeeze(axis=1)
if not isinstance(result, pandas.Series):
raise RuntimeError(
f"Expected getting column {key} to give "
+ f"pandas.Series, but instead got {type(result)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column(self, label):\n dis = []\n for x in self.rows:\n dis = dis + [x[self.column_labels.index(label)]]\n return dis\n # return self.rows[self.column_labels.index(label)]",
"def _get_column(self, column_or_label):\n c = column_or_label\n if isinstance(c, ... | [
"0.70182896",
"0.61772114",
"0.59096074",
"0.58245206",
"0.57554513",
"0.57306933",
"0.5685542",
"0.5679807",
"0.5640324",
"0.5635656",
"0.5605904",
"0.5561545",
"0.55126536",
"0.5478005",
"0.54747593",
"0.5467604",
"0.5461635",
"0.5413309",
"0.5363357",
"0.5361741",
"0.53364... | 0.5803683 | 4 |
Return boolean if values in the object are monotonically increasing. Returns bool | def is_monotonic_increasing(self):
return SeriesDefault.register(pandas.Series.is_monotonic_increasing)(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_monotonic_decreasing(self) -> bool:\n # monotonic decreasing if and only if reverse is monotonic increasing\n return self[::-1].is_monotonic_increasing",
"def is_sorted(self):\n previous = 0 # Setting to 0 shouldn't be an issue aslong as MIN_VALUE is at least 0\n for value in ... | [
"0.6865822",
"0.67540365",
"0.6742378",
"0.65915745",
"0.6518575",
"0.6318547",
"0.6254051",
"0.6214034",
"0.6207452",
"0.6125734",
"0.6117266",
"0.6111474",
"0.60909104",
"0.60753226",
"0.6040103",
"0.602355",
"0.60044944",
"0.5992493",
"0.5974965",
"0.5969545",
"0.5969133",... | 0.65452826 | 4 |
Return boolean if values in the object are monotonically decreasing. Returns bool | def is_monotonic_decreasing(self):
return SeriesDefault.register(pandas.Series.is_monotonic_decreasing)(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_monotonic_decreasing(self) -> bool:\n # monotonic decreasing if and only if reverse is monotonic increasing\n return self[::-1].is_monotonic_increasing",
"def is_increasing(data):\n pass",
"def is_monotonic_increasing(self):\n return SeriesDefault.register(pandas.Series.is_monoto... | [
"0.7661428",
"0.6975034",
"0.6746523",
"0.672616",
"0.6633899",
"0.6598428",
"0.6584515",
"0.65740216",
"0.6449511",
"0.6340435",
"0.6302828",
"0.62531674",
"0.6241536",
"0.6213131",
"0.62054986",
"0.6118089",
"0.60890293",
"0.60751647",
"0.6074199",
"0.60673976",
"0.60640115... | 0.6924787 | 2 |
Replace values where the condition `cond` is True. Returns BaseQueryCompiler New QueryCompiler with elements replaced with ones from `other` where `cond` is True. | def mask(self, cond, other, **kwargs): # noqa: PR01
return DataFrameDefault.register(pandas.DataFrame.mask)(
self, cond, other, **kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def where(self, cond, other, **kwargs): # noqa: PR02\n return DataFrameDefault.register(pandas.DataFrame.where)(\n self, cond=cond, other=other, **kwargs\n )",
"def assign_when(lhs, rhs, conditions):\n for nd_index in np.ndindex(lhs.shape):\n if conditions[nd_index]:\n lhs[nd_i... | [
"0.5708477",
"0.5282244",
"0.5097151",
"0.49866322",
"0.4963681",
"0.48932472",
"0.47283506",
"0.46269017",
"0.4600547",
"0.45533377",
"0.45529318",
"0.45372614",
"0.4421013",
"0.43981633",
"0.4394641",
"0.43856317",
"0.43517214",
"0.43175963",
"0.43090308",
"0.43044934",
"0.... | 0.52414435 | 2 |
Convert columns of the QueryCompiler to the datetime dtype. | def to_datetime(self, *args, **kwargs):
return SeriesDefault.register(pandas.to_datetime)(self, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert(frame):\n frame = frame.convert_objects(convert_numeric=True)\n for column in frame:\n if column in c.dates:\n frame[column] = frame[column].astype('datetime64')\n return frame",
"def dt_to_pydatetime(self):\n return DateTimeDefault.register(pandas.Series.dt.to_pyda... | [
"0.6836998",
"0.66343814",
"0.64229715",
"0.6328779",
"0.6140836",
"0.6100975",
"0.6092735",
"0.5967828",
"0.5964857",
"0.5899258",
"0.5881144",
"0.58372337",
"0.5830784",
"0.58270943",
"0.5816091",
"0.5737446",
"0.5700464",
"0.5669621",
"0.56645733",
"0.5652112",
"0.5608656"... | 0.6433974 | 2 |
Apply passed function elementwise. | def applymap(self, func, *args, **kwargs):
return DataFrameDefault.register(pandas.DataFrame.applymap)(
self, func, *args, **kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(self, func, *args):\n pass",
"def apply(self, func, *args, **kwargs):\n pass",
"def apply(self, function, *args, **kwargs):\n pass",
"def apply(cls, func):\n raise NotImplementedError",
"def applyToEach(L,f):\n for i in range(len(L)):\n L[i] = f(L[i])",
"de... | [
"0.7667716",
"0.7619807",
"0.75417525",
"0.72570974",
"0.72059256",
"0.7130036",
"0.7086028",
"0.7043221",
"0.7027774",
"0.70002466",
"0.696466",
"0.6847594",
"0.6844164",
"0.6839754",
"0.6635122",
"0.6622388",
"0.6605588",
"0.659064",
"0.655061",
"0.6528702",
"0.6528017",
... | 0.5760019 | 97 |
Return the integer indices that would sort the Series values. Override ndarray.argsort. Argsorts the value, omitting NA/null values, and places the result in the same locations as the nonNA values. | def argsort(self, **kwargs): # noqa: PR02
return SeriesDefault.register(pandas.Series.argsort)(self, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argsort(data, reversed=False):\n\n index = np.arange(len(data))\n key = lambda x: data[x]\n sortidx = sorted(index, key=key,reverse=reversed)\n sortidx = np.array(list(sortidx))\n return sortidx",
"def _argsort(seq):\n # http://stackoverflow.com/questions/3071415/efficient-method-to-calcula... | [
"0.68214244",
"0.6388833",
"0.6262796",
"0.6152183",
"0.6017884",
"0.59798586",
"0.59694034",
"0.59371024",
"0.5712881",
"0.5704977",
"0.567824",
"0.56720495",
"0.5667777",
"0.5667609",
"0.5646133",
"0.5620333",
"0.5593816",
"0.55647707",
"0.55567133",
"0.55500156",
"0.553832... | 0.67422855 | 1 |
Convert underlying data to numeric dtype. | def to_numeric(self, *args, **kwargs): # noqa: PR02
return SeriesDefault.register(pandas.to_numeric)(self, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toNumeric(self):\n for column in list(self.data.columns):\n if not is_numeric_dtype(self.data[column]):\n values = list(sorted(self.data[column].unique()))\n indices = [index for index, value in enumerate(values)]\n self.data[column] = self.data[co... | [
"0.7196644",
"0.70000637",
"0.6628361",
"0.6535753",
"0.6468631",
"0.6201777",
"0.62004703",
"0.61736465",
"0.61135316",
"0.6094723",
"0.6033249",
"0.601148",
"0.5949899",
"0.59299564",
"0.59199625",
"0.59169346",
"0.5874936",
"0.58705735",
"0.58699816",
"0.58555406",
"0.5826... | 0.7104397 | 1 |
Convert columns dtypes to given dtypes. | def astype(self, col_dtypes, errors: str = "raise"): # noqa: PR02
return DataFrameDefault.register(pandas.DataFrame.astype)(
self, dtype=col_dtypes, errors=errors
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_column_types(self):\n type_list = [\"category\" if u_input == 1 else float for u_input in self.user_column_label]\n self.df = self.df.astype(dict(zip(self.df.columns, type_list)))\n df_types = pd.DataFrame(self.df.dtypes).reset_index()\n df_types.columns = [\"column_name\", \... | [
"0.66267186",
"0.65652454",
"0.65377486",
"0.6522656",
"0.64960134",
"0.63529843",
"0.6338003",
"0.63355935",
"0.63288695",
"0.63015723",
"0.62628376",
"0.62533873",
"0.6242137",
"0.6230301",
"0.6191892",
"0.6174604",
"0.61647916",
"0.6143277",
"0.6132584",
"0.6125871",
"0.60... | 0.63469785 | 6 |
Attempt to infer better dtypes for object columns. Attempts soft conversion of objectdtyped columns, leaving nonobject and unconvertible columns unchanged. The inference rules are the same as during normal Series/DataFrame construction. Returns BaseQueryCompiler New query compiler with udpated dtypes. | def infer_objects(self):
return DataFrameDefault.register(pandas.DataFrame.infer_objects)(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_dtypes(\n self,\n infer_objects: bool = True,\n convert_string: bool = True,\n convert_integer: bool = True,\n convert_boolean: bool = True,\n convert_floating: bool = True,\n dtype_backend: DtypeBackend = \"numpy_nullable\",\n ):\n return Data... | [
"0.7311645",
"0.6141115",
"0.5951801",
"0.59252405",
"0.5858429",
"0.5804716",
"0.57135195",
"0.56596303",
"0.5637005",
"0.5549481",
"0.55312085",
"0.55210197",
"0.54947287",
"0.5372321",
"0.53722",
"0.53638613",
"0.53631264",
"0.5359891",
"0.5349382",
"0.5315697",
"0.5295546... | 0.5911609 | 4 |
Return index label of first nonNaN/NULL value. Returns scalar | def first_valid_index(self):
return (
DataFrameDefault.register(pandas.DataFrame.first_valid_index)(self)
.to_pandas()
.squeeze()
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_first_non_nan(array):\n for index, value in enumerate(array):\n if not np.isnan(value):\n return index",
"def first_label(self):\n if self.labels:\n return self.labels[0]\n else:\n return None",
"def get_nan_idx(column, df):\n ret... | [
"0.6835309",
"0.68267745",
"0.65452796",
"0.6204963",
"0.61745405",
"0.6162127",
"0.6115417",
"0.6045796",
"0.60122323",
"0.59438425",
"0.59438425",
"0.59438425",
"0.59356296",
"0.59039",
"0.58519214",
"0.58519214",
"0.5845297",
"0.5845297",
"0.5835075",
"0.5835075",
"0.58037... | 0.0 | -1 |
Get position of the first occurrence of the minimum for each row or column. | def idxmin(self, **kwargs): # noqa: PR02
return DataFrameDefault.register(pandas.DataFrame.idxmin)(self, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min(self):\n\n\n min_x = 1000\n min_y = 1000\n k = len(self.__col_lista)\n for i in range(k):\n x, y = self.__col_lista[i]\n if x < min_x:\n min_x = x\n if y < min_y:\n min_y = y\n return min_x, min_y",
"de... | [
"0.7606432",
"0.7486169",
"0.74666184",
"0.7378834",
"0.72925377",
"0.7253958",
"0.71094084",
"0.710032",
"0.710032",
"0.7065796",
"0.69802296",
"0.69791645",
"0.6967608",
"0.6948678",
"0.6929608",
"0.6911934",
"0.6895985",
"0.688899",
"0.6875615",
"0.6849772",
"0.6836843",
... | 0.0 | -1 |
Return index label of last nonNaN/NULL value. Returns scalar | def last_valid_index(self):
return (
DataFrameDefault.register(pandas.DataFrame.last_valid_index)(self)
.to_pandas()
.squeeze()
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _next_unlabelled_col(x):\n for i in range(self.n_cols):\n idx = (x + i) % self.n_cols\n x_current = self._x_positions[idx]\n if self._cols[x_current].label is None:\n return idx",
"def first_label(self):\n if self.labels:\n ... | [
"0.62180364",
"0.61514366",
"0.6128868",
"0.6112533",
"0.59477663",
"0.59477663",
"0.5915875",
"0.58772737",
"0.58652467",
"0.5849298",
"0.57923335",
"0.5783711",
"0.5774498",
"0.5758952",
"0.57212836",
"0.5717264",
"0.5700071",
"0.56982714",
"0.5691616",
"0.56902575",
"0.568... | 0.5335152 | 56 |
Return boolean Series denoting duplicate rows. | def duplicated(self, **kwargs):
return DataFrameDefault.register(pandas.DataFrame.duplicated)(self, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_duplicate_rows(df):\n\treturn df.duplicated().sum()",
"def is_duplicate(self):\n return bool(self.duplicated)",
"def test_are_duplicates_true(self):\n rules = [\n pd.Series({\"A\": \"high\", \"B\": Bounds(lower=1, upper=1), \"C\": Bounds(lower=1, upper=1), \"Class\": \"apple\"}... | [
"0.66962427",
"0.6345543",
"0.6297283",
"0.62205887",
"0.62191767",
"0.61853206",
"0.60617083",
"0.6031279",
"0.5952495",
"0.5909576",
"0.5865909",
"0.57123417",
"0.56867814",
"0.5643697",
"0.56338406",
"0.5628796",
"0.5599933",
"0.55956906",
"0.5586573",
"0.5564077",
"0.5559... | 0.6518206 | 1 |
Get column data for target labels. | def getitem_column_array(self, key, numeric=False, ignore_order=False):
def get_column(df, key):
if numeric:
return df.iloc[:, key]
else:
return df[key]
return DataFrameDefault.register(get_column)(self, key=key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_own_target():\n data = Data()\n target = data.get_label_col()\n return target.values",
"def get_labels(self):\n\n labels = list(self.meta_data[self.target_column])\n\n return labels",
"def get_targets(self, df):\n return df.iloc[:, self.target_col]",
"def column(self, l... | [
"0.76562256",
"0.72727287",
"0.7057856",
"0.69942695",
"0.6444361",
"0.6442194",
"0.64207816",
"0.62213004",
"0.61960655",
"0.6189303",
"0.6078397",
"0.59455943",
"0.5943184",
"0.5935936",
"0.59046566",
"0.59012216",
"0.5884195",
"0.5856353",
"0.5848508",
"0.58355045",
"0.582... | 0.0 | -1 |
Pivot a level of the (necessarily hierarchical) index labels. | def unstack(self, level, fill_value):
return DataFrameDefault.register(pandas.DataFrame.unstack)(
self, level=level, fill_value=fill_value
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_lvl(a, thlds, labels):\n if len(labels) != len(thlds) + 1:\n raise ValueError(\"Must be one more label than number of thresholds\")\n lvl_indexes = index_lvl(a, thlds)\n return np.take(labels, lvl_indexes)",
"def make_index(cls, selector, names=[]):\n\n assert cls.is_selector(sel... | [
"0.55825186",
"0.54157853",
"0.5290193",
"0.52227354",
"0.51961017",
"0.51941335",
"0.51261646",
"0.51091826",
"0.5059404",
"0.50194997",
"0.49861678",
"0.49650565",
"0.4941675",
"0.49147475",
"0.49135137",
"0.4880725",
"0.48776016",
"0.4852325",
"0.4843919",
"0.48432368",
"0... | 0.45496312 | 55 |
Return index labels of the specified axis. | def get_axis(self, axis):
return self.index if axis == 0 else self.columns | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index_names(self, axis=0):\n return self.get_axis(axis).names",
"def get_index_name(self, axis=0):\n return self.get_axis(axis).name",
"def _get_labels(data, axis=0, always=True):\n # NOTE: Previously inferred 'axis 1' metadata of 1D variable using the\n # data values metadata but t... | [
"0.77826273",
"0.67891854",
"0.663276",
"0.66251105",
"0.6609745",
"0.6567489",
"0.65309304",
"0.6408788",
"0.63370806",
"0.6294041",
"0.61580217",
"0.61505395",
"0.61101425",
"0.6065778",
"0.60636157",
"0.5994912",
"0.59918153",
"0.596576",
"0.59245753",
"0.59097874",
"0.585... | 0.6320961 | 9 |
Check if specified axis is indexed by MultiIndex. | def has_multiindex(self, axis=0):
if axis == 0:
return isinstance(self.index, pandas.MultiIndex)
assert axis == 1
return isinstance(self.columns, pandas.MultiIndex) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_scalar(self, indexable, axis):\n index = self._obj.index\n complete_key = False\n partial_key = False\n duplicated_key = False\n if axis == 0 and self._has_fancy_index():\n try:\n if type(indexable) is tuple:\n complete_key = (l... | [
"0.6597858",
"0.6183221",
"0.5924871",
"0.5913737",
"0.58870906",
"0.5857055",
"0.5823348",
"0.57668537",
"0.5764379",
"0.5760966",
"0.56905574",
"0.56238174",
"0.5615301",
"0.55744624",
"0.55022734",
"0.5496",
"0.5463239",
"0.5444868",
"0.5387473",
"0.53632617",
"0.52963406"... | 0.8425392 | 0 |
Set index name for the specified axis. | def set_index_name(self, name, axis=0):
self.get_axis(axis).name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_index_names(self, names, axis=0):\n self.get_axis(axis).names = names",
"def setAxisName(name, axes='XYZ'):\n dislin.name(name, axes)",
"def get_index_name(self, axis=0):\n return self.get_axis(axis).name",
"def setIndexNames(self):\n self.xi = self.i1\n self.yi = self.... | [
"0.81254125",
"0.768487",
"0.72516674",
"0.7115051",
"0.6894231",
"0.6474862",
"0.6446114",
"0.6410826",
"0.62496513",
"0.6227452",
"0.6226252",
"0.61387885",
"0.60937417",
"0.5987103",
"0.5939337",
"0.59236515",
"0.58841425",
"0.5819334",
"0.5790911",
"0.5763626",
"0.5762923... | 0.91129285 | 0 |
Localize tznaive index of a Series or DataFrame to target time zone. | def tz_localize(
self, tz, axis=0, level=None, copy=True, ambiguous="raise", nonexistent="raise"
):
new_labels = (
pandas.Series(index=self.get_axis(axis))
.tz_localize(
tz,
axis=axis,
level=level,
copy=False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_tz(df,site):\n if site == 'berk':\n tz_offset = df.index.name[-5:]\n if tz_offset[0] == '-':\n tz = '+'\n else:\n tz = '-'\n hr_adjust = int(tz_offset[1:3])\n tz = 'Etc/GMT' + tz + str(hr_adjust)\n df.index = df.index.tz_localize(tz).tz... | [
"0.6465465",
"0.6421628",
"0.6330451",
"0.6209787",
"0.6179455",
"0.61222404",
"0.6120622",
"0.610939",
"0.59529567",
"0.594147",
"0.5828125",
"0.553847",
"0.5419413",
"0.54193896",
"0.5373239",
"0.5312458",
"0.525091",
"0.5184261",
"0.51657677",
"0.508285",
"0.50410527",
"... | 0.6802567 | 0 |
Get the timezone of the underlying timeseries data. Returns BaseQueryCompiler QueryCompiler containing a single value, timezone of the data. | def dt_tz(self):
return DateTimeDefault.register(pandas.Series.dt.tz)(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timezone(self):\n tz_data = self._router_request(\n self._make_request_data(\n 'getTimeZone',\n data=dict()\n )\n )\n\n return tz_data['data']",
"def query_timezone(self):\n return self._query_timezone",
"def tz(self) -> tzinfo... | [
"0.6352232",
"0.62932754",
"0.57562435",
"0.5677687",
"0.56559086",
"0.564777",
"0.5560829",
"0.55422443",
"0.54996294",
"0.547904",
"0.545104",
"0.54244906",
"0.54244906",
"0.54244906",
"0.5383554",
"0.53727037",
"0.53195506",
"0.531601",
"0.52916265",
"0.526059",
"0.5243439... | 0.6071103 | 2 |
Convert timeseries data to the specified time zone. | def dt_tz_convert(self, tz):
return DateTimeDefault.register(pandas.Series.dt.tz_convert)(self, tz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_timezones(self, to_tzinfo):\n\n # If to_tzinfo is a pytz timezone, then use the normalize\n # method so pytz can do normalize DST transition data\n if isinstance(to_tzinfo, pytz.tzinfo.BaseTzInfo):\n self.dates = np.array(\n [to_tzinfo.normalize(date.astim... | [
"0.63275766",
"0.5790547",
"0.578196",
"0.5758568",
"0.56332403",
"0.53255606",
"0.5304012",
"0.52989143",
"0.52742994",
"0.5271136",
"0.5270757",
"0.526997",
"0.5237644",
"0.5229533",
"0.5194383",
"0.51664364",
"0.5146615",
"0.5102725",
"0.50631636",
"0.5038844",
"0.50242853... | 0.58144325 | 1 |
Resample timeseries data and get the values at the new frequency. Group data into intervals by timeseries row/column with a specified frequency and get values at the new frequency. | def resample_asfreq(self, resample_kwargs, fill_value):
return ResampleDefault.register(pandas.core.resample.Resampler.asfreq)(
self, resample_kwargs, fill_value
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resample_timeseries_data(data, frequency, datetime_field, decimal_places):\r\n if not data:\r\n return []\r\n else:\r\n df = pd.DataFrame(data)\r\n df[datetime_field] = pd.to_datetime(df[datetime_field])\r\n time_indexed_data = df.set_index(datetime_fie... | [
"0.7527857",
"0.65395516",
"0.640981",
"0.6323524",
"0.623719",
"0.6235245",
"0.613569",
"0.6012482",
"0.59993255",
"0.59604543",
"0.59267193",
"0.5916196",
"0.5837326",
"0.5806948",
"0.56829226",
"0.56749856",
"0.5665765",
"0.5574831",
"0.5569976",
"0.55341446",
"0.5513231",... | 0.5271273 | 31 |
returns a random word at random | def get_word(self) -> str:
#return str(choice(word_list).upper())
return "ANONYMOUS" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_word(self):\n pass",
"def get_randword():\n with open('/home/sarga/text_words.txt','r') as f:\n rword = f.read().split(\" \")\n return random.choice(rword)",
"def random_word(wordlist):\n return random.choice(wordlist)",
"def return_word():\n wordlist = lo... | [
"0.8547697",
"0.8541739",
"0.84624016",
"0.8407738",
"0.8344305",
"0.8344305",
"0.8344305",
"0.8302557",
"0.8302557",
"0.8302557",
"0.81407785",
"0.8104453",
"0.8038347",
"0.7990067",
"0.7870184",
"0.7812768",
"0.77841663",
"0.77741605",
"0.7651383",
"0.76324385",
"0.76273364... | 0.0 | -1 |
Return the result of adding x to y. | def add(x, y):
return x + y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(x, y):\n sum = 0\n sum = x + y\n return sum",
"def plus(x, y):\n x[:] += y[:]\n return x",
"def add(x, y):\n\n return x + y",
"def add(x,y):\n return x + y",
"def add(x,y):\n return x + y",
"def add(x, y=default_y):\n return x + y",
"def suma(x, y):\n return... | [
"0.8285821",
"0.8139316",
"0.8038355",
"0.78860354",
"0.78860354",
"0.7833536",
"0.7713705",
"0.77054733",
"0.7648527",
"0.75544655",
"0.7370305",
"0.72671247",
"0.72570634",
"0.72168326",
"0.71489775",
"0.70954823",
"0.707491",
"0.70641196",
"0.7056436",
"0.7038028",
"0.7018... | 0.8119181 | 12 |
Return the result of taking x to the nth power. | def power(x, n):
# Negative and fractional powers are not allowed
if n < 0:
raise ValueError('n cannot be negative')
elif 0 < n < 1.0:
raise ValueError('n cannot be fractional')
result = 1
for _ in range(n):
result = multiply(result, x)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power(x, n):\n if n == 0:\n return 1\n result = power(x, math.floor(n / 2))\n if n % 2 > 0:\n return x * result * result\n else:\n return result * result",
"def power(x, n):\n value = 1\n for i in range(n):\n value = multiply(value, x)\n return value",
"def ... | [
"0.8199509",
"0.81016123",
"0.8088352",
"0.7859765",
"0.7859765",
"0.7715088",
"0.7705435",
"0.76808894",
"0.75457567",
"0.7507694",
"0.74372077",
"0.7429175",
"0.7158701",
"0.7127153",
"0.71141845",
"0.70898527",
"0.70872205",
"0.7086152",
"0.70483077",
"0.7018379",
"0.70050... | 0.76778656 | 8 |
Return the dot product between this vector and another | def dot(self, vec):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))",
"def dot(a, b):\n return np.vdot(a.arr,b.arr)",
"def dotProduct(v1, v2):\n n1 = norm... | [
"0.8505826",
"0.8368459",
"0.8303031",
"0.8283391",
"0.8272856",
"0.8154917",
"0.81380934",
"0.81278825",
"0.81029814",
"0.80807114",
"0.80738443",
"0.80517715",
"0.80395997",
"0.80368125",
"0.80174136",
"0.80084735",
"0.7994307",
"0.79861826",
"0.79775643",
"0.79737896",
"0.... | 0.7623168 | 49 |
Return a normalized version of this Vector | def normalized(self):
return self / self.norm() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized(self):\n len = self.length\n return Vector(self.x / len, self.y / len)",
"def normalized(self):\n length = self.length\n if length != 0:\n return self/length\n return Vec2d(self)",
"def normalize(self):\n\n if not self.magnitude():\n ... | [
"0.86686355",
"0.86559093",
"0.8580528",
"0.85564035",
"0.8480029",
"0.8430394",
"0.84175295",
"0.84173983",
"0.8393434",
"0.83588344",
"0.82665974",
"0.8200469",
"0.8017504",
"0.7981171",
"0.7964477",
"0.79497397",
"0.7867605",
"0.7790052",
"0.7776491",
"0.7735478",
"0.77121... | 0.82586324 | 11 |
If each component of this vector equals (in value, not necessarily reference) each component of the other vector, return True | def __eq__(self, other):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_equal_values_vec(x):\n return jnp.all(x == x[0])",
"def vector_equal(v1,v2):\n if (v2.x - 0.001 <= v1.x <= v2.x + 0.001) and \\\n (v2.y - 0.001 <= v1.y <= v2.y + 0.001) and \\\n (v2.z - 0.001 <= v1.z <= v2.z + 0.001):\n return True",
"def __eq__(self, other):\n if not... | [
"0.7244127",
"0.7240972",
"0.71351475",
"0.71092814",
"0.70171255",
"0.6862085",
"0.6798979",
"0.6778298",
"0.67446285",
"0.67352504",
"0.67322564",
"0.6722077",
"0.66963804",
"0.66633445",
"0.66473705",
"0.66326976",
"0.6627866",
"0.6543714",
"0.652508",
"0.65029955",
"0.650... | 0.0 | -1 |
Tests that the correct result is returned when repository is not set. | def test_unset_repository(self):
self.assertIsNone(self.env.project_repo_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_repo_false(self):\n repo = Repository(\"https://repo.com/fake.git\")\n self.assertFalse(repo.get_repo())\n if (os.path.exists(MEDIA_ROOT+\"/fake\")):\n shutil.rmtree(MEDIA_ROOT+\"/fake\")",
"def test_unknownRepository(self):\n self.assertRaises(NotWorkingDirect... | [
"0.68190604",
"0.6580668",
"0.6512336",
"0.6402686",
"0.6382168",
"0.62787455",
"0.61984885",
"0.6154842",
"0.6127846",
"0.6126439",
"0.60788876",
"0.6036756",
"0.6020512",
"0.60083205",
"0.60046244",
"0.5992514",
"0.5959926",
"0.5957926",
"0.5954694",
"0.59232473",
"0.591526... | 0.59718096 | 16 |
Tests that the correct result is returned for owner. | def test_owner(self):
self.assertIsNone(self.env.project_repo_owner) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_owner(self):\n url = reverse('projectroles:api_project_list')\n response = self.request_knox(url, token=self.get_token(self.user_owner))\n self.assertEqual(response.status_code, 200)\n response_data = json.loads(response.content)\n self.assertEqual(len(response_data)... | [
"0.705032",
"0.6947268",
"0.6887776",
"0.6743806",
"0.67128575",
"0.67086506",
"0.6651376",
"0.65637034",
"0.6531271",
"0.64770263",
"0.64222896",
"0.63498306",
"0.63294023",
"0.6319555",
"0.62652695",
"0.62485087",
"0.6242229",
"0.624055",
"0.61685663",
"0.6159195",
"0.60562... | 0.61007816 | 20 |
Tests that the correct result is returned when repository contains the just the repo name (as it does outside of GitHub). | def test_repository(self):
os.environ['REPOSITORY'] = self.repo_name
self.assertEqual(self.env.project_repo_name, self.repo_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_fetch_valid_github_repo(self):\n url = 'https://github.com/ivacf/archi'\n repo = GitHubRepoFetcher().fetch(url)\n self.assertEqual('archi', repo['name'])",
"def test_returns_cloned_repo_by_name(self):\n # Need to set up a git repo with origin info.\n full_path = path.j... | [
"0.79387957",
"0.72274804",
"0.70685846",
"0.7066236",
"0.7042844",
"0.70427036",
"0.6866362",
"0.6829966",
"0.67533773",
"0.67025536",
"0.6701095",
"0.66502905",
"0.66423833",
"0.6629975",
"0.6610513",
"0.6603796",
"0.6558495",
"0.6557167",
"0.6529914",
"0.65183574",
"0.6492... | 0.67454344 | 9 |
Tests that the correct result is returned when repository is not set. | def test_unset_repository(self):
self.assertEqual(self.env.git_url, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_repo_false(self):\n repo = Repository(\"https://repo.com/fake.git\")\n self.assertFalse(repo.get_repo())\n if (os.path.exists(MEDIA_ROOT+\"/fake\")):\n shutil.rmtree(MEDIA_ROOT+\"/fake\")",
"def test_unknownRepository(self):\n self.assertRaises(NotWorkingDirect... | [
"0.68190604",
"0.6580668",
"0.6512336",
"0.6402686",
"0.6382168",
"0.62787455",
"0.61984885",
"0.6154842",
"0.6127846",
"0.6126439",
"0.60788876",
"0.6036756",
"0.6020512",
"0.60083205",
"0.60046244",
"0.5992514",
"0.59718096",
"0.5959926",
"0.5957926",
"0.5954694",
"0.592324... | 0.5771215 | 33 |
Return the id of the mapper that will process this instance. | def mapper_id(self, structure):
type_ = structure['type']
mapper = self.mappers[type_]
return id(mapper) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_map_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"route_map_id\")",
"def route_map_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"route_map_id\")",
"def get_id(self):\n\n\t\treturn self.__id",
"def depmap_id(self) -> str:\n return self._depma... | [
"0.70546967",
"0.67053664",
"0.6474064",
"0.6465166",
"0.6455745",
"0.64422184",
"0.64422184",
"0.64002794",
"0.63903004",
"0.6381717",
"0.63603354",
"0.63550997",
"0.63550997",
"0.63550997",
"0.63550997",
"0.63549197",
"0.63549197",
"0.63549197",
"0.6314278",
"0.628576",
"0.... | 0.81042916 | 0 |
Move the instruction pointer to the specified index. If no index is provided, the instruction pointer incremented by one. | def move_ip(self, idx: Optional[int] = None) -> None:
if idx:
self.ip = idx
else:
self.ip += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance(self):\n # if the current program counter is still smaller than the last instruction\n if self.simulator.programCounter < (len(self.simulator.instrCollection) * 4 + 0x1000):\n # increment the instruction counter\n self.simulator.instrCount += 1\n # get ano... | [
"0.59776795",
"0.56575114",
"0.5644023",
"0.55885756",
"0.55816555",
"0.5547853",
"0.5512334",
"0.54401666",
"0.54332864",
"0.54073185",
"0.53878546",
"0.5371363",
"0.5359736",
"0.53524834",
"0.5346483",
"0.5344448",
"0.53410846",
"0.5299588",
"0.5242052",
"0.5218073",
"0.521... | 0.67650664 | 0 |
Only store forms defined in the formsets list | def filter_additional_data(self, additional_data):
additional_data = dict(
(
form, additional_data[form]
) for form in self.context.formsets if form in additional_data
)
return additional_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_formset( self, request, form, formset, change ):\n formset.save()",
"def process_show_formset(self, request, step, formset):\n pass",
"def get_formset(self, **kwargs):\n return self.formsets[kwargs.get('prefix')](\n data=self.get_form_kwargs().get('data'),\n ... | [
"0.67014563",
"0.65062875",
"0.62511253",
"0.61880183",
"0.6096422",
"0.6093236",
"0.6020964",
"0.5973284",
"0.5954874",
"0.5920148",
"0.59046793",
"0.5898752",
"0.58766043",
"0.58450043",
"0.58153385",
"0.57910424",
"0.5790516",
"0.57819563",
"0.57571834",
"0.5735166",
"0.57... | 0.5493425 | 43 |
Set the password of the user with the value provided. | def set_password(self, password):
self.password = password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setpassword(self, pwd):\n pass",
"def setUserPassword(self,value):\n self.PDFreactorConfiguration.in1[\"userPassword\"] = value",
"def set_password(self, value):\n # Salt need to be generated before set password\n m = hashlib.sha256()\n m.update('-'.join([\n st... | [
"0.83965147",
"0.83401",
"0.82305247",
"0.8219254",
"0.7953167",
"0.794184",
"0.788397",
"0.7800467",
"0.7728219",
"0.7727818",
"0.7718363",
"0.771215",
"0.7675518",
"0.76627034",
"0.7643271",
"0.7600908",
"0.7586816",
"0.75794786",
"0.757568",
"0.7566384",
"0.7560118",
"0.... | 0.80618644 | 4 |
Make ``GET`` request to ``self.list_view`` view. If ``user`` is not ``None``, the given user is authenticated before making the request. | def _get_list(self, user=None):
request = self.factory.get(self.list_url, format='json')
force_authenticate(request, user)
resp = self.list_view(request)
resp.render()
return resp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self, request, *args, **kwargs):\n return super(UserViewSet, self).list(request, *args, **kwargs)",
"def api(self, user=None):\n if not user.is_authenticated:\n return self.none()\n return self.filter(users=user)",
"def on_GET(self, request, target_user_id):\n ta... | [
"0.66977596",
"0.64901763",
"0.6413722",
"0.6391765",
"0.6381077",
"0.6352666",
"0.6348698",
"0.6209904",
"0.6166639",
"0.61006683",
"0.60709566",
"0.6054311",
"0.60411555",
"0.6013274",
"0.60076576",
"0.59735596",
"0.59570545",
"0.5950276",
"0.5904665",
"0.5904665",
"0.59046... | 0.8007476 | 0 |
>>> is_board_valid([[1,2,1]], 1, 3) True | def is_board_valid(board, rows, cols):
return all(all(is_cell_valid(board, r, c) for c in xrange(cols)) for r in xrange(rows)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_sudoku_board(board):\n if type(board)!=list:#checks that the Type of the board is list\n return False\n for i in range(len(board)):\n if type(board[i])!=list:#checks that the Type of a row is list\n return False\n if len(board[i])!=9:#checks that the Number of num... | [
"0.7950053",
"0.7873286",
"0.78376895",
"0.7534804",
"0.7525191",
"0.7464738",
"0.7334641",
"0.73339695",
"0.72910523",
"0.72714454",
"0.7238741",
"0.72123414",
"0.7178877",
"0.7161056",
"0.7019266",
"0.7015835",
"0.7014332",
"0.69828767",
"0.6971216",
"0.6956139",
"0.6947592... | 0.7563894 | 3 |
>>> is_cell_valid([ [2, 2, 2, 2, 2], [2, 1, 1, 1, 2], [2, 1, 2, 1, 2], [2, 1, 1, 1, 2], [2, 2, 2, 2, 2] ], 0, 0) True >>> is_cell_valid([ [2, 2, 2, 2, 2], [2, 1, 1, 1, 2], [2, 1, 2, 1, 2], [2, 1, 1, 1, 2], [2, 2, 2, 2, 2] ], 1, 1) False | def is_cell_valid(board, r, c):
return is_cell_row_valid(board, r, c) or is_cell_col_valid(board, r, c) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_valid(self):\n for cell in self._cells_iterable():\n if cell not in self._valid_elements:\n return False\n return True",
"def isvalid(board, num, cell):\r\n x, y = cell\r\n row = board[x]\r\n col = transpose(board)[y]\r\n\r\n # check row if num already ... | [
"0.78606266",
"0.7470603",
"0.72972816",
"0.725799",
"0.71368986",
"0.71296334",
"0.7098325",
"0.7067219",
"0.6959899",
"0.69269663",
"0.6918944",
"0.6873363",
"0.68651116",
"0.6859215",
"0.68392086",
"0.6835174",
"0.6777917",
"0.676585",
"0.6765554",
"0.6763993",
"0.67618966... | 0.71045303 | 6 |
>>> is_cell_row_valid([[2,1,2],[1,1,1],[2,1,2]], 1, 1) True >>> is_cell_row_valid([[2,1,2],[1,1,1],[2,1,2]], 0, 1) False | def is_cell_row_valid(board, r, c):
return all(board[r][i] <= board[r][c] for i in xrange(len(board[r]))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid(row, peg):\n return (\n (row < TRI_SIZE) and\n (row >= 0) and\n (peg < TRI_SIZE) and\n (peg >= 0) and\n (peg <= row)\n )",
"def _is_valid(self):\n for cell in self._cells_iterable():\n if cell ... | [
"0.741701",
"0.73611414",
"0.7293227",
"0.72435266",
"0.71651745",
"0.7097694",
"0.70769405",
"0.7064634",
"0.702554",
"0.70054007",
"0.70042956",
"0.69479513",
"0.6880997",
"0.6861574",
"0.6836509",
"0.6788453",
"0.6779461",
"0.67663956",
"0.67450076",
"0.67191553",
"0.67146... | 0.75150836 | 0 |
>>> is_cell_col_valid([[1,2,1]], 0, 1) True | def is_cell_col_valid(board, r, c):
return all(board[i][c] <= board[r][c] for i in xrange(len(board))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cols_valid(bd):\n for col in cols:\n seen = []\n for num in nums:\n if bd[col[num]] == \" \":\n continue\n elif bd[col[num]] not in seen:\n seen += [bd[col[num]]]\n else:\n return False\n else:\n ... | [
"0.7146674",
"0.68358624",
"0.68296504",
"0.6785207",
"0.67778975",
"0.669936",
"0.66751194",
"0.6616738",
"0.6550353",
"0.64705276",
"0.6453668",
"0.64139533",
"0.637194",
"0.6362539",
"0.63340443",
"0.632881",
"0.6263058",
"0.6261916",
"0.6261916",
"0.6250828",
"0.6232614",... | 0.6981767 | 1 |
Test that the index page shows "Hello, World!" | def test_index():
res = app.test_client().get('/')
assert res.status_code == 200
result_page_text = res.get_data(as_text=True)
expected_page_text = "Hello, World!"
assert expected_page_text == result_page_text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index(self):\n response = self.client.get('')\n self.assertEqual(response.status_code, 200)\n self.assertTemplateUsed(response, 'home/index.html')",
"def test_index(self):\n tester = app.test_client(self)\n response = tester.get('/', content_type = 'html_text')\n ... | [
"0.82992214",
"0.82339764",
"0.8233368",
"0.8123874",
"0.8107575",
"0.8092139",
"0.8070833",
"0.80489016",
"0.8029757",
"0.8021677",
"0.7972373",
"0.79647183",
"0.79483277",
"0.79391086",
"0.7865811",
"0.7855116",
"0.78347164",
"0.7822497",
"0.77946293",
"0.77592766",
"0.7751... | 0.829304 | 1 |
Return EqualTo specific properties. | def _add_matcher_specific_properties_to_json(self):
return {
'unaryNumericMatcherData': {
'dataType': self._data_type,
'value': self._original_value,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return self.properties == other.properties",
"def filter_by_property(self, properties=None, **kwargs):\r\n\t\tif properties is None:\r\n\t\t\tproperties = {}\r\n\t\tproperties.update(kwargs)\r\n\t\tresult_list = ElementList()\r\n\t\tfor element in self:\r\n\t\t\tif all(k in elem... | [
"0.64632505",
"0.5935306",
"0.5854237",
"0.5807983",
"0.5662073",
"0.53720057",
"0.53608155",
"0.53559494",
"0.53400886",
"0.5325553",
"0.53016734",
"0.5287769",
"0.5202537",
"0.5201451",
"0.5189079",
"0.5163047",
"0.5161581",
"0.5158672",
"0.5152971",
"0.5145692",
"0.5103573... | 0.0 | -1 |
Returns a list of tuples of integers. The tuples are the start and end indexes of the points that make up a consistent stroke. | def getSegments(points):
return _identifyStrokes(points)[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segment_tuples(self):\n return ((self.vertices[i], self.vertices[i+1])\n for i in range(len(self.vertices)-1))",
"def segment_tuples(self):\n return ((self.vertices[i-1], self.vertices[i])\n for i in range(len(self.vertices)))",
"def get_coords(self):\n xT... | [
"0.650172",
"0.6356292",
"0.63191974",
"0.62127423",
"0.6193609",
"0.6157209",
"0.6088006",
"0.607852",
"0.60672754",
"0.6035215",
"0.601639",
"0.6005251",
"0.5987621",
"0.596972",
"0.5950823",
"0.59374946",
"0.59174734",
"0.5912734",
"0.5906149",
"0.5878647",
"0.58663976",
... | 0.58718604 | 20 |
Returns a list of tuples. The first item in the tuple is the directional integer, and the second item is a tuple of integers for the start and end indexes of the points that make up the stroke. | def getGestureAndSegments(points):
strokes, strokeSegments = _identifyStrokes(points)
return list(zip(strokes, strokeSegments)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_directions():\n return [(1, 0), (0, 1), (-1, 0), (0, -1)]",
"def segment_tuples(self):\n return ((self.vertices[i], self.vertices[i+1])\n for i in range(len(self.vertices)-1))",
"def segment_tuples(self):\n return ((self.vertices[i-1], self.vertices[i])\n ... | [
"0.7704623",
"0.67594296",
"0.671177",
"0.65432245",
"0.6489372",
"0.6403351",
"0.6285116",
"0.6213297",
"0.62070006",
"0.61684287",
"0.6166679",
"0.61550885",
"0.61420554",
"0.613753",
"0.610363",
"0.60906774",
"0.6049638",
"0.6041686",
"0.60254407",
"0.59993815",
"0.5994001... | 0.5780157 | 38 |
Returns the Levenshtein Distance between two strings, `s1` and `s2` as an integer. | def levenshteinDistance(s1, s2):
singleLetterMapping = {DOWNLEFT: '1', DOWN:'2', DOWNRIGHT:'3',
LEFT:'4', RIGHT:'6',
UPLEFT:'7', UP:'8', UPRIGHT:'9'}
len1 = len([singleLetterMapping[letter] for letter in s1])
len2 = len([singleLetterMapping[letter] for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(str1, str2):\n return levenshtein.normalized_distance(str1, str2)",
"def levenshtein_distance(s1,s2):\n\n\t\tif len(s1) < len(s2):\n\t\t\treturn Searcher.levenshtein_distance(s2, s1)\n\n\t\t# len(s1) >= len(s2)\n\t\tif len(s2) == 0:\n\t\t\treturn len(s1)\n\n\t\tprevious_row = range(len(s2) + 1)\n... | [
"0.86942244",
"0.8484132",
"0.8356348",
"0.8239916",
"0.82171315",
"0.81972265",
"0.8021736",
"0.80152994",
"0.80049",
"0.7843604",
"0.7796122",
"0.7768025",
"0.7650802",
"0.7649564",
"0.7597331",
"0.75894356",
"0.75690806",
"0.75381345",
"0.748515",
"0.74419534",
"0.73805445... | 0.80751187 | 6 |
Return the direction the line formed by the (x, y) points in `coord1` and `coord2`. | def _getDirection(coord1, coord2):
x1, y1 = coord1
x2, y2 = coord2
if x1 == x2 and y1 == y2:
return None # two coordinates are the same.
elif x1 == x2 and y1 > y2:
return UP
elif x1 == x2 and y1 < y2:
return DOWN
elif x1 > x2 and y1 == y2:
return LEFT
elif x1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_direction(self, coord_1, coord_2=None):\n if coord_2:\n start = coord_1\n end = coord_2\n else:\n start = self.position\n end = coord_1\n\n if start % self.game.rules[\"row_len\"] == end % self.game.rules[\"row_len\"]:\n if e... | [
"0.7077475",
"0.67473817",
"0.6727258",
"0.6560717",
"0.6557516",
"0.6508098",
"0.63948435",
"0.6390899",
"0.6382273",
"0.6314306",
"0.63093567",
"0.62927353",
"0.6271189",
"0.62622476",
"0.62521976",
"0.6245554",
"0.62347925",
"0.6232314",
"0.6200161",
"0.6172732",
"0.614724... | 0.82584655 | 0 |
Select high confidence samples from `D^U` whose entropy is smaller than the threshold `delta`. | def get_high_confidence_samples(pred_prob: np.ndarray,
delta: float) -> Tuple[np.ndarray, np.ndarray]:
_, eni = entropy(pred_prob=pred_prob, k=len(pred_prob))
hcs = eni[eni[:, 2] < delta]
return hcs[:, 0].astype(np.int32), hcs[:, 1].astype(np.int32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def huber_loss(y, y_hat, delta):\n half_delta_squared = 0.5 * delta * delta\n error = y - y_hat\n abs_error = abs(error)\n\n less_than = 0.5 * square(error)\n more_than = (delta * abs_error) - half_delta_squared\n loss_per_sample = element_select(less(abs_error, delta), less_than, more_than)\n\n ... | [
"0.5153756",
"0.51270103",
"0.5089108",
"0.5044927",
"0.5040845",
"0.49423006",
"0.49409744",
"0.49026722",
"0.48604807",
"0.4840753",
"0.48234597",
"0.48054135",
"0.48036078",
"0.47382608",
"0.47269264",
"0.46974674",
"0.46751145",
"0.46705526",
"0.46705526",
"0.46526754",
"... | 0.6555946 | 0 |
Post data for authors Sets all other values to None if values are not provided | def post_author_data():
data = None
if request.get_json() is None:
data = request.form.to_dict()
print(data)
else:
data = request.get_json()
if data is None or data == {} or all(value == '' for value in data.values()):
return render_template('error.html', message='Input ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_author(self, **kwargs):\n self.author_name = kwargs.get('name')\n self.author_url = kwargs.get('url')\n self.author_icon = kwargs.get('icon_url')",
"def author(self, value):\n self._set_attr('author', value)",
"def update_author():\n try:\n key = list(request.args.keys())[0]\n... | [
"0.64397407",
"0.6175825",
"0.6098915",
"0.599035",
"0.59754086",
"0.5949272",
"0.59302086",
"0.5908655",
"0.5890984",
"0.5885011",
"0.5772818",
"0.5765819",
"0.5765376",
"0.5741887",
"0.57224584",
"0.5678815",
"0.5582717",
"0.5577919",
"0.5567393",
"0.55624264",
"0.5545347",... | 0.7018504 | 0 |
Delete data for books When excepts IndexError, the request is coming from the front end application, and needs to parse and request data differently. | def delete_book():
try:
key = list(request.args.keys())[0]
if key is None:
return render_template("error.html", message="Please enter a correct key"), 400
val = request.args[key].strip('"')
except IndexError:
queryVal = request.form.to_dict()
key = list(queryV... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(request):\n if request.method == \"POST\":\n Books.objects.get(isbn=request.POST['delete_book']).delete()\n return redirect('libros:home')",
"def delete(self, book_info, destroy):\n self.connect()\n bid = book_info[0].get()\n\n delete_sql = f\"delete from {self.book_t... | [
"0.6731346",
"0.628473",
"0.6237934",
"0.61953634",
"0.6152177",
"0.6112556",
"0.6083911",
"0.6070356",
"0.60578585",
"0.5977506",
"0.59410113",
"0.5906001",
"0.5869275",
"0.58415025",
"0.58209205",
"0.5729588",
"0.57208157",
"0.57138693",
"0.56903034",
"0.5669386",
"0.563844... | 0.66425616 | 1 |
Delete data for authors When excepts IndexError, the request is coming from the front end application, and needs to parse and request data differently. | def delete_author():
try:
key = list(request.args.keys())[0]
val = request.args[key].strip('"')
if key is None:
return render_template("error.html", message="Please enter a correct key"), 400
except IndexError:
queryVal = request.form.to_dict()
key = list(quer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, data):\r\n pass",
"def delete_author(self,author):\n\n rowEle = self._get_author_row(author)\n b = self.find_element(self.locators['trash'],rowEle)\n b.click()",
"def test_delete_author_unlogged(self):\n request = self.client.delete(self.epoint)\n self... | [
"0.597612",
"0.59476274",
"0.5905207",
"0.57171905",
"0.56966794",
"0.56966376",
"0.5624778",
"0.5574861",
"0.55492336",
"0.5535055",
"0.55328184",
"0.5532815",
"0.5497408",
"0.54943645",
"0.5481601",
"0.5422773",
"0.5419028",
"0.5416888",
"0.5415432",
"0.5415432",
"0.5410114... | 0.69702786 | 0 |
Return a product matching the given identifier. | def get_product(self, identifier):
# try to find an id corresponding to the code
for p in self['products']:
if identifier in p.get('ids', []):
return p
# if no product associated with the code found, return None
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_product(cls, product_id):\n return Product.query.get(product_id)",
"def get_product_by_id(pid: int) -> Optional[Product]:\n return get_market().get_product(pid)",
"def get_product_with_id(product_id: str) -> Product:\n return Product.query.filter_by(id=product_id).first()",
"def get_prod... | [
"0.7814515",
"0.7807445",
"0.7786215",
"0.7755031",
"0.7526172",
"0.7422317",
"0.738578",
"0.7383733",
"0.7365643",
"0.7342667",
"0.73252803",
"0.7310571",
"0.7261338",
"0.7246913",
"0.72411865",
"0.7225621",
"0.72061104",
"0.71366537",
"0.7126494",
"0.7113762",
"0.7075467",
... | 0.84982795 | 0 |
Return a deep copy of this instance with resolved dependencies. | def get_copy_with_resolved_dependencies(self):
invoice_copy = copy.deepcopy(self)
changes = 1
while changes > 0:
changes = 0
for product in invoice_copy['products']:
# if any other products depend on this product, don't try to resolve it
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution_copy(self):\n to_return = DepAlgoSolution(self.packages_in_solution[:], self.visited_packages[:], set(self.visited_names))\n to_return.is_valid = self.is_valid\n to_return.not_to_delete_deps = set(self.not_to_delete_deps)\n for key, value in self.dict_to_way.items():\n ... | [
"0.6926472",
"0.681574",
"0.6802871",
"0.68017864",
"0.6791336",
"0.67703503",
"0.6767935",
"0.6766639",
"0.67352974",
"0.6732083",
"0.6725003",
"0.671437",
"0.671437",
"0.671437",
"0.671437",
"0.671437",
"0.671437",
"0.671437",
"0.671437",
"0.671437",
"0.671437",
"0.671437... | 0.6665218 | 46 |
Get the total price for all products on the invoice. | def get_total_price(self):
i = self.get_copy_with_resolved_dependencies()
total_price = Decimal(0)
for product in i['products']:
billed_price = Decimal(str(product.get('price', 0))) * Decimal(str(product.get('quantity')))
total_price += billed_price
return total_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_price(self):\n return sum(Decimal(item[\"price\"]) * item[\"qty\"] for item in self.cart.values())",
"def get_total_amount(self):\n total_price = 0.00\n\n for k, v in self.order.product_orders.items():\n total_price += v.quantity * v.product.price\n\n return t... | [
"0.8184352",
"0.7815383",
"0.7793876",
"0.7451419",
"0.7338859",
"0.73210144",
"0.72848165",
"0.7229103",
"0.7190418",
"0.71891224",
"0.7170491",
"0.7085157",
"0.70526737",
"0.69886434",
"0.69755095",
"0.68929064",
"0.6840607",
"0.6806935",
"0.6740282",
"0.6629764",
"0.659980... | 0.83977413 | 0 |
Display the face of the rendered image. | def show_render_face(data):
return cv2.resize(data['render'][20:180,330:490,:],(256,256)); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display(self):\n\t\t# print len(self.visibleFaceList)\n\t\t# print \"not visible: \"\n\t\t# for face in self.notVisibleFaceList:\n\t\t# \tprint face.id\n\t\t# print \"visibel: \"\n\t\tfor i in range(len(self.visibleFaceList)):\n\t\t\t# print self.visibleFaceList[i].id\n\t\t\tself.showRectangle(self.visibleFace... | [
"0.78271073",
"0.73238623",
"0.71018475",
"0.6917512",
"0.6900026",
"0.67763174",
"0.6699282",
"0.6689702",
"0.6671418",
"0.66544527",
"0.6628153",
"0.65974486",
"0.6555711",
"0.6554558",
"0.6507949",
"0.64394236",
"0.63981605",
"0.6389864",
"0.6382514",
"0.6369299",
"0.63493... | 0.6858825 | 5 |
Displays a box around the face area. | def draw_face_box(data):
head = extract_head(data);
face_box = data['position_data']['face_box'][data['i']];
sefs = data['sefs'][data['i']];
if face_box is not None:
cv2.rectangle(head, *face_box, (0, 255, 0));
else:
cv2.rectangle(head, *sefs, (0, 0, 255));
return head; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _box_face(image, face):\n draw = PIL.ImageDraw.Draw(image.image)\n draw.rectangle(face.as_box(), outline=\"yellow\")",
"def _display_face(draw, bounding_box, name):\n top, right, bottom, left = bounding_box\n draw.rectangle(((left, top), (right, bottom)), outline=BOUNDING_BOX_COLOR)\n text_lef... | [
"0.73727435",
"0.7295779",
"0.7284597",
"0.7002227",
"0.6632041",
"0.65869826",
"0.6552596",
"0.6439948",
"0.63533455",
"0.6349754",
"0.6341232",
"0.63264877",
"0.63031256",
"0.6290293",
"0.62884825",
"0.62680304",
"0.62650377",
"0.62331635",
"0.6167695",
"0.6156476",
"0.6142... | 0.7171745 | 3 |
Generate a secure random string of letters, digits and special characters | def generateSecureRandomString(stringLength=50):
password_characters = string.ascii_letters + string.digits
return ''.join(secrets.choice(password_characters) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_alphanumeric_string():\n return get_random_string(char_choice=string.ascii_letters + string.digits)",
"def create_secret_code():\n characters = string.ascii_uppercase + string.digits\n size = 6\n return ''.join(random.choice(characters) for _ in range(size))",
"def password():\n c... | [
"0.780001",
"0.77551126",
"0.7673126",
"0.7654715",
"0.7621727",
"0.7614289",
"0.7596714",
"0.75855654",
"0.755834",
"0.7549379",
"0.7527521",
"0.7518602",
"0.7473979",
"0.7444539",
"0.73692334",
"0.7366418",
"0.7351018",
"0.7348109",
"0.7311087",
"0.7306283",
"0.72968966",
... | 0.7442787 | 14 |
Test that populating deque with iterable produces head with value of 3. | def test_full_deque_is_full(full_deque):
assert full_deque._deque.head.value == 3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_that_peek_returns_head_from_list_of_iterables(iterable):\n from deque import Deque\n new_deque = Deque(iterable)\n assert new_deque.peek() == new_deque.pop()",
"def test_deque_works_on_diff_iterables_tail_is_first_val_pushed(iterable):\n from deque import Deque\n new_deque = Deque(iterabl... | [
"0.81437397",
"0.77774477",
"0.7641183",
"0.762126",
"0.75147253",
"0.74455357",
"0.7325635",
"0.7292514",
"0.7273456",
"0.7206831",
"0.7181101",
"0.71744853",
"0.7135484",
"0.71108943",
"0.70355535",
"0.6992504",
"0.6964566",
"0.6954277",
"0.69438636",
"0.69130117",
"0.68323... | 0.6876222 | 20 |
Test that populating deque with iterable has correct tail element. | def test_full_deque_has_tail(full_deque):
assert full_deque._deque.tail.value == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deque_works_on_diff_iterables_tail_is_first_val_pushed(iterable):\n from deque import Deque\n new_deque = Deque(iterable)\n new_deque.pop()\n assert new_deque._container.tail.val == iterable[0]",
"def test_deque_works_on_diff_iterables_head_is_last_val_pushed_after_pop(iterable):\n from d... | [
"0.85604364",
"0.8389156",
"0.8330138",
"0.8286497",
"0.7804315",
"0.77509844",
"0.77497774",
"0.7640565",
"0.7574091",
"0.75488013",
"0.7487353",
"0.7435704",
"0.7374973",
"0.7370068",
"0.7368684",
"0.7339676",
"0.7320013",
"0.72704476",
"0.7242975",
"0.71349615",
"0.7129379... | 0.77158684 | 7 |
Test that full deque has length of 3. | def test_full_deque_has_length(full_deque):
assert full_deque._deque._length == 3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deque_length_after_pop(dq_3):\n dq_3.pop()\n assert dq_3.length == 2",
"def test_full_deque_is_full(full_deque):\n assert full_deque._deque.head.value == 3",
"def test_for_size_when_filled(iterable, result):\n from deque import Deque\n new_deque = Deque(iterable)\n assert new_deque.s... | [
"0.78715956",
"0.78197706",
"0.73358923",
"0.72801864",
"0.72706133",
"0.72319394",
"0.7222254",
"0.715272",
"0.7090539",
"0.70765245",
"0.70622855",
"0.70296174",
"0.70007426",
"0.6952745",
"0.693772",
"0.69085497",
"0.6839387",
"0.67744434",
"0.67727983",
"0.6702122",
"0.66... | 0.8577407 | 0 |
Test that error is raised when you try to initialize with noniterable. | def test_initializing_deque_with_non_iterable_raises_error():
from deque import Deque
with pytest.raises(TypeError):
new_deque = Deque(interable=123456) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_make_np_iterable_type_error():\n with pytest.raises(TypeError):\n _ = uc._make_np_iterable(\"s\")",
"def test_wrong_input_on_creation(self):\r\n\r\n self.assertRaises(TypeError, TypedListType, None)",
"def test_initalizing_with_non_iterable_or_not_numbers_raises_ValueError():\n fro... | [
"0.78207946",
"0.75227827",
"0.751042",
"0.69699025",
"0.69321096",
"0.6930511",
"0.68200904",
"0.67998004",
"0.67872363",
"0.67678916",
"0.666899",
"0.6656615",
"0.6621781",
"0.6617661",
"0.65959954",
"0.6566306",
"0.65636396",
"0.6561756",
"0.65577096",
"0.6555133",
"0.6553... | 0.7068486 | 3 |
Test append method on empty deque first value is Denny Way. | def test_append_to_empty_deque_check_head(empty_deque):
empty_deque.append("Denny Way")
assert empty_deque._deque.head.value == "Denny Way" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_head_of_deque_when_using_append(val, result, filled_deque):\n filled_deque.append(val)\n assert filled_deque._container.head.val == val",
"def test_head_of_deque_when_using_append2(val, result, filled_deque):\n filled_deque.append(val)\n assert filled_deque._container.head.val == result[-1]"... | [
"0.81063646",
"0.80645436",
"0.7982597",
"0.7895707",
"0.78383845",
"0.78174025",
"0.7813049",
"0.7812579",
"0.7778344",
"0.77583534",
"0.77384186",
"0.7715168",
"0.7702814",
"0.7702004",
"0.7699113",
"0.7697456",
"0.7637012",
"0.7620477",
"0.7534843",
"0.75113165",
"0.750499... | 0.8057467 | 2 |
Test append method on empty deque size is 1. | def test_append_to_empty_deque_size(empty_deque):
empty_deque.append("Denny Way")
assert empty_deque.size() == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_appendleft_to_empty_deque_size(empty_deque):\n empty_deque.appendleft(\"Denny Way\")\n assert empty_deque.size() == 1",
"def test_append_to_full_deque_size(full_deque):\n full_deque.append(\"Denny Way\")\n assert full_deque.size() == 4",
"def test_for_size_0_when_empty(new_empty_deque):\n ... | [
"0.8142693",
"0.799281",
"0.78356516",
"0.78067744",
"0.7801254",
"0.77563304",
"0.773669",
"0.7716044",
"0.7708684",
"0.7670607",
"0.76092035",
"0.7573592",
"0.7572263",
"0.75669426",
"0.7537802",
"0.75131786",
"0.74663246",
"0.7427651",
"0.74211085",
"0.7410628",
"0.7410008... | 0.84189683 | 0 |
Test append method on full deque size is 4. | def test_append_to_full_deque_size(full_deque):
full_deque.append("Denny Way")
assert full_deque.size() == 4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_appendleft_to_full_deque_size(full_deque):\n full_deque.appendleft(\"Denny Way\")\n assert full_deque.size() == 4",
"def test_length_of_deque_when_using_append(val, result, filled_deque):\n filled_deque.append(val)\n assert filled_deque.size() == len(result)",
"def test_append_increases_si... | [
"0.8107763",
"0.7996083",
"0.784534",
"0.7771841",
"0.7692915",
"0.75496393",
"0.7489729",
"0.73493737",
"0.72653687",
"0.72479504",
"0.72458094",
"0.72401154",
"0.7204945",
"0.7107906",
"0.7087053",
"0.70749664",
"0.705101",
"0.69922996",
"0.6958757",
"0.69586974",
"0.686231... | 0.83668894 | 0 |
Test appendleft method on empty deque head is Denny Way. | def test_appendleft_to_empty_deque_check_head(empty_deque):
empty_deque.appendleft("Denny Way")
assert empty_deque._deque.head.value == "Denny Way" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_appendleft_to_full_deque_check_head(full_deque):\n full_deque.appendleft(\"Denny Way\")\n assert full_deque._deque.head.value == \"Denny Way\"",
"def test_appendleft_to_empty_deque_check_tail(empty_deque):\n empty_deque.appendleft(\"Denny Way\")\n assert empty_deque._deque.tail.value == \"De... | [
"0.830469",
"0.7929587",
"0.78767884",
"0.78461593",
"0.7833552",
"0.77282774",
"0.7704946",
"0.7542734",
"0.751248",
"0.75116086",
"0.7436412",
"0.7408393",
"0.7381483",
"0.73600256",
"0.7332698",
"0.7320863",
"0.7265071",
"0.72560406",
"0.7203242",
"0.7128719",
"0.7119223",... | 0.8473656 | 0 |
Test appendleft method on empty deque tail is Denny Way. | def test_appendleft_to_empty_deque_check_tail(empty_deque):
empty_deque.appendleft("Denny Way")
assert empty_deque._deque.tail.value == "Denny Way" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_appendleft_to_full_deque_check_tail(full_deque):\n full_deque.appendleft(\"Denny Way\")\n assert full_deque._deque.tail.value == 1",
"def test_appendleft_to_empty_deque_check_head(empty_deque):\n empty_deque.appendleft(\"Denny Way\")\n assert empty_deque._deque.head.value == \"Denny Way\"",
... | [
"0.815062",
"0.8085601",
"0.7992411",
"0.7941262",
"0.7925602",
"0.7906034",
"0.78771245",
"0.7870173",
"0.76730615",
"0.74690825",
"0.74386823",
"0.7400576",
"0.7399048",
"0.7236741",
"0.7168462",
"0.7163567",
"0.71409",
"0.71073455",
"0.710688",
"0.70870817",
"0.7067546",
... | 0.82863724 | 0 |
Test appendleft method on empty deque size is 1. | def test_appendleft_to_empty_deque_size(empty_deque):
empty_deque.appendleft("Denny Way")
assert empty_deque.size() == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_popleft_with_append(empty_deque):\n empty_deque.append(1)\n empty_deque.append(2)\n empty_deque.popleft()\n empty_deque.append(3)\n empty_deque.append(4)\n empty_deque.append(5)\n assert empty_deque.popleft() == 2",
"def test_popleft_with_appendleft(empty_deque):\n empty_deque.ap... | [
"0.83064234",
"0.8298093",
"0.81073576",
"0.80492526",
"0.79913604",
"0.7971466",
"0.79468334",
"0.79121435",
"0.7818164",
"0.77969116",
"0.7793064",
"0.77172947",
"0.77104694",
"0.7601281",
"0.74928474",
"0.74416953",
"0.74322677",
"0.7417033",
"0.7411387",
"0.7393293",
"0.7... | 0.8355765 | 0 |
Test appendleft method on full deque head is Denny Way. | def test_appendleft_to_full_deque_check_head(full_deque):
full_deque.appendleft("Denny Way")
assert full_deque._deque.head.value == "Denny Way" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_appendleft_to_empty_deque_check_head(empty_deque):\n empty_deque.appendleft(\"Denny Way\")\n assert empty_deque._deque.head.value == \"Denny Way\"",
"def test_appendleft_to_full_deque_check_tail(full_deque):\n full_deque.appendleft(\"Denny Way\")\n assert full_deque._deque.tail.value == 1",
... | [
"0.8341617",
"0.796743",
"0.7875342",
"0.7788519",
"0.77584755",
"0.7672243",
"0.7668103",
"0.7632527",
"0.7608101",
"0.751689",
"0.7504997",
"0.7438034",
"0.73950726",
"0.7379405",
"0.719912",
"0.71738017",
"0.7165083",
"0.71103764",
"0.709915",
"0.7078017",
"0.70711243",
... | 0.8437011 | 0 |
Test appendleft method on full deque tail is 1. | def test_appendleft_to_full_deque_check_tail(full_deque):
full_deque.appendleft("Denny Way")
assert full_deque._deque.tail.value == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_append_left_increases_size_of_list(val, filled_deque):\n filled_deque.appendleft(val)\n assert filled_deque._container.tail.val == val",
"def test_appendleft_to_full_deque_check_head(full_deque):\n full_deque.appendleft(\"Denny Way\")\n assert full_deque._deque.head.value == \"Denny Way\"",
... | [
"0.7818615",
"0.7815832",
"0.77897835",
"0.773756",
"0.7727385",
"0.7554335",
"0.7552151",
"0.7547333",
"0.7540695",
"0.74069977",
"0.7389955",
"0.730823",
"0.71370834",
"0.7095124",
"0.70614755",
"0.7051897",
"0.7012173",
"0.700986",
"0.68795544",
"0.6864387",
"0.68641514",
... | 0.8188662 | 0 |
Test appendleft method on full deque size is 4. | def test_appendleft_to_full_deque_size(full_deque):
full_deque.appendleft("Denny Way")
assert full_deque.size() == 4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_append_left_increases_size_of_list(val, filled_deque):\n filled_deque.appendleft(val)\n assert filled_deque._container.tail.val == val",
"def test_length_of_deque_when_using_append_left(val, result, filled_deque):\n filled_deque.appendleft(val)\n assert filled_deque.size() == len(result)",
... | [
"0.8025878",
"0.8019026",
"0.7909267",
"0.78957397",
"0.7843764",
"0.75904626",
"0.75304943",
"0.7504672",
"0.747138",
"0.7412794",
"0.7403576",
"0.7392287",
"0.7296944",
"0.7259141",
"0.71874154",
"0.71711254",
"0.7112074",
"0.709036",
"0.7067906",
"0.69947386",
"0.6990768",... | 0.8296546 | 0 |
Test peekleft can't be called on empty deques. | def test_cant_peekleft_empty(empty_deque):
assert empty_deque.peekleft() is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_peekleft_return_none_when_empty(new_empty_deque):\n assert new_empty_deque.peekleft() is None",
"def test_peek_left_empty_list():\n from deque import Deque\n dq = Deque()\n assert dq.peek_left() is None",
"def test_pop_left_on_empty_deque():\n from deque import Deque\n dq = Deque()\n... | [
"0.869497",
"0.8658158",
"0.7961052",
"0.7938752",
"0.78588176",
"0.7847153",
"0.77712846",
"0.7733076",
"0.76820976",
"0.7653646",
"0.7647736",
"0.7622755",
"0.7546392",
"0.7471053",
"0.7461773",
"0.7456721",
"0.7350174",
"0.7328798",
"0.7275362",
"0.7210209",
"0.71714437",
... | 0.88838273 | 0 |
Test peeklefting at the proper (head) value. | def test_peekleft_returns_value(full_deque):
assert full_deque.peekleft() == 3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peekleft(self):\n if self.front:\n return self.front.val",
"def test_peek_shows_value_of_current_head(dq_3):\n assert dq_3.peek_left() == 'snine'",
"def test_that_peekleft_returns_head(filled_deque):\n assert filled_deque.peekleft() == 4",
"def peekleft(self):\n if self.new... | [
"0.75279486",
"0.73468935",
"0.7328573",
"0.7175502",
"0.69309133",
"0.68942034",
"0.68223447",
"0.67919904",
"0.6745669",
"0.6518544",
"0.64878124",
"0.64781356",
"0.6392733",
"0.6365095",
"0.62917286",
"0.62813044",
"0.62599677",
"0.6243189",
"0.6212736",
"0.61834204",
"0.6... | 0.72643614 | 3 |
Format specified time duration as human readable text. >>> format_duration(0) '0s' >>> format_duration(61) '1m 1s' >>> format_duration(86400 2 + 60) '2d 1m' >>> format_duration(86400 2 + 60, keep_zeros=True) '2d 0h 1m 0s' >>> format_duration(86400 2 + 60, short_units=False) '2 days 1 minute' >>> format_duration(1) '1s ... | def format_duration(seconds: Union[float, int],
short_units: bool = True,
keep_zeros: bool = False):
if short_units:
units = [(86400, 'd', 'd'), (3600, 'h', 'h'),
(60, 'm', 'm'), (1, 's', 's')]
else:
units = [(86400, ' day', ' days'), (360... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_duration(duration: int) -> str:\n assert duration > 0, \"`duration` must be nonzero number.\"\n\n hours = duration / 3600\n minutes = duration // 60 % 60\n seconds = duration % 60\n\n result = []\n if hours >= 1:\n result.append(\"{} hours\".format(hours))\n if minutes >= 1:\... | [
"0.8164258",
"0.770202",
"0.7465312",
"0.7358414",
"0.72903585",
"0.7265614",
"0.7159384",
"0.7037472",
"0.7013463",
"0.70068485",
"0.69709533",
"0.68307924",
"0.6745669",
"0.67096573",
"0.66820735",
"0.6619122",
"0.6572073",
"0.6555335",
"0.65534097",
"0.65240216",
"0.646631... | 0.74299043 | 3 |
Iterate through all files in `root_dir`, returning the relative paths of each file. The subdirectories will not be yielded. | def iter_files(root_dir: str, sep: str = '/') -> Generator[str, None, None]:
def f(parent_path, parent_name):
for f_name in os.listdir(parent_path):
f_child_path = parent_path + os.sep + f_name
f_child_name = parent_name + sep + f_name
if os.path.isdir(f_child_path):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_in_dir(root_dir):\n file_set = set()\n\n for dir_, _, files in os.walk(root_dir):\n for file_name in files:\n rel_dir = os.path.relpath(dir_, root_dir)\n rel_file = os.path.join(rel_dir, file_name)\n file_set.add(rel_file)\n\n return [Path(PureWindowsPath(... | [
"0.75813466",
"0.7393683",
"0.7353875",
"0.7309697",
"0.7163507",
"0.713694",
"0.7091001",
"0.70528835",
"0.6991746",
"0.6955394",
"0.69136506",
"0.69136506",
"0.69004786",
"0.6784223",
"0.6782648",
"0.6757082",
"0.6727774",
"0.6710993",
"0.6702517",
"0.6684065",
"0.66800773"... | 0.6524021 | 27 |
Get an option's description. This function exists so descriptions are always fetched in the exact same way. | def get_desc(option_name):
if option_name not in OPTIONS:
raise Exception(
f"Option '{option_name}' is missing metadata. " + internal_error_message
)
if "description" not in OPTIONS[option_name]:
raise Exception(
f"Option '{option_name}' is missing a description.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description(self) -> Optional[str]:\n if hasattr(self, \"_description\"):\n return self._description\n _args: list[Arg] = []\n _ctx = self._select(\"description\", _args)\n return _ctx.execute_sync(Optional[str])",
"def description(self) -> Optional[str]:\n if ha... | [
"0.75363505",
"0.75363505",
"0.75363505",
"0.73141265",
"0.7289079",
"0.7207426",
"0.7188839",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",
"0.717354",... | 0.8380134 | 0 |
Assert that two lists of L{Project}s are equal. | def assertProjectsEqual(self, observedProjects, expectedProjects):
self.assertEqual(len(observedProjects), len(expectedProjects))
observedProjects = sorted(
observedProjects, key=operator.attrgetter("directory")
)
expectedProjects = sorted(
expectedProjects, key=o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_project_list_with_projects(self):\n # Add test projects.\n first_project = add_project(title='Title 1', description='Description 1')\n second_project = add_project(title='Title 2', description='Description 2')\n\n # Check that project list contains test projects.\n respo... | [
"0.73328876",
"0.73238105",
"0.6994209",
"0.696267",
"0.69351625",
"0.65774673",
"0.65192145",
"0.65192145",
"0.6508537",
"0.6452453",
"0.6420661",
"0.6392122",
"0.63602877",
"0.6321427",
"0.6298714",
"0.6287265",
"0.62575305",
"0.62445533",
"0.6238674",
"0.62175125",
"0.6155... | 0.7359227 | 0 |
For sensor, return True if connector's 'succeeded_at' field has updated. | def get_sync_status(self, connector_id, previous_completed_at):
# @todo Need logic here to tell if the sync is not running at all and not
# likely to run in the near future.
connector_details = self.get_connector(connector_id)
succeeded_at = self._parse_timestamp(connector_details["succe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_updated(self):\n return self.timestamp > 0",
"def available(self) -> bool:\n return self._coordinator.last_update_success",
"def available(self):\n return self._coordinator.last_update_success",
"def available(self):\n return self.coordinator.last_update_success",
"def av... | [
"0.67608744",
"0.62473327",
"0.62284654",
"0.62173575",
"0.62173575",
"0.62173575",
"0.62173575",
"0.62173575",
"0.62173575",
"0.62173575",
"0.619776",
"0.61824787",
"0.6137783",
"0.60570663",
"0.59798604",
"0.5891137",
"0.5823085",
"0.58165175",
"0.58084744",
"0.5768444",
"0... | 0.6409103 | 1 |
Returns either the pendulumparsed actual timestamp or a very outofdate timestamp if not set | def _parse_timestamp(self, api_time):
return (
pendulum.parse(api_time)
if api_time is not None
else pendulum.from_timestamp(-1)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_timestamp(self):\r\n\t\tlogger.debug(\"Get a timestamp\")\r\n\t\treturn time.mktime(datetime.today().timetuple())",
"def request_timestamp(self) -> Optional[int]:\n if self.last_platform_timestamp is None:\n self.logger.warning(\"No timestamp available yet, will return None\")\n ... | [
"0.648689",
"0.6444861",
"0.63685566",
"0.6341769",
"0.6303737",
"0.6288155",
"0.6212839",
"0.61870384",
"0.6161954",
"0.6149132",
"0.6146321",
"0.6142913",
"0.6133332",
"0.6062449",
"0.60585964",
"0.60549253",
"0.60471123",
"0.6017606",
"0.59948987",
"0.59833187",
"0.5968561... | 0.0 | -1 |
Create minimization operation for critic Qfunction. Creates a `tf.optimizer.minimize` operation for updating critic Qfunction with gradient descent, and appends it to `self._training_ops` attribute. See Equations (5, 6) in [1], for further information of the Qfunction update rule. | def _init_critic_update(self):
Q_target = tf.stop_gradient(self._get_Q_target())
assert Q_target.shape.as_list() == [None, 1]
Q_values = self._Q_values = tuple(
Q([self._observations_ph, self._actions_ph])
for Q in self._Qs)
Q_losses = self._Q_losses = tuple(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_train_op(self):\n if self.optim_type == 'adagrad':\n self.optimizer = tf.train.AdagradOptimizer(self.learning_rate)\n elif self.optim_type == 'adam':\n self.optimizer = tf.train.AdamOptimizer(self.learning_rate)\n elif self.optim_type == 'rprop':\n ... | [
"0.617701",
"0.617701",
"0.61641705",
"0.6143253",
"0.6074943",
"0.60410094",
"0.5970363",
"0.5933841",
"0.5909643",
"0.5799687",
"0.57930064",
"0.5788546",
"0.5755054",
"0.57424307",
"0.573328",
"0.5724873",
"0.5710213",
"0.56204665",
"0.56014216",
"0.55849814",
"0.55797213"... | 0.6569671 | 0 |
Create minimization operations for policy and entropy. Creates a `tf.optimizer.minimize` operations for updating policy and entropy with gradient descent, and adds them to `self._training_ops` attribute. See Section 4.2 in [1], for further information of the policy update, and Section 5 in [1] for further information o... | def _init_actor_update(self):
actions = self._policy.actions([self._observations_ph])
log_pis = self._policy.log_pis([self._observations_ph], actions)
assert log_pis.shape.as_list() == [None, 1]
log_alpha = self._log_alpha = tf.get_variable(
'log_alpha',
dtype=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_train_op(self):\n self._lr_rate = tf.maximum(\n self._hps.min_lr, # min_lr_rate.\n tf.train.exponential_decay(self._hps.lr, self.global_step, 30000, 0.98))\n \n \n # Take gradients of the trainable variables w.r.t. the loss function to minimize\n loss_to_minimize = self._total_lo... | [
"0.69648427",
"0.695903",
"0.695903",
"0.68485653",
"0.67975026",
"0.67818606",
"0.671241",
"0.6701081",
"0.6650842",
"0.6543448",
"0.6537255",
"0.6452603",
"0.6415802",
"0.6385102",
"0.63520676",
"0.6221968",
"0.62092507",
"0.61971563",
"0.61924285",
"0.61868834",
"0.6179307... | 0.0 | -1 |
Depending on which side the ball is, it will bounce to the floor and head to a random point on the other side | def bouncing(self):
x = random.randint(-250, 250) # where the ball will bounce on the X axis
left_x = -850
right_x = 850
rand_y = random.randint(-350, 350) # random height where the ball goes
floor = -350 # bouncing floor
if self.xcor() > 300:
self.goto(x,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bounce(self):\n self.__dx = random.randint(1, MAX_X_SPEED)\n self.__dy = -abs(self.__dy)\n if random.random() > 0.5:\n self.__dx = -self.__dx",
"def make_ball():\n ball = Ball()\n # Starting position of the ball.\n # Take into account the ball size so we don't spawn o... | [
"0.7395145",
"0.7265917",
"0.7169881",
"0.70911753",
"0.68152076",
"0.6756385",
"0.6731728",
"0.66892594",
"0.65376496",
"0.65313524",
"0.65273404",
"0.6411345",
"0.6409751",
"0.6361762",
"0.6352611",
"0.63488364",
"0.6336417",
"0.6316282",
"0.63056767",
"0.62585163",
"0.6250... | 0.80569315 | 0 |
Find numeric ID of the user's public profile. User's profiles are represented with numeric IDs which can be used for the Facebook Graph API. | def get_numeric_id(self, user_name):
url = 'https://www.facebook.com/' + user_name
self.get(url)
source = self.page_source
try:
match = re.search(r"profile_id=(\d*)", source)
numeric_id = match.group(1)
return numeric_id
except (AttributeError,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile_id(self, profile):\n return profile['id']",
"def get_profile_id(self):\n # get list of user profile\n results = self.service.userProfiles().list().execute()\n # TODO: create custom exceptions\n assert 'items' in results\n # TODO: create custom exceptions\... | [
"0.7555418",
"0.73708826",
"0.65480274",
"0.6344922",
"0.62938446",
"0.62693226",
"0.62293553",
"0.6127612",
"0.6053696",
"0.605078",
"0.59591424",
"0.59457433",
"0.5932992",
"0.5916303",
"0.5914374",
"0.59080905",
"0.5904121",
"0.5903699",
"0.5901826",
"0.5898108",
"0.588808... | 0.7593574 | 0 |
convert a quaternion to a matrix and compare it to m | def assert_equal_as_matrix(self, q, m, **kwargs):
np.testing.assert_array_equal(q.to_matrix(), m, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_matrix_from_quaternion_hamilton():\n q = np.sqrt(0.5) * np.array([1, 0, 0, 1])\n R = pr.matrix_from_quaternion(q)\n assert_array_almost_equal(\n np.array([[0, -1, 0],\n [1, 0, 0],\n [0, 0, 1]]),\n R\n )",
"def test_conversions_matrix_quaternion... | [
"0.78906715",
"0.7567117",
"0.7308167",
"0.730368",
"0.7266376",
"0.7201517",
"0.71758056",
"0.7130442",
"0.69615674",
"0.6950392",
"0.6925922",
"0.69119704",
"0.6881468",
"0.6879158",
"0.68496335",
"0.68344015",
"0.6801395",
"0.6796591",
"0.67957723",
"0.6758892",
"0.6717089... | 0.66734284 | 21 |
convert a quaternion to a matrix and compare it to m | def assert_almost_equal_as_matrix(self, q, m, **kwargs):
np.testing.assert_array_almost_equal(q.to_matrix(), m, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_matrix_from_quaternion_hamilton():\n q = np.sqrt(0.5) * np.array([1, 0, 0, 1])\n R = pr.matrix_from_quaternion(q)\n assert_array_almost_equal(\n np.array([[0, -1, 0],\n [1, 0, 0],\n [0, 0, 1]]),\n R\n )",
"def test_conversions_matrix_quaternion... | [
"0.78906715",
"0.7567117",
"0.7308167",
"0.730368",
"0.7266376",
"0.7201517",
"0.71758056",
"0.7130442",
"0.69615674",
"0.6950392",
"0.6925922",
"0.69119704",
"0.6881468",
"0.6879158",
"0.68496335",
"0.68344015",
"0.6801395",
"0.6796591",
"0.67957723",
"0.6758892",
"0.6717089... | 0.63690233 | 38 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.