query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Determine whether a set of points are contained in this circle.
def is_inside(self, points): points = np.atleast_2d(points) - self.centroid return np.logical_and( np.linalg.norm(points, axis=-1) <= self.radius, # At present circles are not orientable, so the z position must # match exactly. np.isclose(points[:, 2], 0),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_point_inside(self, points):\n return all([self._domain.check_point_inside(point) for point in points])", "def __contains__(self, point: Point[Scalar]) -> bool:\n return point in self._points_set", "def contains(self, points, abs_tol=ABS_TOL):\n if not isinstance(points, np.ndarra...
[ "0.7574919", "0.73008096", "0.7248251", "0.7179526", "0.7061431", "0.7054965", "0.7015508", "0.69956315", "0.6983795", "0.69512105", "0.6893499", "0.67970866", "0.67813414", "0.67538655", "0.6729689", "0.66408074", "0.6627263", "0.66241723", "0.6618708", "0.65898585", "0.6550...
0.7266135
2
Performs tokenization and some preprocessing operations on text data. Converts a phrase into a list of words, removes punctuation, removes nonalphabetic tokens, and lemmatizes the tokens Returns the list of tokens
def tokenize(phrase_str): phrase = phrase_str.split(' ') # tokenize string by space character mapping = str.maketrans('', '', string.punctuation) # remove punctuation, remove non-alphabetic tokens, stem tokens phrase = [WordNetLemmatizer().lemmatize(token.translate(mapping)) for token in phrase \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing(raw_text):\n words_list = tokenize(raw_text)\n words_list = remove_stop_words(words_list)\n words_list = remove_punctuations(words_list)\n words_list = lemmatization(words_list)\n return words_list", "def tokenize(text):\n #Clean data, remove all character except character and...
[ "0.79756796", "0.7904002", "0.78867584", "0.7869221", "0.78579456", "0.7832229", "0.78321916", "0.7832124", "0.782445", "0.7802193", "0.77924955", "0.7784682", "0.777966", "0.77644056", "0.7691479", "0.7691479", "0.768819", "0.7648956", "0.7640827", "0.758754", "0.7564249", ...
0.742666
25
Return key value pairs, values normalized from 0 to 100.
def get_norm_key_values(self, board): return self.key_values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self):\n total = float(sum(self.values()))\n for key in self:\n self[key] /= total", "def normalize_scores(scores):\n #print(scores)\n keys = scores.keys()\n\n sum = 0.0\n for k in keys:\n #print(\"%06f\\t\" % scores.get(k)),\n sum += scores.get(k)\n\n if s...
[ "0.6072583", "0.60643744", "0.60121644", "0.59339607", "0.59324723", "0.58868974", "0.5814362", "0.57555145", "0.5641395", "0.56158954", "0.553331", "0.5531487", "0.5445495", "0.54419345", "0.53720593", "0.53492", "0.53252053", "0.5324647", "0.5298619", "0.5240902", "0.519519...
0.51370573
29
Open index page and show current assignments
def index(): with app.app_context(): return render_template("public/index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_assignment_list():\n\n if len(Assignments.assignments_list) == 0:\n Ui.print_message(\"Assignment list is empty\")\n else:\n Ui.print_assignments_list(Assignments.assignments_list, \"Assignments List:\")", "def open(self, index):\n\n index = int(index.strip())\...
[ "0.6490753", "0.61643285", "0.60393304", "0.6013807", "0.6008998", "0.5956105", "0.5916988", "0.5865909", "0.5796941", "0.5792777", "0.5788435", "0.57624733", "0.573752", "0.5731666", "0.5712784", "0.5700674", "0.569984", "0.56919783", "0.56916326", "0.56863374", "0.5685109",...
0.0
-1
Create mask image from text. A mask image is used during maze creation to mark areas where the algorithm won't go. Black pixels mark cells the algorithm won't move into, i.e. the represent walls.
def text_mask(text: str, fontsize: int, bordersize: int = 32, invert: bool = False) -> Image.Image: text = text.lower() if invert: fill_color = Color.black line_color = Color.white else: fill_color = Color.white line_color = Color.black try: # TODO add option to l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_text_mask(shape, textboxes):\n if textboxes is None or len(textboxes) == 0:\n return np.zeros(shape).astype(np.uint8)\n \n mask = np.zeros(shape)\n for (xtl, ytl, xbr, ybr) in textboxes:\n pts = np.array(((xtl, ytl), (xtl, ybr), (xbr, ybr), (xbr, ytl)))\n cv2.fillConve...
[ "0.68902", "0.6767854", "0.6495216", "0.64659613", "0.6140956", "0.61083484", "0.6106871", "0.6052533", "0.5992212", "0.59548646", "0.5950822", "0.59290344", "0.59110165", "0.58821726", "0.58730745", "0.58669186", "0.5801924", "0.57735807", "0.57705575", "0.57230383", "0.5705...
0.6645137
2
Convert floating point array `arr` to type `int_type` Rounds numbers to nearest integer Clips values to prevent overflows when casting Converts NaN to 0 (for `nan2zero` == True) Casting floats to integers is delicate because the result is undefined and platform specific for float values outside the range of `int_type`....
def float_to_int(arr, int_type, nan2zero=True, infmax=False): arr = np.asarray(arr) flt_type = arr.dtype.type int_type = np.dtype(int_type).type # Deal with scalar as input; fancy indexing needs 1D shape = arr.shape arr = np.atleast_1d(arr) mn, mx = shared_range(flt_type, int_type) if na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shared_range(flt_type, int_type):\n flt_type = np.dtype(flt_type).type\n int_type = np.dtype(int_type).type\n key = (flt_type, int_type)\n # Used cached value if present\n try:\n return _SHARED_RANGES[key]\n except KeyError:\n pass\n ii = np.iinfo(int_type)\n fi = np.finfo...
[ "0.6277321", "0.60933924", "0.58549047", "0.5741616", "0.552237", "0.5518937", "0.54227996", "0.5386261", "0.5383315", "0.5326426", "0.53080285", "0.52810884", "0.52766216", "0.5270667", "0.5269668", "0.5256169", "0.52117723", "0.5198044", "0.5180438", "0.5116046", "0.5093809...
0.6989811
0
True if fp type `np_type` seems to have `maxexp` maximum exponent We're testing "maxexp" as returned by numpy. This value is set to one greater than the maximum power of 2 that `np_type` can represent. Assumes base 2 representation. Very crude check
def _check_maxexp(np_type, maxexp): dt = np.dtype(np_type) np_type = dt.type two = np_type(2).reshape((1,)) # to avoid upcasting return (np.isfinite(two ** (maxexp - 1)) and not np.isfinite(two ** maxexp))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def have_binary128():\n try:\n ti = type_info(np.longdouble)\n except FloatingError:\n return False\n return (ti['nmant'], ti['maxexp']) == (112, 16384)", "def is_max():\n\n return 'MaxPlus' in main.__dict__ or 'pymxs' in main.__dict__", "def is_max(self):\n return self._is_max", ...
[ "0.6465047", "0.6069682", "0.60577065", "0.5884155", "0.5880062", "0.5727874", "0.5712911", "0.57087207", "0.56794137", "0.5557588", "0.5549962", "0.54973704", "0.54384303", "0.53982246", "0.53702974", "0.53491426", "0.5345262", "0.53180844", "0.5316695", "0.5229985", "0.5229...
0.88971424
0
Return python integer representation of number This is useful because the numpy int(val) mechanism is broken for large values in np.longdouble. It is also useful to work around a numpy 1.4.1 bug in conversion of uints to python ints. This routine will still raise an OverflowError for values that are outside the range o...
def as_int(x, check=True): x = np.array(x) if x.dtype.kind in 'iu': # This works around a nasty numpy 1.4.1 bug such that: # >>> int(np.uint32(2**32-1) # -1 return int(str(x)) ix = int(x) if ix == x: return ix fx = np.floor(x) if check and fx != x: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float_to_int_64(x):\n return np.float64(x).view(np.int64)", "def _convert_int_to_i64(val):\n if val > 0x7FFFFFFFFFFFFFFF:\n val -= 0x10000000000000000\n return val", "def to_long_int(val):\n return long(val) if six.PY2 else int(val)", "def rint(a: Number) -> int:\n return np.round(a)....
[ "0.66037387", "0.639089", "0.6249033", "0.6216118", "0.6160923", "0.6093319", "0.6029579", "0.5797227", "0.57939583", "0.57774496", "0.5755939", "0.571572", "0.5691665", "0.56641895", "0.56481284", "0.56016886", "0.55284464", "0.5457622", "0.5457045", "0.54459876", "0.5429053...
0.6243762
3
First, check if mssql tests can be executed, that is, MSSQL hostname was given connection to MSSQL can be established using the given hostname, port number, ODBC driver and credentials MSSQL doesn't have database with name stored in constant TEST_DB_NAME If mssql tests can be executed, add fixture 'mssql_setup_and_tear...
def pytest_collection_modifyitems(config, items): execute_mssql_tests = ensure_mssql_ready_for_tests(config) skip_mssql = pytest.mark.skip(reason="requires SQL Server") for item in items: if "mssql" in item.keywords: if execute_mssql_tests: # Add 'mssql_setup_and_teardown...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_mssql_ready_for_tests(config):\n try:\n if not config.getoption('mssql_host'):\n raise Exception('MSSQL Server not given')\n engine = engine_from(config)\n with engine.connect() as connection:\n query = \"SELECT name FROM sys.databases WHERE UPPER(name) = ?\...
[ "0.75187415", "0.6198483", "0.6188444", "0.6129452", "0.60783184", "0.60497016", "0.60490113", "0.6035314", "0.6022797", "0.59940165", "0.5986652", "0.5985682", "0.597711", "0.597711", "0.597711", "0.5972064", "0.59481573", "0.5920721", "0.591941", "0.5915701", "0.59092796", ...
0.6534527
1
[summary] Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
def skip( count: int, ) -> Callable[[AsyncObservable[_TSource]], AsyncObservable[_TSource]]: def _skip(source: AsyncObservable[_TSource]) -> AsyncObservable[_TSource]: async def subscribe_async(obvAsync: AsyncObserver[_TSource]) -> AsyncDisposable: safe_obv, auto_detach = auto_detach_observ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop(n, seq):\n return itertools.islice(seq, n, None)", "def drop(iterable, n, islice=islice):\n return islice(iterable, n, None)", "def drop(iterable, n):\n counter = 0\n for element in iterable:\n if counter < n:\n counter += 1\n else:\n yield element", "...
[ "0.7129068", "0.69727373", "0.69348544", "0.6351498", "0.633893", "0.613475", "0.6084957", "0.6045007", "0.6006796", "0.5989606", "0.5982909", "0.59758115", "0.59758115", "0.59671295", "0.59671295", "0.59522516", "0.59125525", "0.58811975", "0.5859811", "0.58546406", "0.58546...
0.6333277
5
Take elements until other. Returns the values from the source observable sequence until the other observable sequence produces a value.
def take_until( other: AsyncObservable[Any], ) -> Callable[[AsyncObservable[_TSource]], AsyncObservable[_TSource]]: def _take_until(source: AsyncObservable[_TSource]) -> AsyncObservable[_TSource]: async def subscribe_async(aobv: AsyncObserver[_TSource]) -> AsyncDisposable: safe_obv, auto_de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_until(self, other):\n \n source = self\n\n def subscribe(observer):\n is_open = False\n\n def on_next(left):\n if is_open:\n observer.on_next(left)\n \n def on_completed():\n if is_open:\n ...
[ "0.68112385", "0.6707546", "0.5977765", "0.5531474", "0.55141187", "0.5389061", "0.5344173", "0.53357154", "0.5321708", "0.53201705", "0.5233898", "0.522528", "0.5223908", "0.52066475", "0.52049947", "0.51533276", "0.51141363", "0.5046804", "0.5043729", "0.50181514", "0.50096...
0.6892169
0
Given a DataFrame containing external vertex ids in the identified columns, return a DataFrame containing the internal vertex ids as the specified column name. Optionally drop the external vertex id columns. Optionally preserve the order of the original DataFrame.
def add_internal_vertex_id( self, df, internal_column_name, external_column_name, drop=True, preserve_order=False, ): return self.renumber_map.add_internal_vertex_id( df, internal_column_name, external_column_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup_internal_vertex_id(self, df, column_name=None):\n return self.renumber_map.to_internal_vertex_id(df, column_name)", "def extract_iaa_df_by_column_name(annotation_df: pd.DataFrame, column_name: str) -> pd.DataFrame:\n return annotation_df[['source_spreadsheet', 'key', column_name]] \\\n ...
[ "0.6369649", "0.5434573", "0.5080946", "0.50768137", "0.50756174", "0.50700754", "0.5035684", "0.5035684", "0.500678", "0.49395162", "0.49026927", "0.48853773", "0.4879121", "0.48784655", "0.4845465", "0.48175415", "0.4817421", "0.47987697", "0.47728112", "0.47706375", "0.475...
0.6863625
0
Returns True if the graph is a multigraph. Else returns False.
def is_multigraph(self): # TO DO: Call coloring algorithm return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_multigraph(G):\n return G.is_multigraph()", "def is_multigraph(self):\n # TO DO: Call coloring algorithm\n return True", "def is_graph_isomorphic(self):\n out=True\n for node in self.node_names:\n self.move_to_node(node)\n if not self.check_closed_pat...
[ "0.8892002", "0.8073157", "0.6822975", "0.6403869", "0.6260127", "0.6115192", "0.6026695", "0.59937394", "0.5915851", "0.59066856", "0.589493", "0.5885649", "0.58637273", "0.58487767", "0.58229613", "0.5822232", "0.58123803", "0.57812524", "0.57509226", "0.5748932", "0.574890...
0.80856836
1
Returns True if the graph is renumbered.
def is_renumbered(self): return self.properties.renumbered
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_recurrent(self):\n G = self._get_recurrence_graph()\n # C = G.strongly_connected_components()\n first_component = next(nx.strongly_connected_components(G))\n abs_numbers = {abs(x) for x in first_component}\n # return sorted(list(set([abs(x) for x in C[0]]))) == \\\n ...
[ "0.62102467", "0.61067367", "0.5743151", "0.5701313", "0.5685437", "0.5677423", "0.5677423", "0.5677423", "0.5620424", "0.56178945", "0.5471461", "0.53902453", "0.53844684", "0.53594327", "0.52996284", "0.5260967", "0.52489305", "0.5224834", "0.51943403", "0.5161381", "0.5152...
0.6701319
0
Returns True if the graph has edge weights.
def is_weighted(self): return self.properties.weighted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_edges(self):\n\n return len(self._edges) > 0", "def has_weight(self, weight):\n weights = self.get_descendant_weights()\n return weight.get_name() in self.get_descendant_weights()", "def is_weighted(G):\n return G.is_weighted()", "def is_edge(self, v, w):\n return self....
[ "0.7324179", "0.6706014", "0.645694", "0.6385782", "0.63533646", "0.63305855", "0.6150095", "0.6116152", "0.5967429", "0.593755", "0.5897626", "0.58661133", "0.585745", "0.58356833", "0.5835194", "0.5835194", "0.5835194", "0.5821682", "0.58215225", "0.57662624", "0.57638526",...
0.5698054
22
Returns True if the graph has isolated vertices.
def has_isolated_vertices(self): return self.properties.isolated_vertices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasvertices(self):\n if len(self.vertices) > 0:\n return True\n else:\n return False", "def is_vertex(self):\n return False", "def is_vertex(self):\n return True", "def is_vertex(self):\n return True", "def find_isolated_vertices(self):\n ...
[ "0.77151877", "0.710259", "0.70984995", "0.70984995", "0.70648944", "0.7027467", "0.69378316", "0.67973167", "0.6709582", "0.6689782", "0.6688046", "0.663522", "0.6606373", "0.6583431", "0.6447404", "0.6430645", "0.6398466", "0.63945377", "0.6384457", "0.63697594", "0.6348511...
0.8685614
0
Compute the density of the graph. Density is the measure of how many edges are in the graph versus the max number of edges that could be present. Returns
def density(self) -> float: if self.is_directed(): factor = 1 else: factor = 2 num_e = self._Impl.number_of_edges(directed_edges=True) num_v = self._Impl.number_of_vertices() density = (factor * num_e) / (num_v * (num_v - 1)) return density
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_density(self) -> float:\n return self.number_of_edges() / (\n self.number_of_nodes() * self.number_of_nodes()\n )", "def density(self):\n raise TypeError(\"The density function is not support on a Multigraph.\")", "def density(self):\n return self.nnz / self.size", "def dens...
[ "0.83812225", "0.7660197", "0.7286196", "0.7279116", "0.7126875", "0.70641553", "0.70641553", "0.70641553", "0.7053454", "0.69986826", "0.6820144", "0.67335665", "0.67326057", "0.6672423", "0.6588537", "0.65546536", "0.65151596", "0.65117574", "0.63858944", "0.6380969", "0.63...
0.8391614
0
Returns True if the graph is a multigraph. Else returns False.
def is_multigraph(self): # TO DO: Call coloring algorithm return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_multigraph(G):\n return G.is_multigraph()", "def is_multigraph(self):\n # TO DO: Call coloring algorithm\n return False", "def is_graph_isomorphic(self):\n out=True\n for node in self.node_names:\n self.move_to_node(node)\n if not self.check_closed_pa...
[ "0.88915426", "0.80854493", "0.68237036", "0.64042544", "0.6260408", "0.6116132", "0.6027724", "0.59951085", "0.5914047", "0.59079295", "0.5896611", "0.5886608", "0.58633703", "0.5849805", "0.5823834", "0.58232814", "0.58137304", "0.5781308", "0.57509154", "0.5749467", "0.574...
0.8072888
2
Density is the measure of how many edges are in the graph versus the max number of edges that could be present. This function is not support on a Multigraph. Since the maximal number of possible edges between any vertex pairs can be greater than 1 (undirected) a realistic max number of possible edges cannot be determin...
def density(self): raise TypeError("The density function is not support on a Multigraph.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_density(self) -> float:\n return self.number_of_edges() / (\n self.number_of_nodes() * self.number_of_nodes()\n )", "def density(self) -> float:\n if self.is_directed():\n factor = 1\n else:\n factor = 2\n\n num_e = self._Impl.number_of_edges(directe...
[ "0.7398295", "0.73262954", "0.64582163", "0.64541274", "0.64176804", "0.63355756", "0.60894424", "0.6053115", "0.59816647", "0.59357804", "0.587777", "0.5850377", "0.58019286", "0.57873327", "0.57873327", "0.57873327", "0.5774872", "0.5743493", "0.5718684", "0.5705746", "0.57...
0.77110106
0
Returns True if the graph is a multigraph. Else returns False.
def is_multigraph(G): return G.is_multigraph()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_multigraph(self):\n # TO DO: Call coloring algorithm\n return False", "def is_multigraph(self):\n # TO DO: Call coloring algorithm\n return True", "def is_graph_isomorphic(self):\n out=True\n for node in self.node_names:\n self.move_to_node(node)\n ...
[ "0.80854493", "0.8072888", "0.68237036", "0.64042544", "0.6260408", "0.6116132", "0.6027724", "0.59951085", "0.5914047", "0.59079295", "0.5896611", "0.5886608", "0.58633703", "0.5849805", "0.5823834", "0.58232814", "0.58137304", "0.5781308", "0.57509154", "0.5749467", "0.5749...
0.88915426
0
Returns True if the graph has edge weights.
def is_weighted(G): return G.is_weighted()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_edges(self):\n\n return len(self._edges) > 0", "def has_weight(self, weight):\n weights = self.get_descendant_weights()\n return weight.get_name() in self.get_descendant_weights()", "def is_edge(self, v, w):\n return self.op_norm(v[0], w[0]) == (v[1] + w[1]) and (self.varian...
[ "0.7324179", "0.6706014", "0.6385782", "0.63533646", "0.63305855", "0.6150095", "0.6116152", "0.5967429", "0.593755", "0.5897626", "0.58661133", "0.585745", "0.58356833", "0.5835194", "0.5835194", "0.5835194", "0.5821682", "0.58215225", "0.57662624", "0.57638526", "0.5755424"...
0.645694
2
Yield successive nsized chunks from l.
def chunks(l, n): for i in xrange(0, len(l), n): yield l[i:i+n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.80379355", "0.79237956", "0.7922027", "0.78840584", "0.7876208", "0.78144675", "0.77643776", "0.77544284", "0.7743112", "0.7730491", "0.772761", "0.7723601", "0.7701434", "0.768797", "0.768797", "0.7662925", "0.765581", "0.765473", "0.765473", "0.76447", "0.76447", "0.76...
0.0
-1
creates a flask instance according to config passed
def create_app(config_name): app = Flask(__name__) app.config.from_object(app_config[config_name]) # versions of api from app.api.v2 import version2 as v2 app.register_blueprint(v2) # registered JWT manager app.config['JWT_SECRET_KEY'] = 'owezzy' jwt = JWTManager(app) create_table...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(config_name):\n app = Flask(__name__)\n # create app instance\n app.config.from_object(config_by_name[config_name])\n flask_bcrypt.init_app(app)\n\n CORS(app)\n\n routes.init_routes(app)\n\n return app", "def create_application(config=None):\n app = Flask(__name__) \n ...
[ "0.76520264", "0.7645604", "0.76421773", "0.75285846", "0.751704", "0.7502416", "0.74965453", "0.7468897", "0.74440193", "0.7443135", "0.741995", "0.7416124", "0.7412297", "0.7408235", "0.74022716", "0.74010473", "0.73979867", "0.7391507", "0.7388088", "0.7381329", "0.7375037...
0.71717995
43
Learning Rate Schedule Learning rate is scheduled to be reduced after 80, 120, 160, 180 epochs. Called automatically every epoch as part of callbacks during training. Arguments
def lr_schedule(epoch): lr = 1e-3 if epoch > 30: lr *= 0.5e-3 elif epoch > 25: lr *= 1e-3 elif epoch > 20: lr *= 1e-2 elif epoch > 10: lr *= 1e-1 print('Learning rate: ', lr) return lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rnn_learning_rate_schedule(dataset):\n model, prefix = make_rnn(non_negative=True)\n # model.set_params(**{prefix + \"val\": 0.1})\n\n # base = no schedule\n print(\"Baseline RNN\")\n # model.set_params(**{prefix + \"history_file\": \"nn_default.csv\"})\n cross_validate(dataset, model)\n #...
[ "0.75228554", "0.7497287", "0.74851155", "0.74810237", "0.7468757", "0.7468757", "0.7468757", "0.7468757", "0.7407706", "0.7364903", "0.7353609", "0.7334378", "0.72664744", "0.72637755", "0.7227157", "0.7223075", "0.7197404", "0.7190094", "0.7099005", "0.7085819", "0.7078524"...
0.7347105
11
Multiplies every element of vector {v} by a scalar {s}, then returns the resulting vector.
def scalar_multiply(s: float, v: Vector) -> Vector: return [s * v_item for v_item in v]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scalar_mult(s, v): #11.22.6\r\n new_list = []\r\n for i in range(len(v)):\r\n m = v[i] * s\r\n new_list.append(m)\r\n return new_list", "def scalar_multiply(c: float, v: Vector) -> Vector:\n return [c * v_i for v_i in v]", "def scalar_multiply(c: float, v: Vector) -> Vector:\n ...
[ "0.84043247", "0.82030743", "0.82030743", "0.81144905", "0.79392517", "0.7871723", "0.7817536", "0.7817536", "0.7805719", "0.780021", "0.7778261", "0.7458911", "0.72835606", "0.708623", "0.69591796", "0.692144", "0.6904699", "0.6900433", "0.6851884", "0.6680126", "0.66310865"...
0.87742597
0
Computes the sum of the componentwise products of two vectors. Returns the dot product.
def dot(v: Vector, w: Vector) -> float: assert len(v) == len(w), 'vectors must be the same length' return sum(v_item * w_item for v_item, w_item in zip(v, w))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dotproduct(vec1, vec2):\n return sum((a*b) for a, b in zip(vec1, vec2))", "def dotProduct(v1, v2):\n return sum((a * b) for a, b in zip(v1, v2))", "def dotproduct(vec1, vec2):\n import operator\n return sum(map(operator.mul, vec1, vec2))", "def dot(vector1, vector2):\n return sum(a1 * a2 f...
[ "0.867841", "0.8671401", "0.86348313", "0.8578247", "0.83692396", "0.83624357", "0.83483756", "0.8280531", "0.8273634", "0.8248271", "0.8221459", "0.81876683", "0.81833833", "0.8177947", "0.81730944", "0.817229", "0.8090193", "0.8048194", "0.79327166", "0.7905995", "0.7903583...
0.76729673
35
Returns the magnitude (or length) of a vector {v}
def magnitude(v: Vector) -> float: return math.sqrt(sum_of_squares(v))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude_of_vector(v):\n return math.sqrt(sum_of_squares(v))", "def magnitude(v):\n if len(v.arr) != 4 or v[3] != 0.0:\n raise ValueError(\"Only use this function with vectors.\")\n return np.sqrt(np.sum(np.square(v.arr)))", "def magnitude(v):\n\treturn math.sqrt(sum_squares(v))", "def m...
[ "0.90163326", "0.89769083", "0.8783631", "0.8778432", "0.8690162", "0.8413762", "0.83721006", "0.8264289", "0.80263287", "0.77711004", "0.76732117", "0.7623041", "0.74499166", "0.7376535", "0.7362611", "0.7224577", "0.71998286", "0.71658176", "0.7066095", "0.698452", "0.69735...
0.8879909
2
Class for generating test datasets of atomic resolution STEM images.
def __init__(self, image_x, image_y, sublattice_generate_image=True): self.data_extent = (image_x, image_y) self._image_noise = False self._sublattice_generate_image = sublattice_generate_image self.__sublattice = Sublattice([], np.zeros((2, 2))) self.__sublattice.atom_list = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataset():\n\n\tnumberOfTrials = dataset_params.num_of_samples\n\tnumberOfTrials_train = int(numberOfTrials*0.8)\n\tnumberOfTrials_test = int(numberOfTrials*0.2)\n\n\tprint(\"==================================================\")\n\tprint(\"1. Generating Train images ......\")\n\tprint(\"\\nTrain image per...
[ "0.6748568", "0.6541603", "0.65275174", "0.645458", "0.64377", "0.63501275", "0.62469023", "0.61989534", "0.6163901", "0.614062", "0.6119562", "0.608182", "0.6055524", "0.60225505", "0.6006589", "0.5981856", "0.5952288", "0.5950903", "0.58759433", "0.5858", "0.58556086", "0...
0.0
-1
Get points in [xmin, ymin, xmax, ymin] format.
def extract_points(json_object): points = [] for list_of_points in json_object['data']: for el in list_of_points: points.append(el) return points
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box_xy(points):\n x, y = islice(zip(*points), 2)\n min_x = min(x)\n max_x = max(x)\n min_y = min(y)\n max_y = max(y)\n return [\n [min_x, min_y, 0.0],\n [max_x, min_y, 0.0],\n [max_x, max_y, 0.0],\n [min_x, max_y, 0.0],\n ]", "def get_random_point(sel...
[ "0.72088885", "0.70674276", "0.67725325", "0.672778", "0.6678864", "0.66729623", "0.6580219", "0.65582705", "0.6511928", "0.6509357", "0.65005386", "0.64879125", "0.6446694", "0.6439704", "0.6436331", "0.6425148", "0.63949805", "0.6362631", "0.63504726", "0.6319681", "0.62833...
0.0
-1
Get value of occlusion.
def extract_occluded(json_object): return extract_attributes(json_object)['occlusion']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_conclusion(self, data):\n pass", "def value(self):\n return self.flags.value", "def value(self):\n return self._force.params[self.typepair][self.name] * (\n self._cpp_obj.alpha)", "def getValue(self):\n return self.value", "def getValue(self):\n re...
[ "0.58671904", "0.561371", "0.5532263", "0.5444355", "0.5434282", "0.5412588", "0.5403018", "0.5403018", "0.5403018", "0.5395264", "0.5392219", "0.5392219", "0.53735214", "0.5369397", "0.5362674", "0.535929", "0.53545475", "0.53545475", "0.5351859", "0.5351859", "0.5351859", ...
0.5265672
28
L{Automaton.outputForInput} raises L{NoTransition} if no transition for that input is defined.
def test_noOutputForInput(self): a = Automaton() self.assertRaises(NoTransition, a.outputForInput, "no-state", "no-symbol")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_oneTransition_nonIterableOutputs(self):\n a = Automaton()\n nonIterableOutputs = 1\n self.assertRaises(\n TypeError,\n a.addTransition,\n \"fromState\", \"viaSymbol\", \"toState\", nonIterableOutputs)\n self.assertFalse(a.inputAlphabet())\n ...
[ "0.6586582", "0.6557924", "0.6540305", "0.6440613", "0.5900226", "0.55977666", "0.55939287", "0.55303645", "0.5515723", "0.5494398", "0.5437537", "0.5395913", "0.5349973", "0.5349103", "0.53027713", "0.52672046", "0.5247775", "0.5226895", "0.5206325", "0.5202092", "0.5168983"...
0.75474966
0
Return the items colour.
def get_colour(self, address): return idaapi.get_item_color(address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetItemTextColour(self, item):\r\n\r\n return item.Attr().GetTextColour()", "def getItemColor(self, itemType):\n # define the color of the item\n if itemType == DiagramItem.Action:\n color = QColor(0, 0, 0)\n color.setNamedColor( COLOR_TESTCASE )\n elif itemT...
[ "0.74861", "0.7410526", "0.7397212", "0.7286779", "0.7139415", "0.7086014", "0.69636357", "0.68982524", "0.68421155", "0.6829906", "0.67943287", "0.6790019", "0.67559105", "0.67024505", "0.66977406", "0.6679019", "0.6668555", "0.6666594", "0.6663186", "0.66597736", "0.6659773...
0.6999412
6
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary env_type = dictionary.get('envType') protected_count = dictionary.get('protectedCount') protected_size_bytes = dictionary.get('pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.7589917
79
If no data is in the database, no content is displayed but there is no map of graudation rates.
def test_no_data(self): response = self.client.get(reverse('education:index')) self.assertEqual(response.status_code, 200) self.assertEqual(response.context.get("json_data"), None) self.assertContains(response, "High School Graduation") self.assertContains(response, "How Rates We...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def survivor_reports(request):\n\n if request.method == 'GET':\n data = {}\n total_survivors = infected = non_infected = water = food = medication = ammunition = pointslost = 0\n for i in Survivor.objects.all():\n total_survivors += 1\n if i.infected is False:\n ...
[ "0.56976914", "0.5689704", "0.56867355", "0.55187994", "0.5508733", "0.5469109", "0.53344077", "0.5331825", "0.532648", "0.5320642", "0.53052545", "0.529917", "0.5292996", "0.52572066", "0.51999986", "0.5190109", "0.5163557", "0.51499313", "0.51114166", "0.5087369", "0.504665...
0.60015076
0
Check if two lists are equal.
def is_equal(a: list[int], b: list[int]) -> bool: i: int = 0 if len(a) != len(b): return False while i < len(a): if a[i] != b[i]: return False else: i = i + 1 return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lists_are_identical(list1, list2):\n if len(list1) != len(list2):\n return False\n for elem1, elem2 in zip(list1, list2):\n if elem1 != elem2:\n return False\n return True", "def check_lists_equal(list_1, list_2):\n if len(list_1) != len(list_2):\n return False\n ...
[ "0.8211461", "0.8210343", "0.8095882", "0.79870707", "0.7872633", "0.78687215", "0.7867317", "0.7854582", "0.7752908", "0.7726307", "0.772101", "0.7640429", "0.7621148", "0.7553402", "0.748566", "0.7481399", "0.7448626", "0.74191844", "0.7313987", "0.7182058", "0.7170578", ...
0.77526903
9
Form should have errors if submitted with invalid tags.
def test_clean_tags_with_invalid_tags(self): form = forms.GroupForm( { 'tags': 'this,is,an,invalid,tag,list', 'category': self.category.pk }) self.assertFalse(form.is_valid()) self.assertEqual( form.errors['tags'], [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_invalid(self, form, request):\n return", "def form_invalid(self, form, request):\n return", "def clean_tags(self):\n if hasattr(self.instance, 'get_required_keys') and hasattr(self.instance, 'tags'):\n for key in self.instance.get_required_keys():\n if ke...
[ "0.70063394", "0.70063394", "0.6835544", "0.66716987", "0.6597181", "0.6597181", "0.6548737", "0.6448814", "0.63792026", "0.635597", "0.6316827", "0.63110304", "0.63110304", "0.6282148", "0.6263178", "0.6223775", "0.6218237", "0.6212735", "0.6205367", "0.61641395", "0.6138782...
0.7211779
0
Test that passing in an invalid email causes an error
def test_invalid_emails_cause_error(self): form = forms.GroupInviteForm({'emails': 'abcd123123'}) self.assertFalse(form.is_valid()) self.assertEqual( form.errors['emails'], [u'No Valid Addresses Found'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_invalid_email(self):\n self.assertFalse(is_valid_email('helloworld'))", "def test_invalid_email(self):\n rv = self.login('Bo_wrong@example.com', 'Bo1995')\n self.assertIn(b'Invalid email! Please try again', rv.data)", "def test_invalid_email_when_logging_in(self):\n pass...
[ "0.85758525", "0.8359473", "0.8342922", "0.8208039", "0.8130191", "0.808138", "0.8044641", "0.7977467", "0.7948085", "0.7941922", "0.78820217", "0.78769296", "0.78647184", "0.78516585", "0.78111726", "0.77330416", "0.77219236", "0.77194446", "0.76920426", "0.7605099", "0.7574...
0.7642521
19
Test that passing in a valid email address works
def test_valid_address_go_through(self): form = forms.GroupInviteForm({'emails': 'me@razzmatazz.local'}) self.assertTrue(form.is_valid())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_email(self):\n self.assertTrue(is_valid_email('abc@example.com'))", "def test_is_invalid_email(self):\n self.assertFalse(is_valid_email('helloworld'))", "def test_invalid_email_when_logging_in(self):\n pass", "def test_email():\n assert is_email(None) is None\n assert...
[ "0.87399966", "0.8391867", "0.79970074", "0.7942512", "0.7921945", "0.79122925", "0.7892736", "0.7785832", "0.7653587", "0.7650771", "0.76477313", "0.75786644", "0.75699157", "0.75674486", "0.75621724", "0.7550053", "0.7548029", "0.75469095", "0.75129616", "0.75033474", "0.74...
0.0
-1
Ensures reproducibility for `DataLoader` classes. This method is meant to be handed as an argument to the parameter `worker_init_fn` of a PyTorch `DataLoader`.
def seed_worker(worker_id): worker_seed = torch.initial_seed() % 2 ** 32 np.random.seed(worker_seed) random.seed(worker_seed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worker_init_fn(worker_id):\n worker_info = torch.utils.data.get_worker_info() # type: ignore\n if hasattr(worker_info.dataset, \"transform\") and hasattr(worker_info.dataset.transform, \"set_random_state\"):\n worker_info.dataset.transform.set_random_state(worker_info.seed % (2 ** 32))", "def w...
[ "0.7514552", "0.7487547", "0.68602884", "0.68250054", "0.67156917", "0.67156917", "0.656293", "0.6533378", "0.65226924", "0.65226924", "0.6441305", "0.6198926", "0.6094901", "0.5719621", "0.5713314", "0.5713142", "0.56522506", "0.56388235", "0.55711097", "0.55418384", "0.5541...
0.61602294
12
Get the stratum positioned at index i among retained strata. Index order is from most ancient (index 0) to most recent.
def GetStratumAtColumnIndex( self: "HereditaryStratumOrderedStoreList", index: int, # needed for other implementations get_rank_at_column_index: typing.Optional[typing.Callable] = None, ) -> HereditaryStratum: return self._data[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(self, i):\n\n s = self._find(i)\n self._compress(i, s)\n return s", "def get(self, i):\n\t\tif(i < 0 or i >= self.d):\n\t\t\traise ValueError(\"Illegal index\")\n\t\tif(self.st.contains(i)):\n\t\t\treturn self.st.get(i)\n\t\telse:\n\t\t\treturn 0.0", "def past_indice(l, i):\n \...
[ "0.60305434", "0.5916065", "0.58731717", "0.585068", "0.5738559", "0.56062317", "0.5576207", "0.5546586", "0.5477701", "0.5443728", "0.5259882", "0.51919895", "0.5185881", "0.51732874", "0.5128746", "0.5085129", "0.50831664", "0.5058265", "0.50537527", "0.505085", "0.50482225...
0.5132178
14
Iterate over differentia and corresponding deposition ranks. Values yielded as tuples. Guaranteed ordered from most ancient to most recent.
def IterRankDifferentiaZip( self: "HereditaryStratumOrderedStoreList", # deposition ranks might not be stored in strata get_rank_at_column_index: typing.Optional[typing.Callable] = None, start_column_index: int = 0, ) -> typing.Iterator[typing.Tuple[int, int]]: if get_rank_at...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IterRetainedRanks(\n self: \"HereditaryStratumOrderedStoreList\",\n ) -> typing.Iterator[int]:\n # must make copy to prevent invalidation when strata are deleted\n # note, however, that copy is made lazily\n # (only when first item requested)\n ranks = [stratum.GetDepositi...
[ "0.56450135", "0.54363763", "0.53075534", "0.5210653", "0.5192767", "0.5179598", "0.5138363", "0.5132688", "0.51252264", "0.51217586", "0.5048127", "0.50448364", "0.50326985", "0.4983411", "0.49781853", "0.4976568", "0.4969654", "0.4952363", "0.49007815", "0.4894423", "0.4888...
0.6670545
0
Create an independent copy of the store. Returned copy contains identical data but may be freely altered without affecting data within this store.
def Clone( self: "HereditaryStratumOrderedStoreList", ) -> "HereditaryStratumOrderedStoreList": # shallow copy result = copy(self) # do semi-shallow clone on select elements # see https://stackoverflow.com/a/47859483 for performance consierations result._data = [*self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pure_data_copy(self):\n import copy\n data=copy.copy(self)\n data.xp = data.xp.get_pure_data_copy()\n data.timetable = data.timetable.get_pure_data_copy() \n return data", "def copy(self):\n return self.update({})", "def copy(self, data=None, stores=None):\n\n ...
[ "0.67915666", "0.6688249", "0.66663396", "0.666516", "0.66264254", "0.6600333", "0.6594994", "0.6577342", "0.65630984", "0.65251696", "0.6515307", "0.6492816", "0.64864224", "0.64588827", "0.64555305", "0.64367586", "0.64363873", "0.6430476", "0.6430194", "0.6430194", "0.6428...
0.69047505
0
Generate an hourly time series.
def _generate_hourly_time_series( self, size: int, hourly_seasonality: float, hourly_seasonality_params: Optional[List[Tuple[float, float]]] = None, trend_params: Optional[List[TrendParams]] = None, weekday_dummy_params: Optional[List[float]] = None, annual_season...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hourly_data():\n return generate_df_for_tests(freq=\"H\", periods=24 * 500)", "def hourly_table(self):\n htable = [0 for i in range(24)]\n for i in range(self.dataset.shape[0]):\n stime = time.localtime(np.int32(self.dataset[i][2]))\n evtime = stime[3]\n htab...
[ "0.74684554", "0.7132654", "0.66726404", "0.65727043", "0.63073367", "0.62709874", "0.62641674", "0.61987746", "0.61564374", "0.610799", "0.60429335", "0.59825134", "0.59708935", "0.59361815", "0.59323895", "0.59156996", "0.5897527", "0.5873104", "0.58665985", "0.5865832", "0...
0.7140618
1
Generate a time series as a pandas dataframe.
def generate_df( self, size: Optional[int] = 90 * 24, # 90 days worth of data start_date: Optional[str] = "2018-01-01", hourly_seasonality: float = 1.0, hourly_seasonality_params: Optional[List[Tuple[float, float]]] = None, trend_params: Optional[List[TrendParams]] = Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeseries_dataframe(self):\n return", "def TimeFrame(*args, **kwargs):\n underride(kwargs, dtype=float)\n return pd.DataFrame(*args, **kwargs)", "def to_dataframe(self, include_metadata: bool = True) -> pd.DataFrame:\n # Get all our data first with async\n # Note that all our pa...
[ "0.77449614", "0.7706055", "0.7511874", "0.73487455", "0.7260083", "0.715982", "0.7092487", "0.7000812", "0.6926073", "0.682812", "0.68220454", "0.677222", "0.676606", "0.66988957", "0.669569", "0.66841584", "0.6640958", "0.66385335", "0.6625552", "0.6612977", "0.6595446", ...
0.6385234
38
r""" The cumulative hazard function for a distribution using the parameters found in the ``.params`` attribute.
def Hf(self, x, X): if type(x) == list: x = np.array(x) return self.model.hf(x, X, *self.params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumulative_hazard(self, t, t_section):\n λ = torch.exp(self.logλ)\n\n # cumulative hazard\n cum_hazard = λ * self.widths\n cum_hazard = cum_hazard.cumsum(0)\n cum_hazard = self.prepend_zero(cum_hazard)\n cum_hazard_sec = cum_hazard[t_section]\n\n δ_t = t - self....
[ "0.60570204", "0.60319805", "0.5774177", "0.57732964", "0.57166827", "0.56217664", "0.55389374", "0.5386353", "0.5382352", "0.53780574", "0.5292881", "0.52690184", "0.5240028", "0.5196296", "0.51733685", "0.51666766", "0.51470697", "0.5142484", "0.5124799", "0.5124009", "0.51...
0.0
-1
Serialize the given numpy bool instance to a native python object.
def default_numpy_bool_serializer(np_bool: np.bool_, **kwargs: Dict[str, Any]) -> bool: return np_bool.item()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bool(a):\n # Booleans need to be converted to integers for Theano\n if cf.use_theano and isinstance(a, (builtins.bool, np.bool_)):\n return np.int8(a)\n elif cf.use_theano or is_theano_object(a):\n return a\n else:\n return builtins.bool(a)", "def convert_bool(self, v, t):\n ...
[ "0.6861864", "0.6637141", "0.65455157", "0.6500497", "0.6457228", "0.6444667", "0.644196", "0.64244586", "0.6366775", "0.636606", "0.62839353", "0.6269632", "0.6265855", "0.62544906", "0.6242926", "0.62285286", "0.62284315", "0.62205946", "0.62100136", "0.6128256", "0.6090576...
0.8004025
0
Serialize the given numpy object instance to a string. It uses str because all numpy object str representation are compatible with the Python builtin equivalent.
def default_numpy_array_serializer( np_array: np.ndarray, **kwargs: Dict[str, Any] ) -> List[Any]: native_list = np_array.tolist() return jsons.default_iterable_serializer(native_list, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_str(self) -> str:\n return dumps(self.as_dict(), cls=NumpyEncoder)", "def np2str(a: np.ndarray) -> str:\n return json.dumps(a.tolist())", "def _serialize_array(self, array):\n buffer = io.BytesIO()\n np.save(buffer, array)\n return buffer.getvalue()", "def as_str(self):\...
[ "0.78949434", "0.76403326", "0.7053368", "0.6945251", "0.69019216", "0.6805534", "0.67603695", "0.6752964", "0.6752964", "0.67353094", "0.6722942", "0.6714071", "0.67120516", "0.67120516", "0.66904944", "0.665997", "0.6656607", "0.66561085", "0.6655779", "0.66445416", "0.6642...
0.0
-1
Get the default pretrained STonKGs model.
def from_default_pretrained(cls, **kwargs) -> ProtSTonKGsForPreTraining: return cls.from_pretrained("stonkgs/protstonkgs", **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_default_model(name):\n return DEFAULT_MODEL_DICT[name]", "def get_default_model():\n models = PluginLoader.get_available_models()\n return 'original' if 'original' in models else models[0]", "def get_default_model(self):\n return self.default_model", "def _get_fallback_model(...
[ "0.7386228", "0.7326146", "0.7030142", "0.6931034", "0.6776019", "0.6768746", "0.6511428", "0.6445138", "0.64266455", "0.63915956", "0.63906044", "0.6353093", "0.63015527", "0.6286604", "0.6285321", "0.62462056", "0.6204003", "0.62014246", "0.61988705", "0.61866933", "0.61856...
0.66550076
6
Return class extended from dict with predefined attributes.
def dict_with_attrs(*args): class CustomDict(dict): __slots__ = args def __init__(self, *args, **kwargs): super(CustomDict, self).__init__(*args) for k, v in kwargs.iteritems(): setattr(self, k, v) return CustomDict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, d):\n attr_cls = etau.get_class(d[\"type\"])\n return attr_cls._from_dict(d)", "def __new__(metacls, name, bases, classdict):\n # classdict is not always a dict wtf\n if not isinstance(classdict, dict):\n classdict = dict(classdict)\n\n for (key, v...
[ "0.6915154", "0.6848715", "0.6619447", "0.64407814", "0.6350254", "0.6337018", "0.6310718", "0.630098", "0.6287915", "0.628274", "0.62654734", "0.6240761", "0.6227842", "0.6196036", "0.6185309", "0.6156422", "0.6057244", "0.6047725", "0.5999413", "0.5999413", "0.59933215", ...
0.6267856
10
Returns class with predefined attributes that's behaves like dict.
def dict_with_attrs2(*args): class CustomDict(object): __slots__ = args __dict__ = {} def __init__(self, *args, **kwargs): super(CustomDict, self).__init__() if args: self.__dict__.update(*args) for k, v in kwargs.iteritems(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict(cls):\n if cls._dict is None:\n cls._dict = {attr: getattr(cls, attr) for attr in cls.keys()}\n return cls._dict", "def universal_dict(name, attributes, namespace=None):\n\n def wrapper(cls):\n \"\"\"Inner decorator\n\n Args:\n cls: Input class\n\n ...
[ "0.71188974", "0.7104826", "0.69981736", "0.6951296", "0.6823749", "0.6714926", "0.67116714", "0.66764766", "0.6594255", "0.65357935", "0.64394623", "0.63782394", "0.6249532", "0.6230101", "0.6229982", "0.62257504", "0.6108477", "0.6103807", "0.6079946", "0.6075537", "0.60755...
0.6867783
4
Return a list of nodes forming the path from the root to this node.
def path(self): node, path_back = self, [] while node: path_back.append(node.state) node = node.parent return list(reversed(path_back))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(self):\n node, return_path = self, []\n while node:\n # Add the nodes in reverse order to a list until you reach the\n # root parent node which will terminate the loop\n return_path.append(node)\n node = node.parent\n # Reverse the list to g...
[ "0.7984329", "0.77074516", "0.7606885", "0.7581861", "0.7581861", "0.7442534", "0.7393407", "0.73567694", "0.73452824", "0.7337256", "0.7315247", "0.7290767", "0.7246857", "0.72439355", "0.7197385", "0.7157757", "0.715197", "0.71127594", "0.710878", "0.7068614", "0.7051616", ...
0.7297849
11
Return the state that results from executing the given action in the given state. The action must be one of self.actions(state).
def result(self, state, action): state_after_act = [[0 for i in range(self.col)] for j in range(self.row)] for k in action: x = k[1][0] y = k[1][1] if k[0] == "vaccinate": state_after_act[x][y] = ('I', 1) else: state_after_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result(self, state, action):\n return self.actions(state)\n\n raise NotImplementedError", "def get_action(self, state):\n assert np.shape(state) == (self._state_dim,)\n\n ### PROBLEM 2\n ### YOUR CODE HERE\n # raise NotImplementedError\n best_action = self._se...
[ "0.73666155", "0.7348703", "0.73339397", "0.71464074", "0.7144661", "0.7106249", "0.70973265", "0.70748794", "0.7064508", "0.70303303", "0.70127004", "0.69918805", "0.69513994", "0.69513994", "0.69435465", "0.6936866", "0.6917359", "0.68941545", "0.6882376", "0.68590295", "0....
0.0
-1
Extracts a list of ngrams from a sequence of tokens. Optionally filters stopwords and partsofspeech tags.
def ngrams(doc, n, filter_stopwords=True, good_tags={'NOUN', 'PROPN', 'ADJ'}): ngrams_ = (doc[i:i + n] for i in range(len(doc) - n + 1)) ngrams_ = (ngram for ngram in ngrams_ if not any(w.is_space or w.is_punct for w in ngram)) if filter_stopwords: ngrams_ = (ngram for ngram in ngram...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ngrams(tokens,lang):\n stopwords = stops.stopwords[lang]\n max = len(tokens)\n ngrams = []\n left_punctuation = '!\"%&\\'()*+,-./:;<=>?[\\\\]^_`{|}~'\n\n for i in range(1,max):\n for j in xrange(0,len(tokens)-(i-1)):\n if __check_features(tokens[j:j+i],stopwords):\n ...
[ "0.67689955", "0.638789", "0.62968653", "0.62458616", "0.6241695", "0.62124324", "0.62124324", "0.6200714", "0.6195914", "0.6065235", "0.60594636", "0.6045318", "0.6030371", "0.6029092", "0.6014368", "0.5984045", "0.5980244", "0.5962954", "0.59489787", "0.5913373", "0.5894951...
0.6927093
0
Saves json to disk
def save(self): with open(self.SETTINGS_FILE, 'w') as handle: data = dict() for (key, value) in self.__dict__.items(): if not key.startswith('__'): data[key] = value json.dump(data, handle)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save(self):\n with open(self.file_path, 'w') as fid:\n json.dump(self.data, fid, indent=4, sort_keys=True)", "def save_json(self, data, json_path=None):\n if json_path is None:\n json_path = self.json_path\n with open(json_path, encoding='utf-8', mode='w') as f:\n ...
[ "0.8146608", "0.8103121", "0.79884785", "0.79823726", "0.7956236", "0.7944488", "0.7944488", "0.7944488", "0.79351836", "0.79003954", "0.7849422", "0.78461325", "0.7745626", "0.7730556", "0.77196413", "0.7712896", "0.77034354", "0.7658315", "0.7652176", "0.7647846", "0.762540...
0.0
-1
Returns a random string of length string_length.
def my_random_string(string_length=7): flag = False while flag == False: random = str(uuid.uuid4()) # Convert UUID format to a Python string. random = random.upper() # Make all characters uppercase. random = random.replace("-","") # Remove the UUID '-'. my_hash = random[0:string_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string(length):\n return ''.join(SystemRandom().choice(ascii_letters + digits)\n for i in range(length))", "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def get_random_stri...
[ "0.8691263", "0.8690539", "0.8676425", "0.86712104", "0.86504567", "0.86304426", "0.8626901", "0.85903996", "0.8588565", "0.8576007", "0.8560824", "0.85416645", "0.8539037", "0.85361385", "0.84932715", "0.8490938", "0.844971", "0.8442166", "0.84295636", "0.8426424", "0.838733...
0.0
-1
Represents a plotter for registrations. Saves the moving image on each resolution change and the registration end.
def __init__(self, plot_dir: str, file_name_prefix: str = '') -> None: super().__init__() self.plot_dir = plot_dir self.file_name_prefix = file_name_prefix self.resolution = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration_resolution_changed(self):\n self._write_image('res' + str(self.resolution))\n self.resolution = self.resolution + 1", "def save_plot(self):\r\n\t\t# Generate the plot\r\n\t\tself.generate_plot()\r\n\t\t# Create save directory\r\n\t\tdirectory = self.dir + '/%s/' % str(int(self.univ...
[ "0.6069234", "0.5992814", "0.5930921", "0.5888007", "0.5852812", "0.57674295", "0.5758157", "0.56983036", "0.55172473", "0.54818344", "0.54771286", "0.5443621", "0.54205316", "0.53946054", "0.53733927", "0.53448796", "0.53390396", "0.532733", "0.5319958", "0.53151286", "0.530...
0.0
-1
Return the amount of relations in the modelfile.
def get_number_of_relations(model): if model == None: return 0 counter = 0 for line in model: if line.find('f(2') >= 0: counter += 1 return float(counter) #TODO when multiples of same relation, the result is still 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\n return len(self._relationships)", "def get_relation_length(self, relation_name):\n try:\n conn = psycopg2.connect(\"dbname='{0}'\".format(DATABASE))\n cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)\n cur.execute(sql.SQL(\"SELECT C...
[ "0.6608096", "0.6528449", "0.642496", "0.641118", "0.6170477", "0.6135605", "0.60742676", "0.6050827", "0.60481715", "0.6032104", "0.60219", "0.599503", "0.59808564", "0.5978073", "0.597612", "0.59550285", "0.5892466", "0.5876437", "0.5866056", "0.5859394", "0.5854556", "0....
0.760421
0
This function takes a filename as input, and returns a dataframe with raw data read from that file in a Pandas DataFrame. The DataFrame index should be the year, month and day of the observation. DataFrame headers should be "Date", "Precip", "Max Temp", "Min Temp", "Wind Speed". Function returns the completed DataFrame...
def ReadData( fileName ): # define column names colNames = ['Date','Precip','Max Temp', 'Min Temp','Wind Speed'] #NOTE: I changed the column names because .query() would not work when referencing column names with spaces global DataDF #added this line to make the dataframe visible in the variable explo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(fname: str) -> pd.DataFrame:\n raw_data = (\n pd.read_hdf(fname).to_frame().reset_index(level=[0, 1]).loc[ANALYSIS_DATE]\n )\n raw_data[\"date\"] = raw_data.index\n return raw_data", "def load_data(fpath: str, station: Dict[str, Any]) -> pd.DataFrame:\n df ...
[ "0.6836466", "0.6620243", "0.65212286", "0.64475286", "0.6446659", "0.64143574", "0.6404277", "0.6382293", "0.6360664", "0.63007826", "0.62479633", "0.623475", "0.6176039", "0.61627704", "0.614112", "0.6122494", "0.61128575", "0.60823435", "0.60781777", "0.6057122", "0.604903...
0.708538
0
Return the batch sampler for torch DataLoader.
def build_batch_sampler( self, build_batch_sampler: dict, target_dir: str, cache_dir: str, mode: str, data_csv: str, dataset: Dataset, ): def _build_batch_sampler( train: dict = None, valid: dict = None, test: dict = None ): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_loader(batch_size, train_set, train_sampler):\n train_loader = torch.utils.data.DataLoader(train_set, batch_size=batch_size, sampler=train_sampler, num_workers=4)\n\n return train_loader", "def get_loader(self, batch_size=1, num_threads=3):\n\n gen_func, gen_types, gen_shapes = self.ge...
[ "0.7504383", "0.7078306", "0.68939435", "0.6834587", "0.68155754", "0.67458016", "0.6712563", "0.6707158", "0.6663603", "0.6657999", "0.6648987", "0.65571725", "0.6546343", "0.65012336", "0.6476465", "0.635005", "0.63412124", "0.6290277", "0.62717426", "0.62717426", "0.627174...
0.6208087
28
Get the protein indices of this Pattern DNA.
def get_indices(self): return self._indices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position_tuples(self, protein=False):\n if protein:\n if not self.is_coding():\n raise AttributeError(\n \"Cannot return wild type protein \"\n \"position tuples for non-coding wild \"\n \"type [{}]\".format(self.parent_n...
[ "0.6438336", "0.6386663", "0.6190215", "0.6186855", "0.613421", "0.6118562", "0.6016423", "0.6007257", "0.59953547", "0.5990575", "0.5988369", "0.5983595", "0.59767777", "0.588974", "0.58851296", "0.58837056", "0.58705294", "0.5832751", "0.5824465", "0.5801836", "0.5787089", ...
0.61409116
4
Sets the id of this MarketOrderRejectTransaction.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancelling_transaction_id(self, cancelling_transaction_id):\n\n self._cancelling_transaction_id = cancelling_transaction_id", "def set_id(self, id_):\n\n self.id_ = id_", "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id...
[ "0.616969", "0.6081822", "0.6005011", "0.59927577", "0.5952243", "0.5931047", "0.5931047", "0.5931047", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "0.5874312", "...
0.0
-1
Sets the user_id of this MarketOrderRejectTransaction.
def user_id(self, user_id): self._user_id = user_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id(self, user_id):\n if user_id is None:\n raise ValueError(\"Invalid value for `user_id`, must not be `None`\") # noqa: E501\n\n self._user_id = user_id", "def user_id(self, user_id):\n if user_id is None:\n raise ValueError(\"Invalid value for `user_id`, mus...
[ "0.6791442", "0.6791442", "0.6556419", "0.65344274", "0.65039194", "0.60536677", "0.6035002", "0.600265", "0.5733465", "0.5733465", "0.5648693", "0.56065035", "0.5591614", "0.5591018", "0.5564686", "0.55509424", "0.55509424", "0.55509424", "0.55509424", "0.55509424", "0.55509...
0.680719
9
Sets the batch_id of this MarketOrderRejectTransaction.
def batch_id(self, batch_id): self._batch_id = batch_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch(self, batch):\n\n self._batch = batch", "def cancelling_transaction_id(self, cancelling_transaction_id):\n\n self._cancelling_transaction_id = cancelling_transaction_id", "def from_batch_id(batch_id: int, *args, **kwargs):\n b = Batch(*args, **kwargs)\n assert isinstance(b...
[ "0.54712254", "0.49516186", "0.48238078", "0.47711", "0.47382987", "0.46406078", "0.45800018", "0.4546411", "0.45108935", "0.45005015", "0.44547743", "0.44355947", "0.4424396", "0.44218066", "0.44215253", "0.44097447", "0.4409602", "0.4392691", "0.43434194", "0.434097", "0.43...
0.69741434
0
Sets the type of this MarketOrderRejectTransaction.
def type(self, type): allowed_values = ["CREATE", "CLOSE", "REOPEN", "CLIENT_CONFIGURE", "CLIENT_CONFIGURE_REJECT", "TRANSFER_FUNDS", "TRANSFER_FUNDS_REJECT", "MARKET_ORDER", "MARKET_ORDER_REJECT", "FIXED_PRICE_ORDER", "LIMIT_ORDER", "LIMIT_ORDER_REJECT", "STOP_ORDER", "STOP_ORDER_REJECT", "MARKET_IF_TOUCHED_OR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self, type):\n allowed_values = [\"MARKET\", \"LIMIT\", \"STOP\", \"MARKET_IF_TOUCHED\", \"TAKE_PROFIT\", \"STOP_LOSS\", \"TRAILING_STOP_LOSS\", \"FIXED_PRICE\"] # noqa: E501\n if type not in allowed_values:\n raise ValueError(\n \"Invalid value for `type` ({0}), m...
[ "0.63552785", "0.61354685", "0.5958674", "0.59507453", "0.5940051", "0.5940051", "0.5724454", "0.5724454", "0.5704127", "0.56992775", "0.5691497", "0.56812745", "0.56812745", "0.56812745", "0.5617452", "0.560892", "0.5593402", "0.5567974", "0.55197144", "0.55197144", "0.55159...
0.6185596
1
Sets the units of this MarketOrderRejectTransaction.
def units(self, units): self._units = units
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_units(self, units):\n self.units = units", "def setUnits(self, *args):\n return _libsbml.ASTNode_setUnits(self, *args)", "def units_setting(self, units_setting):\n\n self._units_setting = units_setting", "def setDistanceUnits(self, units: Unit) -> None:\n self.units = ..."...
[ "0.68634665", "0.62225926", "0.61284584", "0.60881466", "0.6033428", "0.5960187", "0.5959898", "0.5921989", "0.5751329", "0.57310385", "0.5690587", "0.5566046", "0.5557599", "0.5536428", "0.5505388", "0.5492312", "0.5479548", "0.54642123", "0.54361135", "0.54317987", "0.54192...
0.67113054
2
Sets the price_bound of this MarketOrderRejectTransaction.
def price_bound(self, price_bound): self._price_bound = price_bound
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def price_high(self, price_high):\n\n self._price_high = price_high", "def max_price(self, new_max_price):\n self._max_price = new_max_price", "def limit_sell(self, order_id, quantity, price):\n Library.functions.limit_sell(self._book, order_id, quantity, price)", "def price_low(self, pr...
[ "0.59876394", "0.5858634", "0.55547017", "0.55529404", "0.5504063", "0.5416083", "0.5399506", "0.5361958", "0.53292257", "0.53051317", "0.52659595", "0.5250701", "0.5240878", "0.5240878", "0.5240878", "0.5240878", "0.5221792", "0.52198285", "0.52153987", "0.5186552", "0.51787...
0.72744787
0
Sets the stop_loss_on_fill of this MarketOrderRejectTransaction.
def stop_loss_on_fill(self, stop_loss_on_fill): self._stop_loss_on_fill = stop_loss_on_fill
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trailing_stop_loss_on_fill(self, trailing_stop_loss_on_fill):\n\n self._trailing_stop_loss_on_fill = trailing_stop_loss_on_fill", "def trailing_stop_loss_on_fill(self, trailing_stop_loss_on_fill):\n\n self._trailing_stop_loss_on_fill = trailing_stop_loss_on_fill", "def stoploss(self):\n ...
[ "0.67848814", "0.67848814", "0.61803555", "0.60428375", "0.5571031", "0.53847116", "0.5230572", "0.52102363", "0.51663446", "0.5103554", "0.5103554", "0.50750256", "0.4990297", "0.49376294", "0.49010283", "0.48777053", "0.48696148", "0.4856305", "0.48374575", "0.48366204", "0...
0.7519222
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, MarketOrderRejectTransaction): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Construct JSONcompatible dict representation of DC/OS installation state descriptor.
def body(self): if self._istor_nodes is None: istor_nodes = self._istor_nodes else: istor_nodes = { k: str(v) for k, v in self._istor_nodes._asdict().items() } return { 'istor_nodes': istor_nodes, 'istate': self._istate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_state_json(self) -> Dict[str, Any]:\n return self.state_to_json()", "def state_to_json(self) -> Dict[str, Any]:\n return self.rstate.to_json()", "def to_json(self) -> Dict[str, Any]:\n return json.loads(self.get_state().to_json())", "def as_dict(self):\n d = {\n ...
[ "0.66759527", "0.64746493", "0.6470029", "0.6405876", "0.639158", "0.63756096", "0.62627554", "0.624835", "0.62182915", "0.62065744", "0.6195241", "0.6191506", "0.61785084", "0.61625314", "0.61595553", "0.6134287", "0.61318386", "0.61244655", "0.6117357", "0.6113017", "0.6100...
0.0
-1
Initializes the CommentNode instance and sets its instance variables.
def __init__(self, **kwargs): comment, kwargs = util.commentnode_kwargs(kwargs) self.comment = comment super().__init__(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, node, declare):\n self.comment = getOptionalTag(node, \"comment\", [])\n if self.comment != []:\n self.comment = self.comment.replace(\"\\n\",\" \")\n while self.comment.find(\" \") != -1:\n self.comment = self.comment.replace(\" \", \" \")\n ...
[ "0.67862296", "0.6417433", "0.62419426", "0.60803556", "0.60703856", "0.59807277", "0.5921069", "0.59153795", "0.5906258", "0.59005237", "0.58964694", "0.5896427", "0.5881375", "0.5854798", "0.5850246", "0.5801992", "0.58010596", "0.57992613", "0.5796773", "0.57849115", "0.57...
0.72452855
0
Return the precision of the tokenization given by `pred_tokens`, relative to the goldstandard tokenization given by `gold_tokens`.
def precision(gold_tokens, pred_tokens): n_pred_tokens = len(pred_tokens) n_matches = _n_matches(gold_tokens, pred_tokens) return n_matches / n_pred_tokens if n_pred_tokens > 0 else float('NaN')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gold_labels, predicted_labels):\n \n true_pos = 0 #gold pos sys pos\n false_pos = 0 #gold neg sys pos\n\n for i in range(0, len(gold_labels)):\n if(gold_labels[i] == predicted_labels[i] == \"1\"):\n true_pos += 1\n elif(gold_labels[i] == \"0\" and predicted_labels[i] == \"1\"):\n ...
[ "0.7615332", "0.7346569", "0.7274505", "0.71836686", "0.71250874", "0.69158167", "0.6870146", "0.6857818", "0.6857818", "0.6857818", "0.6857818", "0.6857818", "0.6857818", "0.68484575", "0.68323153", "0.68323153", "0.68323153", "0.68323153", "0.68323153", "0.68323153", "0.683...
0.8823241
0
Return the recall of the tokenization given by `pred_tokens`, relative to the goldstandard tokenization given by `gold_tokens`.
def recall(gold_tokens, pred_tokens): n_gold_tokens = len(gold_tokens) n_matches = _n_matches(gold_tokens, pred_tokens) return n_matches / n_gold_tokens if n_gold_tokens > 0 else float('NaN')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_tokenization(test_tokens, gold_tokens):\n matcher = difflib.SequenceMatcher()\n matcher.set_seqs(test_tokens, gold_tokens)\n error_chunks = true_positives = false_positives = false_negatives = 0\n print(\" Token%30s | %-30sToken\" % (\"Error\", \"Correct\"))\n print(\"-\" * 38 + \"+\" +...
[ "0.7206922", "0.7133992", "0.688653", "0.6802705", "0.6706201", "0.6681363", "0.65989614", "0.6493529", "0.6452467", "0.6394541", "0.6376204", "0.6345423", "0.6345423", "0.6345423", "0.6345423", "0.6345423", "0.6345423", "0.6334306", "0.6334306", "0.6334306", "0.6334306", "...
0.8166089
0
Return a list of node URIs stored in the 'dtables' table, which gives the client machine access to the cluster.
def return_node_uris(k, r): f, tname = r[1], r[2] # Connect to the catalog. conn, cur = Database.connect(f, ErrorHandle.raise_handler) sql_handler = lambda e_n: Database.rollback_wrapper(e_n, ErrorHandle.raise_handler, conn) # Grab the node URIs belonging to the given table. Re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_nodes(self):\n return self.datanodes.keys()", "def return_node_uris(c, tname):\n host, port, f = ClusterCFG.parse_uri(c)\n\n # Create our socket.\n sock = Network.open_client(host, port)\n if ErrorHandle.is_error(sock):\n return ErrorHandle.wrap_error_tag('S...
[ "0.6401811", "0.62206054", "0.61878246", "0.60436136", "0.60244495", "0.6003733", "0.5842286", "0.584082", "0.5837702", "0.5819017", "0.58174837", "0.57950413", "0.5758357", "0.5723658", "0.5680991", "0.5668304", "0.56438655", "0.56185335", "0.5608812", "0.55858696", "0.55572...
0.6838651
0
Copy/paste/tweak model's weights to transformers design.
def convert_flava_checkpoint(checkpoint_path, codebook_path, pytorch_dump_folder_path, config_path=None): if config_path is not None: config = FlavaConfig.from_pretrained(config_path) else: config = FlavaConfig() hf_model = FlavaForPreTraining(config).eval() codebook_state_dict = conve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(model):\n ...", "def _set_weights(self):\n self.Wc = torch.mm(self.TP.T, self.W).mm(self.TP)", "def update_weights(self):\n\t\tpass", "def transfer_weights(self):\n W, target_W = self.model.get_weights(), self.target_model.get_weights()\n for i in range(len(W)):\n...
[ "0.6434471", "0.6390357", "0.63426805", "0.6310116", "0.62819606", "0.62763566", "0.62763566", "0.62763566", "0.62428963", "0.62073433", "0.6166604", "0.61212003", "0.61101246", "0.6071462", "0.59756315", "0.5932138", "0.59147173", "0.59093386", "0.59081566", "0.5896905", "0....
0.0
-1
Checks whether a path doesn't match one of the ignore patterns.
def ignore_pattern_filter(self, path): # Return False for the checksum file. if self.checksum_file_path.exists(): if self.checksum_file_path.samefile(path): return False # Return True of no patterns where given. if self.ignore_patterns is None: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ignore(path):\n return any(re.match(pattern, path) for pattern in ignore)", "def should_ignore_path(path):\n for p in config.compiled_ignore_patterns:\n if p.match(path):\n return True\n return False", "def ignore_path(path, ignore_list=None, whitelist=None):\n if ignore_...
[ "0.84693325", "0.79556054", "0.77542216", "0.77243066", "0.767848", "0.7567808", "0.7485229", "0.74522066", "0.7436566", "0.7371237", "0.73677677", "0.7255325", "0.6994276", "0.69670373", "0.6907283", "0.67134756", "0.6635161", "0.6532193", "0.6469475", "0.6451187", "0.641754...
0.7673839
5
Renders the home page.
def home(): return render_template( 'index.html', title='Automation Center', year=datetime.now().year, message='Welcome to the Automation Center' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n\n return render_template('home_page.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def ...
[ "0.85574406", "0.853399", "0.8351404", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.827363", "...
0.7795327
77
Renders the about page.
def about(): return render_template( 'about.html', title='About', message='Project Brief.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.8394454", "0.82935613", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82680845",...
0.8204868
24
Return the rows of the table. Header and footer rows are included in the count.
def get_table_rows(self, table_locator, loglevel='INFO'): table = self._table_element_finder.find(self._current_browser(), table_locator) if table is not None: rows = table.find_elements_by_xpath("./thead/tr") rows.extend(table.find_elements_by_xpath("./tbody/tr")) ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rows(self):\n return self.Rows(self)", "def rows(self):\n if self.header is None:\n raise ValueError('header cannot be None.')\n header = list(enumerate(self.header))\n return ({'count': v, **{f: k[i] for i, f in header}} for k, v in self.items())", "def get_table_row...
[ "0.72642994", "0.7126307", "0.7091468", "0.7082948", "0.7014534", "0.6999806", "0.69433177", "0.69219774", "0.6818649", "0.6752095", "0.6729207", "0.6693278", "0.66899735", "0.668595", "0.65616935", "0.65501463", "0.65039545", "0.64913774", "0.6373596", "0.6283091", "0.627876...
0.67151433
11
Aggregates transactions by their resepective categories
def groupTxns(txnSubCollection, classifier=DefaultClassifier(), mustHaveProbes=None): groupMap = {} # classifiy the counter breakups into categories for txn in txnSubCollection: if not mustHaveProbes or txn.hasProbes(mustHaveProbes): TxnAggregator._addOrUpdateContainer( groupMap, la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transactions(all_tx, type_filter):\n return map_reduce(lambda tx: [(tx.case_id,)],\n lambda v: sorted(v, key=lambda tx: tx.priority_order), # important!\n data=filter(type_filter, all_tx),\n include_docs=True)", "def budget...
[ "0.6043684", "0.59223616", "0.5841007", "0.56304395", "0.55718404", "0.55374765", "0.55227816", "0.5430148", "0.54216105", "0.54151744", "0.5384077", "0.537592", "0.5346596", "0.5326109", "0.5297145", "0.52805257", "0.52644163", "0.5246926", "0.5225621", "0.52107614", "0.5161...
0.0
-1
Return a submatrix with the given rows and columns.
def submatrix(self, row_set, column_set): submatrix = Matrix(len(row_set), len(column_set)) raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submatrix(self, from_row: int, num_of_rows: int,\n from_col: int, num_of_cols: int) -> Matrix:\n A = [row[from_col:from_col+num_of_cols]\n for row in self._A[from_row:from_row+num_of_rows]]\n\n return Matrix(A, clone_matrix=False)", "def subset(self, rows, cols):\n ...
[ "0.7637758", "0.6963952", "0.6932904", "0.6636276", "0.66148734", "0.6336145", "0.63309044", "0.61470884", "0.61235136", "0.60355", "0.59983504", "0.59393865", "0.5931904", "0.5908259", "0.58184266", "0.5780733", "0.5771103", "0.5761476", "0.57053506", "0.56737775", "0.567193...
0.78517514
0
Splits path to reterive domain
def get_domain_from_path(post_path): return post_path.split('/', 1)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_split_fullpath_with_route_domain():\n\n # Expected input must have route specified, otherwise reject\n tests = [\n [\"/Partition/1.2.3.4%0:80\", \"/Partition\", \"1.2.3.4\", 0, 80],\n [\"/Part/Folder/1.2.3.4%1:443\", \"/Part/Folder\", \"1.2.3.4\", 1, 443],\n [\"/Part/::ffff:0:0%...
[ "0.71818495", "0.70898926", "0.7057033", "0.6897246", "0.67176765", "0.66891456", "0.6666522", "0.66478187", "0.66435826", "0.66200495", "0.6552045", "0.65107936", "0.64860445", "0.6468844", "0.64266604", "0.6392706", "0.63296366", "0.63124466", "0.6286037", "0.6261368", "0.6...
0.66134393
10
test that two numbers are subtracted from each other and returned
def test_subtract_numbers(self): self.assertEqual(subtract(8, 4), 4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(num1, num2):\n return num1 - num2", "def subtract(first, second):\n return first - second", "def subtraction(number1, number2):\n return number1 - number2", "def subtract(num1, num2):\n return num1 - num2", "def subtract(num1, num2):\n return num1 - num2", "def subtract_numbers(...
[ "0.81849897", "0.81740993", "0.81333935", "0.81261384", "0.81261384", "0.8074688", "0.8071506", "0.8071506", "0.7994318", "0.7930554", "0.79095656", "0.79094756", "0.79069036", "0.7893601", "0.7892667", "0.7864205", "0.7833848", "0.7833848", "0.7833848", "0.7828021", "0.77706...
0.7802757
20
Function that return whether two numbers of an array add up to a given int k
def add_up_to(array, k): add_up = False for i in range(len(array)): for j in range(i, len(array)): if array[i] + array[j] == k: return not add_up return add_up
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_up_to_bonus(array, k):\n add_up = False\n for i in range(len(array)):\n if (k - array[i]) in array[(i+1):]:\n return not add_up\n return add_up", "def check_through_arr(arr, k):\n i = 0\n j = 1\n count = 0\n while j < len(arr):\n if arr[i] + k > arr[j]:\n ...
[ "0.80263937", "0.73171085", "0.7078784", "0.69871897", "0.6769615", "0.67333865", "0.6723526", "0.6612337", "0.656037", "0.6499423", "0.6489904", "0.6444215", "0.64191973", "0.6405079", "0.6306966", "0.6278029", "0.62304604", "0.6185139", "0.618443", "0.61533153", "0.6140441"...
0.8181224
0
Function that return whether two numbers of an array add up to a given int k Same as the previous one but does the process in one pass
def add_up_to_bonus(array, k): add_up = False for i in range(len(array)): if (k - array[i]) in array[(i+1):]: return not add_up return add_up
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_up_to(array, k):\n add_up = False\n for i in range(len(array)):\n for j in range(i, len(array)):\n if array[i] + array[j] == k:\n return not add_up\n return add_up", "def listEqualNumber(numbers, k):\n\n for i in range(len(numbers)):\n for j in range(le...
[ "0.80783874", "0.71850127", "0.7112109", "0.70567715", "0.6838672", "0.66224855", "0.6579962", "0.6568131", "0.64855", "0.6477507", "0.6416751", "0.6355544", "0.6310595", "0.6282906", "0.6265922", "0.6254142", "0.6241136", "0.6231912", "0.6219769", "0.61956555", "0.6165372", ...
0.78991693
1
Creates a shield for the player
def shield_up(screen, player): #Spawn the blocks screen.blocks = BlockGroup(screen.screen_width, screen.screen_height//1.2, screen.screen, 3, screen.player1.get_height() + 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_shield(ai_settings, screen, stats, shield):\n\tif (stats.alien_kills % ai_settings.shield_drop_point == 0):\n\t\tif (len(shield) < 1):\n\t\t\tnew_shield = Shield(ai_settings, screen)\n\t\t\tshield.add(new_shield)", "def shield(self):\n capacity = self._getAttribute(Attribute.shieldCapacity)\n re...
[ "0.7926429", "0.65140337", "0.6461072", "0.64147377", "0.62519276", "0.6031781", "0.6031781", "0.5920436", "0.51673377", "0.5003809", "0.49737394", "0.49566978", "0.4849355", "0.48456866", "0.48456866", "0.48374948", "0.48044813", "0.47855592", "0.4775937", "0.4771783", "0.47...
0.5718269
8
Destroy lives of all normal enemies by 1
def emp_bomb(screen, player): #Var to decrease emp bomb dmg if screen.wave // 4 > 1: health_dec = screen.wave // 4 else: health_dec = 1 #Iterate through all the sprites for sprite in screen.enemies: #If the enemy only has 1 life if sprite.get_lives() <= health_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revive_heroes(self, health=100):\n for hero in range(len(self.heroes)):\n self.heroes[hero].health = self.heroes[hero].start_health", "def kill(self, enemys):\n for enemy in enemys:\n for bullet in self.bullets:\n if enemy.rect.colliderect(bullet.rect):\n ...
[ "0.69009894", "0.686637", "0.6799824", "0.6712598", "0.6462224", "0.6406054", "0.63886005", "0.6234758", "0.6177906", "0.60148466", "0.6004328", "0.59714055", "0.5908846", "0.59051913", "0.58951366", "0.5891623", "0.5853167", "0.5841208", "0.58343726", "0.5812321", "0.5806709...
0.6666145
4
Increase the bullet power of the player
def extra_bullet_power(screen, player): #Increase the bullet power of the player if player.get_bullet_power() < screen.wave + 2: #Increase the damage of the player bullet player.increase_bullet_power(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrease_bullet_power(screen, player):\n\n #If the player bullet power is greater than 1\n if player.get_bullet_power() > 1:\n\n #Decrease the player bullet power\n player.increase_bullet_power(-1)", "def bullet_up(screen, player):\n #If the player is not firing at a higher speed\n ...
[ "0.7462812", "0.71221375", "0.68916607", "0.6845742", "0.6729341", "0.66336495", "0.6602227", "0.65300953", "0.6414298", "0.64081305", "0.6350781", "0.63279396", "0.6267386", "0.6257932", "0.6231431", "0.62284976", "0.6203847", "0.61917883", "0.6185694", "0.61731195", "0.6157...
0.81642306
0
Decrease the bullet power of the player
def decrease_bullet_power(screen, player): #If the player bullet power is greater than 1 if player.get_bullet_power() > 1: #Decrease the player bullet power player.increase_bullet_power(-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bullet_down(screen, player):\n\n #If the player is not firing at a really slow speed\n if player.maxcooldown < screen.fps:\n player.maxcooldown += 2", "def bullet_up(screen, player):\n #If the player is not firing at a higher speed\n if player.maxcooldown > 6:\n player.maxcooldown -...
[ "0.73818815", "0.71456206", "0.69487506", "0.6702782", "0.6502496", "0.63303065", "0.62927586", "0.6281604", "0.62743026", "0.62197655", "0.6213346", "0.61908555", "0.6176309", "0.6165527", "0.61522216", "0.6116871", "0.6103739", "0.6055228", "0.6037487", "0.59977174", "0.596...
0.88279486
0
Test generated header file within cpp source file.
def test_headerfile(template=TESTFILE_TEMPLATE, testvalue=1.1, df=1, precision=10000, start_chi=25, headerfile="tests/Chi2PLookup.h", srcfpath="tests/test.cpp", binfpath="tests/test.out"): command = "python -m chi2plookup generate --headerfile={} --df={} --precision={} --star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_header():\n header_file = AUTOGEN_WARNING\n header_file += \"/// /file atomic_nuclear_data.h\\n\"\n header_file += \"/// /author Andrew Davis (andrew.davis@wisc.edu)\\n\"\n header_file += \"///\\n\"\n header_file += (\n \"/// /brief Implements all the fundamental atomic & nuclear...
[ "0.6506344", "0.64690584", "0.63654625", "0.632702", "0.6290967", "0.6247173", "0.61565125", "0.6110689", "0.61089665", "0.6091983", "0.60704404", "0.6035598", "0.6014333", "0.60120636", "0.6008023", "0.59775066", "0.59770197", "0.59426457", "0.59142625", "0.5907985", "0.5890...
0.6995705
0
Indicates if the request context is an administrator.
def is_admin_context(context): if not context: warnings.warn(_('Use of empty request context is deprecated'), DeprecationWarning) raise Exception('die') return context.is_admin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_administrator(self):\n return self.can(Permission.ADMIN)", "def is_administrator(self):\n return self.can(Permission.ADMIN)", "def is_admin(self):\n if not self.current_user:\n return False\n else:\n return self.current_user in [\"1\"]", "def is_admini...
[ "0.8191161", "0.8191161", "0.8108815", "0.8068232", "0.80673116", "0.80640364", "0.8022507", "0.7994126", "0.79832196", "0.79504997", "0.79504997", "0.79398054", "0.7807665", "0.77539754", "0.7704711", "0.76905066", "0.76668555", "0.7647622", "0.76299095", "0.76168936", "0.76...
0.7406213
34
Indicates if the request context is a normal user.
def is_user_context(context): if not context: return False if context.is_admin: return False if not context.user_id or not context.project_id: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_user_context(context):\n if not context or not isinstance(context, RequestContext):\n return False\n if context.is_admin:\n return False\n return True", "def is_regular_user(user):\n return user.is_authenticated()", "def _is_user_context(context):\n if not context:\n ...
[ "0.7632277", "0.74472946", "0.70615214", "0.70615214", "0.68780714", "0.673595", "0.6617593", "0.6616803", "0.6615392", "0.6606159", "0.6588011", "0.6531366", "0.64678705", "0.64584976", "0.6383593", "0.6357672", "0.6351535", "0.63481635", "0.63026196", "0.6299073", "0.629090...
0.6977175
5
Decorator to require the specified share network subnet to exist. Requires the wrapped function to use context and share_network_subnet_id as their first two arguments.
def require_share_network_subnet_exists(f): @wraps(f) def wrapper(context, share_network_subnet_id, *args, **kwargs): share_network_subnet_get(context, share_network_subnet_id) return f(context, share_network_subnet_id, *args, **kwargs) wrapper.__name__ = f.__name__ return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_share_exists(f):\n @wraps(f)\n def wrapper(context, share_id, *args, **kwargs):\n share_get(context, share_id)\n return f(context, share_id, *args, **kwargs)\n wrapper.__name__ = f.__name__\n return wrapper", "def require_share_instance_exists(f):\n @wraps(f)\n def wra...
[ "0.62906754", "0.61818737", "0.60099584", "0.5219941", "0.50199157", "0.4976661", "0.49296808", "0.49183965", "0.4889821", "0.48663825", "0.48009545", "0.4792581", "0.47901934", "0.4778091", "0.47467113", "0.4727369", "0.4687619", "0.46799305", "0.46682802", "0.46657076", "0....
0.8838162
0
Decorator to require the specified share instance to exist. Requires the wrapped function to use context and share_instance_id as their first two arguments.
def require_share_instance_exists(f): @wraps(f) def wrapper(context, share_instance_id, *args, **kwargs): share_instance_get(context, share_instance_id) return f(context, share_instance_id, *args, **kwargs) wrapper.__name__ = f.__name__ return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_share_exists(f):\n @wraps(f)\n def wrapper(context, share_id, *args, **kwargs):\n share_get(context, share_id)\n return f(context, share_id, *args, **kwargs)\n wrapper.__name__ = f.__name__\n return wrapper", "def require_share_snapshot_exists(f):\n @wraps(f)\n def wra...
[ "0.8175012", "0.7726144", "0.68108416", "0.65809447", "0.6293138", "0.5848768", "0.5622376", "0.54770184", "0.54770184", "0.54062116", "0.5389517", "0.5389517", "0.53846145", "0.53150797", "0.5278322", "0.5144399", "0.5051295", "0.5025795", "0.5025795", "0.49902993", "0.49831...
0.8840724
0
Query helper that accounts for context's `read_deleted` field.
def model_query(context, model, *args, **kwargs): session = kwargs.get('session') if hasattr(context, 'session') and context.session: session = context.session if not session: session = get_session() read_deleted = kwargs.get('read_deleted') or context.read_deleted project_only = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_query(context, *args, **kwargs):\n session = kwargs.get('session') or context.session\n read_deleted = kwargs.get('read_deleted') or context.read_deleted\n project_only = kwargs.get('project_only')\n\n query = session.query(*args)\n\n if read_deleted == 'no':\n query = query.filter_...
[ "0.6627549", "0.6627549", "0.6613225", "0.6613225", "0.6242648", "0.62392414", "0.58661956", "0.5761054", "0.5659555", "0.5637472", "0.55814755", "0.55604327", "0.5552125", "0.54741687", "0.53852934", "0.53211725", "0.53011674", "0.52753043", "0.5223493", "0.51596826", "0.515...
0.6230362
6
Applies exact match filtering to a query. Returns the updated query. Modifies filters argument to remove filters consumed.
def exact_filter(query, model, filters, legal_keys, created_at_key='created_at'): filter_dict = {} created_at_attr = getattr(model, created_at_key, None) # Walk through all the keys for key in legal_keys: # Skip ones we're not filtering on if key not in filters: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exact_filter(query, model, filters, legal_keys):\n\n filter_dict = {}\n\n # Walk through all the keys\n for key in legal_keys:\n # Skip ones we're not filtering on\n if key not in filters:\n continue\n\n # OK, filtering on this key; what value do we search for?\n ...
[ "0.70886403", "0.62373084", "0.60857767", "0.60531527", "0.60531527", "0.60522145", "0.60442626", "0.5980774", "0.59535575", "0.5900673", "0.5853482", "0.5823551", "0.5740636", "0.5699592", "0.56672454", "0.56462556", "0.56449527", "0.5596534", "0.5581866", "0.55695236", "0.5...
0.67535067
1
Returns list of share instances that belong to given share.
def share_instances_get_all_by_share(context, share_id): result = ( model_query(context, models.ShareInstance).filter( models.ShareInstance.share_id == share_id, ).all() ) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_instances_get_all_by_share_network(context, share_network_id):\n result = (\n model_query(context, models.ShareInstance).filter(\n models.ShareInstance.share_network_id == share_network_id,\n ).all()\n )\n return result", "def share_instances_get_all_by_share_server(co...
[ "0.8084144", "0.7523595", "0.73590827", "0.6667383", "0.6508828", "0.6121487", "0.58515793", "0.5774612", "0.5773792", "0.5746597", "0.55819094", "0.55207425", "0.54920053", "0.54629123", "0.53225636", "0.53004646", "0.52994925", "0.5296331", "0.5225122", "0.52142537", "0.521...
0.8177977
0
Returns list of shares in recycle bin with given share network.
def get_shares_in_recycle_bin_by_network( context, share_network_id, filters=None, sort_key=None, sort_dir=None): if filters is None: filters = {} filters["share_network_id"] = share_network_id filters["is_soft_deleted"] = True query = _share_get_all_with_filters(context, filters=filters...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shares_in_recycle_bin_by_share_server(\n context, share_server_id, filters=None, sort_key=None, sort_dir=None):\n if filters is None:\n filters = {}\n filters[\"is_soft_deleted\"] = True\n query = _share_get_all_with_filters(\n context, share_server_id=share_server_id, filters...
[ "0.6680181", "0.64485323", "0.5804686", "0.57891446", "0.57879066", "0.5742139", "0.5711607", "0.564378", "0.55695397", "0.5563209", "0.5547765", "0.54614323", "0.5368814", "0.5357463", "0.53278124", "0.52733594", "0.51911813", "0.5160666", "0.51573014", "0.5153695", "0.51517...
0.76321846
0
Get the share network subnets DB records in a given AZ. This method returns list of subnets DB record for a given share network id and an availability zone. If the 'availability_zone_id' is 'None', a record may be returned and it will represent the default share network subnets. If there is no subnet for a specific ava...
def share_network_subnets_get_all_by_availability_zone_id( context, share_network_id, availability_zone_id, fallback_to_default=True, ): return _share_network_subnets_get_all_by_availability_zone_id( context, share_network_id, availability_zone_id, fallback_to_default=fallback_to_default, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self, tenant=None, network=None, gateway_ip=None, cidr=None):\n path = '%s/subnets' % self.ver \n \n query = {}\n if tenant is not None:\n query['tenant_id'] = tenant\n if network is not None:\n query['network_id'] = network\n if gateway_i...
[ "0.6042876", "0.59247905", "0.5910263", "0.5908592", "0.57033145", "0.56731826", "0.5656423", "0.5656364", "0.55795884", "0.55653036", "0.5491563", "0.54033", "0.5282052", "0.5245697", "0.5245697", "0.52364314", "0.52363515", "0.51896966", "0.516646", "0.5152554", "0.5105716"...
0.81954664
0
Convert type query result to dict with extra_spec and rate_limit. Takes a share [group] type query returned by sqlalchemy and returns it as a dictionary, converting the extra/group specs entry from a list
def _dict_with_specs(inst_type_query, specs_key='extra_specs'): inst_type_dict = dict(inst_type_query) specs = {x['key']: x['value'] for x in inst_type_query[specs_key]} inst_type_dict[specs_key] = specs return inst_type_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dict_with_extra_specs(inst_type_query):\n inst_type_dict = dict(inst_type_query)\n extra_specs = dict([(x['key'], x['value'])\n for x in inst_type_query['extra_specs']])\n inst_type_dict['extra_specs'] = extra_specs\n return inst_type_dict", "def add_result_type_declaratio...
[ "0.6157686", "0.5163453", "0.5163453", "0.502843", "0.5025297", "0.5008356", "0.5003798", "0.49214113", "0.49137986", "0.48893902", "0.4881225", "0.48780817", "0.48423618", "0.4838062", "0.482074", "0.48103333", "0.4805018", "0.480352", "0.48014528", "0.47888014", "0.47721228...
0.6024232
1