code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def _schedule(self, delay: float, event: Callable, *args: Any, **kwargs: Any) -> int: """ Schedules a one-time event to be run along the simulation. The event is scheduled relative to current simulator time, so delay is expected to be a positive simulation time interval. The `event' parameter c...
def function[_schedule, parameter[self, delay, event]]: constant[ Schedules a one-time event to be run along the simulation. The event is scheduled relative to current simulator time, so delay is expected to be a positive simulation time interval. The `event' parameter corresponds to a ...
keyword[def] identifier[_schedule] ( identifier[self] , identifier[delay] : identifier[float] , identifier[event] : identifier[Callable] ,* identifier[args] : identifier[Any] ,** identifier[kwargs] : identifier[Any] )-> identifier[int] : literal[string] keyword[if] identifier[_logger] keyword[is]...
def _schedule(self, delay: float, event: Callable, *args: Any, **kwargs: Any) -> int: """ Schedules a one-time event to be run along the simulation. The event is scheduled relative to current simulator time, so delay is expected to be a positive simulation time interval. The `event' parameter corre...
def buildDQMasks(imageObjectList,configObj): """ Build DQ masks for all input images. """ # Insure that input imageObject is a list if not isinstance(imageObjectList, list): imageObjectList = [imageObjectList] for img in imageObjectList: img.buildMask(configObj['single'], configObj[...
def function[buildDQMasks, parameter[imageObjectList, configObj]]: constant[ Build DQ masks for all input images. ] if <ast.UnaryOp object at 0x7da1b1bb8580> begin[:] variable[imageObjectList] assign[=] list[[<ast.Name object at 0x7da1b1bbab30>]] for taget[name[img]] in starr...
keyword[def] identifier[buildDQMasks] ( identifier[imageObjectList] , identifier[configObj] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[imageObjectList] , identifier[list] ): identifier[imageObjectList] =[ identifier[imageObjectList] ] keyword[for] ...
def buildDQMasks(imageObjectList, configObj): """ Build DQ masks for all input images. """ # Insure that input imageObject is a list if not isinstance(imageObjectList, list): imageObjectList = [imageObjectList] # depends on [control=['if'], data=[]] for img in imageObjectList: img.b...
def thing_type_present(name, thingTypeName, thingTypeDescription, searchableAttributesList, region=None, key=None, keyid=None, profile=None): ''' Ensure thing type exists. .. versionadded:: 2016.11.0 name The name of the state definition thingTypeName Name of the thing typ...
def function[thing_type_present, parameter[name, thingTypeName, thingTypeDescription, searchableAttributesList, region, key, keyid, profile]]: constant[ Ensure thing type exists. .. versionadded:: 2016.11.0 name The name of the state definition thingTypeName Name of the thing ...
keyword[def] identifier[thing_type_present] ( identifier[name] , identifier[thingTypeName] , identifier[thingTypeDescription] , identifier[searchableAttributesList] , identifier[region] = keyword[None] , identifier[key] = keyword[None] , identifier[keyid] = keyword[None] , identifier[profile] = keyword[None] ): ...
def thing_type_present(name, thingTypeName, thingTypeDescription, searchableAttributesList, region=None, key=None, keyid=None, profile=None): """ Ensure thing type exists. .. versionadded:: 2016.11.0 name The name of the state definition thingTypeName Name of the thing type t...
def remove(self, param, author=None): """Remove by url or name""" if isinstance(param, SkillEntry): skill = param else: skill = self.find_skill(param, author) skill.remove() skills = [s for s in self.skills_data['skills'] if s['name'] != ...
def function[remove, parameter[self, param, author]]: constant[Remove by url or name] if call[name[isinstance], parameter[name[param], name[SkillEntry]]] begin[:] variable[skill] assign[=] name[param] call[name[skill].remove, parameter[]] variable[skills] assign[=] <ast.L...
keyword[def] identifier[remove] ( identifier[self] , identifier[param] , identifier[author] = keyword[None] ): literal[string] keyword[if] identifier[isinstance] ( identifier[param] , identifier[SkillEntry] ): identifier[skill] = identifier[param] keyword[else] : ...
def remove(self, param, author=None): """Remove by url or name""" if isinstance(param, SkillEntry): skill = param # depends on [control=['if'], data=[]] else: skill = self.find_skill(param, author) skill.remove() skills = [s for s in self.skills_data['skills'] if s['name'] != skill....
def select(self, *args, **kwargs): ''' Query this object and all of its references for objects that match the given selector. There are a few different ways to call the ``select`` method. The most general is to supply a JSON-like query dictionary as the single argument or as key...
def function[select, parameter[self]]: constant[ Query this object and all of its references for objects that match the given selector. There are a few different ways to call the ``select`` method. The most general is to supply a JSON-like query dictionary as the single argument...
keyword[def] identifier[select] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[selector] = identifier[_select_helper] ( identifier[args] , identifier[kwargs] ) keyword[return] identifier[_list_attr_splat] ( identifier[find] ( identif...
def select(self, *args, **kwargs): """ Query this object and all of its references for objects that match the given selector. There are a few different ways to call the ``select`` method. The most general is to supply a JSON-like query dictionary as the single argument or as keyword...
def step(self, **args): """ SRN.step() Extends network step method by automatically copying hidden layer activations to the context layer. """ if self.sequenceType == None: raise AttributeError("""sequenceType not set! Use SRN.setSequenceType() """) # ...
def function[step, parameter[self]]: constant[ SRN.step() Extends network step method by automatically copying hidden layer activations to the context layer. ] if compare[name[self].sequenceType equal[==] constant[None]] begin[:] <ast.Raise object at 0x7da1b03905b...
keyword[def] identifier[step] ( identifier[self] ,** identifier[args] ): literal[string] keyword[if] identifier[self] . identifier[sequenceType] == keyword[None] : keyword[raise] identifier[AttributeError] ( literal[string] ) keyword[if...
def step(self, **args): """ SRN.step() Extends network step method by automatically copying hidden layer activations to the context layer. """ if self.sequenceType == None: raise AttributeError('sequenceType not set! Use SRN.setSequenceType() ') # depends on [control=['i...
def warp_image_by_corner_points_projection(corner_points, image): """Given corner points of a Sudoku, warps original selection to a square image. :param corner_points: :type: corner_points: list :param image: :type image: :return: :rtype: """ # Clarify by storing in named variables...
def function[warp_image_by_corner_points_projection, parameter[corner_points, image]]: constant[Given corner points of a Sudoku, warps original selection to a square image. :param corner_points: :type: corner_points: list :param image: :type image: :return: :rtype: ] <ast.T...
keyword[def] identifier[warp_image_by_corner_points_projection] ( identifier[corner_points] , identifier[image] ): literal[string] identifier[top_left] , identifier[top_right] , identifier[bottom_left] , identifier[bottom_right] = identifier[np] . identifier[array] ( identifier[corner_points] ) ...
def warp_image_by_corner_points_projection(corner_points, image): """Given corner points of a Sudoku, warps original selection to a square image. :param corner_points: :type: corner_points: list :param image: :type image: :return: :rtype: """ # Clarify by storing in named variables...
def return_hdr(self): """Return the header for further use. Returns ------- subj_id : str subject identification code start_time : datetime start time of the dataset s_freq : float sampling frequency chan_name : list of str ...
def function[return_hdr, parameter[self]]: constant[Return the header for further use. Returns ------- subj_id : str subject identification code start_time : datetime start time of the dataset s_freq : float sampling frequency ...
keyword[def] identifier[return_hdr] ( identifier[self] ): literal[string] keyword[with] identifier[open] ( identifier[self] . identifier[filename] , literal[string] ) keyword[as] identifier[f] : identifier[orig] = identifier[load] ( identifier[f] ) identifier[start_time] = ...
def return_hdr(self): """Return the header for further use. Returns ------- subj_id : str subject identification code start_time : datetime start time of the dataset s_freq : float sampling frequency chan_name : list of str ...
def main(): """Entry point when module is run from command line""" parser = argparse.ArgumentParser(description='Run the chaid algorithm on a' ' csv/sav file.') parser.add_argument('file') parser.add_argument('dependent_variable', nargs=1) parser.add_argument('-...
def function[main, parameter[]]: constant[Entry point when module is run from command line] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] call[name[parser].add_argument, parameter[constant[file]]] call[name[parser].add_argument, parameter[constant[dependent_...
keyword[def] identifier[main] (): literal[string] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] ( identifier[description] = literal[string] literal[string] ) identifier[parser] . identifier[add_argument] ( literal[string] ) identifier[parser] . identifier[add_argum...
def main(): """Entry point when module is run from command line""" parser = argparse.ArgumentParser(description='Run the chaid algorithm on a csv/sav file.') parser.add_argument('file') parser.add_argument('dependent_variable', nargs=1) parser.add_argument('--dependent-variable-type', type=str) ...
def _default_error_handler(msg, _): """Default error handler callback for libopenjp2.""" msg = "OpenJPEG library error: {0}".format(msg.decode('utf-8').rstrip()) opj2.set_error_message(msg)
def function[_default_error_handler, parameter[msg, _]]: constant[Default error handler callback for libopenjp2.] variable[msg] assign[=] call[constant[OpenJPEG library error: {0}].format, parameter[call[call[name[msg].decode, parameter[constant[utf-8]]].rstrip, parameter[]]]] call[name[opj2].s...
keyword[def] identifier[_default_error_handler] ( identifier[msg] , identifier[_] ): literal[string] identifier[msg] = literal[string] . identifier[format] ( identifier[msg] . identifier[decode] ( literal[string] ). identifier[rstrip] ()) identifier[opj2] . identifier[set_error_message] ( identifier[m...
def _default_error_handler(msg, _): """Default error handler callback for libopenjp2.""" msg = 'OpenJPEG library error: {0}'.format(msg.decode('utf-8').rstrip()) opj2.set_error_message(msg)
def to_dict_list(df, use_ordered_dict=True): """Transform each row to dict, and put them into a list. **中文文档** 将 ``pandas.DataFrame`` 转换成一个字典的列表。列表的长度与行数相同, 其中 每一个字典相当于表中的一行, 相当于一个 ``pandas.Series`` 对象。 """ if use_ordered_dict: dict = OrderedDict columns = df.columns data = li...
def function[to_dict_list, parameter[df, use_ordered_dict]]: constant[Transform each row to dict, and put them into a list. **中文文档** 将 ``pandas.DataFrame`` 转换成一个字典的列表。列表的长度与行数相同, 其中 每一个字典相当于表中的一行, 相当于一个 ``pandas.Series`` 对象。 ] if name[use_ordered_dict] begin[:] variable...
keyword[def] identifier[to_dict_list] ( identifier[df] , identifier[use_ordered_dict] = keyword[True] ): literal[string] keyword[if] identifier[use_ordered_dict] : identifier[dict] = identifier[OrderedDict] identifier[columns] = identifier[df] . identifier[columns] identifier[data] =...
def to_dict_list(df, use_ordered_dict=True): """Transform each row to dict, and put them into a list. **中文文档** 将 ``pandas.DataFrame`` 转换成一个字典的列表。列表的长度与行数相同, 其中 每一个字典相当于表中的一行, 相当于一个 ``pandas.Series`` 对象。 """ if use_ordered_dict: dict = OrderedDict # depends on [control=['if'], data=[]]...
async def start(self, *args, **kwargs): """|coro| A shorthand coroutine for :meth:`login` + :meth:`connect`. """ bot = kwargs.pop('bot', True) reconnect = kwargs.pop('reconnect', True) await self.login(*args, bot=bot) await self.connect(reconnect=reconnect)
<ast.AsyncFunctionDef object at 0x7da1b20407f0>
keyword[async] keyword[def] identifier[start] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[bot] = identifier[kwargs] . identifier[pop] ( literal[string] , keyword[True] ) identifier[reconnect] = identifier[kwargs] . identifier[pop] ( literal...
async def start(self, *args, **kwargs): """|coro| A shorthand coroutine for :meth:`login` + :meth:`connect`. """ bot = kwargs.pop('bot', True) reconnect = kwargs.pop('reconnect', True) await self.login(*args, bot=bot) await self.connect(reconnect=reconnect)
def copy_tree(src, dst, symlinks=False, ignore=[]): """Copy a full directory structure. :param src: Source path :param dst: Destination path :param symlinks: Copy symlinks :param ignore: Subdirs/filenames to ignore """ names = os.listdir(src) if not os.path.exists(dst): os.make...
def function[copy_tree, parameter[src, dst, symlinks, ignore]]: constant[Copy a full directory structure. :param src: Source path :param dst: Destination path :param symlinks: Copy symlinks :param ignore: Subdirs/filenames to ignore ] variable[names] assign[=] call[name[os].listdir,...
keyword[def] identifier[copy_tree] ( identifier[src] , identifier[dst] , identifier[symlinks] = keyword[False] , identifier[ignore] =[]): literal[string] identifier[names] = identifier[os] . identifier[listdir] ( identifier[src] ) keyword[if] keyword[not] identifier[os] . identifier[path] . identif...
def copy_tree(src, dst, symlinks=False, ignore=[]): """Copy a full directory structure. :param src: Source path :param dst: Destination path :param symlinks: Copy symlinks :param ignore: Subdirs/filenames to ignore """ names = os.listdir(src) if not os.path.exists(dst): os.maked...
def _parse_os_release_content(lines): """ Parse the lines of an os-release file. Parameters: * lines: Iterable through the lines in the os-release file. Each line must be a unicode string or a UTF-8 encoded byte string. Returns: A ...
def function[_parse_os_release_content, parameter[lines]]: constant[ Parse the lines of an os-release file. Parameters: * lines: Iterable through the lines in the os-release file. Each line must be a unicode string or a UTF-8 encoded byte string. ...
keyword[def] identifier[_parse_os_release_content] ( identifier[lines] ): literal[string] identifier[props] ={} identifier[lexer] = identifier[shlex] . identifier[shlex] ( identifier[lines] , identifier[posix] = keyword[True] ) identifier[lexer] . identifier[whitespace_split] = ke...
def _parse_os_release_content(lines): """ Parse the lines of an os-release file. Parameters: * lines: Iterable through the lines in the os-release file. Each line must be a unicode string or a UTF-8 encoded byte string. Returns: A dict...
def auth(username, password): ''' Simple LDAP auth ''' if not HAS_LDAP: log.error('LDAP authentication requires python-ldap module') return False bind = None # If bind credentials are configured, verify that we receive a valid bind if _config('binddn', mandatory=False) and ...
def function[auth, parameter[username, password]]: constant[ Simple LDAP auth ] if <ast.UnaryOp object at 0x7da1b20456c0> begin[:] call[name[log].error, parameter[constant[LDAP authentication requires python-ldap module]]] return[constant[False]] variable[bind] as...
keyword[def] identifier[auth] ( identifier[username] , identifier[password] ): literal[string] keyword[if] keyword[not] identifier[HAS_LDAP] : identifier[log] . identifier[error] ( literal[string] ) keyword[return] keyword[False] identifier[bind] = keyword[None] keyw...
def auth(username, password): """ Simple LDAP auth """ if not HAS_LDAP: log.error('LDAP authentication requires python-ldap module') return False # depends on [control=['if'], data=[]] bind = None # If bind credentials are configured, verify that we receive a valid bind if _...
def footprint(self): """Return product footprint.""" product_footprint = self._product_metadata.iter("Product_Footprint") # I don't know why two "Product_Footprint" items are found. for element in product_footprint: global_footprint = None for global_footprint in ...
def function[footprint, parameter[self]]: constant[Return product footprint.] variable[product_footprint] assign[=] call[name[self]._product_metadata.iter, parameter[constant[Product_Footprint]]] for taget[name[element]] in starred[name[product_footprint]] begin[:] variable[globa...
keyword[def] identifier[footprint] ( identifier[self] ): literal[string] identifier[product_footprint] = identifier[self] . identifier[_product_metadata] . identifier[iter] ( literal[string] ) keyword[for] identifier[element] keyword[in] identifier[product_footprint] : ...
def footprint(self): """Return product footprint.""" product_footprint = self._product_metadata.iter('Product_Footprint') # I don't know why two "Product_Footprint" items are found. for element in product_footprint: global_footprint = None for global_footprint in element.iter('Global_Foo...
def copystat(src, dst): """Copy all stat info (mode bits, atime, mtime, flags) from src to dst""" st = os.stat(src) mode = stat.S_IMODE(st.st_mode) if hasattr(os, 'utime'): os.utime(dst, (st.st_atime, st.st_mtime)) if hasattr(os, 'chmod'): os.chmod(dst, mode) if hasattr(os, 'chfl...
def function[copystat, parameter[src, dst]]: constant[Copy all stat info (mode bits, atime, mtime, flags) from src to dst] variable[st] assign[=] call[name[os].stat, parameter[name[src]]] variable[mode] assign[=] call[name[stat].S_IMODE, parameter[name[st].st_mode]] if call[name[hasattr]...
keyword[def] identifier[copystat] ( identifier[src] , identifier[dst] ): literal[string] identifier[st] = identifier[os] . identifier[stat] ( identifier[src] ) identifier[mode] = identifier[stat] . identifier[S_IMODE] ( identifier[st] . identifier[st_mode] ) keyword[if] identifier[hasattr] ( ide...
def copystat(src, dst): """Copy all stat info (mode bits, atime, mtime, flags) from src to dst""" st = os.stat(src) mode = stat.S_IMODE(st.st_mode) if hasattr(os, 'utime'): os.utime(dst, (st.st_atime, st.st_mtime)) # depends on [control=['if'], data=[]] if hasattr(os, 'chmod'): os.c...
def for_data_and_tracer(cls, lens_data, tracer, padded_tracer=None): """Fit lens data with a model tracer, automatically determining the type of fit based on the \ properties of the galaxies in the tracer. Parameters ----------- lens_data : lens_data.LensData or lens_data.LensDa...
def function[for_data_and_tracer, parameter[cls, lens_data, tracer, padded_tracer]]: constant[Fit lens data with a model tracer, automatically determining the type of fit based on the properties of the galaxies in the tracer. Parameters ----------- lens_data : lens_data.LensData...
keyword[def] identifier[for_data_and_tracer] ( identifier[cls] , identifier[lens_data] , identifier[tracer] , identifier[padded_tracer] = keyword[None] ): literal[string] keyword[if] identifier[tracer] . identifier[has_light_profile] keyword[and] keyword[not] identifier[tracer] . identifier[ha...
def for_data_and_tracer(cls, lens_data, tracer, padded_tracer=None): """Fit lens data with a model tracer, automatically determining the type of fit based on the properties of the galaxies in the tracer. Parameters ----------- lens_data : lens_data.LensData or lens_data.LensDataHype...
def convert(self, txn): """ Convert an OFX Transaction to a posting """ ofxid = self.mk_ofxid(txn.id) metadata = {} posting_metadata = {"ofxid": ofxid} if isinstance(txn, OfxTransaction): posting = Posting(self.name, Amo...
def function[convert, parameter[self, txn]]: constant[ Convert an OFX Transaction to a posting ] variable[ofxid] assign[=] call[name[self].mk_ofxid, parameter[name[txn].id]] variable[metadata] assign[=] dictionary[[], []] variable[posting_metadata] assign[=] dictionary[[<...
keyword[def] identifier[convert] ( identifier[self] , identifier[txn] ): literal[string] identifier[ofxid] = identifier[self] . identifier[mk_ofxid] ( identifier[txn] . identifier[id] ) identifier[metadata] ={} identifier[posting_metadata] ={ literal[string] : identifier[ofxid] }...
def convert(self, txn): """ Convert an OFX Transaction to a posting """ ofxid = self.mk_ofxid(txn.id) metadata = {} posting_metadata = {'ofxid': ofxid} if isinstance(txn, OfxTransaction): posting = Posting(self.name, Amount(txn.amount, self.currency), metadata=posting_metadat...
def update_channels(self): """Update the GUI to reflect channels and image listing. """ if not self.gui_up: return self.logger.debug("channel configuration has changed--updating gui") try: channel = self.fv.get_channel(self.chname) except KeyErro...
def function[update_channels, parameter[self]]: constant[Update the GUI to reflect channels and image listing. ] if <ast.UnaryOp object at 0x7da1b0d1b160> begin[:] return[None] call[name[self].logger.debug, parameter[constant[channel configuration has changed--updating gui]]] ...
keyword[def] identifier[update_channels] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[gui_up] : keyword[return] identifier[self] . identifier[logger] . identifier[debug] ( literal[string] ) keyword[try] : ...
def update_channels(self): """Update the GUI to reflect channels and image listing. """ if not self.gui_up: return # depends on [control=['if'], data=[]] self.logger.debug('channel configuration has changed--updating gui') try: channel = self.fv.get_channel(self.chname) # depen...
def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|arg...
def function[AddArguments, parameter[cls, argument_group]]: constant[Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_gro...
keyword[def] identifier[AddArguments] ( identifier[cls] , identifier[argument_group] ): literal[string] identifier[default_fields] = literal[string] . identifier[join] ( identifier[cls] . identifier[_DEFAULT_FIELDS] ) identifier[argument_group] . identifier[add_argument] ( literal[string] , ident...
def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|arg...
def otherwise(self, value): """ Evaluates a list of conditions and returns one of multiple possible result expressions. If :func:`Column.otherwise` is not invoked, None is returned for unmatched conditions. See :func:`pyspark.sql.functions.when` for example usage. :param value:...
def function[otherwise, parameter[self, value]]: constant[ Evaluates a list of conditions and returns one of multiple possible result expressions. If :func:`Column.otherwise` is not invoked, None is returned for unmatched conditions. See :func:`pyspark.sql.functions.when` for example us...
keyword[def] identifier[otherwise] ( identifier[self] , identifier[value] ): literal[string] identifier[v] = identifier[value] . identifier[_jc] keyword[if] identifier[isinstance] ( identifier[value] , identifier[Column] ) keyword[else] identifier[value] identifier[jc] = identifier[sel...
def otherwise(self, value): """ Evaluates a list of conditions and returns one of multiple possible result expressions. If :func:`Column.otherwise` is not invoked, None is returned for unmatched conditions. See :func:`pyspark.sql.functions.when` for example usage. :param value: a l...
def add_resize_bilinear(self, name, input_name, output_name, target_height=1, target_width=1, mode='ALIGN_ENDPOINTS_MODE'): """ Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ...
def function[add_resize_bilinear, parameter[self, name, input_name, output_name, target_height, target_width, mode]]: constant[ Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ---------- name...
keyword[def] identifier[add_resize_bilinear] ( identifier[self] , identifier[name] , identifier[input_name] , identifier[output_name] , identifier[target_height] = literal[int] , identifier[target_width] = literal[int] , identifier[mode] = literal[string] ): literal[string] identifier[spec] = iden...
def add_resize_bilinear(self, name, input_name, output_name, target_height=1, target_width=1, mode='ALIGN_ENDPOINTS_MODE'): """ Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ---------- name: st...
def set_password(self, raw_password): """Calls :py:func:`~xmpp_backends.base.XmppBackendBase.set_password` for the user. If password is ``None``, calls :py:func:`~xmpp_backends.base.XmppBackendBase.set_unusable_password`. """ if raw_password is None: self.set_unusable_passwo...
def function[set_password, parameter[self, raw_password]]: constant[Calls :py:func:`~xmpp_backends.base.XmppBackendBase.set_password` for the user. If password is ``None``, calls :py:func:`~xmpp_backends.base.XmppBackendBase.set_unusable_password`. ] if compare[name[raw_password] is con...
keyword[def] identifier[set_password] ( identifier[self] , identifier[raw_password] ): literal[string] keyword[if] identifier[raw_password] keyword[is] keyword[None] : identifier[self] . identifier[set_unusable_password] () keyword[else] : identifier[xmpp_backe...
def set_password(self, raw_password): """Calls :py:func:`~xmpp_backends.base.XmppBackendBase.set_password` for the user. If password is ``None``, calls :py:func:`~xmpp_backends.base.XmppBackendBase.set_unusable_password`. """ if raw_password is None: self.set_unusable_password() # depe...
def plot_station_mappings(mapping_results): # pragma: no cover """ Plot a list of mapping results on a map. Requires matplotlib and cartopy. Parameters ---------- mapping_results : list of MappingResult objects Mapping results to plot """ try: import matplotlib.pyplot as p...
def function[plot_station_mappings, parameter[mapping_results]]: constant[ Plot a list of mapping results on a map. Requires matplotlib and cartopy. Parameters ---------- mapping_results : list of MappingResult objects Mapping results to plot ] <ast.Try object at 0x7da1b26ad330...
keyword[def] identifier[plot_station_mappings] ( identifier[mapping_results] ): literal[string] keyword[try] : keyword[import] identifier[matplotlib] . identifier[pyplot] keyword[as] identifier[plt] keyword[except] identifier[ImportError] : keyword[raise] identifier[ImportError...
def plot_station_mappings(mapping_results): # pragma: no cover ' Plot a list of mapping results on a map.\n\n Requires matplotlib and cartopy.\n\n Parameters\n ----------\n mapping_results : list of MappingResult objects\n Mapping results to plot\n ' try: import matplotlib.pyplot ...
def writeArray(fp, a, delim = " ", nl = 1): """ Writes a sequence a of floats to file pointed to by file pointer. """ for i in a: fp.write("%f%s" % (i, delim)) if nl: fp.write("\n")
def function[writeArray, parameter[fp, a, delim, nl]]: constant[ Writes a sequence a of floats to file pointed to by file pointer. ] for taget[name[i]] in starred[name[a]] begin[:] call[name[fp].write, parameter[binary_operation[constant[%f%s] <ast.Mod object at 0x7da2590d6920> t...
keyword[def] identifier[writeArray] ( identifier[fp] , identifier[a] , identifier[delim] = literal[string] , identifier[nl] = literal[int] ): literal[string] keyword[for] identifier[i] keyword[in] identifier[a] : identifier[fp] . identifier[write] ( literal[string] %( identifier[i] , identifier...
def writeArray(fp, a, delim=' ', nl=1): """ Writes a sequence a of floats to file pointed to by file pointer. """ for i in a: fp.write('%f%s' % (i, delim)) # depends on [control=['for'], data=['i']] if nl: fp.write('\n') # depends on [control=['if'], data=[]]
def _dictionary(self): # type: () -> Dict[str, Any] """A dictionary representing the loaded configuration. """ # NOTE: Dictionaries are not populated if not loaded. So, conditionals # are not needed here. retval = {} for variant in self._override_order: ...
def function[_dictionary, parameter[self]]: constant[A dictionary representing the loaded configuration. ] variable[retval] assign[=] dictionary[[], []] for taget[name[variant]] in starred[name[self]._override_order] begin[:] call[name[retval].update, parameter[call[name[...
keyword[def] identifier[_dictionary] ( identifier[self] ): literal[string] identifier[retval] ={} keyword[for] identifier[variant] keyword[in] identifier[self] . identifier[_override_order] : identifier[retval] . identifier[update] ( identifier[self] . i...
def _dictionary(self): # type: () -> Dict[str, Any] 'A dictionary representing the loaded configuration.\n ' # NOTE: Dictionaries are not populated if not loaded. So, conditionals # are not needed here. retval = {} for variant in self._override_order: retval.update(self._con...
def _log_end_transaction(self, start_time, response): """Log response from an API request.""" if not self._is_logging: return elapsed_time = int((time.time() - start_time) * 1000) msg = "<<< HTTP %d %s (%d ms)\n" % (response.status_code, response.reason, elapsed_time) if "Conte...
def function[_log_end_transaction, parameter[self, start_time, response]]: constant[Log response from an API request.] if <ast.UnaryOp object at 0x7da207f03be0> begin[:] return[None] variable[elapsed_time] assign[=] call[name[int], parameter[binary_operation[binary_operation[call[name[ti...
keyword[def] identifier[_log_end_transaction] ( identifier[self] , identifier[start_time] , identifier[response] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_is_logging] : keyword[return] identifier[elapsed_time] = identifier[int] (( identifier[time] . iden...
def _log_end_transaction(self, start_time, response): """Log response from an API request.""" if not self._is_logging: return # depends on [control=['if'], data=[]] elapsed_time = int((time.time() - start_time) * 1000) msg = '<<< HTTP %d %s (%d ms)\n' % (response.status_code, response.reason,...
def tuple_as_vec(xyzw): """ Generates a Vector4 from a tuple or list. """ vec = Vector4() vec[0] = xyzw[0] vec[1] = xyzw[1] vec[2] = xyzw[2] vec[3] = xyzw[3] return vec
def function[tuple_as_vec, parameter[xyzw]]: constant[ Generates a Vector4 from a tuple or list. ] variable[vec] assign[=] call[name[Vector4], parameter[]] call[name[vec]][constant[0]] assign[=] call[name[xyzw]][constant[0]] call[name[vec]][constant[1]] assign[=] call[nam...
keyword[def] identifier[tuple_as_vec] ( identifier[xyzw] ): literal[string] identifier[vec] = identifier[Vector4] () identifier[vec] [ literal[int] ]= identifier[xyzw] [ literal[int] ] identifier[vec] [ literal[int] ]= identifier[xyzw] [ literal[int] ] identifier[vec] [ l...
def tuple_as_vec(xyzw): """ Generates a Vector4 from a tuple or list. """ vec = Vector4() vec[0] = xyzw[0] vec[1] = xyzw[1] vec[2] = xyzw[2] vec[3] = xyzw[3] return vec
def render_startmenu(self, ctx, data): """ For authenticated users, add the start-menu style navigation to the given tag. For unauthenticated users, remove the given tag from the output. @see L{xmantissa.webnav.startMenu} """ if self.username is None: ...
def function[render_startmenu, parameter[self, ctx, data]]: constant[ For authenticated users, add the start-menu style navigation to the given tag. For unauthenticated users, remove the given tag from the output. @see L{xmantissa.webnav.startMenu} ] if compare[...
keyword[def] identifier[render_startmenu] ( identifier[self] , identifier[ctx] , identifier[data] ): literal[string] keyword[if] identifier[self] . identifier[username] keyword[is] keyword[None] : keyword[return] literal[string] identifier[translator] = identifier[self] ....
def render_startmenu(self, ctx, data): """ For authenticated users, add the start-menu style navigation to the given tag. For unauthenticated users, remove the given tag from the output. @see L{xmantissa.webnav.startMenu} """ if self.username is None: return '' ...
def tenants_list(**kwargs): ''' .. versionadded:: 2019.2.0 List all tenants for your account. CLI Example: .. code-block:: bash salt-call azurearm_resource.tenants_list ''' result = {} subconn = __utils__['azurearm.get_client']('subscription', **kwargs) try: tena...
def function[tenants_list, parameter[]]: constant[ .. versionadded:: 2019.2.0 List all tenants for your account. CLI Example: .. code-block:: bash salt-call azurearm_resource.tenants_list ] variable[result] assign[=] dictionary[[], []] variable[subconn] assign[=]...
keyword[def] identifier[tenants_list] (** identifier[kwargs] ): literal[string] identifier[result] ={} identifier[subconn] = identifier[__utils__] [ literal[string] ]( literal[string] ,** identifier[kwargs] ) keyword[try] : identifier[tenants] = identifier[__utils__] [ literal[string] ](...
def tenants_list(**kwargs): """ .. versionadded:: 2019.2.0 List all tenants for your account. CLI Example: .. code-block:: bash salt-call azurearm_resource.tenants_list """ result = {} subconn = __utils__['azurearm.get_client']('subscription', **kwargs) try: tena...
def write_single_coil(slave_id, address, value): """ Return ADU for Modbus function code 05: Write Single Coil. :param slave_id: Number of slave. :return: Byte array with ADU. """ function = WriteSingleCoil() function.address = address function.value = value return _create_request_adu(...
def function[write_single_coil, parameter[slave_id, address, value]]: constant[ Return ADU for Modbus function code 05: Write Single Coil. :param slave_id: Number of slave. :return: Byte array with ADU. ] variable[function] assign[=] call[name[WriteSingleCoil], parameter[]] name[fun...
keyword[def] identifier[write_single_coil] ( identifier[slave_id] , identifier[address] , identifier[value] ): literal[string] identifier[function] = identifier[WriteSingleCoil] () identifier[function] . identifier[address] = identifier[address] identifier[function] . identifier[value] = identif...
def write_single_coil(slave_id, address, value): """ Return ADU for Modbus function code 05: Write Single Coil. :param slave_id: Number of slave. :return: Byte array with ADU. """ function = WriteSingleCoil() function.address = address function.value = value return _create_request_adu(s...
def replace(self, **kwargs): """ Return: a new :class:`AssetLocation` with specific ``kwargs`` replacing their corresponding values. Using AssetLocator's replace function results in a mismatch of __init__ args and kwargs. Replace tries to instantiate an AssetLocation obj...
def function[replace, parameter[self]]: constant[ Return: a new :class:`AssetLocation` with specific ``kwargs`` replacing their corresponding values. Using AssetLocator's replace function results in a mismatch of __init__ args and kwargs. Replace tries to instantiate an ...
keyword[def] identifier[replace] ( identifier[self] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[AssetLocation] ( identifier[kwargs] . identifier[pop] ( literal[string] , identifier[self] . identifier[org] ), identifier[kwargs] . identifier[pop] (...
def replace(self, **kwargs): """ Return: a new :class:`AssetLocation` with specific ``kwargs`` replacing their corresponding values. Using AssetLocator's replace function results in a mismatch of __init__ args and kwargs. Replace tries to instantiate an AssetLocation object ...
def from_parse_args(cls, args): """Constructor from command line args. :param args: parse command line arguments :type args: argparse.ArgumentParser """ return cls(args.migration_file, args.database, db_user=args.db_user, ...
def function[from_parse_args, parameter[cls, args]]: constant[Constructor from command line args. :param args: parse command line arguments :type args: argparse.ArgumentParser ] return[call[name[cls], parameter[name[args].migration_file, name[args].database]]]
keyword[def] identifier[from_parse_args] ( identifier[cls] , identifier[args] ): literal[string] keyword[return] identifier[cls] ( identifier[args] . identifier[migration_file] , identifier[args] . identifier[database] , identifier[db_user] = identifier[args] . identifier[db_use...
def from_parse_args(cls, args): """Constructor from command line args. :param args: parse command line arguments :type args: argparse.ArgumentParser """ return cls(args.migration_file, args.database, db_user=args.db_user, db_password=args.db_password, db_port=args.db_port, db_host=args...
def create(cls, schema, name): """ Create an object based on the root tag name. @param schema: A schema object. @type schema: L{schema.Schema} @param name: The name. @type name: str @return: The created object. @rtype: L{XBuiltin} """ fn ...
def function[create, parameter[cls, schema, name]]: constant[ Create an object based on the root tag name. @param schema: A schema object. @type schema: L{schema.Schema} @param name: The name. @type name: str @return: The created object. @rtype: L{XBuilti...
keyword[def] identifier[create] ( identifier[cls] , identifier[schema] , identifier[name] ): literal[string] identifier[fn] = identifier[cls] . identifier[tags] . identifier[get] ( identifier[name] , identifier[XBuiltin] ) keyword[return] identifier[fn] ( identifier[schema] , identifier[n...
def create(cls, schema, name): """ Create an object based on the root tag name. @param schema: A schema object. @type schema: L{schema.Schema} @param name: The name. @type name: str @return: The created object. @rtype: L{XBuiltin} """ fn = cls.ta...
def delete(self, force=False, volumes=False, **kwargs): """ remove this container; kwargs indicate that some container runtimes might accept more parameters :param force: bool, if container engine supports this, force the functionality :param volumes: bool, remove also associate...
def function[delete, parameter[self, force, volumes]]: constant[ remove this container; kwargs indicate that some container runtimes might accept more parameters :param force: bool, if container engine supports this, force the functionality :param volumes: bool, remove also asso...
keyword[def] identifier[delete] ( identifier[self] , identifier[force] = keyword[False] , identifier[volumes] = keyword[False] ,** identifier[kwargs] ): literal[string] identifier[self] . identifier[d] . identifier[remove_container] ( identifier[self] . identifier[get_id] (), identifier[v] = identi...
def delete(self, force=False, volumes=False, **kwargs): """ remove this container; kwargs indicate that some container runtimes might accept more parameters :param force: bool, if container engine supports this, force the functionality :param volumes: bool, remove also associated vo...
def _add_factor(self, factor): """ Add a factor to the workflow :param factor: The factor object :type factor: Factor | MultiOutputFactor | NodeCreationFactor :return: None """ self.factors.append(factor) logging.info("Added factor with tool {} ".format(f...
def function[_add_factor, parameter[self, factor]]: constant[ Add a factor to the workflow :param factor: The factor object :type factor: Factor | MultiOutputFactor | NodeCreationFactor :return: None ] call[name[self].factors.append, parameter[name[factor]]] ...
keyword[def] identifier[_add_factor] ( identifier[self] , identifier[factor] ): literal[string] identifier[self] . identifier[factors] . identifier[append] ( identifier[factor] ) identifier[logging] . identifier[info] ( literal[string] . identifier[format] ( identifier[factor] . identifier...
def _add_factor(self, factor): """ Add a factor to the workflow :param factor: The factor object :type factor: Factor | MultiOutputFactor | NodeCreationFactor :return: None """ self.factors.append(factor) logging.info('Added factor with tool {} '.format(factor.tool))
def _set_roi_mask(self, roi_mask): """Sets a new ROI mask.""" if isinstance(roi_mask, np.ndarray): # not (roi_mask is None or roi_mask=='auto'): self._verify_shape_compatibility(roi_mask, 'ROI set') self.roi_mask = roi_mask self.roi_list = np....
def function[_set_roi_mask, parameter[self, roi_mask]]: constant[Sets a new ROI mask.] if call[name[isinstance], parameter[name[roi_mask], name[np].ndarray]] begin[:] call[name[self]._verify_shape_compatibility, parameter[name[roi_mask], constant[ROI set]]] name[self].roi...
keyword[def] identifier[_set_roi_mask] ( identifier[self] , identifier[roi_mask] ): literal[string] keyword[if] identifier[isinstance] ( identifier[roi_mask] , identifier[np] . identifier[ndarray] ): identifier[self] . identifier[_verify_shape_compatibility] ( identifier[roi...
def _set_roi_mask(self, roi_mask): """Sets a new ROI mask.""" if isinstance(roi_mask, np.ndarray): # not (roi_mask is None or roi_mask=='auto'): self._verify_shape_compatibility(roi_mask, 'ROI set') self.roi_mask = roi_mask self.roi_list = np.unique(roi_mask.flatten()) np.setdif...
def Zabransky_quasi_polynomial_integral_over_T(T, Tc, a1, a2, a3, a4, a5, a6): r'''Calculates the integral of liquid heat capacity over T using the quasi-polynomial model developed in [1]_. Parameters ---------- T : float Temperature [K] a1-a6 : float Coefficients Returns...
def function[Zabransky_quasi_polynomial_integral_over_T, parameter[T, Tc, a1, a2, a3, a4, a5, a6]]: constant[Calculates the integral of liquid heat capacity over T using the quasi-polynomial model developed in [1]_. Parameters ---------- T : float Temperature [K] a1-a6 : float ...
keyword[def] identifier[Zabransky_quasi_polynomial_integral_over_T] ( identifier[T] , identifier[Tc] , identifier[a1] , identifier[a2] , identifier[a3] , identifier[a4] , identifier[a5] , identifier[a6] ): literal[string] identifier[term] = identifier[T] - identifier[Tc] identifier[logT] = identifier...
def Zabransky_quasi_polynomial_integral_over_T(T, Tc, a1, a2, a3, a4, a5, a6): """Calculates the integral of liquid heat capacity over T using the quasi-polynomial model developed in [1]_. Parameters ---------- T : float Temperature [K] a1-a6 : float Coefficients Returns ...
def write_feedback(self, feedback, cr=True): """ Store feedback. Keep specified feedback as previous output :param feedback: data to store :param cr: whether to write carriage return to the end or not :return: None """ self.__previous_data += feedback if cr is True: self.__previous_data += '\n'
def function[write_feedback, parameter[self, feedback, cr]]: constant[ Store feedback. Keep specified feedback as previous output :param feedback: data to store :param cr: whether to write carriage return to the end or not :return: None ] <ast.AugAssign object at 0x7da1b2585b70> if compare[...
keyword[def] identifier[write_feedback] ( identifier[self] , identifier[feedback] , identifier[cr] = keyword[True] ): literal[string] identifier[self] . identifier[__previous_data] += identifier[feedback] keyword[if] identifier[cr] keyword[is] keyword[True] : identifier[self] . identifier[__previous...
def write_feedback(self, feedback, cr=True): """ Store feedback. Keep specified feedback as previous output :param feedback: data to store :param cr: whether to write carriage return to the end or not :return: None """ self.__previous_data += feedback if cr is True: self.__previous_data += ...
def _create_s(y, h): """Estimate secants""" s = np.zeros_like(y) s[:-1] = (y[1:] - y[:-1]) / h[:-1] s[-1] = 0.0 return s
def function[_create_s, parameter[y, h]]: constant[Estimate secants] variable[s] assign[=] call[name[np].zeros_like, parameter[name[y]]] call[name[s]][<ast.Slice object at 0x7da20c6c6950>] assign[=] binary_operation[binary_operation[call[name[y]][<ast.Slice object at 0x7da20c6c5ae0>] - call[name...
keyword[def] identifier[_create_s] ( identifier[y] , identifier[h] ): literal[string] identifier[s] = identifier[np] . identifier[zeros_like] ( identifier[y] ) identifier[s] [:- literal[int] ]=( identifier[y] [ literal[int] :]- identifier[y] [:- literal[int] ])/ identifier[h] [:- literal[i...
def _create_s(y, h): """Estimate secants""" s = np.zeros_like(y) s[:-1] = (y[1:] - y[:-1]) / h[:-1] s[-1] = 0.0 return s
def to_dict(self): """ Prepare a JSON serializable dict for read-only purposes. Includes storages and IP-addresses. Use prepare_post_body for POST and .save() for PUT. """ fields = dict(vars(self).items()) if self.populated: fields['ip_addresses'] = ...
def function[to_dict, parameter[self]]: constant[ Prepare a JSON serializable dict for read-only purposes. Includes storages and IP-addresses. Use prepare_post_body for POST and .save() for PUT. ] variable[fields] assign[=] call[name[dict], parameter[call[call[name[vars]...
keyword[def] identifier[to_dict] ( identifier[self] ): literal[string] identifier[fields] = identifier[dict] ( identifier[vars] ( identifier[self] ). identifier[items] ()) keyword[if] identifier[self] . identifier[populated] : identifier[fields] [ literal[string] ]=[] ...
def to_dict(self): """ Prepare a JSON serializable dict for read-only purposes. Includes storages and IP-addresses. Use prepare_post_body for POST and .save() for PUT. """ fields = dict(vars(self).items()) if self.populated: fields['ip_addresses'] = [] fields...
def build(self, link_type, path): super(HeadLink, self).build() """ :param link_type: Link type :param target: Link target """ self.target = path self.link_type = link_type self.autoclosing = True
def function[build, parameter[self, link_type, path]]: call[call[name[super], parameter[name[HeadLink], name[self]]].build, parameter[]] constant[ :param link_type: Link type :param target: Link target ] name[self].target assign[=] name[path] name[self].link_type assign[=] na...
keyword[def] identifier[build] ( identifier[self] , identifier[link_type] , identifier[path] ): identifier[super] ( identifier[HeadLink] , identifier[self] ). identifier[build] () literal[string] identifier[self] . identifier[target] = identifier[path] identifier[self] . identifi...
def build(self, link_type, path): super(HeadLink, self).build() '\n :param link_type: Link type\n :param target: Link target\n ' self.target = path self.link_type = link_type self.autoclosing = True
def initWithComplexQuery(query): """ create a query using a complex article query """ q = QueryArticles() # provided an instance of ComplexArticleQuery if isinstance(query, ComplexArticleQuery): q._setVal("query", json.dumps(query.getQuery())) # provid...
def function[initWithComplexQuery, parameter[query]]: constant[ create a query using a complex article query ] variable[q] assign[=] call[name[QueryArticles], parameter[]] if call[name[isinstance], parameter[name[query], name[ComplexArticleQuery]]] begin[:] call[n...
keyword[def] identifier[initWithComplexQuery] ( identifier[query] ): literal[string] identifier[q] = identifier[QueryArticles] () keyword[if] identifier[isinstance] ( identifier[query] , identifier[ComplexArticleQuery] ): identifier[q] . identifier[_setVal] ( literal...
def initWithComplexQuery(query): """ create a query using a complex article query """ q = QueryArticles() # provided an instance of ComplexArticleQuery if isinstance(query, ComplexArticleQuery): q._setVal('query', json.dumps(query.getQuery())) # depends on [control=['if'], data=...
def execute(self): """ Executes the command. """ from vsgen.util.logger import VSGLogger VSGLogger.info(self._logname, self._message) start = time.clock() VSGWriter.write(self._writables, self._parallel) end = time.clock() VSGLogger.info(self._log...
def function[execute, parameter[self]]: constant[ Executes the command. ] from relative_module[vsgen.util.logger] import module[VSGLogger] call[name[VSGLogger].info, parameter[name[self]._logname, name[self]._message]] variable[start] assign[=] call[name[time].clock, paramete...
keyword[def] identifier[execute] ( identifier[self] ): literal[string] keyword[from] identifier[vsgen] . identifier[util] . identifier[logger] keyword[import] identifier[VSGLogger] identifier[VSGLogger] . identifier[info] ( identifier[self] . identifier[_logname] , identifier[self] . ...
def execute(self): """ Executes the command. """ from vsgen.util.logger import VSGLogger VSGLogger.info(self._logname, self._message) start = time.clock() VSGWriter.write(self._writables, self._parallel) end = time.clock() VSGLogger.info(self._logname, 'Wrote %s files in %s s...
def _prune_beam(states: List[State], beam_size: int, sort_states: bool = False) -> List[State]: """ This method can be used to prune the set of unfinished states on a beam or finished states at the end of search. In the former case, the states need not be ...
def function[_prune_beam, parameter[states, beam_size, sort_states]]: constant[ This method can be used to prune the set of unfinished states on a beam or finished states at the end of search. In the former case, the states need not be sorted because the all come from the same decoding s...
keyword[def] identifier[_prune_beam] ( identifier[states] : identifier[List] [ identifier[State] ], identifier[beam_size] : identifier[int] , identifier[sort_states] : identifier[bool] = keyword[False] )-> identifier[List] [ identifier[State] ]: literal[string] identifier[states_by_batch_index] :...
def _prune_beam(states: List[State], beam_size: int, sort_states: bool=False) -> List[State]: """ This method can be used to prune the set of unfinished states on a beam or finished states at the end of search. In the former case, the states need not be sorted because the all come from the s...
def import_name_or_class(name): " Import an obect as either a fully qualified, dotted name, " if isinstance(name, str): # for "a.b.c.d" -> [ 'a.b.c', 'd' ] module_name, object_name = name.rsplit('.',1) # __import__ loads the multi-level of module, but returns # the top level, w...
def function[import_name_or_class, parameter[name]]: constant[ Import an obect as either a fully qualified, dotted name, ] if call[name[isinstance], parameter[name[name], name[str]]] begin[:] <ast.Tuple object at 0x7da20c76e9e0> assign[=] call[name[name].rsplit, parameter[constant[.], co...
keyword[def] identifier[import_name_or_class] ( identifier[name] ): literal[string] keyword[if] identifier[isinstance] ( identifier[name] , identifier[str] ): identifier[module_name] , identifier[object_name] = identifier[name] . identifier[rsplit] ( literal[string] , literal[int] ) ...
def import_name_or_class(name): """ Import an obect as either a fully qualified, dotted name, """ if isinstance(name, str): # for "a.b.c.d" -> [ 'a.b.c', 'd' ] (module_name, object_name) = name.rsplit('.', 1) # __import__ loads the multi-level of module, but returns # the top lev...
def rewriteLoadCommands(self, changefunc): """ Rewrite the load commands based upon a change dictionary """ data = changefunc(self.parent.filename) changed = False if data is not None: if self.rewriteInstallNameCommand( data.encode(sys.getf...
def function[rewriteLoadCommands, parameter[self, changefunc]]: constant[ Rewrite the load commands based upon a change dictionary ] variable[data] assign[=] call[name[changefunc], parameter[name[self].parent.filename]] variable[changed] assign[=] constant[False] if compa...
keyword[def] identifier[rewriteLoadCommands] ( identifier[self] , identifier[changefunc] ): literal[string] identifier[data] = identifier[changefunc] ( identifier[self] . identifier[parent] . identifier[filename] ) identifier[changed] = keyword[False] keyword[if] identifier[data...
def rewriteLoadCommands(self, changefunc): """ Rewrite the load commands based upon a change dictionary """ data = changefunc(self.parent.filename) changed = False if data is not None: if self.rewriteInstallNameCommand(data.encode(sys.getfilesystemencoding())): change...
def rebinmask(mask, binx, biny, enlarge=False): """Re-bin (shrink or enlarge) a mask matrix. Inputs ------ mask: np.ndarray mask matrix. binx: integer binning along the 0th axis biny: integer binning along the 1st axis enlarge: bool, optional direction of bin...
def function[rebinmask, parameter[mask, binx, biny, enlarge]]: constant[Re-bin (shrink or enlarge) a mask matrix. Inputs ------ mask: np.ndarray mask matrix. binx: integer binning along the 0th axis biny: integer binning along the 1st axis enlarge: bool, optional...
keyword[def] identifier[rebinmask] ( identifier[mask] , identifier[binx] , identifier[biny] , identifier[enlarge] = keyword[False] ): literal[string] keyword[if] keyword[not] identifier[enlarge] keyword[and] (( identifier[mask] . identifier[shape] [ literal[int] ]% identifier[binx] ) keyword[or] ( ident...
def rebinmask(mask, binx, biny, enlarge=False): """Re-bin (shrink or enlarge) a mask matrix. Inputs ------ mask: np.ndarray mask matrix. binx: integer binning along the 0th axis biny: integer binning along the 1st axis enlarge: bool, optional direction of bin...
def ensure_started(self): """Idempotent channel start""" if self.active: return self self._observer = self._observer_class(**self._observer_params) self.start() self._active = True return self
def function[ensure_started, parameter[self]]: constant[Idempotent channel start] if name[self].active begin[:] return[name[self]] name[self]._observer assign[=] call[name[self]._observer_class, parameter[]] call[name[self].start, parameter[]] name[self]._active assign[=]...
keyword[def] identifier[ensure_started] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[active] : keyword[return] identifier[self] identifier[self] . identifier[_observer] = identifier[self] . identifier[_observer_class] (** identifier[self] ...
def ensure_started(self): """Idempotent channel start""" if self.active: return self # depends on [control=['if'], data=[]] self._observer = self._observer_class(**self._observer_params) self.start() self._active = True return self
def _set_cfm_config(self, v, load=False): """ Setter method for cfm_config, mapped from YANG variable /cfm_config (container) If this variable is read-only (config: false) in the source YANG file, then _set_cfm_config is considered as a private method. Backends looking to populate this variable shou...
def function[_set_cfm_config, parameter[self, v, load]]: constant[ Setter method for cfm_config, mapped from YANG variable /cfm_config (container) If this variable is read-only (config: false) in the source YANG file, then _set_cfm_config is considered as a private method. Backends looking to po...
keyword[def] identifier[_set_cfm_config] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ): literal[string] keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ): identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] ) keyword[try] : ide...
def _set_cfm_config(self, v, load=False): """ Setter method for cfm_config, mapped from YANG variable /cfm_config (container) If this variable is read-only (config: false) in the source YANG file, then _set_cfm_config is considered as a private method. Backends looking to populate this variable shou...
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ assert all(stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES ...
def function[get_mean_and_stddevs, parameter[self, sites, rup, dists, imt, stddev_types]]: constant[ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. ] assert[call[name[all], parameter[<ast.GeneratorEx...
keyword[def] identifier[get_mean_and_stddevs] ( identifier[self] , identifier[sites] , identifier[rup] , identifier[dists] , identifier[imt] , identifier[stddev_types] ): literal[string] keyword[assert] identifier[all] ( identifier[stddev_type] keyword[in] identifier[self] . identifier[DEFINED_F...
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ assert all((stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES for stdde...
def set_training(model, mode): """ A context manager to temporarily set the training mode of 'model' to 'mode', resetting it when we exit the with-block. A no-op if mode is None. """ if mode is None: yield return old_mode = model.training if old_mode != mode: mod...
def function[set_training, parameter[model, mode]]: constant[ A context manager to temporarily set the training mode of 'model' to 'mode', resetting it when we exit the with-block. A no-op if mode is None. ] if compare[name[mode] is constant[None]] begin[:] <ast.Yield ob...
keyword[def] identifier[set_training] ( identifier[model] , identifier[mode] ): literal[string] keyword[if] identifier[mode] keyword[is] keyword[None] : keyword[yield] keyword[return] identifier[old_mode] = identifier[model] . identifier[training] keyword[if] identifier[o...
def set_training(model, mode): """ A context manager to temporarily set the training mode of 'model' to 'mode', resetting it when we exit the with-block. A no-op if mode is None. """ if mode is None: yield return # depends on [control=['if'], data=[]] old_mode = model.train...
def set_docstring(self, loc, tokens): """Set the docstring.""" internal_assert(len(tokens) == 2, "invalid docstring tokens", tokens) self.docstring = self.reformat(tokens[0]) + "\n\n" return tokens[1]
def function[set_docstring, parameter[self, loc, tokens]]: constant[Set the docstring.] call[name[internal_assert], parameter[compare[call[name[len], parameter[name[tokens]]] equal[==] constant[2]], constant[invalid docstring tokens], name[tokens]]] name[self].docstring assign[=] binary_operatio...
keyword[def] identifier[set_docstring] ( identifier[self] , identifier[loc] , identifier[tokens] ): literal[string] identifier[internal_assert] ( identifier[len] ( identifier[tokens] )== literal[int] , literal[string] , identifier[tokens] ) identifier[self] . identifier[docstring] = identi...
def set_docstring(self, loc, tokens): """Set the docstring.""" internal_assert(len(tokens) == 2, 'invalid docstring tokens', tokens) self.docstring = self.reformat(tokens[0]) + '\n\n' return tokens[1]
def _get_algorithm_info(self, algorithm_info): '''Get algorithm info''' if algorithm_info['algorithm'] not in self.ALGORITHMS: raise Exception('Algorithm not supported: %s' % algorithm_info['algorithm']) algorithm = self.ALGORITHMS[algorithm_info['algori...
def function[_get_algorithm_info, parameter[self, algorithm_info]]: constant[Get algorithm info] if compare[call[name[algorithm_info]][constant[algorithm]] <ast.NotIn object at 0x7da2590d7190> name[self].ALGORITHMS] begin[:] <ast.Raise object at 0x7da2054a65f0> variable[algorithm] assign...
keyword[def] identifier[_get_algorithm_info] ( identifier[self] , identifier[algorithm_info] ): literal[string] keyword[if] identifier[algorithm_info] [ literal[string] ] keyword[not] keyword[in] identifier[self] . identifier[ALGORITHMS] : keyword[raise] identifier[Exception] ( li...
def _get_algorithm_info(self, algorithm_info): """Get algorithm info""" if algorithm_info['algorithm'] not in self.ALGORITHMS: raise Exception('Algorithm not supported: %s' % algorithm_info['algorithm']) # depends on [control=['if'], data=[]] algorithm = self.ALGORITHMS[algorithm_info['algorithm']]...
def has_access_api(f): """ Use this decorator to enable granular security permissions to your API methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name. this will return a message and HTTP 401 is c...
def function[has_access_api, parameter[f]]: constant[ Use this decorator to enable granular security permissions to your API methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name. this will ret...
keyword[def] identifier[has_access_api] ( identifier[f] ): literal[string] keyword[if] identifier[hasattr] ( identifier[f] , literal[string] ): identifier[permission_str] = identifier[f] . identifier[_permission_name] keyword[else] : identifier[permission_str] = identifier[f] . ide...
def has_access_api(f): """ Use this decorator to enable granular security permissions to your API methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name. this will return a message and HTTP 401 is c...
def get_url(self): """Gets the URL associated with this content for web-based retrieval. return: (string) - the url for this data raise: IllegalState - ``has_url()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # construct the URL from r...
def function[get_url, parameter[self]]: constant[Gets the URL associated with this content for web-based retrieval. return: (string) - the url for this data raise: IllegalState - ``has_url()`` is ``false`` *compliance: mandatory -- This method must be implemented.* ] v...
keyword[def] identifier[get_url] ( identifier[self] ): literal[string] identifier[url] = literal[string] . identifier[format] ( identifier[self] . identifier[_my_map] [ literal[string] ][ literal[int] ], identifier[str] ( identifier[self] . identifier[ge...
def get_url(self): """Gets the URL associated with this content for web-based retrieval. return: (string) - the url for this data raise: IllegalState - ``has_url()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # construct the URL from runtime's...
def add_event_handler(self, callback, event=None): """ Registers the given callback to be called on the specified event. Args: callback (`callable`): The callable function accepting one parameter to be used. Note that if you have used `telethon.event...
def function[add_event_handler, parameter[self, callback, event]]: constant[ Registers the given callback to be called on the specified event. Args: callback (`callable`): The callable function accepting one parameter to be used. Note that if you hav...
keyword[def] identifier[add_event_handler] ( identifier[self] , identifier[callback] , identifier[event] = keyword[None] ): literal[string] identifier[builders] = identifier[events] . identifier[_get_handlers] ( identifier[callback] ) keyword[if] identifier[builders] keyword[is] keyword...
def add_event_handler(self, callback, event=None): """ Registers the given callback to be called on the specified event. Args: callback (`callable`): The callable function accepting one parameter to be used. Note that if you have used `telethon.events.re...
def recent(self, message_id=None, limit=None): """ Recent messages. Kwargs: message_id (int): If specified, return messages since the specified message ID limit (int): If specified, limit the number of messages Returns: array. Messages """ pa...
def function[recent, parameter[self, message_id, limit]]: constant[ Recent messages. Kwargs: message_id (int): If specified, return messages since the specified message ID limit (int): If specified, limit the number of messages Returns: array. Messages ...
keyword[def] identifier[recent] ( identifier[self] , identifier[message_id] = keyword[None] , identifier[limit] = keyword[None] ): literal[string] identifier[parameters] ={} keyword[if] identifier[message_id] : identifier[parameters] [ literal[string] ]= identifier[message_id...
def recent(self, message_id=None, limit=None): """ Recent messages. Kwargs: message_id (int): If specified, return messages since the specified message ID limit (int): If specified, limit the number of messages Returns: array. Messages """ parameters...
def add_subscription(self, channel, callback_function): """ Add a channel to subscribe to and a callback function to run when the channel receives an update. If channel already exists, create a new "subscription" and append another callback function. Args: ch...
def function[add_subscription, parameter[self, channel, callback_function]]: constant[ Add a channel to subscribe to and a callback function to run when the channel receives an update. If channel already exists, create a new "subscription" and append another callback function. ...
keyword[def] identifier[add_subscription] ( identifier[self] , identifier[channel] , identifier[callback_function] ): literal[string] keyword[if] identifier[channel] keyword[not] keyword[in] identifier[CHANNELS] : identifier[CHANNELS] . identifier[append] ( identifier[channel] ) ...
def add_subscription(self, channel, callback_function): """ Add a channel to subscribe to and a callback function to run when the channel receives an update. If channel already exists, create a new "subscription" and append another callback function. Args: channe...
def on_channel_open(self, channel): """Called by pika when the channel has been opened. The channel object is passed in so we can make use of it. Since the channel is now open, we'll start consuming. :param pika.channel.Channel channel: The channel object """ logger.deb...
def function[on_channel_open, parameter[self, channel]]: constant[Called by pika when the channel has been opened. The channel object is passed in so we can make use of it. Since the channel is now open, we'll start consuming. :param pika.channel.Channel channel: The channel object ...
keyword[def] identifier[on_channel_open] ( identifier[self] , identifier[channel] ): literal[string] identifier[logger] . identifier[debug] ( literal[string] ) identifier[self] . identifier[_channel] = identifier[channel] identifier[self] . identifier[add_on_channel_close_callbac...
def on_channel_open(self, channel): """Called by pika when the channel has been opened. The channel object is passed in so we can make use of it. Since the channel is now open, we'll start consuming. :param pika.channel.Channel channel: The channel object """ logger.debug('Chan...
def validate_usage(validation_context, cert, key_usage, extended_key_usage, extended_optional): """ Validates the end-entity certificate from a certvalidator.path.ValidationPath object to ensure that the certificate is valid for the key usage and extended key usage purposes specified. THE CERTIFICA...
def function[validate_usage, parameter[validation_context, cert, key_usage, extended_key_usage, extended_optional]]: constant[ Validates the end-entity certificate from a certvalidator.path.ValidationPath object to ensure that the certificate is valid for the key usage and extended key usage purpose...
keyword[def] identifier[validate_usage] ( identifier[validation_context] , identifier[cert] , identifier[key_usage] , identifier[extended_key_usage] , identifier[extended_optional] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[validation_context] , identifier[Validation...
def validate_usage(validation_context, cert, key_usage, extended_key_usage, extended_optional): """ Validates the end-entity certificate from a certvalidator.path.ValidationPath object to ensure that the certificate is valid for the key usage and extended key usage purposes specified. THE CERTIFICA...
async def authenticate_with_device(atv): """Perform device authentication and print credentials.""" credentials = await atv.airplay.generate_credentials() await atv.airplay.load_credentials(credentials) try: await atv.airplay.start_authentication() pin = input('PIN Code: ') awai...
<ast.AsyncFunctionDef object at 0x7da18fe918a0>
keyword[async] keyword[def] identifier[authenticate_with_device] ( identifier[atv] ): literal[string] identifier[credentials] = keyword[await] identifier[atv] . identifier[airplay] . identifier[generate_credentials] () keyword[await] identifier[atv] . identifier[airplay] . identifier[load_credentia...
async def authenticate_with_device(atv): """Perform device authentication and print credentials.""" credentials = await atv.airplay.generate_credentials() await atv.airplay.load_credentials(credentials) try: await atv.airplay.start_authentication() pin = input('PIN Code: ') await...
def query_transactions(self, initial_date, final_date, page=None, max_results=None): """ query transaction by date range """ last_page = False results = [] while last_page is False: search_result = self._consume_query_tran...
def function[query_transactions, parameter[self, initial_date, final_date, page, max_results]]: constant[ query transaction by date range ] variable[last_page] assign[=] constant[False] variable[results] assign[=] list[[]] while compare[name[last_page] is constant[False]] begin[:] ...
keyword[def] identifier[query_transactions] ( identifier[self] , identifier[initial_date] , identifier[final_date] , identifier[page] = keyword[None] , identifier[max_results] = keyword[None] ): literal[string] identifier[last_page] = keyword[False] identifier[results] =[] keyw...
def query_transactions(self, initial_date, final_date, page=None, max_results=None): """ query transaction by date range """ last_page = False results = [] while last_page is False: search_result = self._consume_query_transactions(initial_date, final_date, page, max_results) results.exte...
def archive_insert_data(self, data_dump): ''' :param data: Archive table data :type data: list[archive] :raises: IOError ''' with self.session as session: try: data = [self.tables.archive(**entry) for entry in data_dump] sessio...
def function[archive_insert_data, parameter[self, data_dump]]: constant[ :param data: Archive table data :type data: list[archive] :raises: IOError ] with name[self].session begin[:] <ast.Try object at 0x7da20c6c7490>
keyword[def] identifier[archive_insert_data] ( identifier[self] , identifier[data_dump] ): literal[string] keyword[with] identifier[self] . identifier[session] keyword[as] identifier[session] : keyword[try] : identifier[data] =[ identifier[self] . identifier[tables]...
def archive_insert_data(self, data_dump): """ :param data: Archive table data :type data: list[archive] :raises: IOError """ with self.session as session: try: data = [self.tables.archive(**entry) for entry in data_dump] session.add_all(data) ...
def _serve_environment(self, request): """Serve a JSON object containing some base properties used by the frontend. * data_location is either a path to a directory or an address to a database (depending on which mode TensorBoard is running in). * window_title is the title of the TensorBoard web page....
def function[_serve_environment, parameter[self, request]]: constant[Serve a JSON object containing some base properties used by the frontend. * data_location is either a path to a directory or an address to a database (depending on which mode TensorBoard is running in). * window_title is the tit...
keyword[def] identifier[_serve_environment] ( identifier[self] , identifier[request] ): literal[string] keyword[return] identifier[http_util] . identifier[Respond] ( identifier[request] , { literal[string] : identifier[self] . identifier[_logdir] keyword[or] identifier[self] . identifier[_...
def _serve_environment(self, request): """Serve a JSON object containing some base properties used by the frontend. * data_location is either a path to a directory or an address to a database (depending on which mode TensorBoard is running in). * window_title is the title of the TensorBoard web page....
def predict_lmm_forest(tree_nodes, left_children, right_children, best_predictor, mean, splitting_value, X, depth): """ predict_lmm_forest(VectorXi const & tree_nodes, VectorXi const & left_children, VectorXi const & right_children, VectorXi const & best_predictor, MatrixXd const & mean, MatrixXd const & splitt...
def function[predict_lmm_forest, parameter[tree_nodes, left_children, right_children, best_predictor, mean, splitting_value, X, depth]]: constant[ predict_lmm_forest(VectorXi const & tree_nodes, VectorXi const & left_children, VectorXi const & right_children, VectorXi const & best_predictor, MatrixXd const ...
keyword[def] identifier[predict_lmm_forest] ( identifier[tree_nodes] , identifier[left_children] , identifier[right_children] , identifier[best_predictor] , identifier[mean] , identifier[splitting_value] , identifier[X] , identifier[depth] ): literal[string] keyword[return] identifier[_core] . identifier[...
def predict_lmm_forest(tree_nodes, left_children, right_children, best_predictor, mean, splitting_value, X, depth): """ predict_lmm_forest(VectorXi const & tree_nodes, VectorXi const & left_children, VectorXi const & right_children, VectorXi const & best_predictor, MatrixXd const & mean, MatrixXd const & splitt...
def as_knock(self, created=False): """ Returns a dictionary with the knock data built from _knocker_data """ knock = {} if self.should_knock(created): for field, data in self._retrieve_data(None, self._knocker_data): knock[field] = data return ...
def function[as_knock, parameter[self, created]]: constant[ Returns a dictionary with the knock data built from _knocker_data ] variable[knock] assign[=] dictionary[[], []] if call[name[self].should_knock, parameter[name[created]]] begin[:] for taget[tuple[[<ast.N...
keyword[def] identifier[as_knock] ( identifier[self] , identifier[created] = keyword[False] ): literal[string] identifier[knock] ={} keyword[if] identifier[self] . identifier[should_knock] ( identifier[created] ): keyword[for] identifier[field] , identifier[data] keyword[in...
def as_knock(self, created=False): """ Returns a dictionary with the knock data built from _knocker_data """ knock = {} if self.should_knock(created): for (field, data) in self._retrieve_data(None, self._knocker_data): knock[field] = data # depends on [control=['for'], d...
def add_spout(self, name, spout_cls, par, config=None, optional_outputs=None): """Add a spout to the topology""" spout_spec = spout_cls.spec(name=name, par=par, config=config, optional_outputs=optional_outputs) self.add_spec(spout_spec) return spout_spec
def function[add_spout, parameter[self, name, spout_cls, par, config, optional_outputs]]: constant[Add a spout to the topology] variable[spout_spec] assign[=] call[name[spout_cls].spec, parameter[]] call[name[self].add_spec, parameter[name[spout_spec]]] return[name[spout_spec]]
keyword[def] identifier[add_spout] ( identifier[self] , identifier[name] , identifier[spout_cls] , identifier[par] , identifier[config] = keyword[None] , identifier[optional_outputs] = keyword[None] ): literal[string] identifier[spout_spec] = identifier[spout_cls] . identifier[spec] ( identifier[name] = id...
def add_spout(self, name, spout_cls, par, config=None, optional_outputs=None): """Add a spout to the topology""" spout_spec = spout_cls.spec(name=name, par=par, config=config, optional_outputs=optional_outputs) self.add_spec(spout_spec) return spout_spec
def run(bam, chrom, pos1, pos2, reffa, chr_reffa, parameters): """Run mpileup on given chrom and pos""" # check for chr ref is_chr_query = chrom.startswith('chr') if is_chr_query and chr_reffa is None: chr_reffa = reffa # check bam ref type bam_header = subprocess.check_output("samtool...
def function[run, parameter[bam, chrom, pos1, pos2, reffa, chr_reffa, parameters]]: constant[Run mpileup on given chrom and pos] variable[is_chr_query] assign[=] call[name[chrom].startswith, parameter[constant[chr]]] if <ast.BoolOp object at 0x7da20c990460> begin[:] variable[chr_...
keyword[def] identifier[run] ( identifier[bam] , identifier[chrom] , identifier[pos1] , identifier[pos2] , identifier[reffa] , identifier[chr_reffa] , identifier[parameters] ): literal[string] identifier[is_chr_query] = identifier[chrom] . identifier[startswith] ( literal[string] ) keyword[if] ...
def run(bam, chrom, pos1, pos2, reffa, chr_reffa, parameters): """Run mpileup on given chrom and pos""" # check for chr ref is_chr_query = chrom.startswith('chr') if is_chr_query and chr_reffa is None: chr_reffa = reffa # depends on [control=['if'], data=[]] # check bam ref type bam_hea...
def _timeout_cb(self, method): """Call the timeout handler due. """ self._anything_done = True logger.debug("_timeout_cb() called for: {0!r}".format(method)) result = method() # pylint: disable=W0212 rec = method._pyxmpp_recurring if rec: self....
def function[_timeout_cb, parameter[self, method]]: constant[Call the timeout handler due. ] name[self]._anything_done assign[=] constant[True] call[name[logger].debug, parameter[call[constant[_timeout_cb() called for: {0!r}].format, parameter[name[method]]]]] variable[result] as...
keyword[def] identifier[_timeout_cb] ( identifier[self] , identifier[method] ): literal[string] identifier[self] . identifier[_anything_done] = keyword[True] identifier[logger] . identifier[debug] ( literal[string] . identifier[format] ( identifier[method] )) identifier[result] =...
def _timeout_cb(self, method): """Call the timeout handler due. """ self._anything_done = True logger.debug('_timeout_cb() called for: {0!r}'.format(method)) result = method() # pylint: disable=W0212 rec = method._pyxmpp_recurring if rec: self._prepare_pending() retur...
def _raise_duplicate_symbol(msgid, symbol, other_symbol): """Raise an error when a symbol is duplicated. :param str msgid: The msgid corresponding to the symbols :param str symbol: Offending symbol :param str other_symbol: Other offending symbol :raises InvalidMessageError: when...
def function[_raise_duplicate_symbol, parameter[msgid, symbol, other_symbol]]: constant[Raise an error when a symbol is duplicated. :param str msgid: The msgid corresponding to the symbols :param str symbol: Offending symbol :param str other_symbol: Other offending symbol :raise...
keyword[def] identifier[_raise_duplicate_symbol] ( identifier[msgid] , identifier[symbol] , identifier[other_symbol] ): literal[string] identifier[symbols] =[ identifier[symbol] , identifier[other_symbol] ] identifier[symbols] . identifier[sort] () identifier[error_message] = lite...
def _raise_duplicate_symbol(msgid, symbol, other_symbol): """Raise an error when a symbol is duplicated. :param str msgid: The msgid corresponding to the symbols :param str symbol: Offending symbol :param str other_symbol: Other offending symbol :raises InvalidMessageError: when a s...
def log_html(self, log) -> str: """Return single check sub-result string as HTML or not if below log level.""" if not self.omit_loglevel(log["status"]): emoticon = EMOTICON[log["status"]] status = log["status"] message = html.escape(log["message"]).replace("\n...
def function[log_html, parameter[self, log]]: constant[Return single check sub-result string as HTML or not if below log level.] if <ast.UnaryOp object at 0x7da1b122cee0> begin[:] variable[emoticon] assign[=] call[name[EMOTICON]][call[name[log]][constant[status]]] ...
keyword[def] identifier[log_html] ( identifier[self] , identifier[log] )-> identifier[str] : literal[string] keyword[if] keyword[not] identifier[self] . identifier[omit_loglevel] ( identifier[log] [ literal[string] ]): identifier[emoticon] = identifier[EMOTICON] [ identifier[log] [ l...
def log_html(self, log) -> str: """Return single check sub-result string as HTML or not if below log level.""" if not self.omit_loglevel(log['status']): emoticon = EMOTICON[log['status']] status = log['status'] message = html.escape(log['message']).replace('\n', '<br/>') ...
def all(self): """All results""" all = list(self) if self._results_cache: return iter(self._results_cache) return all
def function[all, parameter[self]]: constant[All results] variable[all] assign[=] call[name[list], parameter[name[self]]] if name[self]._results_cache begin[:] return[call[name[iter], parameter[name[self]._results_cache]]] return[name[all]]
keyword[def] identifier[all] ( identifier[self] ): literal[string] identifier[all] = identifier[list] ( identifier[self] ) keyword[if] identifier[self] . identifier[_results_cache] : keyword[return] identifier[iter] ( identifier[self] . identifier[_results_cache] ) ...
def all(self): """All results""" all = list(self) if self._results_cache: return iter(self._results_cache) # depends on [control=['if'], data=[]] return all
def cancel(self): """ stops the timer. call_back function is not called """ self.event.clear() if self.__timer is not None: self.__timer.cancel()
def function[cancel, parameter[self]]: constant[ stops the timer. call_back function is not called ] call[name[self].event.clear, parameter[]] if compare[name[self].__timer is_not constant[None]] begin[:] call[name[self].__timer.cancel, parameter[]]
keyword[def] identifier[cancel] ( identifier[self] ): literal[string] identifier[self] . identifier[event] . identifier[clear] () keyword[if] identifier[self] . identifier[__timer] keyword[is] keyword[not] keyword[None] : identifier[self] . identifier[__timer] . identifier...
def cancel(self): """ stops the timer. call_back function is not called """ self.event.clear() if self.__timer is not None: self.__timer.cancel() # depends on [control=['if'], data=[]]
def write(self, filename=None): """Write array to xvg file *filename* in NXY format. .. Note:: Only plain files working at the moment, not compressed. """ self._init_filename(filename) with utilities.openany(self.real_filename, 'w') as xvg: xvg.write("# xmgrace compa...
def function[write, parameter[self, filename]]: constant[Write array to xvg file *filename* in NXY format. .. Note:: Only plain files working at the moment, not compressed. ] call[name[self]._init_filename, parameter[name[filename]]] with call[name[utilities].openany, parameter[...
keyword[def] identifier[write] ( identifier[self] , identifier[filename] = keyword[None] ): literal[string] identifier[self] . identifier[_init_filename] ( identifier[filename] ) keyword[with] identifier[utilities] . identifier[openany] ( identifier[self] . identifier[real_filename] , lit...
def write(self, filename=None): """Write array to xvg file *filename* in NXY format. .. Note:: Only plain files working at the moment, not compressed. """ self._init_filename(filename) with utilities.openany(self.real_filename, 'w') as xvg: xvg.write('# xmgrace compatible NXY data f...
def recursive_unicode(obj): """Walks a simple data structure, converting byte strings to unicode. Supports lists, tuples, and dictionaries. """ if isinstance(obj, dict): return dict((recursive_unicode(k), recursive_unicode(v)) for (k,v) in obj.iteritems()) elif isinstance(obj, list): ...
def function[recursive_unicode, parameter[obj]]: constant[Walks a simple data structure, converting byte strings to unicode. Supports lists, tuples, and dictionaries. ] if call[name[isinstance], parameter[name[obj], name[dict]]] begin[:] return[call[name[dict], parameter[<ast.GeneratorE...
keyword[def] identifier[recursive_unicode] ( identifier[obj] ): literal[string] keyword[if] identifier[isinstance] ( identifier[obj] , identifier[dict] ): keyword[return] identifier[dict] (( identifier[recursive_unicode] ( identifier[k] ), identifier[recursive_unicode] ( identifier[v] )) keyword...
def recursive_unicode(obj): """Walks a simple data structure, converting byte strings to unicode. Supports lists, tuples, and dictionaries. """ if isinstance(obj, dict): return dict(((recursive_unicode(k), recursive_unicode(v)) for (k, v) in obj.iteritems())) # depends on [control=['if'], data...
def create(self, create_missing=None): """Manually fetch a complete set of attributes for this entity. For more information, see `Bugzilla #1449749 <https://bugzilla.redhat.com/show_bug.cgi?id=1449749>`_. """ return Host( self._server_config, id=self.crea...
def function[create, parameter[self, create_missing]]: constant[Manually fetch a complete set of attributes for this entity. For more information, see `Bugzilla #1449749 <https://bugzilla.redhat.com/show_bug.cgi?id=1449749>`_. ] return[call[call[name[Host], parameter[name[self]._ser...
keyword[def] identifier[create] ( identifier[self] , identifier[create_missing] = keyword[None] ): literal[string] keyword[return] identifier[Host] ( identifier[self] . identifier[_server_config] , identifier[id] = identifier[self] . identifier[create_json] ( identifier[create_mi...
def create(self, create_missing=None): """Manually fetch a complete set of attributes for this entity. For more information, see `Bugzilla #1449749 <https://bugzilla.redhat.com/show_bug.cgi?id=1449749>`_. """ return Host(self._server_config, id=self.create_json(create_missing)['id']).re...
def assigned_librefs(self): """ This method returns the list of currently assigned librefs """ code = """ data _null_; retain libref; retain cobs 1; set sashelp.vlibnam end=last; if cobs EQ 1 then put "LIBREFSSTART"; cobs = 2; ...
def function[assigned_librefs, parameter[self]]: constant[ This method returns the list of currently assigned librefs ] variable[code] assign[=] constant[ data _null_; retain libref; retain cobs 1; set sashelp.vlibnam end=last; if cobs EQ 1 then ...
keyword[def] identifier[assigned_librefs] ( identifier[self] ): literal[string] identifier[code] = literal[string] keyword[if] identifier[self] . identifier[nosub] : identifier[print] ( identifier[code] ) keyword[return] keyword[None] keyword[else] ...
def assigned_librefs(self): """ This method returns the list of currently assigned librefs """ code = '\n data _null_; retain libref; retain cobs 1; \n set sashelp.vlibnam end=last;\n if cobs EQ 1 then\n put "LIBREFSSTART";\n cobs = 2;\n ...
def map_throats(self, throats, origin, filtered=True): r""" Given a list of throats on a target object, finds indices of those throats on the calling object Parameters ---------- throats : array_like The indices of the throats on the object specified in ``ori...
def function[map_throats, parameter[self, throats, origin, filtered]]: constant[ Given a list of throats on a target object, finds indices of those throats on the calling object Parameters ---------- throats : array_like The indices of the throats on the obje...
keyword[def] identifier[map_throats] ( identifier[self] , identifier[throats] , identifier[origin] , identifier[filtered] = keyword[True] ): literal[string] identifier[ids] = identifier[origin] [ literal[string] ][ identifier[throats] ] keyword[return] identifier[self] . identifier[_map] ...
def map_throats(self, throats, origin, filtered=True): """ Given a list of throats on a target object, finds indices of those throats on the calling object Parameters ---------- throats : array_like The indices of the throats on the object specified in ``origin``...
def diff_missed_lines(self, filename): """ Return a list of 2-element tuples `(lineno, is_new)` for the given file `filename` where `lineno` is a missed line number and `is_new` indicates whether the missed line was introduced (True) or removed (False). """ line_c...
def function[diff_missed_lines, parameter[self, filename]]: constant[ Return a list of 2-element tuples `(lineno, is_new)` for the given file `filename` where `lineno` is a missed line number and `is_new` indicates whether the missed line was introduced (True) or removed (False)....
keyword[def] identifier[diff_missed_lines] ( identifier[self] , identifier[filename] ): literal[string] identifier[line_changed] =[] keyword[for] identifier[line] keyword[in] identifier[self] . identifier[file_source] ( identifier[filename] ): keyword[if] identifier[line] ...
def diff_missed_lines(self, filename): """ Return a list of 2-element tuples `(lineno, is_new)` for the given file `filename` where `lineno` is a missed line number and `is_new` indicates whether the missed line was introduced (True) or removed (False). """ line_changed =...
def Animation_resolveAnimation(self, animationId): """ Function path: Animation.resolveAnimation Domain: Animation Method name: resolveAnimation Parameters: Required arguments: 'animationId' (type: string) -> Animation id. Returns: 'remoteObject' (type: Runtime.RemoteObject) -> Correspon...
def function[Animation_resolveAnimation, parameter[self, animationId]]: constant[ Function path: Animation.resolveAnimation Domain: Animation Method name: resolveAnimation Parameters: Required arguments: 'animationId' (type: string) -> Animation id. Returns: 'remoteObject' (type: R...
keyword[def] identifier[Animation_resolveAnimation] ( identifier[self] , identifier[animationId] ): literal[string] keyword[assert] identifier[isinstance] ( identifier[animationId] ,( identifier[str] ,) ), literal[string] % identifier[type] ( identifier[animationId] ) identifier[subdom_funcs] = identi...
def Animation_resolveAnimation(self, animationId): """ Function path: Animation.resolveAnimation Domain: Animation Method name: resolveAnimation Parameters: Required arguments: 'animationId' (type: string) -> Animation id. Returns: 'remoteObject' (type: Runtime.RemoteObject) -> Corresp...
def _align_intervals(int_hier, lab_hier, t_min=0.0, t_max=None): '''Align a hierarchical annotation to span a fixed start and end time. Parameters ---------- int_hier : list of list of intervals lab_hier : list of list of str Hierarchical segment annotations, encoded as a list of li...
def function[_align_intervals, parameter[int_hier, lab_hier, t_min, t_max]]: constant[Align a hierarchical annotation to span a fixed start and end time. Parameters ---------- int_hier : list of list of intervals lab_hier : list of list of str Hierarchical segment annotations, encoded a...
keyword[def] identifier[_align_intervals] ( identifier[int_hier] , identifier[lab_hier] , identifier[t_min] = literal[int] , identifier[t_max] = keyword[None] ): literal[string] keyword[return] [ identifier[list] ( identifier[_] ) keyword[for] identifier[_] keyword[in] identifier[zip] (*[ identifier[uti...
def _align_intervals(int_hier, lab_hier, t_min=0.0, t_max=None): """Align a hierarchical annotation to span a fixed start and end time. Parameters ---------- int_hier : list of list of intervals lab_hier : list of list of str Hierarchical segment annotations, encoded as a list of li...
def validator(flag_name, message='Flag validation failed', flag_values=_flagvalues.FLAGS): """A function decorator for defining a flag validator. Registers the decorated function as a validator for flag_name, e.g. @flags.validator('foo') def _CheckFoo(foo): ... See register_validator() fo...
def function[validator, parameter[flag_name, message, flag_values]]: constant[A function decorator for defining a flag validator. Registers the decorated function as a validator for flag_name, e.g. @flags.validator('foo') def _CheckFoo(foo): ... See register_validator() for the specification of c...
keyword[def] identifier[validator] ( identifier[flag_name] , identifier[message] = literal[string] , identifier[flag_values] = identifier[_flagvalues] . identifier[FLAGS] ): literal[string] keyword[def] identifier[decorate] ( identifier[function] ): identifier[register_validator] ( identifier[flag_name...
def validator(flag_name, message='Flag validation failed', flag_values=_flagvalues.FLAGS): """A function decorator for defining a flag validator. Registers the decorated function as a validator for flag_name, e.g. @flags.validator('foo') def _CheckFoo(foo): ... See register_validator() for the specif...
def generate_data(shp=[16, 20, 24]): """ Generating data """ x = np.ones(shp) # inserting box x[4:-4, 6:-2, 1:-6] = -1 x_noisy = x + np.random.normal(0, 0.6, size=x.shape) return x_noisy
def function[generate_data, parameter[shp]]: constant[ Generating data ] variable[x] assign[=] call[name[np].ones, parameter[name[shp]]] call[name[x]][tuple[[<ast.Slice object at 0x7da1b271f7f0>, <ast.Slice object at 0x7da1b271c640>, <ast.Slice object at 0x7da1b271cfa0>]]] assign[=] <ast.UnaryOp...
keyword[def] identifier[generate_data] ( identifier[shp] =[ literal[int] , literal[int] , literal[int] ]): literal[string] identifier[x] = identifier[np] . identifier[ones] ( identifier[shp] ) identifier[x] [ literal[int] :- literal[int] , literal[int] :- literal[int] , literal[int] :- lite...
def generate_data(shp=[16, 20, 24]): """ Generating data """ x = np.ones(shp) # inserting box x[4:-4, 6:-2, 1:-6] = -1 x_noisy = x + np.random.normal(0, 0.6, size=x.shape) return x_noisy
def map(self, *args): """maps the function onto multiple inputs. The input should be multiple sequences. The sequences will be zipped together forming the positional arguments for the call. This is equivalent to map(func, ...) but is executed with a single network call.""" call_args = [self._map_args...
def function[map, parameter[self]]: constant[maps the function onto multiple inputs. The input should be multiple sequences. The sequences will be zipped together forming the positional arguments for the call. This is equivalent to map(func, ...) but is executed with a single network call.] variable[...
keyword[def] identifier[map] ( identifier[self] ,* identifier[args] ): literal[string] identifier[call_args] =[ identifier[self] . identifier[_map_args] (* identifier[cur_args] ) keyword[for] identifier[cur_args] keyword[in] identifier[zip] (* identifier[args] )] identifier[r] = identif...
def map(self, *args): """maps the function onto multiple inputs. The input should be multiple sequences. The sequences will be zipped together forming the positional arguments for the call. This is equivalent to map(func, ...) but is executed with a single network call.""" call_args = [self._map_args(*cur_ar...
def getstruct(self, msgid, as_json=False, stream=sys.stdout): """Get and print the whole message. as_json indicates whether to print the part list as JSON or not. """ parts = [part.get_content_type() for hdr, part in self._get(msgid)] if as_json: print(json.dumps(par...
def function[getstruct, parameter[self, msgid, as_json, stream]]: constant[Get and print the whole message. as_json indicates whether to print the part list as JSON or not. ] variable[parts] assign[=] <ast.ListComp object at 0x7da18c4ce260> if name[as_json] begin[:] ...
keyword[def] identifier[getstruct] ( identifier[self] , identifier[msgid] , identifier[as_json] = keyword[False] , identifier[stream] = identifier[sys] . identifier[stdout] ): literal[string] identifier[parts] =[ identifier[part] . identifier[get_content_type] () keyword[for] identifier[hdr] , ide...
def getstruct(self, msgid, as_json=False, stream=sys.stdout): """Get and print the whole message. as_json indicates whether to print the part list as JSON or not. """ parts = [part.get_content_type() for (hdr, part) in self._get(msgid)] if as_json: print(json.dumps(parts), file=stre...
def reparse_local_options(self): """ Re-parse the leftover command-line options stored in self.largs, so that any value overridden on the command line is immediately available if the user turns around and does a GetOption() right away. We mimic the processing of ...
def function[reparse_local_options, parameter[self]]: constant[ Re-parse the leftover command-line options stored in self.largs, so that any value overridden on the command line is immediately available if the user turns around and does a GetOption() right away. ...
keyword[def] identifier[reparse_local_options] ( identifier[self] ): literal[string] identifier[rargs] =[] identifier[largs_restore] =[] identifier[skip] = keyword[False] keyword[for] identifier[l] keyword[in] identifier[self] . identifier[largs] : ...
def reparse_local_options(self): """ Re-parse the leftover command-line options stored in self.largs, so that any value overridden on the command line is immediately available if the user turns around and does a GetOption() right away. We mimic the processing of the ...
def byteswap(input,output=None,clobber=True): """Input GEIS files "input" will be read and converted to a new GEIS file whose byte-order has been swapped from its original state. Parameters ---------- input - str Full filename with path of input GEIS image header file output - str ...
def function[byteswap, parameter[input, output, clobber]]: constant[Input GEIS files "input" will be read and converted to a new GEIS file whose byte-order has been swapped from its original state. Parameters ---------- input - str Full filename with path of input GEIS image header file...
keyword[def] identifier[byteswap] ( identifier[input] , identifier[output] = keyword[None] , identifier[clobber] = keyword[True] ): literal[string] keyword[global] identifier[dat] identifier[cardLen] = identifier[fits] . identifier[Card] . identifier[length] keyword[if] identifier[inp...
def byteswap(input, output=None, clobber=True): """Input GEIS files "input" will be read and converted to a new GEIS file whose byte-order has been swapped from its original state. Parameters ---------- input - str Full filename with path of input GEIS image header file output - str ...
def destroy_ssh_key(self, ssh_key_id): """ This method will delete the SSH key from your account. """ json = self.request('/ssh_keys/%s/destroy' % ssh_key_id, method='GET') status = json.get('status') return status
def function[destroy_ssh_key, parameter[self, ssh_key_id]]: constant[ This method will delete the SSH key from your account. ] variable[json] assign[=] call[name[self].request, parameter[binary_operation[constant[/ssh_keys/%s/destroy] <ast.Mod object at 0x7da2590d6920> name[ssh_key_id]]]...
keyword[def] identifier[destroy_ssh_key] ( identifier[self] , identifier[ssh_key_id] ): literal[string] identifier[json] = identifier[self] . identifier[request] ( literal[string] % identifier[ssh_key_id] , identifier[method] = literal[string] ) identifier[status] = identifier[json] . iden...
def destroy_ssh_key(self, ssh_key_id): """ This method will delete the SSH key from your account. """ json = self.request('/ssh_keys/%s/destroy' % ssh_key_id, method='GET') status = json.get('status') return status
def route_directions(self, rt): """ Return a list of directions for a route. The directions seem to always be INBOUND and OUTBOUND for the busses currently, where INBOUND is towards downtown and OUTBOUND is away from downtown. (No idea if this is going to change.) ...
def function[route_directions, parameter[self, rt]]: constant[ Return a list of directions for a route. The directions seem to always be INBOUND and OUTBOUND for the busses currently, where INBOUND is towards downtown and OUTBOUND is away from downtown. (No idea if this ...
keyword[def] identifier[route_directions] ( identifier[self] , identifier[rt] ): literal[string] identifier[url] = identifier[self] . identifier[endpoint] ( literal[string] , identifier[dict] ( identifier[rt] = identifier[rt] )) keyword[return] identifier[self] . identifier[response] ( id...
def route_directions(self, rt): """ Return a list of directions for a route. The directions seem to always be INBOUND and OUTBOUND for the busses currently, where INBOUND is towards downtown and OUTBOUND is away from downtown. (No idea if this is going to change.) ...
def add_line(preso, x1, y1, x2, y2, width="3pt", color="red"): """ Arrow pointing up to right: context.xml: office:automatic-styles/ <style:style style:name="gr1" style:family="graphic" style:parent-style-name="objectwithoutfill"> <style:graphic-properties draw:marker-end="Arrow" draw:...
def function[add_line, parameter[preso, x1, y1, x2, y2, width, color]]: constant[ Arrow pointing up to right: context.xml: office:automatic-styles/ <style:style style:name="gr1" style:family="graphic" style:parent-style-name="objectwithoutfill"> <style:graphic-properties draw:marker-end=...
keyword[def] identifier[add_line] ( identifier[preso] , identifier[x1] , identifier[y1] , identifier[x2] , identifier[y2] , identifier[width] = literal[string] , identifier[color] = literal[string] ): literal[string] identifier[marker_end_ratio] = literal[int] / literal[int] identifier[marker_start_r...
def add_line(preso, x1, y1, x2, y2, width='3pt', color='red'): """ Arrow pointing up to right: context.xml: office:automatic-styles/ <style:style style:name="gr1" style:family="graphic" style:parent-style-name="objectwithoutfill"> <style:graphic-properties draw:marker-end="Arrow" draw:...
def seal_aes_ctr_legacy(key_service, secret, digest_method=DEFAULT_DIGEST): """ Encrypts `secret` using the key service. You can decrypt with the companion method `open_aes_ctr_legacy`. """ # generate a a 64 byte key. # Half will be for data encryption, the other half for HMAC key, encoded_k...
def function[seal_aes_ctr_legacy, parameter[key_service, secret, digest_method]]: constant[ Encrypts `secret` using the key service. You can decrypt with the companion method `open_aes_ctr_legacy`. ] <ast.Tuple object at 0x7da20c7c80a0> assign[=] call[name[key_service].generate_key_data, par...
keyword[def] identifier[seal_aes_ctr_legacy] ( identifier[key_service] , identifier[secret] , identifier[digest_method] = identifier[DEFAULT_DIGEST] ): literal[string] identifier[key] , identifier[encoded_key] = identifier[key_service] . identifier[generate_key_data] ( literal[int] ) identif...
def seal_aes_ctr_legacy(key_service, secret, digest_method=DEFAULT_DIGEST): """ Encrypts `secret` using the key service. You can decrypt with the companion method `open_aes_ctr_legacy`. """ # generate a a 64 byte key. # Half will be for data encryption, the other half for HMAC (key, encoded_...
def process_pem_rsakey(self, data, name, idx): """ Processes PEM encoded RSA key :param data: :param name: :param idx: :return: """ from cryptography.hazmat.primitives.serialization import load_der_public_key from cryptography.hazmat.primitives.ser...
def function[process_pem_rsakey, parameter[self, data, name, idx]]: constant[ Processes PEM encoded RSA key :param data: :param name: :param idx: :return: ] from relative_module[cryptography.hazmat.primitives.serialization] import module[load_der_public_key] ...
keyword[def] identifier[process_pem_rsakey] ( identifier[self] , identifier[data] , identifier[name] , identifier[idx] ): literal[string] keyword[from] identifier[cryptography] . identifier[hazmat] . identifier[primitives] . identifier[serialization] keyword[import] identifier[load_der_public_ke...
def process_pem_rsakey(self, data, name, idx): """ Processes PEM encoded RSA key :param data: :param name: :param idx: :return: """ from cryptography.hazmat.primitives.serialization import load_der_public_key from cryptography.hazmat.primitives.serialization i...
def initialize(self, num_of_paths=None, grid=None, seed=None): """initialize StackedConsumer""" super(StackedConsumer, self).initialize(grid, num_of_paths, seed) for c in self.consumers: c.initialize(grid, num_of_paths, seed) self.state = [c.state for c in self.consumers]
def function[initialize, parameter[self, num_of_paths, grid, seed]]: constant[initialize StackedConsumer] call[call[name[super], parameter[name[StackedConsumer], name[self]]].initialize, parameter[name[grid], name[num_of_paths], name[seed]]] for taget[name[c]] in starred[name[self].consumers] be...
keyword[def] identifier[initialize] ( identifier[self] , identifier[num_of_paths] = keyword[None] , identifier[grid] = keyword[None] , identifier[seed] = keyword[None] ): literal[string] identifier[super] ( identifier[StackedConsumer] , identifier[self] ). identifier[initialize] ( identifier[grid] ...
def initialize(self, num_of_paths=None, grid=None, seed=None): """initialize StackedConsumer""" super(StackedConsumer, self).initialize(grid, num_of_paths, seed) for c in self.consumers: c.initialize(grid, num_of_paths, seed) # depends on [control=['for'], data=['c']] self.state = [c.state for ...
def in_channels(m:nn.Module) -> List[int]: "Return the shape of the first weight layer in `m`." for l in flatten_model(m): if hasattr(l, 'weight'): return l.weight.shape[1] raise Exception('No weight layer')
def function[in_channels, parameter[m]]: constant[Return the shape of the first weight layer in `m`.] for taget[name[l]] in starred[call[name[flatten_model], parameter[name[m]]]] begin[:] if call[name[hasattr], parameter[name[l], constant[weight]]] begin[:] return[call[name[l...
keyword[def] identifier[in_channels] ( identifier[m] : identifier[nn] . identifier[Module] )-> identifier[List] [ identifier[int] ]: literal[string] keyword[for] identifier[l] keyword[in] identifier[flatten_model] ( identifier[m] ): keyword[if] identifier[hasattr] ( identifier[l] , literal[str...
def in_channels(m: nn.Module) -> List[int]: """Return the shape of the first weight layer in `m`.""" for l in flatten_model(m): if hasattr(l, 'weight'): return l.weight.shape[1] # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['l']] raise Exception('No weight...
def scan_volumes(cryst, lo=0.98, hi=1.02, n=5, scale_volumes=True): ''' Provide set of crystals along volume axis from lo to hi (inclusive). No volume cell optimization is performed. Bounds are specified as fractions (1.10 = 10% increase). If scale_volumes==False the scalling is applied to lattice v...
def function[scan_volumes, parameter[cryst, lo, hi, n, scale_volumes]]: constant[ Provide set of crystals along volume axis from lo to hi (inclusive). No volume cell optimization is performed. Bounds are specified as fractions (1.10 = 10% increase). If scale_volumes==False the scalling is applie...
keyword[def] identifier[scan_volumes] ( identifier[cryst] , identifier[lo] = literal[int] , identifier[hi] = literal[int] , identifier[n] = literal[int] , identifier[scale_volumes] = keyword[True] ): literal[string] identifier[scale] = identifier[linspace] ( identifier[lo] , identifier[hi] , identifier[num...
def scan_volumes(cryst, lo=0.98, hi=1.02, n=5, scale_volumes=True): """ Provide set of crystals along volume axis from lo to hi (inclusive). No volume cell optimization is performed. Bounds are specified as fractions (1.10 = 10% increase). If scale_volumes==False the scalling is applied to lattice v...
def record_received(self, msg): """Handle ALDB record received from device.""" release_lock = False userdata = msg.userdata rec = ALDBRecord.create_from_userdata(userdata) self._records[rec.mem_addr] = rec _LOGGER.debug('ALDB Record: %s', rec) rec_count = self._...
def function[record_received, parameter[self, msg]]: constant[Handle ALDB record received from device.] variable[release_lock] assign[=] constant[False] variable[userdata] assign[=] name[msg].userdata variable[rec] assign[=] call[name[ALDBRecord].create_from_userdata, parameter[name[user...
keyword[def] identifier[record_received] ( identifier[self] , identifier[msg] ): literal[string] identifier[release_lock] = keyword[False] identifier[userdata] = identifier[msg] . identifier[userdata] identifier[rec] = identifier[ALDBRecord] . identifier[create_from_userdata] ( ...
def record_received(self, msg): """Handle ALDB record received from device.""" release_lock = False userdata = msg.userdata rec = ALDBRecord.create_from_userdata(userdata) self._records[rec.mem_addr] = rec _LOGGER.debug('ALDB Record: %s', rec) rec_count = self._load_action.rec_count if r...
def JMS_to_Fierz_lep(C, ddll): """From JMS to semileptonic Fierz basis for Class V. `ddll` should be of the form 'sbl_enu_tau', 'dbl_munu_e' etc.""" if ddll[:2] == 'uc': s = uflav[ddll[0]] b = uflav[ddll[1]] q = 'u' else: s = dflav[ddll[0]] b = dflav[ddll[1]] ...
def function[JMS_to_Fierz_lep, parameter[C, ddll]]: constant[From JMS to semileptonic Fierz basis for Class V. `ddll` should be of the form 'sbl_enu_tau', 'dbl_munu_e' etc.] if compare[call[name[ddll]][<ast.Slice object at 0x7da1b1991360>] equal[==] constant[uc]] begin[:] variable[s]...
keyword[def] identifier[JMS_to_Fierz_lep] ( identifier[C] , identifier[ddll] ): literal[string] keyword[if] identifier[ddll] [: literal[int] ]== literal[string] : identifier[s] = identifier[uflav] [ identifier[ddll] [ literal[int] ]] identifier[b] = identifier[uflav] [ identifier[ddll] [...
def JMS_to_Fierz_lep(C, ddll): """From JMS to semileptonic Fierz basis for Class V. `ddll` should be of the form 'sbl_enu_tau', 'dbl_munu_e' etc.""" if ddll[:2] == 'uc': s = uflav[ddll[0]] b = uflav[ddll[1]] q = 'u' # depends on [control=['if'], data=[]] else: s = dflav[...
def assign_per_atom_sasa(self): """Make a dictionary with SASA assigned to each ligand atom, stored as list of SASA values over the simulation time.""" atom_names= [atom.name for atom in self.topology_data.universe.ligand_noH.atoms] sasa_dict = {} for atom in range(0,self.topology_data.universe.ligand_noH.n_a...
def function[assign_per_atom_sasa, parameter[self]]: constant[Make a dictionary with SASA assigned to each ligand atom, stored as list of SASA values over the simulation time.] variable[atom_names] assign[=] <ast.ListComp object at 0x7da18bc72a70> variable[sasa_dict] assign[=] dictionary[[], [...
keyword[def] identifier[assign_per_atom_sasa] ( identifier[self] ): literal[string] identifier[atom_names] =[ identifier[atom] . identifier[name] keyword[for] identifier[atom] keyword[in] identifier[self] . identifier[topology_data] . identifier[universe] . identifier[ligand_noH] . identifier[atoms] ] i...
def assign_per_atom_sasa(self): """Make a dictionary with SASA assigned to each ligand atom, stored as list of SASA values over the simulation time.""" atom_names = [atom.name for atom in self.topology_data.universe.ligand_noH.atoms] sasa_dict = {} for atom in range(0, self.topology_data.universe.liga...