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
Get the environment variable or raise exception
def get_env_variable(var_name, prefix=VARIABLE_PREFIX, as_bool=False): if prefix is not None: var_name = prefix + var_name try: value = os.environ[var_name] if as_bool: value = value.lower() == 'true' return value except KeyError: raise ImproperlyConfigur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_env_or_exception(key):\n \n value = os.getenv(key)\n if value is None:\n raise ImproperlyConfigured(f'{key} env variable is not set')\n\n return value", "def getenv_or_raise_exception(varname) -> str:\n\n env = os.getenv(varname)\n if env is None:\n raise EnvironmentError(...
[ "0.81823474", "0.8099072", "0.80557066", "0.7901131", "0.78702366", "0.7809254", "0.77559894", "0.77216524", "0.76638013", "0.76466703", "0.754514", "0.7476793", "0.74719614", "0.7465123", "0.74572086", "0.7426255", "0.74211806", "0.74081814", "0.73991525", "0.7345222", "0.73...
0.0
-1
Returns current true UTC time as a timeaware datetime object
def utc_now(): realtime = datetime.utcnow() realtime = pytz.utc.localize(realtime) return realtime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def datetime(self, aware=False) -> dt.datetime:\n if aware is True:\n now = await self.AD.sched.get_now()\n return now.astimezone(self.AD.tz)\n else:\n return await self.AD.sched.get_now_naive()", "def datetime_utc_now() -> datetime:\n return datetime.now(t...
[ "0.76857644", "0.7552746", "0.7549446", "0.74968964", "0.749523", "0.74306625", "0.7427546", "0.7373462", "0.7314741", "0.7302832", "0.72967887", "0.7238569", "0.72143453", "0.7194171", "0.71692985", "0.71404064", "0.7138585", "0.7124459", "0.71094424", "0.7070395", "0.705971...
0.714195
15
Test index route status code
def test_index(client): ind = client.get('/') ind2 = client.get('/index/') assert ind.status_code == 200 assert ind2.status_code == 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index_route():\n response = client.get(\"/\")\n assert response.status_code == status.HTTP_200_OK\n assert response.raw != None", "def test_index_availability(client):\n response = client.get('/')\n assert response.status_code == 200", "def test_resources_index_200(self):\n url =...
[ "0.7927917", "0.76967937", "0.7463699", "0.7333757", "0.7285797", "0.72006303", "0.7153459", "0.7075232", "0.70320183", "0.70130235", "0.7011268", "0.6974113", "0.69543785", "0.69445413", "0.693427", "0.68701935", "0.68637955", "0.6828023", "0.6806781", "0.67570263", "0.67430...
0.75898707
2
Get file hex digest (fingerprint).
def _get_sha1(file_descriptor): sha1 = hashlib.sha1() for block in iter(partial(file_descriptor.read, BLOCK_SIZE), ''): sha1.update(block) file_descriptor.seek(0) return sha1.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_digest(file):\n # 'rb' file mode reads the file as bytes\n input_file = open(file, 'rb')\n data = input_file.read()\n # getting the digest\n digest = hash_comparing(data).hexdigest()\n input_file.close()\n return digest", "def fingerprint(self) -> str:\n fp = self.sha256.hex(...
[ "0.75853276", "0.73116523", "0.7146365", "0.6978861", "0.6942803", "0.6900638", "0.68414474", "0.6836104", "0.679403", "0.67751384", "0.67482144", "0.67346597", "0.6670643", "0.6655388", "0.6625109", "0.66017854", "0.65971655", "0.6596163", "0.6596081", "0.6587272", "0.658485...
0.0
-1
Extract number from string.
def get_number(text): # if (isinstance(text, str) or isinstance(text, unicode)): if True: text.replace(",",".") text = re.sub("\xa0","", text) rst = re.findall("[0-9]+\.{0,1}[0-9]*", text) if rst: rst = rst[0] else: rst = "nan" else: rst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumFromString(self, string):\n \n m = re.search(r'\\d+$', string)\n if m is not None:\n return int(m.group())\n else:\n return 0", "def find_number(self, string):\n #string = string.encode('ascii', 'ignore')\n #return int(filter(str.isdigit, stri...
[ "0.77379173", "0.7693082", "0.74840516", "0.73821986", "0.73413527", "0.73124546", "0.72008556", "0.71422917", "0.70899296", "0.70725447", "0.70215183", "0.7020617", "0.6971994", "0.6915471", "0.69110984", "0.67833114", "0.6762571", "0.6740995", "0.667752", "0.6662119", "0.66...
0.6420083
35
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary application_restore_objects = None if dictionary.get('applicationRestoreObjects') != None: application_restore_objects = list(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.0
-1
Returns the distance between point a and b
def distance(a,b): return math.sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))", "def distance(a, b):\n ax, ay = a\n bx, by = b\n dx = bx - ax\n dy = by - ay\n return (abs(dx) + abs(dy) + abs(dx - dy)) / 2", "def distance(a, b):\n return math.sqrt((a.x - b.x...
[ "0.89436543", "0.8793485", "0.877518", "0.8699922", "0.8699736", "0.85757345", "0.8559321", "0.85422933", "0.8519206", "0.8496124", "0.8491182", "0.8467624", "0.8454343", "0.8448204", "0.83784014", "0.83561504", "0.8355257", "0.8339597", "0.8136336", "0.8117115", "0.8106733",...
0.82824945
18
Returns true iff point c intersects the line segment from a to b
def is_on(a, b, c): return(isCollinear(a, b, c) and (within(a[0], c[0], b[0]) if a[0] != b[0] else within(a[1], c[1], b[1])))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle_point_intersects(a, b, c, s):\n return (\n line_ccw(a, b, c) == line_ccw(a, b, s) and\n line_ccw(b, c, a) == line_ccw(b, c, s) and\n line_ccw(c, a, b) == line_ccw(c, a, s)\n )", "def is_on_line(point_a, point_b, point_c):\r\n return (point_b[0] - point_a[0]) * (point_c[...
[ "0.78442276", "0.7745619", "0.7684103", "0.75799155", "0.7465657", "0.7365313", "0.7256164", "0.72147787", "0.7184703", "0.7145719", "0.7143656", "0.714278", "0.7115458", "0.7057952", "0.7025709", "0.7018279", "0.7015748", "0.7009866", "0.69651437", "0.695812", "0.6947701", ...
0.6911741
21
Returns True if the list of points contains collinear points, False if not
def hasCollinearPoints(listOfPoints): for points in listOfPoints: if isCollinear(points[0], points[1], points[2]): #If any of the points are collinear return True else: pass return False #If none of the points are collinear
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_collinear(*points: Point, tolerance: float = 1e-2) -> bool:\n if len(points) < 3:\n raise ValueError(\"CurveChecker.assert_collinear() must be called with at least three points\")\n\n thetas = [np.arctan2(p0[1] - p1[1], p0[0] - p1[0]) for p0, p1 in zip(points, points[1:])]\n for t0, t1 i...
[ "0.7421417", "0.7090952", "0.7080276", "0.70396364", "0.68133307", "0.6784668", "0.6733284", "0.6707415", "0.6630739", "0.6605163", "0.6556163", "0.6528503", "0.6493936", "0.64693415", "0.6435088", "0.6398559", "0.63703936", "0.6363428", "0.6346839", "0.633933", "0.6316365", ...
0.91530555
0
Provides a tensor of labels for a sentence
def labels_of_sentence(self, sentence, split): self._manual_setup() if self.cache is None: labels = self._labels_of_sentence(sentence, split) return labels # Otherwise, either read from or write to cache if split == TRAIN_STR and self.train_cache: return next(self.train_cache) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _labels_of_sentence(self, sentence, split):\n labels = torch.ones(1)\n labels[0] = self.category_int_of_label_string(sentence[0][self.name_to_index_dict['label']]) #\n return labels", "def _labels_of_sentence(self, sentence, esplit):\n\n labels = torch.zeros(len(sentence))\n for token_index, t...
[ "0.7633192", "0.74526405", "0.7438841", "0.71451473", "0.6762559", "0.6646994", "0.65556735", "0.65207595", "0.6427919", "0.64105254", "0.6357295", "0.63412035", "0.6334646", "0.62953913", "0.62874544", "0.6285283", "0.62676525", "0.62660605", "0.62401193", "0.62401193", "0.6...
0.5867349
92
Provides a tensor of labels for a sentence; no caching
def _labels_of_sentence(self, sentence, esplit): labels = torch.zeros(len(sentence)) for token_index, token_attribute_list in enumerate(sentence): label_string = token_attribute_list[self.task_label_index] labels[token_index] = self.category_int_of_label_string(label_string) return labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _labels_of_sentence(self, sentence, split):\n labels = torch.ones(1)\n labels[0] = self.category_int_of_label_string(sentence[0][self.name_to_index_dict['label']]) #\n return labels", "def _labels_of_sentence(self, sentence, split):\n #print(self.label_vocab)\n self.category_int_of_label_strin...
[ "0.76675564", "0.75061345", "0.7251737", "0.67914265", "0.67559904", "0.66362303", "0.65498954", "0.64939016", "0.64492726", "0.6421228", "0.63688195", "0.6367366", "0.6363684", "0.63294405", "0.6285814", "0.62503785", "0.6245327", "0.62333935", "0.6225621", "0.6213378", "0.6...
0.75278974
1
Provides a tensor of labels for a sentence; no caching Optionally limits
def _labels_of_sentence(self, sentence, split): labels = torch.zeros(len(sentence)) for token_index, token_attribute_list in enumerate(sentence): label_string = token_attribute_list[self.task_label_index] if self.train_types_only: word_type = token_attribute_list[self.input_fields.index('to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _labels_of_sentence(self, sentence, split):\n labels = torch.ones(1)\n labels[0] = self.category_int_of_label_string(sentence[0][self.name_to_index_dict['label']]) #\n return labels", "def _labels_of_sentence(self, sentence, esplit):\n\n labels = torch.zeros(len(sentence))\n for token_index, t...
[ "0.73730224", "0.7153044", "0.7138539", "0.6724346", "0.6569151", "0.6557397", "0.635572", "0.631755", "0.631755", "0.631755", "0.631755", "0.6265511", "0.62584513", "0.61942625", "0.61746794", "0.6134543", "0.6134543", "0.6127364", "0.61165136", "0.61165136", "0.61165136", ...
0.6932934
3
Provides a tensor of labels for a sentence; no caching
def _labels_of_sentence(self, sentence, split): #print(self.label_vocab) self.category_int_of_label_string('O') bioes_tags = self._string_labels_of_sentence(sentence) labels = torch.zeros(len(sentence)) for index, label in enumerate(bioes_tags): labels[index] = self.category_int_of_label_strin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _labels_of_sentence(self, sentence, split):\n labels = torch.ones(1)\n labels[0] = self.category_int_of_label_string(sentence[0][self.name_to_index_dict['label']]) #\n return labels", "def _labels_of_sentence(self, sentence, esplit):\n\n labels = torch.zeros(len(sentence))\n for token_index, t...
[ "0.76675564", "0.75278974", "0.7251737", "0.67914265", "0.67559904", "0.66362303", "0.65498954", "0.64939016", "0.64492726", "0.6421228", "0.63688195", "0.6367366", "0.6363684", "0.63294405", "0.6285814", "0.62503785", "0.6245327", "0.62333935", "0.6225621", "0.6213378", "0.6...
0.75061345
2
Provides a tensor of labels for a sentence; no caching
def _labels_of_sentence(self, sentence, split): labels = torch.ones(1) labels[0] = self.category_int_of_label_string(sentence[0][self.name_to_index_dict['label']]) # return labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _labels_of_sentence(self, sentence, esplit):\n\n labels = torch.zeros(len(sentence))\n for token_index, token_attribute_list in enumerate(sentence):\n label_string = token_attribute_list[self.task_label_index]\n labels[token_index] = self.category_int_of_label_string(label_string)\n return l...
[ "0.75278974", "0.75061345", "0.7251737", "0.67914265", "0.67559904", "0.66362303", "0.65498954", "0.64939016", "0.64492726", "0.6421228", "0.63688195", "0.6367366", "0.6363684", "0.63294405", "0.6285814", "0.62503785", "0.6245327", "0.62333935", "0.6225621", "0.6213378", "0.6...
0.76675564
0
Correct initial value of learning rate Learning rate is normally not printed until after the initial test and training step, which means the initial testing and training rows have LearningRate = NaN. Fix this by copying over the LearningRate from the second row, if it exists.
def fix_initial_nan_learning_rate(dict_list): if len(dict_list) > 1: dict_list[0]['LearningRate'] = dict_list[1]['LearningRate']
{ "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(self...
[ "0.6768827", "0.6768827", "0.67010623", "0.6651517", "0.6617209", "0.6617089", "0.6538696", "0.6489587", "0.63844854", "0.6331242", "0.6324924", "0.6298766", "0.62934715", "0.62894815", "0.6259135", "0.6252254", "0.6227886", "0.6210034", "0.6202021", "0.61548364", "0.6143069"...
0.72049683
0
Lets split our dataframe into a train and test set
def train_test_split(df, test_size=0.3): # split df here train_size = int(df.shape[0] * (1 - test_size)) test_size = df.shape[0] - train_size train = df[:train_size] test = df[train_size:] return train, test # return the train and test datasets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_test_split(df):\n training_size = int(len(df) * .67)\n test_size = int(len(df) - training_size)\n train, test = df[0:training_size], df[training_size:len(df)]\n return train, test", "def split_data(df: pd.DataFrame):\n size = int(df.shape[0] * 0.8)\n indexes = np.random.choice(df.inde...
[ "0.86475015", "0.8354764", "0.83336425", "0.8326615", "0.83220124", "0.82861865", "0.82702154", "0.82519627", "0.8249891", "0.8197455", "0.8175665", "0.8162518", "0.81209254", "0.7913004", "0.7909744", "0.7904663", "0.7842215", "0.7732526", "0.7723425", "0.7675278", "0.766974...
0.87321454
0
Return a queryset that contains the current instance only.
def qs(self) -> MIZQuerySet: if isinstance(self, type): raise TypeError( f"Calling qs() from class level is prohibited. Use {self.__name__}.objects instead." ) # noinspection PyUnresolvedReferences return self._meta.model.objects.filter(pk=self.pk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queryset(self, request, queryset):\n\n return (\n queryset if self.value() is None\n else queryset.filter(instrument__id=self.value())\n )", "def get_queryset(self):\n if getattr(self, 'use_this_queryset', None):\n return self.use_this_queryset\n r...
[ "0.7233966", "0.7232219", "0.71482134", "0.7080837", "0.6943455", "0.6900099", "0.68274784", "0.6803888", "0.67920953", "0.6754965", "0.67368996", "0.67081106", "0.6697828", "0.66588944", "0.6651975", "0.6631959", "0.6621603", "0.6604922", "0.65966076", "0.6595515", "0.658584...
0.7061662
4
Add annotations and optimizations useful for an overview over objects of this model to the given queryset. If `annotations` is given, only apply matching annotations.
def overview(cls, queryset, *annotations): if select_related := cls.select_related: queryset = queryset.select_related(*select_related) if prefetch_related := cls.prefetch_related: queryset = queryset.prefetch_related(*prefetch_related) if all_annotations := cls.get_overv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotate(self, **annotations):\n return AnnotatedQuery(self, annotations)", "def annotate(self, **annotations):\n _check_annotations(annotations)\n self.annotations.update(annotations)", "def annotate(self, *args, **kwargs):\n self._not_support_combined_queries(\"annotate\")\n ...
[ "0.65685785", "0.5866021", "0.54998356", "0.5483387", "0.5405466", "0.538402", "0.5339501", "0.5286085", "0.52613825", "0.52430934", "0.52145547", "0.5067361", "0.5067361", "0.5024573", "0.5020363", "0.49947312", "0.4994107", "0.49529073", "0.4925285", "0.485336", "0.48532107...
0.84806633
0
Return a string representation of this instance. Combines the values of the ForeignKey fields of this model.
def __str__(self) -> str: if self.name_field: return str(getattr(self, self.name_field)) # noinspection PyUnresolvedReferences data = [ # Collect the string representations of related objects. # getattr(self, fk_field.attname) and # fk_field.value_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n model_fields = get_model_fields(\n opts.model,\n ...
[ "0.7180453", "0.7063152", "0.66812104", "0.66250813", "0.65785676", "0.6537082", "0.65302354", "0.6496612", "0.64646924", "0.64646924", "0.64593154", "0.64593154", "0.6447051", "0.6435329", "0.6435175", "0.6420463", "0.6418382", "0.6401425", "0.63658315", "0.6351427", "0.6347...
0.7895634
0
Yield successive nsized chunks from l.
def chunks(l, n): for index in xrange(0, len(l), n): yield l[index:index + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.0
-1
Return tuple of (width, height) of screen resolution in pixels.
def get_screen_resolution() -> tuple: root = tkinter.Tk() root.withdraw() return root.winfo_screenwidth(), root.winfo_screenheight()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getScreenDims(self):\n nes_lib.getScreenHeight.argtypes = [c_void_p]\n nes_lib.getScreenHeight.restype = c_int\n nes_lib.getScreenWidth.argtypes = [c_void_p]\n nes_lib.getScreenWidth.restype = c_int\n width = nes_lib.getScreenWidth(self.obj)\n height = nes_lib.getScree...
[ "0.8203829", "0.8127261", "0.8030692", "0.801898", "0.79001886", "0.78191257", "0.77617353", "0.7523849", "0.74164426", "0.7346486", "0.7099414", "0.70678407", "0.7058346", "0.70498407", "0.70390517", "0.7010935", "0.69222224", "0.6844366", "0.6785893", "0.67808294", "0.67675...
0.84009147
0
The subpath to the template source directory.
def src_subpath(self) -> str: val = self.get("src_subpath", "public").strip() if len(val) > 0: return val return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSrcDir(self):\n if self.srcdir == None:\n tmpl = self.getTmplDir()\n self.srcdir = os.path.join(tmpl, 'template', self.args.tmpl)\n return self.srcdir", "def _find_base_path(self):\n paths = [path for path, content in self._templates]\n if len(paths) == 1:...
[ "0.75856274", "0.72184086", "0.72040915", "0.71801096", "0.71522135", "0.7110129", "0.7033525", "0.70139134", "0.69697696", "0.6946601", "0.6929383", "0.69238436", "0.6869233", "0.6783497", "0.67746055", "0.6746368", "0.67353374", "0.6723021", "0.67179376", "0.66053903", "0.6...
0.69886315
8
The subpath to the template source directory.
def src_subpath(self, val: str): self["src_subpath"] = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSrcDir(self):\n if self.srcdir == None:\n tmpl = self.getTmplDir()\n self.srcdir = os.path.join(tmpl, 'template', self.args.tmpl)\n return self.srcdir", "def _find_base_path(self):\n paths = [path for path, content in self._templates]\n if len(paths) == 1:...
[ "0.75856274", "0.72184086", "0.72040915", "0.71801096", "0.71522135", "0.7110129", "0.7033525", "0.70139134", "0.69886315", "0.69697696", "0.6946601", "0.6929383", "0.69238436", "0.6869233", "0.6783497", "0.67746055", "0.6746368", "0.67353374", "0.6723021", "0.67179376", "0.6...
0.0
-1
Returns the config of the command handler for the module by the name.
def get_module_command_handler_config(self, name: str): handler = self.get_module_command_handler(name) if handler is None or not hasattr(handler, FILEBASE_API_API_METHOD_MARKER_CONFIG_ATTRIB_NAME): return None return getattr(handler, FILEBASE_API_API_METHOD_MARKER_CONFIG_ATTRIB_NAM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_module_config(name):\n return _CONFIGS[name]", "def get_config(name: str):\n conf_file = Path(__file__).parent.joinpath(\"configs\").joinpath(name)\n return console.read_config(conf_file)", "def get_module_command_handler(self, name: str) -> Callable:\n if self.module is None:\n ...
[ "0.72854984", "0.6690883", "0.6655319", "0.6561855", "0.638901", "0.6338779", "0.6271329", "0.62536776", "0.62471986", "0.60725015", "0.6071195", "0.6058717", "0.60383934", "0.6038057", "0.60347384", "0.6027689", "0.59903604", "0.59708947", "0.5957921", "0.5918792", "0.591596...
0.81698024
0
The associated websocket if this is a websocket call (if any)
def websocket(self) -> FilebaseApiWebSocket: return self._ws
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def websocket(self):\n return self._websocket_client.wss", "def is_websocket_state(self) -> bool:\n return self.websocket is not None", "def getWebsocketAddress(self):\r\n return self._endpoint.getWebsocketAddress()", "def get_curr_connection(self):\n if not self._ws:\n ...
[ "0.7512004", "0.64862096", "0.63381284", "0.62801164", "0.6138468", "0.61241406", "0.6105022", "0.61046845", "0.60651845", "0.60328686", "0.60054106", "0.60023224", "0.5988893", "0.594512", "0.5919132", "0.58334404", "0.58285874", "0.5827377", "0.5772439", "0.5751141", "0.568...
0.69039625
1
Set the player_number of our actor, so that we can tell our MCTS which actor we are.
def handle_series_start(self, unique_id, series_id, player_map, num_games, game_params): self.series_id = series_id self.board_size = game_params[0] ############################# # # learning_rate = 0.001 NN_structure = [128,128,128] optimizer_ = 'Adam' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_number(self, number):\n self.number = number", "def set_player_id(self, player_id):\n self.player_id = player_id", "def set_player(self, new_player):\n self.player = new_player", "def change_player(self):\n if self.__root.children is None:\n if self.__root.win[0...
[ "0.6179841", "0.6176695", "0.6093636", "0.6062521", "0.60140693", "0.60140693", "0.5967024", "0.59655344", "0.58397114", "0.57751215", "0.5762645", "0.5736783", "0.57279825", "0.57062703", "0.56779444", "0.56611997", "0.5584991", "0.5575513", "0.55389434", "0.5507975", "0.548...
0.0
-1
r""" Copies the modules' saved parameters back to the normal weights to allow for backpropagation
def restore(self): pert_params = list(self.net.parameters()) saved_params = list(self.saved_net.parameters()) for perturbed, saved in zip(pert_params, saved_params): perturbed_shape = perturbed.shape saved_shape = saved.shape perturbed = perturbed.flatten() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_fast_weights(self):\n for group in self.optimizer.param_groups:\n for p in group[\"params\"]:\n param_state = self.state[p]\n p.data.copy_(param_state[\"backup_params\"])\n del param_state[\"backup_params\"]", "def reset_parameters(self) ...
[ "0.70343876", "0.6929818", "0.68515986", "0.676677", "0.67303187", "0.66237044", "0.66195077", "0.6590421", "0.65590507", "0.65569586", "0.6529367", "0.6514517", "0.64915", "0.6486136", "0.64430135", "0.64068586", "0.64068586", "0.64007336", "0.6388214", "0.63864124", "0.6376...
0.6727065
5
Get current authenticated user.
async def get_user( token: str = Depends(get_token), users: UserRepository = Depends() ) -> User: user = await users.get(token=token) if user: return user raise HTTPException(status_code=403, detail="Invalid token")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user(self):\n user_dict = self.auth.get_user_by_session()\n return self.auth.store.user_model.get_by_id(user_dict['user_id'])", "def get_current_user(self):\n return self.get_secure_cookie(\"user\")", "def get_logged_in_user(self):\n return self.session_mgr.get_logged_in_user()"...
[ "0.8571876", "0.85515493", "0.8519226", "0.8518644", "0.85126567", "0.84409165", "0.83612144", "0.82615393", "0.82615393", "0.81365633", "0.81365633", "0.81365633", "0.808582", "0.8018222", "0.8017955", "0.79994124", "0.7988795", "0.79841006", "0.79564947", "0.7919046", "0.79...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, AddDataOptionalParam): 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
Test that we can solvate CB6BUT using default settings.
def test_solvation_simple(self): waters = np.random.randint(1000, 10000) log.debug('Trying {} waters with default settings...'.format(waters)) solvate(tleapfile='./cb6-but/tleap.in', pdbfile='cb6-but.pdb', bufferwater=waters) grepped_waters = sp.check_output(["grep -oh 'W...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bw40_auto(self, setUp):\n\n self.common_channel(band='40', channel='0')", "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def test_configuration():\n config = Configuration()\n\n assert config.relay_pin...
[ "0.59080553", "0.59022135", "0.59022135", "0.57441473", "0.5736499", "0.5734828", "0.572405", "0.5723549", "0.5723512", "0.570715", "0.5684505", "0.5636447", "0.56213325", "0.5612155", "0.5605271", "0.5604381", "0.55830157", "0.5575312", "0.55703926", "0.5564534", "0.55503356...
0.0
-1
Test that we can solvate CB6BUT after alignment.
def test_alignment_workflow(self): cb6 = pmd.load_file('./cb6-but/vac.pdb') align(cb6, ':CB6', ':BUT', save=True, filename='./cb6-but/tmp.pdb') waters = np.random.randint(1000, 10000) log.debug('Trying {} waters after alignment...'.format(waters)) solvate(tleapfile='./cb6-but/tle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_attempt_bc_correction_hamming8(self):\r\n\r\n curr_bc = \"AGCAGCAC\"\r\n all_bcs = [\"AGCAGAAC\", \"TGCAGTAC\", \"ACAGAGTC\"]\r\n barcode_type = \"hamming_8\"\r\n actual_bc, actual_errs = attempt_bc_correction(curr_bc,\r\n a...
[ "0.6348653", "0.6057476", "0.6055911", "0.60175234", "0.59462845", "0.59276086", "0.5807655", "0.5713912", "0.5703765", "0.56379324", "0.5595034", "0.557872", "0.5567587", "0.55536944", "0.5549737", "0.5486054", "0.5478163", "0.5465785", "0.54629385", "0.54577285", "0.5439462...
0.69005454
0
Determine the time zone offset for the given timestamp, using the. time zone name set in the P4GF time zone counter. For example, with time zone 'US/Pacific' and timestamp 1371663968, the offset returned will be the string '0700'.
def __get_timezone_offset(self, timestamp): try: ts = int(timestamp) except ValueError: LOG.error("__get_timezone_offset() given non-numeric input {}".format(timestamp)) if self.__tzname is None: r = self.ctx.p4.run('counter', '-u', p4gf_const.P4GF_COUNTER_TIM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_utc_offset(timestamp: str):\n offset_direction = timestamp[-5] # A plus or minus sign\n offset_hours = int(timestamp[-4:-2])\n offset_minutes = int(timestamp[-2:])\n offset_seconds = offset_hours * 3600 + offset_minutes * 60\n return datetime.timezone(datetime.timedelta(...
[ "0.77218825", "0.7023838", "0.68059814", "0.66974765", "0.6428055", "0.6373265", "0.63631135", "0.6331677", "0.6208793", "0.6184792", "0.6178788", "0.6134264", "0.61226845", "0.6104191", "0.6103491", "0.60706764", "0.60646605", "0.60517627", "0.5873172", "0.5853053", "0.58061...
0.78259754
0
get human's first/last name for a user
def __full_name_for_user(self, username): # First check our cache of previous hits. if username in self.username_map: return self.username_map[username] # Fall back to p4gf_usermap, p4 users. user_3tuple = self.usermap.lookup_by_p4user(username) if user_3tuple: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_firstname_lastname(self, record):\n lower_first_name, lower_last_name = self.clean_user_names(record)\n\n #No first name and last name check email\n if lower_first_name is None and lower_last_name is None:\n\n lower_first_name, lower_last_name = \\\n se...
[ "0.81253433", "0.80418694", "0.80048645", "0.79458046", "0.7798828", "0.77899486", "0.7760679", "0.7752513", "0.77258176", "0.7725709", "0.77069265", "0.769502", "0.7681346", "0.76361895", "0.7592645", "0.75834364", "0.75565404", "0.7507657", "0.7503546", "0.7502552", "0.7482...
0.0
-1
Return map of LOS velocity at a given time for a given instrument resolution.
def make_los_velocity_map(time: u.s, field, instr, **kwargs): plot_settings = {'cmap': cm.get_cmap('bwr'), 'norm': colors.SymLogNorm(10, vmin=-1e8, vmax=1e8)} plot_settings.update(kwargs.get('plot_settings', {})) bins, bin_range = instr.make_detector_array(field) visible = is_visib...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lspe_coordinates (self, time):\n\n return (self.base_lat,\n self.base_long\n + time * 2 * np.pi * (1 + 1 / self.rev_days) / SECONDS_PER_DAY)", "def get_vsolar(self):\n return self.read_register(4098, 1, 3)", "def target_velocity(self, time):\n\n x_v = self...
[ "0.6022048", "0.5431379", "0.54237163", "0.5304054", "0.52471644", "0.5243057", "0.52149034", "0.51837087", "0.5157578", "0.5153102", "0.5153102", "0.5145083", "0.5142027", "0.5097", "0.5092783", "0.50844187", "0.5084345", "0.5067277", "0.505423", "0.50330955", "0.5032764", ...
0.6832797
0
Add a ``/`` to the end of the path part of a URL if there isn't one.
def clean_url(url: str) -> str: r = urlparse(url) parts = list(r) # Add a / to the end of the path if it isn't there if not parts[2].endswith("/"): parts[2] += "/" return urlunparse(parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ends_slash(url):\n return url if url.endswith(\"/\") else url + \"/\"", "def add_closing_slash(url_path: str) -> str:\r\n if url_path[-1:] != \"/\":\r\n url_path = url_path + \"/\"\r\n return url_path", "def fix_url_path(url: str) -> str:\n return url if url.endswith(\"/\") else url + \"...
[ "0.77813625", "0.7560367", "0.7476204", "0.73775727", "0.6920676", "0.6844311", "0.6628404", "0.65950286", "0.65861773", "0.65334946", "0.65045154", "0.6449289", "0.6425955", "0.639948", "0.6395555", "0.6372957", "0.6369524", "0.63251096", "0.6321981", "0.62701225", "0.626395...
0.5883198
59
Computes distance between two rectangles specified by corners.
def rectangle_distance(x1, y1, x1b, y1b, x2, y2, x2b, y2b): # From https://stackoverflow.com/questions/4978323/ left = x2b < x1 right = x1b < x2 bottom = y2b < y1 top = y1b < y2 if top and left: return distance(x1, y1b, x2b, y2) elif left and bottom: return distance(x1, y1, x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_from_corners(self, x: int, y: int) -> float:\n corners = self._find_corners()\n dis = sum([distance(x, y, a, b) for a, b in corners])\n return dis", "def rect_delta(rect1, rect2):\n rect1_area = rect_area(rect1)\n\n return float(rect1_area - rect_overlap(rect1, rect2)) / r...
[ "0.664094", "0.5945949", "0.59302294", "0.5893882", "0.58615994", "0.5846764", "0.58248484", "0.581344", "0.5812294", "0.5789009", "0.57213247", "0.5711634", "0.5707684", "0.5676806", "0.5652074", "0.5632851", "0.5628602", "0.55876994", "0.55838364", "0.55692524", "0.5560981"...
0.6891776
0
Computes distance between two rectangles specified by corners. The distance metric is their x distance if they are in the same row, y distance if same col, otherwise inf.
def row_col_distance(x1, y1, x1b, y1b, x2, y2, x2b, y2b): def flat_dist(z1, z1b, z2, z2b): """z1, ..., z2b, are all x coords or all y coords of a corner. Returns the distance between 1 and 2. z1 >= z1b, z2 >= z2b""" assert z1 >= z1b assert z2 >= z2b if z1 > z2 and z1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangle_distance(x1, y1, x1b, y1b, x2, y2, x2b, y2b):\n # From https://stackoverflow.com/questions/4978323/\n left = x2b < x1\n right = x1b < x2\n bottom = y2b < y1\n top = y1b < y2\n if top and left:\n return distance(x1, y1b, x2b, y2)\n elif left and bottom:\n return dist...
[ "0.6950202", "0.6929587", "0.63661236", "0.61704826", "0.6143578", "0.6037531", "0.60308945", "0.6001459", "0.5992535", "0.59630877", "0.5958687", "0.59574723", "0.5948512", "0.5936569", "0.5927653", "0.5916477", "0.59053206", "0.58886695", "0.5864382", "0.58641106", "0.58547...
0.6165578
4
Numerically stable cumulative product by cumulative sum in logspace
def cumprod(x, dim=-1, exclusive=False): if exclusive: length = x.size(dim) x = torch.narrow(F.pad(x, pad=(1, 0, 0, 0), value=1.0), dim, 0, length) return torch.cumprod(x, dim=dim)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_cum_sum(A, output_sum=False):\n C = [A[0]]\n for a in A[1:]:\n C.append(log_add(C[-1], a))\n C_norm = np.array(C) - C[-1]\n if output_sum:\n return C_norm, C[-1]\n else:\n return C_norm", "def safe_cumprod(x, eps):\n return torch.exp(exclusive_cumsum(torch.log(torch.clamp(x, min=eps, max...
[ "0.6743707", "0.6712568", "0.6532089", "0.6394644", "0.63145477", "0.62548614", "0.6184599", "0.618202", "0.612796", "0.6088546", "0.59717244", "0.59582067", "0.5896176", "0.589534", "0.5836424", "0.5827925", "0.5808574", "0.5805297", "0.5781801", "0.5764621", "0.5764476", ...
0.5961325
11
Compute the moving sum of x over a window with the provided bounds. x is expected to be of shape (batch_size, sequence_length). The returned tensor x_max is computed as x_max[i, j] = max(x[i, j window + 1], ..., x[i, j])
def moving_max(x, w): # Pad x with -inf at the start x = F.pad(x, pad=(w - 1, 0), value=float("-inf")) # Add "channel" dimension (max_pool operates on 1D) x = x.unsqueeze(1) x = F.max_pool1d(x, kernel_size=w, stride=1).squeeze(1) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moving_sum(x, back, forward):\n # Pad window before applying convolution\n # [batch_size, back + sequence_length + forward]\n x_padded = F.pad(x, pad=(back, forward))\n\n # Fake channel dimension for conv1d\n # [batch_size, 1, back + sequence_length + forward]\n x_padded = x_padded.unsquee...
[ "0.6197078", "0.5975352", "0.585098", "0.58083296", "0.57451665", "0.5703335", "0.5696928", "0.56892365", "0.563994", "0.5614588", "0.5608574", "0.55215454", "0.54030335", "0.534649", "0.53079367", "0.53075355", "0.52992946", "0.52962106", "0.52953625", "0.5291361", "0.526493...
0.658622
0
Return all the inbound connection layer names for the layer.
def _get_inbound_layer_names(self, layer): inbound_layer_names = [] for inbound_node in self._inbound_node_generator(layer): # TODO(b/197935452): temporary fix when the input is a dictionary of # tensors. A comprehensive solution may be needed. if isinstance(inbound_node, dict): inboun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_input_layer_names(self, layer):\n if self._is_functional_model(self.model):\n inbound_nodes = layer['inbound_nodes']\n return [connection_info[0] for connection_info in inbound_nodes[0]]\n else: # Sequential model.\n layers = self._config['layers']\n i = layers.index(layer)\n ...
[ "0.79535574", "0.74204594", "0.69721764", "0.6950132", "0.67388475", "0.6392184", "0.6206379", "0.61832464", "0.61069447", "0.6067602", "0.60085857", "0.5993531", "0.5917675", "0.5892441", "0.5862271", "0.582579", "0.5746387", "0.5727739", "0.5720989", "0.57039493", "0.569338...
0.87165093
0
Returns all the layers which are out nodes from the layer.
def _get_consuming_layers(self, check_layer): consuming_layers = [] check_layer_name = check_layer['config']['name'] for layer in self._config['layers']: if check_layer_name in self._get_inbound_layer_names(layer): consuming_layers.append(layer) return consuming_layers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layers(self):\n\n if not self.last_node:\n return []\n return nuke.layers(self.last_node)", "def getOutEdges(self):\n edges = []\n for edict in mm.G[self].values():\n for k in edict.keys():\n edges.append(edict.get(k).get(\"edge\"))\n \n...
[ "0.709377", "0.66400844", "0.655851", "0.6493307", "0.623304", "0.6191962", "0.6187802", "0.6182203", "0.616724", "0.6079425", "0.60270447", "0.59757304", "0.59682405", "0.5951588", "0.5920442", "0.5885003", "0.5874266", "0.5851527", "0.5837367", "0.58270323", "0.58083737", ...
0.53889006
65
Check if ModelTransformer supports transformations given number of inputs and outputs at a layer.
def _is_match_supported(self, layer, is_head_node): inbound_nodes = layer['inbound_nodes'] if len(inbound_nodes) > 1: # `layer` is re-used for more than 1 connection from previous layers. If # a pattern matches one set of inputs and is replaced, it will break the # other connection. # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_supported(input_x, input_y, bias=None, output_z={}, trans_a=False,\n trans_b=False, kernel_name=\"matmul\"):\n shape_a = input_x.get(\"shape\")\n shape_b = input_y.get(\"shape\")\n src_dtype = input_x.get(\"dtype\")\n util.check_kernel_name(kernel_name)\n util.check_shap...
[ "0.6102859", "0.5755928", "0.5755928", "0.5634628", "0.5548429", "0.554829", "0.5502053", "0.5485601", "0.5483515", "0.5340284", "0.5306273", "0.52937686", "0.52897626", "0.5257676", "0.525277", "0.5240802", "0.5185512", "0.5171018", "0.5161673", "0.51510733", "0.51271033", ...
0.57000196
3
Get the names of a layer's input layers.
def _get_input_layer_names(self, layer): if self._is_functional_model(self.model): inbound_nodes = layer['inbound_nodes'] return [connection_info[0] for connection_info in inbound_nodes[0]] else: # Sequential model. layers = self._config['layers'] i = layers.index(layer) if i == 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_inbound_layer_names(self, layer):\n inbound_layer_names = []\n for inbound_node in self._inbound_node_generator(layer):\n # TODO(b/197935452): temporary fix when the input is a dictionary of\n # tensors. A comprehensive solution may be needed.\n if isinstance(inbound_node, dict):\n ...
[ "0.7958569", "0.75536776", "0.7385108", "0.7346697", "0.7134956", "0.7081401", "0.70404625", "0.6999719", "0.69111854", "0.6901708", "0.6861955", "0.6841928", "0.67502224", "0.6742784", "0.6655954", "0.6628915", "0.6612524", "0.6503373", "0.6408949", "0.6401098", "0.6355295",...
0.83258146
0
Extracts the weight name by removing layer from TF variable name.
def _weight_name(self, name): return name.split('/')[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_embedding_layer_name_from_var(var):\n # Assumes that for ElasticDL embedding layer, variable will be a\n # string representing its layer name\n if isinstance(var, str):\n return var\n return None", "def extract_weights(self, name):\n\n # Extract weights\n weight_layer = ...
[ "0.65886426", "0.6024206", "0.5959093", "0.589764", "0.58954316", "0.5894907", "0.5818142", "0.5805167", "0.57902527", "0.57860255", "0.5743607", "0.57401985", "0.5736452", "0.57295346", "0.57279736", "0.57181054", "0.56707186", "0.5608376", "0.5606752", "0.56016076", "0.5590...
0.6309701
1
Sets the values of weights in a Keras layer.
def _set_layer_weights(self, layer, weights_map): weight_value_tuples = [] for weight_tensor in layer.weights: weight_name = self._weight_name(weight_tensor.name) if weight_name in weights_map: weight_value_tuples.append((weight_tensor, weights_map[weight_name])) K.batch_set_value(weig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_weights(self, weights):\n tuples = []\n for layer in self.layers:\n num_param = len(layer.weights)\n layer_weights = weights[:num_param]\n for sw, w in zip(layer.weights, layer_weights):\n tuples.append((sw, w))\n weights = weights[num_param:]\n K.batch_set_value(tuples)...
[ "0.8254819", "0.790198", "0.77381283", "0.7728647", "0.7726482", "0.7681645", "0.7670822", "0.75297874", "0.73252094", "0.73252094", "0.7306705", "0.7290871", "0.7181071", "0.71274585", "0.7112225", "0.70822555", "0.70816183", "0.7066907", "0.70620877", "0.7045611", "0.704419...
0.7493721
8
Get batch of patches from source raster
def get_batch(self, src, geometries): batch = [] for bounds in geometries.bounds.itertuples(): bot, left = src.index(bounds[1], bounds[2]) top, right = src.index(bounds[3], bounds[4]) window = rasterio.windows.Window(left, top, right-left, bot-top) batch....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_patches(img, patch_s):\n def np_extract_patches(img):\n orig = np.array(img.shape[:2])\n new = patch_s[0] * np.ceil(orig / patch_s[0]).astype(int)\n points = new - orig\n img = np.pad(img, [(0, points[0]), (0, points[1]), (0, 0)],\n ...
[ "0.73309374", "0.68934095", "0.6833312", "0.67783153", "0.67205703", "0.6699947", "0.65656865", "0.6563666", "0.65290356", "0.65018827", "0.6406049", "0.6403912", "0.639977", "0.6389587", "0.63741976", "0.6330082", "0.6305813", "0.6253377", "0.62508744", "0.6198837", "0.61941...
0.69629455
1
Local method to find the predecessor of the node
def FindPredeccesor(self, id): node = self.nodeInfo while True: succNode = self.RemoteGetSuccessor(node.Address) if self.IsInRange(id, node.HashValue, False,succNode.HashValue, True) == False: node = self.RemoteClosestPrecedingFinger(node.Address, id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predecessor(self, node):\n if node is None:\n return None\n if node.left_child is not None:\n pred = node.left_child\n while pred.right_child is not None:\n pred = pred.right_child\n return pred\n else:\n p = node.parent\n while p is not None:\n if node is n...
[ "0.85525703", "0.8060409", "0.7846785", "0.7680293", "0.7598868", "0.7543974", "0.7512033", "0.74554515", "0.7129717", "0.7125059", "0.7098016", "0.69520473", "0.6837189", "0.6822443", "0.6684301", "0.66685927", "0.66640186", "0.6638222", "0.65213186", "0.64929134", "0.649267...
0.5877609
70
Returns a generator that generates sequences in batches
def sequence_generator(self, split, batch_size, image_size): if split == 'train': df = self.train_df if split == 'validation': df = self.validation_df while True: # Load a random batch of video IDs and the corresponding labels video_ids, labels = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_batches(data, batch_size):\n data = np.array(data)\n\n for i in range(0, data.shape[0], batch_size):\n yield data[i:i+batch_size]", "def gen(num_batches,\n batch_size,\n seq_width,\n min_len,\n max_len):\n for batch_num in range(num_batches):\n\n # All b...
[ "0.7595446", "0.7570019", "0.72925305", "0.71779406", "0.71777004", "0.717469", "0.71338344", "0.71338344", "0.71338344", "0.71197075", "0.7108677", "0.709318", "0.7034662", "0.694488", "0.69352585", "0.6917848", "0.6913459", "0.68947846", "0.688771", "0.688563", "0.6872548",...
0.0
-1
gets shares per workspace
def get_workspace_shares(workspaces_dict, kb_staff): client = MongoClient(mongoDB_metrics_connection + to_workspace) db = client.workspace max_shared_count = 0 perms_dict = {10: "view", 20: "edit", 30: "admin"} shares_query = db.workspaceACLs.find( {"perm": {"$in": [10, 20, 30]}}, {"id": 1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_workspace_share_details():\n\n # connect to mysql\n db_connection = mysql.connect(\n host=sql_host, user=\"metrics\", passwd=metrics_mysql_password, database=\"metrics\"\n )\n\n cursor = db_connection.cursor()\n query = \"use \" + query_on\n cursor.execute(query)\n\n workspaces_...
[ "0.65139437", "0.63054276", "0.61448854", "0.609831", "0.60521346", "0.60031885", "0.594751", "0.5870468", "0.5800644", "0.5797525", "0.5675161", "0.5662835", "0.5640565", "0.5639666", "0.56150806", "0.55442786", "0.54940224", "0.5486155", "0.547889", "0.54624695", "0.5438821...
0.719158
0
Returns x for a given idx.
def get_input(self, idx): img_filename = self.root / "images" / self._image_array[idx] x = Image.open(img_filename) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__ (self, idx):\n return self.row(idx[0])[idx[1]]", "def __getitem__(self, i):\n return self.__x[i]", "def __getitem__(self, idx):\n return self.getitem(idx)", "def __getitem__(self, idx):\n assert(isinstance(idx, int))\n nidx = self._normalize_idx(idx)\n ...
[ "0.73830557", "0.72807217", "0.72095203", "0.7187324", "0.71183145", "0.69980365", "0.696129", "0.69323874", "0.68897754", "0.6885327", "0.688036", "0.6818033", "0.6816802", "0.6702032", "0.6702032", "0.66839224", "0.6668585", "0.6652264", "0.66482174", "0.66262376", "0.66262...
0.0
-1
Returns true if student is enrolled else false.
def is_enrolled(self, course): return bool( self.enrolled_courses_dict.get(course.get_namespace_name()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_student_enrolled(self, student_email):\n if not self.is_course_exists():\n print(\"Course with name - {} does not exist\".format(self._course_name))\n return\n course = self.get_course()\n for s in course._students:\n if s == student_email:\n ...
[ "0.8126032", "0.7564434", "0.7482116", "0.72469395", "0.69870216", "0.6880363", "0.6822904", "0.6683211", "0.6612921", "0.6477275", "0.6431483", "0.635405", "0.63100964", "0.62802535", "0.6277323", "0.6254838", "0.62295127", "0.6185011", "0.61419123", "0.60957515", "0.608499"...
0.75515515
2
Returns list of courses registered by student.
def get_enrolled_courses(self, courses): enrolled_courses = [] for course in courses: if self.is_enrolled(course): enrolled_courses.append(self.get_course_info(course)) return enrolled_courses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_student_courses(cls, user):\n member_record = CourseMember.objects.filter(user=user)\n member_teacher = member_record.filter(type = 3)\n student_list = []\n\n for member in member_teacher:\n if member.course.pk not in student_list:\n student_list.ap...
[ "0.6932861", "0.6907047", "0.6884693", "0.6869742", "0.68586296", "0.6855048", "0.65996426", "0.65471286", "0.6543456", "0.6543051", "0.6508013", "0.65009874", "0.6491006", "0.6485445", "0.6482703", "0.6446594", "0.64407617", "0.64306474", "0.6430036", "0.63964576", "0.635691...
0.5886917
50
Gets the months of the mortgage
def get_months(self): return self.__months;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def month(self):\n return self._months", "def _get_months(self, cr, uid, context):\n months=[(str(n),str(n)) for n in range(1,13)]\n return months", "def get_months(self):\n months = mcache.get_months()\n if months is not None:\n return months\n\n posts = self.ba...
[ "0.78539133", "0.7586287", "0.73032415", "0.7264079", "0.7183441", "0.7169279", "0.7112151", "0.7112151", "0.69857067", "0.6914436", "0.6905901", "0.6821646", "0.67456675", "0.6694782", "0.66866136", "0.6671499", "0.6671499", "0.6628175", "0.6591944", "0.65739965", "0.6563161...
0.8065687
0
checkpoint = torch.load(PATH) model.load_state_dict(checkpoint['modelA_state_dict'])
def load_models(self, episode): self.actor.load_state_dict(self.target_actor.state_dict()) self.critic.load_state_dict(self.target_critic.state_dict()) hard_update(self.target_actor, self.actor) hard_update(self.target_critic, self.critic)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_checkpoint(self, model):\n print(f\"load model {self.save_model_path}\")\n model.load_state_dict(torch.load(self.save_model_path))", "def load_checkpoint(model, save_path):\n model.load_state_dict(torch.load(save_path))", "def load_model_from_checkpoint(self, path: str):\n ckpt...
[ "0.815598", "0.80500335", "0.7925157", "0.77874094", "0.77797115", "0.77617335", "0.77617335", "0.77467966", "0.7719628", "0.76553005", "0.75652087", "0.7541595", "0.7521537", "0.7521117", "0.7514407", "0.7506065", "0.74975723", "0.74928534", "0.7478204", "0.74427867", "0.743...
0.0
-1
Aplica padding a una matriz
def padding(image, padded_size): image_row, image_col = image.shape #asigna alto y ancho de la imagen padded_image = np.zeros((image_row + padded_size*2, image_col + padded_size*2)) #matriz de imagen con padding en zeros print("Padded image zeros:") print(padded_image) padded_image[padded_size:pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_padding(kernel_size, stride, dilation):\n return -((-kernel_size - (kernel_size - 1) * (dilation - 1)) // stride + 1) // 2", "def padding(a, dim):\n\n return np.pad(a, (0, dim-len(a)), 'constant', constant_values=(0))", "def _padding(self, x, shape, value=0):\n row_padding = shape[0] - x....
[ "0.68298715", "0.68248665", "0.6786162", "0.6778636", "0.6759346", "0.67146754", "0.6689943", "0.6454501", "0.6439295", "0.6424021", "0.64172816", "0.6413171", "0.6407117", "0.6390251", "0.6380762", "0.634647", "0.6330269", "0.63174593", "0.63170314", "0.63123107", "0.6299436...
0.7330859
0
Iterates list to remove duplicates and return list
def remove_duplicates(list): x = 0 while x < len(list): y = x + 1 while y < len(list): if list[x] == list[y]: del list[y] else: y += 1 x += 1 return list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_duplicates(mylist):\n return list(set(mylist))", "def removeDuplicates(list):\n\treturn Set((item for item in list))", "def removeDuplicates(list):\n\treturn set((item for item in list))", "def remove_duplicates(self,list_):\r\n ret =[]\r\n\r\n for item in list_:\r\n if...
[ "0.8257772", "0.8242487", "0.82050616", "0.80007696", "0.80003065", "0.79858524", "0.796079", "0.7884095", "0.7864731", "0.7848045", "0.78107095", "0.77330434", "0.76898193", "0.75909024", "0.7462247", "0.7443621", "0.74303246", "0.7417903", "0.7415495", "0.7401926", "0.73752...
0.7057619
49
Construct an MPO from a list of Qobj operators. Manybody operators are put in MPO form by exact SVD, and virtual "left" and "right" indices with bond dimension one are added between the elements of the list.
def qobjlist_to_mpo(qobjlist): tensors = np.array([]) for i, qobj in enumerate(qobjlist): if not len(np.shape(qobj.dims)) == 2: # wrong dims (not a ket, bra or operator) raise ValueError("qobj element not a ket/bra/operator") t = qobj_to_tensor(qobj, trim_dummy=False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qobjlist_to_mps(qobjlist):\n mpo = qobjlist_to_mpo(qobjlist)\n tensors = mpo.data\n for t in tensors:\n # Remove dummy input labels\n t.remove_all_dummy_indices(labels=[mpo.physin_label])\n # Change physical label to the standard choice 'phys'\n t.replace_label(mpo.physout_...
[ "0.62214667", "0.5949054", "0.58264136", "0.5606159", "0.5593654", "0.5584528", "0.55312747", "0.54770976", "0.5474094", "0.5378102", "0.53478754", "0.5334067", "0.5306447", "0.5279064", "0.5228326", "0.5213091", "0.51991266", "0.50929374", "0.50669366", "0.5062249", "0.49681...
0.74147075
0
Get the front item from the deque.
def getFront(self) -> int: if self.isEmpty(): return -1 return self.arr[self.front]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek_front(self):\n if ((self.is_empty()) or self.data_[self.front_]== None): #If we trip this if block we raise an error since we know the deque should be empty \n raise IndexError\n return self.data_[self.front_]", "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\tretur...
[ "0.8504709", "0.8491281", "0.841562", "0.8374413", "0.8284823", "0.82578164", "0.8202539", "0.7989508", "0.79789394", "0.79612917", "0.7959505", "0.79556924", "0.7929888", "0.7900811", "0.78996456", "0.78637207", "0.7849841", "0.7849841", "0.7751278", "0.77479947", "0.7728384...
0.7279614
40
Get the last item from the deque.
def getRear(self) -> int: if self.isEmpty(): return -1 return self.arr[(self.rear - 1 + self.capacity) % self.capacity]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(self):\n return self.deque[-1]", "def last_item(self):\n return self.container[self.length-1]", "def last(self):\n if self.is_empty():\n raise Empty(\"Deque is empty\")\n return self._trailer._prev._element #real item just before trailer", "def last(iterabl...
[ "0.873561", "0.84392744", "0.8213561", "0.8139774", "0.7803814", "0.7800985", "0.7751803", "0.7621705", "0.7618637", "0.75757027", "0.75228494", "0.7490607", "0.74851626", "0.7431453", "0.7431453", "0.7409974", "0.73955023", "0.7393824", "0.7360437", "0.7358974", "0.7358188",...
0.0
-1
Checks whether the circular deque is full or not.
def isFull(self) -> bool: return (self.rear + 1) % self.capacity == self.front
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.deque) == 0", "def isFull(self):\n return len(self.queue) == self.size", "def isFull(self):\r\n if (len(self.queue) == self.maxlen):\r\n return True\r\n else:\r\n return False", "def empty(self) -> bool:\n return l...
[ "0.7989078", "0.7895886", "0.7891434", "0.7660478", "0.75128245", "0.7484213", "0.73029816", "0.73029816", "0.72759694", "0.7268464", "0.7253773", "0.7235688", "0.72299623", "0.72299623", "0.72278905", "0.72223043", "0.7189977", "0.7189218", "0.7189218", "0.7166158", "0.71531...
0.7483096
6
show all current routes.
def show_positioned_routes(self, routes): print(55*"-") print(" Positioned Routes:") print(55*"-") for elem in routes: print(str(elem))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_all_routes(self):\n try:\n routes = self.admin_repository.show_all_routes()\n if routes:\n for route in routes:\n print(\"Route Id: {}\".format(route[0]))\n print(\"Route : {}\".format(route[1]))\n print(\...
[ "0.72586024", "0.7230948", "0.7123343", "0.6808892", "0.67028224", "0.668056", "0.662038", "0.6595741", "0.65435576", "0.65434283", "0.65387565", "0.6535836", "0.64731705", "0.6469571", "0.64103067", "0.6393596", "0.6302355", "0.6238044", "0.62110084", "0.61841947", "0.617631...
0.57644075
74
show all current routes.
def show_routes(self): routelist= [(handler.regex.pattern, handler.handler_class) for handler in self.handlers[0][1]] print(55*"-") print(" Routing table (order matters) :") print(55*"-") for elem in routelist: print('{0:<20} {1:<30} '.format(elem[0], str(elem[1])))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_all_routes(self):\n try:\n routes = self.admin_repository.show_all_routes()\n if routes:\n for route in routes:\n print(\"Route Id: {}\".format(route[0]))\n print(\"Route : {}\".format(route[1]))\n print(\...
[ "0.72586024", "0.7123343", "0.6808892", "0.67028224", "0.668056", "0.662038", "0.6595741", "0.65435576", "0.65434283", "0.65387565", "0.6535836", "0.64731705", "0.6469571", "0.64103067", "0.6393596", "0.6302355", "0.6238044", "0.62110084", "0.61841947", "0.61763114", "0.61512...
0.7230948
1
Run a bidirectional LSTM with highway connections over `x`.
def apply_highway_lstm(x, seq_len): lstm_out = apply_lstm(x, seq_len) proj = ops.affine(x, FLAGS.lstm_dim * 4, "w", bias_name="b") gate, transform = tf.split(proj, 2, 2) gate = tf.sigmoid(gate) transform = tf.tanh(transform) return lstm_out * gate + (1 - gate) * transform
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n x, self.hidden = self.lstm(x, self.hidden)\n self.detach_hidden()\n x = self.dropout(x)\n x = self.out(x)\n return x", "def forward(self, x):\n x = tensor(x).unsqueeze(1)\n x = self.cnn(x)\n\n # LSTM from here\n batch_size = x...
[ "0.6603126", "0.6597981", "0.6437069", "0.63598657", "0.6353596", "0.6339107", "0.6302097", "0.62967634", "0.62922555", "0.6243886", "0.61967885", "0.61767125", "0.6142668", "0.6132513", "0.609587", "0.6049187", "0.60363305", "0.60302013", "0.602851", "0.60156953", "0.6007463...
0.67451996
0
Builds the `tf.estimator.EstimatorSpec` to train/eval with.
def model_function(features, labels, mode, params): is_train = mode == tf_estimator.ModeKeys.TRAIN logits = predict(is_train, embeddings, features["premise"], features["hypothesis"]) loss = tf.nn.sparse_softmax_cross_entropy_with_logits( labels=tf.to_int32(labels), logits=logit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_estimator_spec(self):\n host_calls = {}\n if self.eval_metrics is not None:\n host_calls['eval_metrics'] = self.eval_metrics\n if self.host_call is not None:\n host_calls['host_call'] = self.host_call\n host_call_ret = _OutfeedHostCall.create_cpu_hostcall(host_calls)\n eval_metric_o...
[ "0.7483144", "0.69653875", "0.68885684", "0.6777047", "0.6767065", "0.6717721", "0.66880214", "0.66420263", "0.6620949", "0.6564782", "0.64057344", "0.6399975", "0.63963366", "0.6376076", "0.63569033", "0.62908036", "0.62706155", "0.6219677", "0.6201526", "0.6189201", "0.6175...
0.5426357
63
Tokenize with spacy, placing service words as individual tokens.
def tokenize(self, text, **kwargs): if self.opt['tracker'] == 'babi6': text = babi6_dirty_fix(text) text = text.replace('<SILENCE>', '_SILENCE_') return [t.text for t in NLP.tokenizer(text)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _word_tokenize_spacy(sent):\n tokens = SQuADDataTokenizer._spacy_tokenizer(sent)\n return tokens", "def tokenize(text: str):\n # Create list of word tokens\n token_list = []\n # nlp = init_nlp(TaggingMethod.SPACY, Lang.ES, size=DictionarySize.MEDIUM)\n doc = nlp(text)\n token_lis...
[ "0.71525794", "0.67237216", "0.6536082", "0.6464274", "0.63215363", "0.63136214", "0.62994015", "0.625333", "0.62518924", "0.6225237", "0.6198206", "0.6182261", "0.6149354", "0.6135552", "0.6125539", "0.61220944", "0.61216193", "0.6116335", "0.61108583", "0.6101484", "0.60982...
0.0
-1
Build dictionary from the list of provided tokens. Only add words contained in self.embedding_words, if not None.
def add_to_dict(self, tokens): # TODO: ?add normalization of a token? for token in tokens: if self.embedding_words and (token not in self.embedding_words): continue self.freq[token] += 1 if token not in self.tok2ind: index = len(self.tok2ind) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vocab(self, lst_tokens):\n freqs = {}\n\n # Calculate frequency of words\n for tokens in lst_tokens:\n for word in tokens:\n if word not in self._special_tokens.values() and word not in freqs.keys():\n freqs[word] = 0\n freq...
[ "0.73061806", "0.7002274", "0.6315244", "0.6219969", "0.61121595", "0.61034936", "0.6099661", "0.60497403", "0.60243684", "0.6009772", "0.6000921", "0.5949871", "0.5887991", "0.587184", "0.586285", "0.5851658", "0.58266574", "0.5810338", "0.57823133", "0.57681745", "0.5740205...
0.70376384
1
Retorna el maximo valor de intervalo permitido en funcion de
def round_based_alien_limitation(self): if self.num_round < 5: return 1 elif self.num_round < 10: return 2 else: return 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max(self):\n\n return time_stat(self, stat=\"max\")", "def _max_in_bounds(self, max):\n if max >= self.valmax:\n if not self.closedmax:\n return self.val[1]\n max = self.valmax\n\n if max <= self.val[0]:\n max = self.val[0]\n return self...
[ "0.70688176", "0.6911259", "0.6859873", "0.66536784", "0.6621255", "0.65974665", "0.6580353", "0.6566932", "0.65666676", "0.651444", "0.64946896", "0.6466681", "0.64317226", "0.64267105", "0.6418696", "0.6394922", "0.6358113", "0.63576555", "0.63205403", "0.6319478", "0.63159...
0.0
-1
Loads a file as a Numpy Byte (uint8) Array.
def load_encoded(filename): return np.fromfile(filename, dtype='uint8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_as_bytes(filename):\n try:\n with open(filename, \"rb\") as file:\n bytes = array.array(\"B\")\n bytes.frombytes(file.read())\n return bytes\n except FileNotFoundError:\n print(f\"File not found: {filename}\")\n ex...
[ "0.7259066", "0.69095975", "0.65852845", "0.652208", "0.6494615", "0.6420596", "0.63468164", "0.627644", "0.6253144", "0.62431794", "0.61992043", "0.6145117", "0.60967314", "0.60532904", "0.6040249", "0.6033883", "0.6010476", "0.6003917", "0.59884894", "0.5967871", "0.5938831...
0.7577892
0
Gets token embeddings for tokens given by `input_ids` prefixed by `prefix_ids`. If not provided, `prefix_ids` is replaced with `self.prefix_ids` at every position.
def embed_input_ids( self, input_ids: torch.Tensor, next_token_ids: torch.Tensor, prefix_ids: Optional[torch.Tensor]) -> Tuple[torch.Tensor, torch.Tensor]: batch_size = len(input_ids) if prefix_ids is None: prefix_ids = self.prefix_ids prefix_embedding = self.prefix_embed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_query(self, input_ids, prefix):\n\n input_strings = self.generator_tokenizer.batch_decode(input_ids, skip_special_tokens=False)\n\n # handle prefix for T5\n if isinstance(self.generator_tokenizer, T5Tokenizer):\n for i, s in enumerate(input_strings):\n ...
[ "0.6539803", "0.5948898", "0.5661057", "0.5661057", "0.5619583", "0.55910766", "0.55719936", "0.5559339", "0.5557459", "0.54775995", "0.54746634", "0.54484516", "0.5373518", "0.52815443", "0.52612275", "0.5258932", "0.52559406", "0.52509916", "0.52365005", "0.52196455", "0.52...
0.7882142
0
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7448925
67
Similar to make_padded_input_tensor, but does it on the outputs without the option to reverse input
def make_padded_output_tensor(exs, output_indexer, max_len): return np.array([[ex.y_indexed[i] if i < len(ex.y_indexed) else output_indexer.index_of(PAD_SYMBOL) for i in range(0, max_len)] for ex in exs])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(self, inputs):\n if self._padding_mode == 'zero':\n # tf.pad interprets this as paddings per dimension. We only need to pad\n # the middle dimension which is why the other two values are pairs of 0s.\n paddings = ((0, 0), self._padding, (0, 0))\n outputs = tf.pad(inputs, paddings)\n...
[ "0.72530204", "0.7243589", "0.7243589", "0.7218602", "0.72113645", "0.7173471", "0.67020684", "0.663841", "0.6534705", "0.6514708", "0.64728826", "0.64728826", "0.63910264", "0.632878", "0.6301848", "0.62262946", "0.6201561", "0.6162932", "0.6137488", "0.61104417", "0.6107769...
0.61546886
19
Similar to make_padded_input_tensor, but does it on the outputs without the option to reverse input
def make_padded_output_inp_tensor(exs, output_indexer, max_len): return np.array([[ex.y_indexed_inp[i] if i < len(ex.y_indexed_inp) else output_indexer.index_of(PAD_SYMBOL) for i in range(0, max_len)] for ex in exs])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(self, inputs):\n if self._padding_mode == 'zero':\n # tf.pad interprets this as paddings per dimension. We only need to pad\n # the middle dimension which is why the other two values are pairs of 0s.\n paddings = ((0, 0), self._padding, (0, 0))\n outputs = tf.pad(inputs, paddings)\n...
[ "0.72549313", "0.7243792", "0.7243792", "0.7218835", "0.72122765", "0.7174052", "0.67015636", "0.6534452", "0.65158516", "0.6473999", "0.6473999", "0.63913155", "0.6330551", "0.6303713", "0.6228892", "0.6202585", "0.6163961", "0.61568725", "0.61568725", "0.61397326", "0.61114...
0.6640104
7
Runs the encoder (input embedding layer and encoder as two separate modules) on a tensor of inputs x_tensor with inp_lens_tensor lengths. YOU DO NOT NEED TO USE THIS FUNCTION. It's merely meant to illustrate the usage of EmbeddingLayer and RNNEncoder as they're given to you, as well as show what kinds of inputs/outputs...
def encode_input_for_decoder(x_tensor, inp_lens_tensor, model_input_emb: EmbeddingLayer, model_enc: RNNEncoder): input_emb = model_input_emb.forward(x_tensor) (enc_output_each_word, enc_context_mask, enc_final_states) = model_enc.forward(input_emb, inp_lens_tensor) enc_final_states_reshaped = (enc_final_sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_input(self, x_tensor, inp_lens_tensor):\r\n input_emb = self.input_emb.forward(x_tensor)\r\n enc_output_each_word, enc_context_mask, enc_final_states = self.encoder(input_emb, inp_lens_tensor)\r\n enc_final_states_reshaped = (enc_final_states[0].unsqueeze(0), enc_final_states[1].uns...
[ "0.752864", "0.6831427", "0.6781641", "0.67434967", "0.6630997", "0.6623081", "0.6585142", "0.65178657", "0.64999723", "0.6480972", "0.6475214", "0.6472015", "0.64607733", "0.6455721", "0.64428383", "0.642908", "0.6392102", "0.6384745", "0.63723063", "0.63054127", "0.6217398"...
0.7410453
1
Sets the packet's unique ID as the specified value.
def setId(self, identifier): self.identifier = identifier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_id(self, value):\n pass", "def id(self, value):\n self._id = value", "def uuid(self, value):\n self.unique_id = UUID(str(value)).hex", "def id(self, value: str):\n self._id = value", "def set_ID(self, x):\n x = str(x)\n if self.ID != x:\n self.I...
[ "0.73391616", "0.7155068", "0.7048854", "0.6988872", "0.6895797", "0.6741082", "0.6695969", "0.6587237", "0.6537794", "0.6495277", "0.64542377", "0.64374983", "0.6298493", "0.6282707", "0.62618953", "0.6252123", "0.6251011", "0.6232033", "0.61497086", "0.61202675", "0.6115953...
0.5951914
26
Gets the id of this AccountFull. Account ID. Sometimes referred to as \"Voip ID\" or \"voip_id\".
def id(self): return self._id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_id(self):\n return self.get('/accounts')[0]['Id']", "def account_id(self) -> str:\n return self._account_id", "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")", "def acco...
[ "0.75177616", "0.7510043", "0.7494164", "0.7494164", "0.7494164", "0.7494164", "0.7494164", "0.7494164", "0.7494164", "0.7494164", "0.73569965", "0.72125113", "0.70965207", "0.70965207", "0.70965207", "0.70965207", "0.70965207", "0.70092165", "0.70092165", "0.70092165", "0.69...
0.0
-1
Sets the id of this AccountFull. Account ID. Sometimes referred to as \"Voip ID\" or \"voip_id\".
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id):\n self.data['id'] = id", "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id):\n self.__id = id", "def set_id(self, id_):\n\n self.id_ = id_", "def setID(self, id):\n self._id = id\n return self.callRemote('setID', id)", "def ac...
[ "0.69197965", "0.6907137", "0.68705165", "0.6861742", "0.6797797", "0.66696423", "0.65901035", "0.65901035", "0.65901035", "0.65901035", "0.65901035", "0.65783966", "0.65355206", "0.65350556", "0.6532835", "0.6532835", "0.6532835", "0.6532835", "0.6532835", "0.6532835", "0.65...
0.6481037
100
Gets the name of this AccountFull. Name on the account. Readonly.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name(self):\n return self.name", "def get_full_name(self):\n return self.name", "def get_full_name(self):\n return self.name", "def get_full_name(self):\n return self.name", "def get_full_name(self):\n return self.name", "def get_full_name(self):\n\n ...
[ "0.7989224", "0.7989224", "0.7989224", "0.7989224", "0.7989224", "0.7982894", "0.7982894", "0.7870362", "0.7838378", "0.779231", "0.778696", "0.77744395", "0.77702564", "0.7742472", "0.7742472", "0.77288747", "0.77288747", "0.77108455", "0.7683587", "0.7679632", "0.7678023", ...
0.0
-1
Sets the name of this AccountFull. Name on the account. Readonly.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(self, full_name):\n\n self._full_name = full_name", "def full_name(self, full_name):\n\n self._full_name = full_name", "def set_name(self, name):\n\t\tself.name_ = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name"...
[ "0.7387419", "0.7387419", "0.7345867", "0.73332864", "0.73332864", "0.73332864", "0.73332864", "0.73332864", "0.73174626", "0.7313306", "0.7313306", "0.73081434", "0.72838306", "0.7264557", "0.7258013", "0.721653", "0.7191358", "0.7191358", "0.7182522", "0.7182522", "0.717280...
0.0
-1
Gets the master_account of this AccountFull. If this account is a subaccount, this property shows the master account that it belongs to. Otherwise it is NULL. Readonly. Output is an Account Summary Object.
def master_account(self): return self._master_account
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_account_summary(self):\r\n return self.get_object('GetAccountSummary', {}, SummaryMap)", "def master(self):\n\n return self._master", "def master(self):\n return self._master", "def master_account(self, master_account):\n\n self._master_account = master_account", "def ma...
[ "0.61191386", "0.5715441", "0.56205124", "0.5565199", "0.5372768", "0.5334369", "0.53104615", "0.53018093", "0.53018093", "0.5236358", "0.5122607", "0.5111378", "0.5111378", "0.5105393", "0.5025174", "0.50058645", "0.4983558", "0.497866", "0.49717057", "0.49622187", "0.496221...
0.76490706
0
Sets the master_account of this AccountFull. If this account is a subaccount, this property shows the master account that it belongs to. Otherwise it is NULL. Readonly. Output is an Account Summary Object.
def master_account(self, master_account): self._master_account = master_account
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def master_account(self):\n return self._master_account", "def setMaster(self, master):\n _cantera.flowdev_setMaster(self.flowdev_id(),\n master.flowdev_id())", "async def async_set_master(self, master):\n self._master = master", "def SetMasterManager(se...
[ "0.6377629", "0.60253954", "0.57807606", "0.54432863", "0.5340606", "0.5325318", "0.5231134", "0.5027194", "0.50133157", "0.48292473", "0.47346526", "0.47233143", "0.4653343", "0.46260804", "0.45900288", "0.45702145", "0.456755", "0.4564637", "0.45429322", "0.45266345", "0.45...
0.74671936
0
Gets the billing_contact of this AccountFull. Contact Object for billing purposes. See below for details.
def billing_contact(self): return self._billing_contact
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_billing_phone(self):\n if self.billing_phone:\n return self.billing_phone\n else:\n return self.contact.phone", "def get_billing_address(self):\n if self.billing_address:\n return self.billing_address.address_1\n else:\n subscription...
[ "0.6514139", "0.6312961", "0.60894465", "0.5964028", "0.59532285", "0.592418", "0.5832944", "0.58254695", "0.58167064", "0.58167064", "0.5812328", "0.57611084", "0.57611084", "0.57495", "0.57495", "0.57495", "0.5683821", "0.5683821", "0.56430525", "0.56332636", "0.559522", ...
0.81044155
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, AccountFull): 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
Convert and filter json compatible object to model compatible dict, also filter fields that is not allowed to be edited.
def to_model(self, obj): if obj is None: raise UnprocessableEntity("expected data in request, was empty", what=BAD_VALUE) if not isinstance(obj, Mapping): raise UnprocessableEntity("expected data object in request", what=BAD_VALUE) return {k: self.cols_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __json_light__(self):\n filtered_dict = dict()\n\n for k, item in six.iteritems(self.__dict__):\n if k.startswith('_') or k == 'annotations':\n continue\n\n if hasattr(item, '__json__'):\n filtered_dict[k] = item.__json__\n else:\n ...
[ "0.7309143", "0.718547", "0.70756376", "0.644619", "0.6415183", "0.64003205", "0.6335626", "0.63041055", "0.6279957", "0.621953", "0.6209961", "0.6103006", "0.5990991", "0.5989903", "0.5967135", "0.59133464", "0.5910795", "0.5892439", "0.58859164", "0.58845717", "0.5880171", ...
0.6324965
7
Set as attribute the configuration file directory, which will be used during the SED fitting.
def set_fileout(self, fileout, builddir=True): if builddir: dir_ = os.path.dirname(fileout) if not os.path.isdir(dir_): os.makedirs(dir_) self._fileout = fileout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Dir(self, directory='cfg/'):\n try:\n self.__dir = os.path.join(os.getcwd(), directory.lstrip('/\\\\'))\n except Exception:\n KITConfig.configDir = os.path.join(os.getcwd(), directory.lstrip('/\\\\'))", "def setup_configuration_file(self):\n\n with open(self.config_...
[ "0.6903508", "0.6400414", "0.6360941", "0.6330567", "0.6275161", "0.62670714", "0.62634474", "0.6255362", "0.62052494", "0.6176368", "0.61529267", "0.61342514", "0.61308813", "0.61092764", "0.6106888", "0.6104662", "0.6065037", "0.6059609", "0.605647", "0.6039383", "0.6039178...
0.0
-1
Return the configuration file directory which will be used for the SED fitting. Options
def get_fileout(self, buildit=True, update=False): if self.has_fileout(): if update or (not os.path.isfile(self.fileout) and buildit): self.writeto() return self.fileout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_install_dir(options):\n return (os.path.join(get_spinnaker_dir(options), 'config'))", "def config_directory(self):\n\n return self.get_raw(\"config_directory\")", "def config_dir(self) -> Path:\n return self._config_dir", "def get_user_config_dir(options):\n return '/root/....
[ "0.67623967", "0.66580516", "0.6577391", "0.6567267", "0.65615207", "0.65395236", "0.64207685", "0.6392607", "0.6359868", "0.6306662", "0.6293642", "0.625792", "0.6255219", "0.6244269", "0.6220655", "0.6214047", "0.6209381", "0.6185008", "0.6169837", "0.61507916", "0.6074904"...
0.0
-1
Test that a configuration file directory is set yet
def has_fileout(self): return self.fileout is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config():\n if not os.path.exists(CONFIG_DIR):\n raise mupub.BadConfiguration('Configuration folder not found.')\n if not os.path.exists(_CONFIG_FNM):\n raise mupub.BadConfiguration('Configuration file not found.')\n if not os.path.exists(getDBPath()):\n raise mupub.BadConfig...
[ "0.7753465", "0.725407", "0.72260857", "0.7130134", "0.70807195", "0.7075092", "0.70027983", "0.6937402", "0.69322777", "0.6919455", "0.6873999", "0.68321675", "0.68006307", "0.6798281", "0.67892265", "0.6771314", "0.6754025", "0.67181426", "0.6704088", "0.6663313", "0.662446...
0.0
-1
All detections exactly match their respective ground truths
def test_true_detections(self): expected_accuracy = dict(num_recall=10, uniq_recall=10, num_precision=10, uniq_precision=10) self._run_and_validate(self.true_dets, self.ground_truths, expected_accuracy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_detections(ground_truth, predictions, class_name, overlap_threshold=0.5,\n allow_multiple_matches_per_ignored=True,\n verbose=True):\n\n Detection = namedtuple('Detection', ['image', 'bbox', 'score', 'gt_match'])\n GT = namedtuple('GroundTruth', ['bb...
[ "0.7000474", "0.69553316", "0.68805325", "0.6876431", "0.6830491", "0.6619367", "0.6503127", "0.64181936", "0.63625646", "0.62995064", "0.61465216", "0.6128997", "0.6117078", "0.6051656", "0.6047645", "0.60292894", "0.59727913", "0.5972579", "0.5959089", "0.5933453", "0.59227...
0.76566756
0
Returns a string representation of a rule.
def __str__(self): return "[" + str(self.quick) + "] " + \ self.regexp.pattern + " --> " + \ str(self.handler)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"{ %s }\" % str(self.__rule)", "def __str__(self):\n return \"[ %s ]\" % str(self.__rule)", "def __str__(self):\n return \"{ %s }1\" % str(self.__rule)", "def get_formatted_rule(rule=None):\r\n rule = rule or {}\r\n return ('action: %s\\n'\r\n ...
[ "0.81409717", "0.8025819", "0.7734218", "0.75833976", "0.7540133", "0.7539098", "0.7442867", "0.71042466", "0.70906323", "0.7083471", "0.7043963", "0.699276", "0.6928893", "0.6925948", "0.67421424", "0.67421424", "0.67421424", "0.67036843", "0.67036843", "0.66518587", "0.6607...
0.56503856
60
Constructor that specifies the line that caused a match to occur, as well as the match object returned by the 're' module.
def __init__(self, line, match): self.line = line self.match = match
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_line_from(self, match):\n self.line = match.group(3)\n self.filename = match.group(2)\n self.message = match.group(1)\n self.eoli = match.group(4)\n\n self.fix_filename()\n self.fix_namespaces()\n self.fix_nonerrors()\n\n if self.filename is None or...
[ "0.6986645", "0.6792507", "0.6763284", "0.6561272", "0.65183675", "0.6482478", "0.6385724", "0.63585615", "0.63484687", "0.6328976", "0.63213855", "0.6320055", "0.62761885", "0.62701315", "0.6251758", "0.6173255", "0.6114995", "0.60241866", "0.60121745", "0.5959163", "0.59543...
0.8687365
0
Constructor that specifies the name of the encapsulator.
def __init__(self, name): self.name = name self.rules = [] self._watched_files = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, name):\n\n self.__name = name\n\n return", "def __init__(__self__, *,\n name: pulumi.Input[str]):\n pulumi.set(__self__, \"name\", name)", "def __init__(self, name):\n self._name = name", "def __init__(self, name):\n self._name = name", ...
[ "0.675478", "0.67278385", "0.6623235", "0.6623235", "0.66194266", "0.6615722", "0.661221", "0.65987533", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.6596641", "0.65745497", ...
0.0
-1
Get the activation based on the act string
def get_activation(act): if act is None: return lambda x: x if isinstance(act, str): if act == 'leaky': return nn.LeakyReLU(0.1) elif act == 'identity': return IdentityActivation() elif act == 'elu': return ELU() elif act in ['relu', 's...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_activation(activation_string):\n act = activation_string.lower()\n if act == 'tanh':\n return torch.tanh\n\n elif act == 'relu':\n return torch.relu\n\n elif act == 'selu':\n return torch.relu\n\n elif act == 'sigmoid':\n return torch.sigmoid\n\n elif act == 'g...
[ "0.7753945", "0.76958704", "0.7671476", "0.76657397", "0.74976265", "0.7368674", "0.72764295", "0.70815176", "0.70522547", "0.7041514", "0.7021039", "0.7019781", "0.69799423", "0.6939832", "0.6936443", "0.66482556", "0.66242135", "0.6618292", "0.660491", "0.64936054", "0.6429...
0.78043425
0
Return a list of args of the `__init__` function of a class Returns list of str the list of argument names. No information about defaults is included.
def args(cls): try: args = getfullargspec(cls.__init__) except TypeError: return [] return args[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_init_arguments_and_types(cls) -> List[Tuple[str, Tuple, Any]]:\n trainer_default_params = inspect.signature(cls).parameters\n name_type_default = []\n for arg in trainer_default_params:\n arg_type = trainer_default_params[arg].annotation\n arg_default = trainer_default_params[arg].de...
[ "0.7642557", "0.73575205", "0.695252", "0.67744136", "0.6700589", "0.6689303", "0.66563034", "0.66367686", "0.65861225", "0.6430415", "0.6428584", "0.6419104", "0.64071065", "0.629382", "0.62801296", "0.62801296", "0.62755585", "0.62083876", "0.6198534", "0.6198534", "0.61985...
0.8002228
0
Reconstruct an object from a dictionary representaiton
def from_dict(cls, dct): if dct is None: dct = {} if hasattr(cls, 'args'): args = cls.args() init_dct = {key: dct[key] for key in dct if key in args} try: obj = cls(**init_dct) if cls._restore_non_initial_attr: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, d):\n return cls(**d)", "def from_dict(cls, obj):\r\n raise NotImplementedError", "def from_dict(cls, d):\n return loadd(d, cls)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", ...
[ "0.73724455", "0.7345858", "0.7344402", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", "0.7315515", ...
0.66199476
80
Return the current name of the object. If no name has been set a default generated name is returned. Returns str the name of the object
def name(self): if self._name == '': return self.default_name else: return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self) -> str:\n return self.__name", "def name(self):\n if self._name is None:\n return(self.default_name)\n else:\n return(self._name)", "def name ( self ) :\n return self.__name if self.__name else ''", "def getname(self):\n if self.instance...
[ "0.8304011", "0.8281682", "0.8264517", "0.8258241", "0.8213678", "0.8188638", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0.815338", "0...
0.8186097
6
Name an unnamed object. This only renames the object if it does not yet have a name. It can be used to chain the naming onto the object creation. It should also
def named(self, name): if not self.is_named and not self._name_fixed: self.name = name return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_object_name(self, object_name = \"DefaultObject\"):\n self.obj_name = object_name", "def object_creator(object_name):\n obj = TemplateClass()\n print(f\"Name of object:{obj.get_object_name()}\")\n obj.set_object_name(\"NewObjectName\")\n print(f\"This is the new object name: {obj.get_o...
[ "0.687818", "0.6530012", "0.6441485", "0.6433343", "0.6329922", "0.62707305", "0.62678564", "0.6232175", "0.62075007", "0.620701", "0.6194444", "0.61667633", "0.61667633", "0.6136961", "0.61212444", "0.61200225", "0.60770977", "0.60696614", "0.6062008", "0.6061782", "0.605912...
0.6034877
22
Checks the given board and outputs the winner
def check_win(board_list): for i in range(0, 3): # rows if board_list[i][0] == board_list[i][1] == board_list[i][2]: if board_list[i][0] != 0: return board_list[i][0] # columns elif board_list[0][i] == board_list[1][i] == board_list[2][i]: i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner(board):\n\n # Check none empty horizontals\n for i in range(3):\n if board[i][0] and board[i][0] == board[i][1] == board[i][2]:\n return board[i][0]\n\n # Check none empty verticals\n for j in range(3):\n if board[0][j] and board[0][j] == board[1][j] == board[2][j]:\...
[ "0.8094012", "0.803237", "0.8030652", "0.79790246", "0.79652417", "0.7957905", "0.79527944", "0.7910215", "0.7891467", "0.7882655", "0.7882188", "0.78704005", "0.784328", "0.78418934", "0.7826353", "0.7825126", "0.781274", "0.77869415", "0.7781925", "0.7769895", "0.770633", ...
0.0
-1
(list of str) > list of str Return a new list with adjacent pairs of string elements from L concatenated together, starting with indices 0 and 1, 2 and 3,and so on.
def compress_list(L): compressed_list = [] i = 0 while i < len(L): compressed_list.append(L[i] + L[i + 1]) # MISSING CODE HERE i = i+2 return compressed_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ijoin_lists(l):\n if l:\n try:\n if not all(ymap(isinstance, l, list)):\n from tek.errors import MooException\n raise MooException('Some elements aren\\'t lists!')\n for i in cumsum([0] + list(map(len, l[:-1]))):\n l[i:i+1] = l[i]\n ...
[ "0.64031535", "0.6280419", "0.6257252", "0.6257252", "0.6257252", "0.6257252", "0.62311846", "0.6090729", "0.60836554", "0.60312283", "0.6021402", "0.6003156", "0.5972356", "0.5969489", "0.5969489", "0.5916614", "0.5860778", "0.58524144", "0.5841129", "0.58254766", "0.5754222...
0.60210323
11
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1