code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def existing_versions(self): """ Returns data with different cfgstr values that were previously computed with this cacher. Example: >>> from ubelt.util_cache import Cacher >>> # Ensure that some data exists >>> known_fnames = set() >>> cac...
def function[existing_versions, parameter[self]]: constant[ Returns data with different cfgstr values that were previously computed with this cacher. Example: >>> from ubelt.util_cache import Cacher >>> # Ensure that some data exists >>> known_fnames ...
keyword[def] identifier[existing_versions] ( identifier[self] ): literal[string] keyword[import] identifier[glob] identifier[pattern] = identifier[join] ( identifier[self] . identifier[dpath] , identifier[self] . identifier[fname] + literal[string] + identifier[self] . identifier[ext] ) ...
def existing_versions(self): """ Returns data with different cfgstr values that were previously computed with this cacher. Example: >>> from ubelt.util_cache import Cacher >>> # Ensure that some data exists >>> known_fnames = set() >>> cacher ...
def restore(name): """Restores the database from a snapshot""" app = get_app() if not name: snapshot = app.get_latest_snapshot() if not snapshot: click.echo( "Couldn't find any snapshots for project %s" % load_config()['project_name'] ...
def function[restore, parameter[name]]: constant[Restores the database from a snapshot] variable[app] assign[=] call[name[get_app], parameter[]] if <ast.UnaryOp object at 0x7da1b0537d00> begin[:] variable[snapshot] assign[=] call[name[app].get_latest_snapshot, parameter[]] ...
keyword[def] identifier[restore] ( identifier[name] ): literal[string] identifier[app] = identifier[get_app] () keyword[if] keyword[not] identifier[name] : identifier[snapshot] = identifier[app] . identifier[get_latest_snapshot] () keyword[if] keyword[not] identifier[snapshot] :...
def restore(name): """Restores the database from a snapshot""" app = get_app() if not name: snapshot = app.get_latest_snapshot() if not snapshot: click.echo("Couldn't find any snapshots for project %s" % load_config()['project_name']) sys.exit(1) # depends on [contro...
def get_attribute(cls, soup, key, unknown=None): """ Get attribute for Beautifulsoup object :param soup: Beautifulsoup object :param key: attribute key :param unknown: attribute key not exists value(default:None) :return: attribute value """ if key in soup...
def function[get_attribute, parameter[cls, soup, key, unknown]]: constant[ Get attribute for Beautifulsoup object :param soup: Beautifulsoup object :param key: attribute key :param unknown: attribute key not exists value(default:None) :return: attribute value ] ...
keyword[def] identifier[get_attribute] ( identifier[cls] , identifier[soup] , identifier[key] , identifier[unknown] = keyword[None] ): literal[string] keyword[if] identifier[key] keyword[in] identifier[soup] . identifier[attrs] : keyword[return] identifier[soup] . identifier[get] (...
def get_attribute(cls, soup, key, unknown=None): """ Get attribute for Beautifulsoup object :param soup: Beautifulsoup object :param key: attribute key :param unknown: attribute key not exists value(default:None) :return: attribute value """ if key in soup.attrs: ...
def leaveEvent(self, event): """ Reimplemented to start the hide timer. """ super(CallTipWidget, self).leaveEvent(event) self._leave_event_hide()
def function[leaveEvent, parameter[self, event]]: constant[ Reimplemented to start the hide timer. ] call[call[name[super], parameter[name[CallTipWidget], name[self]]].leaveEvent, parameter[name[event]]] call[name[self]._leave_event_hide, parameter[]]
keyword[def] identifier[leaveEvent] ( identifier[self] , identifier[event] ): literal[string] identifier[super] ( identifier[CallTipWidget] , identifier[self] ). identifier[leaveEvent] ( identifier[event] ) identifier[self] . identifier[_leave_event_hide] ()
def leaveEvent(self, event): """ Reimplemented to start the hide timer. """ super(CallTipWidget, self).leaveEvent(event) self._leave_event_hide()
def printMe(self, selfTag, selfValue): '''Parse the single and its value and return the parsed str. Args: selfTag (str): The tag. Normally just ``self.tag`` selfValue (list): a list of value elements(single, subclasses, str, int). Normally just ``self.value`` Returns: ...
def function[printMe, parameter[self, selfTag, selfValue]]: constant[Parse the single and its value and return the parsed str. Args: selfTag (str): The tag. Normally just ``self.tag`` selfValue (list): a list of value elements(single, subclasses, str, int). Normally just ``self.va...
keyword[def] identifier[printMe] ( identifier[self] , identifier[selfTag] , identifier[selfValue] ): literal[string] keyword[if] identifier[len] ( identifier[selfValue] )== literal[int] : keyword[return] literal[string] keyword[elif] identifier[le...
def printMe(self, selfTag, selfValue): """Parse the single and its value and return the parsed str. Args: selfTag (str): The tag. Normally just ``self.tag`` selfValue (list): a list of value elements(single, subclasses, str, int). Normally just ``self.value`` Returns: ...
def move(self, partition, source, dest): """Return a new state that is the result of moving a single partition. :param partition: The partition index of the partition to move. :param source: The broker index of the broker to move the partition from. :param dest: The broker i...
def function[move, parameter[self, partition, source, dest]]: constant[Return a new state that is the result of moving a single partition. :param partition: The partition index of the partition to move. :param source: The broker index of the broker to move the partition from. ...
keyword[def] identifier[move] ( identifier[self] , identifier[partition] , identifier[source] , identifier[dest] ): literal[string] identifier[new_state] = identifier[copy] ( identifier[self] ) identifier[source_index] = identifier[self] . identifier[replicas] [ identifier[partit...
def move(self, partition, source, dest): """Return a new state that is the result of moving a single partition. :param partition: The partition index of the partition to move. :param source: The broker index of the broker to move the partition from. :param dest: The broker index...
def setup_file_logging(log_filename, log_file_level="DEBUG", str_format=None, date_format=None, log_restart=False, log_history=False, formatter=None, silence_modules=None, log_filter=None): """ This will setup logging for a single file but can be called more than on...
def function[setup_file_logging, parameter[log_filename, log_file_level, str_format, date_format, log_restart, log_history, formatter, silence_modules, log_filter]]: constant[ This will setup logging for a single file but can be called more than once LOG LEVELS are "CRITICAL", "ERROR", "INFO", "DEBUG" ...
keyword[def] identifier[setup_file_logging] ( identifier[log_filename] , identifier[log_file_level] = literal[string] , identifier[str_format] = keyword[None] , identifier[date_format] = keyword[None] , identifier[log_restart] = keyword[False] , identifier[log_history] = keyword[False] , identifier[formatter] = key...
def setup_file_logging(log_filename, log_file_level='DEBUG', str_format=None, date_format=None, log_restart=False, log_history=False, formatter=None, silence_modules=None, log_filter=None): """ This will setup logging for a single file but can be called more than once LOG LEVELS are "CRITICAL", "ERROR", "IN...
def patch_python_logging_handlers(): ''' Patch the python logging handlers with out mixed-in classes ''' logging.StreamHandler = StreamHandler logging.FileHandler = FileHandler logging.handlers.SysLogHandler = SysLogHandler logging.handlers.WatchedFileHandler = WatchedFileHandler logging...
def function[patch_python_logging_handlers, parameter[]]: constant[ Patch the python logging handlers with out mixed-in classes ] name[logging].StreamHandler assign[=] name[StreamHandler] name[logging].FileHandler assign[=] name[FileHandler] name[logging].handlers.SysLogHandler a...
keyword[def] identifier[patch_python_logging_handlers] (): literal[string] identifier[logging] . identifier[StreamHandler] = identifier[StreamHandler] identifier[logging] . identifier[FileHandler] = identifier[FileHandler] identifier[logging] . identifier[handlers] . identifier[SysLogHandler] =...
def patch_python_logging_handlers(): """ Patch the python logging handlers with out mixed-in classes """ logging.StreamHandler = StreamHandler logging.FileHandler = FileHandler logging.handlers.SysLogHandler = SysLogHandler logging.handlers.WatchedFileHandler = WatchedFileHandler logging...
def height(self, minimum: float = 1.5, maximum: float = 2.0) -> str: """Generate a random height in M (Meter). :param minimum: Minimum value. :param float maximum: Maximum value. :return: Height. :Example: 1.85. """ h = self.random.uniform(minimum, m...
def function[height, parameter[self, minimum, maximum]]: constant[Generate a random height in M (Meter). :param minimum: Minimum value. :param float maximum: Maximum value. :return: Height. :Example: 1.85. ] variable[h] assign[=] call[name[self].rand...
keyword[def] identifier[height] ( identifier[self] , identifier[minimum] : identifier[float] = literal[int] , identifier[maximum] : identifier[float] = literal[int] )-> identifier[str] : literal[string] identifier[h] = identifier[self] . identifier[random] . identifier[uniform] ( identifier[minimum...
def height(self, minimum: float=1.5, maximum: float=2.0) -> str: """Generate a random height in M (Meter). :param minimum: Minimum value. :param float maximum: Maximum value. :return: Height. :Example: 1.85. """ h = self.random.uniform(minimum, maximum) ...
def get_agenda(self, conservative: bool = False): """ Returns an agenda that can be used guide search. Parameters ---------- conservative : ``bool`` Setting this flag will return a subset of the agenda items that correspond to high conf...
def function[get_agenda, parameter[self, conservative]]: constant[ Returns an agenda that can be used guide search. Parameters ---------- conservative : ``bool`` Setting this flag will return a subset of the agenda items that correspond to high confidence...
keyword[def] identifier[get_agenda] ( identifier[self] , identifier[conservative] : identifier[bool] = keyword[False] ): literal[string] identifier[agenda_items] =[] identifier[question_tokens] =[ identifier[token] . identifier[text] keyword[for] identifier[token] keyword[in] identifi...
def get_agenda(self, conservative: bool=False): """ Returns an agenda that can be used guide search. Parameters ---------- conservative : ``bool`` Setting this flag will return a subset of the agenda items that correspond to high confidence lexical matches. Y...
def check_sufficient_inputs(self): '''Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. ''' if not ((self.T and self.P) or (self.T and self.V) or (self.P and self.V)): raise Exception('Either T and P, or T and V, or P and V are required')
def function[check_sufficient_inputs, parameter[self]]: constant[Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. ] if <ast.UnaryOp object at 0x7da1b2345db0> begin[:] <ast.Raise object at 0x7da1b2345120>
keyword[def] identifier[check_sufficient_inputs] ( identifier[self] ): literal[string] keyword[if] keyword[not] (( identifier[self] . identifier[T] keyword[and] identifier[self] . identifier[P] ) keyword[or] ( identifier[self] . identifier[T] keyword[and] identifier[self] . identifier[V] ) key...
def check_sufficient_inputs(self): """Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. """ if not (self.T and self.P or (self.T and self.V) or (self.P and self.V)): raise Exception('Either T and P, or T and V, or P and V are required') # depends on [control=['if...
def _write_new_tag_to_init(self): """ Write version to __init__.py by editing in place """ for line in fileinput.input(self.init_file, inplace=1): if line.strip().startswith("__version__"): line = "__version__ = \"" + self.tag + "\"" print(line.str...
def function[_write_new_tag_to_init, parameter[self]]: constant[ Write version to __init__.py by editing in place ] for taget[name[line]] in starred[call[name[fileinput].input, parameter[name[self].init_file]]] begin[:] if call[call[name[line].strip, parameter[]].startswi...
keyword[def] identifier[_write_new_tag_to_init] ( identifier[self] ): literal[string] keyword[for] identifier[line] keyword[in] identifier[fileinput] . identifier[input] ( identifier[self] . identifier[init_file] , identifier[inplace] = literal[int] ): keyword[if] identifier[line] ...
def _write_new_tag_to_init(self): """ Write version to __init__.py by editing in place """ for line in fileinput.input(self.init_file, inplace=1): if line.strip().startswith('__version__'): line = '__version__ = "' + self.tag + '"' # depends on [control=['if'], data=[]] ...
def model(self, voltages=True, sensitivities=False, potentials=False, output_directory=None, silent=False, ): """Forward model the tomodir and read in the results """ self._check_state() if self.can_model...
def function[model, parameter[self, voltages, sensitivities, potentials, output_directory, silent]]: constant[Forward model the tomodir and read in the results ] call[name[self]._check_state, parameter[]] if name[self].can_model begin[:] if compare[name[output_directory] ...
keyword[def] identifier[model] ( identifier[self] , identifier[voltages] = keyword[True] , identifier[sensitivities] = keyword[False] , identifier[potentials] = keyword[False] , identifier[output_directory] = keyword[None] , identifier[silent] = keyword[False] , ): literal[string] identifier[s...
def model(self, voltages=True, sensitivities=False, potentials=False, output_directory=None, silent=False): """Forward model the tomodir and read in the results """ self._check_state() if self.can_model: if output_directory is not None: if not os.path.isdir(output_directory): ...
def write(self, data): """Print any command sent in raw format. :param bytes data: arbitrary code to be printed. """ self.device.write(data) if self.auto_flush: self.flush()
def function[write, parameter[self, data]]: constant[Print any command sent in raw format. :param bytes data: arbitrary code to be printed. ] call[name[self].device.write, parameter[name[data]]] if name[self].auto_flush begin[:] call[name[self].flush, parameter[]...
keyword[def] identifier[write] ( identifier[self] , identifier[data] ): literal[string] identifier[self] . identifier[device] . identifier[write] ( identifier[data] ) keyword[if] identifier[self] . identifier[auto_flush] : identifier[self] . identifier[flush] ()
def write(self, data): """Print any command sent in raw format. :param bytes data: arbitrary code to be printed. """ self.device.write(data) if self.auto_flush: self.flush() # depends on [control=['if'], data=[]]
def urlencode(query): """Encode string to be used in urls (percent encoding). :param query: string to be encoded :type query: str :return: urlencoded string :rtype: str :Example: >>> urlencode('pekná líščička') 'pekn%C3%A1%20l%C3%AD%C5%A1%C4%8Di%C4%8Dka' """ if hasattr(...
def function[urlencode, parameter[query]]: constant[Encode string to be used in urls (percent encoding). :param query: string to be encoded :type query: str :return: urlencoded string :rtype: str :Example: >>> urlencode('pekná líščička') 'pekn%C3%A1%20l%C3%AD%C5%A1%C4%8Di%C...
keyword[def] identifier[urlencode] ( identifier[query] ): literal[string] keyword[if] identifier[hasattr] ( identifier[urllib] , literal[string] ): keyword[return] identifier[urllib] . identifier[parse] . identifier[urlencode] ( identifier[query] ) keyword[else] : keyword[return] ...
def urlencode(query): """Encode string to be used in urls (percent encoding). :param query: string to be encoded :type query: str :return: urlencoded string :rtype: str :Example: >>> urlencode('pekná líščička') 'pekn%C3%A1%20l%C3%AD%C5%A1%C4%8Di%C4%8Dka' """ if hasattr(...
def fetch(self): ''' Gives all the data it has stored, and remembers what it has given. Later we need to call commit() to actually remove the data from the cache. ''' if self._fetched is not None: raise RuntimeError('fetch() was called but the previous one has...
def function[fetch, parameter[self]]: constant[ Gives all the data it has stored, and remembers what it has given. Later we need to call commit() to actually remove the data from the cache. ] if compare[name[self]._fetched is_not constant[None]] begin[:] <ast.Rais...
keyword[def] identifier[fetch] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_fetched] keyword[is] keyword[not] keyword[None] : keyword[raise] identifier[RuntimeError] ( literal[string] literal[string] ) keyword[if] identif...
def fetch(self): """ Gives all the data it has stored, and remembers what it has given. Later we need to call commit() to actually remove the data from the cache. """ if self._fetched is not None: raise RuntimeError('fetch() was called but the previous one has not yet bee...
def _dispatch_event(self, event, data=None): """Dispatches the event and executes any associated callbacks. Note: To prevent the app from crashing due to callback errors. We catch all exceptions and send all data to the logger. Args: event (str): The type of event. e.g. 'bo...
def function[_dispatch_event, parameter[self, event, data]]: constant[Dispatches the event and executes any associated callbacks. Note: To prevent the app from crashing due to callback errors. We catch all exceptions and send all data to the logger. Args: event (str): The t...
keyword[def] identifier[_dispatch_event] ( identifier[self] , identifier[event] , identifier[data] = keyword[None] ): literal[string] keyword[for] identifier[callback] keyword[in] identifier[self] . identifier[_callbacks] [ identifier[event] ]: identifier[self] . identifier[_logger]...
def _dispatch_event(self, event, data=None): """Dispatches the event and executes any associated callbacks. Note: To prevent the app from crashing due to callback errors. We catch all exceptions and send all data to the logger. Args: event (str): The type of event. e.g. 'bot_ad...
def set_application_property(self, key, value): """Set the application property. :param key: key of the property to set :type key: str :param value: value to assign to the property :type value: str """ url = self._options['server'] + \ '/rest/api/late...
def function[set_application_property, parameter[self, key, value]]: constant[Set the application property. :param key: key of the property to set :type key: str :param value: value to assign to the property :type value: str ] variable[url] assign[=] binary_opera...
keyword[def] identifier[set_application_property] ( identifier[self] , identifier[key] , identifier[value] ): literal[string] identifier[url] = identifier[self] . identifier[_options] [ literal[string] ]+ literal[string] + identifier[key] identifier[payload] ={ literal[string] : ...
def set_application_property(self, key, value): """Set the application property. :param key: key of the property to set :type key: str :param value: value to assign to the property :type value: str """ url = self._options['server'] + '/rest/api/latest/application-propert...
def exactly(self, number): """ Inspected function should be called exactly number times Return: self """ def check(): #pylint: disable=missing-docstring return True if number == super(SinonExpectation, self).callCount else False self.valid_list.append(check) ...
def function[exactly, parameter[self, number]]: constant[ Inspected function should be called exactly number times Return: self ] def function[check, parameter[]]: return[<ast.IfExp object at 0x7da1b2347820>] call[name[self].valid_list.append, parameter[name[check...
keyword[def] identifier[exactly] ( identifier[self] , identifier[number] ): literal[string] keyword[def] identifier[check] (): keyword[return] keyword[True] keyword[if] identifier[number] == identifier[super] ( identifier[SinonExpectation] , identifier[self] ). identifier[callCount...
def exactly(self, number): """ Inspected function should be called exactly number times Return: self """ def check(): #pylint: disable=missing-docstring return True if number == super(SinonExpectation, self).callCount else False self.valid_list.append(check) return self
def removeAnalysis(self, analysis): """ Unassigns the analysis passed in from the worksheet. Delegates to 'unassign' transition for the analysis passed in """ # We need to bypass the guard's check for current context! api.get_request().set("ws_uid", api.get_uid(self)) if ...
def function[removeAnalysis, parameter[self, analysis]]: constant[ Unassigns the analysis passed in from the worksheet. Delegates to 'unassign' transition for the analysis passed in ] call[call[name[api].get_request, parameter[]].set, parameter[constant[ws_uid], call[name[api].get_uid, p...
keyword[def] identifier[removeAnalysis] ( identifier[self] , identifier[analysis] ): literal[string] identifier[api] . identifier[get_request] (). identifier[set] ( literal[string] , identifier[api] . identifier[get_uid] ( identifier[self] )) keyword[if] identifier[analysis] . id...
def removeAnalysis(self, analysis): """ Unassigns the analysis passed in from the worksheet. Delegates to 'unassign' transition for the analysis passed in """ # We need to bypass the guard's check for current context! api.get_request().set('ws_uid', api.get_uid(self)) if analysis.getWork...
def get_title(src_name, src_type=None): """Normalizes a source name as a string to be used for viewer's title.""" if src_type == 'tcp': return '{0}:{1}'.format(*src_name) return os.path.basename(src_name)
def function[get_title, parameter[src_name, src_type]]: constant[Normalizes a source name as a string to be used for viewer's title.] if compare[name[src_type] equal[==] constant[tcp]] begin[:] return[call[constant[{0}:{1}].format, parameter[<ast.Starred object at 0x7da1b1197790>]]] return[c...
keyword[def] identifier[get_title] ( identifier[src_name] , identifier[src_type] = keyword[None] ): literal[string] keyword[if] identifier[src_type] == literal[string] : keyword[return] literal[string] . identifier[format] (* identifier[src_name] ) keyword[return] identifier[os] . identifi...
def get_title(src_name, src_type=None): """Normalizes a source name as a string to be used for viewer's title.""" if src_type == 'tcp': return '{0}:{1}'.format(*src_name) # depends on [control=['if'], data=[]] return os.path.basename(src_name)
def __get_stack_id(self, value, values, height): """ Returns the index of the column representation of the given value ▁ ▂ ▃ ▄ ▅ ▆ ▇' ... ▁ ▂ ▃ ▄ ▅ ▆ ▇' ▇ ▇ ▇ ▇ ▇ ▇ ▇ ... ▁ ▂ ▃ ▄ ▅ ▆ ▇' ▇ ▇ ...
def function[__get_stack_id, parameter[self, value, values, height]]: constant[ Returns the index of the column representation of the given value ▁ ▂ ▃ ▄ ▅ ▆ ▇' ... ▁ ▂ ▃ ▄ ▅ ▆ ▇' ▇ ▇ ▇ ▇ ▇ ▇ ▇ ... ...
keyword[def] identifier[__get_stack_id] ( identifier[self] , identifier[value] , identifier[values] , identifier[height] ): literal[string] keyword[def] identifier[step] ( identifier[values] , identifier[height] ): identifier[step_range] = identifier[max] ( identifier[values] )- iden...
def __get_stack_id(self, value, values, height): """ Returns the index of the column representation of the given value ▁ ▂ ▃ ▄ ▅ ▆ ▇' ... ▁ ▂ ▃ ▄ ▅ ▆ ▇' ▇ ▇ ▇ ▇ ▇ ▇ ▇ ... ▁ ▂ ▃ ▄ ▅ ▆ ▇' ▇ ▇ ▇ ...
def dSbr_dV(self, Yf, Yt, V, buses=None, branches=None): """ Based on dSbr_dV.m from MATPOWER by Ray Zimmerman, developed at PSERC Cornell. See U{http://www.pserc.cornell.edu/matpower/} for more information. @return: The branch power flow vectors and the partial derivatives of ...
def function[dSbr_dV, parameter[self, Yf, Yt, V, buses, branches]]: constant[ Based on dSbr_dV.m from MATPOWER by Ray Zimmerman, developed at PSERC Cornell. See U{http://www.pserc.cornell.edu/matpower/} for more information. @return: The branch power flow vectors and the partial derivat...
keyword[def] identifier[dSbr_dV] ( identifier[self] , identifier[Yf] , identifier[Yt] , identifier[V] , identifier[buses] = keyword[None] , identifier[branches] = keyword[None] ): literal[string] identifier[buses] = identifier[self] . identifier[buses] keyword[if] identifier[buses] keyword[is] ...
def dSbr_dV(self, Yf, Yt, V, buses=None, branches=None): """ Based on dSbr_dV.m from MATPOWER by Ray Zimmerman, developed at PSERC Cornell. See U{http://www.pserc.cornell.edu/matpower/} for more information. @return: The branch power flow vectors and the partial derivatives of ...
def p_statement_list_1(self, p): '''statement_list : statement SEMICOLON statement_list''' p[0] = p[3] if p[1] is not None: p[0].children.insert(0, p[1])
def function[p_statement_list_1, parameter[self, p]]: constant[statement_list : statement SEMICOLON statement_list] call[name[p]][constant[0]] assign[=] call[name[p]][constant[3]] if compare[call[name[p]][constant[1]] is_not constant[None]] begin[:] call[call[name[p]][constant[0]...
keyword[def] identifier[p_statement_list_1] ( identifier[self] , identifier[p] ): literal[string] identifier[p] [ literal[int] ]= identifier[p] [ literal[int] ] keyword[if] identifier[p] [ literal[int] ] keyword[is] keyword[not] keyword[None] : identifier[p] [ literal[int] ...
def p_statement_list_1(self, p): """statement_list : statement SEMICOLON statement_list""" p[0] = p[3] if p[1] is not None: p[0].children.insert(0, p[1]) # depends on [control=['if'], data=[]]
def get_rendering_cache_key(placeholder_name, contentitem): """ Return a cache key for the content item output. .. seealso:: The :func:`ContentItem.clear_cache() <fluent_contents.models.ContentItem.clear_cache>` function can be used to remove the cache keys of a retrieved object. """ ...
def function[get_rendering_cache_key, parameter[placeholder_name, contentitem]]: constant[ Return a cache key for the content item output. .. seealso:: The :func:`ContentItem.clear_cache() <fluent_contents.models.ContentItem.clear_cache>` function can be used to remove the cache keys o...
keyword[def] identifier[get_rendering_cache_key] ( identifier[placeholder_name] , identifier[contentitem] ): literal[string] keyword[if] keyword[not] identifier[contentitem] . identifier[pk] : keyword[return] keyword[None] keyword[return] literal[string] . identifier[format] ( ident...
def get_rendering_cache_key(placeholder_name, contentitem): """ Return a cache key for the content item output. .. seealso:: The :func:`ContentItem.clear_cache() <fluent_contents.models.ContentItem.clear_cache>` function can be used to remove the cache keys of a retrieved object. """ ...
def ensemble_mean_std_max_min(ens): """Calculate ensemble statistics between a results from an ensemble of climate simulations Returns a dataset containing ensemble mean, standard-deviation, minimum and maximum for input climate simulations. Parameters ---------- ens : Ensemble dataset (see xc...
def function[ensemble_mean_std_max_min, parameter[ens]]: constant[Calculate ensemble statistics between a results from an ensemble of climate simulations Returns a dataset containing ensemble mean, standard-deviation, minimum and maximum for input climate simulations. Parameters ---------- ...
keyword[def] identifier[ensemble_mean_std_max_min] ( identifier[ens] ): literal[string] identifier[dsOut] = identifier[ens] . identifier[drop] ( identifier[ens] . identifier[data_vars] ) keyword[for] identifier[v] keyword[in] identifier[ens] . identifier[data_vars] : identifier[dsOut] [ i...
def ensemble_mean_std_max_min(ens): """Calculate ensemble statistics between a results from an ensemble of climate simulations Returns a dataset containing ensemble mean, standard-deviation, minimum and maximum for input climate simulations. Parameters ---------- ens : Ensemble dataset (see xc...
def _get_span(self, m): """ Gets a tuple that identifies a span for the specific mention class that m belongs to. """ return (m.sentence.id, m.char_start, m.char_end)
def function[_get_span, parameter[self, m]]: constant[ Gets a tuple that identifies a span for the specific mention class that m belongs to. ] return[tuple[[<ast.Attribute object at 0x7da204622bf0>, <ast.Attribute object at 0x7da204621b70>, <ast.Attribute object at 0x7da204623580>]]]
keyword[def] identifier[_get_span] ( identifier[self] , identifier[m] ): literal[string] keyword[return] ( identifier[m] . identifier[sentence] . identifier[id] , identifier[m] . identifier[char_start] , identifier[m] . identifier[char_end] )
def _get_span(self, m): """ Gets a tuple that identifies a span for the specific mention class that m belongs to. """ return (m.sentence.id, m.char_start, m.char_end)
def init_optimizer(self, optimizer): """Init the optimizer. Args: optimizer (dict or :obj:`~torch.optim.Optimizer`): Either an optimizer object or a dict used for constructing the optimizer. Returns: :obj:`~torch.optim.Optimizer`: An optimizer object. ...
def function[init_optimizer, parameter[self, optimizer]]: constant[Init the optimizer. Args: optimizer (dict or :obj:`~torch.optim.Optimizer`): Either an optimizer object or a dict used for constructing the optimizer. Returns: :obj:`~torch.optim.Optimize...
keyword[def] identifier[init_optimizer] ( identifier[self] , identifier[optimizer] ): literal[string] keyword[if] identifier[isinstance] ( identifier[optimizer] , identifier[dict] ): identifier[optimizer] = identifier[obj_from_dict] ( identifier[optimizer] , identifier[to...
def init_optimizer(self, optimizer): """Init the optimizer. Args: optimizer (dict or :obj:`~torch.optim.Optimizer`): Either an optimizer object or a dict used for constructing the optimizer. Returns: :obj:`~torch.optim.Optimizer`: An optimizer object. ...
def value(self): """ Return the value of this SpinBox. """ if self.opts['int']: return int(self.val) else: return float(self.val)
def function[value, parameter[self]]: constant[ Return the value of this SpinBox. ] if call[name[self].opts][constant[int]] begin[:] return[call[name[int], parameter[name[self].val]]]
keyword[def] identifier[value] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[opts] [ literal[string] ]: keyword[return] identifier[int] ( identifier[self] . identifier[val] ) keyword[else] : keyword[return] identifier[float] ( ...
def value(self): """ Return the value of this SpinBox. """ if self.opts['int']: return int(self.val) # depends on [control=['if'], data=[]] else: return float(self.val)
def intermediate_cpfs(self) -> List[CPF]: '''Returns list of intermediate-fluent CPFs in level order.''' _, cpfs = self.cpfs interm_cpfs = [cpf for cpf in cpfs if cpf.name in self.intermediate_fluents] interm_cpfs = sorted(interm_cpfs, key=lambda cpf: (self.intermediate_fluents[cpf.name]...
def function[intermediate_cpfs, parameter[self]]: constant[Returns list of intermediate-fluent CPFs in level order.] <ast.Tuple object at 0x7da1b0926140> assign[=] name[self].cpfs variable[interm_cpfs] assign[=] <ast.ListComp object at 0x7da1b0925930> variable[interm_cpfs] assign[=] call...
keyword[def] identifier[intermediate_cpfs] ( identifier[self] )-> identifier[List] [ identifier[CPF] ]: literal[string] identifier[_] , identifier[cpfs] = identifier[self] . identifier[cpfs] identifier[interm_cpfs] =[ identifier[cpf] keyword[for] identifier[cpf] keyword[in] identifier...
def intermediate_cpfs(self) -> List[CPF]: """Returns list of intermediate-fluent CPFs in level order.""" (_, cpfs) = self.cpfs interm_cpfs = [cpf for cpf in cpfs if cpf.name in self.intermediate_fluents] interm_cpfs = sorted(interm_cpfs, key=lambda cpf: (self.intermediate_fluents[cpf.name].level, cpf.na...
def sink(wrapped): """Creates an SPL operator with a single input port. A SPL operator with a single input port and no output ports. For each tuple on the input port the decorated function is called passing the contents of the tuple. .. deprecated:: 1.8 Recommended to use :py:class:`@spl.f...
def function[sink, parameter[wrapped]]: constant[Creates an SPL operator with a single input port. A SPL operator with a single input port and no output ports. For each tuple on the input port the decorated function is called passing the contents of the tuple. .. deprecated:: 1.8 Recom...
keyword[def] identifier[sink] ( identifier[wrapped] ): literal[string] keyword[if] keyword[not] identifier[inspect] . identifier[isfunction] ( identifier[wrapped] ): keyword[raise] identifier[TypeError] ( literal[string] ) keyword[return] identifier[_wrapforsplop] ( identifier[_OperatorT...
def sink(wrapped): """Creates an SPL operator with a single input port. A SPL operator with a single input port and no output ports. For each tuple on the input port the decorated function is called passing the contents of the tuple. .. deprecated:: 1.8 Recommended to use :py:class:`@spl.f...
def _assign_numbers(self): """ Assign numbers in preparation for validating these receipts. WARNING: Don't call the method manually unless you know what you're doing! """ first = self.select_related('point_of_sales', 'receipt_type').first() next_num = Receipt.ob...
def function[_assign_numbers, parameter[self]]: constant[ Assign numbers in preparation for validating these receipts. WARNING: Don't call the method manually unless you know what you're doing! ] variable[first] assign[=] call[call[name[self].select_related, parameter[co...
keyword[def] identifier[_assign_numbers] ( identifier[self] ): literal[string] identifier[first] = identifier[self] . identifier[select_related] ( literal[string] , literal[string] ). identifier[first] () identifier[next_num] = identifier[Receipt] . identifier[objects] . identifier[fetch_...
def _assign_numbers(self): """ Assign numbers in preparation for validating these receipts. WARNING: Don't call the method manually unless you know what you're doing! """ first = self.select_related('point_of_sales', 'receipt_type').first() next_num = Receipt.objects.fetch_l...
def open(self, output, opts=None): """Use this to set where to write to. output can be a file object or a string. This code raises IOError on error.""" if isinstance(output, io.TextIOWrapper) or \ isinstance(output, io.StringIO) or \ output == sys.stdout: pass ...
def function[open, parameter[self, output, opts]]: constant[Use this to set where to write to. output can be a file object or a string. This code raises IOError on error.] if <ast.BoolOp object at 0x7da1b0373d90> begin[:] pass name[self].output assign[=] name[output] return[N...
keyword[def] identifier[open] ( identifier[self] , identifier[output] , identifier[opts] = keyword[None] ): literal[string] keyword[if] identifier[isinstance] ( identifier[output] , identifier[io] . identifier[TextIOWrapper] ) keyword[or] identifier[isinstance] ( identifier[output] , identifier[i...
def open(self, output, opts=None): """Use this to set where to write to. output can be a file object or a string. This code raises IOError on error.""" if isinstance(output, io.TextIOWrapper) or isinstance(output, io.StringIO) or output == sys.stdout: pass # depends on [control=['if'], data=[]]...
def _GetRecord(self, offset, record_size): """Retrieve a single record from the file. Args: offset: offset from start of input_dat where header starts record_size: length of the header according to file (untrusted) Returns: A dict containing a single browser history record. """ r...
def function[_GetRecord, parameter[self, offset, record_size]]: constant[Retrieve a single record from the file. Args: offset: offset from start of input_dat where header starts record_size: length of the header according to file (untrusted) Returns: A dict containing a single browse...
keyword[def] identifier[_GetRecord] ( identifier[self] , identifier[offset] , identifier[record_size] ): literal[string] identifier[record_header] = literal[string] identifier[get4] = keyword[lambda] identifier[x] : identifier[struct] . identifier[unpack] ( literal[string] , identifier[self] . ident...
def _GetRecord(self, offset, record_size): """Retrieve a single record from the file. Args: offset: offset from start of input_dat where header starts record_size: length of the header according to file (untrusted) Returns: A dict containing a single browser history record. """ r...
def get_hashes_from_search(self, query, page=None): """ Get the scan results for a file. Even if you do not have a Private Mass API key that you can use, you can still automate VirusTotal Intelligence searches pretty much in the same way that the searching for files api call works. :pa...
def function[get_hashes_from_search, parameter[self, query, page]]: constant[ Get the scan results for a file. Even if you do not have a Private Mass API key that you can use, you can still automate VirusTotal Intelligence searches pretty much in the same way that the searching for files api ca...
keyword[def] identifier[get_hashes_from_search] ( identifier[self] , identifier[query] , identifier[page] = keyword[None] ): literal[string] identifier[params] ={ literal[string] : identifier[query] , literal[string] : identifier[self] . identifier[api_key] , literal[string] : identifier[page] } ...
def get_hashes_from_search(self, query, page=None): """ Get the scan results for a file. Even if you do not have a Private Mass API key that you can use, you can still automate VirusTotal Intelligence searches pretty much in the same way that the searching for files api call works. :param ...
def write(path, content, encoding="UTF-8", append=False, raw=False): """Write *content* to file *path*""" mode = 'wb' if not append else 'ab' with OPEN_FUNC(path, mode) as _file: if raw: import shutil shutil.copyfileobj(content, _file) else: _file.write(co...
def function[write, parameter[path, content, encoding, append, raw]]: constant[Write *content* to file *path*] variable[mode] assign[=] <ast.IfExp object at 0x7da18f721ea0> with call[name[OPEN_FUNC], parameter[name[path], name[mode]]] begin[:] if name[raw] begin[:] im...
keyword[def] identifier[write] ( identifier[path] , identifier[content] , identifier[encoding] = literal[string] , identifier[append] = keyword[False] , identifier[raw] = keyword[False] ): literal[string] identifier[mode] = literal[string] keyword[if] keyword[not] identifier[append] keyword[else] lite...
def write(path, content, encoding='UTF-8', append=False, raw=False): """Write *content* to file *path*""" mode = 'wb' if not append else 'ab' with OPEN_FUNC(path, mode) as _file: if raw: import shutil shutil.copyfileobj(content, _file) # depends on [control=['if'], data=[]] ...
def colorize_text(self, text): """Adds escape sequences to colorize text and make it beautiful. To colorize text, prefix the text you want to color with the color (capitalized) wrapped in double angle brackets (i.e.: <<GREEN>>). End your string with <<NORMAL>>. If you don't, it w...
def function[colorize_text, parameter[self, text]]: constant[Adds escape sequences to colorize text and make it beautiful. To colorize text, prefix the text you want to color with the color (capitalized) wrapped in double angle brackets (i.e.: <<GREEN>>). End your string with <<NORMAL>>....
keyword[def] identifier[colorize_text] ( identifier[self] , identifier[text] ): literal[string] identifier[rnormal] = identifier[text] . identifier[rfind] ( literal[string] ) identifier[rany] = identifier[text] . identifier[rfind] ( literal[string] ) keyword[fo...
def colorize_text(self, text): """Adds escape sequences to colorize text and make it beautiful. To colorize text, prefix the text you want to color with the color (capitalized) wrapped in double angle brackets (i.e.: <<GREEN>>). End your string with <<NORMAL>>. If you don't, it will ...
def hmac_sha256(secret, message): """ 获取一个字符串的在密钥 secret 加密下的 sha256 哈希值 :param: * secret: (string) 哈希算法的密钥 * message: (string) 需要进行哈希的字符串 :return: * hashed_str: sha256 算法哈希值 """ hashed_str = hmac.new(secret.encode('utf-8'), ...
def function[hmac_sha256, parameter[secret, message]]: constant[ 获取一个字符串的在密钥 secret 加密下的 sha256 哈希值 :param: * secret: (string) 哈希算法的密钥 * message: (string) 需要进行哈希的字符串 :return: * hashed_str: sha256 算法哈希值 ] variable[hashed_str] assign[=] ...
keyword[def] identifier[hmac_sha256] ( identifier[secret] , identifier[message] ): literal[string] identifier[hashed_str] = identifier[hmac] . identifier[new] ( identifier[secret] . identifier[encode] ( literal[string] ), identifier[message] . identifier[encode] ( literal[string] ), ...
def hmac_sha256(secret, message): """ 获取一个字符串的在密钥 secret 加密下的 sha256 哈希值 :param: * secret: (string) 哈希算法的密钥 * message: (string) 需要进行哈希的字符串 :return: * hashed_str: sha256 算法哈希值 """ hashed_str = hmac.new(secret.encode('utf-8'), message.encode('ut...
def dict_of(validate_key, validate_item): """Returns a validator function that succeeds only if the input is a dict, and each key and value in the dict passes as input to the provided validators validate_key and validate_item, respectively. :param callable validate_key: the validator function for keys in t...
def function[dict_of, parameter[validate_key, validate_item]]: constant[Returns a validator function that succeeds only if the input is a dict, and each key and value in the dict passes as input to the provided validators validate_key and validate_item, respectively. :param callable validate_key: the v...
keyword[def] identifier[dict_of] ( identifier[validate_key] , identifier[validate_item] ): literal[string] keyword[def] identifier[validate] ( identifier[value] , identifier[should_raise] = keyword[True] ): identifier[validate_type] = identifier[is_type] ( identifier[dict] ) keyword[if] ...
def dict_of(validate_key, validate_item): """Returns a validator function that succeeds only if the input is a dict, and each key and value in the dict passes as input to the provided validators validate_key and validate_item, respectively. :param callable validate_key: the validator function for keys in t...
def add_granule(self, data, store, workspace=None): '''Harvest/add a granule into an existing imagemosaic''' ext = os.path.splitext(data)[-1] if ext == ".zip": type = "file.imagemosaic" upload_data = open(data, 'rb') headers = { "Content-type":...
def function[add_granule, parameter[self, data, store, workspace]]: constant[Harvest/add a granule into an existing imagemosaic] variable[ext] assign[=] call[call[name[os].path.splitext, parameter[name[data]]]][<ast.UnaryOp object at 0x7da1b0123f10>] if compare[name[ext] equal[==] constant[.zip]...
keyword[def] identifier[add_granule] ( identifier[self] , identifier[data] , identifier[store] , identifier[workspace] = keyword[None] ): literal[string] identifier[ext] = identifier[os] . identifier[path] . identifier[splitext] ( identifier[data] )[- literal[int] ] keyword[if] identifier...
def add_granule(self, data, store, workspace=None): """Harvest/add a granule into an existing imagemosaic""" ext = os.path.splitext(data)[-1] if ext == '.zip': type = 'file.imagemosaic' upload_data = open(data, 'rb') headers = {'Content-type': 'application/zip', 'Accept': 'applicatio...
def _wait_for_finishing(self): """Observe running state machine and stop engine if execution has finished""" self.state_machine_running = True self.__running_state_machine.join() self.__set_execution_mode_to_finished() self.state_machine_manager.active_state_machine_id = None ...
def function[_wait_for_finishing, parameter[self]]: constant[Observe running state machine and stop engine if execution has finished] name[self].state_machine_running assign[=] constant[True] call[name[self].__running_state_machine.join, parameter[]] call[name[self].__set_execution_mode_...
keyword[def] identifier[_wait_for_finishing] ( identifier[self] ): literal[string] identifier[self] . identifier[state_machine_running] = keyword[True] identifier[self] . identifier[__running_state_machine] . identifier[join] () identifier[self] . identifier[__set_execution_mode_...
def _wait_for_finishing(self): """Observe running state machine and stop engine if execution has finished""" self.state_machine_running = True self.__running_state_machine.join() self.__set_execution_mode_to_finished() self.state_machine_manager.active_state_machine_id = None plugins.run_on_stat...
def read_chunk(self, chunk): r""" Works like :meth:`read`\ , but data is stored in the writable buffer ``chunk`` rather than returned. Reads at most a number of bytes equal to the size of ``chunk``\ . :type chunk: buffer :param chunk: a writable object that supports the ...
def function[read_chunk, parameter[self, chunk]]: constant[ Works like :meth:`read`\ , but data is stored in the writable buffer ``chunk`` rather than returned. Reads at most a number of bytes equal to the size of ``chunk``\ . :type chunk: buffer :param chunk: a writable...
keyword[def] identifier[read_chunk] ( identifier[self] , identifier[chunk] ): literal[string] identifier[_complain_ifclosed] ( identifier[self] . identifier[closed] ) keyword[return] identifier[self] . identifier[f] . identifier[readinto] ( identifier[chunk] )
def read_chunk(self, chunk): """ Works like :meth:`read`\\ , but data is stored in the writable buffer ``chunk`` rather than returned. Reads at most a number of bytes equal to the size of ``chunk``\\ . :type chunk: buffer :param chunk: a writable object that supports the buf...
def compute_distances_dict(egg): """ Creates a nested dict of distances """ pres, rec, features, dist_funcs = parse_egg(egg) pres_list = list(pres) features_list = list(features) # initialize dist dict distances = {} # for each word in the list for idx1, item1 in enumerate(pres_list): ...
def function[compute_distances_dict, parameter[egg]]: constant[ Creates a nested dict of distances ] <ast.Tuple object at 0x7da204344880> assign[=] call[name[parse_egg], parameter[name[egg]]] variable[pres_list] assign[=] call[name[list], parameter[name[pres]]] variable[features_list] as...
keyword[def] identifier[compute_distances_dict] ( identifier[egg] ): literal[string] identifier[pres] , identifier[rec] , identifier[features] , identifier[dist_funcs] = identifier[parse_egg] ( identifier[egg] ) identifier[pres_list] = identifier[list] ( identifier[pres] ) identifier[features_lis...
def compute_distances_dict(egg): """ Creates a nested dict of distances """ (pres, rec, features, dist_funcs) = parse_egg(egg) pres_list = list(pres) features_list = list(features) # initialize dist dict distances = {} # for each word in the list for (idx1, item1) in enumerate(pres_list)...
def add_item_metadata(self, handle, key, value): """Store the given key:value pair for the item associated with handle. :param handle: handle for accessing an item before the dataset is frozen :param key: metadata key :param value: metadata value """ ...
def function[add_item_metadata, parameter[self, handle, key, value]]: constant[Store the given key:value pair for the item associated with handle. :param handle: handle for accessing an item before the dataset is frozen :param key: metadata key :param value: metad...
keyword[def] identifier[add_item_metadata] ( identifier[self] , identifier[handle] , identifier[key] , identifier[value] ): literal[string] identifier[identifier] = identifier[generate_identifier] ( identifier[handle] ) identifier[metadata_blob_suffix] = literal[string] . identifier[form...
def add_item_metadata(self, handle, key, value): """Store the given key:value pair for the item associated with handle. :param handle: handle for accessing an item before the dataset is frozen :param key: metadata key :param value: metadata value """ ident...
def update_primary(hdu_in, hdu=None): """ 'Update' a primary HDU This checks hdu exists and creates it from hdu_in if it does not. If hdu does exist, this adds the data in hdu_in to hdu """ if hdu is None: hdu = fits.PrimaryHDU(data=hdu_in.data, header=hdu_in.header) else: hdu.d...
def function[update_primary, parameter[hdu_in, hdu]]: constant[ 'Update' a primary HDU This checks hdu exists and creates it from hdu_in if it does not. If hdu does exist, this adds the data in hdu_in to hdu ] if compare[name[hdu] is constant[None]] begin[:] variable[hdu] as...
keyword[def] identifier[update_primary] ( identifier[hdu_in] , identifier[hdu] = keyword[None] ): literal[string] keyword[if] identifier[hdu] keyword[is] keyword[None] : identifier[hdu] = identifier[fits] . identifier[PrimaryHDU] ( identifier[data] = identifier[hdu_in] . identifier[data] , iden...
def update_primary(hdu_in, hdu=None): """ 'Update' a primary HDU This checks hdu exists and creates it from hdu_in if it does not. If hdu does exist, this adds the data in hdu_in to hdu """ if hdu is None: hdu = fits.PrimaryHDU(data=hdu_in.data, header=hdu_in.header) # depends on [control=...
def ReadMostRecentClientGraphSeries(self, client_label, report_type ): """See db.Database.""" series_with_timestamps = self.ReadAllClientGraphSeries( client_label, report_type) if not series_with_timestamps: return None...
def function[ReadMostRecentClientGraphSeries, parameter[self, client_label, report_type]]: constant[See db.Database.] variable[series_with_timestamps] assign[=] call[name[self].ReadAllClientGraphSeries, parameter[name[client_label], name[report_type]]] if <ast.UnaryOp object at 0x7da1b1b6e4a0> b...
keyword[def] identifier[ReadMostRecentClientGraphSeries] ( identifier[self] , identifier[client_label] , identifier[report_type] ): literal[string] identifier[series_with_timestamps] = identifier[self] . identifier[ReadAllClientGraphSeries] ( identifier[client_label] , identifier[report_type] ) ...
def ReadMostRecentClientGraphSeries(self, client_label, report_type): """See db.Database.""" series_with_timestamps = self.ReadAllClientGraphSeries(client_label, report_type) if not series_with_timestamps: return None # depends on [control=['if'], data=[]] (_, latest_series) = list(sorted(iteri...
def random_orthonormal(normal): """Return a random normalized vector orthogonal to the given vector""" u = normal_fns[np.argmin(np.fabs(normal))](normal) u /= np.linalg.norm(u) v = np.cross(normal, u) v /= np.linalg.norm(v) alpha = np.random.uniform(0.0, np.pi*2) return np.cos(alpha)*u + np....
def function[random_orthonormal, parameter[normal]]: constant[Return a random normalized vector orthogonal to the given vector] variable[u] assign[=] call[call[name[normal_fns]][call[name[np].argmin, parameter[call[name[np].fabs, parameter[name[normal]]]]]], parameter[name[normal]]] <ast.AugAssign o...
keyword[def] identifier[random_orthonormal] ( identifier[normal] ): literal[string] identifier[u] = identifier[normal_fns] [ identifier[np] . identifier[argmin] ( identifier[np] . identifier[fabs] ( identifier[normal] ))]( identifier[normal] ) identifier[u] /= identifier[np] . identifier[linalg] . ide...
def random_orthonormal(normal): """Return a random normalized vector orthogonal to the given vector""" u = normal_fns[np.argmin(np.fabs(normal))](normal) u /= np.linalg.norm(u) v = np.cross(normal, u) v /= np.linalg.norm(v) alpha = np.random.uniform(0.0, np.pi * 2) return np.cos(alpha) * u +...
def anonymous_required(func=None, url=None): """Required that the user is not logged in.""" url = url or "/" def _dec(view_func): @wraps(view_func, assigned=available_attrs(view_func)) def _wrapped_view(request, *args, **kwargs): if request.user.is_authenticated(): ...
def function[anonymous_required, parameter[func, url]]: constant[Required that the user is not logged in.] variable[url] assign[=] <ast.BoolOp object at 0x7da2041d9de0> def function[_dec, parameter[view_func]]: def function[_wrapped_view, parameter[request]]: ...
keyword[def] identifier[anonymous_required] ( identifier[func] = keyword[None] , identifier[url] = keyword[None] ): literal[string] identifier[url] = identifier[url] keyword[or] literal[string] keyword[def] identifier[_dec] ( identifier[view_func] ): @ identifier[wraps] ( identifier[view...
def anonymous_required(func=None, url=None): """Required that the user is not logged in.""" url = url or '/' def _dec(view_func): @wraps(view_func, assigned=available_attrs(view_func)) def _wrapped_view(request, *args, **kwargs): if request.user.is_authenticated(): ...
def process_credentials_elements(cred_tree): """ Receive an XML object with the credentials to run a scan against a given target. @param: <credentials> <credential type="up" service="ssh" port="22"> <username>scanuser</username> <password>mypass</passwo...
def function[process_credentials_elements, parameter[cred_tree]]: constant[ Receive an XML object with the credentials to run a scan against a given target. @param: <credentials> <credential type="up" service="ssh" port="22"> <username>scanuser</username> ...
keyword[def] identifier[process_credentials_elements] ( identifier[cred_tree] ): literal[string] identifier[credentials] ={} keyword[for] identifier[credential] keyword[in] identifier[cred_tree] : identifier[service] = identifier[credential] . identifier[attrib] . identifie...
def process_credentials_elements(cred_tree): """ Receive an XML object with the credentials to run a scan against a given target. @param: <credentials> <credential type="up" service="ssh" port="22"> <username>scanuser</username> <password>mypass</password> ...
def get_reserved_resources(role=None): """ resource types from state summary include: reserved_resources :param role: the name of the role if for reserved and if None all reserved :type role: str :return: resources(cpu,mem) :rtype: Resources """ rtype = 'reserved_resources' cpus = 0.0 ...
def function[get_reserved_resources, parameter[role]]: constant[ resource types from state summary include: reserved_resources :param role: the name of the role if for reserved and if None all reserved :type role: str :return: resources(cpu,mem) :rtype: Resources ] variable[rtype] ...
keyword[def] identifier[get_reserved_resources] ( identifier[role] = keyword[None] ): literal[string] identifier[rtype] = literal[string] identifier[cpus] = literal[int] identifier[mem] = literal[int] identifier[summary] = identifier[DCOSClient] (). identifier[get_state_summary] () ...
def get_reserved_resources(role=None): """ resource types from state summary include: reserved_resources :param role: the name of the role if for reserved and if None all reserved :type role: str :return: resources(cpu,mem) :rtype: Resources """ rtype = 'reserved_resources' cpus = 0.0 ...
def homepage_view(request, message=None): ''' The view of the homepage. ''' userProfile = UserProfile.objects.get(user=request.user) request_types = RequestType.objects.filter(enabled=True) # List of request types for which the user is a relevant manager manager_request_types = list() for reques...
def function[homepage_view, parameter[request, message]]: constant[ The view of the homepage. ] variable[userProfile] assign[=] call[name[UserProfile].objects.get, parameter[]] variable[request_types] assign[=] call[name[RequestType].objects.filter, parameter[]] variable[manager_request_...
keyword[def] identifier[homepage_view] ( identifier[request] , identifier[message] = keyword[None] ): literal[string] identifier[userProfile] = identifier[UserProfile] . identifier[objects] . identifier[get] ( identifier[user] = identifier[request] . identifier[user] ) identifier[request_types] = iden...
def homepage_view(request, message=None): """ The view of the homepage. """ userProfile = UserProfile.objects.get(user=request.user) request_types = RequestType.objects.filter(enabled=True) # List of request types for which the user is a relevant manager manager_request_types = list() for reques...
def list(self, service, per_page=20, page=1): """ Get a list of limits for the given service :param service: The service that the limit is linked to :param per_page: The number of results per page returned :param page: The page number of the results :return: dict...
def function[list, parameter[self, service, per_page, page]]: constant[ Get a list of limits for the given service :param service: The service that the limit is linked to :param per_page: The number of results per page returned :param page: The page number of the results ...
keyword[def] identifier[list] ( identifier[self] , identifier[service] , identifier[per_page] = literal[int] , identifier[page] = literal[int] ): literal[string] identifier[params] ={ literal[string] : identifier[per_page] , literal[string] : identifier[page] } keyword[return] identifie...
def list(self, service, per_page=20, page=1): """ Get a list of limits for the given service :param service: The service that the limit is linked to :param per_page: The number of results per page returned :param page: The page number of the results :return: dict of ...
def dilute_ionic_conductivity(ionic_conductivities, zs, rhom): r'''This function handles the calculation of the electrical conductivity of a dilute electrolytic aqueous solution. Requires the mole fractions of each ion, the molar density of the whole mixture, and ionic conductivity coefficients for e...
def function[dilute_ionic_conductivity, parameter[ionic_conductivities, zs, rhom]]: constant[This function handles the calculation of the electrical conductivity of a dilute electrolytic aqueous solution. Requires the mole fractions of each ion, the molar density of the whole mixture, and ionic conduc...
keyword[def] identifier[dilute_ionic_conductivity] ( identifier[ionic_conductivities] , identifier[zs] , identifier[rhom] ): literal[string] keyword[return] identifier[sum] ([ identifier[ci] *( identifier[zi] * identifier[rhom] ) keyword[for] identifier[zi] , identifier[ci] keyword[in] identifier[zip] ...
def dilute_ionic_conductivity(ionic_conductivities, zs, rhom): """This function handles the calculation of the electrical conductivity of a dilute electrolytic aqueous solution. Requires the mole fractions of each ion, the molar density of the whole mixture, and ionic conductivity coefficients for ea...
def put(self, path, args, wait=False): # pragma: no cover, looks never used! # todo: remove this because it looks never used anywhere... """PUT and HTTP request to a daemon :param path: path to do the request :type path: str :param args: data to send in the request :typ...
def function[put, parameter[self, path, args, wait]]: constant[PUT and HTTP request to a daemon :param path: path to do the request :type path: str :param args: data to send in the request :type args: :return: Content of the HTTP response if server returned 200 :...
keyword[def] identifier[put] ( identifier[self] , identifier[path] , identifier[args] , identifier[wait] = keyword[False] ): literal[string] identifier[uri] = identifier[self] . identifier[make_uri] ( identifier[path] ) identifier[timeout] = identifier[self] . identifier[make_timeout] ( i...
def put(self, path, args, wait=False): # pragma: no cover, looks never used! # todo: remove this because it looks never used anywhere... 'PUT and HTTP request to a daemon\n\n :param path: path to do the request\n :type path: str\n :param args: data to send in the request\n :type arg...
def child_(self, ctx): """ If the root resource is requested, return the primary application's front page, if a primary application has been chosen. Otherwise return 'self', since this page can render a simple index. """ if self.frontPageItem.defaultApplication i...
def function[child_, parameter[self, ctx]]: constant[ If the root resource is requested, return the primary application's front page, if a primary application has been chosen. Otherwise return 'self', since this page can render a simple index. ] if compare[name[s...
keyword[def] identifier[child_] ( identifier[self] , identifier[ctx] ): literal[string] keyword[if] identifier[self] . identifier[frontPageItem] . identifier[defaultApplication] keyword[is] keyword[None] : keyword[return] identifier[self] . identifier[webViewer] . identifier[wrapMo...
def child_(self, ctx): """ If the root resource is requested, return the primary application's front page, if a primary application has been chosen. Otherwise return 'self', since this page can render a simple index. """ if self.frontPageItem.defaultApplication is None: ...
def calculate_splits(sdf_file, split_size): """Retrieve """ counts = _sdfstats(sdf_file)["counts"] splits = [] cur = 0 for i in range(counts // split_size + (0 if counts % split_size == 0 else 1)): splits.append("%s-%s" % (cur, min(counts, cur + split_size))) cur += split_size ...
def function[calculate_splits, parameter[sdf_file, split_size]]: constant[Retrieve ] variable[counts] assign[=] call[call[name[_sdfstats], parameter[name[sdf_file]]]][constant[counts]] variable[splits] assign[=] list[[]] variable[cur] assign[=] constant[0] for taget[name[i]] ...
keyword[def] identifier[calculate_splits] ( identifier[sdf_file] , identifier[split_size] ): literal[string] identifier[counts] = identifier[_sdfstats] ( identifier[sdf_file] )[ literal[string] ] identifier[splits] =[] identifier[cur] = literal[int] keyword[for] identifier[i] keyword[in] ...
def calculate_splits(sdf_file, split_size): """Retrieve """ counts = _sdfstats(sdf_file)['counts'] splits = [] cur = 0 for i in range(counts // split_size + (0 if counts % split_size == 0 else 1)): splits.append('%s-%s' % (cur, min(counts, cur + split_size))) cur += split_size #...
def previous_session_label(self, session_label): """ Given a session label, returns the label of the previous session. Parameters ---------- session_label: pd.Timestamp A session whose previous session is desired. Returns ------- pd.Timestamp...
def function[previous_session_label, parameter[self, session_label]]: constant[ Given a session label, returns the label of the previous session. Parameters ---------- session_label: pd.Timestamp A session whose previous session is desired. Returns -...
keyword[def] identifier[previous_session_label] ( identifier[self] , identifier[session_label] ): literal[string] identifier[idx] = identifier[self] . identifier[schedule] . identifier[index] . identifier[get_loc] ( identifier[session_label] ) keyword[if] identifier[idx] == literal[int] :...
def previous_session_label(self, session_label): """ Given a session label, returns the label of the previous session. Parameters ---------- session_label: pd.Timestamp A session whose previous session is desired. Returns ------- pd.Timestamp ...
def get_all_requisite_objectives(self, objective_id=None): """Gets a list of Objectives that are the requisites for the given Objective including the requistes of the requisites, and so on. In plenary mode, the returned list contains all of the immediate requisites, or an error results ...
def function[get_all_requisite_objectives, parameter[self, objective_id]]: constant[Gets a list of Objectives that are the requisites for the given Objective including the requistes of the requisites, and so on. In plenary mode, the returned list contains all of the immediate requisites...
keyword[def] identifier[get_all_requisite_objectives] ( identifier[self] , identifier[objective_id] = keyword[None] ): literal[string] identifier[requisites] = identifier[list] () identifier[requisite_ids] = identifier[list] () identifier[all_requisites] = identi...
def get_all_requisite_objectives(self, objective_id=None): """Gets a list of Objectives that are the requisites for the given Objective including the requistes of the requisites, and so on. In plenary mode, the returned list contains all of the immediate requisites, or an error results if a...
def pca_to_mapping(pca,**extra_props): """ A helper to return a mapping of a PCA result set suitable for reconstructing a planar error surface in other software packages kwargs: method (defaults to sampling axes) """ from .axes import sampling_axes method = extra_props.pop('method',sampling...
def function[pca_to_mapping, parameter[pca]]: constant[ A helper to return a mapping of a PCA result set suitable for reconstructing a planar error surface in other software packages kwargs: method (defaults to sampling axes) ] from relative_module[axes] import module[sampling_axes] ...
keyword[def] identifier[pca_to_mapping] ( identifier[pca] ,** identifier[extra_props] ): literal[string] keyword[from] . identifier[axes] keyword[import] identifier[sampling_axes] identifier[method] = identifier[extra_props] . identifier[pop] ( literal[string] , identifier[sampling_axes] ) key...
def pca_to_mapping(pca, **extra_props): """ A helper to return a mapping of a PCA result set suitable for reconstructing a planar error surface in other software packages kwargs: method (defaults to sampling axes) """ from .axes import sampling_axes method = extra_props.pop('method', sampli...
def git_root(self): """ Find the root git folder """ if not getattr(self, "_git_folder", None): root_folder = os.path.abspath(self.parent_dir) while not os.path.exists(os.path.join(root_folder, '.git')): if root_folder == '/': r...
def function[git_root, parameter[self]]: constant[ Find the root git folder ] if <ast.UnaryOp object at 0x7da18ede5990> begin[:] variable[root_folder] assign[=] call[name[os].path.abspath, parameter[name[self].parent_dir]] while <ast.UnaryOp object at 0x7d...
keyword[def] identifier[git_root] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[getattr] ( identifier[self] , literal[string] , keyword[None] ): identifier[root_folder] = identifier[os] . identifier[path] . identifier[abspath] ( identifier[self] . identifi...
def git_root(self): """ Find the root git folder """ if not getattr(self, '_git_folder', None): root_folder = os.path.abspath(self.parent_dir) while not os.path.exists(os.path.join(root_folder, '.git')): if root_folder == '/': raise HarpoonError("Could...
def t_NAMESPACE(self, t): r"([0-9a-zA-Z_])+(?=::)" t.endlexpos = t.lexpos + len(t.value) return t
def function[t_NAMESPACE, parameter[self, t]]: constant[([0-9a-zA-Z_])+(?=::)] name[t].endlexpos assign[=] binary_operation[name[t].lexpos + call[name[len], parameter[name[t].value]]] return[name[t]]
keyword[def] identifier[t_NAMESPACE] ( identifier[self] , identifier[t] ): literal[string] identifier[t] . identifier[endlexpos] = identifier[t] . identifier[lexpos] + identifier[len] ( identifier[t] . identifier[value] ) keyword[return] identifier[t]
def t_NAMESPACE(self, t): """([0-9a-zA-Z_])+(?=::)""" t.endlexpos = t.lexpos + len(t.value) return t
def check_version_info(redis_client): """Check if various version info of this process is correct. This will be used to detect if workers or drivers are started using different versions of Python, pyarrow, or Ray. If the version information is not present in Redis, then no check is done. Args: ...
def function[check_version_info, parameter[redis_client]]: constant[Check if various version info of this process is correct. This will be used to detect if workers or drivers are started using different versions of Python, pyarrow, or Ray. If the version information is not present in Redis, then n...
keyword[def] identifier[check_version_info] ( identifier[redis_client] ): literal[string] identifier[redis_reply] = identifier[redis_client] . identifier[get] ( literal[string] ) keyword[if] identifier[redis_reply] keyword[is] keyword[None] : keyword[return] identifier[tr...
def check_version_info(redis_client): """Check if various version info of this process is correct. This will be used to detect if workers or drivers are started using different versions of Python, pyarrow, or Ray. If the version information is not present in Redis, then no check is done. Args: ...
def _step(self): """ A single step in the loop. Basically gets an input bag, send it to the node, interpret the results. """ # Pull and check data input_bag = self._get() # Sent through the stack results = self._stack(input_bag) # self._exec_t...
def function[_step, parameter[self]]: constant[ A single step in the loop. Basically gets an input bag, send it to the node, interpret the results. ] variable[input_bag] assign[=] call[name[self]._get, parameter[]] variable[results] assign[=] call[name[self]._stack, par...
keyword[def] identifier[_step] ( identifier[self] ): literal[string] identifier[input_bag] = identifier[self] . identifier[_get] () identifier[results] = identifier[self] . identifier[_stack] ( identifier[input_bag] ) keyword[if] identifier...
def _step(self): """ A single step in the loop. Basically gets an input bag, send it to the node, interpret the results. """ # Pull and check data input_bag = self._get() # Sent through the stack results = self._stack(input_bag) # self._exec_time += timer.duration #...
def xmatch_search(lcc_server, file_to_upload, xmatch_dist_arcsec=3.0, result_visibility='unlisted', email_when_done=False, collections=None, columns=None, filters=None, sortspe...
def function[xmatch_search, parameter[lcc_server, file_to_upload, xmatch_dist_arcsec, result_visibility, email_when_done, collections, columns, filters, sortspec, limitspec, samplespec, download_data, outdir, maxtimeout, refresh]]: constant[This runs a cross-match search query. Parameters ---------- ...
keyword[def] identifier[xmatch_search] ( identifier[lcc_server] , identifier[file_to_upload] , identifier[xmatch_dist_arcsec] = literal[int] , identifier[result_visibility] = literal[string] , identifier[email_when_done] = keyword[False] , identifier[collections] = keyword[None] , identifier[columns] = keyword[...
def xmatch_search(lcc_server, file_to_upload, xmatch_dist_arcsec=3.0, result_visibility='unlisted', email_when_done=False, collections=None, columns=None, filters=None, sortspec=None, limitspec=None, samplespec=None, download_data=True, outdir=None, maxtimeout=300.0, refresh=15.0): """This runs a cross-match search...
def capture_dash_in_url_name(self, node): """ Capture dash in URL name """ for keyword in node.keywords: if keyword.arg == 'name' and '-' in keyword.value.s: return DJ04( lineno=node.lineno, col=node.col_offset, ...
def function[capture_dash_in_url_name, parameter[self, node]]: constant[ Capture dash in URL name ] for taget[name[keyword]] in starred[name[node].keywords] begin[:] if <ast.BoolOp object at 0x7da1b0780bb0> begin[:] return[call[name[DJ04], parameter[]]]
keyword[def] identifier[capture_dash_in_url_name] ( identifier[self] , identifier[node] ): literal[string] keyword[for] identifier[keyword] keyword[in] identifier[node] . identifier[keywords] : keyword[if] identifier[keyword] . identifier[arg] == literal[string] keyword[and] lite...
def capture_dash_in_url_name(self, node): """ Capture dash in URL name """ for keyword in node.keywords: if keyword.arg == 'name' and '-' in keyword.value.s: return DJ04(lineno=node.lineno, col=node.col_offset) # depends on [control=['if'], data=[]] # depends on [control=['...
def tmpdir(prefix='npythy_tempdir_', delete=True): ''' tmpdir() creates a temporary directory and yields its path. At python exit, the directory and all of its contents are recursively deleted (so long as the the normal python exit process is allowed to call the atexit handlers). tmpdir(prefix) ...
def function[tmpdir, parameter[prefix, delete]]: constant[ tmpdir() creates a temporary directory and yields its path. At python exit, the directory and all of its contents are recursively deleted (so long as the the normal python exit process is allowed to call the atexit handlers). tmpdir(...
keyword[def] identifier[tmpdir] ( identifier[prefix] = literal[string] , identifier[delete] = keyword[True] ): literal[string] identifier[path] = identifier[tempfile] . identifier[mkdtemp] ( identifier[prefix] = identifier[prefix] ) keyword[if] keyword[not] identifier[os] . identifier[path] . identi...
def tmpdir(prefix='npythy_tempdir_', delete=True): """ tmpdir() creates a temporary directory and yields its path. At python exit, the directory and all of its contents are recursively deleted (so long as the the normal python exit process is allowed to call the atexit handlers). tmpdir(prefix) ...
def sample_stats_prior_to_xarray(self): """Extract sample_stats_prior from prior.""" prior = self.prior prior_model = self.prior_model data = get_sample_stats_stan3(prior, model=prior_model) return dict_to_dataset(data, library=self.stan, coords=self.coords, dims=self.dims)
def function[sample_stats_prior_to_xarray, parameter[self]]: constant[Extract sample_stats_prior from prior.] variable[prior] assign[=] name[self].prior variable[prior_model] assign[=] name[self].prior_model variable[data] assign[=] call[name[get_sample_stats_stan3], parameter[name[prior...
keyword[def] identifier[sample_stats_prior_to_xarray] ( identifier[self] ): literal[string] identifier[prior] = identifier[self] . identifier[prior] identifier[prior_model] = identifier[self] . identifier[prior_model] identifier[data] = identifier[get_sample_stats_stan3] ( i...
def sample_stats_prior_to_xarray(self): """Extract sample_stats_prior from prior.""" prior = self.prior prior_model = self.prior_model data = get_sample_stats_stan3(prior, model=prior_model) return dict_to_dataset(data, library=self.stan, coords=self.coords, dims=self.dims)
def sub_bytes(state): """ Transformation in the Cipher that processes the State using a non­linear byte substitution table (S-box) that operates on each of the State bytes independently. """ state = state.reshape(4, 32) return fcat( subword(state[0]), subword(state[1]), ...
def function[sub_bytes, parameter[state]]: constant[ Transformation in the Cipher that processes the State using a non­linear byte substitution table (S-box) that operates on each of the State bytes independently. ] variable[state] assign[=] call[name[state].reshape, parameter[constant[4...
keyword[def] identifier[sub_bytes] ( identifier[state] ): literal[string] identifier[state] = identifier[state] . identifier[reshape] ( literal[int] , literal[int] ) keyword[return] identifier[fcat] ( identifier[subword] ( identifier[state] [ literal[int] ]), identifier[subword] ( identifie...
def sub_bytes(state): """ Transformation in the Cipher that processes the State using a non\xadlinear byte substitution table (S-box) that operates on each of the State bytes independently. """ state = state.reshape(4, 32) return fcat(subword(state[0]), subword(state[1]), subword(state[2]), ...
def rollback(self): """ Rolls back changes to this database. """ with self.native(writeAccess=True) as conn: return self._rollback(conn)
def function[rollback, parameter[self]]: constant[ Rolls back changes to this database. ] with call[name[self].native, parameter[]] begin[:] return[call[name[self]._rollback, parameter[name[conn]]]]
keyword[def] identifier[rollback] ( identifier[self] ): literal[string] keyword[with] identifier[self] . identifier[native] ( identifier[writeAccess] = keyword[True] ) keyword[as] identifier[conn] : keyword[return] identifier[self] . identifier[_rollback] ( identifier[conn] )
def rollback(self): """ Rolls back changes to this database. """ with self.native(writeAccess=True) as conn: return self._rollback(conn) # depends on [control=['with'], data=['conn']]
def plot_normal(x=None, mean_x=None,std_x=None,color='red',linewidth=2,alpha=1,bins=20,xlim=False,plot_mean=True,plot_std=False,plot_2std=True,figure=None,annotate=True,histogram=True): """ plot a fit of a normal distribution to the data in x. """ import pylab if figure is None: figure=pylab...
def function[plot_normal, parameter[x, mean_x, std_x, color, linewidth, alpha, bins, xlim, plot_mean, plot_std, plot_2std, figure, annotate, histogram]]: constant[ plot a fit of a normal distribution to the data in x. ] import module[pylab] if compare[name[figure] is constant[None]] begin[:]...
keyword[def] identifier[plot_normal] ( identifier[x] = keyword[None] , identifier[mean_x] = keyword[None] , identifier[std_x] = keyword[None] , identifier[color] = literal[string] , identifier[linewidth] = literal[int] , identifier[alpha] = literal[int] , identifier[bins] = literal[int] , identifier[xlim] = keyword[F...
def plot_normal(x=None, mean_x=None, std_x=None, color='red', linewidth=2, alpha=1, bins=20, xlim=False, plot_mean=True, plot_std=False, plot_2std=True, figure=None, annotate=True, histogram=True): """ plot a fit of a normal distribution to the data in x. """ import pylab if figure is None: ...
def batch_map_mean(func, batch_iter, progress_iter_func=None, sum_axis=None, n_batches=None, prepend_args=None): """ Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the across-samples mean of the results returned by `func` ...
def function[batch_map_mean, parameter[func, batch_iter, progress_iter_func, sum_axis, n_batches, prepend_args]]: constant[ Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the across-samples mean of the results returned by `func` The `sum...
keyword[def] identifier[batch_map_mean] ( identifier[func] , identifier[batch_iter] , identifier[progress_iter_func] = keyword[None] , identifier[sum_axis] = keyword[None] , identifier[n_batches] = keyword[None] , identifier[prepend_args] = keyword[None] ): literal[string] identifier[results_accum] =...
def batch_map_mean(func, batch_iter, progress_iter_func=None, sum_axis=None, n_batches=None, prepend_args=None): """ Apply a function to all the samples that are accessed as mini-batches obtained from an iterator. Returns the across-samples mean of the results returned by `func` The `sum_axis` argu...
def build( self, requirements, # type: Iterable[InstallRequirement] session, # type: PipSession autobuilding=False # type: bool ): # type: (...) -> List[InstallRequirement] """Build wheels. :param unpack: If True, replace the sdist we built from with the ...
def function[build, parameter[self, requirements, session, autobuilding]]: constant[Build wheels. :param unpack: If True, replace the sdist we built from with the newly built wheel, in preparation for installation. :return: True if all the wheels built correctly. ] v...
keyword[def] identifier[build] ( identifier[self] , identifier[requirements] , identifier[session] , identifier[autobuilding] = keyword[False] ): literal[string] identifier[buildset] =[] identifier[format_control] = identifier[self] . identifier[finder] . identifier[format_control] ...
def build(self, requirements, session, autobuilding=False): # type: Iterable[InstallRequirement] # type: PipSession # type: bool # type: (...) -> List[InstallRequirement] 'Build wheels.\n\n :param unpack: If True, replace the sdist we built from with the\n newly built wheel, in prepar...
def twos_comp_repr(val, bitwidth): """ Converts a value to it's two's-complement (positive) integer representation using a given bitwidth (only converts the value if it is negative). For use with Simulation.step() etc. in passing negative numbers, which it does not accept """ correctbw = abs(val...
def function[twos_comp_repr, parameter[val, bitwidth]]: constant[ Converts a value to it's two's-complement (positive) integer representation using a given bitwidth (only converts the value if it is negative). For use with Simulation.step() etc. in passing negative numbers, which it does not accept ...
keyword[def] identifier[twos_comp_repr] ( identifier[val] , identifier[bitwidth] ): literal[string] identifier[correctbw] = identifier[abs] ( identifier[val] ). identifier[bit_length] ()+ literal[int] keyword[if] identifier[bitwidth] < identifier[correctbw] : keyword[raise] identifier[pyrt...
def twos_comp_repr(val, bitwidth): """ Converts a value to it's two's-complement (positive) integer representation using a given bitwidth (only converts the value if it is negative). For use with Simulation.step() etc. in passing negative numbers, which it does not accept """ correctbw = abs(val...
def apply(self, function): """ For each row or column in cuts, read a list of its colors, apply the function to that list of colors, then write it back to the layout. """ for cut in self.cuts: value = self.read(cut) function(value) self...
def function[apply, parameter[self, function]]: constant[ For each row or column in cuts, read a list of its colors, apply the function to that list of colors, then write it back to the layout. ] for taget[name[cut]] in starred[name[self].cuts] begin[:] va...
keyword[def] identifier[apply] ( identifier[self] , identifier[function] ): literal[string] keyword[for] identifier[cut] keyword[in] identifier[self] . identifier[cuts] : identifier[value] = identifier[self] . identifier[read] ( identifier[cut] ) identifier[function] ( ...
def apply(self, function): """ For each row or column in cuts, read a list of its colors, apply the function to that list of colors, then write it back to the layout. """ for cut in self.cuts: value = self.read(cut) function(value) self.write(cut, value) ...
def transform_dataframe(self, dataframe): """ Unstack the dataframe so header consists of a composite 'value' header plus any other header fields. """ coord_fields = self.get_coord_fields() header_fields = self.get_header_fields() # Remove any pairs that don't ha...
def function[transform_dataframe, parameter[self, dataframe]]: constant[ Unstack the dataframe so header consists of a composite 'value' header plus any other header fields. ] variable[coord_fields] assign[=] call[name[self].get_coord_fields, parameter[]] variable[header_...
keyword[def] identifier[transform_dataframe] ( identifier[self] , identifier[dataframe] ): literal[string] identifier[coord_fields] = identifier[self] . identifier[get_coord_fields] () identifier[header_fields] = identifier[self] . identifier[get_header_fields] () keywor...
def transform_dataframe(self, dataframe): """ Unstack the dataframe so header consists of a composite 'value' header plus any other header fields. """ coord_fields = self.get_coord_fields() header_fields = self.get_header_fields() # Remove any pairs that don't have data for both ...
def pause(self): """Pauses the stream.""" res = librtmp.RTMP_Pause(self.client.rtmp, 1) if res < 1: raise RTMPError("Failed to pause")
def function[pause, parameter[self]]: constant[Pauses the stream.] variable[res] assign[=] call[name[librtmp].RTMP_Pause, parameter[name[self].client.rtmp, constant[1]]] if compare[name[res] less[<] constant[1]] begin[:] <ast.Raise object at 0x7da20c6e6980>
keyword[def] identifier[pause] ( identifier[self] ): literal[string] identifier[res] = identifier[librtmp] . identifier[RTMP_Pause] ( identifier[self] . identifier[client] . identifier[rtmp] , literal[int] ) keyword[if] identifier[res] < literal[int] : keyword[raise] identi...
def pause(self): """Pauses the stream.""" res = librtmp.RTMP_Pause(self.client.rtmp, 1) if res < 1: raise RTMPError('Failed to pause') # depends on [control=['if'], data=[]]
def _serialize_record(self, record): """Serialize whole Record""" f = self._empty_to_dot row = [record.CHROM, record.POS] row.append(f(";".join(record.ID))) row.append(f(record.REF)) if not record.ALT: row.append(".") else: row.append(",".j...
def function[_serialize_record, parameter[self, record]]: constant[Serialize whole Record] variable[f] assign[=] name[self]._empty_to_dot variable[row] assign[=] list[[<ast.Attribute object at 0x7da18f00f430>, <ast.Attribute object at 0x7da18f00f700>]] call[name[row].append, parameter[ca...
keyword[def] identifier[_serialize_record] ( identifier[self] , identifier[record] ): literal[string] identifier[f] = identifier[self] . identifier[_empty_to_dot] identifier[row] =[ identifier[record] . identifier[CHROM] , identifier[record] . identifier[POS] ] identifier[row] . ...
def _serialize_record(self, record): """Serialize whole Record""" f = self._empty_to_dot row = [record.CHROM, record.POS] row.append(f(';'.join(record.ID))) row.append(f(record.REF)) if not record.ALT: row.append('.') # depends on [control=['if'], data=[]] else: row.append('...
def _got_session(self, response): """Private function to navigate SOL payload activation """ if 'error' in response: self._print_error(response['error']) return if not self.ipmi_session: self.callgotsession = response return # Send ...
def function[_got_session, parameter[self, response]]: constant[Private function to navigate SOL payload activation ] if compare[constant[error] in name[response]] begin[:] call[name[self]._print_error, parameter[call[name[response]][constant[error]]]] return[None] ...
keyword[def] identifier[_got_session] ( identifier[self] , identifier[response] ): literal[string] keyword[if] literal[string] keyword[in] identifier[response] : identifier[self] . identifier[_print_error] ( identifier[response] [ literal[string] ]) keyword[return] ...
def _got_session(self, response): """Private function to navigate SOL payload activation """ if 'error' in response: self._print_error(response['error']) return # depends on [control=['if'], data=['response']] if not self.ipmi_session: self.callgotsession = response ...
def getColor(rgb=None, hsv=None): """ Convert a color or list of colors to (r,g,b) format from many input formats. :param bool hsv: if set to `True`, rgb is assumed as (hue, saturation, value). Example: - RGB = (255, 255, 255), corresponds to white - rgb = (1,1,1) is white ...
def function[getColor, parameter[rgb, hsv]]: constant[ Convert a color or list of colors to (r,g,b) format from many input formats. :param bool hsv: if set to `True`, rgb is assumed as (hue, saturation, value). Example: - RGB = (255, 255, 255), corresponds to white - rgb = ...
keyword[def] identifier[getColor] ( identifier[rgb] = keyword[None] , identifier[hsv] = keyword[None] ): literal[string] keyword[if] identifier[_isSequence] ( identifier[rgb] ) keyword[and] identifier[len] ( identifier[rgb] )> literal[int] : identifier[seqcol] =[] keyword[for] ide...
def getColor(rgb=None, hsv=None): """ Convert a color or list of colors to (r,g,b) format from many input formats. :param bool hsv: if set to `True`, rgb is assumed as (hue, saturation, value). Example: - RGB = (255, 255, 255), corresponds to white - rgb = (1,1,1) is white ...
def vinet_v_single(p, v0, k0, k0p, min_strain=0.01): """ find volume at given pressure using brenth in scipy.optimize this is for single p value, not vectorized :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: ...
def function[vinet_v_single, parameter[p, v0, k0, k0p, min_strain]]: constant[ find volume at given pressure using brenth in scipy.optimize this is for single p value, not vectorized :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference c...
keyword[def] identifier[vinet_v_single] ( identifier[p] , identifier[v0] , identifier[k0] , identifier[k0p] , identifier[min_strain] = literal[int] ): literal[string] keyword[if] identifier[p] <= literal[int] : keyword[return] identifier[v0] keyword[def] identifier[f_diff] ( identifier[v...
def vinet_v_single(p, v0, k0, k0p, min_strain=0.01): """ find volume at given pressure using brenth in scipy.optimize this is for single p value, not vectorized :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: ...
def t_ID(self, t): r'[a-zA-Z]+' if t.value in self._RESERVED.keys(): t.type = self._RESERVED[t.value] return t if Information.is_valid_symbol(t.value) or \ Information.is_valid_category(t.value): t.type = self._INFORMATION_UNIT ret...
def function[t_ID, parameter[self, t]]: constant[[a-zA-Z]+] if compare[name[t].value in call[name[self]._RESERVED.keys, parameter[]]] begin[:] name[t].type assign[=] call[name[self]._RESERVED][name[t].value] return[name[t]] if <ast.BoolOp object at 0x7da1b14604c0> begin[:...
keyword[def] identifier[t_ID] ( identifier[self] , identifier[t] ): literal[string] keyword[if] identifier[t] . identifier[value] keyword[in] identifier[self] . identifier[_RESERVED] . identifier[keys] (): identifier[t] . identifier[type] = identifier[self] . identifier[_RESERVED] [...
def t_ID(self, t): """[a-zA-Z]+""" if t.value in self._RESERVED.keys(): t.type = self._RESERVED[t.value] return t # depends on [control=['if'], data=[]] if Information.is_valid_symbol(t.value) or Information.is_valid_category(t.value): t.type = self._INFORMATION_UNIT return ...
def get_state(self): """Get the current directory state""" return [os.path.join(dp, f) for dp, _, fn in os.walk(self.dir) for f in fn]
def function[get_state, parameter[self]]: constant[Get the current directory state] return[<ast.ListComp object at 0x7da1afea66b0>]
keyword[def] identifier[get_state] ( identifier[self] ): literal[string] keyword[return] [ identifier[os] . identifier[path] . identifier[join] ( identifier[dp] , identifier[f] ) keyword[for] identifier[dp] , identifier[_] , identifier[fn] keyword[in] identifier[os] . identifier[walk] (...
def get_state(self): """Get the current directory state""" return [os.path.join(dp, f) for (dp, _, fn) in os.walk(self.dir) for f in fn]
def from_str(date): """ Given a date in the format: Jan,21st.2015 will return a datetime of it. """ month = date[:3][0] + date[:3][-2:].lower() if month not in NAMED_MONTHS: raise CanNotFormatError('Month not recognized') date = date.replace('...
def function[from_str, parameter[date]]: constant[ Given a date in the format: Jan,21st.2015 will return a datetime of it. ] variable[month] assign[=] binary_operation[call[call[name[date]][<ast.Slice object at 0x7da1b0cb3070>]][constant[0]] + call[call[call[name[date]][<...
keyword[def] identifier[from_str] ( identifier[date] ): literal[string] identifier[month] = identifier[date] [: literal[int] ][ literal[int] ]+ identifier[date] [: literal[int] ][- literal[int] :]. identifier[lower] () keyword[if] identifier[month] keyword[not] keyword[in] identifier[N...
def from_str(date): """ Given a date in the format: Jan,21st.2015 will return a datetime of it. """ month = date[:3][0] + date[:3][-2:].lower() if month not in NAMED_MONTHS: raise CanNotFormatError('Month not recognized') # depends on [control=['if'], data=[]] da...
def hull_moving_average(data, period): """ Hull Moving Average. Formula: HMA = WMA(2*WMA(n/2) - WMA(n)), sqrt(n) """ catch_errors.check_for_period_error(data, period) hma = wma( 2 * wma(data, int(period/2)) - wma(data, period), int(np.sqrt(period)) ) return hma
def function[hull_moving_average, parameter[data, period]]: constant[ Hull Moving Average. Formula: HMA = WMA(2*WMA(n/2) - WMA(n)), sqrt(n) ] call[name[catch_errors].check_for_period_error, parameter[name[data], name[period]]] variable[hma] assign[=] call[name[wma], parameter[bi...
keyword[def] identifier[hull_moving_average] ( identifier[data] , identifier[period] ): literal[string] identifier[catch_errors] . identifier[check_for_period_error] ( identifier[data] , identifier[period] ) identifier[hma] = identifier[wma] ( literal[int] * identifier[wma] ( identifier[data] , i...
def hull_moving_average(data, period): """ Hull Moving Average. Formula: HMA = WMA(2*WMA(n/2) - WMA(n)), sqrt(n) """ catch_errors.check_for_period_error(data, period) hma = wma(2 * wma(data, int(period / 2)) - wma(data, period), int(np.sqrt(period))) return hma
def reset(self): """ Initial state """ self.regs = {} self.stack = [] self.mem = defaultdict(new_tmp_val) # Dict of label -> value in memory for i in 'abcdefhl': self.regs[i] = new_tmp_val() # Initial unknown state self.regs["%s'" % i] = new_tmp...
def function[reset, parameter[self]]: constant[ Initial state ] name[self].regs assign[=] dictionary[[], []] name[self].stack assign[=] list[[]] name[self].mem assign[=] call[name[defaultdict], parameter[name[new_tmp_val]]] for taget[name[i]] in starred[constant[abcdefhl]...
keyword[def] identifier[reset] ( identifier[self] ): literal[string] identifier[self] . identifier[regs] ={} identifier[self] . identifier[stack] =[] identifier[self] . identifier[mem] = identifier[defaultdict] ( identifier[new_tmp_val] ) keyword[for] identifier[i] key...
def reset(self): """ Initial state """ self.regs = {} self.stack = [] self.mem = defaultdict(new_tmp_val) # Dict of label -> value in memory for i in 'abcdefhl': self.regs[i] = new_tmp_val() # Initial unknown state self.regs["%s'" % i] = new_tmp_val() # depends on [control...
def _history_locked(self): """ Returns whether history movement is locked. """ return (self.history_lock and (self._get_edited_history(self._history_index) != self.input_buffer) and (self._get_prompt_cursor().blockNumber() != self...
def function[_history_locked, parameter[self]]: constant[ Returns whether history movement is locked. ] return[<ast.BoolOp object at 0x7da204622d10>]
keyword[def] identifier[_history_locked] ( identifier[self] ): literal[string] keyword[return] ( identifier[self] . identifier[history_lock] keyword[and] ( identifier[self] . identifier[_get_edited_history] ( identifier[self] . identifier[_history_index] )!= identifier[self] . id...
def _history_locked(self): """ Returns whether history movement is locked. """ return self.history_lock and self._get_edited_history(self._history_index) != self.input_buffer and (self._get_prompt_cursor().blockNumber() != self._get_end_cursor().blockNumber())
def render(self, name, context): """Returns the rendered text from a single template file from the template loader using the given context data""" if Generator.strict: self.env.undefined = TestableUndefined else: self.env.undefined = Undefined template = s...
def function[render, parameter[self, name, context]]: constant[Returns the rendered text from a single template file from the template loader using the given context data] if name[Generator].strict begin[:] name[self].env.undefined assign[=] name[TestableUndefined] variab...
keyword[def] identifier[render] ( identifier[self] , identifier[name] , identifier[context] ): literal[string] keyword[if] identifier[Generator] . identifier[strict] : identifier[self] . identifier[env] . identifier[undefined] = identifier[TestableUndefined] keyword[else] : ...
def render(self, name, context): """Returns the rendered text from a single template file from the template loader using the given context data""" if Generator.strict: self.env.undefined = TestableUndefined # depends on [control=['if'], data=[]] else: self.env.undefined = Undefined ...
def binaryorbit(orbit, comp1, comp2, envelope=None): """ Build the string representation of a hierarchy containing a binary orbit with 2 components. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.set_hierarchy` :parameter comp1: an existin...
def function[binaryorbit, parameter[orbit, comp1, comp2, envelope]]: constant[ Build the string representation of a hierarchy containing a binary orbit with 2 components. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.set_hierarchy` :p...
keyword[def] identifier[binaryorbit] ( identifier[orbit] , identifier[comp1] , identifier[comp2] , identifier[envelope] = keyword[None] ): literal[string] keyword[if] identifier[envelope] : keyword[return] literal[string] . identifier[format] ( identifier[_to_component] ( identifier[orbit] , ke...
def binaryorbit(orbit, comp1, comp2, envelope=None): """ Build the string representation of a hierarchy containing a binary orbit with 2 components. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.set_hierarchy` :parameter comp1: an existin...
def build_slabs(self): """ Builds the reconstructed slab by: (1) Obtaining the unreconstructed slab using the specified parameters for the SlabGenerator. (2) Applying the appropriate lattice transformation in the a and b lattice vectors. ...
def function[build_slabs, parameter[self]]: constant[ Builds the reconstructed slab by: (1) Obtaining the unreconstructed slab using the specified parameters for the SlabGenerator. (2) Applying the appropriate lattice transformation in the a and b ...
keyword[def] identifier[build_slabs] ( identifier[self] ): literal[string] identifier[slabs] = identifier[self] . identifier[get_unreconstructed_slabs] () identifier[recon_slabs] =[] keyword[for] identifier[slab] keyword[in] identifier[slabs] : identifier[d] = id...
def build_slabs(self): """ Builds the reconstructed slab by: (1) Obtaining the unreconstructed slab using the specified parameters for the SlabGenerator. (2) Applying the appropriate lattice transformation in the a and b lattice vectors. (3...
def comittoapi(api): """ Commit to the use of specified Qt api. Raise an error if another Qt api is already loaded in sys.modules """ global USED_API assert USED_API is None, "committoapi called again!" check = ["PyQt4", "PyQt5", "PySide", "PySide2"] assert api in [QT_API_PYQT5, QT_API...
def function[comittoapi, parameter[api]]: constant[ Commit to the use of specified Qt api. Raise an error if another Qt api is already loaded in sys.modules ] <ast.Global object at 0x7da1b26ad270> assert[compare[name[USED_API] is constant[None]]] variable[check] assign[=] list[[<as...
keyword[def] identifier[comittoapi] ( identifier[api] ): literal[string] keyword[global] identifier[USED_API] keyword[assert] identifier[USED_API] keyword[is] keyword[None] , literal[string] identifier[check] =[ literal[string] , literal[string] , literal[string] , literal[string] ] ke...
def comittoapi(api): """ Commit to the use of specified Qt api. Raise an error if another Qt api is already loaded in sys.modules """ global USED_API assert USED_API is None, 'committoapi called again!' check = ['PyQt4', 'PyQt5', 'PySide', 'PySide2'] assert api in [QT_API_PYQT5, QT_API...
def suggest(): """ Suggest a new random brain key. Randomness is provided by the operating system using ``os.urandom()``. """ word_count = 16 brainkey = [None] * word_count dict_lines = BrainKeyDictionary.split(",") assert len(dict_lines) == 49744 for ...
def function[suggest, parameter[]]: constant[ Suggest a new random brain key. Randomness is provided by the operating system using ``os.urandom()``. ] variable[word_count] assign[=] constant[16] variable[brainkey] assign[=] binary_operation[list[[<ast.Constant object at 0x7da...
keyword[def] identifier[suggest] (): literal[string] identifier[word_count] = literal[int] identifier[brainkey] =[ keyword[None] ]* identifier[word_count] identifier[dict_lines] = identifier[BrainKeyDictionary] . identifier[split] ( literal[string] ) keyword[assert] id...
def suggest(): """ Suggest a new random brain key. Randomness is provided by the operating system using ``os.urandom()``. """ word_count = 16 brainkey = [None] * word_count dict_lines = BrainKeyDictionary.split(',') assert len(dict_lines) == 49744 for j in range(0, word_count...
def ignore(code): """Should this code be ignored. :param str code: Error code (e.g. D201). :return: True if code should be ignored, False otherwise. :rtype: bool """ if code in Main.options['ignore']: return True if any(c in code for c in Main.options['ignore']): return Tru...
def function[ignore, parameter[code]]: constant[Should this code be ignored. :param str code: Error code (e.g. D201). :return: True if code should be ignored, False otherwise. :rtype: bool ] if compare[name[code] in call[name[Main].options][constant[ignore]]] begin[:] return[co...
keyword[def] identifier[ignore] ( identifier[code] ): literal[string] keyword[if] identifier[code] keyword[in] identifier[Main] . identifier[options] [ literal[string] ]: keyword[return] keyword[True] keyword[if] identifier[any] ( identifier[c] keyword[in] identifier[code] keyword[fo...
def ignore(code): """Should this code be ignored. :param str code: Error code (e.g. D201). :return: True if code should be ignored, False otherwise. :rtype: bool """ if code in Main.options['ignore']: return True # depends on [control=['if'], data=[]] if any((c in code for c in Ma...
def read_locked(*args, **kwargs): """Acquires & releases a read lock around call into decorated method. NOTE(harlowja): if no attribute name is provided then by default the attribute named '_lock' is looked for (this attribute is expected to be a :py:class:`.ReaderWriterLock`) in the instance object th...
def function[read_locked, parameter[]]: constant[Acquires & releases a read lock around call into decorated method. NOTE(harlowja): if no attribute name is provided then by default the attribute named '_lock' is looked for (this attribute is expected to be a :py:class:`.ReaderWriterLock`) in the in...
keyword[def] identifier[read_locked] (* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[def] identifier[decorator] ( identifier[f] ): identifier[attr_name] = identifier[kwargs] . identifier[get] ( literal[string] , literal[string] ) @ identifier[six] . identifier[wrap...
def read_locked(*args, **kwargs): """Acquires & releases a read lock around call into decorated method. NOTE(harlowja): if no attribute name is provided then by default the attribute named '_lock' is looked for (this attribute is expected to be a :py:class:`.ReaderWriterLock`) in the instance object th...
def finalize(state, block): """Apply rewards and commit.""" if state.is_METROPOLIS(): br = state.config['BYZANTIUM_BLOCK_REWARD'] nr = state.config['BYZANTIUM_NEPHEW_REWARD'] else: br = state.config['BLOCK_REWARD'] nr = state.config['NEPHEW_REWARD'] delta = int(...
def function[finalize, parameter[state, block]]: constant[Apply rewards and commit.] if call[name[state].is_METROPOLIS, parameter[]] begin[:] variable[br] assign[=] call[name[state].config][constant[BYZANTIUM_BLOCK_REWARD]] variable[nr] assign[=] call[name[state].config][...
keyword[def] identifier[finalize] ( identifier[state] , identifier[block] ): literal[string] keyword[if] identifier[state] . identifier[is_METROPOLIS] (): identifier[br] = identifier[state] . identifier[config] [ literal[string] ] identifier[nr] = identifier[state] . identifier[config] ...
def finalize(state, block): """Apply rewards and commit.""" if state.is_METROPOLIS(): br = state.config['BYZANTIUM_BLOCK_REWARD'] nr = state.config['BYZANTIUM_NEPHEW_REWARD'] # depends on [control=['if'], data=[]] else: br = state.config['BLOCK_REWARD'] nr = state.config['NE...
def rpyhttp(value): """ converts a no namespace pyuri back to a standard uri """ if value.startswith("http"): return value try: parts = value.split("_") del parts[0] _uri = base64.b64decode(parts.pop(0)).decode() return _uri + "_".join(...
def function[rpyhttp, parameter[value]]: constant[ converts a no namespace pyuri back to a standard uri ] if call[name[value].startswith, parameter[constant[http]]] begin[:] return[name[value]] <ast.Try object at 0x7da20e957ac0>
keyword[def] identifier[rpyhttp] ( identifier[value] ): literal[string] keyword[if] identifier[value] . identifier[startswith] ( literal[string] ): keyword[return] identifier[value] keyword[try] : identifier[parts] = identifier[value] . identifier[split] ( lite...
def rpyhttp(value): """ converts a no namespace pyuri back to a standard uri """ if value.startswith('http'): return value # depends on [control=['if'], data=[]] try: parts = value.split('_') del parts[0] _uri = base64.b64decode(parts.pop(0)).decode() return _uri + '...
def get_local_playlists(filepaths, exclude_patterns=None, max_depth=float('inf')): """Load playlists from local filepaths. Parameters: filepaths (list or str): Filepath(s) to search for music files. exclude_patterns (list or str): Pattern(s) to exclude. Patterns are Python regex patterns. Filepaths ...
def function[get_local_playlists, parameter[filepaths, exclude_patterns, max_depth]]: constant[Load playlists from local filepaths. Parameters: filepaths (list or str): Filepath(s) to search for music files. exclude_patterns (list or str): Pattern(s) to exclude. Patterns are Python regex patterns....
keyword[def] identifier[get_local_playlists] ( identifier[filepaths] , identifier[exclude_patterns] = keyword[None] , identifier[max_depth] = identifier[float] ( literal[string] )): literal[string] identifier[logger] . identifier[info] ( literal[string] ) identifier[included_playlists] =[] identifier[e...
def get_local_playlists(filepaths, exclude_patterns=None, max_depth=float('inf')): """Load playlists from local filepaths. Parameters: filepaths (list or str): Filepath(s) to search for music files. exclude_patterns (list or str): Pattern(s) to exclude. Patterns are Python regex patterns. Filepath...
async def emit(self, event, data, namespace=None, room=None, skip_sid=None, callback=None, **kwargs): """Emit a message to a single client, a room, or all the clients connected to the namespace. This method takes care or propagating the message to all the servers that...
<ast.AsyncFunctionDef object at 0x7da18dc996c0>
keyword[async] keyword[def] identifier[emit] ( identifier[self] , identifier[event] , identifier[data] , identifier[namespace] = keyword[None] , identifier[room] = keyword[None] , identifier[skip_sid] = keyword[None] , identifier[callback] = keyword[None] ,** identifier[kwargs] ): literal[string] ...
async def emit(self, event, data, namespace=None, room=None, skip_sid=None, callback=None, **kwargs): """Emit a message to a single client, a room, or all the clients connected to the namespace. This method takes care or propagating the message to all the servers that are connected through ...
def get_publication(request): """Lookup publication state""" publication_id = request.matchdict['id'] state, messages = check_publication_state(publication_id) response_data = { 'publication': publication_id, 'state': state, 'messages': messages, } return response_data
def function[get_publication, parameter[request]]: constant[Lookup publication state] variable[publication_id] assign[=] call[name[request].matchdict][constant[id]] <ast.Tuple object at 0x7da20c6e6ef0> assign[=] call[name[check_publication_state], parameter[name[publication_id]]] variabl...
keyword[def] identifier[get_publication] ( identifier[request] ): literal[string] identifier[publication_id] = identifier[request] . identifier[matchdict] [ literal[string] ] identifier[state] , identifier[messages] = identifier[check_publication_state] ( identifier[publication_id] ) identifier[r...
def get_publication(request): """Lookup publication state""" publication_id = request.matchdict['id'] (state, messages) = check_publication_state(publication_id) response_data = {'publication': publication_id, 'state': state, 'messages': messages} return response_data
def size_control_valve_g(T, MW, mu, gamma, Z, P1, P2, Q, D1=None, D2=None, d=None, FL=0.9, Fd=1, xT=0.7, allow_choked=True, allow_laminar=True, full_output=False): r'''Calculates flow coefficient of a control valve passing a gas according to IEC 60534. Uses a ...
def function[size_control_valve_g, parameter[T, MW, mu, gamma, Z, P1, P2, Q, D1, D2, d, FL, Fd, xT, allow_choked, allow_laminar, full_output]]: constant[Calculates flow coefficient of a control valve passing a gas according to IEC 60534. Uses a large number of inputs in SI units. Note the return value i...
keyword[def] identifier[size_control_valve_g] ( identifier[T] , identifier[MW] , identifier[mu] , identifier[gamma] , identifier[Z] , identifier[P1] , identifier[P2] , identifier[Q] , identifier[D1] = keyword[None] , identifier[D2] = keyword[None] , identifier[d] = keyword[None] , identifier[FL] = literal[int] , ide...
def size_control_valve_g(T, MW, mu, gamma, Z, P1, P2, Q, D1=None, D2=None, d=None, FL=0.9, Fd=1, xT=0.7, allow_choked=True, allow_laminar=True, full_output=False): """Calculates flow coefficient of a control valve passing a gas according to IEC 60534. Uses a large number of inputs in SI units. Note the retu...
def _apply_krauss_multi_qubit(krauss: Union[Tuple[Any], Sequence[Any]], args: 'ApplyChannelArgs') -> np.ndarray: """Use numpy's einsum to apply a multi-qubit channel.""" for krauss_op in krauss: np.copyto(dst=args.target_tensor, src=args.auxiliary_buffer0) krauss_tensor = np.reshape( ...
def function[_apply_krauss_multi_qubit, parameter[krauss, args]]: constant[Use numpy's einsum to apply a multi-qubit channel.] for taget[name[krauss_op]] in starred[name[krauss]] begin[:] call[name[np].copyto, parameter[]] variable[krauss_tensor] assign[=] call[name[np].r...
keyword[def] identifier[_apply_krauss_multi_qubit] ( identifier[krauss] : identifier[Union] [ identifier[Tuple] [ identifier[Any] ], identifier[Sequence] [ identifier[Any] ]], identifier[args] : literal[string] )-> identifier[np] . identifier[ndarray] : literal[string] keyword[for] identifier[krauss_op] ...
def _apply_krauss_multi_qubit(krauss: Union[Tuple[Any], Sequence[Any]], args: 'ApplyChannelArgs') -> np.ndarray: """Use numpy's einsum to apply a multi-qubit channel.""" for krauss_op in krauss: np.copyto(dst=args.target_tensor, src=args.auxiliary_buffer0) krauss_tensor = np.reshape(krauss_op.as...