code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def get_variable_info(cls, hads_var_name): """ Returns a tuple of (mmi name, units, english name, english description) or None. """ if hads_var_name == "UR": return ( "wind_gust_from_direction", "degrees from N", "Wind Gust from...
def function[get_variable_info, parameter[cls, hads_var_name]]: constant[ Returns a tuple of (mmi name, units, english name, english description) or None. ] if compare[name[hads_var_name] equal[==] constant[UR]] begin[:] return[tuple[[<ast.Constant object at 0x7da1b2353d30>, <ast...
keyword[def] identifier[get_variable_info] ( identifier[cls] , identifier[hads_var_name] ): literal[string] keyword[if] identifier[hads_var_name] == literal[string] : keyword[return] ( literal[string] , literal[string] , literal[string] , ...
def get_variable_info(cls, hads_var_name): """ Returns a tuple of (mmi name, units, english name, english description) or None. """ if hads_var_name == 'UR': return ('wind_gust_from_direction', 'degrees from N', 'Wind Gust from Direction', 'Direction from which wind gust is blowing when ...
def exit(self): """Quits this octave session and cleans up. """ if self._engine: self._engine.repl.terminate() self._engine = None
def function[exit, parameter[self]]: constant[Quits this octave session and cleans up. ] if name[self]._engine begin[:] call[name[self]._engine.repl.terminate, parameter[]] name[self]._engine assign[=] constant[None]
keyword[def] identifier[exit] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_engine] : identifier[self] . identifier[_engine] . identifier[repl] . identifier[terminate] () identifier[self] . identifier[_engine] = keyword[None]
def exit(self): """Quits this octave session and cleans up. """ if self._engine: self._engine.repl.terminate() # depends on [control=['if'], data=[]] self._engine = None
def Rowlinson_Poling(T, Tc, omega, Cpgm): r'''Calculate liquid constant-pressure heat capacitiy with the [1]_ CSP method. This equation is not terrible accurate. The heat capacity of a liquid is given by: .. math:: \frac{Cp^{L} - Cp^{g}}{R} = 1.586 + \frac{0.49}{1-T_r} + \omega\left[ ...
def function[Rowlinson_Poling, parameter[T, Tc, omega, Cpgm]]: constant[Calculate liquid constant-pressure heat capacitiy with the [1]_ CSP method. This equation is not terrible accurate. The heat capacity of a liquid is given by: .. math:: \frac{Cp^{L} - Cp^{g}}{R} = 1.586 + \frac{0.49}{...
keyword[def] identifier[Rowlinson_Poling] ( identifier[T] , identifier[Tc] , identifier[omega] , identifier[Cpgm] ): literal[string] identifier[Tr] = identifier[T] / identifier[Tc] identifier[Cplm] = identifier[Cpgm] + identifier[R] *( literal[int] + literal[int] /( literal[int] - identifier[Tr] )+ i...
def Rowlinson_Poling(T, Tc, omega, Cpgm): """Calculate liquid constant-pressure heat capacitiy with the [1]_ CSP method. This equation is not terrible accurate. The heat capacity of a liquid is given by: .. math:: \\frac{Cp^{L} - Cp^{g}}{R} = 1.586 + \\frac{0.49}{1-T_r} + \\omega\\lef...
def str2dict(dotted_str, value=None, separator='.'): """ Convert dotted string to dict splitting by :separator: """ dict_ = {} parts = dotted_str.split(separator) d, prev = dict_, None for part in parts: prev = d d = d.setdefault(part, {}) else: if value is not None: ...
def function[str2dict, parameter[dotted_str, value, separator]]: constant[ Convert dotted string to dict splitting by :separator: ] variable[dict_] assign[=] dictionary[[], []] variable[parts] assign[=] call[name[dotted_str].split, parameter[name[separator]]] <ast.Tuple object at 0x7da20...
keyword[def] identifier[str2dict] ( identifier[dotted_str] , identifier[value] = keyword[None] , identifier[separator] = literal[string] ): literal[string] identifier[dict_] ={} identifier[parts] = identifier[dotted_str] . identifier[split] ( identifier[separator] ) identifier[d] , identifier[pre...
def str2dict(dotted_str, value=None, separator='.'): """ Convert dotted string to dict splitting by :separator: """ dict_ = {} parts = dotted_str.split(separator) (d, prev) = (dict_, None) for part in parts: prev = d d = d.setdefault(part, {}) # depends on [control=['for'], data=['p...
def route(self, req, node, path): ''' Looks up a controller from a node based upon the specified path. :param node: The node, such as a root controller object. :param path: The path to look up on this node. ''' path = path.split('/')[1:] try: node, re...
def function[route, parameter[self, req, node, path]]: constant[ Looks up a controller from a node based upon the specified path. :param node: The node, such as a root controller object. :param path: The path to look up on this node. ] variable[path] assign[=] call[call[...
keyword[def] identifier[route] ( identifier[self] , identifier[req] , identifier[node] , identifier[path] ): literal[string] identifier[path] = identifier[path] . identifier[split] ( literal[string] )[ literal[int] :] keyword[try] : identifier[node] , identifier[remainder] = i...
def route(self, req, node, path): """ Looks up a controller from a node based upon the specified path. :param node: The node, such as a root controller object. :param path: The path to look up on this node. """ path = path.split('/')[1:] try: (node, remainder) = look...
def is_module_reloadable(self, module, modname): """Decide if a module is reloadable or not.""" if self.has_cython: # Don't return cached inline compiled .PYX files return False else: if (self.is_module_in_pathlist(module) or self.is_module...
def function[is_module_reloadable, parameter[self, module, modname]]: constant[Decide if a module is reloadable or not.] if name[self].has_cython begin[:] return[constant[False]]
keyword[def] identifier[is_module_reloadable] ( identifier[self] , identifier[module] , identifier[modname] ): literal[string] keyword[if] identifier[self] . identifier[has_cython] : keyword[return] keyword[False] keyword[else] : keyword[if] ( identifi...
def is_module_reloadable(self, module, modname): """Decide if a module is reloadable or not.""" if self.has_cython: # Don't return cached inline compiled .PYX files return False # depends on [control=['if'], data=[]] elif self.is_module_in_pathlist(module) or self.is_module_in_namelist(modn...
def execute(script, *args, **kwargs): """ Executes a command through the shell. Spaces should breakup the args. Usage: execute('grep', 'TODO', '*') NOTE: Any kwargs will be converted to args in the destination command. E.g. execute('grep', 'TODO', '*', **{'--before-context': 5}) will be $grep todo * --b...
def function[execute, parameter[script]]: constant[ Executes a command through the shell. Spaces should breakup the args. Usage: execute('grep', 'TODO', '*') NOTE: Any kwargs will be converted to args in the destination command. E.g. execute('grep', 'TODO', '*', **{'--before-context': 5}) will be $g...
keyword[def] identifier[execute] ( identifier[script] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[popen_args] =[ identifier[script] ]+ identifier[list] ( identifier[args] ) keyword[if] identifier[kwargs] : identifier[popen_args] . identifier[extend] ( identifier...
def execute(script, *args, **kwargs): """ Executes a command through the shell. Spaces should breakup the args. Usage: execute('grep', 'TODO', '*') NOTE: Any kwargs will be converted to args in the destination command. E.g. execute('grep', 'TODO', '*', **{'--before-context': 5}) will be $grep todo * --b...
def _genpath(self, filename, mhash): """Generate the path to a file in the cache. Does not check to see if the file exists. Just constructs the path where it should be. """ mhash = mhash.hexdigest() return os.path.join(self.mh_cachedir, mhash[0:2], mhash[2:4], ...
def function[_genpath, parameter[self, filename, mhash]]: constant[Generate the path to a file in the cache. Does not check to see if the file exists. Just constructs the path where it should be. ] variable[mhash] assign[=] call[name[mhash].hexdigest, parameter[]] return[cal...
keyword[def] identifier[_genpath] ( identifier[self] , identifier[filename] , identifier[mhash] ): literal[string] identifier[mhash] = identifier[mhash] . identifier[hexdigest] () keyword[return] identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[mh_cache...
def _genpath(self, filename, mhash): """Generate the path to a file in the cache. Does not check to see if the file exists. Just constructs the path where it should be. """ mhash = mhash.hexdigest() return os.path.join(self.mh_cachedir, mhash[0:2], mhash[2:4], mhash, filename)
def parse(cls, fptr, offset, length): """Parse CaptureResolutionBox. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
def function[parse, parameter[cls, fptr, offset, length]]: constant[Parse CaptureResolutionBox. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. ...
keyword[def] identifier[parse] ( identifier[cls] , identifier[fptr] , identifier[offset] , identifier[length] ): literal[string] identifier[read_buffer] = identifier[fptr] . identifier[read] ( literal[int] ) ( identifier[rn1] , identifier[rd1] , identifier[rn2] , identifier[rd2] , identifie...
def parse(cls, fptr, offset, length): """Parse CaptureResolutionBox. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns -------...
def predict_expectation(self, X): r""" Compute the expected lifetime, :math:`E[T]`, using covariates X. This algorithm to compute the expectation is to use the fact that :math:`E[T] = \int_0^\inf P(T > t) dt = \int_0^\inf S(t) dt`. To compute the integral, we use the trapizoidal rule to approxim...
def function[predict_expectation, parameter[self, X]]: constant[ Compute the expected lifetime, :math:`E[T]`, using covariates X. This algorithm to compute the expectation is to use the fact that :math:`E[T] = \int_0^\inf P(T > t) dt = \int_0^\inf S(t) dt`. To compute the integral, we use the tr...
keyword[def] identifier[predict_expectation] ( identifier[self] , identifier[X] ): literal[string] identifier[subjects] = identifier[_get_index] ( identifier[X] ) identifier[v] = identifier[self] . identifier[predict_survival_function] ( identifier[X] )[ identifier[subjects] ] key...
def predict_expectation(self, X): """ Compute the expected lifetime, :math:`E[T]`, using covariates X. This algorithm to compute the expectation is to use the fact that :math:`E[T] = \\int_0^\\inf P(T > t) dt = \\int_0^\\inf S(t) dt`. To compute the integral, we use the trapizoidal rule to approxima...
def process_spider_input(self, response, spider): ''' Ensures the meta data from the response is passed through in any Request's generated from the spider ''' self.logger.debug("processing redis stats middleware") if self.settings['STATS_STATUS_CODES']: if spi...
def function[process_spider_input, parameter[self, response, spider]]: constant[ Ensures the meta data from the response is passed through in any Request's generated from the spider ] call[name[self].logger.debug, parameter[constant[processing redis stats middleware]]] if...
keyword[def] identifier[process_spider_input] ( identifier[self] , identifier[response] , identifier[spider] ): literal[string] identifier[self] . identifier[logger] . identifier[debug] ( literal[string] ) keyword[if] identifier[self] . identifier[settings] [ literal[string] ]: ...
def process_spider_input(self, response, spider): """ Ensures the meta data from the response is passed through in any Request's generated from the spider """ self.logger.debug('processing redis stats middleware') if self.settings['STATS_STATUS_CODES']: if spider.name not in ...
def _start_keep_alive(self): ''' Start the keep alive thread as a daemon ''' keep_alive_thread = threading.Thread(target=self.keep_alive) keep_alive_thread.daemon = True keep_alive_thread.start()
def function[_start_keep_alive, parameter[self]]: constant[ Start the keep alive thread as a daemon ] variable[keep_alive_thread] assign[=] call[name[threading].Thread, parameter[]] name[keep_alive_thread].daemon assign[=] constant[True] call[name[keep_alive_thread].start...
keyword[def] identifier[_start_keep_alive] ( identifier[self] ): literal[string] identifier[keep_alive_thread] = identifier[threading] . identifier[Thread] ( identifier[target] = identifier[self] . identifier[keep_alive] ) identifier[keep_alive_thread] . identifier[daemon] = keyword[True] ...
def _start_keep_alive(self): """ Start the keep alive thread as a daemon """ keep_alive_thread = threading.Thread(target=self.keep_alive) keep_alive_thread.daemon = True keep_alive_thread.start()
def factory(opts, **kwargs): ''' If we have additional IPC transports other than UxD and TCP, add them here ''' # FIXME for now, just UXD # Obviously, this makes the factory approach pointless, but we'll extend later import salt.transport.ipc return salt.transport...
def function[factory, parameter[opts]]: constant[ If we have additional IPC transports other than UxD and TCP, add them here ] import module[salt.transport.ipc] return[call[name[salt].transport.ipc.IPCMessageClient, parameter[name[opts]]]]
keyword[def] identifier[factory] ( identifier[opts] ,** identifier[kwargs] ): literal[string] keyword[import] identifier[salt] . identifier[transport] . identifier[ipc] keyword[return] identifier[salt] . identifier[transport] . identifier[ipc] . identifier[IPCMessageCl...
def factory(opts, **kwargs): """ If we have additional IPC transports other than UxD and TCP, add them here """ # FIXME for now, just UXD # Obviously, this makes the factory approach pointless, but we'll extend later import salt.transport.ipc return salt.transport.ipc.IPCMessageClien...
def doExperiment(numColumns, objects, l2Overrides, noiseLevels, numInitialTraversals, noisyFeature, noisyLocation): """ Touch every point on an object 'numInitialTraversals' times, then evaluate whether it has inferred the object by touching every point once more and checking the number of corr...
def function[doExperiment, parameter[numColumns, objects, l2Overrides, noiseLevels, numInitialTraversals, noisyFeature, noisyLocation]]: constant[ Touch every point on an object 'numInitialTraversals' times, then evaluate whether it has inferred the object by touching every point once more and checking th...
keyword[def] identifier[doExperiment] ( identifier[numColumns] , identifier[objects] , identifier[l2Overrides] , identifier[noiseLevels] , identifier[numInitialTraversals] , identifier[noisyFeature] , identifier[noisyLocation] ): literal[string] identifier[featureSDR] = keyword[lambda] : identifier[set] ( id...
def doExperiment(numColumns, objects, l2Overrides, noiseLevels, numInitialTraversals, noisyFeature, noisyLocation): """ Touch every point on an object 'numInitialTraversals' times, then evaluate whether it has inferred the object by touching every point once more and checking the number of correctly active an...
def detect(self, volume_system, vstype='detect'): """Gather information about lvolumes, gathering their label, size and raw path""" volume_group = volume_system.parent.info.get('volume_group') result = _util.check_output_(["lvm", "lvdisplay", volume_group]) cur_v = None for l i...
def function[detect, parameter[self, volume_system, vstype]]: constant[Gather information about lvolumes, gathering their label, size and raw path] variable[volume_group] assign[=] call[name[volume_system].parent.info.get, parameter[constant[volume_group]]] variable[result] assign[=] call[name[_...
keyword[def] identifier[detect] ( identifier[self] , identifier[volume_system] , identifier[vstype] = literal[string] ): literal[string] identifier[volume_group] = identifier[volume_system] . identifier[parent] . identifier[info] . identifier[get] ( literal[string] ) identifier[result] =...
def detect(self, volume_system, vstype='detect'): """Gather information about lvolumes, gathering their label, size and raw path""" volume_group = volume_system.parent.info.get('volume_group') result = _util.check_output_(['lvm', 'lvdisplay', volume_group]) cur_v = None for l in result.splitlines():...
def format_ring_double_bond(mol): """Set double bonds around the ring. """ mol.require("Topology") mol.require("ScaleAndCenter") for r in sorted(mol.rings, key=len, reverse=True): vertices = [mol.atom(n).coords for n in r] try: if geometry.is_clockwise(vertices): ...
def function[format_ring_double_bond, parameter[mol]]: constant[Set double bonds around the ring. ] call[name[mol].require, parameter[constant[Topology]]] call[name[mol].require, parameter[constant[ScaleAndCenter]]] for taget[name[r]] in starred[call[name[sorted], parameter[name[mol]...
keyword[def] identifier[format_ring_double_bond] ( identifier[mol] ): literal[string] identifier[mol] . identifier[require] ( literal[string] ) identifier[mol] . identifier[require] ( literal[string] ) keyword[for] identifier[r] keyword[in] identifier[sorted] ( identifier[mol] . identifier[rin...
def format_ring_double_bond(mol): """Set double bonds around the ring. """ mol.require('Topology') mol.require('ScaleAndCenter') for r in sorted(mol.rings, key=len, reverse=True): vertices = [mol.atom(n).coords for n in r] try: if geometry.is_clockwise(vertices): ...
def format_mtime(mtime): """ Format the date associated with a file to be displayed in directory listing. """ now = datetime.now() dt = datetime.fromtimestamp(mtime) return '%s %2d %5s' % ( dt.strftime('%b'), dt.day, dt.year if dt.year != now.year else dt.strftime('%H:%M'))
def function[format_mtime, parameter[mtime]]: constant[ Format the date associated with a file to be displayed in directory listing. ] variable[now] assign[=] call[name[datetime].now, parameter[]] variable[dt] assign[=] call[name[datetime].fromtimestamp, parameter[name[mtime]]] return[bi...
keyword[def] identifier[format_mtime] ( identifier[mtime] ): literal[string] identifier[now] = identifier[datetime] . identifier[now] () identifier[dt] = identifier[datetime] . identifier[fromtimestamp] ( identifier[mtime] ) keyword[return] literal[string] %( identifier[dt] . identifier[strftime] ( l...
def format_mtime(mtime): """ Format the date associated with a file to be displayed in directory listing. """ now = datetime.now() dt = datetime.fromtimestamp(mtime) return '%s %2d %5s' % (dt.strftime('%b'), dt.day, dt.year if dt.year != now.year else dt.strftime('%H:%M'))
def get_all_classify(): """获取全部菜谱分类""" url = "https://www.xinshipu.com/%E8%8F%9C%E8%B0%B1%E5%A4%A7%E5%85%A8.html" response = requests.get(url, headers=get_header()) html = BeautifulSoup(response.text, "lxml") all_a = html.find("div", {'class': "detail-cate-list clearfix mt20"}).find_all('a') cl...
def function[get_all_classify, parameter[]]: constant[获取全部菜谱分类] variable[url] assign[=] constant[https://www.xinshipu.com/%E8%8F%9C%E8%B0%B1%E5%A4%A7%E5%85%A8.html] variable[response] assign[=] call[name[requests].get, parameter[name[url]]] variable[html] assign[=] call[name[BeautifulSou...
keyword[def] identifier[get_all_classify] (): literal[string] identifier[url] = literal[string] identifier[response] = identifier[requests] . identifier[get] ( identifier[url] , identifier[headers] = identifier[get_header] ()) identifier[html] = identifier[BeautifulSoup] ( identifier[response] ....
def get_all_classify(): """获取全部菜谱分类""" url = 'https://www.xinshipu.com/%E8%8F%9C%E8%B0%B1%E5%A4%A7%E5%85%A8.html' response = requests.get(url, headers=get_header()) html = BeautifulSoup(response.text, 'lxml') all_a = html.find('div', {'class': 'detail-cate-list clearfix mt20'}).find_all('a') cla...
def quit(self): """ This could be called from another thread, so let's do this via alarm """ def q(*args): raise urwid.ExitMainLoop() self.worker.shutdown(wait=False) self.ui_worker.shutdown(wait=False) self.loop.set_alarm_in(0, q)
def function[quit, parameter[self]]: constant[ This could be called from another thread, so let's do this via alarm ] def function[q, parameter[]]: <ast.Raise object at 0x7da1b0723e50> call[name[self].worker.shutdown, parameter[]] call[name[self].ui_worker.shutdow...
keyword[def] identifier[quit] ( identifier[self] ): literal[string] keyword[def] identifier[q] (* identifier[args] ): keyword[raise] identifier[urwid] . identifier[ExitMainLoop] () identifier[self] . identifier[worker] . identifier[shutdown] ( identifier[wait] = keyword[Fals...
def quit(self): """ This could be called from another thread, so let's do this via alarm """ def q(*args): raise urwid.ExitMainLoop() self.worker.shutdown(wait=False) self.ui_worker.shutdown(wait=False) self.loop.set_alarm_in(0, q)
def fetch_by_ids(TableName,iso_id_list,numin,numax,ParameterGroups=[],Parameters=[]): """ INPUT PARAMETERS: TableName: local table name to fetch in (required) iso_id_list: list of isotopologue id's (required) numin: lower wavenumber bound (required) numax: ...
def function[fetch_by_ids, parameter[TableName, iso_id_list, numin, numax, ParameterGroups, Parameters]]: constant[ INPUT PARAMETERS: TableName: local table name to fetch in (required) iso_id_list: list of isotopologue id's (required) numin: lower wavenumber bound (...
keyword[def] identifier[fetch_by_ids] ( identifier[TableName] , identifier[iso_id_list] , identifier[numin] , identifier[numax] , identifier[ParameterGroups] =[], identifier[Parameters] =[]): literal[string] keyword[if] identifier[type] ( identifier[iso_id_list] ) keyword[not] keyword[in] identifier[set...
def fetch_by_ids(TableName, iso_id_list, numin, numax, ParameterGroups=[], Parameters=[]): """ INPUT PARAMETERS: TableName: local table name to fetch in (required) iso_id_list: list of isotopologue id's (required) numin: lower wavenumber bound (required) numax: ...
def build_profile_variant(variant): """Returns a ProfileVariant object Args: variant (cyvcf2.Variant) Returns: variant (models.ProfileVariant) """ chrom = variant.CHROM if chrom.startswith(('chr', 'CHR', 'Chr')): chrom = chrom[3:] pos = int(variant.POS) varia...
def function[build_profile_variant, parameter[variant]]: constant[Returns a ProfileVariant object Args: variant (cyvcf2.Variant) Returns: variant (models.ProfileVariant) ] variable[chrom] assign[=] name[variant].CHROM if call[name[chrom].startswith, parameter[tuple[...
keyword[def] identifier[build_profile_variant] ( identifier[variant] ): literal[string] identifier[chrom] = identifier[variant] . identifier[CHROM] keyword[if] identifier[chrom] . identifier[startswith] (( literal[string] , literal[string] , literal[string] )): identifier[chrom] = identifi...
def build_profile_variant(variant): """Returns a ProfileVariant object Args: variant (cyvcf2.Variant) Returns: variant (models.ProfileVariant) """ chrom = variant.CHROM if chrom.startswith(('chr', 'CHR', 'Chr')): chrom = chrom[3:] # depends on [control=['if'], data=[]]...
def issur_melacha_in_effect(self): """At the given time, return whether issur melacha is in effect.""" # TODO: Rewrite this in terms of candle_lighting/havdalah properties. weekday = self.date.weekday() tomorrow = self.date + dt.timedelta(days=1) tomorrow_holiday_type = HDate( ...
def function[issur_melacha_in_effect, parameter[self]]: constant[At the given time, return whether issur melacha is in effect.] variable[weekday] assign[=] call[name[self].date.weekday, parameter[]] variable[tomorrow] assign[=] binary_operation[name[self].date + call[name[dt].timedelta, paramete...
keyword[def] identifier[issur_melacha_in_effect] ( identifier[self] ): literal[string] identifier[weekday] = identifier[self] . identifier[date] . identifier[weekday] () identifier[tomorrow] = identifier[self] . identifier[date] + identifier[dt] . identifier[timedelta] ( identifie...
def issur_melacha_in_effect(self): """At the given time, return whether issur melacha is in effect.""" # TODO: Rewrite this in terms of candle_lighting/havdalah properties. weekday = self.date.weekday() tomorrow = self.date + dt.timedelta(days=1) tomorrow_holiday_type = HDate(gdate=tomorrow, diaspor...
def iterkeys(self): """ Enumerate the keys found at any scope for the current plugin. rtype: Generator[str] """ visited_keys = set() try: for key in self.idb.iterkeys(): if key not in visited_keys: yield key ...
def function[iterkeys, parameter[self]]: constant[ Enumerate the keys found at any scope for the current plugin. rtype: Generator[str] ] variable[visited_keys] assign[=] call[name[set], parameter[]] <ast.Try object at 0x7da1b026c910> <ast.Try object at 0x7da1b026e860> ...
keyword[def] identifier[iterkeys] ( identifier[self] ): literal[string] identifier[visited_keys] = identifier[set] () keyword[try] : keyword[for] identifier[key] keyword[in] identifier[self] . identifier[idb] . identifier[iterkeys] (): keyword[if] identifi...
def iterkeys(self): """ Enumerate the keys found at any scope for the current plugin. rtype: Generator[str] """ visited_keys = set() try: for key in self.idb.iterkeys(): if key not in visited_keys: yield key visited_keys.add(key) ...
def parse_cif_structure(self): """Parse a `StructureData` from the cleaned `CifData` returned by the `CifSelectCalculation`.""" from aiida_codtools.workflows.functions.primitive_structure_from_cif import primitive_structure_from_cif if self.ctx.cif.has_unknown_species: self.ctx.exit...
def function[parse_cif_structure, parameter[self]]: constant[Parse a `StructureData` from the cleaned `CifData` returned by the `CifSelectCalculation`.] from relative_module[aiida_codtools.workflows.functions.primitive_structure_from_cif] import module[primitive_structure_from_cif] if name[self].ctx...
keyword[def] identifier[parse_cif_structure] ( identifier[self] ): literal[string] keyword[from] identifier[aiida_codtools] . identifier[workflows] . identifier[functions] . identifier[primitive_structure_from_cif] keyword[import] identifier[primitive_structure_from_cif] keyword[if] ...
def parse_cif_structure(self): """Parse a `StructureData` from the cleaned `CifData` returned by the `CifSelectCalculation`.""" from aiida_codtools.workflows.functions.primitive_structure_from_cif import primitive_structure_from_cif if self.ctx.cif.has_unknown_species: self.ctx.exit_code = self.exit...
def create_context(self, state_hash, base_contexts, inputs, outputs): """Create a ExecutionContext to run a transaction against. Args: state_hash: (str): Merkle root to base state on. base_contexts (list of str): Context ids of contexts that will have their state...
def function[create_context, parameter[self, state_hash, base_contexts, inputs, outputs]]: constant[Create a ExecutionContext to run a transaction against. Args: state_hash: (str): Merkle root to base state on. base_contexts (list of str): Context ids of contexts that will ...
keyword[def] identifier[create_context] ( identifier[self] , identifier[state_hash] , identifier[base_contexts] , identifier[inputs] , identifier[outputs] ): literal[string] keyword[for] identifier[address] keyword[in] identifier[inputs] : keyword[if] keyword[not] identifier[self...
def create_context(self, state_hash, base_contexts, inputs, outputs): """Create a ExecutionContext to run a transaction against. Args: state_hash: (str): Merkle root to base state on. base_contexts (list of str): Context ids of contexts that will have their state app...
def extend(self, iterable): """Extend the list by appending all the items in the given list.""" return super(Collection, self).extend( self._ensure_iterable_is_valid(iterable))
def function[extend, parameter[self, iterable]]: constant[Extend the list by appending all the items in the given list.] return[call[call[name[super], parameter[name[Collection], name[self]]].extend, parameter[call[name[self]._ensure_iterable_is_valid, parameter[name[iterable]]]]]]
keyword[def] identifier[extend] ( identifier[self] , identifier[iterable] ): literal[string] keyword[return] identifier[super] ( identifier[Collection] , identifier[self] ). identifier[extend] ( identifier[self] . identifier[_ensure_iterable_is_valid] ( identifier[iterable] ))
def extend(self, iterable): """Extend the list by appending all the items in the given list.""" return super(Collection, self).extend(self._ensure_iterable_is_valid(iterable))
def assertFileSizeEqual(self, filename, size, msg=None): '''Fail if ``filename`` does not have the given ``size`` as determined by the '==' operator. Parameters ---------- filename : str, bytes, file-like size : int, float msg : str If not provided, t...
def function[assertFileSizeEqual, parameter[self, filename, size, msg]]: constant[Fail if ``filename`` does not have the given ``size`` as determined by the '==' operator. Parameters ---------- filename : str, bytes, file-like size : int, float msg : str ...
keyword[def] identifier[assertFileSizeEqual] ( identifier[self] , identifier[filename] , identifier[size] , identifier[msg] = keyword[None] ): literal[string] identifier[fsize] = identifier[self] . identifier[_get_file_size] ( identifier[filename] ) identifier[self] . identifier[assertEqua...
def assertFileSizeEqual(self, filename, size, msg=None): """Fail if ``filename`` does not have the given ``size`` as determined by the '==' operator. Parameters ---------- filename : str, bytes, file-like size : int, float msg : str If not provided, the :...
def dbg(message, *args): """ Looks at the stack, to see if a debug message should be printed. """ if debug_function and enable_notice: frm = inspect.stack()[1] mod = inspect.getmodule(frm[0]) if not (mod.__name__ in ignored_modules): i = ' ' * _debug_indent debug_...
def function[dbg, parameter[message]]: constant[ Looks at the stack, to see if a debug message should be printed. ] if <ast.BoolOp object at 0x7da18fe90820> begin[:] variable[frm] assign[=] call[call[name[inspect].stack, parameter[]]][constant[1]] variable[mod] assign[=] ...
keyword[def] identifier[dbg] ( identifier[message] ,* identifier[args] ): literal[string] keyword[if] identifier[debug_function] keyword[and] identifier[enable_notice] : identifier[frm] = identifier[inspect] . identifier[stack] ()[ literal[int] ] identifier[mod] = identifier[inspect] ....
def dbg(message, *args): """ Looks at the stack, to see if a debug message should be printed. """ if debug_function and enable_notice: frm = inspect.stack()[1] mod = inspect.getmodule(frm[0]) if not mod.__name__ in ignored_modules: i = ' ' * _debug_indent debug_fu...
def set_state(self, state): """ Set the state of this device to on or off. """ self.basicevent.SetBinaryState(BinaryState=int(state)) self._state = int(state)
def function[set_state, parameter[self, state]]: constant[ Set the state of this device to on or off. ] call[name[self].basicevent.SetBinaryState, parameter[]] name[self]._state assign[=] call[name[int], parameter[name[state]]]
keyword[def] identifier[set_state] ( identifier[self] , identifier[state] ): literal[string] identifier[self] . identifier[basicevent] . identifier[SetBinaryState] ( identifier[BinaryState] = identifier[int] ( identifier[state] )) identifier[self] . identifier[_state] = identifier[int] ( i...
def set_state(self, state): """ Set the state of this device to on or off. """ self.basicevent.SetBinaryState(BinaryState=int(state)) self._state = int(state)
def remover(self, id_tipo_acesso): """Removes access type by its identifier. :param id_tipo_acesso: Access type identifier. :return: None :raise TipoAcessoError: Access type associated with equipment, cannot be removed. :raise InvalidParameterError: Protocol value is invalid o...
def function[remover, parameter[self, id_tipo_acesso]]: constant[Removes access type by its identifier. :param id_tipo_acesso: Access type identifier. :return: None :raise TipoAcessoError: Access type associated with equipment, cannot be removed. :raise InvalidParameterError: ...
keyword[def] identifier[remover] ( identifier[self] , identifier[id_tipo_acesso] ): literal[string] keyword[if] keyword[not] identifier[is_valid_int_param] ( identifier[id_tipo_acesso] ): keyword[raise] identifier[InvalidParameterError] ( literal[string] ) ide...
def remover(self, id_tipo_acesso): """Removes access type by its identifier. :param id_tipo_acesso: Access type identifier. :return: None :raise TipoAcessoError: Access type associated with equipment, cannot be removed. :raise InvalidParameterError: Protocol value is invalid or no...
def create(self, identity, role_sid=values.unset, attributes=values.unset, friendly_name=values.unset): """ Create a new UserInstance :param unicode identity: The `identity` value that identifies the new resource's User :param unicode role_sid: The SID of the Role assigne...
def function[create, parameter[self, identity, role_sid, attributes, friendly_name]]: constant[ Create a new UserInstance :param unicode identity: The `identity` value that identifies the new resource's User :param unicode role_sid: The SID of the Role assigned to this user :par...
keyword[def] identifier[create] ( identifier[self] , identifier[identity] , identifier[role_sid] = identifier[values] . identifier[unset] , identifier[attributes] = identifier[values] . identifier[unset] , identifier[friendly_name] = identifier[values] . identifier[unset] ): literal[string] identi...
def create(self, identity, role_sid=values.unset, attributes=values.unset, friendly_name=values.unset): """ Create a new UserInstance :param unicode identity: The `identity` value that identifies the new resource's User :param unicode role_sid: The SID of the Role assigned to this user ...
def attach_service(cls, service): """ Allows you to attach one TCP and one HTTP service deprecated:: 2.1.73 use http and tcp specific methods :param service: A trellio TCP or HTTP service that needs to be hosted """ if isinstance(service, HTTPService): cls._http_serv...
def function[attach_service, parameter[cls, service]]: constant[ Allows you to attach one TCP and one HTTP service deprecated:: 2.1.73 use http and tcp specific methods :param service: A trellio TCP or HTTP service that needs to be hosted ] if call[name[isinstance], parameter[na...
keyword[def] identifier[attach_service] ( identifier[cls] , identifier[service] ): literal[string] keyword[if] identifier[isinstance] ( identifier[service] , identifier[HTTPService] ): identifier[cls] . identifier[_http_service] = identifier[service] keyword[elif] identifie...
def attach_service(cls, service): """ Allows you to attach one TCP and one HTTP service deprecated:: 2.1.73 use http and tcp specific methods :param service: A trellio TCP or HTTP service that needs to be hosted """ if isinstance(service, HTTPService): cls._http_service = servic...
def encrypt_cbc_cts(self, data, init_vector): """ Return an iterator that encrypts `data` using the Cipher-Block Chaining with Ciphertext Stealing (CBC-CTS) mode of operation. CBC-CTS mode can only operate on `data` that is greater than 8 bytes in length. Each iteration, except the las...
def function[encrypt_cbc_cts, parameter[self, data, init_vector]]: constant[ Return an iterator that encrypts `data` using the Cipher-Block Chaining with Ciphertext Stealing (CBC-CTS) mode of operation. CBC-CTS mode can only operate on `data` that is greater than 8 bytes in length. ...
keyword[def] identifier[encrypt_cbc_cts] ( identifier[self] , identifier[data] , identifier[init_vector] ): literal[string] identifier[data_len] = identifier[len] ( identifier[data] ) keyword[if] identifier[data_len] <= literal[int] : keyword[raise] identifier[ValueError] ( literal[string] ) ...
def encrypt_cbc_cts(self, data, init_vector): """ Return an iterator that encrypts `data` using the Cipher-Block Chaining with Ciphertext Stealing (CBC-CTS) mode of operation. CBC-CTS mode can only operate on `data` that is greater than 8 bytes in length. Each iteration, except the las...
def format_env(key, value: Union[None, bytes, str]) -> str: """ Formats envs from {key:value} to ['key=value'] """ if value is None: return key if isinstance(value, bytes): value = value.decode("utf-8") return "{key}={value}".format(key=key, value=value)
def function[format_env, parameter[key, value]]: constant[ Formats envs from {key:value} to ['key=value'] ] if compare[name[value] is constant[None]] begin[:] return[name[key]] if call[name[isinstance], parameter[name[value], name[bytes]]] begin[:] variable[value]...
keyword[def] identifier[format_env] ( identifier[key] , identifier[value] : identifier[Union] [ keyword[None] , identifier[bytes] , identifier[str] ])-> identifier[str] : literal[string] keyword[if] identifier[value] keyword[is] keyword[None] : keyword[return] identifier[key] keyword[if]...
def format_env(key, value: Union[None, bytes, str]) -> str: """ Formats envs from {key:value} to ['key=value'] """ if value is None: return key # depends on [control=['if'], data=[]] if isinstance(value, bytes): value = value.decode('utf-8') # depends on [control=['if'], data=[]] ...
def thermal_source(self): """Apply emissivity to an existing beam to produce a thermal source spectrum (without optical counterpart). Thermal source spectrum is calculated as follow: #. Create a blackbody spectrum in PHOTLAM per square arcsec with `temperature`. ...
def function[thermal_source, parameter[self]]: constant[Apply emissivity to an existing beam to produce a thermal source spectrum (without optical counterpart). Thermal source spectrum is calculated as follow: #. Create a blackbody spectrum in PHOTLAM per square arcsec ...
keyword[def] identifier[thermal_source] ( identifier[self] ): literal[string] identifier[sp] =( identifier[SourceSpectrum] ( identifier[BlackBody1D] , identifier[temperature] = identifier[self] . identifier[temperature] )* identifier[units] . identifier[SR_PER_ARCSEC2] * identifier[self] ....
def thermal_source(self): """Apply emissivity to an existing beam to produce a thermal source spectrum (without optical counterpart). Thermal source spectrum is calculated as follow: #. Create a blackbody spectrum in PHOTLAM per square arcsec with `temperature`. ...
def block_code(self): inputs = self._get_all_input_values() outputs = {} """ self.f = self.user_function(**inputs) try: outputs = self.f.send(inputs) except StopIteration: self.terminate() """ if self.first_time: self.f ...
def function[block_code, parameter[self]]: variable[inputs] assign[=] call[name[self]._get_all_input_values, parameter[]] variable[outputs] assign[=] dictionary[[], []] constant[ self.f = self.user_function(**inputs) try: outputs = self.f.send(inputs) except S...
keyword[def] identifier[block_code] ( identifier[self] ): identifier[inputs] = identifier[self] . identifier[_get_all_input_values] () identifier[outputs] ={} literal[string] keyword[if] identifier[self] . identifier[first_time] : identifier[self] . identifier[f] = i...
def block_code(self): inputs = self._get_all_input_values() outputs = {} '\n self.f = self.user_function(**inputs)\n try:\n outputs = self.f.send(inputs)\n except StopIteration:\n self.terminate()\n ' if self.first_time: self.f = self.user_functi...
def flatten_multi_dim(sequence): """Flatten a multi-dimensional array-like to a single dimensional sequence (as a generator). """ for x in sequence: if (isinstance(x, collections.Iterable) and not isinstance(x, six.string_types)): for y in flatten_multi_dim(x): ...
def function[flatten_multi_dim, parameter[sequence]]: constant[Flatten a multi-dimensional array-like to a single dimensional sequence (as a generator). ] for taget[name[x]] in starred[name[sequence]] begin[:] if <ast.BoolOp object at 0x7da1b0f70250> begin[:] ...
keyword[def] identifier[flatten_multi_dim] ( identifier[sequence] ): literal[string] keyword[for] identifier[x] keyword[in] identifier[sequence] : keyword[if] ( identifier[isinstance] ( identifier[x] , identifier[collections] . identifier[Iterable] ) keyword[and] keyword[not] identif...
def flatten_multi_dim(sequence): """Flatten a multi-dimensional array-like to a single dimensional sequence (as a generator). """ for x in sequence: if isinstance(x, collections.Iterable) and (not isinstance(x, six.string_types)): for y in flatten_multi_dim(x): yield ...
def get_v_total_stress_at_depth(self, z): """ Determine the vertical total stress at depth z, where z can be a number or an array of numbers. """ if not hasattr(z, "__len__"): return self.one_vertical_total_stress(z) else: sigma_v_effs = [] fo...
def function[get_v_total_stress_at_depth, parameter[self, z]]: constant[ Determine the vertical total stress at depth z, where z can be a number or an array of numbers. ] if <ast.UnaryOp object at 0x7da20e9b3be0> begin[:] return[call[name[self].one_vertical_total_stress, paramete...
keyword[def] identifier[get_v_total_stress_at_depth] ( identifier[self] , identifier[z] ): literal[string] keyword[if] keyword[not] identifier[hasattr] ( identifier[z] , literal[string] ): keyword[return] identifier[self] . identifier[one_vertical_total_stress] ( identifier[z] ) ...
def get_v_total_stress_at_depth(self, z): """ Determine the vertical total stress at depth z, where z can be a number or an array of numbers. """ if not hasattr(z, '__len__'): return self.one_vertical_total_stress(z) # depends on [control=['if'], data=[]] else: sigma_v_effs ...
def connectToBroker(self, protocol): ''' Connect to MQTT broker ''' self.protocol = protocol self.protocol.onPublish = self.onPublish self.protocol.onDisconnection = self.onDisconnection self.protocol.setWindowSize(3) try: ...
def function[connectToBroker, parameter[self, protocol]]: constant[ Connect to MQTT broker ] name[self].protocol assign[=] name[protocol] name[self].protocol.onPublish assign[=] name[self].onPublish name[self].protocol.onDisconnection assign[=] name[self].onDisconnection ...
keyword[def] identifier[connectToBroker] ( identifier[self] , identifier[protocol] ): literal[string] identifier[self] . identifier[protocol] = identifier[protocol] identifier[self] . identifier[protocol] . identifier[onPublish] = identifier[self] . identifier[onPublish] identif...
def connectToBroker(self, protocol): """ Connect to MQTT broker """ self.protocol = protocol self.protocol.onPublish = self.onPublish self.protocol.onDisconnection = self.onDisconnection self.protocol.setWindowSize(3) try: yield self.protocol.connect('TwistedMQTT-subs', k...
def _generate_bokeh_file(file_name): """ ----- Brief ----- Auxiliary function responsible for the creation of a directory where Bokeh figures will be stored. The "active" output file for Bokeh will also be updated for the new one. ----------- Description ----------- To ensur...
def function[_generate_bokeh_file, parameter[file_name]]: constant[ ----- Brief ----- Auxiliary function responsible for the creation of a directory where Bokeh figures will be stored. The "active" output file for Bokeh will also be updated for the new one. ----------- Descripti...
keyword[def] identifier[_generate_bokeh_file] ( identifier[file_name] ): literal[string] keyword[if] identifier[file_name] keyword[is] keyword[None] : identifier[file_name] = literal[string] + identifier[time_package] . identifier[strftime] ( literal[string] ) keyword[else] : ...
def _generate_bokeh_file(file_name): """ ----- Brief ----- Auxiliary function responsible for the creation of a directory where Bokeh figures will be stored. The "active" output file for Bokeh will also be updated for the new one. ----------- Description ----------- To ensur...
def emitRemoved( self ): """ Emits the removed signal, provided the dispatcher's signals \ are not currently blocked. :return <bool> emitted """ # check the signals blocked if ( self.signalsBlocked() ): return False # emit...
def function[emitRemoved, parameter[self]]: constant[ Emits the removed signal, provided the dispatcher's signals are not currently blocked. :return <bool> emitted ] if call[name[self].signalsBlocked, parameter[]] begin[:] return[constant[False]] ...
keyword[def] identifier[emitRemoved] ( identifier[self] ): literal[string] keyword[if] ( identifier[self] . identifier[signalsBlocked] ()): keyword[return] keyword[False] identifier[self] . identifier[dispatch] . identifier[removed] . identifier[emit] ...
def emitRemoved(self): """ Emits the removed signal, provided the dispatcher's signals are not currently blocked. :return <bool> emitted """ # check the signals blocked if self.signalsBlocked(): return False # depends on [control=['if'], data=[]] # e...
def plotall(xargs): """ %prog plotall input.bed Plot the matchings between the reconstructed pseudomolecules and the maps. This command will plot each reconstructed object (non-singleton). """ p = OptionParser(plotall.__doc__) add_allmaps_plot_options(p) opts, args, iopts = p.set_image_...
def function[plotall, parameter[xargs]]: constant[ %prog plotall input.bed Plot the matchings between the reconstructed pseudomolecules and the maps. This command will plot each reconstructed object (non-singleton). ] variable[p] assign[=] call[name[OptionParser], parameter[name[plotall...
keyword[def] identifier[plotall] ( identifier[xargs] ): literal[string] identifier[p] = identifier[OptionParser] ( identifier[plotall] . identifier[__doc__] ) identifier[add_allmaps_plot_options] ( identifier[p] ) identifier[opts] , identifier[args] , identifier[iopts] = identifier[p] . identifie...
def plotall(xargs): """ %prog plotall input.bed Plot the matchings between the reconstructed pseudomolecules and the maps. This command will plot each reconstructed object (non-singleton). """ p = OptionParser(plotall.__doc__) add_allmaps_plot_options(p) (opts, args, iopts) = p.set_imag...
def read_inquiry_scan_activity(sock): """returns the current inquiry scan interval and window, or -1 on failure""" # save current filter old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) # Setup socket filter to receive only events related to the # read_inquiry_mode command ...
def function[read_inquiry_scan_activity, parameter[sock]]: constant[returns the current inquiry scan interval and window, or -1 on failure] variable[old_filter] assign[=] call[name[sock].getsockopt, parameter[name[bluez].SOL_HCI, name[bluez].HCI_FILTER, constant[14]]] variable[flt] assign[=...
keyword[def] identifier[read_inquiry_scan_activity] ( identifier[sock] ): literal[string] identifier[old_filter] = identifier[sock] . identifier[getsockopt] ( identifier[bluez] . identifier[SOL_HCI] , identifier[bluez] . identifier[HCI_FILTER] , literal[int] ) identifier[flt] = identif...
def read_inquiry_scan_activity(sock): """returns the current inquiry scan interval and window, or -1 on failure""" # save current filter old_filter = sock.getsockopt(bluez.SOL_HCI, bluez.HCI_FILTER, 14) # Setup socket filter to receive only events related to the # read_inquiry_mode command ...
def adjust_for_scratch(self): """ Remove certain plugins in order to handle the "scratch build" scenario. Scratch builds must not affect subsequent builds, and should not be imported into Koji. """ if self.user_params.scratch.value: remove_plugins = [ ...
def function[adjust_for_scratch, parameter[self]]: constant[ Remove certain plugins in order to handle the "scratch build" scenario. Scratch builds must not affect subsequent builds, and should not be imported into Koji. ] if name[self].user_params.scratch.value begin[:] ...
keyword[def] identifier[adjust_for_scratch] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[user_params] . identifier[scratch] . identifier[value] : identifier[remove_plugins] =[ ( literal[string] , literal[string] ), ( literal[s...
def adjust_for_scratch(self): """ Remove certain plugins in order to handle the "scratch build" scenario. Scratch builds must not affect subsequent builds, and should not be imported into Koji. """ if self.user_params.scratch.value: # required only to make an archive for Koji ...
def handle_na(self, data): """ Remove rows with NaN values geoms that infer extra information from missing values should override this method. For example :class:`~plotnine.geoms.geom_path`. Parameters ---------- data : dataframe Data ...
def function[handle_na, parameter[self, data]]: constant[ Remove rows with NaN values geoms that infer extra information from missing values should override this method. For example :class:`~plotnine.geoms.geom_path`. Parameters ---------- data : datafra...
keyword[def] identifier[handle_na] ( identifier[self] , identifier[data] ): literal[string] keyword[return] identifier[remove_missing] ( identifier[data] , identifier[self] . identifier[params] [ literal[string] ], identifier[list] ( identifier[self] . identifier[REQUIRED_AES] | ...
def handle_na(self, data): """ Remove rows with NaN values geoms that infer extra information from missing values should override this method. For example :class:`~plotnine.geoms.geom_path`. Parameters ---------- data : dataframe Data Re...
def debug(self, text): """ Ajout d'un message de log de type DEBUG """ self.logger.debug("{}{}".format(self.message_prefix, text))
def function[debug, parameter[self, text]]: constant[ Ajout d'un message de log de type DEBUG ] call[name[self].logger.debug, parameter[call[constant[{}{}].format, parameter[name[self].message_prefix, name[text]]]]]
keyword[def] identifier[debug] ( identifier[self] , identifier[text] ): literal[string] identifier[self] . identifier[logger] . identifier[debug] ( literal[string] . identifier[format] ( identifier[self] . identifier[message_prefix] , identifier[text] ))
def debug(self, text): """ Ajout d'un message de log de type DEBUG """ self.logger.debug('{}{}'.format(self.message_prefix, text))
def json_data(self): """Return json description of a question.""" return { "number": self.number, "type": self.type, "participant_id": self.participant_id, "question": self.question, "response": self.response, }
def function[json_data, parameter[self]]: constant[Return json description of a question.] return[dictionary[[<ast.Constant object at 0x7da1b03dafe0>, <ast.Constant object at 0x7da1b03db520>, <ast.Constant object at 0x7da1b03dba90>, <ast.Constant object at 0x7da1b03dbeb0>, <ast.Constant object at 0x7da1b03d...
keyword[def] identifier[json_data] ( identifier[self] ): literal[string] keyword[return] { literal[string] : identifier[self] . identifier[number] , literal[string] : identifier[self] . identifier[type] , literal[string] : identifier[self] . identifier[participant_id] , ...
def json_data(self): """Return json description of a question.""" return {'number': self.number, 'type': self.type, 'participant_id': self.participant_id, 'question': self.question, 'response': self.response}
def generate_contact_list(config, args): """TODO: Docstring for generate_contact_list. :param config: the config object to use :type config: config.Config :param args: the command line arguments :type args: argparse.Namespace :returns: the contacts for further processing (TODO) :rtype: list...
def function[generate_contact_list, parameter[config, args]]: constant[TODO: Docstring for generate_contact_list. :param config: the config object to use :type config: config.Config :param args: the command line arguments :type args: argparse.Namespace :returns: the contacts for further pro...
keyword[def] identifier[generate_contact_list] ( identifier[config] , identifier[args] ): literal[string] identifier[vcard_list] =[] keyword[if] literal[string] keyword[in] identifier[args] keyword[and] identifier[args] . identifier[uid] : identifier[logging] . identifier[debug...
def generate_contact_list(config, args): """TODO: Docstring for generate_contact_list. :param config: the config object to use :type config: config.Config :param args: the command line arguments :type args: argparse.Namespace :returns: the contacts for further processing (TODO) :rtype: list...
def get_rrsets_by_type_owner(self, zone_name, rtype, owner_name, q=None, **kwargs): """Returns the list of RRSets in the specified zone of the specified type. Arguments: zone_name -- The name of the zone. rtype -- The type of the RRSets. This can be numeric (1) or if a...
def function[get_rrsets_by_type_owner, parameter[self, zone_name, rtype, owner_name, q]]: constant[Returns the list of RRSets in the specified zone of the specified type. Arguments: zone_name -- The name of the zone. rtype -- The type of the RRSets. This can be numeric (1) or ...
keyword[def] identifier[get_rrsets_by_type_owner] ( identifier[self] , identifier[zone_name] , identifier[rtype] , identifier[owner_name] , identifier[q] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[uri] = literal[string] + identifier[zone_name] + literal[string] + identifie...
def get_rrsets_by_type_owner(self, zone_name, rtype, owner_name, q=None, **kwargs): """Returns the list of RRSets in the specified zone of the specified type. Arguments: zone_name -- The name of the zone. rtype -- The type of the RRSets. This can be numeric (1) or if a wel...
def is_boolean(value): """ Check if the value represents a boolean. >>> vtor = Validator() >>> vtor.check('boolean', 0) 0 >>> vtor.check('boolean', False) 0 >>> vtor.check('boolean', '0') 0 >>> vtor.check('boolean', 'off') 0 >>> vtor.check('boolean', 'false') 0 >...
def function[is_boolean, parameter[value]]: constant[ Check if the value represents a boolean. >>> vtor = Validator() >>> vtor.check('boolean', 0) 0 >>> vtor.check('boolean', False) 0 >>> vtor.check('boolean', '0') 0 >>> vtor.check('boolean', 'off') 0 >>> vtor.check(...
keyword[def] identifier[is_boolean] ( identifier[value] ): literal[string] keyword[if] identifier[isinstance] ( identifier[value] , identifier[string_types] ): keyword[try] : keyword[return] identifier[bool_dict] [ identifier[value] . identifier[lower] ()] keyword[except] ...
def is_boolean(value): """ Check if the value represents a boolean. >>> vtor = Validator() >>> vtor.check('boolean', 0) 0 >>> vtor.check('boolean', False) 0 >>> vtor.check('boolean', '0') 0 >>> vtor.check('boolean', 'off') 0 >>> vtor.check('boolean', 'false') 0 >...
def _get_main_and_json(directory): """Retrieve the main CWL and sample JSON files from a bcbio generated directory. """ directory = os.path.normpath(os.path.abspath(directory)) checker_main = os.path.normpath(os.path.join(directory, os.path.pardir, "checker-workflow-wrapping-tool.cwl")) if checker_m...
def function[_get_main_and_json, parameter[directory]]: constant[Retrieve the main CWL and sample JSON files from a bcbio generated directory. ] variable[directory] assign[=] call[name[os].path.normpath, parameter[call[name[os].path.abspath, parameter[name[directory]]]]] variable[checker_mai...
keyword[def] identifier[_get_main_and_json] ( identifier[directory] ): literal[string] identifier[directory] = identifier[os] . identifier[path] . identifier[normpath] ( identifier[os] . identifier[path] . identifier[abspath] ( identifier[directory] )) identifier[checker_main] = identifier[os] . ident...
def _get_main_and_json(directory): """Retrieve the main CWL and sample JSON files from a bcbio generated directory. """ directory = os.path.normpath(os.path.abspath(directory)) checker_main = os.path.normpath(os.path.join(directory, os.path.pardir, 'checker-workflow-wrapping-tool.cwl')) if checker_m...
def yield_name2value(self, idx1=None, idx2=None) \ -> Iterator[Tuple[str, str]]: """Sequentially return name-value-pairs describing the current state of the target variables. The names are automatically generated and contain both the name of the |Device| of the respective |V...
def function[yield_name2value, parameter[self, idx1, idx2]]: constant[Sequentially return name-value-pairs describing the current state of the target variables. The names are automatically generated and contain both the name of the |Device| of the respective |Variable| object and the ta...
keyword[def] identifier[yield_name2value] ( identifier[self] , identifier[idx1] = keyword[None] , identifier[idx2] = keyword[None] )-> identifier[Iterator] [ identifier[Tuple] [ identifier[str] , identifier[str] ]]: literal[string] keyword[for] identifier[device] , identifier[name] keyword[in] i...
def yield_name2value(self, idx1=None, idx2=None) -> Iterator[Tuple[str, str]]: """Sequentially return name-value-pairs describing the current state of the target variables. The names are automatically generated and contain both the name of the |Device| of the respective |Variable| object an...
def _get_original_coverage(data, itype="target"): """Back compatible: get existing coverage files if they exist """ work_dir = os.path.join(_sv_workdir(data), "raw") work_bam = dd.get_work_bam(data) or dd.get_align_bam(data) out = [] base, _ = _bam_to_outbase(work_bam, work_dir, data) target...
def function[_get_original_coverage, parameter[data, itype]]: constant[Back compatible: get existing coverage files if they exist ] variable[work_dir] assign[=] call[name[os].path.join, parameter[call[name[_sv_workdir], parameter[name[data]]], constant[raw]]] variable[work_bam] assign[=] <as...
keyword[def] identifier[_get_original_coverage] ( identifier[data] , identifier[itype] = literal[string] ): literal[string] identifier[work_dir] = identifier[os] . identifier[path] . identifier[join] ( identifier[_sv_workdir] ( identifier[data] ), literal[string] ) identifier[work_bam] = identifier[dd...
def _get_original_coverage(data, itype='target'): """Back compatible: get existing coverage files if they exist """ work_dir = os.path.join(_sv_workdir(data), 'raw') work_bam = dd.get_work_bam(data) or dd.get_align_bam(data) out = [] (base, _) = _bam_to_outbase(work_bam, work_dir, data) targ...
def tick(self, filename): """Try to connect and display messages in queue.""" if self.connection_attempts < 10: # Trick to connect ASAP when # plugin is started without # user interaction (CursorMove) self.setup(True, False) self.connection_at...
def function[tick, parameter[self, filename]]: constant[Try to connect and display messages in queue.] if compare[name[self].connection_attempts less[<] constant[10]] begin[:] call[name[self].setup, parameter[constant[True], constant[False]]] <ast.AugAssign object at 0x7da18fe93d...
keyword[def] identifier[tick] ( identifier[self] , identifier[filename] ): literal[string] keyword[if] identifier[self] . identifier[connection_attempts] < literal[int] : identifier[self] . identifier[setup] ( keyword[True] , keyword[False] ) id...
def tick(self, filename): """Try to connect and display messages in queue.""" if self.connection_attempts < 10: # Trick to connect ASAP when # plugin is started without # user interaction (CursorMove) self.setup(True, False) self.connection_attempts += 1 # depends on [c...
def ft2file(self, **kwargs): """ return the name of the input ft2 file list """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['data_time'] = kwargs.get( 'data_time', self.dataset(**kwargs)) self._replace_none(kwargs_copy) ...
def function[ft2file, parameter[self]]: constant[ return the name of the input ft2 file list ] variable[kwargs_copy] assign[=] call[name[self].base_dict.copy, parameter[]] call[name[kwargs_copy].update, parameter[]] call[name[kwargs_copy]][constant[data_time]] assign[=] call[name...
keyword[def] identifier[ft2file] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[kwargs_copy] = identifier[self] . identifier[base_dict] . identifier[copy] () identifier[kwargs_copy] . identifier[update] (** identifier[kwargs] ) identifier[kwargs_copy] [ li...
def ft2file(self, **kwargs): """ return the name of the input ft2 file list """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['data_time'] = kwargs.get('data_time', self.dataset(**kwargs)) self._replace_none(kwargs_copy) localpath = NameFactory.ft2file_form...
def send_activation_email(self, user, profile, password, site): """ Custom send email method to supplied the activation link and new generated password. """ ctx_dict = { 'password': password, 'site': site, 'activation_key': profile.act...
def function[send_activation_email, parameter[self, user, profile, password, site]]: constant[ Custom send email method to supplied the activation link and new generated password. ] variable[ctx_dict] assign[=] dictionary[[<ast.Constant object at 0x7da1b2866470>, <ast.Constant o...
keyword[def] identifier[send_activation_email] ( identifier[self] , identifier[user] , identifier[profile] , identifier[password] , identifier[site] ): literal[string] identifier[ctx_dict] ={ literal[string] : identifier[password] , literal[string] : identifier[site] , literal[str...
def send_activation_email(self, user, profile, password, site): """ Custom send email method to supplied the activation link and new generated password. """ ctx_dict = {'password': password, 'site': site, 'activation_key': profile.activation_key, 'expiration_days': settings.ACCOUNT_ACTI...
def random_sample(list_, nSample, strict=False, rng=None, seed=None): """ Grabs data randomly Args: list_ (list): nSample (?): strict (bool): (default = False) rng (module): random number generator(default = numpy.random) seed (None): (default = None) Returns: ...
def function[random_sample, parameter[list_, nSample, strict, rng, seed]]: constant[ Grabs data randomly Args: list_ (list): nSample (?): strict (bool): (default = False) rng (module): random number generator(default = numpy.random) seed (None): (default = None)...
keyword[def] identifier[random_sample] ( identifier[list_] , identifier[nSample] , identifier[strict] = keyword[False] , identifier[rng] = keyword[None] , identifier[seed] = keyword[None] ): literal[string] identifier[rng] = identifier[ensure_rng] ( identifier[seed] keyword[if] identifier[rng] keyword[i...
def random_sample(list_, nSample, strict=False, rng=None, seed=None): """ Grabs data randomly Args: list_ (list): nSample (?): strict (bool): (default = False) rng (module): random number generator(default = numpy.random) seed (None): (default = None) Returns: ...
def iter_rels(self): """ Generate exactly one reference to each relationship in the package by performing a depth-first traversal of the rels graph. """ def walk_rels(source, visited=None): visited = [] if visited is None else visited for rel in source.rel...
def function[iter_rels, parameter[self]]: constant[ Generate exactly one reference to each relationship in the package by performing a depth-first traversal of the rels graph. ] def function[walk_rels, parameter[source, visited]]: variable[visited] assign[=] <ast....
keyword[def] identifier[iter_rels] ( identifier[self] ): literal[string] keyword[def] identifier[walk_rels] ( identifier[source] , identifier[visited] = keyword[None] ): identifier[visited] =[] keyword[if] identifier[visited] keyword[is] keyword[None] keyword[else] identifier[vis...
def iter_rels(self): """ Generate exactly one reference to each relationship in the package by performing a depth-first traversal of the rels graph. """ def walk_rels(source, visited=None): visited = [] if visited is None else visited for rel in source.rels.values(): ...
def ReadAllArtifacts(self, cursor=None): """Lists all artifacts that are stored in the database.""" cursor.execute("SELECT definition FROM artifacts") return [_RowToArtifact(row) for row in cursor.fetchall()]
def function[ReadAllArtifacts, parameter[self, cursor]]: constant[Lists all artifacts that are stored in the database.] call[name[cursor].execute, parameter[constant[SELECT definition FROM artifacts]]] return[<ast.ListComp object at 0x7da1b1b0ec80>]
keyword[def] identifier[ReadAllArtifacts] ( identifier[self] , identifier[cursor] = keyword[None] ): literal[string] identifier[cursor] . identifier[execute] ( literal[string] ) keyword[return] [ identifier[_RowToArtifact] ( identifier[row] ) keyword[for] identifier[row] keyword[in] identifier[curs...
def ReadAllArtifacts(self, cursor=None): """Lists all artifacts that are stored in the database.""" cursor.execute('SELECT definition FROM artifacts') return [_RowToArtifact(row) for row in cursor.fetchall()]
def create_or_login(resp): """This is called when login with OpenID succeeded and it's not necessary to figure out if this is the users's first login or not. This function has to redirect otherwise the user will be presented with a terrible URL which we certainly don't want. """ session['openid'...
def function[create_or_login, parameter[resp]]: constant[This is called when login with OpenID succeeded and it's not necessary to figure out if this is the users's first login or not. This function has to redirect otherwise the user will be presented with a terrible URL which we certainly don't wan...
keyword[def] identifier[create_or_login] ( identifier[resp] ): literal[string] identifier[session] [ literal[string] ]= identifier[resp] . identifier[identity_url] identifier[user] = identifier[User] . identifier[query] . identifier[filter_by] ( identifier[openid] = identifier[resp] . identifier[iden...
def create_or_login(resp): """This is called when login with OpenID succeeded and it's not necessary to figure out if this is the users's first login or not. This function has to redirect otherwise the user will be presented with a terrible URL which we certainly don't want. """ session['openid'...
def eval_file(filename: str, ctx: compiler.CompilerContext, module: types.ModuleType): """Evaluate a file with the given name into a Python module AST node.""" last = None for form in reader.read_file(filename, resolver=runtime.resolve_alias): last = compiler.compile_and_exec_form(form, ctx, module)...
def function[eval_file, parameter[filename, ctx, module]]: constant[Evaluate a file with the given name into a Python module AST node.] variable[last] assign[=] constant[None] for taget[name[form]] in starred[call[name[reader].read_file, parameter[name[filename]]]] begin[:] varia...
keyword[def] identifier[eval_file] ( identifier[filename] : identifier[str] , identifier[ctx] : identifier[compiler] . identifier[CompilerContext] , identifier[module] : identifier[types] . identifier[ModuleType] ): literal[string] identifier[last] = keyword[None] keyword[for] identifier[form] keyw...
def eval_file(filename: str, ctx: compiler.CompilerContext, module: types.ModuleType): """Evaluate a file with the given name into a Python module AST node.""" last = None for form in reader.read_file(filename, resolver=runtime.resolve_alias): last = compiler.compile_and_exec_form(form, ctx, module)...
def re_line_and_indentation(base_indentation, modifiers=(True, True)): """Returns a re matching newline + base_indentation. modifiers is a tuple, (include_first, include_final). If include_first, matches indentation at the beginning of the string. If include_final, matches ...
def function[re_line_and_indentation, parameter[base_indentation, modifiers]]: constant[Returns a re matching newline + base_indentation. modifiers is a tuple, (include_first, include_final). If include_first, matches indentation at the beginning of the string. If include_final, matches indentatio...
keyword[def] identifier[re_line_and_indentation] ( identifier[base_indentation] , identifier[modifiers] =( keyword[True] , keyword[True] )): literal[string] identifier[cache] = identifier[re_line_and_indentation] . identifier[cache] [ identifier[modifiers] ] identifier[compiled] = identifier[cache] ....
def re_line_and_indentation(base_indentation, modifiers=(True, True)): """Returns a re matching newline + base_indentation. modifiers is a tuple, (include_first, include_final). If include_first, matches indentation at the beginning of the string. If include_final, matches indentation at the end of th...
def create_table(self, table_name, model): """Create the model's table. Returns True if the table is being created, False otherwise. Does not wait for the table to create, and does not validate an existing table. Will not raise "ResourceInUseException" if the table exists or is being created. ...
def function[create_table, parameter[self, table_name, model]]: constant[Create the model's table. Returns True if the table is being created, False otherwise. Does not wait for the table to create, and does not validate an existing table. Will not raise "ResourceInUseException" if the table e...
keyword[def] identifier[create_table] ( identifier[self] , identifier[table_name] , identifier[model] ): literal[string] identifier[table] = identifier[create_table_request] ( identifier[table_name] , identifier[model] ) keyword[try] : identifier[self] . identifier[dynamodb_cl...
def create_table(self, table_name, model): """Create the model's table. Returns True if the table is being created, False otherwise. Does not wait for the table to create, and does not validate an existing table. Will not raise "ResourceInUseException" if the table exists or is being created. ...
def _get_station_codes(self, force=False): """ Gets and caches a list of station codes optionally within a bbox. Will return the cached version if it exists unless force is True. """ if not force and self.station_codes is not None: return self.station_codes ...
def function[_get_station_codes, parameter[self, force]]: constant[ Gets and caches a list of station codes optionally within a bbox. Will return the cached version if it exists unless force is True. ] if <ast.BoolOp object at 0x7da1b24b6320> begin[:] return[name[self].s...
keyword[def] identifier[_get_station_codes] ( identifier[self] , identifier[force] = keyword[False] ): literal[string] keyword[if] keyword[not] identifier[force] keyword[and] identifier[self] . identifier[station_codes] keyword[is] keyword[not] keyword[None] : keyword[return] i...
def _get_station_codes(self, force=False): """ Gets and caches a list of station codes optionally within a bbox. Will return the cached version if it exists unless force is True. """ if not force and self.station_codes is not None: return self.station_codes # depends on [contro...
def get_money_with_currency_format(self, amount): """ :type amount: int or float or str Usage: >>> currency = Currency('USD') >>> currency.get_money_with_currency_format(13) >>> '$13 USD' >>> currency.get_money_with_currency_format(13.99) >>> '$13.99 USD'...
def function[get_money_with_currency_format, parameter[self, amount]]: constant[ :type amount: int or float or str Usage: >>> currency = Currency('USD') >>> currency.get_money_with_currency_format(13) >>> '$13 USD' >>> currency.get_money_with_currency_format(13.9...
keyword[def] identifier[get_money_with_currency_format] ( identifier[self] , identifier[amount] ): literal[string] keyword[return] identifier[self] . identifier[money_formats] [ identifier[self] . identifier[get_money_currency] () ][ literal[string] ]. identifier[format] ( identif...
def get_money_with_currency_format(self, amount): """ :type amount: int or float or str Usage: >>> currency = Currency('USD') >>> currency.get_money_with_currency_format(13) >>> '$13 USD' >>> currency.get_money_with_currency_format(13.99) >>> '$13.99 USD' ...
def lz (inlist, score): """ Returns the z-score for a given input score, given that score and the list from which that score came. Not appropriate for population calculations. Usage: lz(inlist, score) """ z = (score-mean(inlist))/samplestdev(inlist) return z
def function[lz, parameter[inlist, score]]: constant[ Returns the z-score for a given input score, given that score and the list from which that score came. Not appropriate for population calculations. Usage: lz(inlist, score) ] variable[z] assign[=] binary_operation[binary_operation[name[score] - c...
keyword[def] identifier[lz] ( identifier[inlist] , identifier[score] ): literal[string] identifier[z] =( identifier[score] - identifier[mean] ( identifier[inlist] ))/ identifier[samplestdev] ( identifier[inlist] ) keyword[return] identifier[z]
def lz(inlist, score): """ Returns the z-score for a given input score, given that score and the list from which that score came. Not appropriate for population calculations. Usage: lz(inlist, score) """ z = (score - mean(inlist)) / samplestdev(inlist) return z
def pairs(self, strand, cutoff=0.001, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the pair probabilities for an ordered complex of strands. Runs the \'pairs\' command. :param strand: Strand on which to run pairs. Strands must be e...
def function[pairs, parameter[self, strand, cutoff, temp, pseudo, material, dangles, sodium, magnesium]]: constant[Compute the pair probabilities for an ordered complex of strands. Runs the 'pairs' command. :param strand: Strand on which to run pairs. Strands must be either ...
keyword[def] identifier[pairs] ( identifier[self] , identifier[strand] , identifier[cutoff] = literal[int] , identifier[temp] = literal[int] , identifier[pseudo] = keyword[False] , identifier[material] = keyword[None] , identifier[dangles] = literal[string] , identifier[sodium] = literal[int] , identifier[magnesium]...
def pairs(self, strand, cutoff=0.001, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): """Compute the pair probabilities for an ordered complex of strands. Runs the 'pairs' command. :param strand: Strand on which to run pairs. Strands must be either ...
def get_session_conf_dir(self, cleanup=False): """ Tries to find the session configuration directory by looking in ~/.dnanexus_config/sessions/<PID>, where <PID> is pid of the parent of this process, then its parent, and so on. If none of those exist, the path for the immediate parent is...
def function[get_session_conf_dir, parameter[self, cleanup]]: constant[ Tries to find the session configuration directory by looking in ~/.dnanexus_config/sessions/<PID>, where <PID> is pid of the parent of this process, then its parent, and so on. If none of those exist, the path for th...
keyword[def] identifier[get_session_conf_dir] ( identifier[self] , identifier[cleanup] = keyword[False] ): literal[string] identifier[sessions_dir] = identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[_user_conf_dir] , literal[string] ) keyword[try] : ...
def get_session_conf_dir(self, cleanup=False): """ Tries to find the session configuration directory by looking in ~/.dnanexus_config/sessions/<PID>, where <PID> is pid of the parent of this process, then its parent, and so on. If none of those exist, the path for the immediate parent is giv...
def save_metadata(self, file_path): """Saves a json file of the search result metadata. Saves a json file of the search result metadata from :class:`api.results`.metadata. Args: file_path (str): Path to the json file to save metadata to. """ data = self.metadata with open...
def function[save_metadata, parameter[self, file_path]]: constant[Saves a json file of the search result metadata. Saves a json file of the search result metadata from :class:`api.results`.metadata. Args: file_path (str): Path to the json file to save metadata to. ] v...
keyword[def] identifier[save_metadata] ( identifier[self] , identifier[file_path] ): literal[string] identifier[data] = identifier[self] . identifier[metadata] keyword[with] identifier[open] ( identifier[file_path] , literal[string] ) keyword[as] identifier[out_file] : identifier[json] . ide...
def save_metadata(self, file_path): """Saves a json file of the search result metadata. Saves a json file of the search result metadata from :class:`api.results`.metadata. Args: file_path (str): Path to the json file to save metadata to. """ data = self.metadata with open...
def redshift_from_comoving_volume(vc, **kwargs): r"""Returns the redshift from the given comoving volume. Parameters ---------- vc : float The comoving volume, in units of cubed Mpc. \**kwargs : All other keyword args are passed to :py:func:`get_cosmology` to select a cosmol...
def function[redshift_from_comoving_volume, parameter[vc]]: constant[Returns the redshift from the given comoving volume. Parameters ---------- vc : float The comoving volume, in units of cubed Mpc. \**kwargs : All other keyword args are passed to :py:func:`get_cosmology` to ...
keyword[def] identifier[redshift_from_comoving_volume] ( identifier[vc] ,** identifier[kwargs] ): literal[string] identifier[cosmology] = identifier[get_cosmology] (** identifier[kwargs] ) keyword[return] identifier[z_at_value] ( identifier[cosmology] . identifier[comoving_volume] , identifier[vc] , ...
def redshift_from_comoving_volume(vc, **kwargs): """Returns the redshift from the given comoving volume. Parameters ---------- vc : float The comoving volume, in units of cubed Mpc. \\**kwargs : All other keyword args are passed to :py:func:`get_cosmology` to select a cosmol...
def get_epoch_namespace_lifetime_grace_period( block_height, namespace_id ): """ what's the namespace lifetime grace period for this epoch? """ epoch_config = get_epoch_config( block_height ) if epoch_config['namespaces'].has_key(namespace_id): return epoch_config['namespaces'][namespace_id]...
def function[get_epoch_namespace_lifetime_grace_period, parameter[block_height, namespace_id]]: constant[ what's the namespace lifetime grace period for this epoch? ] variable[epoch_config] assign[=] call[name[get_epoch_config], parameter[name[block_height]]] if call[call[name[epoch_conf...
keyword[def] identifier[get_epoch_namespace_lifetime_grace_period] ( identifier[block_height] , identifier[namespace_id] ): literal[string] identifier[epoch_config] = identifier[get_epoch_config] ( identifier[block_height] ) keyword[if] identifier[epoch_config] [ literal[string] ]. identifier[has_key...
def get_epoch_namespace_lifetime_grace_period(block_height, namespace_id): """ what's the namespace lifetime grace period for this epoch? """ epoch_config = get_epoch_config(block_height) if epoch_config['namespaces'].has_key(namespace_id): return epoch_config['namespaces'][namespace_id]['NA...
def ucnstring_to_python(ucn_string): """ Return string with Unicode UCN (e.g. "U+4E00") to native Python Unicode (u'\\u4e00'). """ res = re.findall("U\+[0-9a-fA-F]*", ucn_string) for r in res: ucn_string = ucn_string.replace(text_type(r), text_type(ucn_to_unicode(r))) ucn_string = u...
def function[ucnstring_to_python, parameter[ucn_string]]: constant[ Return string with Unicode UCN (e.g. "U+4E00") to native Python Unicode (u'\u4e00'). ] variable[res] assign[=] call[name[re].findall, parameter[constant[U\+[0-9a-fA-F]*], name[ucn_string]]] for taget[name[r]] in star...
keyword[def] identifier[ucnstring_to_python] ( identifier[ucn_string] ): literal[string] identifier[res] = identifier[re] . identifier[findall] ( literal[string] , identifier[ucn_string] ) keyword[for] identifier[r] keyword[in] identifier[res] : identifier[ucn_string] = identifier[ucn_stri...
def ucnstring_to_python(ucn_string): """ Return string with Unicode UCN (e.g. "U+4E00") to native Python Unicode (u'\\u4e00'). """ res = re.findall('U\\+[0-9a-fA-F]*', ucn_string) for r in res: ucn_string = ucn_string.replace(text_type(r), text_type(ucn_to_unicode(r))) # depends on [con...
def fourier(x, N): """Fourier approximation with N terms""" term = 0. for n in range(1, N, 2): term += (1. / n) * math.sin(n * math.pi * x / L) return (4. / (math.pi)) * term
def function[fourier, parameter[x, N]]: constant[Fourier approximation with N terms] variable[term] assign[=] constant[0.0] for taget[name[n]] in starred[call[name[range], parameter[constant[1], name[N], constant[2]]]] begin[:] <ast.AugAssign object at 0x7da1b207d210> return[binary_o...
keyword[def] identifier[fourier] ( identifier[x] , identifier[N] ): literal[string] identifier[term] = literal[int] keyword[for] identifier[n] keyword[in] identifier[range] ( literal[int] , identifier[N] , literal[int] ): identifier[term] +=( literal[int] / identifier[n] )* identifier[ma...
def fourier(x, N): """Fourier approximation with N terms""" term = 0.0 for n in range(1, N, 2): term += 1.0 / n * math.sin(n * math.pi * x / L) # depends on [control=['for'], data=['n']] return 4.0 / math.pi * term
def pause(self, length=None, **kwargs): """ Create a <Pause> element :param length: Length in seconds to pause :param kwargs: additional attributes :returns: <Pause> element """ return self.nest(Pause(length=length, **kwargs))
def function[pause, parameter[self, length]]: constant[ Create a <Pause> element :param length: Length in seconds to pause :param kwargs: additional attributes :returns: <Pause> element ] return[call[name[self].nest, parameter[call[name[Pause], parameter[]]]]]
keyword[def] identifier[pause] ( identifier[self] , identifier[length] = keyword[None] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[nest] ( identifier[Pause] ( identifier[length] = identifier[length] ,** identifier[kwargs] ))
def pause(self, length=None, **kwargs): """ Create a <Pause> element :param length: Length in seconds to pause :param kwargs: additional attributes :returns: <Pause> element """ return self.nest(Pause(length=length, **kwargs))
def _post_execute(self): """ Should be called when executing the user requested command has been completed. It will do some maintenance and write out the final result to the todo.txt file. """ if self.todolist.dirty: # do not archive when the value of the fil...
def function[_post_execute, parameter[self]]: constant[ Should be called when executing the user requested command has been completed. It will do some maintenance and write out the final result to the todo.txt file. ] if name[self].todolist.dirty begin[:] ...
keyword[def] identifier[_post_execute] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[todolist] . identifier[dirty] : keyword[if] identifier[self] . identifier[do_archive] keyword[and] identifier[config] (). identifier[archive] ()...
def _post_execute(self): """ Should be called when executing the user requested command has been completed. It will do some maintenance and write out the final result to the todo.txt file. """ if self.todolist.dirty: # do not archive when the value of the filename is an e...
def parse_source_file(file_name): """ Parses the AST of Python file for lines containing references to the argparse module. returns the collection of ast objects found. Example client code: 1. parser = ArgumentParser(desc="My help Message") 2. parser.add_argument('filename', help="Nam...
def function[parse_source_file, parameter[file_name]]: constant[ Parses the AST of Python file for lines containing references to the argparse module. returns the collection of ast objects found. Example client code: 1. parser = ArgumentParser(desc="My help Message") 2. parser.add...
keyword[def] identifier[parse_source_file] ( identifier[file_name] ): literal[string] keyword[with] identifier[open] ( identifier[file_name] , literal[string] ) keyword[as] identifier[f] : identifier[s] = identifier[f] . identifier[read] () identifier[nodes] = identifier[ast] . identifier[...
def parse_source_file(file_name): """ Parses the AST of Python file for lines containing references to the argparse module. returns the collection of ast objects found. Example client code: 1. parser = ArgumentParser(desc="My help Message") 2. parser.add_argument('filename', help="Nam...
def calc_mass_from_fit_and_conv_factor(A, Damping, ConvFactor): """ Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Parameters ---------- A :...
def function[calc_mass_from_fit_and_conv_factor, parameter[A, Damping, ConvFactor]]: constant[ Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Pa...
keyword[def] identifier[calc_mass_from_fit_and_conv_factor] ( identifier[A] , identifier[Damping] , identifier[ConvFactor] ): literal[string] identifier[T0] = literal[int] identifier[mFromA] = literal[int] * identifier[Boltzmann] * identifier[T0] /( identifier[pi] * identifier[A] )* identifier[ConvFa...
def calc_mass_from_fit_and_conv_factor(A, Damping, ConvFactor): """ Calculates mass from the A parameter from fitting, the damping from fitting in angular units and the Conversion factor calculated from comparing the ratio of the z signal and first harmonic of z. Parameters ---------- A :...
def find_all(self, pattern): """ Return the subset of this RcParams dictionary whose keys match, using :func:`re.search`, the given ``pattern``. Parameters ---------- pattern: str pattern as suitable for re.compile Returns ------- RcP...
def function[find_all, parameter[self, pattern]]: constant[ Return the subset of this RcParams dictionary whose keys match, using :func:`re.search`, the given ``pattern``. Parameters ---------- pattern: str pattern as suitable for re.compile Returns ...
keyword[def] identifier[find_all] ( identifier[self] , identifier[pattern] ): literal[string] identifier[pattern_re] = identifier[re] . identifier[compile] ( identifier[pattern] ) identifier[ret] = identifier[RcParams] () identifier[ret] . identifier[defaultParams] = identifier[se...
def find_all(self, pattern): """ Return the subset of this RcParams dictionary whose keys match, using :func:`re.search`, the given ``pattern``. Parameters ---------- pattern: str pattern as suitable for re.compile Returns ------- RcParam...
def subtract_params(param_list_left, param_list_right): """Subtract two lists of parameters :param param_list_left: list of numpy arrays :param param_list_right: list of numpy arrays :return: list of numpy arrays """ res = [] for x, y in zip(param_list_left, param_list_right): res.a...
def function[subtract_params, parameter[param_list_left, param_list_right]]: constant[Subtract two lists of parameters :param param_list_left: list of numpy arrays :param param_list_right: list of numpy arrays :return: list of numpy arrays ] variable[res] assign[=] list[[]] for ...
keyword[def] identifier[subtract_params] ( identifier[param_list_left] , identifier[param_list_right] ): literal[string] identifier[res] =[] keyword[for] identifier[x] , identifier[y] keyword[in] identifier[zip] ( identifier[param_list_left] , identifier[param_list_right] ): identifier[res...
def subtract_params(param_list_left, param_list_right): """Subtract two lists of parameters :param param_list_left: list of numpy arrays :param param_list_right: list of numpy arrays :return: list of numpy arrays """ res = [] for (x, y) in zip(param_list_left, param_list_right): res...
def masked_dilated_self_attention_1d(q, k, v, query_block_size=64, memory_block_size=64, gap_size=2, ...
def function[masked_dilated_self_attention_1d, parameter[q, k, v, query_block_size, memory_block_size, gap_size, num_memory_blocks, name]]: constant[Dilated self-attention. TODO(avaswani): Try it and write a paper on it. Args: q: a Tensor with shape [batch, heads, length, depth] k: a Tensor with shap...
keyword[def] identifier[masked_dilated_self_attention_1d] ( identifier[q] , identifier[k] , identifier[v] , identifier[query_block_size] = literal[int] , identifier[memory_block_size] = literal[int] , identifier[gap_size] = literal[int] , identifier[num_memory_blocks] = literal[int] , identifier[name] = keywor...
def masked_dilated_self_attention_1d(q, k, v, query_block_size=64, memory_block_size=64, gap_size=2, num_memory_blocks=2, name=None): """Dilated self-attention. TODO(avaswani): Try it and write a paper on it. Args: q: a Tensor with shape [batch, heads, length, depth] k: a Tensor with shape [batch, heads,...
def generate_hashfile(directory, blacklist=_BLACKLIST): """ Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blacklisted filenames. Only...
def function[generate_hashfile, parameter[directory, blacklist]]: constant[ Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blackli...
keyword[def] identifier[generate_hashfile] ( identifier[directory] , identifier[blacklist] = identifier[_BLACKLIST] ): literal[string] identifier[checksums] = identifier[generate_checksums] ( identifier[directory] , identifier[blacklist] ) identifier[out] = literal[string] keyword[for] identif...
def generate_hashfile(directory, blacklist=_BLACKLIST): """ Compute checksum for each file in `directory`, with exception of files specified in `blacklist`. Args: directory (str): Absolute or relative path to the directory. blacklist (list/set/tuple): List of blacklisted filenames. Only...
def values(self): """Gets the parameter values :returns: dict of inputs: | *'nfft'*: int -- length, in samples, of FFT chunks | *'window'*: str -- name of window to apply to FFT chunks | *'overlap'*: float -- percent overlap of windows """ s...
def function[values, parameter[self]]: constant[Gets the parameter values :returns: dict of inputs: | *'nfft'*: int -- length, in samples, of FFT chunks | *'window'*: str -- name of window to apply to FFT chunks | *'overlap'*: float -- percent overlap of win...
keyword[def] identifier[values] ( identifier[self] ): literal[string] identifier[self] . identifier[vals] [ literal[string] ]= identifier[self] . identifier[ui] . identifier[nfftSpnbx] . identifier[value] () identifier[self] . identifier[vals] [ literal[string] ]= identifier[str] ( identif...
def values(self): """Gets the parameter values :returns: dict of inputs: | *'nfft'*: int -- length, in samples, of FFT chunks | *'window'*: str -- name of window to apply to FFT chunks | *'overlap'*: float -- percent overlap of windows """ self.vals...
def calcRandomAnchors(args, inworld=True): """ Generates a list of random anchor points such that all circles will fit in the world, given the specified radius and worldsize. The number of anchors to generate is given by nPatches """ anchors = [] rng = (args.patchRadius, args.worldSize - arg...
def function[calcRandomAnchors, parameter[args, inworld]]: constant[ Generates a list of random anchor points such that all circles will fit in the world, given the specified radius and worldsize. The number of anchors to generate is given by nPatches ] variable[anchors] assign[=] list[[...
keyword[def] identifier[calcRandomAnchors] ( identifier[args] , identifier[inworld] = keyword[True] ): literal[string] identifier[anchors] =[] identifier[rng] =( identifier[args] . identifier[patchRadius] , identifier[args] . identifier[worldSize] - identifier[args] . identifier[patchRadius] ) ke...
def calcRandomAnchors(args, inworld=True): """ Generates a list of random anchor points such that all circles will fit in the world, given the specified radius and worldsize. The number of anchors to generate is given by nPatches """ anchors = [] rng = (args.patchRadius, args.worldSize - arg...
def _import_ucsmsdk(self): """Imports the Ucsm SDK module. This module is not installed as part of the normal Neutron distributions. It is imported dynamically in this module so that the import can be mocked, allowing unit testing without requiring the installation of UcsSdk. ...
def function[_import_ucsmsdk, parameter[self]]: constant[Imports the Ucsm SDK module. This module is not installed as part of the normal Neutron distributions. It is imported dynamically in this module so that the import can be mocked, allowing unit testing without requiring the...
keyword[def] identifier[_import_ucsmsdk] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[CONF] . identifier[ml2_cisco_ucsm] . identifier[ucsm_https_verify] : identifier[LOG] . identifier[warning] ( identifier[const] . identifier[SSL_WARNING...
def _import_ucsmsdk(self): """Imports the Ucsm SDK module. This module is not installed as part of the normal Neutron distributions. It is imported dynamically in this module so that the import can be mocked, allowing unit testing without requiring the installation of UcsSdk. ...
def __publish(topic, message, subject=None): """ Publish a message to a SNS topic :type topic: str :param topic: SNS topic to publish the message to :type message: str :param message: Message to send via SNS :type subject: str :param subject: Subject to use for e-mail notifications :ret...
def function[__publish, parameter[topic, message, subject]]: constant[ Publish a message to a SNS topic :type topic: str :param topic: SNS topic to publish the message to :type message: str :param message: Message to send via SNS :type subject: str :param subject: Subject to use for e-m...
keyword[def] identifier[__publish] ( identifier[topic] , identifier[message] , identifier[subject] = keyword[None] ): literal[string] keyword[try] : identifier[SNS_CONNECTION] . identifier[publish] ( identifier[topic] = identifier[topic] , identifier[message] = identifier[message] , identifier[sub...
def __publish(topic, message, subject=None): """ Publish a message to a SNS topic :type topic: str :param topic: SNS topic to publish the message to :type message: str :param message: Message to send via SNS :type subject: str :param subject: Subject to use for e-mail notifications :ret...
def get_node(conn, name): ''' Return a node for the named VM ''' datacenter_id = get_datacenter_id() for item in conn.list_servers(datacenter_id)['items']: if item['properties']['name'] == name: node = {'id': item['id']} node.update(item['properties']) re...
def function[get_node, parameter[conn, name]]: constant[ Return a node for the named VM ] variable[datacenter_id] assign[=] call[name[get_datacenter_id], parameter[]] for taget[name[item]] in starred[call[call[name[conn].list_servers, parameter[name[datacenter_id]]]][constant[items]]] be...
keyword[def] identifier[get_node] ( identifier[conn] , identifier[name] ): literal[string] identifier[datacenter_id] = identifier[get_datacenter_id] () keyword[for] identifier[item] keyword[in] identifier[conn] . identifier[list_servers] ( identifier[datacenter_id] )[ literal[string] ]: k...
def get_node(conn, name): """ Return a node for the named VM """ datacenter_id = get_datacenter_id() for item in conn.list_servers(datacenter_id)['items']: if item['properties']['name'] == name: node = {'id': item['id']} node.update(item['properties']) ret...
def getChildren(self, name=None, ns=None): """ Get a list of children by (optional) name and/or (optional) namespace. @param name: The name of a child element (may contain prefix). @type name: basestring @param ns: An optional namespace used to match the child. @type ns: ...
def function[getChildren, parameter[self, name, ns]]: constant[ Get a list of children by (optional) name and/or (optional) namespace. @param name: The name of a child element (may contain prefix). @type name: basestring @param ns: An optional namespace used to match the child. ...
keyword[def] identifier[getChildren] ( identifier[self] , identifier[name] = keyword[None] , identifier[ns] = keyword[None] ): literal[string] keyword[if] identifier[name] keyword[is] keyword[None] : identifier[matched] = identifier[self] . identifier[__root] keyword[else]...
def getChildren(self, name=None, ns=None): """ Get a list of children by (optional) name and/or (optional) namespace. @param name: The name of a child element (may contain prefix). @type name: basestring @param ns: An optional namespace used to match the child. @type ns: (I{p...
def erosion(x, radius=3): """Return greyscale morphological erosion of an image, see `skimage.morphology.erosion <http://scikit-image.org/docs/dev/api/skimage.morphology.html#skimage.morphology.erosion>`__. Parameters ----------- x : 2D array A greyscale image. radius : int For ...
def function[erosion, parameter[x, radius]]: constant[Return greyscale morphological erosion of an image, see `skimage.morphology.erosion <http://scikit-image.org/docs/dev/api/skimage.morphology.html#skimage.morphology.erosion>`__. Parameters ----------- x : 2D array A greyscale image. ...
keyword[def] identifier[erosion] ( identifier[x] , identifier[radius] = literal[int] ): literal[string] identifier[mask] = identifier[disk] ( identifier[radius] ) identifier[x] = identifier[_erosion] ( identifier[x] , identifier[selem] = identifier[mask] ) keyword[return] identifier[x]
def erosion(x, radius=3): """Return greyscale morphological erosion of an image, see `skimage.morphology.erosion <http://scikit-image.org/docs/dev/api/skimage.morphology.html#skimage.morphology.erosion>`__. Parameters ----------- x : 2D array A greyscale image. radius : int For ...
def _assign_dates(self): """assign dates to nodes Returns ------- str success/error code """ if self.tree is None: self.logger("ClockTree._assign_dates: tree is not set, can't assign dates", 0) return ttconf.ERROR bad_branch_c...
def function[_assign_dates, parameter[self]]: constant[assign dates to nodes Returns ------- str success/error code ] if compare[name[self].tree is constant[None]] begin[:] call[name[self].logger, parameter[constant[ClockTree._assign_dates: tr...
keyword[def] identifier[_assign_dates] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[tree] keyword[is] keyword[None] : identifier[self] . identifier[logger] ( literal[string] , literal[int] ) keyword[return] identifier[ttconf] . identi...
def _assign_dates(self): """assign dates to nodes Returns ------- str success/error code """ if self.tree is None: self.logger("ClockTree._assign_dates: tree is not set, can't assign dates", 0) return ttconf.ERROR # depends on [control=['if'], data=[...
def scalar_term(self, st): """Return a _ScalarTermS or _ScalarTermU from a string, to perform text and HTML substitutions""" if isinstance(st, binary_type): return _ScalarTermS(st, self._jinja_sub) elif isinstance(st, text_type): return _ScalarTermU(st, self._jinja_sub) ...
def function[scalar_term, parameter[self, st]]: constant[Return a _ScalarTermS or _ScalarTermU from a string, to perform text and HTML substitutions] if call[name[isinstance], parameter[name[st], name[binary_type]]] begin[:] return[call[name[_ScalarTermS], parameter[name[st], name[self]._jinja_s...
keyword[def] identifier[scalar_term] ( identifier[self] , identifier[st] ): literal[string] keyword[if] identifier[isinstance] ( identifier[st] , identifier[binary_type] ): keyword[return] identifier[_ScalarTermS] ( identifier[st] , identifier[self] . identifier[_jinja_sub] ) ...
def scalar_term(self, st): """Return a _ScalarTermS or _ScalarTermU from a string, to perform text and HTML substitutions""" if isinstance(st, binary_type): return _ScalarTermS(st, self._jinja_sub) # depends on [control=['if'], data=[]] elif isinstance(st, text_type): return _ScalarTermU(st...
def get_ins_off(self, off): """ Get a particular instruction by using the address :param off: address of the instruction :type off: int :rtype: an :class:`Instruction` object """ idx = 0 for i in self.get_instructions(): if idx == off: ...
def function[get_ins_off, parameter[self, off]]: constant[ Get a particular instruction by using the address :param off: address of the instruction :type off: int :rtype: an :class:`Instruction` object ] variable[idx] assign[=] constant[0] for taget[name...
keyword[def] identifier[get_ins_off] ( identifier[self] , identifier[off] ): literal[string] identifier[idx] = literal[int] keyword[for] identifier[i] keyword[in] identifier[self] . identifier[get_instructions] (): keyword[if] identifier[idx] == identifier[off] : ...
def get_ins_off(self, off): """ Get a particular instruction by using the address :param off: address of the instruction :type off: int :rtype: an :class:`Instruction` object """ idx = 0 for i in self.get_instructions(): if idx == off: return i ...
def update(self, key, item): """ Update item into hash table with specified key and item. If key is already present, destroys old item and inserts new one. Use free_fn method to ensure deallocator is properly called on item. """ return lib.zhash_update(self._as_parameter_, key, item)
def function[update, parameter[self, key, item]]: constant[ Update item into hash table with specified key and item. If key is already present, destroys old item and inserts new one. Use free_fn method to ensure deallocator is properly called on item. ] return[call[name[lib].zhash_update, pa...
keyword[def] identifier[update] ( identifier[self] , identifier[key] , identifier[item] ): literal[string] keyword[return] identifier[lib] . identifier[zhash_update] ( identifier[self] . identifier[_as_parameter_] , identifier[key] , identifier[item] )
def update(self, key, item): """ Update item into hash table with specified key and item. If key is already present, destroys old item and inserts new one. Use free_fn method to ensure deallocator is properly called on item. """ return lib.zhash_update(self._as_parameter_, key, item)
def drain_rois(img): """Find all the ROIs in img and returns a similar volume with the ROIs emptied, keeping only their border voxels. This is useful for DTI tractography. Parameters ---------- img: img-like object or str Can either be: - a file path to a Nifti image - ...
def function[drain_rois, parameter[img]]: constant[Find all the ROIs in img and returns a similar volume with the ROIs emptied, keeping only their border voxels. This is useful for DTI tractography. Parameters ---------- img: img-like object or str Can either be: - a file p...
keyword[def] identifier[drain_rois] ( identifier[img] ): literal[string] identifier[img_data] = identifier[get_img_data] ( identifier[img] ) identifier[out] = identifier[np] . identifier[zeros] ( identifier[img_data] . identifier[shape] , identifier[dtype] = identifier[img_data] . identifier[dtype] )...
def drain_rois(img): """Find all the ROIs in img and returns a similar volume with the ROIs emptied, keeping only their border voxels. This is useful for DTI tractography. Parameters ---------- img: img-like object or str Can either be: - a file path to a Nifti image - ...
def as_xml(self,parent): """ Create XML representation of `self`. :Parameters: - `parent`: the element to which the created node should be linked to. :Types: - `parent`: `libxml2.xmlNode` :return: an XML node. :returntype: `libxml2.xmlNode` ...
def function[as_xml, parameter[self, parent]]: constant[ Create XML representation of `self`. :Parameters: - `parent`: the element to which the created node should be linked to. :Types: - `parent`: `libxml2.xmlNode` :return: an XML node. :returnt...
keyword[def] identifier[as_xml] ( identifier[self] , identifier[parent] ): literal[string] identifier[n] = identifier[parent] . identifier[newChild] ( keyword[None] , literal[string] , keyword[None] ) keyword[if] identifier[self] . identifier[actor] : identifier[n] . identifi...
def as_xml(self, parent): """ Create XML representation of `self`. :Parameters: - `parent`: the element to which the created node should be linked to. :Types: - `parent`: `libxml2.xmlNode` :return: an XML node. :returntype: `libxml2.xmlNode` ...
def _auth(profile=None, api_version=1, **connection_args): ''' Set up heat credentials, returns `heatclient.client.Client`. Optional parameter "api_version" defaults to 1. Only intended to be used within heat-enabled modules ''' if profile: prefix = profile + ':keystone.' else:...
def function[_auth, parameter[profile, api_version]]: constant[ Set up heat credentials, returns `heatclient.client.Client`. Optional parameter "api_version" defaults to 1. Only intended to be used within heat-enabled modules ] if name[profile] begin[:] variable[pref...
keyword[def] identifier[_auth] ( identifier[profile] = keyword[None] , identifier[api_version] = literal[int] ,** identifier[connection_args] ): literal[string] keyword[if] identifier[profile] : identifier[prefix] = identifier[profile] + literal[string] keyword[else] : identifier[...
def _auth(profile=None, api_version=1, **connection_args): """ Set up heat credentials, returns `heatclient.client.Client`. Optional parameter "api_version" defaults to 1. Only intended to be used within heat-enabled modules """ if profile: prefix = profile + ':keystone.' # depends...
def is_free(self): """ returns True if any of the spectral model parameters is set to free, else False """ return bool(np.array([int(value.get("free", False)) for key, value in self.spectral_pars.items()]).sum())
def function[is_free, parameter[self]]: constant[ returns True if any of the spectral model parameters is set to free, else False ] return[call[name[bool], parameter[call[call[name[np].array, parameter[<ast.ListComp object at 0x7da20e956380>]].sum, parameter[]]]]]
keyword[def] identifier[is_free] ( identifier[self] ): literal[string] keyword[return] identifier[bool] ( identifier[np] . identifier[array] ([ identifier[int] ( identifier[value] . identifier[get] ( literal[string] , keyword[False] )) keyword[for] identifier[key] , identifier[value] keyword[in]...
def is_free(self): """ returns True if any of the spectral model parameters is set to free, else False """ return bool(np.array([int(value.get('free', False)) for (key, value) in self.spectral_pars.items()]).sum())
def p_declarations(self, p): """declarations : declarations declaration | declaration""" n = len(p) if n == 3: p[0] = p[1] + [p[2]] elif n == 2: p[0] = [p[1]]
def function[p_declarations, parameter[self, p]]: constant[declarations : declarations declaration | declaration] variable[n] assign[=] call[name[len], parameter[name[p]]] if compare[name[n] equal[==] constant[3]] begin[:] call[name[p]][constant[0]] assign...
keyword[def] identifier[p_declarations] ( identifier[self] , identifier[p] ): literal[string] identifier[n] = identifier[len] ( identifier[p] ) keyword[if] identifier[n] == literal[int] : identifier[p] [ literal[int] ]= identifier[p] [ literal[int] ]+[ identifier[p] [ literal...
def p_declarations(self, p): """declarations : declarations declaration | declaration""" n = len(p) if n == 3: p[0] = p[1] + [p[2]] # depends on [control=['if'], data=[]] elif n == 2: p[0] = [p[1]] # depends on [control=['if'], data=[]]
def is_reseller_admin(self, req, admin_detail=None): """Returns True if the admin specified in the request represents a .reseller_admin. :param req: The swob.Request to check. :param admin_detail: The previously retrieved dict from :func:`get_admin_detail` o...
def function[is_reseller_admin, parameter[self, req, admin_detail]]: constant[Returns True if the admin specified in the request represents a .reseller_admin. :param req: The swob.Request to check. :param admin_detail: The previously retrieved dict from :fun...
keyword[def] identifier[is_reseller_admin] ( identifier[self] , identifier[req] , identifier[admin_detail] = keyword[None] ): literal[string] identifier[req] . identifier[credentials_valid] = keyword[False] keyword[if] identifier[self] . identifier[is_super_admin] ( identifier[req] ): ...
def is_reseller_admin(self, req, admin_detail=None): """Returns True if the admin specified in the request represents a .reseller_admin. :param req: The swob.Request to check. :param admin_detail: The previously retrieved dict from :func:`get_admin_detail` or No...
def _initialize_references(model_class, name, bases, attrs): """Stores the list of reference field descriptors of a model.""" model_class._references = {} h = {} deferred = [] for k, v in attrs.iteritems(): if isinstance(v, ReferenceField): model_class._references[k] = v ...
def function[_initialize_references, parameter[model_class, name, bases, attrs]]: constant[Stores the list of reference field descriptors of a model.] name[model_class]._references assign[=] dictionary[[], []] variable[h] assign[=] dictionary[[], []] variable[deferred] assign[=] list[[]]...
keyword[def] identifier[_initialize_references] ( identifier[model_class] , identifier[name] , identifier[bases] , identifier[attrs] ): literal[string] identifier[model_class] . identifier[_references] ={} identifier[h] ={} identifier[deferred] =[] keyword[for] identifier[k] , identifier[v]...
def _initialize_references(model_class, name, bases, attrs): """Stores the list of reference field descriptors of a model.""" model_class._references = {} h = {} deferred = [] for (k, v) in attrs.iteritems(): if isinstance(v, ReferenceField): model_class._references[k] = v ...
def addinterval(instr, add, interval): ''' adds string every n character. returns string ''' if not isinstance(instr, str): instr = str(instr) return add.join( instr[i:i+interval] for i in xrange(0,len(instr),interval))
def function[addinterval, parameter[instr, add, interval]]: constant[ adds string every n character. returns string ] if <ast.UnaryOp object at 0x7da18f09ded0> begin[:] variable[instr] assign[=] call[name[str], parameter[name[instr]]] return[call[name[add].join, parameter...
keyword[def] identifier[addinterval] ( identifier[instr] , identifier[add] , identifier[interval] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[instr] , identifier[str] ): identifier[instr] = identifier[str] ( identifier[instr] ) keyword[return] identifie...
def addinterval(instr, add, interval): """ adds string every n character. returns string """ if not isinstance(instr, str): instr = str(instr) # depends on [control=['if'], data=[]] return add.join((instr[i:i + interval] for i in xrange(0, len(instr), interval)))