query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Postprocesses a config as returned by a searcher Adding parameters which are constant, therefore do not feature in the config space of the searcher Casting values to types (float, int, str) according to ``config_space`` value types
def _postprocess_config(self, config: Dict[str, Any]) -> Dict[str, Any]: new_config = self.config_space.copy() new_config.update(cast_config_values(config, config_space=self.config_space)) return new_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _preprocess_config(self, config: Dict[str, Any]) -> Dict[str, Any]:\n return cast_config_values(\n {k: v for k, v in config.items() if k in self._hyperparameter_keys},\n config_space=self.config_space,\n )", "def set_search_parameters(self, config):\n for k, v in co...
[ "0.6231514", "0.58390164", "0.5793793", "0.5631059", "0.5523095", "0.5519895", "0.5515676", "0.54081607", "0.5359156", "0.5356524", "0.5356158", "0.5298508", "0.52851367", "0.52372867", "0.5236865", "0.5235426", "0.5228315", "0.52258736", "0.5211553", "0.51955223", "0.5179636...
0.70582974
0
Preprocesses a config before passing it to a searcher Removing parameters which are constant in ``config_space`` (these do not feature in the config space used by the searcher) Casting values to types (float, int, str) according to ``config_space`` value types
def _preprocess_config(self, config: Dict[str, Any]) -> Dict[str, Any]: return cast_config_values( {k: v for k, v in config.items() if k in self._hyperparameter_keys}, config_space=self.config_space, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _postprocess_config(self, config: Dict[str, Any]) -> Dict[str, Any]:\n new_config = self.config_space.copy()\n new_config.update(cast_config_values(config, config_space=self.config_space))\n return new_config", "def normalize_config(config):\n richTypes = [\"query\", \"model\"]\n\...
[ "0.65492624", "0.60672563", "0.5904274", "0.5733662", "0.56687444", "0.55815893", "0.54939795", "0.5273813", "0.5268722", "0.5265684", "0.52574617", "0.5256308", "0.52511877", "0.524782", "0.5230959", "0.522306", "0.5222517", "0.5222091", "0.5197381", "0.5192428", "0.51893425...
0.6900642
0
Called when a new trial is added to the trial runner. Additions are normally triggered by ``suggest``.
def on_trial_add(self, trial: Trial): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_trial_add(self, trial_runner, trial):\n\n raise NotImplementedError", "def add_trial(cls, rank, title, status, study_results, conditions, interventions, locations, url, file_name):\n if not Trial.repeated(title):\n Trial.id_counter += 1\n Trial.trials.append(Trial(Trial...
[ "0.83409905", "0.65875345", "0.63587755", "0.62775654", "0.62297976", "0.6161869", "0.6123104", "0.60858196", "0.6058126", "0.6007815", "0.59896976", "0.59085274", "0.58563226", "0.58468807", "0.57852834", "0.5756643", "0.5745819", "0.5738419", "0.57192475", "0.57148266", "0....
0.8157928
1
Called when a trial has failed.
def on_trial_error(self, trial: Trial): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_trial_error(self, trial_runner, trial):\n\n raise NotImplementedError", "def testTrialErrored(self):\n stats = self.default_statistics()\n trial_count = stats[str(0)][\"n\"] + 3\n sched, mock_runner = self.schedulerSetup(trial_count)\n t1, t2, t3 = sched._state[\"bracket...
[ "0.8088279", "0.75794166", "0.7502997", "0.69837457", "0.6813894", "0.6813894", "0.67705554", "0.67626214", "0.6759174", "0.6736948", "0.6728218", "0.6724342", "0.6620727", "0.6587359", "0.6511883", "0.64683217", "0.6456149", "0.64313114", "0.64216995", "0.6421262", "0.64203"...
0.82358086
0
Called on each intermediate result reported by a trial. At this point, the trial scheduler can make a decision by returning
def on_trial_result(self, trial: Trial, result: Dict[str, Any]) -> str: return SchedulerDecision.CONTINUE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_trial_result(self, trial_runner, trial, result):\n\n raise NotImplementedError", "def on_trial_result(self, trial_id: str, result: Dict):\r\n pass", "def report_trial(self):\n pass", "def on_trial_complete(self, trial_runner, trial, result):\n\n raise NotImplementedError", ...
[ "0.7575379", "0.7243744", "0.6817611", "0.6668856", "0.6573318", "0.6164989", "0.613629", "0.6135658", "0.6082108", "0.6055392", "0.6046703", "0.6018116", "0.60136414", "0.60079867", "0.5984867", "0.59505767", "0.59255534", "0.58745474", "0.5874537", "0.58479226", "0.57923996...
0.75724995
1
Notification for the completion of trial.
def on_trial_complete(self, trial: Trial, result: Dict[str, Any]): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_trial_complete(self, trial_runner, trial, result):\n\n raise NotImplementedError", "def trial_end(self, parameter_id, success, **kwargs):", "def on_trial_complete(self,\r\n trial_id: str,\r\n result: Optional[Dict] = None,\r\n ...
[ "0.7848071", "0.7418109", "0.7190581", "0.67227614", "0.65807676", "0.6573202", "0.6526082", "0.6507184", "0.64640254", "0.64526606", "0.64432675", "0.64056724", "0.64056325", "0.64056325", "0.637625", "0.63596755", "0.6356491", "0.635427", "0.6350848", "0.6296551", "0.629329...
0.79264545
0
Called to remove trial. This is called when the trial is in PAUSED or PENDING state. Otherwise,
def on_trial_remove(self, trial: Trial): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_trial_remove(self, trial_runner, trial):\n\n raise NotImplementedError", "def trial_clean_up(self):\n pass", "def remove_player(self, player):\n super().remove_player(player)\n if self._waiting_for_players:\n if self.__current_player == player:\n sel...
[ "0.7641294", "0.64737886", "0.5809718", "0.57677525", "0.57091033", "0.5677479", "0.56178224", "0.5556594", "0.5535496", "0.55101436", "0.54661894", "0.54658806", "0.5421648", "0.5412056", "0.5406573", "0.5392968", "0.5384532", "0.5370421", "0.5365156", "0.53363353", "0.53341...
0.80954224
0
Return True if a scheduler is multiobjective.
def is_multiobjective_scheduler(self) -> bool: # This is set to False as a default but should be overriden by any classes that implement MO Schedulers return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def does_support_multiobjective() -> bool:\n multioutput = False\n return multioutput", "def isParallelMS(vis):\n \n msTool = mstool()\n if not msTool.open(vis):\n raise ValueError, \"Unable to open MS %s,\" % vis\n rtnVal = msTool.ismultims() and \\\n ...
[ "0.708563", "0.6150229", "0.58966094", "0.58742005", "0.5825971", "0.56958294", "0.566074", "0.56585366", "0.5647438", "0.5628078", "0.55075556", "0.54979324", "0.546331", "0.546331", "0.5438831", "0.5420369", "0.5415281", "0.53909224", "0.53867036", "0.53433305", "0.53289056...
0.87335306
0
Default implementation for _XMLIdentifierToPython For historical reasons, this converts the identifier from a str to unicode in the system default encoding. This should have no practical effect.
def _DefaultXMLIdentifierToPython (identifier): return six.text_type(identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _SetXMLIdentifierToPython (xml_identifier_to_python):\n global _XMLIdentifierToPython\n if xml_identifier_to_python is None:\n xml_identifier_to_python = _DefaultXMLIdentifierToPython\n _XMLIdentifierToPython = xml_identifier_to_python", "def _unicodeify(self, value, encoding=\"utf8\"):\n ...
[ "0.6642679", "0.6174144", "0.60445756", "0.5969381", "0.5914155", "0.59118557", "0.587203", "0.58548003", "0.58026296", "0.57193226", "0.5715238", "0.57140726", "0.57060766", "0.565981", "0.56537277", "0.56176376", "0.5602993", "0.55988634", "0.5581407", "0.55747074", "0.5570...
0.76331604
0
Convert a string into something suitable to be a Python identifier. The string is processed by L{_XMLIdentifierToPython}. Following this, dashes, spaces, and periods are replaced by underscores, and characters not permitted in Python identifiers are stripped. Furthermore, any leading underscores are removed. If the res...
def MakeIdentifier (s, camel_case=False): s = _XMLIdentifierToPython(s) s = _PrefixUnderscore_re.sub('', _NonIdentifier_re.sub('', _UnderscoreSubstitute_re.sub('_', s))) if camel_case: s = _CamelCase_re.sub(lambda _m: _m.group(0)[1].upper(), s) if _PrefixDigit_re.match(s): s = 'n' + s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_python_identifier(string):\n # Todo: check for variable uniqueness\n # perhaps maintain a list of current variables and their translations??\n # Todo: check that the output is actually a valid python identifier\n\n string = string.lower()\n\n # remove leading and trailing whitespace\n s...
[ "0.8302692", "0.6752775", "0.6718251", "0.6598083", "0.6587029", "0.63822687", "0.62174153", "0.6135094", "0.60881364", "0.6069373", "0.60202104", "0.58889824", "0.5888", "0.5884226", "0.5868551", "0.58431655", "0.5817622", "0.57959217", "0.57879376", "0.57620525", "0.5743887...
0.71453947
1
Convert a string into something that can be a valid element in a Python module path. Module path elements are similar to identifiers, but may begin with numbers and should not have leading underscores removed.
def MakeModuleElement (s): return _UnderscoreSubstitute_re.sub('_', _XMLIdentifierToPython(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_to_module(path: str):\n if path[-3:] != '.py':\n raise ValueError(\"Not a python module path \", path)\n path_minus_py = path[:-3]\n path_w_dots = path_minus_py.replace(\"/\", \".\")\n # strip leading docs\n if path_w_dots[0] == '.':\n path_w_dots = path_w_dots[1:]\n # if t...
[ "0.65108526", "0.61270255", "0.5951177", "0.5949715", "0.59277713", "0.59068525", "0.5887359", "0.58531743", "0.58339024", "0.5830648", "0.5801116", "0.57909554", "0.57706255", "0.5728476", "0.5728476", "0.5722548", "0.57178664", "0.57069695", "0.56600803", "0.5642926", "0.56...
0.7106397
0
Return an identifier based on C{s} that is not in the given set. The returned identifier is made unique by appending an underscore and, if necessary, a serial number.
def MakeUnique (s, in_use): if s in in_use: ctr = 2 s = s.rstrip('_') candidate = '%s_' % (s,) while candidate in in_use: candidate = '%s_%d' % (s, ctr) ctr += 1 s = candidate in_use.add(s) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_unique(name, reserved_names):\n while name in reserved_names:\n name += '_'\n\n return name", "def uniquify(s):\n curr_time = datetime.datetime.now().strftime(\"%m_%d_%Y_%H_%M_%S\")\n return s+'_%s'%curr_time", "def PrepareIdentifier (s, in_use, aux_keywords=frozenset(), private=Fal...
[ "0.63225794", "0.61516315", "0.611535", "0.6013068", "0.5633094", "0.5531747", "0.5530027", "0.54593974", "0.54593974", "0.53802276", "0.5343881", "0.5334126", "0.53085405", "0.53034174", "0.5292102", "0.526896", "0.5262137", "0.5253826", "0.52506745", "0.5231749", "0.522898"...
0.6679372
0
Normalize the given string. Exactly one of the C{preserve}, C{replace}, and C{collapse} keyword parameters must be assigned the value C{True} by the caller.
def NormalizeWhitespace (text, preserve=False, replace=False, collapse=False): if preserve: return text text = __TabCRLF_re.sub(' ', text) if replace: return text if collapse: return __MultiSpace_re.sub(' ', text).strip() # pyxb not imported here; could be. raise Exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self, string):\n\n # If the string is empty, just return it\n if len(string) is 0:\n return string\n\n # Setting all words to lowercase\n string = string.lower()\n\n # Removing punctuation\n if not string[-1].isalnum():\n string = string...
[ "0.6053437", "0.5850378", "0.5737457", "0.56278425", "0.55883133", "0.55687374", "0.5461997", "0.53825057", "0.53707397", "0.5362448", "0.5325962", "0.53217804", "0.52814376", "0.52608967", "0.52598417", "0.5242707", "0.52335143", "0.52070796", "0.5184114", "0.5162204", "0.51...
0.6033365
1
Add a directed edge from the C{source} to the C{target}. The nodes are added to the graph if necessary.
def addEdge (self, source, target): self.__edges.add( (source, target) ) self.__edgeMap.setdefault(source, set()).add(target) if source != target: self.__reverseMap.setdefault(target, set()).add(source) self.__nodes.add(source) self.__nodes.add(target)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, source, target):\n self.__edge_map[source].add(target)\n if source != target:\n self.__reverse_map[target].add(source)\n self.__nodes.add(source)\n self.__nodes.add(target)", "def add_edge(self,source,target,weight):\n \n # Check if source e...
[ "0.85198647", "0.81083274", "0.7926543", "0.74129057", "0.73955977", "0.697965", "0.697476", "0.6972375", "0.69695324", "0.69382036", "0.6936409", "0.68476546", "0.6845237", "0.68226635", "0.67719465", "0.67515546", "0.66439915", "0.66117394", "0.65961504", "0.65672183", "0.6...
0.8466291
1
Return the set of nodes calculated to be roots (i.e., those that have no incoming edges). This caches the roots calculated in a previous invocation unless the C{reset} keyword is given the value C{True}.
def roots (self, reset=False): if reset or (self.__roots is None): self.__roots = set() for n in self.__nodes: if not (n in self.__reverseMap): self.__roots.add(n) return self.__roots
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roots(self):\n if not self.__roots:\n self.__roots = set()\n for n in self.__nodes:\n if n not in self.__reverse_map:\n self.__roots.add(n)\n return self.__roots", "def roots(self) -> List[str]:\n return [node for node, degree in se...
[ "0.75745994", "0.66823053", "0.6606786", "0.65892243", "0.6557205", "0.65282804", "0.6425244", "0.62325907", "0.62034404", "0.61831456", "0.61707497", "0.6147587", "0.6117938", "0.6115766", "0.60967505", "0.60475665", "0.5984837", "0.5928481", "0.58924735", "0.58659506", "0.5...
0.81035554
0
Add the provided node as a root node, even if it has incoming edges. The node need not be present in the graph (if necessary, it is added). Note that roots added in this way do not survive a reset using L{roots}.
def addRoot (self, root): if self.__roots is None: self.__roots = set() self.__nodes.add(root) self.__roots.add(root) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_root(self, e):\n if self._root is not None:\n raise ValueError('Root exists')\n self._root = self._Node(e)\n self._size = 1\n return self._root", "def set_root(self):\n try:\n _check_call(_LIB.TreeliteTreeBuilderSetRootNode(\n self.tree.handle...
[ "0.65972877", "0.6509773", "0.63744116", "0.63690895", "0.6271446", "0.62533367", "0.6231514", "0.6231514", "0.6220464", "0.61977607", "0.61874366", "0.61798453", "0.61202335", "0.60836643", "0.6081746", "0.60742366", "0.6074043", "0.6040833", "0.5978153", "0.5945655", "0.589...
0.6897831
0
Execute Tarjan's algorithm on the graph. U{Tarjan's
def tarjan (self, reset=False): if (self.__scc is not None) and (not reset): return self.__sccMap = { } self.__stack = [] self.__sccOrder = [] self.__scc = [] self.__index = 0 self.__tarjanIndex = { } self.__tarjanLowLink = { } for v i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tarjan(g):\n ctx = TarjanContext(\n g=g,\n S=[],\n S_set=set(),\n index={},\n lowlink={},\n T=[],\n ret=[])\n main_iter = iter(g)\n while True:\n try:\n v = next(main_iter)\n except StopIteration:\n return ctx.ret\n ...
[ "0.65056634", "0.60056716", "0.5858525", "0.56790924", "0.56730115", "0.56695354", "0.5486521", "0.544314", "0.54168236", "0.54120547", "0.54055315", "0.53431743", "0.5307506", "0.5294147", "0.5270186", "0.5245127", "0.523547", "0.52276146", "0.5209443", "0.52058405", "0.5199...
0.6255905
1
Return the stronglyconnected component to which the given node belongs. Any keywords suppliend when invoking this method are passed to the L{sccMap} method.
def sccForNode (self, node, **kw): return self.sccMap(**kw).get(node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strongly_connected_components(self):\n for node in self.graph:\n node.data.visited = False\n\n reverse_graph = self.reverse_graph()\n dfs_reverse_graph = DFS(reverse_graph.graph, generate_stack=True)\n dfs_reverse_graph.search()\n\n dfs_graph = DFS(self.graph, gene...
[ "0.690451", "0.68742985", "0.6473766", "0.64694965", "0.6450434", "0.6265773", "0.615741", "0.60335255", "0.6008124", "0.59753853", "0.59593517", "0.58773434", "0.5864113", "0.58441275", "0.5814417", "0.5794216", "0.5786024", "0.5770247", "0.5719518", "0.56839013", "0.5667406...
0.80238163
0
Return the cyclomatic complexity of the graph.
def cyclomaticComplexity (self): self.tarjan() return len(self.__edges) - len(self.__nodes) + 2 * len(self.__scc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complexity(self):\n raise NotImplementedError()", "def commands_complexity():\n complexity()", "def complexity(self):\n n = 0\n ctx = self\n while ctx is not None:\n n += 1\n ctx = ctx.parent()\n return n", "def complexity(self) -> str:\n ...
[ "0.70237046", "0.67451406", "0.6741009", "0.6484362", "0.64384604", "0.64315176", "0.6389272", "0.6336281", "0.62591004", "0.606621", "0.6049148", "0.5970148", "0.5930055", "0.59023154", "0.5815262", "0.5650881", "0.56085956", "0.5530896", "0.5526717", "0.55237794", "0.547507...
0.70936227
0
Set the map that is used to by L{NormalizeLocation} to rewrite URI prefixes.
def SetLocationPrefixRewriteMap (prefix_map): LocationPrefixRewriteMap_.clear() LocationPrefixRewriteMap_.update(prefix_map)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remap_prefixes(cmap):\n cmap[\"MGI\"] = \"http://identifiers.org/mgi/MGI:\"\n cmap[\"WB\"] = \"http://identifiers.org/wormbase/\"\n return cmap", "def setPrefixes(self, p):\n return self._set(prefixes=p)", "def _set_folium_map(self):", "def set_location(self, location_set):", "def pathM...
[ "0.6274829", "0.6207522", "0.56970084", "0.5689622", "0.5501718", "0.5479919", "0.542708", "0.54124254", "0.5398055", "0.53901523", "0.53843075", "0.5377399", "0.53752804", "0.5355837", "0.5314074", "0.5300265", "0.5268486", "0.5249031", "0.5226954", "0.5225233", "0.5224879",...
0.824288
0
Normalize a URI against an optional parent_uri in the way that is done for C{schemaLocation} attribute values. If no URI schema is present, this will normalize a file system path. Optionally, the resulting absolute URI can subsequently be rewritten to replace specified prefix strings with alternative strings, e.g. to c...
def NormalizeLocation (uri, parent_uri=None, prefix_map=None): if uri is None: return uri if parent_uri is None: abs_uri = uri else: abs_uri = urlparse.urljoin(parent_uri, uri) if prefix_map is None: prefix_map = LocationPrefixRewriteMap_ for (pfx, sub) in six.iterite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _urlnorm(self, uri):\r\n (scheme, authority, path, query, fragment) = parse_uri(uri)\r\n if not scheme or not authority:\r\n raise Exception(\"Only absolute URIs are allowed. uri = %s\" % uri)\r\n authority = authority.lower()\r\n scheme = scheme.lower()\r\n if not...
[ "0.66681325", "0.6330562", "0.62404627", "0.6194146", "0.6085592", "0.605729", "0.5868248", "0.5811165", "0.56482995", "0.5631597", "0.55902255", "0.5514136", "0.5494855", "0.543842", "0.5353547", "0.5343081", "0.53275096", "0.53252316", "0.53132325", "0.5098708", "0.50721663...
0.77308106
0
Return a file object used to write binary data into the given file. Use the C{tag} keyword to preserve the contents of existing files that are not supposed to be overwritten. To get a writable file but leaving any existing contents in place, set the C{preserve_contents} keyword to C{True}. Normally, existing file conte...
def OpenOrCreate (file_name, tag=None, preserve_contents=False): (path, leaf) = os.path.split(file_name) if path: try: os.makedirs(path) except Exception as e: if not (isinstance(e, (OSError, IOError)) and (errno.EEXIST == e.errno)): raise fp = open(fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_write(self, filename, contents, append=True, create=True):\n return self._file_model.file_write(filename, contents, append=append, create=create)", "def file(self):\n file = BytesIO(b\"the_file\")\n file.name = self.name\n return File(file)", "def write_file(filename: str, ...
[ "0.61206645", "0.54896116", "0.54544973", "0.5446193", "0.54175335", "0.5410322", "0.5409091", "0.54074293", "0.5352646", "0.53195566", "0.5262908", "0.5253602", "0.52367777", "0.52204037", "0.5197529", "0.5163391", "0.51554316", "0.51535887", "0.51448315", "0.51125944", "0.5...
0.6841961
0
Calculate a cryptographic hash of the given string. For example, this is used to verify that a given module file contains bindings from a previous generation run for the same namespace. See L{OpenOrCreate}. If the text is in Unicode, the hash is calculated on the UTF8 encoding of the text.
def HashForText (text): if isinstance(text, six.text_type): text = text.encode('utf-8') return __Hasher(text).hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeHash(string):\n\tif isBytes(string):\n\t\tstring = string.decode(\"latin-1\")\n\thash_ = 63689\n\tfor char in string:\n\t\thash_ = hash_ * 378551 + ord(char)\n\treturn hash_ % 65536", "def hash(self, string):\n return self.__scaffydb.hash(string)", "def strhash(s: str) -> int:\n h = hashli...
[ "0.7676665", "0.75430036", "0.74706113", "0.7469234", "0.74666005", "0.7345958", "0.72857845", "0.7204431", "0.71816057", "0.7116454", "0.7063451", "0.7055297", "0.7052959", "0.70247537", "0.69435936", "0.6914469", "0.6909469", "0.68896514", "0.6868915", "0.685122", "0.683789...
0.7769382
0
Obtain a UUID using the best available method. On a version of python that does not incorporate the C{uuid} class, this creates a string combining the current date and time (to the second) with a random number.
def _NewUUIDString (): if __HaveUUID: return uuid.uuid1().urn return '%s:%08.8x' % (time.strftime('%Y%m%d%H%M%S'), random.randint(0, 0xFFFFFFFF))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_uuid():\n return str(uuid.uuid4())", "def get_uuid():\n\n return str(uuid.uuid4())", "def get_uuid():\n return str(uuid4())", "def _generate_uuid():\n return str(uuid.uuid4())", "def gen_uuid():\n return str( uuid.uuid4() )", "def gen_uuid():\n return str( uuid.uuid4() )", "d...
[ "0.7988666", "0.7973136", "0.79608667", "0.7941612", "0.79167926", "0.79167926", "0.79163796", "0.7891484", "0.7840817", "0.7835", "0.78042585", "0.7754499", "0.774", "0.7716067", "0.7701786", "0.76150984", "0.75722706", "0.75719523", "0.7551545", "0.7542992", "0.7470442", ...
0.8256856
0
Associate the given object witth this identifier.
def associateObject (self, obj): self.__associatedObjects.add(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, obj):\n ID = id(obj)\n self.pDict[ID] = obj\n return ID", "def attach(self, obj):\n self.Object = obj.Object", "def attach(self, obj):\n return", "def assignObjectID(self, target, objectID) :\n\n vr.addVrayObjectID(target, 1)\n mc.setAttr('%s.vra...
[ "0.68819743", "0.6874238", "0.66801", "0.66053325", "0.65256524", "0.6444394", "0.63617814", "0.6245241", "0.6241432", "0.6241432", "0.6241432", "0.6241432", "0.6241432", "0.6241432", "0.6241432", "0.6241432", "0.62288487", "0.62235206", "0.6209444", "0.6203184", "0.6203184",...
0.7797932
0
Return the name of the timezone in the format expected by XML Schema.
def tzname (self, dt): return self.__tzName
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tzname(self):\n if self._tzinfo is None:\n return None\n name = self._tzinfo.tzname(None)\n _check_tzname(name)\n return name", "def time_zone_name(self):\n return icemac.addressbook.preferences.utils.get_time_zone_name()", "def timezone(self) -> str:\n ...
[ "0.70214516", "0.69538474", "0.69426125", "0.6892086", "0.68898755", "0.672193", "0.6653623", "0.6560038", "0.65424305", "0.63958055", "0.6333146", "0.6325287", "0.6269747", "0.620944", "0.6073368", "0.60271823", "0.60114473", "0.59778816", "0.5971603", "0.59701407", "0.59655...
0.69655573
1
Filtered builtin repr for python 2/3 compatibility in generated bindings. All generated string values are to be unicode. We always import unicode_literals from __future__, so we want plain quotes with no prefix u. Strip that off. Integer constants should not have the suffix L even if they do not fit in a Python2 int. T...
def repr2to3 (v): if isinstance(v, six.string_types): qu = QuotedEscaped(v) if 'u' == qu[0]: return qu[1:] return qu if isinstance(v, six.integer_types): vs = repr(v) if vs.endswith('L'): return vs[:-1] return vs return repr(v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _non_unicode_repr(objekt, context, maxlevels, level):\n repr_string, isreadable, isrecursive = pprint._safe_repr(objekt, context,\n maxlevels, level)\n if repr_string.startswith('u\"') or repr_string.startswith(\"u'\"):\n repr_string = re...
[ "0.60274", "0.58803445", "0.5872854", "0.5807373", "0.57983094", "0.5738373", "0.57099766", "0.5656571", "0.56331575", "0.5591109", "0.55842423", "0.5579216", "0.55732864", "0.5561592", "0.55615634", "0.5549557", "0.5540482", "0.5530538", "0.5509811", "0.5503267", "0.5481925"...
0.66248673
0
Return a validator checking that the field holds an instance of its own entity. Returns _InstanceOfSelfValidator The instantiated validator
def instance_of_self() -> _InstanceOfSelfValidator: return _InstanceOfSelfValidator(type=None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_validator(cls):\n cls.validator.model = cls\n return cls.validator or SageValidator", "def get_validator(self):\n return self.get_validator_class()(**self.get_validator_kwargs())", "def validator(self):\n return self._validator", "def clone(self):\n return _libsbml....
[ "0.6045495", "0.56410486", "0.5635099", "0.5611481", "0.5541117", "0.54452765", "0.5437147", "0.5351048", "0.5177893", "0.50366426", "0.5033584", "0.5007929", "0.49912202", "0.49912202", "0.4989515", "0.49886537", "0.49702406", "0.48704463", "0.4848198", "0.48240975", "0.4779...
0.75648
0
Define an optional field of the specified `field_type`.
def optional_field( field_type: Union[Type[_T], str], relation_verbose_name: Optional[str] = None ) -> Optional[_T]: metadata = {} if relation_verbose_name: metadata["relation_verbose_name"] = relation_verbose_name assert not isinstance(field_type, str) or field_type == "self" return attr....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gen_basic_field(name_of_field, name_of_type, the_type):\n def validate(self, x):\n return None if x is None else the_type(x)\n\n doc = \"A field which can be {name_of_type} or None\".format(name_of_type=name_of_type)\n\n return Field(name_of_field, (), {'validate': validate, '__doc__': doc})",...
[ "0.6912172", "0.6548607", "0.5983148", "0.5933199", "0.5766476", "0.5714636", "0.57088166", "0.57029545", "0.5693993", "0.56425905", "0.5640413", "0.5617874", "0.56139416", "0.55398256", "0.5530448", "0.551866", "0.55133075", "0.5423735", "0.5400708", "0.536897", "0.5339176",...
0.7133128
0
Define a required field of the specified `field_type`.
def required_field( field_type: Union[Type[_T], str], frozen: bool = False, relation_verbose_name: Optional[str] = None, ) -> _T: metadata = {} if relation_verbose_name: metadata["relation_verbose_name"] = relation_verbose_name assert not isinstance(field_type, str) or field_type == "se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gen_basic_field(name_of_field, name_of_type, the_type):\n def validate(self, x):\n return None if x is None else the_type(x)\n\n doc = \"A field which can be {name_of_type} or None\".format(name_of_type=name_of_type)\n\n return Field(name_of_field, (), {'validate': validate, '__doc__': doc})",...
[ "0.70051587", "0.674339", "0.63265055", "0.6029678", "0.5823708", "0.5773735", "0.5721671", "0.5671777", "0.5651229", "0.55752707", "0.55752707", "0.55737865", "0.55191225", "0.5499543", "0.5495154", "0.54762226", "0.5424283", "0.54168296", "0.54077685", "0.5388281", "0.53869...
0.7263691
0
Validate a whole instance.
def validate_instance(instance: Any) -> Any: attr.validate(instance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self) -> None:\n validate_instance(self)", "def _validate(self, instance, value):", "def validate(self, instance, value):", "def validate(self, instance, value):", "def validate(self):\n return self.__class__._validate(self)", "def validate(cls, **kwargs: Any) -> None: # pragm...
[ "0.8433824", "0.75562286", "0.7500758", "0.7500758", "0.7221152", "0.72203815", "0.72176826", "0.72084004", "0.7164786", "0.71616006", "0.7125931", "0.7110639", "0.7091956", "0.7091956", "0.7091956", "0.7091956", "0.7091956", "0.7091956", "0.7091956", "0.7091956", "0.70873153...
0.7823064
1
Validate that the given `value` is a positive integer (``None`` accepted if `none_allowed`).
def validate_positive_integer( value: Any, none_allowed: bool, display_name: str ) -> None: if none_allowed and value is None: return if not isinstance(value, int): raise TypeError(f"{display_name} must be a positive integer") if value <= 0: raise ValueError(f"{display_name} mus...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, value):\n super(PositiveInteger, self).validate(value)\n if value is not None and value < 0:\n raise ValidationError('must be positive integer')\n\n return True", "def must_be_positive_or_zero(cls, value):\n if value < 0:\n raise ValueError('mu...
[ "0.7604798", "0.74878687", "0.7477893", "0.7372281", "0.7327428", "0.7310186", "0.7309169", "0.72575694", "0.72093", "0.7166242", "0.71568584", "0.7155701", "0.7137333", "0.71311134", "0.71014625", "0.7099577", "0.70873487", "0.70630044", "0.70425266", "0.6931459", "0.6927795...
0.884364
0
Validate that the given `value` is a uuid (version 4) (``None`` accepted if `none_allowed`).
def validate_uuid(value: Any, none_allowed: bool, display_name: str) -> None: if none_allowed and value is None: return if not isinstance(value, UUID) or value.version != 4: raise TypeError(f"{display_name} must be a UUID version 4")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateUuid(sValue, aoNilValues = tuple([None, '']), fAllowNull = True):\n if sValue in aoNilValues:\n return (sValue, None if fAllowNull else 'Mandatory.');\n\n try:\n sValue = str(uuid.UUID(sValue));\n except:\n return (sValue, 'Invalid UUID value.');\n ...
[ "0.7557076", "0.7478994", "0.69724876", "0.6930316", "0.6930316", "0.67378175", "0.6720659", "0.6699453", "0.6679053", "0.6581491", "0.6578702", "0.65757734", "0.6468944", "0.63455117", "0.62802315", "0.6190816", "0.6187551", "0.6185069", "0.61406916", "0.6130624", "0.6036289...
0.8942554
0
Compute the hash of the entity for python internal hashing. The hash is purely based on the entity's identifier, ie two different with the same identifier will share the same hash. And as it's the same for ``__eq__`` method, two different instances of the same entity class with the same identifier will always have the ...
def __hash__(self) -> int: return hash(self.identifier)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __hash__(self):\n # These entities are not cached, so we wont use their `id` if applicable.\n hash_value = 0\n \n # bot\n hash_value ^= hash(self.bot)\n \n # description\n description = self.description\n if (description is not None):\n ...
[ "0.778117", "0.75746995", "0.75740457", "0.74172354", "0.74172354", "0.74172354", "0.74172354", "0.7393091", "0.7372504", "0.73348933", "0.7325732", "0.732276", "0.7308895", "0.72698194", "0.71794254", "0.7148986", "0.71293014", "0.71191555", "0.7117688", "0.7117688", "0.7106...
0.78192955
0
Set default expression from test or `ast.AST` node.
def set_default(self, node: Node) -> None: if isinstance(node, str): self._default = TextRecord(self.node, node) if isinstance(node, ast.AST): self._default = ExpressionRecord(node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f_default(self, expr, default=None):\r\n try:\r\n r = self.eval(expr, self.locals_ptr)\r\n if r is None:\r\n return default\r\n return r\r\n #TODO: which exceptions should be catched here?\r\n except (NameError, IndexError, KeyError):\r\n ...
[ "0.674292", "0.59424496", "0.5770362", "0.5768259", "0.556176", "0.55320954", "0.542926", "0.53776956", "0.5313344", "0.5296972", "0.52907914", "0.52821857", "0.5279476", "0.52569", "0.5231613", "0.5207663", "0.52066475", "0.5177847", "0.5177847", "0.51753044", "0.51559085", ...
0.6625553
1
Set of related names.
def related_names(self) -> Set[str]: result = set() if self.default: result.update(self.default.related_names) if self.type_hint: result.update(self.type_hint.related_names) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relations(self):\n return set(self.triples()[\"relation\"])", "def getrelations(self):\n return self.getfieldnames('ONE')", "def namelist(self):\n return set(self.names())", "def getmanyrelations(self):\n return self.getfieldnames('MANY')", "def get_goterms_lower(self):\n ...
[ "0.66142404", "0.6504243", "0.631992", "0.6193588", "0.6174414", "0.6171429", "0.61463445", "0.5943368", "0.58884627", "0.58840996", "0.5882292", "0.5880444", "0.58118933", "0.5805925", "0.58042383", "0.5800241", "0.5799987", "0.5799987", "0.57998604", "0.5777368", "0.5757922...
0.85763925
0
set everything back to default and erase button texts so we can play a new game
def reset(self): self.make_board() # configure each buttons text option to an empty string for row in range(3): for column in range(3): self.board[row][column][0]['text'] = ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_game_ui(self):\n for button in self.button_list:\n button.configure(state='normal', text='')\n self.instructions.configure(text=self.PROMPT.format(self.players[self.game.whose_turn]))\n self.player_0_score_label.configure(text=self.SCORE_LABEL.format(self.players[0], self....
[ "0.75088555", "0.73414177", "0.7275885", "0.71914345", "0.7065287", "0.70544976", "0.6764448", "0.67537314", "0.6733901", "0.66971445", "0.6674348", "0.66638386", "0.6647142", "0.65523106", "0.654514", "0.65356827", "0.65277696", "0.6511071", "0.6511071", "0.6463612", "0.6457...
0.76234233
0
Use the tk grid geometry manager to place widgets into window
def grid_widgets(self): # we must first make sure we grid self, since self is the frame # that the other widgets are slave to self.grid(row=0, column=0, sticky="nsew") # grid in the other widgets self.btn_tl.grid(row=0, column=0, sticky="nsew") self.btn_tm.grid(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _place_widgets(self):\n padding = 15\n\n # Workspace block\n self.main_container.columnconfigure(0, weight=4)\n self.main_container.grid(row=0, column=0, rowspan=4, columnspan=5, sticky='EW')\n\n # Information block\n self.text.grid(row=1, column=0, columnspan=5, padx=...
[ "0.7258025", "0.72214925", "0.7195263", "0.68752784", "0.68064123", "0.6779908", "0.67267174", "0.66636646", "0.66052264", "0.65849805", "0.65628296", "0.6555326", "0.6543602", "0.64403373", "0.64345556", "0.64047015", "0.64024705", "0.6401306", "0.63974756", "0.6379957", "0....
0.7308794
0
Call gridconfigure and rowconfiugre on the widgets so they can be resized
def configure_grid(self): for r in range(3): self.rowconfigure(r, weight=1) for c in range(3): self.columnconfigure(c, weight=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configureWidgetGrid(self, widget, horiz_split, vert_split):\n for i in range(vert_split):\n widget.grid_columnconfigure(i, weight = 1)\n\n for j in range(horiz_split):\n widget.grid_rowconfigure(j, weight = 1)", "def grid_widgets(self):\r\n\r\n # we must first make ...
[ "0.75268686", "0.72352576", "0.7209307", "0.6788095", "0.6635871", "0.65640235", "0.6561439", "0.6537941", "0.6534093", "0.64993894", "0.645922", "0.6426116", "0.6413974", "0.64030606", "0.63892776", "0.6384907", "0.6340501", "0.63326424", "0.6324888", "0.6294124", "0.628766"...
0.7881081
0
Checks whether stop at index must receive a priorequest and adds it to the tasklist if needed
def check_for_canceled(self, index): if 0 <= index < len(self.stops): stop = self.stops[index] if stop.status == StopStatuses.planned or stop.status == StopStatuses.announced: self.issue_time += timedelta(seconds=config.INTERVAL_BETWEEN_UPDATE_MSG) self.ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_uncanceled(self, index):\n if 0 <= index < len(self.stops):\n stop = self.stops[index]\n if stop.status == StopStatuses.canceled:\n self.issue_time += timedelta(seconds=config.INTERVAL_BETWEEN_UPDATE_MSG)\n self.tasks.append(self.instruction_...
[ "0.65567565", "0.57838917", "0.53538334", "0.53365797", "0.53329337", "0.5271369", "0.52593", "0.5228388", "0.51737815", "0.51439106", "0.5112318", "0.5107713", "0.50838006", "0.5075426", "0.50454843", "0.5020568", "0.5001123", "0.49990565", "0.4995032", "0.49660718", "0.4959...
0.645771
1
Checks whether stop at index must receive a priorequest and adds it to the tasklist if needed
def check_for_uncanceled(self, index): if 0 <= index < len(self.stops): stop = self.stops[index] if stop.status == StopStatuses.canceled: self.issue_time += timedelta(seconds=config.INTERVAL_BETWEEN_UPDATE_MSG) self.tasks.append(self.instruction_task(stop....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_canceled(self, index):\n if 0 <= index < len(self.stops):\n stop = self.stops[index]\n if stop.status == StopStatuses.planned or stop.status == StopStatuses.announced:\n self.issue_time += timedelta(seconds=config.INTERVAL_BETWEEN_UPDATE_MSG)\n ...
[ "0.64572144", "0.578312", "0.5352684", "0.53340954", "0.5331248", "0.52699685", "0.5257081", "0.52252924", "0.5171588", "0.51436263", "0.51103246", "0.5106034", "0.5080391", "0.5072869", "0.5045249", "0.501723", "0.5000757", "0.49994373", "0.49941385", "0.4964059", "0.4960576...
0.65565974
0
Updates the delay for index and higher
def update_delay(self, index, delay, increasing): stop = self.stops[index] stop.delay_dep = delay self.delay = delay index += 1 while index < len(self.stops): previous_stop = stop stop = self.stops[index] riding_time = stop.arrival - previous_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delay(self, n=None):", "def elapseTime(self, idx):\n newBeliefs = util.Counter()\n for oldPos in self.legalPositions:\n if self.beliefs[idx][oldPos] <= 0:\n continue\n newPosDist = self.getPositionDistribution(oldPos)\n for newPos, prob in newPosDist.items():\n newBeliefs[...
[ "0.6225822", "0.6094065", "0.59585875", "0.58179677", "0.58179677", "0.5627489", "0.56243384", "0.561708", "0.554735", "0.54602927", "0.5456821", "0.5440927", "0.54213196", "0.54190534", "0.5405274", "0.5338668", "0.5318396", "0.5293088", "0.5281684", "0.5271529", "0.52611405...
0.6914228
0
Determines which stop is the new altDestination Adjusts status and altDestination in the stops list to the new altDestination Adds a task to the task list, to check what's going on at altDestination
def alter_destination(self, destination): series = self.series if not series: logging.warning('Cannot alter destination to %s for orphan mission %s.' % (destination, self.id)) return destination_point = series.point_for_station(destination) if not destination_poi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __dedasReplace(self, index, newTask, time, tmpTaskQueue, tmpTaskExInfoDict, tmpRscTimeTable):\r\n \r\n tmpTask = tmpTaskQueue[index]\r\n tmpPath = self._netGraph.getShortestPath(tmpTask.getAccessPoint(), tmpTask.getDispatchedServer())\r\n tmpTaskExInfo = tmpTaskExInfoDict[tmpTask.ge...
[ "0.5686947", "0.56619656", "0.54528147", "0.53127235", "0.52562225", "0.5252995", "0.51852137", "0.51236904", "0.51184803", "0.51141226", "0.51086456", "0.5087223", "0.5069544", "0.5067298", "0.50638115", "0.50160086", "0.50018346", "0.49947268", "0.49936318", "0.49817318", "...
0.57013196
0
When log_data is a boolean, it controls whether we log the query with or without parameters substituted in. Otherwise it's understood to be an iterable that determines which indexes in "var_list" are logged.
def executemany(self, sql, var_list, log_data=False): if log_data: strip_list = var_list if type(log_data) is not bool: if len(var_list) and type(var_list[0]) is dict: strip_list = [{key: value for key, value in vars.items() if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_log(cls, sql_query, data=None):\n\t\t# if data exists , I replace them into `complete_sql_query`\n\t\tif data:\n\t\t\tfor key, value in data.items():\n\t\t\t\tsearch = ':{}'.format(key)\n\t\t\t\treplace = '`{}`'.format(value)\n\t\t\t\tsql_query = sql_query.replace(search, replace)\n\n\t\tprint('\\t{}'.form...
[ "0.5391476", "0.5372924", "0.51494277", "0.5132737", "0.5093574", "0.49864873", "0.4950156", "0.4932682", "0.481299", "0.4807137", "0.47811168", "0.47740713", "0.4765344", "0.4739678", "0.473835", "0.47147736", "0.47140032", "0.47092363", "0.46502978", "0.46413177", "0.462457...
0.65407676
0
Verify Point.load from raw bytes.
def test_point_parse(logger): raw_bytes = b'' point_data_fragment = [ (struct.pack(lines.X.fmt, 12.341), 12.341), (struct.pack(lines.Y.fmt, 107.301), 107.301), (struct.pack(lines.Pressure.fmt, 0.351), 0.351), (struct.pack(lines.RotX.fmt, 0.03), 0.03), (struct.pack(lines.R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_points_class_parse(logger):\n raw_bytes = b''\n point_data_fragment = [\n # one point:\n (struct.pack(lines.Points.fmt, 1), 1),\n # the single point's data:\n (struct.pack(lines.X.fmt, 12.341), 12.341),\n (struct.pack(lines.Y.fmt, 107.301), 107.301),\n (stru...
[ "0.6397361", "0.61629707", "0.5736957", "0.5717334", "0.5607182", "0.5527377", "0.5451701", "0.5435203", "0.5384348", "0.5373529", "0.5334239", "0.53270805", "0.53155875", "0.5291772", "0.5285763", "0.527442", "0.52546084", "0.5253642", "0.52392495", "0.5231834", "0.5206961",...
0.6960864
0
Verify Points class.load which creates individual Point instances from raw bytes.
def test_points_class_parse(logger): raw_bytes = b'' point_data_fragment = [ # one point: (struct.pack(lines.Points.fmt, 1), 1), # the single point's data: (struct.pack(lines.X.fmt, 12.341), 12.341), (struct.pack(lines.Y.fmt, 107.301), 107.301), (struct.pack(lines...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_point_parse(logger):\n raw_bytes = b''\n point_data_fragment = [\n (struct.pack(lines.X.fmt, 12.341), 12.341),\n (struct.pack(lines.Y.fmt, 107.301), 107.301),\n (struct.pack(lines.Pressure.fmt, 0.351), 0.351),\n (struct.pack(lines.RotX.fmt, 0.03), 0.03),\n (struct....
[ "0.71426815", "0.6452271", "0.635905", "0.6326112", "0.6287354", "0.5749185", "0.56466216", "0.55982214", "0.5493273", "0.5465206", "0.5458139", "0.5453071", "0.5428825", "0.5401062", "0.5401062", "0.5401062", "0.5401062", "0.5401062", "0.5401062", "0.5401062", "0.5401062", ...
0.7557904
0
Verify how lines.BrushBaseSize handles parsing.
def test_line_attribute_brush_base_size(logger, raw_bytes, value, name): # Set up the generator with the raw bytes: position = recover(raw_bytes) data = next(position) assert data == '' result = lines.BrushBaseSize.load(position) assert result.value == value assert result.name == name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_line_attribute_brush_type(logger, raw_bytes, value, name):\n # Set up the generator with the raw bytes:\n position = recover(raw_bytes)\n data = next(position)\n assert data == ''\n\n result = lines.BrushType.load(position)\n assert result.value == value\n assert result.name == name",...
[ "0.5672954", "0.554844", "0.5517016", "0.5508688", "0.54713", "0.53847474", "0.5374116", "0.5334914", "0.529792", "0.5294883", "0.5289746", "0.5284978", "0.52806383", "0.52457964", "0.5222559", "0.5181812", "0.51758254", "0.51253986", "0.5108726", "0.5106844", "0.51063585", ...
0.7207828
0
Verify how lines.LineAttribute1 handles parsing.
def test_line_attribute_lineattribute1(logger): raw_bytes = struct.pack(Int32.fmt, 0) # Set up the generator with the raw bytes: position = recover(raw_bytes) data = next(position) assert data == '' result = lines.LineAttribute1.load(position) assert result.value == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_line(self, line):\n line = line.rstrip('\\r\\n')\n try:\n line = line.decode('utf8')\n except:\n pass\n return self.rules['all'].validate(line)", "def check_Lines(self):\n\n pass", "def parse_line(self, line):\n raise NotImplementedError...
[ "0.63939774", "0.63659483", "0.6324997", "0.61482006", "0.6090797", "0.60469556", "0.60377765", "0.6033033", "0.5997814", "0.59621793", "0.5910357", "0.59024507", "0.58727866", "0.58675355", "0.5863642", "0.5860524", "0.5822823", "0.58057594", "0.58020437", "0.57921076", "0.5...
0.6548182
0
Verify how lines.BrushBaseSize handles parsing.
def test_line_attribute_brush_type(logger, raw_bytes, value, name): # Set up the generator with the raw bytes: position = recover(raw_bytes) data = next(position) assert data == '' result = lines.BrushType.load(position) assert result.value == value assert result.name == name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_line_attribute_brush_base_size(logger, raw_bytes, value, name):\n # Set up the generator with the raw bytes:\n position = recover(raw_bytes)\n data = next(position)\n assert data == ''\n\n result = lines.BrushBaseSize.load(position)\n assert result.value == value\n assert result.name ...
[ "0.72078264", "0.5547087", "0.55167484", "0.5508538", "0.54708284", "0.5383971", "0.537396", "0.5335137", "0.5296959", "0.5295383", "0.5288488", "0.52841175", "0.52800834", "0.5245572", "0.5222858", "0.5181243", "0.517575", "0.51265633", "0.510835", "0.51062137", "0.51052535"...
0.5673497
1
Verify Line class.load from raw bytes.
def test_line_class_parse(logger): raw_bytes = b'' point_data_fragment = [ # line: # # brush type ( struct.pack(lines.BrushType.fmt, lines.BrushType.REVERSE['pen']), lines.BrushType.REVERSE['pen'], ), # colour ( struct.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_lines_class_parse(logger):\n raw_bytes = b''\n point_data_fragment = [\n # Only 1 line in this \"data\"\n (\n struct.pack(lines.Lines.fmt, 1),\n 1,\n ),\n # line:\n #\n # brush type\n (\n struct.pack(lines.BrushType.fm...
[ "0.6865108", "0.6524229", "0.6412211", "0.6391966", "0.62032044", "0.60651934", "0.6013744", "0.5941991", "0.59239155", "0.5901746", "0.5901746", "0.5885635", "0.58637726", "0.58543175", "0.5772145", "0.5757371", "0.57497835", "0.57272106", "0.5724018", "0.57168907", "0.56420...
0.67966646
1
Verify Lines class.load which creates an individual line instances from raw bytes.
def test_lines_class_parse(logger): raw_bytes = b'' point_data_fragment = [ # Only 1 line in this "data" ( struct.pack(lines.Lines.fmt, 1), 1, ), # line: # # brush type ( struct.pack(lines.BrushType.fmt, lines.BrushType....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_line_class_parse(logger):\n raw_bytes = b''\n point_data_fragment = [\n # line:\n #\n # brush type\n (\n struct.pack(lines.BrushType.fmt, lines.BrushType.REVERSE['pen']),\n lines.BrushType.REVERSE['pen'],\n ),\n # colour\n (\n ...
[ "0.69627464", "0.64888227", "0.6361628", "0.6151427", "0.60366124", "0.6012686", "0.58819324", "0.58819324", "0.58819324", "0.5811487", "0.5809087", "0.58087856", "0.58032155", "0.579998", "0.5765996", "0.5750282", "0.57252777", "0.57089305", "0.57089305", "0.57089305", "0.57...
0.72682613
0
Take a vector of indices or a where expression and select a set of alignments. If a groupBy is specified, then produce a cmp.h5 file for each distinct member of the grouping.
def cmpH5Select(inCmpFile, outCmp, idxs = None, groupByStr = None, groupByCsv = None, whereStr = None, outDir = "."): if idxs: doSelect(inCmpFile, outCmp, idxs) else: where = DefaultWhere if whereStr is None else eval(whereStr) groupBy = DefaultGroupBy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doSelect(inCmpFile, outCmpFile, idxs):\n def trimDataset(groupName, alnIdxID, inCmp, outCmp, fmt, idName = 'ID'):\n ids = outCmp[fmt.ALN_INDEX][:,alnIdxID]\n nds = '/'.join([groupName, idName])\n msk = NP.array([x in ids for x in inCmp[nds].value]) # got to be an NP.array\n for d...
[ "0.5600148", "0.5589626", "0.49898067", "0.49408498", "0.49133438", "0.48850006", "0.48340148", "0.4813052", "0.47609884", "0.4703841", "0.47017217", "0.46976876", "0.46812734", "0.4678678", "0.46577248", "0.46120808", "0.45558232", "0.45498917", "0.45308015", "0.45098576", "...
0.72201425
0
Take an input cmp.h5 file and a vector of indices into the AlnIndex and create a new cmp.h5 file from those alignments.
def doSelect(inCmpFile, outCmpFile, idxs): def trimDataset(groupName, alnIdxID, inCmp, outCmp, fmt, idName = 'ID'): ids = outCmp[fmt.ALN_INDEX][:,alnIdxID] nds = '/'.join([groupName, idName]) msk = NP.array([x in ids for x in inCmp[nds].value]) # got to be an NP.array for dsName in i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortCmpH5(inFile, outFile, deep, jobs, log):\n success = False;\n \n if (outFile):\n log.msg(\"Copying: \" + inFile + \" to \" + outFile)\n shutil.copyfile(inFile, outFile)\n inFile = outFile\n\n try:\n cH5 = H5.File(inFile, 'a')\n format = CmpH5Format(cH5)\n ...
[ "0.657594", "0.54772645", "0.5352994", "0.5331407", "0.5314678", "0.52405137", "0.520523", "0.51739186", "0.51290214", "0.512094", "0.5116543", "0.5088392", "0.50778794", "0.50715655", "0.5067207", "0.5061013", "0.50599724", "0.50321466", "0.50011605", "0.49960637", "0.498153...
0.5809351
1
example funtion to load model The prefix allows the loading of different models
def model_load(prefix='sl',data_dir=None,training=True): if not data_dir: data_dir = os.path.join("..","data","cs-train") models = [f for f in os.listdir(os.path.join(".","models")) if re.search("sl",f)] if len(models) == 0: raise Exception("Models with prefix '{}' cannot be f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self) -> Any:", "def load_model(self, model_path: str):", "def load_model(self, filename):\r\n pass", "def load_model(self):\n pass", "def load(path_to_model):\n pass", "def load_model(self, path):\n pass", "def load(\n self,\n modelLoadPath\...
[ "0.71479505", "0.6893208", "0.6850207", "0.6825739", "0.6771826", "0.66515994", "0.6556749", "0.6517185", "0.64483774", "0.6352274", "0.6318266", "0.63161296", "0.63113886", "0.6216418", "0.6185493", "0.61686164", "0.61437714", "0.61017406", "0.6093109", "0.6088694", "0.60863...
0.7016406
1
Returns the IP address of the gateway.
def get_gateway_ip(timeout=10): return get_default_route(timeout)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ip_address(self):\n return self.adb.get_ip_address()", "def get_ip_address(self):\n return self.__ip_address", "def get_host_ipaddress(self):\n\t\treturn call_sdk_function('PrlVirtNet_GetHostIPAddress', self.handle)", "def ip_address(self):\n return self.address", "def ip_addre...
[ "0.7647858", "0.736099", "0.7333112", "0.7308676", "0.73027515", "0.72874683", "0.7220547", "0.7215896", "0.7183793", "0.7174927", "0.71573424", "0.7156139", "0.7156139", "0.71245736", "0.71231115", "0.71164066", "0.7081324", "0.7068076", "0.70464844", "0.7043685", "0.7041591...
0.7950546
0
Check presence of nonEthernet network adapters (e.g., VPN). VPNs use TUN interfaces which don't have a hardware address.
def check_ethernet_network(): default_iface = get_default_route() assert default_iface[1] == sc.conf.iface, "incorrect sc.conf.iface" iface_str = '' if sys.platform.startswith('win'): iface_info = sc.conf.iface iface_str = iface_info.guid else: iface_str = sc.conf.iface ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_external_networks(self):\n network_list = self.neutron_operations.find_networks(router_external=True)\n self.assertNotEqual(len(network_list), 0, \"No external networks found\")", "def check_extensions(self):\n extensions = self.cloud.get_network_extensions()\n for network_ex...
[ "0.6374621", "0.6130782", "0.61274225", "0.5968749", "0.5785955", "0.57582057", "0.57091117", "0.5560452", "0.5520206", "0.5484068", "0.5473253", "0.5449959", "0.54315954", "0.5416802", "0.54131126", "0.53975147", "0.5394482", "0.53801876", "0.5348337", "0.53474194", "0.53374...
0.61691505
1
Gets network IP range for the default interface.
def get_network_ip_range(): ip_set = set() default_route = get_default_route() assert default_route[1] == sc.conf.iface, "incorrect sc.conf.iface" iface_str = '' if sys.platform.startswith('win'): iface_info = sc.conf.iface iface_str = iface_info.guid else: iface_str = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_ip():\r\n if CONFIG.BIND_INTERFACE is None:\r\n default_gw = netifaces.gateways()['default']\r\n if netifaces.AF_INET in default_gw:\r\n preferred_interface = default_gw[netifaces.AF_INET][1]\r\n else:\r\n interfaces = netifaces.interfaces()\r\n ...
[ "0.688741", "0.67158395", "0.66570085", "0.66431373", "0.6640566", "0.6495127", "0.63225204", "0.6290047", "0.6177535", "0.60079473", "0.5992663", "0.59691036", "0.5924349", "0.5879326", "0.58642465", "0.5844048", "0.58367354", "0.5827652", "0.5814642", "0.5814642", "0.577590...
0.73937607
0
Returns a set of MAC addresses of the current host.
def get_my_mac_set(iface_filter=None): out_set = set() if sys.platform.startswith("win"): from scapy.arch.windows import NetworkInterface if type(iface_filter) == NetworkInterface: out_set.add(iface_filter.mac) for iface in sc.get_if_list(): if iface_filter is not None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mac_address_table(self):\n\n mac_address_table = []\n command = '/interface bridge host print terse'\n\n output = self._send_command(command)\n\n for host in parse_terse_output(output):\n mac_address_table.append({\n 'mac': cast_mac(host.get('mac-addres...
[ "0.7482564", "0.6907314", "0.6590226", "0.65625256", "0.6528473", "0.6510169", "0.64578533", "0.6432203", "0.6377891", "0.6288591", "0.628722", "0.6238919", "0.61721426", "0.612203", "0.61172384", "0.6117105", "0.611112", "0.6107273", "0.6101588", "0.61014223", "0.6100259", ...
0.6956676
1
Restarts func upon unexpected exception and logs stack trace.
def restart_upon_crash(func, args=[], kwargs={}): while True: result = safe_run(func, args, kwargs) if isinstance(result, _SafeRunError): time.sleep(1) continue return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_exception(func):\n\n def wrapper(*args, **kwargs):\n try:\n return func(*args, **kwargs)\n except KeyboardInterrupt:\n self = args[0]\n self.log(\"KeyboardInterrupt detected abort process\")\n except Exception:\n self = args[0]\n ...
[ "0.6616624", "0.6581548", "0.645959", "0.6296821", "0.62436235", "0.6218824", "0.6208522", "0.61570114", "0.61205816", "0.61102957", "0.60994667", "0.6071539", "0.6054992", "0.60408807", "0.6037633", "0.6029749", "0.59839535", "0.59833205", "0.5960773", "0.5953678", "0.590791...
0.6780754
0
Returns a new min_max_tuple with value considered.
def get_min_max_tuple(min_max_tuple, value): min_v, max_v = min_max_tuple min_v = smart_min(min_v, value) max_v = smart_max(max_v, value) return (min_v, max_v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minmax(xs):\n min_val = None\n max_val = None\n for x in xs:\n if min_val is None or x < min_val:\n min_val = x\n if max_val is None or x > max_val:\n max_val = x\n return (min_val, max_val)", "def min_max(items):\n return min(items), max(items)", "def get...
[ "0.6693996", "0.64518523", "0.64440703", "0.6297684", "0.62571377", "0.62511533", "0.62077963", "0.6191093", "0.60693395", "0.60650694", "0.606241", "0.6000497", "0.5987081", "0.596118", "0.59477913", "0.5943709", "0.59234643", "0.5913458", "0.59077615", "0.58547777", "0.5853...
0.8177951
0
Returns 'mac', 'linux', or 'windows'. Raises RuntimeError otherwise.
def get_os(): os_platform = sys.platform if os_platform.startswith('darwin'): return 'mac' if os_platform.startswith('linux'): return 'linux' if os_platform.startswith('win'): return 'windows' raise RuntimeError('Unsupported operating system.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCurrentPlatform():\n if sys.platform == 'darwin':\n return 'mac'\n if sys.platform == 'win32':\n return 'win'\n if sys.platform == 'linux2':\n return 'linux'\n raise RuntimeError('Unknown platform')", "def known_os_type():\n return 'Linux'", "def get_platform():\n system_name = platfo...
[ "0.788494", "0.7715741", "0.7516504", "0.7501988", "0.74913234", "0.737526", "0.7304195", "0.7282568", "0.7147007", "0.71324575", "0.70510066", "0.70051956", "0.6999384", "0.6984772", "0.69302016", "0.69158024", "0.6864436", "0.684984", "0.6830821", "0.6827134", "0.68058926",...
0.7957707
0
Attempts to import the requested library.
def import_or_none(library): try: return importlib.import_module(library) except ImportError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_or_raise(library, error_msg):\n try:\n return importlib.import_module(library)\n except ImportError:\n raise ImportError(error_msg)", "def try_import(module, default=None):\n try:\n return importlib.import_module(module)\n except ImportError:\n return default", ...
[ "0.7078247", "0.63049585", "0.6293319", "0.6240048", "0.62355995", "0.5983", "0.5954648", "0.59089243", "0.58985806", "0.58829147", "0.58829147", "0.5872305", "0.58348227", "0.5797279", "0.57786226", "0.5760172", "0.5685794", "0.5645209", "0.5622872", "0.5618995", "0.5553314"...
0.697441
1
Attempts to import the requested library. If the import fails, raises an ImportError with the supplied error message.
def import_or_raise(library, error_msg): try: return importlib.import_module(library) except ImportError: raise ImportError(error_msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provoke_and_handle_ImportError():\n try:\n from you import me\n except ImportError as impe:\n print(f\"Sorry! {impe}\")", "def import_(module):\n try:\n return importlib.import_module(module)\n except ImportError as e:\n try:\n message = MESSAGES[module]\n ...
[ "0.61548597", "0.59946275", "0.5971833", "0.59628516", "0.5906814", "0.57484615", "0.5737069", "0.5726984", "0.5662793", "0.564088", "0.5638964", "0.561175", "0.55572397", "0.53984267", "0.53959", "0.5379158", "0.53590775", "0.5295622", "0.5292955", "0.52765524", "0.52756506"...
0.824003
0
Reformats LatLong columns to be tuples of floats. Uses np.nan for null values.
def _reformat_to_latlong(latlong, use_list=False): if _is_null_latlong(latlong): return np.nan if isinstance(latlong, str): try: # Serialized latlong columns from csv or parquet will be strings, so null values will be # read as the string 'nan' in pandas and Dask and 'Na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_latlong_float(val):\n if _is_null_latlong(val):\n return np.nan\n\n try:\n return float(val)\n except (ValueError, TypeError):\n raise ValueError(\n f\"Latitude and Longitude values must be in decimal degrees. The latitude or longitude represented by {val} cannot be...
[ "0.62581193", "0.61285114", "0.60195297", "0.5976948", "0.5868812", "0.58154327", "0.58131707", "0.5779865", "0.5701041", "0.5647569", "0.56311095", "0.55860037", "0.5583961", "0.5559613", "0.5548943", "0.55404603", "0.553762", "0.55290985", "0.5450382", "0.5439959", "0.54382...
0.7167407
0
Returns True if all elements in the series contain properly formatted LatLong values, otherwise returns False
def _is_valid_latlong_series(series): if ww.accessor_utils._is_dask_series(series): series = series = series.get_partition(0).compute() if ww.accessor_utils._is_koalas_series(series): series = series.to_pandas() bracket_type = list else: bracket_type = tuple if series.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_latlon(self, col):\r\n # Assumes input in format ##d##.####' Dir or ##d##' Dir\r\n # latlon_pattern = \"[0-9]+[d][0-9]+[.][0-9]+\\' [nsewNSEW]\"\r\n latlon_pattern = \"[0-9]+[d][0-9]+[.]?[0-9]+\\' [nsewNSEW]\"\r\n error_rows = [] # initialize list of rows with errors\r\n ...
[ "0.6370123", "0.6367762", "0.6134372", "0.58406454", "0.5823443", "0.5808954", "0.5729079", "0.5709992", "0.56361866", "0.55776364", "0.5561268", "0.5495813", "0.5489667", "0.54754966", "0.5459088", "0.5456972", "0.545261", "0.54359716", "0.54275155", "0.5427157", "0.5364367"...
0.7682574
0
Returns True if the value provided is a properly formatted LatLong value for a pandas, Dask or Koalas Series, otherwise returns False.
def _is_valid_latlong_value(val, bracket_type=tuple): if isinstance(val, bracket_type) and len(val) == 2: latitude, longitude = val if isinstance(latitude, float) and isinstance(longitude, float): if pd.isnull(latitude) and pd.isnull(longitude): return False r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_valid_latlong_series(series):\n if ww.accessor_utils._is_dask_series(series):\n series = series = series.get_partition(0).compute()\n if ww.accessor_utils._is_koalas_series(series):\n series = series.to_pandas()\n bracket_type = list\n else:\n bracket_type = tuple\n ...
[ "0.7972523", "0.6393337", "0.63101315", "0.62244815", "0.6111046", "0.5928852", "0.57753503", "0.569396", "0.5603471", "0.55631477", "0.55606425", "0.5509485", "0.54928124", "0.549229", "0.5442", "0.5437204", "0.54236805", "0.54077554", "0.5321938", "0.5300589", "0.5290154", ...
0.72534066
1
Generate a list of LogicalTypes that are valid for calculating mutual information. Note that index columns are not valid for calculating mutual information, but their types may be returned by this function.
def get_valid_mi_types(): valid_types = [] for ltype in ww.type_system.registered_types: if "category" in ltype.standard_tags: valid_types.append(ltype) elif "numeric" in ltype.standard_tags: valid_types.append(ltype) elif ( ltype == ww.logical_types.D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTypes():\n\t\n\ttranslationTable = []\n\tfor x in typePrimitive:\n\t\ttranslationTable.extend(x[0])\n\t\n\tid = 0\n\ttypes = []\n\tmax = 0\n\tfor x in typePrimitive:\n\t\t\n\t\tbinds = []\n\t\tfor y in x[2]:\n\t\t\tbinds.append(translationTable.index(y))\n\t\t\n\t\tif (x[4] != False) and (x[4] > max):\n\t\t...
[ "0.60255617", "0.5660919", "0.56258166", "0.5523945", "0.55005306", "0.5465987", "0.52792865", "0.52710205", "0.52457094", "0.5243268", "0.5240935", "0.52369034", "0.52208424", "0.52025646", "0.5169214", "0.5160367", "0.51515776", "0.5141425", "0.5116735", "0.5114437", "0.510...
0.6398191
0
Concatenate Woodwork objects along the columns axis. There can only be one index and time index set across the objects passed in. As Woodwork does not allow duplicate column names, will not allow duplicate columns at concatenation.
def concat_columns(objs, validate_schema=True): if not objs: raise ValueError("No objects to concatenate") table_name = "" logical_types = {} semantic_tags = {} col_descriptions = {} col_origins = {} col_metadata = {} table_metadata = {} use_standard_tags = {} index = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat(self_or_cls, *others, keys=None, broadcast_kwargs=None):\n others = tuple(map(lambda x: x._obj if isinstance(x, BaseAccessor) else x, others))\n if isinstance(self_or_cls, type):\n objs = others\n else:\n objs = (self_or_cls._obj,) + others\n if broadcas...
[ "0.6248578", "0.6030609", "0.5950182", "0.5877113", "0.58261275", "0.575293", "0.5644173", "0.55933523", "0.5548353", "0.5536582", "0.5536095", "0.5524651", "0.55155313", "0.54648536", "0.54237336", "0.54113686", "0.5364805", "0.5362643", "0.5361054", "0.536105", "0.53609735"...
0.7054863
0
Helper function for updating progress of a function and making a call to the progress callback function, if provided. Adds the progress increment to the current progress amount and returns the updated progress amount.
def _update_progress( start_time, current_time, progress_increment, current_progress, total, unit, callback_function, ): if callback_function is not None: new_progress = current_progress + progress_increment elapsed_time = current_time - start_time callback_functi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increase_progress(self, value):\r\n\r\n pass", "def update_progress(i, n):\n global _current_line\n prog = progress_string(i, n)\n if _current_line is not None:\n _current_line.update(prog)", "def with_progress_bar(func, totalCalls, prefix = '', postfix='', isBytes=False):\n from ...
[ "0.7234067", "0.6741861", "0.67230564", "0.66974324", "0.6561446", "0.6561446", "0.6561446", "0.6561446", "0.6493422", "0.6406674", "0.6404424", "0.63656706", "0.636506", "0.6312635", "0.62216663", "0.61957896", "0.61833084", "0.61666036", "0.61554736", "0.61541057", "0.61299...
0.8162616
0
Helper function to infer the datetime format of the first n nonnull rows of a series
def _infer_datetime_format(dates, n=100): first_n = dates.dropna().head(n) if len(first_n) == 0: return None try: fmts = first_n.map(guess_datetime_format) mode_fmt = fmts.mode().loc[0] # select first most common format except (TypeError, ValueError, IndexError, KeyError, NotImp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isdatecol(pd_series,sample_size=10):\n pd_series_notnull = pd_series.dropna()\n samples = pd_series_notnull.astype(str).sample(sample_size,replace=True)\n\n if samples.dtype == np.dtype('float'):\n try:\n samples = samples.astype('int')\n samples = samples.astype('str')\n ...
[ "0.65475", "0.55761886", "0.55549085", "0.5248455", "0.5188043", "0.5157663", "0.5037147", "0.501689", "0.49810252", "0.4977872", "0.4977077", "0.49723107", "0.49161842", "0.49093357", "0.4889514", "0.48762748", "0.48739716", "0.48491412", "0.48465076", "0.48449856", "0.48380...
0.68308353
0
Plot the particle level spectra with ROOT.
def _plot_particle_level_spectra_with_ROOT(ep_analyses: AnalysesBase, output_name: str, output_info: analysis_objects.PlottingOutputWrapper, general_labels: Dict[str, str], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_root(self, root):\n vessel = Marker()\n #visualizations points and lines..\n vessel.header.frame_id = \"map\"\n vessel.header.stamp = rospy.get_rostime()\n vessel.ns = \"markers\"\n vessel.id = 1\n vessel.type = vessel.ARROW\n vessel.action = vessel...
[ "0.64736027", "0.64682025", "0.6455318", "0.64202565", "0.64112085", "0.61038876", "0.599426", "0.59731036", "0.5963233", "0.586455", "0.58537555", "0.5837994", "0.5836717", "0.58262247", "0.5825251", "0.5743784", "0.5729757", "0.56688094", "0.56576216", "0.5625051", "0.56010...
0.7434869
0
Create ratios relative to the particle level spectra and plot them.
def particle_level_spectra_ratios(ep_analyses_iter: Iterator[Tuple[Any, "response_matrix.ResponseMatrixBase"]], output_info: analysis_objects.PlottingOutputWrapper) -> None: # Setup fig, ax = plt.subplots(figsize = (8, 6)) # Diamond, square, up triangle, circle markers ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n\t\tself.plotOfSpect()", "def plot_all(spectra):\n fig, ax = plt.subplots()\n for s in spectra:\n # if we have bin \"centers\" on x:\n plt.plot(s.x, s.y, label=s.name, ls=\"steps\")\n # if we have bin boundaries on x:\n #plot_binned_data(ax, s.x, s.y)\n plt.l...
[ "0.63218486", "0.62749934", "0.6212099", "0.613881", "0.5900433", "0.5891233", "0.58455765", "0.5812598", "0.5808767", "0.57839274", "0.5758367", "0.5751705", "0.5714763", "0.56704575", "0.5658396", "0.56325686", "0.5621882", "0.561225", "0.5591715", "0.55831325", "0.55752015...
0.6730364
0
Validate that the fit object was setup properly. This can be any method that the user devises to ensure that all of the information needed for the fit is available.
def _post_init_validation(self) -> None: fit_range = self.fit_options.get("range", None) # Check that the fit range is specified if fit_range is None: raise ValueError("Fit range must be provided in the fit options.") # Check that the fit range is a Selec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _verify_fit(self) -> None:\n if not hasattr(self, 'X_train') or not hasattr(self, 'Y_train'):\n raise ValueError('Training data not set. Call `fit` and pass training data first.')", "def _check_is_fitted(self):\n check_is_fitted(self, ['w', 'b'])", "def _check_if_fitted(self):\n ...
[ "0.80156094", "0.7147508", "0.7136454", "0.7128601", "0.7102252", "0.7099515", "0.7099515", "0.7061259", "0.6819987", "0.68154365", "0.6812778", "0.6736837", "0.66995203", "0.66995203", "0.66995203", "0.66995203", "0.66995203", "0.66995203", "0.66995203", "0.66995203", "0.669...
0.73755616
1
Compare STAR and ALICE particle level spectra.
def compare_STAR_and_ALICE(star_final_response_task: "response_matrix.ResponseMatrixBase", alice_particle_level_spectra: Dict[params.CollisionEnergy, Hist], output_info: analysis_objects.PlottingOutputWrapper) -> None: # Setup fig, ax = plt.subplots(figsize ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spect(self):\n return 1", "def same_spectrum():\n\n S1=Spectrum.Spectrum()\n S1.add_peak(50.7,234)\n S1.add_peak(54.6,585)\n S1.add_peak(60.7,773)\n S1.add_peak(65.6,387)\n S1.add_peak(87.7,546)\n S1.add_peak(104.6,598)\n S1.pep_mass=100\n S1.euclidean_scale()\n\n S2=Spec...
[ "0.57224834", "0.56981945", "0.5511152", "0.54919094", "0.5453379", "0.54345566", "0.526467", "0.52061856", "0.51798815", "0.5170725", "0.5166418", "0.51523364", "0.5089163", "0.5087198", "0.50576246", "0.4970383", "0.49621376", "0.494066", "0.49322706", "0.4923891", "0.49117...
0.5908162
0
Compare the constituent cut against the minimum constituent cut.
def compare_min_constituent_cut(obj: "response_matrix.ResponseMatrixBase", min_constituent_hist: Hist, output_info: analysis_objects.PlottingOutputWrapper) -> None: # Setup fig, ax = plt.subplots(figsize = (8, 6)) # Plot the standard constitue...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lt__(self, other):\n return not (self.unsplitable or self.split_necessity < other.split_necessity)", "def test_min_cut(default_plugin_resolver):\n dpr = default_plugin_resolver\n source_node = 0\n target_node = 7\n ebunch = [\n (0, 1, 9),\n (0, 3, 10),\n (1, 4, 3),\n...
[ "0.57535315", "0.5663954", "0.5624749", "0.56119233", "0.55975074", "0.5533542", "0.5519202", "0.549347", "0.5488497", "0.548832", "0.54861134", "0.5457886", "0.54371256", "0.54063505", "0.5397358", "0.53348976", "0.5324767", "0.53189343", "0.5235252", "0.52284485", "0.522444...
0.6416536
0
Plot the 2D response matrix and response matrix errors hists using ROOT.
def plot_response_matrix_and_errors(obj: "response_matrix.ResponseMatrixBase", plot_with_ROOT: bool = False) -> None: for hist, plot_errors_hist in [(obj.response_matrix, False), (obj.response_matrix_errors, True)]: # Plot response matri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot_response_matrix_with_ROOT(name: str, x_label: str, y_label: str, output_name: str,\n hist: Hist,\n plot_errors_hist: bool,\n output_info: analysis_objects.PlottingOutputWrapper) -> None:\n # Setup\...
[ "0.68435436", "0.6381821", "0.5851657", "0.5711076", "0.5705237", "0.5652123", "0.56432015", "0.56401414", "0.5564352", "0.554333", "0.5514348", "0.55023986", "0.548718", "0.54841703", "0.54733753", "0.5443174", "0.5363157", "0.53492004", "0.5344716", "0.5259776", "0.525255",...
0.6437198
1
Underlying function to actually plot a response matrix with matplotlib.
def _plot_response_matrix_with_matplotlib(name: str, x_label: str, y_label: str, output_name: str, hist: Hist, plot_errors_hist: bool, output_info: analysis_objects.PlottingOutputWrapper) -> Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot_final_response_matrix_with_matplotlib(obj: \"response_matrix.ResponseMatrixBase\",\n hist: Hist,\n output_info: analysis_objects.PlottingOutputWrapper) -> None:\n # Setup\n fig, ax = plt.subplots(figsize =...
[ "0.7164788", "0.7083894", "0.65651023", "0.6561516", "0.6489073", "0.64880645", "0.6464205", "0.637817", "0.6319792", "0.62200785", "0.6200502", "0.61682755", "0.61657417", "0.61655146", "0.61554474", "0.6149794", "0.6148942", "0.6129614", "0.61133796", "0.6112062", "0.607862...
0.72679454
0
Underlying function to actually plot a response matrix with ROOT.
def _plot_response_matrix_with_ROOT(name: str, x_label: str, y_label: str, output_name: str, hist: Hist, plot_errors_hist: bool, output_info: analysis_objects.PlottingOutputWrapper) -> None: # Setup canva...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot_response_matrix(hist: Hist,\n plot_errors_hist: bool,\n output_info: analysis_objects.PlottingOutputWrapper,\n plot_with_ROOT: bool,\n reaction_plane_orientation: params.ReactionPlaneOrientation) -> None:\...
[ "0.6565106", "0.63350993", "0.6262479", "0.61882514", "0.59974843", "0.59061533", "0.58772486", "0.5790546", "0.5702304", "0.567995", "0.5672698", "0.5660405", "0.55858636", "0.54101074", "0.53710735", "0.5366077", "0.53542006", "0.53508806", "0.5349951", "0.53485036", "0.533...
0.71553904
0
Underlying function to actually plot the final response matrix with matplotlib. It also rebins a clone of the histogram so it's presentable.
def _plot_final_response_matrix_with_matplotlib(obj: "response_matrix.ResponseMatrixBase", hist: Hist, output_info: analysis_objects.PlottingOutputWrapper) -> None: # Setup fig, ax = plt.subplots(figsize = (8, 6)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotResponseMatrix(resmat,bins=[]):\n try:\n shape = resmat.shape\n except AttributeError:\n resmat = np.array(resmat)\n shape = resmat.shape\n\n # use data from the histogram as 'weights'\n # use 'dummy' values for the center of the bin \n if not bins:\n nbinsx = sh...
[ "0.7521574", "0.6646638", "0.65895087", "0.6272343", "0.62388563", "0.6196152", "0.61172557", "0.60064316", "0.594879", "0.59486943", "0.5945983", "0.5919958", "0.58663094", "0.58508855", "0.58120465", "0.58120465", "0.58120465", "0.58054113", "0.5781867", "0.57800865", "0.57...
0.7151266
1
Plot the agreement of the particle level spectra between the inclusive and sum of all EP orientations.
def plot_particle_level_spectra_agreement(difference: Hist, absolute_value_of_difference: Hist, output_info: analysis_objects.PlottingOutputWrapper) -> None: # Setup output_name = "difference_of_sum_EP_orientations_vs_inclusive" canvas = ROOT.TCanvas("canvas", "canv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self, num_levels=10):\n if num_levels == -1:\n num_levels = len(self.energies())\n print(self.energies(num_levels))\n figure(figsize=(20, 5))\n subplot(1, num_levels + 1, 1)\n self.plot_potential()\n #xlabel('$\\phi$')\n for ii, psi2D in enumerat...
[ "0.64189", "0.6295174", "0.62356186", "0.6168209", "0.5964071", "0.593904", "0.5924532", "0.5846889", "0.5829192", "0.5798979", "0.578939", "0.5737951", "0.5731567", "0.56971", "0.56872207", "0.5686627", "0.56650037", "0.5638997", "0.56376225", "0.561283", "0.5604707", "0.5...
0.6738736
0
Exercises some of the reviewData functions to make sure they don't crash
def test_reviewData(): starttime = UTCDateTime('2018-06-18T02:34:20') endtime = UTCDateTime('2018-06-18T02:37:20') st = rd.getdata('IU', 'TEIG,PAYG', '00', 'BHZ', starttime, endtime, savedat=True, filenamepref='Test1_', loadfromfile=True, reloadfile=False) event_lat = 14.178 eve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prep_data(ratings_df, watched_df=None, watchlist_df=None,\n good_threshold=4, bad_threshold=3):\n id_book = pd.read_csv('title_basics_small.csv')\n try:\n # try to read Letterboxd user data\n # drop rows with nulls in the columns we use\n ratings_df = ratings_df.dro...
[ "0.62894493", "0.5989138", "0.5934736", "0.5839075", "0.56993616", "0.5685968", "0.5597375", "0.5552618", "0.5536545", "0.5481391", "0.5478898", "0.54674995", "0.5457173", "0.54479694", "0.54174006", "0.5412899", "0.5405072", "0.537721", "0.53189635", "0.531677", "0.5298867",...
0.59922236
1
check if a pixel is likely a part of antialiasing; based on "Antialiased Pixel and Intensity Slope Detector" paper by V. Vysniauskas, 2009
def antialiased( img: ImageSequence, x1: int, y1: int, width: int, height: int, img2: ImageSequence ) -> bool: x0 = max(x1 - 1, 0) y0 = max(y1 - 1, 0) x2 = min(x1 + 1, width - 1) y2 = min(y1 + 1, height - 1) pos = (y1 * width + x1) * 4 zeroes = int(x1 == x0 or x1 == x2 or y1 == y0 or y1 == y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_anti_aliased_pixels(self, x, y1, y2, color):\n \n y_max = max(y1, y2)\n y_max_int = int(y_max)\n alpha = y_max - y_max_int\n \n if alpha > 0.0 and alpha < 1.0 and y_max_int + 1 < self.image_height:\n current_pix = self.pix[x, y_max_int + 1]\n \n r = int((1...
[ "0.60821176", "0.59126943", "0.57027054", "0.56550395", "0.5565252", "0.55334216", "0.54781353", "0.5379461", "0.5324981", "0.52397627", "0.5226308", "0.519122", "0.5168761", "0.5158019", "0.5151682", "0.5147943", "0.51477754", "0.5115228", "0.51092535", "0.51030046", "0.5072...
0.7016843
0
Blend r, g, and b with a
def blendRGB(r: float, g: float, b: float, a: float): return blend(r, a), blend(g, a), blend(b, a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blend(c: float, a: float) -> float:\n return 255 + (c - 255) * a", "def _blend(img1, img2, alpha):\n return img1.mul(alpha).add(1 - alpha, img2)", "def _alpha_blend_simple(rgb1, alpha1, rgb2, alpha2):\n c_alpha1 = (1.0 - alpha1)\n alpha3 = alpha1 + alpha2 * c_alpha1\n\n numer1 = (rgb1 * alph...
[ "0.7604507", "0.6987253", "0.6777129", "0.6634924", "0.65591335", "0.6513661", "0.6494316", "0.6457785", "0.6436203", "0.64216983", "0.6378084", "0.63416684", "0.6319219", "0.6318102", "0.6285543", "0.62621295", "0.614096", "0.60913044", "0.6062248", "0.60531944", "0.6016201"...
0.799009
0
blend semitransparent color with white
def blend(c: float, a: float) -> float: return 255 + (c - 255) * a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layer_blend(foreground, background, foreground_alpha=.6):\n cv2.addWeighted(foreground, foreground_alpha,\n background, 1 - foreground_alpha, 0, background)\n\n return background", "def _blend(img1, img2, alpha):\n return img1.mul(alpha).add(1 - alpha, img2)", "def BlendColour(f...
[ "0.67601967", "0.67489237", "0.67450917", "0.67288655", "0.6562192", "0.65282667", "0.64514196", "0.64377266", "0.6305049", "0.6249819", "0.61514807", "0.6146871", "0.60922474", "0.6090703", "0.60878575", "0.6058598", "0.6045431", "0.599716", "0.59859043", "0.5959071", "0.591...
0.6970825
0
Test default and patch version bumping.
def test_bump_patch(version: str, bumped: str) -> None: assert bump(version) == bump(version, "patch") == bumped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bump_major(version: str, bumped: str) -> None:\n assert bump(version, \"major\") == bumped", "def test_bump_minor(version: str, bumped: str) -> None:\n assert bump(version, \"minor\") == bumped", "def test_changeVersions(self):\n self._testVersionChanging(8, 2, 3)", "def test_patch(scra...
[ "0.76588094", "0.7593783", "0.7374241", "0.7275594", "0.7221003", "0.72119224", "0.7046133", "0.69352984", "0.682573", "0.6773345", "0.66823137", "0.66781527", "0.6659725", "0.66583407", "0.6638398", "0.6625943", "0.66118336", "0.66053164", "0.6579734", "0.65667886", "0.65479...
0.81615305
0
Test minor version bumping.
def test_bump_minor(version: str, bumped: str) -> None: assert bump(version, "minor") == bumped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_minor(scraper, version_parts):\n\n new_version_parts = list(version_parts)\n new_version_parts[1] = int(new_version_parts[1]) + 1\n\n assert scraper.is_compatible_with(generate_version(new_version_parts)) is True", "def test_minor(self):\n self.assertEqual(1, self._version1.minor())\n ...
[ "0.82367325", "0.8131239", "0.8016907", "0.7655524", "0.7271789", "0.72697747", "0.7235349", "0.7094565", "0.7062398", "0.7053315", "0.7029143", "0.69618255", "0.693128", "0.6765769", "0.67473435", "0.67473435", "0.67393416", "0.6715864", "0.6645604", "0.6644355", "0.66340846...
0.8635401
0
Test major version bumping.
def test_bump_major(version: str, bumped: str) -> None: assert bump(version, "major") == bumped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bump_minor(version: str, bumped: str) -> None:\n assert bump(version, \"minor\") == bumped", "def test_major(scraper, version_parts):\n\n new_version_parts = list(version_parts)\n new_version_parts[0] = int(new_version_parts[0]) + 1\n\n assert scraper.is_compatible_with(generate_version(new_...
[ "0.8030653", "0.794367", "0.7902008", "0.77725935", "0.7619171", "0.719503", "0.7164437", "0.7157481", "0.6914379", "0.691341", "0.68943393", "0.68380123", "0.6765157", "0.6759193", "0.67509687", "0.6741436", "0.67015326", "0.66785026", "0.66615194", "0.6640738", "0.6623431",...
0.84981227
0
Compute bleu and rouge scores.
def compute_bleu_rouge(pred_dict, ref_dict, bleu_order=4): assert set(pred_dict.keys()) == set(ref_dict.keys()), \ "missing keys: {}".format(set(ref_dict.keys()) - set(pred_dict.keys())) scores = {} bleu_scores, _ = Bleu(bleu_order).compute_score(ref_dict, pred_dict) for i, bleu_score in enumera...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculScore(self):\n for cell in self.notComputeRouter:\n if(cell.isCovered==True):\n self.score += 1000\n self.score += self.budget", "def get_score(self, red_score, blue_score):\n if red_score < blue_score:\n return 0\n elif red_score > blue_...
[ "0.695063", "0.68623054", "0.68102175", "0.67968833", "0.6782", "0.6756866", "0.6754789", "0.67452097", "0.6734876", "0.6681154", "0.66802526", "0.66747856", "0.66662073", "0.66634667", "0.66228145", "0.6581652", "0.6546417", "0.65411836", "0.65320295", "0.6530447", "0.651147...
0.6910735
1
Read in the OVF descriptor.
def get_ovf_descriptor(ovf_path): if path.exists(ovf_path): with open(ovf_path, 'r') as f: try: ovfd = f.read() f.close() return ovfd except: print "Could not read file: %s" % ovf_path exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_vnf_descriptor(vnfd_id, vnf_vendor, vnf_version):\n if _catalog_backend is not None:\n return _catalog_backend.read_vnf_descriptor(vnfd_id, vnf_vendor,\n vnf_version)\n return None", "def read(self, fd):\n self._reset()\n \n ...
[ "0.69224715", "0.63324213", "0.5744359", "0.5538069", "0.55315405", "0.5493548", "0.548196", "0.5479747", "0.5408382", "0.53818285", "0.5378525", "0.5370463", "0.53442234", "0.53139555", "0.5294029", "0.52886486", "0.52790886", "0.52727866", "0.5267248", "0.51964396", "0.5179...
0.7587289
0
Gets an object out of a list (obj_list) whos name matches obj_name.
def get_obj_in_list(obj_name, obj_list): for o in obj_list: if o.name == obj_name: return o print ("Unable to find object by the name of %s in list:\n%s" % (o.name, map(lambda o: o.name, obj_list))) exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object_by_name(self, object_list, object_name):\n obj = None\n for i in object_list:\n if i.get_name().lower() == object_name.lower():\n obj = i\n break\n return obj", "def getObject(name, index=-1):\n\n names = [x.name for x in bpy.data.ob...
[ "0.8697059", "0.7209134", "0.7009152", "0.7009152", "0.6874355", "0.6866148", "0.6851065", "0.68362266", "0.68352616", "0.6488747", "0.64736295", "0.6378767", "0.63584274", "0.6305251", "0.62792194", "0.62191564", "0.62100554", "0.6189704", "0.61424476", "0.61080664", "0.6082...
0.8606201
1
Remove articles with duplicate UUIDs from database, and update all IDs.
async def clean_up(): # Load Settings settings = await fetch_settings() try: if settings["previous version"] == settings["version"]: await upgrade() except KeyError: await upgrade() old_version = settings["previous version"] new_version = settings["version"] if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_duplicated_identifiers(rows):\n\n logger.info('Cleaning duplicates')\n unique_identifiers = []\n c = 0\n for row in rows:\n c += 1\n idf = row['identifier']\n logger.info(f'Searching duplicates {c} {idf}')\n if idf not in unique_identifiers:\n unique_ide...
[ "0.605591", "0.57222927", "0.5661031", "0.56231", "0.5568925", "0.55190045", "0.5447636", "0.54263103", "0.5372109", "0.53523695", "0.535199", "0.5326436", "0.53261274", "0.53220457", "0.5313505", "0.53129965", "0.5291006", "0.52829784", "0.52794284", "0.5261226", "0.5259117"...
0.6323741
0
Must return a list of values. >>> get_tag_pairs(event) [tag1, tag2, tag3]
def get_tag_values(self, event): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags(self):\n return tuple([x.strip() for x in self._dict.get('tags').split(',')])", "def GetEventTags(self):\n for event_tag in self._GetAttributeContainers('event_tag'):\n event_identifier = identifiers.SerializedStreamIdentifier(\n event_tag.event_stream_number, event_tag.event_ent...
[ "0.64059234", "0.6108986", "0.60954213", "0.60341644", "0.59650093", "0.59287816", "0.59119004", "0.5824568", "0.57496864", "0.5736333", "0.57354736", "0.57094395", "0.5709377", "0.57091993", "0.56847453", "0.5562875", "0.55483586", "0.5534153", "0.55174404", "0.55034655", "0...
0.70019513
0
Creates an instance of FullSlateQAgent.
def create_agent(sess, environment, eval_mode, summary_writer=None): kwargs = { 'observation_space': environment.observation_space, 'action_space': environment.action_space, 'summary_writer': summary_writer, 'eval_mode': eval_mode, } return full_slate_q_agent.FullSlateQAgent(sess, **kwargs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, agent: AEA) -> None:\n self._agent = agent\n super().__init__()", "def __init__(self, agent):\n self.agent = agent", "def make_agent(cls, feature_dim: int):\n params = LinUCBTrainerParameters()\n policy_network = LinearRegressionUCB(input_dim=feature_dim)\n...
[ "0.54705834", "0.54017335", "0.5360143", "0.53524786", "0.532081", "0.52880126", "0.5275774", "0.5245605", "0.5162603", "0.5136954", "0.5133092", "0.506478", "0.5050614", "0.5041798", "0.5029602", "0.50225794", "0.5000415", "0.49467543", "0.494372", "0.49293464", "0.49257118"...
0.7672317
0
Broadcast loopstate over bluetooth.
def broadcast(loopstate): cmdstring = 'sudo hcitool -i hci0 cmd ' # Send cmd to hci0 cmdstring += '0x08 ' # Set group to BLE cmdstring += '0x0008 ' # Set command to HCI_LE_Set_Advertising_Data cmdstring += '0D ' # Length of entire following data, in bytes cmdstring += '02 ' # Length of flag inf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background_thread():\n state = True\n while True:\n newstate = False if GPIO.input(18) else True\n if state != newstate:\n state = newstate \n print('Button', state)\n socketio.emit('button', {'state': state}, namespace='/test')\n time.sleep(.1)", "...
[ "0.6143892", "0.61352307", "0.6112771", "0.60218054", "0.5856724", "0.5856724", "0.58151907", "0.5786177", "0.5774064", "0.57161194", "0.57023036", "0.56530553", "0.5626573", "0.55784017", "0.55719113", "0.55671567", "0.55671567", "0.5540479", "0.5518041", "0.55152524", "0.54...
0.74595076
0
Get state of loop, with whatever the system ends up being. For now, since it's grovepi, don't call in multiple threads
def get_loopstate(): return grovepi.digitalRead(LOOP)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop(self):\r\n\r\n self._next_state = self._current_state", "def loop(self):\n\n return self._loop", "def loop(self) -> AbstractEventLoop:", "def loop(self) -> AbstractEventLoop:", "def current_state():\n global current_state\n while current_state is None:\n pass...
[ "0.65008533", "0.6309636", "0.63054246", "0.63054246", "0.62447035", "0.6197426", "0.61490273", "0.6106159", "0.60808617", "0.6041753", "0.60180134", "0.59956557", "0.598971", "0.59786713", "0.5978629", "0.59754026", "0.59645075", "0.5948817", "0.5905379", "0.5895321", "0.588...
0.78564936
0
Get loopstate from queue. Safe for all theads.
def get_queue_data(): global grove_data try: grove_data = grove_queue.get_nowait() except Empty: # Just use old loopstate if queue is empty pass return grove_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loopstate():\n return grovepi.digitalRead(LOOP)", "async def queueloop(self, ctx: commands.Context) -> Optional[bool]:\n\n queue = self.queue[ctx.guild.id]\n\n queue.loop = (\n Loops.QUEUE_LOOP\n if self.queue[ctx.guild.id].loop != Loops.QUEUE_LOOP\n else...
[ "0.63969445", "0.6388656", "0.616243", "0.6153826", "0.6005618", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "0.59824425", "...
0.6529675
0
Set data in queue.
def set_queue_data(data): while(not grove_queue.empty): grove_queue.get() grove_queue.put(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update(self, data):\n if len(data) > 0:\n for q in self._queues.values():\n q.put(data)", "def put_data(self, id, data):\n self.msg_queue.put(data)", "def data(self, data):\n try:\n self.put_nowait(data)\n except Full:\n pass", ...
[ "0.737689", "0.72900486", "0.7113438", "0.6962928", "0.6944753", "0.6944753", "0.6902705", "0.6902705", "0.6875079", "0.6869071", "0.6867761", "0.68451226", "0.6805647", "0.6767655", "0.67515993", "0.6731096", "0.67199117", "0.6689896", "0.6653151", "0.6650198", "0.6650198", ...
0.8275841
0
get all of the message from API
def get_message_list(self): result = requests.get( url = root_url + '/{}'.format("message"), headers = { 'Authorization': api_key }, ) message_list = result.json() self.message_list = message_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_messages(self):", "def get(self):\n user_id = get_jwt_identity()\n user = UserModel.get_by_id(user_id)\n return [message.json() for message in MessageModel.get_package_messages(user)], 200", "def api_all():\n all_mail = mail_dao.get_all()\n return _create_response(all_mail)"...
[ "0.71134996", "0.7041658", "0.6958263", "0.6911363", "0.6792598", "0.67873204", "0.6765784", "0.6631227", "0.65949005", "0.65917724", "0.6584501", "0.6583084", "0.65400064", "0.64857435", "0.6477679", "0.6416339", "0.63965744", "0.6390228", "0.63815135", "0.63330156", "0.6326...
0.71309465
0
Simulator function (called by web services stubs) to set the simulated conditions from the temperature sensor. This won't be present in the production Thermostat class because we won't need to do that.
def sim_set_conditions(self, temp=None, humid=None): if temp: self.temp = temp if humid: self.humid = humid print('gtd: sim_set_conditions{}'.format(repr((temp, humid))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_conditions(temp=None, humid=None):\n if temp == None:\n print('=== pretty stupid error, not setting temperature on'\n ' set_conditions()')\n thermo.sim_set_conditions(temp, humid)\n my_dict = set_status(None)\n # This will render a normal status frame in HTML\n return my_...
[ "0.718892", "0.68752706", "0.6565593", "0.6433665", "0.64181554", "0.6414689", "0.6378889", "0.6350442", "0.6314286", "0.6288814", "0.6269809", "0.62591684", "0.6251589", "0.62293375", "0.62147444", "0.618711", "0.61841625", "0.6166066", "0.61625946", "0.61561483", "0.6150179...
0.7022881
1
[utils][word_dict] Check correct merge of the dictionnaries.
def test_merge_word_dicts(): ref_dict = {"accordeon": ["acordeon"], "accoster": ["accostage", "acostage"]} new_dict = {"accordeon": ["accordeons"], "accostage": ["accostages"], "accumulateur": ["acumulateur", "acc"]} word_dict.merge_word_dicts(ref_dict, new_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gen_word_dict(words):\n\n # grab all of them with a single in statement.\n results = lookup_words_by_words(\n (set([self.normalize(w) for w in words] + words)),\n session, Word)\n\n def merge(word):\n if word in results:\n ...
[ "0.6537106", "0.63339984", "0.63094074", "0.63079214", "0.61262935", "0.61243767", "0.59921867", "0.5939619", "0.58666986", "0.58606994", "0.5857551", "0.58371824", "0.58281875", "0.5813482", "0.5808291", "0.58036643", "0.5802069", "0.5778317", "0.5764365", "0.5755581", "0.57...
0.7912319
0