code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def get_task_log(task_id, session, request_kwargs=None): """Static method for getting a task log, given a task_id. This method exists so a task log can be retrieved without retrieving the items task history first. :type task_id: str or int :param task_id: The task id for the ta...
def function[get_task_log, parameter[task_id, session, request_kwargs]]: constant[Static method for getting a task log, given a task_id. This method exists so a task log can be retrieved without retrieving the items task history first. :type task_id: str or int :param task_id: ...
keyword[def] identifier[get_task_log] ( identifier[task_id] , identifier[session] , identifier[request_kwargs] = keyword[None] ): literal[string] identifier[request_kwargs] = identifier[request_kwargs] keyword[if] identifier[request_kwargs] keyword[else] identifier[dict] () identifier[...
def get_task_log(task_id, session, request_kwargs=None): """Static method for getting a task log, given a task_id. This method exists so a task log can be retrieved without retrieving the items task history first. :type task_id: str or int :param task_id: The task id for the task l...
def _attempt_to_extract_ccc(self): """Extracts the country calling code from the beginning of _national_number to _prefix_before_national_number when they are available, and places the remaining input into _national_number. Returns True when a valid country calling code can be found. ...
def function[_attempt_to_extract_ccc, parameter[self]]: constant[Extracts the country calling code from the beginning of _national_number to _prefix_before_national_number when they are available, and places the remaining input into _national_number. Returns True when a valid country ca...
keyword[def] identifier[_attempt_to_extract_ccc] ( identifier[self] ): literal[string] keyword[if] identifier[len] ( identifier[self] . identifier[_national_number] )== literal[int] : keyword[return] keyword[False] identifier[country_code] , identifier[number_without_ccc] ...
def _attempt_to_extract_ccc(self): """Extracts the country calling code from the beginning of _national_number to _prefix_before_national_number when they are available, and places the remaining input into _national_number. Returns True when a valid country calling code can be found. ...
def _collect_zipimporter_cache_entries(normalized_path, cache): """ Return zipimporter cache entry keys related to a given normalized path. Alternative path spellings (e.g. those using different character case or those using alternative path separators) related to the same path are included. Any su...
def function[_collect_zipimporter_cache_entries, parameter[normalized_path, cache]]: constant[ Return zipimporter cache entry keys related to a given normalized path. Alternative path spellings (e.g. those using different character case or those using alternative path separators) related to the sam...
keyword[def] identifier[_collect_zipimporter_cache_entries] ( identifier[normalized_path] , identifier[cache] ): literal[string] identifier[result] =[] identifier[prefix_len] = identifier[len] ( identifier[normalized_path] ) keyword[for] identifier[p] keyword[in] identifier[cache] : i...
def _collect_zipimporter_cache_entries(normalized_path, cache): """ Return zipimporter cache entry keys related to a given normalized path. Alternative path spellings (e.g. those using different character case or those using alternative path separators) related to the same path are included. Any su...
def plot_all(*args, **kwargs): ''' Read all the trial data and plot the result of applying a function on them. ''' dfs = do_all(*args, **kwargs) ps = [] for line in dfs: f, df, config = line df.plot(title=config['name']) ps.append(df) return ps
def function[plot_all, parameter[]]: constant[ Read all the trial data and plot the result of applying a function on them. ] variable[dfs] assign[=] call[name[do_all], parameter[<ast.Starred object at 0x7da1b244e830>]] variable[ps] assign[=] list[[]] for taget[name[line]] in star...
keyword[def] identifier[plot_all] (* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[dfs] = identifier[do_all] (* identifier[args] ,** identifier[kwargs] ) identifier[ps] =[] keyword[for] identifier[line] keyword[in] identifier[dfs] : identifier[f] , identifier[d...
def plot_all(*args, **kwargs): """ Read all the trial data and plot the result of applying a function on them. """ dfs = do_all(*args, **kwargs) ps = [] for line in dfs: (f, df, config) = line df.plot(title=config['name']) ps.append(df) # depends on [control=['for'], dat...
def out_64(library, session, space, offset, data, extended=False): """Write in an 64-bit value from the specified memory space and offset. Corresponds to viOut64* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. ...
def function[out_64, parameter[library, session, space, offset, data, extended]]: constant[Write in an 64-bit value from the specified memory space and offset. Corresponds to viOut64* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical ...
keyword[def] identifier[out_64] ( identifier[library] , identifier[session] , identifier[space] , identifier[offset] , identifier[data] , identifier[extended] = keyword[False] ): literal[string] keyword[if] identifier[extended] : keyword[return] identifier[library] . identifier[viOut64Ex] ( iden...
def out_64(library, session, space, offset, data, extended=False): """Write in an 64-bit value from the specified memory space and offset. Corresponds to viOut64* functions of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. ...
def compute_wcs(key, challenge): """ Compute an WAMP-CRA authentication signature from an authentication challenge and a (derived) key. :param key: The key derived (via PBKDF2) from the secret. :type key: str/bytes :param challenge: The authentication challenge to sign. :type challenge: str...
def function[compute_wcs, parameter[key, challenge]]: constant[ Compute an WAMP-CRA authentication signature from an authentication challenge and a (derived) key. :param key: The key derived (via PBKDF2) from the secret. :type key: str/bytes :param challenge: The authentication challenge to...
keyword[def] identifier[compute_wcs] ( identifier[key] , identifier[challenge] ): literal[string] identifier[key] = identifier[key] . identifier[encode] ( literal[string] ) identifier[challenge] = identifier[challenge] . identifier[encode] ( literal[string] ) identifier[sig] = identifier[hmac] . ...
def compute_wcs(key, challenge): """ Compute an WAMP-CRA authentication signature from an authentication challenge and a (derived) key. :param key: The key derived (via PBKDF2) from the secret. :type key: str/bytes :param challenge: The authentication challenge to sign. :type challenge: str...
def _build_item_closure(itemset, productionset): """Build input itemset closure """ #For every item inside current itemset, if we have the following rule: # xxx <cursor><nonterminalSymbol> xxx append every rule from self._productionruleset that begins with that NonTerminalSymbol if not isinstance(item...
def function[_build_item_closure, parameter[itemset, productionset]]: constant[Build input itemset closure ] if <ast.UnaryOp object at 0x7da20e960bb0> begin[:] <ast.Raise object at 0x7da20e963b80> import module[copy] variable[resultset] assign[=] call[name[copy].copy, parameter[name[...
keyword[def] identifier[_build_item_closure] ( identifier[itemset] , identifier[productionset] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[itemset] , identifier[LR0ItemSet] ): keyword[raise] identifier[TypeError] keyword[import] identifier[co...
def _build_item_closure(itemset, productionset): """Build input itemset closure """ #For every item inside current itemset, if we have the following rule: # xxx <cursor><nonterminalSymbol> xxx append every rule from self._productionruleset that begins with that NonTerminalSymbol if not isinstance(item...
def build_polylines(self, polylines): """ Process data to construct polylines This method is built from the assumption that the polylines parameter is a list of: list of lists or tuples : a list of path points, each one indicating the point coordinates -- [la...
def function[build_polylines, parameter[self, polylines]]: constant[ Process data to construct polylines This method is built from the assumption that the polylines parameter is a list of: list of lists or tuples : a list of path points, each one indicating the point coo...
keyword[def] identifier[build_polylines] ( identifier[self] , identifier[polylines] ): literal[string] keyword[if] keyword[not] identifier[polylines] : keyword[return] keyword[if] keyword[not] identifier[isinstance] ( identifier[polylines] ,( identifier[list] , identifier...
def build_polylines(self, polylines): """ Process data to construct polylines This method is built from the assumption that the polylines parameter is a list of: list of lists or tuples : a list of path points, each one indicating the point coordinates -- [lat,ln...
def readObject(self): """ Reads an object from the stream. """ ref = self.readInteger(False) if ref & REFERENCE_BIT == 0: obj = self.context.getObject(ref >> 1) if obj is None: raise pyamf.ReferenceError('Unknown reference %d' % (ref >> 1...
def function[readObject, parameter[self]]: constant[ Reads an object from the stream. ] variable[ref] assign[=] call[name[self].readInteger, parameter[constant[False]]] if compare[binary_operation[name[ref] <ast.BitAnd object at 0x7da2590d6b60> name[REFERENCE_BIT]] equal[==] cons...
keyword[def] identifier[readObject] ( identifier[self] ): literal[string] identifier[ref] = identifier[self] . identifier[readInteger] ( keyword[False] ) keyword[if] identifier[ref] & identifier[REFERENCE_BIT] == literal[int] : identifier[obj] = identifier[self] . identifier...
def readObject(self): """ Reads an object from the stream. """ ref = self.readInteger(False) if ref & REFERENCE_BIT == 0: obj = self.context.getObject(ref >> 1) if obj is None: raise pyamf.ReferenceError('Unknown reference %d' % (ref >> 1,)) # depends on [control...
def list_qos_policies(self, retrieve_all=True, **_params): """Fetches a list of all qos policies for a project.""" # Pass filters in "params" argument to do_request return self.list('policies', self.qos_policies_path, retrieve_all, **_params)
def function[list_qos_policies, parameter[self, retrieve_all]]: constant[Fetches a list of all qos policies for a project.] return[call[name[self].list, parameter[constant[policies], name[self].qos_policies_path, name[retrieve_all]]]]
keyword[def] identifier[list_qos_policies] ( identifier[self] , identifier[retrieve_all] = keyword[True] ,** identifier[_params] ): literal[string] keyword[return] identifier[self] . identifier[list] ( literal[string] , identifier[self] . identifier[qos_policies_path] , identifie...
def list_qos_policies(self, retrieve_all=True, **_params): """Fetches a list of all qos policies for a project.""" # Pass filters in "params" argument to do_request return self.list('policies', self.qos_policies_path, retrieve_all, **_params)
def element_data_str(z, eldata): '''Return a string with all data for an element This includes shell and ECP potential data Parameters ---------- z : int or str Element Z-number eldata: dict Data for the element to be printed ''' sym = lut.element_sym_from_Z(z, True) ...
def function[element_data_str, parameter[z, eldata]]: constant[Return a string with all data for an element This includes shell and ECP potential data Parameters ---------- z : int or str Element Z-number eldata: dict Data for the element to be printed ] variabl...
keyword[def] identifier[element_data_str] ( identifier[z] , identifier[eldata] ): literal[string] identifier[sym] = identifier[lut] . identifier[element_sym_from_Z] ( identifier[z] , keyword[True] ) identifier[cs] = identifier[contraction_string] ( identifier[eldata] ) keyword[if] identifier[c...
def element_data_str(z, eldata): """Return a string with all data for an element This includes shell and ECP potential data Parameters ---------- z : int or str Element Z-number eldata: dict Data for the element to be printed """ sym = lut.element_sym_from_Z(z, True) ...
def _find_address_and_connect(self, addresses): """Find and connect to the appropriate address. :param addresses: :raises AMQPConnectionError: Raises if the connection encountered an error. :rtype: socket.socket """ error_message = ...
def function[_find_address_and_connect, parameter[self, addresses]]: constant[Find and connect to the appropriate address. :param addresses: :raises AMQPConnectionError: Raises if the connection encountered an error. :rtype: socket.socket ]...
keyword[def] identifier[_find_address_and_connect] ( identifier[self] , identifier[addresses] ): literal[string] identifier[error_message] = keyword[None] keyword[for] identifier[address] keyword[in] identifier[addresses] : identifier[sock] = identifier[self] . identifier[...
def _find_address_and_connect(self, addresses): """Find and connect to the appropriate address. :param addresses: :raises AMQPConnectionError: Raises if the connection encountered an error. :rtype: socket.socket """ error_message = None ...
def from_dict(cls, fields, mapping): """ Create a Record from a dictionary of field mappings. The *fields* object is used to determine the column indices of fields in the mapping. Args: fields: the Relation schema for the table of this record mapping: a ...
def function[from_dict, parameter[cls, fields, mapping]]: constant[ Create a Record from a dictionary of field mappings. The *fields* object is used to determine the column indices of fields in the mapping. Args: fields: the Relation schema for the table of this rec...
keyword[def] identifier[from_dict] ( identifier[cls] , identifier[fields] , identifier[mapping] ): literal[string] identifier[iterable] =[ keyword[None] ]* identifier[len] ( identifier[fields] ) keyword[for] identifier[key] , identifier[value] keyword[in] identifier[mapping] . identifie...
def from_dict(cls, fields, mapping): """ Create a Record from a dictionary of field mappings. The *fields* object is used to determine the column indices of fields in the mapping. Args: fields: the Relation schema for the table of this record mapping: a dict...
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: # Todo: Consider locking the poll/recv block. # Otherwise, this method is not thread safe. ...
def function[get, parameter[self, timeout]]: constant[Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.] if name[timeout] begin[:] if call[name[self]._conn1.poll, parameter[name[timeout]]] begin[:] ...
keyword[def] identifier[get] ( identifier[self] , identifier[timeout] = keyword[None] ): literal[string] keyword[if] identifier[timeout] : keyword[if] identifier[self] . identifier[_conn1] . identifier[poll] ( identifier[timeout] ): keyword[return] ...
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: # Todo: Consider locking the poll/recv block. # Otherwise, this method is not thread safe. if self._conn1.poll(...
def validate_member_type(self, value): """Validate each member of the list, if member_type exists""" if self.member_type: for item in value: self.member_type.validate(item)
def function[validate_member_type, parameter[self, value]]: constant[Validate each member of the list, if member_type exists] if name[self].member_type begin[:] for taget[name[item]] in starred[name[value]] begin[:] call[name[self].member_type.validate, parameter[...
keyword[def] identifier[validate_member_type] ( identifier[self] , identifier[value] ): literal[string] keyword[if] identifier[self] . identifier[member_type] : keyword[for] identifier[item] keyword[in] identifier[value] : identifier[self] . identifier[member_type]...
def validate_member_type(self, value): """Validate each member of the list, if member_type exists""" if self.member_type: for item in value: self.member_type.validate(item) # depends on [control=['for'], data=['item']] # depends on [control=['if'], data=[]]
def verify_counter(self, signature, counter): """ Verifies that counter value is greater than previous signature""" devices = self.__get_u2f_devices() for device in devices: # Searching for specific keyhandle if device['keyHandle'] == signature['keyHandle']: ...
def function[verify_counter, parameter[self, signature, counter]]: constant[ Verifies that counter value is greater than previous signature] variable[devices] assign[=] call[name[self].__get_u2f_devices, parameter[]] for taget[name[device]] in starred[name[devices]] begin[:] if c...
keyword[def] identifier[verify_counter] ( identifier[self] , identifier[signature] , identifier[counter] ): literal[string] identifier[devices] = identifier[self] . identifier[__get_u2f_devices] () keyword[for] identifier[device] keyword[in] identifier[devices] : ...
def verify_counter(self, signature, counter): """ Verifies that counter value is greater than previous signature""" devices = self.__get_u2f_devices() for device in devices: # Searching for specific keyhandle if device['keyHandle'] == signature['keyHandle']: if counter > device['...
def create(self, segment): """A best-effort attempt to create directories. Warnings are issued to the user if those directories could not created or if they don't exist. The caller should only call this function if the user requested prefetching (i.e. concurrency) to avoid spur...
def function[create, parameter[self, segment]]: constant[A best-effort attempt to create directories. Warnings are issued to the user if those directories could not created or if they don't exist. The caller should only call this function if the user requested prefetching (i.e....
keyword[def] identifier[create] ( identifier[self] , identifier[segment] ): literal[string] keyword[def] identifier[lackadaisical_mkdir] ( identifier[place] ): identifier[ok] = keyword[False] identifier[place] = identifier[path] . identifier[realpath] ( identifier[plac...
def create(self, segment): """A best-effort attempt to create directories. Warnings are issued to the user if those directories could not created or if they don't exist. The caller should only call this function if the user requested prefetching (i.e. concurrency) to avoid spurious...
def create_user(config_data): """ Create admin user without user input :param config_data: configuration data """ with chdir(os.path.abspath(config_data.project_directory)): env = deepcopy(dict(os.environ)) env[str('DJANGO_SETTINGS_MODULE')] = str('{0}.settings'.format(config_data.p...
def function[create_user, parameter[config_data]]: constant[ Create admin user without user input :param config_data: configuration data ] with call[name[chdir], parameter[call[name[os].path.abspath, parameter[name[config_data].project_directory]]]] begin[:] variable[env] as...
keyword[def] identifier[create_user] ( identifier[config_data] ): literal[string] keyword[with] identifier[chdir] ( identifier[os] . identifier[path] . identifier[abspath] ( identifier[config_data] . identifier[project_directory] )): identifier[env] = identifier[deepcopy] ( identifier[dict] ( ide...
def create_user(config_data): """ Create admin user without user input :param config_data: configuration data """ with chdir(os.path.abspath(config_data.project_directory)): env = deepcopy(dict(os.environ)) env[str('DJANGO_SETTINGS_MODULE')] = str('{0}.settings'.format(config_data.p...
def _proxy_settings(self): """ Create/replace ~/.datacats/run/proxy-environment and return entry for ro mount for containers """ if not ('https_proxy' in environ or 'HTTPS_PROXY' in environ or 'http_proxy' in environ or 'HTTP_PROXY' in environ): return...
def function[_proxy_settings, parameter[self]]: constant[ Create/replace ~/.datacats/run/proxy-environment and return entry for ro mount for containers ] if <ast.UnaryOp object at 0x7da18ede62f0> begin[:] return[dictionary[[], []]] variable[https_proxy] assign[=] ...
keyword[def] identifier[_proxy_settings] ( identifier[self] ): literal[string] keyword[if] keyword[not] ( literal[string] keyword[in] identifier[environ] keyword[or] literal[string] keyword[in] identifier[environ] keyword[or] literal[string] keyword[in] identifier[environ] keyw...
def _proxy_settings(self): """ Create/replace ~/.datacats/run/proxy-environment and return entry for ro mount for containers """ if not ('https_proxy' in environ or 'HTTPS_PROXY' in environ or 'http_proxy' in environ or ('HTTP_PROXY' in environ)): return {} # depends on [control...
def write(self, buf, **kwargs): """ Write the bytes from ``buffer`` to the device. Transmits a stop bit if ``stop`` is set. If ``start`` or ``end`` is provided, then the buffer will be sliced as if ``buffer[start:end]``. This will not cause an allocation like ``buffer[st...
def function[write, parameter[self, buf]]: constant[ Write the bytes from ``buffer`` to the device. Transmits a stop bit if ``stop`` is set. If ``start`` or ``end`` is provided, then the buffer will be sliced as if ``buffer[start:end]``. This will not cause an allocation like ...
keyword[def] identifier[write] ( identifier[self] , identifier[buf] ,** identifier[kwargs] ): literal[string] identifier[self] . identifier[i2c] . identifier[writeto] ( identifier[self] . identifier[device_address] , identifier[buf] ,** identifier[kwargs] ) keyword[if] identifier[self] . ...
def write(self, buf, **kwargs): """ Write the bytes from ``buffer`` to the device. Transmits a stop bit if ``stop`` is set. If ``start`` or ``end`` is provided, then the buffer will be sliced as if ``buffer[start:end]``. This will not cause an allocation like ``buffer[start:...
def restart(self, timeout=300, config_callback=None): """restart server: stop() and start() return status of start command """ self.stop() if config_callback: self.cfg = config_callback(self.cfg.copy()) self.config_path = process.write_config(self.cfg) ...
def function[restart, parameter[self, timeout, config_callback]]: constant[restart server: stop() and start() return status of start command ] call[name[self].stop, parameter[]] if name[config_callback] begin[:] name[self].cfg assign[=] call[name[config_callback],...
keyword[def] identifier[restart] ( identifier[self] , identifier[timeout] = literal[int] , identifier[config_callback] = keyword[None] ): literal[string] identifier[self] . identifier[stop] () keyword[if] identifier[config_callback] : identifier[self] . identifier[cfg] = iden...
def restart(self, timeout=300, config_callback=None): """restart server: stop() and start() return status of start command """ self.stop() if config_callback: self.cfg = config_callback(self.cfg.copy()) # depends on [control=['if'], data=[]] self.config_path = process.write_conf...
def findB(self, tag_name, params=None, fn=None, case_sensitive=False): """ Same as :meth:`findAllB`, but without `endtags`. You can always get them from :attr:`endtag` property. """ return [ x for x in self.findAllB(tag_name, params, fn, case_sensitive) i...
def function[findB, parameter[self, tag_name, params, fn, case_sensitive]]: constant[ Same as :meth:`findAllB`, but without `endtags`. You can always get them from :attr:`endtag` property. ] return[<ast.ListComp object at 0x7da1b16aa560>]
keyword[def] identifier[findB] ( identifier[self] , identifier[tag_name] , identifier[params] = keyword[None] , identifier[fn] = keyword[None] , identifier[case_sensitive] = keyword[False] ): literal[string] keyword[return] [ identifier[x] keyword[for] identifier[x] keyword[in] identif...
def findB(self, tag_name, params=None, fn=None, case_sensitive=False): """ Same as :meth:`findAllB`, but without `endtags`. You can always get them from :attr:`endtag` property. """ return [x for x in self.findAllB(tag_name, params, fn, case_sensitive) if not x.isEndTag()]
def create_view_for_template(app_name, template_name): ''' Creates a view function for templates (used whe a view.py file doesn't exist but the .html does) Raises TemplateDoesNotExist if the template doesn't exist. ''' # ensure the template exists apps.get_app_config('django_mako_plus').engine.g...
def function[create_view_for_template, parameter[app_name, template_name]]: constant[ Creates a view function for templates (used whe a view.py file doesn't exist but the .html does) Raises TemplateDoesNotExist if the template doesn't exist. ] call[call[call[name[apps].get_app_config, parame...
keyword[def] identifier[create_view_for_template] ( identifier[app_name] , identifier[template_name] ): literal[string] identifier[apps] . identifier[get_app_config] ( literal[string] ). identifier[engine] . identifier[get_template_loader] ( identifier[app_name] ). identifier[get_template] ( identifie...
def create_view_for_template(app_name, template_name): """ Creates a view function for templates (used whe a view.py file doesn't exist but the .html does) Raises TemplateDoesNotExist if the template doesn't exist. """ # ensure the template exists apps.get_app_config('django_mako_plus').engine.g...
def _add_observation(self, x_to_add, y_to_add): """Add observation to window, updating means/variance efficiently.""" self._add_observation_to_means(x_to_add, y_to_add) self._add_observation_to_variances(x_to_add, y_to_add) self.window_size += 1
def function[_add_observation, parameter[self, x_to_add, y_to_add]]: constant[Add observation to window, updating means/variance efficiently.] call[name[self]._add_observation_to_means, parameter[name[x_to_add], name[y_to_add]]] call[name[self]._add_observation_to_variances, parameter[name[x_to_...
keyword[def] identifier[_add_observation] ( identifier[self] , identifier[x_to_add] , identifier[y_to_add] ): literal[string] identifier[self] . identifier[_add_observation_to_means] ( identifier[x_to_add] , identifier[y_to_add] ) identifier[self] . identifier[_add_observation_to_variances...
def _add_observation(self, x_to_add, y_to_add): """Add observation to window, updating means/variance efficiently.""" self._add_observation_to_means(x_to_add, y_to_add) self._add_observation_to_variances(x_to_add, y_to_add) self.window_size += 1
def transform_data(function, input_data): ''' a function to apply a function to each value in a nested dictionary :param function: callable function with a single input of any datatype :param input_data: dictionary or list with nested data to transform :return: dictionary or list with data transformed...
def function[transform_data, parameter[function, input_data]]: constant[ a function to apply a function to each value in a nested dictionary :param function: callable function with a single input of any datatype :param input_data: dictionary or list with nested data to transform :return: dictionary...
keyword[def] identifier[transform_data] ( identifier[function] , identifier[input_data] ): literal[string] keyword[try] : keyword[from] identifier[copy] keyword[import] identifier[deepcopy] identifier[output_data] = identifier[deepcopy] ( identifier[input_data] ) keyword[e...
def transform_data(function, input_data): """ a function to apply a function to each value in a nested dictionary :param function: callable function with a single input of any datatype :param input_data: dictionary or list with nested data to transform :return: dictionary or list with data transformed ...
def _stub_tag(constructor, node): """Stub a constructor with a dictionary.""" seen = getattr(constructor, "_stub_seen", None) if seen is None: seen = constructor._stub_seen = set() if node.tag not in seen: print("YAML tag {} is not supported".format(node.tag)) seen.add(node.tag...
def function[_stub_tag, parameter[constructor, node]]: constant[Stub a constructor with a dictionary.] variable[seen] assign[=] call[name[getattr], parameter[name[constructor], constant[_stub_seen], constant[None]]] if compare[name[seen] is constant[None]] begin[:] variable[seen]...
keyword[def] identifier[_stub_tag] ( identifier[constructor] , identifier[node] ): literal[string] identifier[seen] = identifier[getattr] ( identifier[constructor] , literal[string] , keyword[None] ) keyword[if] identifier[seen] keyword[is] keyword[None] : identifier[seen] = identifier[co...
def _stub_tag(constructor, node): """Stub a constructor with a dictionary.""" seen = getattr(constructor, '_stub_seen', None) if seen is None: seen = constructor._stub_seen = set() # depends on [control=['if'], data=['seen']] if node.tag not in seen: print('YAML tag {} is not supported'...
def start(self, timeout=None): """Start the client in a new thread. Parameters ---------- timeout : float in seconds Seconds to wait for client thread to start. Do not specify a timeout if start() is being called from the same ioloop that this client ...
def function[start, parameter[self, timeout]]: constant[Start the client in a new thread. Parameters ---------- timeout : float in seconds Seconds to wait for client thread to start. Do not specify a timeout if start() is being called from the same ioloop that th...
keyword[def] identifier[start] ( identifier[self] , identifier[timeout] = keyword[None] ): literal[string] keyword[if] identifier[self] . identifier[_running] . identifier[isSet] (): keyword[raise] identifier[RuntimeError] ( literal[string] ) identifier[self] . ...
def start(self, timeout=None): """Start the client in a new thread. Parameters ---------- timeout : float in seconds Seconds to wait for client thread to start. Do not specify a timeout if start() is being called from the same ioloop that this client will...
def add_site(self, name, site_elements=None): """ Add a VPN site with site elements to this engine. VPN sites identify the sites with protected networks to be included in the VPN. Add a network and new VPN site:: >>> net = Network.get_or_create(name='wireless...
def function[add_site, parameter[self, name, site_elements]]: constant[ Add a VPN site with site elements to this engine. VPN sites identify the sites with protected networks to be included in the VPN. Add a network and new VPN site:: >>> net = Network.get_or...
keyword[def] identifier[add_site] ( identifier[self] , identifier[name] , identifier[site_elements] = keyword[None] ): literal[string] identifier[site_elements] = identifier[site_elements] keyword[if] identifier[site_elements] keyword[else] [] keyword[return] identifier[self] . identif...
def add_site(self, name, site_elements=None): """ Add a VPN site with site elements to this engine. VPN sites identify the sites with protected networks to be included in the VPN. Add a network and new VPN site:: >>> net = Network.get_or_create(name='wireless', i...
def _xray_clean_up_entries_for_driver(self, driver_id): """Remove this driver's object/task entries from redis. Removes control-state entries of all tasks and task return objects belonging to the driver. Args: driver_id: The driver id. """ xray_task_table_p...
def function[_xray_clean_up_entries_for_driver, parameter[self, driver_id]]: constant[Remove this driver's object/task entries from redis. Removes control-state entries of all tasks and task return objects belonging to the driver. Args: driver_id: The driver id. ] ...
keyword[def] identifier[_xray_clean_up_entries_for_driver] ( identifier[self] , identifier[driver_id] ): literal[string] identifier[xray_task_table_prefix] =( identifier[ray] . identifier[gcs_utils] . identifier[TablePrefix_RAYLET_TASK_string] . identifier[encode] ( literal[string] )) ...
def _xray_clean_up_entries_for_driver(self, driver_id): """Remove this driver's object/task entries from redis. Removes control-state entries of all tasks and task return objects belonging to the driver. Args: driver_id: The driver id. """ xray_task_table_prefix = r...
def is_allowed( self, policy_name, session_user, session_group, object_owner, object_type, operation ): """ Determine if object access is allowed for the provided policy and session settings. """ ...
def function[is_allowed, parameter[self, policy_name, session_user, session_group, object_owner, object_type, operation]]: constant[ Determine if object access is allowed for the provided policy and session settings. ] variable[policy_section] assign[=] call[name[self].get_releva...
keyword[def] identifier[is_allowed] ( identifier[self] , identifier[policy_name] , identifier[session_user] , identifier[session_group] , identifier[object_owner] , identifier[object_type] , identifier[operation] ): literal[string] identifier[policy_section] = identifier[self] . identifier[...
def is_allowed(self, policy_name, session_user, session_group, object_owner, object_type, operation): """ Determine if object access is allowed for the provided policy and session settings. """ policy_section = self.get_relevant_policy_section(policy_name, session_group) if policy_se...
def url_params(request, except_params=None, as_is=False): """ create string with GET-params of request usage example: c['sort_url'] = url_params(request, except_params=('sort',)) ... <a href="{{ sort_url }}&sort=lab_number">Лабораторный номер</a> """ if not request.GET: ...
def function[url_params, parameter[request, except_params, as_is]]: constant[ create string with GET-params of request usage example: c['sort_url'] = url_params(request, except_params=('sort',)) ... <a href="{{ sort_url }}&sort=lab_number">Лабораторный номер</a> ] if...
keyword[def] identifier[url_params] ( identifier[request] , identifier[except_params] = keyword[None] , identifier[as_is] = keyword[False] ): literal[string] keyword[if] keyword[not] identifier[request] . identifier[GET] : keyword[return] literal[string] identifier[params] =[] keywor...
def url_params(request, except_params=None, as_is=False): """ create string with GET-params of request usage example: c['sort_url'] = url_params(request, except_params=('sort',)) ... <a href="{{ sort_url }}&sort=lab_number">Лабораторный номер</a> """ if not request.GET: ...
def files(self, paths, access=None, extensions=None, minsize=None): """Verify list of files""" self.failures = [path for path in paths if not isvalid(path, access, extensions, 'file', minsize)] return not self.failures
def function[files, parameter[self, paths, access, extensions, minsize]]: constant[Verify list of files] name[self].failures assign[=] <ast.ListComp object at 0x7da1b14c69b0> return[<ast.UnaryOp object at 0x7da18f721930>]
keyword[def] identifier[files] ( identifier[self] , identifier[paths] , identifier[access] = keyword[None] , identifier[extensions] = keyword[None] , identifier[minsize] = keyword[None] ): literal[string] identifier[self] . identifier[failures] =[ identifier[path] keyword[for] identifier[path] k...
def files(self, paths, access=None, extensions=None, minsize=None): """Verify list of files""" self.failures = [path for path in paths if not isvalid(path, access, extensions, 'file', minsize)] return not self.failures
def legends(value): """list or KeyedList of ``Legends`` : Legend definitions Legends visualize scales, and take one or more scales as their input. They can be customized via a LegendProperty object. """ for i, entry in enumerate(value): _assert_is_type('legends[{0}]'...
def function[legends, parameter[value]]: constant[list or KeyedList of ``Legends`` : Legend definitions Legends visualize scales, and take one or more scales as their input. They can be customized via a LegendProperty object. ] for taget[tuple[[<ast.Name object at 0x7da204565c00...
keyword[def] identifier[legends] ( identifier[value] ): literal[string] keyword[for] identifier[i] , identifier[entry] keyword[in] identifier[enumerate] ( identifier[value] ): identifier[_assert_is_type] ( literal[string] . identifier[format] ( identifier[i] ), identifier[entry] , i...
def legends(value): """list or KeyedList of ``Legends`` : Legend definitions Legends visualize scales, and take one or more scales as their input. They can be customized via a LegendProperty object. """ for (i, entry) in enumerate(value): _assert_is_type('legends[{0}]'.format(i)...
def normalize_item(self, value=_nothing, coll=None, index=None): """Hook which is called on every *collection item*; this is a way to perform context-aware clean-ups. args: ``value=``\ *nothing*\ \|\ *anything* The value in the collection slot. *nothing* can be det...
def function[normalize_item, parameter[self, value, coll, index]]: constant[Hook which is called on every *collection item*; this is a way to perform context-aware clean-ups. args: ``value=``\ *nothing*\ \|\ *anything* The value in the collection slot. *nothing* ca...
keyword[def] identifier[normalize_item] ( identifier[self] , identifier[value] = identifier[_nothing] , identifier[coll] = keyword[None] , identifier[index] = keyword[None] ): literal[string] keyword[if] identifier[value] keyword[is] keyword[not] identifier[_nothing] keyword[and] identifier[h...
def normalize_item(self, value=_nothing, coll=None, index=None): """Hook which is called on every *collection item*; this is a way to perform context-aware clean-ups. args: ``value=``\\ *nothing*\\ \\|\\ *anything* The value in the collection slot. *nothing* can be det...
def get_sampleS(self, res, DS=None, resMode='abs', ind=None, offsetIn=0., Out='(X,Y,Z)', Ind=None): """ Sample, with resolution res, the surface defined by DS or ind An optionnal offset perpendicular to the surface can be used (offsetIn>0 => inwards) Parameters ...
def function[get_sampleS, parameter[self, res, DS, resMode, ind, offsetIn, Out, Ind]]: constant[ Sample, with resolution res, the surface defined by DS or ind An optionnal offset perpendicular to the surface can be used (offsetIn>0 => inwards) Parameters ---------- res ...
keyword[def] identifier[get_sampleS] ( identifier[self] , identifier[res] , identifier[DS] = keyword[None] , identifier[resMode] = literal[string] , identifier[ind] = keyword[None] , identifier[offsetIn] = literal[int] , identifier[Out] = literal[string] , identifier[Ind] = keyword[None] ): literal[string] ...
def get_sampleS(self, res, DS=None, resMode='abs', ind=None, offsetIn=0.0, Out='(X,Y,Z)', Ind=None): """ Sample, with resolution res, the surface defined by DS or ind An optionnal offset perpendicular to the surface can be used (offsetIn>0 => inwards) Parameters ---------- ...
def clean_geometry_type(geometry, target_type, allow_multipart=True): """ Return geometry of a specific type if possible. Filters and splits up GeometryCollection into target types. This is necessary when after clipping and/or reprojecting the geometry types from source geometries change (i.e. a Po...
def function[clean_geometry_type, parameter[geometry, target_type, allow_multipart]]: constant[ Return geometry of a specific type if possible. Filters and splits up GeometryCollection into target types. This is necessary when after clipping and/or reprojecting the geometry types from source ge...
keyword[def] identifier[clean_geometry_type] ( identifier[geometry] , identifier[target_type] , identifier[allow_multipart] = keyword[True] ): literal[string] identifier[multipart_geoms] ={ literal[string] : identifier[MultiPoint] , literal[string] : identifier[MultiLineString] , literal[str...
def clean_geometry_type(geometry, target_type, allow_multipart=True): """ Return geometry of a specific type if possible. Filters and splits up GeometryCollection into target types. This is necessary when after clipping and/or reprojecting the geometry types from source geometries change (i.e. a Po...
def attach(zpool, device, new_device, force=False): ''' Attach specified device to zpool zpool : string Name of storage pool device : string Existing device name too new_device : string New device name (to be attached to ``device``) force : boolean Forces use ...
def function[attach, parameter[zpool, device, new_device, force]]: constant[ Attach specified device to zpool zpool : string Name of storage pool device : string Existing device name too new_device : string New device name (to be attached to ``device``) force : bo...
keyword[def] identifier[attach] ( identifier[zpool] , identifier[device] , identifier[new_device] , identifier[force] = keyword[False] ): literal[string] identifier[flags] =[] identifier[target] =[] keyword[if] identifier[force] : identifier[flags] . identifier[append] (...
def attach(zpool, device, new_device, force=False): """ Attach specified device to zpool zpool : string Name of storage pool device : string Existing device name too new_device : string New device name (to be attached to ``device``) force : boolean Forces use ...
def get_thread(self, email, mailinglist): """Group messages by thread looking for similar subjects""" subject_slug = slugify(email.subject_clean) thread = self.THREAD_CACHE.get(subject_slug, {}).get(mailinglist.id) if thread is None: thread = Thread.all_objects.get_or_create...
def function[get_thread, parameter[self, email, mailinglist]]: constant[Group messages by thread looking for similar subjects] variable[subject_slug] assign[=] call[name[slugify], parameter[name[email].subject_clean]] variable[thread] assign[=] call[call[name[self].THREAD_CACHE.get, parameter[na...
keyword[def] identifier[get_thread] ( identifier[self] , identifier[email] , identifier[mailinglist] ): literal[string] identifier[subject_slug] = identifier[slugify] ( identifier[email] . identifier[subject_clean] ) identifier[thread] = identifier[self] . identifier[THREAD_CACHE] . ident...
def get_thread(self, email, mailinglist): """Group messages by thread looking for similar subjects""" subject_slug = slugify(email.subject_clean) thread = self.THREAD_CACHE.get(subject_slug, {}).get(mailinglist.id) if thread is None: thread = Thread.all_objects.get_or_create(mailinglist=mailingl...
def post(self, endpoint, d, *args, **kwargs): """ **post** Make a POST call to a remote endpoint Input: * An endpoint relative to the ``base_url`` * POST data **NOTE**: Passed POST data will be automatically serialized to a JSON string if it's n...
def function[post, parameter[self, endpoint, d]]: constant[ **post** Make a POST call to a remote endpoint Input: * An endpoint relative to the ``base_url`` * POST data **NOTE**: Passed POST data will be automatically serialized to a JSON string ...
keyword[def] identifier[post] ( identifier[self] , identifier[endpoint] , identifier[d] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[endpoint] = identifier[self] . identifier[base_url] + identifier[endpoint] keyword[if] keyword[not] identifier[isinstance] ( i...
def post(self, endpoint, d, *args, **kwargs): """ **post** Make a POST call to a remote endpoint Input: * An endpoint relative to the ``base_url`` * POST data **NOTE**: Passed POST data will be automatically serialized to a JSON string if it's not a...
def _get_bin(self, key): ''' Returns a binned dictionary based on redis zscore @return: The sorted dict ''' # keys based on score sortedDict = {} # this doesnt return them in order, need to bin first for item in self.redis_conn.zscan_iter(key): ...
def function[_get_bin, parameter[self, key]]: constant[ Returns a binned dictionary based on redis zscore @return: The sorted dict ] variable[sortedDict] assign[=] dictionary[[], []] for taget[name[item]] in starred[call[name[self].redis_conn.zscan_iter, parameter[name[k...
keyword[def] identifier[_get_bin] ( identifier[self] , identifier[key] ): literal[string] identifier[sortedDict] ={} keyword[for] identifier[item] keyword[in] identifier[self] . identifier[redis_conn] . identifier[zscan_iter] ( identifier[key] ): identifie...
def _get_bin(self, key): """ Returns a binned dictionary based on redis zscore @return: The sorted dict """ # keys based on score sortedDict = {} # this doesnt return them in order, need to bin first for item in self.redis_conn.zscan_iter(key): my_item = ujson.loads(...
def randurl(self): """ -> a random url-like #str via :prop:randdomain, :prop:randtld, and :prop:randpath """ return "{}://{}.{}/{}".format( self.random.choice(("http", "https")), self.randdomain, self.randtld, self.randpath)
def function[randurl, parameter[self]]: constant[ -> a random url-like #str via :prop:randdomain, :prop:randtld, and :prop:randpath ] return[call[constant[{}://{}.{}/{}].format, parameter[call[name[self].random.choice, parameter[tuple[[<ast.Constant object at 0x7da20c76fd00>, <ast.Co...
keyword[def] identifier[randurl] ( identifier[self] ): literal[string] keyword[return] literal[string] . identifier[format] ( identifier[self] . identifier[random] . identifier[choice] (( literal[string] , literal[string] )), identifier[self] . identifier[randdomain] , identifier...
def randurl(self): """ -> a random url-like #str via :prop:randdomain, :prop:randtld, and :prop:randpath """ return '{}://{}.{}/{}'.format(self.random.choice(('http', 'https')), self.randdomain, self.randtld, self.randpath)
def relabel_atoms(self, start=1): """Relabels all Atoms in numerical order, offset by the start parameter. Parameters ---------- start : int, optional Defines an offset for the labelling. """ counter = start for atom in self.get_atoms(ligands=True): ...
def function[relabel_atoms, parameter[self, start]]: constant[Relabels all Atoms in numerical order, offset by the start parameter. Parameters ---------- start : int, optional Defines an offset for the labelling. ] variable[counter] assign[=] name[start] ...
keyword[def] identifier[relabel_atoms] ( identifier[self] , identifier[start] = literal[int] ): literal[string] identifier[counter] = identifier[start] keyword[for] identifier[atom] keyword[in] identifier[self] . identifier[get_atoms] ( identifier[ligands] = keyword[True] ): ...
def relabel_atoms(self, start=1): """Relabels all Atoms in numerical order, offset by the start parameter. Parameters ---------- start : int, optional Defines an offset for the labelling. """ counter = start for atom in self.get_atoms(ligands=True): atom....
def _Struct_set_Poly(Poly, pos=None, extent=None, arrayorder='C', Type='Tor', Clock=False): """ Compute geometrical attributes of a Struct object """ # Make Poly closed, counter-clockwise, with '(cc,N)' layout and arrayorder Poly = _GG.Poly_Order(Poly, order='C', Clock=False, ...
def function[_Struct_set_Poly, parameter[Poly, pos, extent, arrayorder, Type, Clock]]: constant[ Compute geometrical attributes of a Struct object ] variable[Poly] assign[=] call[name[_GG].Poly_Order, parameter[name[Poly]]] assert[compare[call[name[Poly].shape][constant[0]] equal[==] constant[2]]] ...
keyword[def] identifier[_Struct_set_Poly] ( identifier[Poly] , identifier[pos] = keyword[None] , identifier[extent] = keyword[None] , identifier[arrayorder] = literal[string] , identifier[Type] = literal[string] , identifier[Clock] = keyword[False] ): literal[string] identifier[Poly] = identifier[_G...
def _Struct_set_Poly(Poly, pos=None, extent=None, arrayorder='C', Type='Tor', Clock=False): """ Compute geometrical attributes of a Struct object """ # Make Poly closed, counter-clockwise, with '(cc,N)' layout and arrayorder Poly = _GG.Poly_Order(Poly, order='C', Clock=False, close=True, layout='(cc,N)', Te...
def _project_perturbation(perturbation, epsilon, input_image, clip_min=None, clip_max=None): """Project `perturbation` onto L-infinity ball of radius `epsilon`. Also project into hypercube such that the resulting adversarial example is between clip_min and clip_max, if applicable. """ ...
def function[_project_perturbation, parameter[perturbation, epsilon, input_image, clip_min, clip_max]]: constant[Project `perturbation` onto L-infinity ball of radius `epsilon`. Also project into hypercube such that the resulting adversarial example is between clip_min and clip_max, if applicable. ] ...
keyword[def] identifier[_project_perturbation] ( identifier[perturbation] , identifier[epsilon] , identifier[input_image] , identifier[clip_min] = keyword[None] , identifier[clip_max] = keyword[None] ): literal[string] keyword[if] identifier[clip_min] keyword[is] keyword[None] keyword[or] identifier[cli...
def _project_perturbation(perturbation, epsilon, input_image, clip_min=None, clip_max=None): """Project `perturbation` onto L-infinity ball of radius `epsilon`. Also project into hypercube such that the resulting adversarial example is between clip_min and clip_max, if applicable. """ if clip_min is None ...
def next_sequence_id(session, sequence_ids, parent_vid, table_class, force_query = False): """ Return the next sequence id for a object, identified by the vid of the parent object, and the database prefix for the child object. On the first call, will load the max sequence number from the database, but s...
def function[next_sequence_id, parameter[session, sequence_ids, parent_vid, table_class, force_query]]: constant[ Return the next sequence id for a object, identified by the vid of the parent object, and the database prefix for the child object. On the first call, will load the max sequence number f...
keyword[def] identifier[next_sequence_id] ( identifier[session] , identifier[sequence_ids] , identifier[parent_vid] , identifier[table_class] , identifier[force_query] = keyword[False] ): literal[string] keyword[from] identifier[sqlalchemy] keyword[import] identifier[text] identifier[seq_col] = ...
def next_sequence_id(session, sequence_ids, parent_vid, table_class, force_query=False): """ Return the next sequence id for a object, identified by the vid of the parent object, and the database prefix for the child object. On the first call, will load the max sequence number from the database, but sub...
def api_routes(self, callsign: str) -> Tuple[Airport, ...]: """Returns the route associated to a callsign.""" from .. import airports c = requests.get( f"https://opensky-network.org/api/routes?callsign={callsign}" ) if c.status_code == 404: raise ValueErr...
def function[api_routes, parameter[self, callsign]]: constant[Returns the route associated to a callsign.] from relative_module[None] import module[airports] variable[c] assign[=] call[name[requests].get, parameter[<ast.JoinedStr object at 0x7da204346a10>]] if compare[name[c].status_code equ...
keyword[def] identifier[api_routes] ( identifier[self] , identifier[callsign] : identifier[str] )-> identifier[Tuple] [ identifier[Airport] ,...]: literal[string] keyword[from] .. keyword[import] identifier[airports] identifier[c] = identifier[requests] . identifier[get] ( lite...
def api_routes(self, callsign: str) -> Tuple[Airport, ...]: """Returns the route associated to a callsign.""" from .. import airports c = requests.get(f'https://opensky-network.org/api/routes?callsign={callsign}') if c.status_code == 404: raise ValueError('Unknown callsign') # depends on [contr...
def GetFormatStringAttributeNames(self): """Retrieves the attribute names in the format string. Returns: set(str): attribute names. """ if self._format_string_attribute_names is None: self._format_string_attribute_names = [] for format_string_piece in self.FORMAT_STRING_PIECES: ...
def function[GetFormatStringAttributeNames, parameter[self]]: constant[Retrieves the attribute names in the format string. Returns: set(str): attribute names. ] if compare[name[self]._format_string_attribute_names is constant[None]] begin[:] name[self]._format_string_attri...
keyword[def] identifier[GetFormatStringAttributeNames] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_format_string_attribute_names] keyword[is] keyword[None] : identifier[self] . identifier[_format_string_attribute_names] =[] keyword[for] identifier[form...
def GetFormatStringAttributeNames(self): """Retrieves the attribute names in the format string. Returns: set(str): attribute names. """ if self._format_string_attribute_names is None: self._format_string_attribute_names = [] for format_string_piece in self.FORMAT_STRING_PIECES: ...
def haversine(self, other): """ Calculate the great circle distance between two points on the earth (specified in decimal degrees) """ # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians,\ [self.lon.low, self['lat'].low, other.lon.low...
def function[haversine, parameter[self, other]]: constant[ Calculate the great circle distance between two points on the earth (specified in decimal degrees) ] <ast.Tuple object at 0x7da1b13d5d50> assign[=] call[name[map], parameter[name[radians], list[[<ast.Attribute object at 0...
keyword[def] identifier[haversine] ( identifier[self] , identifier[other] ): literal[string] identifier[lon1] , identifier[lat1] , identifier[lon2] , identifier[lat2] = identifier[map] ( identifier[radians] ,[ identifier[self] . identifier[lon] . identifier[low] , identifier[self] [ litera...
def haversine(self, other): """ Calculate the great circle distance between two points on the earth (specified in decimal degrees) """ # convert decimal degrees to radians (lon1, lat1, lon2, lat2) = map(radians, [self.lon.low, self['lat'].low, other.lon.low, other['lat'].low]) # ...
def delete(self, option=None): """Delete the current document in the Firestore database. Args: option (Optional[~.firestore_v1beta1.client.WriteOption]): A write option to make assertions / preconditions on the server state of the document before applying chang...
def function[delete, parameter[self, option]]: constant[Delete the current document in the Firestore database. Args: option (Optional[~.firestore_v1beta1.client.WriteOption]): A write option to make assertions / preconditions on the server state of the document...
keyword[def] identifier[delete] ( identifier[self] , identifier[option] = keyword[None] ): literal[string] identifier[write_pb] = identifier[_helpers] . identifier[pb_for_delete] ( identifier[self] . identifier[_document_path] , identifier[option] ) identifier[commit_response] = identifier...
def delete(self, option=None): """Delete the current document in the Firestore database. Args: option (Optional[~.firestore_v1beta1.client.WriteOption]): A write option to make assertions / preconditions on the server state of the document before applying changes. ...
def execute_request(server_url, creds, namespace, classname): """ Open a connection with the server_url and creds, and enumerate instances defined by the functions namespace and classname arguments. Displays either the error return or the mof for instances returned. """ prin...
def function[execute_request, parameter[server_url, creds, namespace, classname]]: constant[ Open a connection with the server_url and creds, and enumerate instances defined by the functions namespace and classname arguments. Displays either the error return or the mof for instances ...
keyword[def] identifier[execute_request] ( identifier[server_url] , identifier[creds] , identifier[namespace] , identifier[classname] ): literal[string] identifier[print] ( literal[string] %( identifier[server_url] , identifier[namespace] , identifier[classname] )) keyword[try] : ident...
def execute_request(server_url, creds, namespace, classname): """ Open a connection with the server_url and creds, and enumerate instances defined by the functions namespace and classname arguments. Displays either the error return or the mof for instances returned. """ print...
def get_model(self): """ Returns the fitted bayesian model Example ---------- >>> from pgmpy.readwrite import BIFReader >>> reader = BIFReader("bif_test.bif") >>> reader.get_model() <pgmpy.models.BayesianModel.BayesianModel object at 0x7f20af154320> ...
def function[get_model, parameter[self]]: constant[ Returns the fitted bayesian model Example ---------- >>> from pgmpy.readwrite import BIFReader >>> reader = BIFReader("bif_test.bif") >>> reader.get_model() <pgmpy.models.BayesianModel.BayesianModel obje...
keyword[def] identifier[get_model] ( identifier[self] ): literal[string] keyword[try] : identifier[model] = identifier[BayesianModel] () identifier[model] . identifier[add_nodes_from] ( identifier[self] . identifier[variable_names] ) identifier[model] . identi...
def get_model(self): """ Returns the fitted bayesian model Example ---------- >>> from pgmpy.readwrite import BIFReader >>> reader = BIFReader("bif_test.bif") >>> reader.get_model() <pgmpy.models.BayesianModel.BayesianModel object at 0x7f20af154320> "...
def scroll_deck(self, decknum, scroll_x, scroll_y): """Move a deck.""" self.scroll_deck_x(decknum, scroll_x) self.scroll_deck_y(decknum, scroll_y)
def function[scroll_deck, parameter[self, decknum, scroll_x, scroll_y]]: constant[Move a deck.] call[name[self].scroll_deck_x, parameter[name[decknum], name[scroll_x]]] call[name[self].scroll_deck_y, parameter[name[decknum], name[scroll_y]]]
keyword[def] identifier[scroll_deck] ( identifier[self] , identifier[decknum] , identifier[scroll_x] , identifier[scroll_y] ): literal[string] identifier[self] . identifier[scroll_deck_x] ( identifier[decknum] , identifier[scroll_x] ) identifier[self] . identifier[scroll_deck_y] ( identifi...
def scroll_deck(self, decknum, scroll_x, scroll_y): """Move a deck.""" self.scroll_deck_x(decknum, scroll_x) self.scroll_deck_y(decknum, scroll_y)
def btc_make_p2wpkh_address( pubkey_hex ): """ Make a p2wpkh address from a hex pubkey """ pubkey_hex = keylib.key_formatting.compress(pubkey_hex) hash160_bin = hashing.bin_hash160(pubkey_hex.decode('hex')) return segwit_addr_encode(hash160_bin)
def function[btc_make_p2wpkh_address, parameter[pubkey_hex]]: constant[ Make a p2wpkh address from a hex pubkey ] variable[pubkey_hex] assign[=] call[name[keylib].key_formatting.compress, parameter[name[pubkey_hex]]] variable[hash160_bin] assign[=] call[name[hashing].bin_hash160, paramet...
keyword[def] identifier[btc_make_p2wpkh_address] ( identifier[pubkey_hex] ): literal[string] identifier[pubkey_hex] = identifier[keylib] . identifier[key_formatting] . identifier[compress] ( identifier[pubkey_hex] ) identifier[hash160_bin] = identifier[hashing] . identifier[bin_hash160] ( identifier[p...
def btc_make_p2wpkh_address(pubkey_hex): """ Make a p2wpkh address from a hex pubkey """ pubkey_hex = keylib.key_formatting.compress(pubkey_hex) hash160_bin = hashing.bin_hash160(pubkey_hex.decode('hex')) return segwit_addr_encode(hash160_bin)
def __generate_actor(self, instance_id, operator, input, output): """Generates an actor that will execute a particular instance of the logical operator Attributes: instance_id (UUID): The id of the instance the actor will execute. operator (Operator): The metadata of the...
def function[__generate_actor, parameter[self, instance_id, operator, input, output]]: constant[Generates an actor that will execute a particular instance of the logical operator Attributes: instance_id (UUID): The id of the instance the actor will execute. operator (Ope...
keyword[def] identifier[__generate_actor] ( identifier[self] , identifier[instance_id] , identifier[operator] , identifier[input] , identifier[output] ): literal[string] identifier[actor_id] =( identifier[operator] . identifier[id] , identifier[instance_id] ) identifier[self] . id...
def __generate_actor(self, instance_id, operator, input, output): """Generates an actor that will execute a particular instance of the logical operator Attributes: instance_id (UUID): The id of the instance the actor will execute. operator (Operator): The metadata of the log...
def symbol(name: str=None, symbol_type: Type[Symbol]=Symbol) -> 'SymbolWildcard': """Create a `SymbolWildcard` that matches a single `Symbol` argument. Args: name: Optional variable name for the wildcard. symbol_type: An optional subclass of `Symb...
def function[symbol, parameter[name, symbol_type]]: constant[Create a `SymbolWildcard` that matches a single `Symbol` argument. Args: name: Optional variable name for the wildcard. symbol_type: An optional subclass of `Symbol` to further limit whi...
keyword[def] identifier[symbol] ( identifier[name] : identifier[str] = keyword[None] , identifier[symbol_type] : identifier[Type] [ identifier[Symbol] ]= identifier[Symbol] )-> literal[string] : literal[string] keyword[if] identifier[isinstance] ( identifier[name] , identifier[type] ) keyword[and]...
def symbol(name: str=None, symbol_type: Type[Symbol]=Symbol) -> 'SymbolWildcard': """Create a `SymbolWildcard` that matches a single `Symbol` argument. Args: name: Optional variable name for the wildcard. symbol_type: An optional subclass of `Symbol` ...
def free_slave(**connection_args): ''' Frees a slave from its master. This is a WIP, do not use. CLI Example: .. code-block:: bash salt '*' mysql.free_slave ''' slave_db = _connect(**connection_args) if slave_db is None: return '' slave_cur = slave_db.cursor(MySQLdb.c...
def function[free_slave, parameter[]]: constant[ Frees a slave from its master. This is a WIP, do not use. CLI Example: .. code-block:: bash salt '*' mysql.free_slave ] variable[slave_db] assign[=] call[name[_connect], parameter[]] if compare[name[slave_db] is constan...
keyword[def] identifier[free_slave] (** identifier[connection_args] ): literal[string] identifier[slave_db] = identifier[_connect] (** identifier[connection_args] ) keyword[if] identifier[slave_db] keyword[is] keyword[None] : keyword[return] literal[string] identifier[slave_cur] = i...
def free_slave(**connection_args): """ Frees a slave from its master. This is a WIP, do not use. CLI Example: .. code-block:: bash salt '*' mysql.free_slave """ slave_db = _connect(**connection_args) if slave_db is None: return '' # depends on [control=['if'], data=[]] ...
def full_split(text, regex): """ Split the text by the regex, keeping all parts. The parts should re-join back into the original text. >>> list(full_split('word', re.compile('&.*?'))) ['word'] """ while text: m = regex.search(text) if not m: yield text ...
def function[full_split, parameter[text, regex]]: constant[ Split the text by the regex, keeping all parts. The parts should re-join back into the original text. >>> list(full_split('word', re.compile('&.*?'))) ['word'] ] while name[text] begin[:] variable[m] assign[...
keyword[def] identifier[full_split] ( identifier[text] , identifier[regex] ): literal[string] keyword[while] identifier[text] : identifier[m] = identifier[regex] . identifier[search] ( identifier[text] ) keyword[if] keyword[not] identifier[m] : keyword[yield] identifier[t...
def full_split(text, regex): """ Split the text by the regex, keeping all parts. The parts should re-join back into the original text. >>> list(full_split('word', re.compile('&.*?'))) ['word'] """ while text: m = regex.search(text) if not m: yield text ...
def select_location(self): """Select directory.""" location = osp.normpath(getexistingdirectory(self, _("Select directory"), self.location)) if location: if is_writable(l...
def function[select_location, parameter[self]]: constant[Select directory.] variable[location] assign[=] call[name[osp].normpath, parameter[call[name[getexistingdirectory], parameter[name[self], call[name[_], parameter[constant[Select directory]]], name[self].location]]]] if name[location] begin...
keyword[def] identifier[select_location] ( identifier[self] ): literal[string] identifier[location] = identifier[osp] . identifier[normpath] ( identifier[getexistingdirectory] ( identifier[self] , identifier[_] ( literal[string] ), identifier[self] . identifier[location] )) ...
def select_location(self): """Select directory.""" location = osp.normpath(getexistingdirectory(self, _('Select directory'), self.location)) if location: if is_writable(location): self.location = location self.update_location() # depends on [control=['if'], data=[]] # depen...
def chownr(path, owner, group, follow_links=True, chowntopdir=False): """Recursively change user and group ownership of files and directories in given path. Doesn't chown path itself by default, only its children. :param str path: The string path to start changing ownership. :param str owner: The owner...
def function[chownr, parameter[path, owner, group, follow_links, chowntopdir]]: constant[Recursively change user and group ownership of files and directories in given path. Doesn't chown path itself by default, only its children. :param str path: The string path to start changing ownership. :param ...
keyword[def] identifier[chownr] ( identifier[path] , identifier[owner] , identifier[group] , identifier[follow_links] = keyword[True] , identifier[chowntopdir] = keyword[False] ): literal[string] identifier[uid] = identifier[pwd] . identifier[getpwnam] ( identifier[owner] ). identifier[pw_uid] identi...
def chownr(path, owner, group, follow_links=True, chowntopdir=False): """Recursively change user and group ownership of files and directories in given path. Doesn't chown path itself by default, only its children. :param str path: The string path to start changing ownership. :param str owner: The owner...
def predict(self, dt=None, UT=None, fx=None, **fx_args): r""" Performs the predict step of the UKF. On return, self.x and self.P contain the predicted state (x) and covariance (P). ' Important: this MUST be called before update() is called for the first time. Parameters...
def function[predict, parameter[self, dt, UT, fx]]: constant[ Performs the predict step of the UKF. On return, self.x and self.P contain the predicted state (x) and covariance (P). ' Important: this MUST be called before update() is called for the first time. Parameters...
keyword[def] identifier[predict] ( identifier[self] , identifier[dt] = keyword[None] , identifier[UT] = keyword[None] , identifier[fx] = keyword[None] ,** identifier[fx_args] ): literal[string] keyword[if] identifier[dt] keyword[is] keyword[None] : identifier[dt] = identifier[self]...
def predict(self, dt=None, UT=None, fx=None, **fx_args): """ Performs the predict step of the UKF. On return, self.x and self.P contain the predicted state (x) and covariance (P). ' Important: this MUST be called before update() is called for the first time. Parameters ...
def from_dict(cls, context_options_dict): """Return a context job from a dict output by Context.to_dict.""" import copy context_options = copy.deepcopy(context_options_dict) tasks_inserted = context_options.pop('_tasks_inserted', False) insert_tasks = context_options.pop('inse...
def function[from_dict, parameter[cls, context_options_dict]]: constant[Return a context job from a dict output by Context.to_dict.] import module[copy] variable[context_options] assign[=] call[name[copy].deepcopy, parameter[name[context_options_dict]]] variable[tasks_inserted] assign[=] cal...
keyword[def] identifier[from_dict] ( identifier[cls] , identifier[context_options_dict] ): literal[string] keyword[import] identifier[copy] identifier[context_options] = identifier[copy] . identifier[deepcopy] ( identifier[context_options_dict] ) identifier[tasks_inserted] = i...
def from_dict(cls, context_options_dict): """Return a context job from a dict output by Context.to_dict.""" import copy context_options = copy.deepcopy(context_options_dict) tasks_inserted = context_options.pop('_tasks_inserted', False) insert_tasks = context_options.pop('insert_tasks', None) if...
def scatter(x, y, z=None, c=None, cmap=None, s=None, discrete=None, ax=None, legend=None, figsize=None, xticks=False, yticks=False, zticks=False, xticklabels=True, yticklabels=True, zticklabels=True, label_prefix...
def function[scatter, parameter[x, y, z, c, cmap, s, discrete, ax, legend, figsize, xticks, yticks, zticks, xticklabels, yticklabels, zticklabels, label_prefix, xlabel, ylabel, zlabel, title, legend_title, legend_loc, filename, dpi]]: constant[Create a scatter plot Builds upon `matplotlib.pyplot.scatter` w...
keyword[def] identifier[scatter] ( identifier[x] , identifier[y] , identifier[z] = keyword[None] , identifier[c] = keyword[None] , identifier[cmap] = keyword[None] , identifier[s] = keyword[None] , identifier[discrete] = keyword[None] , identifier[ax] = keyword[None] , identifier[legend] = keyword[None] , identifie...
def scatter(x, y, z=None, c=None, cmap=None, s=None, discrete=None, ax=None, legend=None, figsize=None, xticks=False, yticks=False, zticks=False, xticklabels=True, yticklabels=True, zticklabels=True, label_prefix='PHATE', xlabel=None, ylabel=None, zlabel=None, title=None, legend_title='', legend_loc='best', filename=No...
def delete(method, hmc, uri, uri_parms, logon_required): """Operation: Delete User.""" try: user = hmc.lookup_by_uri(uri) except KeyError: raise InvalidResourceError(method, uri) # Check user type type_ = user.properties['type'] if type_ == 'patter...
def function[delete, parameter[method, hmc, uri, uri_parms, logon_required]]: constant[Operation: Delete User.] <ast.Try object at 0x7da1b05901c0> variable[type_] assign[=] call[name[user].properties][constant[type]] if compare[name[type_] equal[==] constant[pattern-based]] begin[:] ...
keyword[def] identifier[delete] ( identifier[method] , identifier[hmc] , identifier[uri] , identifier[uri_parms] , identifier[logon_required] ): literal[string] keyword[try] : identifier[user] = identifier[hmc] . identifier[lookup_by_uri] ( identifier[uri] ) keyword[except] i...
def delete(method, hmc, uri, uri_parms, logon_required): """Operation: Delete User.""" try: user = hmc.lookup_by_uri(uri) # depends on [control=['try'], data=[]] except KeyError: raise InvalidResourceError(method, uri) # depends on [control=['except'], data=[]] # Check user type ty...
def track(user_id, event, first_name=None, last_name=None, email=None, phone_number=None, apns_tokens=None, gcm_tokens=None, user_attributes=None, properties=None, on_error=None, on_success=None, timestamp=None): """ For any event you want to track, when a user triggers that event you would call...
def function[track, parameter[user_id, event, first_name, last_name, email, phone_number, apns_tokens, gcm_tokens, user_attributes, properties, on_error, on_success, timestamp]]: constant[ For any event you want to track, when a user triggers that event you would call this function. You can do an ident...
keyword[def] identifier[track] ( identifier[user_id] , identifier[event] , identifier[first_name] = keyword[None] , identifier[last_name] = keyword[None] , identifier[email] = keyword[None] , identifier[phone_number] = keyword[None] , identifier[apns_tokens] = keyword[None] , identifier[gcm_tokens] = keyword[None] ,...
def track(user_id, event, first_name=None, last_name=None, email=None, phone_number=None, apns_tokens=None, gcm_tokens=None, user_attributes=None, properties=None, on_error=None, on_success=None, timestamp=None): """ For any event you want to track, when a user triggers that event you would call this function. ...
def get_todo_items(self, **kwargs): ''' Returns an iterator that will provide each item in the todo queue. Note that to complete each item you have to run complete method with the output of this iterator. That will move the item to the done directory and prevent it from being retrieved in the f...
def function[get_todo_items, parameter[self]]: constant[ Returns an iterator that will provide each item in the todo queue. Note that to complete each item you have to run complete method with the output of this iterator. That will move the item to the done directory and prevent it from being r...
keyword[def] identifier[get_todo_items] ( identifier[self] ,** identifier[kwargs] ): literal[string] keyword[def] identifier[inner] ( identifier[self] ): keyword[for] identifier[item] keyword[in] identifier[self] . identifier[get_all_as_list] (): keyword[yield] id...
def get_todo_items(self, **kwargs): """ Returns an iterator that will provide each item in the todo queue. Note that to complete each item you have to run complete method with the output of this iterator. That will move the item to the done directory and prevent it from being retrieved in the futur...
def congruent(self, other): ''' A congruent B True iff all angles of 'A' equal angles in 'B' and all side lengths of 'A' equal all side lengths of 'B', boolean. ''' a = set(self.angles) b = set(other.angles) if len(a) != len(b) or len(a.difference(b)) ...
def function[congruent, parameter[self, other]]: constant[ A congruent B True iff all angles of 'A' equal angles in 'B' and all side lengths of 'A' equal all side lengths of 'B', boolean. ] variable[a] assign[=] call[name[set], parameter[name[self].angles]] vari...
keyword[def] identifier[congruent] ( identifier[self] , identifier[other] ): literal[string] identifier[a] = identifier[set] ( identifier[self] . identifier[angles] ) identifier[b] = identifier[set] ( identifier[other] . identifier[angles] ) keyword[if] identifier[len] ( identi...
def congruent(self, other): """ A congruent B True iff all angles of 'A' equal angles in 'B' and all side lengths of 'A' equal all side lengths of 'B', boolean. """ a = set(self.angles) b = set(other.angles) if len(a) != len(b) or len(a.difference(b)) != 0: retu...
def finish(self, code=None, message=None, perfdata=None, extdata=None): """ exit when using internal function to add results automatically generates output, but each parameter can be overriden all parameters are optional arguments: code: exit status code ...
def function[finish, parameter[self, code, message, perfdata, extdata]]: constant[ exit when using internal function to add results automatically generates output, but each parameter can be overriden all parameters are optional arguments: code: exit status code ...
keyword[def] identifier[finish] ( identifier[self] , identifier[code] = keyword[None] , identifier[message] = keyword[None] , identifier[perfdata] = keyword[None] , identifier[extdata] = keyword[None] ): literal[string] keyword[if] identifier[code] keyword[is] keyword[None] : identi...
def finish(self, code=None, message=None, perfdata=None, extdata=None): """ exit when using internal function to add results automatically generates output, but each parameter can be overriden all parameters are optional arguments: code: exit status code mes...
def post_save(self, obj, created=False): """indexes the object to ElasticSearch after any save function (POST/PUT) :param obj: instance of the saved object :param created: boolean expressing if object is newly created (`False` if updated) :return: `rest_framework.viewset.ModelViewSet.po...
def function[post_save, parameter[self, obj, created]]: constant[indexes the object to ElasticSearch after any save function (POST/PUT) :param obj: instance of the saved object :param created: boolean expressing if object is newly created (`False` if updated) :return: `rest_framework.vi...
keyword[def] identifier[post_save] ( identifier[self] , identifier[obj] , identifier[created] = keyword[False] ): literal[string] keyword[from] identifier[bulbs] . identifier[content] . identifier[tasks] keyword[import] identifier[index] identifier[index] . identifier[delay] ( identif...
def post_save(self, obj, created=False): """indexes the object to ElasticSearch after any save function (POST/PUT) :param obj: instance of the saved object :param created: boolean expressing if object is newly created (`False` if updated) :return: `rest_framework.viewset.ModelViewSet.post_s...
def enable_death_signal(_warn=True): """ Set the "death signal" of the current process, so that the current process will be cleaned with guarantee in case the parent dies accidentally. """ if platform.system() != 'Linux': return try: import prctl # pip install python-prctl...
def function[enable_death_signal, parameter[_warn]]: constant[ Set the "death signal" of the current process, so that the current process will be cleaned with guarantee in case the parent dies accidentally. ] if compare[call[name[platform].system, parameter[]] not_equal[!=] constant[Linu...
keyword[def] identifier[enable_death_signal] ( identifier[_warn] = keyword[True] ): literal[string] keyword[if] identifier[platform] . identifier[system] ()!= literal[string] : keyword[return] keyword[try] : keyword[import] identifier[prctl] keyword[except] identifier[Impor...
def enable_death_signal(_warn=True): """ Set the "death signal" of the current process, so that the current process will be cleaned with guarantee in case the parent dies accidentally. """ if platform.system() != 'Linux': return # depends on [control=['if'], data=[]] try: im...
def prune(self, dir): """Filter out files from 'dir/'.""" match = translate_pattern(os.path.join(dir, '**')) return self._remove_files(match.match)
def function[prune, parameter[self, dir]]: constant[Filter out files from 'dir/'.] variable[match] assign[=] call[name[translate_pattern], parameter[call[name[os].path.join, parameter[name[dir], constant[**]]]]] return[call[name[self]._remove_files, parameter[name[match].match]]]
keyword[def] identifier[prune] ( identifier[self] , identifier[dir] ): literal[string] identifier[match] = identifier[translate_pattern] ( identifier[os] . identifier[path] . identifier[join] ( identifier[dir] , literal[string] )) keyword[return] identifier[self] . identifier[_remove_file...
def prune(self, dir): """Filter out files from 'dir/'.""" match = translate_pattern(os.path.join(dir, '**')) return self._remove_files(match.match)
def unsubscribe(self, ssid, max_msgs=0): """ Takes a subscription sequence id and removes the subscription from the client, optionally after receiving more than max_msgs, and unsubscribes immediatedly. """ if self.is_closed: raise ErrConnectionClosed ...
def function[unsubscribe, parameter[self, ssid, max_msgs]]: constant[ Takes a subscription sequence id and removes the subscription from the client, optionally after receiving more than max_msgs, and unsubscribes immediatedly. ] if name[self].is_closed begin[:] <a...
keyword[def] identifier[unsubscribe] ( identifier[self] , identifier[ssid] , identifier[max_msgs] = literal[int] ): literal[string] keyword[if] identifier[self] . identifier[is_closed] : keyword[raise] identifier[ErrConnectionClosed] identifier[sub] = keyword[None] ...
def unsubscribe(self, ssid, max_msgs=0): """ Takes a subscription sequence id and removes the subscription from the client, optionally after receiving more than max_msgs, and unsubscribes immediatedly. """ if self.is_closed: raise ErrConnectionClosed # depends on [contro...
def _get_enterprise_operator_users_batch(self, start, end): """ Returns a batched queryset of User objects. """ LOGGER.info('Fetching new batch of enterprise operator users from indexes: %s to %s', start, end) return User.objects.filter(groups__name=ENTERPRISE_DATA_API_ACCESS_GRO...
def function[_get_enterprise_operator_users_batch, parameter[self, start, end]]: constant[ Returns a batched queryset of User objects. ] call[name[LOGGER].info, parameter[constant[Fetching new batch of enterprise operator users from indexes: %s to %s], name[start], name[end]]] return...
keyword[def] identifier[_get_enterprise_operator_users_batch] ( identifier[self] , identifier[start] , identifier[end] ): literal[string] identifier[LOGGER] . identifier[info] ( literal[string] , identifier[start] , identifier[end] ) keyword[return] identifier[User] . identifier[objects] ...
def _get_enterprise_operator_users_batch(self, start, end): """ Returns a batched queryset of User objects. """ LOGGER.info('Fetching new batch of enterprise operator users from indexes: %s to %s', start, end) return User.objects.filter(groups__name=ENTERPRISE_DATA_API_ACCESS_GROUP, is_staff...
def add_date_facet(self, *args, **kwargs): """Add a date factory facet""" self.facets.append(DateHistogramFacet(*args, **kwargs))
def function[add_date_facet, parameter[self]]: constant[Add a date factory facet] call[name[self].facets.append, parameter[call[name[DateHistogramFacet], parameter[<ast.Starred object at 0x7da20e962980>]]]]
keyword[def] identifier[add_date_facet] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[self] . identifier[facets] . identifier[append] ( identifier[DateHistogramFacet] (* identifier[args] ,** identifier[kwargs] ))
def add_date_facet(self, *args, **kwargs): """Add a date factory facet""" self.facets.append(DateHistogramFacet(*args, **kwargs))
def play(self, wav=None, data=None, rate=16000, channels=1, width=2, block=True, spectrum=None): """ play wav file or raw audio (string or generator) Args: wav: wav file path data: raw audio data, str or iterator rate: sample rate, only for raw audio ...
def function[play, parameter[self, wav, data, rate, channels, width, block, spectrum]]: constant[ play wav file or raw audio (string or generator) Args: wav: wav file path data: raw audio data, str or iterator rate: sample rate, only for raw audio ...
keyword[def] identifier[play] ( identifier[self] , identifier[wav] = keyword[None] , identifier[data] = keyword[None] , identifier[rate] = literal[int] , identifier[channels] = literal[int] , identifier[width] = literal[int] , identifier[block] = keyword[True] , identifier[spectrum] = keyword[None] ): litera...
def play(self, wav=None, data=None, rate=16000, channels=1, width=2, block=True, spectrum=None): """ play wav file or raw audio (string or generator) Args: wav: wav file path data: raw audio data, str or iterator rate: sample rate, only for raw audio c...
def save_file(self, data, dfile): """ Saves the Instances object in the specified file. :param data: the data to save :type data: Instances :param dfile: the file to save the data to :type dfile: str """ self.enforce_type(self.jobject, "weka.core.converte...
def function[save_file, parameter[self, data, dfile]]: constant[ Saves the Instances object in the specified file. :param data: the data to save :type data: Instances :param dfile: the file to save the data to :type dfile: str ] call[name[self].enforce_ty...
keyword[def] identifier[save_file] ( identifier[self] , identifier[data] , identifier[dfile] ): literal[string] identifier[self] . identifier[enforce_type] ( identifier[self] . identifier[jobject] , literal[string] ) keyword[if] keyword[not] identifier[javabridge] . identifier[is_instanc...
def save_file(self, data, dfile): """ Saves the Instances object in the specified file. :param data: the data to save :type data: Instances :param dfile: the file to save the data to :type dfile: str """ self.enforce_type(self.jobject, 'weka.core.converters.FileS...
def _compute_site_scaling(self, vs30, mean): """ Scales the ground motions by increasing 40 % on NEHRP class D/E sites, and decreasing by 40 % on NEHRP class A/B sites """ site_factor = np.ones(len(vs30), dtype=float) idx = vs30 <= 360. site_factor[idx] = 1.4 ...
def function[_compute_site_scaling, parameter[self, vs30, mean]]: constant[ Scales the ground motions by increasing 40 % on NEHRP class D/E sites, and decreasing by 40 % on NEHRP class A/B sites ] variable[site_factor] assign[=] call[name[np].ones, parameter[call[name[len], param...
keyword[def] identifier[_compute_site_scaling] ( identifier[self] , identifier[vs30] , identifier[mean] ): literal[string] identifier[site_factor] = identifier[np] . identifier[ones] ( identifier[len] ( identifier[vs30] ), identifier[dtype] = identifier[float] ) identifier[idx] = identifie...
def _compute_site_scaling(self, vs30, mean): """ Scales the ground motions by increasing 40 % on NEHRP class D/E sites, and decreasing by 40 % on NEHRP class A/B sites """ site_factor = np.ones(len(vs30), dtype=float) idx = vs30 <= 360.0 site_factor[idx] = 1.4 idx = vs30 > 76...
def remove_trunk_ports(self): """SDN Controller disable trunk ports :rtype: list[tuple[str, str]] """ ports = self.attributes.get("{}Disable Full Trunk Ports".format(self.namespace_prefix), None) return self._parse_ports(ports=ports)
def function[remove_trunk_ports, parameter[self]]: constant[SDN Controller disable trunk ports :rtype: list[tuple[str, str]] ] variable[ports] assign[=] call[name[self].attributes.get, parameter[call[constant[{}Disable Full Trunk Ports].format, parameter[name[self].namespace_prefix]], c...
keyword[def] identifier[remove_trunk_ports] ( identifier[self] ): literal[string] identifier[ports] = identifier[self] . identifier[attributes] . identifier[get] ( literal[string] . identifier[format] ( identifier[self] . identifier[namespace_prefix] ), keyword[None] ) keyword[return] ide...
def remove_trunk_ports(self): """SDN Controller disable trunk ports :rtype: list[tuple[str, str]] """ ports = self.attributes.get('{}Disable Full Trunk Ports'.format(self.namespace_prefix), None) return self._parse_ports(ports=ports)
def note_and_log(cls): """ This will be used as a decorator on class to activate logging and store messages in the variable cls._notes This will allow quick access to events in the web app. A note can be added to cls._notes without logging if passing the argument log=false to function note() ...
def function[note_and_log, parameter[cls]]: constant[ This will be used as a decorator on class to activate logging and store messages in the variable cls._notes This will allow quick access to events in the web app. A note can be added to cls._notes without logging if passing the argument l...
keyword[def] identifier[note_and_log] ( identifier[cls] ): literal[string] keyword[if] identifier[hasattr] ( identifier[cls] , literal[string] ): keyword[if] identifier[cls] . identifier[DEBUG_LEVEL] == literal[string] : identifier[file_level] = identifier[logging] . identifier[DEBU...
def note_and_log(cls): """ This will be used as a decorator on class to activate logging and store messages in the variable cls._notes This will allow quick access to events in the web app. A note can be added to cls._notes without logging if passing the argument log=false to function note() ...
def mkdir_p(path): ''' Mimic `mkdir -p` since os module doesn't provide one. :param str path: directory to create ''' assert isinstance(path, basestring), ("path must be a string but is %r" % path) try: os.makedirs(path) except OSError as exception: if exception.errno != errno.EEXIST: raise
def function[mkdir_p, parameter[path]]: constant[ Mimic `mkdir -p` since os module doesn't provide one. :param str path: directory to create ] assert[call[name[isinstance], parameter[name[path], name[basestring]]]] <ast.Try object at 0x7da2047e86d0>
keyword[def] identifier[mkdir_p] ( identifier[path] ): literal[string] keyword[assert] identifier[isinstance] ( identifier[path] , identifier[basestring] ),( literal[string] % identifier[path] ) keyword[try] : identifier[os] . identifier[makedirs] ( identifier[path] ) keyword[except] identifier[OS...
def mkdir_p(path): """ Mimic `mkdir -p` since os module doesn't provide one. :param str path: directory to create """ assert isinstance(path, basestring), 'path must be a string but is %r' % path try: os.makedirs(path) # depends on [control=['try'], data=[]] except OSError as exception: ...
def calldefs( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of :class:`calldef_t` declarations, t...
def function[calldefs, parameter[self, name, function, return_type, arg_types, header_dir, header_file, recursive, allow_empty]]: constant[returns a set of :class:`calldef_t` declarations, that are matched defined criteria] return[call[name[self]._find_multiple, parameter[call[name[self]._impl_match...
keyword[def] identifier[calldefs] ( identifier[self] , identifier[name] = keyword[None] , identifier[function] = keyword[None] , identifier[return_type] = keyword[None] , identifier[arg_types] = keyword[None] , identifier[header_dir] = keyword[None] , identifier[header_file] = keyword[None] , identifier[recur...
def calldefs(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of :class:`calldef_t` declarations, that are matched defined criteria""" return self._find_multiple(self._impl_matchers[scopedef_t.calldef...
def profiler(self): """Creates a dictionary from the profile scheme(s)""" logging.info('Loading profiles') # Initialise variables profiledata = defaultdict(make_dict) reverse_profiledata = dict() profileset = set() # Find all the unique profiles to use with a set ...
def function[profiler, parameter[self]]: constant[Creates a dictionary from the profile scheme(s)] call[name[logging].info, parameter[constant[Loading profiles]]] variable[profiledata] assign[=] call[name[defaultdict], parameter[name[make_dict]]] variable[reverse_profiledata] assign[=] c...
keyword[def] identifier[profiler] ( identifier[self] ): literal[string] identifier[logging] . identifier[info] ( literal[string] ) identifier[profiledata] = identifier[defaultdict] ( identifier[make_dict] ) identifier[reverse_profiledata] = identifier[dict] () id...
def profiler(self): """Creates a dictionary from the profile scheme(s)""" logging.info('Loading profiles') # Initialise variables profiledata = defaultdict(make_dict) reverse_profiledata = dict() profileset = set() # Find all the unique profiles to use with a set for sample in self.runme...
def predict_variant_effect_on_transcript_or_failure(variant, transcript): """ Try predicting the effect of a variant on a particular transcript but suppress raised exceptions by converting them into `Failure` effect values. """ try: return predict_variant_effect_on_transcript( ...
def function[predict_variant_effect_on_transcript_or_failure, parameter[variant, transcript]]: constant[ Try predicting the effect of a variant on a particular transcript but suppress raised exceptions by converting them into `Failure` effect values. ] <ast.Try object at 0x7da1b0404190>
keyword[def] identifier[predict_variant_effect_on_transcript_or_failure] ( identifier[variant] , identifier[transcript] ): literal[string] keyword[try] : keyword[return] identifier[predict_variant_effect_on_transcript] ( identifier[variant] = identifier[variant] , identifier[tra...
def predict_variant_effect_on_transcript_or_failure(variant, transcript): """ Try predicting the effect of a variant on a particular transcript but suppress raised exceptions by converting them into `Failure` effect values. """ try: return predict_variant_effect_on_transcript(variant=var...
def set_keyboard_focus(self, move_up, move_down, select): """ Set the keyboard as the object that controls the menu. move_up is from the pygame.KEYS enum that defines what button causes the menu selection to move up. move_down is from the pygame.KEYS enum that defines what button causes ...
def function[set_keyboard_focus, parameter[self, move_up, move_down, select]]: constant[ Set the keyboard as the object that controls the menu. move_up is from the pygame.KEYS enum that defines what button causes the menu selection to move up. move_down is from the pygame.KEYS enum that ...
keyword[def] identifier[set_keyboard_focus] ( identifier[self] , identifier[move_up] , identifier[move_down] , identifier[select] ): literal[string] identifier[self] . identifier[input_focus] = identifier[StateTypes] . identifier[KEYBOARD] identifier[self] . identifier[move_up_button] = i...
def set_keyboard_focus(self, move_up, move_down, select): """ Set the keyboard as the object that controls the menu. move_up is from the pygame.KEYS enum that defines what button causes the menu selection to move up. move_down is from the pygame.KEYS enum that defines what button causes the ...
def cli(): """Command line utility to HTTP enable (publish) a dataset.""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "dataset_uri", help="Dtool dataset URI" ) parser.add_argument( "-q", "--quiet", action="store_true", he...
def function[cli, parameter[]]: constant[Command line utility to HTTP enable (publish) a dataset.] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] call[name[parser].add_argument, parameter[constant[dataset_uri]]] call[name[parser].add_argument, parameter[const...
keyword[def] identifier[cli] (): literal[string] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] ( identifier[description] = identifier[__doc__] ) identifier[parser] . identifier[add_argument] ( literal[string] , identifier[help] = literal[string] ) identifie...
def cli(): """Command line utility to HTTP enable (publish) a dataset.""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('dataset_uri', help='Dtool dataset URI') parser.add_argument('-q', '--quiet', action='store_true', help='Only return the http URI') args = parser.parse_...
def reference_title_header_element(feature, parent): """Retrieve reference title header string from definitions.""" _ = feature, parent # NOQA header = reference_title_header['string_format'] return header.capitalize()
def function[reference_title_header_element, parameter[feature, parent]]: constant[Retrieve reference title header string from definitions.] variable[_] assign[=] tuple[[<ast.Name object at 0x7da1b0ce3e80>, <ast.Name object at 0x7da1b0ce1510>]] variable[header] assign[=] call[name[reference_titl...
keyword[def] identifier[reference_title_header_element] ( identifier[feature] , identifier[parent] ): literal[string] identifier[_] = identifier[feature] , identifier[parent] identifier[header] = identifier[reference_title_header] [ literal[string] ] keyword[return] identifier[header] . identif...
def reference_title_header_element(feature, parent): """Retrieve reference title header string from definitions.""" _ = (feature, parent) # NOQA header = reference_title_header['string_format'] return header.capitalize()
def _build_hexameter_template(self, stress_positions: str) -> str: """ Build a hexameter scansion template from string of 5 binary numbers; NOTE: Traditionally the fifth foot is dactyl and spondee substitution is rare, however since it *is* a possible combination, we include it here. ...
def function[_build_hexameter_template, parameter[self, stress_positions]]: constant[ Build a hexameter scansion template from string of 5 binary numbers; NOTE: Traditionally the fifth foot is dactyl and spondee substitution is rare, however since it *is* a possible combination, we inclu...
keyword[def] identifier[_build_hexameter_template] ( identifier[self] , identifier[stress_positions] : identifier[str] )-> identifier[str] : literal[string] identifier[hexameter] =[] keyword[for] identifier[binary] keyword[in] identifier[stress_positions] : keyword[if] ide...
def _build_hexameter_template(self, stress_positions: str) -> str: """ Build a hexameter scansion template from string of 5 binary numbers; NOTE: Traditionally the fifth foot is dactyl and spondee substitution is rare, however since it *is* a possible combination, we include it here. ...
def getScalars(self, inputData): """ Returns a numpy array containing the sub-field scalar value(s) for each sub-field of the ``inputData``. To get the associated field names for each of the scalar values, call :meth:`.getScalarNames()`. For a simple scalar encoder, the scalar value is simply the i...
def function[getScalars, parameter[self, inputData]]: constant[ Returns a numpy array containing the sub-field scalar value(s) for each sub-field of the ``inputData``. To get the associated field names for each of the scalar values, call :meth:`.getScalarNames()`. For a simple scalar encoder, t...
keyword[def] identifier[getScalars] ( identifier[self] , identifier[inputData] ): literal[string] identifier[retVals] = identifier[numpy] . identifier[array] ([]) keyword[if] identifier[self] . identifier[encoders] keyword[is] keyword[not] keyword[None] : keyword[for] ( identifier[name] ,...
def getScalars(self, inputData): """ Returns a numpy array containing the sub-field scalar value(s) for each sub-field of the ``inputData``. To get the associated field names for each of the scalar values, call :meth:`.getScalarNames()`. For a simple scalar encoder, the scalar value is simply the i...
def short_form_one_format(jupytext_format): """Represent one jupytext format as a string""" if not isinstance(jupytext_format, dict): return jupytext_format fmt = jupytext_format['extension'] if 'suffix' in jupytext_format: fmt = jupytext_format['suffix'] + fmt elif fmt.startswith('....
def function[short_form_one_format, parameter[jupytext_format]]: constant[Represent one jupytext format as a string] if <ast.UnaryOp object at 0x7da20e963250> begin[:] return[name[jupytext_format]] variable[fmt] assign[=] call[name[jupytext_format]][constant[extension]] if compar...
keyword[def] identifier[short_form_one_format] ( identifier[jupytext_format] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[jupytext_format] , identifier[dict] ): keyword[return] identifier[jupytext_format] identifier[fmt] = identifier[jupytext_format] [ l...
def short_form_one_format(jupytext_format): """Represent one jupytext format as a string""" if not isinstance(jupytext_format, dict): return jupytext_format # depends on [control=['if'], data=[]] fmt = jupytext_format['extension'] if 'suffix' in jupytext_format: fmt = jupytext_format['s...
def get_proficiencies_for_objectives(self, objective_ids): """Gets a ``ProficiencyList`` relating to the given objectives. arg: objective_ids (osid.id.IdList): the objective ``Ids`` return: (osid.learning.ProficiencyList) - the returned ``Proficiency`` list raise: Nu...
def function[get_proficiencies_for_objectives, parameter[self, objective_ids]]: constant[Gets a ``ProficiencyList`` relating to the given objectives. arg: objective_ids (osid.id.IdList): the objective ``Ids`` return: (osid.learning.ProficiencyList) - the returned ``Proficienc...
keyword[def] identifier[get_proficiencies_for_objectives] ( identifier[self] , identifier[objective_ids] ): literal[string] identifier[collection] = identifier[JSONClientValidated] ( literal[string] , identifier[collection] = literal[string] , identifier...
def get_proficiencies_for_objectives(self, objective_ids): """Gets a ``ProficiencyList`` relating to the given objectives. arg: objective_ids (osid.id.IdList): the objective ``Ids`` return: (osid.learning.ProficiencyList) - the returned ``Proficiency`` list raise: NullAr...
def shuffle_egg(egg): """ Shuffle an Egg's recalls""" from .egg import Egg pres, rec, features, dist_funcs = parse_egg(egg) if pres.ndim==1: pres = pres.reshape(1, pres.shape[0]) rec = rec.reshape(1, rec.shape[0]) features = features.reshape(1, features.shape[0]) for ilist ...
def function[shuffle_egg, parameter[egg]]: constant[ Shuffle an Egg's recalls] from relative_module[egg] import module[Egg] <ast.Tuple object at 0x7da1b10273d0> assign[=] call[name[parse_egg], parameter[name[egg]]] if compare[name[pres].ndim equal[==] constant[1]] begin[:] va...
keyword[def] identifier[shuffle_egg] ( identifier[egg] ): literal[string] keyword[from] . identifier[egg] keyword[import] identifier[Egg] identifier[pres] , identifier[rec] , identifier[features] , identifier[dist_funcs] = identifier[parse_egg] ( identifier[egg] ) keyword[if] identifier[pres...
def shuffle_egg(egg): """ Shuffle an Egg's recalls""" from .egg import Egg (pres, rec, features, dist_funcs) = parse_egg(egg) if pres.ndim == 1: pres = pres.reshape(1, pres.shape[0]) rec = rec.reshape(1, rec.shape[0]) features = features.reshape(1, features.shape[0]) # depends o...
def WriteToPath(obj, filepath): """Serializes and writes given Python object to the specified YAML file. Args: obj: A Python object to serialize. filepath: A path to the file into which the object is to be written. """ with io.open(filepath, mode="w", encoding="utf-8") as filedesc: WriteToFile(obj,...
def function[WriteToPath, parameter[obj, filepath]]: constant[Serializes and writes given Python object to the specified YAML file. Args: obj: A Python object to serialize. filepath: A path to the file into which the object is to be written. ] with call[name[io].open, parameter[name[filepat...
keyword[def] identifier[WriteToPath] ( identifier[obj] , identifier[filepath] ): literal[string] keyword[with] identifier[io] . identifier[open] ( identifier[filepath] , identifier[mode] = literal[string] , identifier[encoding] = literal[string] ) keyword[as] identifier[filedesc] : identifier[WriteToFil...
def WriteToPath(obj, filepath): """Serializes and writes given Python object to the specified YAML file. Args: obj: A Python object to serialize. filepath: A path to the file into which the object is to be written. """ with io.open(filepath, mode='w', encoding='utf-8') as filedesc: WriteToF...
def get_info(dstore): """ :returns: {'stats': dic, 'loss_types': dic, 'num_rlzs': R} """ oq = dstore['oqparam'] stats = {stat: s for s, stat in enumerate(oq.hazard_stats())} loss_types = {lt: l for l, lt in enumerate(oq.loss_dt().names)} imt = {imt: i for i, imt in enumerate(oq.imtls)} n...
def function[get_info, parameter[dstore]]: constant[ :returns: {'stats': dic, 'loss_types': dic, 'num_rlzs': R} ] variable[oq] assign[=] call[name[dstore]][constant[oqparam]] variable[stats] assign[=] <ast.DictComp object at 0x7da2054a7460> variable[loss_types] assign[=] <ast.Dic...
keyword[def] identifier[get_info] ( identifier[dstore] ): literal[string] identifier[oq] = identifier[dstore] [ literal[string] ] identifier[stats] ={ identifier[stat] : identifier[s] keyword[for] identifier[s] , identifier[stat] keyword[in] identifier[enumerate] ( identifier[oq] . identifier[haza...
def get_info(dstore): """ :returns: {'stats': dic, 'loss_types': dic, 'num_rlzs': R} """ oq = dstore['oqparam'] stats = {stat: s for (s, stat) in enumerate(oq.hazard_stats())} loss_types = {lt: l for (l, lt) in enumerate(oq.loss_dt().names)} imt = {imt: i for (i, imt) in enumerate(oq.imtls)}...
def _get_arn_from_idempotency_token(self, token): """ If token doesnt exist, return None, later it will be set with an expiry and arn. If token expiry has passed, delete entry and return None Else return ARN :param token: String token :return: None or ARN ...
def function[_get_arn_from_idempotency_token, parameter[self, token]]: constant[ If token doesnt exist, return None, later it will be set with an expiry and arn. If token expiry has passed, delete entry and return None Else return ARN :param token: String token ...
keyword[def] identifier[_get_arn_from_idempotency_token] ( identifier[self] , identifier[token] ): literal[string] identifier[now] = identifier[datetime] . identifier[datetime] . identifier[now] () keyword[if] identifier[token] keyword[in] identifier[self] . identifier[_idempotency_toke...
def _get_arn_from_idempotency_token(self, token): """ If token doesnt exist, return None, later it will be set with an expiry and arn. If token expiry has passed, delete entry and return None Else return ARN :param token: String token :return: None or ARN "...
def map_custom_field(custom_fields, fields): """Add extra information for custom fields. :param custom_fields: set of custom fields with the extra information :param fields: fields of the issue where to add the extra information :returns: an set of items with the extra information mapped """ d...
def function[map_custom_field, parameter[custom_fields, fields]]: constant[Add extra information for custom fields. :param custom_fields: set of custom fields with the extra information :param fields: fields of the issue where to add the extra information :returns: an set of items with the extra i...
keyword[def] identifier[map_custom_field] ( identifier[custom_fields] , identifier[fields] ): literal[string] keyword[def] identifier[build_cf] ( identifier[cf] , identifier[v] ): keyword[return] { literal[string] : identifier[cf] [ literal[string] ], literal[string] : identifier[cf] [ literal[st...
def map_custom_field(custom_fields, fields): """Add extra information for custom fields. :param custom_fields: set of custom fields with the extra information :param fields: fields of the issue where to add the extra information :returns: an set of items with the extra information mapped """ ...
def get_net_configuration(self, channel=None, gateway_macs=True): """Get network configuration data Retrieve network configuration from the target :param channel: Channel to configure, defaults to None for 'autodetect' :param gateway_macs: Whether to retrieve mac addresses for gateways...
def function[get_net_configuration, parameter[self, channel, gateway_macs]]: constant[Get network configuration data Retrieve network configuration from the target :param channel: Channel to configure, defaults to None for 'autodetect' :param gateway_macs: Whether to retrieve mac addre...
keyword[def] identifier[get_net_configuration] ( identifier[self] , identifier[channel] = keyword[None] , identifier[gateway_macs] = keyword[True] ): literal[string] keyword[if] identifier[channel] keyword[is] keyword[None] : identifier[channel] = identifier[self] . identifier[get_n...
def get_net_configuration(self, channel=None, gateway_macs=True): """Get network configuration data Retrieve network configuration from the target :param channel: Channel to configure, defaults to None for 'autodetect' :param gateway_macs: Whether to retrieve mac addresses for gateways ...
def pformat(self, prefix=()): ''' Makes a pretty ASCII format of the data, suitable for displaying in a console or saving to a text file. Returns a list of lines. ''' nan = float("nan") def sformat(segment, stat): FMT = "n={0}, mean={1}, p50/...
def function[pformat, parameter[self, prefix]]: constant[ Makes a pretty ASCII format of the data, suitable for displaying in a console or saving to a text file. Returns a list of lines. ] variable[nan] assign[=] call[name[float], parameter[constant[nan]]] def fun...
keyword[def] identifier[pformat] ( identifier[self] , identifier[prefix] =()): literal[string] identifier[nan] = identifier[float] ( literal[string] ) keyword[def] identifier[sformat] ( identifier[segment] , identifier[stat] ): identifier[FMT] = literal[string] ...
def pformat(self, prefix=()): """ Makes a pretty ASCII format of the data, suitable for displaying in a console or saving to a text file. Returns a list of lines. """ nan = float('nan') def sformat(segment, stat): FMT = 'n={0}, mean={1}, p50/95={2}/{3}, max={4}' ...
def _qualified_key(self, key): """ Prepends the configured prefix to the key (if applicable). :param key: The unprefixed key. :return: The key with any configured prefix prepended. """ pfx = self.key_prefix if self.key_prefix is not None else '' return '{}{}'.for...
def function[_qualified_key, parameter[self, key]]: constant[ Prepends the configured prefix to the key (if applicable). :param key: The unprefixed key. :return: The key with any configured prefix prepended. ] variable[pfx] assign[=] <ast.IfExp object at 0x7da18f00cdc0> ...
keyword[def] identifier[_qualified_key] ( identifier[self] , identifier[key] ): literal[string] identifier[pfx] = identifier[self] . identifier[key_prefix] keyword[if] identifier[self] . identifier[key_prefix] keyword[is] keyword[not] keyword[None] keyword[else] literal[string] key...
def _qualified_key(self, key): """ Prepends the configured prefix to the key (if applicable). :param key: The unprefixed key. :return: The key with any configured prefix prepended. """ pfx = self.key_prefix if self.key_prefix is not None else '' return '{}{}'.format(pfx, key...
def freeze(dest_dir, opt): """Iterates over the Secretfile looking for secrets to freeze""" tmp_dir = ensure_tmpdir() dest_prefix = "%s/dest" % tmp_dir ensure_dir(dest_dir) ensure_dir(dest_prefix) config = get_secretfile(opt) Context.load(config, opt) \ .freeze(dest_prefix) zi...
def function[freeze, parameter[dest_dir, opt]]: constant[Iterates over the Secretfile looking for secrets to freeze] variable[tmp_dir] assign[=] call[name[ensure_tmpdir], parameter[]] variable[dest_prefix] assign[=] binary_operation[constant[%s/dest] <ast.Mod object at 0x7da2590d6920> name[tmp_d...
keyword[def] identifier[freeze] ( identifier[dest_dir] , identifier[opt] ): literal[string] identifier[tmp_dir] = identifier[ensure_tmpdir] () identifier[dest_prefix] = literal[string] % identifier[tmp_dir] identifier[ensure_dir] ( identifier[dest_dir] ) identifier[ensure_dir] ( identifier[...
def freeze(dest_dir, opt): """Iterates over the Secretfile looking for secrets to freeze""" tmp_dir = ensure_tmpdir() dest_prefix = '%s/dest' % tmp_dir ensure_dir(dest_dir) ensure_dir(dest_prefix) config = get_secretfile(opt) Context.load(config, opt).freeze(dest_prefix) zip_filename = f...
def _add_hook(self, socket, callback): """Generic hook. The passed socket has to be "receive only". """ self._hooks.append(socket) self._hooks_cb[socket] = callback if self.poller: self.poller.register(socket, POLLIN)
def function[_add_hook, parameter[self, socket, callback]]: constant[Generic hook. The passed socket has to be "receive only". ] call[name[self]._hooks.append, parameter[name[socket]]] call[name[self]._hooks_cb][name[socket]] assign[=] name[callback] if name[self].poller begin[:]...
keyword[def] identifier[_add_hook] ( identifier[self] , identifier[socket] , identifier[callback] ): literal[string] identifier[self] . identifier[_hooks] . identifier[append] ( identifier[socket] ) identifier[self] . identifier[_hooks_cb] [ identifier[socket] ]= identifier[callback] ...
def _add_hook(self, socket, callback): """Generic hook. The passed socket has to be "receive only". """ self._hooks.append(socket) self._hooks_cb[socket] = callback if self.poller: self.poller.register(socket, POLLIN) # depends on [control=['if'], data=[]]
def convert_to_string(self, block): """ Takes a list of SeqRecordExpanded objects corresponding to a gene_code and produces the gene_block as string. :param block: :return: str. """ if self.aminoacids: molecule_type = "protein" else: ...
def function[convert_to_string, parameter[self, block]]: constant[ Takes a list of SeqRecordExpanded objects corresponding to a gene_code and produces the gene_block as string. :param block: :return: str. ] if name[self].aminoacids begin[:] variab...
keyword[def] identifier[convert_to_string] ( identifier[self] , identifier[block] ): literal[string] keyword[if] identifier[self] . identifier[aminoacids] : identifier[molecule_type] = literal[string] keyword[else] : identifier[molecule_type] = literal[string] ...
def convert_to_string(self, block): """ Takes a list of SeqRecordExpanded objects corresponding to a gene_code and produces the gene_block as string. :param block: :return: str. """ if self.aminoacids: molecule_type = 'protein' # depends on [control=['if'], data...