code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def _compute_gradients(self, loss_fn, x, unused_optim_state): """Compute a new value of `x` to minimize `loss_fn`. Args: loss_fn: a callable that takes `x`, a batch of images, and returns a batch of loss values. `x` will be optimized to minimize `loss_fn(x)`. x: A list o...
def function[_compute_gradients, parameter[self, loss_fn, x, unused_optim_state]]: constant[Compute a new value of `x` to minimize `loss_fn`. Args: loss_fn: a callable that takes `x`, a batch of images, and returns a batch of loss values. `x` will be optimized to minimize `l...
keyword[def] identifier[_compute_gradients] ( identifier[self] , identifier[loss_fn] , identifier[x] , identifier[unused_optim_state] ): literal[string] keyword[assert] identifier[len] ( identifier[x] )== literal[int] keyword[and] identifier[isinstance] ( identifier[x] , identifier[list] ), l...
def _compute_gradients(self, loss_fn, x, unused_optim_state): """Compute a new value of `x` to minimize `loss_fn`. Args: loss_fn: a callable that takes `x`, a batch of images, and returns a batch of loss values. `x` will be optimized to minimize `loss_fn(x)`. x: A list o...
def tile(lt, width=70, gap=1): """ Pretty print list of items. """ from jcvi.utils.iter import grouper max_len = max(len(x) for x in lt) + gap items_per_line = max(width // max_len, 1) lt = [x.rjust(max_len) for x in lt] g = list(grouper(lt, items_per_line, fillvalue="")) return "\...
def function[tile, parameter[lt, width, gap]]: constant[ Pretty print list of items. ] from relative_module[jcvi.utils.iter] import module[grouper] variable[max_len] assign[=] binary_operation[call[name[max], parameter[<ast.GeneratorExp object at 0x7da204622da0>]] + name[gap]] variab...
keyword[def] identifier[tile] ( identifier[lt] , identifier[width] = literal[int] , identifier[gap] = literal[int] ): literal[string] keyword[from] identifier[jcvi] . identifier[utils] . identifier[iter] keyword[import] identifier[grouper] identifier[max_len] = identifier[max] ( identifier[len] (...
def tile(lt, width=70, gap=1): """ Pretty print list of items. """ from jcvi.utils.iter import grouper max_len = max((len(x) for x in lt)) + gap items_per_line = max(width // max_len, 1) lt = [x.rjust(max_len) for x in lt] g = list(grouper(lt, items_per_line, fillvalue='')) return '\...
def batch_taxids(list_of_names): """ Opposite of batch_taxonomy(): Convert list of Latin names to taxids """ for name in list_of_names: handle = Entrez.esearch(db='Taxonomy', term=name, retmode="xml") records = Entrez.read(handle) yield records["IdList"][0]
def function[batch_taxids, parameter[list_of_names]]: constant[ Opposite of batch_taxonomy(): Convert list of Latin names to taxids ] for taget[name[name]] in starred[name[list_of_names]] begin[:] variable[handle] assign[=] call[name[Entrez].esearch, parameter[]] ...
keyword[def] identifier[batch_taxids] ( identifier[list_of_names] ): literal[string] keyword[for] identifier[name] keyword[in] identifier[list_of_names] : identifier[handle] = identifier[Entrez] . identifier[esearch] ( identifier[db] = literal[string] , identifier[term] = identifier[name] , ide...
def batch_taxids(list_of_names): """ Opposite of batch_taxonomy(): Convert list of Latin names to taxids """ for name in list_of_names: handle = Entrez.esearch(db='Taxonomy', term=name, retmode='xml') records = Entrez.read(handle) yield records['IdList'][0] # depends on [co...
def setStateCodes(self): """ Generates (sorted) codes for the states in the statespace This is used to quickly identify which states occur after a transition/action """ #calculate the statespace and determine the minima and maxima each element in the state ve...
def function[setStateCodes, parameter[self]]: constant[ Generates (sorted) codes for the states in the statespace This is used to quickly identify which states occur after a transition/action ] variable[statespace] assign[=] call[name[self].statespace, parameter[]...
keyword[def] identifier[setStateCodes] ( identifier[self] ): literal[string] identifier[statespace] = identifier[self] . identifier[statespace] () identifier[self] . identifier[minvalues] = identifier[np] . identifier[amin] ( identifier[statespace] , identifier[axis] = literal[in...
def setStateCodes(self): """ Generates (sorted) codes for the states in the statespace This is used to quickly identify which states occur after a transition/action """ #calculate the statespace and determine the minima and maxima each element in the state vector st...
def delete_user(self, auth, username): """ Deletes the user with username ``username``. Should only be called if the to-be-deleted user has no repositories. :param auth.Authentication auth: authentication object, must be admin-level :param str username: username of user to delet...
def function[delete_user, parameter[self, auth, username]]: constant[ Deletes the user with username ``username``. Should only be called if the to-be-deleted user has no repositories. :param auth.Authentication auth: authentication object, must be admin-level :param str username...
keyword[def] identifier[delete_user] ( identifier[self] , identifier[auth] , identifier[username] ): literal[string] identifier[path] = literal[string] . identifier[format] ( identifier[username] ) identifier[self] . identifier[delete] ( identifier[path] , identifier[auth] = identifier[aut...
def delete_user(self, auth, username): """ Deletes the user with username ``username``. Should only be called if the to-be-deleted user has no repositories. :param auth.Authentication auth: authentication object, must be admin-level :param str username: username of user to delete ...
def fix_config(self, options): """ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary. :param options: the options to fix :type options: dict :return: the (potentially) fixed options :rtype: dict """ options = super(Con...
def function[fix_config, parameter[self, options]]: constant[ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary. :param options: the options to fix :type options: dict :return: the (potentially) fixed options :rtype: dict ] ...
keyword[def] identifier[fix_config] ( identifier[self] , identifier[options] ): literal[string] identifier[options] = identifier[super] ( identifier[ContainerValuePicker] , identifier[self] ). identifier[fix_config] ( identifier[options] ) identifier[opt] = literal[string] keywo...
def fix_config(self, options): """ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary. :param options: the options to fix :type options: dict :return: the (potentially) fixed options :rtype: dict """ options = super(ContainerVa...
def update_script(self, script_body): """ Updates the configuration script of the enclosure-group with the specified URI. Args: id_or_uri: Resource id or resource uri. script_body: Configuration script. Returns: dict: Updated enclosure group. ...
def function[update_script, parameter[self, script_body]]: constant[ Updates the configuration script of the enclosure-group with the specified URI. Args: id_or_uri: Resource id or resource uri. script_body: Configuration script. Returns: dict: Upda...
keyword[def] identifier[update_script] ( identifier[self] , identifier[script_body] ): literal[string] identifier[uri] = literal[string] . identifier[format] ( identifier[self] . identifier[data] [ literal[string] ]) keyword[return] identifier[self] . identifier[_helper] . identifier[upd...
def update_script(self, script_body): """ Updates the configuration script of the enclosure-group with the specified URI. Args: id_or_uri: Resource id or resource uri. script_body: Configuration script. Returns: dict: Updated enclosure group. ""...
def build_hypo_list_node(hypo_list): """ :param hypo_list: an array of shape (N, 3) with columns (alongStrike, downDip, weight) :returns: a hypoList node containing N hypo nodes """ hypolist = Node('hypoList', {}) for row in hypo_list: n = Node( 'hypo', dict(al...
def function[build_hypo_list_node, parameter[hypo_list]]: constant[ :param hypo_list: an array of shape (N, 3) with columns (alongStrike, downDip, weight) :returns: a hypoList node containing N hypo nodes ] variable[hypolist] assign[=] call[name[Node], parameter[constant[hypoL...
keyword[def] identifier[build_hypo_list_node] ( identifier[hypo_list] ): literal[string] identifier[hypolist] = identifier[Node] ( literal[string] ,{}) keyword[for] identifier[row] keyword[in] identifier[hypo_list] : identifier[n] = identifier[Node] ( literal[string] , identifier[...
def build_hypo_list_node(hypo_list): """ :param hypo_list: an array of shape (N, 3) with columns (alongStrike, downDip, weight) :returns: a hypoList node containing N hypo nodes """ hypolist = Node('hypoList', {}) for row in hypo_list: n = Node('hypo', dict(alongStrike=row...
def is_subgroup(self, supergroup): """ True if this group is a subgroup of the supplied group. Args: supergroup (SymmetryGroup): Supergroup to test. Returns: True if this group is a subgroup of the supplied group. """ warnings.warn("This is not f...
def function[is_subgroup, parameter[self, supergroup]]: constant[ True if this group is a subgroup of the supplied group. Args: supergroup (SymmetryGroup): Supergroup to test. Returns: True if this group is a subgroup of the supplied group. ] cal...
keyword[def] identifier[is_subgroup] ( identifier[self] , identifier[supergroup] ): literal[string] identifier[warnings] . identifier[warn] ( literal[string] ) keyword[return] identifier[set] ( identifier[self] . identifier[symmetry_ops] ). identifier[issubset] ( identifier[supergroup] . ...
def is_subgroup(self, supergroup): """ True if this group is a subgroup of the supplied group. Args: supergroup (SymmetryGroup): Supergroup to test. Returns: True if this group is a subgroup of the supplied group. """ warnings.warn('This is not fully fun...
def minimise_tables(routing_tables, target_lengths, methods=(remove_default_entries, ordered_covering)): """Utility function which attempts to minimises routing tables for multiple chips. For each routing table supplied, this function will attempt to use the minimisation algorithms ...
def function[minimise_tables, parameter[routing_tables, target_lengths, methods]]: constant[Utility function which attempts to minimises routing tables for multiple chips. For each routing table supplied, this function will attempt to use the minimisation algorithms given (or some sensible default ...
keyword[def] identifier[minimise_tables] ( identifier[routing_tables] , identifier[target_lengths] , identifier[methods] =( identifier[remove_default_entries] , identifier[ordered_covering] )): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[target_lengths] , identifier...
def minimise_tables(routing_tables, target_lengths, methods=(remove_default_entries, ordered_covering)): """Utility function which attempts to minimises routing tables for multiple chips. For each routing table supplied, this function will attempt to use the minimisation algorithms given (or some sensi...
def get_atten(self, idx=0): """This function returns the current attenuation from an attenuator at a given index in the instrument. Args: idx: This zero-based index is the identifier for a particular attenuator in an instrument. Raises: Error: Th...
def function[get_atten, parameter[self, idx]]: constant[This function returns the current attenuation from an attenuator at a given index in the instrument. Args: idx: This zero-based index is the identifier for a particular attenuator in an instrument. Rais...
keyword[def] identifier[get_atten] ( identifier[self] , identifier[idx] = literal[int] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[is_open] : keyword[raise] identifier[attenuator] . identifier[Error] ( literal[string] % identif...
def get_atten(self, idx=0): """This function returns the current attenuation from an attenuator at a given index in the instrument. Args: idx: This zero-based index is the identifier for a particular attenuator in an instrument. Raises: Error: The un...
def calc_empirical_retinotopy(cortex, polar_angle=None, eccentricity=None, pRF_radius=None, weight=None, eccentricity_range=None, weight_min=0, invert_rh_angle=False, partial_voluming_correction=False...
def function[calc_empirical_retinotopy, parameter[cortex, polar_angle, eccentricity, pRF_radius, weight, eccentricity_range, weight_min, invert_rh_angle, partial_voluming_correction]]: constant[ calc_empirical_retinotopy computes the value empirical_retinotopy, which is an itable object storing the re...
keyword[def] identifier[calc_empirical_retinotopy] ( identifier[cortex] , identifier[polar_angle] = keyword[None] , identifier[eccentricity] = keyword[None] , identifier[pRF_radius] = keyword[None] , identifier[weight] = keyword[None] , identifier[eccentricity_range] = keyword[None] , identifier[weight_min] = liter...
def calc_empirical_retinotopy(cortex, polar_angle=None, eccentricity=None, pRF_radius=None, weight=None, eccentricity_range=None, weight_min=0, invert_rh_angle=False, partial_voluming_correction=False): """ calc_empirical_retinotopy computes the value empirical_retinotopy, which is an itable object storin...
def grep(path, pattern, *opts): ''' Grep for a string in the specified file .. note:: This function's return value is slated for refinement in future versions of Salt path Path to the file to be searched .. note:: Globbing is supported (i....
def function[grep, parameter[path, pattern]]: constant[ Grep for a string in the specified file .. note:: This function's return value is slated for refinement in future versions of Salt path Path to the file to be searched .. note:: Globbing is support...
keyword[def] identifier[grep] ( identifier[path] , identifier[pattern] , * identifier[opts] ): literal[string] identifier[path] = identifier[os] . identifier[path] . identifier[expanduser] ( identifier[path] ) identifier[_path] = identifier[path] identifier[path] = identifier[glob] . iden...
def grep(path, pattern, *opts): """ Grep for a string in the specified file .. note:: This function's return value is slated for refinement in future versions of Salt path Path to the file to be searched .. note:: Globbing is supported (i.e. ``/var/log/foo/...
def get_context_data(self, **kwargs): """ Adds available urls and names. """ context = super(CRUDMixin, self).get_context_data(**kwargs) context.update({ 'model_verbose_name': self.model._meta.verbose_name, 'model_verbose_name_plural': self.model._meta.ver...
def function[get_context_data, parameter[self]]: constant[ Adds available urls and names. ] variable[context] assign[=] call[call[name[super], parameter[name[CRUDMixin], name[self]]].get_context_data, parameter[]] call[name[context].update, parameter[dictionary[[<ast.Constant obj...
keyword[def] identifier[get_context_data] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[context] = identifier[super] ( identifier[CRUDMixin] , identifier[self] ). identifier[get_context_data] (** identifier[kwargs] ) identifier[context] . identifier[update] ({ ...
def get_context_data(self, **kwargs): """ Adds available urls and names. """ context = super(CRUDMixin, self).get_context_data(**kwargs) context.update({'model_verbose_name': self.model._meta.verbose_name, 'model_verbose_name_plural': self.model._meta.verbose_name_plural}) context['field...
def helioY(self,*args,**kwargs): """ NAME: helioY PURPOSE: return Heliocentric Galactic rectangular y-coordinate (aka "Y") INPUT: t - (optional) time at which to get Y (can be Quantity) obs=[X,Y,Z] - (optional) position and of observer ...
def function[helioY, parameter[self]]: constant[ NAME: helioY PURPOSE: return Heliocentric Galactic rectangular y-coordinate (aka "Y") INPUT: t - (optional) time at which to get Y (can be Quantity) obs=[X,Y,Z] - (optional) position and of...
keyword[def] identifier[helioY] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[out] = identifier[self] . identifier[_orb] . identifier[helioY] (* identifier[args] ,** identifier[kwargs] ) keyword[if] identifier[len] ( identifier[out] )== litera...
def helioY(self, *args, **kwargs): """ NAME: helioY PURPOSE: return Heliocentric Galactic rectangular y-coordinate (aka "Y") INPUT: t - (optional) time at which to get Y (can be Quantity) obs=[X,Y,Z] - (optional) position and of observer ...
def strip_z(pts): """Strips a Z component from `pts` if it is present.""" pts = np.asarray(pts) if pts.shape[-1] > 2: pts = np.asarray((pts.T[0], pts.T[1])).T return pts
def function[strip_z, parameter[pts]]: constant[Strips a Z component from `pts` if it is present.] variable[pts] assign[=] call[name[np].asarray, parameter[name[pts]]] if compare[call[name[pts].shape][<ast.UnaryOp object at 0x7da1b0d0d360>] greater[>] constant[2]] begin[:] variab...
keyword[def] identifier[strip_z] ( identifier[pts] ): literal[string] identifier[pts] = identifier[np] . identifier[asarray] ( identifier[pts] ) keyword[if] identifier[pts] . identifier[shape] [- literal[int] ]> literal[int] : identifier[pts] = identifier[np] . identifier[asarray] (( identif...
def strip_z(pts): """Strips a Z component from `pts` if it is present.""" pts = np.asarray(pts) if pts.shape[-1] > 2: pts = np.asarray((pts.T[0], pts.T[1])).T # depends on [control=['if'], data=[]] return pts
def get_station_id(self): ''' Use geolocation to get the station ID ''' extra_opts = '/pws:0' if not self.use_pws else '' api_url = GEOLOOKUP_URL % (self.api_key, extra_opts, self.location_code) respons...
def function[get_station_id, parameter[self]]: constant[ Use geolocation to get the station ID ] variable[extra_opts] assign[=] <ast.IfExp object at 0x7da204347a00> variable[api_url] assign[=] binary_operation[name[GEOLOOKUP_URL] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Att...
keyword[def] identifier[get_station_id] ( identifier[self] ): literal[string] identifier[extra_opts] = literal[string] keyword[if] keyword[not] identifier[self] . identifier[use_pws] keyword[else] literal[string] identifier[api_url] = identifier[GEOLOOKUP_URL] %( identifier[self] . i...
def get_station_id(self): """ Use geolocation to get the station ID """ extra_opts = '/pws:0' if not self.use_pws else '' api_url = GEOLOOKUP_URL % (self.api_key, extra_opts, self.location_code) response = self.api_request(api_url) station_type = 'pws' if self.use_pws else 'airport' ...
def ensure_float_vector(F, require_order = False): """Ensures that F is a numpy array of floats If F is already a numpy array of floats, F is returned (no copied!) Otherwise, checks if the argument can be converted to an array of floats and does that. Parameters ---------- F: float, or iterabl...
def function[ensure_float_vector, parameter[F, require_order]]: constant[Ensures that F is a numpy array of floats If F is already a numpy array of floats, F is returned (no copied!) Otherwise, checks if the argument can be converted to an array of floats and does that. Parameters ---------- ...
keyword[def] identifier[ensure_float_vector] ( identifier[F] , identifier[require_order] = keyword[False] ): literal[string] keyword[if] identifier[is_float_vector] ( identifier[F] ): keyword[return] identifier[F] keyword[elif] identifier[is_float] ( identifier[F] ): keyword[retu...
def ensure_float_vector(F, require_order=False): """Ensures that F is a numpy array of floats If F is already a numpy array of floats, F is returned (no copied!) Otherwise, checks if the argument can be converted to an array of floats and does that. Parameters ---------- F: float, or iterable ...
def set_environment_var_options(config, env=None, prefix='CONFPY'): """Set any configuration options which have an environment var set. Args: config (confpy.core.config.Configuration): A configuration object which has been initialized with options. env (dict): Optional dictionary wh...
def function[set_environment_var_options, parameter[config, env, prefix]]: constant[Set any configuration options which have an environment var set. Args: config (confpy.core.config.Configuration): A configuration object which has been initialized with options. env (dict): Optio...
keyword[def] identifier[set_environment_var_options] ( identifier[config] , identifier[env] = keyword[None] , identifier[prefix] = literal[string] ): literal[string] identifier[env] = identifier[env] keyword[or] identifier[os] . identifier[environ] keyword[for] identifier[section_name] , identifie...
def set_environment_var_options(config, env=None, prefix='CONFPY'): """Set any configuration options which have an environment var set. Args: config (confpy.core.config.Configuration): A configuration object which has been initialized with options. env (dict): Optional dictionary wh...
def technical_404_response(request, exception): "Create a technical 404 error response. The exception should be the Http404." try: error_url = exception.args[0]['path'] except (IndexError, TypeError, KeyError): error_url = request.path_info[1:] # Trim leading slash try: tried =...
def function[technical_404_response, parameter[request, exception]]: constant[Create a technical 404 error response. The exception should be the Http404.] <ast.Try object at 0x7da1b0e47e50> <ast.Try object at 0x7da1b0e47a60> variable[urlconf] assign[=] call[name[getattr], parameter[name[request]...
keyword[def] identifier[technical_404_response] ( identifier[request] , identifier[exception] ): literal[string] keyword[try] : identifier[error_url] = identifier[exception] . identifier[args] [ literal[int] ][ literal[string] ] keyword[except] ( identifier[IndexError] , identifier[TypeError]...
def technical_404_response(request, exception): """Create a technical 404 error response. The exception should be the Http404.""" try: error_url = exception.args[0]['path'] # depends on [control=['try'], data=[]] except (IndexError, TypeError, KeyError): error_url = request.path_info[1:] #...
def rollback_transaction(self): """ Rollback the current transaction. :raise: :class:`.TransactionError` if no transaction is currently open """ self._assert_open() if not self._transaction: raise TransactionError("No transaction to rollback") cx = self._conn...
def function[rollback_transaction, parameter[self]]: constant[ Rollback the current transaction. :raise: :class:`.TransactionError` if no transaction is currently open ] call[name[self]._assert_open, parameter[]] if <ast.UnaryOp object at 0x7da18c4cc850> begin[:] <ast.Ra...
keyword[def] identifier[rollback_transaction] ( identifier[self] ): literal[string] identifier[self] . identifier[_assert_open] () keyword[if] keyword[not] identifier[self] . identifier[_transaction] : keyword[raise] identifier[TransactionError] ( literal[string] ) ...
def rollback_transaction(self): """ Rollback the current transaction. :raise: :class:`.TransactionError` if no transaction is currently open """ self._assert_open() if not self._transaction: raise TransactionError('No transaction to rollback') # depends on [control=['if'], data=[]]...
def add_generic_info_message_for_error(request): """ Add message to request indicating that there was an issue processing request. Arguments: request: The current request. """ messages.info( request, _( '{strong_start}Something happened.{strong_end} ' ...
def function[add_generic_info_message_for_error, parameter[request]]: constant[ Add message to request indicating that there was an issue processing request. Arguments: request: The current request. ] call[name[messages].info, parameter[name[request], call[call[name[_], parameter[c...
keyword[def] identifier[add_generic_info_message_for_error] ( identifier[request] ): literal[string] identifier[messages] . identifier[info] ( identifier[request] , identifier[_] ( literal[string] literal[string] literal[string] ). identifier[format] ( identifier[span_s...
def add_generic_info_message_for_error(request): """ Add message to request indicating that there was an issue processing request. Arguments: request: The current request. """ messages.info(request, _('{strong_start}Something happened.{strong_end} {span_start}This course link is currently ...
def cli(yamlfile, inline, format): """ Generate JSON Schema representation of a biolink model """ print(JsonSchemaGenerator(yamlfile, format).serialize(inline=inline))
def function[cli, parameter[yamlfile, inline, format]]: constant[ Generate JSON Schema representation of a biolink model ] call[name[print], parameter[call[call[name[JsonSchemaGenerator], parameter[name[yamlfile], name[format]]].serialize, parameter[]]]]
keyword[def] identifier[cli] ( identifier[yamlfile] , identifier[inline] , identifier[format] ): literal[string] identifier[print] ( identifier[JsonSchemaGenerator] ( identifier[yamlfile] , identifier[format] ). identifier[serialize] ( identifier[inline] = identifier[inline] ))
def cli(yamlfile, inline, format): """ Generate JSON Schema representation of a biolink model """ print(JsonSchemaGenerator(yamlfile, format).serialize(inline=inline))
def part_edit_cmd(): 'Edit a part from an OOXML Package without unzipping it' parser = argparse.ArgumentParser(description=inspect.getdoc(part_edit_cmd)) parser.add_argument( 'path', help='Path to part (including path to zip file, i.e. ./file.zipx/part)', ) parser.add_argument( '--reformat-xml', action='st...
def function[part_edit_cmd, parameter[]]: constant[Edit a part from an OOXML Package without unzipping it] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] call[name[parser].add_argument, parameter[constant[path]]] call[name[parser].add_argument, parameter[cons...
keyword[def] identifier[part_edit_cmd] (): literal[string] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] ( identifier[description] = identifier[inspect] . identifier[getdoc] ( identifier[part_edit_cmd] )) identifier[parser] . identifier[add_argument] ( literal[string] , identifier[...
def part_edit_cmd(): """Edit a part from an OOXML Package without unzipping it""" parser = argparse.ArgumentParser(description=inspect.getdoc(part_edit_cmd)) parser.add_argument('path', help='Path to part (including path to zip file, i.e. ./file.zipx/part)') parser.add_argument('--reformat-xml', action=...
def from_locale(cls, locale): """ Create a new Language instance from a locale string :param locale: locale as string :return: Language instance with instance.locale() == locale if locale is valid else instance of Unknown Language """ locale = str(locale) if local...
def function[from_locale, parameter[cls, locale]]: constant[ Create a new Language instance from a locale string :param locale: locale as string :return: Language instance with instance.locale() == locale if locale is valid else instance of Unknown Language ] variable[loc...
keyword[def] identifier[from_locale] ( identifier[cls] , identifier[locale] ): literal[string] identifier[locale] = identifier[str] ( identifier[locale] ) keyword[if] identifier[locale] keyword[is] literal[string] : keyword[return] identifier[UnknownLanguage] ( identifier[...
def from_locale(cls, locale): """ Create a new Language instance from a locale string :param locale: locale as string :return: Language instance with instance.locale() == locale if locale is valid else instance of Unknown Language """ locale = str(locale) if locale is 'unknow...
def _search_for_executable(self, executable): """ Search for file give in "executable". If it is not found, we try the environment PATH. Returns either the absolute path to the found executable, or None if the executable couldn't be found. """ if os.path.isfile(executable...
def function[_search_for_executable, parameter[self, executable]]: constant[ Search for file give in "executable". If it is not found, we try the environment PATH. Returns either the absolute path to the found executable, or None if the executable couldn't be found. ] if ...
keyword[def] identifier[_search_for_executable] ( identifier[self] , identifier[executable] ): literal[string] keyword[if] identifier[os] . identifier[path] . identifier[isfile] ( identifier[executable] ): keyword[return] identifier[os] . identifier[path] . identifier[abspath] ( iden...
def _search_for_executable(self, executable): """ Search for file give in "executable". If it is not found, we try the environment PATH. Returns either the absolute path to the found executable, or None if the executable couldn't be found. """ if os.path.isfile(executable): ...
def to_ip(self): """Return of copy of the data inside a TDIP container """ if 'chargeability' in self.data.columns: tdip = reda.TDIP(data=self.data) else: raise Exception('Missing column "chargeability"') return tdip
def function[to_ip, parameter[self]]: constant[Return of copy of the data inside a TDIP container ] if compare[constant[chargeability] in name[self].data.columns] begin[:] variable[tdip] assign[=] call[name[reda].TDIP, parameter[]] return[name[tdip]]
keyword[def] identifier[to_ip] ( identifier[self] ): literal[string] keyword[if] literal[string] keyword[in] identifier[self] . identifier[data] . identifier[columns] : identifier[tdip] = identifier[reda] . identifier[TDIP] ( identifier[data] = identifier[self] . identifier[data] ) ...
def to_ip(self): """Return of copy of the data inside a TDIP container """ if 'chargeability' in self.data.columns: tdip = reda.TDIP(data=self.data) # depends on [control=['if'], data=[]] else: raise Exception('Missing column "chargeability"') return tdip
def is_edge_consistent(graph, u, v): """Check if all edges between two nodes have the same relation. :param pybel.BELGraph graph: A BEL Graph :param tuple u: The source BEL node :param tuple v: The target BEL node :return: If all edges from the source to target node have the same relation :rtyp...
def function[is_edge_consistent, parameter[graph, u, v]]: constant[Check if all edges between two nodes have the same relation. :param pybel.BELGraph graph: A BEL Graph :param tuple u: The source BEL node :param tuple v: The target BEL node :return: If all edges from the source to target node h...
keyword[def] identifier[is_edge_consistent] ( identifier[graph] , identifier[u] , identifier[v] ): literal[string] keyword[if] keyword[not] identifier[graph] . identifier[has_edge] ( identifier[u] , identifier[v] ): keyword[raise] identifier[ValueError] ( literal[string] . identifier[format] ( ...
def is_edge_consistent(graph, u, v): """Check if all edges between two nodes have the same relation. :param pybel.BELGraph graph: A BEL Graph :param tuple u: The source BEL node :param tuple v: The target BEL node :return: If all edges from the source to target node have the same relation :rtyp...
def keep_on_one_line(): """ Keep all the output generated within a with-block on one line. Whenever a new line would be printed, instead reset the cursor to the beginning of the line and print the new line without a line break. """ class CondensedStream: def __init__(self): ...
def function[keep_on_one_line, parameter[]]: constant[ Keep all the output generated within a with-block on one line. Whenever a new line would be printed, instead reset the cursor to the beginning of the line and print the new line without a line break. ] class class[CondensedStream,...
keyword[def] identifier[keep_on_one_line] (): literal[string] keyword[class] identifier[CondensedStream] : keyword[def] identifier[__init__] ( identifier[self] ): identifier[self] . identifier[sys_stdout] = identifier[sys] . identifier[stdout] keyword[def] identifier[w...
def keep_on_one_line(): """ Keep all the output generated within a with-block on one line. Whenever a new line would be printed, instead reset the cursor to the beginning of the line and print the new line without a line break. """ class CondensedStream: def __init__(self): ...
def do_POST(self): """Handles the HTTP POST request. Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling. """ # Check that the path is legal if not self.is_rpc_path_valid(): self.re...
def function[do_POST, parameter[self]]: constant[Handles the HTTP POST request. Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling. ] if <ast.UnaryOp object at 0x7da204621960> begin[:] ...
keyword[def] identifier[do_POST] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[is_rpc_path_valid] (): identifier[self] . identifier[report_404] () keyword[return] keyword[try] : ...
def do_POST(self): """Handles the HTTP POST request. Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling. """ # Check that the path is legal if not self.is_rpc_path_valid(): self.report_404() ...
def write(self, fp, space_around_delimiters=True): """Write an .ini-format representation of the configuration state. If `space_around_delimiters' is True (the default), delimiters between keys and values are surrounded by spaces. """ if space_around_delimiters: d = ...
def function[write, parameter[self, fp, space_around_delimiters]]: constant[Write an .ini-format representation of the configuration state. If `space_around_delimiters' is True (the default), delimiters between keys and values are surrounded by spaces. ] if name[space_around_del...
keyword[def] identifier[write] ( identifier[self] , identifier[fp] , identifier[space_around_delimiters] = keyword[True] ): literal[string] keyword[if] identifier[space_around_delimiters] : identifier[d] = literal[string] . identifier[format] ( identifier[self] . identifier[_delimiter...
def write(self, fp, space_around_delimiters=True): """Write an .ini-format representation of the configuration state. If `space_around_delimiters' is True (the default), delimiters between keys and values are surrounded by spaces. """ if space_around_delimiters: d = ' {0} '.form...
def add_collaboration(self, collaboration): """Add collaboration. :param collaboration: collaboration for the current document :type collaboration: string """ collaborations = normalize_collaboration(collaboration) for collaboration in collaborations: self._a...
def function[add_collaboration, parameter[self, collaboration]]: constant[Add collaboration. :param collaboration: collaboration for the current document :type collaboration: string ] variable[collaborations] assign[=] call[name[normalize_collaboration], parameter[name[collabora...
keyword[def] identifier[add_collaboration] ( identifier[self] , identifier[collaboration] ): literal[string] identifier[collaborations] = identifier[normalize_collaboration] ( identifier[collaboration] ) keyword[for] identifier[collaboration] keyword[in] identifier[collaborations] : ...
def add_collaboration(self, collaboration): """Add collaboration. :param collaboration: collaboration for the current document :type collaboration: string """ collaborations = normalize_collaboration(collaboration) for collaboration in collaborations: self._append_to('collab...
def draw_widget(self, item): """Create a preview of the selected treeview item""" if item: self.filter_remove(remember=True) selected_id = self.treedata[item]['id'] item = self.get_toplevel_parent(item) widget_id = self.treedata[item]['id'] wcl...
def function[draw_widget, parameter[self, item]]: constant[Create a preview of the selected treeview item] if name[item] begin[:] call[name[self].filter_remove, parameter[]] variable[selected_id] assign[=] call[call[name[self].treedata][name[item]]][constant[id]] ...
keyword[def] identifier[draw_widget] ( identifier[self] , identifier[item] ): literal[string] keyword[if] identifier[item] : identifier[self] . identifier[filter_remove] ( identifier[remember] = keyword[True] ) identifier[selected_id] = identifier[self] . identifier[treed...
def draw_widget(self, item): """Create a preview of the selected treeview item""" if item: self.filter_remove(remember=True) selected_id = self.treedata[item]['id'] item = self.get_toplevel_parent(item) widget_id = self.treedata[item]['id'] wclass = self.treedata[item]['c...
def find_charged(self, mol): """Looks for positive charges in arginine, histidine or lysine, for negative in aspartic and glutamic acid.""" data = namedtuple('pcharge', 'atoms atoms_orig_idx type center restype resnr reschain') a_set = [] # Iterate through all residue, exclude those in c...
def function[find_charged, parameter[self, mol]]: constant[Looks for positive charges in arginine, histidine or lysine, for negative in aspartic and glutamic acid.] variable[data] assign[=] call[name[namedtuple], parameter[constant[pcharge], constant[atoms atoms_orig_idx type center restype resnr rescha...
keyword[def] identifier[find_charged] ( identifier[self] , identifier[mol] ): literal[string] identifier[data] = identifier[namedtuple] ( literal[string] , literal[string] ) identifier[a_set] =[] keyword[for] identifier[res] keyword[in] [ identifier[r] keyword[for] id...
def find_charged(self, mol): """Looks for positive charges in arginine, histidine or lysine, for negative in aspartic and glutamic acid.""" data = namedtuple('pcharge', 'atoms atoms_orig_idx type center restype resnr reschain') a_set = [] # Iterate through all residue, exclude those in chains defined as...
def daemon_mode(self, args, options): """ Open a ControlWebSocket to SushiBar server and listend for remote commands. Args: args (dict): chef command line arguments options (dict): additional compatibility mode options given on command line """ cws = Contr...
def function[daemon_mode, parameter[self, args, options]]: constant[ Open a ControlWebSocket to SushiBar server and listend for remote commands. Args: args (dict): chef command line arguments options (dict): additional compatibility mode options given on command line ...
keyword[def] identifier[daemon_mode] ( identifier[self] , identifier[args] , identifier[options] ): literal[string] identifier[cws] = identifier[ControlWebSocket] ( identifier[self] , identifier[args] , identifier[options] ) identifier[cws] . identifier[start] () keyword[if] lite...
def daemon_mode(self, args, options): """ Open a ControlWebSocket to SushiBar server and listend for remote commands. Args: args (dict): chef command line arguments options (dict): additional compatibility mode options given on command line """ cws = ControlWebSoc...
def authentication_ok(self): '''Checks the authentication and sets the username of the currently connected terminal. Returns True or False''' username = None password = None if self.authCallback: if self.authNeedUser: username = self.readline(prompt=self.PROM...
def function[authentication_ok, parameter[self]]: constant[Checks the authentication and sets the username of the currently connected terminal. Returns True or False] variable[username] assign[=] constant[None] variable[password] assign[=] constant[None] if name[self].authCallback begin...
keyword[def] identifier[authentication_ok] ( identifier[self] ): literal[string] identifier[username] = keyword[None] identifier[password] = keyword[None] keyword[if] identifier[self] . identifier[authCallback] : keyword[if] identifier[self] . identifier[authNeedU...
def authentication_ok(self): """Checks the authentication and sets the username of the currently connected terminal. Returns True or False""" username = None password = None if self.authCallback: if self.authNeedUser: username = self.readline(prompt=self.PROMPT_USER, use_history=Fal...
def name(self): """ Read only name tag """ name = super(Interface, self).name return name if name else self.data.get('name')
def function[name, parameter[self]]: constant[ Read only name tag ] variable[name] assign[=] call[name[super], parameter[name[Interface], name[self]]].name return[<ast.IfExp object at 0x7da1b1bc1b10>]
keyword[def] identifier[name] ( identifier[self] ): literal[string] identifier[name] = identifier[super] ( identifier[Interface] , identifier[self] ). identifier[name] keyword[return] identifier[name] keyword[if] identifier[name] keyword[else] identifier[self] . identifier[data] . id...
def name(self): """ Read only name tag """ name = super(Interface, self).name return name if name else self.data.get('name')
def _add_scope_decorations(self, block, start, end): """ Show a scope decoration on the editor widget :param start: Start line :param end: End line """ try: parent = FoldScope(block).parent() except ValueError: parent = None if Tex...
def function[_add_scope_decorations, parameter[self, block, start, end]]: constant[ Show a scope decoration on the editor widget :param start: Start line :param end: End line ] <ast.Try object at 0x7da20c76ec20> if call[name[TextBlockHelper].is_fold_trigger, paramete...
keyword[def] identifier[_add_scope_decorations] ( identifier[self] , identifier[block] , identifier[start] , identifier[end] ): literal[string] keyword[try] : identifier[parent] = identifier[FoldScope] ( identifier[block] ). identifier[parent] () keyword[except] identifier[Va...
def _add_scope_decorations(self, block, start, end): """ Show a scope decoration on the editor widget :param start: Start line :param end: End line """ try: parent = FoldScope(block).parent() # depends on [control=['try'], data=[]] except ValueError: parent ...
def find_blocks(): """ Auto-discover INSTALLED_APPS registered_blocks.py modules and fail silently when not present. This forces an import on them thereby registering their blocks. This is a near 1-to-1 copy of how django's admin application registers models. """ for app in settings.IN...
def function[find_blocks, parameter[]]: constant[ Auto-discover INSTALLED_APPS registered_blocks.py modules and fail silently when not present. This forces an import on them thereby registering their blocks. This is a near 1-to-1 copy of how django's admin application registers models. ...
keyword[def] identifier[find_blocks] (): literal[string] keyword[for] identifier[app] keyword[in] identifier[settings] . identifier[INSTALLED_APPS] : identifier[mod] = identifier[import_module] ( identifier[app] ) keyword[try] : identifier[before_import_block_reg...
def find_blocks(): """ Auto-discover INSTALLED_APPS registered_blocks.py modules and fail silently when not present. This forces an import on them thereby registering their blocks. This is a near 1-to-1 copy of how django's admin application registers models. """ for app in settings.INS...
def _chunk_iter(self): """Iterator over the blob file.""" for chunk_offset in self._chunk_offsets(): yield self._download_chunk(chunk_offset=chunk_offset, chunk_size=self._chunk_size)
def function[_chunk_iter, parameter[self]]: constant[Iterator over the blob file.] for taget[name[chunk_offset]] in starred[call[name[self]._chunk_offsets, parameter[]]] begin[:] <ast.Yield object at 0x7da20c76d7e0>
keyword[def] identifier[_chunk_iter] ( identifier[self] ): literal[string] keyword[for] identifier[chunk_offset] keyword[in] identifier[self] . identifier[_chunk_offsets] (): keyword[yield] identifier[self] . identifier[_download_chunk] ( identifier[chunk_offset] = identifier[chunk...
def _chunk_iter(self): """Iterator over the blob file.""" for chunk_offset in self._chunk_offsets(): yield self._download_chunk(chunk_offset=chunk_offset, chunk_size=self._chunk_size) # depends on [control=['for'], data=['chunk_offset']]
def create(self, resource, uri=None, timeout=-1, custom_headers=None, default_values={}): """ Makes a POST request to create a resource when a request body is required. Args: resource: OneView resource dictionary. uri: Can be either the re...
def function[create, parameter[self, resource, uri, timeout, custom_headers, default_values]]: constant[ Makes a POST request to create a resource when a request body is required. Args: resource: OneView resource dictionary. uri: Can be ei...
keyword[def] identifier[create] ( identifier[self] , identifier[resource] , identifier[uri] = keyword[None] , identifier[timeout] =- literal[int] , identifier[custom_headers] = keyword[None] , identifier[default_values] ={}): literal[string] keyword[if] keyword[not] identifier[resource] : ...
def create(self, resource, uri=None, timeout=-1, custom_headers=None, default_values={}): """ Makes a POST request to create a resource when a request body is required. Args: resource: OneView resource dictionary. uri: Can be either the resour...
def stack(nick, rest): 'Manage short lists in pmxbot. See !stack help for more info' atoms = [atom.strip() for atom in rest.split(' ', 1) if atom.strip()] if len(atoms) == 0: subcommand = "show" rest = "" elif len(atoms) == 1: subcommand = atoms[0] rest = "" else: ...
def function[stack, parameter[nick, rest]]: constant[Manage short lists in pmxbot. See !stack help for more info] variable[atoms] assign[=] <ast.ListComp object at 0x7da1b06cb880> if compare[call[name[len], parameter[name[atoms]]] equal[==] constant[0]] begin[:] variable[subcomma...
keyword[def] identifier[stack] ( identifier[nick] , identifier[rest] ): literal[string] identifier[atoms] =[ identifier[atom] . identifier[strip] () keyword[for] identifier[atom] keyword[in] identifier[rest] . identifier[split] ( literal[string] , literal[int] ) keyword[if] identifier[atom] . identifie...
def stack(nick, rest): """Manage short lists in pmxbot. See !stack help for more info""" atoms = [atom.strip() for atom in rest.split(' ', 1) if atom.strip()] if len(atoms) == 0: subcommand = 'show' rest = '' # depends on [control=['if'], data=[]] elif len(atoms) == 1: subcomman...
def currencies(self): """Get all currencies with non-zero values""" return [m.currency.code for m in self.monies() if m.amount]
def function[currencies, parameter[self]]: constant[Get all currencies with non-zero values] return[<ast.ListComp object at 0x7da20c795c00>]
keyword[def] identifier[currencies] ( identifier[self] ): literal[string] keyword[return] [ identifier[m] . identifier[currency] . identifier[code] keyword[for] identifier[m] keyword[in] identifier[self] . identifier[monies] () keyword[if] identifier[m] . identifier[amount] ]
def currencies(self): """Get all currencies with non-zero values""" return [m.currency.code for m in self.monies() if m.amount]
def count_processors(): """How many cores does the current computer have ?""" if 'SLURM_NTASKS' in os.environ: return int(os.environ['SLURM_NTASKS']) elif 'SLURM_JOB_CPUS_PER_NODE' in os.environ: text = os.environ['SLURM_JOB_CPUS_PER_NODE'] if is_integer(text): return int(text) el...
def function[count_processors, parameter[]]: constant[How many cores does the current computer have ?] if compare[constant[SLURM_NTASKS] in name[os].environ] begin[:] return[call[name[int], parameter[call[name[os].environ][constant[SLURM_NTASKS]]]]]
keyword[def] identifier[count_processors] (): literal[string] keyword[if] literal[string] keyword[in] identifier[os] . identifier[environ] : keyword[return] identifier[int] ( identifier[os] . identifier[environ] [ literal[string] ]) keyword[elif] literal[string] keyword[in] identifier[os] . ide...
def count_processors(): """How many cores does the current computer have ?""" if 'SLURM_NTASKS' in os.environ: return int(os.environ['SLURM_NTASKS']) # depends on [control=['if'], data=[]] elif 'SLURM_JOB_CPUS_PER_NODE' in os.environ: text = os.environ['SLURM_JOB_CPUS_PER_NODE'] if ...
def _finite_well_energy(P, n=1, atol=1e-6): ''' Returns the nth bound-state energy for a finite-potential quantum well with the given well-strength parameter, `P`. ''' assert n > 0 and n <= _finite_well_states(P) pi_2 = pi / 2. r = (1 / (P + pi_2)) * (n * pi_2) eta = n * pi_2 - arcsin(r)...
def function[_finite_well_energy, parameter[P, n, atol]]: constant[ Returns the nth bound-state energy for a finite-potential quantum well with the given well-strength parameter, `P`. ] assert[<ast.BoolOp object at 0x7da2041da500>] variable[pi_2] assign[=] binary_operation[name[pi] / con...
keyword[def] identifier[_finite_well_energy] ( identifier[P] , identifier[n] = literal[int] , identifier[atol] = literal[int] ): literal[string] keyword[assert] identifier[n] > literal[int] keyword[and] identifier[n] <= identifier[_finite_well_states] ( identifier[P] ) identifier[pi_2] = identifier...
def _finite_well_energy(P, n=1, atol=1e-06): """ Returns the nth bound-state energy for a finite-potential quantum well with the given well-strength parameter, `P`. """ assert n > 0 and n <= _finite_well_states(P) pi_2 = pi / 2.0 r = 1 / (P + pi_2) * (n * pi_2) eta = n * pi_2 - arcsin(r)...
def p_invoke(p): """ invoke : INVOKE IDENTIFIER SLASH IDENTIFIER | INVOKE IDENTIFIER SLASH IDENTIFIER OPEN_CURLY_BRACKET PRIORITY COLON NUMBER CLOSE_CURLY_BRACKET """ priority = None if len(p) > 5: priority = int(p[8]) p[0] = Trigger(p[2], p[4], priority)
def function[p_invoke, parameter[p]]: constant[ invoke : INVOKE IDENTIFIER SLASH IDENTIFIER | INVOKE IDENTIFIER SLASH IDENTIFIER OPEN_CURLY_BRACKET PRIORITY COLON NUMBER CLOSE_CURLY_BRACKET ] variable[priority] assign[=] constant[None] if compare[call[name[len], parameter[name...
keyword[def] identifier[p_invoke] ( identifier[p] ): literal[string] identifier[priority] = keyword[None] keyword[if] identifier[len] ( identifier[p] )> literal[int] : identifier[priority] = identifier[int] ( identifier[p] [ literal[int] ]) identifier[p] [ literal[int] ]= identifier[Tr...
def p_invoke(p): """ invoke : INVOKE IDENTIFIER SLASH IDENTIFIER | INVOKE IDENTIFIER SLASH IDENTIFIER OPEN_CURLY_BRACKET PRIORITY COLON NUMBER CLOSE_CURLY_BRACKET """ priority = None if len(p) > 5: priority = int(p[8]) # depends on [control=['if'], data=[]] p[0] = Trigger(p[2...
def html(dom: str): """ A string containing a valid HTML snippet. :param dom: The HTML string to add to the display. """ r = _get_report() r.append_body(render.html(dom)) r.stdout_interceptor.write_source('[ADDED] HTML\n')
def function[html, parameter[dom]]: constant[ A string containing a valid HTML snippet. :param dom: The HTML string to add to the display. ] variable[r] assign[=] call[name[_get_report], parameter[]] call[name[r].append_body, parameter[call[name[render].html, parameter[name[...
keyword[def] identifier[html] ( identifier[dom] : identifier[str] ): literal[string] identifier[r] = identifier[_get_report] () identifier[r] . identifier[append_body] ( identifier[render] . identifier[html] ( identifier[dom] )) identifier[r] . identifier[stdout_interceptor] . identifier[write_so...
def html(dom: str): """ A string containing a valid HTML snippet. :param dom: The HTML string to add to the display. """ r = _get_report() r.append_body(render.html(dom)) r.stdout_interceptor.write_source('[ADDED] HTML\n')
def to_bioul(tag_sequence: List[str], encoding: str = "IOB1") -> List[str]: """ Given a tag sequence encoded with IOB1 labels, recode to BIOUL. In the IOB1 scheme, I is a token inside a span, O is a token outside a span and B is the beginning of span immediately following another span of the same t...
def function[to_bioul, parameter[tag_sequence, encoding]]: constant[ Given a tag sequence encoded with IOB1 labels, recode to BIOUL. In the IOB1 scheme, I is a token inside a span, O is a token outside a span and B is the beginning of span immediately following another span of the same type. ...
keyword[def] identifier[to_bioul] ( identifier[tag_sequence] : identifier[List] [ identifier[str] ], identifier[encoding] : identifier[str] = literal[string] )-> identifier[List] [ identifier[str] ]: literal[string] keyword[if] keyword[not] identifier[encoding] keyword[in] { literal[string] , literal[s...
def to_bioul(tag_sequence: List[str], encoding: str='IOB1') -> List[str]: """ Given a tag sequence encoded with IOB1 labels, recode to BIOUL. In the IOB1 scheme, I is a token inside a span, O is a token outside a span and B is the beginning of span immediately following another span of the same typ...
def render(self): """ Try to load content (from cache or by rendering the template). If it fails, return an empty string or raise the exception if it's a TemplateSyntaxError. With this, we can no parse and render the content included in the {% nocache %} blocks, but only ...
def function[render, parameter[self]]: constant[ Try to load content (from cache or by rendering the template). If it fails, return an empty string or raise the exception if it's a TemplateSyntaxError. With this, we can no parse and render the content included in the {% n...
keyword[def] identifier[render] ( identifier[self] ): literal[string] keyword[try] : identifier[self] . identifier[load_content] () keyword[except] identifier[template] . identifier[TemplateSyntaxError] : keyword[raise] keyword[except] identifier[Excep...
def render(self): """ Try to load content (from cache or by rendering the template). If it fails, return an empty string or raise the exception if it's a TemplateSyntaxError. With this, we can no parse and render the content included in the {% nocache %} blocks, but only if w...
def find_path(self, start, end, grid): """ find a path from start to end node on grid by iterating over all neighbors of a node (see check_neighbors) :param start: start node :param end: end node :param grid: grid that stores all possible steps/tiles as 2D-list :r...
def function[find_path, parameter[self, start, end, grid]]: constant[ find a path from start to end node on grid by iterating over all neighbors of a node (see check_neighbors) :param start: start node :param end: end node :param grid: grid that stores all possible steps/...
keyword[def] identifier[find_path] ( identifier[self] , identifier[start] , identifier[end] , identifier[grid] ): literal[string] identifier[self] . identifier[start_time] = identifier[time] . identifier[time] () identifier[self] . identifier[runs] = literal[int] identifier[start...
def find_path(self, start, end, grid): """ find a path from start to end node on grid by iterating over all neighbors of a node (see check_neighbors) :param start: start node :param end: end node :param grid: grid that stores all possible steps/tiles as 2D-list :retur...
def create_readable_dir(entry, section, domain, output): """Create the a human-readable directory to link the entry to if needed.""" if domain != 'viral': full_output_dir = os.path.join(output, 'human_readable', section, domain, get_genus_label(entry), ...
def function[create_readable_dir, parameter[entry, section, domain, output]]: constant[Create the a human-readable directory to link the entry to if needed.] if compare[name[domain] not_equal[!=] constant[viral]] begin[:] variable[full_output_dir] assign[=] call[name[os].path.join, param...
keyword[def] identifier[create_readable_dir] ( identifier[entry] , identifier[section] , identifier[domain] , identifier[output] ): literal[string] keyword[if] identifier[domain] != literal[string] : identifier[full_output_dir] = identifier[os] . identifier[path] . identifier[join] ( identifier[o...
def create_readable_dir(entry, section, domain, output): """Create the a human-readable directory to link the entry to if needed.""" if domain != 'viral': full_output_dir = os.path.join(output, 'human_readable', section, domain, get_genus_label(entry), get_species_label(entry), get_strain_label(entry)) ...
def LSL(value, amount, width): """ The ARM LSL (logical left shift) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ if ...
def function[LSL, parameter[value, amount, width]]: constant[ The ARM LSL (logical left shift) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtyp...
keyword[def] identifier[LSL] ( identifier[value] , identifier[amount] , identifier[width] ): literal[string] keyword[if] identifier[amount] == literal[int] : keyword[return] identifier[value] identifier[result] , identifier[_] = identifier[LSL_C] ( identifier[value] , identifier[amount] ,...
def LSL(value, amount, width): """ The ARM LSL (logical left shift) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ if ...
def poll(self, timeout=0.0): """Modified version of poll() from asyncore module""" if self.sock_map is None: Log.warning("Socket map is not registered to Gateway Looper") readable_lst = [] writable_lst = [] error_lst = [] if self.sock_map is not None: for fd, obj in self.sock_map.it...
def function[poll, parameter[self, timeout]]: constant[Modified version of poll() from asyncore module] if compare[name[self].sock_map is constant[None]] begin[:] call[name[Log].warning, parameter[constant[Socket map is not registered to Gateway Looper]]] variable[readable_lst] a...
keyword[def] identifier[poll] ( identifier[self] , identifier[timeout] = literal[int] ): literal[string] keyword[if] identifier[self] . identifier[sock_map] keyword[is] keyword[None] : identifier[Log] . identifier[warning] ( literal[string] ) identifier[readable_lst] =[] identifier[writ...
def poll(self, timeout=0.0): """Modified version of poll() from asyncore module""" if self.sock_map is None: Log.warning('Socket map is not registered to Gateway Looper') # depends on [control=['if'], data=[]] readable_lst = [] writable_lst = [] error_lst = [] if self.sock_map is not No...
def representCleanOpenAPIPathItem(dumper, data): """ Unpack operation key/values before representing an OpenAPIPathItem """ dct = _orderedCleanDict(data) if '_operations' in dct: items = sorted(data._operations.items()) for k, op in items: dct[k] = op del dct['_op...
def function[representCleanOpenAPIPathItem, parameter[dumper, data]]: constant[ Unpack operation key/values before representing an OpenAPIPathItem ] variable[dct] assign[=] call[name[_orderedCleanDict], parameter[name[data]]] if compare[constant[_operations] in name[dct]] begin[:] ...
keyword[def] identifier[representCleanOpenAPIPathItem] ( identifier[dumper] , identifier[data] ): literal[string] identifier[dct] = identifier[_orderedCleanDict] ( identifier[data] ) keyword[if] literal[string] keyword[in] identifier[dct] : identifier[items] = identifier[sorted] ( identifi...
def representCleanOpenAPIPathItem(dumper, data): """ Unpack operation key/values before representing an OpenAPIPathItem """ dct = _orderedCleanDict(data) if '_operations' in dct: items = sorted(data._operations.items()) for (k, op) in items: dct[k] = op # depends on [con...
def wallace_reducer(wire_array_2, result_bitwidth, final_adder=kogge_stone): """ The reduction and final adding part of a dada tree. Useful for adding many numbers together The use of single bitwidth wires is to allow for additional flexibility :param [[Wirevector]] wire_array_2: An array of arrays of ...
def function[wallace_reducer, parameter[wire_array_2, result_bitwidth, final_adder]]: constant[ The reduction and final adding part of a dada tree. Useful for adding many numbers together The use of single bitwidth wires is to allow for additional flexibility :param [[Wirevector]] wire_array_2: An ...
keyword[def] identifier[wallace_reducer] ( identifier[wire_array_2] , identifier[result_bitwidth] , identifier[final_adder] = identifier[kogge_stone] ): literal[string] keyword[for] identifier[wire_set] keyword[in] identifier[wire_array_2] : keyword[for] identifier[a_wire] keyword[in] i...
def wallace_reducer(wire_array_2, result_bitwidth, final_adder=kogge_stone): """ The reduction and final adding part of a dada tree. Useful for adding many numbers together The use of single bitwidth wires is to allow for additional flexibility :param [[Wirevector]] wire_array_2: An array of arrays of ...
def make_data(n,m): """creates example data set""" I = range(1,n+1) J = range(1,m+1) x,y,w = {},{},{} for i in I: x[i] = random.randint(0,100) y[i] = random.randint(0,100) w[i] = random.randint(1,5) return I,J,x,y,w
def function[make_data, parameter[n, m]]: constant[creates example data set] variable[I] assign[=] call[name[range], parameter[constant[1], binary_operation[name[n] + constant[1]]]] variable[J] assign[=] call[name[range], parameter[constant[1], binary_operation[name[m] + constant[1]]]] <...
keyword[def] identifier[make_data] ( identifier[n] , identifier[m] ): literal[string] identifier[I] = identifier[range] ( literal[int] , identifier[n] + literal[int] ) identifier[J] = identifier[range] ( literal[int] , identifier[m] + literal[int] ) identifier[x] , identifier[y] , identifier[w] =...
def make_data(n, m): """creates example data set""" I = range(1, n + 1) J = range(1, m + 1) (x, y, w) = ({}, {}, {}) for i in I: x[i] = random.randint(0, 100) y[i] = random.randint(0, 100) w[i] = random.randint(1, 5) # depends on [control=['for'], data=['i']] return (I, ...
def encode(self, word, max_length=4): """Return the Statistics Canada code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 4) of the code to return Returns ------- st...
def function[encode, parameter[self, word, max_length]]: constant[Return the Statistics Canada code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 4) of the code to return Returns ...
keyword[def] identifier[encode] ( identifier[self] , identifier[word] , identifier[max_length] = literal[int] ): literal[string] identifier[word] = identifier[unicode_normalize] ( literal[string] , identifier[text_type] ( identifier[word] . identifier[upper] ())) identifier[word] ...
def encode(self, word, max_length=4): """Return the Statistics Canada code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 4) of the code to return Returns ------- str ...
def get_pipeline_steps(pipeline, steps_group): """Get the steps attribute of module pipeline. If there is no steps sequence on the pipeline, return None. Guess you could theoretically want to run a pipeline with nothing in it. """ logger.debug("starting") assert pipeline assert steps_group ...
def function[get_pipeline_steps, parameter[pipeline, steps_group]]: constant[Get the steps attribute of module pipeline. If there is no steps sequence on the pipeline, return None. Guess you could theoretically want to run a pipeline with nothing in it. ] call[name[logger].debug, parameter[...
keyword[def] identifier[get_pipeline_steps] ( identifier[pipeline] , identifier[steps_group] ): literal[string] identifier[logger] . identifier[debug] ( literal[string] ) keyword[assert] identifier[pipeline] keyword[assert] identifier[steps_group] identifier[logger] . identifier[debug] ...
def get_pipeline_steps(pipeline, steps_group): """Get the steps attribute of module pipeline. If there is no steps sequence on the pipeline, return None. Guess you could theoretically want to run a pipeline with nothing in it. """ logger.debug('starting') assert pipeline assert steps_group ...
def set_data(self, data): ''' Sending data to via TCP. Parameters ---------- data : array Array of unsigned integers (32 bit). ''' data = array.array('B', struct.unpack("{}B".format(len(data) * 4), struct.pack("{}I".format(len(data)), *data))) self._i...
def function[set_data, parameter[self, data]]: constant[ Sending data to via TCP. Parameters ---------- data : array Array of unsigned integers (32 bit). ] variable[data] assign[=] call[name[array].array, parameter[constant[B], call[name[struct].unpack, param...
keyword[def] identifier[set_data] ( identifier[self] , identifier[data] ): literal[string] identifier[data] = identifier[array] . identifier[array] ( literal[string] , identifier[struct] . identifier[unpack] ( literal[string] . identifier[format] ( identifier[len] ( identifier[data] )* literal[int]...
def set_data(self, data): """ Sending data to via TCP. Parameters ---------- data : array Array of unsigned integers (32 bit). """ data = array.array('B', struct.unpack('{}B'.format(len(data) * 4), struct.pack('{}I'.format(len(data)), *data))) self._intf._send_tc...
def pretty(self, start, end, e, messages=None): """Pretties up the output error message so it is readable and designates where the error came from""" log.debug("Displaying document from lines '%i' to '%i'", start, end) errorlist = [] if len(e.context) > 0: errorlist...
def function[pretty, parameter[self, start, end, e, messages]]: constant[Pretties up the output error message so it is readable and designates where the error came from] call[name[log].debug, parameter[constant[Displaying document from lines '%i' to '%i'], name[start], name[end]]] variab...
keyword[def] identifier[pretty] ( identifier[self] , identifier[start] , identifier[end] , identifier[e] , identifier[messages] = keyword[None] ): literal[string] identifier[log] . identifier[debug] ( literal[string] , identifier[start] , identifier[end] ) identifier[errorlist] =[] ...
def pretty(self, start, end, e, messages=None): """Pretties up the output error message so it is readable and designates where the error came from""" log.debug("Displaying document from lines '%i' to '%i'", start, end) errorlist = [] if len(e.context) > 0: errorlist = e.context # depend...
def toarray(self): """ Returns the contents as a local array. Will likely cause memory problems for large objects. """ rdd = self._rdd if self._ordered else self._rdd.sortByKey() x = rdd.values().collect() return asarray(x).reshape(self.shape)
def function[toarray, parameter[self]]: constant[ Returns the contents as a local array. Will likely cause memory problems for large objects. ] variable[rdd] assign[=] <ast.IfExp object at 0x7da1b01c2bf0> variable[x] assign[=] call[call[name[rdd].values, parameter[]].col...
keyword[def] identifier[toarray] ( identifier[self] ): literal[string] identifier[rdd] = identifier[self] . identifier[_rdd] keyword[if] identifier[self] . identifier[_ordered] keyword[else] identifier[self] . identifier[_rdd] . identifier[sortByKey] () identifier[x] = identifier[rdd] ...
def toarray(self): """ Returns the contents as a local array. Will likely cause memory problems for large objects. """ rdd = self._rdd if self._ordered else self._rdd.sortByKey() x = rdd.values().collect() return asarray(x).reshape(self.shape)
def get_all_anonymous_mappings(self, struct1, struct2, niggli=True, include_dist=False): """ Performs an anonymous fitting, which allows distinct species in one structure to map to another. Returns a dictionary of species substitutions that are within t...
def function[get_all_anonymous_mappings, parameter[self, struct1, struct2, niggli, include_dist]]: constant[ Performs an anonymous fitting, which allows distinct species in one structure to map to another. Returns a dictionary of species substitutions that are within tolerance A...
keyword[def] identifier[get_all_anonymous_mappings] ( identifier[self] , identifier[struct1] , identifier[struct2] , identifier[niggli] = keyword[True] , identifier[include_dist] = keyword[False] ): literal[string] identifier[struct1] , identifier[struct2] = identifier[self] . identifier[_process_...
def get_all_anonymous_mappings(self, struct1, struct2, niggli=True, include_dist=False): """ Performs an anonymous fitting, which allows distinct species in one structure to map to another. Returns a dictionary of species substitutions that are within tolerance Args: str...
def after_output(command_status): """ Shell sequence to be run after the command output. The ``command_status`` should be in the range 0-255. """ if command_status not in range(256): raise ValueError("command_status must be an integer in the range 0-255") sys.stdout.write(AFTER_OUTPUT.f...
def function[after_output, parameter[command_status]]: constant[ Shell sequence to be run after the command output. The ``command_status`` should be in the range 0-255. ] if compare[name[command_status] <ast.NotIn object at 0x7da2590d7190> call[name[range], parameter[constant[256]]]] begin[...
keyword[def] identifier[after_output] ( identifier[command_status] ): literal[string] keyword[if] identifier[command_status] keyword[not] keyword[in] identifier[range] ( literal[int] ): keyword[raise] identifier[ValueError] ( literal[string] ) identifier[sys] . identifier[stdout] . ident...
def after_output(command_status): """ Shell sequence to be run after the command output. The ``command_status`` should be in the range 0-255. """ if command_status not in range(256): raise ValueError('command_status must be an integer in the range 0-255') # depends on [control=['if'], data...
def create_timezone(tz, first_date=None, last_date=None): """ create an icalendar vtimezone from a pytz.tzinfo object :param tz: the timezone :type tz: pytz.tzinfo :param first_date: the very first datetime that needs to be included in the transition times, typically the DTSTART value of the (f...
def function[create_timezone, parameter[tz, first_date, last_date]]: constant[ create an icalendar vtimezone from a pytz.tzinfo object :param tz: the timezone :type tz: pytz.tzinfo :param first_date: the very first datetime that needs to be included in the transition times, typically the DT...
keyword[def] identifier[create_timezone] ( identifier[tz] , identifier[first_date] = keyword[None] , identifier[last_date] = keyword[None] ): literal[string] keyword[if] identifier[isinstance] ( identifier[tz] , identifier[pytz] . identifier[tzinfo] . identifier[StaticTzInfo] ): keyword[return] ...
def create_timezone(tz, first_date=None, last_date=None): """ create an icalendar vtimezone from a pytz.tzinfo object :param tz: the timezone :type tz: pytz.tzinfo :param first_date: the very first datetime that needs to be included in the transition times, typically the DTSTART value of the (f...
def select_splitfilejob_instance(curr_exe): """ This function returns an instance of the class that is appropriate for splitting an output file up within workflow (for e.g. splitbank). Parameters ---------- curr_exe : string The name of the Executable that is being used. curr_sectio...
def function[select_splitfilejob_instance, parameter[curr_exe]]: constant[ This function returns an instance of the class that is appropriate for splitting an output file up within workflow (for e.g. splitbank). Parameters ---------- curr_exe : string The name of the Executable that...
keyword[def] identifier[select_splitfilejob_instance] ( identifier[curr_exe] ): literal[string] keyword[if] identifier[curr_exe] == literal[string] : identifier[exe_class] = identifier[PycbcSplitBankExecutable] keyword[elif] identifier[curr_exe] == literal[string] : identifier[exe...
def select_splitfilejob_instance(curr_exe): """ This function returns an instance of the class that is appropriate for splitting an output file up within workflow (for e.g. splitbank). Parameters ---------- curr_exe : string The name of the Executable that is being used. curr_sectio...
def analyze(self): """Run analysis.""" precision = 'DP' if self.kernel.datatype == 'double' else 'SP' self.calculate_cache_access() self.results['max_perf'] = self.conv_perf(self.machine['clock'] * self.cores * \ self.machine['FLOPs per cycle'][precision]['total'])
def function[analyze, parameter[self]]: constant[Run analysis.] variable[precision] assign[=] <ast.IfExp object at 0x7da20c6ab970> call[name[self].calculate_cache_access, parameter[]] call[name[self].results][constant[max_perf]] assign[=] call[name[self].conv_perf, parameter[binary_opera...
keyword[def] identifier[analyze] ( identifier[self] ): literal[string] identifier[precision] = literal[string] keyword[if] identifier[self] . identifier[kernel] . identifier[datatype] == literal[string] keyword[else] literal[string] identifier[self] . identifier[calculate_cache_access...
def analyze(self): """Run analysis.""" precision = 'DP' if self.kernel.datatype == 'double' else 'SP' self.calculate_cache_access() self.results['max_perf'] = self.conv_perf(self.machine['clock'] * self.cores * self.machine['FLOPs per cycle'][precision]['total'])
def run_projected_dos(self, sigma=None, freq_min=None, freq_max=None, freq_pitch=None, use_tetrahedron_method=True, direction=None, xyz_pr...
def function[run_projected_dos, parameter[self, sigma, freq_min, freq_max, freq_pitch, use_tetrahedron_method, direction, xyz_projection]]: constant[Calculate projected DOS from phonons on sampling mesh. Parameters ---------- sigma : float, optional Smearing width for smeari...
keyword[def] identifier[run_projected_dos] ( identifier[self] , identifier[sigma] = keyword[None] , identifier[freq_min] = keyword[None] , identifier[freq_max] = keyword[None] , identifier[freq_pitch] = keyword[None] , identifier[use_tetrahedron_method] = keyword[True] , identifier[direction] = keyword[None] , ...
def run_projected_dos(self, sigma=None, freq_min=None, freq_max=None, freq_pitch=None, use_tetrahedron_method=True, direction=None, xyz_projection=False): """Calculate projected DOS from phonons on sampling mesh. Parameters ---------- sigma : float, optional Smearing width for s...
def cancel_reservation(self): """ This method cancel record set for hotel room reservation line ------------------------------------------------------------------ @param self: The object pointer @return: cancel record set for hotel room reservation line. """ room_...
def function[cancel_reservation, parameter[self]]: constant[ This method cancel record set for hotel room reservation line ------------------------------------------------------------------ @param self: The object pointer @return: cancel record set for hotel room reservation line...
keyword[def] identifier[cancel_reservation] ( identifier[self] ): literal[string] identifier[room_res_line_obj] = identifier[self] . identifier[env] [ literal[string] ] identifier[hotel_res_line_obj] = identifier[self] . identifier[env] [ literal[string] ] identifier[self] . ident...
def cancel_reservation(self): """ This method cancel record set for hotel room reservation line ------------------------------------------------------------------ @param self: The object pointer @return: cancel record set for hotel room reservation line. """ room_res_line...
def hash(self): """Return checksum to identify pages in same series.""" return hash( self._shape + ( self.tilewidth, self.tilelength, self.tiledepth, self.bitspersample, self.fillorder, self.predictor, self.extrasamples, self.photometric, self....
def function[hash, parameter[self]]: constant[Return checksum to identify pages in same series.] return[call[name[hash], parameter[binary_operation[name[self]._shape + tuple[[<ast.Attribute object at 0x7da1b18ce740>, <ast.Attribute object at 0x7da1b18ce7a0>, <ast.Attribute object at 0x7da1b18ce800>, <ast.At...
keyword[def] identifier[hash] ( identifier[self] ): literal[string] keyword[return] identifier[hash] ( identifier[self] . identifier[_shape] +( identifier[self] . identifier[tilewidth] , identifier[self] . identifier[tilelength] , identifier[self] . identifier[tiledepth] , ...
def hash(self): """Return checksum to identify pages in same series.""" return hash(self._shape + (self.tilewidth, self.tilelength, self.tiledepth, self.bitspersample, self.fillorder, self.predictor, self.extrasamples, self.photometric, self.compression, self.planarconfig))
def get_user(self, user_id, password): """ Retrieve a user record :param user_id: the user ID :param password: password :return: A :class:`meteorpi_model.User` if everything is correct :raises: ValueError if the user is fou...
def function[get_user, parameter[self, user_id, password]]: constant[ Retrieve a user record :param user_id: the user ID :param password: password :return: A :class:`meteorpi_model.User` if everything is correct :raises: Va...
keyword[def] identifier[get_user] ( identifier[self] , identifier[user_id] , identifier[password] ): literal[string] identifier[self] . identifier[con] . identifier[execute] ( literal[string] ,( identifier[user_id] ,)) identifier[results] = identifier[self] . identifier[con] . identifier[f...
def get_user(self, user_id, password): """ Retrieve a user record :param user_id: the user ID :param password: password :return: A :class:`meteorpi_model.User` if everything is correct :raises: ValueError if the user is found b...
def calcSubpopAvg(data,reference,cutoffs,weights=None): ''' Calculates the average of (weighted) data between cutoff percentiles of a reference variable. Parameters ---------- data : numpy.array A 1D array of float data. reference : numpy.array A 1D array of float data of th...
def function[calcSubpopAvg, parameter[data, reference, cutoffs, weights]]: constant[ Calculates the average of (weighted) data between cutoff percentiles of a reference variable. Parameters ---------- data : numpy.array A 1D array of float data. reference : numpy.array A...
keyword[def] identifier[calcSubpopAvg] ( identifier[data] , identifier[reference] , identifier[cutoffs] , identifier[weights] = keyword[None] ): literal[string] keyword[if] identifier[weights] keyword[is] keyword[None] : identifier[weights] = identifier[np] . identifier[ones] ( identifier[data]...
def calcSubpopAvg(data, reference, cutoffs, weights=None): """ Calculates the average of (weighted) data between cutoff percentiles of a reference variable. Parameters ---------- data : numpy.array A 1D array of float data. reference : numpy.array A 1D array of float data of...
def deploy_config(model, initial_instance_count, instance_type, endpoint_name=None, tags=None): """Export Airflow deploy config from a SageMaker model Args: model (sagemaker.model.Model): The SageMaker model to export the Airflow config from. instance_type (str): The EC2 instance type to deploy...
def function[deploy_config, parameter[model, initial_instance_count, instance_type, endpoint_name, tags]]: constant[Export Airflow deploy config from a SageMaker model Args: model (sagemaker.model.Model): The SageMaker model to export the Airflow config from. instance_type (str): The EC2 in...
keyword[def] identifier[deploy_config] ( identifier[model] , identifier[initial_instance_count] , identifier[instance_type] , identifier[endpoint_name] = keyword[None] , identifier[tags] = keyword[None] ): literal[string] identifier[model_base_config] = identifier[model_config] ( identifier[instance_type] ...
def deploy_config(model, initial_instance_count, instance_type, endpoint_name=None, tags=None): """Export Airflow deploy config from a SageMaker model Args: model (sagemaker.model.Model): The SageMaker model to export the Airflow config from. instance_type (str): The EC2 instance type to deploy...
def copyNode(self, extended): """Do a copy of the node. """ ret = libxml2mod.xmlCopyNode(self._o, extended) if ret is None:raise treeError('xmlCopyNode() failed') __tmp = xmlNode(_obj=ret) return __tmp
def function[copyNode, parameter[self, extended]]: constant[Do a copy of the node. ] variable[ret] assign[=] call[name[libxml2mod].xmlCopyNode, parameter[name[self]._o, name[extended]]] if compare[name[ret] is constant[None]] begin[:] <ast.Raise object at 0x7da1b1fa58d0> variable...
keyword[def] identifier[copyNode] ( identifier[self] , identifier[extended] ): literal[string] identifier[ret] = identifier[libxml2mod] . identifier[xmlCopyNode] ( identifier[self] . identifier[_o] , identifier[extended] ) keyword[if] identifier[ret] keyword[is] keyword[None] : keyword[...
def copyNode(self, extended): """Do a copy of the node. """ ret = libxml2mod.xmlCopyNode(self._o, extended) if ret is None: raise treeError('xmlCopyNode() failed') # depends on [control=['if'], data=[]] __tmp = xmlNode(_obj=ret) return __tmp
def AddStopObject(self, stop, problem_reporter=None): """Add Stop object to this schedule if stop_id is non-blank.""" assert stop._schedule is None if not problem_reporter: problem_reporter = self.problem_reporter if not stop.stop_id: return if stop.stop_id in self.stops: problem...
def function[AddStopObject, parameter[self, stop, problem_reporter]]: constant[Add Stop object to this schedule if stop_id is non-blank.] assert[compare[name[stop]._schedule is constant[None]]] if <ast.UnaryOp object at 0x7da1b160c4f0> begin[:] variable[problem_reporter] assign[=] na...
keyword[def] identifier[AddStopObject] ( identifier[self] , identifier[stop] , identifier[problem_reporter] = keyword[None] ): literal[string] keyword[assert] identifier[stop] . identifier[_schedule] keyword[is] keyword[None] keyword[if] keyword[not] identifier[problem_reporter] : identif...
def AddStopObject(self, stop, problem_reporter=None): """Add Stop object to this schedule if stop_id is non-blank.""" assert stop._schedule is None if not problem_reporter: problem_reporter = self.problem_reporter # depends on [control=['if'], data=[]] if not stop.stop_id: return # dep...
def scan(self, table, scan_filter=None, attributes_to_get=None, request_limit=None, max_results=None, count=False, exclusive_start_key=None, item_class=Item): """ Perform a scan of DynamoDB. :type table: :class:`boto.dynamodb.table.Table` :param table: The Tabl...
def function[scan, parameter[self, table, scan_filter, attributes_to_get, request_limit, max_results, count, exclusive_start_key, item_class]]: constant[ Perform a scan of DynamoDB. :type table: :class:`boto.dynamodb.table.Table` :param table: The Table object that is being scanned. ...
keyword[def] identifier[scan] ( identifier[self] , identifier[table] , identifier[scan_filter] = keyword[None] , identifier[attributes_to_get] = keyword[None] , identifier[request_limit] = keyword[None] , identifier[max_results] = keyword[None] , identifier[count] = keyword[False] , identifier[exclusive_start_key] ...
def scan(self, table, scan_filter=None, attributes_to_get=None, request_limit=None, max_results=None, count=False, exclusive_start_key=None, item_class=Item): """ Perform a scan of DynamoDB. :type table: :class:`boto.dynamodb.table.Table` :param table: The Table object that is being scanned...
def pkgconfig(*packages, **kw): """ Query pkg-config for library compile and linking options. Return configuration in distutils Extension format. Usage: pkgconfig('opencv') pkgconfig('opencv', 'libavformat') pkgconfig('opencv', optional='--static') pkgconfig('opencv', config=c) ...
def function[pkgconfig, parameter[]]: constant[ Query pkg-config for library compile and linking options. Return configuration in distutils Extension format. Usage: pkgconfig('opencv') pkgconfig('opencv', 'libavformat') pkgconfig('opencv', optional='--static') pkgconfig('opencv'...
keyword[def] identifier[pkgconfig] (* identifier[packages] ,** identifier[kw] ): literal[string] identifier[config] = identifier[kw] . identifier[setdefault] ( literal[string] ,{}) identifier[optional_args] = identifier[kw] . identifier[setdefault] ( literal[string] , literal[string] ) iden...
def pkgconfig(*packages, **kw): """ Query pkg-config for library compile and linking options. Return configuration in distutils Extension format. Usage: pkgconfig('opencv') pkgconfig('opencv', 'libavformat') pkgconfig('opencv', optional='--static') pkgconfig('opencv', config=c) ...
def SETNBE(cpu, dest): """ Sets byte if not below or equal. :param cpu: current CPU. :param dest: destination operand. """ dest.write(Operators.ITEBV(dest.size, Operators.AND(cpu.CF == False, cpu.ZF == False), 1, 0))
def function[SETNBE, parameter[cpu, dest]]: constant[ Sets byte if not below or equal. :param cpu: current CPU. :param dest: destination operand. ] call[name[dest].write, parameter[call[name[Operators].ITEBV, parameter[name[dest].size, call[name[Operators].AND, parameter...
keyword[def] identifier[SETNBE] ( identifier[cpu] , identifier[dest] ): literal[string] identifier[dest] . identifier[write] ( identifier[Operators] . identifier[ITEBV] ( identifier[dest] . identifier[size] , identifier[Operators] . identifier[AND] ( identifier[cpu] . identifier[CF] == keyword[Fals...
def SETNBE(cpu, dest): """ Sets byte if not below or equal. :param cpu: current CPU. :param dest: destination operand. """ dest.write(Operators.ITEBV(dest.size, Operators.AND(cpu.CF == False, cpu.ZF == False), 1, 0))
def watch(self, keys, on_watch, filters=None, start_revision=None, return_previous=None): """ Watch one or more keys or key sets and invoke a callback. Watch watches for events happening or that have happened. The entire event history can be watched starting from the last compaction rev...
def function[watch, parameter[self, keys, on_watch, filters, start_revision, return_previous]]: constant[ Watch one or more keys or key sets and invoke a callback. Watch watches for events happening or that have happened. The entire event history can be watched starting from the last co...
keyword[def] identifier[watch] ( identifier[self] , identifier[keys] , identifier[on_watch] , identifier[filters] = keyword[None] , identifier[start_revision] = keyword[None] , identifier[return_previous] = keyword[None] ): literal[string] identifier[d] = identifier[self] . identifier[_start_watchi...
def watch(self, keys, on_watch, filters=None, start_revision=None, return_previous=None): """ Watch one or more keys or key sets and invoke a callback. Watch watches for events happening or that have happened. The entire event history can be watched starting from the last compaction revisio...
def read_config( config_filepath, logger=logging.getLogger('ProsperCommon'), ): """fetch and parse config file Args: config_filepath (str): path to config file. abspath > relpath logger (:obj:`logging.Logger`): logger to catch error msgs """ config_parser = configparse...
def function[read_config, parameter[config_filepath, logger]]: constant[fetch and parse config file Args: config_filepath (str): path to config file. abspath > relpath logger (:obj:`logging.Logger`): logger to catch error msgs ] variable[config_parser] assign[=] call[name[conf...
keyword[def] identifier[read_config] ( identifier[config_filepath] , identifier[logger] = identifier[logging] . identifier[getLogger] ( literal[string] ), ): literal[string] identifier[config_parser] = identifier[configparser] . identifier[ConfigParser] ( identifier[interpolation] = identifier[Exten...
def read_config(config_filepath, logger=logging.getLogger('ProsperCommon')): """fetch and parse config file Args: config_filepath (str): path to config file. abspath > relpath logger (:obj:`logging.Logger`): logger to catch error msgs """ config_parser = configparser.ConfigParser(inte...
def serialize_instance(obj): """ 对象序列化 :param: * obj: (object) 对象实例 :return: * obj_dict: (dict) 对象序列化字典 举例如下:: print('--- serialize_instance demo ---') # 定义两个对象 class Obj(object): def __init__(self, a, b): self.a = a ...
def function[serialize_instance, parameter[obj]]: constant[ 对象序列化 :param: * obj: (object) 对象实例 :return: * obj_dict: (dict) 对象序列化字典 举例如下:: print('--- serialize_instance demo ---') # 定义两个对象 class Obj(object): def __init__(self, a, b): ...
keyword[def] identifier[serialize_instance] ( identifier[obj] ): literal[string] identifier[obj_dict] ={ literal[string] : identifier[type] ( identifier[obj] ). identifier[__name__] } identifier[obj_dict] . identifier[update] ( identifier[obj] . identifier[__dict__] ) keyword[for] identifier[key...
def serialize_instance(obj): """ 对象序列化 :param: * obj: (object) 对象实例 :return: * obj_dict: (dict) 对象序列化字典 举例如下:: print('--- serialize_instance demo ---') # 定义两个对象 class Obj(object): def __init__(self, a, b): self.a = a ...
def check(self, var): """Return True if the variable matches the specified type.""" return (isinstance(var, _num_type) and (self._lower_bound is None or var >= self._lower_bound) and (self._upper_bound is None or var <= self._upper_bound))
def function[check, parameter[self, var]]: constant[Return True if the variable matches the specified type.] return[<ast.BoolOp object at 0x7da1b03ba620>]
keyword[def] identifier[check] ( identifier[self] , identifier[var] ): literal[string] keyword[return] ( identifier[isinstance] ( identifier[var] , identifier[_num_type] ) keyword[and] ( identifier[self] . identifier[_lower_bound] keyword[is] keyword[None] keyword[or] identifier[var] >...
def check(self, var): """Return True if the variable matches the specified type.""" return isinstance(var, _num_type) and (self._lower_bound is None or var >= self._lower_bound) and (self._upper_bound is None or var <= self._upper_bound)
def get_gradebook_columns_by_search(self, gradebook_column_query, gradebook_column_search): """Pass through to provider GradebookColumnSearchSession.get_gradebook_columns_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template ...
def function[get_gradebook_columns_by_search, parameter[self, gradebook_column_query, gradebook_column_search]]: constant[Pass through to provider GradebookColumnSearchSession.get_gradebook_columns_by_search] if <ast.UnaryOp object at 0x7da18bc70070> begin[:] <ast.Raise object at 0x7da18bc70b80>...
keyword[def] identifier[get_gradebook_columns_by_search] ( identifier[self] , identifier[gradebook_column_query] , identifier[gradebook_column_search] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_can] ( literal[string] ): keyword[raise]...
def get_gradebook_columns_by_search(self, gradebook_column_query, gradebook_column_search): """Pass through to provider GradebookColumnSearchSession.get_gradebook_columns_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not s...
def get(self, name): """Get a device model property. Args: name (str): The name of the property to get """ name = str(name) if name not in self._properties: raise ArgumentError("Unknown property in DeviceModel", name=name) return self._propertie...
def function[get, parameter[self, name]]: constant[Get a device model property. Args: name (str): The name of the property to get ] variable[name] assign[=] call[name[str], parameter[name[name]]] if compare[name[name] <ast.NotIn object at 0x7da2590d7190> name[self]._...
keyword[def] identifier[get] ( identifier[self] , identifier[name] ): literal[string] identifier[name] = identifier[str] ( identifier[name] ) keyword[if] identifier[name] keyword[not] keyword[in] identifier[self] . identifier[_properties] : keyword[raise] identifier[Argu...
def get(self, name): """Get a device model property. Args: name (str): The name of the property to get """ name = str(name) if name not in self._properties: raise ArgumentError('Unknown property in DeviceModel', name=name) # depends on [control=['if'], data=['name']] ...
def _module_to_generators(pb_module): ''' Convert a protobuf module to a dict of generators. This is typically used with modules that contain multiple type definitions. ''' if not pb_module: return None message_types = pb_module.DESCRIPTOR.message_types_by_name return {k: ProtobufGe...
def function[_module_to_generators, parameter[pb_module]]: constant[ Convert a protobuf module to a dict of generators. This is typically used with modules that contain multiple type definitions. ] if <ast.UnaryOp object at 0x7da1b1721e40> begin[:] return[constant[None]] var...
keyword[def] identifier[_module_to_generators] ( identifier[pb_module] ): literal[string] keyword[if] keyword[not] identifier[pb_module] : keyword[return] keyword[None] identifier[message_types] = identifier[pb_module] . identifier[DESCRIPTOR] . identifier[message_types_by_name] key...
def _module_to_generators(pb_module): """ Convert a protobuf module to a dict of generators. This is typically used with modules that contain multiple type definitions. """ if not pb_module: return None # depends on [control=['if'], data=[]] message_types = pb_module.DESCRIPTOR.message...
def infer_complexes(stmts): """Return inferred Complex from Statements implying physical interaction. Parameters ---------- stmts : list[indra.statements.Statement] A list of Statements to infer Complexes from. Returns ------- linked_stmts : list[ind...
def function[infer_complexes, parameter[stmts]]: constant[Return inferred Complex from Statements implying physical interaction. Parameters ---------- stmts : list[indra.statements.Statement] A list of Statements to infer Complexes from. Returns ------- ...
keyword[def] identifier[infer_complexes] ( identifier[stmts] ): literal[string] identifier[interact_stmts] = identifier[_get_statements_by_type] ( identifier[stmts] , identifier[Modification] ) identifier[linked_stmts] =[] keyword[for] identifier[mstmt] keyword[in] identifier[i...
def infer_complexes(stmts): """Return inferred Complex from Statements implying physical interaction. Parameters ---------- stmts : list[indra.statements.Statement] A list of Statements to infer Complexes from. Returns ------- linked_stmts : list[indra.m...
def register_action(action): """ Adds an action to the parser cli. :param action(BaseAction): a subclass of the BaseAction class """ sub = _subparsers.add_parser(action.meta('cmd'), help=action.meta('help')) sub.set_defaults(cmd=action.meta('cmd')) for (name, arg) in action.props().items(): sub.add_a...
def function[register_action, parameter[action]]: constant[ Adds an action to the parser cli. :param action(BaseAction): a subclass of the BaseAction class ] variable[sub] assign[=] call[name[_subparsers].add_parser, parameter[call[name[action].meta, parameter[constant[cmd]]]]] call[name[...
keyword[def] identifier[register_action] ( identifier[action] ): literal[string] identifier[sub] = identifier[_subparsers] . identifier[add_parser] ( identifier[action] . identifier[meta] ( literal[string] ), identifier[help] = identifier[action] . identifier[meta] ( literal[string] )) identifier[sub] . ide...
def register_action(action): """ Adds an action to the parser cli. :param action(BaseAction): a subclass of the BaseAction class """ sub = _subparsers.add_parser(action.meta('cmd'), help=action.meta('help')) sub.set_defaults(cmd=action.meta('cmd')) for (name, arg) in action.props().items(): ...
def greenlet_admin(self): """ This greenlet is used to get status information about the worker when --admin_port was given """ if self.config["processes"] > 1: self.log.debug( "Admin server disabled because of multiple processes.") return ...
def function[greenlet_admin, parameter[self]]: constant[ This greenlet is used to get status information about the worker when --admin_port was given ] if compare[call[name[self].config][constant[processes]] greater[>] constant[1]] begin[:] call[name[self].log.debug, ...
keyword[def] identifier[greenlet_admin] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[config] [ literal[string] ]> literal[int] : identifier[self] . identifier[log] . identifier[debug] ( literal[string] ) keyword[return] ...
def greenlet_admin(self): """ This greenlet is used to get status information about the worker when --admin_port was given """ if self.config['processes'] > 1: self.log.debug('Admin server disabled because of multiple processes.') return # depends on [control=['if'], data=[]...
def list_grad(self): """Returns gradient buffers on all contexts, in the same order as :py:meth:`values`.""" if self._data is not None and self._grad is None: raise RuntimeError( "Cannot get gradient array for Parameter '%s' " \ "because grad_req='null...
def function[list_grad, parameter[self]]: constant[Returns gradient buffers on all contexts, in the same order as :py:meth:`values`.] if <ast.BoolOp object at 0x7da1b200b880> begin[:] <ast.Raise object at 0x7da1b200bf40> return[call[name[self]._check_and_get, parameter[name[self]._gr...
keyword[def] identifier[list_grad] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_data] keyword[is] keyword[not] keyword[None] keyword[and] identifier[self] . identifier[_grad] keyword[is] keyword[None] : keyword[raise] identifier[RuntimeError...
def list_grad(self): """Returns gradient buffers on all contexts, in the same order as :py:meth:`values`.""" if self._data is not None and self._grad is None: raise RuntimeError("Cannot get gradient array for Parameter '%s' because grad_req='null'" % self.name) # depends on [control=['if'], dat...
def predictOnValues(self, dstream): """ Make predictions on a keyed dstream. Returns a transformed dstream object. """ self._validate(dstream) return dstream.mapValues(lambda x: self._model.predict(x))
def function[predictOnValues, parameter[self, dstream]]: constant[ Make predictions on a keyed dstream. Returns a transformed dstream object. ] call[name[self]._validate, parameter[name[dstream]]] return[call[name[dstream].mapValues, parameter[<ast.Lambda object at 0x7da20496...
keyword[def] identifier[predictOnValues] ( identifier[self] , identifier[dstream] ): literal[string] identifier[self] . identifier[_validate] ( identifier[dstream] ) keyword[return] identifier[dstream] . identifier[mapValues] ( keyword[lambda] identifier[x] : identifier[self] . identifie...
def predictOnValues(self, dstream): """ Make predictions on a keyed dstream. Returns a transformed dstream object. """ self._validate(dstream) return dstream.mapValues(lambda x: self._model.predict(x))
def generate_oauth2_headers(self): """Generates header for oauth2 """ encoded_credentials = base64.b64encode(('{0}:{1}'.format(self.consumer_key,self.consumer_secret)).encode('utf-8')) headers={ 'Authorization':'Basic {0}'.format(encoded_credentials.decode('utf-8')), ...
def function[generate_oauth2_headers, parameter[self]]: constant[Generates header for oauth2 ] variable[encoded_credentials] assign[=] call[name[base64].b64encode, parameter[call[call[constant[{0}:{1}].format, parameter[name[self].consumer_key, name[self].consumer_secret]].encode, parameter[cons...
keyword[def] identifier[generate_oauth2_headers] ( identifier[self] ): literal[string] identifier[encoded_credentials] = identifier[base64] . identifier[b64encode] (( literal[string] . identifier[format] ( identifier[self] . identifier[consumer_key] , identifier[self] . identifier[consumer_secret] ...
def generate_oauth2_headers(self): """Generates header for oauth2 """ encoded_credentials = base64.b64encode('{0}:{1}'.format(self.consumer_key, self.consumer_secret).encode('utf-8')) headers = {'Authorization': 'Basic {0}'.format(encoded_credentials.decode('utf-8')), 'Content-Type': 'application/x-...
def forward(self, x): """ Args: x (:class:`torch.FloatTensor` [batch size, sequence length, rnn hidden size]): Input to apply dropout too. """ if not self.training or not self.p: return x x = x.clone() mask = x.new_empty(1, x.size(1...
def function[forward, parameter[self, x]]: constant[ Args: x (:class:`torch.FloatTensor` [batch size, sequence length, rnn hidden size]): Input to apply dropout too. ] if <ast.BoolOp object at 0x7da1b1b441c0> begin[:] return[name[x]] variable[x...
keyword[def] identifier[forward] ( identifier[self] , identifier[x] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[training] keyword[or] keyword[not] identifier[self] . identifier[p] : keyword[return] identifier[x] identifier[x] = identifier[x...
def forward(self, x): """ Args: x (:class:`torch.FloatTensor` [batch size, sequence length, rnn hidden size]): Input to apply dropout too. """ if not self.training or not self.p: return x # depends on [control=['if'], data=[]] x = x.clone() mask = x.n...
def learn_sfa(self, mma=None): """ Implements the high level loop of the algorithm for learning a Mealy machine. Args: mma: Returns: MealyMachine: A model for the Mealy machine to be learned. """ logging.info('Initializing learning procedur...
def function[learn_sfa, parameter[self, mma]]: constant[ Implements the high level loop of the algorithm for learning a Mealy machine. Args: mma: Returns: MealyMachine: A model for the Mealy machine to be learned. ] call[name[logging].info,...
keyword[def] identifier[learn_sfa] ( identifier[self] , identifier[mma] = keyword[None] ): literal[string] identifier[logging] . identifier[info] ( literal[string] ) keyword[if] identifier[mma] : identifier[self] . identifier[_init_table_from_dfa] ( identifier[mma] ) ...
def learn_sfa(self, mma=None): """ Implements the high level loop of the algorithm for learning a Mealy machine. Args: mma: Returns: MealyMachine: A model for the Mealy machine to be learned. """ logging.info('Initializing learning procedure.') ...
def can_vote_in_poll(self, poll, user): """ Given a poll, checks whether the user can answer to it. """ # First we have to check if the poll is curently open if poll.duration: poll_dtend = poll.created + dt.timedelta(days=poll.duration) if poll_dtend < now(): ...
def function[can_vote_in_poll, parameter[self, poll, user]]: constant[ Given a poll, checks whether the user can answer to it. ] if name[poll].duration begin[:] variable[poll_dtend] assign[=] binary_operation[name[poll].created + call[name[dt].timedelta, parameter[]]] if ...
keyword[def] identifier[can_vote_in_poll] ( identifier[self] , identifier[poll] , identifier[user] ): literal[string] keyword[if] identifier[poll] . identifier[duration] : identifier[poll_dtend] = identifier[poll] . identifier[created] + identifier[dt] . identifier[timedelta]...
def can_vote_in_poll(self, poll, user): """ Given a poll, checks whether the user can answer to it. """ # First we have to check if the poll is curently open if poll.duration: poll_dtend = poll.created + dt.timedelta(days=poll.duration) if poll_dtend < now(): return False # depe...
def pi (self, data): """ Print HTML pi. @param data: the tag data @type data: string @return: None """ data = data.encode(self.encoding, "ignore") self.fd.write("<?%s?>" % data)
def function[pi, parameter[self, data]]: constant[ Print HTML pi. @param data: the tag data @type data: string @return: None ] variable[data] assign[=] call[name[data].encode, parameter[name[self].encoding, constant[ignore]]] call[name[self].fd.write, par...
keyword[def] identifier[pi] ( identifier[self] , identifier[data] ): literal[string] identifier[data] = identifier[data] . identifier[encode] ( identifier[self] . identifier[encoding] , literal[string] ) identifier[self] . identifier[fd] . identifier[write] ( literal[string] % identifier[d...
def pi(self, data): """ Print HTML pi. @param data: the tag data @type data: string @return: None """ data = data.encode(self.encoding, 'ignore') self.fd.write('<?%s?>' % data)
def parse_balanced_image(self, markup): """ Corrects Wikipedia image markup. Images have a description inside their link markup that can contain link markup itself, make sure the outer "[" and "]" brackets delimiting the image are balanced correctly (e.g. no [[ ]] ]]). ...
def function[parse_balanced_image, parameter[self, markup]]: constant[ Corrects Wikipedia image markup. Images have a description inside their link markup that can contain link markup itself, make sure the outer "[" and "]" brackets delimiting the image are balanced correctly (e.g. no...
keyword[def] identifier[parse_balanced_image] ( identifier[self] , identifier[markup] ): literal[string] identifier[opened] = literal[int] identifier[closed] = literal[int] keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[len] ( identifier[markup] )): ...
def parse_balanced_image(self, markup): """ Corrects Wikipedia image markup. Images have a description inside their link markup that can contain link markup itself, make sure the outer "[" and "]" brackets delimiting the image are balanced correctly (e.g. no [[ ]] ]]). Called fro...
def find_file_in_load_dirs(relpath): """If given relative path exists in one of DevAssistant load paths, return its full path. Args: relpath: a relative path, e.g. "assitants/crt/test.yaml" Returns: absolute path of the file, e.g. "/home/x/.devassistant/assistanta/crt/test.yaml ...
def function[find_file_in_load_dirs, parameter[relpath]]: constant[If given relative path exists in one of DevAssistant load paths, return its full path. Args: relpath: a relative path, e.g. "assitants/crt/test.yaml" Returns: absolute path of the file, e.g. "/home/x/.devassistant/a...
keyword[def] identifier[find_file_in_load_dirs] ( identifier[relpath] ): literal[string] keyword[if] identifier[relpath] . identifier[startswith] ( identifier[os] . identifier[path] . identifier[sep] ): identifier[relpath] = identifier[relpath] . identifier[lstrip] ( identifier[os] . identifier[p...
def find_file_in_load_dirs(relpath): """If given relative path exists in one of DevAssistant load paths, return its full path. Args: relpath: a relative path, e.g. "assitants/crt/test.yaml" Returns: absolute path of the file, e.g. "/home/x/.devassistant/assistanta/crt/test.yaml ...
def dropbox_post_factory(request): """receives a UUID via the request and returns either a fresh or an existing dropbox for it""" try: max_age = int(request.registry.settings.get('post_token_max_age_seconds')) except Exception: max_age = 300 try: drop_id = parse_post_token( ...
def function[dropbox_post_factory, parameter[request]]: constant[receives a UUID via the request and returns either a fresh or an existing dropbox for it] <ast.Try object at 0x7da1affc1ea0> <ast.Try object at 0x7da1affc1600> variable[dropbox] assign[=] call[call[name[request].registry.settin...
keyword[def] identifier[dropbox_post_factory] ( identifier[request] ): literal[string] keyword[try] : identifier[max_age] = identifier[int] ( identifier[request] . identifier[registry] . identifier[settings] . identifier[get] ( literal[string] )) keyword[except] identifier[Exception] : ...
def dropbox_post_factory(request): """receives a UUID via the request and returns either a fresh or an existing dropbox for it""" try: max_age = int(request.registry.settings.get('post_token_max_age_seconds')) # depends on [control=['try'], data=[]] except Exception: max_age = 300 # de...
def remove(self, docid): """ Remove a document from the database. """ docid = int(docid) self.store.executeSQL(self.removeSQL, (docid,))
def function[remove, parameter[self, docid]]: constant[ Remove a document from the database. ] variable[docid] assign[=] call[name[int], parameter[name[docid]]] call[name[self].store.executeSQL, parameter[name[self].removeSQL, tuple[[<ast.Name object at 0x7da1b0a4f430>]]]]
keyword[def] identifier[remove] ( identifier[self] , identifier[docid] ): literal[string] identifier[docid] = identifier[int] ( identifier[docid] ) identifier[self] . identifier[store] . identifier[executeSQL] ( identifier[self] . identifier[removeSQL] ,( identifier[docid] ,))
def remove(self, docid): """ Remove a document from the database. """ docid = int(docid) self.store.executeSQL(self.removeSQL, (docid,))
def retrieve_in(self, key, *paths, **kwargs): """Atomically fetch one or more paths from a document. Convenience method for retrieval operations. This functions identically to :meth:`lookup_in`. As such, the following two forms are equivalent: .. code-block:: python ...
def function[retrieve_in, parameter[self, key]]: constant[Atomically fetch one or more paths from a document. Convenience method for retrieval operations. This functions identically to :meth:`lookup_in`. As such, the following two forms are equivalent: .. code-block:: python ...
keyword[def] identifier[retrieve_in] ( identifier[self] , identifier[key] ,* identifier[paths] ,** identifier[kwargs] ): literal[string] keyword[import] identifier[couchbase] . identifier[subdocument] keyword[as] identifier[SD] keyword[return] identifier[self] . identifier[lookup_in] ...
def retrieve_in(self, key, *paths, **kwargs): """Atomically fetch one or more paths from a document. Convenience method for retrieval operations. This functions identically to :meth:`lookup_in`. As such, the following two forms are equivalent: .. code-block:: python im...
def splitport(host): """splitport('host:port') --> 'host', 'port'.""" global _portprog if _portprog is None: import re _portprog = re.compile('^(.*):([0-9]+)$') match = _portprog.match(host) if match: return match.group(1, 2) return host, None
def function[splitport, parameter[host]]: constant[splitport('host:port') --> 'host', 'port'.] <ast.Global object at 0x7da20c992440> if compare[name[_portprog] is constant[None]] begin[:] import module[re] variable[_portprog] assign[=] call[name[re].compile, parameter[constan...
keyword[def] identifier[splitport] ( identifier[host] ): literal[string] keyword[global] identifier[_portprog] keyword[if] identifier[_portprog] keyword[is] keyword[None] : keyword[import] identifier[re] identifier[_portprog] = identifier[re] . identifier[compile] ( literal[st...
def splitport(host): """splitport('host:port') --> 'host', 'port'.""" global _portprog if _portprog is None: import re _portprog = re.compile('^(.*):([0-9]+)$') # depends on [control=['if'], data=['_portprog']] match = _portprog.match(host) if match: return match.group(1, 2)...