code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def post(self, request): """Handle a query observer unsubscription request.""" try: observer_id = request.query_params['observer'] session_id = request.query_params['subscriber'] except KeyError: return response.Response(status=400) observer.remove_su...
def function[post, parameter[self, request]]: constant[Handle a query observer unsubscription request.] <ast.Try object at 0x7da18dc04fd0> call[name[observer].remove_subscriber, parameter[name[session_id], name[observer_id]]] return[call[name[response].Response, parameter[]]]
keyword[def] identifier[post] ( identifier[self] , identifier[request] ): literal[string] keyword[try] : identifier[observer_id] = identifier[request] . identifier[query_params] [ literal[string] ] identifier[session_id] = identifier[request] . identifier[query_params] [ l...
def post(self, request): """Handle a query observer unsubscription request.""" try: observer_id = request.query_params['observer'] session_id = request.query_params['subscriber'] # depends on [control=['try'], data=[]] except KeyError: return response.Response(status=400) # depends...
def dict_output(self, check_name, groups, source_name, limit): ''' Builds the results into a JSON structure and writes it to the file buffer. @param check_name The test which was run @param groups List of results from compliance checker @param output_filename Path ...
def function[dict_output, parameter[self, check_name, groups, source_name, limit]]: constant[ Builds the results into a JSON structure and writes it to the file buffer. @param check_name The test which was run @param groups List of results from compliance checker @...
keyword[def] identifier[dict_output] ( identifier[self] , identifier[check_name] , identifier[groups] , identifier[source_name] , identifier[limit] ): literal[string] identifier[aggregates] = identifier[self] . identifier[build_structure] ( identifier[check_name] , identifier[groups] , identifier[s...
def dict_output(self, check_name, groups, source_name, limit): """ Builds the results into a JSON structure and writes it to the file buffer. @param check_name The test which was run @param groups List of results from compliance checker @param output_filename Path to f...
def DTAgentProgram(belief_state): "A decision-theoretic agent. [Fig. 13.1]" def program(percept): belief_state.observe(program.action, percept) program.action = argmax(belief_state.actions(), belief_state.expected_outcome_utility) return program.action ...
def function[DTAgentProgram, parameter[belief_state]]: constant[A decision-theoretic agent. [Fig. 13.1]] def function[program, parameter[percept]]: call[name[belief_state].observe, parameter[name[program].action, name[percept]]] name[program].action assign[=] call[name[ar...
keyword[def] identifier[DTAgentProgram] ( identifier[belief_state] ): literal[string] keyword[def] identifier[program] ( identifier[percept] ): identifier[belief_state] . identifier[observe] ( identifier[program] . identifier[action] , identifier[percept] ) identifier[program] . identifi...
def DTAgentProgram(belief_state): """A decision-theoretic agent. [Fig. 13.1]""" def program(percept): belief_state.observe(program.action, percept) program.action = argmax(belief_state.actions(), belief_state.expected_outcome_utility) return program.action program.action = None ...
def draw_uppercase_key(self, surface, key): """Default drawing method for uppercase key. Drawn as character key. :param surface: Surface background should be drawn in. :param key: Target key to be drawn. """ key.value = u'\u21e7' if key.is_activated(): key.v...
def function[draw_uppercase_key, parameter[self, surface, key]]: constant[Default drawing method for uppercase key. Drawn as character key. :param surface: Surface background should be drawn in. :param key: Target key to be drawn. ] name[key].value assign[=] constant[⇧] ...
keyword[def] identifier[draw_uppercase_key] ( identifier[self] , identifier[surface] , identifier[key] ): literal[string] identifier[key] . identifier[value] = literal[string] keyword[if] identifier[key] . identifier[is_activated] (): identifier[key] . identifier[value] = li...
def draw_uppercase_key(self, surface, key): """Default drawing method for uppercase key. Drawn as character key. :param surface: Surface background should be drawn in. :param key: Target key to be drawn. """ key.value = u'⇧' if key.is_activated(): key.value = u'⇪' # depends...
def _get_same_codes(self): """get SAME codes, load into a dict and cache""" same = {} url = '''http://www.nws.noaa.gov/nwr/data/SameCode.txt''' # pylint: disable=E1103 raw = requests.get(url).content.decode('utf-8') # py3 compatibility for row in raw.split('\n'): ...
def function[_get_same_codes, parameter[self]]: constant[get SAME codes, load into a dict and cache] variable[same] assign[=] dictionary[[], []] variable[url] assign[=] constant[http://www.nws.noaa.gov/nwr/data/SameCode.txt] variable[raw] assign[=] call[call[name[requests].get, parameter...
keyword[def] identifier[_get_same_codes] ( identifier[self] ): literal[string] identifier[same] ={} identifier[url] = literal[string] identifier[raw] = identifier[requests] . identifier[get] ( identifier[url] ). identifier[content] . identifier[decode] ( literal[string] ...
def _get_same_codes(self): """get SAME codes, load into a dict and cache""" same = {} url = 'http://www.nws.noaa.gov/nwr/data/SameCode.txt' # pylint: disable=E1103 raw = requests.get(url).content.decode('utf-8') # py3 compatibility for row in raw.split('\n'): try: (code, loc...
def out_putfile(self, fpath): """ 輸出成 CSV 檔 :param path fpath: 檔案輸出位置 .. todo:: files output using `with` syntax. """ with open(fpath, 'w') as csv_file: output = csv.writer(csv_file) output.writerows(self.__raw_data)
def function[out_putfile, parameter[self, fpath]]: constant[ 輸出成 CSV 檔 :param path fpath: 檔案輸出位置 .. todo:: files output using `with` syntax. ] with call[name[open], parameter[name[fpath], constant[w]]] begin[:] variable[output] assign[=] call[name[csv].w...
keyword[def] identifier[out_putfile] ( identifier[self] , identifier[fpath] ): literal[string] keyword[with] identifier[open] ( identifier[fpath] , literal[string] ) keyword[as] identifier[csv_file] : identifier[output] = identifier[csv] . identifier[writer] ( identifier[csv_file] ) ...
def out_putfile(self, fpath): """ 輸出成 CSV 檔 :param path fpath: 檔案輸出位置 .. todo:: files output using `with` syntax. """ with open(fpath, 'w') as csv_file: output = csv.writer(csv_file) output.writerows(self.__raw_data) # depends on [control=['with'], data=['csv_f...
def _delete_forever_values(self, forever_key): """ Delete all of the keys that have been stored forever. :type forever_key: str """ forever = self._store.connection().lrange(forever_key, 0, -1) if len(forever) > 0: self._store.connection().delete(*forever)
def function[_delete_forever_values, parameter[self, forever_key]]: constant[ Delete all of the keys that have been stored forever. :type forever_key: str ] variable[forever] assign[=] call[call[name[self]._store.connection, parameter[]].lrange, parameter[name[forever_key], cons...
keyword[def] identifier[_delete_forever_values] ( identifier[self] , identifier[forever_key] ): literal[string] identifier[forever] = identifier[self] . identifier[_store] . identifier[connection] (). identifier[lrange] ( identifier[forever_key] , literal[int] ,- literal[int] ) keyword[if...
def _delete_forever_values(self, forever_key): """ Delete all of the keys that have been stored forever. :type forever_key: str """ forever = self._store.connection().lrange(forever_key, 0, -1) if len(forever) > 0: self._store.connection().delete(*forever) # depends on [con...
def get_raw_data_from_url(pdb_id, reduced=False): """" Get the msgpack unpacked data given a PDB id. :param pdb_id: the input PDB id :return the unpacked data (a dict) """ url = get_url(pdb_id,reduced) request = urllib2.Request(url) request.add_header('Accept-encoding', 'gzip') response = u...
def function[get_raw_data_from_url, parameter[pdb_id, reduced]]: constant[" Get the msgpack unpacked data given a PDB id. :param pdb_id: the input PDB id :return the unpacked data (a dict) ] variable[url] assign[=] call[name[get_url], parameter[name[pdb_id], name[reduced]]] variable[req...
keyword[def] identifier[get_raw_data_from_url] ( identifier[pdb_id] , identifier[reduced] = keyword[False] ): literal[string] identifier[url] = identifier[get_url] ( identifier[pdb_id] , identifier[reduced] ) identifier[request] = identifier[urllib2] . identifier[Request] ( identifier[url] ) iden...
def get_raw_data_from_url(pdb_id, reduced=False): """" Get the msgpack unpacked data given a PDB id. :param pdb_id: the input PDB id :return the unpacked data (a dict) """ url = get_url(pdb_id, reduced) request = urllib2.Request(url) request.add_header('Accept-encoding', 'gzip') response = ...
def pyeapi_config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): ''' .. versionadded:: 2019.2.0 Configures the Arista switch with th...
def function[pyeapi_config, parameter[commands, config_file, template_engine, context, defaults, saltenv]]: constant[ .. versionadded:: 2019.2.0 Configures the Arista switch with the specified commands, via the ``pyeapi`` library. This function forwards the existing connection details to the :m...
keyword[def] identifier[pyeapi_config] ( identifier[commands] = keyword[None] , identifier[config_file] = keyword[None] , identifier[template_engine] = literal[string] , identifier[context] = keyword[None] , identifier[defaults] = keyword[None] , identifier[saltenv] = literal[string] , ** identifier[kwargs] ): ...
def pyeapi_config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): """ .. versionadded:: 2019.2.0 Configures the Arista switch with the specified commands, via the ``pyeapi`` library. This function forwards the existing connection details...
def peak_generation_per_technology(self): """ Peak generation of each technology in the grid Returns ------- :pandas:`pandas.Series<series>` Peak generation index by technology """ peak_generation = defaultdict(float) for gen in self.generator...
def function[peak_generation_per_technology, parameter[self]]: constant[ Peak generation of each technology in the grid Returns ------- :pandas:`pandas.Series<series>` Peak generation index by technology ] variable[peak_generation] assign[=] call[name...
keyword[def] identifier[peak_generation_per_technology] ( identifier[self] ): literal[string] identifier[peak_generation] = identifier[defaultdict] ( identifier[float] ) keyword[for] identifier[gen] keyword[in] identifier[self] . identifier[generators] : identifier[peak_gen...
def peak_generation_per_technology(self): """ Peak generation of each technology in the grid Returns ------- :pandas:`pandas.Series<series>` Peak generation index by technology """ peak_generation = defaultdict(float) for gen in self.generators: p...
def roc_auc(model, X, y=None, ax=None, **kwargs): """ROCAUC Quick method: Receiver Operating Characteristic (ROC) curves are a measure of a classifier's predictive quality that compares and visualizes the tradeoff between the models' sensitivity and specificity. The ROC curve displays the true posi...
def function[roc_auc, parameter[model, X, y, ax]]: constant[ROCAUC Quick method: Receiver Operating Characteristic (ROC) curves are a measure of a classifier's predictive quality that compares and visualizes the tradeoff between the models' sensitivity and specificity. The ROC curve displays th...
keyword[def] identifier[roc_auc] ( identifier[model] , identifier[X] , identifier[y] = keyword[None] , identifier[ax] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[visualizer] = identifier[ROCAUC] ( identifier[model] , identifier[ax] ,** identifier[kwargs] ) identifie...
def roc_auc(model, X, y=None, ax=None, **kwargs): """ROCAUC Quick method: Receiver Operating Characteristic (ROC) curves are a measure of a classifier's predictive quality that compares and visualizes the tradeoff between the models' sensitivity and specificity. The ROC curve displays the true posi...
def keep(self, diff): """ Mark this diff (or volume) to be kept in path. """ self._keepVol(diff.toVol) self._keepVol(diff.fromVol)
def function[keep, parameter[self, diff]]: constant[ Mark this diff (or volume) to be kept in path. ] call[name[self]._keepVol, parameter[name[diff].toVol]] call[name[self]._keepVol, parameter[name[diff].fromVol]]
keyword[def] identifier[keep] ( identifier[self] , identifier[diff] ): literal[string] identifier[self] . identifier[_keepVol] ( identifier[diff] . identifier[toVol] ) identifier[self] . identifier[_keepVol] ( identifier[diff] . identifier[fromVol] )
def keep(self, diff): """ Mark this diff (or volume) to be kept in path. """ self._keepVol(diff.toVol) self._keepVol(diff.fromVol)
def _init_object(self, catalog_id, proxy, runtime, cat_name, cat_class): """Initialize this object as an OsidObject....do we need this?? From the Mongo learning impl, but seems unnecessary for Handcar""" self._catalog_identifier = None self._init_proxy_and_runtime(proxy, runtime) ...
def function[_init_object, parameter[self, catalog_id, proxy, runtime, cat_name, cat_class]]: constant[Initialize this object as an OsidObject....do we need this?? From the Mongo learning impl, but seems unnecessary for Handcar] name[self]._catalog_identifier assign[=] constant[None] cal...
keyword[def] identifier[_init_object] ( identifier[self] , identifier[catalog_id] , identifier[proxy] , identifier[runtime] , identifier[cat_name] , identifier[cat_class] ): literal[string] identifier[self] . identifier[_catalog_identifier] = keyword[None] identifier[self] . identifier[_i...
def _init_object(self, catalog_id, proxy, runtime, cat_name, cat_class): """Initialize this object as an OsidObject....do we need this?? From the Mongo learning impl, but seems unnecessary for Handcar""" self._catalog_identifier = None self._init_proxy_and_runtime(proxy, runtime) self._catalog =...
def _locals(self, d): """Create a new :class:`.Context` with a copy of this :class:`.Context`'s current state, updated with the given dictionary. The :attr:`.Context.kwargs` collection remains unaffected. """ if not d: return self c = self....
def function[_locals, parameter[self, d]]: constant[Create a new :class:`.Context` with a copy of this :class:`.Context`'s current state, updated with the given dictionary. The :attr:`.Context.kwargs` collection remains unaffected. ] if <ast.UnaryOp object at 0...
keyword[def] identifier[_locals] ( identifier[self] , identifier[d] ): literal[string] keyword[if] keyword[not] identifier[d] : keyword[return] identifier[self] identifier[c] = identifier[self] . identifier[_copy] () identifier[c] . identifier[_data] . identifier...
def _locals(self, d): """Create a new :class:`.Context` with a copy of this :class:`.Context`'s current state, updated with the given dictionary. The :attr:`.Context.kwargs` collection remains unaffected. """ if not d: return self # depends on [control=['if'],...
def join_tags(tags): """ Given list of ``Tag`` instances, creates a string representation of the list suitable for editing by the user, such that submitting the given string representation back without changing it will give the same list of tags. Tag names which contain DELIMITER will be double...
def function[join_tags, parameter[tags]]: constant[ Given list of ``Tag`` instances, creates a string representation of the list suitable for editing by the user, such that submitting the given string representation back without changing it will give the same list of tags. Tag names which c...
keyword[def] identifier[join_tags] ( identifier[tags] ): literal[string] identifier[names] =[] identifier[delimiter] = identifier[settings] . identifier[TAGGIT_SELECTIZE] [ literal[string] ] keyword[for] identifier[tag] keyword[in] identifier[tags] : identifier[name] = identifier[tag]...
def join_tags(tags): """ Given list of ``Tag`` instances, creates a string representation of the list suitable for editing by the user, such that submitting the given string representation back without changing it will give the same list of tags. Tag names which contain DELIMITER will be double...
def _cache_get_entry(self, entry_name, key=ENTIRE_ENTRY_KEY, default=False): """Returns cache entry parameter value by its name. :param str entry_name: :param str key: :param type default: :return: """ if key is self.ENTIRE_ENTRY_KEY: return self._cac...
def function[_cache_get_entry, parameter[self, entry_name, key, default]]: constant[Returns cache entry parameter value by its name. :param str entry_name: :param str key: :param type default: :return: ] if compare[name[key] is name[self].ENTIRE_ENTRY_KEY] begin[...
keyword[def] identifier[_cache_get_entry] ( identifier[self] , identifier[entry_name] , identifier[key] = identifier[ENTIRE_ENTRY_KEY] , identifier[default] = keyword[False] ): literal[string] keyword[if] identifier[key] keyword[is] identifier[self] . identifier[ENTIRE_ENTRY_KEY] : ...
def _cache_get_entry(self, entry_name, key=ENTIRE_ENTRY_KEY, default=False): """Returns cache entry parameter value by its name. :param str entry_name: :param str key: :param type default: :return: """ if key is self.ENTIRE_ENTRY_KEY: return self._cache[entry_nam...
def _read_proc_file(path, opts): ''' Return a dict of JID metadata, or None ''' serial = salt.payload.Serial(opts) current_thread = threading.currentThread().name pid = os.getpid() with salt.utils.files.fopen(path, 'rb') as fp_: buf = fp_.read() fp_.close() if buf: ...
def function[_read_proc_file, parameter[path, opts]]: constant[ Return a dict of JID metadata, or None ] variable[serial] assign[=] call[name[salt].payload.Serial, parameter[name[opts]]] variable[current_thread] assign[=] call[name[threading].currentThread, parameter[]].name vari...
keyword[def] identifier[_read_proc_file] ( identifier[path] , identifier[opts] ): literal[string] identifier[serial] = identifier[salt] . identifier[payload] . identifier[Serial] ( identifier[opts] ) identifier[current_thread] = identifier[threading] . identifier[currentThread] (). identifier[name] ...
def _read_proc_file(path, opts): """ Return a dict of JID metadata, or None """ serial = salt.payload.Serial(opts) current_thread = threading.currentThread().name pid = os.getpid() with salt.utils.files.fopen(path, 'rb') as fp_: buf = fp_.read() fp_.close() if buf: ...
def get_egrc_config(cli_egrc_path): """ Return a Config namedtuple based on the contents of the egrc. If the egrc is not present, it returns an empty default Config. This method tries to use the egrc at cli_egrc_path, then the default path. cli_egrc_path: the path to the egrc as given on the comm...
def function[get_egrc_config, parameter[cli_egrc_path]]: constant[ Return a Config namedtuple based on the contents of the egrc. If the egrc is not present, it returns an empty default Config. This method tries to use the egrc at cli_egrc_path, then the default path. cli_egrc_path: the path t...
keyword[def] identifier[get_egrc_config] ( identifier[cli_egrc_path] ): literal[string] identifier[resolved_path] = identifier[get_priority] ( identifier[cli_egrc_path] , identifier[DEFAULT_EGRC_PATH] , keyword[None] ) identifier[expanded_path] = identifier[get_expanded_path] ( identifier[resolved_pat...
def get_egrc_config(cli_egrc_path): """ Return a Config namedtuple based on the contents of the egrc. If the egrc is not present, it returns an empty default Config. This method tries to use the egrc at cli_egrc_path, then the default path. cli_egrc_path: the path to the egrc as given on the comm...
def autofit(ts, maxp=5, maxd=2, maxq=5, sc=None): """ Utility function to help in fitting an automatically selected ARIMA model based on approximate Akaike Information Criterion (AIC) values. The model search is based on the heuristic developed by Hyndman and Khandakar (2008) and described in [[http://w...
def function[autofit, parameter[ts, maxp, maxd, maxq, sc]]: constant[ Utility function to help in fitting an automatically selected ARIMA model based on approximate Akaike Information Criterion (AIC) values. The model search is based on the heuristic developed by Hyndman and Khandakar (2008) and des...
keyword[def] identifier[autofit] ( identifier[ts] , identifier[maxp] = literal[int] , identifier[maxd] = literal[int] , identifier[maxq] = literal[int] , identifier[sc] = keyword[None] ): literal[string] keyword[assert] identifier[sc] != keyword[None] , literal[string] identifier[jmodel] = identifi...
def autofit(ts, maxp=5, maxd=2, maxq=5, sc=None): """ Utility function to help in fitting an automatically selected ARIMA model based on approximate Akaike Information Criterion (AIC) values. The model search is based on the heuristic developed by Hyndman and Khandakar (2008) and described in [[http://w...
def dump_csv(data: List[dict], fieldnames: Sequence[str], with_header: bool = False, crlf: bool = False, tsv: bool = False) -> str: """ :param data: :param fieldnames: :param with_header: :param crlf: :param tsv: :return: unicode """ def force_str(v): # XXX: Dou...
def function[dump_csv, parameter[data, fieldnames, with_header, crlf, tsv]]: constant[ :param data: :param fieldnames: :param with_header: :param crlf: :param tsv: :return: unicode ] def function[force_str, parameter[v]]: return[<ast.IfExp object at 0x7da18c4cead0>] ...
keyword[def] identifier[dump_csv] ( identifier[data] : identifier[List] [ identifier[dict] ], identifier[fieldnames] : identifier[Sequence] [ identifier[str] ], identifier[with_header] : identifier[bool] = keyword[False] , identifier[crlf] : identifier[bool] = keyword[False] , identifier[tsv] : identifier[bool] = ke...
def dump_csv(data: List[dict], fieldnames: Sequence[str], with_header: bool=False, crlf: bool=False, tsv: bool=False) -> str: """ :param data: :param fieldnames: :param with_header: :param crlf: :param tsv: :return: unicode """ def force_str(v): # XXX: Double quotation behav...
def benchmark(N, gates): """Create and run a circuit with N qubits and given number of gates""" qubits = list(range(0, N)) ket = qf.zero_state(N) for n in range(0, N): ket = qf.H(n).run(ket) for _ in range(0, (gates-N)//3): qubit0, qubit1 = random.sample(qubits, 2) ket = qf...
def function[benchmark, parameter[N, gates]]: constant[Create and run a circuit with N qubits and given number of gates] variable[qubits] assign[=] call[name[list], parameter[call[name[range], parameter[constant[0], name[N]]]]] variable[ket] assign[=] call[name[qf].zero_state, parameter[name[N]]...
keyword[def] identifier[benchmark] ( identifier[N] , identifier[gates] ): literal[string] identifier[qubits] = identifier[list] ( identifier[range] ( literal[int] , identifier[N] )) identifier[ket] = identifier[qf] . identifier[zero_state] ( identifier[N] ) keyword[for] identifier[n] keyword[i...
def benchmark(N, gates): """Create and run a circuit with N qubits and given number of gates""" qubits = list(range(0, N)) ket = qf.zero_state(N) for n in range(0, N): ket = qf.H(n).run(ket) # depends on [control=['for'], data=['n']] for _ in range(0, (gates - N) // 3): (qubit0, qub...
def check_online(stream): """ Used to check user's online opponents and show their online/offline status on page on init """ while True: packet = yield from stream.get() session_id = packet.get('session_key') opponent_username = packet.get('username') if session_i...
def function[check_online, parameter[stream]]: constant[ Used to check user's online opponents and show their online/offline status on page on init ] while constant[True] begin[:] variable[packet] assign[=] <ast.YieldFrom object at 0x7da20e963b80> variable[session...
keyword[def] identifier[check_online] ( identifier[stream] ): literal[string] keyword[while] keyword[True] : identifier[packet] = keyword[yield] keyword[from] identifier[stream] . identifier[get] () identifier[session_id] = identifier[packet] . identifier[get] ( literal[string] ) ...
def check_online(stream): """ Used to check user's online opponents and show their online/offline status on page on init """ while True: packet = (yield from stream.get()) session_id = packet.get('session_key') opponent_username = packet.get('username') if session_id and ...
def _try_cast(self, result, obj, numeric_only=False): """ Try to cast the result to our obj original type, we may have roundtripped through object in the mean-time. If numeric_only is True, then only try to cast numerics and not datetimelikes. """ if obj.ndim > ...
def function[_try_cast, parameter[self, result, obj, numeric_only]]: constant[ Try to cast the result to our obj original type, we may have roundtripped through object in the mean-time. If numeric_only is True, then only try to cast numerics and not datetimelikes. ] ...
keyword[def] identifier[_try_cast] ( identifier[self] , identifier[result] , identifier[obj] , identifier[numeric_only] = keyword[False] ): literal[string] keyword[if] identifier[obj] . identifier[ndim] > literal[int] : identifier[dtype] = identifier[obj] . identifier[_values] . ident...
def _try_cast(self, result, obj, numeric_only=False): """ Try to cast the result to our obj original type, we may have roundtripped through object in the mean-time. If numeric_only is True, then only try to cast numerics and not datetimelikes. """ if obj.ndim > 1: ...
def getSubstituteType(self, elt, ps): '''if xsi:type does not match the instance type attr, check to see if it is a derived type substitution. DONT Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap ob...
def function[getSubstituteType, parameter[self, elt, ps]]: constant[if xsi:type does not match the instance type attr, check to see if it is a derived type substitution. DONT Return the element's type. Parameters: elt -- the DOM element being parsed ...
keyword[def] identifier[getSubstituteType] ( identifier[self] , identifier[elt] , identifier[ps] ): literal[string] identifier[pyclass] = identifier[SchemaInstanceType] . identifier[getTypeDefinition] (* identifier[self] . identifier[type] ) keyword[if] identifier[pyclass] keyword[is] k...
def getSubstituteType(self, elt, ps): """if xsi:type does not match the instance type attr, check to see if it is a derived type substitution. DONT Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object...
def config_dir(self): """ Returns the configuration directory """ home = expanduser('~') config_dir = os.path.join(home, '.jackal') return config_dir
def function[config_dir, parameter[self]]: constant[ Returns the configuration directory ] variable[home] assign[=] call[name[expanduser], parameter[constant[~]]] variable[config_dir] assign[=] call[name[os].path.join, parameter[name[home], constant[.jackal]]] return[name...
keyword[def] identifier[config_dir] ( identifier[self] ): literal[string] identifier[home] = identifier[expanduser] ( literal[string] ) identifier[config_dir] = identifier[os] . identifier[path] . identifier[join] ( identifier[home] , literal[string] ) keyword[return] identifier[...
def config_dir(self): """ Returns the configuration directory """ home = expanduser('~') config_dir = os.path.join(home, '.jackal') return config_dir
def uuid4(self): """Make an id in the format of UUID4, but keep in mind this could very well be pseudorandom, and if it is you'll not be truely random, and can regenerate same id if same seed""" return ''.join([hexchars[self.randint(0,15)] for x in range(0,8)]) + '-' +\ ''.join([hexchars[self.randint...
def function[uuid4, parameter[self]]: constant[Make an id in the format of UUID4, but keep in mind this could very well be pseudorandom, and if it is you'll not be truely random, and can regenerate same id if same seed] return[binary_operation[binary_operation[binary_operation[binary_operation[binary_operat...
keyword[def] identifier[uuid4] ( identifier[self] ): literal[string] keyword[return] literal[string] . identifier[join] ([ identifier[hexchars] [ identifier[self] . identifier[randint] ( literal[int] , literal[int] )] keyword[for] identifier[x] keyword[in] identifier[range] ( literal[int] , literal[int...
def uuid4(self): """Make an id in the format of UUID4, but keep in mind this could very well be pseudorandom, and if it is you'll not be truely random, and can regenerate same id if same seed""" return ''.join([hexchars[self.randint(0, 15)] for x in range(0, 8)]) + '-' + ''.join([hexchars[self.randint(0, 15)] f...
def compare(left, right, left_label='left', right_label='right', drop_close=True, **kwargs): """Compare the data in two IamDataFrames and return a pd.DataFrame Parameters ---------- left, right: IamDataFrames the IamDataFrames to be compared left_label, right_label: str, default...
def function[compare, parameter[left, right, left_label, right_label, drop_close]]: constant[Compare the data in two IamDataFrames and return a pd.DataFrame Parameters ---------- left, right: IamDataFrames the IamDataFrames to be compared left_label, right_label: str, default `left`, `r...
keyword[def] identifier[compare] ( identifier[left] , identifier[right] , identifier[left_label] = literal[string] , identifier[right_label] = literal[string] , identifier[drop_close] = keyword[True] ,** identifier[kwargs] ): literal[string] identifier[ret] = identifier[pd] . identifier[concat] ({ identif...
def compare(left, right, left_label='left', right_label='right', drop_close=True, **kwargs): """Compare the data in two IamDataFrames and return a pd.DataFrame Parameters ---------- left, right: IamDataFrames the IamDataFrames to be compared left_label, right_label: str, default `left`, `ri...
def map_to_regions(regions, values): r""" Maps pore values from a network onto the image from which it was extracted This function assumes that the pore numbering in the network has remained unchanged from the region labels in the partitioned image. Parameters ---------- regions : ND-array...
def function[map_to_regions, parameter[regions, values]]: constant[ Maps pore values from a network onto the image from which it was extracted This function assumes that the pore numbering in the network has remained unchanged from the region labels in the partitioned image. Parameters ---...
keyword[def] identifier[map_to_regions] ( identifier[regions] , identifier[values] ): literal[string] identifier[values] = identifier[sp] . identifier[array] ( identifier[values] ). identifier[flatten] () keyword[if] identifier[sp] . identifier[size] ( identifier[values] )!= identifier[regions] . ide...
def map_to_regions(regions, values): """ Maps pore values from a network onto the image from which it was extracted This function assumes that the pore numbering in the network has remained unchanged from the region labels in the partitioned image. Parameters ---------- regions : ND-array ...
def write_event(self, event): """Writes an event proto to disk. This method is threadsafe with respect to invocations of itself. Args: event: The event proto. Raises: IOError: If writing the event proto to disk fails. """ self._lock.acquire() try: self._events_writer.Wri...
def function[write_event, parameter[self, event]]: constant[Writes an event proto to disk. This method is threadsafe with respect to invocations of itself. Args: event: The event proto. Raises: IOError: If writing the event proto to disk fails. ] call[name[self]._lock.acqu...
keyword[def] identifier[write_event] ( identifier[self] , identifier[event] ): literal[string] identifier[self] . identifier[_lock] . identifier[acquire] () keyword[try] : identifier[self] . identifier[_events_writer] . identifier[WriteEvent] ( identifier[event] ) identifier[self] . iden...
def write_event(self, event): """Writes an event proto to disk. This method is threadsafe with respect to invocations of itself. Args: event: The event proto. Raises: IOError: If writing the event proto to disk fails. """ self._lock.acquire() try: self._events_writer.W...
def _getLayers(self): """ gets layers for the featuer service """ params = {"f": "json"} json_dict = self._get(self._url, params, securityHandler=self._securityHandler, proxy_url=self._proxy_url, ...
def function[_getLayers, parameter[self]]: constant[ gets layers for the featuer service ] variable[params] assign[=] dictionary[[<ast.Constant object at 0x7da1b12284c0>], [<ast.Constant object at 0x7da1b1228790>]] variable[json_dict] assign[=] call[name[self]._get, parameter[name[self]._url, na...
keyword[def] identifier[_getLayers] ( identifier[self] ): literal[string] identifier[params] ={ literal[string] : literal[string] } identifier[json_dict] = identifier[self] . identifier[_get] ( identifier[self] . identifier[_url] , identifier[params] , identifier[securityHandler]...
def _getLayers(self): """ gets layers for the featuer service """ params = {'f': 'json'} json_dict = self._get(self._url, params, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port) self._layers = [] if 'layers' in json_dict: for l in json_dict['lay...
def data_discovery(self, region, keywords=None, regex=None, time=None, boundaries=None, include_quantiles=False): """Discover Data Observatory measures. This method returns the full Data Observatory metadata model for each measure or measures that match the conditions from...
def function[data_discovery, parameter[self, region, keywords, regex, time, boundaries, include_quantiles]]: constant[Discover Data Observatory measures. This method returns the full Data Observatory metadata model for each measure or measures that match the conditions from the inputs. The full ...
keyword[def] identifier[data_discovery] ( identifier[self] , identifier[region] , identifier[keywords] = keyword[None] , identifier[regex] = keyword[None] , identifier[time] = keyword[None] , identifier[boundaries] = keyword[None] , identifier[include_quantiles] = keyword[False] ): literal[string] ...
def data_discovery(self, region, keywords=None, regex=None, time=None, boundaries=None, include_quantiles=False): """Discover Data Observatory measures. This method returns the full Data Observatory metadata model for each measure or measures that match the conditions from the inputs. The full metad...
def destroy_sns_event(app_name, env, region): """ Destroy all Lambda SNS subscriptions. Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function Returns: boolean: True if subscriptio...
def function[destroy_sns_event, parameter[app_name, env, region]]: constant[ Destroy all Lambda SNS subscriptions. Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function Returns: ...
keyword[def] identifier[destroy_sns_event] ( identifier[app_name] , identifier[env] , identifier[region] ): literal[string] identifier[session] = identifier[boto3] . identifier[Session] ( identifier[profile_name] = identifier[env] , identifier[region_name] = identifier[region] ) identifier[sns_client]...
def destroy_sns_event(app_name, env, region): """ Destroy all Lambda SNS subscriptions. Args: app_name (str): name of the lambda function env (str): Environment/Account for lambda function region (str): AWS region of the lambda function Returns: boolean: True if subscriptio...
def as_iso8601(self): """ example: 00:38:05.210Z """ if self.__time is None: return None return "%s:%s:%s0Z" % (self.__time[:2], self.__time[2:4], self.__time[4:])
def function[as_iso8601, parameter[self]]: constant[ example: 00:38:05.210Z ] if compare[name[self].__time is constant[None]] begin[:] return[constant[None]] return[binary_operation[constant[%s:%s:%s0Z] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Subscript object at 0x7da1...
keyword[def] identifier[as_iso8601] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[__time] keyword[is] keyword[None] : keyword[return] keyword[None] keyword[return] literal[string] %( identifier[self] . identifier[__time] [: literal[int]...
def as_iso8601(self): """ example: 00:38:05.210Z """ if self.__time is None: return None # depends on [control=['if'], data=[]] return '%s:%s:%s0Z' % (self.__time[:2], self.__time[2:4], self.__time[4:])
def query_job_status(self, submissionid): """ Queries vmray to check id a job was :param submissionid: ID of the job/submission :type submissionid: int :returns: True if job finished, false if not :rtype: bool """ apiurl = '/rest/submission/' ...
def function[query_job_status, parameter[self, submissionid]]: constant[ Queries vmray to check id a job was :param submissionid: ID of the job/submission :type submissionid: int :returns: True if job finished, false if not :rtype: bool ] variabl...
keyword[def] identifier[query_job_status] ( identifier[self] , identifier[submissionid] ): literal[string] identifier[apiurl] = literal[string] identifier[result] = identifier[self] . identifier[session] . identifier[get] ( literal[string] . identifier[format] ( identifier[self] . identi...
def query_job_status(self, submissionid): """ Queries vmray to check id a job was :param submissionid: ID of the job/submission :type submissionid: int :returns: True if job finished, false if not :rtype: bool """ apiurl = '/rest/submission/' result ...
def to_bytes(self): """Serialize the binder's annotations into a byte string.""" for tokens in self.tokens: assert len(tokens.shape) == 2, tokens.shape lengths = [len(tokens) for tokens in self.tokens] msg = { "attrs": self.attrs, "tokens": numpy.vstac...
def function[to_bytes, parameter[self]]: constant[Serialize the binder's annotations into a byte string.] for taget[name[tokens]] in starred[name[self].tokens] begin[:] assert[compare[call[name[len], parameter[name[tokens].shape]] equal[==] constant[2]]] variable[lengths] assign[=] <ast....
keyword[def] identifier[to_bytes] ( identifier[self] ): literal[string] keyword[for] identifier[tokens] keyword[in] identifier[self] . identifier[tokens] : keyword[assert] identifier[len] ( identifier[tokens] . identifier[shape] )== literal[int] , identifier[tokens] . identifier[sh...
def to_bytes(self): """Serialize the binder's annotations into a byte string.""" for tokens in self.tokens: assert len(tokens.shape) == 2, tokens.shape # depends on [control=['for'], data=['tokens']] lengths = [len(tokens) for tokens in self.tokens] msg = {'attrs': self.attrs, 'tokens': numpy.v...
def symb_to_block(symb, coupling = 'full'): """ Maps a symbolic factorization to a block-diagonal structure with coupling constraints. :param symb: :py:class:`symbolic` :param coupling: optional :return dims: list of block dimensions :return sparse_to_b...
def function[symb_to_block, parameter[symb, coupling]]: constant[ Maps a symbolic factorization to a block-diagonal structure with coupling constraints. :param symb: :py:class:`symbolic` :param coupling: optional :return dims: list of block dimensions ...
keyword[def] identifier[symb_to_block] ( identifier[symb] , identifier[coupling] = literal[string] ): literal[string] identifier[n] = identifier[len] ( identifier[symb] . identifier[snode] ) identifier[Ncliques] = identifier[len] ( identifier[symb] . identifier[snpar] ) identifier[dims] =[...
def symb_to_block(symb, coupling='full'): """ Maps a symbolic factorization to a block-diagonal structure with coupling constraints. :param symb: :py:class:`symbolic` :param coupling: optional :return dims: list of block dimensions :return sparse_to_blo...
def initialize(): """Initialize the application configuration, adding any missing default configuration or roles Returns: `None` """ global __initialized if __initialized: return # Setup all the default base settings try: for data in DEFAULT_CONFIG_OPTIONS: ...
def function[initialize, parameter[]]: constant[Initialize the application configuration, adding any missing default configuration or roles Returns: `None` ] <ast.Global object at 0x7da1b20aa680> if name[__initialized] begin[:] return[None] <ast.Try object at 0x7da1b20a9...
keyword[def] identifier[initialize] (): literal[string] keyword[global] identifier[__initialized] keyword[if] identifier[__initialized] : keyword[return] keyword[try] : keyword[for] identifier[data] keyword[in] identifier[DEFAULT_CONFIG_OPTIONS] : ...
def initialize(): """Initialize the application configuration, adding any missing default configuration or roles Returns: `None` """ global __initialized if __initialized: return # depends on [control=['if'], data=[]] # Setup all the default base settings try: for d...
def split_bodies(dataset, label=False): """Find, label, and split connected bodies/volumes. This splits different connected bodies into blocks in a MultiBlock dataset. Parameters ---------- label : bool A flag on whether to keep the ID arrays given by the ...
def function[split_bodies, parameter[dataset, label]]: constant[Find, label, and split connected bodies/volumes. This splits different connected bodies into blocks in a MultiBlock dataset. Parameters ---------- label : bool A flag on whether to keep the ID arrays giv...
keyword[def] identifier[split_bodies] ( identifier[dataset] , identifier[label] = keyword[False] ): literal[string] identifier[labeled] = identifier[dataset] . identifier[connectivity] () identifier[classifier] = identifier[labeled] . identifier[cell_arrays] [ literal[string] ] ...
def split_bodies(dataset, label=False): """Find, label, and split connected bodies/volumes. This splits different connected bodies into blocks in a MultiBlock dataset. Parameters ---------- label : bool A flag on whether to keep the ID arrays given by the ``c...
def plot_periodicvar_recovery_results( precvar_results, aliases_count_as_recovered=None, magbins=None, periodbins=None, amplitudebins=None, ndetbins=None, minbinsize=1, plotfile_ext='png', ): '''This plots the results of periodic var recovery. Thi...
def function[plot_periodicvar_recovery_results, parameter[precvar_results, aliases_count_as_recovered, magbins, periodbins, amplitudebins, ndetbins, minbinsize, plotfile_ext]]: constant[This plots the results of periodic var recovery. This function makes plots for periodicvar recovered fraction as a functi...
keyword[def] identifier[plot_periodicvar_recovery_results] ( identifier[precvar_results] , identifier[aliases_count_as_recovered] = keyword[None] , identifier[magbins] = keyword[None] , identifier[periodbins] = keyword[None] , identifier[amplitudebins] = keyword[None] , identifier[ndetbins] = keyword[None] , i...
def plot_periodicvar_recovery_results(precvar_results, aliases_count_as_recovered=None, magbins=None, periodbins=None, amplitudebins=None, ndetbins=None, minbinsize=1, plotfile_ext='png'): """This plots the results of periodic var recovery. This function makes plots for periodicvar recovered fraction as a func...
def start(endpoint='data.logentries.com', port=10000, token=None, tag='salt/engines/logentries'): ''' Listen to salt events and forward them to Logentries ''' if __opts__.get('id').endswith('_master'): event_bus = salt.utils.event.get_master_event( __opt...
def function[start, parameter[endpoint, port, token, tag]]: constant[ Listen to salt events and forward them to Logentries ] if call[call[name[__opts__].get, parameter[constant[id]]].endswith, parameter[constant[_master]]] begin[:] variable[event_bus] assign[=] call[name[salt].ut...
keyword[def] identifier[start] ( identifier[endpoint] = literal[string] , identifier[port] = literal[int] , identifier[token] = keyword[None] , identifier[tag] = literal[string] ): literal[string] keyword[if] identifier[__opts__] . identifier[get] ( literal[string] ). identifier[endswith] ( literal[str...
def start(endpoint='data.logentries.com', port=10000, token=None, tag='salt/engines/logentries'): """ Listen to salt events and forward them to Logentries """ if __opts__.get('id').endswith('_master'): event_bus = salt.utils.event.get_master_event(__opts__, __opts__['sock_dir'], listen=True) # ...
def run(self): """ Run the command """ device = self.model_config.torch_device() env = self.vec_env_factory.instantiate_single(preset='record', seed=self.model_config.seed) model = self.model_factory.instantiate(action_space=env.action_space).to(device) training_info = Training...
def function[run, parameter[self]]: constant[ Run the command ] variable[device] assign[=] call[name[self].model_config.torch_device, parameter[]] variable[env] assign[=] call[name[self].vec_env_factory.instantiate_single, parameter[]] variable[model] assign[=] call[call[name[self].model...
keyword[def] identifier[run] ( identifier[self] ): literal[string] identifier[device] = identifier[self] . identifier[model_config] . identifier[torch_device] () identifier[env] = identifier[self] . identifier[vec_env_factory] . identifier[instantiate_single] ( identifier[preset] = litera...
def run(self): """ Run the command """ device = self.model_config.torch_device() env = self.vec_env_factory.instantiate_single(preset='record', seed=self.model_config.seed) model = self.model_factory.instantiate(action_space=env.action_space).to(device) training_info = TrainingInfo(start_epoch_idx=s...
def move(self, particle, u, v, w, modelTimestep, **kwargs): # If the particle is settled, don't move it anywhere if particle.settled: return { 'u': 0, 'v': 0, 'w': 0 } # If the particle is halted (but not settled), don't move it anywhere if particle.halted: retu...
def function[move, parameter[self, particle, u, v, w, modelTimestep]]: if name[particle].settled begin[:] return[dictionary[[<ast.Constant object at 0x7da1b28f0fa0>, <ast.Constant object at 0x7da1b28f26e0>, <ast.Constant object at 0x7da1b28f2b60>], [<ast.Constant object at 0x7da1b28f2800>, <ast.Constant...
keyword[def] identifier[move] ( identifier[self] , identifier[particle] , identifier[u] , identifier[v] , identifier[w] , identifier[modelTimestep] ,** identifier[kwargs] ): keyword[if] identifier[particle] . identifier[settled] : keyword[return] { literal[string] : literal[int] , literal[str...
def move(self, particle, u, v, w, modelTimestep, **kwargs): # If the particle is settled, don't move it anywhere if particle.settled: return {'u': 0, 'v': 0, 'w': 0} # depends on [control=['if'], data=[]] # If the particle is halted (but not settled), don't move it anywhere if particle.halted: ...
def centroid_2dg(data, error=None, mask=None): """ Calculate the centroid of a 2D array by fitting a 2D Gaussian (plus a constant) to the array. Invalid values (e.g. NaNs or infs) in the ``data`` or ``error`` arrays are automatically masked. The mask for invalid values represents the combinati...
def function[centroid_2dg, parameter[data, error, mask]]: constant[ Calculate the centroid of a 2D array by fitting a 2D Gaussian (plus a constant) to the array. Invalid values (e.g. NaNs or infs) in the ``data`` or ``error`` arrays are automatically masked. The mask for invalid values rep...
keyword[def] identifier[centroid_2dg] ( identifier[data] , identifier[error] = keyword[None] , identifier[mask] = keyword[None] ): literal[string] identifier[gfit] = identifier[fit_2dgaussian] ( identifier[data] , identifier[error] = identifier[error] , identifier[mask] = identifier[mask] ) keyword[...
def centroid_2dg(data, error=None, mask=None): """ Calculate the centroid of a 2D array by fitting a 2D Gaussian (plus a constant) to the array. Invalid values (e.g. NaNs or infs) in the ``data`` or ``error`` arrays are automatically masked. The mask for invalid values represents the combinati...
def get_go2children_go2obj(go2obj): """Return go2children (set of child GO IDs) for all GO ID keys in go2obj.""" goobjs, altgo2goobj = get_goobjs_altgo2goobj(go2obj) go2children = get_id2children(goobjs) add_alt_goids(go2children, altgo2goobj) return go2children
def function[get_go2children_go2obj, parameter[go2obj]]: constant[Return go2children (set of child GO IDs) for all GO ID keys in go2obj.] <ast.Tuple object at 0x7da20e954c70> assign[=] call[name[get_goobjs_altgo2goobj], parameter[name[go2obj]]] variable[go2children] assign[=] call[name[get_id2ch...
keyword[def] identifier[get_go2children_go2obj] ( identifier[go2obj] ): literal[string] identifier[goobjs] , identifier[altgo2goobj] = identifier[get_goobjs_altgo2goobj] ( identifier[go2obj] ) identifier[go2children] = identifier[get_id2children] ( identifier[goobjs] ) identifier[add_alt_goids] (...
def get_go2children_go2obj(go2obj): """Return go2children (set of child GO IDs) for all GO ID keys in go2obj.""" (goobjs, altgo2goobj) = get_goobjs_altgo2goobj(go2obj) go2children = get_id2children(goobjs) add_alt_goids(go2children, altgo2goobj) return go2children
def global_position_int_cov_send(self, time_boot_ms, time_utc, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance, force_mavlink1=False): ''' The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (right-handed, Z-u...
def function[global_position_int_cov_send, parameter[self, time_boot_ms, time_utc, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance, force_mavlink1]]: constant[ The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (righ...
keyword[def] identifier[global_position_int_cov_send] ( identifier[self] , identifier[time_boot_ms] , identifier[time_utc] , identifier[estimator_type] , identifier[lat] , identifier[lon] , identifier[alt] , identifier[relative_alt] , identifier[vx] , identifier[vy] , identifier[vz] , identifier[covariance] , identif...
def global_position_int_cov_send(self, time_boot_ms, time_utc, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance, force_mavlink1=False): """ The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (right-handed, Z-up). It is ...
def returnAllChips(self,extname=None,exclude=None): """ Returns a list containing all the chips which match the extname given minus those specified for exclusion (if any). """ extensions = self._findExtnames(extname=extname,exclude=exclude) chiplist = [] for i in rang...
def function[returnAllChips, parameter[self, extname, exclude]]: constant[ Returns a list containing all the chips which match the extname given minus those specified for exclusion (if any). ] variable[extensions] assign[=] call[name[self]._findExtnames, parameter[]] variable...
keyword[def] identifier[returnAllChips] ( identifier[self] , identifier[extname] = keyword[None] , identifier[exclude] = keyword[None] ): literal[string] identifier[extensions] = identifier[self] . identifier[_findExtnames] ( identifier[extname] = identifier[extname] , identifier[exclude] = identif...
def returnAllChips(self, extname=None, exclude=None): """ Returns a list containing all the chips which match the extname given minus those specified for exclusion (if any). """ extensions = self._findExtnames(extname=extname, exclude=exclude) chiplist = [] for i in range(1, self._ne...
def get_first_defined(data, keys, default_value=None): """ Get the first defined key in data. :param data: :type data: :param keys: :type keys: :param default_value: :type default_value: :return: :rtype: """ for key in keys: if key in data: return data...
def function[get_first_defined, parameter[data, keys, default_value]]: constant[ Get the first defined key in data. :param data: :type data: :param keys: :type keys: :param default_value: :type default_value: :return: :rtype: ] for taget[name[key]] in starred[name...
keyword[def] identifier[get_first_defined] ( identifier[data] , identifier[keys] , identifier[default_value] = keyword[None] ): literal[string] keyword[for] identifier[key] keyword[in] identifier[keys] : keyword[if] identifier[key] keyword[in] identifier[data] : keyword[return] ...
def get_first_defined(data, keys, default_value=None): """ Get the first defined key in data. :param data: :type data: :param keys: :type keys: :param default_value: :type default_value: :return: :rtype: """ for key in keys: if key in data: return data...
def remove_vertex(self, vertex): """ Remove vertex from G """ try: self.vertices.pop(vertex) except KeyError: raise GraphInsertError("Vertex %s doesn't exist." % (vertex,)) if vertex in self.nodes: self.nodes.pop(vertex) ...
def function[remove_vertex, parameter[self, vertex]]: constant[ Remove vertex from G ] <ast.Try object at 0x7da204344070> if compare[name[vertex] in name[self].nodes] begin[:] call[name[self].nodes.pop, parameter[name[vertex]]] for taget[name[element]] in star...
keyword[def] identifier[remove_vertex] ( identifier[self] , identifier[vertex] ): literal[string] keyword[try] : identifier[self] . identifier[vertices] . identifier[pop] ( identifier[vertex] ) keyword[except] identifier[KeyError] : keyword[raise] identifie...
def remove_vertex(self, vertex): """ Remove vertex from G """ try: self.vertices.pop(vertex) # depends on [control=['try'], data=[]] except KeyError: raise GraphInsertError("Vertex %s doesn't exist." % (vertex,)) # depends on [control=['except'], data=[]] if vertex in s...
def __create_device(self): """ creates device, internal use only """ # retrieve netengine dictionary from memory or from network device_dict = getattr(self, 'netengine_dict', self.netengine.to_dict()) device = Device() device.node_id = self.node_id device....
def function[__create_device, parameter[self]]: constant[ creates device, internal use only ] variable[device_dict] assign[=] call[name[getattr], parameter[name[self], constant[netengine_dict], call[name[self].netengine.to_dict, parameter[]]]] variable[device] assign[=] call[name...
keyword[def] identifier[__create_device] ( identifier[self] ): literal[string] identifier[device_dict] = identifier[getattr] ( identifier[self] , literal[string] , identifier[self] . identifier[netengine] . identifier[to_dict] ()) identifier[device] = identifier[Device] () ...
def __create_device(self): """ creates device, internal use only """ # retrieve netengine dictionary from memory or from network device_dict = getattr(self, 'netengine_dict', self.netengine.to_dict()) device = Device() device.node_id = self.node_id device.name = device_dict['name...
def recipients(self): '''A list of all recipients for this message. ''' cc = self._cc or [] bcc = self._bcc or [] return self._to + cc + bcc
def function[recipients, parameter[self]]: constant[A list of all recipients for this message. ] variable[cc] assign[=] <ast.BoolOp object at 0x7da18eb552d0> variable[bcc] assign[=] <ast.BoolOp object at 0x7da20c7947f0> return[binary_operation[binary_operation[name[self]._to + name[c...
keyword[def] identifier[recipients] ( identifier[self] ): literal[string] identifier[cc] = identifier[self] . identifier[_cc] keyword[or] [] identifier[bcc] = identifier[self] . identifier[_bcc] keyword[or] [] keyword[return] identifier[self] . identifier[_to] + identifier[cc] ...
def recipients(self): """A list of all recipients for this message. """ cc = self._cc or [] bcc = self._bcc or [] return self._to + cc + bcc
def debug_flag(): """Set logging level for entry points.""" logging.basicConfig(format=consts.LOGGING_FORMAT) parser = argparse.ArgumentParser(description=debug_flag.__doc__) add_debug(parser) args, _extra_args = parser.parse_known_args() package, *_ = __package__.split('.') logging.getLog...
def function[debug_flag, parameter[]]: constant[Set logging level for entry points.] call[name[logging].basicConfig, parameter[]] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] call[name[add_debug], parameter[name[parser]]] <ast.Tuple object at 0x7da2...
keyword[def] identifier[debug_flag] (): literal[string] identifier[logging] . identifier[basicConfig] ( identifier[format] = identifier[consts] . identifier[LOGGING_FORMAT] ) identifier[parser] = identifier[argparse] . identifier[ArgumentParser] ( identifier[description] = identifier[debug_flag] . id...
def debug_flag(): """Set logging level for entry points.""" logging.basicConfig(format=consts.LOGGING_FORMAT) parser = argparse.ArgumentParser(description=debug_flag.__doc__) add_debug(parser) (args, _extra_args) = parser.parse_known_args() (package, *_) = __package__.split('.') logging.getL...
def execute_operation(self, method="GET", ops_path="", payload=""): """ Executes a Kubernetes operation using the specified method against a path. This is part of the low-level API. :Parameters: - `method`: The HTTP method to use, defaults to `GET` - `ops_path`: Th...
def function[execute_operation, parameter[self, method, ops_path, payload]]: constant[ Executes a Kubernetes operation using the specified method against a path. This is part of the low-level API. :Parameters: - `method`: The HTTP method to use, defaults to `GET` -...
keyword[def] identifier[execute_operation] ( identifier[self] , identifier[method] = literal[string] , identifier[ops_path] = literal[string] , identifier[payload] = literal[string] ): literal[string] identifier[operation_path_URL] = literal[string] . identifier[join] ([ identifier[self] . identifi...
def execute_operation(self, method='GET', ops_path='', payload=''): """ Executes a Kubernetes operation using the specified method against a path. This is part of the low-level API. :Parameters: - `method`: The HTTP method to use, defaults to `GET` - `ops_path`: The pa...
def update_url(self, url=None): """ Accepts a fully-qualified url. Returns True if successful, False if not successful. """ if not url: raise ValueError("Neither a url or regex was provided to update_url.") post_url = "%s%s" % (self.BASE_URL, url) r = ...
def function[update_url, parameter[self, url]]: constant[ Accepts a fully-qualified url. Returns True if successful, False if not successful. ] if <ast.UnaryOp object at 0x7da1b1b037f0> begin[:] <ast.Raise object at 0x7da1b1b03910> variable[post_url] assign[=] bin...
keyword[def] identifier[update_url] ( identifier[self] , identifier[url] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[url] : keyword[raise] identifier[ValueError] ( literal[string] ) identifier[post_url] = literal[string] %( identifier[self] . iden...
def update_url(self, url=None): """ Accepts a fully-qualified url. Returns True if successful, False if not successful. """ if not url: raise ValueError('Neither a url or regex was provided to update_url.') # depends on [control=['if'], data=[]] post_url = '%s%s' % (self.BAS...
def set_gateway(self, gateway): ''' :param crabpy.gateway.capakey.CapakeyGateway gateway: Gateway to use. ''' self.gateway = gateway self.sectie.set_gateway(gateway)
def function[set_gateway, parameter[self, gateway]]: constant[ :param crabpy.gateway.capakey.CapakeyGateway gateway: Gateway to use. ] name[self].gateway assign[=] name[gateway] call[name[self].sectie.set_gateway, parameter[name[gateway]]]
keyword[def] identifier[set_gateway] ( identifier[self] , identifier[gateway] ): literal[string] identifier[self] . identifier[gateway] = identifier[gateway] identifier[self] . identifier[sectie] . identifier[set_gateway] ( identifier[gateway] )
def set_gateway(self, gateway): """ :param crabpy.gateway.capakey.CapakeyGateway gateway: Gateway to use. """ self.gateway = gateway self.sectie.set_gateway(gateway)
async def message_field(self, msg, field, fvalue=None): """ Dumps/Loads message field :param msg: :param field: :param fvalue: explicit value for dump :return: """ fname, ftype, params = field[0], field[1], field[2:] try: self.tracker.p...
<ast.AsyncFunctionDef object at 0x7da18fe93730>
keyword[async] keyword[def] identifier[message_field] ( identifier[self] , identifier[msg] , identifier[field] , identifier[fvalue] = keyword[None] ): literal[string] identifier[fname] , identifier[ftype] , identifier[params] = identifier[field] [ literal[int] ], identifier[field] [ literal[int] ]...
async def message_field(self, msg, field, fvalue=None): """ Dumps/Loads message field :param msg: :param field: :param fvalue: explicit value for dump :return: """ (fname, ftype, params) = (field[0], field[1], field[2:]) try: self.tracker.push_field(fn...
def generate_sub_codons_left(codons_dict): """Generate the sub_codons_left dictionary of codon prefixes. Parameters ---------- codons_dict : dict Dictionary, keyed by the allowed 'amino acid' symbols with the values being lists of codons corresponding to the symbol. Returns --...
def function[generate_sub_codons_left, parameter[codons_dict]]: constant[Generate the sub_codons_left dictionary of codon prefixes. Parameters ---------- codons_dict : dict Dictionary, keyed by the allowed 'amino acid' symbols with the values being lists of codons corresponding to ...
keyword[def] identifier[generate_sub_codons_left] ( identifier[codons_dict] ): literal[string] identifier[sub_codons_left] ={} keyword[for] identifier[aa] keyword[in] identifier[codons_dict] . identifier[keys] (): identifier[sub_codons_left] [ identifier[aa] ]= identifier[list] ( identifie...
def generate_sub_codons_left(codons_dict): """Generate the sub_codons_left dictionary of codon prefixes. Parameters ---------- codons_dict : dict Dictionary, keyed by the allowed 'amino acid' symbols with the values being lists of codons corresponding to the symbol. Returns --...
def _boosted_value(name, action, key, value, boost): """Boost a value if we should in _process_queries""" if boost is not None: # Note: Most queries use 'value' for the key name except # Match queries which use 'query'. So we have to do some # switcheroo for that. value_key = 'qu...
def function[_boosted_value, parameter[name, action, key, value, boost]]: constant[Boost a value if we should in _process_queries] if compare[name[boost] is_not constant[None]] begin[:] variable[value_key] assign[=] <ast.IfExp object at 0x7da1b10a4c70> return[dictionary[[<ast.Nam...
keyword[def] identifier[_boosted_value] ( identifier[name] , identifier[action] , identifier[key] , identifier[value] , identifier[boost] ): literal[string] keyword[if] identifier[boost] keyword[is] keyword[not] keyword[None] : identifier[value_key] = literal[string] keyword[if...
def _boosted_value(name, action, key, value, boost): """Boost a value if we should in _process_queries""" if boost is not None: # Note: Most queries use 'value' for the key name except # Match queries which use 'query'. So we have to do some # switcheroo for that. value_key = 'qu...
def get_writer_position(self, name): """Get the current writer position""" cursor = self.cursor cursor.execute('SELECT timestamp FROM gauged_writer_history ' 'WHERE id = %s', (name,)) result = cursor.fetchone() return result[0] if result else 0
def function[get_writer_position, parameter[self, name]]: constant[Get the current writer position] variable[cursor] assign[=] name[self].cursor call[name[cursor].execute, parameter[constant[SELECT timestamp FROM gauged_writer_history WHERE id = %s], tuple[[<ast.Name object at 0x7da1b24ad7e0>]]]...
keyword[def] identifier[get_writer_position] ( identifier[self] , identifier[name] ): literal[string] identifier[cursor] = identifier[self] . identifier[cursor] identifier[cursor] . identifier[execute] ( literal[string] literal[string] ,( identifier[name] ,)) identifier...
def get_writer_position(self, name): """Get the current writer position""" cursor = self.cursor cursor.execute('SELECT timestamp FROM gauged_writer_history WHERE id = %s', (name,)) result = cursor.fetchone() return result[0] if result else 0
def shutdown(self, message=None): """Disconnect all servers with a message. Args: message (str): Quit message to use on each connection. """ for name, server in self.servers.items(): server.quit(message)
def function[shutdown, parameter[self, message]]: constant[Disconnect all servers with a message. Args: message (str): Quit message to use on each connection. ] for taget[tuple[[<ast.Name object at 0x7da2044c2d10>, <ast.Name object at 0x7da2044c1270>]]] in starred[call[name[...
keyword[def] identifier[shutdown] ( identifier[self] , identifier[message] = keyword[None] ): literal[string] keyword[for] identifier[name] , identifier[server] keyword[in] identifier[self] . identifier[servers] . identifier[items] (): identifier[server] . identifier[quit] ( identif...
def shutdown(self, message=None): """Disconnect all servers with a message. Args: message (str): Quit message to use on each connection. """ for (name, server) in self.servers.items(): server.quit(message) # depends on [control=['for'], data=[]]
def _Open(self, path_spec=None, mode='rb'): """Opens the file-like object defined by path specification. Args: path_spec (PathSpec): path specification. mode (Optional[str]): file access mode. Raises: AccessError: if the access to open the file was denied. IOError: if the file-like...
def function[_Open, parameter[self, path_spec, mode]]: constant[Opens the file-like object defined by path specification. Args: path_spec (PathSpec): path specification. mode (Optional[str]): file access mode. Raises: AccessError: if the access to open the file was denied. IOEr...
keyword[def] identifier[_Open] ( identifier[self] , identifier[path_spec] = keyword[None] , identifier[mode] = literal[string] ): literal[string] keyword[if] keyword[not] identifier[path_spec] : keyword[raise] identifier[ValueError] ( literal[string] ) identifier[data_stream] = identifier[g...
def _Open(self, path_spec=None, mode='rb'): """Opens the file-like object defined by path specification. Args: path_spec (PathSpec): path specification. mode (Optional[str]): file access mode. Raises: AccessError: if the access to open the file was denied. IOError: if the file-like...
def to_dict(self): """ dump a representation of the nparray object to a dictionary. The nparray object should then be able to be fully restored via nparray.from_dict """ def _json_safe(v): if isinstance(v, np.ndarray): return v.tolist() ...
def function[to_dict, parameter[self]]: constant[ dump a representation of the nparray object to a dictionary. The nparray object should then be able to be fully restored via nparray.from_dict ] def function[_json_safe, parameter[v]]: if call[name[isinsta...
keyword[def] identifier[to_dict] ( identifier[self] ): literal[string] keyword[def] identifier[_json_safe] ( identifier[v] ): keyword[if] identifier[isinstance] ( identifier[v] , identifier[np] . identifier[ndarray] ): keyword[return] identifier[v] . identifier[toli...
def to_dict(self): """ dump a representation of the nparray object to a dictionary. The nparray object should then be able to be fully restored via nparray.from_dict """ def _json_safe(v): if isinstance(v, np.ndarray): return v.tolist() # depends on [contro...
def get_known_subqueues(self): """ Returns all known subqueues """ all_queues_from_mongodb = Queue.all_known(sources=("jobs", )) idprefix = self.id if not idprefix.endswith("/"): idprefix += "/" return {q for q in all_queues_from_mongodb if q.startswith(idprefix)}
def function[get_known_subqueues, parameter[self]]: constant[ Returns all known subqueues ] variable[all_queues_from_mongodb] assign[=] call[name[Queue].all_known, parameter[]] variable[idprefix] assign[=] name[self].id if <ast.UnaryOp object at 0x7da1b0847370> begin[:] <ast.AugA...
keyword[def] identifier[get_known_subqueues] ( identifier[self] ): literal[string] identifier[all_queues_from_mongodb] = identifier[Queue] . identifier[all_known] ( identifier[sources] =( literal[string] ,)) identifier[idprefix] = identifier[self] . identifier[id] keyword[if] ...
def get_known_subqueues(self): """ Returns all known subqueues """ all_queues_from_mongodb = Queue.all_known(sources=('jobs',)) idprefix = self.id if not idprefix.endswith('/'): idprefix += '/' # depends on [control=['if'], data=[]] return {q for q in all_queues_from_mongodb if q.startswith...
def size_threshold(img, thr, comp='lt', structure = None): r""" Removes binary objects from an image identified by a size threshold. The unconnected binary objects in an image are identified and all removed whose size compares (e.g. less-than) to a supplied threshold value. The threshold `...
def function[size_threshold, parameter[img, thr, comp, structure]]: constant[ Removes binary objects from an image identified by a size threshold. The unconnected binary objects in an image are identified and all removed whose size compares (e.g. less-than) to a supplied threshold value. ...
keyword[def] identifier[size_threshold] ( identifier[img] , identifier[thr] , identifier[comp] = literal[string] , identifier[structure] = keyword[None] ): literal[string] identifier[operators] ={ literal[string] : identifier[lt] , literal[string] : identifier[le] , literal[string] : identifier[gt] , lite...
def size_threshold(img, thr, comp='lt', structure=None): """ Removes binary objects from an image identified by a size threshold. The unconnected binary objects in an image are identified and all removed whose size compares (e.g. less-than) to a supplied threshold value. The threshold ``th...
def handle(cls, vm, args): """ Setup forwarding connection to given VM and pipe docker cmds over SSH. """ docker = Iaas.info(vm) if not docker: raise Exception('docker vm %s not found' % vm) if docker['state'] != 'running': Iaas.start(vm) ...
def function[handle, parameter[cls, vm, args]]: constant[ Setup forwarding connection to given VM and pipe docker cmds over SSH. ] variable[docker] assign[=] call[name[Iaas].info, parameter[name[vm]]] if <ast.UnaryOp object at 0x7da18eb57be0> begin[:] <ast.Raise object at...
keyword[def] identifier[handle] ( identifier[cls] , identifier[vm] , identifier[args] ): literal[string] identifier[docker] = identifier[Iaas] . identifier[info] ( identifier[vm] ) keyword[if] keyword[not] identifier[docker] : keyword[raise] identifier[Exception] ( literal[...
def handle(cls, vm, args): """ Setup forwarding connection to given VM and pipe docker cmds over SSH. """ docker = Iaas.info(vm) if not docker: raise Exception('docker vm %s not found' % vm) # depends on [control=['if'], data=[]] if docker['state'] != 'running': Iaas.sta...
def obtain_all_bond_lengths(sp1, sp2, default_bl=None): """ Obtain bond lengths for all bond orders from bond length database Args: sp1 (Specie): First specie. sp2 (Specie): Second specie. default_bl: If a particular type of bond does not exist, use this bond length as a...
def function[obtain_all_bond_lengths, parameter[sp1, sp2, default_bl]]: constant[ Obtain bond lengths for all bond orders from bond length database Args: sp1 (Specie): First specie. sp2 (Specie): Second specie. default_bl: If a particular type of bond does not exist, use this ...
keyword[def] identifier[obtain_all_bond_lengths] ( identifier[sp1] , identifier[sp2] , identifier[default_bl] = keyword[None] ): literal[string] keyword[if] identifier[isinstance] ( identifier[sp1] , identifier[Element] ): identifier[sp1] = identifier[sp1] . identifier[symbol] keyword[if] ...
def obtain_all_bond_lengths(sp1, sp2, default_bl=None): """ Obtain bond lengths for all bond orders from bond length database Args: sp1 (Specie): First specie. sp2 (Specie): Second specie. default_bl: If a particular type of bond does not exist, use this bond length as a...
def attach_usage_plan_to_apis(plan_id, apis, region=None, key=None, keyid=None, profile=None): ''' Attaches given usage plan to each of the apis provided in a list of apiId and stage values .. versionadded:: 2017.7.0 apis a list of dictionaries, where each dictionary contains the following: ...
def function[attach_usage_plan_to_apis, parameter[plan_id, apis, region, key, keyid, profile]]: constant[ Attaches given usage plan to each of the apis provided in a list of apiId and stage values .. versionadded:: 2017.7.0 apis a list of dictionaries, where each dictionary contains the fo...
keyword[def] identifier[attach_usage_plan_to_apis] ( identifier[plan_id] , identifier[apis] , identifier[region] = keyword[None] , identifier[key] = keyword[None] , identifier[keyid] = keyword[None] , identifier[profile] = keyword[None] ): literal[string] keyword[return] identifier[_update_usage_plan_apis...
def attach_usage_plan_to_apis(plan_id, apis, region=None, key=None, keyid=None, profile=None): """ Attaches given usage plan to each of the apis provided in a list of apiId and stage values .. versionadded:: 2017.7.0 apis a list of dictionaries, where each dictionary contains the following: ...
def _get_openstack_release(self): """Get openstack release. Return an integer representing the enum value of the openstack release. """ # Must be ordered by OpenStack release (not by Ubuntu release): for i, os_pair in enumerate(OPENSTACK_RELEASES_PAIRS): ...
def function[_get_openstack_release, parameter[self]]: constant[Get openstack release. Return an integer representing the enum value of the openstack release. ] for taget[tuple[[<ast.Name object at 0x7da18f00e5c0>, <ast.Name object at 0x7da18f00d300>]]] in starred[call[...
keyword[def] identifier[_get_openstack_release] ( identifier[self] ): literal[string] keyword[for] identifier[i] , identifier[os_pair] keyword[in] identifier[enumerate] ( identifier[OPENSTACK_RELEASES_PAIRS] ): identifier[setattr] ( identifier[self] , identifier[os_pair] , ...
def _get_openstack_release(self): """Get openstack release. Return an integer representing the enum value of the openstack release. """ # Must be ordered by OpenStack release (not by Ubuntu release): for (i, os_pair) in enumerate(OPENSTACK_RELEASES_PAIRS): setattr(s...
def delete_servers(self, server_id): """ Requires: account ID, server ID Input should be server id Returns: list of failed deletions (if any) Endpoint: api.newrelic.com Errors: 403 Invalid API Key Method: Delete """ endpoint = "https://api.newrelic...
def function[delete_servers, parameter[self, server_id]]: constant[ Requires: account ID, server ID Input should be server id Returns: list of failed deletions (if any) Endpoint: api.newrelic.com Errors: 403 Invalid API Key Method: Delete ] variabl...
keyword[def] identifier[delete_servers] ( identifier[self] , identifier[server_id] ): literal[string] identifier[endpoint] = literal[string] identifier[uri] = literal[string] . identifier[format] ( identifier[endpoint] = identifier[endpoint] , identifier[account_id] = id...
def delete_servers(self, server_id): """ Requires: account ID, server ID Input should be server id Returns: list of failed deletions (if any) Endpoint: api.newrelic.com Errors: 403 Invalid API Key Method: Delete """ endpoint = 'https://api.newrelic.com' ...
def update_index(self, key, value): "Update the index with the new key/values." for k, v in value.items(): if k in self.indexes: # A non-string index value switches it into a lazy one. if not isinstance(v, six.string_types): self.index_defs...
def function[update_index, parameter[self, key, value]]: constant[Update the index with the new key/values.] for taget[tuple[[<ast.Name object at 0x7da2047e98a0>, <ast.Name object at 0x7da2047e8730>]]] in starred[call[name[value].items, parameter[]]] begin[:] if compare[name[k] in name[s...
keyword[def] identifier[update_index] ( identifier[self] , identifier[key] , identifier[value] ): literal[string] keyword[for] identifier[k] , identifier[v] keyword[in] identifier[value] . identifier[items] (): keyword[if] identifier[k] keyword[in] identifier[self] . identifier[i...
def update_index(self, key, value): """Update the index with the new key/values.""" for (k, v) in value.items(): if k in self.indexes: # A non-string index value switches it into a lazy one. if not isinstance(v, six.string_types): self.index_defs[k]['type'] = 'laz...
def assertFileExists(self, filename, msg=None): '''Fail if ``filename`` does not exist as determined by ``os.path.isfile(filename)``. Parameters ---------- filename : str, bytes msg : str If not provided, the :mod:`marbles.mixins` or :mod:`unittes...
def function[assertFileExists, parameter[self, filename, msg]]: constant[Fail if ``filename`` does not exist as determined by ``os.path.isfile(filename)``. Parameters ---------- filename : str, bytes msg : str If not provided, the :mod:`marbles.mixins` or ...
keyword[def] identifier[assertFileExists] ( identifier[self] , identifier[filename] , identifier[msg] = keyword[None] ): literal[string] identifier[standardMsg] = literal[string] % identifier[filename] keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[isfile] ( id...
def assertFileExists(self, filename, msg=None): """Fail if ``filename`` does not exist as determined by ``os.path.isfile(filename)``. Parameters ---------- filename : str, bytes msg : str If not provided, the :mod:`marbles.mixins` or :mod:`unittest` s...
def _is_deprecated(func): """Helper to check if func is wraped by our deprecated decorator""" if sys.version_info < (3, 5): raise NotImplementedError("This is only available for python3.5 " "or above") closures = getattr(func, '__closure__', []) if closures is N...
def function[_is_deprecated, parameter[func]]: constant[Helper to check if func is wraped by our deprecated decorator] if compare[name[sys].version_info less[<] tuple[[<ast.Constant object at 0x7da1b18ddae0>, <ast.Constant object at 0x7da1b18dc130>]]] begin[:] <ast.Raise object at 0x7da1b18dfc70...
keyword[def] identifier[_is_deprecated] ( identifier[func] ): literal[string] keyword[if] identifier[sys] . identifier[version_info] <( literal[int] , literal[int] ): keyword[raise] identifier[NotImplementedError] ( literal[string] literal[string] ) identifier[closures] = identifi...
def _is_deprecated(func): """Helper to check if func is wraped by our deprecated decorator""" if sys.version_info < (3, 5): raise NotImplementedError('This is only available for python3.5 or above') # depends on [control=['if'], data=[]] closures = getattr(func, '__closure__', []) if closures i...
def load(ctx, input, output): """Read clusters from file and save to model file.""" log.debug('chemdataextractor.cluster.load') import pickle click.echo('Reading %s' % input.name) clusters = {} for line in input.readlines(): cluster, word, freq = line.split() clusters[word] = clu...
def function[load, parameter[ctx, input, output]]: constant[Read clusters from file and save to model file.] call[name[log].debug, parameter[constant[chemdataextractor.cluster.load]]] import module[pickle] call[name[click].echo, parameter[binary_operation[constant[Reading %s] <ast.Mod object...
keyword[def] identifier[load] ( identifier[ctx] , identifier[input] , identifier[output] ): literal[string] identifier[log] . identifier[debug] ( literal[string] ) keyword[import] identifier[pickle] identifier[click] . identifier[echo] ( literal[string] % identifier[input] . identifier[name] ) ...
def load(ctx, input, output): """Read clusters from file and save to model file.""" log.debug('chemdataextractor.cluster.load') import pickle click.echo('Reading %s' % input.name) clusters = {} for line in input.readlines(): (cluster, word, freq) = line.split() clusters[word] = c...
def get(self, sid): """ Constructs a ShortCodeContext :param sid: The unique string that identifies the resource :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext """ return ShortC...
def function[get, parameter[self, sid]]: constant[ Constructs a ShortCodeContext :param sid: The unique string that identifies the resource :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext ...
keyword[def] identifier[get] ( identifier[self] , identifier[sid] ): literal[string] keyword[return] identifier[ShortCodeContext] ( identifier[self] . identifier[_version] , identifier[service_sid] = identifier[self] . identifier[_solution] [ literal[string] ], identifier[sid] = identifier[sid] ,)
def get(self, sid): """ Constructs a ShortCodeContext :param sid: The unique string that identifies the resource :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext """ return ShortCodeConte...
def has_subscriber(self, user): """ Returns ``True`` if the given user is a subscriber of this topic. """ if not hasattr(self, '_subscribers'): self._subscribers = list(self.subscribers.all()) return user in self._subscribers
def function[has_subscriber, parameter[self, user]]: constant[ Returns ``True`` if the given user is a subscriber of this topic. ] if <ast.UnaryOp object at 0x7da1b12c9600> begin[:] name[self]._subscribers assign[=] call[name[list], parameter[call[name[self].subscribers.all, parameter[]]...
keyword[def] identifier[has_subscriber] ( identifier[self] , identifier[user] ): literal[string] keyword[if] keyword[not] identifier[hasattr] ( identifier[self] , literal[string] ): identifier[self] . identifier[_subscribers] = identifier[list] ( identifier[self] . identifier[subscri...
def has_subscriber(self, user): """ Returns ``True`` if the given user is a subscriber of this topic. """ if not hasattr(self, '_subscribers'): self._subscribers = list(self.subscribers.all()) # depends on [control=['if'], data=[]] return user in self._subscribers
def _access_user_info(self): """ Accesses the :attr:`.user_info_url`. :returns: :class:`.UserInfoResponse` """ url = self.user_info_url.format(**self.user.__dict__) return self.access(url)
def function[_access_user_info, parameter[self]]: constant[ Accesses the :attr:`.user_info_url`. :returns: :class:`.UserInfoResponse` ] variable[url] assign[=] call[name[self].user_info_url.format, parameter[]] return[call[name[self].access, parameter[name[url]]...
keyword[def] identifier[_access_user_info] ( identifier[self] ): literal[string] identifier[url] = identifier[self] . identifier[user_info_url] . identifier[format] (** identifier[self] . identifier[user] . identifier[__dict__] ) keyword[return] identifier[self] . identifier[access] ( ide...
def _access_user_info(self): """ Accesses the :attr:`.user_info_url`. :returns: :class:`.UserInfoResponse` """ url = self.user_info_url.format(**self.user.__dict__) return self.access(url)
def device_to_user(self, x, y): """Transform a coordinate from device space to user space by multiplying the given point by the inverse of the current transformation matrix (CTM). :param x: X position. :param y: Y position. :type x: float :type y: float :...
def function[device_to_user, parameter[self, x, y]]: constant[Transform a coordinate from device space to user space by multiplying the given point by the inverse of the current transformation matrix (CTM). :param x: X position. :param y: Y position. :type x: float ...
keyword[def] identifier[device_to_user] ( identifier[self] , identifier[x] , identifier[y] ): literal[string] identifier[xy] = identifier[ffi] . identifier[new] ( literal[string] ,[ identifier[x] , identifier[y] ]) identifier[cairo] . identifier[cairo_device_to_user] ( identifier[self] . i...
def device_to_user(self, x, y): """Transform a coordinate from device space to user space by multiplying the given point by the inverse of the current transformation matrix (CTM). :param x: X position. :param y: Y position. :type x: float :type y: float :retu...
def ADD(cpu, dest, src): """ Add. Adds the first operand (destination operand) and the second operand (source operand) and stores the result in the destination operand. When an immediate value is used as an operand, it is sign-extended to the length of the destination operand fo...
def function[ADD, parameter[cpu, dest, src]]: constant[ Add. Adds the first operand (destination operand) and the second operand (source operand) and stores the result in the destination operand. When an immediate value is used as an operand, it is sign-extended to the length of...
keyword[def] identifier[ADD] ( identifier[cpu] , identifier[dest] , identifier[src] ): literal[string] identifier[cpu] . identifier[_ADD] ( identifier[dest] , identifier[src] , identifier[carry] = keyword[False] )
def ADD(cpu, dest, src): """ Add. Adds the first operand (destination operand) and the second operand (source operand) and stores the result in the destination operand. When an immediate value is used as an operand, it is sign-extended to the length of the destination operand format...
def _match_item(item, any_all=any, ignore_case=False, normalize_values=False, **kwargs): """Match items by metadata. Note: Metadata values are lowercased when ``normalized_values`` is ``True``, so ``ignore_case`` is automatically set to ``True``. Parameters: item (~collections.abc.Mapping, str, os.PathLike):...
def function[_match_item, parameter[item, any_all, ignore_case, normalize_values]]: constant[Match items by metadata. Note: Metadata values are lowercased when ``normalized_values`` is ``True``, so ``ignore_case`` is automatically set to ``True``. Parameters: item (~collections.abc.Mapping, str, os.Pa...
keyword[def] identifier[_match_item] ( identifier[item] , identifier[any_all] = identifier[any] , identifier[ignore_case] = keyword[False] , identifier[normalize_values] = keyword[False] ,** identifier[kwargs] ): literal[string] identifier[it] = identifier[get_item_tags] ( identifier[item] ) keyword[return] ...
def _match_item(item, any_all=any, ignore_case=False, normalize_values=False, **kwargs): """Match items by metadata. Note: Metadata values are lowercased when ``normalized_values`` is ``True``, so ``ignore_case`` is automatically set to ``True``. Parameters: item (~collections.abc.Mapping, str, os.PathLik...
def dht_findprovs(self, multihash, *multihashes, **kwargs): """Finds peers in the DHT that can provide a specific value. .. code-block:: python >>> c.dht_findprovs("QmNPXDC6wTXVmZ9Uoc8X1oqxRRJr4f1sDuyQu … mpW2") [{'ID': 'QmaxqKpiYNr62uSFBhxJAMmEMkT6dvc3oHkrZNpH2VMTLZ', ...
def function[dht_findprovs, parameter[self, multihash]]: constant[Finds peers in the DHT that can provide a specific value. .. code-block:: python >>> c.dht_findprovs("QmNPXDC6wTXVmZ9Uoc8X1oqxRRJr4f1sDuyQu … mpW2") [{'ID': 'QmaxqKpiYNr62uSFBhxJAMmEMkT6dvc3oHkrZNpH2VMTLZ', ...
keyword[def] identifier[dht_findprovs] ( identifier[self] , identifier[multihash] ,* identifier[multihashes] ,** identifier[kwargs] ): literal[string] identifier[args] =( identifier[multihash] ,)+ identifier[multihashes] keyword[return] identifier[self] . identifier[_client] . identifier...
def dht_findprovs(self, multihash, *multihashes, **kwargs): """Finds peers in the DHT that can provide a specific value. .. code-block:: python >>> c.dht_findprovs("QmNPXDC6wTXVmZ9Uoc8X1oqxRRJr4f1sDuyQu … mpW2") [{'ID': 'QmaxqKpiYNr62uSFBhxJAMmEMkT6dvc3oHkrZNpH2VMTLZ', ...
def get_fresh_content(top=4, additional=10, featured=False): """ Requires articles, photos and video packages to be installed. Returns published *Featured* content (articles, galleries, video, etc) and an additional batch of fresh regular (featured or not) content. The number of objects returned i...
def function[get_fresh_content, parameter[top, additional, featured]]: constant[ Requires articles, photos and video packages to be installed. Returns published *Featured* content (articles, galleries, video, etc) and an additional batch of fresh regular (featured or not) content. The number o...
keyword[def] identifier[get_fresh_content] ( identifier[top] = literal[int] , identifier[additional] = literal[int] , identifier[featured] = keyword[False] ): literal[string] keyword[from] identifier[articles] . identifier[models] keyword[import] identifier[Article] keyword[from] identifier[photo...
def get_fresh_content(top=4, additional=10, featured=False): """ Requires articles, photos and video packages to be installed. Returns published *Featured* content (articles, galleries, video, etc) and an additional batch of fresh regular (featured or not) content. The number of objects returned i...
def interm_fluent_variables(self) -> FluentParamsList: '''Returns the instantiated intermediate fluents in canonical order. Returns: Sequence[Tuple[str, List[str]]]: A tuple of pairs of fluent name and a list of instantiated fluents represented as strings. ''' fl...
def function[interm_fluent_variables, parameter[self]]: constant[Returns the instantiated intermediate fluents in canonical order. Returns: Sequence[Tuple[str, List[str]]]: A tuple of pairs of fluent name and a list of instantiated fluents represented as strings. ] ...
keyword[def] identifier[interm_fluent_variables] ( identifier[self] )-> identifier[FluentParamsList] : literal[string] identifier[fluents] = identifier[self] . identifier[domain] . identifier[intermediate_fluents] identifier[ordering] = identifier[self] . identifier[domain] . identifier[i...
def interm_fluent_variables(self) -> FluentParamsList: """Returns the instantiated intermediate fluents in canonical order. Returns: Sequence[Tuple[str, List[str]]]: A tuple of pairs of fluent name and a list of instantiated fluents represented as strings. """ fluents = ...
def _get_unit_factor(cls, unit): """ Returns the unit factor depending on the unit constant :param int unit: the unit of the factor requested :returns: a function to convert the raw sensor value to the given unit :rtype: lambda function :raises Unsu...
def function[_get_unit_factor, parameter[cls, unit]]: constant[ Returns the unit factor depending on the unit constant :param int unit: the unit of the factor requested :returns: a function to convert the raw sensor value to the given unit :rtype: lambda functio...
keyword[def] identifier[_get_unit_factor] ( identifier[cls] , identifier[unit] ): literal[string] keyword[try] : keyword[if] identifier[isinstance] ( identifier[unit] , identifier[str] ): identifier[unit] = identifier[cls] . identifier[UNIT_FACTOR_NAMES] [ identifier[...
def _get_unit_factor(cls, unit): """ Returns the unit factor depending on the unit constant :param int unit: the unit of the factor requested :returns: a function to convert the raw sensor value to the given unit :rtype: lambda function :raises Unsuppor...
def _new_redis_client(self): """Create a new redis client and assign it the class _redis_client attribute for reuse across requests. :rtype: tornadoredis.Client() """ if 'tornadoredis' not in globals(): import tornadoredis kwargs = self._redis_connection_set...
def function[_new_redis_client, parameter[self]]: constant[Create a new redis client and assign it the class _redis_client attribute for reuse across requests. :rtype: tornadoredis.Client() ] if compare[constant[tornadoredis] <ast.NotIn object at 0x7da2590d7190> call[name[globa...
keyword[def] identifier[_new_redis_client] ( identifier[self] ): literal[string] keyword[if] literal[string] keyword[not] keyword[in] identifier[globals] (): keyword[import] identifier[tornadoredis] identifier[kwargs] = identifier[self] . identifier[_redis_connection_set...
def _new_redis_client(self): """Create a new redis client and assign it the class _redis_client attribute for reuse across requests. :rtype: tornadoredis.Client() """ if 'tornadoredis' not in globals(): import tornadoredis # depends on [control=['if'], data=[]] kwargs = se...
def iterate_similarity_datasets(args): """Generator over all similarity evaluation datasets. Iterates over dataset names, keyword arguments for their creation and the created dataset. """ for dataset_name in args.similarity_datasets: parameters = nlp.data.list_datasets(dataset_name) ...
def function[iterate_similarity_datasets, parameter[args]]: constant[Generator over all similarity evaluation datasets. Iterates over dataset names, keyword arguments for their creation and the created dataset. ] for taget[name[dataset_name]] in starred[name[args].similarity_datasets] begi...
keyword[def] identifier[iterate_similarity_datasets] ( identifier[args] ): literal[string] keyword[for] identifier[dataset_name] keyword[in] identifier[args] . identifier[similarity_datasets] : identifier[parameters] = identifier[nlp] . identifier[data] . identifier[list_datasets] ( identifier[...
def iterate_similarity_datasets(args): """Generator over all similarity evaluation datasets. Iterates over dataset names, keyword arguments for their creation and the created dataset. """ for dataset_name in args.similarity_datasets: parameters = nlp.data.list_datasets(dataset_name) ...
def properties_mutator(cls, name, ioper=False): """Wraps a mutating container method to add HasProperties notifications If the container is not part of a HasProperties instance, behavior is unchanged. However, if it is part of a HasProperties instance the new method calls set, triggering change notific...
def function[properties_mutator, parameter[cls, name, ioper]]: constant[Wraps a mutating container method to add HasProperties notifications If the container is not part of a HasProperties instance, behavior is unchanged. However, if it is part of a HasProperties instance the new method calls set, ...
keyword[def] identifier[properties_mutator] ( identifier[cls] , identifier[name] , identifier[ioper] = keyword[False] ): literal[string] keyword[def] identifier[wrapper] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[if] ( identifier[g...
def properties_mutator(cls, name, ioper=False): """Wraps a mutating container method to add HasProperties notifications If the container is not part of a HasProperties instance, behavior is unchanged. However, if it is part of a HasProperties instance the new method calls set, triggering change notific...
def unique_scene_labels(scene_list): """Find the unique scene labels Parameters ---------- scene_list : list, shape=(n,) A list containing scene dicts Returns ------- labels: list, shape=(n,) Unique labels in alphabetical order """ if isinstance(scene_list, dcase_u...
def function[unique_scene_labels, parameter[scene_list]]: constant[Find the unique scene labels Parameters ---------- scene_list : list, shape=(n,) A list containing scene dicts Returns ------- labels: list, shape=(n,) Unique labels in alphabetical order ] ...
keyword[def] identifier[unique_scene_labels] ( identifier[scene_list] ): literal[string] keyword[if] identifier[isinstance] ( identifier[scene_list] , identifier[dcase_util] . identifier[containers] . identifier[MetaDataContainer] ): keyword[return] identifier[scene_list] . identifier[unique_sce...
def unique_scene_labels(scene_list): """Find the unique scene labels Parameters ---------- scene_list : list, shape=(n,) A list containing scene dicts Returns ------- labels: list, shape=(n,) Unique labels in alphabetical order """ if isinstance(scene_list, dcase_u...
def playlist_songs_move( self, playlist_songs, *, after=None, before=None, index=None, position=None ): """Move songs in a playlist. Note: * Provide no optional arguments to move to end. * Provide playlist song dicts for ``after`` and/or ``before``. * Provide a zero-based ``index``. * Pr...
def function[playlist_songs_move, parameter[self, playlist_songs]]: constant[Move songs in a playlist. Note: * Provide no optional arguments to move to end. * Provide playlist song dicts for ``after`` and/or ``before``. * Provide a zero-based ``index``. * Provide a one-based ``position``. Son...
keyword[def] identifier[playlist_songs_move] ( identifier[self] , identifier[playlist_songs] , *, identifier[after] = keyword[None] , identifier[before] = keyword[None] , identifier[index] = keyword[None] , identifier[position] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[mo...
def playlist_songs_move(self, playlist_songs, *, after=None, before=None, index=None, position=None): """Move songs in a playlist. Note: * Provide no optional arguments to move to end. * Provide playlist song dicts for ``after`` and/or ``before``. * Provide a zero-based ``index``. * Provide a one-bas...
def list(): """List running TensorBoard instances.""" running_list = [] parser = argparse.ArgumentParser() parser.add_argument('--logdir') parser.add_argument('--port') for p in psutil.process_iter(): if p.name() != 'tensorboard' or p.status() == psutil.STATUS_ZOMBIE: continue ...
def function[list, parameter[]]: constant[List running TensorBoard instances.] variable[running_list] assign[=] list[[]] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] call[name[parser].add_argument, parameter[constant[--logdir]]] call[name[parser].ad...
keyword[def] identifier[list] (): literal[string] identifier[running_list] =[] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] () identifier[parser] . identifier[add_argument] ( literal[string] ) identifier[parser] . identifier[add_argument] ( literal[string] ) k...
def list(): """List running TensorBoard instances.""" running_list = [] parser = argparse.ArgumentParser() parser.add_argument('--logdir') parser.add_argument('--port') for p in psutil.process_iter(): if p.name() != 'tensorboard' or p.status() == psutil.STATUS_ZOMBIE: continu...
def get_changed_vars(section: SoS_Step): '''changed vars are variables that are "shared" and therefore "provides" to others ''' if 'shared' not in section.options: return set() changed_vars = set() svars = section.options['shared'] if isinstance(svars, str): changed_vars.add(sva...
def function[get_changed_vars, parameter[section]]: constant[changed vars are variables that are "shared" and therefore "provides" to others ] if compare[constant[shared] <ast.NotIn object at 0x7da2590d7190> name[section].options] begin[:] return[call[name[set], parameter[]]] variabl...
keyword[def] identifier[get_changed_vars] ( identifier[section] : identifier[SoS_Step] ): literal[string] keyword[if] literal[string] keyword[not] keyword[in] identifier[section] . identifier[options] : keyword[return] identifier[set] () identifier[changed_vars] = identifier[set] () ...
def get_changed_vars(section: SoS_Step): """changed vars are variables that are "shared" and therefore "provides" to others """ if 'shared' not in section.options: return set() # depends on [control=['if'], data=[]] changed_vars = set() svars = section.options['shared'] if isinstance(sv...
def get_gcps(self): """Read GCP from the GDAL band. Args: band (gdal band): Measurement band which comes with GCP's coordinates (tuple): A tuple with longitude and latitude arrays Returns: points (tuple): Pixel and Line indices 1d arrays gcp_coords (...
def function[get_gcps, parameter[self]]: constant[Read GCP from the GDAL band. Args: band (gdal band): Measurement band which comes with GCP's coordinates (tuple): A tuple with longitude and latitude arrays Returns: points (tuple): Pixel and Line indices 1d arr...
keyword[def] identifier[get_gcps] ( identifier[self] ): literal[string] identifier[gcps] = identifier[self] . identifier[filehandle] . identifier[gcps] identifier[gcp_array] = identifier[np] . identifier[array] ([( identifier[p] . identifier[row] , identifier[p] . identifier[col] , ident...
def get_gcps(self): """Read GCP from the GDAL band. Args: band (gdal band): Measurement band which comes with GCP's coordinates (tuple): A tuple with longitude and latitude arrays Returns: points (tuple): Pixel and Line indices 1d arrays gcp_coords (tupl...
def on_evaluate_request(self, py_db, request): ''' :param EvaluateRequest request: ''' # : :type arguments: EvaluateArguments arguments = request.arguments thread_id = py_db.suspended_frames_manager.get_thread_id_for_variable_reference( arguments.frameId) ...
def function[on_evaluate_request, parameter[self, py_db, request]]: constant[ :param EvaluateRequest request: ] variable[arguments] assign[=] name[request].arguments variable[thread_id] assign[=] call[name[py_db].suspended_frames_manager.get_thread_id_for_variable_reference, para...
keyword[def] identifier[on_evaluate_request] ( identifier[self] , identifier[py_db] , identifier[request] ): literal[string] identifier[arguments] = identifier[request] . identifier[arguments] identifier[thread_id] = identifier[py_db] . identifier[suspended_frames_manager] . ide...
def on_evaluate_request(self, py_db, request): """ :param EvaluateRequest request: """ # : :type arguments: EvaluateArguments arguments = request.arguments thread_id = py_db.suspended_frames_manager.get_thread_id_for_variable_reference(arguments.frameId) self.api.request_exec_or_eval...
def send_terrain_data(self): '''send some terrain data''' for bit in range(56): if self.current_request.mask & (1<<bit) and self.sent_mask & (1<<bit) == 0: self.send_terrain_data_bit(bit) return # no bits to send self.current_request = None ...
def function[send_terrain_data, parameter[self]]: constant[send some terrain data] for taget[name[bit]] in starred[call[name[range], parameter[constant[56]]]] begin[:] if <ast.BoolOp object at 0x7da1b16bc610> begin[:] call[name[self].send_terrain_data_bit, paramet...
keyword[def] identifier[send_terrain_data] ( identifier[self] ): literal[string] keyword[for] identifier[bit] keyword[in] identifier[range] ( literal[int] ): keyword[if] identifier[self] . identifier[current_request] . identifier[mask] &( literal[int] << identifier[bit] ) keyword[a...
def send_terrain_data(self): """send some terrain data""" for bit in range(56): if self.current_request.mask & 1 << bit and self.sent_mask & 1 << bit == 0: self.send_terrain_data_bit(bit) return # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['bit']]...
def t_bin_NUMBER(t): r'[01]+' # A binary integer t.value = int(t.value, 2) t.lexer.begin('INITIAL') return t
def function[t_bin_NUMBER, parameter[t]]: constant[[01]+] name[t].value assign[=] call[name[int], parameter[name[t].value, constant[2]]] call[name[t].lexer.begin, parameter[constant[INITIAL]]] return[name[t]]
keyword[def] identifier[t_bin_NUMBER] ( identifier[t] ): literal[string] identifier[t] . identifier[value] = identifier[int] ( identifier[t] . identifier[value] , literal[int] ) identifier[t] . identifier[lexer] . identifier[begin] ( literal[string] ) keyword[return] identifier[t]
def t_bin_NUMBER(t): """[01]+""" # A binary integer t.value = int(t.value, 2) t.lexer.begin('INITIAL') return t
def genCompleteTypes( compoundSig ): """ Generator function used to iterate over each complete, top-level type contained in in a signature. Ex:: "iii" => [ 'i', 'i', 'i' ] "i(ii)i" => [ 'i', '(ii)', 'i' ] "i(i(ii))i" => [ 'i', '(i(ii))', 'i' ] """ i = 0 s...
def function[genCompleteTypes, parameter[compoundSig]]: constant[ Generator function used to iterate over each complete, top-level type contained in in a signature. Ex:: "iii" => [ 'i', 'i', 'i' ] "i(ii)i" => [ 'i', '(ii)', 'i' ] "i(i(ii))i" => [ 'i', '(i(ii))', 'i' ]...
keyword[def] identifier[genCompleteTypes] ( identifier[compoundSig] ): literal[string] identifier[i] = literal[int] identifier[start] = literal[int] identifier[end] = identifier[len] ( identifier[compoundSig] ) keyword[def] identifier[find_end] ( identifier[idx] , identifier[b] , identi...
def genCompleteTypes(compoundSig): """ Generator function used to iterate over each complete, top-level type contained in in a signature. Ex:: "iii" => [ 'i', 'i', 'i' ] "i(ii)i" => [ 'i', '(ii)', 'i' ] "i(i(ii))i" => [ 'i', '(i(ii))', 'i' ] """ i = 0 start = ...
def get_links(html, outformat): """Return a list of reference links from the html. Parameters ---------- html : str outformat : int the output format of the citations Returns ------- List[str] the links to the references """ if outformat == FORMAT_BIBTEX: ...
def function[get_links, parameter[html, outformat]]: constant[Return a list of reference links from the html. Parameters ---------- html : str outformat : int the output format of the citations Returns ------- List[str] the links to the references ] if ...
keyword[def] identifier[get_links] ( identifier[html] , identifier[outformat] ): literal[string] keyword[if] identifier[outformat] == identifier[FORMAT_BIBTEX] : identifier[refre] = identifier[re] . identifier[compile] ( literal[string] ) keyword[elif] identifier[outformat] == identifier[FO...
def get_links(html, outformat): """Return a list of reference links from the html. Parameters ---------- html : str outformat : int the output format of the citations Returns ------- List[str] the links to the references """ if outformat == FORMAT_BIBTEX: ...
def list_connection_channels(self, name): """ List of all channels for a given connection. :param name: The connection name :type name: str """ return self._api_get('/api/connections/{0}/channels'.format( urllib.parse.quote_plus(name) ))
def function[list_connection_channels, parameter[self, name]]: constant[ List of all channels for a given connection. :param name: The connection name :type name: str ] return[call[name[self]._api_get, parameter[call[constant[/api/connections/{0}/channels].format, parameter[...
keyword[def] identifier[list_connection_channels] ( identifier[self] , identifier[name] ): literal[string] keyword[return] identifier[self] . identifier[_api_get] ( literal[string] . identifier[format] ( identifier[urllib] . identifier[parse] . identifier[quote_plus] ( identifier[name] ) ...
def list_connection_channels(self, name): """ List of all channels for a given connection. :param name: The connection name :type name: str """ return self._api_get('/api/connections/{0}/channels'.format(urllib.parse.quote_plus(name)))
def get_version(self): """Get the DCNM version.""" url = '%s://%s/rest/dcnm-version' % (self.dcnm_protocol, self._ip) payload = {} try: res = self._send_request('GET', url, payload, 'dcnm-version') if res and res.status_code in self._resp_ok: ret...
def function[get_version, parameter[self]]: constant[Get the DCNM version.] variable[url] assign[=] binary_operation[constant[%s://%s/rest/dcnm-version] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Attribute object at 0x7da1b1a5c460>, <ast.Attribute object at 0x7da1b1a5e050>]]] variable[payloa...
keyword[def] identifier[get_version] ( identifier[self] ): literal[string] identifier[url] = literal[string] %( identifier[self] . identifier[dcnm_protocol] , identifier[self] . identifier[_ip] ) identifier[payload] ={} keyword[try] : identifier[res] = identifier[se...
def get_version(self): """Get the DCNM version.""" url = '%s://%s/rest/dcnm-version' % (self.dcnm_protocol, self._ip) payload = {} try: res = self._send_request('GET', url, payload, 'dcnm-version') if res and res.status_code in self._resp_ok: return res.json().get('Dcnm-Versi...
def touch(filepath, times=None, mkdir=False): """ Update the modify (modify) and change (ctime) timestamps of a file, create if necessary >>> from pugnlp.constants import DATA_PATH >>> filepath = os.path.join(DATA_PATH, 'tmpfilefortouch.txt') >>> touch(filepath).endswith('tmpfilefortouch.txt') True...
def function[touch, parameter[filepath, times, mkdir]]: constant[ Update the modify (modify) and change (ctime) timestamps of a file, create if necessary >>> from pugnlp.constants import DATA_PATH >>> filepath = os.path.join(DATA_PATH, 'tmpfilefortouch.txt') >>> touch(filepath).endswith('tmpfilefor...
keyword[def] identifier[touch] ( identifier[filepath] , identifier[times] = keyword[None] , identifier[mkdir] = keyword[False] ): literal[string] identifier[filepath] = identifier[expand_path] ( identifier[filepath] ) keyword[if] identifier[mkdir] : identifier[mkdir_p] ( identifier[os] . ide...
def touch(filepath, times=None, mkdir=False): """ Update the modify (modify) and change (ctime) timestamps of a file, create if necessary >>> from pugnlp.constants import DATA_PATH >>> filepath = os.path.join(DATA_PATH, 'tmpfilefortouch.txt') >>> touch(filepath).endswith('tmpfilefortouch.txt') True...
def clean(self, exclude, max_count=None): """ Delete all objects except for those in the exclude :param exclude: a list of blob_hashes to skip. :param max_count: maximum number of object to delete :return: generator of objects that failed to delete """ return self...
def function[clean, parameter[self, exclude, max_count]]: constant[ Delete all objects except for those in the exclude :param exclude: a list of blob_hashes to skip. :param max_count: maximum number of object to delete :return: generator of objects that failed to delete ]...
keyword[def] identifier[clean] ( identifier[self] , identifier[exclude] , identifier[max_count] = keyword[None] ): literal[string] keyword[return] identifier[self] . identifier[client] . identifier[remove_objects] ( identifier[self] . identifier[bucket] , identifier[itertools] . identifier[islice]...
def clean(self, exclude, max_count=None): """ Delete all objects except for those in the exclude :param exclude: a list of blob_hashes to skip. :param max_count: maximum number of object to delete :return: generator of objects that failed to delete """ return self.client....
def read(self, file, nbytes): """Read nbytes characters from file while running Tk mainloop""" if not capable.OF_GRAPHICS: raise RuntimeError("Cannot run this command without graphics") if isinstance(file, int): fd = file else: # Otherwise, assume we h...
def function[read, parameter[self, file, nbytes]]: constant[Read nbytes characters from file while running Tk mainloop] if <ast.UnaryOp object at 0x7da1b0e60730> begin[:] <ast.Raise object at 0x7da1b0e63940> if call[name[isinstance], parameter[name[file], name[int]]] begin[:] ...
keyword[def] identifier[read] ( identifier[self] , identifier[file] , identifier[nbytes] ): literal[string] keyword[if] keyword[not] identifier[capable] . identifier[OF_GRAPHICS] : keyword[raise] identifier[RuntimeError] ( literal[string] ) keyword[if] identifier[isinstanc...
def read(self, file, nbytes): """Read nbytes characters from file while running Tk mainloop""" if not capable.OF_GRAPHICS: raise RuntimeError('Cannot run this command without graphics') # depends on [control=['if'], data=[]] if isinstance(file, int): fd = file # depends on [control=['if'],...