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 |
|---|---|---|---|---|---|---|
Generate random slices for a single dimension. | def rslices(n, allow_empty=False):
for _ in range(5):
yield rslice(n, allow_empty) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def samples_multidimensional_uniform(bounds, points_count):\n dim = len(bounds)\n Z_rand = np.zeros(shape=(points_count, dim))\n for k in range(0,dim):\n Z_rand[:,k] = np.random.uniform(low=bounds[k][0], high=bounds[k][1], size=points_count)\n print('shape: ', Z_rand.shape)\n return Z_rand",
... | [
"0.6748864",
"0.66025615",
"0.6602007",
"0.65602344",
"0.6382453",
"0.637084",
"0.6325425",
"0.63170785",
"0.63101554",
"0.6257017",
"0.62307423",
"0.6230162",
"0.61685413",
"0.6137612",
"0.6112374",
"0.60909176",
"0.6086134",
"0.6047355",
"0.6043131",
"0.6034215",
"0.6028377... | 0.57534003 | 41 |
Generate random slice tuples for 'shape'. | def rslices_ndim(ndim, shape, iterations=5):
# non-empty slices
for _ in range(iterations):
yield tuple(rslice(shape[n]) for n in range(ndim))
# possibly empty slices
for _ in range(iterations):
yield tuple(rslice(shape[n], allow_empty=True) for n in range(ndim))
# invalid slices
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randslice_from_shape(ndim, shape):\n lslices = [0] * ndim\n rslices = [0] * ndim\n for n in range(ndim):\n l = shape[n]\n slicelen = randrange(1, l+1) if l > 0 else 0\n lslices[n] = randslice_from_slicelen(slicelen, l)\n rslices[n] = randslice_from_slicelen(slicelen, l)\n ... | [
"0.81737244",
"0.8173164",
"0.70365703",
"0.6893058",
"0.66185147",
"0.6588831",
"0.65197295",
"0.64492506",
"0.64458674",
"0.6420841",
"0.6409542",
"0.6335667",
"0.63094866",
"0.6286346",
"0.62749714",
"0.62746143",
"0.62283",
"0.6214",
"0.6178123",
"0.6170837",
"0.6170837",... | 0.59845704 | 36 |
Return True if the queen at column c clashes with any queen to its left. | def col_clashes(bs, c):
for i in range(c):
if share_diagonal(i,bs[i], c,bs[c]):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isfree(col,queens):\n if col in queens:\n return False\n elif any([ abs(col-col1)==len(queens)-index for index,col1 in enumerate(queens)]):\n #c[r]==c[j]; r-j==c[r]-c[j]; r-j==c[j]-c[r]\n # col is the colomn to check; len(queens) just be the row index of col, dont subtract 1\n ... | [
"0.77055407",
"0.72922397",
"0.7145801",
"0.70153964",
"0.6985228",
"0.6902115",
"0.66958386",
"0.65576535",
"0.6551649",
"0.6548673",
"0.6523149",
"0.6523149",
"0.6522317",
"0.6519715",
"0.65155363",
"0.6512403",
"0.6512403",
"0.65036315",
"0.6501785",
"0.64987516",
"0.64938... | 0.0 | -1 |
True if either cell matches one of its neighbours. Slightly different type of matching from isMatch(). | def hasMatch(self):
for cell in (self.head, self.tail):
for neighbour in cell.find_neighbours():
if neighbour.pips == cell.pips:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_neighbours(self):\n for p in self.targetCell.possibilities:\n if p != 0:\n if p not in self.targetCell.row_neighbour_possibilities:\n self.targetCell.solve(p)\n return True\n elif p not in self.targetCell.column_neighbo... | [
"0.6724939",
"0.65565187",
"0.651675",
"0.6491993",
"0.64436924",
"0.64371634",
"0.64162314",
"0.64157915",
"0.64040434",
"0.64029574",
"0.6330807",
"0.6311212",
"0.62970114",
"0.625364",
"0.6251876",
"0.62480813",
"0.6242117",
"0.62384665",
"0.6207678",
"0.6207055",
"0.61696... | 0.7738691 | 0 |
Return the state if the dataset requires one. Datasets which e.g. read files from disks require open file handlers, and this sort of stateful information should be handled by the data stream. Returns | def open(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_dataset(self):\n return self._dataset is not None",
"def isOpened(self) -> bool:\n return True if self.data_file else False",
"def __getstate__(self):\n return [self.dataset, self.parser]",
"def read_data(self):\r\n read_status = True\r\n lines = self.__read_lines__()\r\... | [
"0.6283819",
"0.6104138",
"0.59465337",
"0.5871984",
"0.58360755",
"0.58360755",
"0.5735881",
"0.5735",
"0.5720222",
"0.5720222",
"0.5703286",
"0.5658094",
"0.565653",
"0.5642201",
"0.5624983",
"0.5605287",
"0.5590852",
"0.5588724",
"0.5578193",
"0.5546453",
"0.5546068",
"0... | 0.0 | -1 |
Returns the scan resolution in mm of the ship. | def scanResolution(self):
return self._getAttribute(Attribute.scanResolution) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getResolution(self):\n return self.resolution",
"def getResolution(self):\n return self._lowLevelGetDeviceResolution()",
"def get_current_resolution(self):\n return self.display_info[\"width\"], self.display_info[\"height\"]",
"def resolution(self) -> int:\n return self._resol... | [
"0.7246049",
"0.69126594",
"0.685117",
"0.6794998",
"0.67246604",
"0.6541934",
"0.6535295",
"0.6369",
"0.6277552",
"0.6272509",
"0.6237596",
"0.62197703",
"0.61901945",
"0.6151652",
"0.61414826",
"0.61146194",
"0.6110332",
"0.6093271",
"0.6090543",
"0.6054958",
"0.60548455",
... | 0.73278564 | 0 |
Returns the max target range in metres of the ship. | def targetRange(self):
return self._getAttribute(Attribute.targetRange) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_range(self):\n return self._max_range",
"def __find_max_distance(self):\n return utils.find_max_distance(self.__game)",
"def max(self):\n return self._max_coords",
"def speed_max(self):\n return self._speed_max",
"def maximum(self) -> Union[int, float]:\n return s... | [
"0.73674613",
"0.7078885",
"0.7044618",
"0.6981582",
"0.6943583",
"0.69382846",
"0.692371",
"0.6908214",
"0.6892179",
"0.6888499",
"0.68463236",
"0.67757446",
"0.6704904",
"0.66685164",
"0.6667965",
"0.6664101",
"0.6652931",
"0.664733",
"0.66399574",
"0.66399574",
"0.6636634"... | 0.6399989 | 43 |
Returns the max number of locked targets. | def maxTargets(self):
return self._getAttribute(Attribute.maxTargets) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxTasksAchievable(self):\n maxTasks = 0\n for w in self._workers:\n maxTasks = maxTasks + w.multitask\n return maxTasks",
"def max_node_count(self) -> int:\n return pulumi.get(self, \"max_node_count\")",
"def node_count_max(self) -> int:\n return int(self.graph_tuple_stats.node_cou... | [
"0.7053719",
"0.6945075",
"0.67787427",
"0.6716458",
"0.66914487",
"0.65706974",
"0.6546918",
"0.6542584",
"0.65309083",
"0.65046275",
"0.6473251",
"0.6438238",
"0.6386052",
"0.6385337",
"0.6385203",
"0.63613576",
"0.6358105",
"0.63530767",
"0.63487595",
"0.6279512",
"0.62710... | 0.6987084 | 1 |
Updates the learning rate given the learning rate decay. The routine has been implemented according to the original Lua SGD optimizer | def adjust_learning_rate(cfg, optimizer):
for idx, group in enumerate(optimizer.param_groups):
init_lr = cfg.TRAINING.LR
if 'step' not in group:
group['step'] = 0.
else:
group['step'] += 1.
group['lr'] = init_lr * (
1.0 - float(group['step']) * fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return",
"def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return",
"def adjust_learning_rate(epoc... | [
"0.7998674",
"0.7998674",
"0.7924784",
"0.78758246",
"0.7808031",
"0.78061086",
"0.77633625",
"0.7747445",
"0.77214557",
"0.7702527",
"0.7682688",
"0.76518416",
"0.7618969",
"0.76176",
"0.7549213",
"0.75402725",
"0.7535187",
"0.7533339",
"0.75329775",
"0.7531624",
"0.7524894"... | 0.7274595 | 63 |
Validate that the username is alphanumeric and is not already in use. | def clean_username(self):
existing = UserModel().objects.filter(username__iexact=self.cleaned_data['username'])
if existing.exists():
raise forms.ValidationError(_("A user with that username already exists."))
else:
return self.cleaned_data['username'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalid_username(username):\n word_letters = re.sub('[^a-zA-Z-0-9]+', '', str(username))\n if any(item.isalpha() for item in word_letters):\n return False\n return True",
"def is_valid_username(self, username):\n rex = \"^[a-zA-Z]{3,}$\"\n return re.match(rex, us... | [
"0.83527476",
"0.8211548",
"0.814784",
"0.8135848",
"0.80751944",
"0.805189",
"0.8022534",
"0.7915178",
"0.7838989",
"0.7788622",
"0.77661186",
"0.7763223",
"0.77551514",
"0.7739912",
"0.7730911",
"0.76976854",
"0.76933587",
"0.7691296",
"0.76390404",
"0.76375985",
"0.7623782... | 0.71930707 | 48 |
Verifiy that the values entered into the two password fields match. Note that an error here will end up in ``non_field_errors()`` because it doesn't apply to a single field. | def clean(self):
if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
if self.cleaned_data['password1'] != self.cleaned_data['password2']:
raise forms.ValidationError(_("The two password fields didn't match."))
return self.cleaned_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_password(self):\n password1 = self.cleaned_data.get('password1')\n password2 = self.cleaned_data.get('password2')\n if password1 and password2 and password1 != password2:\n raise forms.ValidationError('Passwords do not match')\n return password2",
"def clean(self)... | [
"0.79393995",
"0.78751373",
"0.7869208",
"0.7735661",
"0.7653578",
"0.76377136",
"0.76262844",
"0.7619865",
"0.76103294",
"0.75963074",
"0.7589395",
"0.7565969",
"0.75650203",
"0.75650203",
"0.756335",
"0.7547981",
"0.7527759",
"0.74647665",
"0.7378254",
"0.7376154",
"0.73637... | 0.7840083 | 4 |
Sets the data_aggregation_setting of this RawDataSettingsV1. | def data_aggregation_setting(self, data_aggregation_setting):
self._data_aggregation_setting = data_aggregation_setting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregate(self, aggregation):\n self._data = self._data.aggregate(**aggregation)",
"def query_aggregation(self, query_aggregation: ConfigNodePropertyBoolean):\n\n self._query_aggregation = query_aggregation",
"def raw_data_setting(self, raw_data_setting):\n\n self._raw_data_setting = r... | [
"0.618007",
"0.5699229",
"0.5593449",
"0.5534642",
"0.5492791",
"0.5159963",
"0.51563",
"0.5152062",
"0.51290625",
"0.48896068",
"0.48860914",
"0.4833387",
"0.47638878",
"0.47190312",
"0.47081825",
"0.465748",
"0.4626875",
"0.46223742",
"0.46195033",
"0.4480558",
"0.44752845"... | 0.8585378 | 0 |
Sets the units_setting of this RawDataSettingsV1. | def units_setting(self, units_setting):
self._units_setting = units_setting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_units(self, units):\n self.units = units",
"def units(self, units):\n\n self._units = units",
"def units(self, units):\n\n self._units = units",
"def units(self, units):\n\n self._units = units",
"def setUnits(self, *args):\n return _libsbml.Parameter_setUnits(sel... | [
"0.73392993",
"0.69501215",
"0.69501215",
"0.69501215",
"0.6416668",
"0.64136463",
"0.6368304",
"0.62724364",
"0.62644994",
"0.6144763",
"0.61432904",
"0.6136528",
"0.6065689",
"0.59879696",
"0.5953695",
"0.5952562",
"0.59308696",
"0.583724",
"0.5836631",
"0.5828655",
"0.5815... | 0.81460136 | 0 |
Sets the work_hours_setting of this RawDataSettingsV1. | def work_hours_setting(self, work_hours_setting):
self._work_hours_setting = work_hours_setting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def work_hours(self, work_hours):\n if work_hours is not None and len(work_hours) > 1024:\n raise ValueError(\"Invalid value for `work_hours`, length must be less than or equal to `1024`\") # noqa: E501\n\n self._work_hours = work_hours",
"def engine_hours(self, engine_hours):\n\n ... | [
"0.7084544",
"0.62833107",
"0.61234754",
"0.5710867",
"0.53572357",
"0.53548336",
"0.5301712",
"0.5130025",
"0.50256395",
"0.49284708",
"0.49263301",
"0.49175677",
"0.4872653",
"0.48705786",
"0.4800906",
"0.47688413",
"0.47624823",
"0.475025",
"0.47354597",
"0.4734547",
"0.47... | 0.8516128 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, RawDataSettingsV1):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Assemble a uri based on a base, any number of path segments, and query string parameters. | def urljoin(base, *path, **query):
if base and base.endswith('/'):
base = base[:-1]
retval = [base]
# build the path
path = '/'.join([''] + [quote(s, '') for s in path])
if path:
retval.append(path)
# build the query string
params = []
for name, value in query.items():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_uri(self, uri_base, params):\n if not params:\n return uri_base\n else:\n uri_extension = \"?\"\n for param in params:\n uri_extension = uri_extension + param + \"&\"\n uri_extension = uri_extension[:-1] # clip off the final & \n ... | [
"0.8172769",
"0.7679958",
"0.7513473",
"0.6879448",
"0.68683076",
"0.6697143",
"0.6584741",
"0.64706886",
"0.64205086",
"0.63630056",
"0.63141865",
"0.6287929",
"0.62767005",
"0.6271733",
"0.62544346",
"0.62226605",
"0.62067354",
"0.6118589",
"0.609388",
"0.6077103",
"0.60672... | 0.6343084 | 10 |
Returns true if arg is a list or another Python Sequence, and false otherwise. | def is_sequence(arg):
return (not hasattr(arg, "strip") and
hasattr(arg, "__getitem__") or
hasattr(arg, "__iter__")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_list(arg):\n return isinstance(arg, collections.Sequence) and not _is_string(arg)",
"def is_sequence(arg):\n\n # np.float{16,32,64} and np.int types have __getitem__ defined\n # this is a long-standing bug in NumPy and unlikely to be fixed\n # todo: backport to qmmlpack, write tests\n if i... | [
"0.842769",
"0.7965603",
"0.7516044",
"0.7451877",
"0.7329391",
"0.73040754",
"0.72747916",
"0.7107596",
"0.70028114",
"0.69910914",
"0.69853663",
"0.6981128",
"0.69492453",
"0.6949044",
"0.6924374",
"0.68378544",
"0.681947",
"0.67969847",
"0.67924744",
"0.6788219",
"0.675699... | 0.79118264 | 2 |
remove the sqlalchemy sesh | def tear(exc):
storage.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove():\n\n db_remove()",
"def tearDown(self):\n #db.session.remove()\n db.drop_all()",
"def teardown_db():\n engine = config['tg.app_globals'].sa_engine\n connection = engine.connect()\n\n # INFO - D.A. - 2014-12-04\n # Recipe taken from bitbucket:\n # https://bitbucket.o... | [
"0.6853588",
"0.6843821",
"0.6779843",
"0.67321277",
"0.67321277",
"0.6699622",
"0.66935766",
"0.66935766",
"0.66935766",
"0.66935766",
"0.66935766",
"0.66935766",
"0.66935766",
"0.668059",
"0.6641767",
"0.6641767",
"0.6641767",
"0.6641767",
"0.6641767",
"0.66150945",
"0.6602... | 0.0 | -1 |
Load model weights from a given file, which should be previously saved by self.save_weights(). | def load_weights(self, file_path, format=None, in_order=True, skip=False):
_load_weights(self, file_path, format, in_order, skip) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_weights(self, weight_file):\r\n self.model.load_weights(weight_file)",
"def load_weights(self, file):\n self.model.load_weights(file)\n return",
"def load_model_weights(self, filename):\n self.model.load_weights(filename)",
"def load_weights(self, filepath):\n self... | [
"0.89469826",
"0.8901181",
"0.8853004",
"0.8774798",
"0.8556394",
"0.8332117",
"0.8260749",
"0.8030833",
"0.799898",
"0.7895191",
"0.78296417",
"0.7825905",
"0.77957875",
"0.7748564",
"0.7748564",
"0.7705152",
"0.7701626",
"0.764279",
"0.7554501",
"0.7549377",
"0.7390658",
... | 0.75612944 | 18 |
Set this network in evaluation mode. After calling this method, all layers in network are in evaluation mode, in particular, BatchNorm, Dropout, etc. Examples >>> import tensorlayer as tl >>> net = tl.models.vgg16() >>> net.eval() do evaluation | def set_eval(self):
self._phase = 'predict'
self.add_flags_recursive(training=False)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()",
"def eval(self):\n self.train(mode=False)",
"def set_eval(self, eval: bool):\n self.brain.set_eval(eval)",
"def eval(self):\n self.mode = \"eval\"\n self.online_net.eval()",
"def... | [
"0.78309643",
"0.75001425",
"0.74250203",
"0.7406579",
"0.7406579",
"0.73397756",
"0.7029367",
"0.6851151",
"0.67749524",
"0.6703862",
"0.6631509",
"0.6591249",
"0.6569461",
"0.6422038",
"0.637382",
"0.6329969",
"0.6329969",
"0.63081795",
"0.6305343",
"0.6291049",
"0.6288456"... | 0.6941809 | 7 |
Set this network in evaluation mode. | def test(self):
self.eval() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setEvaluationMode(self, newMode):\n \n pass",
"def set_eval(self, eval: bool):\n self.brain.set_eval(eval)",
"def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()",
"def set_mode(self, mode):\n if mode == 'train':\n self.net... | [
"0.7694437",
"0.7670649",
"0.7342549",
"0.7151897",
"0.7103393",
"0.7103393",
"0.70450133",
"0.70249236",
"0.7009851",
"0.7001831",
"0.691162",
"0.68425643",
"0.66861284",
"0.6543857",
"0.6487741",
"0.63806707",
"0.6322034",
"0.62210166",
"0.60879964",
"0.60867757",
"0.607585... | 0.0 | -1 |
Set this network in evaluation mode. | def infer(self):
self.eval() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setEvaluationMode(self, newMode):\n \n pass",
"def set_eval(self, eval: bool):\n self.brain.set_eval(eval)",
"def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()",
"def set_mode(self, mode):\n if mode == 'train':\n self.net... | [
"0.7694437",
"0.7670649",
"0.7342549",
"0.7151897",
"0.7103393",
"0.7103393",
"0.70450133",
"0.70249236",
"0.7009851",
"0.7001831",
"0.691162",
"0.68425643",
"0.66861284",
"0.6543857",
"0.6487741",
"0.63806707",
"0.6322034",
"0.62210166",
"0.60879964",
"0.60867757",
"0.607585... | 0.0 | -1 |
Returns a new keras SqueezeNet model | def SqueezeNet(input_shape=(224, 224, 3)):
image_input = Input(shape=input_shape)
network = Conv2D(64, (3, 3), strides=(2, 2), padding="valid")(image_input)
network = Activation("relu")(network)
network = MaxPool2D(pool_size=(3, 3), strides=(2, 2))(network)
network = squeezenet_fire_module(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_original_model():\n model = Sequential()\n model.add(Embedding(max_features,\n embedding_dims,\n input_length=maxlen))\n model.add(Dropout(0.2))\n model.add(Conv1D(filters,\n kernel_size,\n padding='valid',... | [
"0.6779109",
"0.6638269",
"0.66308945",
"0.6543631",
"0.65331703",
"0.6512372",
"0.65106356",
"0.6495543",
"0.64914733",
"0.6490912",
"0.6468552",
"0.6449092",
"0.64283264",
"0.64260525",
"0.64073676",
"0.6404156",
"0.64011025",
"0.63759005",
"0.6370142",
"0.6355601",
"0.6339... | 0.66259646 | 3 |
Gets the prepopulated environment variables for the job build | def get_env_vars(self):
env_vars_api = '/injectedEnvVars/api/json'
env_vars_json = self._api_request(self.url + env_vars_api)
try:
env_vars_json = json.loads(env_vars_json)
return env_vars_json['envMap']
except JSONDecodeError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_env_vars(self):\n return _untag_env_vars(self._tagged_env_vars, build=True)",
"def environment_variables(\n self,\n ) -> typing.Optional[\n typing.Mapping[str, aws_cdk.aws_codebuild.BuildEnvironmentVariable]\n ]:\n return self._values.get(\"environment_variables\")",
... | [
"0.71218103",
"0.6978689",
"0.6978689",
"0.6978689",
"0.6978689",
"0.6962417",
"0.6928234",
"0.6838894",
"0.6718607",
"0.6701541",
"0.67005",
"0.6680116",
"0.6649582",
"0.66316056",
"0.6587881",
"0.65733594",
"0.6556599",
"0.64912426",
"0.63936",
"0.63538235",
"0.6329612",
... | 0.5978486 | 53 |
Copies the model parameters of one estimator to another. | def copy_model_parameters(sess, estimator1, estimator2):
e1_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator1.scope)]
e1_params = sorted(e1_params, key=lambda v: v.name)
e2_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator2.scope)]
e2_params = sorte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_para(from_model, to_model):\n for i, j in zip(from_model.trainable_weights, to_model.trainable_weights):\n j.assign(i)",
"def sync_parameters(self, model: nn.Module) -> None:\n # before ema, copy weights from orig\n avg_param = (\n itertools.chain(self.... | [
"0.6655023",
"0.6186064",
"0.6186064",
"0.61854655",
"0.6052574",
"0.60511726",
"0.60407877",
"0.5963009",
"0.5963009",
"0.59216297",
"0.59045017",
"0.58989644",
"0.589293",
"0.58706653",
"0.5860739",
"0.58496034",
"0.58299047",
"0.58268255",
"0.5764856",
"0.57535136",
"0.574... | 0.7852629 | 1 |
Creates an epsilongreedy policy based on a given Qfunction approximator and epsilon. | def make_epsilon_greedy_policy(estimator, nA):
def policy_fn(sess, observation, epsilon):
A = np.ones(nA, dtype=float) * epsilon / nA
q_values = estimator.predict(sess, np.expand_dims(observation, 0))[0]
print(f'q_values: {q_values}')
best_action = np.argmax(q_values)
A[best_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createEpsilonGreedyPolicy(Q, epsilon, num_actions):\n\n def policyFunction(state):\n Action_probabilities = np.ones(num_actions,\n dtype=float) * epsilon / num_actions\n\n best_action = np.argmax(Q[state])\n Action_probabilities[best_action] += (1.0... | [
"0.78010213",
"0.7771446",
"0.7609632",
"0.7590617",
"0.75758374",
"0.75702316",
"0.7455431",
"0.7435255",
"0.72975755",
"0.70651025",
"0.7052984",
"0.6743078",
"0.6650919",
"0.65363425",
"0.6319062",
"0.62520564",
"0.62376964",
"0.6202657",
"0.61382174",
"0.6107149",
"0.6052... | 0.7177619 | 9 |
Gets the maximum sequence bounds of non idle time Machines shows default values at the beginning and end of the operations; this functions returns the ids of the longest sequence that is not operating with the default values. Note that you cannot just remove all default values, essentially because order matters and the... | def get_id_bounds(
values: Tensor,
default_value: float
):
# get all values that are not default ones
default_value_idx = (values == default_value).nonzero()[:, 0]
# get the longest sequence without interruption
# to do this, get the difference of the above ids
diff = default_value_idx[1:] -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_loose_bounds(maxlum=None):\n return[(None,None), (10**-6, None), (2., 350),\n (None, -10**-6), (None, None)]",
"def longest_sequence(start=1, end=1000000):\n\n max_length = 0\n max_start_value = 0\n\n # generate sequence for each value\n for i in range(start, end):\n cu... | [
"0.5749199",
"0.5637835",
"0.5553669",
"0.5540054",
"0.5517348",
"0.54871017",
"0.547557",
"0.5464125",
"0.54230356",
"0.53948283",
"0.53876203",
"0.53298086",
"0.5300341",
"0.52418303",
"0.5241372",
"0.52193195",
"0.5216842",
"0.52015424",
"0.520039",
"0.51883274",
"0.516819... | 0.7332722 | 0 |
Normalize the given vector to be of unit length. | def normalize(x: float, y: float, z: float) -> Point3D:
mag = math.sqrt(x*x + y*y + z*z)
return x/mag, y/mag, z/mag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(vec):\n return vec / length(vec)",
"def normalize(vector):\n return vector / np.linalg.norm(vector)",
"def _unit_vector(vector):\n return vector / np.linalg.norm(vector)",
"def unit_vector(vector):\n vector = np.array(vector)\n if np.linalg.norm(vector) <= 0.00010:\n ... | [
"0.8418114",
"0.8342787",
"0.82465947",
"0.8231255",
"0.8206098",
"0.81620806",
"0.8138398",
"0.8138398",
"0.8138398",
"0.8138398",
"0.8138398",
"0.8138398",
"0.8138398",
"0.8138398",
"0.8138398",
"0.8138398",
"0.8138398",
"0.81377804",
"0.81377804",
"0.81377804",
"0.81258905... | 0.0 | -1 |
Return the maximum color value that this light can produce. | def get_max_brightness(self) -> float:
return max(self._color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color_max(image, color):\n boundaries = find_color_boundaries(image, color)\n if boundaries:\n return (0, image[boundaries[0] : boundaries[1] + 1, boundaries[2] : boundaries[3] + 1])\n else:\n return 1, None",
"def maximal_color(graph, node):\n return max(get_node_colors(graph, ... | [
"0.7567657",
"0.7444326",
"0.69971585",
"0.68010145",
"0.67860895",
"0.66241765",
"0.6564625",
"0.6542855",
"0.65393096",
"0.65304965",
"0.6511511",
"0.6487539",
"0.64411324",
"0.6435717",
"0.64141905",
"0.6350198",
"0.6333665",
"0.63173854",
"0.62954146",
"0.6288576",
"0.625... | 0.8303178 | 0 |
Return the color contributed by this light on a surface given its (unit) normal vector and material color. | def compute_shaded_color(self, normal: Point3D, material_color: Color) -> Color:
dot_product = sum(multiply_vectors(self._direction, normal))
light_amount = max(dot_product, self._dot_clip)
light_amount = (light_amount - self._dot_clip) / (1.0 - self._dot_clip)
return [vm*vl*light_amount... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_shaded_color(self, p1: Point3D, p2: Point3D, p3: Point3D, material_color: Color) -> Color:\n # compute the normal vector\n ax, ay, az = p1[0]-p2[0], p1[1]-p2[1], p1[2]-p2[2]\n bx, by, bz = p1[0]-p3[0], p1[1]-p3[1], p1[2]-p3[2]\n nx = ay*bz - az*by\n ny = az*bx - ax*bz... | [
"0.66830057",
"0.64685374",
"0.63342154",
"0.6113619",
"0.61106956",
"0.60924566",
"0.6054413",
"0.6053781",
"0.6053781",
"0.6053781",
"0.60509187",
"0.6034845",
"0.59819704",
"0.59732807",
"0.59732807",
"0.5946499",
"0.5937387",
"0.59219927",
"0.5917848",
"0.5914473",
"0.591... | 0.7437899 | 0 |
Create a camera given its position in 3D space and the TaitBryan angles of its orientation. | def __init__(self, pos: Point3D, theta_x: float, theta_y: float, theta_z: float,
zoom: float, fog_factor: float,
lights: Iterable[DirectionalLight], fast_draw: bool):
self._pos = pos
self._cx = math.cos(theta_x)
self._sx = math.sin(theta_x)
self._cy = ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, at=(0, 0, 0), eye=(0, 0, -0.1), lens=None,\r\n is_3d=True, scale=1.0):\r\n super(Camera, self).__init__()\r\n\r\n self.at = at\r\n self.start_eye = eye # for reset with different lens settings\r\n self.eye = [eye[0], eye[1], eye[2]]\r\n if lens == None:\r\n from ... | [
"0.6798269",
"0.67603046",
"0.66758746",
"0.65076005",
"0.64469564",
"0.63589436",
"0.6302461",
"0.6173746",
"0.6167616",
"0.6162428",
"0.6041424",
"0.6036619",
"0.5972016",
"0.59465146",
"0.59234536",
"0.586841",
"0.5862043",
"0.5859587",
"0.5833382",
"0.58221215",
"0.573312... | 0.0 | -1 |
Draw the terrain using the given Camera. | def draw(self, camera: Camera):
camera.draw_triangles(self._triangles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self, surface, camera=None):\n if camera:\n surface.blit(self.image, camera.apply(self.rect))\n else:\n surface.blit(self.image, self.rect)",
"def draw(self, camera):\n for line in self._polyline.lines:\n camera.draw_line(line.begin, line.end, self.c... | [
"0.6371948",
"0.628486",
"0.62307286",
"0.60651135",
"0.59940034",
"0.5988739",
"0.578298",
"0.57561666",
"0.5680349",
"0.56671095",
"0.56671095",
"0.5614266",
"0.5581884",
"0.55596256",
"0.55214775",
"0.54720634",
"0.5420156",
"0.5419159",
"0.5342214",
"0.5324978",
"0.532494... | 0.6245847 | 2 |
Write JSON data to the specified file. This is a simple wrapper around our file handling stuff. | def write(self, file, data):
if not exists(dirname(file)):
makedirs(dirname(file))
with open(file + '.json', 'w') as file:
file.write(dumps(data, indent=2, separators=(',', ': '), sort_keys=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeJsonFile(filename, data):\n try:\n with open(filename, 'w') as jsonfile:\n json.dump(data, jsonfile, indent=0, sort_keys=True)\n except IOError:\n print(\"Error writing to json file %s\" % filename)",
"def _write(self, filename, data):\n fullpath = os.path.join(self... | [
"0.7961672",
"0.79502094",
"0.7937308",
"0.79276156",
"0.7915652",
"0.7915652",
"0.7870587",
"0.7840478",
"0.78364086",
"0.78331935",
"0.7825509",
"0.78103507",
"0.7800449",
"0.77245957",
"0.7690022",
"0.7645593",
"0.7633606",
"0.76325184",
"0.76158357",
"0.76046854",
"0.7592... | 0.79068244 | 6 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# TO DO: display the most common month
popular_month = df['month'].mode()[0]
print("Most Frequent month:",popular_month)
# TO DO: display the most common day of week
popu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583438",
"0.757... | 0.773628 | 8 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
most_com_sta= df['Start Station'].mode()[0]
print('Most common Start Station:', most_com_sta)
# TO DO: display most commo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.7163289 | 51 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
print(df.groupby(['month'])['Trip Duration'].sum())
print(df.groupby(['day_of_week'])['Trip Duration'].sum())
# TO DO: display mean travel time
print(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.8143032",
"0.8024939",
"0.8004003",
"0.7949475",
"0.79372776",
"0.79307956",
"0.7926507",
"0.79149866",
"0.7914229",
"0.79077655",
"0.79054105",
"0.7900338",
"0.78913456",
"0.78892654",
"0.78863764",
"0.7884846",
"0.78839767",
"0.7882144",
"0.7873669",
"0.7868308",
"0.7866... | 0.7553662 | 96 |
Render the homepage template on the / route | def homepage():
pagesClassIDs = {
"index": {
"bannertitle": [],
"subtitle": [],
"firstText": [],
"secondText": []
}
}
for key in pagesClassIDs["index"].keys():
pagesClassIDs["index"][key].append(
str(
pageTe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n return render_template(\"home/index.html\")",
"def home():\n return render_template('homepage.html')",
"def homepage():\n return render_template('homepage.html')",
"def homepage():\n return render_template(\"home/index.html\", title=\"Welcome\")",
"def render_home():\r\n\treturn... | [
"0.8597299",
"0.8569112",
"0.85272837",
"0.8474665",
"0.8474087",
"0.8451808",
"0.8424757",
"0.8424757",
"0.84213376",
"0.8389955",
"0.83125323",
"0.8266481",
"0.8266481",
"0.8266481",
"0.8266481",
"0.8266481",
"0.8266481",
"0.82651",
"0.8260553",
"0.8250731",
"0.8250731",
... | 0.0 | -1 |
Render the fase1 template on the /fase1 route | def fase1():
pagesClassIDs = {
"fase1": {
"bannertitle": [],
"subtitle": [],
"firstText": [],
"secondText": []
}
}
for key in pagesClassIDs["fase1"].keys():
pagesClassIDs["fase1"][key].append(
str(
pageTexts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def landing():\n return render_template(\"landing.html\")",
"def landing_page():\n\n return render_template('index.html')",
"def graphing1():\n return render_template('graph1.html')",
"def prototype_page1():\n return render_template('Prototype1.html')",
"def index():\n return render_template... | [
"0.638614",
"0.6373444",
"0.63079125",
"0.6282907",
"0.62595075",
"0.6239214",
"0.61953425",
"0.61786556",
"0.6143801",
"0.60757196",
"0.60483044",
"0.6037403",
"0.60196054",
"0.5998281",
"0.5984551",
"0.59771687",
"0.5976989",
"0.59730905",
"0.5965922",
"0.5963188",
"0.59589... | 0.0 | -1 |
Render the fase3 template on the / route | def fase3():
pagesClassIDs = {
"fase3": {
"bannertitle": [],
"subtitle": [],
"firstText": [],
"secondText": [],
"thirdText": []
}
}
for key in pagesClassIDs["fase3"].keys():
pagesClassIDs["fase3"][key].append(
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return render_template('home.jinja2')",
"def display():\n\n #still needs some cleanup on imagry and what the site is about. \n\n return render_template(\"index.html\")",
"def landing_page():\n\n return render_template('index.html')",
"def landing():\n return render_template(\"la... | [
"0.6992224",
"0.6916828",
"0.6885695",
"0.68696064",
"0.68494356",
"0.6746363",
"0.67157197",
"0.6707549",
"0.6707549",
"0.6707416",
"0.6693784",
"0.66927797",
"0.66871464",
"0.66830254",
"0.66830254",
"0.66830254",
"0.66830254",
"0.6681699",
"0.6676894",
"0.6676894",
"0.6676... | 0.0 | -1 |
returns a formatted date string | def getFormattedDate(self, dt):
if DATE_FORMAT_STRING == '':
return time.strftime('%Y-%m-%d %H:%M:%S', dt.timetuple())
else:
return time.strftime(DATE_FORMAT_STRING, dt.timetuple()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date() -> str:\n\n return datetime.strftime(datetime.today(), _fmt)",
"def date_string(date):\n day = date.day\n month = date.month\n year = date.year\n formatted_string = str(month) + \"/\"\n formatted_string += str(day) + \"/\"\n formatted_string += str(year)\n return formatted_stri... | [
"0.8016059",
"0.7916384",
"0.7914958",
"0.7656416",
"0.745917",
"0.74570465",
"0.7381044",
"0.73655266",
"0.73201656",
"0.72859514",
"0.72671545",
"0.7251556",
"0.7224932",
"0.7190442",
"0.7117921",
"0.711506",
"0.71048146",
"0.71048146",
"0.7021738",
"0.7020266",
"0.7007234"... | 0.7215428 | 13 |
Converts a string to a python list using json.loads(). Will only work for simple lists with objects supported by json. | def str_to_list_json(s):
s.replace("'", '"')
return json.loads(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json_string(json_string):\n new_list = []\n if json_string is None:\n return new_list\n else:\n return json.loads(json_string)",
"def from_json_string(json_string):\n\n the_list = []\n if json_string is not None and json_string != '':\n ... | [
"0.8196887",
"0.807428",
"0.798657",
"0.7976135",
"0.7941863",
"0.79374737",
"0.7777885",
"0.7750806",
"0.7738409",
"0.76314676",
"0.76314676",
"0.7610711",
"0.7610711",
"0.7610711",
"0.75805837",
"0.755738",
"0.72788525",
"0.71421796",
"0.71223956",
"0.70730686",
"0.70619166... | 0.7986064 | 3 |
Gets the greatest node index 'maxi' from an edgelist. Returns 1 + maxi as an estimate of the network size. | def guess_num_nodes_from(edgelist):
return np.max(edgelist) + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edge_count_max(self) -> int:\n return int(self.graph_tuple_stats.edge_count_max or 0)",
"def edge_position_max(self) -> int:\n return int(self.graph_tuple_stats.edge_position_max or 0)",
"def find_max(self):\n return max(self.nodes, key=int)",
"def node_count_max(self) -> int:\n return in... | [
"0.6852434",
"0.6803402",
"0.6681722",
"0.6654555",
"0.6440404",
"0.63427424",
"0.63394284",
"0.6291241",
"0.6266796",
"0.6244166",
"0.6204025",
"0.61553365",
"0.61204684",
"0.6115518",
"0.6094112",
"0.60562533",
"0.6031743",
"0.6030485",
"0.5977314",
"0.5967381",
"0.59558",
... | 0.6548268 | 4 |
Returns the inverse participation ratio of a vector (first normalized by its sum of squares). | def nav_ipr(x):
x2 = x*x
s2 = np.sum(x2)
if s2 < MACH_EPSILON:
# Zero sum. Could happen for veeery small overall prevalence.
return 0.
else:
return np.sum(x2 * x2 / (s2 * s2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cal_unit_vec(vector):\n return vector / np.linalg.norm(vector)",
"def normalize_vector(vector):\n v = np.divide(vector, np.linalg.norm(vector))\n return np.round(v, decimals=4)",
"def unit_vector(vector):\n vector = np.array(vector)\n if np.linalg.norm(vector) <= 0.00010:\n normv = 1.... | [
"0.7080318",
"0.7013436",
"0.6883938",
"0.6870528",
"0.68592304",
"0.6831641",
"0.68310136",
"0.68310136",
"0.68310136",
"0.682629",
"0.682629",
"0.682629",
"0.682629",
"0.682629",
"0.682629",
"0.682629",
"0.682629",
"0.682629",
"0.682629",
"0.682629",
"0.6815404",
"0.67961... | 0.0 | -1 |
Returns the inverse participation ratio of a vector (first normalized by its sum of squares). | def bla_ipr(x):
phi = x / np.sqrt(np.sum(x**2))
return np.sum(phi**4)
# if s2 < MACH_EPSILON:
# # Zero sum. Could happen for veeery small overall prevalence.
# return 0.
# else:
# return np.sum(x2 * x2 / (s2 * s2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cal_unit_vec(vector):\n return vector / np.linalg.norm(vector)",
"def normalize_vector(vector):\n v = np.divide(vector, np.linalg.norm(vector))\n return np.round(v, decimals=4)",
"def unit_vector(vector):\n vector = np.array(vector)\n if np.linalg.norm(vector) <= 0.00010:\n normv = 1.... | [
"0.70827144",
"0.7014197",
"0.6886357",
"0.68725705",
"0.6860212",
"0.6833496",
"0.6833496",
"0.6833496",
"0.6833495",
"0.68287",
"0.68287",
"0.68287",
"0.68287",
"0.68287",
"0.68287",
"0.68287",
"0.68287",
"0.68287",
"0.68287",
"0.68287",
"0.6817564",
"0.6797501",
"0.677... | 0.0 | -1 |
This function creates a spark session | def create_spark_session():
spark = SparkSession \
.builder \
.config("spark.jars.packages", "org.apache.hadoop:hadoop-aws:2.7.0") \
.getOrCreate()
return spark | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sparksession():\n return SparkSession.builder.\\\n appName(\"Transforming the historical parking occupancy and blockface datasets\").\\\n getOrCreate()",
"def create_spark_session():\n \n print(\"Create Spark Session\")\n spark = SparkSession \\\n .builder ... | [
"0.86831474",
"0.8436503",
"0.8333162",
"0.83242106",
"0.81733435",
"0.8165045",
"0.8144665",
"0.8144665",
"0.8144665",
"0.8144665",
"0.8136419",
"0.8128599",
"0.8064378",
"0.8044765",
"0.8039344",
"0.80319095",
"0.8030627",
"0.7891488",
"0.78447515",
"0.77366775",
"0.771506"... | 0.81336313 | 17 |
Returns whether or not the user has access to this LocalSite. This checks that the user is logged in, and that they're listed in the 'users' field. | def is_accessible_by(self, user):
return (self.public or
(user.is_authenticated and
(user.is_staff or self.users.filter(pk=user.pk).exists()))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user_has_access(self):\n return self.user_has_access(users.get_current_user())",
"def logged_in(self):\n return self.user is not None",
"def has_access(self, user):\n if user.is_superuser:\n return True\n return self.user_objects(user).filter(id=self.id).exists()"... | [
"0.7626998",
"0.7124804",
"0.7096632",
"0.70552987",
"0.7006824",
"0.6978054",
"0.6971998",
"0.69320786",
"0.68809944",
"0.6847775",
"0.6844484",
"0.6837533",
"0.67746365",
"0.6757961",
"0.67500454",
"0.66971207",
"0.66955066",
"0.6690002",
"0.6650356",
"0.659763",
"0.6594348... | 0.6757563 | 14 |
Returns whether or not a user can modify settings in a LocalSite. This checks that the user is either staff with the proper permissions, or that they're listed in the 'admins' field. By default, this is checking whether the LocalSite itself can be modified, but a different permission can be passed to check for another ... | def is_mutable_by(self, user, perm='site.change_localsite'):
return user.has_perm(perm) or self.admins.filter(pk=user.pk).exists() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_modify_permissions(self, request, obj, local_site=None, *args,\n **kwargs):\n return obj.is_mutable_by(request.user, local_site=local_site)",
"def is_local_administrator(self):\n\t\treturn bool(call_sdk_function('PrlUsrCfg_IsLocalAdministrator', self.handle))",
"def... | [
"0.69915265",
"0.6767986",
"0.6745964",
"0.66542995",
"0.6571868",
"0.6538805",
"0.65115726",
"0.64365876",
"0.64365876",
"0.6423288",
"0.6423288",
"0.6423288",
"0.6416041",
"0.64117044",
"0.6377946",
"0.63580614",
"0.6347583",
"0.63408816",
"0.6334341",
"0.6306698",
"0.63005... | 0.7325419 | 0 |
Initial test to ensure flask was setup correctly | def test_index(self):
tester = app.test_client(self) # You can use self.app in place of tester
response = tester.get('/', content_type='html/text')
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.app = Flask(__name__)\n self.app_context = self.app.app_context()\n self.app_context.push()\n self.client = self.app.test_client()",
"def setUp(self):\r\n\r\n # Get the Flask test client\r\n self.client = app.test_client()\r\n\r\n # Show Fl... | [
"0.7963018",
"0.7768348",
"0.775371",
"0.775371",
"0.7753088",
"0.76997596",
"0.76996696",
"0.7628669",
"0.71135354",
"0.70732474",
"0.70732474",
"0.7046274",
"0.70372415",
"0.70372415",
"0.7029195",
"0.7028692",
"0.7028692",
"0.7028692",
"0.7014647",
"0.6978317",
"0.6931532"... | 0.0 | -1 |
Test user's dict is empty at first | def test_users_dictionary(self):
new_user = self.app
self.assertEqual(len(new_user.users), 0)
new_user.create_user()
self.assertIsInstance(new_user, User)
self.assertEqual(len(new_user.users), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_user_exists(self):\n actual = get_user_if_exists(None, self.details)\n self.assertDictEqual(actual, {})",
"def test_user_no_displayname_no_gcos_no_cn(dummy_user_dict):\n del dummy_user_dict[\"displayname\"]\n del dummy_user_dict[\"gecos\"]\n del dummy_user_dict[\"cn\"]\n use... | [
"0.75731874",
"0.6836103",
"0.6771533",
"0.6714173",
"0.66814727",
"0.66372144",
"0.6538163",
"0.65012443",
"0.64893514",
"0.64691335",
"0.64588577",
"0.6456357",
"0.64208287",
"0.63392884",
"0.63277215",
"0.63277215",
"0.62164754",
"0.6210718",
"0.62043333",
"0.62015986",
"0... | 0.6062548 | 31 |
Set the logger to log info in terminal and file `log_path`. In general, it is useful to have a logger so that every output to the terminal is saved in a permanent file. Here we save it to `model_dir/train.log`. | def set_logger(save=False, log_path=None):
logger = logging.getLogger()
logger.setLevel(logging.INFO)
if not logger.handlers:
if save:
# Logging to a file
file_handler = logging.FileHandler(log_path)
file_handler.setFormatter(logging.Formatter('%(asctime)s:%(leve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_log_dir(self, model_path=None):\n # Set date and epoch counter as if starting a new model\n self.epoch = 0\n now = datetime.datetime.now()\n\n # If we have a model path with date and epochs use them\n if model_path:\n # Continue from we left of. Get epoch and d... | [
"0.71050185",
"0.6997534",
"0.69510585",
"0.6779603",
"0.6645142",
"0.6635573",
"0.6463111",
"0.63399893",
"0.6329755",
"0.6300683",
"0.6288131",
"0.6273727",
"0.6232093",
"0.6207704",
"0.62005347",
"0.61989444",
"0.61839473",
"0.61506486",
"0.6113685",
"0.6081524",
"0.606003... | 0.6652557 | 4 |
Saves model and training parameters at checkpoint + 'last.pth.tar'. If is_best==True, also saves checkpoint + 'best.pth.tar' | def save_checkpoint(state, is_best, checkpoint):
filepath = os.path.join(checkpoint, 'last.pth.tar')
if not os.path.exists(checkpoint):
print("Checkpoint Directory does not exist! Making directory {}".format(checkpoint))
os.mkdir(checkpoint)
torch.save(state, filepath)
# 如果是最好的checkpoint... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self, is_best, state, epoch):\n path = os.path.join(self.logpath_models, 'model-%d.pth.tar' % epoch)\n torch.save(state, path)\n if is_best:\n shutil.copyfile(path, path + 'model_best.pth.tar')",
"def save_checkpoint(state, is_best, filename='checkpoint.pth.tar'):\n... | [
"0.8496686",
"0.8399394",
"0.83906746",
"0.8384919",
"0.8348396",
"0.8271069",
"0.82680976",
"0.8267125",
"0.8241347",
"0.8236903",
"0.8175586",
"0.8158997",
"0.80980265",
"0.7997058",
"0.79906005",
"0.7988534",
"0.77621585",
"0.7731652",
"0.770671",
"0.7673197",
"0.7665389",... | 0.80526185 | 13 |
Loads model parameters (state_dict) from file_path. If optimizer is provided, loads state_dict of optimizer assuming it is present in checkpoint. | def load_checkpoint(checkpoint, model, optimizer=None):
if not os.path.exists(checkpoint):
raise ("File doesn't exist {}".format(checkpoint))
checkpoint = torch.load(checkpoint, map_location=torch.device('cpu'))
model.load_state_dict(checkpoint['state_dict'])
if optimizer:
optimizer.loa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self, path):\n checkpoint = torch.load(path)\n self.load_state_dict(checkpoint['model_state_dict'])\n self.optimizer.load_state_dict(checkpoint['optimizer_state_dict'])",
"def load(self, path):\n checkpoint = torch.load(path)\n self.load_state_dict(checkpoint['model_st... | [
"0.77860296",
"0.77860296",
"0.77438104",
"0.7649429",
"0.763189",
"0.7625136",
"0.74906623",
"0.7334688",
"0.7298337",
"0.72729903",
"0.7204361",
"0.69773376",
"0.6974468",
"0.6941346",
"0.69103247",
"0.69103247",
"0.6908916",
"0.6892366",
"0.68774337",
"0.6849951",
"0.68485... | 0.6616543 | 33 |
r"""A method used to initialize the weights of PyTorch models. | def initial_parameter(net, initial_method=None):
if initial_method == 'xavier_uniform':
init_method = init.xavier_uniform_
elif initial_method == 'xavier_normal':
init_method = init.xavier_normal_
elif initial_method == 'kaiming_normal' or initial_method == 'msra':
init_method = init... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(model):\n ...",
"def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)",
"def init_weights_(self):\n raise NotImplementedError",
"def initialize_weights(self):\n for layer in self._cnn_layers:\n weight... | [
"0.83783656",
"0.8238353",
"0.8124111",
"0.8117989",
"0.8094813",
"0.80609393",
"0.8049274",
"0.7970722",
"0.79436654",
"0.79354197",
"0.7932881",
"0.7882599",
"0.78008497",
"0.77923226",
"0.7735501",
"0.77258617",
"0.76977146",
"0.768977",
"0.768977",
"0.768977",
"0.76897144... | 0.0 | -1 |
Test that creating machine via API is denied if role assignment is missing | def testPostAccessDenied(self):
self.runPost(None, data=self.post_data)
self.response_401()
for user in (self.guest, self.norole, self.unrelated_owner):
self.runPost(user, data=self.post_data)
self.response_403() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ipam_roles_create(self):\n pass",
"def test_add_role(self):\n pass",
"def test_create_cluster_role(self):\n pass",
"def test_create_role_existing(self):\n self.assertEqual(\n RoleAssignment.objects.filter(project=self.project).count(), 1\n )\n\n u... | [
"0.6913737",
"0.67129654",
"0.66731906",
"0.661018",
"0.6593888",
"0.6571657",
"0.6563195",
"0.65280247",
"0.6488382",
"0.64345706",
"0.63944924",
"0.6379238",
"0.6311238",
"0.6309953",
"0.6306513",
"0.6277936",
"0.6217779",
"0.621662",
"0.61997426",
"0.61470944",
"0.61278063... | 0.0 | -1 |
Test that creating machine via API is denied if role assignment is missing | def testUpdateAccessDenied(self):
self.runPut(None, sequencer=self.hiseq2000.sodar_uuid, data=self.post_data)
self.response_401()
for user in (self.guest, self.norole, self.unrelated_owner):
self.runPut(user, sequencer=self.hiseq2000.sodar_uuid, data=self.post_data)
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ipam_roles_create(self):\n pass",
"def test_add_role(self):\n pass",
"def test_create_cluster_role(self):\n pass",
"def test_create_role_existing(self):\n self.assertEqual(\n RoleAssignment.objects.filter(project=self.project).count(), 1\n )\n\n u... | [
"0.69133914",
"0.6711957",
"0.6672267",
"0.6610954",
"0.6593591",
"0.6570844",
"0.6563578",
"0.65272325",
"0.648989",
"0.6435081",
"0.63971525",
"0.63795996",
"0.6311099",
"0.63101393",
"0.63023156",
"0.6276793",
"0.62193877",
"0.62167495",
"0.62016016",
"0.61470497",
"0.6126... | 0.0 | -1 |
Test that creating machine via API is denied if role assignment is missing | def testDeleteAccessDenied(self):
self.assertEqual(SequencingMachine.objects.count(), 1)
self.runDelete(None, sequencer=self.hiseq2000.sodar_uuid)
self.assertEqual(SequencingMachine.objects.count(), 1)
self.response_401()
for user in (self.guest, self.norole, self.unrelated_owner... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ipam_roles_create(self):\n pass",
"def test_add_role(self):\n pass",
"def test_create_cluster_role(self):\n pass",
"def test_create_role_existing(self):\n self.assertEqual(\n RoleAssignment.objects.filter(project=self.project).count(), 1\n )\n\n u... | [
"0.691287",
"0.6711393",
"0.6673219",
"0.6611075",
"0.65933186",
"0.6572169",
"0.6563367",
"0.6526778",
"0.64898455",
"0.64361477",
"0.63957036",
"0.63793045",
"0.6310888",
"0.63099724",
"0.6303449",
"0.62759304",
"0.62187326",
"0.6216716",
"0.62010765",
"0.6147637",
"0.61264... | 0.0 | -1 |
Initialize the battery's attributes. | def __init__(self, battery_size=40):
self.battery_size = battery_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, battery_size=70):\r\n\t\tself.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size =... | [
"0.7373256",
"0.73601586",
"0.73601586",
"0.73601586",
"0.734221",
"0.734221",
"0.7319005",
"0.7316006",
"0.72850525",
"0.7227408",
"0.72071785",
"0.7196292",
"0.6998248",
"0.696277",
"0.69499767",
"0.6907041",
"0.6907041",
"0.6907041",
"0.6907041",
"0.6907041",
"0.6907041",
... | 0.7383211 | 0 |
Checks if the CSV file contains all required columns. | def validate_column_names(self, cols):
self.stdout.write('Verifying CSV header')
csv_cols = set(cols)
if self.required_csv_columns <= csv_cols:
return True
else:
missing_cols = set(self.required_csv_columns).difference(csv_cols)
raise ValidationError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_csv(filename, header, cols, rows):\n\n # open file\n data = pd.read_csv(filename, delimiter='|')\n\n # validate header\n assert header == '|'.join(list(data.columns.values))\n\n # validate column count\n assert data.shape[1] == cols\n\n # validate row count\n assert data.shape[... | [
"0.74219674",
"0.71559626",
"0.7064051",
"0.7044676",
"0.6933204",
"0.6880624",
"0.6842778",
"0.67009544",
"0.6593976",
"0.6554927",
"0.65337193",
"0.64992315",
"0.6493306",
"0.64672685",
"0.6462007",
"0.64533734",
"0.64333785",
"0.6407367",
"0.63730824",
"0.63719225",
"0.636... | 0.77545106 | 0 |
Gets relation or adds error message to errors list. Errors should be descriptive to user. (Standard DoesNotExist errors are not.) If a value is NaN, None is returned. | def get_relations(model, field):
field_iexact = '{0}__exact'.format(field)
value = dictified_chunk[model.__name__.lower()]
if type(value) == float and math.isnan(value):
return None
try:
return model.objects.get(**{
fie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(self):\n errors = self._info.get('error', {}).get('errors')\n if not errors:\n return None\n return ' '.join(err.get('message', 'unknown') for err in errors)",
"def get_error(self):\n p = self._get_sub_text('error')\n if not p:\n return None\n else:\n ... | [
"0.60867625",
"0.566688",
"0.5566653",
"0.5510137",
"0.5510137",
"0.5510137",
"0.5510137",
"0.5510137",
"0.5510137",
"0.5510137",
"0.5442257",
"0.5405362",
"0.5397558",
"0.536908",
"0.5291303",
"0.5285853",
"0.5274996",
"0.52188915",
"0.517312",
"0.517312",
"0.5161423",
"0.... | 0.47182307 | 79 |
INTERNAL USE ONLY Get the rule in the KB that is the same as the rule argument | def _get_rule(self, rule):
for kbrule in self.rules:
if rule == kbrule:
return kbrule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRule(self, *args):\n return _libsbml.Model_getRule(self, *args)",
"def get_rule(self):\n\n return self.__rule_",
"def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")",
"def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")",
"def ru... | [
"0.72598034",
"0.69801867",
"0.69057363",
"0.69057363",
"0.69057363",
"0.676362",
"0.67517036",
"0.6723854",
"0.6723854",
"0.6723854",
"0.6723854",
"0.6723854",
"0.6723854",
"0.6723854",
"0.6402129",
"0.63560486",
"0.63248295",
"0.628659",
"0.6276691",
"0.61988664",
"0.616951... | 0.79268336 | 2 |
To create the summed profile of all individual profiles in an instance, we can use a list comprehension to iterate over all profiles in the instance. Note how we now use `instance.profiles` to get this dictionary, where in chapter ` we simply used `instance`. | def model_data_from_instance(self, instance: af.ModelInstance) -> np.ndarray:
return sum(
[
profile.profile_from_xvalues(xvalues=self.dataset.xvalues)
for profile in instance.profiles
]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_all(profile):\n params = {}\n params[\"profile\"] = profile\n response = utils.do_request(instanceprofile, \"get\", params)\n data = utils.get_data(\"InstanceProfiles\", response)\n return data",
"def add_profile(self, profile):\r\n self.profiles.append(profile)",
"def calculate... | [
"0.61369634",
"0.5885941",
"0.5739842",
"0.56562793",
"0.5639097",
"0.5628797",
"0.56232256",
"0.56074524",
"0.5585603",
"0.5508757",
"0.5508473",
"0.549711",
"0.54968506",
"0.54808754",
"0.54765385",
"0.54575425",
"0.54535663",
"0.5451851",
"0.54071444",
"0.54000574",
"0.537... | 0.58057755 | 2 |
The name of this component. | def name(self):
return "component_manager" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component_name(self):\n return self._name",
"def name(self):\r\n return self.component.get(\"Name\", \"\")",
"def name(self):\r\n return self.component.get(\"Name\", \"\")",
"def get_name(self):\n return COMPONENT_LIST[self.index][0]",
"def name(self):\n return se... | [
"0.9065345",
"0.897935",
"0.897935",
"0.8652009",
"0.8357189",
"0.8357189",
"0.8357189",
"0.8357189",
"0.8357189",
"0.8357189",
"0.8357189",
"0.8357189",
"0.8357189",
"0.8357189",
"0.83296686",
"0.83296686",
"0.83296686",
"0.83296686",
"0.83296686",
"0.83296686",
"0.83296686"... | 0.0 | -1 |
Computes the histogram of the input image | def compute_histogram(self, image):
hist = [0] * 256
x, y = image.shape[:2]
#print(image.shape)
for i in range(x):
for j in range(y):
hist[image[i, j]] += 1
return hist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hist(img):\n bottom_half = img[img.shape[0]//2:,:] # 0:img.shape[0]//2 is the top half\n histogram = bottom_half.sum(axis=0) \n \n return histogram",
"def compute_histogram(self, image):\n hist = [0] * 256\n [h, w] = image.shape\n print(h,w)\n i = 0\n while i < ... | [
"0.8064423",
"0.8042533",
"0.8037536",
"0.7930632",
"0.76470864",
"0.7604351",
"0.75007343",
"0.73157203",
"0.7244618",
"0.71898323",
"0.7063043",
"0.6988698",
"0.69718844",
"0.69492954",
"0.6931104",
"0.6850683",
"0.6834464",
"0.6798194",
"0.6795921",
"0.6792963",
"0.6772005... | 0.82736444 | 0 |
Comptues the binary image of the the input image based on histogram analysis and thresholding take as input | def binarize(self, image, threshold):
bin_img = image.copy()
for i in range(image.shape[0]):
for j in range(image.shape[1]):
if image[i, j] >= threshold:
bin_img[i, j] = 0
else:
bin_img[i, j] = 255
return bin_img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binarize(self, image, threshold):\n\n bin_img = image.copy()\n [h, w] = bin_img.shape\n opt_threshold = threshold\n print(opt_threshold)\n for row in range(h):\n for col in range(w):\n if bin_img[row, col] > opt_threshold: #greater than threshld whit... | [
"0.7681446",
"0.727308",
"0.7155279",
"0.70369035",
"0.6960089",
"0.6878597",
"0.6873943",
"0.6869752",
"0.6862886",
"0.68430334",
"0.68059856",
"0.67681766",
"0.67679167",
"0.6710474",
"0.66879267",
"0.6674513",
"0.66720676",
"0.666158",
"0.6618548",
"0.6603418",
"0.6565325"... | 0.73140323 | 1 |
Cosine decay schedule with warm up period. | def cosine_decay_with_warmup(global_step,
learning_rate_base,
total_steps,
warmup_learning_rate=0.0,
warmup_steps=0,
hold_base_rate_steps=0):
if total_steps < warmup_steps... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule(epoch):\n return alpha / (1 + (decay_rate * epoch))",
"def cosine_decay(base_lr, max_iteration, cur_step):\n return base_lr * (math.cos( (7*math.pi*cur_step) / (16*max_iteration) ))",
"def get_cosine_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, num_cycles=.5, las... | [
"0.6320161",
"0.62945265",
"0.6014468",
"0.6014468",
"0.5992535",
"0.5947948",
"0.594646",
"0.59023297",
"0.5854784",
"0.58509827",
"0.5842494",
"0.582645",
"0.5814702",
"0.57450205",
"0.5581755",
"0.550415",
"0.5425403",
"0.5404061",
"0.5401594",
"0.5377699",
"0.53299034",
... | 0.5282483 | 22 |
Callable to compute the learning rate. | def eager_decay_rate():
learning_rate = 0.5 * learning_rate_base * (1 + tf.cos(
np.pi *
(tf.cast(global_step, tf.float32) - warmup_steps - hold_base_rate_steps
) / float(total_steps - warmup_steps - hold_base_rate_steps)))
if hold_base_rate_steps > 0:
lea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def __call__(self, epoch):\n # Compute the new dynamic learning rate, log in onto TensorBoard and\n # return the result for the training process\n learning_rate = self.schedule(epoch)\n ... | [
"0.8016885",
"0.8015723",
"0.7786947",
"0.77867407",
"0.7728448",
"0.7575189",
"0.7575189",
"0.7390784",
"0.7385804",
"0.7383413",
"0.7356881",
"0.7334096",
"0.73053694",
"0.72900087",
"0.71948165",
"0.70886856",
"0.7037042",
"0.69462264",
"0.69425225",
"0.69425225",
"0.68872... | 0.6100761 | 65 |
This funtion should perform the job of projecting the input pointcloud onto the frame of an image captured by a camera with camera matrix as given, of dimensions as given, in pixels. points is an 3 x N array where the ith entry is an (x, y, z) point in 3D space, in the reference frame of the depth camera. This correspo... | def project_points(points, cam_matrix, trans, rot):
# STEP 1: Transform pointcloud into new reference frame.
points = np.dot(rot, points) + trans[:, None]
# STEP 2: Project new pointcloud onto image frame using K matrix.
# gives a 3 x N array of image plane coordinates in homogenous coordinates.
h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project(points, camera_params, theta):\n \"\"\"\n Function takes input of 3d_points, transformations and Convert 3-D points to 2-D by projecting onto images. \n Input:\n points: 3D points in world frame\n camera_params: parameters of camera corrosponding to the point\n theta: Need... | [
"0.75861025",
"0.73979294",
"0.73724365",
"0.70940655",
"0.7059192",
"0.7011868",
"0.69861317",
"0.6886492",
"0.685968",
"0.6813133",
"0.6795302",
"0.6780843",
"0.6771063",
"0.676563",
"0.6705942",
"0.66217476",
"0.65333843",
"0.6509686",
"0.64969933",
"0.6453741",
"0.6448303... | 0.7957179 | 0 |
Determines all import names that should be considered "local". This is used when running the linter to insure that import order is properly checked. | def _determine_local_import_names(start_dir):
file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
return [
basename
for basename, extension
in file_ext_pairs
if extension == '.py' or os.path.isdir(
os.path.join(start_dir, basename))
and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_import_local_methods(self):\n package_foo = determine_package(LocalClass().foo_method)\n package_bar = determine_package(LocalClass().bar_method)\n assert package_foo == package_bar",
"def is_local(self) -> bool:\n if not self.source:\n return False\n\n if s... | [
"0.5883926",
"0.58062863",
"0.57493323",
"0.57031",
"0.56781274",
"0.56347144",
"0.5598635",
"0.5551292",
"0.5530518",
"0.5508783",
"0.55060405",
"0.5462658",
"0.5400261",
"0.5390425",
"0.53739977",
"0.5363772",
"0.53556126",
"0.53410673",
"0.5327128",
"0.5322422",
"0.5312975... | 0.7432707 | 0 |
Compute softmax values for each sets of scores in x. | def softmax(x):
# Compute and return softmax(x)
denom = sum(np.exp(x))
return [ np.exp(xi)/denom for xi in x ] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7800231",
"0.776332",
"0.7762483",
"0.77600384",
"0.76607925",
"0.76607925",
"0.76607925",
"0.76607925",
"0.7585753",
"0.7432371",
"0.7409777",
"0.73932534",
"0.7360278",
"0.72708684",
"0.7263948",
"0.7262435",
"0.7257905",
"0.7231808",
"0.72159433",
"0.7203519",
"0.720315... | 0.731833 | 13 |
Returns the Rectified Linear Unit (ReLU) activation | def relu(x: jnp.DeviceArray) -> jnp.DeviceArray:
return jnp.clip(x, a_min=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_relu(self):\n activation_name = 'ReLU'\n args = {}\n\n activation = activation_factory.create(activation_name, **args)\n self.assertEqual(activation._get_name(), activation_name)\n\n x = torch.ones(10) * -1\n y = activation(x)\n self.assertEqual(len(torch.n... | [
"0.6779949",
"0.66550666",
"0.6524321",
"0.6480041",
"0.639636",
"0.639636",
"0.6394408",
"0.6366181",
"0.6363569",
"0.63122356",
"0.6284705",
"0.62716",
"0.62474895",
"0.623992",
"0.6230122",
"0.6230122",
"0.6192656",
"0.61823756",
"0.6163329",
"0.6142856",
"0.6132948",
"0... | 0.0 | -1 |
Calculates softmax across a desired axis. Arguments | def softmax(x: jnp.DeviceArray, *, axis: int = 0) -> jnp.DeviceArray:
return jnp.exp(x) / jnp.expand_dims(jnp.sum(jnp.exp(x), axis=axis), axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\r\n e_x = np.exp(x - np.expand_dims(np.max(x, axis=-1), axis=-1))\r\n return e_x / np.expand_dims(e_x.sum(axis=-1), axis=-1) # only difference\r",
"def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)",
"def softmax(x):\n return np.exp(x)/np.sum(np.exp(x),... | [
"0.82091117",
"0.8203848",
"0.819648",
"0.819648",
"0.81928647",
"0.81735945",
"0.81680465",
"0.8144589",
"0.8144145",
"0.813783",
"0.8125608",
"0.8100958",
"0.80981773",
"0.80939096",
"0.80836487",
"0.80836487",
"0.80836487",
"0.80836487",
"0.80836487",
"0.80836487",
"0.8083... | 0.8248852 | 0 |
Calculates logsoftmax across a desired axis. Arguments | def log_softmax(x: jnp.DeviceArray, *, axis: int = 0) -> jnp.DeviceArray:
return x - jnp.expand_dims(jnp.log(jnp.sum(jnp.exp(x), axis=axis)), axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_softmax(input, dim, inplace=False):\n return FunctionLib.apply(\n 'LogSoftmax', input.device, [input],\n outputs=[input if inplace else None], axis=dim)",
"def log_softmax_nd(logits, axes=(-1,)):\n logits -= tf.reduce_max(logits, axis=axes, keepdims=True)\n return logits - tf.reduc... | [
"0.79187274",
"0.78436774",
"0.78026515",
"0.7745838",
"0.7555003",
"0.7547153",
"0.7151152",
"0.7116799",
"0.70571184",
"0.70393515",
"0.7036909",
"0.6993901",
"0.69822043",
"0.6971128",
"0.6970583",
"0.69682556",
"0.69494355",
"0.6942103",
"0.6942103",
"0.6929219",
"0.69118... | 0.8242526 | 0 |
Given an input string, returns it as the body of an html document. Adapted from example.py included in docutils distribution. | def rst_to_html(input_string, source_path=None, destination_path=None,
input_encoding='unicode', doctitle=1, initial_header_level=1):
overrides = {'input_encoding': input_encoding,
'doctitle_xform': doctitle,
'initial_header_level': initial_header_level,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest2html(s):\n return core.publish_string(s, writer=html_fragment_writer)",
"def htmlFormat( body = 'No text supplied', title = 'CS 5 project page' ):\n startString = \"\"\"\\\nContent-Type: text/html;\n\n<html>\n<head>\n<title>\n\"\"\"\n afterTitle = \"\"\"\\\n</title>\n</head>\n\n<body>\n\"\"\"\n... | [
"0.66641665",
"0.6609217",
"0.6305159",
"0.6242836",
"0.6172251",
"0.60931087",
"0.6054476",
"0.6012877",
"0.60044134",
"0.59778404",
"0.59670067",
"0.59541255",
"0.5941216",
"0.5902097",
"0.5884714",
"0.588471",
"0.583694",
"0.57947314",
"0.5752858",
"0.57214975",
"0.5713764... | 0.7353787 | 0 |
Render the homepage template on the / route | def homepage():
form = LoginForm()
return render_template("admin/index.html", title="Admin", form=form) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n return render_template(\"home/index.html\")",
"def home():\n return render_template('homepage.html')",
"def homepage():\n return render_template('homepage.html')",
"def homepage():\n return render_template(\"home/index.html\", title=\"Welcome\")",
"def render_home():\r\n\treturn... | [
"0.8597299",
"0.8569112",
"0.85272837",
"0.8474665",
"0.8474087",
"0.8451808",
"0.8424757",
"0.8424757",
"0.84213376",
"0.8389955",
"0.83125323",
"0.8266481",
"0.8266481",
"0.8266481",
"0.8266481",
"0.8266481",
"0.8266481",
"0.82651",
"0.8260553",
"0.8250731",
"0.8250731",
... | 0.0 | -1 |
Sets the aux_input_type3 of this UpdateVehicleRequest. | def aux_input_type3(self, aux_input_type3):
allowed_values = ["none", "emergencyLights", "emergencyAlarm", "stopPaddle", "powerTakeOff", "plow", "sweeper", "salter", "reefer", "door", "boom", "auxiliaryEngine", "generator", "eightWayLights"] # noqa: E501
if self.local_vars_configuration.client_side_val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aux_input_type9(self, aux_input_type9):\n allowed_values = [\"none\", \"emergencyLights\", \"emergencyAlarm\", \"stopPaddle\", \"powerTakeOff\", \"plow\", \"sweeper\", \"salter\", \"reefer\", \"door\", \"boom\", \"auxiliaryEngine\", \"generator\", \"eightWayLights\"] # noqa: E501\n if self.local... | [
"0.60051674",
"0.59958714",
"0.59745276",
"0.5884165",
"0.573058",
"0.55547076",
"0.5548062",
"0.5489199",
"0.54143596",
"0.5395056",
"0.5113174",
"0.5069129",
"0.49999794",
"0.49934226",
"0.49783775",
"0.49597377",
"0.49532253",
"0.48770082",
"0.48317355",
"0.4767722",
"0.47... | 0.833222 | 0 |
Sets the external_ids of this UpdateVehicleRequest. | def external_ids(self, external_ids):
self._external_ids = external_ids | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_ids(self, **kwargs):\n path = self._get_movie_id_path('external_ids')\n resp = self._get_method(path, kwargs)\n return resp",
"def external_id(self, external_id):\n\n self._external_id = external_id",
"def external_id(self, external_id):\n\n self._external_id = e... | [
"0.5645812",
"0.56326723",
"0.56326723",
"0.56326723",
"0.55220467",
"0.5430042",
"0.5307687",
"0.5243291",
"0.5185779",
"0.51405275",
"0.51405275",
"0.5116388",
"0.508638",
"0.5023836",
"0.49995106",
"0.49790815",
"0.49639636",
"0.4961317",
"0.49294525",
"0.49190345",
"0.489... | 0.7786375 | 0 |
Sets the license_plate of this UpdateVehicleRequest. | def license_plate(self, license_plate):
if (self.local_vars_configuration.client_side_validation and
license_plate is not None and len(license_plate) > 12):
raise ValueError("Invalid value for `license_plate`, length must be less than or equal to `12`") # noqa: E501
self._l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def license(self, license):\n\n self._license = license",
"def save(self, *args, **kwargs):\n if self.license_plate:\n self.license_plate = self.license_plate.replace('-','').replace(' ','')\n super(VehicleRegistration,self).save(*args, **kwargs)",
"def license_number(self, lice... | [
"0.6482215",
"0.60094345",
"0.5971417",
"0.57393056",
"0.5617041",
"0.55561376",
"0.53961915",
"0.5359062",
"0.5322539",
"0.5291167",
"0.52001405",
"0.5070711",
"0.5057579",
"0.49738538",
"0.49601606",
"0.49601606",
"0.49461326",
"0.4945529",
"0.49165577",
"0.4910613",
"0.487... | 0.7658375 | 0 |
Sets the notes of this UpdateVehicleRequest. | def notes(self, notes):
if (self.local_vars_configuration.client_side_validation and
notes is not None and len(notes) > 255):
raise ValueError("Invalid value for `notes`, length must be less than or equal to `255`") # noqa: E501
self._notes = notes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self,... | [
"0.68845856",
"0.68845856",
"0.68845856",
"0.68845856",
"0.68845856",
"0.6636343",
"0.65447444",
"0.6384112",
"0.59179527",
"0.58897984",
"0.5507248",
"0.5370536",
"0.51564264",
"0.51564264",
"0.5099891",
"0.5076104",
"0.50644374",
"0.505969",
"0.5039264",
"0.4936329",
"0.493... | 0.64006484 | 7 |
Sets the static_assigned_driver_id of this UpdateVehicleRequest. | def static_assigned_driver_id(self, static_assigned_driver_id):
self._static_assigned_driver_id = static_assigned_driver_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driver_id(self, driver_id):\n\n self._driver_id = driver_id",
"def driver_id(self, driver_id: int):\n if driver_id is None:\n raise ValueError(\"Invalid value for `driver_id`, must not be `None`\") # noqa: E501\n\n self._driver_id = driver_id",
"def static_finding(self, sta... | [
"0.58979875",
"0.52223",
"0.50875014",
"0.45650956",
"0.45579106",
"0.45233056",
"0.45233056",
"0.44840404",
"0.44335097",
"0.43853715",
"0.4371814",
"0.43593413",
"0.43487522",
"0.42879018",
"0.42818657",
"0.42814112",
"0.42524332",
"0.4240414",
"0.4240414",
"0.4225884",
"0.... | 0.8492683 | 0 |
Sets the tag_ids of this UpdateVehicleRequest. | def tag_ids(self, tag_ids):
self._tag_ids = tag_ids | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tags(self, tags):\r\n current_tags = set(self.tag_names())\r\n updated_tags = set(tags)\r\n removed_tags = current_tags.difference(updated_tags)\r\n new_tags = updated_tags.difference(current_tags)\r\n \r\n for tag in new_tags:\r\n self.add_tag(tag)\r\n ... | [
"0.6124682",
"0.61125207",
"0.60852545",
"0.6005471",
"0.6005471",
"0.6005471",
"0.6005471",
"0.6005471",
"0.6005471",
"0.6005471",
"0.6005471",
"0.6005471",
"0.6005471",
"0.5952815",
"0.59259295",
"0.59259295",
"0.59259295",
"0.5924576",
"0.5871416",
"0.5602764",
"0.55914205... | 0.75711256 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, UpdateVehicleRequest):
return False
return self.to_dict() == other.to_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):
if not isinstance(other, UpdateVehicleRequest):
return True
return self.to_dict() != other.to_dict() | {
"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.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Return ID of the command's owner | def owner(self):
answer = self._call('owner')
return answer.owner | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner_id(self) -> str:\n return pulumi.get(self, \"owner_id\")",
"def owner_id(self) -> str:\n return self.__owner_id",
"def owner_id(self) -> int:\n return self.proto.owner",
"def owner_id(self):\n return self._owner_id",
"def owner_id(self) -> Optional[str]:\n retur... | [
"0.7799616",
"0.7753633",
"0.76906127",
"0.76573384",
"0.7629729",
"0.7515706",
"0.7453457",
"0.73210293",
"0.73210293",
"0.73126256",
"0.7185304",
"0.7171606",
"0.71175456",
"0.7111413",
"0.705751",
"0.70522135",
"0.703091",
"0.69719386",
"0.692131",
"0.68922853",
"0.6857497... | 0.7285534 | 10 |
Whether this datatype has staged local modifications. | def modified(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_local_state(self) -> bool:\n return True",
"def is_modified(self):\n return len(self.modified_fields) > 0",
"def is_local(self) -> bool:\n if not self.source:\n return False\n\n if self.source.master_name.startswith(MODULE_NAME):\n return True\n\n ... | [
"0.7210056",
"0.7106617",
"0.70620275",
"0.69745135",
"0.69522744",
"0.69439024",
"0.6663222",
"0.66631716",
"0.66554046",
"0.6641709",
"0.66392136",
"0.6631838",
"0.6622982",
"0.6613594",
"0.66110885",
"0.6608613",
"0.6608613",
"0.65780777",
"0.65697205",
"0.6561284",
"0.655... | 0.0 | -1 |
Adapting numpy.int64 type to SQLconform int type using psycopg extension, see [1]_ for more info. | def adapt_numpy_int64(numpy_int64):
return AsIs(numpy_int64) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def castData(data, type='int64'):\n data = data.astype(type)\n return data",
"def cast_to_integer(array, attributes):\n atts = array.att_names\n\n for nm, typ, null in array.sdbtype.full_rep:\n if nm not in attributes:\n continue\n if 'int' in typ:\n continue\n ... | [
"0.6342146",
"0.62293154",
"0.6208453",
"0.5914053",
"0.5862272",
"0.5841508",
"0.5763204",
"0.5722632",
"0.57082486",
"0.5705555",
"0.5675615",
"0.5662397",
"0.565685",
"0.5637229",
"0.5554309",
"0.54482377",
"0.5430291",
"0.53955346",
"0.5389029",
"0.53852504",
"0.53627807"... | 0.7526429 | 0 |
Gets the name of the primary key column. | def get_id_name(table):
primary_key_columns = table.primary_key.columns.items()
if len(primary_key_columns) == 1:
name, _ = primary_key_columns[0]
return name
# We should never get this far.
# All tables in my db should have a single primary key column
ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pk_column_name(cls):\n return cls._meta.pk_column_name",
"def primary_key(cls):\n\n if cls.__from_class__:\n cls = cls.__from_class__\n return cls.__table__.primary_key.columns.values()[0].name",
"def get_primary_key(cls) -> str:\n return inspect(cls).primary_key[... | [
"0.8489972",
"0.8386202",
"0.8166243",
"0.7895862",
"0.7800656",
"0.75968707",
"0.73416424",
"0.7309249",
"0.7292977",
"0.7266723",
"0.71143186",
"0.71024054",
"0.7098094",
"0.7098094",
"0.70875776",
"0.7059059",
"0.697482",
"0.68769145",
"0.671848",
"0.6676967",
"0.6653327",... | 0.75963014 | 6 |
Converts a python datatype to the appropriate string (including, e.g., \ the necessary single quotes and/or brackets ) for use in a raw \ postgresql query. | def _for_pgsql(value, dtype):
if dtype.startswith(('int', 'float', 'double', 'numeric')):
if value is None:
return "Null"
elif str(value).lower() == 'nan':
return "'nan'"
elif dtype.endswith('[]'):
value = ', '.join([str(v) for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def typecast(dtype: Any) -> str:\n if dtype is int:\n return \"Int64\"\n elif dtype is float:\n return \"Float64\"\n elif dtype is bool:\n return \"bool\"\n return \"string\"",
"def escapeinput_data_for_sql(self, value, sql_type):\n\t\t# print value\n\... | [
"0.72594017",
"0.7176732",
"0.70983726",
"0.701285",
"0.7011267",
"0.69050854",
"0.6897729",
"0.6891294",
"0.66907203",
"0.65747005",
"0.65560377",
"0.6526946",
"0.6434319",
"0.6389201",
"0.6378415",
"0.6377122",
"0.6342456",
"0.6311862",
"0.62993383",
"0.6254328",
"0.6250282... | 0.7943686 | 0 |
Gets the conventional sign associated with a matrix element / form factor. | def get_sign(current):
signs = conventions.form_factor_signs
mask = (signs['spin_taste_current'] == current)
return utils.extract_unique(signs[mask], 'sign') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSign(self):\n return _libsbml.Input_getSign(self)",
"def SIGN(A):\r\n return np.sign(A)",
"def _get_significance_matrix(self) -> np.array:\n if self.author == 'yarkoni':\n if self.signf == 0.05:\n return self.corr_05\n if self.signf == 0.01:\n ... | [
"0.63887745",
"0.63612455",
"0.63400894",
"0.6329764",
"0.6299611",
"0.62754524",
"0.6029659",
"0.6012176",
"0.59190845",
"0.5728139",
"0.570455",
"0.5564154",
"0.55042964",
"0.54584146",
"0.54216564",
"0.5362895",
"0.53505296",
"0.5350341",
"0.5348498",
"0.52633065",
"0.5259... | 0.58625495 | 9 |
Reads the slither.txt file and returns these three columns as numpy | def read_slithertxt(filename: os.PathLike) -> tuple:
reg_statistics = list()
consume = False
with open(filename, "r") as f:
for line in f:
if not consume:
if line.startswith(" FromLine"):
reg_statistics.append(line)
consume = True... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_read(file_name):\n \n #open specified file in read mode\n in_file = open(file_name, \"r\")\n \n #create data lists\n sp_length_v3 = []\n sp_period_v3 = [] \n\n #save header to string and split into list\n header_string = in_file.readline()\n header_v3 = header_string.split... | [
"0.67732704",
"0.66469187",
"0.65621084",
"0.655657",
"0.6525634",
"0.6487795",
"0.6455106",
"0.6452941",
"0.64487594",
"0.6442892",
"0.63788307",
"0.6374876",
"0.6372156",
"0.63671476",
"0.6366139",
"0.632144",
"0.6305059",
"0.6282006",
"0.6272563",
"0.6251759",
"0.62306505"... | 0.0 | -1 |
Return the Cell object in the row and column position | def get_cell(self, row, column):
return self.sudoku_matrix[row][column] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell_from_xy(self,x,y):\n return self.cell_array.item((x,y))",
"def cell(self):\n return self._cell",
"def getCell(self, row, column):\n\t\t\t\t\n\t\t\t\tif ((row is None) or (column is None)):\n\t\t\t\t\traise NotImplementedError()\n\n\t\t\t\treturn self.thing[self.convertColumn(row = row, colum... | [
"0.78056264",
"0.7625454",
"0.7583768",
"0.74747694",
"0.7398449",
"0.7367573",
"0.73494375",
"0.7321168",
"0.7258564",
"0.7245528",
"0.7196293",
"0.71352375",
"0.7028381",
"0.70115393",
"0.6975928",
"0.6946422",
"0.69435024",
"0.6932324",
"0.6905336",
"0.68930906",
"0.688538... | 0.7386752 | 5 |
Method that compare if two SudokuMatrix object are equals | def __eq__(self, other_sudoku_matrix):
equals = False
for row in range(9):
for col in range(9):
if int(self.get_cell(row, col).get_cell_value()) == int(
other_sudoku_matrix.get_cell(row, col).get_cell_value()):
equals = True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not issubclass(type(other), Matrix):\n return False\n\n if self.rows != other.rows or self.columns != other.columns:\n return False\n\n return self.data == other.data",
"def __eq__(self, other):\r\n return self.id_map == other.id_map... | [
"0.76117563",
"0.74743104",
"0.7445452",
"0.74154025",
"0.73595923",
"0.7285003",
"0.72529274",
"0.71656305",
"0.71012837",
"0.7078154",
"0.7041093",
"0.7036643",
"0.7032445",
"0.70261645",
"0.697155",
"0.6970848",
"0.69523555",
"0.69491196",
"0.693337",
"0.6912804",
"0.68703... | 0.8493141 | 0 |
StorageClass is the specification for Storage Classes | def storage_class(self) -> Optional[Sequence['outputs.CSIIsilonSpecDriverStorageClass']]:
return pulumi.get(self, "storage_class") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_class(self) -> \"StorageClass\":\n return self._values.get('storage_class')",
"def storage_class(self) -> \"StorageClass\":\n return self._values.get('storage_class')",
"def GetDefaultStorageClass(self) -> str:\n raise NotImplementedError",
"def storage_class(self) -> Optional[Se... | [
"0.80497444",
"0.80497444",
"0.7733317",
"0.75832784",
"0.75614315",
"0.75532156",
"0.74965537",
"0.6984797",
"0.68212986",
"0.6531295",
"0.6397015",
"0.63666344",
"0.6318624",
"0.6274233",
"0.6237891",
"0.6182181",
"0.60391",
"0.5787072",
"0.56052196",
"0.557219",
"0.5562914... | 0.7733593 | 2 |
ImagePullPolicy is the image pull policy for the image | def image_pull_policy(self) -> Optional[str]:
return pulumi.get(self, "image_pull_policy") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _determine_image_pull_policy(self) -> ImagePullPolicy:\n if not self.image_pull_policy:\n _, tag = self._get_image_and_tag()\n if tag == \"latest\" or not tag:\n return ImagePullPolicy.ALWAYS\n return ImagePullPolicy.IF_NOT_PRESENT\n return self.ima... | [
"0.8125607",
"0.7769917",
"0.68590343",
"0.622387",
"0.5951845",
"0.5950428",
"0.5817936",
"0.57732624",
"0.56761223",
"0.56241024",
"0.561501",
"0.55290407",
"0.5482199",
"0.54586315",
"0.54287744",
"0.5416411",
"0.54072386",
"0.5384012",
"0.53806716",
"0.5362444",
"0.535377... | 0.7894309 | 7 |
NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. | def node_selector(self) -> Optional[Mapping[str, str]]:
return pulumi.get(self, "node_selector") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_selector(self, node_selector: Dict[str, str]):\n\n self._node_selector = node_selector",
"def list_of_pods_in_a_node(self, node_name, namespace: Optional[str] = None, label_selector: Optional[str] = None):\n pod_list = []\n if namespace is None:\n api_response = self.list... | [
"0.6503566",
"0.59163624",
"0.5903968",
"0.5700088",
"0.565937",
"0.56517595",
"0.5634908",
"0.55823445",
"0.55401206",
"0.55401206",
"0.55401206",
"0.54006803",
"0.54006803",
"0.54006803",
"0.5328655",
"0.53018135",
"0.53018135",
"0.53018135",
"0.523169",
"0.523169",
"0.5231... | 0.6245567 | 8 |
EnvVar represents an environment variable present in a Container. | def __init__(__self__, *,
name: str,
value: Optional[str] = None,
value_from: Optional['outputs.CSIIsilonSpecDriverCommonEnvsValueFrom'] = None):
pulumi.set(__self__, "name", name)
if value is not None:
pulumi.set(__self__, "value", value)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env(var):\n return os.environ[var]",
"def with_env_variable(\n self,\n name: str,\n value: str,\n expand: Optional[bool] = None,\n ) -> \"Container\":\n _args = [\n Arg(\"name\", name),\n Arg(\"value\", value),\n Arg(\"expand\", expand... | [
"0.6759011",
"0.64400876",
"0.6365067",
"0.6353957",
"0.6332777",
"0.63078386",
"0.6261371",
"0.61820585",
"0.60630727",
"0.6052506",
"0.6047019",
"0.6040598",
"0.6039395",
"0.6014736",
"0.5986097",
"0.59742486",
"0.5959875",
"0.59374666",
"0.5901712",
"0.58948684",
"0.585241... | 0.0 | -1 |
Name of the environment variable. Must be a C_IDENTIFIER. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._env_name",
"def environment_variable_string(self, name):\n return \"$(\" + name + \")\"",
"def windows_get_env_value(var_name: str) -> str:\n if var_name in os.environ.keys():\n return os.environ[var_name]",
"def name(self):\n return get_env_name(... | [
"0.707886",
"0.70169437",
"0.68652874",
"0.68336385",
"0.67338234",
"0.6632225",
"0.66093564",
"0.6515423",
"0.6485804",
"0.6483849",
"0.6423898",
"0.64139676",
"0.6373172",
"0.63263583",
"0.6298889",
"0.6297938",
"0.62448883",
"0.6225822",
"0.62034917",
"0.6172938",
"0.61534... | 0.0 | -1 |
Source for the environment variable's value. Cannot be used if value is not empty. | def value_from(self) -> Optional['outputs.CSIIsilonSpecDriverCommonEnvsValueFrom']:
return pulumi.get(self, "value_from") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_from(self) -> Optional[pulumi.Input['EnvVarSourceArgs']]:\n return pulumi.get(self, \"value_from\")",
"def get(self):\n self.value = os.getenv(self.name, self.default)\n return self.value",
"def env_var_line(key: str) -> str:\n return str(os.environ.get(key) or \"\").strip()",... | [
"0.7228275",
"0.64528674",
"0.6357909",
"0.633982",
"0.6328291",
"0.62157595",
"0.6187024",
"0.61756605",
"0.6110127",
"0.6071726",
"0.60466075",
"0.6032628",
"0.6013969",
"0.60129076",
"0.59961873",
"0.5995158",
"0.5981432",
"0.59606564",
"0.59373564",
"0.59033906",
"0.58769... | 0.564917 | 53 |
Source for the environment variable's value. Cannot be used if value is not empty. | def __init__(__self__, *,
config_map_key_ref: Optional['outputs.CSIIsilonSpecDriverCommonEnvsValueFromConfigMapKeyRef'] = None,
field_ref: Optional['outputs.CSIIsilonSpecDriverCommonEnvsValueFromFieldRef'] = None,
resource_field_ref: Optional['outputs.CSIIsilonSpecDriv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_from(self) -> Optional[pulumi.Input['EnvVarSourceArgs']]:\n return pulumi.get(self, \"value_from\")",
"def get(self):\n self.value = os.getenv(self.name, self.default)\n return self.value",
"def env_var_line(key: str) -> str:\n return str(os.environ.get(key) or \"\").strip()",... | [
"0.72288674",
"0.64534545",
"0.6357108",
"0.6340354",
"0.63287365",
"0.62147003",
"0.61874634",
"0.61761737",
"0.61121243",
"0.6071117",
"0.6045305",
"0.60322315",
"0.60140574",
"0.6012305",
"0.5996602",
"0.5996114",
"0.59795004",
"0.59593",
"0.5936663",
"0.5903263",
"0.58764... | 0.0 | -1 |
The key of the secret to select from. Must be a valid secret key. | def key(self) -> str:
return pulumi.get(self, "key") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secret_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"secret_key\")",
"def secret_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"secret_key\")",
"def secret_key(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"secret_key\")",
"def secret_key... | [
"0.81515235",
"0.81515235",
"0.79967463",
"0.77533454",
"0.7631605",
"0.7569842",
"0.7526095",
"0.7503426",
"0.74400395",
"0.73191357",
"0.73191357",
"0.72888464",
"0.72888464",
"0.716242",
"0.716242",
"0.7155205",
"0.71101844",
"0.7094617",
"0.7077072",
"0.7058335",
"0.69245... | 0.66455597 | 78 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.