code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def create_python_worker(self, func, *args, **kwargs): """Create a new python worker instance.""" worker = PythonWorker(func, args, kwargs) self._create_worker(worker) return worker
def function[create_python_worker, parameter[self, func]]: constant[Create a new python worker instance.] variable[worker] assign[=] call[name[PythonWorker], parameter[name[func], name[args], name[kwargs]]] call[name[self]._create_worker, parameter[name[worker]]] return[name[worker]]
keyword[def] identifier[create_python_worker] ( identifier[self] , identifier[func] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[worker] = identifier[PythonWorker] ( identifier[func] , identifier[args] , identifier[kwargs] ) identifier[self] . identifier[_create...
def create_python_worker(self, func, *args, **kwargs): """Create a new python worker instance.""" worker = PythonWorker(func, args, kwargs) self._create_worker(worker) return worker
def in_general_ns(uri): """Return True iff the URI is in a well-known general RDF namespace. URI namespaces considered well-known are RDF, RDFS, OWL, SKOS and DC.""" RDFuri = RDF.uri RDFSuri = RDFS.uri for ns in (RDFuri, RDFSuri, OWL, SKOS, DC): if uri.startswith(ns): return Tr...
def function[in_general_ns, parameter[uri]]: constant[Return True iff the URI is in a well-known general RDF namespace. URI namespaces considered well-known are RDF, RDFS, OWL, SKOS and DC.] variable[RDFuri] assign[=] name[RDF].uri variable[RDFSuri] assign[=] name[RDFS].uri for tage...
keyword[def] identifier[in_general_ns] ( identifier[uri] ): literal[string] identifier[RDFuri] = identifier[RDF] . identifier[uri] identifier[RDFSuri] = identifier[RDFS] . identifier[uri] keyword[for] identifier[ns] keyword[in] ( identifier[RDFuri] , identifier[RDFSuri] , identifier[OWL] , i...
def in_general_ns(uri): """Return True iff the URI is in a well-known general RDF namespace. URI namespaces considered well-known are RDF, RDFS, OWL, SKOS and DC.""" RDFuri = RDF.uri RDFSuri = RDFS.uri for ns in (RDFuri, RDFSuri, OWL, SKOS, DC): if uri.startswith(ns): return Tru...
def get_mnist(): """ Gets MNIST dataset """ np.random.seed(1234) # set seed for deterministic ordering mnist_data = mx.test_utils.get_mnist() X = np.concatenate([mnist_data['train_data'], mnist_data['test_data']]) Y = np.concatenate([mnist_data['train_label'], mnist_data['test_label']]) p = np....
def function[get_mnist, parameter[]]: constant[ Gets MNIST dataset ] call[name[np].random.seed, parameter[constant[1234]]] variable[mnist_data] assign[=] call[name[mx].test_utils.get_mnist, parameter[]] variable[X] assign[=] call[name[np].concatenate, parameter[list[[<ast.Subscript objec...
keyword[def] identifier[get_mnist] (): literal[string] identifier[np] . identifier[random] . identifier[seed] ( literal[int] ) identifier[mnist_data] = identifier[mx] . identifier[test_utils] . identifier[get_mnist] () identifier[X] = identifier[np] . identifier[concatenate] ([ identifier[mnist_...
def get_mnist(): """ Gets MNIST dataset """ np.random.seed(1234) # set seed for deterministic ordering mnist_data = mx.test_utils.get_mnist() X = np.concatenate([mnist_data['train_data'], mnist_data['test_data']]) Y = np.concatenate([mnist_data['train_label'], mnist_data['test_label']]) p = np....
def pack_dunder(name): ''' Compatibility helper function to make __utils__ available on demand. ''' # TODO: Deprecate starting with Beryllium mod = sys.modules[name] if not hasattr(mod, '__utils__'): setattr(mod, '__utils__', salt.loader.utils(mod.__opts__))
def function[pack_dunder, parameter[name]]: constant[ Compatibility helper function to make __utils__ available on demand. ] variable[mod] assign[=] call[name[sys].modules][name[name]] if <ast.UnaryOp object at 0x7da1b1f74760> begin[:] call[name[setattr], parameter[name[m...
keyword[def] identifier[pack_dunder] ( identifier[name] ): literal[string] identifier[mod] = identifier[sys] . identifier[modules] [ identifier[name] ] keyword[if] keyword[not] identifier[hasattr] ( identifier[mod] , literal[string] ): identifier[setattr] ( identifier[mod] , literal[s...
def pack_dunder(name): """ Compatibility helper function to make __utils__ available on demand. """ # TODO: Deprecate starting with Beryllium mod = sys.modules[name] if not hasattr(mod, '__utils__'): setattr(mod, '__utils__', salt.loader.utils(mod.__opts__)) # depends on [control=['if']...
def setup(self): """ Set up the power system object by executing the following workflow: * Sort the loaded models to meet the initialization sequence * Create call strings for routines * Call the ``setup`` function of the loaded models * Assign addresses for the load...
def function[setup, parameter[self]]: constant[ Set up the power system object by executing the following workflow: * Sort the loaded models to meet the initialization sequence * Create call strings for routines * Call the ``setup`` function of the loaded models * As...
keyword[def] identifier[setup] ( identifier[self] ): literal[string] identifier[self] . identifier[devman] . identifier[sort_device] () identifier[self] . identifier[call] . identifier[setup] () identifier[self] . identifier[model_setup] () identifier[self] . identifier[...
def setup(self): """ Set up the power system object by executing the following workflow: * Sort the loaded models to meet the initialization sequence * Create call strings for routines * Call the ``setup`` function of the loaded models * Assign addresses for the loaded m...
def publish_report(report, args, old_commit, new_commit): """Publish the RST report based on the user request.""" # Print the report to stdout unless the user specified --quiet. output = "" if not args.quiet and not args.gist and not args.file: return report if args.gist: gist_url ...
def function[publish_report, parameter[report, args, old_commit, new_commit]]: constant[Publish the RST report based on the user request.] variable[output] assign[=] constant[] if <ast.BoolOp object at 0x7da1b28f1570> begin[:] return[name[report]] if name[args].gist begin[:] ...
keyword[def] identifier[publish_report] ( identifier[report] , identifier[args] , identifier[old_commit] , identifier[new_commit] ): literal[string] identifier[output] = literal[string] keyword[if] keyword[not] identifier[args] . identifier[quiet] keyword[and] keyword[not] identifier[args]...
def publish_report(report, args, old_commit, new_commit): """Publish the RST report based on the user request.""" # Print the report to stdout unless the user specified --quiet. output = '' if not args.quiet and (not args.gist) and (not args.file): return report # depends on [control=['if'], da...
def prepare(ctx, new_version=None, version_part=None, hide=True, dry_run=False): """Prepare the release: bump version, build packages, ...""" if new_version is not None: bump_version(ctx, new_version, version_part=version_part, dry_run=dry_run) build_packages(ctx, hi...
def function[prepare, parameter[ctx, new_version, version_part, hide, dry_run]]: constant[Prepare the release: bump version, build packages, ...] if compare[name[new_version] is_not constant[None]] begin[:] call[name[bump_version], parameter[name[ctx], name[new_version]]] call[na...
keyword[def] identifier[prepare] ( identifier[ctx] , identifier[new_version] = keyword[None] , identifier[version_part] = keyword[None] , identifier[hide] = keyword[True] , identifier[dry_run] = keyword[False] ): literal[string] keyword[if] identifier[new_version] keyword[is] keyword[not] keyword[None...
def prepare(ctx, new_version=None, version_part=None, hide=True, dry_run=False): """Prepare the release: bump version, build packages, ...""" if new_version is not None: bump_version(ctx, new_version, version_part=version_part, dry_run=dry_run) # depends on [control=['if'], data=['new_version']] bu...
def create_table_sql(cls, db): ''' Returns the SQL command for creating a table for this model. ''' parts = ['CREATE TABLE IF NOT EXISTS `%s`.`%s` AS `%s`.`%s`' % (db.db_name, cls.table_name(), db.db_name, cls.engine...
def function[create_table_sql, parameter[cls, db]]: constant[ Returns the SQL command for creating a table for this model. ] variable[parts] assign[=] list[[<ast.BinOp object at 0x7da18fe90f70>]] variable[engine_str] assign[=] call[name[cls].engine.create_table_sql, parameter[nam...
keyword[def] identifier[create_table_sql] ( identifier[cls] , identifier[db] ): literal[string] identifier[parts] =[ literal[string] %( identifier[db] . identifier[db_name] , identifier[cls] . identifier[table_name] (), identifier[db] . identifier[db_name] , identifier[cls] . identifier[en...
def create_table_sql(cls, db): """ Returns the SQL command for creating a table for this model. """ parts = ['CREATE TABLE IF NOT EXISTS `%s`.`%s` AS `%s`.`%s`' % (db.db_name, cls.table_name(), db.db_name, cls.engine.main_model.table_name())] engine_str = cls.engine.create_table_sql(db) ...
def distributions_for_instances(self, data): """ Peforms predictions, returning the class distributions. :param data: the Instances to get the class distributions for :type data: Instances :return: the class distribution matrix, None if not a batch predictor :rtype: ndar...
def function[distributions_for_instances, parameter[self, data]]: constant[ Peforms predictions, returning the class distributions. :param data: the Instances to get the class distributions for :type data: Instances :return: the class distribution matrix, None if not a batch pre...
keyword[def] identifier[distributions_for_instances] ( identifier[self] , identifier[data] ): literal[string] keyword[if] identifier[self] . identifier[is_batchpredictor] : keyword[return] identifier[typeconv] . identifier[double_matrix_to_ndarray] ( identifier[self] . identifier[__d...
def distributions_for_instances(self, data): """ Peforms predictions, returning the class distributions. :param data: the Instances to get the class distributions for :type data: Instances :return: the class distribution matrix, None if not a batch predictor :rtype: ndarray ...
def _submit_to_queue(self, script_file): """Submit a job script to the queue.""" if sys.version_info[0] < 3: process = Popen(['qsub', script_file], stdout=PIPE, stderr=PIPE) else: # need string not bytes so must use universal_newlines process = Popen(['qsub', ...
def function[_submit_to_queue, parameter[self, script_file]]: constant[Submit a job script to the queue.] if compare[call[name[sys].version_info][constant[0]] less[<] constant[3]] begin[:] variable[process] assign[=] call[name[Popen], parameter[list[[<ast.Constant object at 0x7da20c992b0...
keyword[def] identifier[_submit_to_queue] ( identifier[self] , identifier[script_file] ): literal[string] keyword[if] identifier[sys] . identifier[version_info] [ literal[int] ]< literal[int] : identifier[process] = identifier[Popen] ([ literal[string] , identifier[script_file] ], ide...
def _submit_to_queue(self, script_file): """Submit a job script to the queue.""" if sys.version_info[0] < 3: process = Popen(['qsub', script_file], stdout=PIPE, stderr=PIPE) # depends on [control=['if'], data=[]] else: # need string not bytes so must use universal_newlines process =...
def render_css(self, fn=None, text=None, margin='', indent='\t'): """output css using the Sass processor""" fn = fn or os.path.splitext(self.fn)[0]+'.css' if not os.path.exists(os.path.dirname(fn)): os.makedirs(os.path.dirname(fn)) curdir = os.path.abspath(os.curdir) ...
def function[render_css, parameter[self, fn, text, margin, indent]]: constant[output css using the Sass processor] variable[fn] assign[=] <ast.BoolOp object at 0x7da207f98c40> if <ast.UnaryOp object at 0x7da18dc98e20> begin[:] call[name[os].makedirs, parameter[call[name[os].path....
keyword[def] identifier[render_css] ( identifier[self] , identifier[fn] = keyword[None] , identifier[text] = keyword[None] , identifier[margin] = literal[string] , identifier[indent] = literal[string] ): literal[string] identifier[fn] = identifier[fn] keyword[or] identifier[os] . identifier[path]...
def render_css(self, fn=None, text=None, margin='', indent='\t'): """output css using the Sass processor""" fn = fn or os.path.splitext(self.fn)[0] + '.css' if not os.path.exists(os.path.dirname(fn)): os.makedirs(os.path.dirname(fn)) # depends on [control=['if'], data=[]] curdir = os.path.abspa...
def open(filename, frame='unspecified'): """Creates a PointCloudImage from a file. Parameters ---------- filename : :obj:`str` The file to load the data from. Must be one of .png, .jpg, .npy, or .npz. frame : :obj:`str` A string representing ...
def function[open, parameter[filename, frame]]: constant[Creates a PointCloudImage from a file. Parameters ---------- filename : :obj:`str` The file to load the data from. Must be one of .png, .jpg, .npy, or .npz. frame : :obj:`str` A string ...
keyword[def] identifier[open] ( identifier[filename] , identifier[frame] = literal[string] ): literal[string] identifier[data] = identifier[Image] . identifier[load_data] ( identifier[filename] ) keyword[return] identifier[PointCloudImage] ( identifier[data] , identifier[frame] )
def open(filename, frame='unspecified'): """Creates a PointCloudImage from a file. Parameters ---------- filename : :obj:`str` The file to load the data from. Must be one of .png, .jpg, .npy, or .npz. frame : :obj:`str` A string representing the ...
def start(self, start_context): """ Perform any logic on solution start """ for p in self._providers: p.start(start_context) if self._clear_start: self.clear_cache()
def function[start, parameter[self, start_context]]: constant[ Perform any logic on solution start ] for taget[name[p]] in starred[name[self]._providers] begin[:] call[name[p].start, parameter[name[start_context]]] if name[self]._clear_start begin[:] call[name[sel...
keyword[def] identifier[start] ( identifier[self] , identifier[start_context] ): literal[string] keyword[for] identifier[p] keyword[in] identifier[self] . identifier[_providers] : identifier[p] . identifier[start] ( identifier[start_context] ) keyword[if] identifier[self]...
def start(self, start_context): """ Perform any logic on solution start """ for p in self._providers: p.start(start_context) # depends on [control=['for'], data=['p']] if self._clear_start: self.clear_cache() # depends on [control=['if'], data=[]]
def infer_call_result(self, caller, context=None): """infer what a class is returning when called""" if ( self.is_subtype_of("%s.type" % (BUILTINS,), context) and len(caller.args) == 3 ): result = self._infer_type_call(caller, context) yield result...
def function[infer_call_result, parameter[self, caller, context]]: constant[infer what a class is returning when called] if <ast.BoolOp object at 0x7da1b1e5a530> begin[:] variable[result] assign[=] call[name[self]._infer_type_call, parameter[name[caller], name[context]]] ...
keyword[def] identifier[infer_call_result] ( identifier[self] , identifier[caller] , identifier[context] = keyword[None] ): literal[string] keyword[if] ( identifier[self] . identifier[is_subtype_of] ( literal[string] %( identifier[BUILTINS] ,), identifier[context] ) keyword[and] ...
def infer_call_result(self, caller, context=None): """infer what a class is returning when called""" if self.is_subtype_of('%s.type' % (BUILTINS,), context) and len(caller.args) == 3: result = self._infer_type_call(caller, context) yield result return # depends on [control=['if'], data=...
def _generate_base_mimetypes(self): """ Generate the base mimetypes as described by non customized document types. """ for t in self.type_instances: if t.custom_mime: continue yield t.mime, (t, None, None)
def function[_generate_base_mimetypes, parameter[self]]: constant[ Generate the base mimetypes as described by non customized document types. ] for taget[name[t]] in starred[name[self].type_instances] begin[:] if name[t].custom_mime begin[:] continue ...
keyword[def] identifier[_generate_base_mimetypes] ( identifier[self] ): literal[string] keyword[for] identifier[t] keyword[in] identifier[self] . identifier[type_instances] : keyword[if] identifier[t] . identifier[custom_mime] : keyword[continue] key...
def _generate_base_mimetypes(self): """ Generate the base mimetypes as described by non customized document types. """ for t in self.type_instances: if t.custom_mime: continue # depends on [control=['if'], data=[]] yield (t.mime, (t, None, None)) # depends o...
def run(self, scr): 'Manage execution of keystrokes and subsequent redrawing of screen.' global sheet scr.timeout(int(options.curses_timeout)) with suppress(curses.error): curses.curs_set(0) self.scr = scr numTimeouts = 0 self.keystrokes = '' ...
def function[run, parameter[self, scr]]: constant[Manage execution of keystrokes and subsequent redrawing of screen.] <ast.Global object at 0x7da207f02050> call[name[scr].timeout, parameter[call[name[int], parameter[name[options].curses_timeout]]]] with call[name[suppress], parameter[name[cu...
keyword[def] identifier[run] ( identifier[self] , identifier[scr] ): literal[string] keyword[global] identifier[sheet] identifier[scr] . identifier[timeout] ( identifier[int] ( identifier[options] . identifier[curses_timeout] )) keyword[with] identifier[suppress] ( identifier[c...
def run(self, scr): """Manage execution of keystrokes and subsequent redrawing of screen.""" global sheet scr.timeout(int(options.curses_timeout)) with suppress(curses.error): curses.curs_set(0) # depends on [control=['with'], data=[]] self.scr = scr numTimeouts = 0 self.keystrokes ...
def market_if_touched_replace(self, accountID, orderID, **kwargs): """ Shortcut to replace a pending MarketIfTouched Order in an Account Args: accountID : The ID of the Account orderID : The ID of the MarketIfTouched Order to replace kwargs : The arguments to...
def function[market_if_touched_replace, parameter[self, accountID, orderID]]: constant[ Shortcut to replace a pending MarketIfTouched Order in an Account Args: accountID : The ID of the Account orderID : The ID of the MarketIfTouched Order to replace kwargs :...
keyword[def] identifier[market_if_touched_replace] ( identifier[self] , identifier[accountID] , identifier[orderID] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[replace] ( identifier[accountID] , identifier[orderID] , identifier...
def market_if_touched_replace(self, accountID, orderID, **kwargs): """ Shortcut to replace a pending MarketIfTouched Order in an Account Args: accountID : The ID of the Account orderID : The ID of the MarketIfTouched Order to replace kwargs : The arguments to cre...
def kill_workflow(self): '''Kills the workflow. See also -------- :func:`tmserver.api.workflow.kill_workflow` :class:`tmlib.workflow.workflow.Workflow` ''' logger.info('kill workflow of experiment "%s"', self.experiment_name) content = dict() url ...
def function[kill_workflow, parameter[self]]: constant[Kills the workflow. See also -------- :func:`tmserver.api.workflow.kill_workflow` :class:`tmlib.workflow.workflow.Workflow` ] call[name[logger].info, parameter[constant[kill workflow of experiment "%s"], name...
keyword[def] identifier[kill_workflow] ( identifier[self] ): literal[string] identifier[logger] . identifier[info] ( literal[string] , identifier[self] . identifier[experiment_name] ) identifier[content] = identifier[dict] () identifier[url] = identifier[self] . identifier[_build_...
def kill_workflow(self): """Kills the workflow. See also -------- :func:`tmserver.api.workflow.kill_workflow` :class:`tmlib.workflow.workflow.Workflow` """ logger.info('kill workflow of experiment "%s"', self.experiment_name) content = dict() url = self._build_ap...
def set_working_directory(self, dirname): """Set current working directory. In the workingdirectory and explorer plugins. """ if dirname: self.main.workingdirectory.chdir(dirname, refresh_explorer=True, refresh_console=False)
def function[set_working_directory, parameter[self, dirname]]: constant[Set current working directory. In the workingdirectory and explorer plugins. ] if name[dirname] begin[:] call[name[self].main.workingdirectory.chdir, parameter[name[dirname]]]
keyword[def] identifier[set_working_directory] ( identifier[self] , identifier[dirname] ): literal[string] keyword[if] identifier[dirname] : identifier[self] . identifier[main] . identifier[workingdirectory] . identifier[chdir] ( identifier[dirname] , identifier[refresh_explorer] =...
def set_working_directory(self, dirname): """Set current working directory. In the workingdirectory and explorer plugins. """ if dirname: self.main.workingdirectory.chdir(dirname, refresh_explorer=True, refresh_console=False) # depends on [control=['if'], data=[]]
def get_fieldsets(self, request, obj=None): """ Add fieldsets of placeholders to the list of already existing fieldsets. """ # some ugly business to remove freeze_date # from the field list general_module = { 'fields': list(self.general_fields), ...
def function[get_fieldsets, parameter[self, request, obj]]: constant[ Add fieldsets of placeholders to the list of already existing fieldsets. ] variable[general_module] assign[=] dictionary[[<ast.Constant object at 0x7da1b1d34d30>, <ast.Constant object at 0x7da1b1d37af0>], [<ast...
keyword[def] identifier[get_fieldsets] ( identifier[self] , identifier[request] , identifier[obj] = keyword[None] ): literal[string] identifier[general_module] ={ literal[string] : identifier[list] ( identifier[self] . identifier[general_fields] ), literal[strin...
def get_fieldsets(self, request, obj=None): """ Add fieldsets of placeholders to the list of already existing fieldsets. """ # some ugly business to remove freeze_date # from the field list general_module = {'fields': list(self.general_fields), 'classes': ('module-general',)} ...
def validate_field(field, allowed_keys, allowed_types): """Validate field is allowed and valid.""" for key, value in field.items(): if key not in allowed_keys: raise exceptions.ParametersFieldError(key, "property") if key == defs.TYPE: if value not in allowed_types: ...
def function[validate_field, parameter[field, allowed_keys, allowed_types]]: constant[Validate field is allowed and valid.] for taget[tuple[[<ast.Name object at 0x7da1b11a4bb0>, <ast.Name object at 0x7da1b11a6bf0>]]] in starred[call[name[field].items, parameter[]]] begin[:] if compare[na...
keyword[def] identifier[validate_field] ( identifier[field] , identifier[allowed_keys] , identifier[allowed_types] ): literal[string] keyword[for] identifier[key] , identifier[value] keyword[in] identifier[field] . identifier[items] (): keyword[if] identifier[key] keyword[not] keyword[in] i...
def validate_field(field, allowed_keys, allowed_types): """Validate field is allowed and valid.""" for (key, value) in field.items(): if key not in allowed_keys: raise exceptions.ParametersFieldError(key, 'property') # depends on [control=['if'], data=['key']] if key == defs.TYPE: ...
def keep_params(self, base_key, *params): """ Method to keep only specific parameters from a parameter documentation. This method extracts the given `param` from the `base_key` item in the :attr:`params` dictionary and creates a new item with the original documentation with only...
def function[keep_params, parameter[self, base_key]]: constant[ Method to keep only specific parameters from a parameter documentation. This method extracts the given `param` from the `base_key` item in the :attr:`params` dictionary and creates a new item with the original docum...
keyword[def] identifier[keep_params] ( identifier[self] , identifier[base_key] ,* identifier[params] ): literal[string] identifier[self] . identifier[params] [ identifier[base_key] + literal[string] + literal[string] . identifier[join] ( identifier[params] )]= identifier[self] . identifier[keep_par...
def keep_params(self, base_key, *params): """ Method to keep only specific parameters from a parameter documentation. This method extracts the given `param` from the `base_key` item in the :attr:`params` dictionary and creates a new item with the original documentation with only the...
def compare(self, origin, pattern): """ Args: origin (:obj:`str`): original string pattern (:obj:`str`): Regexp pattern string Returns: bool: True if matches otherwise False. """ if origin is None or pattern is None: return False ...
def function[compare, parameter[self, origin, pattern]]: constant[ Args: origin (:obj:`str`): original string pattern (:obj:`str`): Regexp pattern string Returns: bool: True if matches otherwise False. ] if <ast.BoolOp object at 0x7da2044c2800...
keyword[def] identifier[compare] ( identifier[self] , identifier[origin] , identifier[pattern] ): literal[string] keyword[if] identifier[origin] keyword[is] keyword[None] keyword[or] identifier[pattern] keyword[is] keyword[None] : keyword[return] keyword[False] keywo...
def compare(self, origin, pattern): """ Args: origin (:obj:`str`): original string pattern (:obj:`str`): Regexp pattern string Returns: bool: True if matches otherwise False. """ if origin is None or pattern is None: return False # depends on...
def pull_request(self, file): """ Create a pull request :param file: File to push through pull request :return: URL of the PullRequest or Proxy Error """ uri = "{api}/repos/{upstream}/pulls".format( api=self.github_api_url, upstream=self.upstream, ...
def function[pull_request, parameter[self, file]]: constant[ Create a pull request :param file: File to push through pull request :return: URL of the PullRequest or Proxy Error ] variable[uri] assign[=] call[constant[{api}/repos/{upstream}/pulls].format, parameter[]] var...
keyword[def] identifier[pull_request] ( identifier[self] , identifier[file] ): literal[string] identifier[uri] = literal[string] . identifier[format] ( identifier[api] = identifier[self] . identifier[github_api_url] , identifier[upstream] = identifier[self] . identifier[upstream] ...
def pull_request(self, file): """ Create a pull request :param file: File to push through pull request :return: URL of the PullRequest or Proxy Error """ uri = '{api}/repos/{upstream}/pulls'.format(api=self.github_api_url, upstream=self.upstream, path=file.path) params = {'title': '...
def update_eol(self, os_name): """Update end of line status.""" os_name = to_text_string(os_name) value = {"nt": "CRLF", "posix": "LF"}.get(os_name, "CR") self.set_value(value)
def function[update_eol, parameter[self, os_name]]: constant[Update end of line status.] variable[os_name] assign[=] call[name[to_text_string], parameter[name[os_name]]] variable[value] assign[=] call[dictionary[[<ast.Constant object at 0x7da1b2042650>, <ast.Constant object at 0x7da1b20420b0>], ...
keyword[def] identifier[update_eol] ( identifier[self] , identifier[os_name] ): literal[string] identifier[os_name] = identifier[to_text_string] ( identifier[os_name] ) identifier[value] ={ literal[string] : literal[string] , literal[string] : literal[string] }. identifier[get] ( identifie...
def update_eol(self, os_name): """Update end of line status.""" os_name = to_text_string(os_name) value = {'nt': 'CRLF', 'posix': 'LF'}.get(os_name, 'CR') self.set_value(value)
def encode_dict(dynamizer, value): """ Encode a dict for the DynamoDB format """ encoded_dict = {} for k, v in six.iteritems(value): encoded_type, encoded_value = dynamizer.raw_encode(v) encoded_dict[k] = { encoded_type: encoded_value, } return 'M', encoded_dict
def function[encode_dict, parameter[dynamizer, value]]: constant[ Encode a dict for the DynamoDB format ] variable[encoded_dict] assign[=] dictionary[[], []] for taget[tuple[[<ast.Name object at 0x7da204346080>, <ast.Name object at 0x7da204347b20>]]] in starred[call[name[six].iteritems, paramete...
keyword[def] identifier[encode_dict] ( identifier[dynamizer] , identifier[value] ): literal[string] identifier[encoded_dict] ={} keyword[for] identifier[k] , identifier[v] keyword[in] identifier[six] . identifier[iteritems] ( identifier[value] ): identifier[encoded_type] , identifier[encod...
def encode_dict(dynamizer, value): """ Encode a dict for the DynamoDB format """ encoded_dict = {} for (k, v) in six.iteritems(value): (encoded_type, encoded_value) = dynamizer.raw_encode(v) encoded_dict[k] = {encoded_type: encoded_value} # depends on [control=['for'], data=[]] return (...
def addActionFinish(self): """ Indicates all callbacks that should run within the action's context have been added, and that the action should therefore finish once those callbacks have fired. @return: The wrapped L{Deferred}. @raises AlreadyFinished: L{DeferredContext....
def function[addActionFinish, parameter[self]]: constant[ Indicates all callbacks that should run within the action's context have been added, and that the action should therefore finish once those callbacks have fired. @return: The wrapped L{Deferred}. @raises AlreadyF...
keyword[def] identifier[addActionFinish] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_finishAdded] : keyword[raise] identifier[AlreadyFinished] () identifier[self] . identifier[_finishAdded] = keyword[True] keyword[def] identif...
def addActionFinish(self): """ Indicates all callbacks that should run within the action's context have been added, and that the action should therefore finish once those callbacks have fired. @return: The wrapped L{Deferred}. @raises AlreadyFinished: L{DeferredContext.addA...
def drizCR(input=None, configObj=None, editpars=False, **inputDict): """ Look for cosmic rays. """ log.debug(inputDict) inputDict["input"] = input configObj = util.getDefaultConfigObj(__taskname__, configObj, inputDict, loadOnly=(not editpars)) if configObj i...
def function[drizCR, parameter[input, configObj, editpars]]: constant[ Look for cosmic rays. ] call[name[log].debug, parameter[name[inputDict]]] call[name[inputDict]][constant[input]] assign[=] name[input] variable[configObj] assign[=] call[name[util].getDefaultConfigObj, parameter[name[...
keyword[def] identifier[drizCR] ( identifier[input] = keyword[None] , identifier[configObj] = keyword[None] , identifier[editpars] = keyword[False] ,** identifier[inputDict] ): literal[string] identifier[log] . identifier[debug] ( identifier[inputDict] ) identifier[inputDict] [ literal[string] ]= iden...
def drizCR(input=None, configObj=None, editpars=False, **inputDict): """ Look for cosmic rays. """ log.debug(inputDict) inputDict['input'] = input configObj = util.getDefaultConfigObj(__taskname__, configObj, inputDict, loadOnly=not editpars) if configObj is None: return # depends on [contr...
def salt_call(): ''' Directly call a salt command in the modules, does not require a running salt minion to run. ''' import salt.cli.call if '' in sys.path: sys.path.remove('') client = salt.cli.call.SaltCall() _install_signal_handlers(client) client.run()
def function[salt_call, parameter[]]: constant[ Directly call a salt command in the modules, does not require a running salt minion to run. ] import module[salt.cli.call] if compare[constant[] in name[sys].path] begin[:] call[name[sys].path.remove, parameter[constant[]]] ...
keyword[def] identifier[salt_call] (): literal[string] keyword[import] identifier[salt] . identifier[cli] . identifier[call] keyword[if] literal[string] keyword[in] identifier[sys] . identifier[path] : identifier[sys] . identifier[path] . identifier[remove] ( literal[string] ) ident...
def salt_call(): """ Directly call a salt command in the modules, does not require a running salt minion to run. """ import salt.cli.call if '' in sys.path: sys.path.remove('') # depends on [control=['if'], data=[]] client = salt.cli.call.SaltCall() _install_signal_handlers(clie...
def get_act_act(self, end): """ implements Act/Act day count convention (4.16(b) 2006 ISDA Definitions) """ # split end-self in year portions # if the period does not lie within a year split the days in the period as following: # restdays of start year / ye...
def function[get_act_act, parameter[self, end]]: constant[ implements Act/Act day count convention (4.16(b) 2006 ISDA Definitions) ] if compare[binary_operation[name[end].year - name[self].year] equal[==] constant[0]] begin[:] if call[name[BusinessDate].is_leap_year, ...
keyword[def] identifier[get_act_act] ( identifier[self] , identifier[end] ): literal[string] keyword[if] identifier[end] . identifier[year] - identifier[self] . identifier[year] == literal[int] : keyword[if] identifier[...
def get_act_act(self, end): """ implements Act/Act day count convention (4.16(b) 2006 ISDA Definitions) """ # split end-self in year portions # if the period does not lie within a year split the days in the period as following: # restdays of start year / years in between / ...
def extra_info(self): """Retrieve the log string generated when opening the file.""" info = _ffi.new("char[]", 2**14) _snd.sf_command(self._file, _snd.SFC_GET_LOG_INFO, info, _ffi.sizeof(info)) return _ffi.string(info).decode('utf-8', 'replace')
def function[extra_info, parameter[self]]: constant[Retrieve the log string generated when opening the file.] variable[info] assign[=] call[name[_ffi].new, parameter[constant[char[]], binary_operation[constant[2] ** constant[14]]]] call[name[_snd].sf_command, parameter[name[self]._file, name[_sn...
keyword[def] identifier[extra_info] ( identifier[self] ): literal[string] identifier[info] = identifier[_ffi] . identifier[new] ( literal[string] , literal[int] ** literal[int] ) identifier[_snd] . identifier[sf_command] ( identifier[self] . identifier[_file] , identifier[_snd] . identifie...
def extra_info(self): """Retrieve the log string generated when opening the file.""" info = _ffi.new('char[]', 2 ** 14) _snd.sf_command(self._file, _snd.SFC_GET_LOG_INFO, info, _ffi.sizeof(info)) return _ffi.string(info).decode('utf-8', 'replace')
def __sub(self, string: str = '') -> str: """Replace spaces in string. :param string: String. :return: String without spaces. """ replacer = self.random.choice(['_', '-']) return re.sub(r'\s+', replacer, string.strip())
def function[__sub, parameter[self, string]]: constant[Replace spaces in string. :param string: String. :return: String without spaces. ] variable[replacer] assign[=] call[name[self].random.choice, parameter[list[[<ast.Constant object at 0x7da20c6c5d50>, <ast.Constant object at ...
keyword[def] identifier[__sub] ( identifier[self] , identifier[string] : identifier[str] = literal[string] )-> identifier[str] : literal[string] identifier[replacer] = identifier[self] . identifier[random] . identifier[choice] ([ literal[string] , literal[string] ]) keyword[return] identi...
def __sub(self, string: str='') -> str: """Replace spaces in string. :param string: String. :return: String without spaces. """ replacer = self.random.choice(['_', '-']) return re.sub('\\s+', replacer, string.strip())
def get_descriptions(self, description_type): """ Gets the descriptions for specified type. When complete the callback is called with a list of descriptions """ (desc_type, max_units) = description_type results = [None] * max_units self.elk._descriptions_in_progre...
def function[get_descriptions, parameter[self, description_type]]: constant[ Gets the descriptions for specified type. When complete the callback is called with a list of descriptions ] <ast.Tuple object at 0x7da18dc076a0> assign[=] name[description_type] variable[results...
keyword[def] identifier[get_descriptions] ( identifier[self] , identifier[description_type] ): literal[string] ( identifier[desc_type] , identifier[max_units] )= identifier[description_type] identifier[results] =[ keyword[None] ]* identifier[max_units] identifier[self] . identifi...
def get_descriptions(self, description_type): """ Gets the descriptions for specified type. When complete the callback is called with a list of descriptions """ (desc_type, max_units) = description_type results = [None] * max_units self.elk._descriptions_in_progress[desc_type] = ...
def in_8(library, session, space, offset, extended=False): """Reads in an 8-bit value from the specified memory space and offset. Corresponds to viIn8* function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param s...
def function[in_8, parameter[library, session, space, offset, extended]]: constant[Reads in an 8-bit value from the specified memory space and offset. Corresponds to viIn8* function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier t...
keyword[def] identifier[in_8] ( identifier[library] , identifier[session] , identifier[space] , identifier[offset] , identifier[extended] = keyword[False] ): literal[string] identifier[value_8] = identifier[ViUInt8] () keyword[if] identifier[extended] : identifier[ret] = identifier[library] ...
def in_8(library, session, space, offset, extended=False): """Reads in an 8-bit value from the specified memory space and offset. Corresponds to viIn8* function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param s...
def orb(self): """ Returns the orb of this fixed star. """ for (mag, orb) in FixedStar._ORBS: if self.mag < mag: return orb return 0.5
def function[orb, parameter[self]]: constant[ Returns the orb of this fixed star. ] for taget[tuple[[<ast.Name object at 0x7da1b11dde40>, <ast.Name object at 0x7da1b11dc7c0>]]] in starred[name[FixedStar]._ORBS] begin[:] if compare[name[self].mag less[<] name[mag]] begin[:] re...
keyword[def] identifier[orb] ( identifier[self] ): literal[string] keyword[for] ( identifier[mag] , identifier[orb] ) keyword[in] identifier[FixedStar] . identifier[_ORBS] : keyword[if] identifier[self] . identifier[mag] < identifier[mag] : keyword[return] identifie...
def orb(self): """ Returns the orb of this fixed star. """ for (mag, orb) in FixedStar._ORBS: if self.mag < mag: return orb # depends on [control=['if'], data=[]] # depends on [control=['for'], data=[]] return 0.5
def accounts(self) -> AccountsAggregate: """ Returns the Accounts aggregate """ if not self.__accounts_aggregate: self.__accounts_aggregate = AccountsAggregate(self.book) return self.__accounts_aggregate
def function[accounts, parameter[self]]: constant[ Returns the Accounts aggregate ] if <ast.UnaryOp object at 0x7da1b1289510> begin[:] name[self].__accounts_aggregate assign[=] call[name[AccountsAggregate], parameter[name[self].book]] return[name[self].__accounts_aggregate]
keyword[def] identifier[accounts] ( identifier[self] )-> identifier[AccountsAggregate] : literal[string] keyword[if] keyword[not] identifier[self] . identifier[__accounts_aggregate] : identifier[self] . identifier[__accounts_aggregate] = identifier[AccountsAggregate] ( identifier[sel...
def accounts(self) -> AccountsAggregate: """ Returns the Accounts aggregate """ if not self.__accounts_aggregate: self.__accounts_aggregate = AccountsAggregate(self.book) # depends on [control=['if'], data=[]] return self.__accounts_aggregate
def update(self, **kwargs): """Update the Account resource with specified content. Args: name (str): Human-readable name for the account Returns: the updated Account object. """ return self.__class__(self.resource.update(kwargs), self.cli...
def function[update, parameter[self]]: constant[Update the Account resource with specified content. Args: name (str): Human-readable name for the account Returns: the updated Account object. ] return[call[name[self].__class__, parameter[call[name[self].resource.update, pa...
keyword[def] identifier[update] ( identifier[self] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[__class__] ( identifier[self] . identifier[resource] . identifier[update] ( identifier[kwargs] ), identifier[self] . identifier[client] , ide...
def update(self, **kwargs): """Update the Account resource with specified content. Args: name (str): Human-readable name for the account Returns: the updated Account object. """ return self.__class__(self.resource.update(kwargs), self.client, wallet=self.wallet)
def seen_nonce(id, nonce, timestamp): """ Returns True if the Hawk nonce has been seen already. """ key = '{id}:{n}:{ts}'.format(id=id, n=nonce, ts=timestamp) if cache.get(key): log.warning('replay attack? already processed nonce {k}' .format(k=key)) return True ...
def function[seen_nonce, parameter[id, nonce, timestamp]]: constant[ Returns True if the Hawk nonce has been seen already. ] variable[key] assign[=] call[constant[{id}:{n}:{ts}].format, parameter[]] if call[name[cache].get, parameter[name[key]]] begin[:] call[name[log].wa...
keyword[def] identifier[seen_nonce] ( identifier[id] , identifier[nonce] , identifier[timestamp] ): literal[string] identifier[key] = literal[string] . identifier[format] ( identifier[id] = identifier[id] , identifier[n] = identifier[nonce] , identifier[ts] = identifier[timestamp] ) keyword[if] ident...
def seen_nonce(id, nonce, timestamp): """ Returns True if the Hawk nonce has been seen already. """ key = '{id}:{n}:{ts}'.format(id=id, n=nonce, ts=timestamp) if cache.get(key): log.warning('replay attack? already processed nonce {k}'.format(k=key)) return True # depends on [control...
def p_expression_1(self, program): """ expression : '-' expression %prec negative | '+' expression %prec positive """ program[0] = node.Prefix([node.UnaryOperator(program[1]), program[2]])
def function[p_expression_1, parameter[self, program]]: constant[ expression : '-' expression %prec negative | '+' expression %prec positive ] call[name[program]][constant[0]] assign[=] call[name[node].Prefix, parameter[list[[<ast.Call object at 0x7da1b03a9ea0...
keyword[def] identifier[p_expression_1] ( identifier[self] , identifier[program] ): literal[string] identifier[program] [ literal[int] ]= identifier[node] . identifier[Prefix] ([ identifier[node] . identifier[UnaryOperator] ( identifier[program] [ literal[int] ]), identifier[program] [ literal[int]...
def p_expression_1(self, program): """ expression : '-' expression %prec negative | '+' expression %prec positive """ program[0] = node.Prefix([node.UnaryOperator(program[1]), program[2]])
def urlunsplit(data): """Combine the elements of a tuple as returned by urlsplit() into a complete URL as a string. The data argument can be any five-item iterable. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had unnecessary delimiters (for example,...
def function[urlunsplit, parameter[data]]: constant[Combine the elements of a tuple as returned by urlsplit() into a complete URL as a string. The data argument can be any five-item iterable. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had unnec...
keyword[def] identifier[urlunsplit] ( identifier[data] ): literal[string] identifier[scheme] , identifier[netloc] , identifier[url] , identifier[query] , identifier[fragment] = identifier[data] keyword[if] identifier[netloc] keyword[or] ( identifier[scheme] keyword[and] identifier[scheme] keywor...
def urlunsplit(data): """Combine the elements of a tuple as returned by urlsplit() into a complete URL as a string. The data argument can be any five-item iterable. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had unnecessary delimiters (for example,...
def make_path(config, *endings): """ Create a path based on component configuration. All paths are relative to the component's configuration directory; usually this will be the same for an entire session, but this function supuports component-specific configuration directories. Arguments: ...
def function[make_path, parameter[config]]: constant[ Create a path based on component configuration. All paths are relative to the component's configuration directory; usually this will be the same for an entire session, but this function supuports component-specific configuration directories....
keyword[def] identifier[make_path] ( identifier[config] ,* identifier[endings] ): literal[string] identifier[config_dir] = identifier[config] . identifier[get] ( literal[string] ) keyword[return] identifier[os] . identifier[path] . identifier[join] ( identifier[config_dir] ,* identifier[endings] )
def make_path(config, *endings): """ Create a path based on component configuration. All paths are relative to the component's configuration directory; usually this will be the same for an entire session, but this function supuports component-specific configuration directories. Arguments: ...
def parse_file(self, filename: str, entry: str=None) -> parsing.Node: """Parse filename using the grammar""" self.from_string = False import os.path with open(filename, 'r') as f: self.parsed_stream(f.read(), os.path.abspath(filename)) if entry is None: en...
def function[parse_file, parameter[self, filename, entry]]: constant[Parse filename using the grammar] name[self].from_string assign[=] constant[False] import module[os.path] with call[name[open], parameter[name[filename], constant[r]]] begin[:] call[name[self].parsed_stream,...
keyword[def] identifier[parse_file] ( identifier[self] , identifier[filename] : identifier[str] , identifier[entry] : identifier[str] = keyword[None] )-> identifier[parsing] . identifier[Node] : literal[string] identifier[self] . identifier[from_string] = keyword[False] keyword[import] i...
def parse_file(self, filename: str, entry: str=None) -> parsing.Node: """Parse filename using the grammar""" self.from_string = False import os.path with open(filename, 'r') as f: self.parsed_stream(f.read(), os.path.abspath(filename)) # depends on [control=['with'], data=['f']] if entry is...
def get_next_entry(file, entrymarker="\xFE\xFF\xFE\xFF\xFE\xFF\xFE\xFF\xFE\xFF", only_coord=True, blocksize=65535): '''Find or read the next ecc entry in a given ecc file. Call this function multiple times with the same file handle to get subsequent markers positions (this is not a generator but it works very s...
def function[get_next_entry, parameter[file, entrymarker, only_coord, blocksize]]: constant[Find or read the next ecc entry in a given ecc file. Call this function multiple times with the same file handle to get subsequent markers positions (this is not a generator but it works very similarly, because it wi...
keyword[def] identifier[get_next_entry] ( identifier[file] , identifier[entrymarker] = literal[string] , identifier[only_coord] = keyword[True] , identifier[blocksize] = literal[int] ): literal[string] identifier[found] = keyword[False] identifier[start] = keyword[None] identifier[end] = keywor...
def get_next_entry(file, entrymarker='þÿþÿþÿþÿþÿ', only_coord=True, blocksize=65535): """Find or read the next ecc entry in a given ecc file. Call this function multiple times with the same file handle to get subsequent markers positions (this is not a generator but it works very similarly, because it will cont...
def _compute_a22_factor(self, imt): """ Compute and return the a22 factor, equation 20, page 80. """ if imt.name == 'PGV': return 0.0 period = imt.period if period < 2.0: return 0.0 else: return 0.0625 * (period - 2.0)
def function[_compute_a22_factor, parameter[self, imt]]: constant[ Compute and return the a22 factor, equation 20, page 80. ] if compare[name[imt].name equal[==] constant[PGV]] begin[:] return[constant[0.0]] variable[period] assign[=] name[imt].period if compare[n...
keyword[def] identifier[_compute_a22_factor] ( identifier[self] , identifier[imt] ): literal[string] keyword[if] identifier[imt] . identifier[name] == literal[string] : keyword[return] literal[int] identifier[period] = identifier[imt] . identifier[period] keyword[...
def _compute_a22_factor(self, imt): """ Compute and return the a22 factor, equation 20, page 80. """ if imt.name == 'PGV': return 0.0 # depends on [control=['if'], data=[]] period = imt.period if period < 2.0: return 0.0 # depends on [control=['if'], data=[]] else: ...
def read_solrad(filename): """ Read NOAA SOLRAD [1]_ [2]_ fixed-width file into pandas dataframe. Parameters ---------- filename: str filepath or url to read for the fixed-width file. Returns ------- data: Dataframe A dataframe with DatetimeIndex and all of the variable...
def function[read_solrad, parameter[filename]]: constant[ Read NOAA SOLRAD [1]_ [2]_ fixed-width file into pandas dataframe. Parameters ---------- filename: str filepath or url to read for the fixed-width file. Returns ------- data: Dataframe A dataframe with Dateti...
keyword[def] identifier[read_solrad] ( identifier[filename] ): literal[string] keyword[if] literal[string] keyword[in] identifier[filename] : identifier[names] = identifier[MADISON_HEADERS] identifier[widths] = identifier[MADISON_WIDTHS] identifier[dtypes] = identifier[MADIS...
def read_solrad(filename): """ Read NOAA SOLRAD [1]_ [2]_ fixed-width file into pandas dataframe. Parameters ---------- filename: str filepath or url to read for the fixed-width file. Returns ------- data: Dataframe A dataframe with DatetimeIndex and all of the variable...
def draw(self): """ Draw guide Returns ------- out : matplotlib.offsetbox.Offsetbox A drawing of this legend """ obverse = slice(0, None) reverse = slice(None, None, -1) nbreak = len(self.key) themeable = self.theme.figure._the...
def function[draw, parameter[self]]: constant[ Draw guide Returns ------- out : matplotlib.offsetbox.Offsetbox A drawing of this legend ] variable[obverse] assign[=] call[name[slice], parameter[constant[0], constant[None]]] variable[reverse] a...
keyword[def] identifier[draw] ( identifier[self] ): literal[string] identifier[obverse] = identifier[slice] ( literal[int] , keyword[None] ) identifier[reverse] = identifier[slice] ( keyword[None] , keyword[None] ,- literal[int] ) identifier[nbreak] = identifier[len] ( identifier[...
def draw(self): """ Draw guide Returns ------- out : matplotlib.offsetbox.Offsetbox A drawing of this legend """ obverse = slice(0, None) reverse = slice(None, None, -1) nbreak = len(self.key) themeable = self.theme.figure._themeable # When th...
def tweets_files(string, path): """Iterates over json files in path.""" for filename in os.listdir(path): if re.match(string, filename) and ".jsonl" in filename: f = gzip.open if ".gz" in filename else open yield path + filename, f Ellipsis
def function[tweets_files, parameter[string, path]]: constant[Iterates over json files in path.] for taget[name[filename]] in starred[call[name[os].listdir, parameter[name[path]]]] begin[:] if <ast.BoolOp object at 0x7da20c6a9f90> begin[:] variable[f] assign[=] <a...
keyword[def] identifier[tweets_files] ( identifier[string] , identifier[path] ): literal[string] keyword[for] identifier[filename] keyword[in] identifier[os] . identifier[listdir] ( identifier[path] ): keyword[if] identifier[re] . identifier[match] ( identifier[string] , identifier[filename] )...
def tweets_files(string, path): """Iterates over json files in path.""" for filename in os.listdir(path): if re.match(string, filename) and '.jsonl' in filename: f = gzip.open if '.gz' in filename else open yield (path + filename, f) Ellipsis # depends on [control=['...
def predict(dataset, fitmodel_url, save_results=True, show=False): """ Function starts a job that makes predictions to input data with a given model. Parameters ---------- input - dataset object with input urls and other parameters fitmodel_url - model created in fit phase save_results - sa...
def function[predict, parameter[dataset, fitmodel_url, save_results, show]]: constant[ Function starts a job that makes predictions to input data with a given model. Parameters ---------- input - dataset object with input urls and other parameters fitmodel_url - model created in fit phase ...
keyword[def] identifier[predict] ( identifier[dataset] , identifier[fitmodel_url] , identifier[save_results] = keyword[True] , identifier[show] = keyword[False] ): literal[string] keyword[from] identifier[disco] . identifier[worker] . identifier[pipeline] . identifier[worker] keyword[import] identifier[...
def predict(dataset, fitmodel_url, save_results=True, show=False): """ Function starts a job that makes predictions to input data with a given model. Parameters ---------- input - dataset object with input urls and other parameters fitmodel_url - model created in fit phase save_results - sa...
def send_packet(self, pattern, packet_buffer, callback=None, limit=10): """ Send a buffer as a packet to a network interface and optionally capture a response :param pattern: a wildcard pattern to match the description of a network interface to capture packets on :param packet_buffer: a ...
def function[send_packet, parameter[self, pattern, packet_buffer, callback, limit]]: constant[ Send a buffer as a packet to a network interface and optionally capture a response :param pattern: a wildcard pattern to match the description of a network interface to capture packets on :para...
keyword[def] identifier[send_packet] ( identifier[self] , identifier[pattern] , identifier[packet_buffer] , identifier[callback] = keyword[None] , identifier[limit] = literal[int] ): literal[string] identifier[device_name] , identifier[desc] = identifier[WinPcapDevices] . identifier[get_matching_de...
def send_packet(self, pattern, packet_buffer, callback=None, limit=10): """ Send a buffer as a packet to a network interface and optionally capture a response :param pattern: a wildcard pattern to match the description of a network interface to capture packets on :param packet_buffer: a buff...
def get_message(self, dummy0, dummy1, use_cmd=False): """Get a getmore message.""" ns = _UJOIN % (self.db, self.coll) if use_cmd: ns = _UJOIN % (self.db, "$cmd") spec = self.as_command()[0] return query(0, ns, 0, -1, spec, None, self.codec_options) ...
def function[get_message, parameter[self, dummy0, dummy1, use_cmd]]: constant[Get a getmore message.] variable[ns] assign[=] binary_operation[name[_UJOIN] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Attribute object at 0x7da20c7c8910>, <ast.Attribute object at 0x7da20c7cb820>]]] if name[use_c...
keyword[def] identifier[get_message] ( identifier[self] , identifier[dummy0] , identifier[dummy1] , identifier[use_cmd] = keyword[False] ): literal[string] identifier[ns] = identifier[_UJOIN] %( identifier[self] . identifier[db] , identifier[self] . identifier[coll] ) keyword[if] identi...
def get_message(self, dummy0, dummy1, use_cmd=False): """Get a getmore message.""" ns = _UJOIN % (self.db, self.coll) if use_cmd: ns = _UJOIN % (self.db, '$cmd') spec = self.as_command()[0] return query(0, ns, 0, -1, spec, None, self.codec_options) # depends on [control=['if'], data...
def _send(self): """ Send all queued messages to the server. """ data = self.output_buffer.view() if not data: return if self.closed(): raise self.Error("Failed to write to closed connection {!r}".format(self.server.address)) if self.defunct(): ...
def function[_send, parameter[self]]: constant[ Send all queued messages to the server. ] variable[data] assign[=] call[name[self].output_buffer.view, parameter[]] if <ast.UnaryOp object at 0x7da207f02fb0> begin[:] return[None] if call[name[self].closed, parameter[]] begi...
keyword[def] identifier[_send] ( identifier[self] ): literal[string] identifier[data] = identifier[self] . identifier[output_buffer] . identifier[view] () keyword[if] keyword[not] identifier[data] : keyword[return] keyword[if] identifier[self] . identifier[closed]...
def _send(self): """ Send all queued messages to the server. """ data = self.output_buffer.view() if not data: return # depends on [control=['if'], data=[]] if self.closed(): raise self.Error('Failed to write to closed connection {!r}'.format(self.server.address)) # depends on ...
def parametrize(self, operator, params): """ Return a parser that parses an operator with parameters. """ return (CaselessKeyword(operator, identChars=alphanums) + self.parameter(params))
def function[parametrize, parameter[self, operator, params]]: constant[ Return a parser that parses an operator with parameters. ] return[binary_operation[call[name[CaselessKeyword], parameter[name[operator]]] + call[name[self].parameter, parameter[name[params]]]]]
keyword[def] identifier[parametrize] ( identifier[self] , identifier[operator] , identifier[params] ): literal[string] keyword[return] ( identifier[CaselessKeyword] ( identifier[operator] , identifier[identChars] = identifier[alphanums] )+ identifier[self] . identifier[parameter] ( identif...
def parametrize(self, operator, params): """ Return a parser that parses an operator with parameters. """ return CaselessKeyword(operator, identChars=alphanums) + self.parameter(params)
def _add_details(self, info): """ The 'id' attribute is not supplied directly, but included as part of the 'href' value. Also, convert the dicts for messages into QueueMessage objects. """ msg_dicts = info.pop("messages", []) super(QueueClaim, self)._add_details(i...
def function[_add_details, parameter[self, info]]: constant[ The 'id' attribute is not supplied directly, but included as part of the 'href' value. Also, convert the dicts for messages into QueueMessage objects. ] variable[msg_dicts] assign[=] call[name[info].pop, paramet...
keyword[def] identifier[_add_details] ( identifier[self] , identifier[info] ): literal[string] identifier[msg_dicts] = identifier[info] . identifier[pop] ( literal[string] ,[]) identifier[super] ( identifier[QueueClaim] , identifier[self] ). identifier[_add_details] ( identifier[info] ) ...
def _add_details(self, info): """ The 'id' attribute is not supplied directly, but included as part of the 'href' value. Also, convert the dicts for messages into QueueMessage objects. """ msg_dicts = info.pop('messages', []) super(QueueClaim, self)._add_details(info) par...
def stripe_to_db(self, data): """Convert the raw timestamp value to a DateTime representation.""" val = data.get(self.name) # Note: 0 is a possible return value, which is 'falseish' if val is not None: return convert_tstamp(val)
def function[stripe_to_db, parameter[self, data]]: constant[Convert the raw timestamp value to a DateTime representation.] variable[val] assign[=] call[name[data].get, parameter[name[self].name]] if compare[name[val] is_not constant[None]] begin[:] return[call[name[convert_tstamp], param...
keyword[def] identifier[stripe_to_db] ( identifier[self] , identifier[data] ): literal[string] identifier[val] = identifier[data] . identifier[get] ( identifier[self] . identifier[name] ) keyword[if] identifier[val] keyword[is] keyword[not] keyword[None] : keyword[return] identifier[convert_tst...
def stripe_to_db(self, data): """Convert the raw timestamp value to a DateTime representation.""" val = data.get(self.name) # Note: 0 is a possible return value, which is 'falseish' if val is not None: return convert_tstamp(val) # depends on [control=['if'], data=['val']]
def x509_name(name): """Parses a subject into a :py:class:`x509.Name <cg:cryptography.x509.Name>`. If ``name`` is a string, :py:func:`parse_name` is used to parse it. >>> x509_name('/C=AT/CN=example.com') <Name(C=AT,CN=example.com)> >>> x509_name([('C', 'AT'), ('CN', 'example.com')]) <Name(C=A...
def function[x509_name, parameter[name]]: constant[Parses a subject into a :py:class:`x509.Name <cg:cryptography.x509.Name>`. If ``name`` is a string, :py:func:`parse_name` is used to parse it. >>> x509_name('/C=AT/CN=example.com') <Name(C=AT,CN=example.com)> >>> x509_name([('C', 'AT'), ('CN',...
keyword[def] identifier[x509_name] ( identifier[name] ): literal[string] keyword[if] identifier[isinstance] ( identifier[name] , identifier[six] . identifier[string_types] ): identifier[name] = identifier[parse_name] ( identifier[name] ) keyword[return] identifier[x509] . identifier[Name] ...
def x509_name(name): """Parses a subject into a :py:class:`x509.Name <cg:cryptography.x509.Name>`. If ``name`` is a string, :py:func:`parse_name` is used to parse it. >>> x509_name('/C=AT/CN=example.com') <Name(C=AT,CN=example.com)> >>> x509_name([('C', 'AT'), ('CN', 'example.com')]) <Name(C=A...
def set_dict_options(self, options): """for dictionary-like inputs (as object in Javascript) options must be in python dictionary format """ if isinstance(options, dict): for key, option_data in options.items(): self.set_options(key, option_data) else:...
def function[set_dict_options, parameter[self, options]]: constant[for dictionary-like inputs (as object in Javascript) options must be in python dictionary format ] if call[name[isinstance], parameter[name[options], name[dict]]] begin[:] for taget[tuple[[<ast.Name object...
keyword[def] identifier[set_dict_options] ( identifier[self] , identifier[options] ): literal[string] keyword[if] identifier[isinstance] ( identifier[options] , identifier[dict] ): keyword[for] identifier[key] , identifier[option_data] keyword[in] identifier[options] . identifier[i...
def set_dict_options(self, options): """for dictionary-like inputs (as object in Javascript) options must be in python dictionary format """ if isinstance(options, dict): for (key, option_data) in options.items(): self.set_options(key, option_data) # depends on [control=['fo...
def add_measurement(request, experiment_id): """This is a view to display a form to add single measurements to an experiment. It calls the object MeasurementForm, which has an autocomplete field for animal.""" experiment = get_object_or_404(Experiment, pk=experiment_id) if request.method == 'POST': form = Measu...
def function[add_measurement, parameter[request, experiment_id]]: constant[This is a view to display a form to add single measurements to an experiment. It calls the object MeasurementForm, which has an autocomplete field for animal.] variable[experiment] assign[=] call[name[get_object_or_404], param...
keyword[def] identifier[add_measurement] ( identifier[request] , identifier[experiment_id] ): literal[string] identifier[experiment] = identifier[get_object_or_404] ( identifier[Experiment] , identifier[pk] = identifier[experiment_id] ) keyword[if] identifier[request] . identifier[method] == literal[string] :...
def add_measurement(request, experiment_id): """This is a view to display a form to add single measurements to an experiment. It calls the object MeasurementForm, which has an autocomplete field for animal.""" experiment = get_object_or_404(Experiment, pk=experiment_id) if request.method == 'POST': ...
def projection(radius=5e-6, sphere_index=1.339, medium_index=1.333, wavelength=550e-9, pixel_size=1e-7, grid_size=(80, 80), center=(39.5, 39.5)): """Optical path difference projection of a dielectric sphere Parameters ---------- radius: float Radius of the sphere [...
def function[projection, parameter[radius, sphere_index, medium_index, wavelength, pixel_size, grid_size, center]]: constant[Optical path difference projection of a dielectric sphere Parameters ---------- radius: float Radius of the sphere [m] sphere_index: float Refractive inde...
keyword[def] identifier[projection] ( identifier[radius] = literal[int] , identifier[sphere_index] = literal[int] , identifier[medium_index] = literal[int] , identifier[wavelength] = literal[int] , identifier[pixel_size] = literal[int] , identifier[grid_size] =( literal[int] , literal[int] ), identifier[center] =( ...
def projection(radius=5e-06, sphere_index=1.339, medium_index=1.333, wavelength=5.5e-07, pixel_size=1e-07, grid_size=(80, 80), center=(39.5, 39.5)): """Optical path difference projection of a dielectric sphere Parameters ---------- radius: float Radius of the sphere [m] sphere_index: float ...
def chung_dense(T, MW, Tc, Vc, omega, Cvm, Vm, mu, dipole, association=0): r'''Estimates the thermal conductivity of a gas at high pressure as a function of temperature using the reference fluid method of Chung [1]_ as shown in [2]_. .. math:: \lambda = \frac{31.2 \eta^\circ \Psi}{M'}(G_2^{-1} ...
def function[chung_dense, parameter[T, MW, Tc, Vc, omega, Cvm, Vm, mu, dipole, association]]: constant[Estimates the thermal conductivity of a gas at high pressure as a function of temperature using the reference fluid method of Chung [1]_ as shown in [2]_. .. math:: \lambda = \frac{31.2 \e...
keyword[def] identifier[chung_dense] ( identifier[T] , identifier[MW] , identifier[Tc] , identifier[Vc] , identifier[omega] , identifier[Cvm] , identifier[Vm] , identifier[mu] , identifier[dipole] , identifier[association] = literal[int] ): literal[string] identifier[ais] =[ literal[int] ,- literal[int] , ...
def chung_dense(T, MW, Tc, Vc, omega, Cvm, Vm, mu, dipole, association=0): """Estimates the thermal conductivity of a gas at high pressure as a function of temperature using the reference fluid method of Chung [1]_ as shown in [2]_. .. math:: \\lambda = \\frac{31.2 \\eta^\\circ \\Psi}{M'}(G_2^{...
def days_and_sids_for_frames(frames): """ Returns the date index and sid columns shared by a list of dataframes, ensuring they all match. Parameters ---------- frames : list[pd.DataFrame] A list of dataframes indexed by day, with a column per sid. Returns ------- days : np....
def function[days_and_sids_for_frames, parameter[frames]]: constant[ Returns the date index and sid columns shared by a list of dataframes, ensuring they all match. Parameters ---------- frames : list[pd.DataFrame] A list of dataframes indexed by day, with a column per sid. Ret...
keyword[def] identifier[days_and_sids_for_frames] ( identifier[frames] ): literal[string] keyword[if] keyword[not] identifier[frames] : identifier[days] = identifier[np] . identifier[array] ([], identifier[dtype] = literal[string] ) identifier[sids] = identifier[np] . identifier[array] ...
def days_and_sids_for_frames(frames): """ Returns the date index and sid columns shared by a list of dataframes, ensuring they all match. Parameters ---------- frames : list[pd.DataFrame] A list of dataframes indexed by day, with a column per sid. Returns ------- days : np....
def _extract_pynn_components_to_neuroml(nl_model, nml_doc=None): """ Parse the NeuroMLlite description for cell, synapses and inputs described as PyNN elements (e.g. IF_cond_alpha, DCSource) and parameters, and convert these to the equivalent elements in a NeuroMLDocument """ if nml_doc =...
def function[_extract_pynn_components_to_neuroml, parameter[nl_model, nml_doc]]: constant[ Parse the NeuroMLlite description for cell, synapses and inputs described as PyNN elements (e.g. IF_cond_alpha, DCSource) and parameters, and convert these to the equivalent elements in a NeuroMLDocument ...
keyword[def] identifier[_extract_pynn_components_to_neuroml] ( identifier[nl_model] , identifier[nml_doc] = keyword[None] ): literal[string] keyword[if] identifier[nml_doc] == keyword[None] : keyword[from] identifier[neuroml] keyword[import] identifier[NeuroMLDocument] identifier[nm...
def _extract_pynn_components_to_neuroml(nl_model, nml_doc=None): """ Parse the NeuroMLlite description for cell, synapses and inputs described as PyNN elements (e.g. IF_cond_alpha, DCSource) and parameters, and convert these to the equivalent elements in a NeuroMLDocument """ if nml_doc == Non...
def calc_arguments(args): ''' calc_arguments is a calculator that parses the command-line arguments for the registration command and produces the subject, the model, the log function, and the additional options. ''' (args, opts) = _retinotopy_parser(args) # We do some of the options right here.....
def function[calc_arguments, parameter[args]]: constant[ calc_arguments is a calculator that parses the command-line arguments for the registration command and produces the subject, the model, the log function, and the additional options. ] <ast.Tuple object at 0x7da1b0ebf4c0> assign[=] call...
keyword[def] identifier[calc_arguments] ( identifier[args] ): literal[string] ( identifier[args] , identifier[opts] )= identifier[_retinotopy_parser] ( identifier[args] ) keyword[if] identifier[opts] [ literal[string] ]: identifier[print] ( identifier[info] , identifier[file] = identifie...
def calc_arguments(args): """ calc_arguments is a calculator that parses the command-line arguments for the registration command and produces the subject, the model, the log function, and the additional options. """ (args, opts) = _retinotopy_parser(args) # We do some of the options right here.....
def discover_connectors( domain: str, loop=None, logger=logger): """ Discover all connection options for a domain, in descending order of preference. This coroutine returns options discovered from SRV records, or if none are found, the generic option using the domain name an...
def function[discover_connectors, parameter[domain, loop, logger]]: constant[ Discover all connection options for a domain, in descending order of preference. This coroutine returns options discovered from SRV records, or if none are found, the generic option using the domain name and the defau...
keyword[def] identifier[discover_connectors] ( identifier[domain] : identifier[str] , identifier[loop] = keyword[None] , identifier[logger] = identifier[logger] ): literal[string] identifier[domain_encoded] = identifier[domain] . identifier[encode] ( literal[string] )+ literal[string] identifier[...
def discover_connectors(domain: str, loop=None, logger=logger): """ Discover all connection options for a domain, in descending order of preference. This coroutine returns options discovered from SRV records, or if none are found, the generic option using the domain name and the default XMPP client...
def LogGamma(input_vertex: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Returns the log of the gamma of the inputVertex :param input_vertex: the vertex """ return Double(context.jvm_view().LogGammaVertex, label, cast_to_double_vertex(input_vertex))
def function[LogGamma, parameter[input_vertex, label]]: constant[ Returns the log of the gamma of the inputVertex :param input_vertex: the vertex ] return[call[name[Double], parameter[call[name[context].jvm_view, parameter[]].LogGammaVertex, name[label], call[name[cast_to_double_vertex], pa...
keyword[def] identifier[LogGamma] ( identifier[input_vertex] : identifier[vertex_constructor_param_types] , identifier[label] : identifier[Optional] [ identifier[str] ]= keyword[None] )-> identifier[Vertex] : literal[string] keyword[return] identifier[Double] ( identifier[context] . identifier[jvm_view] (...
def LogGamma(input_vertex: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Returns the log of the gamma of the inputVertex :param input_vertex: the vertex """ return Double(context.jvm_view().LogGammaVertex, label, cast_to_double_vertex(input_vertex))
def has_true(self, e, extra_constraints=(), solver=None, model_callback=None): #pylint:disable=unused-argument """ Should return True if `e` can possible be True. :param e: The AST. :param extra_constraints: Extra constraints (as ASTs) to add to the solver for this s...
def function[has_true, parameter[self, e, extra_constraints, solver, model_callback]]: constant[ Should return True if `e` can possible be True. :param e: The AST. :param extra_constraints: Extra constraints (as ASTs) to add to the solver for this solve. :par...
keyword[def] identifier[has_true] ( identifier[self] , identifier[e] , identifier[extra_constraints] =(), identifier[solver] = keyword[None] , identifier[model_callback] = keyword[None] ): literal[string] keyword[return] identifier[self] . identifier[_has_true] ( identifier[sel...
def has_true(self, e, extra_constraints=(), solver=None, model_callback=None): #pylint:disable=unused-argument '\n Should return True if `e` can possible be True.\n\n :param e: The AST.\n :param extra_constraints: Extra constraints (as ASTs) to add to the solver for this so...
def compute_transformed(context): """Compute transformed key for opening database""" if context._._.transformed_key is not None: transformed_key = context._._transformed_key else: transformed_key = aes_kdf( context._.header.value.dynamic_header.transform_seed.data, c...
def function[compute_transformed, parameter[context]]: constant[Compute transformed key for opening database] if compare[name[context]._._.transformed_key is_not constant[None]] begin[:] variable[transformed_key] assign[=] name[context]._._transformed_key return[name[transformed_key]...
keyword[def] identifier[compute_transformed] ( identifier[context] ): literal[string] keyword[if] identifier[context] . identifier[_] . identifier[_] . identifier[transformed_key] keyword[is] keyword[not] keyword[None] : identifier[transformed_key] = identifier[context] . identifier[_] . iden...
def compute_transformed(context): """Compute transformed key for opening database""" if context._._.transformed_key is not None: transformed_key = context._._transformed_key # depends on [control=['if'], data=[]] else: transformed_key = aes_kdf(context._.header.value.dynamic_header.transfor...
def get_app(self, reference_app=None): """Helper method that implements the logic to look up an application.""" if reference_app is not None: return reference_app if self.app is not None: return self.app ctx = stack.top if ctx is not None: ...
def function[get_app, parameter[self, reference_app]]: constant[Helper method that implements the logic to look up an application.] if compare[name[reference_app] is_not constant[None]] begin[:] return[name[reference_app]] if compare[name[self].app is_not constant[None]] begin[:] ...
keyword[def] identifier[get_app] ( identifier[self] , identifier[reference_app] = keyword[None] ): literal[string] keyword[if] identifier[reference_app] keyword[is] keyword[not] keyword[None] : keyword[return] identifier[reference_app] keyword[if] identifier[self] . i...
def get_app(self, reference_app=None): """Helper method that implements the logic to look up an application.""" if reference_app is not None: return reference_app # depends on [control=['if'], data=['reference_app']] if self.app is not None: return self.app # depends on [control=['if'], da...
def schedule(self): """Initiate distribution of the test collection. Initiate scheduling of the items across the nodes. If this gets called again later it behaves the same as calling ``._reschedule()`` on all nodes so that newly added nodes will start to be used. If ``.collect...
def function[schedule, parameter[self]]: constant[Initiate distribution of the test collection. Initiate scheduling of the items across the nodes. If this gets called again later it behaves the same as calling ``._reschedule()`` on all nodes so that newly added nodes will start to be u...
keyword[def] identifier[schedule] ( identifier[self] ): literal[string] keyword[assert] identifier[self] . identifier[collection_is_completed] keyword[if] identifier[self] . identifier[collection] keyword[is] keyword[not] keyword[None] : keyword[for] identifie...
def schedule(self): """Initiate distribution of the test collection. Initiate scheduling of the items across the nodes. If this gets called again later it behaves the same as calling ``._reschedule()`` on all nodes so that newly added nodes will start to be used. If ``.collection_...
def p_recipe(self, t): """recipe : RECIPE_LINE | RECIPE_LINE recipe""" if len(t) == 3: t[0] = t[1] + t[2] else: t[0] = t[1]
def function[p_recipe, parameter[self, t]]: constant[recipe : RECIPE_LINE | RECIPE_LINE recipe] if compare[call[name[len], parameter[name[t]]] equal[==] constant[3]] begin[:] call[name[t]][constant[0]] assign[=] binary_operation[call[name[t]][constant[1]] + call[name[t]...
keyword[def] identifier[p_recipe] ( identifier[self] , identifier[t] ): literal[string] keyword[if] identifier[len] ( identifier[t] )== literal[int] : identifier[t] [ literal[int] ]= identifier[t] [ literal[int] ]+ identifier[t] [ literal[int] ] keyword[else] : i...
def p_recipe(self, t): """recipe : RECIPE_LINE | RECIPE_LINE recipe""" if len(t) == 3: t[0] = t[1] + t[2] # depends on [control=['if'], data=[]] else: t[0] = t[1]
def moment(self, axis, channel=0, moment=1, *, resultant=None): """Take the nth moment the dataset along one axis, adding lower rank channels. New channels have names ``<channel name>_<axis name>_moment_<moment num>``. Moment 0 is the integral of the slice. Moment 1 is the weighted ave...
def function[moment, parameter[self, axis, channel, moment]]: constant[Take the nth moment the dataset along one axis, adding lower rank channels. New channels have names ``<channel name>_<axis name>_moment_<moment num>``. Moment 0 is the integral of the slice. Moment 1 is the weighted...
keyword[def] identifier[moment] ( identifier[self] , identifier[axis] , identifier[channel] = literal[int] , identifier[moment] = literal[int] ,*, identifier[resultant] = keyword[None] ): literal[string] identifier[axis_index] = keyword[None] keyword[if] identifier[resultant] k...
def moment(self, axis, channel=0, moment=1, *, resultant=None): """Take the nth moment the dataset along one axis, adding lower rank channels. New channels have names ``<channel name>_<axis name>_moment_<moment num>``. Moment 0 is the integral of the slice. Moment 1 is the weighted average...
def _handle_posix(self, i, result, end_range): """Handle posix classes.""" last_posix = False m = i.match(RE_POSIX) if m: last_posix = True # Cannot do range with posix class # so escape last `-` if we think this # is the end of a range. ...
def function[_handle_posix, parameter[self, i, result, end_range]]: constant[Handle posix classes.] variable[last_posix] assign[=] constant[False] variable[m] assign[=] call[name[i].match, parameter[name[RE_POSIX]]] if name[m] begin[:] variable[last_posix] assign[=] const...
keyword[def] identifier[_handle_posix] ( identifier[self] , identifier[i] , identifier[result] , identifier[end_range] ): literal[string] identifier[last_posix] = keyword[False] identifier[m] = identifier[i] . identifier[match] ( identifier[RE_POSIX] ) keyword[if] identifier[m]...
def _handle_posix(self, i, result, end_range): """Handle posix classes.""" last_posix = False m = i.match(RE_POSIX) if m: last_posix = True # Cannot do range with posix class # so escape last `-` if we think this # is the end of a range. if end_range and i.index -...
def require_component_access(view_func, component): """Perform component can_access check to access the view. :param component containing the view (panel or dashboard). Raises a :exc:`~horizon.exceptions.NotAuthorized` exception if the user cannot access the component containing the view. By examp...
def function[require_component_access, parameter[view_func, component]]: constant[Perform component can_access check to access the view. :param component containing the view (panel or dashboard). Raises a :exc:`~horizon.exceptions.NotAuthorized` exception if the user cannot access the component co...
keyword[def] identifier[require_component_access] ( identifier[view_func] , identifier[component] ): literal[string] keyword[from] identifier[horizon] . identifier[exceptions] keyword[import] identifier[NotAuthorized] @ identifier[functools] . identifier[wraps] ( identifier[view_func] , identifier...
def require_component_access(view_func, component): """Perform component can_access check to access the view. :param component containing the view (panel or dashboard). Raises a :exc:`~horizon.exceptions.NotAuthorized` exception if the user cannot access the component containing the view. By examp...
def show_details(item_data: Dict[Any, Any]) -> str: """Format catalog item output Parameters: item_data: item's attributes values Returns: [rich_message]: list of formatted rich message """ txt = "" for key, value in item_data.items(): txt += "**" + str(key) + "**" + ...
def function[show_details, parameter[item_data]]: constant[Format catalog item output Parameters: item_data: item's attributes values Returns: [rich_message]: list of formatted rich message ] variable[txt] assign[=] constant[] for taget[tuple[[<ast.Name object at 0x...
keyword[def] identifier[show_details] ( identifier[item_data] : identifier[Dict] [ identifier[Any] , identifier[Any] ])-> identifier[str] : literal[string] identifier[txt] = literal[string] keyword[for] identifier[key] , identifier[value] keyword[in] identifier[item_data] . identifier[items] ():...
def show_details(item_data: Dict[Any, Any]) -> str: """Format catalog item output Parameters: item_data: item's attributes values Returns: [rich_message]: list of formatted rich message """ txt = '' for (key, value) in item_data.items(): txt += '**' + str(key) + '**' + ...
def jsonresolver_loader(url_map): """Resolve the OpenAIRE grant.""" from flask import current_app url_map.add(Rule( '/grants/10.13039/<path:doi_grant_code>', endpoint=resolve_grant_endpoint, host=current_app.config['OPENAIRE_JSONRESOLVER_GRANTS_HOST']))
def function[jsonresolver_loader, parameter[url_map]]: constant[Resolve the OpenAIRE grant.] from relative_module[flask] import module[current_app] call[name[url_map].add, parameter[call[name[Rule], parameter[constant[/grants/10.13039/<path:doi_grant_code>]]]]]
keyword[def] identifier[jsonresolver_loader] ( identifier[url_map] ): literal[string] keyword[from] identifier[flask] keyword[import] identifier[current_app] identifier[url_map] . identifier[add] ( identifier[Rule] ( literal[string] , identifier[endpoint] = identifier[resolve_grant_endpo...
def jsonresolver_loader(url_map): """Resolve the OpenAIRE grant.""" from flask import current_app url_map.add(Rule('/grants/10.13039/<path:doi_grant_code>', endpoint=resolve_grant_endpoint, host=current_app.config['OPENAIRE_JSONRESOLVER_GRANTS_HOST']))
def tryload_cache_list(dpath, fname, cfgstr_list, verbose=False): """ loads a list of similar cached datas. Returns flags that needs to be computed """ data_list = [tryload_cache(dpath, fname, cfgstr, verbose) for cfgstr in cfgstr_list] ismiss_list = [data is None for data in data_list] return d...
def function[tryload_cache_list, parameter[dpath, fname, cfgstr_list, verbose]]: constant[ loads a list of similar cached datas. Returns flags that needs to be computed ] variable[data_list] assign[=] <ast.ListComp object at 0x7da1b24e5060> variable[ismiss_list] assign[=] <ast.ListComp o...
keyword[def] identifier[tryload_cache_list] ( identifier[dpath] , identifier[fname] , identifier[cfgstr_list] , identifier[verbose] = keyword[False] ): literal[string] identifier[data_list] =[ identifier[tryload_cache] ( identifier[dpath] , identifier[fname] , identifier[cfgstr] , identifier[verbose] ) key...
def tryload_cache_list(dpath, fname, cfgstr_list, verbose=False): """ loads a list of similar cached datas. Returns flags that needs to be computed """ data_list = [tryload_cache(dpath, fname, cfgstr, verbose) for cfgstr in cfgstr_list] ismiss_list = [data is None for data in data_list] return (...
def set_interval(self, interval): """Set the polling interval for the process thread. :param interval: How often to poll the Hottop :type interval: int or float :returns: None :raises: InvalidInput """ if type(interval) != float or type(interval) != int: ...
def function[set_interval, parameter[self, interval]]: constant[Set the polling interval for the process thread. :param interval: How often to poll the Hottop :type interval: int or float :returns: None :raises: InvalidInput ] if <ast.BoolOp object at 0x7da204565...
keyword[def] identifier[set_interval] ( identifier[self] , identifier[interval] ): literal[string] keyword[if] identifier[type] ( identifier[interval] )!= identifier[float] keyword[or] identifier[type] ( identifier[interval] )!= identifier[int] : keyword[raise] identifier[InvalidIn...
def set_interval(self, interval): """Set the polling interval for the process thread. :param interval: How often to poll the Hottop :type interval: int or float :returns: None :raises: InvalidInput """ if type(interval) != float or type(interval) != int: raise In...
def fetch(self, **kwargs) -> 'FetchContextManager': ''' Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.bac...
def function[fetch, parameter[self]]: constant[ Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.backend.cli...
keyword[def] identifier[fetch] ( identifier[self] ,** identifier[kwargs] )-> literal[string] : literal[string] keyword[assert] identifier[self] . identifier[method] keyword[in] identifier[self] . identifier[_allowed_methods] , literal[string] . identifier[format] ( identifier[self] . identifier[...
def fetch(self, **kwargs) -> 'FetchContextManager': """ Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.backend...
def dpar(self, cl=1): """Return dpar-style executable assignment for parameter Default is to write CL version of code; if cl parameter is false, writes Python executable code instead. Note that dpar doesn't even work for arrays in the CL, so we just use Python syntax here. ...
def function[dpar, parameter[self, cl]]: constant[Return dpar-style executable assignment for parameter Default is to write CL version of code; if cl parameter is false, writes Python executable code instead. Note that dpar doesn't even work for arrays in the CL, so we just use ...
keyword[def] identifier[dpar] ( identifier[self] , identifier[cl] = literal[int] ): literal[string] identifier[sval] = identifier[list] ( identifier[map] ( identifier[self] . identifier[toString] , identifier[self] . identifier[value] , identifier[len] ( identifier[self] . identifier[value] )*[ lit...
def dpar(self, cl=1): """Return dpar-style executable assignment for parameter Default is to write CL version of code; if cl parameter is false, writes Python executable code instead. Note that dpar doesn't even work for arrays in the CL, so we just use Python syntax here. ...
def table(self, data, header=None): """Example:: +----------+------------+ | CityName | Population | +----------+------------+ | Adelaide | 1158259 | +----------+------------+ | Darwin | 120900 | +----------+----------...
def function[table, parameter[self, data, header]]: constant[Example:: +----------+------------+ | CityName | Population | +----------+------------+ | Adelaide | 1158259 | +----------+------------+ | Darwin | 120900 | ...
keyword[def] identifier[table] ( identifier[self] , identifier[data] , identifier[header] = keyword[None] ): literal[string] keyword[if] identifier[header] : identifier[x] = identifier[PrettyTable] ( identifier[header] ) keyword[else] : identifier[x] = identifier...
def table(self, data, header=None): """Example:: +----------+------------+ | CityName | Population | +----------+------------+ | Adelaide | 1158259 | +----------+------------+ | Darwin | 120900 | +----------+------------+ ...
def parse(self, data): """ Converts a CNML structure to a NetworkX Graph object which is then returned. """ graph = self._init_graph() # loop over links and create networkx graph # Add only working nodes with working links for link in data.get_inner_links(...
def function[parse, parameter[self, data]]: constant[ Converts a CNML structure to a NetworkX Graph object which is then returned. ] variable[graph] assign[=] call[name[self]._init_graph, parameter[]] for taget[name[link]] in starred[call[name[data].get_inner_links, param...
keyword[def] identifier[parse] ( identifier[self] , identifier[data] ): literal[string] identifier[graph] = identifier[self] . identifier[_init_graph] () keyword[for] identifier[link] keyword[in] identifier[data] . identifier[get_inner_links] (): keyword[i...
def parse(self, data): """ Converts a CNML structure to a NetworkX Graph object which is then returned. """ graph = self._init_graph() # loop over links and create networkx graph # Add only working nodes with working links for link in data.get_inner_links(): if link.s...
def delete_event(self, calendar_id, event_id): """Delete an event from the specified calendar. :param string calendar_id: ID of calendar to delete from. :param string event_id: ID of event to delete. """ self.request_handler.delete(endpoint='calendars/%s/events' % calendar_id, d...
def function[delete_event, parameter[self, calendar_id, event_id]]: constant[Delete an event from the specified calendar. :param string calendar_id: ID of calendar to delete from. :param string event_id: ID of event to delete. ] call[name[self].request_handler.delete, parameter[...
keyword[def] identifier[delete_event] ( identifier[self] , identifier[calendar_id] , identifier[event_id] ): literal[string] identifier[self] . identifier[request_handler] . identifier[delete] ( identifier[endpoint] = literal[string] % identifier[calendar_id] , identifier[data] ={ literal[string] :...
def delete_event(self, calendar_id, event_id): """Delete an event from the specified calendar. :param string calendar_id: ID of calendar to delete from. :param string event_id: ID of event to delete. """ self.request_handler.delete(endpoint='calendars/%s/events' % calendar_id, data={'ev...
def equilibrium_transition_matrix(Xi, omega, sigma, reversible=True, return_lcc=True): """ Compute equilibrium transition matrix from OOM components: Parameters ---------- Xi : ndarray(M, N, M) matrix of set-observable operators omega: ndarray(M,) information state vector of OOM...
def function[equilibrium_transition_matrix, parameter[Xi, omega, sigma, reversible, return_lcc]]: constant[ Compute equilibrium transition matrix from OOM components: Parameters ---------- Xi : ndarray(M, N, M) matrix of set-observable operators omega: ndarray(M,) informatio...
keyword[def] identifier[equilibrium_transition_matrix] ( identifier[Xi] , identifier[omega] , identifier[sigma] , identifier[reversible] = keyword[True] , identifier[return_lcc] = keyword[True] ): literal[string] keyword[import] identifier[msmtools] . identifier[estimation] keyword[as] identifier[me] ...
def equilibrium_transition_matrix(Xi, omega, sigma, reversible=True, return_lcc=True): """ Compute equilibrium transition matrix from OOM components: Parameters ---------- Xi : ndarray(M, N, M) matrix of set-observable operators omega: ndarray(M,) information state vector of OOM...
def shift_image(im, shift, borderValue=0): """shift the image Parameters ---------- im: 2d array The image shift: 2 numbers (y,x) the shift in y and x direction borderValue: number, default 0 The value for the pixels outside the border (default 0) Returns ------...
def function[shift_image, parameter[im, shift, borderValue]]: constant[shift the image Parameters ---------- im: 2d array The image shift: 2 numbers (y,x) the shift in y and x direction borderValue: number, default 0 The value for the pixels outside the border (defau...
keyword[def] identifier[shift_image] ( identifier[im] , identifier[shift] , identifier[borderValue] = literal[int] ): literal[string] identifier[im] = identifier[np] . identifier[asarray] ( identifier[im] , identifier[dtype] = identifier[np] . identifier[float32] ) identifier[rows] , identifier[cols] ...
def shift_image(im, shift, borderValue=0): """shift the image Parameters ---------- im: 2d array The image shift: 2 numbers (y,x) the shift in y and x direction borderValue: number, default 0 The value for the pixels outside the border (default 0) Returns ------...
def customchain(**kwargsChain): """ This decorator allows you to access ``ctx.peerplays`` which is an instance of Peerplays. But in contrast to @chain, this is a decorator that expects parameters that are directed right to ``PeerPlays()``. ... code-block::python @ma...
def function[customchain, parameter[]]: constant[ This decorator allows you to access ``ctx.peerplays`` which is an instance of Peerplays. But in contrast to @chain, this is a decorator that expects parameters that are directed right to ``PeerPlays()``. ... code-block::python ...
keyword[def] identifier[customchain] (** identifier[kwargsChain] ): literal[string] keyword[def] identifier[wrap] ( identifier[f] ): @ identifier[click] . identifier[pass_context] @ identifier[verbose] keyword[def] identifier[new_func] ( identifier[ctx] ,* identifier[args] ,**...
def customchain(**kwargsChain): """ This decorator allows you to access ``ctx.peerplays`` which is an instance of Peerplays. But in contrast to @chain, this is a decorator that expects parameters that are directed right to ``PeerPlays()``. ... code-block::python @ma...
def writeCleanup(self, varBind, **context): """Finalize Managed Object Instance modification. Implements the successful third step of the multi-step workflow of the SNMP SET command processing (:RFC:`1905#section-4.2.5`). The goal of the third (successful) phase is to seal the new stat...
def function[writeCleanup, parameter[self, varBind]]: constant[Finalize Managed Object Instance modification. Implements the successful third step of the multi-step workflow of the SNMP SET command processing (:RFC:`1905#section-4.2.5`). The goal of the third (successful) phase is to s...
keyword[def] identifier[writeCleanup] ( identifier[self] , identifier[varBind] ,** identifier[context] ): literal[string] identifier[name] , identifier[val] = identifier[varBind] ( identifier[debug] . identifier[logger] & identifier[debug] . identifier[FLAG_INS] keyword[and] id...
def writeCleanup(self, varBind, **context): """Finalize Managed Object Instance modification. Implements the successful third step of the multi-step workflow of the SNMP SET command processing (:RFC:`1905#section-4.2.5`). The goal of the third (successful) phase is to seal the new state of...
def _dumps(self, obj): """ If :prop:serialized is True, @obj will be serialized using :prop:serializer """ if not self.serialized: return obj return self.serializer.dumps(obj)
def function[_dumps, parameter[self, obj]]: constant[ If :prop:serialized is True, @obj will be serialized using :prop:serializer ] if <ast.UnaryOp object at 0x7da1b28fae00> begin[:] return[name[obj]] return[call[name[self].serializer.dumps, parameter[name[obj]]]]
keyword[def] identifier[_dumps] ( identifier[self] , identifier[obj] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[serialized] : keyword[return] identifier[obj] keyword[return] identifier[self] . identifier[serializer] . identifier[dumps] ( ide...
def _dumps(self, obj): """ If :prop:serialized is True, @obj will be serialized using :prop:serializer """ if not self.serialized: return obj # depends on [control=['if'], data=[]] return self.serializer.dumps(obj)
def get_repository_ids_by_asset(self, asset_id): """Gets the list of ``Repository`` ``Ids`` mapped to an ``Asset``. arg: asset_id (osid.id.Id): ``Id`` of an ``Asset`` return: (osid.id.IdList) - list of repository ``Ids`` raise: NotFound - ``asset_id`` is not found raise: N...
def function[get_repository_ids_by_asset, parameter[self, asset_id]]: constant[Gets the list of ``Repository`` ``Ids`` mapped to an ``Asset``. arg: asset_id (osid.id.Id): ``Id`` of an ``Asset`` return: (osid.id.IdList) - list of repository ``Ids`` raise: NotFound - ``asset_id`` is ...
keyword[def] identifier[get_repository_ids_by_asset] ( identifier[self] , identifier[asset_id] ): literal[string] identifier[mgr] = identifier[self] . identifier[_get_provider_manager] ( literal[string] , identifier[local] = keyword[True] ) identifier[lookup_session] = id...
def get_repository_ids_by_asset(self, asset_id): """Gets the list of ``Repository`` ``Ids`` mapped to an ``Asset``. arg: asset_id (osid.id.Id): ``Id`` of an ``Asset`` return: (osid.id.IdList) - list of repository ``Ids`` raise: NotFound - ``asset_id`` is not found raise: NullA...
async def create_app_collections(db): ''' load all models in app and create collections in db with specified indices''' futures = [] for model_class in MongoCollectionMixin.__subclasses__(): if model_class._meta.concrete is True: futures.append(create_collection(db, model_class)) aw...
<ast.AsyncFunctionDef object at 0x7da18eb57700>
keyword[async] keyword[def] identifier[create_app_collections] ( identifier[db] ): literal[string] identifier[futures] =[] keyword[for] identifier[model_class] keyword[in] identifier[MongoCollectionMixin] . identifier[__subclasses__] (): keyword[if] identifier[model_class] . identifier[_...
async def create_app_collections(db): """ load all models in app and create collections in db with specified indices""" futures = [] for model_class in MongoCollectionMixin.__subclasses__(): if model_class._meta.concrete is True: futures.append(create_collection(db, model_class)) # depe...
def listen_ttf(self, target, timeout): """Listen as Type F Target is supported for either 212 or 424 kbps.""" if target.brty not in ('212F', '424F'): info = "unsupported target bitrate: %r" % target.brty raise nfc.clf.UnsupportedTargetError(info) if target.sensf_res is N...
def function[listen_ttf, parameter[self, target, timeout]]: constant[Listen as Type F Target is supported for either 212 or 424 kbps.] if compare[name[target].brty <ast.NotIn object at 0x7da2590d7190> tuple[[<ast.Constant object at 0x7da20c7968c0>, <ast.Constant object at 0x7da20c794dc0>]]] begin[:] ...
keyword[def] identifier[listen_ttf] ( identifier[self] , identifier[target] , identifier[timeout] ): literal[string] keyword[if] identifier[target] . identifier[brty] keyword[not] keyword[in] ( literal[string] , literal[string] ): identifier[info] = literal[string] % identifier[targ...
def listen_ttf(self, target, timeout): """Listen as Type F Target is supported for either 212 or 424 kbps.""" if target.brty not in ('212F', '424F'): info = 'unsupported target bitrate: %r' % target.brty raise nfc.clf.UnsupportedTargetError(info) # depends on [control=['if'], data=[]] if ta...
def reserve(self, capacity): """ Set current capacity of the underlying array""" if capacity >= self._data.size: capacity = int(2 ** np.ceil(np.log2(capacity))) self._data = np.resize(self._data, capacity)
def function[reserve, parameter[self, capacity]]: constant[ Set current capacity of the underlying array] if compare[name[capacity] greater_or_equal[>=] name[self]._data.size] begin[:] variable[capacity] assign[=] call[name[int], parameter[binary_operation[constant[2] ** call[name[np].ce...
keyword[def] identifier[reserve] ( identifier[self] , identifier[capacity] ): literal[string] keyword[if] identifier[capacity] >= identifier[self] . identifier[_data] . identifier[size] : identifier[capacity] = identifier[int] ( literal[int] ** identifier[np] . identifier[ceil] ( ide...
def reserve(self, capacity): """ Set current capacity of the underlying array""" if capacity >= self._data.size: capacity = int(2 ** np.ceil(np.log2(capacity))) self._data = np.resize(self._data, capacity) # depends on [control=['if'], data=['capacity']]
def get_unauthorized(self, msg, signature, timestamp, nonce): """ 处理取消授权通知 :params msg: 加密内容 :params signature: 消息签名 :params timestamp: 时间戳 :params nonce: 随机数 """ warnings.warn('`get_unauthorized` method of `WeChatComponent` is deprecated,' ...
def function[get_unauthorized, parameter[self, msg, signature, timestamp, nonce]]: constant[ 处理取消授权通知 :params msg: 加密内容 :params signature: 消息签名 :params timestamp: 时间戳 :params nonce: 随机数 ] call[name[warnings].warn, parameter[constant[`get_unauthorized` met...
keyword[def] identifier[get_unauthorized] ( identifier[self] , identifier[msg] , identifier[signature] , identifier[timestamp] , identifier[nonce] ): literal[string] identifier[warnings] . identifier[warn] ( literal[string] literal[string] , identifier[DeprecationWarning] , ident...
def get_unauthorized(self, msg, signature, timestamp, nonce): """ 处理取消授权通知 :params msg: 加密内容 :params signature: 消息签名 :params timestamp: 时间戳 :params nonce: 随机数 """ warnings.warn('`get_unauthorized` method of `WeChatComponent` is deprecated,Use `parse_message` inst...
def populateFromRow(self, referenceRecord): """ Populates this reference from the values in the specified DB row. """ self._length = referenceRecord.length self._isDerived = bool(referenceRecord.isderived) self._md5checksum = referenceRecord.md5checksum species = ...
def function[populateFromRow, parameter[self, referenceRecord]]: constant[ Populates this reference from the values in the specified DB row. ] name[self]._length assign[=] name[referenceRecord].length name[self]._isDerived assign[=] call[name[bool], parameter[name[referenceRecord...
keyword[def] identifier[populateFromRow] ( identifier[self] , identifier[referenceRecord] ): literal[string] identifier[self] . identifier[_length] = identifier[referenceRecord] . identifier[length] identifier[self] . identifier[_isDerived] = identifier[bool] ( identifier[referenceRecord]...
def populateFromRow(self, referenceRecord): """ Populates this reference from the values in the specified DB row. """ self._length = referenceRecord.length self._isDerived = bool(referenceRecord.isderived) self._md5checksum = referenceRecord.md5checksum species = referenceRecord.spec...
def _extract_game_info(self, games): """ Parse game information from all boxscores. Find the major game information for all boxscores listed on a particular boxscores webpage and return the results in a list. Parameters ---------- games : generator A...
def function[_extract_game_info, parameter[self, games]]: constant[ Parse game information from all boxscores. Find the major game information for all boxscores listed on a particular boxscores webpage and return the results in a list. Parameters ---------- game...
keyword[def] identifier[_extract_game_info] ( identifier[self] , identifier[games] ): literal[string] identifier[all_boxscores] =[] keyword[for] identifier[game] keyword[in] identifier[games] : identifier[details] = identifier[self] . identifier[_get_team_details] ( identi...
def _extract_game_info(self, games): """ Parse game information from all boxscores. Find the major game information for all boxscores listed on a particular boxscores webpage and return the results in a list. Parameters ---------- games : generator A gen...
def _equal_values(self, val1, val2): """Checks if the parameter considers two values as equal. This is important for the trajectory in case of merging. In case you want to delete duplicate parameter points, the trajectory needs to know when two parameters are equal. Since equality is no...
def function[_equal_values, parameter[self, val1, val2]]: constant[Checks if the parameter considers two values as equal. This is important for the trajectory in case of merging. In case you want to delete duplicate parameter points, the trajectory needs to know when two parameters are ...
keyword[def] identifier[_equal_values] ( identifier[self] , identifier[val1] , identifier[val2] ): literal[string] keyword[if] identifier[self] . identifier[f_supports] ( identifier[val1] )!= identifier[self] . identifier[f_supports] ( identifier[val2] ): keyword[return] keyword[Fals...
def _equal_values(self, val1, val2): """Checks if the parameter considers two values as equal. This is important for the trajectory in case of merging. In case you want to delete duplicate parameter points, the trajectory needs to know when two parameters are equal. Since equality is not al...
def match(self, item): '''Return whether *item* matches this collection expression. If a match is successful return data about the match otherwise return None. ''' match = self._expression.match(item) if not match: return None index = match.group('i...
def function[match, parameter[self, item]]: constant[Return whether *item* matches this collection expression. If a match is successful return data about the match otherwise return None. ] variable[match] assign[=] call[name[self]._expression.match, parameter[name[item]]] ...
keyword[def] identifier[match] ( identifier[self] , identifier[item] ): literal[string] identifier[match] = identifier[self] . identifier[_expression] . identifier[match] ( identifier[item] ) keyword[if] keyword[not] identifier[match] : keyword[return] keyword[None] ...
def match(self, item): """Return whether *item* matches this collection expression. If a match is successful return data about the match otherwise return None. """ match = self._expression.match(item) if not match: return None # depends on [control=['if'], data=[]] ind...
def get_v_distance(self, latlonalt1, latlonalt2): '''get the horizontal distance between threat and vehicle''' (lat1, lon1, alt1) = latlonalt1 (lat2, lon2, alt2) = latlonalt2 return alt2 - alt1
def function[get_v_distance, parameter[self, latlonalt1, latlonalt2]]: constant[get the horizontal distance between threat and vehicle] <ast.Tuple object at 0x7da20c76cf10> assign[=] name[latlonalt1] <ast.Tuple object at 0x7da20c76e860> assign[=] name[latlonalt2] return[binary_operation[name...
keyword[def] identifier[get_v_distance] ( identifier[self] , identifier[latlonalt1] , identifier[latlonalt2] ): literal[string] ( identifier[lat1] , identifier[lon1] , identifier[alt1] )= identifier[latlonalt1] ( identifier[lat2] , identifier[lon2] , identifier[alt2] )= identifier[latlonalt...
def get_v_distance(self, latlonalt1, latlonalt2): """get the horizontal distance between threat and vehicle""" (lat1, lon1, alt1) = latlonalt1 (lat2, lon2, alt2) = latlonalt2 return alt2 - alt1
def _summarize_accessible_fields(field_descriptions, width=40, section_title='Accessible fields'): """ Create a summary string for the accessible fields in a model. Unlike `_toolkit_repr_print`, this function does not look up the values of the fields, it just formats the...
def function[_summarize_accessible_fields, parameter[field_descriptions, width, section_title]]: constant[ Create a summary string for the accessible fields in a model. Unlike `_toolkit_repr_print`, this function does not look up the values of the fields, it just formats the names and descriptions. ...
keyword[def] identifier[_summarize_accessible_fields] ( identifier[field_descriptions] , identifier[width] = literal[int] , identifier[section_title] = literal[string] ): literal[string] identifier[key_str] = literal[string] identifier[items] =[] identifier[items] . identifier[append] ( identi...
def _summarize_accessible_fields(field_descriptions, width=40, section_title='Accessible fields'): """ Create a summary string for the accessible fields in a model. Unlike `_toolkit_repr_print`, this function does not look up the values of the fields, it just formats the names and descriptions. Par...
def dict_find(in_dict, value): """ Helper function for looking up directory keys by their values. This isn't robust to repeated values Parameters ---------- in_dict : dictionary A dictionary containing `value` value : any type What we wish to find in the dictionary Return...
def function[dict_find, parameter[in_dict, value]]: constant[ Helper function for looking up directory keys by their values. This isn't robust to repeated values Parameters ---------- in_dict : dictionary A dictionary containing `value` value : any type What we wish to fin...
keyword[def] identifier[dict_find] ( identifier[in_dict] , identifier[value] ): literal[string] keyword[return] identifier[list] ( identifier[in_dict] . identifier[keys] ())[ identifier[list] ( identifier[in_dict] . identifier[values] ()). identifier[index] ( identifier[value] )]
def dict_find(in_dict, value): """ Helper function for looking up directory keys by their values. This isn't robust to repeated values Parameters ---------- in_dict : dictionary A dictionary containing `value` value : any type What we wish to find in the dictionary Return...
def _separable_series2(h, N=1): """ finds separable approximations to the 2d function 2d h returns res = (hx, hy)[N] s.t. h \approx sum_i outer(res[i,0],res[i,1]) """ if min(h.shape)<N: raise ValueError("smallest dimension of h is smaller than approximation order! (%s < %s)"%(min(h.shape),N...
def function[_separable_series2, parameter[h, N]]: constant[ finds separable approximations to the 2d function 2d h returns res = (hx, hy)[N] s.t. h pprox sum_i outer(res[i,0],res[i,1]) ] if compare[call[name[min], parameter[name[h].shape]] less[<] name[N]] begin[:] <ast.Raise obje...
keyword[def] identifier[_separable_series2] ( identifier[h] , identifier[N] = literal[int] ): literal[string] keyword[if] identifier[min] ( identifier[h] . identifier[shape] )< identifier[N] : keyword[raise] identifier[ValueError] ( literal[string] %( identifier[min] ( identifier[h] . identifier...
def _separable_series2(h, N=1): """ finds separable approximations to the 2d function 2d h returns res = (hx, hy)[N] s.t. h \x07pprox sum_i outer(res[i,0],res[i,1]) """ if min(h.shape) < N: raise ValueError('smallest dimension of h is smaller than approximation order! (%s < %s)' % (min(h.sh...
def _encode_batched_op_msg( operation, command, docs, check_keys, ack, opts, ctx): """Encode the next batched insert, update, or delete operation as OP_MSG. """ buf = StringIO() to_send, _ = _batched_op_msg_impl( operation, command, docs, check_keys, ack, opts, ctx, buf) return ...
def function[_encode_batched_op_msg, parameter[operation, command, docs, check_keys, ack, opts, ctx]]: constant[Encode the next batched insert, update, or delete operation as OP_MSG. ] variable[buf] assign[=] call[name[StringIO], parameter[]] <ast.Tuple object at 0x7da20c991ea0> assign[=...
keyword[def] identifier[_encode_batched_op_msg] ( identifier[operation] , identifier[command] , identifier[docs] , identifier[check_keys] , identifier[ack] , identifier[opts] , identifier[ctx] ): literal[string] identifier[buf] = identifier[StringIO] () identifier[to_send] , identifier[_] = identifi...
def _encode_batched_op_msg(operation, command, docs, check_keys, ack, opts, ctx): """Encode the next batched insert, update, or delete operation as OP_MSG. """ buf = StringIO() (to_send, _) = _batched_op_msg_impl(operation, command, docs, check_keys, ack, opts, ctx, buf) return (buf.getvalue(), ...