code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def atomic_write(filename, content, overwrite=True, permissions=0o0644, encoding='utf-8'): ''' Write a file atomically by writing the file content to a temporary location first, then renaming the file. TODO: this relies pretty heavily on os.rename to ensure atomicity, but os.rename does not s...
def function[atomic_write, parameter[filename, content, overwrite, permissions, encoding]]: constant[ Write a file atomically by writing the file content to a temporary location first, then renaming the file. TODO: this relies pretty heavily on os.rename to ensure atomicity, but os.rename...
keyword[def] identifier[atomic_write] ( identifier[filename] , identifier[content] , identifier[overwrite] = keyword[True] , identifier[permissions] = literal[int] , identifier[encoding] = literal[string] ): literal[string] identifier[filename] = identifier[os] . identifier[path] . identifier[expanduser] (...
def atomic_write(filename, content, overwrite=True, permissions=420, encoding='utf-8'): """ Write a file atomically by writing the file content to a temporary location first, then renaming the file. TODO: this relies pretty heavily on os.rename to ensure atomicity, but os.rename does not sile...
def atmos_worker(srcs, window, ij, args): """A simple atmospheric correction user function.""" src = srcs[0] rgb = src.read(window=window) rgb = to_math_type(rgb) atmos = simple_atmo(rgb, args["atmo"], args["contrast"], args["bias"]) # should be scaled 0 to 1, scale to outtype return scale...
def function[atmos_worker, parameter[srcs, window, ij, args]]: constant[A simple atmospheric correction user function.] variable[src] assign[=] call[name[srcs]][constant[0]] variable[rgb] assign[=] call[name[src].read, parameter[]] variable[rgb] assign[=] call[name[to_math_type], paramet...
keyword[def] identifier[atmos_worker] ( identifier[srcs] , identifier[window] , identifier[ij] , identifier[args] ): literal[string] identifier[src] = identifier[srcs] [ literal[int] ] identifier[rgb] = identifier[src] . identifier[read] ( identifier[window] = identifier[window] ) identifier[rgb]...
def atmos_worker(srcs, window, ij, args): """A simple atmospheric correction user function.""" src = srcs[0] rgb = src.read(window=window) rgb = to_math_type(rgb) atmos = simple_atmo(rgb, args['atmo'], args['contrast'], args['bias']) # should be scaled 0 to 1, scale to outtype return scale_d...
def from_file_path(cls, path_prefix): """Load the embedding matrix and the vocab from <path_prefix>.npy and <path_prefix>.vocab. :param (str) path_prefix: path prefix of the saved files """ with cls._path_prefix_to_files(path_prefix, 'r') as (array_file, vocab_file): return ...
def function[from_file_path, parameter[cls, path_prefix]]: constant[Load the embedding matrix and the vocab from <path_prefix>.npy and <path_prefix>.vocab. :param (str) path_prefix: path prefix of the saved files ] with call[name[cls]._path_prefix_to_files, parameter[name[path_prefix], ...
keyword[def] identifier[from_file_path] ( identifier[cls] , identifier[path_prefix] ): literal[string] keyword[with] identifier[cls] . identifier[_path_prefix_to_files] ( identifier[path_prefix] , literal[string] ) keyword[as] ( identifier[array_file] , identifier[vocab_file] ): keywo...
def from_file_path(cls, path_prefix): """Load the embedding matrix and the vocab from <path_prefix>.npy and <path_prefix>.vocab. :param (str) path_prefix: path prefix of the saved files """ with cls._path_prefix_to_files(path_prefix, 'r') as (array_file, vocab_file): return cls.from_fil...
def field_value(self, value): """Validate against NodeType. """ if not self.is_array: return self.field_type(value) if isinstance(value, (list, tuple, set)): return [self.field_type(item) for item in value] return self.field_type(value)
def function[field_value, parameter[self, value]]: constant[Validate against NodeType. ] if <ast.UnaryOp object at 0x7da18fe90100> begin[:] return[call[name[self].field_type, parameter[name[value]]]] if call[name[isinstance], parameter[name[value], tuple[[<ast.Name object at 0x7d...
keyword[def] identifier[field_value] ( identifier[self] , identifier[value] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[is_array] : keyword[return] identifier[self] . identifier[field_type] ( identifier[value] ) keyword[if] identifier[isinsta...
def field_value(self, value): """Validate against NodeType. """ if not self.is_array: return self.field_type(value) # depends on [control=['if'], data=[]] if isinstance(value, (list, tuple, set)): return [self.field_type(item) for item in value] # depends on [control=['if'], data=[...
def check_crtf(self): """ Checks for CRTF compatibility. """ if self.region_type not in regions_attributes: raise ValueError("'{0}' is not a valid region type in this package" "supported by CRTF".format(self.region_type)) if self.coordsys...
def function[check_crtf, parameter[self]]: constant[ Checks for CRTF compatibility. ] if compare[name[self].region_type <ast.NotIn object at 0x7da2590d7190> name[regions_attributes]] begin[:] <ast.Raise object at 0x7da207f9ba30> if compare[name[self].coordsys <ast.NotIn o...
keyword[def] identifier[check_crtf] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[region_type] keyword[not] keyword[in] identifier[regions_attributes] : keyword[raise] identifier[ValueError] ( literal[string] literal[string] . identi...
def check_crtf(self): """ Checks for CRTF compatibility. """ if self.region_type not in regions_attributes: raise ValueError("'{0}' is not a valid region type in this packagesupported by CRTF".format(self.region_type)) # depends on [control=['if'], data=[]] if self.coordsys not in v...
def GetK2Campaign(campaign, clobber=False, split=False, epics_only=False, cadence='lc'): ''' Return all stars in a given *K2* campaign. :param campaign: The *K2* campaign number. If this is an :py:class:`int`, \ returns all targets in that campaign. If a :py:class:`float` in \ ...
def function[GetK2Campaign, parameter[campaign, clobber, split, epics_only, cadence]]: constant[ Return all stars in a given *K2* campaign. :param campaign: The *K2* campaign number. If this is an :py:class:`int`, returns all targets in that campaign. If a :py:class:`float` in the...
keyword[def] identifier[GetK2Campaign] ( identifier[campaign] , identifier[clobber] = keyword[False] , identifier[split] = keyword[False] , identifier[epics_only] = keyword[False] , identifier[cadence] = literal[string] ): literal[string] identifier[all] = identifier[GetK2Stars] ( identifier[clobber] = i...
def GetK2Campaign(campaign, clobber=False, split=False, epics_only=False, cadence='lc'): """ Return all stars in a given *K2* campaign. :param campaign: The *K2* campaign number. If this is an :py:class:`int`, returns all targets in that campaign. If a :py:class:`float` in the form :p...
def _search(self): """Returns all documents in the doc dict. This function is not a part of the DocManager API, and is only used to simulate searching all documents from a backend. """ results = [] for _id in self.doc_dict: entry = self.doc_dict[_id] ...
def function[_search, parameter[self]]: constant[Returns all documents in the doc dict. This function is not a part of the DocManager API, and is only used to simulate searching all documents from a backend. ] variable[results] assign[=] list[[]] for taget[name[_id]] in ...
keyword[def] identifier[_search] ( identifier[self] ): literal[string] identifier[results] =[] keyword[for] identifier[_id] keyword[in] identifier[self] . identifier[doc_dict] : identifier[entry] = identifier[self] . identifier[doc_dict] [ identifier[_id] ] key...
def _search(self): """Returns all documents in the doc dict. This function is not a part of the DocManager API, and is only used to simulate searching all documents from a backend. """ results = [] for _id in self.doc_dict: entry = self.doc_dict[_id] if entry.doc is ...
def add_child(self, **kwargs): """Adds a child to the node.""" cls = get_result_class(self.__class__) if len(kwargs) == 1 and 'instance' in kwargs: # adding the passed (unsaved) instance to the tree newobj = kwargs['instance'] if newobj.pk: ra...
def function[add_child, parameter[self]]: constant[Adds a child to the node.] variable[cls] assign[=] call[name[get_result_class], parameter[name[self].__class__]] if <ast.BoolOp object at 0x7da20c794f10> begin[:] variable[newobj] assign[=] call[name[kwargs]][constant[instance]] ...
keyword[def] identifier[add_child] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[cls] = identifier[get_result_class] ( identifier[self] . identifier[__class__] ) keyword[if] identifier[len] ( identifier[kwargs] )== literal[int] keyword[and] literal[string] ke...
def add_child(self, **kwargs): """Adds a child to the node.""" cls = get_result_class(self.__class__) if len(kwargs) == 1 and 'instance' in kwargs: # adding the passed (unsaved) instance to the tree newobj = kwargs['instance'] if newobj.pk: raise NodeAlreadySaved('Attempt...
def search_certificate(self, hash): """ Searches for a specific certificate using its hash :param hash: certificate hash :type hash: str :return: dict """ c = CensysCertificates(api_id=self.__uid, api_secret=self.__api_key) return c.view(hash)
def function[search_certificate, parameter[self, hash]]: constant[ Searches for a specific certificate using its hash :param hash: certificate hash :type hash: str :return: dict ] variable[c] assign[=] call[name[CensysCertificates], parameter[]] return[call[n...
keyword[def] identifier[search_certificate] ( identifier[self] , identifier[hash] ): literal[string] identifier[c] = identifier[CensysCertificates] ( identifier[api_id] = identifier[self] . identifier[__uid] , identifier[api_secret] = identifier[self] . identifier[__api_key] ) keyword[retu...
def search_certificate(self, hash): """ Searches for a specific certificate using its hash :param hash: certificate hash :type hash: str :return: dict """ c = CensysCertificates(api_id=self.__uid, api_secret=self.__api_key) return c.view(hash)
def _compile_lock(self, query, value): """ Compile the lock into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :param value: The lock value :type value: bool or str :return: The compiled lock :rtype: str """ if isin...
def function[_compile_lock, parameter[self, query, value]]: constant[ Compile the lock into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :param value: The lock value :type value: bool or str :return: The compiled lock :rtype: str ...
keyword[def] identifier[_compile_lock] ( identifier[self] , identifier[query] , identifier[value] ): literal[string] keyword[if] identifier[isinstance] ( identifier[value] , identifier[basestring] ): keyword[return] identifier[value] keyword[if] identifier[value] keyword...
def _compile_lock(self, query, value): """ Compile the lock into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :param value: The lock value :type value: bool or str :return: The compiled lock :rtype: str """ if isinstance(v...
def get_sources(zone, permanent=True): ''' List sources bound to a zone .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' firewalld.get_sources zone ''' cmd = '--zone={0} --list-sources'.format(zone) if permanent: cmd += ' --permanent' return...
def function[get_sources, parameter[zone, permanent]]: constant[ List sources bound to a zone .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' firewalld.get_sources zone ] variable[cmd] assign[=] call[constant[--zone={0} --list-sources].format, parame...
keyword[def] identifier[get_sources] ( identifier[zone] , identifier[permanent] = keyword[True] ): literal[string] identifier[cmd] = literal[string] . identifier[format] ( identifier[zone] ) keyword[if] identifier[permanent] : identifier[cmd] += literal[string] keyword[return] ident...
def get_sources(zone, permanent=True): """ List sources bound to a zone .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' firewalld.get_sources zone """ cmd = '--zone={0} --list-sources'.format(zone) if permanent: cmd += ' --permanent' # depends o...
def sort_stats(stats, sortedby='cpu_percent', sortedby_secondary='memory_percent', reverse=True): """Return the stats (dict) sorted by (sortedby). Reverse the sort if reverse is True. """ if sortedby is None and sortedby_secondary is None: # No need ...
def function[sort_stats, parameter[stats, sortedby, sortedby_secondary, reverse]]: constant[Return the stats (dict) sorted by (sortedby). Reverse the sort if reverse is True. ] if <ast.BoolOp object at 0x7da18bc72620> begin[:] return[name[stats]] variable[sort_lambda] assign[=] ...
keyword[def] identifier[sort_stats] ( identifier[stats] , identifier[sortedby] = literal[string] , identifier[sortedby_secondary] = literal[string] , identifier[reverse] = keyword[True] ): literal[string] keyword[if] identifier[sortedby] keyword[is] keyword[None] keyword[and] identifier[sortedby_se...
def sort_stats(stats, sortedby='cpu_percent', sortedby_secondary='memory_percent', reverse=True): """Return the stats (dict) sorted by (sortedby). Reverse the sort if reverse is True. """ if sortedby is None and sortedby_secondary is None: # No need to sort... return stats # depends on...
def concatenate(arrs, axis=0): r"""Concatenate multiple values into a new unitized object. This is essentially a unit-aware version of `numpy.concatenate`. All items must be able to be converted to the same units. If an item has no units, it will be given those of the rest of the collection, without co...
def function[concatenate, parameter[arrs, axis]]: constant[Concatenate multiple values into a new unitized object. This is essentially a unit-aware version of `numpy.concatenate`. All items must be able to be converted to the same units. If an item has no units, it will be given those of the rest o...
keyword[def] identifier[concatenate] ( identifier[arrs] , identifier[axis] = literal[int] ): literal[string] identifier[dest] = literal[string] keyword[for] identifier[a] keyword[in] identifier[arrs] : keyword[if] identifier[hasattr] ( identifier[a] , literal[string] ): iden...
def concatenate(arrs, axis=0): """Concatenate multiple values into a new unitized object. This is essentially a unit-aware version of `numpy.concatenate`. All items must be able to be converted to the same units. If an item has no units, it will be given those of the rest of the collection, without con...
def from_file(filename): """Creates a new Spec object from a given file. :param filename: The path to the spec file. :return: A new Spec object. """ spec = Spec() with open(filename, "r", encoding="utf-8") as f: parse_context = {"current_subpackage": None} ...
def function[from_file, parameter[filename]]: constant[Creates a new Spec object from a given file. :param filename: The path to the spec file. :return: A new Spec object. ] variable[spec] assign[=] call[name[Spec], parameter[]] with call[name[open], parameter[name[filen...
keyword[def] identifier[from_file] ( identifier[filename] ): literal[string] identifier[spec] = identifier[Spec] () keyword[with] identifier[open] ( identifier[filename] , literal[string] , identifier[encoding] = literal[string] ) keyword[as] identifier[f] : identifier[pars...
def from_file(filename): """Creates a new Spec object from a given file. :param filename: The path to the spec file. :return: A new Spec object. """ spec = Spec() with open(filename, 'r', encoding='utf-8') as f: parse_context = {'current_subpackage': None} for line i...
def all(self): """ Returns all the values joined together. :return <int> """ out = 0 for key, value in self.items(): out |= value return out
def function[all, parameter[self]]: constant[ Returns all the values joined together. :return <int> ] variable[out] assign[=] constant[0] for taget[tuple[[<ast.Name object at 0x7da18f00d9f0>, <ast.Name object at 0x7da18f00ece0>]]] in starred[call[name[self].i...
keyword[def] identifier[all] ( identifier[self] ): literal[string] identifier[out] = literal[int] keyword[for] identifier[key] , identifier[value] keyword[in] identifier[self] . identifier[items] (): identifier[out] |= identifier[value] keyword[return] identifie...
def all(self): """ Returns all the values joined together. :return <int> """ out = 0 for (key, value) in self.items(): out |= value # depends on [control=['for'], data=[]] return out
def delete_address_by_id(cls, address_id, **kwargs): """Delete Address Delete an instance of Address by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.delete_address_by_id(address_id,...
def function[delete_address_by_id, parameter[cls, address_id]]: constant[Delete Address Delete an instance of Address by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.delete_address_...
keyword[def] identifier[delete_address_by_id] ( identifier[cls] , identifier[address_id] ,** identifier[kwargs] ): literal[string] identifier[kwargs] [ literal[string] ]= keyword[True] keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ): keyword[return] ide...
def delete_address_by_id(cls, address_id, **kwargs): """Delete Address Delete an instance of Address by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.delete_address_by_id(address_id, asy...
def set_result_type(self, result_type): """ Sets 'result_type' parameter to specify what type of search \ results you would prefer to receive. The current default is “mixed.” \ Valid values include: \ - mixed: Include both popular and real time results \ - recent: return ...
def function[set_result_type, parameter[self, result_type]]: constant[ Sets 'result_type' parameter to specify what type of search results you would prefer to receive. The current default is “mixed.” Valid values include: - mixed: Include both popular and real time results ...
keyword[def] identifier[set_result_type] ( identifier[self] , identifier[result_type] ): literal[string] identifier[result_type] = identifier[result_type] . identifier[lower] () keyword[if] identifier[result_type] keyword[in] [ literal[string] , literal[string] , literal[string] ]: ...
def set_result_type(self, result_type): """ Sets 'result_type' parameter to specify what type of search results you would prefer to receive. The current default is “mixed.” Valid values include: - mixed: Include both popular and real time results - recent: return only the mos...
def quaternion_conjugate(quaternion): """Return conjugate of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_conjugate(q0) >>> q1[0] == q0[0] and all(q1[1:] == -q0[1:]) True """ q = np.array(quaternion, dtype=np.float64, copy=True) np.negative(q[1:], q[1:]) return q
def function[quaternion_conjugate, parameter[quaternion]]: constant[Return conjugate of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_conjugate(q0) >>> q1[0] == q0[0] and all(q1[1:] == -q0[1:]) True ] variable[q] assign[=] call[name[np].array, parameter[name[quaterni...
keyword[def] identifier[quaternion_conjugate] ( identifier[quaternion] ): literal[string] identifier[q] = identifier[np] . identifier[array] ( identifier[quaternion] , identifier[dtype] = identifier[np] . identifier[float64] , identifier[copy] = keyword[True] ) identifier[np] . identifier[negative] ( ...
def quaternion_conjugate(quaternion): """Return conjugate of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_conjugate(q0) >>> q1[0] == q0[0] and all(q1[1:] == -q0[1:]) True """ q = np.array(quaternion, dtype=np.float64, copy=True) np.negative(q[1:], q[1:]) return q
def get_headers(data, extra_headers=None): ''' Takes the response data as well as any additional headers and returns a tuple of tuples of headers suitable for passing to start_response() ''' response_headers = { 'Content-Length': str(len(data)), } if extra_headers: response_...
def function[get_headers, parameter[data, extra_headers]]: constant[ Takes the response data as well as any additional headers and returns a tuple of tuples of headers suitable for passing to start_response() ] variable[response_headers] assign[=] dictionary[[<ast.Constant object at 0x7da18e...
keyword[def] identifier[get_headers] ( identifier[data] , identifier[extra_headers] = keyword[None] ): literal[string] identifier[response_headers] ={ literal[string] : identifier[str] ( identifier[len] ( identifier[data] )), } keyword[if] identifier[extra_headers] : identifier[res...
def get_headers(data, extra_headers=None): """ Takes the response data as well as any additional headers and returns a tuple of tuples of headers suitable for passing to start_response() """ response_headers = {'Content-Length': str(len(data))} if extra_headers: response_headers.update(e...
def check(self): """ Determine how long until the next scheduled time for a Task. Returns the number of seconds until the next scheduled time or zero if the task needs to be run immediately. If it's an hourly task and it's never been run, run it now. If it's a daily task ...
def function[check, parameter[self]]: constant[ Determine how long until the next scheduled time for a Task. Returns the number of seconds until the next scheduled time or zero if the task needs to be run immediately. If it's an hourly task and it's never been run, run it now. ...
keyword[def] identifier[check] ( identifier[self] ): literal[string] identifier[boto] . identifier[log] . identifier[info] ( literal[string] %( identifier[self] . identifier[name] , identifier[self] . identifier[now] , identifier[self] . identifier[last_executed] )) keyword[if] identifie...
def check(self): """ Determine how long until the next scheduled time for a Task. Returns the number of seconds until the next scheduled time or zero if the task needs to be run immediately. If it's an hourly task and it's never been run, run it now. If it's a daily task and ...
def recursive_copy(source, dest): ''' Recursively copy the source directory to the destination, leaving files with the source does not explicitly overwrite. (identical to cp -r on a unix machine) ''' for root, _, files in salt.utils.path.os_walk(source): path_from_source = root.replace(...
def function[recursive_copy, parameter[source, dest]]: constant[ Recursively copy the source directory to the destination, leaving files with the source does not explicitly overwrite. (identical to cp -r on a unix machine) ] for taget[tuple[[<ast.Name object at 0x7da1b1c37430>, <ast.Nam...
keyword[def] identifier[recursive_copy] ( identifier[source] , identifier[dest] ): literal[string] keyword[for] identifier[root] , identifier[_] , identifier[files] keyword[in] identifier[salt] . identifier[utils] . identifier[path] . identifier[os_walk] ( identifier[source] ): identifier[path_...
def recursive_copy(source, dest): """ Recursively copy the source directory to the destination, leaving files with the source does not explicitly overwrite. (identical to cp -r on a unix machine) """ for (root, _, files) in salt.utils.path.os_walk(source): path_from_source = root.replac...
def save(self, validate=False): """ Save the current values in all the widgets back to the persistent data storage. :param validate: Whether to validate the data before saving. Calling this while setting the `data` field (e.g. in a widget callback) will have no effect. ...
def function[save, parameter[self, validate]]: constant[ Save the current values in all the widgets back to the persistent data storage. :param validate: Whether to validate the data before saving. Calling this while setting the `data` field (e.g. in a widget callback) will have no ...
keyword[def] identifier[save] ( identifier[self] , identifier[validate] = keyword[False] ): literal[string] keyword[if] identifier[self] . identifier[_in_call] : keyword[return] identifier[invalid] =[] keyword[for] identifier[layout]...
def save(self, validate=False): """ Save the current values in all the widgets back to the persistent data storage. :param validate: Whether to validate the data before saving. Calling this while setting the `data` field (e.g. in a widget callback) will have no effect. Whe...
def compcor( boldImage, ncompcor=4, quantile=0.975, mask=None, filter_type=False, degree=2 ): """ Compute noise components from the input image ANTsR function: `compcor` this is adapted from nipy code https://github.com/nipy/nipype/blob/e29ac95fc0fc00fedbcaa0adaf29d5878408ca7c/nipype/algorithms/confou...
def function[compcor, parameter[boldImage, ncompcor, quantile, mask, filter_type, degree]]: constant[ Compute noise components from the input image ANTsR function: `compcor` this is adapted from nipy code https://github.com/nipy/nipype/blob/e29ac95fc0fc00fedbcaa0adaf29d5878408ca7c/nipype/algorithm...
keyword[def] identifier[compcor] ( identifier[boldImage] , identifier[ncompcor] = literal[int] , identifier[quantile] = literal[int] , identifier[mask] = keyword[None] , identifier[filter_type] = keyword[False] , identifier[degree] = literal[int] ): literal[string] keyword[def] identifier[compute_tSTD] (...
def compcor(boldImage, ncompcor=4, quantile=0.975, mask=None, filter_type=False, degree=2): """ Compute noise components from the input image ANTsR function: `compcor` this is adapted from nipy code https://github.com/nipy/nipype/blob/e29ac95fc0fc00fedbcaa0adaf29d5878408ca7c/nipype/algorithms/confound...
def pay_cost(self, source, amount: int) -> int: """ Make player pay \a amount mana. Returns how much mana is spent, after temporary mana adjustments. """ if self.spells_cost_health and source.type == CardType.SPELL: self.log("%s spells cost %i health", self, amount) self.game.queue_actions(self, [Hit(se...
def function[pay_cost, parameter[self, source, amount]]: constant[ Make player pay  amount mana. Returns how much mana is spent, after temporary mana adjustments. ] if <ast.BoolOp object at 0x7da1b08e7340> begin[:] call[name[self].log, parameter[constant[%s spells cost %i health],...
keyword[def] identifier[pay_cost] ( identifier[self] , identifier[source] , identifier[amount] : identifier[int] )-> identifier[int] : literal[string] keyword[if] identifier[self] . identifier[spells_cost_health] keyword[and] identifier[source] . identifier[type] == identifier[CardType] . identifier[SPELL] ...
def pay_cost(self, source, amount: int) -> int: """ Make player pay \x07 amount mana. Returns how much mana is spent, after temporary mana adjustments. """ if self.spells_cost_health and source.type == CardType.SPELL: self.log('%s spells cost %i health', self, amount) self.game.queue_actio...
def timeit(func): ''' 计算运行消耗时间 @timeit def test(): time.sleep(1) ''' def wapper(*args, **kwargs): _start = time.time() retval = func(*args, **kwargs) _end = time.time() logger.info('function %s() used : %.6f s' % (func.__name__, _end - _start)) re...
def function[timeit, parameter[func]]: constant[ 计算运行消耗时间 @timeit def test(): time.sleep(1) ] def function[wapper, parameter[]]: variable[_start] assign[=] call[name[time].time, parameter[]] variable[retval] assign[=] call[name[func], parameter[<as...
keyword[def] identifier[timeit] ( identifier[func] ): literal[string] keyword[def] identifier[wapper] (* identifier[args] ,** identifier[kwargs] ): identifier[_start] = identifier[time] . identifier[time] () identifier[retval] = identifier[func] (* identifier[args] ,** identifier[kwargs...
def timeit(func): """ 计算运行消耗时间 @timeit def test(): time.sleep(1) """ def wapper(*args, **kwargs): _start = time.time() retval = func(*args, **kwargs) _end = time.time() logger.info('function %s() used : %.6f s' % (func.__name__, _end - _start)) re...
def _harmonic_number(x): """Compute the harmonic number from its analytic continuation. Derivation from [here]( https://en.wikipedia.org/wiki/Digamma_function#Relation_to_harmonic_numbers) and [Euler's constant]( https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant). Args: x: input float. ...
def function[_harmonic_number, parameter[x]]: constant[Compute the harmonic number from its analytic continuation. Derivation from [here]( https://en.wikipedia.org/wiki/Digamma_function#Relation_to_harmonic_numbers) and [Euler's constant]( https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant...
keyword[def] identifier[_harmonic_number] ( identifier[x] ): literal[string] identifier[one] = identifier[tf] . identifier[ones] ([], identifier[dtype] = identifier[x] . identifier[dtype] ) keyword[return] identifier[tf] . identifier[math] . identifier[digamma] ( identifier[x] + identifier[one] )- identifi...
def _harmonic_number(x): """Compute the harmonic number from its analytic continuation. Derivation from [here]( https://en.wikipedia.org/wiki/Digamma_function#Relation_to_harmonic_numbers) and [Euler's constant]( https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant). Args: x: input float....
def _compute_and_transfer_to_final_run(self, process_name, start_timeperiod, end_timeperiod, job_record): """ method computes new unit_of_work and transfers the job to STATE_FINAL_RUN it also shares _fuzzy_ DuplicateKeyError logic from _compute_and_transfer_to_progress method""" source_collectio...
def function[_compute_and_transfer_to_final_run, parameter[self, process_name, start_timeperiod, end_timeperiod, job_record]]: constant[ method computes new unit_of_work and transfers the job to STATE_FINAL_RUN it also shares _fuzzy_ DuplicateKeyError logic from _compute_and_transfer_to_progress method]...
keyword[def] identifier[_compute_and_transfer_to_final_run] ( identifier[self] , identifier[process_name] , identifier[start_timeperiod] , identifier[end_timeperiod] , identifier[job_record] ): literal[string] identifier[source_collection_name] = identifier[context] . identifier[process_context] [ ...
def _compute_and_transfer_to_final_run(self, process_name, start_timeperiod, end_timeperiod, job_record): """ method computes new unit_of_work and transfers the job to STATE_FINAL_RUN it also shares _fuzzy_ DuplicateKeyError logic from _compute_and_transfer_to_progress method""" source_collection_name =...
def disassemble(qobj): """Dissasemble a qobj and return the circuits, run_config, and user header Args: qobj (Qobj): The input qobj object to dissasemble Returns: circuits (list): A list of quantum circuits run_config (dict): The dist of the run config user_qobj_header (dict...
def function[disassemble, parameter[qobj]]: constant[Dissasemble a qobj and return the circuits, run_config, and user header Args: qobj (Qobj): The input qobj object to dissasemble Returns: circuits (list): A list of quantum circuits run_config (dict): The dist of the run config...
keyword[def] identifier[disassemble] ( identifier[qobj] ): literal[string] identifier[run_config] = identifier[qobj] . identifier[config] . identifier[to_dict] () identifier[user_qobj_header] = identifier[qobj] . identifier[header] . identifier[to_dict] () identifier[circuits] = identifier[_exper...
def disassemble(qobj): """Dissasemble a qobj and return the circuits, run_config, and user header Args: qobj (Qobj): The input qobj object to dissasemble Returns: circuits (list): A list of quantum circuits run_config (dict): The dist of the run config user_qobj_header (dict...
def confirm(message='Confirm (y or n) '): """ Display a confirmation prompt. """ assert isinstance(message, text_type) app = create_confirm_application(message) return run_application(app)
def function[confirm, parameter[message]]: constant[ Display a confirmation prompt. ] assert[call[name[isinstance], parameter[name[message], name[text_type]]]] variable[app] assign[=] call[name[create_confirm_application], parameter[name[message]]] return[call[name[run_application], para...
keyword[def] identifier[confirm] ( identifier[message] = literal[string] ): literal[string] keyword[assert] identifier[isinstance] ( identifier[message] , identifier[text_type] ) identifier[app] = identifier[create_confirm_application] ( identifier[message] ) keyword[return] identifier[run_app...
def confirm(message='Confirm (y or n) '): """ Display a confirmation prompt. """ assert isinstance(message, text_type) app = create_confirm_application(message) return run_application(app)
def add(self, s, c, track=False): """ This function adds constraints to the backend solver. :param c: A sequence of ASTs :param s: A backend solver object :param bool track: True to enable constraint tracking, which is used in unsat_core() """ return self._add(s,...
def function[add, parameter[self, s, c, track]]: constant[ This function adds constraints to the backend solver. :param c: A sequence of ASTs :param s: A backend solver object :param bool track: True to enable constraint tracking, which is used in unsat_core() ] retu...
keyword[def] identifier[add] ( identifier[self] , identifier[s] , identifier[c] , identifier[track] = keyword[False] ): literal[string] keyword[return] identifier[self] . identifier[_add] ( identifier[s] , identifier[self] . identifier[convert_list] ( identifier[c] ), identifier[track] = identifie...
def add(self, s, c, track=False): """ This function adds constraints to the backend solver. :param c: A sequence of ASTs :param s: A backend solver object :param bool track: True to enable constraint tracking, which is used in unsat_core() """ return self._add(s, self.co...
def _get_point_value(self, loglstar): """Grab the first live point proposal in the queue.""" # If the queue is empty, refill it. if self.nqueue <= 0: self._fill_queue(loglstar) # Grab the earliest entry. u, v, logl, nc, blob = self.queue.pop(0) self.used += ...
def function[_get_point_value, parameter[self, loglstar]]: constant[Grab the first live point proposal in the queue.] if compare[name[self].nqueue less_or_equal[<=] constant[0]] begin[:] call[name[self]._fill_queue, parameter[name[loglstar]]] <ast.Tuple object at 0x7da1b1d4b0a0> ...
keyword[def] identifier[_get_point_value] ( identifier[self] , identifier[loglstar] ): literal[string] keyword[if] identifier[self] . identifier[nqueue] <= literal[int] : identifier[self] . identifier[_fill_queue] ( identifier[loglstar] ) identifier[u]...
def _get_point_value(self, loglstar): """Grab the first live point proposal in the queue.""" # If the queue is empty, refill it. if self.nqueue <= 0: self._fill_queue(loglstar) # depends on [control=['if'], data=[]] # Grab the earliest entry. (u, v, logl, nc, blob) = self.queue.pop(0) s...
def hist_1d_index(x, shape): """ Fast 1d histogram of 1D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram(). The indices are given in coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like shape :...
def function[hist_1d_index, parameter[x, shape]]: constant[ Fast 1d histogram of 1D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram(). The indices are given in coordinates and have to fit into a histogram of the dimensions shape. Parameters ----------...
keyword[def] identifier[hist_1d_index] ( identifier[x] , identifier[shape] ): literal[string] keyword[if] identifier[len] ( identifier[shape] )!= literal[int] : keyword[raise] identifier[InvalidInputError] ( literal[string] ) identifier[x] = identifier[np] . identifier[ascontiguou...
def hist_1d_index(x, shape): """ Fast 1d histogram of 1D indices with C++ inner loop optimization. Is more than 2 orders faster than np.histogram(). The indices are given in coordinates and have to fit into a histogram of the dimensions shape. Parameters ---------- x : array like shape :...
def get_column_at_index(self, index): """ Returns a table column by it's index :param int index: the zero-indexed position of the column in the table """ if index is None: return None url = self.build_url(self._endpoints.get('get_column_index')) respo...
def function[get_column_at_index, parameter[self, index]]: constant[ Returns a table column by it's index :param int index: the zero-indexed position of the column in the table ] if compare[name[index] is constant[None]] begin[:] return[constant[None]] variable[ur...
keyword[def] identifier[get_column_at_index] ( identifier[self] , identifier[index] ): literal[string] keyword[if] identifier[index] keyword[is] keyword[None] : keyword[return] keyword[None] identifier[url] = identifier[self] . identifier[build_url] ( identifier[self] . ...
def get_column_at_index(self, index): """ Returns a table column by it's index :param int index: the zero-indexed position of the column in the table """ if index is None: return None # depends on [control=['if'], data=[]] url = self.build_url(self._endpoints.get('get_column...
def __move_line_or_selection(self, after_current_line=True): """Move current line or selected text""" cursor = self.textCursor() cursor.beginEditBlock() start_pos, end_pos = self.__save_selection() last_line = False # ------ Select text # Get selection ...
def function[__move_line_or_selection, parameter[self, after_current_line]]: constant[Move current line or selected text] variable[cursor] assign[=] call[name[self].textCursor, parameter[]] call[name[cursor].beginEditBlock, parameter[]] <ast.Tuple object at 0x7da2054a4490> assign[=] call...
keyword[def] identifier[__move_line_or_selection] ( identifier[self] , identifier[after_current_line] = keyword[True] ): literal[string] identifier[cursor] = identifier[self] . identifier[textCursor] () identifier[cursor] . identifier[beginEditBlock] () identifier[start_pos] ,...
def __move_line_or_selection(self, after_current_line=True): """Move current line or selected text""" cursor = self.textCursor() cursor.beginEditBlock() (start_pos, end_pos) = self.__save_selection() last_line = False # ------ Select text # Get selection start location cursor.setPosition(st...
def addFolderPermission(self, principal, isAllowed=True, folder=None): """ Assigns a new permission to a role (principal). The permission on a parent resource is automatically inherited by all child resources Input: principal - name of role to assign/dis...
def function[addFolderPermission, parameter[self, principal, isAllowed, folder]]: constant[ Assigns a new permission to a role (principal). The permission on a parent resource is automatically inherited by all child resources Input: principal - name of r...
keyword[def] identifier[addFolderPermission] ( identifier[self] , identifier[principal] , identifier[isAllowed] = keyword[True] , identifier[folder] = keyword[None] ): literal[string] keyword[if] identifier[folder] keyword[is] keyword[not] keyword[None] : identifier[uURL] = identif...
def addFolderPermission(self, principal, isAllowed=True, folder=None): """ Assigns a new permission to a role (principal). The permission on a parent resource is automatically inherited by all child resources Input: principal - name of role to assign/disassi...
def list_straten_adapter(obj, request): """ Adapter for rendering a list of :class:`crabpy.gateway.crab.Straat` to json. """ return { 'id': obj.id, 'label': obj.label, 'status': { 'id': obj.status.id, 'naam': obj.status.naam, 'definitie': o...
def function[list_straten_adapter, parameter[obj, request]]: constant[ Adapter for rendering a list of :class:`crabpy.gateway.crab.Straat` to json. ] return[dictionary[[<ast.Constant object at 0x7da20c796560>, <ast.Constant object at 0x7da20c795c30>, <ast.Constant object at 0x7da204565f30>], [<a...
keyword[def] identifier[list_straten_adapter] ( identifier[obj] , identifier[request] ): literal[string] keyword[return] { literal[string] : identifier[obj] . identifier[id] , literal[string] : identifier[obj] . identifier[label] , literal[string] :{ literal[string] : identifier[obj] . ...
def list_straten_adapter(obj, request): """ Adapter for rendering a list of :class:`crabpy.gateway.crab.Straat` to json. """ return {'id': obj.id, 'label': obj.label, 'status': {'id': obj.status.id, 'naam': obj.status.naam, 'definitie': obj.status.definitie}}
def setKeyColor( self, key, color ): """ Sets the color used when rendering pie charts. :param key | <str> color | <QColor> """ self._keyColors[nativestring(key)] = QColor(color)
def function[setKeyColor, parameter[self, key, color]]: constant[ Sets the color used when rendering pie charts. :param key | <str> color | <QColor> ] call[name[self]._keyColors][call[name[nativestring], parameter[name[key]]]] assign[=] call[na...
keyword[def] identifier[setKeyColor] ( identifier[self] , identifier[key] , identifier[color] ): literal[string] identifier[self] . identifier[_keyColors] [ identifier[nativestring] ( identifier[key] )]= identifier[QColor] ( identifier[color] )
def setKeyColor(self, key, color): """ Sets the color used when rendering pie charts. :param key | <str> color | <QColor> """ self._keyColors[nativestring(key)] = QColor(color)
def sort_servers_closest(servers: Sequence[str]) -> Sequence[Tuple[str, float]]: """Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty...
def function[sort_servers_closest, parameter[servers]]: constant[Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty) ] ...
keyword[def] identifier[sort_servers_closest] ( identifier[servers] : identifier[Sequence] [ identifier[str] ])-> identifier[Sequence] [ identifier[Tuple] [ identifier[str] , identifier[float] ]]: literal[string] keyword[if] keyword[not] { identifier[urlparse] ( identifier[url] ). identifier[scheme] keyw...
def sort_servers_closest(servers: Sequence[str]) -> Sequence[Tuple[str, float]]: """Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty...
def parse_entry_media_attributes(self, soup): """ Args: soup: a bs4 element containing a row from the current media list Return a dict of attributes of the media the row is about. """ row_info = {} try: start = utilities.parse_profile_date(soup.find('series_start').text) ...
def function[parse_entry_media_attributes, parameter[self, soup]]: constant[ Args: soup: a bs4 element containing a row from the current media list Return a dict of attributes of the media the row is about. ] variable[row_info] assign[=] dictionary[[], []] <ast.Try object at...
keyword[def] identifier[parse_entry_media_attributes] ( identifier[self] , identifier[soup] ): literal[string] identifier[row_info] ={} keyword[try] : identifier[start] = identifier[utilities] . identifier[parse_profile_date] ( identifier[soup] . identifier[find] ( literal[string] ). identifie...
def parse_entry_media_attributes(self, soup): """ Args: soup: a bs4 element containing a row from the current media list Return a dict of attributes of the media the row is about. """ row_info = {} try: start = utilities.parse_profile_date(soup.find('series_start').text) # ...
def is_logged_in(self, name_id): """ Check if user is in the cache :param name_id: The identifier of the subject """ identity = self.users.get_identity(name_id)[0] return bool(identity)
def function[is_logged_in, parameter[self, name_id]]: constant[ Check if user is in the cache :param name_id: The identifier of the subject ] variable[identity] assign[=] call[call[name[self].users.get_identity, parameter[name[name_id]]]][constant[0]] return[call[name[bool], paramet...
keyword[def] identifier[is_logged_in] ( identifier[self] , identifier[name_id] ): literal[string] identifier[identity] = identifier[self] . identifier[users] . identifier[get_identity] ( identifier[name_id] )[ literal[int] ] keyword[return] identifier[bool] ( identifier[identity] )
def is_logged_in(self, name_id): """ Check if user is in the cache :param name_id: The identifier of the subject """ identity = self.users.get_identity(name_id)[0] return bool(identity)
def sieve(self, ifos=None, description=None, segment=None, segmentlist=None, exact_match=False): """ Return a Cache object with those CacheEntries that contain the given patterns (or overlap, in the case of segment or segmentlist). If exact_match is True, then non-None ifos, description, and segment patter...
def function[sieve, parameter[self, ifos, description, segment, segmentlist, exact_match]]: constant[ Return a Cache object with those CacheEntries that contain the given patterns (or overlap, in the case of segment or segmentlist). If exact_match is True, then non-None ifos, description, and segment p...
keyword[def] identifier[sieve] ( identifier[self] , identifier[ifos] = keyword[None] , identifier[description] = keyword[None] , identifier[segment] = keyword[None] , identifier[segmentlist] = keyword[None] , identifier[exact_match] = keyword[False] ): literal[string] keyword[if] identifier[exact_match] : ...
def sieve(self, ifos=None, description=None, segment=None, segmentlist=None, exact_match=False): """ Return a Cache object with those CacheEntries that contain the given patterns (or overlap, in the case of segment or segmentlist). If exact_match is True, then non-None ifos, description, and segment patter...
def esc_split(text, delimiter=" ", maxsplit=-1, escape="\\", *, ignore_empty=False): """Escape-aware text splitting: Split text on on a delimiter, recognizing escaped delimiters.""" is_escaped = False split_count = 0 yval = [] for char in text: if is_escaped: is_escaped = False yval.append...
def function[esc_split, parameter[text, delimiter, maxsplit, escape]]: constant[Escape-aware text splitting: Split text on on a delimiter, recognizing escaped delimiters.] variable[is_escaped] assign[=] constant[False] variable[split_count] assign[=] constant[0] variable[yval] assign[...
keyword[def] identifier[esc_split] ( identifier[text] , identifier[delimiter] = literal[string] , identifier[maxsplit] =- literal[int] , identifier[escape] = literal[string] ,*, identifier[ignore_empty] = keyword[False] ): literal[string] identifier[is_escaped] = keyword[False] identifier[split_count] = li...
def esc_split(text, delimiter=' ', maxsplit=-1, escape='\\', *, ignore_empty=False): """Escape-aware text splitting: Split text on on a delimiter, recognizing escaped delimiters.""" is_escaped = False split_count = 0 yval = [] for char in text: if is_escaped: is_escaped = Fals...
def calculate_first_digit(number): """ This function calculates the first check digit of a cpf or cnpj. :param number: cpf (length 9) or cnpf (length 12) string to check the first digit. Only numbers. :type number: string :returns: string -- the first digit """ ...
def function[calculate_first_digit, parameter[number]]: constant[ This function calculates the first check digit of a cpf or cnpj. :param number: cpf (length 9) or cnpf (length 12) string to check the first digit. Only numbers. :type number: string :returns: string ...
keyword[def] identifier[calculate_first_digit] ( identifier[number] ): literal[string] identifier[sum] = literal[int] keyword[if] identifier[len] ( identifier[number] )== literal[int] : identifier[weights] = identifier[CPF_WEIGHTS] [ literal[int] ] keyword[else] : identifier[...
def calculate_first_digit(number): """ This function calculates the first check digit of a cpf or cnpj. :param number: cpf (length 9) or cnpf (length 12) string to check the first digit. Only numbers. :type number: string :returns: string -- the first digit """ ...
def session(self, sid): """Return the user session for a client with context manager syntax. :param sid: The session id of the client. This is a context manager that returns the user session dictionary for the client. Any changes that are made to this dictionary inside the cont...
def function[session, parameter[self, sid]]: constant[Return the user session for a client with context manager syntax. :param sid: The session id of the client. This is a context manager that returns the user session dictionary for the client. Any changes that are made to this diction...
keyword[def] identifier[session] ( identifier[self] , identifier[sid] ): literal[string] keyword[class] identifier[_session_context_manager] ( identifier[object] ): keyword[def] identifier[__init__] ( identifier[self] , identifier[server] , identifier[sid] ): identif...
def session(self, sid): """Return the user session for a client with context manager syntax. :param sid: The session id of the client. This is a context manager that returns the user session dictionary for the client. Any changes that are made to this dictionary inside the context ...
def image_import(self, image_name, url, image_meta, remote_host=None): """Import the image specified in url to SDK image repository, and create a record in image db, the imported images are located in image_repository/prov_method/os_version/image_name/, for example, /opt/sdk/images/netbo...
def function[image_import, parameter[self, image_name, url, image_meta, remote_host]]: constant[Import the image specified in url to SDK image repository, and create a record in image db, the imported images are located in image_repository/prov_method/os_version/image_name/, for example, ...
keyword[def] identifier[image_import] ( identifier[self] , identifier[image_name] , identifier[url] , identifier[image_meta] , identifier[remote_host] = keyword[None] ): literal[string] identifier[image_info] =[] keyword[try] : identifier[image_info] = identifier[self] . ident...
def image_import(self, image_name, url, image_meta, remote_host=None): """Import the image specified in url to SDK image repository, and create a record in image db, the imported images are located in image_repository/prov_method/os_version/image_name/, for example, /opt/sdk/images/netboot/r...
def write_message(self, message, binary=False, locked=True): ''' Override parent write_message with a version that acquires a write lock before writing. ''' if locked: with (yield self.write_lock.acquire()): yield super(WSHandler, self).write_message(message,...
def function[write_message, parameter[self, message, binary, locked]]: constant[ Override parent write_message with a version that acquires a write lock before writing. ] if name[locked] begin[:] with <ast.Yield object at 0x7da1b21d69b0> begin[:] ...
keyword[def] identifier[write_message] ( identifier[self] , identifier[message] , identifier[binary] = keyword[False] , identifier[locked] = keyword[True] ): literal[string] keyword[if] identifier[locked] : keyword[with] ( keyword[yield] identifier[self] . identifier[write_lock] . id...
def write_message(self, message, binary=False, locked=True): """ Override parent write_message with a version that acquires a write lock before writing. """ if locked: with (yield self.write_lock.acquire()): yield super(WSHandler, self).write_message(message, binary) # depe...
def words(self, quantity: int = 5) -> List[str]: """Generate lis of the random words. :param quantity: Quantity of words. Default is 5. :return: Word list. :Example: [science, network, god, octopus, love] """ words = self._data['words'].get('normal') ...
def function[words, parameter[self, quantity]]: constant[Generate lis of the random words. :param quantity: Quantity of words. Default is 5. :return: Word list. :Example: [science, network, god, octopus, love] ] variable[words] assign[=] call[call[name[self]...
keyword[def] identifier[words] ( identifier[self] , identifier[quantity] : identifier[int] = literal[int] )-> identifier[List] [ identifier[str] ]: literal[string] identifier[words] = identifier[self] . identifier[_data] [ literal[string] ]. identifier[get] ( literal[string] ) identifier[w...
def words(self, quantity: int=5) -> List[str]: """Generate lis of the random words. :param quantity: Quantity of words. Default is 5. :return: Word list. :Example: [science, network, god, octopus, love] """ words = self._data['words'].get('normal') words_list = ...
async def list_pools() -> None: """ Lists names of created pool ledgers :return: Error code """ logger = logging.getLogger(__name__) logger.debug("list_pools: >>> ") if not hasattr(list_pools, "cb"): logger.debug("list_pools: Creating callback") list_pools.cb = create_cb(CF...
<ast.AsyncFunctionDef object at 0x7da18f00c910>
keyword[async] keyword[def] identifier[list_pools] ()-> keyword[None] : literal[string] identifier[logger] = identifier[logging] . identifier[getLogger] ( identifier[__name__] ) identifier[logger] . identifier[debug] ( literal[string] ) keyword[if] keyword[not] identifier[hasattr] ( identifi...
async def list_pools() -> None: """ Lists names of created pool ledgers :return: Error code """ logger = logging.getLogger(__name__) logger.debug('list_pools: >>> ') if not hasattr(list_pools, 'cb'): logger.debug('list_pools: Creating callback') list_pools.cb = create_cb(CFUN...
def group_by_allele(self, locus): ''' Split the PileupCollection by the alleles suggested by the reads at the specified locus. If a read has an insertion immediately following the locus, then the insertion is included in the allele. For example, if locus is the 1-base ra...
def function[group_by_allele, parameter[self, locus]]: constant[ Split the PileupCollection by the alleles suggested by the reads at the specified locus. If a read has an insertion immediately following the locus, then the insertion is included in the allele. For example, if loc...
keyword[def] identifier[group_by_allele] ( identifier[self] , identifier[locus] ): literal[string] identifier[locus] = identifier[to_locus] ( identifier[locus] ) identifier[read_to_allele] = keyword[None] identifier[loci] =[] keyword[if] identifier[locus] . identifier[p...
def group_by_allele(self, locus): """ Split the PileupCollection by the alleles suggested by the reads at the specified locus. If a read has an insertion immediately following the locus, then the insertion is included in the allele. For example, if locus is the 1-base range ...
def py_to_couch_validate(key, val): """ Validates the individual parameter key and value. """ if key not in RESULT_ARG_TYPES: raise CloudantArgumentError(116, key) # pylint: disable=unidiomatic-typecheck # Validate argument values and ensure that a boolean is not passed in # if an in...
def function[py_to_couch_validate, parameter[key, val]]: constant[ Validates the individual parameter key and value. ] if compare[name[key] <ast.NotIn object at 0x7da2590d7190> name[RESULT_ARG_TYPES]] begin[:] <ast.Raise object at 0x7da1b2346d40> if <ast.BoolOp object at 0x7da1b2...
keyword[def] identifier[py_to_couch_validate] ( identifier[key] , identifier[val] ): literal[string] keyword[if] identifier[key] keyword[not] keyword[in] identifier[RESULT_ARG_TYPES] : keyword[raise] identifier[CloudantArgumentError] ( literal[int] , identifier[key] ) ...
def py_to_couch_validate(key, val): """ Validates the individual parameter key and value. """ if key not in RESULT_ARG_TYPES: raise CloudantArgumentError(116, key) # depends on [control=['if'], data=['key']] # pylint: disable=unidiomatic-typecheck # Validate argument values and ensure t...
def corpora(self, full=False): '''Return list of corpora owned by user. If `full=True`, it'll download all pages returned by the HTTP server''' url = self.base_url + self.CORPORA_PAGE class_ = Corpus results = self._retrieve_resources(url, class_, full) return results
def function[corpora, parameter[self, full]]: constant[Return list of corpora owned by user. If `full=True`, it'll download all pages returned by the HTTP server] variable[url] assign[=] binary_operation[name[self].base_url + name[self].CORPORA_PAGE] variable[class_] assign[=] name[Corp...
keyword[def] identifier[corpora] ( identifier[self] , identifier[full] = keyword[False] ): literal[string] identifier[url] = identifier[self] . identifier[base_url] + identifier[self] . identifier[CORPORA_PAGE] identifier[class_] = identifier[Corpus] identifier[results] = identi...
def corpora(self, full=False): """Return list of corpora owned by user. If `full=True`, it'll download all pages returned by the HTTP server""" url = self.base_url + self.CORPORA_PAGE class_ = Corpus results = self._retrieve_resources(url, class_, full) return results
def apply_single_tag_set(tag_set, selection): """All servers matching one tag set. A tag set is a dict. A server matches if its tags are a superset: A server tagged {'a': '1', 'b': '2'} matches the tag set {'a': '1'}. The empty tag set {} matches any server. """ def tags_match(server_tags): ...
def function[apply_single_tag_set, parameter[tag_set, selection]]: constant[All servers matching one tag set. A tag set is a dict. A server matches if its tags are a superset: A server tagged {'a': '1', 'b': '2'} matches the tag set {'a': '1'}. The empty tag set {} matches any server. ] ...
keyword[def] identifier[apply_single_tag_set] ( identifier[tag_set] , identifier[selection] ): literal[string] keyword[def] identifier[tags_match] ( identifier[server_tags] ): keyword[for] identifier[key] , identifier[value] keyword[in] identifier[tag_set] . identifier[items] (): ...
def apply_single_tag_set(tag_set, selection): """All servers matching one tag set. A tag set is a dict. A server matches if its tags are a superset: A server tagged {'a': '1', 'b': '2'} matches the tag set {'a': '1'}. The empty tag set {} matches any server. """ def tags_match(server_tags): ...
def to_table_data(self): """ :raises ValueError: :raises pytablereader.error.ValidationError: """ self._validate_source_data() for table_key, json_records in six.iteritems(self._buffer): headers = sorted(six.viewkeys(json_records)) self._loader....
def function[to_table_data, parameter[self]]: constant[ :raises ValueError: :raises pytablereader.error.ValidationError: ] call[name[self]._validate_source_data, parameter[]] for taget[tuple[[<ast.Name object at 0x7da1b0fd82b0>, <ast.Name object at 0x7da1b0fd9a50>]]] in s...
keyword[def] identifier[to_table_data] ( identifier[self] ): literal[string] identifier[self] . identifier[_validate_source_data] () keyword[for] identifier[table_key] , identifier[json_records] keyword[in] identifier[six] . identifier[iteritems] ( identifier[self] . identifier[_buffe...
def to_table_data(self): """ :raises ValueError: :raises pytablereader.error.ValidationError: """ self._validate_source_data() for (table_key, json_records) in six.iteritems(self._buffer): headers = sorted(six.viewkeys(json_records)) self._loader.inc_table_count() ...
def group_consecutives(data, stepsize=1): """ Return list of consecutive lists of numbers from data (number list). References: http://stackoverflow.com/questions/7352684/how-to-find-the-groups-of-consecutive-elements-from-an-array-in-numpy """ run = [] result = [run] expect = None ...
def function[group_consecutives, parameter[data, stepsize]]: constant[ Return list of consecutive lists of numbers from data (number list). References: http://stackoverflow.com/questions/7352684/how-to-find-the-groups-of-consecutive-elements-from-an-array-in-numpy ] variable[run] as...
keyword[def] identifier[group_consecutives] ( identifier[data] , identifier[stepsize] = literal[int] ): literal[string] identifier[run] =[] identifier[result] =[ identifier[run] ] identifier[expect] = keyword[None] keyword[for] identifier[item] keyword[in] identifier[data] : key...
def group_consecutives(data, stepsize=1): """ Return list of consecutive lists of numbers from data (number list). References: http://stackoverflow.com/questions/7352684/how-to-find-the-groups-of-consecutive-elements-from-an-array-in-numpy """ run = [] result = [run] expect = None ...
def get_version_status( package_descriptors, targets, repos_data, strip_version=False, strip_os_code_name=False): """ For each package and target check if it is affected by a sync. This is the case when the package version in the testing repo is different from the version in the main re...
def function[get_version_status, parameter[package_descriptors, targets, repos_data, strip_version, strip_os_code_name]]: constant[ For each package and target check if it is affected by a sync. This is the case when the package version in the testing repo is different from the version in the main ...
keyword[def] identifier[get_version_status] ( identifier[package_descriptors] , identifier[targets] , identifier[repos_data] , identifier[strip_version] = keyword[False] , identifier[strip_os_code_name] = keyword[False] ): literal[string] identifier[status] ={} keyword[for] identifier[package_descr...
def get_version_status(package_descriptors, targets, repos_data, strip_version=False, strip_os_code_name=False): """ For each package and target check if it is affected by a sync. This is the case when the package version in the testing repo is different from the version in the main repo. :return:...
def subclass_of(*args): """ This type validation function can be used in two modes: * providing two arguments (c, ref_type), it returns `True` if issubclass(c, ref_type) and raises a IsWrongType error if not. If ref_type is a set of types, any match with one of the included types will do * provid...
def function[subclass_of, parameter[]]: constant[ This type validation function can be used in two modes: * providing two arguments (c, ref_type), it returns `True` if issubclass(c, ref_type) and raises a IsWrongType error if not. If ref_type is a set of types, any match with one of the included t...
keyword[def] identifier[subclass_of] (* identifier[args] ): literal[string] keyword[if] identifier[len] ( identifier[args] )== literal[int] : identifier[typ] , identifier[ref_type] = identifier[args] keyword[if] keyword[not] identifier[isinstance] ( identifier[ref_type] , identif...
def subclass_of(*args): """ This type validation function can be used in two modes: * providing two arguments (c, ref_type), it returns `True` if issubclass(c, ref_type) and raises a IsWrongType error if not. If ref_type is a set of types, any match with one of the included types will do * provid...
def eta_from_seebeck(seeb,Lambda): """ It takes a value of seebeck and adjusts the analytic seebeck until it's equal Returns: eta where the two seebeck coefficients are equal (reduced chemical potential) """ from scipy.optimize import fsolve out = fsolve(lambda x: (seebeck_spb(...
def function[eta_from_seebeck, parameter[seeb, Lambda]]: constant[ It takes a value of seebeck and adjusts the analytic seebeck until it's equal Returns: eta where the two seebeck coefficients are equal (reduced chemical potential) ] from relative_module[scipy.optimize] import ...
keyword[def] identifier[eta_from_seebeck] ( identifier[seeb] , identifier[Lambda] ): literal[string] keyword[from] identifier[scipy] . identifier[optimize] keyword[import] identifier[fsolve] identifier[out] = identifier[fsolve] ( keyword[lambda] identifier[x] :( identifier[seebeck_spb] ( identifi...
def eta_from_seebeck(seeb, Lambda): """ It takes a value of seebeck and adjusts the analytic seebeck until it's equal Returns: eta where the two seebeck coefficients are equal (reduced chemical potential) """ from scipy.optimize import fsolve out = fsolve(lambda x: (seebeck_spb...
def get_location(self, location): """ For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in standard python notation [-3,...
def function[get_location, parameter[self, location]]: constant[ For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in st...
keyword[def] identifier[get_location] ( identifier[self] , identifier[location] ): literal[string] keyword[return] { identifier[self] . identifier[index_name] : identifier[self] . identifier[_index] [ identifier[location] ], identifier[self] . identifier[data_name] : identifier[self] . identifier[_...
def get_location(self, location): """ For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in standard python notation [-3, -2,...
async def call_async(self, method_name: str, *args, rpc_timeout: float = None, **kwargs): """ Send JSON RPC request to a backend socket and receive reply (asynchronously) :param method_name: Method name :param args: Args that will be passed to the remote function :param float rp...
<ast.AsyncFunctionDef object at 0x7da1b0efa110>
keyword[async] keyword[def] identifier[call_async] ( identifier[self] , identifier[method_name] : identifier[str] ,* identifier[args] , identifier[rpc_timeout] : identifier[float] = keyword[None] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[rpc_timeout] keyword[is] ...
async def call_async(self, method_name: str, *args, rpc_timeout: float=None, **kwargs): """ Send JSON RPC request to a backend socket and receive reply (asynchronously) :param method_name: Method name :param args: Args that will be passed to the remote function :param float rpc_time...
def order_by_next_occurrence(self): """ :return: A list of events in order of minimum occurrence greater than now (or overlapping now in the case of drop-in events). This is an expensive operation - use with as small a source queryset as possible. ...
def function[order_by_next_occurrence, parameter[self]]: constant[ :return: A list of events in order of minimum occurrence greater than now (or overlapping now in the case of drop-in events). This is an expensive operation - use with as small a source querys...
keyword[def] identifier[order_by_next_occurrence] ( identifier[self] ): literal[string] identifier[qs] = identifier[self] . identifier[prefetch_related] ( literal[string] ) keyword[def] identifier[_sort] ( identifier[x] ): keyword[try] : keyword...
def order_by_next_occurrence(self): """ :return: A list of events in order of minimum occurrence greater than now (or overlapping now in the case of drop-in events). This is an expensive operation - use with as small a source queryset as possible. ...
def ensure_contexted(func): """ This decorator ensure that an instance of the Evtx class is used within a context statement. That is, that the `with` statement is used, or `__enter__()` and `__exit__()` are called explicitly. """ @wraps(func) def wr...
def function[ensure_contexted, parameter[func]]: constant[ This decorator ensure that an instance of the Evtx class is used within a context statement. That is, that the `with` statement is used, or `__enter__()` and `__exit__()` are called explicitly. ] de...
keyword[def] identifier[ensure_contexted] ( identifier[func] ): literal[string] @ identifier[wraps] ( identifier[func] ) keyword[def] identifier[wrapped] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): keyword[if] identifier[self] . identifier[_buf] keyword[...
def ensure_contexted(func): """ This decorator ensure that an instance of the Evtx class is used within a context statement. That is, that the `with` statement is used, or `__enter__()` and `__exit__()` are called explicitly. """ @wraps(func) def wrapped(self,...
def _parse_hosts(self, hosts): """ Return hosts parsed into a tuple of tuples. :param hosts: String or list of hosts """ # Default host if hosts is None: return # If it's a string, we allow comma separated strings if isinstance(hosts, six.st...
def function[_parse_hosts, parameter[self, hosts]]: constant[ Return hosts parsed into a tuple of tuples. :param hosts: String or list of hosts ] if compare[name[hosts] is constant[None]] begin[:] return[None] if call[name[isinstance], parameter[name[hosts], nam...
keyword[def] identifier[_parse_hosts] ( identifier[self] , identifier[hosts] ): literal[string] keyword[if] identifier[hosts] keyword[is] keyword[None] : keyword[return] keyword[if] identifier[isinstance] ( identifier[hosts] , identifier[six] . iden...
def _parse_hosts(self, hosts): """ Return hosts parsed into a tuple of tuples. :param hosts: String or list of hosts """ # Default host if hosts is None: return # depends on [control=['if'], data=[]] # If it's a string, we allow comma separated strings if isinstanc...
def add_after(self): """Returns a builder inserting a new block after the current block""" idx = self._container.structure.index(self) return BlockBuilder(self._container, idx+1)
def function[add_after, parameter[self]]: constant[Returns a builder inserting a new block after the current block] variable[idx] assign[=] call[name[self]._container.structure.index, parameter[name[self]]] return[call[name[BlockBuilder], parameter[name[self]._container, binary_operation[name[idx] +...
keyword[def] identifier[add_after] ( identifier[self] ): literal[string] identifier[idx] = identifier[self] . identifier[_container] . identifier[structure] . identifier[index] ( identifier[self] ) keyword[return] identifier[BlockBuilder] ( identifier[self] . identifier[_container] , iden...
def add_after(self): """Returns a builder inserting a new block after the current block""" idx = self._container.structure.index(self) return BlockBuilder(self._container, idx + 1)
def wait_for_initial_conf(self, timeout=1.0): """Wait initial configuration from the arbiter. Basically sleep 1.0 and check if new_conf is here :param timeout: timeout to wait :type timeout: int :return: None """ logger.info("Waiting for initial configuration") ...
def function[wait_for_initial_conf, parameter[self, timeout]]: constant[Wait initial configuration from the arbiter. Basically sleep 1.0 and check if new_conf is here :param timeout: timeout to wait :type timeout: int :return: None ] call[name[logger].info, param...
keyword[def] identifier[wait_for_initial_conf] ( identifier[self] , identifier[timeout] = literal[int] ): literal[string] identifier[logger] . identifier[info] ( literal[string] ) identifier[_ts] = identifier[time] . identifier[time] () keyword[while] keyword[not] ident...
def wait_for_initial_conf(self, timeout=1.0): """Wait initial configuration from the arbiter. Basically sleep 1.0 and check if new_conf is here :param timeout: timeout to wait :type timeout: int :return: None """ logger.info('Waiting for initial configuration') # Arb...
def get_change(self, change_id): """ Get information about a proposed set of changes, as submitted by the change_rrsets method. Returns a Python data structure with status information about the changes. :type change_id: str :param change_id: The unique identifier...
def function[get_change, parameter[self, change_id]]: constant[ Get information about a proposed set of changes, as submitted by the change_rrsets method. Returns a Python data structure with status information about the changes. :type change_id: str :param chang...
keyword[def] identifier[get_change] ( identifier[self] , identifier[change_id] ): literal[string] identifier[uri] = literal[string] %( identifier[self] . identifier[Version] , identifier[change_id] ) identifier[response] = identifier[self] . identifier[make_request] ( literal[string] , ide...
def get_change(self, change_id): """ Get information about a proposed set of changes, as submitted by the change_rrsets method. Returns a Python data structure with status information about the changes. :type change_id: str :param change_id: The unique identifier for...
def get_term_category_frequencies(self, scatterchartdata): ''' Applies the ranker in scatterchartdata to term-category frequencies. Parameters ---------- scatterchartdata : ScatterChartData Returns ------- pd.DataFrame ''' term_ranker = s...
def function[get_term_category_frequencies, parameter[self, scatterchartdata]]: constant[ Applies the ranker in scatterchartdata to term-category frequencies. Parameters ---------- scatterchartdata : ScatterChartData Returns ------- pd.DataFrame ...
keyword[def] identifier[get_term_category_frequencies] ( identifier[self] , identifier[scatterchartdata] ): literal[string] identifier[term_ranker] = identifier[scatterchartdata] . identifier[term_ranker] ( identifier[self] ) keyword[if] identifier[scatterchartdata] . identifier[use_non_t...
def get_term_category_frequencies(self, scatterchartdata): """ Applies the ranker in scatterchartdata to term-category frequencies. Parameters ---------- scatterchartdata : ScatterChartData Returns ------- pd.DataFrame """ term_ranker = scatterch...
def connection_from_url(self, url, pool_kwargs=None): """ Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpoo...
def function[connection_from_url, parameter[self, url, pool_kwargs]]: constant[ Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:...
keyword[def] identifier[connection_from_url] ( identifier[self] , identifier[url] , identifier[pool_kwargs] = keyword[None] ): literal[string] identifier[u] = identifier[parse_url] ( identifier[url] ) keyword[return] identifier[self] . identifier[connection_from_host] ( identifier[u] . id...
def connection_from_url(self, url, pool_kwargs=None): """ Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpool.Co...
def _got_cons_input(self, handle): """Callback for handle events detected by ipmi session """ self._addpendingdata(handle.read()) if not self.awaitingack: self._sendpendingoutput()
def function[_got_cons_input, parameter[self, handle]]: constant[Callback for handle events detected by ipmi session ] call[name[self]._addpendingdata, parameter[call[name[handle].read, parameter[]]]] if <ast.UnaryOp object at 0x7da18dc07e50> begin[:] call[name[self]._sen...
keyword[def] identifier[_got_cons_input] ( identifier[self] , identifier[handle] ): literal[string] identifier[self] . identifier[_addpendingdata] ( identifier[handle] . identifier[read] ()) keyword[if] keyword[not] identifier[self] . identifier[awaitingack] : identifier[sel...
def _got_cons_input(self, handle): """Callback for handle events detected by ipmi session """ self._addpendingdata(handle.read()) if not self.awaitingack: self._sendpendingoutput() # depends on [control=['if'], data=[]]
def _get_rule(cls): # type: (_MetaRule) -> (List[object], List[object]) """ Get rule on the Rule class. :param cls: Rule for which return the rule. :return: Rule inside the Rule class. :raise RuleNotDefinedException: If the rule is not defined. :raise CantCreateSi...
def function[_get_rule, parameter[cls]]: constant[ Get rule on the Rule class. :param cls: Rule for which return the rule. :return: Rule inside the Rule class. :raise RuleNotDefinedException: If the rule is not defined. :raise CantCreateSingleRuleException: If the rule co...
keyword[def] identifier[_get_rule] ( identifier[cls] ): literal[string] keyword[if] identifier[cls] . identifier[_traverse] : keyword[return] ( identifier[cls] . identifier[left] , identifier[cls] . identifier[right] ) keyword[if] identifier[len] ( identifier[cls] . identif...
def _get_rule(cls): # type: (_MetaRule) -> (List[object], List[object]) '\n Get rule on the Rule class.\n :param cls: Rule for which return the rule.\n :return: Rule inside the Rule class.\n :raise RuleNotDefinedException: If the rule is not defined.\n :raise CantCreateSingleR...
async def cli_handler(loop): """Application starts here.""" parser = argparse.ArgumentParser() parser.add_argument('command', nargs='+', help='commands, help, ...') parser.add_argument('--name', help='apple tv name', dest='name', default='Apple TV') p...
<ast.AsyncFunctionDef object at 0x7da2054a4070>
keyword[async] keyword[def] identifier[cli_handler] ( identifier[loop] ): literal[string] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] () identifier[parser] . identifier[add_argument] ( literal[string] , identifier[nargs] = literal[string] , identifier[help] = literal[...
async def cli_handler(loop): """Application starts here.""" parser = argparse.ArgumentParser() parser.add_argument('command', nargs='+', help='commands, help, ...') parser.add_argument('--name', help='apple tv name', dest='name', default='Apple TV') parser.add_argument('--address', help='device ip a...
def parse_gntp(data, password=None): """Attempt to parse a message as a GNTP message :param string data: Message to be parsed :param string password: Optional password to be used to verify the message """ data = gntp.shim.u(data) match = GNTP_INFO_LINE_SHORT.match(data) if not match: raise errors.ParseError('...
def function[parse_gntp, parameter[data, password]]: constant[Attempt to parse a message as a GNTP message :param string data: Message to be parsed :param string password: Optional password to be used to verify the message ] variable[data] assign[=] call[name[gntp].shim.u, parameter[name[data]]] ...
keyword[def] identifier[parse_gntp] ( identifier[data] , identifier[password] = keyword[None] ): literal[string] identifier[data] = identifier[gntp] . identifier[shim] . identifier[u] ( identifier[data] ) identifier[match] = identifier[GNTP_INFO_LINE_SHORT] . identifier[match] ( identifier[data] ) keyword[if...
def parse_gntp(data, password=None): """Attempt to parse a message as a GNTP message :param string data: Message to be parsed :param string password: Optional password to be used to verify the message """ data = gntp.shim.u(data) match = GNTP_INFO_LINE_SHORT.match(data) if not match: raise e...
def check_file_names(samples, raw_dir, options): """Check if all files are present. :param samples: a list of tuples with the family ID as first element (str) and sample ID as last element (str). :param raw_dir: the directory containing the raw files. :param options: the options. ...
def function[check_file_names, parameter[samples, raw_dir, options]]: constant[Check if all files are present. :param samples: a list of tuples with the family ID as first element (str) and sample ID as last element (str). :param raw_dir: the directory containing the raw files. ...
keyword[def] identifier[check_file_names] ( identifier[samples] , identifier[raw_dir] , identifier[options] ): literal[string] identifier[file_names] ={} keyword[for] identifier[sample] keyword[in] identifier[samples] : identifier[the_sample] = keyword[None] keyword[try] : ...
def check_file_names(samples, raw_dir, options): """Check if all files are present. :param samples: a list of tuples with the family ID as first element (str) and sample ID as last element (str). :param raw_dir: the directory containing the raw files. :param options: the options. ...
def _descr_str(descr, data, region): """Add additional useful information from data to description string. """ if data: name = dd.get_sample_name(data) if name: descr = "{0} : {1}".format(descr, name) elif "work_bam" in data: descr = "{0} : {1}".format(descr, ...
def function[_descr_str, parameter[descr, data, region]]: constant[Add additional useful information from data to description string. ] if name[data] begin[:] variable[name] assign[=] call[name[dd].get_sample_name, parameter[name[data]]] if name[name] begin[:] ...
keyword[def] identifier[_descr_str] ( identifier[descr] , identifier[data] , identifier[region] ): literal[string] keyword[if] identifier[data] : identifier[name] = identifier[dd] . identifier[get_sample_name] ( identifier[data] ) keyword[if] identifier[name] : identifier[d...
def _descr_str(descr, data, region): """Add additional useful information from data to description string. """ if data: name = dd.get_sample_name(data) if name: descr = '{0} : {1}'.format(descr, name) # depends on [control=['if'], data=[]] elif 'work_bam' in data: ...
def get_statistics(self): """ Gather basic stats about the Knowledge Base and its contents. :return: a dictionary """ statistics = { "number_authors": 0, "number_author_names": 0, "number_author_abbreviations": 0, "number_works": ...
def function[get_statistics, parameter[self]]: constant[ Gather basic stats about the Knowledge Base and its contents. :return: a dictionary ] variable[statistics] assign[=] dictionary[[<ast.Constant object at 0x7da18dc9a890>, <ast.Constant object at 0x7da18dc9a1d0>, <ast.Const...
keyword[def] identifier[get_statistics] ( identifier[self] ): literal[string] identifier[statistics] ={ literal[string] : literal[int] , literal[string] : literal[int] , literal[string] : literal[int] , literal[string] : literal[int] , literal[string] : ...
def get_statistics(self): """ Gather basic stats about the Knowledge Base and its contents. :return: a dictionary """ statistics = {'number_authors': 0, 'number_author_names': 0, 'number_author_abbreviations': 0, 'number_works': 0, 'number_work_titles': 0, 'number_title_abbreviations':...
def prune_by_ngram_count_per_work(self, minimum=None, maximum=None, label=None): """Removes results rows if the n-gram count for all works bearing that n-gram is outside the range specified by `minimum` and `maximum`. That is, if a single witness of...
def function[prune_by_ngram_count_per_work, parameter[self, minimum, maximum, label]]: constant[Removes results rows if the n-gram count for all works bearing that n-gram is outside the range specified by `minimum` and `maximum`. That is, if a single witness of a single work has an n-gr...
keyword[def] identifier[prune_by_ngram_count_per_work] ( identifier[self] , identifier[minimum] = keyword[None] , identifier[maximum] = keyword[None] , identifier[label] = keyword[None] ): literal[string] identifier[self] . identifier[_logger] . identifier[info] ( literal[string] ) identi...
def prune_by_ngram_count_per_work(self, minimum=None, maximum=None, label=None): """Removes results rows if the n-gram count for all works bearing that n-gram is outside the range specified by `minimum` and `maximum`. That is, if a single witness of a single work has an n-gram count...
def render(self, data): ''' Renders the reports based on data.content_type's value. Arguments: data (ReportViewRequestData): The report data. data.content_type is used to determine how the reports are rendered. Returns: HTTPResponse: The rendered version...
def function[render, parameter[self, data]]: constant[ Renders the reports based on data.content_type's value. Arguments: data (ReportViewRequestData): The report data. data.content_type is used to determine how the reports are rendered. Returns: HTTPRes...
keyword[def] identifier[render] ( identifier[self] , identifier[data] ): literal[string] identifier[renderers] ={ literal[string] : identifier[self] . identifier[_render_as_csv] , literal[string] : identifier[self] . identifier[_render_as_html] , keyword[None] : identifie...
def render(self, data): """ Renders the reports based on data.content_type's value. Arguments: data (ReportViewRequestData): The report data. data.content_type is used to determine how the reports are rendered. Returns: HTTPResponse: The rendered version of ...
async def generate_widget_large( self, bot_id: int = None, top: str = '2C2F33', mid: str = '23272A', user: str = 'FFFFFF', cert: str = 'FFFFFF', data: str = 'FFFFFF', label: str = '99AAB5', highlight: str = '2C2F...
<ast.AsyncFunctionDef object at 0x7da1b024f2b0>
keyword[async] keyword[def] identifier[generate_widget_large] ( identifier[self] , identifier[bot_id] : identifier[int] = keyword[None] , identifier[top] : identifier[str] = literal[string] , identifier[mid] : identifier[str] = literal[string] , identifier[user] : identifier[str] = literal[string] , identifier...
async def generate_widget_large(self, bot_id: int=None, top: str='2C2F33', mid: str='23272A', user: str='FFFFFF', cert: str='FFFFFF', data: str='FFFFFF', label: str='99AAB5', highlight: str='2C2F33'): """This function is a coroutine. Generates a custom large widget. Do not add `#` to the color codes (e.g. ...
def clear_to_enc_filename(fname): """ Converts the filename of a cleartext file and convert it to an encrypted filename :param fname: :return: filename of encrypted secret file if found, else None """ if not fname.lower().endswith('.json'): raise CredkeepException('Invalid filetype') ...
def function[clear_to_enc_filename, parameter[fname]]: constant[ Converts the filename of a cleartext file and convert it to an encrypted filename :param fname: :return: filename of encrypted secret file if found, else None ] if <ast.UnaryOp object at 0x7da207f99780> begin[:] <a...
keyword[def] identifier[clear_to_enc_filename] ( identifier[fname] ): literal[string] keyword[if] keyword[not] identifier[fname] . identifier[lower] (). identifier[endswith] ( literal[string] ): keyword[raise] identifier[CredkeepException] ( literal[string] ) keyword[if] identifier[fname...
def clear_to_enc_filename(fname): """ Converts the filename of a cleartext file and convert it to an encrypted filename :param fname: :return: filename of encrypted secret file if found, else None """ if not fname.lower().endswith('.json'): raise CredkeepException('Invalid filetype') #...
def _create_stdout_logger(): """ create a logger to stdout """ log = logging.getLogger(__name__) out_hdlr = logging.StreamHandler(sys.stdout) out_hdlr.setFormatter(logging.Formatter('%(message)s')) out_hdlr.setLevel(logging.INFO) log.addHandler(out_hdlr) log.setLevel(logging.INFO)
def function[_create_stdout_logger, parameter[]]: constant[ create a logger to stdout ] variable[log] assign[=] call[name[logging].getLogger, parameter[name[__name__]]] variable[out_hdlr] assign[=] call[name[logging].StreamHandler, parameter[name[sys].stdout]] call[name[out_hdlr].setForm...
keyword[def] identifier[_create_stdout_logger] (): literal[string] identifier[log] = identifier[logging] . identifier[getLogger] ( identifier[__name__] ) identifier[out_hdlr] = identifier[logging] . identifier[StreamHandler] ( identifier[sys] . identifier[stdout] ) identifier[out_hdlr] . identifi...
def _create_stdout_logger(): """ create a logger to stdout """ log = logging.getLogger(__name__) out_hdlr = logging.StreamHandler(sys.stdout) out_hdlr.setFormatter(logging.Formatter('%(message)s')) out_hdlr.setLevel(logging.INFO) log.addHandler(out_hdlr) log.setLevel(logging.INFO)
def boxes_intersect(box1, box2): """Determines if two rectangles, each input as a tuple (xmin, xmax, ymin, ymax), intersect.""" xmin1, xmax1, ymin1, ymax1 = box1 xmin2, xmax2, ymin2, ymax2 = box2 if interval_intersection_width(xmin1, xmax1, xmin2, xmax2) and \ interval_intersection_w...
def function[boxes_intersect, parameter[box1, box2]]: constant[Determines if two rectangles, each input as a tuple (xmin, xmax, ymin, ymax), intersect.] <ast.Tuple object at 0x7da20cabd870> assign[=] name[box1] <ast.Tuple object at 0x7da20cabfa30> assign[=] name[box2] if <ast.Boo...
keyword[def] identifier[boxes_intersect] ( identifier[box1] , identifier[box2] ): literal[string] identifier[xmin1] , identifier[xmax1] , identifier[ymin1] , identifier[ymax1] = identifier[box1] identifier[xmin2] , identifier[xmax2] , identifier[ymin2] , identifier[ymax2] = identifier[box2] key...
def boxes_intersect(box1, box2): """Determines if two rectangles, each input as a tuple (xmin, xmax, ymin, ymax), intersect.""" (xmin1, xmax1, ymin1, ymax1) = box1 (xmin2, xmax2, ymin2, ymax2) = box2 if interval_intersection_width(xmin1, xmax1, xmin2, xmax2) and interval_intersection_width(ymin1...
def check_smtp_domain (self, mail): """ Check a single mail address. """ from dns.exception import DNSException log.debug(LOG_CHECK, "checking mail address %r", mail) mail = strformat.ascii_safe(mail) username, domain = mail.rsplit('@', 1) log.debug(LOG_CH...
def function[check_smtp_domain, parameter[self, mail]]: constant[ Check a single mail address. ] from relative_module[dns.exception] import module[DNSException] call[name[log].debug, parameter[name[LOG_CHECK], constant[checking mail address %r], name[mail]]] variable[mail] as...
keyword[def] identifier[check_smtp_domain] ( identifier[self] , identifier[mail] ): literal[string] keyword[from] identifier[dns] . identifier[exception] keyword[import] identifier[DNSException] identifier[log] . identifier[debug] ( identifier[LOG_CHECK] , literal[string] , identifier[...
def check_smtp_domain(self, mail): """ Check a single mail address. """ from dns.exception import DNSException log.debug(LOG_CHECK, 'checking mail address %r', mail) mail = strformat.ascii_safe(mail) (username, domain) = mail.rsplit('@', 1) log.debug(LOG_CHECK, 'looking up MX mai...
def read_fields(self, template, offset=0): """ Return a tuple containing the C-struct fields in this stream specified by *template* and starting at *offset*. """ self._file.seek(offset) bufr = self._file.read(calcsize(template)) return unpack_from(template, bufr)
def function[read_fields, parameter[self, template, offset]]: constant[ Return a tuple containing the C-struct fields in this stream specified by *template* and starting at *offset*. ] call[name[self]._file.seek, parameter[name[offset]]] variable[bufr] assign[=] call[name...
keyword[def] identifier[read_fields] ( identifier[self] , identifier[template] , identifier[offset] = literal[int] ): literal[string] identifier[self] . identifier[_file] . identifier[seek] ( identifier[offset] ) identifier[bufr] = identifier[self] . identifier[_file] . identifier[read] ( ...
def read_fields(self, template, offset=0): """ Return a tuple containing the C-struct fields in this stream specified by *template* and starting at *offset*. """ self._file.seek(offset) bufr = self._file.read(calcsize(template)) return unpack_from(template, bufr)
def p_int(self, tree): ''' V ::= INTEGER ''' tree.value = int(tree.attr) tree.svalue = tree.attr
def function[p_int, parameter[self, tree]]: constant[ V ::= INTEGER ] name[tree].value assign[=] call[name[int], parameter[name[tree].attr]] name[tree].svalue assign[=] name[tree].attr
keyword[def] identifier[p_int] ( identifier[self] , identifier[tree] ): literal[string] identifier[tree] . identifier[value] = identifier[int] ( identifier[tree] . identifier[attr] ) identifier[tree] . identifier[svalue] = identifier[tree] . identifier[attr]
def p_int(self, tree): """ V ::= INTEGER """ tree.value = int(tree.attr) tree.svalue = tree.attr
def reset(self): """Reset the tough connection. If a reset is not possible, tries to reopen the connection. It will not complain if the connection is already closed. """ try: self._con.reset() self._transaction = False self._setsession() ...
def function[reset, parameter[self]]: constant[Reset the tough connection. If a reset is not possible, tries to reopen the connection. It will not complain if the connection is already closed. ] <ast.Try object at 0x7da207f02da0>
keyword[def] identifier[reset] ( identifier[self] ): literal[string] keyword[try] : identifier[self] . identifier[_con] . identifier[reset] () identifier[self] . identifier[_transaction] = keyword[False] identifier[self] . identifier[_setsession] () ...
def reset(self): """Reset the tough connection. If a reset is not possible, tries to reopen the connection. It will not complain if the connection is already closed. """ try: self._con.reset() self._transaction = False self._setsession() self._usage = 0 ...
def compileGLShader(self, pchShaderName, pchVertexShader, pchFragmentShader): """ Purpose: Compiles a GL shader program and returns the handle. Returns 0 if the shader couldn't be compiled for some reason. """ unProgramID = glCreateProgram() nSceneVertexShader = ...
def function[compileGLShader, parameter[self, pchShaderName, pchVertexShader, pchFragmentShader]]: constant[ Purpose: Compiles a GL shader program and returns the handle. Returns 0 if the shader couldn't be compiled for some reason. ] variable[unProgramID] assign[=] call[name[...
keyword[def] identifier[compileGLShader] ( identifier[self] , identifier[pchShaderName] , identifier[pchVertexShader] , identifier[pchFragmentShader] ): literal[string] identifier[unProgramID] = identifier[glCreateProgram] () identifier[nSceneVertexShader] = identifier[glCreateShader] (...
def compileGLShader(self, pchShaderName, pchVertexShader, pchFragmentShader): """ Purpose: Compiles a GL shader program and returns the handle. Returns 0 if the shader couldn't be compiled for some reason. """ unProgramID = glCreateProgram() nSceneVertexShader = glCreateShader(GL_...
def _synthesize(self, text_file): """ Synthesize text into a WAVE file. Return a tuple consisting of: 1. the handler of the generated audio file 2. the path of the generated audio file 3. the list of anchors, that is, a list of floats each representing the st...
def function[_synthesize, parameter[self, text_file]]: constant[ Synthesize text into a WAVE file. Return a tuple consisting of: 1. the handler of the generated audio file 2. the path of the generated audio file 3. the list of anchors, that is, a list of floats ...
keyword[def] identifier[_synthesize] ( identifier[self] , identifier[text_file] ): literal[string] identifier[handler] , identifier[path] = identifier[gf] . identifier[tmp_file] ( identifier[suffix] = literal[string] , identifier[root] = identifier[self] . identifier[rconf] [ identifier[RuntimeConf...
def _synthesize(self, text_file): """ Synthesize text into a WAVE file. Return a tuple consisting of: 1. the handler of the generated audio file 2. the path of the generated audio file 3. the list of anchors, that is, a list of floats each representing the start ...
def emit_signal(sender=None, namespace=None): """ @emit_signal A decorator to mark a method or function as a signal emitter It will turn the function into a decorator that can be used to receive signal with: $fn_name.pre.connect, $fn_name.post.connect *pre will execute before running the funct...
def function[emit_signal, parameter[sender, namespace]]: constant[ @emit_signal A decorator to mark a method or function as a signal emitter It will turn the function into a decorator that can be used to receive signal with: $fn_name.pre.connect, $fn_name.post.connect *pre will execute bef...
keyword[def] identifier[emit_signal] ( identifier[sender] = keyword[None] , identifier[namespace] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[namespace] : identifier[namespace] = identifier[__signals_namespace] keyword[def] identifier[decorator] ( identifier[fn...
def emit_signal(sender=None, namespace=None): """ @emit_signal A decorator to mark a method or function as a signal emitter It will turn the function into a decorator that can be used to receive signal with: $fn_name.pre.connect, $fn_name.post.connect *pre will execute before running the funct...
def promote(self): """ Mark object as alive, so it won't be collected during next run of the garbage collector. """ if self.expiry is not None: self.promoted = self.time_module.time() + self.expiry
def function[promote, parameter[self]]: constant[ Mark object as alive, so it won't be collected during next run of the garbage collector. ] if compare[name[self].expiry is_not constant[None]] begin[:] name[self].promoted assign[=] binary_operation[call[name[self].time_mo...
keyword[def] identifier[promote] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[expiry] keyword[is] keyword[not] keyword[None] : identifier[self] . identifier[promoted] = identifier[self] . identifier[time_module] . identifier[time] ()+ identifier[s...
def promote(self): """ Mark object as alive, so it won't be collected during next run of the garbage collector. """ if self.expiry is not None: self.promoted = self.time_module.time() + self.expiry # depends on [control=['if'], data=[]]
def endpoint_from_flag(flag): """The object used for interacting with relations tied to a flag, or None. """ relation_name = None value = _get_flag_value(flag) if isinstance(value, dict) and 'relation' in value: # old-style RelationBase relation_name = value['relation'] elif flag...
def function[endpoint_from_flag, parameter[flag]]: constant[The object used for interacting with relations tied to a flag, or None. ] variable[relation_name] assign[=] constant[None] variable[value] assign[=] call[name[_get_flag_value], parameter[name[flag]]] if <ast.BoolOp object at...
keyword[def] identifier[endpoint_from_flag] ( identifier[flag] ): literal[string] identifier[relation_name] = keyword[None] identifier[value] = identifier[_get_flag_value] ( identifier[flag] ) keyword[if] identifier[isinstance] ( identifier[value] , identifier[dict] ) keyword[and] literal[stri...
def endpoint_from_flag(flag): """The object used for interacting with relations tied to a flag, or None. """ relation_name = None value = _get_flag_value(flag) if isinstance(value, dict) and 'relation' in value: # old-style RelationBase relation_name = value['relation'] # depends on...
def map_pvc(self, port1, vpi1, vci1, port2, vpi2, vci2): """ Creates a new Virtual Channel connection (unidirectional). :param port1: input port :param vpi1: input vpi :param vci1: input vci :param port2: output port :param vpi2: output vpi :param vci2: o...
def function[map_pvc, parameter[self, port1, vpi1, vci1, port2, vpi2, vci2]]: constant[ Creates a new Virtual Channel connection (unidirectional). :param port1: input port :param vpi1: input vpi :param vci1: input vci :param port2: output port :param vpi2: output...
keyword[def] identifier[map_pvc] ( identifier[self] , identifier[port1] , identifier[vpi1] , identifier[vci1] , identifier[port2] , identifier[vpi2] , identifier[vci2] ): literal[string] keyword[if] identifier[port1] keyword[not] keyword[in] identifier[self] . identifier[_nios] : ...
def map_pvc(self, port1, vpi1, vci1, port2, vpi2, vci2): """ Creates a new Virtual Channel connection (unidirectional). :param port1: input port :param vpi1: input vpi :param vci1: input vci :param port2: output port :param vpi2: output vpi :param vci2: outpu...
def action_is_greedy(action, isoptional=False): ''' Returns True if action will necessarily consume the next argument. isoptional indicates whether the argument is an optional (starts with -). ''' num_consumed_args = _num_consumed_args.get(action, 0) if action.option_strings: if not isoptio...
def function[action_is_greedy, parameter[action, isoptional]]: constant[ Returns True if action will necessarily consume the next argument. isoptional indicates whether the argument is an optional (starts with -). ] variable[num_consumed_args] assign[=] call[name[_num_consumed_args].get, paramet...
keyword[def] identifier[action_is_greedy] ( identifier[action] , identifier[isoptional] = keyword[False] ): literal[string] identifier[num_consumed_args] = identifier[_num_consumed_args] . identifier[get] ( identifier[action] , literal[int] ) keyword[if] identifier[action] . identifier[option_string...
def action_is_greedy(action, isoptional=False): """ Returns True if action will necessarily consume the next argument. isoptional indicates whether the argument is an optional (starts with -). """ num_consumed_args = _num_consumed_args.get(action, 0) if action.option_strings: if not isoption...
def get(self, endpoint): """ Todo """ r = self.http.request('GET', self._api_base.format(endpoint), headers={'Authorization': 'Bot '+self.token}) if r.status == 200: return json.loads(r.data.decode('utf-8')) else: return {}
def function[get, parameter[self, endpoint]]: constant[ Todo ] variable[r] assign[=] call[name[self].http.request, parameter[constant[GET], call[name[self]._api_base.format, parameter[name[endpoint]]]]] if compare[name[r].status equal[==] constant[200]] begin[:] return[call[name[json].lo...
keyword[def] identifier[get] ( identifier[self] , identifier[endpoint] ): literal[string] identifier[r] = identifier[self] . identifier[http] . identifier[request] ( literal[string] , identifier[self] . identifier[_api_base] . identifier[format] ( identifier[endpoint] ), identifier[headers] ={ li...
def get(self, endpoint): """ Todo """ r = self.http.request('GET', self._api_base.format(endpoint), headers={'Authorization': 'Bot ' + self.token}) if r.status == 200: return json.loads(r.data.decode('utf-8')) # depends on [control=['if'], data=[]] else: return {}
def instantiate(self, seed=0, serial_id=0, preset='default', extra_args=None) -> gym.Env: """ Make a single environment compatible with the experiments """ settings = self.get_preset(preset) return wrapped_env_maker(self.envname, seed, serial_id, **settings)
def function[instantiate, parameter[self, seed, serial_id, preset, extra_args]]: constant[ Make a single environment compatible with the experiments ] variable[settings] assign[=] call[name[self].get_preset, parameter[name[preset]]] return[call[name[wrapped_env_maker], parameter[name[self].envname, ...
keyword[def] identifier[instantiate] ( identifier[self] , identifier[seed] = literal[int] , identifier[serial_id] = literal[int] , identifier[preset] = literal[string] , identifier[extra_args] = keyword[None] )-> identifier[gym] . identifier[Env] : literal[string] identifier[settings] = identifier[...
def instantiate(self, seed=0, serial_id=0, preset='default', extra_args=None) -> gym.Env: """ Make a single environment compatible with the experiments """ settings = self.get_preset(preset) return wrapped_env_maker(self.envname, seed, serial_id, **settings)
def listRoleIds(self, *args, **kwargs): """ List Role IDs If no limit is given, the roleIds of all roles are returned. Since this list may become long, callers can use the `limit` and `continuationToken` query arguments to page through the responses. This method gives o...
def function[listRoleIds, parameter[self]]: constant[ List Role IDs If no limit is given, the roleIds of all roles are returned. Since this list may become long, callers can use the `limit` and `continuationToken` query arguments to page through the responses. This meth...
keyword[def] identifier[listRoleIds] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[_makeApiCall] ( identifier[self] . identifier[funcinfo] [ literal[string] ],* identifier[args] ,** identifier[kwargs] )
def listRoleIds(self, *args, **kwargs): """ List Role IDs If no limit is given, the roleIds of all roles are returned. Since this list may become long, callers can use the `limit` and `continuationToken` query arguments to page through the responses. This method gives outpu...
def path(self, value): """ Setter for **self.__path** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format("path", value) self._...
def function[path, parameter[self, value]]: constant[ Setter for **self.__path** attribute. :param value: Attribute value. :type value: unicode ] if compare[name[value] is_not constant[None]] begin[:] assert[compare[call[name[type], parameter[name[value]]] is nam...
keyword[def] identifier[path] ( identifier[self] , identifier[value] ): literal[string] keyword[if] identifier[value] keyword[is] keyword[not] keyword[None] : keyword[assert] identifier[type] ( identifier[value] ) keyword[is] identifier[unicode] , literal[string] . identifier[fo...
def path(self, value): """ Setter for **self.__path** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format('path', value) # depends on [control=['if...
def _get_variable_name_or_register(var, variables, names, params, prefix): ''' Args: var (~nnabla.Variable) variables (OrderedDict) names (dict): Force name table, Variable -> str params (dict): NdArray -> str prefix(str) ''' if var not in variables.values(): ...
def function[_get_variable_name_or_register, parameter[var, variables, names, params, prefix]]: constant[ Args: var (~nnabla.Variable) variables (OrderedDict) names (dict): Force name table, Variable -> str params (dict): NdArray -> str prefix(str) ] if co...
keyword[def] identifier[_get_variable_name_or_register] ( identifier[var] , identifier[variables] , identifier[names] , identifier[params] , identifier[prefix] ): literal[string] keyword[if] identifier[var] keyword[not] keyword[in] identifier[variables] . identifier[values] (): identifier[vnam...
def _get_variable_name_or_register(var, variables, names, params, prefix): """ Args: var (~nnabla.Variable) variables (OrderedDict) names (dict): Force name table, Variable -> str params (dict): NdArray -> str prefix(str) """ if var not in variables.values(): ...
def get_thumbnail(file_, geometry_string, **options): """ A shortcut for the Backend ``get_thumbnail`` method """ return default.backend.get_thumbnail(file_, geometry_string, **options)
def function[get_thumbnail, parameter[file_, geometry_string]]: constant[ A shortcut for the Backend ``get_thumbnail`` method ] return[call[name[default].backend.get_thumbnail, parameter[name[file_], name[geometry_string]]]]
keyword[def] identifier[get_thumbnail] ( identifier[file_] , identifier[geometry_string] ,** identifier[options] ): literal[string] keyword[return] identifier[default] . identifier[backend] . identifier[get_thumbnail] ( identifier[file_] , identifier[geometry_string] ,** identifier[options] )
def get_thumbnail(file_, geometry_string, **options): """ A shortcut for the Backend ``get_thumbnail`` method """ return default.backend.get_thumbnail(file_, geometry_string, **options)
def parse(argv=None): """ Parse some arguments using the parser. """ if argv is None: argv = sys.argv[1:] # Evade http://bugs.python.org/issue9253 if not argv or argv[0] not in {"run", "transform"}: argv = ["run"] + argv arguments = _clean(_parser.parse_args(argv)) re...
def function[parse, parameter[argv]]: constant[ Parse some arguments using the parser. ] if compare[name[argv] is constant[None]] begin[:] variable[argv] assign[=] call[name[sys].argv][<ast.Slice object at 0x7da20c794610>] if <ast.BoolOp object at 0x7da20c795900> begin[:...
keyword[def] identifier[parse] ( identifier[argv] = keyword[None] ): literal[string] keyword[if] identifier[argv] keyword[is] keyword[None] : identifier[argv] = identifier[sys] . identifier[argv] [ literal[int] :] keyword[if] keyword[not] identifier[argv] keyword[or] identif...
def parse(argv=None): """ Parse some arguments using the parser. """ if argv is None: argv = sys.argv[1:] # depends on [control=['if'], data=['argv']] # Evade http://bugs.python.org/issue9253 if not argv or argv[0] not in {'run', 'transform'}: argv = ['run'] + argv # depends o...
def read_lines_from_file(file_path: str) -> List[str]: """ Read text lines from a file """ # check if the file exists? with open(file_path) as csv_file: content = csv_file.readlines() return content
def function[read_lines_from_file, parameter[file_path]]: constant[ Read text lines from a file ] with call[name[open], parameter[name[file_path]]] begin[:] variable[content] assign[=] call[name[csv_file].readlines, parameter[]] return[name[content]]
keyword[def] identifier[read_lines_from_file] ( identifier[file_path] : identifier[str] )-> identifier[List] [ identifier[str] ]: literal[string] keyword[with] identifier[open] ( identifier[file_path] ) keyword[as] identifier[csv_file] : identifier[content] = identifier[csv_file] . identifi...
def read_lines_from_file(file_path: str) -> List[str]: """ Read text lines from a file """ # check if the file exists? with open(file_path) as csv_file: content = csv_file.readlines() # depends on [control=['with'], data=['csv_file']] return content
def run(self): """Run until there are no more events. This only looks at events scheduled through the event loop. """ self._stop = False while not self._stop: have_sources = self._timers or self._readers or self._writers if not self._processor.pending and ...
def function[run, parameter[self]]: constant[Run until there are no more events. This only looks at events scheduled through the event loop. ] name[self]._stop assign[=] constant[False] while <ast.UnaryOp object at 0x7da20c7c8520> begin[:] variable[have_sources] a...
keyword[def] identifier[run] ( identifier[self] ): literal[string] identifier[self] . identifier[_stop] = keyword[False] keyword[while] keyword[not] identifier[self] . identifier[_stop] : identifier[have_sources] = identifier[self] . identifier[_timers] keyword[or] identi...
def run(self): """Run until there are no more events. This only looks at events scheduled through the event loop. """ self._stop = False while not self._stop: have_sources = self._timers or self._readers or self._writers if not self._processor.pending and (not have_sources): ...