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 |
|---|---|---|---|---|---|---|
Split a date string into units and epoch | def split_date_string(date_string: str):
try:
units,_,epoch = date_string.split(None, 2)
except ValueError:
raise ValueError(f'Invalid format: {date_string}')
else:
return (units.lower(), parse(epoch)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_date_string(date_string: str):\n # try parsing the original date string as a date\n try:\n epoch = parse(date_string)\n except ValueError:\n pass\n else:\n # return the epoch (as list)\n return (datetime_to_list(epoch), 0.0)\n # split the date string into units ... | [
"0.7257494",
"0.7253272",
"0.67156667",
"0.64704216",
"0.63837385",
"0.6196135",
"0.6182121",
"0.60728586",
"0.6071914",
"0.60442466",
"0.6017566",
"0.60019803",
"0.5955302",
"0.588226",
"0.58331114",
"0.58295196",
"0.5822171",
"0.5812971",
"0.58089995",
"0.57947624",
"0.5778... | 0.78031945 | 0 |
Convert a ``numpy`` ``datetime`` array to seconds since ``epoch`` | def convert_datetime(
date: float | np.ndarray,
epoch: str | tuple | list | np.datetime64 = _unix_epoch
):
# convert epoch to datetime variables
if isinstance(epoch, (tuple, list)):
epoch = np.datetime64(datetime.datetime(*epoch))
elif isinstance(epoch, str):
epoch = np.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ts_to_epoch_seconds(t) -> float:\n return t.astype(int) / 1e9",
"def epoch2datetime(t):\n return datetime.fromtimestamp(t/1000.0)",
"def seconds_since_epoch(date_time, epoch=None):\n return microseconds_since_epoch(date_time) / 10.0**6",
"def epoch_seconds(date):\n td = date - epoch\n retu... | [
"0.7118472",
"0.7046606",
"0.6772909",
"0.66768813",
"0.66768813",
"0.6676594",
"0.6578405",
"0.65100276",
"0.6425068",
"0.6245704",
"0.6234241",
"0.6234241",
"0.6190503",
"0.61882025",
"0.6174044",
"0.5989631",
"0.5972627",
"0.59568745",
"0.59374034",
"0.5933194",
"0.5920487... | 0.720014 | 0 |
Universal Time (UT) as Julian Days | def ut1(self):
return self.MJD + 2400000.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_juldate():\n import time\n mjd = time.time()/86400.0 + 40587.0\n return mjd + 2400000.5",
"def JulianDay(self):\n a = (14 - self._month) // 12\n y = self._year + 4800 - a\n m = self._month + (12 * a) - 3\n return (self._day + (153 * m + 2) // 5 + 365 * y +\n ... | [
"0.715137",
"0.71111745",
"0.69940096",
"0.6913078",
"0.68461066",
"0.6762256",
"0.66047966",
"0.6559268",
"0.64414185",
"0.634221",
"0.630194",
"0.6293434",
"0.6263928",
"0.6248005",
"0.6168659",
"0.61454284",
"0.6137253",
"0.6083866",
"0.6073943",
"0.6063152",
"0.60316104",... | 0.64695466 | 8 |
Counts the number of leap seconds between a given GPS time and UTC | def count_leap_seconds(
GPS_Time: np.ndarray | float,
truncate: bool = True
):
# get the valid leap seconds
leaps = get_leap_seconds(truncate=truncate)
# number of leap seconds prior to GPS_Time
n_leaps = np.zeros_like(GPS_Time,dtype=np.float64)
for i,leap in enumerate(leaps):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utctoweekseconds(utc, leapseconds=18):\n datetimeformat = \"%Y-%m-%d %H:%M:%S\"\n epoch = datetime.datetime.strptime(\"1980-01-06 00:00:00\", datetimeformat)\n tdiff = utc - epoch + datetime.timedelta(seconds=leapseconds)\n gpsweek = tdiff.days // 7\n gpsdays = tdiff.days - 7 * gpsweek\n gpss... | [
"0.65216655",
"0.5833346",
"0.57278067",
"0.56890005",
"0.56728673",
"0.5596442",
"0.5512546",
"0.54993033",
"0.53895235",
"0.53806776",
"0.5326265",
"0.5325846",
"0.52866095",
"0.52589804",
"0.51825666",
"0.51720935",
"0.5155383",
"0.5153672",
"0.511898",
"0.51158345",
"0.50... | 0.714384 | 0 |
create an OnnxRuntime InferenceSession. | def create_inference_session(self):
sess_options = onnxruntime.SessionOptions()
sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_DISABLE_ALL
self.infer_session = onnxruntime.InferenceSession(
self.augmented_model_path,
sess_options=sess_optio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_ort_session(self, onnx_path):\n # Setup options for optimization\n sess_options = ort.SessionOptions()\n sess_options.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL\n sess_options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL\n\n self.ort_sessio... | [
"0.64287347",
"0.63863736",
"0.6347452",
"0.5931692",
"0.5925455",
"0.58672893",
"0.5637707",
"0.5620587",
"0.5582713",
"0.55574703",
"0.550082",
"0.5489399",
"0.547671",
"0.54669124",
"0.5439374",
"0.54066926",
"0.5406201",
"0.53796494",
"0.5331371",
"0.5314776",
"0.5209954"... | 0.82782066 | 0 |
Sets the token_expiration of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def token_expiration(self, token_expiration):
self._token_expiration = token_expiration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_expiration(self):\n # This is an arbitrary decision setting the expiration time\n # to the current date + expires_in - 10 seconds\n self.expiration = datetime.now() + \\\n timedelta(seconds=(self.expires_in - 10))\n logging.debug('Token expiration set to %s' % self.ex... | [
"0.65515846",
"0.6489425",
"0.61133724",
"0.6036679",
"0.58961684",
"0.55701935",
"0.5387193",
"0.536487",
"0.5342043",
"0.5285386",
"0.5218918",
"0.5185711",
"0.5058732",
"0.50248253",
"0.49781796",
"0.4948664",
"0.49243316",
"0.48843396",
"0.48690245",
"0.4849527",
"0.48338... | 0.7860061 | 0 |
Sets the password_hash_iterations of this OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties. | def password_hash_iterations(self, password_hash_iterations):
self._password_hash_iterations = password_hash_iterations | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password_hash(self, password):\n salt = bcrypt.gensalt()\n self.password_hash = bcrypt.hashpw(password.encode(), salt)",
"def password_hash_algorithm(self, password_hash_algorithm):\n\n self._password_hash_algorithm = password_hash_algorithm",
"def set_password(self, password):\n ... | [
"0.61004245",
"0.6039315",
"0.57552356",
"0.56171733",
"0.5576066",
"0.5576066",
"0.5562618",
"0.55493253",
"0.55397487",
"0.5534445",
"0.5534032",
"0.54852223",
"0.5428458",
"0.5395618",
"0.5395618",
"0.5395618",
"0.5395618",
"0.5382891",
"0.5292858",
"0.5260845",
"0.5180539... | 0.7950528 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80886984",
"0.80886984",
"0.8055307",
"0.7983415",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Checks whether two models parameters are equal | def check_params_equal(param1, param2):
for key, val in param1.items():
if np.any(param1[key] != param2[key]):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def models_are_equivalent(model_a: TopLevelOscalModel, model_b: TopLevelOscalModel) -> bool:\n # this will change the second model as a side-effect\n model_b.metadata.last_modified = model_a.metadata.last_modified\n return model_a == model_b",
"def __eq__(self, other: 'ModelParameters') -> bool:\n ... | [
"0.7516173",
"0.74578166",
"0.7345072",
"0.7342032",
"0.7218318",
"0.72155297",
"0.710855",
"0.7100062",
"0.70620775",
"0.6999765",
"0.6909127",
"0.6865819",
"0.68470407",
"0.6826237",
"0.68185353",
"0.67935354",
"0.6775829",
"0.67686844",
"0.6742816",
"0.6725789",
"0.6703481... | 0.6883297 | 11 |
Convert given row and column number to an Excelstyle cell name. | def excel_style(col):
result = []
while col:
col, rem = divmod(col-1, 26)
result[:0] = LETTERS[rem]
return ''.join(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cell_name(self, inst_name, row, col):\n return self.bitcell_array.get_cell_name(inst_name + \"{}x\".format(OPTS.hier_seperator) + self.bitcell_array_inst.name, row, col)",
"def convert_number_to_excel_colname(n):\n\n assert 0 < n <= 256\n\n alphabet = [chr(x) for x in xrange(65, 91)]\n\n ... | [
"0.6875886",
"0.6873031",
"0.6624854",
"0.646285",
"0.6194314",
"0.59675694",
"0.58355004",
"0.5832388",
"0.5810062",
"0.578682",
"0.5703801",
"0.5666068",
"0.5597809",
"0.55182964",
"0.5498179",
"0.54974335",
"0.5480556",
"0.5470536",
"0.5445592",
"0.5410976",
"0.5398021",
... | 0.5506305 | 14 |
Calculates the softmax for each row of the input x. Your code should work for a row vector and also for matrices of shape (n, m). | def softmax(x):
x_exp = np.exp(x)
x_sum = np.sum(x_exp, axis=1, keepdims=True)
s = x_exp / x_sum
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n x = np.array(x)\n if x.ndim == 1:\n return column_softmax(x)\n else:\n ret_arr = np.array([column_softmax(col) for col in x.T])\n return ret_arr.T",
"def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).reshape(-1, 1)\n exp_x = np.exp(x - row_wise_max... | [
"0.8463776",
"0.8435088",
"0.8414381",
"0.82625526",
"0.8240777",
"0.8203867",
"0.8156382",
"0.81255054",
"0.8109221",
"0.8072896",
"0.8058246",
"0.8042024",
"0.7988304",
"0.7928008",
"0.7902256",
"0.78875816",
"0.7881924",
"0.7847789",
"0.78416556",
"0.7826352",
"0.7824393",... | 0.7576917 | 89 |
Return storage type if there is only one. This should always return a type in relational databases, but does not have to in databases such as MongoDB. | def unique_storage_type(self):
if len(self.storage_types) == 1:
return list(self.storage_types)[0]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_storage_type(self):\r\n\r\n if len(self.storage_types) == 1:\r\n return list(self.storage_types)[0]\r\n else:\r\n return None",
"def unique_storage_type(self):\r\n\r\n if len(self.storage_types) == 1:\r\n return list(self.storage_types)[0]\r\n ... | [
"0.84290254",
"0.84290254",
"0.81773037",
"0.81211674",
"0.81211674",
"0.81211674",
"0.79246795",
"0.771355",
"0.7289832",
"0.7134607",
"0.7115287",
"0.7115287",
"0.71080095",
"0.70176816",
"0.69720024",
"0.69720024",
"0.6906267",
"0.6888628",
"0.6732944",
"0.6709205",
"0.665... | 0.8422047 | 2 |
Initialize source stream. If the fields are not initialized, then they are read from the table. | def initialize(self):
if not self.context:
self.context = SQLContext(self.url, self.connection, self.schema)
if self.table is None:
self.table = self.context.table(self.table_name)
if not self.fields:
self.read_fields()
self.field_names = self.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_table(self, table: \"Table\"):\n if not self.columns:\n self.columns = table.columns\n self._data = table.data",
"def __post_init__(self):\n # Only do this if source_data already exists (not during its own initialization)\n if \"SOURCE_DATA\" in globals():\n ... | [
"0.6567911",
"0.64584345",
"0.64303744",
"0.62981564",
"0.6155012",
"0.61321723",
"0.6029323",
"0.59548885",
"0.59049594",
"0.5894522",
"0.58836263",
"0.5859183",
"0.58539855",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"... | 0.6926253 | 0 |
Sets a name for `node`. Raises an exception if the `node` is not part of the stream, if `name` is empty or there is already node with the same name. | def rename_node(self, node, name):
if not name:
raise ValueError("No node name provided for rename")
if name in self.nodes():
raise ValueError("Node with name '%s' already exists" % name)
old_name = self.node_name(node)
del self.nodes[old_name]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)",
"def setName(self, name):\n libxml2mod.xmlNodeSetName(self._o, name)",
"def node_name(self, value: str):\n self._properties[\"nodeName\"] = value",
"def set_name(self, name):\n self.name = name # overwrite... | [
"0.83490866",
"0.7088931",
"0.6897682",
"0.6853107",
"0.6853107",
"0.6769459",
"0.67315155",
"0.6702388",
"0.6701894",
"0.668318",
"0.6648065",
"0.6642689",
"0.6640702",
"0.6640702",
"0.6640702",
"0.6640702",
"0.6634831",
"0.6628643",
"0.66260713",
"0.6609876",
"0.65992534",
... | 0.7324265 | 1 |
Return dictionary representation of the field. | def to_dict(self):
d = {
"name": self.name,
"label": self.label,
"storage_type": self.storage_type,
"analytical_type": self.analytical_type,
"concrete_storage_type": self.concrete_storage_type,
"missing_values... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n _dict = {}\n for f in self._meta.fields:\n if f.name == 'created':\n _dict[f.name] = str(f.value_from_object(self))\n else:\n _dict[f.name] = f.value_from_object(self)\n\n return _dict",
"def dictify(self):\n ret... | [
"0.7392628",
"0.738731",
"0.72834563",
"0.7272394",
"0.72522825",
"0.72284466",
"0.72047096",
"0.713855",
"0.70919913",
"0.70575505",
"0.7041807",
"0.70039463",
"0.69826317",
"0.69761455",
"0.69625425",
"0.69602543",
"0.69359726",
"0.6919989",
"0.6919989",
"0.691676",
"0.6912... | 0.6696163 | 85 |
Return field name as field string representation. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NAME(self) -> str:\n return self._field_name",
"def py_field_name(self, field):\n name = field.name\n name = as_identifier(name)\n if self.options(field).convert_case:\n name = from_camel_case(name)\n name = self._mangle_name(name)\n return name",
"def _... | [
"0.7857624",
"0.78311974",
"0.76416886",
"0.7597991",
"0.7528716",
"0.748733",
"0.7357914",
"0.7356117",
"0.7232144",
"0.72058624",
"0.71373785",
"0.70608956",
"0.70161134",
"0.6975634",
"0.6858445",
"0.6816973",
"0.6816973",
"0.6803938",
"0.6796402",
"0.67763567",
"0.6700877... | 0.0 | -1 |
Return a list representing field selector which fields are selected from a row. | def selectors(self, fields = None):
sel_names = [str(field) for field in fields]
selectors = [unicode(name) in sel_names for name in self.names()]
return selectors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _select_fields(self):\r\n return []",
"def _get_fields(self):\n table = self.ui.tableFields\n rows = table.rowCount()\n cols = table.columnCount()\n fields = []\n for i in range(rows):\n fields.append(\n tuple(map(lambda x: table.item(i, x).... | [
"0.7673547",
"0.67533666",
"0.65299696",
"0.6491336",
"0.64159906",
"0.62741077",
"0.6236396",
"0.6159341",
"0.60381097",
"0.60081404",
"0.59687746",
"0.5967494",
"0.59337884",
"0.5927561",
"0.59260964",
"0.58889085",
"0.5869368",
"0.5869368",
"0.5823076",
"0.57602054",
"0.57... | 0.67026454 | 2 |
Coalesces `value` to given storage `type`. `empty_values` is a dictionary where keys are storage type names and values are values to be used as empty value replacements. | def coalesce_value(value, storage_type, empty_values=None, strip=False):
if empty_values is None:
empty_values={}
if storage_type in ["string", "text"]:
if strip:
value = value.strip()
elif value:
value = unicode(value)
if value == "" or value is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_store(raw_val):\n if raw_val not in EMPTY_VALUES:\n return auto_type_convert(raw_val)\n else:\n return raw_val",
"def check_integrity(dict):\n if (dict['type'] == 'string') and (dict['value'] == None or dict['value'] == ''):\n dict['value'] = '\"\"'",
"def empty(cls, ke... | [
"0.58325046",
"0.521288",
"0.49877736",
"0.4948348",
"0.48418808",
"0.4832019",
"0.4825413",
"0.47597077",
"0.47303224",
"0.47151342",
"0.47076306",
"0.4702731",
"0.46962714",
"0.46962714",
"0.46882483",
"0.46549195",
"0.4623449",
"0.4623449",
"0.4623449",
"0.4623449",
"0.462... | 0.65644866 | 0 |
Get all subclasses of node. | def node_subclasses(root, abstract = False):
classes = []
for c in utils.subclass_iterator(root):
try:
info = get_node_info(c)
node_type = info.get("type")
if node_type != "abstract":
classes.append(c)
except AttributeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descendants(cls):\n return cls.__subclasses__() + \\\n [g for s in cls.__subclasses__() for g in s.descendants()]",
"def get_subclasses(self, klass: TypeInfo) -> OrderedSet[TypeInfo]:\n if klass not in self._graph:\n return OrderedSet([klass])\n result: OrderedSet[T... | [
"0.7140406",
"0.6957714",
"0.6886573",
"0.6848165",
"0.68365824",
"0.6833044",
"0.6756908",
"0.67236257",
"0.66959816",
"0.66798323",
"0.6634815",
"0.6603208",
"0.65786904",
"0.65046304",
"0.64756143",
"0.64746326",
"0.6457086",
"0.6451578",
"0.6394505",
"0.6363579",
"0.63500... | 0.7421831 | 0 |
Initializes the node. Initialization is separated from creation. Put any Node subclass initialization in this method. Default implementation does nothing. | def initialize(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = self.Node(None)",
"def __init__(self):\n self.root = Node(None)",
"def initialize(self, node: MComputeNode):\n raise Exception(\"Subclass responsibility\")",
"def __init__(self):\n self.__root = Node()",
"def __init__(self):\n self.root =... | [
"0.7394568",
"0.7317101",
"0.7298309",
"0.7248716",
"0.71772677",
"0.7159799",
"0.71550786",
"0.7080142",
"0.7070756",
"0.7070756",
"0.7045996",
"0.6988274",
"0.698752",
"0.698752",
"0.698752",
"0.69853956",
"0.6927686",
"0.6922692",
"0.6920655",
"0.68968785",
"0.68796796",
... | 0.62976766 | 65 |
Return single node imput if exists. Convenience property for nodes which process only one input. Raises exception if there are no inputs or are more than one imput. | def input(self):
if len(self.inputs) == 1:
return self.inputs[0]
else:
raise Exception("Single input requested. Node has none or more than one input (%d)."
% len(self.inputs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_node(model):\n iter = model.GetNodes()\n while iter.IsValid():\n node = iter.Get()\n if \"InputNode\" in node.GetRuntimeTypeName():\n return node\n iter.Next()\n return None",
"def single_input_node(self, port: int):\n input_nodes = self.input_nodes(p... | [
"0.6151729",
"0.5955724",
"0.5748265",
"0.5743951",
"0.53562725",
"0.5282334",
"0.52456343",
"0.51267284",
"0.5086693",
"0.49852207",
"0.4975962",
"0.49515104",
"0.49140608",
"0.49103492",
"0.49075767",
"0.48992518",
"0.48833162",
"0.48802078",
"0.4870505",
"0.48196357",
"0.4... | 0.6596412 | 0 |
Retype an output field `name` to field `field`. | def retype(self, name, **attributes):
self._retype_dictionary[name] = attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def give_field(self, name):\n return self.field(name).toPyObject()",
"def output_field(self):\n Field = self.original_field.__class__\n if isinstance(self.original_field, fields.CharField):\n return Field(max_length=self.original_field.max_length)\n\n return Field()",
"de... | [
"0.6752095",
"0.6315052",
"0.6160488",
"0.6054666",
"0.5919098",
"0.584958",
"0.57491964",
"0.57263315",
"0.57225895",
"0.5691854",
"0.5658548",
"0.56518394",
"0.5613815",
"0.55921423",
"0.55889755",
"0.5578654",
"0.557052",
"0.5529592",
"0.5525257",
"0.5491146",
"0.548618",
... | 0.0 | -1 |
Creates a node that will select records where `field` contains value from `value_set`. | def __init__(self, field = None, value_set = None, discard = False):
super(SetSelectNode, self).__init__()
self.field = field
self.value_set = value_set
self.discard = discard | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, value, caseSensitive=False):\n newq = self.copy()\n newq.setOp(Query.Op.Contains)\n newq.setValue(value)\n newq.setCaseSensitive(caseSensitive)\n return newq",
"def find_tasks_by_field(field, field_value):\n if field == 'date':\n tasks = Task.select... | [
"0.61387366",
"0.5894773",
"0.58398205",
"0.56510174",
"0.56493205",
"0.56202406",
"0.5549655",
"0.55027217",
"0.5488821",
"0.54749596",
"0.54177004",
"0.5409625",
"0.5339753",
"0.53032535",
"0.52950317",
"0.5278579",
"0.5220621",
"0.51991963",
"0.5172268",
"0.516876",
"0.510... | 0.538276 | 12 |
Return storage type if there is only one. This should always return a type in relational databases, but does not have to in databases such as MongoDB. | def unique_storage_type(self):
if len(self.storage_types) == 1:
return list(self.storage_types)[0]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_storage_type(self):\r\n\r\n if len(self.storage_types) == 1:\r\n return list(self.storage_types)[0]\r\n return None",
"def storage_type(self) -> str:\n return pulumi.get(self, \"storage_type\")",
"def storage_type(self) -> Optional[pulumi.Input[str]]:\n return ... | [
"0.84219027",
"0.81767267",
"0.81212354",
"0.81212354",
"0.81212354",
"0.79251057",
"0.7713634",
"0.7288947",
"0.71342427",
"0.7114066",
"0.7114066",
"0.71074",
"0.7018581",
"0.6972723",
"0.6972723",
"0.6906787",
"0.6888426",
"0.67335147",
"0.6708264",
"0.6656682",
"0.6612755... | 0.84288293 | 0 |
Return storage type if there is only one. This should always return a type in relational databases, but does not have to in databases such as MongoDB. | def unique_storage_type(self):
if len(self.storage_types) == 1:
return list(self.storage_types)[0]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_storage_type(self):\r\n\r\n if len(self.storage_types) == 1:\r\n return list(self.storage_types)[0]\r\n return None",
"def storage_type(self) -> str:\n return pulumi.get(self, \"storage_type\")",
"def storage_type(self) -> Optional[pulumi.Input[str]]:\n return ... | [
"0.8422102",
"0.8176501",
"0.81210995",
"0.81210995",
"0.81210995",
"0.7924676",
"0.77130455",
"0.7289685",
"0.71347797",
"0.71145844",
"0.71145844",
"0.710812",
"0.7017996",
"0.69726884",
"0.69726884",
"0.6906241",
"0.68885106",
"0.67330426",
"0.67083806",
"0.66560495",
"0.6... | 0.8429062 | 1 |
Sets name of current node. | def set_name(self, name):
self.stream.set_node_name(self.node, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n ... | [
"0.79930604",
"0.79815876",
"0.79815876",
"0.79815876",
"0.79815876",
"0.79815876",
"0.7972499",
"0.7959629",
"0.7959629",
"0.7954432",
"0.79386765",
"0.7903524",
"0.79033303",
"0.79033303",
"0.79007787",
"0.78796196",
"0.78541315",
"0.7770957",
"0.77659255",
"0.77659255",
"0... | 0.88172925 | 0 |
Create a default logger | def create_logger():
global logger
logger = logging.getLogger(logger_name)
formatter = logging.Formatter(fmt='%(asctime)s %(levelname)s %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)
return logger | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_logger_creator(config):\n return UnifiedLogger(config, logdir, loggers=None)",
"def create_logger() -> logging.Logger:\n pass # TODO: Replace with implementation!",
"def create_logger():\n logging.basicConfig(level = logging.INFO, filename='logging', filemode='w')\n log... | [
"0.809169",
"0.7998874",
"0.774856",
"0.7713438",
"0.7710585",
"0.7466199",
"0.74572444",
"0.7447276",
"0.74315107",
"0.7409398",
"0.74037707",
"0.73186123",
"0.7294232",
"0.7293659",
"0.72897285",
"0.72745645",
"0.72398216",
"0.72253305",
"0.71935004",
"0.7160885",
"0.715393... | 0.7786755 | 2 |
Generator over all subclasses of a given class, in depth first order. | def subclass_iterator(cls, _seen=None):
if not isinstance(cls, type):
raise TypeError('_subclass_iterator must be called with '
'new-style classes, not %.100r' % cls)
_seen = _seen or set()
try:
subs = cls.__subclasses__()
except TypeError: # fails on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_subclasses(cls):\n for subclass in cls.__subclasses__():\n yield subclass\n for subc in all_subclasses(subclass):\n yield subc",
"def class_hierarchy(clslist):\n for cls in clslist:\n subclass_list = cls.__subclasses__()\n if subclass_list:\n ... | [
"0.7962231",
"0.7943153",
"0.7784564",
"0.7563064",
"0.7522415",
"0.7415031",
"0.73414916",
"0.73381543",
"0.73268855",
"0.7237079",
"0.7028352",
"0.70265555",
"0.70090574",
"0.69635135",
"0.6907735",
"0.6889192",
"0.6881786",
"0.68299997",
"0.68015057",
"0.6777709",
"0.67390... | 0.7539626 | 4 |
Set the Group ID for the service to be registered. | def setGroupId(self, groupId):
internals.blpapi_ServiceRegistrationOptions_setGroupId(
self.__handle, groupId.encode('utf-8'))
# NOTE: we should convert groupId to bytes here because
# otherwise we'll get an error in SWIG wrapper. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def group_id(self, group_id... | [
"0.7257652",
"0.7257652",
"0.7257652",
"0.7257652",
"0.7257652",
"0.7257652",
"0.6927829",
"0.6887743",
"0.67472553",
"0.6733823",
"0.6626543",
"0.66177475",
"0.6609379",
"0.6551552",
"0.6538167",
"0.64768946",
"0.6458963",
"0.6439793",
"0.6335913",
"0.6293197",
"0.62830555",... | 0.76897526 | 0 |
Return the name of the exchange. This is used by the RESTClientFactory and is NOT the name of the class, but is defined by the class implementation. | def name():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exchange_name(self):\n LOGGER.info('Getting the exchange name')\n if self._exchange is None:\n raise ExchangeNotDefinedYet('The exchange is not defined')\n return self._exchange",
"def get_name(cls):\n return cls.__name__",
"def name(self):\n\n return self.... | [
"0.8098211",
"0.6656022",
"0.66340804",
"0.662712",
"0.6609683",
"0.6591373",
"0.6591373",
"0.6591373",
"0.6591373",
"0.6591373",
"0.65405357",
"0.653918",
"0.653918",
"0.6534172",
"0.65311414",
"0.64898247",
"0.6486621",
"0.6480957",
"0.6480957",
"0.6480957",
"0.6454231",
... | 0.0 | -1 |
Sets the dimention of the stokes vector. | def set_stokes_dim(self, stokes_dim):
if stokes_dim not in [1, 2, 3, 4]:
raise ValueError(
"The dimention of the stokes vector can only be 1, 2, 3 or 4"
)
self.stokes_dim = stokes_dim | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setidd(self, iddinfo, iddindex, block, idd_version):\n self.idd_info = iddinfo\n self.block = block\n self.idd_index = iddindex\n self.idd_version = idd_version",
"def duns(self, duns: str):\n\n self._duns = duns",
"def set_stdeviations(self, sigma):\n stdeviations... | [
"0.632355",
"0.6193907",
"0.5888917",
"0.5645816",
"0.5536929",
"0.55124253",
"0.5478698",
"0.544167",
"0.5424394",
"0.54221827",
"0.53855914",
"0.5377502",
"0.5362815",
"0.53419864",
"0.53410035",
"0.53191084",
"0.53157526",
"0.5282019",
"0.52759916",
"0.5262627",
"0.5243309... | 0.6994929 | 0 |
Clalculates the extinction term based on the given intensity and the absorbtion and scattering coefficent at the given height. | def extinction_term(self, intensity, height):
id = f.argclosest(height, self.height_array)
k = (
self.absorption_coeff_field[id]
+ self.use_scat * self.scattering_coeff_field[id]
)
# np.exp calculates element wise not the matricexponential!
# but for diag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extinction(pyrat):\n # Load parameters for that molecular species (in future pyrat.cond.names for condensate species) \n species = 'H2O'\n pyrat.haze.cloudBenneke.readVP(species) # do this outside once in beginning of code and call it??\n # Fill in Cloud Base Pressure and Temperature\n pyrat.h... | [
"0.5243953",
"0.5232212",
"0.52192557",
"0.52076006",
"0.5106173",
"0.5002402",
"0.49990737",
"0.497829",
"0.49478427",
"0.49193546",
"0.49118948",
"0.487345",
"0.48102024",
"0.4802348",
"0.47917363",
"0.47859445",
"0.477885",
"0.47580746",
"0.47495157",
"0.47404954",
"0.4739... | 0.74419826 | 0 |
True if the message has changed since last read. | def changed(self):
if self.readable:
old_data = self.data[:]
data = self.tag.read_binary(0, self._max_le)
size = data[0] * 256 + data[1] + 2
tail = max(0, size - len(data))
while len(data) < size:
count = min(self._max_lc, size - len(da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isUpdated(self):\n seq = self.readSeq()\n\n if (seq != self.seq):\n self.seq = seq\n return True\n else:\n return False",
"def has_changed(self):\n return bool(self.changed_data)",
"def has_been_modified(self):\n return self._has_been_modi... | [
"0.7590222",
"0.7515303",
"0.74319184",
"0.7383908",
"0.73827004",
"0.7348319",
"0.7306883",
"0.72848237",
"0.7212825",
"0.7155925",
"0.71495605",
"0.714205",
"0.7109246",
"0.7104731",
"0.7051768",
"0.70474595",
"0.6978085",
"0.6942784",
"0.69229704",
"0.6901572",
"0.6877428"... | 0.69910336 | 16 |
Configure and return the Flask app | def create_app(self):
app.config.from_object('config.TestingConfig')
return app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app(self):\n\n ## set flask specific things that are non-optional\n error = lambda k: 'Fatal: You need to specify a \"flask\" section ' + \\\n 'with an entry like \"'+k+'=...\" in your .ini file'\n try: app_name = self['flask.app']\n except KeyError: raise SystemExit... | [
"0.85104823",
"0.81120455",
"0.8054589",
"0.80477077",
"0.7995264",
"0.7929426",
"0.7846994",
"0.7837908",
"0.7773335",
"0.7747373",
"0.7746391",
"0.7729097",
"0.77219594",
"0.7708146",
"0.77017826",
"0.76943517",
"0.7686414",
"0.7680069",
"0.76726705",
"0.76552176",
"0.76191... | 0.76463825 | 20 |
Initialize layers of the head. | def _init_layers(self):
self.relu = nn.ReLU(inplace=True)
self.cls_convs = nn.ModuleList()
self.reg_convs = nn.ModuleList()
for i in range(self.stacked_convs):
chn = self.in_channels if i == 0 else self.feat_channels
self.cls_convs.append(
ConvModu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()",
"def _init_layers(self) -> None:\n self.self_attn = MultiheadAttention(**self.self_attn_cfg)\n self.cross_attn = MultiheadAttention(**self.cross_attn_cfg)\n self.... | [
"0.7565452",
"0.73801965",
"0.7378758",
"0.70826614",
"0.70083666",
"0.68058515",
"0.6793121",
"0.6747672",
"0.6699219",
"0.6565106",
"0.6552534",
"0.6548868",
"0.6536724",
"0.6533556",
"0.65013635",
"0.64803135",
"0.6478405",
"0.6438143",
"0.6429889",
"0.6428964",
"0.6401287... | 0.67046845 | 8 |
Initialize weights of the head. | def init_weights(self):
for m in self.cls_convs:
normal_init(m.conv, std=0.01)
for m in self.reg_convs:
normal_init(m.conv, std=0.01)
bias_cls = bias_init_with_prob(0.01)
normal_init(self.retina_cls, std=0.01, bias=bias_cls)
normal_init(self.retina_reg, st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_weights(self):\n pass",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def setWeightInitializer(self,weights):\n self.init_w = weights",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weigh... | [
"0.8231931",
"0.8066145",
"0.8041016",
"0.8037346",
"0.79638714",
"0.78825206",
"0.7794443",
"0.7718116",
"0.76905215",
"0.76740956",
"0.7660412",
"0.76257116",
"0.76194113",
"0.75636816",
"0.7554319",
"0.7554319",
"0.75442475",
"0.75423366",
"0.75423366",
"0.75423366",
"0.75... | 0.66495466 | 96 |
Forward feature of a single scale level. | def forward_single(self, x):
cls_feat = x
reg_feat = x
for cls_conv in self.cls_convs:
cls_feat = cls_conv(cls_feat)
for reg_conv in self.reg_convs:
reg_feat = reg_conv(reg_feat)
cls_score = self.retina_cls(cls_feat)
bbox_pred = self.retina_reg(reg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature_forward(self, x):\n raise NotImplementedError",
"def forward(self, x):\n x = self.features(x)\n return x",
"def forward_single(self, x, scale):\n cls_feat = x\n reg_feat = x\n for cls_conv in self.cls_convs:\n cls_feat = cls_conv(cls_feat)\n ... | [
"0.74690366",
"0.68007946",
"0.65777415",
"0.6515914",
"0.6515914",
"0.6404764",
"0.6320513",
"0.6306763",
"0.6299315",
"0.6285584",
"0.6279949",
"0.6200305",
"0.6179189",
"0.6158268",
"0.6132828",
"0.6124821",
"0.61077636",
"0.61061907",
"0.6104554",
"0.6101124",
"0.6098391"... | 0.0 | -1 |
Computes all applicable offers if the offer type is PriceDrop. | def get_basket_items_pricedrop(self, offer_info, actual_volume, product_prices):
prod_code = offer_info.base_prod_code
base_prod_vol = actual_volume.get(prod_code.lower())
pricedrop_basket = []
if base_prod_vol >= offer_info.min_vol:
offer_on_prod = offer_info.offer_on
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_viable_offers(want, have, offers) -> List:\n return [x for x in offers if is_offer_viable(want, have, x) is True]",
"def _compute_offers_to_send(self) -> Dict[Tuple[float, float], float]:\n partial_asgt = self._neighbors_values.copy()\n offers = dict()\n\n for limited_asgt in g... | [
"0.6091617",
"0.56822497",
"0.5510932",
"0.54817843",
"0.5454564",
"0.5445133",
"0.5424857",
"0.5380617",
"0.5372044",
"0.53682536",
"0.52954173",
"0.52618384",
"0.52528185",
"0.5248819",
"0.5241865",
"0.5238828",
"0.5230508",
"0.5212023",
"0.51742303",
"0.5160276",
"0.515464... | 0.55353993 | 2 |
initialise Domain with cell vertices and sizes | def __init__( self, xh ):
super( Domain, self ).__init__( xh )
self.dg = 0.5*self.dxh # cell jacobian
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initializeDomainBorder(self):\n #Read image of the structure\n if (self.PictureExistance == \"'yes'\"):\n self.__processImage()\n #re-define the domain size with the layers of boundaries and ghost points\n self.ny, self.nx = self.effectiveDomain.shape\n ... | [
"0.65595925",
"0.6468736",
"0.6450791",
"0.6306958",
"0.62393385",
"0.6191882",
"0.61890566",
"0.6186516",
"0.6183734",
"0.61758626",
"0.61507654",
"0.6102445",
"0.60795426",
"0.60794216",
"0.6060467",
"0.60585374",
"0.60388637",
"0.60134053",
"0.5997532",
"0.59871835",
"0.59... | 0.65838295 | 0 |
This method converts the loaded JSON file into a YAML file. | def _convert(self):
json_data = xjson.loads(self.jfile_path)
with io.open(self.yfile_path, 'w', encoding='utf8') as f:
yaml.dump(json_data, f, default_flow_style=False, allow_unicode=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conversion_yaml():\r\n data ={\r\n 'name': 'george',\r\n 'age': 16,\r\n 'friends':\r\n [{'name': 'marry', 'age': 16}, {'name': 'jack', 'age': 17}]\r\n }\r\n yaml_data = yaml.dump(data)\r\n dirname = os.path.dirname(os.path.dirname(__file__))\r\n # data_dir = os.path.j... | [
"0.6950082",
"0.65651673",
"0.64373296",
"0.6395889",
"0.6372225",
"0.63502705",
"0.6332867",
"0.6277105",
"0.62494844",
"0.62304705",
"0.6180754",
"0.61751336",
"0.6173389",
"0.6132995",
"0.6115755",
"0.61057806",
"0.609142",
"0.60893536",
"0.6081999",
"0.60774404",
"0.60572... | 0.7058134 | 0 |
Buids the optimizer(s) to minimize the loss(es) of the model. | def _build_optimizer(self, optimizer_to_use=tf.train.AdamOptimizer, tpu_support=False):
self.optimize_ops = []
for loss in self.losses['train']: # TODO Create apropoiate external training scheme
optimize_op = optimizer_to_use(
learning_rate=self.learning_rate
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_optimizers(self, *args, **kwargs):\n\n # self.optimizers.append(...)\n # self.loss.append(...)\n pass",
"def optimizer(self, model: nn.Module) -> torch.optim.Optimizer: # type: ignore\n pass",
"def add_optimizers_to_graph(self):\n with tf.device(self.params.device):\n ... | [
"0.6608268",
"0.64778686",
"0.6411067",
"0.62030786",
"0.6198828",
"0.61828005",
"0.6151315",
"0.6079092",
"0.6024876",
"0.60010314",
"0.59784526",
"0.59219277",
"0.5897613",
"0.58832854",
"0.5872504",
"0.5870774",
"0.5869316",
"0.58690035",
"0.58505696",
"0.5844197",
"0.5842... | 0.5378428 | 72 |
Simple function to compute the dot product for any number of arguments. | def dot(*Ms):
N = Ms[0]
for M in Ms[1:]:
N = np.dot(N, M)
return N | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotProduct(v1, v2):\n return sum((a * b) for a, b in zip(v1, v2))",
"def dotproduct(v1, v2):\n\treturn sum(imap(operator.mul, v1, v2))",
"def dot_product(a, b):\n a1, a2, a3 = a\n b1, b2, b3 = b\n return a1 * b1 + a2 * b2 + a3 * b3",
"def dotproduct(vec1, vec2):\n return sum((a*b) for a, b... | [
"0.78134674",
"0.7769241",
"0.77504635",
"0.7745433",
"0.77197284",
"0.77065027",
"0.7691163",
"0.7675378",
"0.76714635",
"0.7669843",
"0.76356405",
"0.7633193",
"0.7629635",
"0.7625092",
"0.7574043",
"0.74101996",
"0.7398503",
"0.7380813",
"0.7374599",
"0.73743266",
"0.73453... | 0.7135117 | 35 |
list of topics in a forum forum_id id of a Forum record | def topic_list(request, forum_id, pagination_id=1):
try:
topics = Topic.objects.order_by('-is_global', '-is_sticky', '-topic_modification_date').filter(Q(topic_forum=forum_id) | Q(is_global='1'))
forum_name = Forum.objects.get(id=forum_id)
forum_name = forum_name.forum_name
except:
return HttpResponseRedirect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_topics(project_id):\n project_path = f\"projects/{project_id}\"\n for topic in PUBLISHER_CLIENT.list_topics(request={\"project\": project_path}):\n print(topic)",
"def get_teacher_topic_all():\n topic_data = query_db(\n \"SELECT topics.id, topics.name, classes.name FROM topics JOI... | [
"0.71958566",
"0.7154457",
"0.7141806",
"0.70193803",
"0.68313867",
"0.68131095",
"0.6796887",
"0.67777157",
"0.66847396",
"0.6667825",
"0.6666503",
"0.658895",
"0.65878844",
"0.64640737",
"0.64293224",
"0.64095646",
"0.63564235",
"0.6342142",
"0.63283175",
"0.6324823",
"0.62... | 0.8021172 | 0 |
add topic forum_id ID of a Forum entry | def add_topic(request, forum_id):
if request.POST:
page_data = request.POST.copy()
page_data['topic_author'] = str(request.user)
tags = findall( r'(?xs)\[code\](.*?)\[/code\]''', page_data['text'])
for i in tags:
page_data['text'] = page_data['text'].replace(u'[code]'+i+u'[/code]', u'[code]'+base64.enco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, project_id, forum):\n url = base_url + 'portal/' + str(self.portal_id) + '/projects/' + str(project_id) + '/forums/' \n data = parser.to_json(forum)\n if forum.get_upload_file():\n file_list = []\n for value in forum.get_upload_file():\n attac... | [
"0.6570903",
"0.6472428",
"0.6250559",
"0.62304735",
"0.6184321",
"0.60586286",
"0.60568684",
"0.6007388",
"0.6006287",
"0.6000936",
"0.5944206",
"0.5922772",
"0.58859265",
"0.5834617",
"0.5823592",
"0.5787207",
"0.57700557",
"0.57238126",
"0.5704046",
"0.5689148",
"0.5668062... | 0.770152 | 0 |
Create separate list of products | def create_lol_non_json():
all_assets= {
'loyalist_products' : [],
'nonloyalist_products' : []
}
with open('product_map.csv', 'rU') as product_map_file:
reader = csv.reader(product_map_file)
reader.next()
for row in reader:
if row[1].lower() == 'loyalist'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_products(self):\n\n lst = []\n for product in self.products.findall('product'):\n id = product.find('id').text\n name = product.find('name').text\n dispensary_id = product.find('dispensary_id').text\n dispensary_name = product.find('dispensary_name'... | [
"0.74861544",
"0.72362596",
"0.7197762",
"0.7040266",
"0.69847625",
"0.6922062",
"0.691666",
"0.69131726",
"0.6891263",
"0.68896013",
"0.6869908",
"0.68412274",
"0.68405294",
"0.6837897",
"0.6827034",
"0.68108493",
"0.673016",
"0.67167586",
"0.6713133",
"0.6710625",
"0.669335... | 0.0 | -1 |
Writes database values with header to a csv file | def backup_database(cls):
with open('db_backup.csv', 'w', newline='') as csvfile:
fieldnames = ['product_name',
'product_price',
'product_quantity',
'date_updated']
writer = csv.DictWriter(csvfile, fieldnames=f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dbtocsv():\n connection = sqlite3.connect(\"sensordata.db\")\n cursor = connection.cursor()\n cursor.execute(\"Select * from sensordata\")\n roadstationdata = cursor.fetchall()\n\n with open('roadstationdata.csv', 'w') as f:\n writer = csv.writer(f)\n wr... | [
"0.76455003",
"0.7485735",
"0.744107",
"0.73065215",
"0.72242785",
"0.7182872",
"0.7182053",
"0.71791434",
"0.71308947",
"0.71163934",
"0.7060005",
"0.70399785",
"0.7039917",
"0.7022545",
"0.6983291",
"0.6969411",
"0.69114316",
"0.6907802",
"0.68914586",
"0.68578553",
"0.6857... | 0.0 | -1 |
Extracts crater coordinates (in pixels) from a CNNpredicted target by iteratively sliding rings through the image via match_template from scikitimage. | def template_match_t(self, target, minrad=minrad_, maxrad=maxrad_,
longlat_thresh2=longlat_thresh2_, rad_thresh=rad_thresh_,
template_thresh=template_thresh_,
target_thresh=target_thresh_, rw=rw_):
# thickness of rings for template match
#c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(image_path, wrapper):\n \"\"\"\n #Don't forget to store your prediction into ImgPred\n img_prediction = ImgPred(...)\n \"\"\"\n\n #This is where all of our code will probably go. Here are the steps to success\n\n \n #Step One: Make a list which will cont... | [
"0.5992719",
"0.59377164",
"0.59244645",
"0.5877198",
"0.5799066",
"0.5745002",
"0.57416475",
"0.5725476",
"0.56992644",
"0.5695285",
"0.56865203",
"0.56704944",
"0.5668689",
"0.5619099",
"0.55937564",
"0.55932057",
"0.5573753",
"0.55696166",
"0.55518115",
"0.55396336",
"0.54... | 0.613752 | 0 |
Return true if entity is on. | def is_on(self) -> bool:
return self._current_speed != SPEED_OFF | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on(self) -> bool:\n return self.entity_description.is_on_fn(self._client)",
"def is_on(self) -> bool:\n return self.entity_description.state_fn(self._valve)",
"def is_on(hass, entity_id):\n return hass.states.is_state(entity_id, STATE_ON)",
"def is_on(self) -> bool:\n return se... | [
"0.85540265",
"0.8216411",
"0.8045664",
"0.7860732",
"0.7860732",
"0.75340164",
"0.7447756",
"0.7408673",
"0.73520595",
"0.73520595",
"0.73520595",
"0.73520595",
"0.73520595",
"0.73107237",
"0.7309693",
"0.7309128",
"0.7309128",
"0.7309128",
"0.7309128",
"0.7309128",
"0.73091... | 0.0 | -1 |
Is the logical type of the column equal to the other column. | def is_type_equivalent(self, other):
mine = self._replace_defaults()
theirs = other._replace_defaults()
def remove_base(dct):
# removes base attributes in the phyiscal layer.
basekeys = Column._replace_defaults(self).keys()
for k in basekeys:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return super(Column, self).__eq__(tuple(other))",
"def conformability(self, other):\r\n if self.columns == other.rows:\r\n return True\r\n else:\r\n return False",
"def _is_equal_same_type(self, other):\n return True",
"def __eq__(s... | [
"0.70812297",
"0.6932587",
"0.6804235",
"0.6796748",
"0.67400944",
"0.66611063",
"0.6654303",
"0.66352093",
"0.65839386",
"0.65638554",
"0.6563409",
"0.6555065",
"0.6536806",
"0.6502776",
"0.64863825",
"0.64399666",
"0.64218426",
"0.6402173",
"0.63337994",
"0.63291293",
"0.63... | 0.66202605 | 8 |
Gets the meta of this StoreProfile. | def meta(self):
return self._meta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_meta(self) -> Meta:\n return Meta(\n object_type=\"profile\",\n extra_custom_props=[\n (\"property\", \"profile.username\", self.user.username),\n (\"property\", \"profile.first_name\", self.user.first_name),\n (\"property\", \"profi... | [
"0.75090975",
"0.6818852",
"0.6687395",
"0.6506509",
"0.6486768",
"0.6472494",
"0.63900566",
"0.6342975",
"0.63346213",
"0.6325228",
"0.6315868",
"0.6256557",
"0.62344116",
"0.61842823",
"0.6178086",
"0.6144196",
"0.6142889",
"0.6142889",
"0.6099836",
"0.60929203",
"0.6089251... | 0.7010534 | 2 |
Gets the name of this StoreProfile. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n return self.profile_device.name",
"def name(self):\n return self.properties.get('name', None)",
"def name(self):\n return self.measurement_profile.name",
"def name(self):\n return self.properties.get('name')",
"def name(self):\n return self.proper... | [
"0.76981187",
"0.733422",
"0.7321972",
"0.7318531",
"0.7318531",
"0.72827613",
"0.7189084",
"0.7160284",
"0.71291465",
"0.71291465",
"0.7111798",
"0.7087537",
"0.7087537",
"0.70873374",
"0.70873374",
"0.70873374",
"0.70739406",
"0.7037252",
"0.7032549",
"0.7026763",
"0.702676... | 0.0 | -1 |
Sets the name of this StoreProfile. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_name(self, profile_name):\n\n self._profile_name = profile_name",
"def profile_name(self, profile_name):\n\n self._profile_name = profile_name",
"def set_name(self, name):\n self._name = name",
"def set_name(self, name: str):\n self._name = name",
"def set_name(self,... | [
"0.76024014",
"0.76024014",
"0.73460335",
"0.7331119",
"0.73240584",
"0.73240584",
"0.73240584",
"0.73240584",
"0.73240584",
"0.73008317",
"0.719803",
"0.7145583",
"0.71070445",
"0.71070445",
"0.7063145",
"0.706168",
"0.70541626",
"0.70541626",
"0.70182437",
"0.69738054",
"0.... | 0.0 | -1 |
Gets the description of this StoreProfile. | def description(self):
return self._description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_description(self):\n return self.__description",
"def getDescription(self):\n return self.description",
"def getDescription(self):\n return self._description",
"def get_description(self):\n return self._description",
"def get_description(self):\n\n return self._de... | [
"0.6791806",
"0.67796797",
"0.67580754",
"0.6744666",
"0.6726742",
"0.67260855",
"0.67260855",
"0.67260855",
"0.67260855",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615",
"0.6714615... | 0.6608305 | 75 |
Sets the description of this StoreProfile. | def description(self, description):
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\n self.description = description",
"def set_description(self, description):\n self._description = description",
"def set_description(self, description):\n self.__description = description",
"def set_description(self, description):\r\n self._... | [
"0.7216981",
"0.7169391",
"0.7163605",
"0.7136314",
"0.7072769",
"0.6972964",
"0.6972557",
"0.68284494",
"0.68284494",
"0.68284494",
"0.68284494",
"0.6813767",
"0.6771052",
"0.6771052",
"0.6771052",
"0.6771052",
"0.66920125",
"0.656157",
"0.6513287",
"0.6509549",
"0.6437283",... | 0.68255776 | 42 |
Gets the billing_info of this StoreProfile. | def billing_info(self):
return self._billing_info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def billing_info(self):\r\n return BillingInfo(self)",
"def billing(self):\n return self._billing",
"def billing_account(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"billing_account\")",
"def billing_account(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"bill... | [
"0.77087563",
"0.71477145",
"0.6761446",
"0.6761446",
"0.6761446",
"0.6540891",
"0.6534776",
"0.64655393",
"0.63661957",
"0.63661957",
"0.61825705",
"0.61825705",
"0.61659193",
"0.61363465",
"0.6119282",
"0.61044437",
"0.6019976",
"0.5942303",
"0.5787421",
"0.55749315",
"0.55... | 0.8297777 | 0 |
Sets the billing_info of this StoreProfile. | def billing_info(self, billing_info):
self._billing_info = billing_info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def billing(self, billing):\n\n self._billing = billing",
"def billing_contact(self, billing_contact):\n\n self._billing_contact = billing_contact",
"def billing_currency(self, billing_currency):\n\n self._billing_currency = billing_currency",
"def billing_info(self):\n return sel... | [
"0.6947018",
"0.6334089",
"0.59712374",
"0.5709125",
"0.56954914",
"0.5641454",
"0.52830344",
"0.5201318",
"0.5174602",
"0.51457936",
"0.5099419",
"0.5058219",
"0.5058219",
"0.50350636",
"0.50086355",
"0.49812788",
"0.49464315",
"0.49219757",
"0.49004814",
"0.4897163",
"0.485... | 0.8221735 | 0 |
Sets the facebook of this StoreProfile. | def facebook(self, facebook):
self._facebook = facebook | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook_url(self, facebook_url):\n\n self._facebook_url = facebook_url",
"def facebook(self):\n try:\n from facebook import Facebook\n except ImportError:\n log.warning(\"PyFacebook is not installed!\")\n else:\n if self.user and self.user.profile... | [
"0.6374106",
"0.5990116",
"0.5905431",
"0.54284465",
"0.5185664",
"0.5098087",
"0.50038993",
"0.4828573",
"0.4786767",
"0.4675968",
"0.46523046",
"0.46096033",
"0.4588999",
"0.45869476",
"0.4569041",
"0.4569041",
"0.4555865",
"0.4552569",
"0.45499423",
"0.4545021",
"0.4514413... | 0.7717775 | 0 |
Gets the youtube of this StoreProfile. | def youtube(self):
return self._youtube | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def youtube(self, youtube):\n\n self._youtube = youtube",
"def get_youtube_api_key(self):\n key = self.bot_data_file[\"youtube\"][\"key\"]\n if self.check_empty_key(key):\n return key\n else:\n print(\n \"ERROR GETTING THE YOUTUBE KEY (check bot do... | [
"0.6090054",
"0.5948142",
"0.5814511",
"0.57243747",
"0.5691043",
"0.5570341",
"0.5460085",
"0.54214174",
"0.5418943",
"0.5391258",
"0.5333565",
"0.5277207",
"0.5272169",
"0.5246922",
"0.5221705",
"0.5219989",
"0.52189547",
"0.5195068",
"0.51844424",
"0.51579475",
"0.5124477"... | 0.79352546 | 0 |
Sets the youtube of this StoreProfile. | def youtube(self, youtube):
self._youtube = youtube | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def youtube(self):\n return self._youtube",
"def isYouTube(self):\n if 'youtube' in self.link.split('.'):\n return True\n return None",
"def play_youtube(self, media_id):\n pass",
"def set_y(self, y):\n self._y = y",
"def SetY(self, y):\r\n\r\n self._y =... | [
"0.6800553",
"0.54981285",
"0.52603334",
"0.52439976",
"0.5157042",
"0.5153385",
"0.5152133",
"0.5151252",
"0.5134109",
"0.5134109",
"0.50935537",
"0.504834",
"0.5020317",
"0.4995652",
"0.49926963",
"0.49606714",
"0.4948556",
"0.49337053",
"0.49234337",
"0.49103868",
"0.48708... | 0.8214083 | 0 |
Gets the instagram of this StoreProfile. | def instagram(self):
return self._instagram | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def self(self):\n\n url = \"https://api.instagram.com/v1/users/self/?access_token=\" + self.access_token\n request = requests.get(url)\n return request.json()",
"def get_gallery_profile(self):\n url = (\"https://api.imgur.com/3/account/{0}/\"\n \"gallery_profile\".format... | [
"0.6358503",
"0.5790814",
"0.57500106",
"0.5704466",
"0.54454136",
"0.54388595",
"0.5421649",
"0.5314913",
"0.5236288",
"0.52185434",
"0.51092464",
"0.5101984",
"0.5048644",
"0.5047885",
"0.50447875",
"0.50331956",
"0.49664336",
"0.49385908",
"0.49379966",
"0.4937163",
"0.493... | 0.80316 | 0 |
Gets the pinterest of this StoreProfile. | def pinterest(self):
return self._pinterest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interests(self):\n if \"interests\" in self._prop_dict:\n return self._prop_dict[\"interests\"]\n else:\n return None",
"def get_percent_interest(self):\n return self.__percentage_interest",
"def get_profile(self):\n endpoint = '/profile'\n return se... | [
"0.65898913",
"0.62914765",
"0.58359545",
"0.5743681",
"0.5684692",
"0.562656",
"0.5506814",
"0.5492201",
"0.5492201",
"0.53988117",
"0.5398023",
"0.53309345",
"0.5324174",
"0.5252778",
"0.52367723",
"0.52086645",
"0.5199404",
"0.51921695",
"0.5150444",
"0.5120884",
"0.511402... | 0.7561153 | 0 |
Sets the pinterest of this StoreProfile. | def pinterest(self, pinterest):
self._pinterest = pinterest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repaid_interest(self, repaid_interest):\n\n self._repaid_interest = repaid_interest",
"def paid_interest(self, paid_interest):\n\n self._paid_interest = paid_interest",
"def set_profile(self, profile: str):\n self._profile = profile",
"def pinterest(self):\n return self._pinte... | [
"0.6722862",
"0.66200674",
"0.5696167",
"0.5647955",
"0.5599525",
"0.5578526",
"0.5578526",
"0.5271597",
"0.5177461",
"0.5171312",
"0.51635766",
"0.5154178",
"0.50973547",
"0.50973547",
"0.5083053",
"0.5078245",
"0.50472605",
"0.500781",
"0.49349016",
"0.48526222",
"0.4851890... | 0.76808065 | 0 |
Gets the linkedin of this StoreProfile. | def linkedin(self):
return self._linkedin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_profile(self):\n return self.user.profile",
"def customer_profile_oid(self):\n return self._customer_profile_oid",
"def linkedin(self, linkedin):\n\n self._linkedin = linkedin",
"def facebook(self):\n return self._facebook",
"def spinnaker_link_id(self):\n re... | [
"0.5506056",
"0.54694885",
"0.5464488",
"0.544704",
"0.54469264",
"0.54198897",
"0.529772",
"0.5277959",
"0.52728975",
"0.5262846",
"0.52600217",
"0.5232096",
"0.5193333",
"0.51623476",
"0.51113135",
"0.5104671",
"0.5104671",
"0.50951856",
"0.5093852",
"0.5092114",
"0.5088513... | 0.78746176 | 0 |
Sets the linkedin of this StoreProfile. | def linkedin(self, linkedin):
self._linkedin = linkedin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linkedin(self):\n return self._linkedin",
"def set_profile(self, profile: str):\n self._profile = profile",
"def ssl_profile_id(self, ssl_profile_id):\n\n self._ssl_profile_id = ssl_profile_id",
"def bank_link_id(self, bank_link_id):\n\n self._bank_link_id = bank_link_id",
"... | [
"0.58889306",
"0.56160456",
"0.53995335",
"0.5340398",
"0.52321786",
"0.50734967",
"0.50274986",
"0.49676663",
"0.4957416",
"0.4908219",
"0.4908219",
"0.48871168",
"0.48871168",
"0.48871168",
"0.48871168",
"0.48871168",
"0.48276922",
"0.47811252",
"0.47811252",
"0.47811252",
... | 0.7773678 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, StoreProfile):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84568954",
"0.83923674",
"0.81447554",
"0.81407183",
"0.81326675",
"0.80941343",
"0.8092415",
"0.8092415",
"0.8092415",
"0.8085536",
"0.8085536",
"0.8076502",
"0.8076502",
"0.8066026"
] | 0.0 | -1 |
Create model from json. | def from_json(recipe_item_json):
return RecipeItem(
recipe_item_json.get('hash', None),
recipe_item_json.get('uid', None)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(data: Dict[str, Any]) -> 'ModelData':\n return ModelData(data.get(\"name\"),\n data.get(\"type\"),\n data.get(\"value\"),\n data.get(\"units\"))",
"def from_json(cls, factory, json_data):\n data = deepcopy(json_da... | [
"0.7584196",
"0.7180405",
"0.7118459",
"0.710242",
"0.7052127",
"0.70423496",
"0.7041804",
"0.6896937",
"0.6863662",
"0.6847984",
"0.6832809",
"0.68271583",
"0.6817734",
"0.68111944",
"0.6752456",
"0.6734141",
"0.6680335",
"0.6679268",
"0.6679268",
"0.6672973",
"0.66457385",
... | 0.0 | -1 |
Is the queue empty? | def is_empty(self):
# If the queue is an empty list, self._data would return False
# So if the queue is empty we want to return true
# modify with not self._data
return not self._data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return self.queue == []",
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def ... | [
"0.92403233",
"0.9186681",
"0.91693956",
"0.91693956",
"0.914682",
"0.9137048",
"0.9083102",
"0.90663934",
"0.9037946",
"0.8976355",
"0.89380217",
"0.8915447",
"0.89138514",
"0.8908865",
"0.8884015",
"0.88772047",
"0.88772047",
"0.88771504",
"0.881595",
"0.87687516",
"0.87408... | 0.8465951 | 26 |
Unauthenticated users are redirected to the login screen. | def test_login_required(self):
response = self.client.get(reverse("upload-form"))
# See if a temporary redirect happens...
self.assertEqual(response.status_code, 302)
# Slightly redundant, but could alert early about unexpected changes/issues.
self.assertIsInstance(response, H... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deny_access():\n flash('You must login first.')\n return redirect(url_for('home'))",
"def unauthorized_handler(self):\n return flask.redirect(\"/login\")",
"def unauthorized():\n flash(\"You must be logged in to view that page.\")\n return redirect(url_for(\"auth.login_view\"))",
"def ... | [
"0.76734066",
"0.7642473",
"0.7596786",
"0.7472385",
"0.74398303",
"0.7406799",
"0.73732406",
"0.7365459",
"0.7322922",
"0.7294877",
"0.7252337",
"0.72414875",
"0.7239106",
"0.72310627",
"0.72267795",
"0.7203325",
"0.7185352",
"0.71704066",
"0.7160235",
"0.7126403",
"0.709778... | 0.0 | -1 |
If form invalid return error list in JSON response | def form_invalid(self, form, prefix=None):
response = super(FormAjaxMixin, self).form_invalid(form)
if self.request.is_ajax():
data = {
"errors_list": self.add_prefix(form.errors, prefix),
}
return self.json_to_response(status=400, json_data=data,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_invalid(self, form):\n response = super().form_invalid(form)\n if self.is_ajax():\n return JsonResponse(form.errors, status=400)\n else:\n return response",
"def form_invalid(self, form):\n response = super(AjaxableResponseMixin, self).form_invalid(form)... | [
"0.7665663",
"0.75349003",
"0.7339613",
"0.71741205",
"0.7158141",
"0.7126791",
"0.7107218",
"0.6952973",
"0.6897809",
"0.6629777",
"0.6626728",
"0.6606772",
"0.6513617",
"0.64996225",
"0.64490724",
"0.6420252",
"0.63936806",
"0.63936806",
"0.6303919",
"0.6296751",
"0.6293436... | 0.7219318 | 3 |
The type of the job. | def job_type(self) -> pulumi.Output[str]:
return pulumi.get(self, "job_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_type(self):\n return self._job_type",
"def type(self) -> Optional[pulumi.Input['JobType']]:\n return pulumi.get(self, \"type\")",
"def job_details_type(self) -> str:\n return pulumi.get(self, \"job_details_type\")",
"def job_details_type(self) -> str:\n return pulumi.get(s... | [
"0.9002671",
"0.844342",
"0.76216686",
"0.76216686",
"0.76216686",
"0.7435503",
"0.726418",
"0.709847",
"0.7038003",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"0.7030451",
"... | 0.87467295 | 1 |
The labels associated with this job. You can use these to organize and group your jobs. | def labels(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
return pulumi.get(self, "labels") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label(self):\n return self.job[self.label_key]",
"def labels(self) -> Mapping[str, str]:\n return pulumi.get(self, \"labels\")",
"def labels(self) -> Mapping[str, str]:\n return pulumi.get(self, \"labels\")",
"def labels(self) -> Mapping[str, str]:\n return pulumi.get(self... | [
"0.7774395",
"0.757336",
"0.757336",
"0.757336",
"0.757336",
"0.757336",
"0.757336",
"0.757336",
"0.757336",
"0.7461375",
"0.7347413",
"0.7347413",
"0.723107",
"0.72306985",
"0.720582",
"0.720582",
"0.720582",
"0.720582",
"0.720582",
"0.71988285",
"0.7185549",
"0.71437156",... | 0.71388465 | 29 |
The geographic location of the job. The default value is US. | def location(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "location") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(self) -> str:\n return pulumi.get(self, \"location\")",
"def location(self) -> str:\n return pulumi.get(self, \"location\")",
"def location(self) -> str:\n return pulumi.get(self, \"location\")",
"def location(self) -> str:\n return pulumi.get(self, \"location\")",
... | [
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.74507964",
"0.733936",
"0.7273975",
"0.72535896",
"0.72535896",
"0.72535896",
"0.7241201",
"0.7181057",
"... | 0.7040756 | 30 |
Email address of the user who ran the job. | def user_email(self) -> pulumi.Output[str]:
return pulumi.get(self, "user_email") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_useremail(self):\n return self.user.email",
"def email(self, instance):\r\n return instance.user.email",
"def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')",
"def email(self) -> str:\n return pulumi.get... | [
"0.8045067",
"0.7482019",
"0.72746706",
"0.7197063",
"0.7197063",
"0.7197063",
"0.7195695",
"0.7189387",
"0.7168474",
"0.7168474",
"0.7168474",
"0.7168474",
"0.71192086",
"0.7095948",
"0.7094554",
"0.70901",
"0.69890106",
"0.6986238",
"0.6955563",
"0.691718",
"0.68999255",
... | 0.8011265 | 1 |
Space n items with spacing according to (n1) ratios. E.g., ratios=[0, 1] puts item[1] at item[0] fraction = (dc)/(dc + (ed)) => (dc) = (ec) fraction. | def set_between(self,
coord: str,
*items: str,
ratios: None | Sequence[float] = None) -> None:
if ratios is None:
ratios = [1] * (len(items) - 1)
for c, d, e, r1, r2 in zip(items, items[1:], items[2:], ratios, ratios[1:],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spacing(self, divisions=10, ratio=1.0, thickness=1.0):\r\n if divisions == 1:\r\n sp = [0.0, 1.0]\r\n return np.array(sp)\r\n\r\n growth = ratio**(1.0 / (float(divisions) - 1.0))\r\n\r\n if growth == 1.0:\r\n growth = 1.0 + 1.0e-10\r\n\r\n s0 = 1.0\r... | [
"0.6269365",
"0.62639314",
"0.5947355",
"0.5471383",
"0.52522314",
"0.523624",
"0.51842475",
"0.51664436",
"0.5130865",
"0.5109552",
"0.51064223",
"0.5102746",
"0.50894815",
"0.50866324",
"0.5018106",
"0.5007691",
"0.4956959",
"0.4938565",
"0.49329013",
"0.4932875",
"0.493201... | 0.5090766 | 12 |
Return a standard feed dictionary for this dataset. | def create_supplier(self, x, y, other_feeds=None, name=None):
if not other_feeds:
other_feeds = {}
# noinspection PyUnusedLocal
def _supplier(step=None):
"""
:param step: unused, just for making it compatible with `HG` and `Saver`
:return: the fe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feed_dict(self, dataset: Dataset, train: bool = False) -> FeedDict:\n return {}",
"def make_feed_dict(self, data):\r\n raise NotImplementedError",
"def make_feed_dict(data):\n raise NotImplemented()",
"def get_feed_dict(self, contexts, endings, **kwargs):\n return {}",
"def ... | [
"0.7395898",
"0.7168172",
"0.68816406",
"0.6846803",
"0.6486111",
"0.6357085",
"0.63534397",
"0.6323259",
"0.6295681",
"0.6267062",
"0.621977",
"0.6208225",
"0.6144665",
"0.6024322",
"0.601893",
"0.59780514",
"0.59629107",
"0.5940235",
"0.5908434",
"0.5869132",
"0.5869132",
... | 0.0 | -1 |
Generates and returns a single Datasets (possibly composed by training, validation and test sets) according to args and kwargs | def generate_datasets(self, rand=None, *args, **kwargs):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_datasets(self):\n\n degrade_test = False\n if self._opts['degrade_step'] == 'test':\n degrade_test = True\n\n use_trainset_for_tests = UseTrainForTest.IDENTICAL # can be different in few shot workflow\n\n train_dataset, test_dataset = self._gen_datasets_with_options(self._opts['tr... | [
"0.7621178",
"0.69473433",
"0.69207567",
"0.68117255",
"0.67662066",
"0.67376935",
"0.67357695",
"0.66206133",
"0.6593647",
"0.6577879",
"0.65543586",
"0.6548655",
"0.6536837",
"0.64582735",
"0.6456158",
"0.6447764",
"0.6381144",
"0.6376832",
"0.6368962",
"0.63482434",
"0.633... | 0.68321073 | 3 |
Return _aware_ `datetime.now()` object in UTC timezone. This function must be used to insert or update `datetime` fields in the database, otherwise the validation `validate_utc` will reject the value. | def utcnow():
# From the Python documentation:
# https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
# datetime.utcnow()
# Return the current UTC date and time, with `tzinfo None`.
# This is like `now()`, but returns the current UTC date and time, as a
# naive `datetim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_utc_now() -> datetime:\n return datetime.now(timezone.utc)",
"def now_utc() -> datetime:\n return datetime.now(timezone.utc)",
"def utc_now():\n return datetime.now(tz=timezone.utc)",
"def get_utc_now():\n return datetime.datetime.utcnow().replace(tzinfo=pytz.timezone(\"UTC\"))",
"... | [
"0.8656396",
"0.8527489",
"0.8506886",
"0.8276427",
"0.8191999",
"0.815434",
"0.801268",
"0.7952559",
"0.7899885",
"0.78881174",
"0.7862986",
"0.7835481",
"0.7827097",
"0.775173",
"0.765144",
"0.7639328",
"0.76259637",
"0.7582488",
"0.7496754",
"0.74300855",
"0.74300855",
"... | 0.73830366 | 23 |
Emulate legacy field superseeded by `patient_consent_date`. Forward to current datetime to `patient_consent_date` setter, which will set both underlying columns. | def patient_consent(self, value):
self.patient_consent_date = utcnow() if value else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patient_consent_date(self, value):\n self._patient_consent_date = value\n self._patient_consent = 1 if value else 0",
"def patient_consent_date(self):\n return self._patient_consent_date",
"def set_to_date(self):\n self.set_value_into_input_field(self.set_to_date_locator, self.g... | [
"0.668064",
"0.5796747",
"0.57947594",
"0.571031",
"0.571031",
"0.5642255",
"0.5556245",
"0.5523759",
"0.55139166",
"0.5509836",
"0.55023223",
"0.5477226",
"0.5464905",
"0.5369002",
"0.5365053",
"0.5335959",
"0.53224725",
"0.5223045",
"0.5208461",
"0.5204645",
"0.51883584",
... | 0.6615058 | 1 |
Get internal value for `patient_consent_date`. | def patient_consent_date(self):
return self._patient_consent_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_patient_consent_date(self, d: dict):\n consent_date = d.get('patient_consent_date')\n consent_bool = d.get('patient_consent')\n if consent_date is not None:\n return self._str_to_datetime(consent_date)\n elif consent_bool:\n t0 = datetime.datetime.fromtim... | [
"0.8094495",
"0.7589582",
"0.7246536",
"0.71703386",
"0.6186469",
"0.60771775",
"0.582364",
"0.582364",
"0.582364",
"0.582364",
"0.5744298",
"0.57036215",
"0.5643021",
"0.56060433",
"0.56060433",
"0.56060433",
"0.56038517",
"0.5568324",
"0.5548201",
"0.55249274",
"0.5518372",... | 0.8428358 | 0 |
Read patient_consent information from dict serialization. For existing rows that did not record the actual consent date, if `patient_consent` is True, `ceation_date` is used if present, UNIX epoch 0 if it is missing. | def _read_patient_consent_date(self, d: dict):
consent_date = d.get('patient_consent_date')
consent_bool = d.get('patient_consent')
if consent_date is not None:
return self._str_to_datetime(consent_date)
elif consent_bool:
t0 = datetime.datetime.fromtimestamp(0, t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patient_consent(self):\n return 1 if self.patient_consent_date is not None else 0",
"def patient_consent(self, value):\n self.patient_consent_date = utcnow() if value else None",
"def patient_consent_date(self, value):\n self._patient_consent_date = value\n self._patient_consent... | [
"0.5926589",
"0.5809377",
"0.5732567",
"0.56433344",
"0.55838776",
"0.5239948",
"0.514208",
"0.5133141",
"0.4684602",
"0.45138747",
"0.44812942",
"0.44552103",
"0.44459537",
"0.44308993",
"0.44297066",
"0.4419778",
"0.43893576",
"0.4386389",
"0.43847585",
"0.4346647",
"0.4310... | 0.73424447 | 0 |
Creates a DataLoader from given source and its open/transform params. | def get_loader(
data_source: Iterable[dict],
open_fn: Callable,
dict_transform: Callable = None,
sampler=None,
collate_fn: Callable = default_collate_fn,
batch_size: int = 32,
num_workers: int = 4,
shuffle: bool = False,
drop_last: bool = False,
):
from catalyst.data.dataset impo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_DataLoader(self, **kwargs):\r\n return DataLoader(self, **kwargs)",
"def get_dataloader(params, format_name='hdf5', **kwargs):\n \n Provider = get_proper_provider(format_name)(params.modality)\n \n return DataLoader(Provider(params.dataset_path,\n seq_len... | [
"0.67652076",
"0.6572773",
"0.6279626",
"0.61619353",
"0.61383015",
"0.61090654",
"0.60896605",
"0.60315233",
"0.6029367",
"0.60176903",
"0.5900374",
"0.58815914",
"0.5844954",
"0.584316",
"0.5832388",
"0.5825662",
"0.58236927",
"0.58061033",
"0.58045447",
"0.5799926",
"0.577... | 0.73296386 | 0 |
Returns a batch from experiment loaders by its index or name. | def get_native_batch_from_loaders(
loaders: Dict[str, DataLoader],
loader: Union[str, int] = 0,
batch_index: int = 0,
):
if isinstance(loader, str):
loader_instance = loaders[loader]
elif isinstance(loader, int):
loader_instance = list(loaders.values())[loader]
else:
rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_native_batch_from_loader(loader: DataLoader, batch_index: int = 0):\n dataset = loader.dataset\n collate_fn = loader.collate_fn\n return collate_fn([dataset[batch_index]])",
"def get_batch(self, name):\n batches = self._meta['sets'].get('batches', {})\n if batches.get(name):\n ... | [
"0.62770796",
"0.6147377",
"0.6142249",
"0.5965098",
"0.5944489",
"0.58695436",
"0.58550024",
"0.5844343",
"0.57876563",
"0.57487893",
"0.5744385",
"0.56675255",
"0.56562734",
"0.56562734",
"0.5644203",
"0.56192917",
"0.56192917",
"0.561557",
"0.55952257",
"0.557245",
"0.5514... | 0.6902564 | 0 |
Creates pytorch dataloaders from datasets and additional parameters. | def get_loaders_from_params(
batch_size: int = 1,
num_workers: int = 0,
drop_last: bool = False,
per_gpu_scaling: bool = False,
loaders_params: Dict[str, Any] = None,
samplers_params: Dict[str, Any] = None,
initial_seed: int = 42,
get_datasets_fn: Callable = None,
**data_params,
) ->... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dataloaders(params):\r\n transform_train = transforms.Compose([transforms.RandomCrop(32, padding=4),\r\n transforms.RandomHorizontalFlip(),\r\n transforms.ToTensor(),\r\n transform... | [
"0.79882824",
"0.7873911",
"0.77523524",
"0.7489144",
"0.7423688",
"0.74065715",
"0.7383054",
"0.73766834",
"0.73579735",
"0.735641",
"0.7308889",
"0.72247446",
"0.7185362",
"0.71817666",
"0.7140771",
"0.71166503",
"0.711527",
"0.7087059",
"0.7068981",
"0.7030009",
"0.7026917... | 0.0 | -1 |
Find all rows in a matrix that is zero, and add a 1 on the diagonal | def ident_zeros(A):
assert A.size[0] == A.size[1]
A.assemble()
o_range = A.getOwnershipRange()
rows = []
for i in range(o_range[1]-o_range[0]):
indices, values = A.getRow(o_range[0]+i)
absrow = sum(abs(values))
if absrow < 1e-6:
rows.append(o_range[0] + i)
add... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_matrix(matrix):\n rows = set()\n columns = set()\n m = len(matrix)\n n = len(matrix[0])\n for i in range(m):\n for j in range(n):\n if matrix[i][j] == 0:\n rows.add(i)\n columns.add(j)\n\n for i in range(m):\n for j in range(n):\n ... | [
"0.73189586",
"0.7197821",
"0.7129083",
"0.70978343",
"0.7078936",
"0.68751305",
"0.68057173",
"0.6782833",
"0.67469335",
"0.66681945",
"0.6666137",
"0.66429776",
"0.6623435",
"0.6621061",
"0.6620543",
"0.6616192",
"0.66147125",
"0.66110265",
"0.66069096",
"0.65960264",
"0.65... | 0.64289784 | 36 |
Computes a translation matrix. | def translate(v: InputTensor) -> t.Tensor:
result = util.to_tensor(v, dtype=t.float32)
assert len(result.shape) >= 1
dimensions = result.shape[-1]
result = result[..., None, :].transpose(-1, -2)
result = t.constant_pad_nd(result, [dimensions, 0, 0, 1])
id_matrix = t.diag(result.new_ones([dimensions + 1]))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TranslationMatrix(x, y, z):\n\treturn np.matrix([ [1., 0., 0., x],\n\t\t\t\t\t\t[0., 1., 0., y],\n\t\t\t\t\t\t[0., 0., 1., z],\n\t\t\t\t\t\t[0., 0., 0., 1.]])",
"def translation_matrix(tx, ty, tz):\n T = np.array([[1, 0, 0, tx],\n [0, 1, 0, ty],\n [0, 0, 1, tz],\n ... | [
"0.7476626",
"0.73376346",
"0.71156037",
"0.70561665",
"0.70042557",
"0.69543445",
"0.68936795",
"0.6859392",
"0.6858805",
"0.6777836",
"0.6776042",
"0.67170495",
"0.6642511",
"0.6580854",
"0.6550882",
"0.6474842",
"0.64231503",
"0.63632214",
"0.6332118",
"0.63255674",
"0.629... | 0.5711762 | 62 |
Computes a righthanded 4x4 lookat camera matrix. | def look_at_rh(eye: InputTensor, center: InputTensor,
up: InputTensor) -> t.Tensor:
eye = util.to_tensor(eye, dtype=t.float32)
center = util.to_tensor(center, dtype=t.float32)
up = util.to_tensor(up, dtype=t.float32)
assert eye.shape == (3,)
assert center.shape == (3,)
assert up.shape == (3,)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCameraMatrix(self): # real signature unknown; restored from __doc__\n pass",
"def camera_matrix(self) -> TransformationMatrixType:\n return numpy.matmul(\n self.rotation_matrix(*self.rotation),\n displacement_matrix(*-numpy.array(self.location)),\n )",
"def cam... | [
"0.604629",
"0.5690877",
"0.566058",
"0.546934",
"0.5419739",
"0.53992414",
"0.53747255",
"0.53564847",
"0.53442174",
"0.533645",
"0.53151274",
"0.52816457",
"0.52754575",
"0.5259618",
"0.5208826",
"0.5179219",
"0.5169666",
"0.51681334",
"0.51548636",
"0.5148781",
"0.5135079"... | 0.0 | -1 |
Returns the total staked amount stored in a vardb _total_stake. | def getTotalStake(self) -> int:
return self._total_stake.get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_spent(self):\n total_sum = Order.objects.filter(\n email=self.email).aggregate(\n Sum('total_price')\n ).get('total_price__sum')\n return round(total_sum, 4) if total_sum else 0",
"def total_sold(album):\n return album.total_sold",
"def total(self):\n ... | [
"0.65858716",
"0.6538318",
"0.62111753",
"0.6138218",
"0.6135569",
"0.6123897",
"0.6095115",
"0.60794395",
"0.60766083",
"0.6074283",
"0.6031743",
"0.5965689",
"0.5964389",
"0.59520096",
"0.5926538",
"0.59139526",
"0.590713",
"0.5894734",
"0.58571315",
"0.5856632",
"0.5830383... | 0.8146318 | 0 |
Returns the total rewards earned up to now by the staking contract. | def getLifetimeReward(self) -> int:
return self._total_lifetime_reward.get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_rewards(self) -> float:\n return self.__total_rewards",
"def getTotalReward(self):\n return self.cumreward",
"def getTotalReward(self):\n return self.cumreward",
"def getTotalReward(self):\n return self.lastFitness",
"def total_reward(self):\n return np.sum(self.rew... | [
"0.74350184",
"0.7319174",
"0.7319174",
"0.6883852",
"0.67559856",
"0.67167974",
"0.6656435",
"0.6656435",
"0.6656435",
"0.66351753",
"0.65298206",
"0.6467578",
"0.6409539",
"0.63020545",
"0.6262705",
"0.6262705",
"0.62345237",
"0.6190423",
"0.6136656",
"0.61360705",
"0.61356... | 0.5873769 | 39 |
Push the item onto the heap, maintaining the heap invariant. | def heappush(heap, item):
heap.append(item)
_siftdown(heap, 0, len(heap)-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, item: tuple):\n self.__heap.append(item)\n self.__sift_up(self.__len__() - 1)",
"def push(self, item):\n heapq.heappush(self.heap, item)",
"def push(self, item):\n self.heap.append(self.m * item)\n self._sift_up()",
"def insert(self, item):\n self.heap... | [
"0.9063282",
"0.8996565",
"0.8773676",
"0.82297313",
"0.8163153",
"0.7998835",
"0.79950887",
"0.7948598",
"0.7889434",
"0.78529996",
"0.7817438",
"0.7795371",
"0.7776321",
"0.7763033",
"0.77054644",
"0.7682576",
"0.7661818",
"0.7661818",
"0.76568264",
"0.76370543",
"0.7628241... | 0.80675966 | 5 |
Given an absolute path, return a path relative to the project root. 'subdir/foo' | def _get_relative_path(self, abs_path):
relative_path = os.path.relpath(abs_path, settings.PROJECT_ROOT)
return relative_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_relative_path(path):\n if os.path.isabs(path):\n return path\n root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))\n return os.path.join(root_dir, path)",
"def _abs_path(rel_path):\n return os.path.join(BASE_DIR, rel_path)",
"def absPath(path)... | [
"0.76968694",
"0.7513431",
"0.74758035",
"0.7474766",
"0.7435405",
"0.7332667",
"0.7309524",
"0.7283314",
"0.7236684",
"0.7155462",
"0.7137708",
"0.7106382",
"0.70955163",
"0.70686436",
"0.70526963",
"0.7035758",
"0.7011202",
"0.701053",
"0.70069593",
"0.6901063",
"0.68866503... | 0.7532645 | 1 |
Returns whether the stack is empty. | def empty(self) -> bool:
return self.size == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self) -> bool:\n return len(self.stack) == 0",
"def isEmpty(self):\n return len(self.stack) == 0",
"def empty(self):\n return len(self.stack) == 0",
"... | [
"0.9207258",
"0.91276956",
"0.90185934",
"0.9000551",
"0.89481044",
"0.89481044",
"0.8914844",
"0.8904091",
"0.8881541",
"0.88791907",
"0.8867761",
"0.87955654",
"0.8768181",
"0.8748518",
"0.87393755",
"0.8728073",
"0.8719241",
"0.87090814",
"0.87090814",
"0.85431594",
"0.850... | 0.0 | -1 |
This function runs hashlib.sha512() on a file using chunks to ensure that too much RAM is not used. | def sha512(fname, /, *, chunksize = 1048576):
# Import standard modules ...
import hashlib
# Create hash object ...
hobj = hashlib.sha512()
# Open input file as bytes ...
with open(fname, "rb") as fObj:
# Start infinite loop ...
while True:
# Read a chunk ...
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_file_sha512(fileIn):\n\n # fileIn is read in chunks to ensure it will work with (very) large files as well\n # Adapted from: http://stackoverflow.com/a/1131255/1209004\n\n blocksize = 2**20\n m = hashlib.sha512()\n with open(fileIn, \"rb\") as f:\n while True:\n buf = ... | [
"0.7312387",
"0.72841877",
"0.7193235",
"0.69665354",
"0.68670136",
"0.6723953",
"0.6630066",
"0.6559456",
"0.6534818",
"0.64672387",
"0.63602763",
"0.6274184",
"0.626974",
"0.6252934",
"0.6230989",
"0.6187304",
"0.61721843",
"0.6122351",
"0.6092596",
"0.5980338",
"0.59542215... | 0.8374994 | 0 |
Convert date string to datetime. | def convert_date(date_str):
return datetime.strptime(date_str, "%d/%m/%Y") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_to_datetime(datestr):\n\n from dateutil import parser\n from datetime import datetime\n\n date = parser.parse(datestr)\n return date",
"def parse_datetime(date_str: str) -> datetime:\n return dateutil.parser.parse(date_str)",
"def to_datetime(date_string):\n return dt.strptime(date_st... | [
"0.8128393",
"0.8001215",
"0.7989846",
"0.798428",
"0.79651654",
"0.7881875",
"0.7866022",
"0.78598154",
"0.78395015",
"0.77747935",
"0.7715534",
"0.76870006",
"0.75268126",
"0.7498706",
"0.74965304",
"0.7485769",
"0.74842775",
"0.746032",
"0.7424017",
"0.74084324",
"0.739559... | 0.75608206 | 12 |
Pop the topmost item off the stack. Returns the item. | def pop(self):
item = self.stack[-1]
self.stack = self.stack[:-1]
return item | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n else:\n raise IndexError('Cannot pop item, stack is empty.')\n except IndexError as err:\n print(err)\n ... | [
"0.9038657",
"0.89699066",
"0.8646669",
"0.8436965",
"0.8425731",
"0.8394855",
"0.8379378",
"0.83787584",
"0.8376376",
"0.836779",
"0.8341289",
"0.83400613",
"0.83147097",
"0.8313943",
"0.8297329",
"0.8291556",
"0.8232232",
"0.82071257",
"0.82069063",
"0.81836283",
"0.8150139... | 0.9046111 | 0 |
Peek at the topmost item of the stack without popping. Returns the item, or None on underflow. | def peek(self):
try:
return self.stack[-1]
except IndexError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peek(self):\n if self.isEmpty():\n raise Exception(\"Stack underflow\") # Nothing to peek at\n return self.first.Item # most recently added item",
"def peek(self):\n if not self.is_empty():\n return self._stack_items[-1]\n else:\n raise StackException('Peek oper... | [
"0.7854999",
"0.7848019",
"0.77432376",
"0.7725692",
"0.7712781",
"0.7672322",
"0.76620185",
"0.7641305",
"0.7610284",
"0.76081336",
"0.7587791",
"0.7587791",
"0.75744694",
"0.7550017",
"0.75288725",
"0.7514343",
"0.75083995",
"0.7495166",
"0.74850506",
"0.7464874",
"0.745950... | 0.80332464 | 0 |
Returns whether or not the stack is empty. | def is_empty(self):
return len(self.stack) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def empty(self) -> bool:\n return len(self.stack) == 0",
"def empty(self):\n return len(self.stack) == 0",
"def empty(self):\n return len(self.stack) == 0",
"def empty(self):\r\n return len(self.stack) == 0",
"def... | [
"0.92969453",
"0.90845764",
"0.9067046",
"0.9067046",
"0.9049475",
"0.9040509",
"0.90028155",
"0.8970693",
"0.8958459",
"0.894402",
"0.8918213",
"0.89048815",
"0.88327855",
"0.8823499",
"0.8811676",
"0.87955076",
"0.87955076",
"0.8791064",
"0.87125903",
"0.8611502",
"0.859849... | 0.92230463 | 1 |
String representation of the stack. | def __repr__(self):
return str(self.stack) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStackString(self):\n return \"\".join(self.stack[:0:-1])",
"def __repr__(self):\n return str(self._stack_items)",
"def __str__(self):\n return \"The stack contains: \" + str(self.the_stack)",
"def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"ST... | [
"0.85406256",
"0.8412833",
"0.8216093",
"0.8198461",
"0.8198461",
"0.818666",
"0.8168011",
"0.81232345",
"0.7814737",
"0.7814737",
"0.76956904",
"0.76956904",
"0.76956904",
"0.76956904",
"0.7628415",
"0.7368872",
"0.715802",
"0.7069953",
"0.67405593",
"0.67273206",
"0.6695258... | 0.87551796 | 0 |
Validates that the string is a correct infix expression. Also, replaces unary minus operators with a 'u'. Returns a valid, tokenized string on success; raises ExpressionError if the input is erroneous. | def validate(string):
tokens = string.split()
# Remembers if the previous token was an operator
opflag = True
## Highly inefficient validity checking begins here ##
# List of operators as they would appear in the infix expression
operators = ['+', '-', '*', '/', '^', 'sqrt']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_infix(string):\n return postfix(infix_to_postfix(string))",
"def parse_infix(input: str) -> Node:\n parsed = ParsedString(input).tokenize()\n ans = parse_e(parsed)\n return ans",
"def infix_to_postfix(string):\n \n # Validate and tokenize the string\n tokens = validate(string)... | [
"0.67217284",
"0.66280156",
"0.66256684",
"0.6390146",
"0.63846296",
"0.6309319",
"0.63021815",
"0.6235218",
"0.61009157",
"0.60545176",
"0.60317606",
"0.60182995",
"0.5994529",
"0.5970374",
"0.59688133",
"0.5967874",
"0.59608865",
"0.59466004",
"0.5895652",
"0.5879398",
"0.5... | 0.75027424 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.