code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def create_bar_chart(self, x_labels, y_values, y_label): """Creates bar char :param x_labels: Names for each variable :param y_values: Values of x labels :param y_label: Label of y axis :return: Bar chart """ self.setup(0.25) ax1 = self.get_ax() a...
def function[create_bar_chart, parameter[self, x_labels, y_values, y_label]]: constant[Creates bar char :param x_labels: Names for each variable :param y_values: Values of x labels :param y_label: Label of y axis :return: Bar chart ] call[name[self].setup, parame...
keyword[def] identifier[create_bar_chart] ( identifier[self] , identifier[x_labels] , identifier[y_values] , identifier[y_label] ): literal[string] identifier[self] . identifier[setup] ( literal[int] ) identifier[ax1] = identifier[self] . identifier[get_ax] () identifier[ax1] . id...
def create_bar_chart(self, x_labels, y_values, y_label): """Creates bar char :param x_labels: Names for each variable :param y_values: Values of x labels :param y_label: Label of y axis :return: Bar chart """ self.setup(0.25) ax1 = self.get_ax() ax1.set_xticks(li...
def list_snapshots_days(path, cam_id): """Returns a list of (date, dir) in which snapshopts are present""" screenshoots_path = path + "/" + str(cam_id) if os.path.exists(screenshoots_path): days = [] for day_dir in os.listdir(screenshoots_path): date = datetime.datetime.strptime(...
def function[list_snapshots_days, parameter[path, cam_id]]: constant[Returns a list of (date, dir) in which snapshopts are present] variable[screenshoots_path] assign[=] binary_operation[binary_operation[name[path] + constant[/]] + call[name[str], parameter[name[cam_id]]]] if call[name[os].path....
keyword[def] identifier[list_snapshots_days] ( identifier[path] , identifier[cam_id] ): literal[string] identifier[screenshoots_path] = identifier[path] + literal[string] + identifier[str] ( identifier[cam_id] ) keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[screensho...
def list_snapshots_days(path, cam_id): """Returns a list of (date, dir) in which snapshopts are present""" screenshoots_path = path + '/' + str(cam_id) if os.path.exists(screenshoots_path): days = [] for day_dir in os.listdir(screenshoots_path): date = datetime.datetime.strptime(...
def _have_conf(self, magic_hash=None): """Get the daemon current configuration state If the daemon has received a configuration from its arbiter, this will return True If a `magic_hash` is provided it is compared with the one included in the daemon configuration and this functi...
def function[_have_conf, parameter[self, magic_hash]]: constant[Get the daemon current configuration state If the daemon has received a configuration from its arbiter, this will return True If a `magic_hash` is provided it is compared with the one included in the daemon configu...
keyword[def] identifier[_have_conf] ( identifier[self] , identifier[magic_hash] = keyword[None] ): literal[string] identifier[self] . identifier[app] . identifier[have_conf] = identifier[getattr] ( identifier[self] . identifier[app] , literal[string] , keyword[None] ) keyword[not] keyword[in] [ ke...
def _have_conf(self, magic_hash=None): """Get the daemon current configuration state If the daemon has received a configuration from its arbiter, this will return True If a `magic_hash` is provided it is compared with the one included in the daemon configuration and this function r...
def nodeInLanguageStem(_: Context, n: Node, s: ShExJ.LanguageStem) -> bool: """ http://shex.io/shex-semantics/#values **nodeIn**: asserts that an RDF node n is equal to an RDF term s or is in a set defined by a :py:class:`ShExJ.IriStem`, :py:class:`LiteralStem` or :py:class:`LanguageStem`. ...
def function[nodeInLanguageStem, parameter[_, n, s]]: constant[ http://shex.io/shex-semantics/#values **nodeIn**: asserts that an RDF node n is equal to an RDF term s or is in a set defined by a :py:class:`ShExJ.IriStem`, :py:class:`LiteralStem` or :py:class:`LanguageStem`. The express...
keyword[def] identifier[nodeInLanguageStem] ( identifier[_] : identifier[Context] , identifier[n] : identifier[Node] , identifier[s] : identifier[ShExJ] . identifier[LanguageStem] )-> identifier[bool] : literal[string] keyword[return] identifier[isinstance] ( identifier[s] , identifier[ShExJ] . identifier...
def nodeInLanguageStem(_: Context, n: Node, s: ShExJ.LanguageStem) -> bool: """ http://shex.io/shex-semantics/#values **nodeIn**: asserts that an RDF node n is equal to an RDF term s or is in a set defined by a :py:class:`ShExJ.IriStem`, :py:class:`LiteralStem` or :py:class:`LanguageStem`. ...
def _setup_sentry_client(context): """Produce and configure the sentry client.""" # get_secret will be deprecated soon dsn = os.environ.get("SENTRY_DSN") try: client = raven.Client(dsn, sample_rate=SENTRY_SAMPLE_RATE) client.user_context(_sentry_context_dict(context)) return cli...
def function[_setup_sentry_client, parameter[context]]: constant[Produce and configure the sentry client.] variable[dsn] assign[=] call[name[os].environ.get, parameter[constant[SENTRY_DSN]]] <ast.Try object at 0x7da1b1452170>
keyword[def] identifier[_setup_sentry_client] ( identifier[context] ): literal[string] identifier[dsn] = identifier[os] . identifier[environ] . identifier[get] ( literal[string] ) keyword[try] : identifier[client] = identifier[raven] . identifier[Client] ( identifier[dsn] , identifier[s...
def _setup_sentry_client(context): """Produce and configure the sentry client.""" # get_secret will be deprecated soon dsn = os.environ.get('SENTRY_DSN') try: client = raven.Client(dsn, sample_rate=SENTRY_SAMPLE_RATE) client.user_context(_sentry_context_dict(context)) return clie...
def create(self, term, options): """Create a monitor using passed configuration.""" if not self._state: raise InvalidState("State was not properly obtained from the app") options['action'] = 'CREATE' payload = self._build_payload(term, options) url = self.ALERTS_CREAT...
def function[create, parameter[self, term, options]]: constant[Create a monitor using passed configuration.] if <ast.UnaryOp object at 0x7da20c6e4460> begin[:] <ast.Raise object at 0x7da20c6e77c0> call[name[options]][constant[action]] assign[=] constant[CREATE] variable[payload] ...
keyword[def] identifier[create] ( identifier[self] , identifier[term] , identifier[options] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_state] : keyword[raise] identifier[InvalidState] ( literal[string] ) identifier[options] [ literal[string] ...
def create(self, term, options): """Create a monitor using passed configuration.""" if not self._state: raise InvalidState('State was not properly obtained from the app') # depends on [control=['if'], data=[]] options['action'] = 'CREATE' payload = self._build_payload(term, options) url = s...
def description(self): """ Retrieve a description of the columns in the current result set :return: A tuple of seven elements. Only some elements are meaningful:\n * Element #0 is the name of the column * Element #1 is the type code of the column ...
def function[description, parameter[self]]: constant[ Retrieve a description of the columns in the current result set :return: A tuple of seven elements. Only some elements are meaningful: * Element #0 is the name of the column * Element #1 is the type cod...
keyword[def] identifier[description] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[result_set] : identifier[info] = identifier[self] . identifier[result_set] . identifier[get_column_info] () keyword[return] [( identifier[c] . identifier[n...
def description(self): """ Retrieve a description of the columns in the current result set :return: A tuple of seven elements. Only some elements are meaningful: * Element #0 is the name of the column * Element #1 is the type code of the column ...
def create_store(): """ A helper for setting the _proxy and slapping the store object for us. :return: A thread-local storage as a dictionary """ new_storage = _proxy('store') _state.store = type('store', (object,), {}) new_storage.store = dict() return new_storage.store
def function[create_store, parameter[]]: constant[ A helper for setting the _proxy and slapping the store object for us. :return: A thread-local storage as a dictionary ] variable[new_storage] assign[=] call[name[_proxy], parameter[constant[store]]] name[_state].store assign[=] ...
keyword[def] identifier[create_store] (): literal[string] identifier[new_storage] = identifier[_proxy] ( literal[string] ) identifier[_state] . identifier[store] = identifier[type] ( literal[string] ,( identifier[object] ,),{}) identifier[new_storage] . identifier[store] = identifier[dict] () ...
def create_store(): """ A helper for setting the _proxy and slapping the store object for us. :return: A thread-local storage as a dictionary """ new_storage = _proxy('store') _state.store = type('store', (object,), {}) new_storage.store = dict() return new_storage.store
def consume(self, consumer_callback=None, exclusive=False): """ Initialize consuming of messages from an AMQP RPC queue. Messages will be consumed after start_consuming() is called. An internal callback will be used to handle incoming RPC responses. Only responses that have been registered with register_response...
def function[consume, parameter[self, consumer_callback, exclusive]]: constant[ Initialize consuming of messages from an AMQP RPC queue. Messages will be consumed after start_consuming() is called. An internal callback will be used to handle incoming RPC responses. Only responses that have been registered ...
keyword[def] identifier[consume] ( identifier[self] , identifier[consumer_callback] = keyword[None] , identifier[exclusive] = keyword[False] ): literal[string] keyword[if] keyword[not] identifier[hasattr] ( identifier[self] , literal[string] ) keyword[and] identifier[consumer_callback] : keyword[raise] ...
def consume(self, consumer_callback=None, exclusive=False): """ Initialize consuming of messages from an AMQP RPC queue. Messages will be consumed after start_consuming() is called. An internal callback will be used to handle incoming RPC responses. Only responses that have been registered with register_respon...
def _compute_pga_rock(self, C_PGA, mag, rjb): """ Returns the PGA (g) on rock, as defined in equation 15 """ return np.exp(self._compute_linear_magnitude_term(C_PGA, mag) + self._compute_simple_distance_term(C_PGA, rjb))
def function[_compute_pga_rock, parameter[self, C_PGA, mag, rjb]]: constant[ Returns the PGA (g) on rock, as defined in equation 15 ] return[call[name[np].exp, parameter[binary_operation[call[name[self]._compute_linear_magnitude_term, parameter[name[C_PGA], name[mag]]] + call[name[self]._com...
keyword[def] identifier[_compute_pga_rock] ( identifier[self] , identifier[C_PGA] , identifier[mag] , identifier[rjb] ): literal[string] keyword[return] identifier[np] . identifier[exp] ( identifier[self] . identifier[_compute_linear_magnitude_term] ( identifier[C_PGA] , identifier[mag] )+ ...
def _compute_pga_rock(self, C_PGA, mag, rjb): """ Returns the PGA (g) on rock, as defined in equation 15 """ return np.exp(self._compute_linear_magnitude_term(C_PGA, mag) + self._compute_simple_distance_term(C_PGA, rjb))
def return_data(self, data, format=None): """Format and return data appropriate to the requested API format. data: The data retured by the api request """ if format is None: format = self.format if format == "json": formatted_data = json.loads(data) ...
def function[return_data, parameter[self, data, format]]: constant[Format and return data appropriate to the requested API format. data: The data retured by the api request ] if compare[name[format] is constant[None]] begin[:] variable[format] assign[=] name[self].forma...
keyword[def] identifier[return_data] ( identifier[self] , identifier[data] , identifier[format] = keyword[None] ): literal[string] keyword[if] identifier[format] keyword[is] keyword[None] : identifier[format] = identifier[self] . identifier[format] keyword[if] identifier[...
def return_data(self, data, format=None): """Format and return data appropriate to the requested API format. data: The data retured by the api request """ if format is None: format = self.format # depends on [control=['if'], data=['format']] if format == 'json': formatted_...
def _seconds_have_elapsed(token, num_seconds): """Tests if 'num_seconds' have passed since 'token' was requested. Not strictly thread-safe - may log with the wrong frequency if called concurrently from multiple threads. Accuracy depends on resolution of 'timeit.default_timer()'. Always returns True on the f...
def function[_seconds_have_elapsed, parameter[token, num_seconds]]: constant[Tests if 'num_seconds' have passed since 'token' was requested. Not strictly thread-safe - may log with the wrong frequency if called concurrently from multiple threads. Accuracy depends on resolution of 'timeit.default_timer()'...
keyword[def] identifier[_seconds_have_elapsed] ( identifier[token] , identifier[num_seconds] ): literal[string] identifier[now] = identifier[timeit] . identifier[default_timer] () identifier[then] = identifier[_log_timer_per_token] . identifier[get] ( identifier[token] , keyword[None] ) keyword[if] iden...
def _seconds_have_elapsed(token, num_seconds): """Tests if 'num_seconds' have passed since 'token' was requested. Not strictly thread-safe - may log with the wrong frequency if called concurrently from multiple threads. Accuracy depends on resolution of 'timeit.default_timer()'. Always returns True on the...
def _line_by_type(self, line, header, hgroups, htypes, out, want_type, collapse_quals_fn = None): """Parse out key value pairs for line information based on a group of values. """ for index, htype in ((i, t) for i, t in enumerate(htypes) if t == want_type): col ...
def function[_line_by_type, parameter[self, line, header, hgroups, htypes, out, want_type, collapse_quals_fn]]: constant[Parse out key value pairs for line information based on a group of values. ] for taget[tuple[[<ast.Name object at 0x7da18dc98430>, <ast.Name object at 0x7da18dc985b0>]]] in st...
keyword[def] identifier[_line_by_type] ( identifier[self] , identifier[line] , identifier[header] , identifier[hgroups] , identifier[htypes] , identifier[out] , identifier[want_type] , identifier[collapse_quals_fn] = keyword[None] ): literal[string] keyword[for] identifier[index] , identifier[hty...
def _line_by_type(self, line, header, hgroups, htypes, out, want_type, collapse_quals_fn=None): """Parse out key value pairs for line information based on a group of values. """ for (index, htype) in ((i, t) for (i, t) in enumerate(htypes) if t == want_type): col = hgroups[index][0] key ...
def get_squeezenet(version, pretrained=False, ctx=cpu(), root=os.path.join(base.data_dir(), 'models'), **kwargs): r"""SqueezeNet model from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" <https://arxiv.org/abs/1602.07360>`_ paper. SqueezeNet 1.1 ...
def function[get_squeezenet, parameter[version, pretrained, ctx, root]]: constant[SqueezeNet model from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" <https://arxiv.org/abs/1602.07360>`_ paper. SqueezeNet 1.1 model from the `official SqueezeNet repo <https...
keyword[def] identifier[get_squeezenet] ( identifier[version] , identifier[pretrained] = keyword[False] , identifier[ctx] = identifier[cpu] (), identifier[root] = identifier[os] . identifier[path] . identifier[join] ( identifier[base] . identifier[data_dir] (), literal[string] ),** identifier[kwargs] ): literal...
def get_squeezenet(version, pretrained=False, ctx=cpu(), root=os.path.join(base.data_dir(), 'models'), **kwargs): """SqueezeNet model from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" <https://arxiv.org/abs/1602.07360>`_ paper. SqueezeNet 1.1 model from the `offi...
def do_POST(self): """Handles HTTP POST requests.""" post_data = self.rfile.read(int(self.headers['Content-Length'])) json_data = gzip.decompress(post_data) self._profile_json.update(json.loads(json_data.decode('utf-8'))) self._send_response( 200, headers=(('Content-t...
def function[do_POST, parameter[self]]: constant[Handles HTTP POST requests.] variable[post_data] assign[=] call[name[self].rfile.read, parameter[call[name[int], parameter[call[name[self].headers][constant[Content-Length]]]]]] variable[json_data] assign[=] call[name[gzip].decompress, parameter[n...
keyword[def] identifier[do_POST] ( identifier[self] ): literal[string] identifier[post_data] = identifier[self] . identifier[rfile] . identifier[read] ( identifier[int] ( identifier[self] . identifier[headers] [ literal[string] ])) identifier[json_data] = identifier[gzip] . identifier[deco...
def do_POST(self): """Handles HTTP POST requests.""" post_data = self.rfile.read(int(self.headers['Content-Length'])) json_data = gzip.decompress(post_data) self._profile_json.update(json.loads(json_data.decode('utf-8'))) self._send_response(200, headers=(('Content-type', '%s; charset=utf-8' % 'text...
def w_diffuser_outer(sed_inputs=sed_dict): """Return the outer width of each diffuser in the sedimentation tank. Parameters ---------- sed_inputs : dict A dictionary of all of the constant inputs needed for sedimentation tank calculations can be found in sed.yaml Returns ------- ...
def function[w_diffuser_outer, parameter[sed_inputs]]: constant[Return the outer width of each diffuser in the sedimentation tank. Parameters ---------- sed_inputs : dict A dictionary of all of the constant inputs needed for sedimentation tank calculations can be found in sed.yaml ...
keyword[def] identifier[w_diffuser_outer] ( identifier[sed_inputs] = identifier[sed_dict] ): literal[string] keyword[return] ( identifier[w_diffuser_inner_min] ( identifier[sed_inputs] [ literal[string] ][ literal[string] ])+ ( literal[int] * identifier[sed_inputs] [ literal[string] ][ literal[string] ...
def w_diffuser_outer(sed_inputs=sed_dict): """Return the outer width of each diffuser in the sedimentation tank. Parameters ---------- sed_inputs : dict A dictionary of all of the constant inputs needed for sedimentation tank calculations can be found in sed.yaml Returns ------- ...
def get_word_before_cursor(self, WORD=False): """ Give the word before the cursor. If we have whitespace before the cursor this returns an empty string. """ if self.text_before_cursor[-1:].isspace(): return '' else: return self.text_before_cursor[s...
def function[get_word_before_cursor, parameter[self, WORD]]: constant[ Give the word before the cursor. If we have whitespace before the cursor this returns an empty string. ] if call[call[name[self].text_before_cursor][<ast.Slice object at 0x7da1b08a7c40>].isspace, parameter[]] ...
keyword[def] identifier[get_word_before_cursor] ( identifier[self] , identifier[WORD] = keyword[False] ): literal[string] keyword[if] identifier[self] . identifier[text_before_cursor] [- literal[int] :]. identifier[isspace] (): keyword[return] literal[string] keyword[else] ...
def get_word_before_cursor(self, WORD=False): """ Give the word before the cursor. If we have whitespace before the cursor this returns an empty string. """ if self.text_before_cursor[-1:].isspace(): return '' # depends on [control=['if'], data=[]] else: return self....
def pop(self, key, timeout=1, is_async=False, only_read=False): """ Test: >>> cache = Cache(log_level=logging.WARNING) >>> cache.put('a', 0) >>> cache.pop('a') 0 >>> cache.pop('b') == None True """ if key not in self.cache_items: ...
def function[pop, parameter[self, key, timeout, is_async, only_read]]: constant[ Test: >>> cache = Cache(log_level=logging.WARNING) >>> cache.put('a', 0) >>> cache.pop('a') 0 >>> cache.pop('b') == None True ] if compare[name[key] <ast.NotI...
keyword[def] identifier[pop] ( identifier[self] , identifier[key] , identifier[timeout] = literal[int] , identifier[is_async] = keyword[False] , identifier[only_read] = keyword[False] ): literal[string] keyword[if] identifier[key] keyword[not] keyword[in] identifier[self] . identifier[cache_ite...
def pop(self, key, timeout=1, is_async=False, only_read=False): """ Test: >>> cache = Cache(log_level=logging.WARNING) >>> cache.put('a', 0) >>> cache.pop('a') 0 >>> cache.pop('b') == None True """ if key not in self.cache_items: return No...
def solve_tsp(V,c): """solve_tsp -- solve the traveling salesman problem - start with assignment model - check flow from a source to every other node; - if no flow, a sub-cycle has been found --> add cut - otherwise, the solution is optimal Parameters: - V: set/list of ...
def function[solve_tsp, parameter[V, c]]: constant[solve_tsp -- solve the traveling salesman problem - start with assignment model - check flow from a source to every other node; - if no flow, a sub-cycle has been found --> add cut - otherwise, the solution is optimal Param...
keyword[def] identifier[solve_tsp] ( identifier[V] , identifier[c] ): literal[string] keyword[def] identifier[addcut] ( identifier[X] ): keyword[for] identifier[sink] keyword[in] identifier[V] [ literal[int] :]: identifier[mflow] = identifier[maxflow] ( identifier[V] , identifier...
def solve_tsp(V, c): """solve_tsp -- solve the traveling salesman problem - start with assignment model - check flow from a source to every other node; - if no flow, a sub-cycle has been found --> add cut - otherwise, the solution is optimal Parameters: - V: set/list of...
def get_canonical_headers(cls, req, include=None): """ Generate the Canonical Headers section of the Canonical Request. Return the Canonical Headers and the Signed Headers strs as a tuple (canonical_headers, signed_headers). req -- Requests PreparedRequest object in...
def function[get_canonical_headers, parameter[cls, req, include]]: constant[ Generate the Canonical Headers section of the Canonical Request. Return the Canonical Headers and the Signed Headers strs as a tuple (canonical_headers, signed_headers). req -- Requests PreparedReq...
keyword[def] identifier[get_canonical_headers] ( identifier[cls] , identifier[req] , identifier[include] = keyword[None] ): literal[string] keyword[if] identifier[include] keyword[is] keyword[None] : identifier[include] = identifier[cls] . identifier[default_include_headers] ...
def get_canonical_headers(cls, req, include=None): """ Generate the Canonical Headers section of the Canonical Request. Return the Canonical Headers and the Signed Headers strs as a tuple (canonical_headers, signed_headers). req -- Requests PreparedRequest object includ...
def autoconfig_url_from_registry(): """ Get the PAC ``AutoConfigURL`` value from the Windows Registry. This setting is visible as the "use automatic configuration script" field in Internet Options > Connection > LAN Settings. :return: The value from the registry, or None if the value isn't co...
def function[autoconfig_url_from_registry, parameter[]]: constant[ Get the PAC ``AutoConfigURL`` value from the Windows Registry. This setting is visible as the "use automatic configuration script" field in Internet Options > Connection > LAN Settings. :return: The value from the registry, or N...
keyword[def] identifier[autoconfig_url_from_registry] (): literal[string] keyword[if] keyword[not] identifier[ON_WINDOWS] : keyword[raise] identifier[NotWindowsError] () keyword[try] : keyword[with] identifier[winreg] . identifier[OpenKey] ( identifier[winreg] . identifier...
def autoconfig_url_from_registry(): """ Get the PAC ``AutoConfigURL`` value from the Windows Registry. This setting is visible as the "use automatic configuration script" field in Internet Options > Connection > LAN Settings. :return: The value from the registry, or None if the value isn't configur...
def get_author_string(self, links=False): saved_args = locals() saved_args = saved_args['links'] """Returns list of authors as a comma-separated string (with 'and' before last author).""" def format_author(author): if links and author.person.slug: ret...
def function[get_author_string, parameter[self, links]]: variable[saved_args] assign[=] call[name[locals], parameter[]] variable[saved_args] assign[=] call[name[saved_args]][constant[links]] constant[Returns list of authors as a comma-separated string (with 'and' before last author).] ...
keyword[def] identifier[get_author_string] ( identifier[self] , identifier[links] = keyword[False] ): identifier[saved_args] = identifier[locals] () identifier[saved_args] = identifier[saved_args] [ literal[string] ] literal[string] keyword[def] identifier[format_author] ( ident...
def get_author_string(self, links=False): saved_args = locals() saved_args = saved_args['links'] "Returns list of authors as a comma-separated\n string (with 'and' before last author)." def format_author(author): if links and author.person.slug: return '<a href="/authors/%s/"...
def in_array(self, event_property, value): """An in-array filter chain. >>> request_time = EventExpression('request', 'elapsed_ms') >>> filtered = request_time.in_array('path', '/event') >>> print(filtered) request(elapsed_ms).in(path, ["/", "e", "v", "e", "n", "t"]) >>>...
def function[in_array, parameter[self, event_property, value]]: constant[An in-array filter chain. >>> request_time = EventExpression('request', 'elapsed_ms') >>> filtered = request_time.in_array('path', '/event') >>> print(filtered) request(elapsed_ms).in(path, ["/", "e", "v", ...
keyword[def] identifier[in_array] ( identifier[self] , identifier[event_property] , identifier[value] ): literal[string] identifier[c] = identifier[self] . identifier[copy] () identifier[c] . identifier[filters] . identifier[append] ( identifier[filters] . identifier[IN] ( identifier[event...
def in_array(self, event_property, value): """An in-array filter chain. >>> request_time = EventExpression('request', 'elapsed_ms') >>> filtered = request_time.in_array('path', '/event') >>> print(filtered) request(elapsed_ms).in(path, ["/", "e", "v", "e", "n", "t"]) >>> fil...
def _select_phase_left_bound(self, epoch_number): """ Return number of current phase. Return index of first phase not done after all up to epoch_number were done. """ idx = bisect.bisect_left(self.ladder, epoch_number) if idx >= len(self.ladder): return len(s...
def function[_select_phase_left_bound, parameter[self, epoch_number]]: constant[ Return number of current phase. Return index of first phase not done after all up to epoch_number were done. ] variable[idx] assign[=] call[name[bisect].bisect_left, parameter[name[self].ladder, name...
keyword[def] identifier[_select_phase_left_bound] ( identifier[self] , identifier[epoch_number] ): literal[string] identifier[idx] = identifier[bisect] . identifier[bisect_left] ( identifier[self] . identifier[ladder] , identifier[epoch_number] ) keyword[if] identifier[idx] >= identifier...
def _select_phase_left_bound(self, epoch_number): """ Return number of current phase. Return index of first phase not done after all up to epoch_number were done. """ idx = bisect.bisect_left(self.ladder, epoch_number) if idx >= len(self.ladder): return len(self.ladder) - 1 ...
def start(cls, name): """ starts a timer with the given name. :param name: the name of the timer :type name: string """ if cls.debug: print("Timer", name, "started ...") cls.timer_start[name] = time.time()
def function[start, parameter[cls, name]]: constant[ starts a timer with the given name. :param name: the name of the timer :type name: string ] if name[cls].debug begin[:] call[name[print], parameter[constant[Timer], name[name], constant[started ...]]] ...
keyword[def] identifier[start] ( identifier[cls] , identifier[name] ): literal[string] keyword[if] identifier[cls] . identifier[debug] : identifier[print] ( literal[string] , identifier[name] , literal[string] ) identifier[cls] . identifier[timer_start] [ identifier[name] ]= ...
def start(cls, name): """ starts a timer with the given name. :param name: the name of the timer :type name: string """ if cls.debug: print('Timer', name, 'started ...') # depends on [control=['if'], data=[]] cls.timer_start[name] = time.time()
def meanOmega(self,dangle,oned=False,tdisrupt=None,approx=True, higherorder=None): """ NAME: meanOmega PURPOSE: calculate the mean frequency as a function of angle, assuming a uniform time distribution up to a maximum time INPUT: da...
def function[meanOmega, parameter[self, dangle, oned, tdisrupt, approx, higherorder]]: constant[ NAME: meanOmega PURPOSE: calculate the mean frequency as a function of angle, assuming a uniform time distribution up to a maximum time INPUT: dangle - a...
keyword[def] identifier[meanOmega] ( identifier[self] , identifier[dangle] , identifier[oned] = keyword[False] , identifier[tdisrupt] = keyword[None] , identifier[approx] = keyword[True] , identifier[higherorder] = keyword[None] ): literal[string] keyword[if] identifier[higherorder] keyword[is] ...
def meanOmega(self, dangle, oned=False, tdisrupt=None, approx=True, higherorder=None): """ NAME: meanOmega PURPOSE: calculate the mean frequency as a function of angle, assuming a uniform time distribution up to a maximum time INPUT: dangle - angle offse...
def output(self, stream): """Outputs the results of :meth:`.run` to the given stream. The results are presented similarly to HTTP headers, where each line has a key and value, separated by ``: ``. The ``Status`` key will always be available in the output. :param stream: The outp...
def function[output, parameter[self, stream]]: constant[Outputs the results of :meth:`.run` to the given stream. The results are presented similarly to HTTP headers, where each line has a key and value, separated by ``: ``. The ``Status`` key will always be available in the output. ...
keyword[def] identifier[output] ( identifier[self] , identifier[stream] ): literal[string] keyword[for] identifier[key] , identifier[val] keyword[in] identifier[self] . identifier[results] . identifier[items] (): keyword[if] identifier[isinstance] ( identifier[val] , identifier[bas...
def output(self, stream): """Outputs the results of :meth:`.run` to the given stream. The results are presented similarly to HTTP headers, where each line has a key and value, separated by ``: ``. The ``Status`` key will always be available in the output. :param stream: The output f...
def print_stream(file, name): """Print stream from file to logger.""" logger = logging.getLogger('xenon.{}'.format(name)) for line in file: logger.info('[{}] {}'.format(name, line.strip()))
def function[print_stream, parameter[file, name]]: constant[Print stream from file to logger.] variable[logger] assign[=] call[name[logging].getLogger, parameter[call[constant[xenon.{}].format, parameter[name[name]]]]] for taget[name[line]] in starred[name[file]] begin[:] call[na...
keyword[def] identifier[print_stream] ( identifier[file] , identifier[name] ): literal[string] identifier[logger] = identifier[logging] . identifier[getLogger] ( literal[string] . identifier[format] ( identifier[name] )) keyword[for] identifier[line] keyword[in] identifier[file] : identifi...
def print_stream(file, name): """Print stream from file to logger.""" logger = logging.getLogger('xenon.{}'.format(name)) for line in file: logger.info('[{}] {}'.format(name, line.strip())) # depends on [control=['for'], data=['line']]
def newton_refine_solve(jac_both, x_val, surf_x, y_val, surf_y): r"""Helper for :func:`newton_refine`. We have a system: .. code-block:: rest [A C][ds] = [E] [B D][dt] [F] This is not a typo, ``A->B->C->D`` matches the data in ``jac_both``. We solve directly rather than using a l...
def function[newton_refine_solve, parameter[jac_both, x_val, surf_x, y_val, surf_y]]: constant[Helper for :func:`newton_refine`. We have a system: .. code-block:: rest [A C][ds] = [E] [B D][dt] [F] This is not a typo, ``A->B->C->D`` matches the data in ``jac_both``. We solve ...
keyword[def] identifier[newton_refine_solve] ( identifier[jac_both] , identifier[x_val] , identifier[surf_x] , identifier[y_val] , identifier[surf_y] ): literal[string] identifier[a_val] , identifier[b_val] , identifier[c_val] , identifier[d_val] = identifier[jac_both] [:, literal[int] ] identifi...
def newton_refine_solve(jac_both, x_val, surf_x, y_val, surf_y): """Helper for :func:`newton_refine`. We have a system: .. code-block:: rest [A C][ds] = [E] [B D][dt] [F] This is not a typo, ``A->B->C->D`` matches the data in ``jac_both``. We solve directly rather than using a li...
def get_nodedata(self, sort_names=False): """ get dc node data from solved power flow """ if not self.Node.n: return if not self.pflow.solved: logger.error('Power flow not solved when getting bus data.') return tuple([False] * 7) idx = ...
def function[get_nodedata, parameter[self, sort_names]]: constant[ get dc node data from solved power flow ] if <ast.UnaryOp object at 0x7da18bccb5b0> begin[:] return[None] if <ast.UnaryOp object at 0x7da18bcc8a90> begin[:] call[name[logger].error, paramet...
keyword[def] identifier[get_nodedata] ( identifier[self] , identifier[sort_names] = keyword[False] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[Node] . identifier[n] : keyword[return] keyword[if] keyword[not] identifier[self] . identifier[pflo...
def get_nodedata(self, sort_names=False): """ get dc node data from solved power flow """ if not self.Node.n: return # depends on [control=['if'], data=[]] if not self.pflow.solved: logger.error('Power flow not solved when getting bus data.') return tuple([False] * 7...
def _jws_payload(expire_at, requrl=None, **kwargs): """ Produce a base64-encoded JWS payload. expire_at, if specified, must be a number that indicates a timestamp after which the message must be rejected. requrl, if specified, is used as the "audience" according to the JWT spec. Any other...
def function[_jws_payload, parameter[expire_at, requrl]]: constant[ Produce a base64-encoded JWS payload. expire_at, if specified, must be a number that indicates a timestamp after which the message must be rejected. requrl, if specified, is used as the "audience" according to the JWT spec...
keyword[def] identifier[_jws_payload] ( identifier[expire_at] , identifier[requrl] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[data] ={ literal[string] : identifier[expire_at] , literal[string] : identifier[requrl] } identifier[data] . identifier[update] ( ident...
def _jws_payload(expire_at, requrl=None, **kwargs): """ Produce a base64-encoded JWS payload. expire_at, if specified, must be a number that indicates a timestamp after which the message must be rejected. requrl, if specified, is used as the "audience" according to the JWT spec. Any other...
def set_execution_state(self, execution_state): """ set exectuion state """ if not execution_state: self.execution_state = None self.cluster = None self.environ = None else: self.execution_state = execution_state cluster, environ = self.get_execution_state_dc_environ(execution_...
def function[set_execution_state, parameter[self, execution_state]]: constant[ set exectuion state ] if <ast.UnaryOp object at 0x7da2054a5420> begin[:] name[self].execution_state assign[=] constant[None] name[self].cluster assign[=] constant[None] name[sel...
keyword[def] identifier[set_execution_state] ( identifier[self] , identifier[execution_state] ): literal[string] keyword[if] keyword[not] identifier[execution_state] : identifier[self] . identifier[execution_state] = keyword[None] identifier[self] . identifier[cluster] = keyword[None] ...
def set_execution_state(self, execution_state): """ set exectuion state """ if not execution_state: self.execution_state = None self.cluster = None self.environ = None # depends on [control=['if'], data=[]] else: self.execution_state = execution_state (cluster, envir...
def _recv(self): """Take all available bytes from socket, return list of any responses from parser""" recvd = [] self._lock.acquire() if not self._can_send_recv(): log.warning('%s cannot recv: socket not connected', self) self._lock.release() return ()...
def function[_recv, parameter[self]]: constant[Take all available bytes from socket, return list of any responses from parser] variable[recvd] assign[=] list[[]] call[name[self]._lock.acquire, parameter[]] if <ast.UnaryOp object at 0x7da1b21e3a00> begin[:] call[name[log]....
keyword[def] identifier[_recv] ( identifier[self] ): literal[string] identifier[recvd] =[] identifier[self] . identifier[_lock] . identifier[acquire] () keyword[if] keyword[not] identifier[self] . identifier[_can_send_recv] (): identifier[log] . identifier[warning] ...
def _recv(self): """Take all available bytes from socket, return list of any responses from parser""" recvd = [] self._lock.acquire() if not self._can_send_recv(): log.warning('%s cannot recv: socket not connected', self) self._lock.release() return () # depends on [control=['if...
def transition_matrix_samples(self): r""" Samples of the transition matrix """ res = np.empty((self.nsamples, self.nstates, self.nstates), dtype=config.dtype) for i in range(self.nsamples): res[i, :, :] = self._sampled_hmms[i].transition_matrix return res
def function[transition_matrix_samples, parameter[self]]: constant[ Samples of the transition matrix ] variable[res] assign[=] call[name[np].empty, parameter[tuple[[<ast.Attribute object at 0x7da20c6c4580>, <ast.Attribute object at 0x7da20c6c4340>, <ast.Attribute object at 0x7da20c6c7760>]]]] fo...
keyword[def] identifier[transition_matrix_samples] ( identifier[self] ): literal[string] identifier[res] = identifier[np] . identifier[empty] (( identifier[self] . identifier[nsamples] , identifier[self] . identifier[nstates] , identifier[self] . identifier[nstates] ), identifier[dtype] = identifie...
def transition_matrix_samples(self): """ Samples of the transition matrix """ res = np.empty((self.nsamples, self.nstates, self.nstates), dtype=config.dtype) for i in range(self.nsamples): res[i, :, :] = self._sampled_hmms[i].transition_matrix # depends on [control=['for'], data=['i']] return r...
def mark_deactivated(self,request,queryset): """An admin action for marking several cages as inactive. This action sets the selected cages as Active=False and Death=today. This admin action also shows as the output the number of mice sacrificed.""" rows_updated = queryset.update(Activ...
def function[mark_deactivated, parameter[self, request, queryset]]: constant[An admin action for marking several cages as inactive. This action sets the selected cages as Active=False and Death=today. This admin action also shows as the output the number of mice sacrificed.] variable[...
keyword[def] identifier[mark_deactivated] ( identifier[self] , identifier[request] , identifier[queryset] ): literal[string] identifier[rows_updated] = identifier[queryset] . identifier[update] ( identifier[Active] = keyword[False] , identifier[End] = identifier[datetime] . identifier[date] . ident...
def mark_deactivated(self, request, queryset): """An admin action for marking several cages as inactive. This action sets the selected cages as Active=False and Death=today. This admin action also shows as the output the number of mice sacrificed.""" rows_updated = queryset.update(Active=Fals...
def characters(self): """ The number of characters in this text file. :rtype: int """ chars = 0 for fragment in self.fragments: chars += fragment.characters return chars
def function[characters, parameter[self]]: constant[ The number of characters in this text file. :rtype: int ] variable[chars] assign[=] constant[0] for taget[name[fragment]] in starred[name[self].fragments] begin[:] <ast.AugAssign object at 0x7da1b1881060> r...
keyword[def] identifier[characters] ( identifier[self] ): literal[string] identifier[chars] = literal[int] keyword[for] identifier[fragment] keyword[in] identifier[self] . identifier[fragments] : identifier[chars] += identifier[fragment] . identifier[characters] ...
def characters(self): """ The number of characters in this text file. :rtype: int """ chars = 0 for fragment in self.fragments: chars += fragment.characters # depends on [control=['for'], data=['fragment']] return chars
def parse_date(string, formation=None): """ string to date stamp :param string: date string :param formation: format string :return: datetime.date """ if formation: _stamp = datetime.datetime.strptime(string, formation).date() return _stamp...
def function[parse_date, parameter[string, formation]]: constant[ string to date stamp :param string: date string :param formation: format string :return: datetime.date ] if name[formation] begin[:] variable[_stamp] assign[=] call[call[name[datetim...
keyword[def] identifier[parse_date] ( identifier[string] , identifier[formation] = keyword[None] ): literal[string] keyword[if] identifier[formation] : identifier[_stamp] = identifier[datetime] . identifier[datetime] . identifier[strptime] ( identifier[string] , identifier[formation] ...
def parse_date(string, formation=None): """ string to date stamp :param string: date string :param formation: format string :return: datetime.date """ if formation: _stamp = datetime.datetime.strptime(string, formation).date() return _stamp # depends on [...
def load_from_config(cp, model, **kwargs): """Loads a sampler from the given config file. This looks for a name in the section ``[sampler]`` to determine which sampler class to load. That sampler's ``from_config`` is then called. Parameters ---------- cp : WorkflowConfigParser Config p...
def function[load_from_config, parameter[cp, model]]: constant[Loads a sampler from the given config file. This looks for a name in the section ``[sampler]`` to determine which sampler class to load. That sampler's ``from_config`` is then called. Parameters ---------- cp : WorkflowConfigPa...
keyword[def] identifier[load_from_config] ( identifier[cp] , identifier[model] ,** identifier[kwargs] ): literal[string] identifier[name] = identifier[cp] . identifier[get] ( literal[string] , literal[string] ) keyword[return] identifier[samplers] [ identifier[name] ]. identifier[from_config] ( ident...
def load_from_config(cp, model, **kwargs): """Loads a sampler from the given config file. This looks for a name in the section ``[sampler]`` to determine which sampler class to load. That sampler's ``from_config`` is then called. Parameters ---------- cp : WorkflowConfigParser Config p...
def n_join(self, other, psi=-40.76, omega=-178.25, phi=-65.07, o_c_n_angle=None, c_n_ca_angle=None, c_n_length=None, relabel=True): """Joins other to self at the N-terminus via a peptide bond. Notes ----- This function directly modifies self. It does not return a new obje...
def function[n_join, parameter[self, other, psi, omega, phi, o_c_n_angle, c_n_ca_angle, c_n_length, relabel]]: constant[Joins other to self at the N-terminus via a peptide bond. Notes ----- This function directly modifies self. It does not return a new object. Parameters ...
keyword[def] identifier[n_join] ( identifier[self] , identifier[other] , identifier[psi] =- literal[int] , identifier[omega] =- literal[int] , identifier[phi] =- literal[int] , identifier[o_c_n_angle] = keyword[None] , identifier[c_n_ca_angle] = keyword[None] , identifier[c_n_length] = keyword[None] , identifier[rel...
def n_join(self, other, psi=-40.76, omega=-178.25, phi=-65.07, o_c_n_angle=None, c_n_ca_angle=None, c_n_length=None, relabel=True): """Joins other to self at the N-terminus via a peptide bond. Notes ----- This function directly modifies self. It does not return a new object. Parame...
def clear_cache(backend=None): ''' .. versionadded:: 2015.5.0 Clear the fileserver cache from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). Executing this runner with no arguments will clear the cache for all ...
def function[clear_cache, parameter[backend]]: constant[ .. versionadded:: 2015.5.0 Clear the fileserver cache from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). Executing this runner with no arguments will ...
keyword[def] identifier[clear_cache] ( identifier[backend] = keyword[None] ): literal[string] identifier[fileserver] = identifier[salt] . identifier[fileserver] . identifier[Fileserver] ( identifier[__opts__] ) identifier[cleared] , identifier[errors] = identifier[fileserver] . identifier[clear_cache]...
def clear_cache(backend=None): """ .. versionadded:: 2015.5.0 Clear the fileserver cache from VCS fileserver backends (:mod:`git <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.svnfs>`). Executing this runner with no arguments will clear the cache for all ...
def delete_preferences(queryset): """ Delete preferences objects if they are not present in registry. Return a list of deleted objects """ deleted = [] # Iterate through preferences. If an error is raised when accessing preference object, just delete it for p in queryset: try: ...
def function[delete_preferences, parameter[queryset]]: constant[ Delete preferences objects if they are not present in registry. Return a list of deleted objects ] variable[deleted] assign[=] list[[]] for taget[name[p]] in starred[name[queryset]] begin[:] <ast.Try object at 0x7da...
keyword[def] identifier[delete_preferences] ( identifier[queryset] ): literal[string] identifier[deleted] =[] keyword[for] identifier[p] keyword[in] identifier[queryset] : keyword[try] : identifier[pref] = identifier[p] . identifier[registry] . identifier[get] ( identifi...
def delete_preferences(queryset): """ Delete preferences objects if they are not present in registry. Return a list of deleted objects """ deleted = [] # Iterate through preferences. If an error is raised when accessing preference object, just delete it for p in queryset: try: ...
def _get_auth_from_keyring(self): """Try to get credentials using `keyring <https://github.com/jaraco/keyring>`_.""" if not keyring: return None # Take user from URL if available, else the OS login name password = self._get_password_from_keyring(self.user or getpass.getuser(...
def function[_get_auth_from_keyring, parameter[self]]: constant[Try to get credentials using `keyring <https://github.com/jaraco/keyring>`_.] if <ast.UnaryOp object at 0x7da204564490> begin[:] return[constant[None]] variable[password] assign[=] call[name[self]._get_password_from_keyring,...
keyword[def] identifier[_get_auth_from_keyring] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[keyring] : keyword[return] keyword[None] identifier[password] = identifier[self] . identifier[_get_password_from_keyring] ( identifier[se...
def _get_auth_from_keyring(self): """Try to get credentials using `keyring <https://github.com/jaraco/keyring>`_.""" if not keyring: return None # depends on [control=['if'], data=[]] # Take user from URL if available, else the OS login name password = self._get_password_from_keyring(self.user ...
def cluster_application_attempt_info(self, application_id, attempt_id): """ With the application attempts API, you can obtain an extended info about an application attempt. :param str application_id: The application id :param str attempt_id: The attempt id :returns: API ...
def function[cluster_application_attempt_info, parameter[self, application_id, attempt_id]]: constant[ With the application attempts API, you can obtain an extended info about an application attempt. :param str application_id: The application id :param str attempt_id: The attemp...
keyword[def] identifier[cluster_application_attempt_info] ( identifier[self] , identifier[application_id] , identifier[attempt_id] ): literal[string] identifier[path] = literal[string] . identifier[format] ( identifier[appid] = identifier[application_id] , identifier[attemptid] = identifie...
def cluster_application_attempt_info(self, application_id, attempt_id): """ With the application attempts API, you can obtain an extended info about an application attempt. :param str application_id: The application id :param str attempt_id: The attempt id :returns: API resp...
def ReadList(self, *branches, **kwargs): """ Same as `phi.dsl.Expression.List` but any string argument `x` is translated to `Read(x)`. """ branches = map(lambda x: E.Read(x) if isinstance(x, str) else x, branches) return self.List(*branches, **kwargs)
def function[ReadList, parameter[self]]: constant[ Same as `phi.dsl.Expression.List` but any string argument `x` is translated to `Read(x)`. ] variable[branches] assign[=] call[name[map], parameter[<ast.Lambda object at 0x7da207f01330>, name[branches]]] return[call[name[self].List, parameter...
keyword[def] identifier[ReadList] ( identifier[self] ,* identifier[branches] ,** identifier[kwargs] ): literal[string] identifier[branches] = identifier[map] ( keyword[lambda] identifier[x] : identifier[E] . identifier[Read] ( identifier[x] ) keyword[if] identifier[isinstance] ( identifier[x] , i...
def ReadList(self, *branches, **kwargs): """ Same as `phi.dsl.Expression.List` but any string argument `x` is translated to `Read(x)`. """ branches = map(lambda x: E.Read(x) if isinstance(x, str) else x, branches) return self.List(*branches, **kwargs)
def kill(arg1, arg2): """Stops a proces that contains arg1 and is filtered by arg2 """ from subprocess import Popen, PIPE # Wait until ready t0 = time.time() # Wait no more than these many seconds time_out = 30 running = True while running and time.time() - t0 < time_out: i...
def function[kill, parameter[arg1, arg2]]: constant[Stops a proces that contains arg1 and is filtered by arg2 ] from relative_module[subprocess] import module[Popen], module[PIPE] variable[t0] assign[=] call[name[time].time, parameter[]] variable[time_out] assign[=] constant[30] ...
keyword[def] identifier[kill] ( identifier[arg1] , identifier[arg2] ): literal[string] keyword[from] identifier[subprocess] keyword[import] identifier[Popen] , identifier[PIPE] identifier[t0] = identifier[time] . identifier[time] () identifier[time_out] = literal[int] identif...
def kill(arg1, arg2): """Stops a proces that contains arg1 and is filtered by arg2 """ from subprocess import Popen, PIPE # Wait until ready t0 = time.time() # Wait no more than these many seconds time_out = 30 running = True while running and time.time() - t0 < time_out: if ...
def erase_disk_partitions(disk_id=None, scsi_address=None, service_instance=None): ''' Erases the partitions on a disk. The disk can be specified either by the canonical name, or by the scsi_address. disk_id Canonical name of the disk. Either ``disk_id`` or...
def function[erase_disk_partitions, parameter[disk_id, scsi_address, service_instance]]: constant[ Erases the partitions on a disk. The disk can be specified either by the canonical name, or by the scsi_address. disk_id Canonical name of the disk. Either ``disk_id`` or ``scsi_ad...
keyword[def] identifier[erase_disk_partitions] ( identifier[disk_id] = keyword[None] , identifier[scsi_address] = keyword[None] , identifier[service_instance] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[disk_id] keyword[and] keyword[not] identifier[scsi_address] : ...
def erase_disk_partitions(disk_id=None, scsi_address=None, service_instance=None): """ Erases the partitions on a disk. The disk can be specified either by the canonical name, or by the scsi_address. disk_id Canonical name of the disk. Either ``disk_id`` or ``scsi_address`` needs to...
def accept(self): """Method invoked when OK button is clicked.""" output_path = self.output_path_line_edit.text() if not output_path: display_warning_message_box( self, tr('Empty Output Path'), tr('Output path can not be empty')) ...
def function[accept, parameter[self]]: constant[Method invoked when OK button is clicked.] variable[output_path] assign[=] call[name[self].output_path_line_edit.text, parameter[]] if <ast.UnaryOp object at 0x7da204345f00> begin[:] call[name[display_warning_message_box], parameter...
keyword[def] identifier[accept] ( identifier[self] ): literal[string] identifier[output_path] = identifier[self] . identifier[output_path_line_edit] . identifier[text] () keyword[if] keyword[not] identifier[output_path] : identifier[display_warning_message_box] ( ...
def accept(self): """Method invoked when OK button is clicked.""" output_path = self.output_path_line_edit.text() if not output_path: display_warning_message_box(self, tr('Empty Output Path'), tr('Output path can not be empty')) return # depends on [control=['if'], data=[]] try: ...
def get_files_from_filestore(job, files, work_dir, cache=True, docker=False): """ This is adapted from John Vivian's return_input_paths from the RNA-Seq pipeline. Returns the paths of files from the FileStore if they are not present. If docker=True, return the docker path for the file. If the file ...
def function[get_files_from_filestore, parameter[job, files, work_dir, cache, docker]]: constant[ This is adapted from John Vivian's return_input_paths from the RNA-Seq pipeline. Returns the paths of files from the FileStore if they are not present. If docker=True, return the docker path for the fi...
keyword[def] identifier[get_files_from_filestore] ( identifier[job] , identifier[files] , identifier[work_dir] , identifier[cache] = keyword[True] , identifier[docker] = keyword[False] ): literal[string] keyword[for] identifier[name] keyword[in] identifier[files] . identifier[keys] (): identifi...
def get_files_from_filestore(job, files, work_dir, cache=True, docker=False): """ This is adapted from John Vivian's return_input_paths from the RNA-Seq pipeline. Returns the paths of files from the FileStore if they are not present. If docker=True, return the docker path for the file. If the file ...
def invert_projection(self, X, identities): """ Calculate the inverted projection. The inverted projectio of a SOM is created by association each weight with the input which matches it the most, thus giving a good approximation of the "influence" of each input item. Wor...
def function[invert_projection, parameter[self, X, identities]]: constant[ Calculate the inverted projection. The inverted projectio of a SOM is created by association each weight with the input which matches it the most, thus giving a good approximation of the "influence" of ea...
keyword[def] identifier[invert_projection] ( identifier[self] , identifier[X] , identifier[identities] ): literal[string] identifier[distances] = identifier[self] . identifier[transform] ( identifier[X] ) keyword[if] identifier[len] ( identifier[distances] )!= identifier[len] ( identifie...
def invert_projection(self, X, identities): """ Calculate the inverted projection. The inverted projectio of a SOM is created by association each weight with the input which matches it the most, thus giving a good approximation of the "influence" of each input item. Works b...
def has_public_constructor(class_): """if class has any public constructor, this function will return list of them, otherwise None""" class_ = class_traits.get_declaration(class_) decls = class_.constructors( lambda c: not is_copy_constructor(c) and c.access_type == 'public', recursive=F...
def function[has_public_constructor, parameter[class_]]: constant[if class has any public constructor, this function will return list of them, otherwise None] variable[class_] assign[=] call[name[class_traits].get_declaration, parameter[name[class_]]] variable[decls] assign[=] call[name[clas...
keyword[def] identifier[has_public_constructor] ( identifier[class_] ): literal[string] identifier[class_] = identifier[class_traits] . identifier[get_declaration] ( identifier[class_] ) identifier[decls] = identifier[class_] . identifier[constructors] ( keyword[lambda] identifier[c] : keyword[n...
def has_public_constructor(class_): """if class has any public constructor, this function will return list of them, otherwise None""" class_ = class_traits.get_declaration(class_) decls = class_.constructors(lambda c: not is_copy_constructor(c) and c.access_type == 'public', recursive=False, allow_empty...
def emit(self, record): """Emit record after checking if message triggers later sending of e-mail.""" if self.triggerLevelNo is not None and record.levelno>=self.triggerLevelNo: self.triggered = True logging.handlers.BufferingHandler.emit(self,record)
def function[emit, parameter[self, record]]: constant[Emit record after checking if message triggers later sending of e-mail.] if <ast.BoolOp object at 0x7da1b2677880> begin[:] name[self].triggered assign[=] constant[True] call[name[logging].handlers.BufferingHandler.emit, parame...
keyword[def] identifier[emit] ( identifier[self] , identifier[record] ): literal[string] keyword[if] identifier[self] . identifier[triggerLevelNo] keyword[is] keyword[not] keyword[None] keyword[and] identifier[record] . identifier[levelno] >= identifier[self] . identifier[triggerLevelNo] : ...
def emit(self, record): """Emit record after checking if message triggers later sending of e-mail.""" if self.triggerLevelNo is not None and record.levelno >= self.triggerLevelNo: self.triggered = True # depends on [control=['if'], data=[]] logging.handlers.BufferingHandler.emit(self, record)
def _create_repo(self, args): ''' Scan a directory and create an SPM-METADATA file which describes all of the SPM files in that directory. ''' if len(args) < 2: raise SPMInvocationError('A path to a directory must be specified') if args[1] == '.': ...
def function[_create_repo, parameter[self, args]]: constant[ Scan a directory and create an SPM-METADATA file which describes all of the SPM files in that directory. ] if compare[call[name[len], parameter[name[args]]] less[<] constant[2]] begin[:] <ast.Raise object at 0x7...
keyword[def] identifier[_create_repo] ( identifier[self] , identifier[args] ): literal[string] keyword[if] identifier[len] ( identifier[args] )< literal[int] : keyword[raise] identifier[SPMInvocationError] ( literal[string] ) keyword[if] identifier[args] [ literal[int] ]==...
def _create_repo(self, args): """ Scan a directory and create an SPM-METADATA file which describes all of the SPM files in that directory. """ if len(args) < 2: raise SPMInvocationError('A path to a directory must be specified') # depends on [control=['if'], data=[]] if args...
def load(self, val, **kwargs): """ Load the file contents into the supplied pandas dataframe or HoloViews Table. This allows a selection to be made over the metadata before loading the file contents (may be slow). """ if Table and isinstance(val, Table): retur...
def function[load, parameter[self, val]]: constant[ Load the file contents into the supplied pandas dataframe or HoloViews Table. This allows a selection to be made over the metadata before loading the file contents (may be slow). ] if <ast.BoolOp object at 0x7da1afe0e770...
keyword[def] identifier[load] ( identifier[self] , identifier[val] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[Table] keyword[and] identifier[isinstance] ( identifier[val] , identifier[Table] ): keyword[return] identifier[self] . identifier[load_table] ( identi...
def load(self, val, **kwargs): """ Load the file contents into the supplied pandas dataframe or HoloViews Table. This allows a selection to be made over the metadata before loading the file contents (may be slow). """ if Table and isinstance(val, Table): return self.load_...
def _check_input_files(nspc, parser): """check filename args. otherwise if one of the 3 filenames is bad it's hard to tell which one""" if not len(nspc.filenames) == 3: parser.print_help() msg = """ 3 Expected files; Expected content: study population association", ...
def function[_check_input_files, parameter[nspc, parser]]: constant[check filename args. otherwise if one of the 3 filenames is bad it's hard to tell which one] if <ast.UnaryOp object at 0x7da18bc70430> begin[:] call[name[parser].print_help, parameter[]] variable[...
keyword[def] identifier[_check_input_files] ( identifier[nspc] , identifier[parser] ): literal[string] keyword[if] keyword[not] identifier[len] ( identifier[nspc] . identifier[filenames] )== literal[int] : identifier[parser] . identifier[print_help] () identifier[msg] = ...
def _check_input_files(nspc, parser): """check filename args. otherwise if one of the 3 filenames is bad it's hard to tell which one""" if not len(nspc.filenames) == 3: parser.print_help() msg = '\n 3 Expected files; Expected content: study population association",\n {} Actual ...
def set(self, property_dict): """Attempts to set the given properties of the object. An example of this is setting the nickname of the object:: cdb.set({"nickname": "My new nickname"}) note that there is a convenience property `cdb.nickname` that allows you to get/set the nic...
def function[set, parameter[self, property_dict]]: constant[Attempts to set the given properties of the object. An example of this is setting the nickname of the object:: cdb.set({"nickname": "My new nickname"}) note that there is a convenience property `cdb.nickname` that allows y...
keyword[def] identifier[set] ( identifier[self] , identifier[property_dict] ): literal[string] identifier[self] . identifier[metadata] = identifier[self] . identifier[db] . identifier[update] ( identifier[self] . identifier[path] , identifier[property_dict] ). identifier[json] ()
def set(self, property_dict): """Attempts to set the given properties of the object. An example of this is setting the nickname of the object:: cdb.set({"nickname": "My new nickname"}) note that there is a convenience property `cdb.nickname` that allows you to get/set the nickname dire...
def required_length(nmin, nmax): """ For use with argparse's action argument. Allows setting a range for nargs. Example: nargs='+', action=required_length(2, 3) :param int nmin: Minimum number of arguments :param int nmax: Maximum number of arguments :return: RequiredLength object """ c...
def function[required_length, parameter[nmin, nmax]]: constant[ For use with argparse's action argument. Allows setting a range for nargs. Example: nargs='+', action=required_length(2, 3) :param int nmin: Minimum number of arguments :param int nmax: Maximum number of arguments :return: Requ...
keyword[def] identifier[required_length] ( identifier[nmin] , identifier[nmax] ): literal[string] keyword[class] identifier[RequiredLength] ( identifier[argparse] . identifier[Action] ): keyword[def] identifier[__call__] ( identifier[self] , identifier[parser] , identifier[args] , identifier[val...
def required_length(nmin, nmax): """ For use with argparse's action argument. Allows setting a range for nargs. Example: nargs='+', action=required_length(2, 3) :param int nmin: Minimum number of arguments :param int nmax: Maximum number of arguments :return: RequiredLength object """ ...
def grant_authority(self, column=None, value=None, **kwargs): """Many-to-many table connecting grants and authority.""" return self._resolve_call('GIC_GRANT_AUTH', column, value, **kwargs)
def function[grant_authority, parameter[self, column, value]]: constant[Many-to-many table connecting grants and authority.] return[call[name[self]._resolve_call, parameter[constant[GIC_GRANT_AUTH], name[column], name[value]]]]
keyword[def] identifier[grant_authority] ( identifier[self] , identifier[column] = keyword[None] , identifier[value] = keyword[None] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[_resolve_call] ( literal[string] , identifier[column] , identifier[value] ,**...
def grant_authority(self, column=None, value=None, **kwargs): """Many-to-many table connecting grants and authority.""" return self._resolve_call('GIC_GRANT_AUTH', column, value, **kwargs)
def read_meta(self, **kwargs): ''' Read only the annotation of the FCS file (without reading DATA segment). It's advised not to use this method, but instead to access the meta data through the FCMeasurement.meta attribute. ''' # TODO Try to rewrite the code to be more lo...
def function[read_meta, parameter[self]]: constant[ Read only the annotation of the FCS file (without reading DATA segment). It's advised not to use this method, but instead to access the meta data through the FCMeasurement.meta attribute. ] if compare[constant[channel_n...
keyword[def] identifier[read_meta] ( identifier[self] ,** identifier[kwargs] ): literal[string] keyword[if] literal[string] keyword[in] identifier[self] . identifier[readdata_kwargs] : identifier[kwargs] [ literal[string] ]= identifier[self] . ide...
def read_meta(self, **kwargs): """ Read only the annotation of the FCS file (without reading DATA segment). It's advised not to use this method, but instead to access the meta data through the FCMeasurement.meta attribute. """ # TODO Try to rewrite the code to be more logical ...
def process_all_json_files(build_dir): """Return a list of pages to index""" html_files = [] for root, _, files in os.walk(build_dir): for filename in fnmatch.filter(files, '*.fjson'): if filename in ['search.fjson', 'genindex.fjson', 'py-modindex.fjson']: ...
def function[process_all_json_files, parameter[build_dir]]: constant[Return a list of pages to index] variable[html_files] assign[=] list[[]] for taget[tuple[[<ast.Name object at 0x7da1b16aabc0>, <ast.Name object at 0x7da1b16a9e10>, <ast.Name object at 0x7da1b16a8580>]]] in starred[call[name[os]...
keyword[def] identifier[process_all_json_files] ( identifier[build_dir] ): literal[string] identifier[html_files] =[] keyword[for] identifier[root] , identifier[_] , identifier[files] keyword[in] identifier[os] . identifier[walk] ( identifier[build_dir] ): keyword[for] identifier[filename...
def process_all_json_files(build_dir): """Return a list of pages to index""" html_files = [] for (root, _, files) in os.walk(build_dir): for filename in fnmatch.filter(files, '*.fjson'): if filename in ['search.fjson', 'genindex.fjson', 'py-modindex.fjson']: continue # d...
async def stop(self): """Stop the current task process. Starts with SIGTERM, gives the process 1 second to terminate, then kills it """ # negate pid so that signals apply to process group pgid = -self.process.pid try: os.kill(pgid, signal.SIGTERM) ...
<ast.AsyncFunctionDef object at 0x7da1b0e9ece0>
keyword[async] keyword[def] identifier[stop] ( identifier[self] ): literal[string] identifier[pgid] =- identifier[self] . identifier[process] . identifier[pid] keyword[try] : identifier[os] . identifier[kill] ( identifier[pgid] , identifier[signal] . identifier[SIGT...
async def stop(self): """Stop the current task process. Starts with SIGTERM, gives the process 1 second to terminate, then kills it """ # negate pid so that signals apply to process group pgid = -self.process.pid try: os.kill(pgid, signal.SIGTERM) await asyncio.sleep(1) ...
def get_requires_for_build_sdist(config_settings): """Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined. """ backend = _build_backend() try: hook = backend.get_requires_for_build_sdist except AttributeError: return [] else: r...
def function[get_requires_for_build_sdist, parameter[config_settings]]: constant[Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined. ] variable[backend] assign[=] call[name[_build_backend], parameter[]] <ast.Try object at 0x7da2041d99f0>
keyword[def] identifier[get_requires_for_build_sdist] ( identifier[config_settings] ): literal[string] identifier[backend] = identifier[_build_backend] () keyword[try] : identifier[hook] = identifier[backend] . identifier[get_requires_for_build_sdist] keyword[except] identifier[Attribu...
def get_requires_for_build_sdist(config_settings): """Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined. """ backend = _build_backend() try: hook = backend.get_requires_for_build_sdist # depends on [control=['try'], data=[]] except AttributeErr...
def end(self): """ Ends the response. Useful for quickly ending connection with no data sent """ self.send_headers() self.write() self.write_eof() self.has_ended = True
def function[end, parameter[self]]: constant[ Ends the response. Useful for quickly ending connection with no data sent ] call[name[self].send_headers, parameter[]] call[name[self].write, parameter[]] call[name[self].write_eof, parameter[]] name[self].has_...
keyword[def] identifier[end] ( identifier[self] ): literal[string] identifier[self] . identifier[send_headers] () identifier[self] . identifier[write] () identifier[self] . identifier[write_eof] () identifier[self] . identifier[has_ended] = keyword[True]
def end(self): """ Ends the response. Useful for quickly ending connection with no data sent """ self.send_headers() self.write() self.write_eof() self.has_ended = True
def convert_to_mosek(sdp): """Convert an SDP relaxation to a MOSEK task. :param sdp: The SDP relaxation to convert. :type sdp: :class:`ncpol2sdpa.sdp`. :returns: :class:`mosek.Task`. """ import mosek # Cheat when variables are complex and convert with PICOS if sdp.complex_matrix: ...
def function[convert_to_mosek, parameter[sdp]]: constant[Convert an SDP relaxation to a MOSEK task. :param sdp: The SDP relaxation to convert. :type sdp: :class:`ncpol2sdpa.sdp`. :returns: :class:`mosek.Task`. ] import module[mosek] if name[sdp].complex_matrix begin[:] from...
keyword[def] identifier[convert_to_mosek] ( identifier[sdp] ): literal[string] keyword[import] identifier[mosek] keyword[if] identifier[sdp] . identifier[complex_matrix] : keyword[from] . identifier[picos_utils] keyword[import] identifier[convert_to_picos] identifier[Probl...
def convert_to_mosek(sdp): """Convert an SDP relaxation to a MOSEK task. :param sdp: The SDP relaxation to convert. :type sdp: :class:`ncpol2sdpa.sdp`. :returns: :class:`mosek.Task`. """ import mosek # Cheat when variables are complex and convert with PICOS if sdp.complex_matrix: ...
def load_sst(path=None, url='http://nlp.stanford.edu/sentiment/trainDevTestTrees_PTB.zip'): """ Download and read in the Stanford Sentiment Treebank dataset into a dictionary with a 'train', 'dev', and 'test' keys. The dictionary keys point to lists of LabeledTrees. Arguments: ----...
def function[load_sst, parameter[path, url]]: constant[ Download and read in the Stanford Sentiment Treebank dataset into a dictionary with a 'train', 'dev', and 'test' keys. The dictionary keys point to lists of LabeledTrees. Arguments: ---------- path : str, (optional defaults to ...
keyword[def] identifier[load_sst] ( identifier[path] = keyword[None] , identifier[url] = literal[string] ): literal[string] keyword[if] identifier[path] keyword[is] keyword[None] : identifier[path] = identifier[os] . identifier[path] . identifier[expanduser] ( literal[string] ) i...
def load_sst(path=None, url='http://nlp.stanford.edu/sentiment/trainDevTestTrees_PTB.zip'): """ Download and read in the Stanford Sentiment Treebank dataset into a dictionary with a 'train', 'dev', and 'test' keys. The dictionary keys point to lists of LabeledTrees. Arguments: ---------- ...
def find_similar(self, doc, min_score=0.0, max_results=100): """ Find `max_results` most similar articles in the index, each having similarity score of at least `min_score`. The resulting list may be shorter than `max_results`, in case there are not enough matching documents. `d...
def function[find_similar, parameter[self, doc, min_score, max_results]]: constant[ Find `max_results` most similar articles in the index, each having similarity score of at least `min_score`. The resulting list may be shorter than `max_results`, in case there are not enough matching doc...
keyword[def] identifier[find_similar] ( identifier[self] , identifier[doc] , identifier[min_score] = literal[int] , identifier[max_results] = literal[int] ): literal[string] identifier[logger] . identifier[debug] ( literal[string] % identifier[doc] ) keyword[if] identifier[self] . identif...
def find_similar(self, doc, min_score=0.0, max_results=100): """ Find `max_results` most similar articles in the index, each having similarity score of at least `min_score`. The resulting list may be shorter than `max_results`, in case there are not enough matching documents. `doc` ...
def parse_config(config, env, as_dict=True): """ Parse a config from a magic cell body. This could be JSON or YAML. We turn it into a Python dictionary then recursively replace any variable references using the supplied env dictionary. """ if config is None: return None stripped = config.strip(...
def function[parse_config, parameter[config, env, as_dict]]: constant[ Parse a config from a magic cell body. This could be JSON or YAML. We turn it into a Python dictionary then recursively replace any variable references using the supplied env dictionary. ] if compare[name[config] is con...
keyword[def] identifier[parse_config] ( identifier[config] , identifier[env] , identifier[as_dict] = keyword[True] ): literal[string] keyword[if] identifier[config] keyword[is] keyword[None] : keyword[return] keyword[None] identifier[stripped] = identifier[config] . identifier[strip] () keywor...
def parse_config(config, env, as_dict=True): """ Parse a config from a magic cell body. This could be JSON or YAML. We turn it into a Python dictionary then recursively replace any variable references using the supplied env dictionary. """ if config is None: return None # depends on [cont...
def hsl(self, *args): """ Translate hsl(...) to color string raises: ValueError returns: str """ if len(args) == 4: return self.hsla(*args) elif len(args) == 3: h, s, l = args rgb = colorsys.hls_to_rgb( ...
def function[hsl, parameter[self]]: constant[ Translate hsl(...) to color string raises: ValueError returns: str ] if compare[call[name[len], parameter[name[args]]] equal[==] constant[4]] begin[:] return[call[name[self].hsla, parameter[<ast.Starred...
keyword[def] identifier[hsl] ( identifier[self] ,* identifier[args] ): literal[string] keyword[if] identifier[len] ( identifier[args] )== literal[int] : keyword[return] identifier[self] . identifier[hsla] (* identifier[args] ) keyword[elif] identifier[len] ( identifier[args...
def hsl(self, *args): """ Translate hsl(...) to color string raises: ValueError returns: str """ if len(args) == 4: return self.hsla(*args) # depends on [control=['if'], data=[]] elif len(args) == 3: (h, s, l) = args rgb = colorsys.hls...
def summary(args): """ %prog summary input.bed scaffolds.fasta Print out summary statistics per map, followed by consensus summary of scaffold anchoring based on multiple maps. """ p = OptionParser(summary.__doc__) p.set_table(sep="|", align=True) p.set_outfile() opts, args = p.pars...
def function[summary, parameter[args]]: constant[ %prog summary input.bed scaffolds.fasta Print out summary statistics per map, followed by consensus summary of scaffold anchoring based on multiple maps. ] variable[p] assign[=] call[name[OptionParser], parameter[name[summary].__doc__]] ...
keyword[def] identifier[summary] ( identifier[args] ): literal[string] identifier[p] = identifier[OptionParser] ( identifier[summary] . identifier[__doc__] ) identifier[p] . identifier[set_table] ( identifier[sep] = literal[string] , identifier[align] = keyword[True] ) identifier[p] . identifier[...
def summary(args): """ %prog summary input.bed scaffolds.fasta Print out summary statistics per map, followed by consensus summary of scaffold anchoring based on multiple maps. """ p = OptionParser(summary.__doc__) p.set_table(sep='|', align=True) p.set_outfile() (opts, args) = p.pa...
def merge(self, other): """Merges a set of build file aliases and returns a new set of aliases containing both. Any duplicate aliases from `other` will trump. :API: public :param other: The BuildFileAliases to merge in. :type other: :class:`BuildFileAliases` :returns: A new BuildFileAliases c...
def function[merge, parameter[self, other]]: constant[Merges a set of build file aliases and returns a new set of aliases containing both. Any duplicate aliases from `other` will trump. :API: public :param other: The BuildFileAliases to merge in. :type other: :class:`BuildFileAliases` :re...
keyword[def] identifier[merge] ( identifier[self] , identifier[other] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[other] , identifier[BuildFileAliases] ): keyword[raise] identifier[TypeError] ( literal[string] . identifier[format] ( identifier[other] )) k...
def merge(self, other): """Merges a set of build file aliases and returns a new set of aliases containing both. Any duplicate aliases from `other` will trump. :API: public :param other: The BuildFileAliases to merge in. :type other: :class:`BuildFileAliases` :returns: A new BuildFileAliases c...
def s_supply(self, bus): """ Returns the total complex power generation capacity. """ Sg = array([complex(g.p, g.q) for g in self.generators if (g.bus == bus) and not g.is_load], dtype=complex64) if len(Sg): return sum(Sg) else: return ...
def function[s_supply, parameter[self, bus]]: constant[ Returns the total complex power generation capacity. ] variable[Sg] assign[=] call[name[array], parameter[<ast.ListComp object at 0x7da1b25d1ae0>]] if call[name[len], parameter[name[Sg]]] begin[:] return[call[name[sum], para...
keyword[def] identifier[s_supply] ( identifier[self] , identifier[bus] ): literal[string] identifier[Sg] = identifier[array] ([ identifier[complex] ( identifier[g] . identifier[p] , identifier[g] . identifier[q] ) keyword[for] identifier[g] keyword[in] identifier[self] . identifier[generators] ...
def s_supply(self, bus): """ Returns the total complex power generation capacity. """ Sg = array([complex(g.p, g.q) for g in self.generators if g.bus == bus and (not g.is_load)], dtype=complex64) if len(Sg): return sum(Sg) # depends on [control=['if'], data=[]] else: return 0 + ...
def check_environment_presets(): """ Checks for environment variables that can cause problems with supernova """ presets = [x for x in os.environ.copy().keys() if x.startswith('NOVA_') or x.startswith('OS_')] if len(presets) < 1: return True else: click.echo("_" * ...
def function[check_environment_presets, parameter[]]: constant[ Checks for environment variables that can cause problems with supernova ] variable[presets] assign[=] <ast.ListComp object at 0x7da1b27e2050> if compare[call[name[len], parameter[name[presets]]] less[<] constant[1]] begin[:]...
keyword[def] identifier[check_environment_presets] (): literal[string] identifier[presets] =[ identifier[x] keyword[for] identifier[x] keyword[in] identifier[os] . identifier[environ] . identifier[copy] (). identifier[keys] () keyword[if] identifier[x] . identifier[startswith] ( literal[string] ) keyw...
def check_environment_presets(): """ Checks for environment variables that can cause problems with supernova """ presets = [x for x in os.environ.copy().keys() if x.startswith('NOVA_') or x.startswith('OS_')] if len(presets) < 1: return True # depends on [control=['if'], data=[]] else: ...
def remove_interface_router(self, router, body=None): """Removes an internal network interface from the specified router.""" return self.put((self.router_path % router) + "/remove_router_interface", body=body)
def function[remove_interface_router, parameter[self, router, body]]: constant[Removes an internal network interface from the specified router.] return[call[name[self].put, parameter[binary_operation[binary_operation[name[self].router_path <ast.Mod object at 0x7da2590d6920> name[router]] + constant[/remove_...
keyword[def] identifier[remove_interface_router] ( identifier[self] , identifier[router] , identifier[body] = keyword[None] ): literal[string] keyword[return] identifier[self] . identifier[put] (( identifier[self] . identifier[router_path] % identifier[router] )+ literal[string] , identif...
def remove_interface_router(self, router, body=None): """Removes an internal network interface from the specified router.""" return self.put(self.router_path % router + '/remove_router_interface', body=body)
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ sites.vs30 = 700 * np.ones(len(sites.vs30)) mean, stddevs = ...
def function[get_mean_and_stddevs, parameter[self, sites, rup, dists, imt, stddev_types]]: constant[ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. ] name[sites].vs30 assign[=] binary_operation[c...
keyword[def] identifier[get_mean_and_stddevs] ( identifier[self] , identifier[sites] , identifier[rup] , identifier[dists] , identifier[imt] , identifier[stddev_types] ): literal[string] identifier[sites] . identifier[vs30] = literal[int] * identifier[np] . identifier[ones] ( identifier[len] ( ide...
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ sites.vs30 = 700 * np.ones(len(sites.vs30)) (mean, stddevs) = super().get_...
def method_not_allowed(cls, errors=None): """Shortcut API for HTTP 405 `Method not allowed` response. Args: errors (list): Response key/value data. Returns: WSResponse Instance. """ if cls.expose_status: # pragma: no cover cls.response.conte...
def function[method_not_allowed, parameter[cls, errors]]: constant[Shortcut API for HTTP 405 `Method not allowed` response. Args: errors (list): Response key/value data. Returns: WSResponse Instance. ] if name[cls].expose_status begin[:] ...
keyword[def] identifier[method_not_allowed] ( identifier[cls] , identifier[errors] = keyword[None] ): literal[string] keyword[if] identifier[cls] . identifier[expose_status] : identifier[cls] . identifier[response] . identifier[content_type] = literal[string] identifier[...
def method_not_allowed(cls, errors=None): """Shortcut API for HTTP 405 `Method not allowed` response. Args: errors (list): Response key/value data. Returns: WSResponse Instance. """ if cls.expose_status: # pragma: no cover cls.response.content_type = 'a...
def install_notebook_hook(notebook_type, load, show_doc, show_app, overwrite=False): ''' Install a new notebook display hook. Bokeh comes with support for Jupyter notebooks built-in. However, there are other kinds of notebooks in use by different communities. This function provides a mechanism for othe...
def function[install_notebook_hook, parameter[notebook_type, load, show_doc, show_app, overwrite]]: constant[ Install a new notebook display hook. Bokeh comes with support for Jupyter notebooks built-in. However, there are other kinds of notebooks in use by different communities. This function prov...
keyword[def] identifier[install_notebook_hook] ( identifier[notebook_type] , identifier[load] , identifier[show_doc] , identifier[show_app] , identifier[overwrite] = keyword[False] ): literal[string] keyword[if] identifier[notebook_type] keyword[in] identifier[_HOOKS] keyword[and] keyword[not] identi...
def install_notebook_hook(notebook_type, load, show_doc, show_app, overwrite=False): """ Install a new notebook display hook. Bokeh comes with support for Jupyter notebooks built-in. However, there are other kinds of notebooks in use by different communities. This function provides a mechanism for othe...
def write_seqinfo(self, out_fp, include_name=True): """ Write a simple seq_info file, suitable for use in taxtastic. Useful for printing out the results of collapsing tax nodes - super bare bones, just tax_id and seqname. If include_name is True, a column with the taxon name is ...
def function[write_seqinfo, parameter[self, out_fp, include_name]]: constant[ Write a simple seq_info file, suitable for use in taxtastic. Useful for printing out the results of collapsing tax nodes - super bare bones, just tax_id and seqname. If include_name is True, a column w...
keyword[def] identifier[write_seqinfo] ( identifier[self] , identifier[out_fp] , identifier[include_name] = keyword[True] ): literal[string] identifier[header] =[ literal[string] , literal[string] ] keyword[if] identifier[include_name] : identifier[header] . identifier[appen...
def write_seqinfo(self, out_fp, include_name=True): """ Write a simple seq_info file, suitable for use in taxtastic. Useful for printing out the results of collapsing tax nodes - super bare bones, just tax_id and seqname. If include_name is True, a column with the taxon name is incl...
def host_key_checking(enable): """ Temporarily disables host_key_checking, which is set globally. """ def as_string(b): return b and 'True' or 'False' with environment_variable('ANSIBLE_HOST_KEY_CHECKING', as_string(enable)): previous = ansible.constants.HOST_KEY_CHECKING ansible....
def function[host_key_checking, parameter[enable]]: constant[ Temporarily disables host_key_checking, which is set globally. ] def function[as_string, parameter[b]]: return[<ast.BoolOp object at 0x7da1b184bfd0>] with call[name[environment_variable], parameter[constant[ANSIBLE_HOST_KEY_CH...
keyword[def] identifier[host_key_checking] ( identifier[enable] ): literal[string] keyword[def] identifier[as_string] ( identifier[b] ): keyword[return] identifier[b] keyword[and] literal[string] keyword[or] literal[string] keyword[with] identifier[environment_variable] ( literal[st...
def host_key_checking(enable): """ Temporarily disables host_key_checking, which is set globally. """ def as_string(b): return b and 'True' or 'False' with environment_variable('ANSIBLE_HOST_KEY_CHECKING', as_string(enable)): previous = ansible.constants.HOST_KEY_CHECKING ansible.co...
def evaluate(self, genomes, config): """Evaluate the genomes""" if not self.working: self.start() p = 0 for genome_id, genome in genomes: p += 1 self.inqueue.put((genome_id, genome, config)) # assign the fitness back to each genome whi...
def function[evaluate, parameter[self, genomes, config]]: constant[Evaluate the genomes] if <ast.UnaryOp object at 0x7da204564dc0> begin[:] call[name[self].start, parameter[]] variable[p] assign[=] constant[0] for taget[tuple[[<ast.Name object at 0x7da2045661a0>, <ast.Nam...
keyword[def] identifier[evaluate] ( identifier[self] , identifier[genomes] , identifier[config] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[working] : identifier[self] . identifier[start] () identifier[p] = literal[int] keyword[for] i...
def evaluate(self, genomes, config): """Evaluate the genomes""" if not self.working: self.start() # depends on [control=['if'], data=[]] p = 0 for (genome_id, genome) in genomes: p += 1 self.inqueue.put((genome_id, genome, config)) # depends on [control=['for'], data=[]] # ...
def Connect(self, Skype): """Connects this call channel manager instance to Skype. This is the first thing you should do after creating this object. :Parameters: Skype : `Skype` The Skype object. :see: `Disconnect` """ self._Skype = Skype s...
def function[Connect, parameter[self, Skype]]: constant[Connects this call channel manager instance to Skype. This is the first thing you should do after creating this object. :Parameters: Skype : `Skype` The Skype object. :see: `Disconnect` ] name...
keyword[def] identifier[Connect] ( identifier[self] , identifier[Skype] ): literal[string] identifier[self] . identifier[_Skype] = identifier[Skype] identifier[self] . identifier[_Skype] . identifier[RegisterEventHandler] ( literal[string] , identifier[self] . identifier[_CallStatus] ) ...
def Connect(self, Skype): """Connects this call channel manager instance to Skype. This is the first thing you should do after creating this object. :Parameters: Skype : `Skype` The Skype object. :see: `Disconnect` """ self._Skype = Skype self._Skype.R...
def bosonic_constraints(a): """Return a set of constraints that define fermionic ladder operators. :param a: The non-Hermitian variables. :type a: list of :class:`sympy.physics.quantum.operator.Operator`. :returns: a dict of substitutions. """ substitutions = {} for i, ai in enumerate(a): ...
def function[bosonic_constraints, parameter[a]]: constant[Return a set of constraints that define fermionic ladder operators. :param a: The non-Hermitian variables. :type a: list of :class:`sympy.physics.quantum.operator.Operator`. :returns: a dict of substitutions. ] variable[substitu...
keyword[def] identifier[bosonic_constraints] ( identifier[a] ): literal[string] identifier[substitutions] ={} keyword[for] identifier[i] , identifier[ai] keyword[in] identifier[enumerate] ( identifier[a] ): identifier[substitutions] [ identifier[ai] * identifier[Dagger] ( identifier[ai] )]...
def bosonic_constraints(a): """Return a set of constraints that define fermionic ladder operators. :param a: The non-Hermitian variables. :type a: list of :class:`sympy.physics.quantum.operator.Operator`. :returns: a dict of substitutions. """ substitutions = {} for (i, ai) in enumerate(a)...
def windows_dir_format(host_dir, user): """Format a string for the location of the user's folder on the Windows (TJ03) fileserver.""" if user and user.grade: grade = int(user.grade) else: return host_dir if grade in range(9, 13): win_path = "/{}/".format(user.username) else:...
def function[windows_dir_format, parameter[host_dir, user]]: constant[Format a string for the location of the user's folder on the Windows (TJ03) fileserver.] if <ast.BoolOp object at 0x7da1b04bc460> begin[:] variable[grade] assign[=] call[name[int], parameter[name[user].grade]] ...
keyword[def] identifier[windows_dir_format] ( identifier[host_dir] , identifier[user] ): literal[string] keyword[if] identifier[user] keyword[and] identifier[user] . identifier[grade] : identifier[grade] = identifier[int] ( identifier[user] . identifier[grade] ) keyword[else] : ke...
def windows_dir_format(host_dir, user): """Format a string for the location of the user's folder on the Windows (TJ03) fileserver.""" if user and user.grade: grade = int(user.grade) # depends on [control=['if'], data=[]] else: return host_dir if grade in range(9, 13): win_path =...
def _find_v1_settings(self, settings): """Parse a v1 module_settings.json file. V1 is the older file format that requires a modules dictionary with a module_name and modules key that could in theory hold information on multiple modules in a single directory. """ if 'mod...
def function[_find_v1_settings, parameter[self, settings]]: constant[Parse a v1 module_settings.json file. V1 is the older file format that requires a modules dictionary with a module_name and modules key that could in theory hold information on multiple modules in a single directory. ...
keyword[def] identifier[_find_v1_settings] ( identifier[self] , identifier[settings] ): literal[string] keyword[if] literal[string] keyword[in] identifier[settings] : identifier[modname] = identifier[settings] [ literal[string] ] keyword[if] literal[string] keyword[not] ...
def _find_v1_settings(self, settings): """Parse a v1 module_settings.json file. V1 is the older file format that requires a modules dictionary with a module_name and modules key that could in theory hold information on multiple modules in a single directory. """ if 'module_name'...
def receive_empty(self, message): """ Pair ACKs with requests. :type message: Message :param message: the received message :rtype : Transaction :return: the transaction to which the message belongs to """ logger.debug("receive_empty - " + str(message)) ...
def function[receive_empty, parameter[self, message]]: constant[ Pair ACKs with requests. :type message: Message :param message: the received message :rtype : Transaction :return: the transaction to which the message belongs to ] call[name[logger].debug, ...
keyword[def] identifier[receive_empty] ( identifier[self] , identifier[message] ): literal[string] identifier[logger] . identifier[debug] ( literal[string] + identifier[str] ( identifier[message] )) keyword[try] : identifier[host] , identifier[port] = identifier[message] . ide...
def receive_empty(self, message): """ Pair ACKs with requests. :type message: Message :param message: the received message :rtype : Transaction :return: the transaction to which the message belongs to """ logger.debug('receive_empty - ' + str(message)) try: ...
def filter_zone(self, data): """Check if a zone is private""" if self.private_zone is not None: if data['Config']['PrivateZone'] != self.str2bool(self.private_zone): return False if data['Name'] != '{0}.'.format(self.domain): return False return ...
def function[filter_zone, parameter[self, data]]: constant[Check if a zone is private] if compare[name[self].private_zone is_not constant[None]] begin[:] if compare[call[call[name[data]][constant[Config]]][constant[PrivateZone]] not_equal[!=] call[name[self].str2bool, parameter[name[self...
keyword[def] identifier[filter_zone] ( identifier[self] , identifier[data] ): literal[string] keyword[if] identifier[self] . identifier[private_zone] keyword[is] keyword[not] keyword[None] : keyword[if] identifier[data] [ literal[string] ][ literal[string] ]!= identifier[self] . i...
def filter_zone(self, data): """Check if a zone is private""" if self.private_zone is not None: if data['Config']['PrivateZone'] != self.str2bool(self.private_zone): return False # depends on [control=['if'], data=[]] # depends on [control=['if'], data=[]] if data['Name'] != '{0}.'.for...
def to_type(upcast_type, varlist): """Loop over all elements of varlist and convert them to upcasttype. Parameters ---------- upcast_type : data type e.g. complex, float64 or complex128 varlist : list list may contain arrays, mat's, sparse matrices, or scalars the elements m...
def function[to_type, parameter[upcast_type, varlist]]: constant[Loop over all elements of varlist and convert them to upcasttype. Parameters ---------- upcast_type : data type e.g. complex, float64 or complex128 varlist : list list may contain arrays, mat's, sparse matrices, or...
keyword[def] identifier[to_type] ( identifier[upcast_type] , identifier[varlist] ): literal[string] keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[len] ( identifier[varlist] )): keyword[if] identifier[np] . identifier[isscalar] ( identifier[varlist] [ identif...
def to_type(upcast_type, varlist): """Loop over all elements of varlist and convert them to upcasttype. Parameters ---------- upcast_type : data type e.g. complex, float64 or complex128 varlist : list list may contain arrays, mat's, sparse matrices, or scalars the elements m...
def parse(self, string): '''Parse some string to the Grammar. Returns a nodeResult with the following attributes: - is_valid: True when the string is successfully parsed by the Grammar. - pos: position in the string where parsing ended. (this is th...
def function[parse, parameter[self, string]]: constant[Parse some string to the Grammar. Returns a nodeResult with the following attributes: - is_valid: True when the string is successfully parsed by the Grammar. - pos: position in the string where parsing ended. ...
keyword[def] identifier[parse] ( identifier[self] , identifier[string] ): literal[string] identifier[self] . identifier[_string] = identifier[string] identifier[self] . identifier[_expecting] = identifier[Expecting] () identifier[self] . identifier[_cached_kw_match] . identifier[...
def parse(self, string): """Parse some string to the Grammar. Returns a nodeResult with the following attributes: - is_valid: True when the string is successfully parsed by the Grammar. - pos: position in the string where parsing ended. (this is the en...
def event_types(self): """ Raises ------ IndexError When there is no selected rater """ try: events = self.rater.find('events') except AttributeError: raise IndexError('You need to have at least one rater') return [x.ge...
def function[event_types, parameter[self]]: constant[ Raises ------ IndexError When there is no selected rater ] <ast.Try object at 0x7da1b0d76830> return[<ast.ListComp object at 0x7da207f03160>]
keyword[def] identifier[event_types] ( identifier[self] ): literal[string] keyword[try] : identifier[events] = identifier[self] . identifier[rater] . identifier[find] ( literal[string] ) keyword[except] identifier[AttributeError] : keyword[raise] identifier[Inde...
def event_types(self): """ Raises ------ IndexError When there is no selected rater """ try: events = self.rater.find('events') # depends on [control=['try'], data=[]] except AttributeError: raise IndexError('You need to have at least one rater') ...
def manageInputCopies(filelist, **workinplace): """ Creates copies of all input images in a sub-directory. The copies are made prior to any processing being done to the images at all, including updating the WCS keywords. If there are already copies present, they will NOT be overwritten, but instead...
def function[manageInputCopies, parameter[filelist]]: constant[ Creates copies of all input images in a sub-directory. The copies are made prior to any processing being done to the images at all, including updating the WCS keywords. If there are already copies present, they will NOT be overwrit...
keyword[def] identifier[manageInputCopies] ( identifier[filelist] ,** identifier[workinplace] ): literal[string] identifier[workingdir] = identifier[os] . identifier[getcwd] () identifier[origdir] = identifier[os] . identifier[path] . identifier[join] ( identifier[workingdir] , literal...
def manageInputCopies(filelist, **workinplace): """ Creates copies of all input images in a sub-directory. The copies are made prior to any processing being done to the images at all, including updating the WCS keywords. If there are already copies present, they will NOT be overwritten, but instead...
def getVarianceComps(self, univariance=False): """ Return the estimated variance components Args: univariance: Boolean indicator, if True variance components are normalized to sum up to 1 for each trait Returns: variance components of all random effects on all ...
def function[getVarianceComps, parameter[self, univariance]]: constant[ Return the estimated variance components Args: univariance: Boolean indicator, if True variance components are normalized to sum up to 1 for each trait Returns: variance components of all r...
keyword[def] identifier[getVarianceComps] ( identifier[self] , identifier[univariance] = keyword[False] ): literal[string] identifier[RV] = identifier[sp] . identifier[zeros] (( identifier[self] . identifier[P] , identifier[self] . identifier[n_randEffs] )) keyword[for] identifier[term_i]...
def getVarianceComps(self, univariance=False): """ Return the estimated variance components Args: univariance: Boolean indicator, if True variance components are normalized to sum up to 1 for each trait Returns: variance components of all random effects on all phen...
def parse_simplersp(self, tup_tree): """ Parse for SIMPLERSP Element. :: <!ELEMENT SIMPLERSP (METHODRESPONSE | IMETHODRESPONSE)> """ self.check_node(tup_tree, 'SIMPLERSP') child = self.one_child(tup_tree, ('METHODRESPONSE', 'IMETHODRESPONSE')) r...
def function[parse_simplersp, parameter[self, tup_tree]]: constant[ Parse for SIMPLERSP Element. :: <!ELEMENT SIMPLERSP (METHODRESPONSE | IMETHODRESPONSE)> ] call[name[self].check_node, parameter[name[tup_tree], constant[SIMPLERSP]]] variable[child] assign...
keyword[def] identifier[parse_simplersp] ( identifier[self] , identifier[tup_tree] ): literal[string] identifier[self] . identifier[check_node] ( identifier[tup_tree] , literal[string] ) identifier[child] = identifier[self] . identifier[one_child] ( identifier[tup_tree] ,( literal[string...
def parse_simplersp(self, tup_tree): """ Parse for SIMPLERSP Element. :: <!ELEMENT SIMPLERSP (METHODRESPONSE | IMETHODRESPONSE)> """ self.check_node(tup_tree, 'SIMPLERSP') child = self.one_child(tup_tree, ('METHODRESPONSE', 'IMETHODRESPONSE')) return (name(tup_tre...
def calculate_connvectivity_radius(self, amount_clusters, maximum_iterations = 100): """! @brief Calculates connectivity radius of allocation specified amount of clusters using ordering diagram and marks borders of clusters using indexes of values of ordering diagram. @details Parameter 'maxi...
def function[calculate_connvectivity_radius, parameter[self, amount_clusters, maximum_iterations]]: constant[! @brief Calculates connectivity radius of allocation specified amount of clusters using ordering diagram and marks borders of clusters using indexes of values of ordering diagram. @detai...
keyword[def] identifier[calculate_connvectivity_radius] ( identifier[self] , identifier[amount_clusters] , identifier[maximum_iterations] = literal[int] ): literal[string] identifier[maximum_distance] = identifier[max] ( identifier[self] . identifier[__ordering] ) identifier[upper_d...
def calculate_connvectivity_radius(self, amount_clusters, maximum_iterations=100): """! @brief Calculates connectivity radius of allocation specified amount of clusters using ordering diagram and marks borders of clusters using indexes of values of ordering diagram. @details Parameter 'maximum_itera...
def _join_summary_file(data, summary_filename="msd_summary_file.h5"): """ Gets the trackinfo array by joining taste profile to the track summary file """ msd = h5py.File(summary_filename) # create a lookup table of trackid -> position track_lookup = dict((t.encode("utf8"), i) for i, t in enumerate(data...
def function[_join_summary_file, parameter[data, summary_filename]]: constant[ Gets the trackinfo array by joining taste profile to the track summary file ] variable[msd] assign[=] call[name[h5py].File, parameter[name[summary_filename]]] variable[track_lookup] assign[=] call[name[dict], paramete...
keyword[def] identifier[_join_summary_file] ( identifier[data] , identifier[summary_filename] = literal[string] ): literal[string] identifier[msd] = identifier[h5py] . identifier[File] ( identifier[summary_filename] ) identifier[track_lookup] = identifier[dict] (( identifier[t] . identifier[enco...
def _join_summary_file(data, summary_filename='msd_summary_file.h5'): """ Gets the trackinfo array by joining taste profile to the track summary file """ msd = h5py.File(summary_filename) # create a lookup table of trackid -> position track_lookup = dict(((t.encode('utf8'), i) for (i, t) in enumerate(da...
def calculate(self, T, method): r'''Method to calculate surface tension of a liquid at temperature `T` with a given method. This method has no exception handling; see `T_dependent_property` for that. Parameters ---------- T : float Temperature at whi...
def function[calculate, parameter[self, T, method]]: constant[Method to calculate surface tension of a liquid at temperature `T` with a given method. This method has no exception handling; see `T_dependent_property` for that. Parameters ---------- T : float ...
keyword[def] identifier[calculate] ( identifier[self] , identifier[T] , identifier[method] ): literal[string] keyword[if] identifier[method] == identifier[TRCIG] : identifier[Cp] = identifier[TRCCp] ( identifier[T] ,* identifier[self] . identifier[TRCIG_coefs] ) keyword[elif]...
def calculate(self, T, method): """Method to calculate surface tension of a liquid at temperature `T` with a given method. This method has no exception handling; see `T_dependent_property` for that. Parameters ---------- T : float Temperature at which to...
def show_version(a_device): """Execute show version command using Netmiko.""" remote_conn = ConnectHandler(**a_device) print() print("#" * 80) print(remote_conn.send_command("show version")) print("#" * 80) print()
def function[show_version, parameter[a_device]]: constant[Execute show version command using Netmiko.] variable[remote_conn] assign[=] call[name[ConnectHandler], parameter[]] call[name[print], parameter[]] call[name[print], parameter[binary_operation[constant[#] * constant[80]]]] ...
keyword[def] identifier[show_version] ( identifier[a_device] ): literal[string] identifier[remote_conn] = identifier[ConnectHandler] (** identifier[a_device] ) identifier[print] () identifier[print] ( literal[string] * literal[int] ) identifier[print] ( identifier[remote_conn] . identifier[s...
def show_version(a_device): """Execute show version command using Netmiko.""" remote_conn = ConnectHandler(**a_device) print() print('#' * 80) print(remote_conn.send_command('show version')) print('#' * 80) print()
def commit(self, repository=None, tag=None, **kwargs): """ Commit a container to an image. Similar to the ``docker commit`` command. Args: repository (str): The repository to push the image to tag (str): The tag to push message (str): A commit message...
def function[commit, parameter[self, repository, tag]]: constant[ Commit a container to an image. Similar to the ``docker commit`` command. Args: repository (str): The repository to push the image to tag (str): The tag to push message (str): A commit ...
keyword[def] identifier[commit] ( identifier[self] , identifier[repository] = keyword[None] , identifier[tag] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[resp] = identifier[self] . identifier[client] . identifier[api] . identifier[commit] ( identifier[self] . identifier[id...
def commit(self, repository=None, tag=None, **kwargs): """ Commit a container to an image. Similar to the ``docker commit`` command. Args: repository (str): The repository to push the image to tag (str): The tag to push message (str): A commit message ...
def get_first_of_element(element, sub, contype=None): """抽取lxml.etree库中elem对象中文字 Args: element: lxml.etree.Element sub: str Returns: elem中文字 """ content = element.xpath(sub) return list_or_empty(content, contype)
def function[get_first_of_element, parameter[element, sub, contype]]: constant[抽取lxml.etree库中elem对象中文字 Args: element: lxml.etree.Element sub: str Returns: elem中文字 ] variable[content] assign[=] call[name[element].xpath, parameter[name[sub]]] return[call[name[list...
keyword[def] identifier[get_first_of_element] ( identifier[element] , identifier[sub] , identifier[contype] = keyword[None] ): literal[string] identifier[content] = identifier[element] . identifier[xpath] ( identifier[sub] ) keyword[return] identifier[list_or_empty] ( identifier[content] , identifier...
def get_first_of_element(element, sub, contype=None): """抽取lxml.etree库中elem对象中文字 Args: element: lxml.etree.Element sub: str Returns: elem中文字 """ content = element.xpath(sub) return list_or_empty(content, contype)
def inasafe_exposure_summary_field_values(field, feature, parent): """Retrieve all values from a field in the exposure summary layer. """ _ = feature, parent # NOQA layer = exposure_summary_layer() if not layer: return None index = layer.fields().lookupField(field) if index < 0: ...
def function[inasafe_exposure_summary_field_values, parameter[field, feature, parent]]: constant[Retrieve all values from a field in the exposure summary layer. ] variable[_] assign[=] tuple[[<ast.Name object at 0x7da1b0c3ee90>, <ast.Name object at 0x7da1b0c3e140>]] variable[layer] assign[=]...
keyword[def] identifier[inasafe_exposure_summary_field_values] ( identifier[field] , identifier[feature] , identifier[parent] ): literal[string] identifier[_] = identifier[feature] , identifier[parent] identifier[layer] = identifier[exposure_summary_layer] () keyword[if] keyword[not] identifi...
def inasafe_exposure_summary_field_values(field, feature, parent): """Retrieve all values from a field in the exposure summary layer. """ _ = (feature, parent) # NOQA layer = exposure_summary_layer() if not layer: return None # depends on [control=['if'], data=[]] index = layer.fields(...
def _common_parser(): """Returns a parser with common command-line options for all the scripts in the fortpy suite. """ import argparse parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-examples", action="store_true", help="See detailed help and examp...
def function[_common_parser, parameter[]]: constant[Returns a parser with common command-line options for all the scripts in the fortpy suite. ] import module[argparse] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] call[name[parser].add_argument, paramet...
keyword[def] identifier[_common_parser] (): literal[string] keyword[import] identifier[argparse] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] ( identifier[add_help] = keyword[False] ) identifier[parser] . identifier[add_argument] ( literal[string] , identifier[action] ...
def _common_parser(): """Returns a parser with common command-line options for all the scripts in the fortpy suite. """ import argparse parser = argparse.ArgumentParser(add_help=False) parser.add_argument('-examples', action='store_true', help='See detailed help and examples for this script.') ...
def accept(self, message=None, expires_at=None): """Accept request.""" with db.session.begin_nested(): if self.status != RequestStatus.PENDING: raise InvalidRequestStateError(RequestStatus.PENDING) self.status = RequestStatus.ACCEPTED request_accepted.send...
def function[accept, parameter[self, message, expires_at]]: constant[Accept request.] with call[name[db].session.begin_nested, parameter[]] begin[:] if compare[name[self].status not_equal[!=] name[RequestStatus].PENDING] begin[:] <ast.Raise object at 0x7da2044c1d50> ...
keyword[def] identifier[accept] ( identifier[self] , identifier[message] = keyword[None] , identifier[expires_at] = keyword[None] ): literal[string] keyword[with] identifier[db] . identifier[session] . identifier[begin_nested] (): keyword[if] identifier[self] . identifier[status] != ...
def accept(self, message=None, expires_at=None): """Accept request.""" with db.session.begin_nested(): if self.status != RequestStatus.PENDING: raise InvalidRequestStateError(RequestStatus.PENDING) # depends on [control=['if'], data=[]] self.status = RequestStatus.ACCEPTED # depend...
def fn_minimum_argcount(callable): """Returns the minimum number of arguments that must be provided for the call to succeed.""" fn = get_fn(callable) available_argcount = fn_available_argcount(callable) try: return available_argcount - len(fn.__defaults__) except TypeError: return av...
def function[fn_minimum_argcount, parameter[callable]]: constant[Returns the minimum number of arguments that must be provided for the call to succeed.] variable[fn] assign[=] call[name[get_fn], parameter[name[callable]]] variable[available_argcount] assign[=] call[name[fn_available_argcount], p...
keyword[def] identifier[fn_minimum_argcount] ( identifier[callable] ): literal[string] identifier[fn] = identifier[get_fn] ( identifier[callable] ) identifier[available_argcount] = identifier[fn_available_argcount] ( identifier[callable] ) keyword[try] : keyword[return] identifier[avail...
def fn_minimum_argcount(callable): """Returns the minimum number of arguments that must be provided for the call to succeed.""" fn = get_fn(callable) available_argcount = fn_available_argcount(callable) try: return available_argcount - len(fn.__defaults__) # depends on [control=['try'], data=[]...