query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Accessor method to get the classes. Shifts the index so it matches Fabers. This index is printed by the rij() function. | def __getitem__(self, index):
if index in self.marks:
return psi_class(self, index)
return self.classes[index-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_classes(self):\n return list(range(self.num_clss))",
"def return_classes(self):\n\n\t\t \n\t\t \n\t\treturn self.classes",
"def _get_classifers(self):\n return self.__classifers",
"def _get_classifers(self):\n return self.__classifers",
"def _get_classifers(self):\n return self.... | [
"0.6719678",
"0.66587174",
"0.664865",
"0.664865",
"0.664865",
"0.664865",
"0.664865",
"0.664865",
"0.64690423",
"0.6428921",
"0.64125866",
"0.6395632",
"0.6255855",
"0.6167112",
"0.6150065",
"0.61381936",
"0.61374813",
"0.60772604",
"0.59909374",
"0.59331733",
"0.5930647",
... | 0.67644227 | 0 |
Creates symbols in the global namespace for all the classes on this space. This makes it so you can type in e.g. psi1ka2 and it knows what you mean. | def mak(self):
#print "entering mak!!!"
for cl in self.classes:
sage.misc.misc.inject_variable(repr(cl),cl, warn=False)
#for long_name_for_class_that_probably_wont_be_in_global_namespace in self.classes:
#if long_name_for_class_that_probably_wont_be_in_global_namespace !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_root_symbols(self):\n RootSymbol = Symbol(Token(None,None,'R00t.Symbol'))\n RootSymbol.GlobalSymbolDict=self.GlobalSymbolDict\n StartDocSymbol = Symbol(Token(None,None,'%^'))\n StartDocSymbol.regex = Set('%^')\n StartDocSymbol.is_lit = True\n StartDocSymbol.Glob... | [
"0.61037695",
"0.60583246",
"0.5722966",
"0.5719212",
"0.56878597",
"0.56597066",
"0.55972683",
"0.55732954",
"0.5548546",
"0.5395741",
"0.53940487",
"0.53814834",
"0.53207135",
"0.52824837",
"0.5233545",
"0.5211916",
"0.52010185",
"0.5181912",
"0.5168852",
"0.5159553",
"0.51... | 0.6204658 | 0 |
Generator object, gives all the reducible boundaries for this space, but returns them as spaces, i.e., as a Mgn object with the defining genus and marked points. This is used to compute itersections with ch. | def red_boundaries_as_spaces(self):
marks = set(self.marks)
if self.n != 0:
first_mark_list = [marks.pop()]
p1,p2 = self.next_marks()
for g1 in range(0, self.genus + 1):
for p in subsets(marks):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def irr_boundary_as_space(self):\n p1,p2 = self.next_marks()\n \n return Mgn(self.genus - 1, self.marks.union([p1,p2])), p1, p2",
"def gen_grids(self):\n self.dx = self.grid_width / self.grid_resol\n self.dk = 2 * np.pi/self.grid_width\n self.grid_x_shifted = -self.grid... | [
"0.6455349",
"0.60431594",
"0.5857253",
"0.54997003",
"0.5488937",
"0.5479533",
"0.54215795",
"0.5392349",
"0.5385499",
"0.53742164",
"0.5348733",
"0.534845",
"0.5332898",
"0.5305748",
"0.52968",
"0.5293048",
"0.52900636",
"0.52560335",
"0.52560335",
"0.52474153",
"0.52438915... | 0.76073295 | 0 |
Gives the irreducible boundaries for this space, but returns it as a space, i.e., as a Mgn object with the defining genus and marked points. This is used to compute itersections with ch. | def irr_boundary_as_space(self):
p1,p2 = self.next_marks()
return Mgn(self.genus - 1, self.marks.union([p1,p2])), p1, p2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def red_boundaries_as_spaces(self):\n marks = set(self.marks)\n if self.n != 0:\n first_mark_list = [marks.pop()]\n \n \n p1,p2 = self.next_marks() \n \n for g1 in range(0, self.genus + 1):\n for p in subsets(marks):\... | [
"0.6790039",
"0.57674015",
"0.5721155",
"0.5695158",
"0.5683047",
"0.56764877",
"0.56645674",
"0.54823256",
"0.5448614",
"0.5395288",
"0.5320104",
"0.5307561",
"0.5305074",
"0.52890897",
"0.5264711",
"0.5260044",
"0.5260044",
"0.5260044",
"0.5260044",
"0.5260044",
"0.5260044"... | 0.76175594 | 0 |
Returns the two next marks that haven't been used on this space. | def next_marks(self):
if self.n != 0:
pmax = max(self.marks)
else:
pmax = 0
p1 = pmax + 1
p2 = pmax + 2
return p1, p2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getNextTerritoryPlaceMarkerno(self):\n \n # if self.max_markerno == 0\n if self.max_markerno == 0:\n return 1\n \n # All markerno's SHOULD be number 1 through total number markers\n # if not, there are some markers that have not yet been assigned markerno\n # go ahead and set m... | [
"0.62585247",
"0.6197842",
"0.6161695",
"0.5964449",
"0.5657985",
"0.55898744",
"0.55055714",
"0.54640234",
"0.5390226",
"0.5383929",
"0.531474",
"0.52425236",
"0.52278495",
"0.51669264",
"0.5164936",
"0.51615626",
"0.51525515",
"0.51417595",
"0.5131687",
"0.5094463",
"0.5083... | 0.7172521 | 0 |
Returns the next mark that hasn't been used. | def next_mark(self):
if self.n != 0:
pmax = max(self.marks)
else:
pmax = 0
return pmax + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_next_unmarked(self, current):\n while self.__is_multiple(current):\n current += 1\n return current",
"def _getNextTerritoryPlaceMarkerno(self):\n \n # if self.max_markerno == 0\n if self.max_markerno == 0:\n return 1\n \n # All markerno's SHOULD be num... | [
"0.7044648",
"0.6642172",
"0.62489015",
"0.62181896",
"0.61391634",
"0.60871315",
"0.60135794",
"0.59055674",
"0.57508135",
"0.5715984",
"0.5689493",
"0.5670749",
"0.5634214",
"0.56282294",
"0.5622141",
"0.5611392",
"0.5594197",
"0.5570131",
"0.5565583",
"0.55653036",
"0.5558... | 0.73365617 | 0 |
Returns a dictionary, with keys being the degrees, and values being a list of indexes of classes of the corrsponding degree. This is used by a different function to generate a list of all potentially nonzero monomials. Does not return psi classes, since they are made differently. | def degree_index_dict(self):
did = dict()
for i,c in enumerate(self.classes):
if isinstance(c, lambda_class) or isinstance(c, psi_class) or c == 0:
continue
try:
degree = c.degree
except AttributeError:
degre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degree_index_dict_no_red(self):\n did = dict()\n for i,c in enumerate(self.classes):\n if isinstance(c, reducible_boundary) or isinstance(c, psi_class) or c == 0:\n continue \n try:\n degree = c.degree\n except AttributeEr... | [
"0.76682293",
"0.60476583",
"0.53982973",
"0.5278339",
"0.526159",
"0.52377534",
"0.5233555",
"0.5195327",
"0.5183467",
"0.5165781",
"0.5156541",
"0.5151971",
"0.5097595",
"0.50944966",
"0.50942034",
"0.5063305",
"0.50598127",
"0.50462115",
"0.504316",
"0.50406444",
"0.502819... | 0.7501198 | 1 |
Returns a dictionary, with keys being the degrees, and values being a list of indexes of classes of the corrsponding degree. This is used by a different function to generate a list of all potentially nonzero monomials. This version does do the lambdas, but no reducible boundaries or psis. | def degree_index_dict_no_red(self):
did = dict()
for i,c in enumerate(self.classes):
if isinstance(c, reducible_boundary) or isinstance(c, psi_class) or c == 0:
continue
try:
degree = c.degree
except AttributeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degree_index_dict(self):\n did = dict()\n for i,c in enumerate(self.classes):\n if isinstance(c, lambda_class) or isinstance(c, psi_class) or c == 0:\n continue \n try:\n degree = c.degree\n except AttributeError:\n ... | [
"0.72528434",
"0.5412844",
"0.5394591",
"0.53063107",
"0.5302103",
"0.52735525",
"0.526004",
"0.5210724",
"0.5204059",
"0.51863134",
"0.51816136",
"0.51750946",
"0.51374143",
"0.5130763",
"0.50688875",
"0.5054228",
"0.5043922",
"0.5026027",
"0.4983465",
"0.49790865",
"0.49574... | 0.7285419 | 0 |
This method must be overridden. Pull back to the irreducible curve, where the class is currently on M, and p1 and p2 are the names of the new marks. | def pullback_irr(self, M, p1, p2):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pullback_red(self, M1p1, M2p2):\n pass",
"def oncurve(self, P):\n\t\traise Exception(NotImplemented)",
"def GetPoint2(self):\n ...",
"def GetPoint2(self):\n ...",
"def GetPoint1(self):\n ...",
"def GetPoint1(self):\n ...",
"def __init__(self, pt1, pt2):\n s... | [
"0.55120814",
"0.5377777",
"0.5299187",
"0.5299187",
"0.5174387",
"0.5174387",
"0.5164251",
"0.5075292",
"0.5018509",
"0.49826714",
"0.49812275",
"0.49715918",
"0.49609345",
"0.4957323",
"0.495071",
"0.49328053",
"0.49311933",
"0.4910637",
"0.48935622",
"0.48855036",
"0.48817... | 0.55004317 | 1 |
Returns a tuple that can be used to represent this class in the dictionary. It recieves as a argument a dictionary that tells you how to reindex the marks. | def table_key(self, reindex_dict):
reindexed_marks = []
for m in self.component1.marks:
new_m = reindex_dict.get(m)
if new_m == None:
if len(reindex_dict) == 0:
new_m = 0
else:
new_m = max(reindex_dict.values... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\n if index in self.marks:\n return psi_class(self, index)\n return self.classes[index-1]",
"def key(self, x):\r\n return tuple(x)",
"def _hashable_content(self) -> Tuple[int]:\n return (self.index,)",
"def get_info_in_tuple(self):\r\n ... | [
"0.5695776",
"0.553696",
"0.5536798",
"0.55358136",
"0.5507339",
"0.5451462",
"0.5404659",
"0.5376407",
"0.5360486",
"0.5334526",
"0.5330665",
"0.53029096",
"0.528989",
"0.52669483",
"0.5261161",
"0.5231731",
"0.5197029",
"0.5193263",
"0.51903",
"0.515945",
"0.51434106",
"0... | 0.66550064 | 0 |
Returns either 1 or 2, depending on the degree of the map from the product space to this reducible boundary. It should be two if there is an automorphism of the graph, and 1 otherwise. | def degree_of_map(self):
if 2*self.component1.genus == self.space.genus and self.space.n == 0:
return 2
else:
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degree(self, k):\n one_if_my_all_k = 1 if self.my_alll(k) else 0\n return (2 * self.get_prp_j(k)[0]) + one_if_my_all_k",
"def __len__(self):\n # Product function that can handle iterables (np.product can't).\n product = partial(reduce, operator.mul)\n modstr = '%s__' % self... | [
"0.56591105",
"0.55599594",
"0.55144054",
"0.54866827",
"0.54248524",
"0.5414117",
"0.5380749",
"0.53456897",
"0.5329448",
"0.53151715",
"0.53136253",
"0.5302995",
"0.5274688",
"0.52355593",
"0.52244955",
"0.52135247",
"0.52087957",
"0.5205941",
"0.52037925",
"0.51970476",
"0... | 0.7497575 | 0 |
Returns the "bad" (Mumford's original) kappa of the same degree. | def get_kappa(self):
return kappa_class(self.space, self.degree) - sum((psi_class(self.space, p)**self.degree for p in self.space.marks) ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kappa(tol_angle, degrees=True):\n if degrees:\n tol_angle = np.radians(tol_angle)\n return 4/(tol_angle**2)",
"def kappa(self):\n a, c, d, b = self.to_ccw()\n p1, q1 = a + b, c + d\n p2, q2 = a + c, b + d\n n = p1 + q1\n\n if n == 0:\n return np.nan\... | [
"0.67796105",
"0.6638783",
"0.65222853",
"0.62173575",
"0.61565024",
"0.6044664",
"0.60339195",
"0.5998601",
"0.59471756",
"0.5932053",
"0.5853644",
"0.5831035",
"0.57836586",
"0.5782085",
"0.5764921",
"0.57372206",
"0.57042474",
"0.56982696",
"0.5663674",
"0.5653718",
"0.564... | 0.70768404 | 0 |
Returns an equivilant expression terms of chern characters. | def as_chern_chars(self):
#value = self.as_chern_chars_dict.get(self)
if True: #value == None:
#print "on space", self.space, "with lambda_", self.degree
upto = ceil(self.degree/2.0)+1
S = PowerSeriesRing(SR, "t")
f = ( sum( [fact... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_word(word):\r\n\r\n if word.isupper():\r\n terms = [('%s*%s' % (10**i, d)) for (i,d) in enumerate(word[::-1])]\r\n return '(' + '+'.join(terms) + ')'\r\n else:\r\n return word",
"def sanitize(formula):\n TR_UNICODE = {u\"·\": u\"*\", u\"−\": u\"-\"}\n return \"\".join... | [
"0.577644",
"0.56820256",
"0.56617486",
"0.5594537",
"0.5474107",
"0.5408417",
"0.539007",
"0.5386722",
"0.5358573",
"0.5320198",
"0.53183347",
"0.52778924",
"0.5266685",
"0.52639884",
"0.52527505",
"0.52509403",
"0.5234368",
"0.5219025",
"0.5209141",
"0.5207185",
"0.52059174... | 0.65786517 | 0 |
Handler function for hash join. | def hash_join (planNode):
operation_name = planNode.get_attr("Node Type")
operation_type = planNode.get_attr("Join Type")
cond_msg = planNode.get_attr("Hash Cond")
if operation_type != '':
operation_type += ' '
if (cond_msg):
cond_msg = ' on condition '+cond_msg
descrip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join(self):\n pass",
"def hash_key(self):",
"def _hexdigests(self):\n\n for algo in self.algos:\n q = self._queues[algo]\n q.put(b'') # Terminate\n self._threads[algo].join()\n assert q.empty()\n return super(MtHasher, self)._hexdigests()",
... | [
"0.5794422",
"0.5703464",
"0.5696048",
"0.5614501",
"0.5572176",
"0.5495869",
"0.54828334",
"0.5481546",
"0.54747283",
"0.5461832",
"0.5442346",
"0.5442346",
"0.5442346",
"0.5412181",
"0.5403193",
"0.5361309",
"0.5354412",
"0.5342982",
"0.533204",
"0.5304427",
"0.5287919",
... | 0.590912 | 0 |
Handler function for nested loop join. | def nested_loop(planNode):
node = planNode.get_attr("Node Type")
join_type = planNode.get_attr("Join Type")
if join_type != '':
join_type += ' '
join_filter = planNode.get_attr("Join Filter")
filter_msg = ''
if (join_filter):
filter_msg = ' on join filter '+join_filter
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join(self):\n pass",
"def join(self):\n for t in self.created_list:\n t.join()",
"def joiner():\n for th in threads:\n th.join()\n done(process)",
"def run(self):\n self.cc_log(\"INFO\", \"Data Processing Join: Started\")\n if self.left_join... | [
"0.6358565",
"0.6278032",
"0.5571421",
"0.5554408",
"0.55250555",
"0.55180985",
"0.5479515",
"0.5351793",
"0.52703863",
"0.52608633",
"0.5218109",
"0.5128748",
"0.51163507",
"0.51048696",
"0.50975645",
"0.50968325",
"0.50797707",
"0.5073068",
"0.4993057",
"0.49908677",
"0.498... | 0.6324225 | 1 |
Shuffle orders of points in each point cloud changes FPS behavior. Use the same shuffling idx for the entire batch. | def shuffle_points(batch_data):
idx = np.arange(batch_data.shape[1])
np.random.shuffle(idx)
return batch_data[:, idx, :] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle_points(batch_data):\n idx = np.arange(batch_data.shape[1])\n np.random.shuffle(idx)\n return batch_data[:,idx,:]",
"def shuffle_points(mutated_genome,index):\n random.shuffle(mutated_genome[index][2])",
"def _shuffle_roidb_idx(self):\n self.perm = np.random.permutation(np.arange(s... | [
"0.72590023",
"0.7239251",
"0.67538834",
"0.6724801",
"0.6550845",
"0.6484533",
"0.6474677",
"0.6474677",
"0.6458041",
"0.6420625",
"0.6403558",
"0.63890237",
"0.6386616",
"0.63513637",
"0.629727",
"0.62965",
"0.6291102",
"0.6281963",
"0.62366074",
"0.62181103",
"0.6217867",
... | 0.7280055 | 0 |
Returns the PlotWidget contains in this window | def getPlotWidget(self):
return self._plot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_widget(self):\n return self.imgwin",
"def getHistogramWidget(self):\n return self._getToolWindow()",
"def get_active_plot(self):\n for plot in list(self.plots.values()):\n canvas = plot.canvas()\n if canvas.hasFocus():\n return plot\n ret... | [
"0.70153105",
"0.6961207",
"0.6889463",
"0.6799132",
"0.67330176",
"0.65999055",
"0.65312165",
"0.65188783",
"0.6484199",
"0.64163965",
"0.6361403",
"0.6350211",
"0.6318388",
"0.6266669",
"0.62585574",
"0.61179197",
"0.60474443",
"0.6045812",
"0.60415775",
"0.60415775",
"0.60... | 0.832208 | 0 |
Set or change the database name. If 'modify' is True, then allow modifying the name to make it unique. Return the final name. Raise ValueError if name is invalid or already in use. | def set_name(self, name, modify=False):
assert not hasattr(self, "_dbcnx") # Must be done before any write ops.
if name == self.db.get("name"):
return
if not constants.NAME_RX.match(name):
raise ValueError("invalid database name")
if modify:
modified ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(name=False):\n if not name:\n name = name_generator()\n return name",
"def set_name(self, newname=\"\"):\n self.name = newname",
"def name(self, new_name: str) -> None:\n raise NotImplementedError()",
"def new_name(self,new_name):\n self.name = new_name",
"def... | [
"0.63189477",
"0.6314735",
"0.6165321",
"0.61172503",
"0.60988",
"0.60660833",
"0.6036501",
"0.6013789",
"0.600955",
"0.600955",
"0.5947962",
"0.59277517",
"0.59162265",
"0.5903049",
"0.5815733",
"0.58009654",
"0.5748256",
"0.5719417",
"0.5719417",
"0.56806755",
"0.5662065",
... | 0.8319422 | 0 |
Create and load table from records (lists of data items). Infer table column types and constraints from records contents. Raises ValueError or sqlite3.Error if any problem. | def create_table_load_records(self, tablename, records, has_header=True):
# Column names from header, or make up.
if has_header:
header = records.pop(0)
header = [utils.name_cleaned(n) for n in header]
if len(header) != len(set(header)):
raise ValueErr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(cursor, table, *args, **kwds):\n try:\n records, = args\n columns = None\n except ValueError:\n columns, records = args\n\n default = kwds.pop('default', '')\n if kwds:\n msg = 'load_data() got unexpected keyword argument {0!r}'\n raise TypeError(msg.for... | [
"0.66279644",
"0.6479597",
"0.6434635",
"0.6011159",
"0.6007939",
"0.5869238",
"0.58558583",
"0.58282346",
"0.57568645",
"0.5747565",
"0.5666356",
"0.555702",
"0.5545761",
"0.55447066",
"0.5540246",
"0.5536555",
"0.5501205",
"0.5488088",
"0.54878986",
"0.5467272",
"0.54550296... | 0.762297 | 0 |
Create the table in the database and add to the database definition. If 'query' is given, do 'CREATE TABLE AS', and fix up the schema. If 'create' is True, then actually create the table. Raises ValueError if there is a problem with the input schema data. Raises SystemError if the query is interrupted by timeout. | def add_table(self, schema, query=None, create=True):
if not constants.NAME_RX.match(schema["name"]):
raise ValueError("invalid table name")
if utils.name_in_nocase(schema["name"], self.db["tables"]):
raise ValueError("name is already in use for a table")
if utils.name_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sql_table(self, query):\n table_pattern = r\"CREATE TABLE ([\\w_:]+)\"\n match = re.search(table_pattern, query, re.IGNORECASE)\n table_name = match.group(1)\n if \":\" in table_name:\n query = self.clean_table_name(query, table_name)\n\n # Check to see if t... | [
"0.72810155",
"0.6941827",
"0.65274644",
"0.64704907",
"0.6371803",
"0.63551843",
"0.63226044",
"0.62900233",
"0.6281851",
"0.62293935",
"0.62046564",
"0.61940694",
"0.6184373",
"0.6161017",
"0.6122502",
"0.6103641",
"0.6048098",
"0.60406506",
"0.602241",
"0.6019121",
"0.6005... | 0.74015164 | 0 |
Add the given column to the table described by the schema. Raise ValueError if there is any problem. | def add_table_column(self, schema, column):
if not column["name"] or not constants.NAME_RX.match(column["name"]):
raise ValueError("invalid column name")
if utils.name_in_nocase(column["name"], [c["name"] for c in schema["columns"]]):
raise ValueError("non-unique column name")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_column(self, table_name: str, column) -> None:\n sql = 'ALTER TABLE ' + table_name + ' ADD COLUMN ' + column.to_sql()\n self.cursor.execute(sql)",
"def add_column_to_staging_table(cursor,table_schema,table_name,column_name):\n if not check_if_column_exists(cursor, table_schema, table_name,... | [
"0.7461268",
"0.70328975",
"0.7005947",
"0.6832318",
"0.6706952",
"0.6699322",
"0.66819566",
"0.66518646",
"0.66147494",
"0.6606529",
"0.6585268",
"0.6562195",
"0.6534154",
"0.64950705",
"0.64822",
"0.64128786",
"0.6389013",
"0.6368527",
"0.62607074",
"0.6210972",
"0.6156823"... | 0.8124627 | 0 |
Create a view in the database and add to the database definition. If 'create' is True, then actually create the view. Raises ValueError if there is a problem with the input schema data. | def add_view(self, schema, create=True):
if not constants.NAME_RX.match(schema["name"]):
raise ValueError("invalid view name")
if utils.name_in_nocase(schema["name"], self.db["tables"]):
raise ValueError("name is already in use for a table")
if utils.name_in_nocase(schema... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_view(self, repo, view, sql):\n return self.user_con.create_view(\n repo=repo, view=view, sql=sql)",
"def creates_view(self):\n return self.statements[0].creates_view()",
"def create_view(self, start: int = 0, stop: int = 0):\n stmt = f\"\"\"create or replace view {sel... | [
"0.7217368",
"0.656495",
"0.63287896",
"0.6194457",
"0.6177249",
"0.6164981",
"0.60936546",
"0.6083409",
"0.606832",
"0.5918686",
"0.5900394",
"0.57855225",
"0.57373005",
"0.5719429",
"0.5673319",
"0.5611739",
"0.55860096",
"0.5470929",
"0.5427602",
"0.5407982",
"0.5404273",
... | 0.7786582 | 0 |
Check the validity of the metadata for the database. Return False if no metadata (i.e. not a DbShare file), else True. Raises ValueError or sqlite3.Error if any problem. | def check_metadata(self):
sql = f"SELECT COUNT(*) FROM {constants.TABLES}"
if self.dbcnx.execute(sql).fetchone()[0] == 0:
return False # No metadata; skip.
sql = f"SELECT name FROM {constants.TABLES}"
tables1 = [r[0] for r in self.dbcnx.execute(sql)]
sql = "SELECT na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self):\n # validate contents still to do - for now just check if it exists\n return os.path.exists(self.getDefaultDatabaseConnectionParameter()['path'])",
"def db_exists(self, db):\n # HDF5 is file based\n return os.path.isfile(db)",
"def _metadata_is_consistent(metadata):... | [
"0.6685639",
"0.66693676",
"0.6632217",
"0.6471173",
"0.6443462",
"0.63612366",
"0.6281263",
"0.6280908",
"0.62710387",
"0.62230617",
"0.6158644",
"0.614975",
"0.6114387",
"0.60799456",
"0.6042524",
"0.60312736",
"0.59899956",
"0.59632313",
"0.59618896",
"0.5924156",
"0.59134... | 0.81981516 | 0 |
Get the schema of the table or view. Add a member 'type' denoting which it is. Raise ValueError if no such table or view. | def get_schema(db, sourcename):
try:
schema = db["tables"][sourcename]
schema["type"] = constants.TABLE
except KeyError:
try:
schema = db["views"][sourcename]
schema["type"] = constants.VIEW
except KeyError:
raise ValueError("no such table/view... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _schema_type(self) -> Optional[type]:\n return IndexSchema",
"def _schema_type(self) -> Optional[type]:\n pass",
"def _schema_type(self) -> Optional[type]:\n return PanelSchema",
"def _schema_type(self) -> Optional[type]:\n return MovieSchema",
"def _schema_type(self) -> Opt... | [
"0.67394197",
"0.64360523",
"0.642696",
"0.6404674",
"0.63924086",
"0.6387125",
"0.63536716",
"0.6310814",
"0.62644035",
"0.6218083",
"0.6200075",
"0.61655676",
"0.6131771",
"0.6125235",
"0.601341",
"0.59711987",
"0.5944062",
"0.58982587",
"0.5890849",
"0.5876796",
"0.587585"... | 0.7271602 | 0 |
Return SQL to create a table given by its schema. Raise ValueError if any problem. | def get_sql_create_table(schema, if_not_exists=False):
if not schema.get("name"):
raise ValueError("no table name defined")
if not schema.get("columns"):
raise ValueError("no columns defined")
names = set()
for column in schema["columns"]:
if utils.name_in_nocase(column["name"], ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(self, schema, table):\n fields = \", \".join([\" \".join(t) for t in zip(self.schemas[schema][table][0], self.schemas[schema][table][1])])\n sql = f'set role {self.write_role}; ' \\\n + f'CREATE TABLE IF NOT EXISTS {schema}.{table} ( {fields} );'\n return sql",
"... | [
"0.7396332",
"0.7222839",
"0.7214331",
"0.719338",
"0.7181155",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7175187",
"0.7173953",
"0... | 0.77022225 | 0 |
Return SQL to create an index given by its schema. Raise ValueError if any problem. | def get_sql_create_index(tablename, schema, if_not_exists=False):
if not schema.get("columns"):
raise ValueError("no columns defined")
if len(schema["columns"]) != len(set(schema["columns"])):
raise ValueError("same column given more than once")
sql = ["CREATE"]
if schema.get("unique"):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sql(self, model, schema_editor, using='', **kwargs):\n include = [model._meta.get_field(field_name).column for field_name in self.include]\n condition = self._get_condition_sql(model, schema_editor)\n if self.expressions:\n index_expressions = []\n for expressi... | [
"0.72072047",
"0.706101",
"0.6861405",
"0.64765775",
"0.64105004",
"0.63790756",
"0.6371936",
"0.6313902",
"0.6216902",
"0.61960846",
"0.61543465",
"0.61295676",
"0.6011166",
"0.600814",
"0.5993174",
"0.5950828",
"0.5849119",
"0.5826671",
"0.5727391",
"0.56642616",
"0.5639990... | 0.7434653 | 0 |
Get the database and check that the current user has read access. Optionally add nrows for each table and view. Raise KeyError if no such database. Raise ValueError if may not access. | def get_check_read(dbname, nrows=False, complete=True):
db = get_db(dbname, complete=complete)
if db is None:
raise KeyError("no such database")
if not has_read_access(db):
raise ValueError("may not read the database")
set_nrows(db, targets=nrows)
return db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_read(self, db, randomize_access=False):\n self.db = db\n self.randomize_access = randomize_access\n self.can_read = True",
"def db_for_read(self, model, **hints):\n if self.isAdminApp(model):\n return 'auth_db'\n return None",
"def raise_for_access(\n ... | [
"0.61900944",
"0.5673167",
"0.5670762",
"0.56600416",
"0.5628751",
"0.56280935",
"0.5595738",
"0.55469775",
"0.545015",
"0.53966767",
"0.5375409",
"0.53170985",
"0.5258059",
"0.5160819",
"0.5094779",
"0.5073889",
"0.5005565",
"0.49983191",
"0.49965835",
"0.4994591",
"0.496552... | 0.7279948 | 0 |
Get the database and check that the current user has write access. Optionally add nrows for each table and view. Raise KeyError if no such database. Raise ValueError if may not access. | def get_check_write(dbname, check_mode=True, nrows=False, complete=True):
db = get_db(dbname, complete=complete)
if db is None:
raise KeyError("no such database")
if not has_write_access(db, check_mode=check_mode):
raise ValueError("may not write to the database")
set_nrows(db, targets=n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_check_read(dbname, nrows=False, complete=True):\n db = get_db(dbname, complete=complete)\n if db is None:\n raise KeyError(\"no such database\")\n if not has_read_access(db):\n raise ValueError(\"may not read the database\")\n set_nrows(db, targets=nrows)\n return db",
"def _... | [
"0.62008744",
"0.5717889",
"0.5461007",
"0.54139274",
"0.5394495",
"0.53823745",
"0.5362482",
"0.53576916",
"0.5351964",
"0.5261355",
"0.51136035",
"0.4998261",
"0.4941331",
"0.4937972",
"0.49325716",
"0.48510417",
"0.4825769",
"0.48031938",
"0.47883636",
"0.47742996",
"0.476... | 0.6900375 | 0 |
Add the Sqlite3 database file present in the given open file object. If the database has the metadata of a DbShare Sqlite3 database, check it. Else if the database appears to be a plain Sqlite3 database, infer the DbShare metadata from it by inspection. 'size' is the size of the database file. Return the database dicti... | def add_sqlite3_database(dbname, infile, size):
try:
check_quota(size=size)
with DbSaver() as saver:
dbname = saver.set_name(dbname, modify=True)
with open(utils.get_dbpath(dbname), "wb") as outfile:
outfile.write(infile.read())
saver.initialize()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(self):\n if not self.filename:\n raise ValueError(\"Can only open on-disk databases\")\n self.db = dbm.open(self.filename, \"w\") #raises anydbm.error\n try:\n if self.db[\"--Reserved--type\"] != self.type:\n raise ValueError(\"Not a %s database\" ... | [
"0.5955714",
"0.5953158",
"0.59470034",
"0.5555061",
"0.54738444",
"0.54535043",
"0.54270566",
"0.54080987",
"0.53994936",
"0.53630704",
"0.5354894",
"0.53220826",
"0.5319659",
"0.5310338",
"0.528904",
"0.52802867",
"0.52757585",
"0.52705204",
"0.5266127",
"0.52581644",
"0.52... | 0.7196136 | 0 |
Add the XLSX file workbook as a database. The worksheets are loaded as tables. 'size' is the size of the XLSX file. Return the database dictionary. Raise ValueError if any problem. | def add_xlsx_database(dbname, infile, size):
tmp = tempfile.NamedTemporaryFile(suffix=".xlsx")
tmp.write(infile.read())
tmp.seek(0)
try:
wb = openpyxl.load_workbook(tmp.name)
check_quota(size=size)
with DbSaver() as saver:
dbname = saver.set_name(dbname)
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_xl2db(xlfilepath, sheetname, header_cols, insfunc, start_row=0):\n def is_header(row):\n hText = ('!!'.join(header_cols)).lower()\n rText = ('!!'.join([str(r) for r in row[:len(header_cols)]])).lower()\n return hText == rText\n \n #load sheet & file header\n sheet = XlShee... | [
"0.58233666",
"0.5794",
"0.54771256",
"0.5370337",
"0.5314483",
"0.52456737",
"0.5185944",
"0.5175234",
"0.5072808",
"0.50604826",
"0.5035717",
"0.5033447",
"0.50137645",
"0.50020313",
"0.49190697",
"0.49113122",
"0.4905969",
"0.48963267",
"0.48790076",
"0.48784056",
"0.48197... | 0.77125597 | 0 |
Load movie details and ranking from csv file to database. | def load_movies_details():
data = pd.read_csv(CSV_PATH + MOVIES_DETAILS_CSV_NAME).T.to_dict()
#Insert directors to database
for i in range(len(data)):
director_name = data[i]['Director']
director_exist = Director.query.filter(Director.name == director_name).first()
if not director_ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_ratings_data(connection, csvfile):\n insert_sql = 'insert into ratings (userId, movieId, rating, timestamp) ' \\\n 'values (%s, %s, %s, %s)'\n load_data(connection, insert_sql, get_data_from_file(csvfile))",
"def load_records():\n\n with open('seed_data/records.csv', 'rb') as cs... | [
"0.7449447",
"0.7045075",
"0.697231",
"0.6925202",
"0.6890127",
"0.6758247",
"0.6721577",
"0.66272926",
"0.6552087",
"0.65332365",
"0.6506688",
"0.6401783",
"0.6366583",
"0.6349926",
"0.6347025",
"0.6312729",
"0.624575",
"0.6232512",
"0.6219035",
"0.62042195",
"0.62028986",
... | 0.77248156 | 0 |
Load movie cast from csv file to database | def load_movies_cast():
data = pd.read_csv(CSV_PATH + MOVIES_CAST_CSV_NAME).T.to_dict()
for i in range(len(data)):
name = data[i]['Cast']
cast_exist = Cast.query.filter(Cast.name == name).first()
if not cast_exist:
db.session.add(Cast(name=name))
db.session.commit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_ratings_data(connection, csvfile):\n insert_sql = 'insert into ratings (userId, movieId, rating, timestamp) ' \\\n 'values (%s, %s, %s, %s)'\n load_data(connection, insert_sql, get_data_from_file(csvfile))",
"def load_movies():\n filepath = \"./seed_data/u.item\"\n movies = o... | [
"0.6801924",
"0.67638457",
"0.6730367",
"0.65531254",
"0.6460458",
"0.6447328",
"0.64101523",
"0.6394198",
"0.63643944",
"0.6338704",
"0.629535",
"0.6241045",
"0.624032",
"0.6213262",
"0.6189707",
"0.60986936",
"0.6065023",
"0.60348296",
"0.59879386",
"0.5985728",
"0.5954525"... | 0.74498796 | 0 |
Load movie reviews to database | def load_movies_reviews():
data = pd.read_csv(CSV_PATH + MOVIES_REVIEWS_CSV_NAME).T.to_dict()
for i in range(len(data)):
movie_id = Movies.query.filter(Movies.title == data[i]['Title'].strip()).first().id
review = data[i]['Reviews'].strip()
rating = float(data[i]['Rating'])*100000
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_movies():\n print \"Movies\"\n\n # Delete all rows in table, so if we need to run this a second time,\n # we won't be trying to add duplicate users\n Movie.query.delete()\n\n # Read u.item file and insert data\n for row in open(\"seed_data/u.item\"):\n row =row.rstrip()\n\n ... | [
"0.67932075",
"0.67891663",
"0.6626961",
"0.65537125",
"0.64071196",
"0.63042593",
"0.6298705",
"0.62060344",
"0.618357",
"0.6129251",
"0.6100108",
"0.6071276",
"0.5998696",
"0.5919214",
"0.59152097",
"0.58447194",
"0.5771323",
"0.5766531",
"0.575739",
"0.5706212",
"0.5703885... | 0.8098433 | 0 |
Set path to csv files and run load functions | def run_load(rootpath):
global CSV_PATH
CSV_PATH = rootpath+'/csv_files/'
load_movies_details()
load_movies_cast()
load_movies_reviews() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadCSV(input_file):",
"def runs_loader(path):\n files = sorted(glob.glob(f\"{path}/*_runs.csv\"))\n df_lis = list(range(len(files)))\n for i, f in enumerate(files):\n try:\n df_lis[i] = pd.read_csv(f, sep=\",\", header=0)\n print('Read runs.csv\\n', f, df_lis[i].shape,\... | [
"0.69244933",
"0.67308754",
"0.67234784",
"0.6704039",
"0.6694249",
"0.66542995",
"0.66303647",
"0.6621924",
"0.66083246",
"0.6604463",
"0.6528164",
"0.64278746",
"0.6407914",
"0.6399219",
"0.63922846",
"0.63281393",
"0.631288",
"0.62899953",
"0.6281878",
"0.6277048",
"0.6274... | 0.79588497 | 0 |
Check than array of values specified using `c` can be used for a colormap. | def test_color_cmap_c_combination(self):
arr = self.arr
out = ternary(arr, c=np.linspace(0, 10, 10), cmap="viridis")
self.assertTrue(hasattr(out, "tax"))
self.assertEqual(
type(out.tax), pyternary.ternary_axes_subplot.TernaryAxesSubplot
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_color(c):\n\n c = asarray(c)\n if c.ndim == 1:\n c = c.flatten()\n c = c[newaxis, :]\n if c.shape[1] != 3:\n raise Exception(\"Color must have three values per point\")\n elif c.ndim == 2:\n if c.shape[1] != 3:\n raise Exception(\"Color array mus... | [
"0.7522997",
"0.6399244",
"0.6233486",
"0.61515546",
"0.5972068",
"0.5734837",
"0.5714697",
"0.57047075",
"0.56964606",
"0.5671895",
"0.5666058",
"0.5661867",
"0.5612082",
"0.5578248",
"0.5551499",
"0.5532785",
"0.5467735",
"0.5461801",
"0.54509157",
"0.5412546",
"0.5403892",... | 0.6554897 | 1 |
This method searching for the body html element, sends it to the Scraper class to find potencials popups and finally close them | def ads_breaker(self):
try:
self.find_element_by_xpath('/html/body').send_keys(Keys.ESCAPE)
return
except:
pass
html_element = self.find_element_by_xpath(
'/html/body').get_attribute('outerHTML')
soup = Scraper(html_element)
targe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_popup_windows(chrome_driver, close_ele_class_names):\r\n\r\n for class_name in close_ele_class_names:\r\n close_ele = check_and_get_ele_by_class_name(chrome_driver, class_name) \r\n if close_ele:\r\n try:\r\n close_ele.click()\r\n time.sleep(1)\r\... | [
"0.5855956",
"0.5506015",
"0.5407686",
"0.5332533",
"0.53205526",
"0.52699345",
"0.5266626",
"0.52550715",
"0.5238747",
"0.52184844",
"0.51588637",
"0.50889885",
"0.50163907",
"0.49882764",
"0.4971992",
"0.49317858",
"0.49307364",
"0.49163505",
"0.48968342",
"0.4895865",
"0.4... | 0.5718086 | 1 |
Initializes the `ImageSearcher` object. | def __init__(self, options: ImageSearcherOptions,
cpp_searcher: _CppImageSearcher) -> None:
# Creates the object of C++ ImageSearcher class.
self._options = options
self._searcher = cpp_searcher | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initImages(self):\n pass",
"def initImages(self):\n pass",
"def initImages(self):\n pass",
"def initialize(self):\n for path in self._paths:\n for root, dirnames, filenames in os.walk(os.path.expanduser(path)):\n if self._is_in_excluded_patterns(root)... | [
"0.6192012",
"0.6192012",
"0.6192012",
"0.5984795",
"0.59554297",
"0.5908261",
"0.58379114",
"0.5573122",
"0.54988146",
"0.54773754",
"0.5456339",
"0.54226214",
"0.5420283",
"0.5420283",
"0.5420283",
"0.54042417",
"0.5379169",
"0.5376522",
"0.53504145",
"0.53011996",
"0.52807... | 0.7267351 | 0 |
Creates the `ImageSearcher` object from image searcher options. | def create_from_options(cls,
options: ImageSearcherOptions) -> "ImageSearcher":
searcher = _CppImageSearcher.create_from_options(
options.base_options.to_pb2(), options.embedding_options.to_pb2(),
options.search_options.to_pb2())
return cls(options, searcher) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, options: ImageSearcherOptions,\n cpp_searcher: _CppImageSearcher) -> None:\n # Creates the object of C++ ImageSearcher class.\n self._options = options\n self._searcher = cpp_searcher",
"def create_search_agent(opt):\n logging.info('Initializing the search engine API.... | [
"0.78471154",
"0.6055885",
"0.57526535",
"0.5699698",
"0.5563751",
"0.54936445",
"0.5071097",
"0.49560168",
"0.49559525",
"0.49472928",
"0.48358572",
"0.48286322",
"0.48202154",
"0.4785771",
"0.47675824",
"0.4759022",
"0.4755689",
"0.47328192",
"0.47293845",
"0.4693368",
"0.4... | 0.86626315 | 0 |
Gets the user info stored in the index file. | def get_user_info(self) -> str:
return self._searcher.get_user_info() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_info(self):\n response = self.query('user_info')\n return response",
"def userinfo(self):\n return self._userinfo",
"def get_users_info(): \n \n data = user_obj.get_users_info()\n return data",
"def getUserInfo(self):\r\n userJson = self.httpGet(ReaderUrl.USER_IN... | [
"0.7138062",
"0.6822024",
"0.67177176",
"0.66358757",
"0.6631659",
"0.6545722",
"0.6526983",
"0.64795595",
"0.6454526",
"0.6445177",
"0.64245903",
"0.6411693",
"0.63946784",
"0.6389253",
"0.63816994",
"0.63520616",
"0.63245225",
"0.6322499",
"0.63019735",
"0.6295263",
"0.6294... | 0.73406935 | 0 |
Return True if `path` is pointing to a genuine audio. `evalkey` must not be empty if path points to an evaluation file. | def is_genuine(path, evalkey=None):
iid = os.path.basename(path)[:-4]
tt, ii = iid.split('_')
if tt == 'T': # training
return (int(ii) <= 1001508)
elif tt == 'D': # development
return (int(ii) <= 1000760)
elif tt == 'E': # evaluation
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def good_filepath(path):\n return str(path).endswith(\".wav\") and (not str(path).startswith(\".\"))",
"def is_valid(path):\n return (\n bool(path)\n and os.path.isabs(path)\n and os.path.exists(path)\n and (not is_apple() or path.endswith(\".dylib\"))\n )",
"def Valida... | [
"0.558747",
"0.52809876",
"0.52377313",
"0.50975066",
"0.50592226",
"0.5046655",
"0.50263387",
"0.49985436",
"0.49946505",
"0.49753332",
"0.4958943",
"0.4958355",
"0.48810974",
"0.4860872",
"0.48376176",
"0.4824684",
"0.481506",
"0.4802418",
"0.4767467",
"0.4759725",
"0.47442... | 0.7245087 | 0 |
Loads a configuration from an environment variable pointing to a configuration file. This is basically just a shortcut with nicer | def from_envvar(self, variable_name, silent=False):
rv = os.environ.get(variable_name)
if not rv:
if silent:
return False
raise RuntimeError('The environment variable %r is not set '
'and as such configuration could not be '
'loaded. Set this variable and make it '
'point to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config(env_file_path: str) -> None:\n if os.path.isfile(env_file_path):\n load_dotenv(dotenv_path=env_file_path)\n else:\n logger.info(f\".env file does not exist on {env_file_path}. Loading environment variable from the machine\")",
"def load_settings(env=\"prod\"):\n global conf... | [
"0.74765843",
"0.74600065",
"0.74470395",
"0.7430562",
"0.7397101",
"0.7353322",
"0.72494924",
"0.7222283",
"0.7202781",
"0.71942145",
"0.70727456",
"0.6914294",
"0.6894895",
"0.68913084",
"0.68873185",
"0.68520534",
"0.6797871",
"0.6778612",
"0.6776017",
"0.67610717",
"0.675... | 0.7465972 | 1 |
Function to to import data into customer table and return success and error count for inserts | def import_customers(input_data):
error_count = 0
insert_count = 0
LOGGER.info('Starting Customer import')
for onecust in input_data:
try:
Customer(onecust['user_id'], onecust['first_name'], onecust['last_name'],
onecust['address'], onecust['phone_number'], onecu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_import(self):\n\n database.delete_database()\n\n #Fully successful import\n actual_tuples1 = database.import_data('csvs', 'product_data.csv', 'customer_data.csv',\n 'rentals_data.csv')\n expected_tuples1 = ((1, 1, 1), (0, 0, 0))\n ... | [
"0.6880175",
"0.6587729",
"0.6475325",
"0.63756824",
"0.635704",
"0.61101794",
"0.59374183",
"0.59222734",
"0.584351",
"0.57974064",
"0.5794389",
"0.5749154",
"0.5666902",
"0.56425035",
"0.56202424",
"0.5606056",
"0.5592512",
"0.5570438",
"0.5553956",
"0.5546706",
"0.5538326"... | 0.78119606 | 0 |
Function to to import data into products table and return success and error count for inserts | def import_products(input_data):
error_count = 0
insert_count = 0
LOGGER.info('Starting product import')
for oneprod in input_data:
try:
Product(oneprod['product_id'], oneprod['description'], oneprod['product_type'],
oneprod['quantity']).save(full_clean=True, forc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_import(self):\n\n database.delete_database()\n\n #Fully successful import\n actual_tuples1 = database.import_data('csvs', 'product_data.csv', 'customer_data.csv',\n 'rentals_data.csv')\n expected_tuples1 = ((1, 1, 1), (0, 0, 0))\n ... | [
"0.7205454",
"0.6843036",
"0.6732004",
"0.6323785",
"0.625654",
"0.62170696",
"0.6186297",
"0.61729926",
"0.61049217",
"0.6082726",
"0.60693866",
"0.6066227",
"0.6065975",
"0.6064503",
"0.60631615",
"0.5999859",
"0.5967927",
"0.5964014",
"0.59577274",
"0.5945393",
"0.59418017... | 0.79316103 | 0 |
Function to to import data into rental table and return success and error count for inserts | def import_rentals(input_data):
error_count = 0
insert_count = 0
LOGGER.info('Starting rental import')
for onerent in input_data:
try:
Rental(onerent['rental_id'], onerent['user_id'], onerent['product_id']).save(full_clean=True,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_import(self):\n\n database.delete_database()\n\n #Fully successful import\n actual_tuples1 = database.import_data('csvs', 'product_data.csv', 'customer_data.csv',\n 'rentals_data.csv')\n expected_tuples1 = ((1, 1, 1), (0, 0, 0))\n ... | [
"0.62678164",
"0.62354636",
"0.62039506",
"0.61935264",
"0.6193359",
"0.6156778",
"0.6081947",
"0.5987708",
"0.59412384",
"0.57262313",
"0.5705593",
"0.5682023",
"0.5644518",
"0.562816",
"0.5627879",
"0.56163913",
"0.55966115",
"0.55852526",
"0.5581225",
"0.5578956",
"0.55618... | 0.7651243 | 0 |
Extracts last hidden states from both directions. | def extract_hidden_states(self, output):
# Extracting the forward and backward hidden states from the last BiLSTM layer
# output (batch_size, sequence length, 2 * hidden dim)
output_fw = output[:,:,0:self._hidden_size]
output_bw = output[:,:,self._hidden_size:]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_hidden_states(self, output):\n # Intermediate hidden states\n output_fw_intermediate = output[:,:-1,0:self._hidden_size]\n output_bw_intermediate = output[:,1:,self._hidden_size:] \n \n # Last hidden states\n output_fw = output[:,-1,0:self._hidden_size]\n ... | [
"0.7700957",
"0.73588395",
"0.6921017",
"0.6706472",
"0.6245193",
"0.6230705",
"0.61972374",
"0.6155109",
"0.6091971",
"0.60544163",
"0.6048018",
"0.59658885",
"0.584702",
"0.58091694",
"0.58073974",
"0.57948864",
"0.5786997",
"0.5783306",
"0.5776817",
"0.57515407",
"0.575154... | 0.758297 | 1 |
Extracts intermediate and last hidden states | def extract_hidden_states(self, output):
# Intermediate hidden states
output_fw_intermediate = output[:,:-1,0:self._hidden_size]
output_bw_intermediate = output[:,1:,self._hidden_size:]
# Last hidden states
output_fw = output[:,-1,0:self._hidden_size]
output_bw ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_hidden_states(self, output):\n \n # Extracting the forward and backward hidden states from the last BiLSTM layer\n # output (batch_size, sequence length, 2 * hidden dim)\n output_fw = output[:,:,0:self._hidden_size]\n output_bw = output[:,:,self._hidden_size:]\n ... | [
"0.7124553",
"0.66910857",
"0.668173",
"0.6495266",
"0.63891685",
"0.63413036",
"0.63327545",
"0.6322163",
"0.62529796",
"0.6247621",
"0.61202276",
"0.6086323",
"0.6083734",
"0.60036206",
"0.5999816",
"0.5995558",
"0.59741884",
"0.5928138",
"0.5910407",
"0.5886927",
"0.587857... | 0.75195116 | 0 |
Get the link to the mp3 that has the pronunciation of the word | def pron(word):
return send_from_directory('prons', word + ".mp3", mimetype="audio/mpeg") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_url(word):\n\tfor i, _ in enumerate(word['pronunciations']):\n\t\turl = word['pronunciations'][i]['url']\n\n\t\ttry:\n\t\t\togg_file = url.rsplit('/', 1)[1]\n\t\t\tmp3_file = ogg_file.split('.')[0] + '.mp3'\n\n\t\t\tword['pronunciations'][i]['filename'] = mp3_file\n\t\t\tword['pronunciations'][i].pop('... | [
"0.6719211",
"0.6286832",
"0.58968437",
"0.58269715",
"0.57700187",
"0.5694772",
"0.561889",
"0.5577821",
"0.55301756",
"0.5515074",
"0.5479446",
"0.54604495",
"0.54530525",
"0.5450867",
"0.5440568",
"0.5434193",
"0.5410042",
"0.5328304",
"0.5322993",
"0.53166324",
"0.5315228... | 0.68460476 | 0 |
Match sizes by comparing each set field. Process size may change inbetween two measurements. | def _match_sizes(self, pi1, pi2, ignore=[]):
if pi1.available and pi2.available:
for arg in ('vsz', 'rss', 'data_segment', 'shared_segment',
'stack_segment', 'code_segment'):
if arg in ignore:
continue
size1 = getattr(pi1, a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assign_sizes(self):",
"def test_mid_sizes(self):\n for size in settings.MISAGO_AVATARS_SIZES:\n self.assertEqual(clean_size(size - 1), size)",
"def test_valid_sizes(self):\n for size in settings.MISAGO_AVATARS_SIZES:\n self.assertEqual(clean_size(size), size)",
"def c... | [
"0.6204795",
"0.6184761",
"0.61249745",
"0.610729",
"0.59723085",
"0.5955496",
"0.5939015",
"0.5932825",
"0.58930546",
"0.58097595",
"0.58097595",
"0.58097595",
"0.58097595",
"0.58097595",
"0.58097595",
"0.58097595",
"0.5759278",
"0.5759278",
"0.57523656",
"0.57167405",
"0.56... | 0.6783647 | 0 |
Compile conversion option schemas from each of the data interface classes. | def get_conversion_options_schema(self) -> dict:
conversion_options_schema = get_base_schema(
root=True,
id_="conversion_options.schema.json",
title="Conversion options schema",
description="Schema for the conversion options",
version="0.1.0",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_generators():\n return {\n \"trips\": trips_schema,\n \"status_changes\": status_changes_schema,\n \"events\": events_schema,\n \"vehicles\": vehicles_schema,\n \"stops\": stops_schema\n }",
"def buildConverters(tableSpec, tableNamespace):\n converters = []\... | [
"0.56526315",
"0.5620702",
"0.5523117",
"0.55160886",
"0.536558",
"0.51273906",
"0.5100788",
"0.50955427",
"0.50951093",
"0.50712836",
"0.49624124",
"0.49403378",
"0.49315578",
"0.49236938",
"0.48799866",
"0.4868732",
"0.4861183",
"0.48473457",
"0.48407805",
"0.48375595",
"0.... | 0.6372114 | 0 |
Validate source_data against Converter source_schema. | def validate_source(cls, source_data: Dict[str, dict], verbose: bool = True):
cls._validate_source_data(source_data=source_data, verbose=verbose) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(cls, data, errors):",
"def validate(self, *, destination: FieldModel, source: list) -> bool:\n if not isinstance(source, list):\n raise ValueError(f\"Action source script does not conform to required structure. ({source})\")\n for chunk in self.core.chunks(lst=source, n=len(... | [
"0.622033",
"0.61825204",
"0.60589474",
"0.60442704",
"0.60242766",
"0.6022463",
"0.58533144",
"0.5791768",
"0.57778436",
"0.57204026",
"0.56741023",
"0.5669912",
"0.56534284",
"0.56511724",
"0.5648261",
"0.5627419",
"0.5624629",
"0.55918056",
"0.5581766",
"0.5579891",
"0.556... | 0.73413634 | 0 |
Validate source_data against source_schema and initialize all data interfaces. | def __init__(self, source_data: Dict[str, dict], verbose: bool = True):
self.verbose = verbose
self._validate_source_data(source_data=source_data, verbose=self.verbose)
self.data_interface_objects = {
name: data_interface(**source_data[name])
for name, data_interface in s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_source(cls, source_data: Dict[str, dict], verbose: bool = True):\n cls._validate_source_data(source_data=source_data, verbose=verbose)",
"def __post_init__(self):\n # Only do this if source_data already exists (not during its own initialization)\n if \"SOURCE_DATA\" in globals()... | [
"0.696322",
"0.62050235",
"0.5793729",
"0.5759235",
"0.5751692",
"0.5744186",
"0.57387424",
"0.5735445",
"0.5684236",
"0.56799126",
"0.5645745",
"0.56375694",
"0.5569745",
"0.5554738",
"0.55513054",
"0.55060434",
"0.5498737",
"0.54937583",
"0.5421979",
"0.5412901",
"0.5385543... | 0.7059488 | 0 |
Compile metadata schemas from each of the data interface objects. | def get_metadata_schema(self) -> dict:
metadata_schema = load_dict_from_file(Path(__file__).parent / "schemas" / "base_metadata_schema.json")
for data_interface in self.data_interface_objects.values():
interface_schema = unroot_schema(data_interface.get_metadata_schema())
metadat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_schema_from_datafiles(datasets):\n\n schema = {}\n for dataset in datasets:\n schema.update(dataset.native_schema)\n\n return schema",
"def _CreateSchemas(self) -> None:\n self.schema_objs = dict() # Holds OpenAPI representations of types.\n\n # Add the OpenAP... | [
"0.61461616",
"0.60478354",
"0.59317285",
"0.58521867",
"0.57625383",
"0.56529933",
"0.56043863",
"0.553093",
"0.55201304",
"0.5496202",
"0.5449299",
"0.53587925",
"0.5321705",
"0.530396",
"0.5268813",
"0.5268668",
"0.52536666",
"0.5236021",
"0.5233846",
"0.522641",
"0.522080... | 0.6485286 | 0 |
Validate metadata against Converter metadata_schema. | def validate_metadata(self, metadata: Dict[str, dict]):
encoder = NWBMetaDataEncoder()
# The encoder produces a serialiazed object so we de serialized it for comparison
serialized_metadata = encoder.encode(metadata)
decoded_metadata = json.loads(serialized_metadata)
validate(inst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate(self):\n if not self._contents.has_key('type'):\n raise ValidationFailed(\"Metadata file %s contains no type field\" % (self._filename))\n \n if not self._contents.has_key('version'):\n raise ValidationFailed(\"Metadata file %s contains no version field\" %\... | [
"0.67834675",
"0.6774967",
"0.6396517",
"0.6372613",
"0.6314087",
"0.62640077",
"0.61724794",
"0.61656445",
"0.61574095",
"0.61177945",
"0.60506034",
"0.6029551",
"0.6025059",
"0.6017817",
"0.601185",
"0.5954007",
"0.59126073",
"0.59023726",
"0.5883788",
"0.5880836",
"0.58434... | 0.7296295 | 0 |
Validate conversion_options against Converter conversion_options_schema. | def validate_conversion_options(self, conversion_options: Dict[str, dict]):
validate(instance=conversion_options or {}, schema=self.get_conversion_options_schema())
if self.verbose:
print("conversion_options is valid!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_conversion_schema():\n legal_filing = {'conversion': BEN_CONVERSION}\n is_valid, errors = validate(legal_filing, 'conversion')\n\n if errors:\n for err in errors:\n print(err.message)\n print(errors)\n\n assert is_valid",
"def __validate_options__(cls, options):\n ... | [
"0.6484723",
"0.6115653",
"0.6110735",
"0.6048836",
"0.6048836",
"0.5758768",
"0.5712079",
"0.57083374",
"0.55992967",
"0.5536905",
"0.55322844",
"0.5477315",
"0.54282635",
"0.5426897",
"0.5373139",
"0.5366407",
"0.53514874",
"0.53224105",
"0.53178",
"0.52855515",
"0.52787715... | 0.84981906 | 0 |
Compile conversion option schemas from each of the data interface classes. | def get_conversion_options_schema(self) -> dict:
conversion_options_schema = get_base_schema(
root=True,
id_="conversion_options.schema.json",
title="Conversion options schema",
description="Schema for the conversion options",
version="0.1.0",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_generators():\n return {\n \"trips\": trips_schema,\n \"status_changes\": status_changes_schema,\n \"events\": events_schema,\n \"vehicles\": vehicles_schema,\n \"stops\": stops_schema\n }",
"def buildConverters(tableSpec, tableNamespace):\n converters = []\... | [
"0.56542283",
"0.56212246",
"0.5526179",
"0.55158335",
"0.53670424",
"0.5130123",
"0.5103227",
"0.50974584",
"0.50963557",
"0.5072053",
"0.49627963",
"0.49403316",
"0.49340504",
"0.49235007",
"0.48808965",
"0.48718503",
"0.48601958",
"0.48495325",
"0.48423228",
"0.48361728",
... | 0.636941 | 1 |
@ get all episodes in selected asset type, and if project type is not series then return None. | def bsw_getAllAssetEpisodes(astType):
# get basic inputs.
basePath = ProjectNamingInputs().basePath
projectName = ProjectNamingInputs().projectName
assetType = ProjectNamingInputs().assetType
projectType = ProjectNamingInputs().projectType
if projectType == 'series':
episodeDir = '{baseP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_episodes(self):\n return [series_episode for series_episode in SeriesEpisode.objects.filter(series=self)]",
"def episodes(self):\n if self._episode_cache_ver == self._db._version:\n return self._episode_cache\n\n # Get only rows from the preferred provider (provider id is... | [
"0.6472294",
"0.6238427",
"0.6109521",
"0.6061909",
"0.58215487",
"0.5817781",
"0.56866485",
"0.5580703",
"0.5557396",
"0.5460225",
"0.5414427",
"0.5404259",
"0.5401844",
"0.53146833",
"0.53129226",
"0.51491994",
"0.51185447",
"0.5114288",
"0.5105471",
"0.50925493",
"0.507416... | 0.7465757 | 0 |
@ get all asset names of asset types from directory. | def bsw_getAllAssetNames(astType, episode=None):
# get basic inputs.
basePath = ProjectNamingInputs().basePath
projectName = ProjectNamingInputs().projectName
assetType = ProjectNamingInputs().assetType
projectType = ProjectNamingInputs().projectType
if projectType == 'series':
assetDire... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listAssetTypes(self):\n return self.get_json('/assetType')",
"def get_custom_asset_types() -> list[str]:\n with GlobalDBHandler().conn.read_ctx() as cursor:\n cursor.execute('SELECT DISTINCT type FROM custom_assets ORDER BY type;')\n return [entry[0] for entry in cursor]",... | [
"0.74853826",
"0.69678617",
"0.6263411",
"0.6205344",
"0.61148363",
"0.609677",
"0.60557204",
"0.6006449",
"0.5994604",
"0.5930386",
"0.59195334",
"0.58995765",
"0.58823216",
"0.5859081",
"0.5832998",
"0.58204025",
"0.5820043",
"0.581612",
"0.5813952",
"0.5796276",
"0.5788555... | 0.71672857 | 1 |
@ create asset directories of all department. | def bsw_createAssetDirectories(astType, astName, episode=None):
# get all asset department directory template.
projectType = ProjectNamingInputs().projectType
if projectType == 'series':
assetDeptDir = bsw_getAssetDeptDirs(astType, astName, episode=episode)
else:
assetDeptDir = bsw_getAs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_directories(self):\n print \"[--init] creating directory structure in %s\" % (self.target_path)\n ensure_path(self.conf_path)\n for subdir in config.PROCESSING_AREAS:\n subdir_path = self.data_path + os.sep + subdir\n ensure_path(subdir_path)",
"def createAs... | [
"0.7096028",
"0.67460805",
"0.6727249",
"0.66118586",
"0.6416269",
"0.6301152",
"0.6208901",
"0.6203855",
"0.6202322",
"0.6182706",
"0.616796",
"0.6159768",
"0.61580974",
"0.61043555",
"0.6102615",
"0.60950065",
"0.60941195",
"0.60727894",
"0.60680026",
"0.6064777",
"0.605273... | 0.71996766 | 0 |
@ return all department wise asset return name if file is exist. | def bsw_getValidDeptAssetNames(astType, astDept, episode=None):
# get all asset names.
projectShortName = ProjectNamingInputs().projectShortName
projectType = ProjectNamingInputs().projectType
if projectType == 'series':
assetNames = bsw_getAllAssetNames(astType, episode=episode)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_data_asset_names(self) -> List[str]:\n raise NotImplementedError",
"def assetName(self):\n\t\treturn self._assetName",
"def bsw_getAssetDeptDirs(astType, astName, episode=None):\n basePath = ProjectNamingInputs().basePath\n projName = ProjectNamingInputs().projectName\n assetT... | [
"0.5815256",
"0.5636447",
"0.55993414",
"0.55701506",
"0.55508494",
"0.54256535",
"0.5399064",
"0.53980976",
"0.5394662",
"0.53775007",
"0.53440297",
"0.533159",
"0.5322432",
"0.5286498",
"0.526668",
"0.5252649",
"0.52432853",
"0.5233909",
"0.5209876",
"0.5205642",
"0.5201809... | 0.6095677 | 0 |
@ get asset details from root group entries which created in asset generation time. | def bsw_getAssetDetails(rootGrpName=None):
if not rootGrpName:
if pm.objExists('Texture_Group'):
rootGrpName = 'Texture_Group'
elif pm.objExists('rig_grp'):
rootGrpName = 'rig_grp'
elif pm.objExists('geo'):
rootGrpName = 'geo'
else:
roo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAssetInfo(self):\n return self._AssetInfo",
"def getInfo(self):\n doc = minidom.parse(urllib.urlopen(serverString + \"/rest/asset/\" + self.id))\n self._getInfoFromNode(doc.getElementsByTagName(\"asset\")[0])",
"def get_assets(id_group):\n data = sql.list_assets(id_group)\n na... | [
"0.5737252",
"0.57269895",
"0.56889707",
"0.5585239",
"0.55731195",
"0.55246085",
"0.55192024",
"0.546723",
"0.5462399",
"0.53377986",
"0.533493",
"0.5249755",
"0.523537",
"0.51746964",
"0.516901",
"0.5139736",
"0.5098993",
"0.5071982",
"0.50337255",
"0.501638",
"0.49910238",... | 0.6417712 | 0 |
@ get only final file of required department. | def bsw_getOnlyFinalFileOfDept(astType, astDept, astName, episode=None):
projectShortName = ProjectNamingInputs().projectShortName
astTypShortCode = {'Character': 'ch', 'Prop': 'pr', 'Set': 'bg', 'Vehicle': 'vh', 'SetElement': 'se'}
astDeptShortCode = {'Model': 'mod', 'Rig': 'rig', 'Texture': 'tex', 'Light'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file(plan, shape=False):\n if (DistrictFile.get_file_status(plan, shape) == 'done'):\n file_name = DistrictFile.get_file_name(plan, shape) + '.zip'\n return file_name",
"def get_dsc(self):\n for path in self.get_all_files():\n if path.endswith('.dsc'):\n ... | [
"0.6320338",
"0.5684126",
"0.5551462",
"0.5470761",
"0.53162855",
"0.52884984",
"0.5274076",
"0.5233386",
"0.5233386",
"0.5226018",
"0.51835144",
"0.51724654",
"0.512775",
"0.5127529",
"0.5094329",
"0.5093315",
"0.5081137",
"0.5072476",
"0.50506085",
"0.50324",
"0.5015832",
... | 0.64966166 | 0 |
Negative sampling cost function for word2vec models | def negSamplingCostAndGradient(predicted, target, outputVectors, dataset,
K=10):
# Implement the cost and gradients for one predicted word vector
# and one target word vector as a building block for word2vec
# models, using the negative sampling technique. K is the sample
# size. You might want to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neg_sampling_loss_and_gradient(\n center_word_vec,\n outside_word_idx,\n outside_vectors,\n dataset,\n K=10\n):\n\n # Negative sampling of words is done for you. Do not modify this if you\n # wish to match the autograder and receive points!\n neg_sample_word_indices ... | [
"0.6708602",
"0.64941853",
"0.64483947",
"0.6427767",
"0.6373894",
"0.6373894",
"0.6373894",
"0.6267261",
"0.6267261",
"0.6156621",
"0.61330694",
"0.6097435",
"0.6084569",
"0.602716",
"0.60267574",
"0.6020172",
"0.60125136",
"0.600268",
"0.59315264",
"0.59011626",
"0.5843728"... | 0.67069376 | 1 |
CBOW model in word2vec | def cbow(currentWord, C, contextWords, tokens, inputVectors, outputVectors,
dataset, word2vecCostAndGradient = softmaxCostAndGradient):
# Implement the continuous bag-of-words model in this function.
# Input/Output specifications: same as the skip-gram model
# We will not provide starter code for this ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cbow(currentWord, C, contextWords, tokens, inputVectors, outputVectors,\n dataset, word2vecCostAndGradient=softmaxCostAndGradient):\n\n cost = 0.0\n gradIn = np.zeros(inputVectors.shape)\n gradOut = np.zeros(outputVectors.shape)\n\n ### YOUR CODE HERE\n target = tokens[currentWord]\n\n ... | [
"0.6977331",
"0.6879846",
"0.6852588",
"0.6753627",
"0.6711709",
"0.66832954",
"0.66618025",
"0.6635551",
"0.6472121",
"0.6373049",
"0.6366068",
"0.63088983",
"0.63043493",
"0.6302005",
"0.62772036",
"0.6273346",
"0.62633795",
"0.6254702",
"0.618194",
"0.6137404",
"0.6132508"... | 0.75711095 | 0 |
Create Parameter Keyword Arguments for the `Minuit` constructor. | def make_minuit_par_kwargs(parameters):
kwargs = {}
for par in parameters.parameters:
kwargs[par.name] = par.value
min_ = None if np.isnan(par.min) else par.min
max_ = None if np.isnan(par.max) else par.max
kwargs['limit_{}'.format(par.name)] = (min_, max_)
if parameter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(**params):",
"def define_parameters(self):",
"def __init__(self, *args: Union[List[AtomKey], HKT], **kwargs: str) -> None:\n ...",
"def define_parameters(self):\n self.add_argument('--prefix', dest='prefix', type=str, optional=False,\n help='prefix for file... | [
"0.6288195",
"0.6145601",
"0.608256",
"0.6077384",
"0.60681677",
"0.6064592",
"0.60551435",
"0.60317856",
"0.60270023",
"0.60270023",
"0.60270023",
"0.60270023",
"0.60270023",
"0.60270023",
"0.60270023",
"0.60239285",
"0.5958885",
"0.5912476",
"0.5897381",
"0.5871605",
"0.587... | 0.67365843 | 0 |
Get full covar matrix as Numpy array. This was added as `minuit.np_covariance` in `iminuit` in v1.3, but we still want to support v1.2 | def _get_covar(minuit):
n = len(minuit.parameters)
m = np.zeros((n, n))
for i1, k1 in enumerate(minuit.parameters):
for i2, k2 in enumerate(minuit.parameters):
if set([k1, k2]).issubset(minuit.list_of_vary_param()):
m[i1, i2] = minuit.covariance[(k1, k2)]
return m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def covar(self) -> np.ndarray:\n if self._covar is None:\n self._covar = batched_inv_spd(batched_cholesky(self._inv_covar))\n return self._covar",
"def covariance(data_matrix):\n return np.asmatrix(np.cov(data_matrix, rowvar=0))",
"def get_cov_matrix_states(self):\n cov = num... | [
"0.715",
"0.6918695",
"0.68584454",
"0.68436575",
"0.6735441",
"0.66587955",
"0.665023",
"0.6618526",
"0.65532213",
"0.65131664",
"0.648743",
"0.6473425",
"0.6427018",
"0.64248204",
"0.640013",
"0.6393602",
"0.63809496",
"0.63302636",
"0.631944",
"0.63151485",
"0.62982684",
... | 0.75416523 | 0 |
Returns true if there is more than one active project associated with this client. | def has_multiple_projects(self):
return self.projects.filter(active=True).count() > 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_projects(self):\n return self.projects.filter(active=True)",
"def is_active(self) -> bool:\n return any(x is not None for x in self._constraints)",
"def is_competition(self):\n return self.db_is_competition",
"def is_project(self, project):\n return self._projects_looku... | [
"0.65099156",
"0.6169773",
"0.61593264",
"0.6121147",
"0.61132723",
"0.61132723",
"0.5950498",
"0.5926298",
"0.58955985",
"0.5866945",
"0.5798091",
"0.5769043",
"0.57587534",
"0.5707796",
"0.5696425",
"0.56953526",
"0.5688109",
"0.5679527",
"0.5667053",
"0.5654484",
"0.562980... | 0.8511699 | 0 |
Returns the active projects for the client. | def active_projects(self):
return self.projects.filter(active=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects(self):\n return conf.projects",
"def get_client_projects(self, client=None):\n if type(client) is Client:\n return [p for p in self.project_list if client.client_id == p.client_id]",
"def get_projects(self):\n return self.http_call(\"get\", url=f\"{self.base_url... | [
"0.79490113",
"0.7929667",
"0.77085984",
"0.7485822",
"0.7469964",
"0.74452794",
"0.74072176",
"0.73590404",
"0.7318829",
"0.724942",
"0.7204794",
"0.71989226",
"0.719029",
"0.7152463",
"0.7124276",
"0.7114484",
"0.7078646",
"0.7010834",
"0.7005374",
"0.6980954",
"0.6970034",... | 0.8063469 | 0 |
Process a document into its final form. Translate `document` (a Docutils document tree) into the Writer's native format, and write it out to its `destination` (a `docutils.io.Output` subclass object). Normally not overridden or extended in subclasses. | def write(self, document, destination):
self.document = document
self.language = languages.get_language(
document.settings.language_code,
document.reporter)
self.destination = destination
self.translate()
output = self.destination.write(self.output)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emit_document(self, document):\n raise NotImplementedError()",
"def _transform(self, document):\n pass",
"def process_document(self, document, **kwargs):\n \n start = time.time()\n\n if self._log_file is not None:\n map_annotations_logger.addHandler(file_handle... | [
"0.60927504",
"0.5725874",
"0.54091835",
"0.52739656",
"0.5214437",
"0.51614934",
"0.5158953",
"0.5158953",
"0.5136689",
"0.50936973",
"0.5086801",
"0.50783026",
"0.50710064",
"0.49749365",
"0.49396706",
"0.4884253",
"0.4865418",
"0.48605415",
"0.48564097",
"0.48286474",
"0.4... | 0.72632694 | 0 |
Return the Writer class from the `writer_name` module. | def get_writer_class(writer_name):
writer_name = writer_name.lower()
if writer_name in _writer_aliases:
writer_name = _writer_aliases[writer_name]
try:
module = __import__(writer_name, globals(), locals(), level=1)
except ImportError:
module = __import__(writer_name, globals(), l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_writer_class(cls) -> 'Type[SpectrumWriter]':\n raise NotImplementedError(SpectrumReader.get_writer_class.__qualname__)",
"def _get_writer(self, writer_name):\r\n if writer_name not in self._writers:\r\n path = os.path.join(self.log_dir, writer_name)\r\n writer = summary_ops_v2.create_... | [
"0.69305336",
"0.6689665",
"0.6409046",
"0.62630635",
"0.6220382",
"0.58785063",
"0.5845479",
"0.5839867",
"0.58295506",
"0.56432635",
"0.5637954",
"0.5606227",
"0.5554922",
"0.5537747",
"0.5523522",
"0.5474596",
"0.5463936",
"0.54269594",
"0.5412886",
"0.54028976",
"0.538162... | 0.9022644 | 0 |
Test to validate that custom payloads work with simple queries creates a simple query and ensures that custom payloads are passed to C. A custom query provider is used with C so we can validate that same custom payloads are sent back with the results 2.6 PYTHON280 valid custom payloads should be sent and received | def test_custom_query_basic(self):
# Create a simple query statement a
query = "SELECT * FROM system.local"
statement = SimpleStatement(query)
# Validate that various types of custom payloads are sent and received okay
self.validate_various_custom_payloads(statement=statement) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load_kql_query_defs(self):\n la_provider = self.la_provider\n la_provider.connect(connection_str=\"test\")\n self.assertEqual(getattr(la_provider, \"test\"), \"CustomAttrib\")\n\n # Did we read and process the query definitions OK\n q_sources = la_provider.query_store.da... | [
"0.6527704",
"0.64625055",
"0.6448495",
"0.64351636",
"0.63665766",
"0.60493946",
"0.60140413",
"0.5982427",
"0.59034127",
"0.58764935",
"0.5842737",
"0.578988",
"0.5781109",
"0.5768024",
"0.5743283",
"0.5735624",
"0.5709683",
"0.5625501",
"0.5560789",
"0.5519123",
"0.5516742... | 0.80934554 | 0 |
Test to validate that custom payloads work with batch queries creates a batch query and ensures that custom payloads are passed to C. A custom query provider is used with C so we can validate that same custom payloads are sent back with the results 2.6 PYTHON280 valid custom payloads should be sent and received | def test_custom_query_batching(self):
# Construct Batch Statement
batch = BatchStatement(BatchType.LOGGED)
for i in range(10):
batch.add(SimpleStatement("INSERT INTO test3rf.test (k, v) VALUES (%s, %s)"), (i, i))
# Validate that various types of custom payloads are sent and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_custom_query_basic(self):\n\n # Create a simple query statement a\n query = \"SELECT * FROM system.local\"\n statement = SimpleStatement(query)\n # Validate that various types of custom payloads are sent and received okay\n self.validate_various_custom_payloads(statement... | [
"0.6579624",
"0.6282645",
"0.5862671",
"0.58041817",
"0.5789634",
"0.571839",
"0.5674159",
"0.5659514",
"0.5572245",
"0.55634826",
"0.552229",
"0.54960763",
"0.54557633",
"0.5425926",
"0.5420833",
"0.54062617",
"0.5386587",
"0.5372885",
"0.5361616",
"0.531875",
"0.53118783",
... | 0.7527416 | 0 |
This is just a simple method that submits a statement with a payload, and validates that the custom payload we submitted matches the one that we got back statement The statement to execute custom_payload The custom payload to submit with | def execute_async_validate_custom_payload(self, statement, custom_payload):
# Submit the statement with our custom payload. Validate the one
# we receive from the server matches
response_future = self.session.execute_async(statement, custom_payload=custom_payload)
response_future.result... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_various_custom_payloads(self, statement):\n\n # Simple key value\n custom_payload = {'test': b'test_return'}\n self.execute_async_validate_custom_payload(statement=statement, custom_payload=custom_payload)\n\n # no key value\n custom_payload = {'': b''}\n self... | [
"0.63223815",
"0.6253099",
"0.59362966",
"0.5643522",
"0.5596571",
"0.5494747",
"0.5285481",
"0.5124251",
"0.5088654",
"0.50280416",
"0.50209314",
"0.50113577",
"0.50002974",
"0.49883088",
"0.49857587",
"0.49452132",
"0.4872657",
"0.48709938",
"0.48590347",
"0.4841354",
"0.48... | 0.7807556 | 0 |
Matches each point in the region to minimum SSD template from entire list of templates | def processRegionSSD( self, r ):
ixs = TemplateMatcher.matIxs( self.n ** 2 )
## 5 x 5 windows for region r
ws = map( lambda x : TemplateMatcher.slice( r, self.n, x ), ixs )
ts = map( lambda w : map( lambda t : TemplateMatcher.SSD( t, w ), self.templates ) , ws)
tMatch = map( la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templateMatchMulti(img, template):\n\tgray = grayscale(img)\n\ttemp = grayscale(template)\n\tw, h = temp.shape[::-1]\n\tres = cv2.matchTemplate(gray, temp, cv2.TM_CCOEFF_NORMED)\n\tthreshold = 0.8\n\tloc = np.where(res >= threshold)\n\tpts = []\n\tfor pt in zip(*loc[::-1]):\n\t\trect = [pt, (pt[0] + w, pt[1] +... | [
"0.61586505",
"0.58594805",
"0.57886225",
"0.5669279",
"0.56338966",
"0.56214774",
"0.56101286",
"0.5605014",
"0.551976",
"0.5498334",
"0.5397037",
"0.5397037",
"0.53930295",
"0.5299927",
"0.5288984",
"0.52475137",
"0.5227831",
"0.51846814",
"0.5125249",
"0.51196617",
"0.5094... | 0.6197051 | 0 |
Slices matrix centered around point pt to have size nxn If area includes the edge of imaged area, 0 padded rows/cols are added lc uc lr | | | ur | def slice( mat, n, pt ):
lc, uc = TemplateMatcher.hinge( pt.x, n ) ## column limits
lr, ur = TemplateMatcher.hinge( pt.y, n )
nr, nc = np.shape( mat )
nr = nr - 1
nc = nc - 1
alc, auc = lc, uc
alr, aur = lr, ur
rpb, rpa, cpl, cpr = [0,0,0,0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyKernelToPoints(image,pts,kernel,border_type='BLACK'):\n \n \n pts=np.asarray(pts)\n image=np.asarray(image)\n image.shape\n if len(image.shape)>2:\n grayscale=False\n shaperesult=(len(pts),image.shape[2])\n elif len(image.shape)==1:\n image=image.reshape(1,image.s... | [
"0.5488434",
"0.5432423",
"0.53871787",
"0.5326633",
"0.5318443",
"0.52965856",
"0.52940756",
"0.52368885",
"0.5177451",
"0.5161178",
"0.5160577",
"0.5142208",
"0.51415056",
"0.5134802",
"0.5108706",
"0.5104009",
"0.5100073",
"0.5083504",
"0.50543976",
"0.50510263",
"0.503998... | 0.6774917 | 0 |
Parses the given data which should be retrieved from a standard format JSON file and turns it into a DemoInfo instance. | def from_json(cls, json_data, demo_name):
cur_bm = []
cur_ks = []
for k in json_data["events"]:
if k["name"] == "Killstreak":
cur_ks.append(DemoEvent(int(k["value"]), int(k["tick"]), None))
elif k["name"] == "Bookmark":
cur_bm.append(DemoEvent(k["value"], int(k["tick"]), None))
return cls(demo_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_json_reader_data_contents(process_data):\n json_data = process_data(file_name_or_type='scooter_data.json')\n for val in json_data:\n assert(isinstance(val['id'], int))\n assert(isinstance(val['name'], str))\n assert(isinstance(val['vin_number'], str))\n assert(isinstance(... | [
"0.6023979",
"0.58691",
"0.57561564",
"0.5740799",
"0.5706439",
"0.56778896",
"0.56699413",
"0.5652918",
"0.5647447",
"0.56199074",
"0.56082773",
"0.55712605",
"0.5567739",
"0.5567385",
"0.5561605",
"0.55434746",
"0.5526353",
"0.5500797",
"0.550043",
"0.5485761",
"0.5455614",... | 0.6014086 | 1 |
Takes a handle_events.RawLogchunk and converts it into DemoInfo. | def from_raw_logchunk(cls, in_chk):
loglines = in_chk.content.split("\n")
if not loglines:
raise ValueError("Logchunks may not be empty.")
regres = RE_LINE.search(loglines[0])
if not regres:
raise ValueError("Regex match failed, Logchunk malformed.")
demo = regres[GROUP.DEMO] + ".dem"
killstreaks = [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_sample(self, line, publish=True):\n sample = None\n match = self._sample_regex.match(line)\n if match:\n sample = {}\n sample['t'] = [float(match.group(1))]\n sample['c'] = [float(match.group(2))]\n sample['p'] = [float(match.group(3))]\... | [
"0.5132385",
"0.5127417",
"0.51171947",
"0.5102437",
"0.5070641",
"0.49931782",
"0.48906305",
"0.488175",
"0.4847076",
"0.48453277",
"0.48372746",
"0.48219904",
"0.4818269",
"0.47931176",
"0.47858205",
"0.4750492",
"0.47170094",
"0.46886584",
"0.4665421",
"0.46565127",
"0.464... | 0.60423684 | 0 |
Action comboBox box changed | def comboBoxChanged(self):
new_action = self.ui.comboBoxAction.currentText().lower()
self.parameters['action'] = new_action
self.changed.emit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_comboBox_celuebianhao_currentIndexChanged(self, p0):\n # TODO: not implemented yet\n raise NotImplementedError",
"def on_comboBox_qihuozhanghao_currentIndexChanged(self, p0):\n # TODO: not implemented yet\n raise NotImplementedError",
"def on_comboBox_jiaoyimoxing_currentInde... | [
"0.71040225",
"0.6949202",
"0.6788177",
"0.6759619",
"0.66363245",
"0.65092915",
"0.6395416",
"0.63920945",
"0.636702",
"0.63205105",
"0.6268223",
"0.620821",
"0.6175454",
"0.6147484",
"0.6136072",
"0.613324",
"0.61324733",
"0.6116489",
"0.6108808",
"0.61041707",
"0.6085081",... | 0.8299217 | 0 |
Logs a message via vumi.log (i.e. Twisted logging). Subclass should override this if they wish to log messages elsewhere. The `api` parameter is provided for use by such subclasses. The `log` method should always return a deferred. | def log(self, api, msg, level):
return succeed(log.msg(msg, logLevel=level)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(self, message: str):",
"def log(self, message):",
"def handle_log(self, api, command, level=None):\n level = command.get('level', level)\n if level is None:\n level = logging.INFO\n msg = command.get('msg')\n if msg is None:\n returnValue(self.reply(com... | [
"0.62588555",
"0.61909205",
"0.60318035",
"0.5876172",
"0.5767462",
"0.5719353",
"0.56615025",
"0.56615025",
"0.56079364",
"0.5598509",
"0.55829424",
"0.5562299",
"0.5525649",
"0.55162686",
"0.5513187",
"0.5507155",
"0.54979646",
"0.5494922",
"0.54893714",
"0.5478701",
"0.546... | 0.6609489 | 0 |
Use ClientContextFactory directly and set the method if necessary. This will perform no host verification at all. | def _get_noverify_context(self):
from twisted.internet.ssl import ClientContextFactory
context_factory = ClientContextFactory()
if self.ssl_method is not None:
context_factory.method = self.ssl_method
return context_factory.getContext() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, url, **kwargs):\n self.hostname = self.getHostnameFromURL(url)\n\n # ``verify`` here refers to server-side verification of certificates\n # presented by a client:\n self.verify = False if self.isClient else True\n super(SSLVerifyingContextFactory, self).__init_... | [
"0.58759177",
"0.57396954",
"0.5704184",
"0.5654362",
"0.5596379",
"0.5576222",
"0.5547429",
"0.5513605",
"0.551157",
"0.54686517",
"0.5450384",
"0.54451317",
"0.54451317",
"0.54451317",
"0.54451317",
"0.54451317",
"0.5389514",
"0.53803885",
"0.53754294",
"0.5344577",
"0.5342... | 0.57632256 | 1 |
Return a sandbox id for a message or event. Subclasses may override this to retrieve an appropriate id. | def sandbox_id_for_message(self, msg_or_event):
return msg_or_event['sandbox_id'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self) -> str:\n return self._event.get('id')",
"def getId(self):\n return _libsbml.Event_getId(self)",
"def getMessageID(self):\n return self._payload[1]",
"def message_id(self) -> int:\n enforce(self.is_set(\"message_id\"), \"message_id is not set.\")\n return cast(... | [
"0.6507702",
"0.627226",
"0.6100435",
"0.6046295",
"0.60373926",
"0.5947721",
"0.59358907",
"0.5924999",
"0.5924389",
"0.5914692",
"0.58880615",
"0.58774614",
"0.5876454",
"0.5876454",
"0.5876454",
"0.5876454",
"0.5876454",
"0.5876454",
"0.5876454",
"0.5876454",
"0.5876454",
... | 0.88027954 | 0 |
Return a sandbox protocol for a message or event. Subclasses may override this to retrieve an appropriate protocol. | def sandbox_protocol_for_message(self, msg_or_event, config):
api = self.create_sandbox_api(self.resources, config)
protocol = self.create_sandbox_protocol(api)
return protocol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protocol(self):\n self._recv_protocol()\n return self._protocol",
"def protocol(self) -> MessageProtocol:\n return self._sender.protocol",
"def getProtocol(self, _):\r\n return self._protocol",
"def protocol(self) -> NetworkProtocol:\n if hasattr(self, \"_protocol\"):\n... | [
"0.6581834",
"0.65799445",
"0.65358585",
"0.645299",
"0.62877756",
"0.6196647",
"0.6158876",
"0.6152343",
"0.6143666",
"0.60666347",
"0.60666347",
"0.60666347",
"0.60666347",
"0.60666347",
"0.606265",
"0.606265",
"0.5934752",
"0.59274423",
"0.58809066",
"0.5875745",
"0.586304... | 0.80012 | 0 |
Returns formatted output for a dictionary with string keys and float values. | def format_dict(d: Dict[str, float], format: str=".4f") -> Dict[str, float]:
return dict((k, float(f'{v:{format}}')) for k,v in d.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_dict(dictionary):\n for key in sorted(dictionary.keys()):\n value = dictionary[key]\n if type(value) == float:\n value = round(value, 8)\n print key, value",
"def print_dict(dictionary):\r\n for key in sorted(dictionary.keys()):\r\n value = dictionary[key]\r... | [
"0.70268685",
"0.70015323",
"0.6506103",
"0.65015024",
"0.63505834",
"0.63133466",
"0.61922085",
"0.6134083",
"0.6098064",
"0.6060226",
"0.6022871",
"0.6014576",
"0.5958936",
"0.5937073",
"0.5937073",
"0.5933473",
"0.5883104",
"0.5847088",
"0.5822004",
"0.5818801",
"0.581338"... | 0.7233693 | 0 |
Create contour plots for a study, given a list or tuple of two parameter names. | def study_contour_plot(study: optuna.Study,
params: Optional[List[str]]=None,
width: int=560,
height: int=500):
if params is None:
params = ["dv", "vc"]
fig = optuna.visualization.plot_contour(study, params=params)
fig.update_la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_plots(fig_title, \n t_csd_x, t_csd_y, t_csd_z, true_csd, \n ele_x, ele_y, ele_z, pots,\n k_csd_x, k_csd_y, k_csd_z, est_csd):\n fig = plt.figure(figsize=(10,16))\n #True CSD\n z_steps = 5\n height_ratios = [1 for i in range(z_steps)]\n height_ratios... | [
"0.62037873",
"0.58769345",
"0.5820305",
"0.57832277",
"0.57221377",
"0.56909025",
"0.5687232",
"0.562841",
"0.5538102",
"0.5485024",
"0.54831433",
"0.54714435",
"0.5457713",
"0.5433277",
"0.54000473",
"0.53964806",
"0.5381867",
"0.53771883",
"0.53722656",
"0.5367312",
"0.536... | 0.7024441 | 0 |
Keyword arguments specify which objects should be read from ROOT files. types sets the list of possible objects types. keys specifies a list of allowed objects' names. Only simple keys are currently allowed (no regular expressions). If both types and keys are provided, then objects that satisfy any of types or keys are... | def __init__(self, types=None, keys=None, selector=None):
try:
import ROOT
except ImportError:
raise ImportError("ROOT not installed")
if selector is not None:
if keys or types:
raise lena.core.LenaTypeError(
"if selector i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_select(self, selected):\n\t\tfor filename in selected:\n\t\t\tself.load(filename)\n\n\t\tif \"worddict\" in selected and \"classdict\" in selected:\n\t\t\tself.reverse_dicts()",
"def selector(**kwargs):\n return kwargs",
"def select(self, mode, types=None, types_excluded=None, layers=None, layers_e... | [
"0.5373972",
"0.5329947",
"0.51422113",
"0.5035492",
"0.47958642",
"0.4764183",
"0.4713935",
"0.4688114",
"0.46815497",
"0.46460122",
"0.46450743",
"0.46351984",
"0.4616212",
"0.46100155",
"0.46050787",
"0.45995423",
"0.457178",
"0.4546644",
"0.4534454",
"0.45308408",
"0.4524... | 0.71854883 | 0 |
Read ROOT files from flow and yield objects they contain. For file to be read, data part of the value must be a string (file's path) and context.input.read_root_file must not be `False`. Other values pass unchanged. After all entries from the file are yielded, it is closed. context.input.root_file_path is updated with ... | def run(self, flow):
from ROOT import TFile
from lena.context import get_recursively, update_recursively
from lena.flow import get_data_context
from copy import deepcopy
for val in flow:
data, context = get_data_context(val)
# skip not ROOT files
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_and_folders(self):\n yield from self._root.files_and_folders(0)",
"def files_from_roots(roots, accept):\n for root in roots:\n if root is not None:\n yield from files_from_root(root, accept)",
"def open_test_root_fs() -> FS:\n cwd = os.path.dirname(__file__)\n return... | [
"0.55671173",
"0.5524454",
"0.5513734",
"0.5512159",
"0.54909235",
"0.5358831",
"0.5296867",
"0.5270758",
"0.5249741",
"0.51901007",
"0.5162517",
"0.514831",
"0.5129456",
"0.5121177",
"0.5115669",
"0.5112054",
"0.51021385",
"0.50759375",
"0.5071909",
"0.5056866",
"0.5011314",... | 0.7067436 | 0 |
Overrides the superclass is_executable. | def is_executable(self, path):
if (CGIHTTPServer.CGIHTTPRequestHandler.is_executable(self, path)):
return True
if self.is_python(path):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_executable(self):\n raise NotImplementedError()",
"def supports_sys_executable(self):\n return bool(getattr(sys, \"executable\", None))",
"def is_executable(exe):\n return os.path.isfile(exe) and os.access(exe, os.X_OK)",
"def is_executable(path):\n return (os.path.exists(path)... | [
"0.8627345",
"0.752851",
"0.7447119",
"0.73333514",
"0.72728646",
"0.7150464",
"0.7150464",
"0.7135183",
"0.7128636",
"0.7040618",
"0.69863826",
"0.6962569",
"0.6943312",
"0.6934778",
"0.6912176",
"0.6887747",
"0.6695774",
"0.66032755",
"0.64987844",
"0.64442396",
"0.64369684... | 0.7610795 | 1 |
Return True if the superclass thinks its true, or if the path ends with .cgi | def is_python(self, path):
if (CGIHTTPServer.CGIHTTPRequestHandler.is_python(self, path)):
return True
if path.endswith(".cgi"):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_is_base(self, path):\n\n return path is not None and len(path) == len(self.levels)",
"def _has_extension(self, path):\r\n if re.match(r'.*\\\\.*\\..*$', path):\r\n return True",
"def is_executable(self, path):\n if (CGIHTTPServer.CGIHTTPRequestHandler.is_executable(self, path)):\... | [
"0.59074575",
"0.5889889",
"0.5860048",
"0.58529234",
"0.5796067",
"0.57866293",
"0.57298136",
"0.5704744",
"0.56834686",
"0.5630984",
"0.55862296",
"0.5585162",
"0.5582354",
"0.5515081",
"0.5491662",
"0.5480578",
"0.5480194",
"0.5464567",
"0.54597604",
"0.5437157",
"0.543539... | 0.750505 | 0 |
ECHO test for GET utility | def test_GET_fetcher():
params = {
'key1':'value1',
'arg2':'value2'
}
## test that request goes ok
resp = wf_utils.fetch_GET_request(
GET_ECHO_ENDPOINT,
params=params
)
## test that response json can be parsed
payload = resp.json()
## test that response... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_method_get():\n return 'GET'",
"def test_get(self):\n return self.doRequest(self.url, method=\"GET\", body=self.input)",
"def test_two_legged_get(self):\n resp, content = self._two_legged(\"GET\")\n self.assertEqual(int(resp['status']), 200)",
"def do_GET(self):\n self... | [
"0.6335031",
"0.6297777",
"0.61926717",
"0.6133453",
"0.6042478",
"0.59543127",
"0.59261894",
"0.59216285",
"0.5915813",
"0.5840221",
"0.5785862",
"0.5777845",
"0.5771906",
"0.57426494",
"0.5737699",
"0.5737379",
"0.5717399",
"0.569291",
"0.5655878",
"0.56524754",
"0.5612279"... | 0.6358074 | 0 |
Filter outliers based on flag pd.Series. | def filter_outliers(self, df, outlier):
return df[~outlier].reset_index(drop=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_outliers(data: pd.Series, std: int=3) -> pd.Series:\n return data[(data - data.mean()).abs() <= (std * data.std())]",
"def filter_outliers(data): \n \n idx_out = find_outliers_IQR(data)\n \n cleaned = data[~idx_out].copy()\n\n # print(f'There were {idx_out.sum()} outliers.')\n ... | [
"0.72473335",
"0.7129621",
"0.6909567",
"0.686517",
"0.68358237",
"0.6784017",
"0.6765156",
"0.66363037",
"0.66167766",
"0.65355045",
"0.65329564",
"0.6509693",
"0.6402966",
"0.63938296",
"0.63908815",
"0.6374849",
"0.6361414",
"0.63555086",
"0.6327466",
"0.63204163",
"0.6289... | 0.73588157 | 0 |
Returns the real part of all the converged eigenvalues from arpack | def GetEigenvalues(self):
return self.Solver.GetEigenvalues().real.copy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eigenvalues(self) -> ndarray:\n return self._vals",
"def eigenvalues(self, expand=False, factor=False, simplify=False):\n raise NotImplementedError",
"def eigvals(self):\n raise NotImplementedError",
"def GetEigenvalues(self, eigenvalues):\n return _hypre.HypreAME_GetEigenvalu... | [
"0.7210072",
"0.6718578",
"0.6628805",
"0.65749586",
"0.6457396",
"0.6456192",
"0.6427934",
"0.64171183",
"0.63999254",
"0.63643235",
"0.6360623",
"0.62789065",
"0.6247136",
"0.6236951",
"0.6201405",
"0.6178681",
"0.6170981",
"0.61528105",
"0.61432594",
"0.6131972",
"0.610695... | 0.6741684 | 1 |
Returns all eigenvectors as a N by M matrix, where N is the number of converged eigenvalues, and M is the size of the wavefunction. The eigenvectors is normalized in the vector 2norm, and can therefore not be expected to be normalized in the grid norm. Assign it to a wavefunction and call | def GetEigenvectors(self):
return self.Solver.GetEigenvectors() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_eigenvectors(self):\n return self.eigenVectors",
"def get_eigenvectors(self):\n return self._eigenvectors",
"def eig(self,manifold_num):\n num_sites = len(self.energies[manifold_num])\n ham = self.manifold_hamiltonian(manifold_num).toarray()\n eigvals, eigvecs = eigh(... | [
"0.7280959",
"0.7014462",
"0.68991834",
"0.6673352",
"0.66130096",
"0.6587522",
"0.6492255",
"0.6377612",
"0.63553613",
"0.6307149",
"0.6288552",
"0.62492836",
"0.6200734",
"0.6196136",
"0.61908334",
"0.61808556",
"0.6166238",
"0.614508",
"0.6144089",
"0.6143722",
"0.610234",... | 0.7069983 | 1 |
Sets psi to the eigenvector specified by eigenvetorIndex if normalize == True, psi will be normalized | def SetEigenvector(self, psi, eigenvectorIndex, normalize=True):
eigenvectors = self.GetEigenvectors()
shape = psi.GetData().shape
psi.GetData()[:] = numpy.reshape(eigenvectors[eigenvectorIndex, :], shape)
if normalize:
psi.Normalize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eigsolve(self,**kwargs):\n return eigsolve(self,**kwargs)",
"def eigensolve(self, epsilon=0.85):\n raise NotImplementedError(\"eigensolve Incomplete\")",
"def eigen_vector_i(self, i):\n return self._eig_vec[:,i]",
"def set_eigenvalue_problem(self, *args, ncc_cutoff=1e-10, tolerance=1... | [
"0.56931436",
"0.55284667",
"0.54967713",
"0.54389435",
"0.5401519",
"0.5303515",
"0.522989",
"0.5135587",
"0.5133062",
"0.50980896",
"0.5096003",
"0.5075772",
"0.5053383",
"0.5042445",
"0.50405645",
"0.49959317",
"0.49945125",
"0.49574724",
"0.49294224",
"0.49113372",
"0.487... | 0.8005101 | 0 |
This view renders the general timeline. | def general_timeline():
return render_template('timeline.html', general=True, show_username=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_timeline():\n return render_template('timeline.html', messages=query_db('''\n select message.*, user.* from message, user\n where message.author_id = user.user_id\n order by message.pub_date desc limit ?''', [PER_PAGE]))",
"def public_timeline():\n return render_template('ti... | [
"0.68146354",
"0.68146354",
"0.646931",
"0.6225129",
"0.62190664",
"0.61926216",
"0.61690927",
"0.5976462",
"0.59268796",
"0.58612955",
"0.5815437",
"0.5813973",
"0.576644",
"0.57416373",
"0.5709168",
"0.5668732",
"0.55861884",
"0.5561978",
"0.5561588",
"0.5535532",
"0.552569... | 0.8364598 | 0 |
This view renders the user timeline. It also allows the user to post tweets. | def user_timeline(username=None): # pylint: disable=unused-argument
form = PostTweetForm()
if form.validate_on_submit():
try:
current_user.post_tweet(form.tweet.data)
flash('Tweet successfully posted')
except ValueError as excep:
flash(str(excep))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_timeline():\n return render_template('timeline.html', messages=query_db('''\n select message.*, user.* from message, user\n where message.author_id = user.user_id\n order by message.pub_date desc limit ?''', [PER_PAGE]))",
"def public_timeline():\n return render_template('ti... | [
"0.7028494",
"0.7028494",
"0.68925434",
"0.68407875",
"0.666454",
"0.64178663",
"0.63294685",
"0.6242161",
"0.6237933",
"0.61577386",
"0.61176234",
"0.61053467",
"0.6042958",
"0.5984481",
"0.5931631",
"0.5931134",
"0.5919422",
"0.5892258",
"0.57867306",
"0.57760817",
"0.57731... | 0.8192773 | 0 |
This view renders the user history. It will display all the tweets posted by this user; allow the loggedin user to follow/unfollow this user if they are different. | def user_history(username):
follow_form = FollowForm()
unfollow_form = UnfollowForm()
return render_template('user_history.html',
username=username,
follow_form=follow_form,
unfollow_form=unfollow_form) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history():\n \n user_id = session[\"user_id\"]\n history_list = hist(user_id, db)\n return render_template('history.html', history=history_list)",
"def user_timeline(username):\n profile_user = query_db('select * from user where username = ?',\n [username], one=True)... | [
"0.65801525",
"0.6558955",
"0.65173095",
"0.65121293",
"0.6486155",
"0.64845365",
"0.643965",
"0.640158",
"0.6400872",
"0.6372886",
"0.63680434",
"0.63648087",
"0.6350884",
"0.632362",
"0.6294069",
"0.62907934",
"0.627852",
"0.62391174",
"0.62049097",
"0.61988515",
"0.6156545... | 0.74899447 | 0 |
This view handles the follow form in the user history page. | def follow(username):
follow_form = FollowForm()
unfollow_form = UnfollowForm()
if follow_form.validate_on_submit():
try:
current_user.follow(username)
flash('Followed {}'.format(username))
except ValueError as excep:
flash(str(excep))
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_follow_page(request):\n user = get_user_from_username(request.user, request.GET.get(\"user\"))\n data = {\"user\": user}\n return TemplateResponse(request, \"ostatus/remote_follow.html\", data)",
"def follow(request, usertofollow):\n to_follow = Member.objects.get(user__username=usertofoll... | [
"0.7149877",
"0.7063604",
"0.6739925",
"0.6728417",
"0.671004",
"0.6617824",
"0.6579484",
"0.6551827",
"0.6518894",
"0.650463",
"0.6486437",
"0.642817",
"0.64219815",
"0.64128906",
"0.6406436",
"0.6385301",
"0.6356875",
"0.63392025",
"0.63104033",
"0.6288673",
"0.62805295",
... | 0.7363769 | 0 |
This view handles the unfollow form in the user history page. | def unfollow(username):
follow_form = FollowForm()
unfollow_form = UnfollowForm()
if unfollow_form.validate_on_submit():
try:
current_user.unfollow(username)
flash('Unfollowed {}'.format(username))
except ValueError as excep:
flash(str(excep))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_unfollow():\n data = request.get_json(force=True)\n follower = User.query.get(data['follower'])\n following = User.query.get(data['following'])\n follower.followcheck.remove(following)\n db.session.commit()\n return {'unfollowed': True}",
"def unfollow(request, usertostopfollow):\n ... | [
"0.75263685",
"0.7512871",
"0.74527144",
"0.7343735",
"0.7333024",
"0.7246593",
"0.72271776",
"0.70816875",
"0.696819",
"0.68924844",
"0.68613744",
"0.6822375",
"0.67654264",
"0.676503",
"0.67183167",
"0.6688176",
"0.6617912",
"0.65045625",
"0.6494655",
"0.6466272",
"0.645384... | 0.822711 | 0 |
This function injects the function object 'Tweet.get_general_timeline' into the application context so that 'get_general_timeline' can be accessed in Jinja2 templates. | def inject_general_timeline():
return dict(get_general_timeline=Tweet.get_general_timeline) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def general_timeline():\n return render_template('timeline.html', general=True, show_username=True)",
"def common_context(request):\n c = {\n 'lessons': get_lesson_numbers(),\n }\n return c",
"def _timeline_context(self):\n\n timeline = self.channel.get_months_active()\n if not... | [
"0.6907658",
"0.55791354",
"0.5368909",
"0.5239636",
"0.5160229",
"0.5101733",
"0.50975186",
"0.50097936",
"0.50072044",
"0.49837127",
"0.49837127",
"0.4918119",
"0.49131495",
"0.49122372",
"0.4868816",
"0.48333994",
"0.4832774",
"0.48210987",
"0.4787424",
"0.47700545",
"0.47... | 0.7961719 | 0 |
Test case for api_last_tested_repo_get | def test_api_last_tested_repo_get(self):
default_api = DefaultApi(api_client=self.api_client)
params = dlrnapi_client.Params()
path, method = default_api.api_last_tested_repo_get(params)
self.assertEqual(path, '/api/last_tested_repo')
self.assertEqual(method, 'GET') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_last_tested_repo_post(self):\n default_api = DefaultApi(api_client=self.api_client)\n params = dlrnapi_client.Params1()\n path, method = default_api.api_last_tested_repo_post(params)\n self.assertEqual(path, '/api/last_tested_repo')\n self.assertEqual(method, 'POST')... | [
"0.7768464",
"0.72451514",
"0.7038413",
"0.6969715",
"0.65839493",
"0.6558673",
"0.64816403",
"0.6443256",
"0.6438606",
"0.6329126",
"0.6317321",
"0.61880976",
"0.6162838",
"0.6152482",
"0.61490256",
"0.6125279",
"0.6106903",
"0.61035943",
"0.6100584",
"0.6053026",
"0.6051147... | 0.88925594 | 0 |
Test case for api_last_tested_repo_post | def test_api_last_tested_repo_post(self):
default_api = DefaultApi(api_client=self.api_client)
params = dlrnapi_client.Params1()
path, method = default_api.api_last_tested_repo_post(params)
self.assertEqual(path, '/api/last_tested_repo')
self.assertEqual(method, 'POST') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_last_tested_repo_get(self):\n default_api = DefaultApi(api_client=self.api_client)\n params = dlrnapi_client.Params()\n path, method = default_api.api_last_tested_repo_get(params)\n self.assertEqual(path, '/api/last_tested_repo')\n self.assertEqual(method, 'GET')",
... | [
"0.7607755",
"0.6482869",
"0.6286869",
"0.62830985",
"0.61684394",
"0.6084323",
"0.6048418",
"0.60430026",
"0.6034124",
"0.5954312",
"0.5915801",
"0.58691543",
"0.58313596",
"0.5807549",
"0.5777155",
"0.57586783",
"0.573755",
"0.57354254",
"0.57269734",
"0.5724796",
"0.570244... | 0.8940906 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.