code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def is_header(self): """ Whether or not the cell is a header Any header cell will have "=" instead of "-" on its border. For example, this is a header cell:: +-----+ | foo | +=====+ while this cell is not:: +-----+ ...
def function[is_header, parameter[self]]: constant[ Whether or not the cell is a header Any header cell will have "=" instead of "-" on its border. For example, this is a header cell:: +-----+ | foo | +=====+ while this cell is not:: ...
keyword[def] identifier[is_header] ( identifier[self] ): literal[string] identifier[bottom_line] = identifier[self] . identifier[text] . identifier[split] ( literal[string] )[- literal[int] ] keyword[if] identifier[is_only] ( identifier[bottom_line] ,[ literal[string] , literal[string] ]...
def is_header(self): """ Whether or not the cell is a header Any header cell will have "=" instead of "-" on its border. For example, this is a header cell:: +-----+ | foo | +=====+ while this cell is not:: +-----+ | fo...
def SetPassword(self, Password, Hint=''): """Sets the chat password. :Parameters: Password : unicode Password Hint : unicode Password hint """ if ' ' in Password: raise ValueError('Password mut be one word') self._Alter('SE...
def function[SetPassword, parameter[self, Password, Hint]]: constant[Sets the chat password. :Parameters: Password : unicode Password Hint : unicode Password hint ] if compare[constant[ ] in name[Password]] begin[:] <ast.Raise object a...
keyword[def] identifier[SetPassword] ( identifier[self] , identifier[Password] , identifier[Hint] = literal[string] ): literal[string] keyword[if] literal[string] keyword[in] identifier[Password] : keyword[raise] identifier[ValueError] ( literal[string] ) identifier[self] ...
def SetPassword(self, Password, Hint=''): """Sets the chat password. :Parameters: Password : unicode Password Hint : unicode Password hint """ if ' ' in Password: raise ValueError('Password mut be one word') # depends on [control=['if'], data...
def get_ids_in_region( self, resource, resolution, x_range, y_range, z_range, time_range=[0, 1]): """Get all ids in the region defined by x_range, y_range, z_range. Args: resource (intern.resource.Resource): An annotation channel. resolution (int): 0 indi...
def function[get_ids_in_region, parameter[self, resource, resolution, x_range, y_range, z_range, time_range]]: constant[Get all ids in the region defined by x_range, y_range, z_range. Args: resource (intern.resource.Resource): An annotation channel. resolution (int): 0 indicates...
keyword[def] identifier[get_ids_in_region] ( identifier[self] , identifier[resource] , identifier[resolution] , identifier[x_range] , identifier[y_range] , identifier[z_range] , identifier[time_range] =[ literal[int] , literal[int] ]): literal[string] keyword[return] identifier[self] . identifie...
def get_ids_in_region(self, resource, resolution, x_range, y_range, z_range, time_range=[0, 1]): """Get all ids in the region defined by x_range, y_range, z_range. Args: resource (intern.resource.Resource): An annotation channel. resolution (int): 0 indicates native resolution. ...
def expand_actions(self, actions): """ Accepts an array of actions and returns an array of actions which match """ r = [] for action in actions: r.append(action) if action in self.aliased_actions: r.extend(self.aliased_actions[action]) ...
def function[expand_actions, parameter[self, actions]]: constant[ Accepts an array of actions and returns an array of actions which match ] variable[r] assign[=] list[[]] for taget[name[action]] in starred[name[actions]] begin[:] call[name[r].append, parameter[nam...
keyword[def] identifier[expand_actions] ( identifier[self] , identifier[actions] ): literal[string] identifier[r] =[] keyword[for] identifier[action] keyword[in] identifier[actions] : identifier[r] . identifier[append] ( identifier[action] ) keyword[if] identi...
def expand_actions(self, actions): """ Accepts an array of actions and returns an array of actions which match """ r = [] for action in actions: r.append(action) if action in self.aliased_actions: r.extend(self.aliased_actions[action]) # depends on [control=['if'...
def collect_metadata(self, name, obj): """Collect all file variables and attributes for the provided file object. This method also iterates through subgroups of the provided object. """ # Look through each subgroup base_name = name + "/" if name else "" for group_name, g...
def function[collect_metadata, parameter[self, name, obj]]: constant[Collect all file variables and attributes for the provided file object. This method also iterates through subgroups of the provided object. ] variable[base_name] assign[=] <ast.IfExp object at 0x7da1b22f97b0> f...
keyword[def] identifier[collect_metadata] ( identifier[self] , identifier[name] , identifier[obj] ): literal[string] identifier[base_name] = identifier[name] + literal[string] keyword[if] identifier[name] keyword[else] literal[string] keyword[for] identifier[group_name] , id...
def collect_metadata(self, name, obj): """Collect all file variables and attributes for the provided file object. This method also iterates through subgroups of the provided object. """ # Look through each subgroup base_name = name + '/' if name else '' for (group_name, group_obj) in ob...
def pkill(): """Kill all of FIO processes""" if env(): return 1 cmd = ["ps -aux | grep fio | grep -v grep"] status, _, _ = cij.ssh.command(cmd, shell=True, echo=False) if not status: status, _, _ = cij.ssh.command(["pkill -f fio"], shell=True) if status: return ...
def function[pkill, parameter[]]: constant[Kill all of FIO processes] if call[name[env], parameter[]] begin[:] return[constant[1]] variable[cmd] assign[=] list[[<ast.Constant object at 0x7da1b007de40>]] <ast.Tuple object at 0x7da1b007fca0> assign[=] call[name[cij].ssh.command, pa...
keyword[def] identifier[pkill] (): literal[string] keyword[if] identifier[env] (): keyword[return] literal[int] identifier[cmd] =[ literal[string] ] identifier[status] , identifier[_] , identifier[_] = identifier[cij] . identifier[ssh] . identifier[command] ( identifier[cmd] , ident...
def pkill(): """Kill all of FIO processes""" if env(): return 1 # depends on [control=['if'], data=[]] cmd = ['ps -aux | grep fio | grep -v grep'] (status, _, _) = cij.ssh.command(cmd, shell=True, echo=False) if not status: (status, _, _) = cij.ssh.command(['pkill -f fio'], shell=Tr...
def add_avatar_image(self, mime_type, *, id_=None, image_bytes=None, width=None, height=None, url=None, nbytes=None): """ Add a source of the avatar image. All sources of an avatar image added to an avatar set must be *the same image*, i...
def function[add_avatar_image, parameter[self, mime_type]]: constant[ Add a source of the avatar image. All sources of an avatar image added to an avatar set must be *the same image*, in different formats and sizes. :param mime_type: The MIME type of the avatar image. :...
keyword[def] identifier[add_avatar_image] ( identifier[self] , identifier[mime_type] ,*, identifier[id_] = keyword[None] , identifier[image_bytes] = keyword[None] , identifier[width] = keyword[None] , identifier[height] = keyword[None] , identifier[url] = keyword[None] , identifier[nbytes] = keyword[None] ): ...
def add_avatar_image(self, mime_type, *, id_=None, image_bytes=None, width=None, height=None, url=None, nbytes=None): """ Add a source of the avatar image. All sources of an avatar image added to an avatar set must be *the same image*, in different formats and sizes. :param mime_ty...
def __api_descriptor(self, services, hostname=None): """Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. ...
def function[__api_descriptor, parameter[self, services, hostname]]: constant[Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current se...
keyword[def] identifier[__api_descriptor] ( identifier[self] , identifier[services] , identifier[hostname] = keyword[None] ): literal[string] identifier[merged_api_info] = identifier[self] . identifier[__get_merged_api_info] ( identifier[services] ) identifier[descriptor] = identifier[self] . identifi...
def __api_descriptor(self, services, hostname=None): """Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. ...
def _print(pass_through_tensor, values): """Wrapper for tf.Print which supports lists and namedtuples for printing.""" flat_values = [] for value in values: # Checks if it is a namedtuple. if hasattr(value, '_fields'): for field in value._fields: flat_values.extend([field, _to_str(getattr(va...
def function[_print, parameter[pass_through_tensor, values]]: constant[Wrapper for tf.Print which supports lists and namedtuples for printing.] variable[flat_values] assign[=] list[[]] for taget[name[value]] in starred[name[values]] begin[:] if call[name[hasattr], parameter[name[...
keyword[def] identifier[_print] ( identifier[pass_through_tensor] , identifier[values] ): literal[string] identifier[flat_values] =[] keyword[for] identifier[value] keyword[in] identifier[values] : keyword[if] identifier[hasattr] ( identifier[value] , literal[string] ): keyword[for] iden...
def _print(pass_through_tensor, values): """Wrapper for tf.Print which supports lists and namedtuples for printing.""" flat_values = [] for value in values: # Checks if it is a namedtuple. if hasattr(value, '_fields'): for field in value._fields: flat_values.exten...
def role_get(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None, return_password=False): ''' Return a dict with information about users of a Postgres server. Set return_password to True to get password hash in the result. CLI Example: .. code-block:...
def function[role_get, parameter[name, user, host, port, maintenance_db, password, runas, return_password]]: constant[ Return a dict with information about users of a Postgres server. Set return_password to True to get password hash in the result. CLI Example: .. code-block:: bash sa...
keyword[def] identifier[role_get] ( identifier[name] , identifier[user] = keyword[None] , identifier[host] = keyword[None] , identifier[port] = keyword[None] , identifier[maintenance_db] = keyword[None] , identifier[password] = keyword[None] , identifier[runas] = keyword[None] , identifier[return_password] = keyword...
def role_get(name, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None, return_password=False): """ Return a dict with information about users of a Postgres server. Set return_password to True to get password hash in the result. CLI Example: .. code-block:: bash ...
def kalman_filter(cls, p_A, p_Q, p_H, p_R, Y, index=None, m_init=None, P_init=None, p_kalman_filter_type='regular', calc_log_likelihood=False, calc_grad_log_likelihood=False, grad_params_no=None, grad_calc_params=None): """ ...
def function[kalman_filter, parameter[cls, p_A, p_Q, p_H, p_R, Y, index, m_init, P_init, p_kalman_filter_type, calc_log_likelihood, calc_grad_log_likelihood, grad_params_no, grad_calc_params]]: constant[ This function implements the basic Kalman Filter algorithm These notations for the State-Spa...
keyword[def] identifier[kalman_filter] ( identifier[cls] , identifier[p_A] , identifier[p_Q] , identifier[p_H] , identifier[p_R] , identifier[Y] , identifier[index] = keyword[None] , identifier[m_init] = keyword[None] , identifier[P_init] = keyword[None] , identifier[p_kalman_filter_type] = literal[string] , identi...
def kalman_filter(cls, p_A, p_Q, p_H, p_R, Y, index=None, m_init=None, P_init=None, p_kalman_filter_type='regular', calc_log_likelihood=False, calc_grad_log_likelihood=False, grad_params_no=None, grad_calc_params=None): """ This function implements the basic Kalman Filter algorithm These notations f...
def write(self, outfile=None, section=None): """ Write the current ConfigObj as a file tekNico: FIXME: use StringIO instead of real files >>> filename = a.filename # doctest: +SKIP >>> a.filename = 'test.ini' # doctest: +SKIP >>> a.write() # doctest: +SKIP ...
def function[write, parameter[self, outfile, section]]: constant[ Write the current ConfigObj as a file tekNico: FIXME: use StringIO instead of real files >>> filename = a.filename # doctest: +SKIP >>> a.filename = 'test.ini' # doctest: +SKIP >>> a.write() # doctes...
keyword[def] identifier[write] ( identifier[self] , identifier[outfile] = keyword[None] , identifier[section] = keyword[None] ): literal[string] keyword[if] identifier[self] . identifier[indent_type] keyword[is] keyword[None] : identifier[self] . identifier[indent_type] = i...
def write(self, outfile=None, section=None): """ Write the current ConfigObj as a file tekNico: FIXME: use StringIO instead of real files >>> filename = a.filename # doctest: +SKIP >>> a.filename = 'test.ini' # doctest: +SKIP >>> a.write() # doctest: +SKIP >>> ...
def json( body, status=200, headers=None, content_type="application/json", dumps=json_dumps, **kwargs ): """ Returns response object with body in json format. :param body: Response data to be serialized. :param status: Response code. :param headers: Custom Headers. :para...
def function[json, parameter[body, status, headers, content_type, dumps]]: constant[ Returns response object with body in json format. :param body: Response data to be serialized. :param status: Response code. :param headers: Custom Headers. :param kwargs: Remaining arguments that are passe...
keyword[def] identifier[json] ( identifier[body] , identifier[status] = literal[int] , identifier[headers] = keyword[None] , identifier[content_type] = literal[string] , identifier[dumps] = identifier[json_dumps] , ** identifier[kwargs] ): literal[string] keyword[return] identifier[HTTPResponse] ( ...
def json(body, status=200, headers=None, content_type='application/json', dumps=json_dumps, **kwargs): """ Returns response object with body in json format. :param body: Response data to be serialized. :param status: Response code. :param headers: Custom Headers. :param kwargs: Remaining argume...
def solve_venn3_circles(venn_areas): ''' Given the list of "venn areas" (as output from compute_venn3_areas, i.e. [A, B, C, AB, BC, AC, ABC]), finds the positions and radii of the three circles. The return value is a tuple (coords, radii), where coords is a 3x2 array of coordinates and radii is a 3x...
def function[solve_venn3_circles, parameter[venn_areas]]: constant[ Given the list of "venn areas" (as output from compute_venn3_areas, i.e. [A, B, C, AB, BC, AC, ABC]), finds the positions and radii of the three circles. The return value is a tuple (coords, radii), where coords is a 3x2 array of co...
keyword[def] identifier[solve_venn3_circles] ( identifier[venn_areas] ): literal[string] ( identifier[A_a] , identifier[A_b] , identifier[A_c] , identifier[A_ab] , identifier[A_bc] , identifier[A_ac] , identifier[A_abc] )= identifier[list] ( identifier[map] ( identifier[float] , identifier[venn_areas] )) ...
def solve_venn3_circles(venn_areas): """ Given the list of "venn areas" (as output from compute_venn3_areas, i.e. [A, B, C, AB, BC, AC, ABC]), finds the positions and radii of the three circles. The return value is a tuple (coords, radii), where coords is a 3x2 array of coordinates and radii is a 3x...
def _reindent(s, indent, reformat=True): """ Remove the existing indentation from each line of a chunk of text, s, and then prefix each line with a new indent string. Also removes trailing whitespace from each line, and leading and trailing blank lines. """ s = textwrap.dedent(s) s = s...
def function[_reindent, parameter[s, indent, reformat]]: constant[ Remove the existing indentation from each line of a chunk of text, s, and then prefix each line with a new indent string. Also removes trailing whitespace from each line, and leading and trailing blank lines. ] vari...
keyword[def] identifier[_reindent] ( identifier[s] , identifier[indent] , identifier[reformat] = keyword[True] ): literal[string] identifier[s] = identifier[textwrap] . identifier[dedent] ( identifier[s] ) identifier[s] = identifier[s] . identifier[split] ( literal[string] ) identifier[s] =[ iden...
def _reindent(s, indent, reformat=True): """ Remove the existing indentation from each line of a chunk of text, s, and then prefix each line with a new indent string. Also removes trailing whitespace from each line, and leading and trailing blank lines. """ s = textwrap.dedent(s) s = s...
def _req(self, op, uri, payload = None): '''HTTP reequest wrapper with data packaging fucntionality Args: op http verb in str uri address of the request payload data to be sent in dict format (default: None) If not provided no data is sent return code and req response dict (single or lis...
def function[_req, parameter[self, op, uri, payload]]: constant[HTTP reequest wrapper with data packaging fucntionality Args: op http verb in str uri address of the request payload data to be sent in dict format (default: None) If not provided no data is sent return code and req re...
keyword[def] identifier[_req] ( identifier[self] , identifier[op] , identifier[uri] , identifier[payload] = keyword[None] ): literal[string] keyword[if] identifier[DEBUG] : identifier[print] (( literal[string] , identifier[uri] )) identifier[req_fp] , identifier[content_type] = identifier[self] . iden...
def _req(self, op, uri, payload=None): """HTTP reequest wrapper with data packaging fucntionality Args: op http verb in str uri address of the request payload data to be sent in dict format (default: None) If not provided no data is sent return code and req response dict (single or lis...
def get_gam_splines(start=0, end=100, n_bases=10, spline_order=3, add_intercept=True): """Main function required by (TF)Concise class """ # make sure n_bases is an int assert type(n_bases) == int x = np.arange(start, end + 1) knots = get_knots(start, end, n_bases, spline_order) X_splines =...
def function[get_gam_splines, parameter[start, end, n_bases, spline_order, add_intercept]]: constant[Main function required by (TF)Concise class ] assert[compare[call[name[type], parameter[name[n_bases]]] equal[==] name[int]]] variable[x] assign[=] call[name[np].arange, parameter[name[start], bi...
keyword[def] identifier[get_gam_splines] ( identifier[start] = literal[int] , identifier[end] = literal[int] , identifier[n_bases] = literal[int] , identifier[spline_order] = literal[int] , identifier[add_intercept] = keyword[True] ): literal[string] keyword[assert] identifier[type] ( identifier[n_ba...
def get_gam_splines(start=0, end=100, n_bases=10, spline_order=3, add_intercept=True): """Main function required by (TF)Concise class """ # make sure n_bases is an int assert type(n_bases) == int x = np.arange(start, end + 1) knots = get_knots(start, end, n_bases, spline_order) X_splines = g...
def print_number_of_parameters(): """ Print number of *trainable* parameters in the network """ log.info('Number of parameters: ') variables = tf.trainable_variables() blocks = defaultdict(int) for var in variables: # Get the top level scope name of va...
def function[print_number_of_parameters, parameter[]]: constant[ Print number of *trainable* parameters in the network ] call[name[log].info, parameter[constant[Number of parameters: ]]] variable[variables] assign[=] call[name[tf].trainable_variables, parameter[]] variabl...
keyword[def] identifier[print_number_of_parameters] (): literal[string] identifier[log] . identifier[info] ( literal[string] ) identifier[variables] = identifier[tf] . identifier[trainable_variables] () identifier[blocks] = identifier[defaultdict] ( identifier[int] ) keyw...
def print_number_of_parameters(): """ Print number of *trainable* parameters in the network """ log.info('Number of parameters: ') variables = tf.trainable_variables() blocks = defaultdict(int) for var in variables: # Get the top level scope name of variable block_nam...
def ParseGshadowEntry(self, line): """Extract the members of each group from /etc/gshadow. Identifies the groups in /etc/gshadow and several attributes of the group, including how the password is crypted (if set). gshadow files have the format group_name:passwd:admins:members admins are both group...
def function[ParseGshadowEntry, parameter[self, line]]: constant[Extract the members of each group from /etc/gshadow. Identifies the groups in /etc/gshadow and several attributes of the group, including how the password is crypted (if set). gshadow files have the format group_name:passwd:admins:me...
keyword[def] identifier[ParseGshadowEntry] ( identifier[self] , identifier[line] ): literal[string] identifier[fields] =( literal[string] , literal[string] , literal[string] , literal[string] ) keyword[if] identifier[line] : identifier[rslt] = identifier[dict] ( identifier[zip] ( identifier[fi...
def ParseGshadowEntry(self, line): """Extract the members of each group from /etc/gshadow. Identifies the groups in /etc/gshadow and several attributes of the group, including how the password is crypted (if set). gshadow files have the format group_name:passwd:admins:members admins are both group...
def verify(pwfile, user, password, opts='', runas=None): ''' Return True if the htpasswd file exists, the user has an entry, and their password matches. pwfile Fully qualified path to htpasswd file user User name password User password opts Valid options t...
def function[verify, parameter[pwfile, user, password, opts, runas]]: constant[ Return True if the htpasswd file exists, the user has an entry, and their password matches. pwfile Fully qualified path to htpasswd file user User name password User password opts ...
keyword[def] identifier[verify] ( identifier[pwfile] , identifier[user] , identifier[password] , identifier[opts] = literal[string] , identifier[runas] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[exists] ( identifier[pwfile] ): keywo...
def verify(pwfile, user, password, opts='', runas=None): """ Return True if the htpasswd file exists, the user has an entry, and their password matches. pwfile Fully qualified path to htpasswd file user User name password User password opts Valid options t...
def from_file(cls, filename): """Initialize datasource from file (.tds ot .tdsx)""" dsxml = xml_open(filename, 'datasource').getroot() return cls(dsxml, filename)
def function[from_file, parameter[cls, filename]]: constant[Initialize datasource from file (.tds ot .tdsx)] variable[dsxml] assign[=] call[call[name[xml_open], parameter[name[filename], constant[datasource]]].getroot, parameter[]] return[call[name[cls], parameter[name[dsxml], name[filename]]]]
keyword[def] identifier[from_file] ( identifier[cls] , identifier[filename] ): literal[string] identifier[dsxml] = identifier[xml_open] ( identifier[filename] , literal[string] ). identifier[getroot] () keyword[return] identifier[cls] ( identifier[dsxml] , identifier[filename] )
def from_file(cls, filename): """Initialize datasource from file (.tds ot .tdsx)""" dsxml = xml_open(filename, 'datasource').getroot() return cls(dsxml, filename)
def fsn2bytes(path, encoding="utf-8"): """ Args: path (fsnative): The path to convert encoding (`str`): encoding used for Windows Returns: `bytes` Raises: TypeError: If no `fsnative` path is passed ValueError: If encoding fails or the encoding is invalid Conv...
def function[fsn2bytes, parameter[path, encoding]]: constant[ Args: path (fsnative): The path to convert encoding (`str`): encoding used for Windows Returns: `bytes` Raises: TypeError: If no `fsnative` path is passed ValueError: If encoding fails or the encodi...
keyword[def] identifier[fsn2bytes] ( identifier[path] , identifier[encoding] = literal[string] ): literal[string] identifier[path] = identifier[_fsn2native] ( identifier[path] ) keyword[if] identifier[is_win] : keyword[if] identifier[encoding] keyword[is] keyword[None] : ke...
def fsn2bytes(path, encoding='utf-8'): """ Args: path (fsnative): The path to convert encoding (`str`): encoding used for Windows Returns: `bytes` Raises: TypeError: If no `fsnative` path is passed ValueError: If encoding fails or the encoding is invalid Conv...
def unpack_method(method): """ Given a JSON-RPC method in: [interface].[function] notation, returns a tuple of the interface name and function. For example, unpack_method("MyService.LoadUser") would return: ("MyService", "LoadUser") :Parameters: method String method name """ ...
def function[unpack_method, parameter[method]]: constant[ Given a JSON-RPC method in: [interface].[function] notation, returns a tuple of the interface name and function. For example, unpack_method("MyService.LoadUser") would return: ("MyService", "LoadUser") :Parameters: method ...
keyword[def] identifier[unpack_method] ( identifier[method] ): literal[string] identifier[pos] = identifier[method] . identifier[find] ( literal[string] ) keyword[if] identifier[pos] ==- literal[int] : keyword[raise] identifier[RpcException] ( identifier[ERR_METHOD_NOT_FOUND] , literal[stri...
def unpack_method(method): """ Given a JSON-RPC method in: [interface].[function] notation, returns a tuple of the interface name and function. For example, unpack_method("MyService.LoadUser") would return: ("MyService", "LoadUser") :Parameters: method String method name """ ...
def apt_install(**kwargs): """ installs a apt package """ for pkg in list(kwargs['packages']): if is_package_installed(distribution='ubuntu', pkg=pkg) is False: sudo("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y %s" % pkg) # if we didn't abort above, we shou...
def function[apt_install, parameter[]]: constant[ installs a apt package ] for taget[name[pkg]] in starred[call[name[list], parameter[call[name[kwargs]][constant[packages]]]]] begin[:] if compare[call[name[is_package_installed], parameter[]] is constant[False]] begin[:] ...
keyword[def] identifier[apt_install] (** identifier[kwargs] ): literal[string] keyword[for] identifier[pkg] keyword[in] identifier[list] ( identifier[kwargs] [ literal[string] ]): keyword[if] identifier[is_package_installed] ( identifier[distribution] = literal[string] , identifier[pkg] = iden...
def apt_install(**kwargs): """ installs a apt package """ for pkg in list(kwargs['packages']): if is_package_installed(distribution='ubuntu', pkg=pkg) is False: sudo('DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y %s' % pkg) # depends on [control=['if'], data=[]] ...
def _connect(**kwargs): ''' Instantiate LDAP Connection class and return an LDAP connection object ''' connargs = {} for name in ['uri', 'server', 'port', 'tls', 'no_verify', 'binddn', 'bindpw', 'anonymous']: connargs[name] = _config(name, **kwargs) return _LDAPConnecti...
def function[_connect, parameter[]]: constant[ Instantiate LDAP Connection class and return an LDAP connection object ] variable[connargs] assign[=] dictionary[[], []] for taget[name[name]] in starred[list[[<ast.Constant object at 0x7da1b26af460>, <ast.Constant object at 0x7da1b26ae590>,...
keyword[def] identifier[_connect] (** identifier[kwargs] ): literal[string] identifier[connargs] ={} keyword[for] identifier[name] keyword[in] [ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ]: ...
def _connect(**kwargs): """ Instantiate LDAP Connection class and return an LDAP connection object """ connargs = {} for name in ['uri', 'server', 'port', 'tls', 'no_verify', 'binddn', 'bindpw', 'anonymous']: connargs[name] = _config(name, **kwargs) # depends on [control=['for'], data=['nam...
def keplers_third_law_hierarchical(b, orbit1, orbit2, solve_for=None, **kwargs): """ TODO: add documentation """ hier = b.hierarchy orbit1_ps = _get_system_ps(b, orbit1) orbit2_ps = _get_system_ps(b, orbit2) sma1 = orbit1_ps.get_parameter(qualifier='sma') sma2 = orbit2_ps.get_paramete...
def function[keplers_third_law_hierarchical, parameter[b, orbit1, orbit2, solve_for]]: constant[ TODO: add documentation ] variable[hier] assign[=] name[b].hierarchy variable[orbit1_ps] assign[=] call[name[_get_system_ps], parameter[name[b], name[orbit1]]] variable[orbit2_ps] ass...
keyword[def] identifier[keplers_third_law_hierarchical] ( identifier[b] , identifier[orbit1] , identifier[orbit2] , identifier[solve_for] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[hier] = identifier[b] . identifier[hierarchy] identifier[orbit1_ps] = identifier[_get_system...
def keplers_third_law_hierarchical(b, orbit1, orbit2, solve_for=None, **kwargs): """ TODO: add documentation """ hier = b.hierarchy orbit1_ps = _get_system_ps(b, orbit1) orbit2_ps = _get_system_ps(b, orbit2) sma1 = orbit1_ps.get_parameter(qualifier='sma') sma2 = orbit2_ps.get_parameter(q...
def _validate_nonzero_image_size(self, nrows, ncols, component_index): """The image cannot have area of zero. """ if nrows == 0 or ncols == 0: # Letting this situation continue would segfault openjpeg. msg = "Component {0} has dimensions {1} x {2}" msg = msg.f...
def function[_validate_nonzero_image_size, parameter[self, nrows, ncols, component_index]]: constant[The image cannot have area of zero. ] if <ast.BoolOp object at 0x7da20c6e7580> begin[:] variable[msg] assign[=] constant[Component {0} has dimensions {1} x {2}] va...
keyword[def] identifier[_validate_nonzero_image_size] ( identifier[self] , identifier[nrows] , identifier[ncols] , identifier[component_index] ): literal[string] keyword[if] identifier[nrows] == literal[int] keyword[or] identifier[ncols] == literal[int] : identifier[msg] = ...
def _validate_nonzero_image_size(self, nrows, ncols, component_index): """The image cannot have area of zero. """ if nrows == 0 or ncols == 0: # Letting this situation continue would segfault openjpeg. msg = 'Component {0} has dimensions {1} x {2}' msg = msg.format(component_inde...
def set_large_file_size(self, st_size): """Sets the self.st_size attribute and replaces self.content with None. Provided specifically to simulate very large files without regards to their content (which wouldn't fit in memory). Note that read/write operations with such a file raise ...
def function[set_large_file_size, parameter[self, st_size]]: constant[Sets the self.st_size attribute and replaces self.content with None. Provided specifically to simulate very large files without regards to their content (which wouldn't fit in memory). Note that read/write operations ...
keyword[def] identifier[set_large_file_size] ( identifier[self] , identifier[st_size] ): literal[string] identifier[self] . identifier[_check_positive_int] ( identifier[st_size] ) keyword[if] identifier[self] . identifier[st_size] : identifier[self] . identifier[size] = liter...
def set_large_file_size(self, st_size): """Sets the self.st_size attribute and replaces self.content with None. Provided specifically to simulate very large files without regards to their content (which wouldn't fit in memory). Note that read/write operations with such a file raise ...
def add_artifact_file(self, filename, keep_original=False): """ Add file to be stored as result artifact on post-process phase """ if filename: logger.debug( "Adding artifact file to collect (keep=%s): %s", keep_original, filename) ...
def function[add_artifact_file, parameter[self, filename, keep_original]]: constant[ Add file to be stored as result artifact on post-process phase ] if name[filename] begin[:] call[name[logger].debug, parameter[constant[Adding artifact file to collect (keep=%s): %s], nam...
keyword[def] identifier[add_artifact_file] ( identifier[self] , identifier[filename] , identifier[keep_original] = keyword[False] ): literal[string] keyword[if] identifier[filename] : identifier[logger] . identifier[debug] ( literal[string] , identifier[keep_original] , ...
def add_artifact_file(self, filename, keep_original=False): """ Add file to be stored as result artifact on post-process phase """ if filename: logger.debug('Adding artifact file to collect (keep=%s): %s', keep_original, filename) self.artifact_files[filename] = keep_original # ...
def add_nio(self, nio, port_number): """ Adds a NIO as new port on this hub. :param nio: NIO instance to add :param port_number: port to allocate for the NIO """ if port_number not in [port["port_number"] for port in self._ports]: raise DynamipsError("Port {...
def function[add_nio, parameter[self, nio, port_number]]: constant[ Adds a NIO as new port on this hub. :param nio: NIO instance to add :param port_number: port to allocate for the NIO ] if compare[name[port_number] <ast.NotIn object at 0x7da2590d7190> <ast.ListComp obje...
keyword[def] identifier[add_nio] ( identifier[self] , identifier[nio] , identifier[port_number] ): literal[string] keyword[if] identifier[port_number] keyword[not] keyword[in] [ identifier[port] [ literal[string] ] keyword[for] identifier[port] keyword[in] identifier[self] . identifier[_port...
def add_nio(self, nio, port_number): """ Adds a NIO as new port on this hub. :param nio: NIO instance to add :param port_number: port to allocate for the NIO """ if port_number not in [port['port_number'] for port in self._ports]: raise DynamipsError("Port {} doesn't exi...
def __error_message(self,stanza): """Process an error message from a MUC room. :Parameters: - `stanza`: the stanza received. :Types: - `stanza`: `Message` :return: `True` if the message was properly recognized as directed to one of the managed rooms,...
def function[__error_message, parameter[self, stanza]]: constant[Process an error message from a MUC room. :Parameters: - `stanza`: the stanza received. :Types: - `stanza`: `Message` :return: `True` if the message was properly recognized as directed to ...
keyword[def] identifier[__error_message] ( identifier[self] , identifier[stanza] ): literal[string] identifier[fr] = identifier[stanza] . identifier[get_from] () identifier[key] = identifier[fr] . identifier[bare] (). identifier[as_unicode] () identifier[rs] = identifier[self] . i...
def __error_message(self, stanza): """Process an error message from a MUC room. :Parameters: - `stanza`: the stanza received. :Types: - `stanza`: `Message` :return: `True` if the message was properly recognized as directed to one of the managed rooms, `F...
def removeID(self, attr): """Remove the given attribute from the ID table maintained internally. """ if attr is None: attr__o = None else: attr__o = attr._o ret = libxml2mod.xmlRemoveID(self._o, attr__o) return ret
def function[removeID, parameter[self, attr]]: constant[Remove the given attribute from the ID table maintained internally. ] if compare[name[attr] is constant[None]] begin[:] variable[attr__o] assign[=] constant[None] variable[ret] assign[=] call[name[libxml2mod].xmlR...
keyword[def] identifier[removeID] ( identifier[self] , identifier[attr] ): literal[string] keyword[if] identifier[attr] keyword[is] keyword[None] : identifier[attr__o] = keyword[None] keyword[else] : identifier[attr__o] = identifier[attr] . identifier[_o] identifier[ret] = id...
def removeID(self, attr): """Remove the given attribute from the ID table maintained internally. """ if attr is None: attr__o = None # depends on [control=['if'], data=[]] else: attr__o = attr._o ret = libxml2mod.xmlRemoveID(self._o, attr__o) return ret
def imresize_like(img, dst_img, return_scale=False, interpolation='bilinear'): """Resize image to the same size of a given image. Args: img (ndarray): The input image. dst_img (ndarray): The target image. return_scale (bool): Whether to return `w_scale` and `h_scale`. interpolat...
def function[imresize_like, parameter[img, dst_img, return_scale, interpolation]]: constant[Resize image to the same size of a given image. Args: img (ndarray): The input image. dst_img (ndarray): The target image. return_scale (bool): Whether to return `w_scale` and `h_scale`. ...
keyword[def] identifier[imresize_like] ( identifier[img] , identifier[dst_img] , identifier[return_scale] = keyword[False] , identifier[interpolation] = literal[string] ): literal[string] identifier[h] , identifier[w] = identifier[dst_img] . identifier[shape] [: literal[int] ] keyword[return] identif...
def imresize_like(img, dst_img, return_scale=False, interpolation='bilinear'): """Resize image to the same size of a given image. Args: img (ndarray): The input image. dst_img (ndarray): The target image. return_scale (bool): Whether to return `w_scale` and `h_scale`. interpolat...
def find(self, path): """ Find a value :param path: The Key path to search for :type path: :py:obj:`str` :returns: The found value or an empty string if not found. """ p = [re.sub('[\[\]]', '', w) for w in PyVDF.__RE_Path_Seperator.findall(path)] array = self.getData() for c in p: ...
def function[find, parameter[self, path]]: constant[ Find a value :param path: The Key path to search for :type path: :py:obj:`str` :returns: The found value or an empty string if not found. ] variable[p] assign[=] <ast.ListComp object at 0x7da1b0a1d900> variable[array] assi...
keyword[def] identifier[find] ( identifier[self] , identifier[path] ): literal[string] identifier[p] =[ identifier[re] . identifier[sub] ( literal[string] , literal[string] , identifier[w] ) keyword[for] identifier[w] keyword[in] identifier[PyVDF] . identifier[__RE_Path_Seperator] . identifier[findall] ...
def find(self, path): """ Find a value :param path: The Key path to search for :type path: :py:obj:`str` :returns: The found value or an empty string if not found. """ p = [re.sub('[\\[\\]]', '', w) for w in PyVDF.__RE_Path_Seperator.findall(path)] array = self.getData() for c in p:...
def get_fermi(self, c, T, rtol=0.01, nstep=50, step=0.1, precision=8): """ Finds the fermi level at which the doping concentration at the given temperature (T) is equal to c. A greedy algorithm is used where the relative error is minimized by calculating the doping at a grid which ...
def function[get_fermi, parameter[self, c, T, rtol, nstep, step, precision]]: constant[ Finds the fermi level at which the doping concentration at the given temperature (T) is equal to c. A greedy algorithm is used where the relative error is minimized by calculating the doping at a grid...
keyword[def] identifier[get_fermi] ( identifier[self] , identifier[c] , identifier[T] , identifier[rtol] = literal[int] , identifier[nstep] = literal[int] , identifier[step] = literal[int] , identifier[precision] = literal[int] ): literal[string] identifier[fermi] = identifier[self] . identifier[ef...
def get_fermi(self, c, T, rtol=0.01, nstep=50, step=0.1, precision=8): """ Finds the fermi level at which the doping concentration at the given temperature (T) is equal to c. A greedy algorithm is used where the relative error is minimized by calculating the doping at a grid which is...
def _get_transitions(self, probs, indexes, tree_idxs, batch_info, forward_steps=1, discount_factor=1.0): """ Return batch of frames for given indexes """ if forward_steps > 1: transition_arrays = self.backend.get_transitions_forward_steps(indexes, forward_steps, discount_factor) else...
def function[_get_transitions, parameter[self, probs, indexes, tree_idxs, batch_info, forward_steps, discount_factor]]: constant[ Return batch of frames for given indexes ] if compare[name[forward_steps] greater[>] constant[1]] begin[:] variable[transition_arrays] assign[=] call[name[sel...
keyword[def] identifier[_get_transitions] ( identifier[self] , identifier[probs] , identifier[indexes] , identifier[tree_idxs] , identifier[batch_info] , identifier[forward_steps] = literal[int] , identifier[discount_factor] = literal[int] ): literal[string] keyword[if] identifier[forward_steps] >...
def _get_transitions(self, probs, indexes, tree_idxs, batch_info, forward_steps=1, discount_factor=1.0): """ Return batch of frames for given indexes """ if forward_steps > 1: transition_arrays = self.backend.get_transitions_forward_steps(indexes, forward_steps, discount_factor) # depends on [control=[...
def password_args(subparsers): """Add command line options for the set_password operation""" password_parser = subparsers.add_parser('set_password') password_parser.add_argument('vault_path', help='Path which contains password' 'secret to be ...
def function[password_args, parameter[subparsers]]: constant[Add command line options for the set_password operation] variable[password_parser] assign[=] call[name[subparsers].add_parser, parameter[constant[set_password]]] call[name[password_parser].add_argument, parameter[constant[vault_path]]]...
keyword[def] identifier[password_args] ( identifier[subparsers] ): literal[string] identifier[password_parser] = identifier[subparsers] . identifier[add_parser] ( literal[string] ) identifier[password_parser] . identifier[add_argument] ( literal[string] , identifier[help] = literal[string] ...
def password_args(subparsers): """Add command line options for the set_password operation""" password_parser = subparsers.add_parser('set_password') password_parser.add_argument('vault_path', help='Path which contains passwordsecret to be udpated') base_args(password_parser)
def send_messages(self, email_messages): """ Queue one or more EmailMessage objects and returns the number of email messages sent. """ from .mail import create from .utils import create_attachments if not email_messages: return for email_mess...
def function[send_messages, parameter[self, email_messages]]: constant[ Queue one or more EmailMessage objects and returns the number of email messages sent. ] from relative_module[mail] import module[create] from relative_module[utils] import module[create_attachments] i...
keyword[def] identifier[send_messages] ( identifier[self] , identifier[email_messages] ): literal[string] keyword[from] . identifier[mail] keyword[import] identifier[create] keyword[from] . identifier[utils] keyword[import] identifier[create_attachments] keyword[if] keywor...
def send_messages(self, email_messages): """ Queue one or more EmailMessage objects and returns the number of email messages sent. """ from .mail import create from .utils import create_attachments if not email_messages: return # depends on [control=['if'], data=[]] ...
def y(self, y): """Project reversed y""" if y is None: return None return (self.height * (y - self.box.ymin) / self.box.height)
def function[y, parameter[self, y]]: constant[Project reversed y] if compare[name[y] is constant[None]] begin[:] return[constant[None]] return[binary_operation[binary_operation[name[self].height * binary_operation[name[y] - name[self].box.ymin]] / name[self].box.height]]
keyword[def] identifier[y] ( identifier[self] , identifier[y] ): literal[string] keyword[if] identifier[y] keyword[is] keyword[None] : keyword[return] keyword[None] keyword[return] ( identifier[self] . identifier[height] *( identifier[y] - identifier[self] . identifier[bo...
def y(self, y): """Project reversed y""" if y is None: return None # depends on [control=['if'], data=[]] return self.height * (y - self.box.ymin) / self.box.height
def validate_driver(f): """Check driver on""" def check_driver(request): drivers = get_all_driver() drivers = filter(drivers, request) if drivers: return f(request, drivers) else: raise Exception('Driver is not found') return check_driver
def function[validate_driver, parameter[f]]: constant[Check driver on] def function[check_driver, parameter[request]]: variable[drivers] assign[=] call[name[get_all_driver], parameter[]] variable[drivers] assign[=] call[name[filter], parameter[name[drivers], name[request]...
keyword[def] identifier[validate_driver] ( identifier[f] ): literal[string] keyword[def] identifier[check_driver] ( identifier[request] ): identifier[drivers] = identifier[get_all_driver] () identifier[drivers] = identifier[filter] ( identifier[drivers] , identifier[request] ) ...
def validate_driver(f): """Check driver on""" def check_driver(request): drivers = get_all_driver() drivers = filter(drivers, request) if drivers: return f(request, drivers) # depends on [control=['if'], data=[]] else: raise Exception('Driver is not foun...
def hash(self, index_func=os.path.getmtime): """ Hash for the entire directory (except excluded files) recursively. Use mtime instead of sha256 by default for a faster hash. >>> dir.hash(index_func=dirtools.filehash) """ # TODO alternative to filehash => mtime as a faster alte...
def function[hash, parameter[self, index_func]]: constant[ Hash for the entire directory (except excluded files) recursively. Use mtime instead of sha256 by default for a faster hash. >>> dir.hash(index_func=dirtools.filehash) ] variable[shadir] assign[=] call[name[hashlib].sh...
keyword[def] identifier[hash] ( identifier[self] , identifier[index_func] = identifier[os] . identifier[path] . identifier[getmtime] ): literal[string] identifier[shadir] = identifier[hashlib] . identifier[sha256] () keyword[for] identifier[f] keyword[in] identifier[self] . ide...
def hash(self, index_func=os.path.getmtime): """ Hash for the entire directory (except excluded files) recursively. Use mtime instead of sha256 by default for a faster hash. >>> dir.hash(index_func=dirtools.filehash) """ # TODO alternative to filehash => mtime as a faster alternative ...
def DeleteConflict(self, conflict_link, options=None): """Deletes a conflict. :param str conflict_link: The link to the conflict. :param dict options: The request options for the request. :return: The deleted Conflict. :rtype: dic...
def function[DeleteConflict, parameter[self, conflict_link, options]]: constant[Deletes a conflict. :param str conflict_link: The link to the conflict. :param dict options: The request options for the request. :return: The deleted Conflict. :...
keyword[def] identifier[DeleteConflict] ( identifier[self] , identifier[conflict_link] , identifier[options] = keyword[None] ): literal[string] keyword[if] identifier[options] keyword[is] keyword[None] : identifier[options] ={} identifier[path] = identifier[base] . identif...
def DeleteConflict(self, conflict_link, options=None): """Deletes a conflict. :param str conflict_link: The link to the conflict. :param dict options: The request options for the request. :return: The deleted Conflict. :rtype: dict ...
def private_encrypt(key, message): ''' Generate an M2Crypto-compatible signature :param Crypto.PublicKey.RSA._RSAobj key: The RSA key object :param str message: The message to sign :rtype: str :return: The signature, or an empty string if the signature operation failed ''' if HAS_M2: ...
def function[private_encrypt, parameter[key, message]]: constant[ Generate an M2Crypto-compatible signature :param Crypto.PublicKey.RSA._RSAobj key: The RSA key object :param str message: The message to sign :rtype: str :return: The signature, or an empty string if the signature operation f...
keyword[def] identifier[private_encrypt] ( identifier[key] , identifier[message] ): literal[string] keyword[if] identifier[HAS_M2] : keyword[return] identifier[key] . identifier[private_encrypt] ( identifier[message] , identifier[salt] . identifier[utils] . identifier[rsax931] . identifier[RSA_X...
def private_encrypt(key, message): """ Generate an M2Crypto-compatible signature :param Crypto.PublicKey.RSA._RSAobj key: The RSA key object :param str message: The message to sign :rtype: str :return: The signature, or an empty string if the signature operation failed """ if HAS_M2: ...
def partitionBy(self, *cols): """Partitions the output by the given columns on the file system. If specified, the output is laid out on the file system similar to Hive's partitioning scheme. :param cols: name of columns >>> df.write.partitionBy('year', 'month').parquet(os.path...
def function[partitionBy, parameter[self]]: constant[Partitions the output by the given columns on the file system. If specified, the output is laid out on the file system similar to Hive's partitioning scheme. :param cols: name of columns >>> df.write.partitionBy('year', 'mon...
keyword[def] identifier[partitionBy] ( identifier[self] ,* identifier[cols] ): literal[string] keyword[if] identifier[len] ( identifier[cols] )== literal[int] keyword[and] identifier[isinstance] ( identifier[cols] [ literal[int] ],( identifier[list] , identifier[tuple] )): identifie...
def partitionBy(self, *cols): """Partitions the output by the given columns on the file system. If specified, the output is laid out on the file system similar to Hive's partitioning scheme. :param cols: name of columns >>> df.write.partitionBy('year', 'month').parquet(os.path.joi...
def destroy_vm_vdis(name=None, session=None, call=None): ''' Get virtual block devices on VM .. code-block:: bash salt-cloud -a destroy_vm_vdis xenvm01 ''' if session is None: session = _get_session() ret = {} # get vm object vms = session.xenapi.VM.get_by_name_label(...
def function[destroy_vm_vdis, parameter[name, session, call]]: constant[ Get virtual block devices on VM .. code-block:: bash salt-cloud -a destroy_vm_vdis xenvm01 ] if compare[name[session] is constant[None]] begin[:] variable[session] assign[=] call[name[_get_se...
keyword[def] identifier[destroy_vm_vdis] ( identifier[name] = keyword[None] , identifier[session] = keyword[None] , identifier[call] = keyword[None] ): literal[string] keyword[if] identifier[session] keyword[is] keyword[None] : identifier[session] = identifier[_get_session] () identifier[r...
def destroy_vm_vdis(name=None, session=None, call=None): """ Get virtual block devices on VM .. code-block:: bash salt-cloud -a destroy_vm_vdis xenvm01 """ if session is None: session = _get_session() # depends on [control=['if'], data=['session']] ret = {} # get vm obje...
def _linux_skype_status(status, message): """ Updates status and message for Skype IM application on Linux. `status` Status type. `message` Status message. """ try: iface = _dbus_get_interface('com.Skype.API', '/com/Sk...
def function[_linux_skype_status, parameter[status, message]]: constant[ Updates status and message for Skype IM application on Linux. `status` Status type. `message` Status message. ] <ast.Try object at 0x7da20c6aa8f0>
keyword[def] identifier[_linux_skype_status] ( identifier[status] , identifier[message] ): literal[string] keyword[try] : identifier[iface] = identifier[_dbus_get_interface] ( literal[string] , literal[string] , literal[string] ) keyword[if] identifier[iface] : ...
def _linux_skype_status(status, message): """ Updates status and message for Skype IM application on Linux. `status` Status type. `message` Status message. """ try: iface = _dbus_get_interface('com.Skype.API', '/com/Skype', 'com.Skype.API') if ifa...
def describe(cwd, rev='tip', user=None): ''' Mimic git describe and return an identifier for the given revision cwd The path to the Mercurial repository rev: tip The path to the archive tarball user : None Run hg as a user other than what the minion runs as CLI Exampl...
def function[describe, parameter[cwd, rev, user]]: constant[ Mimic git describe and return an identifier for the given revision cwd The path to the Mercurial repository rev: tip The path to the archive tarball user : None Run hg as a user other than what the minion run...
keyword[def] identifier[describe] ( identifier[cwd] , identifier[rev] = literal[string] , identifier[user] = keyword[None] ): literal[string] identifier[cmd] =[ literal[string] , literal[string] , literal[string] , literal[string] . identifier[format] ( identifier[rev] ), literal[s...
def describe(cwd, rev='tip', user=None): """ Mimic git describe and return an identifier for the given revision cwd The path to the Mercurial repository rev: tip The path to the archive tarball user : None Run hg as a user other than what the minion runs as CLI Exampl...
def downloads_per_week(self): """ Return the number of downloads in the last 7 days. :return: number of downloads in the last 7 days; if we have less than 7 days of data, returns None. :rtype: int """ if len(self.cache_dates) < 7: logger.error("Only...
def function[downloads_per_week, parameter[self]]: constant[ Return the number of downloads in the last 7 days. :return: number of downloads in the last 7 days; if we have less than 7 days of data, returns None. :rtype: int ] if compare[call[name[len], paramete...
keyword[def] identifier[downloads_per_week] ( identifier[self] ): literal[string] keyword[if] identifier[len] ( identifier[self] . identifier[cache_dates] )< literal[int] : identifier[logger] . identifier[error] ( literal[string] literal[string] , identifier[len] ( ident...
def downloads_per_week(self): """ Return the number of downloads in the last 7 days. :return: number of downloads in the last 7 days; if we have less than 7 days of data, returns None. :rtype: int """ if len(self.cache_dates) < 7: logger.error('Only have %d day...
def basic_diff( source1, source2, start=None, end=None ): """Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. start ...
def function[basic_diff, parameter[source1, source2, start, end]]: constant[Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. ...
keyword[def] identifier[basic_diff] ( identifier[source1] , identifier[source2] , identifier[start] = keyword[None] , identifier[end] = keyword[None] ): literal[string] identifier[start] = identifier[start] keyword[if] identifier[start] keyword[is] keyword[not] keyword[None] keyword[else] literal[in...
def basic_diff(source1, source2, start=None, end=None): """Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. start St...
def _set_neighbor_route_map_name_direction_out(self, v, load=False): """ Setter method for neighbor_route_map_name_direction_out, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv6/ipv6_unicast/af_ipv6_vrf/neighbor/af_ipv6_vrf_neighbor_address_holder/af_ipv6_neighbor_addr/neighbor_route...
def function[_set_neighbor_route_map_name_direction_out, parameter[self, v, load]]: constant[ Setter method for neighbor_route_map_name_direction_out, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv6/ipv6_unicast/af_ipv6_vrf/neighbor/af_ipv6_vrf_neighbor_address_holder/af_ipv6_nei...
keyword[def] identifier[_set_neighbor_route_map_name_direction_out] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ): literal[string] keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ): identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] ) ...
def _set_neighbor_route_map_name_direction_out(self, v, load=False): """ Setter method for neighbor_route_map_name_direction_out, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv6/ipv6_unicast/af_ipv6_vrf/neighbor/af_ipv6_vrf_neighbor_address_holder/af_ipv6_neighbor_addr/neighbor_route...
def InternalInit(self): """Initializes the device and obtains channel id.""" self.cid = UsbHidTransport.U2FHID_BROADCAST_CID nonce = bytearray(os.urandom(8)) r = self.InternalExchange(UsbHidTransport.U2FHID_INIT, nonce) if len(r) < 17: raise errors.HidError('unexpected init reply len') if ...
def function[InternalInit, parameter[self]]: constant[Initializes the device and obtains channel id.] name[self].cid assign[=] name[UsbHidTransport].U2FHID_BROADCAST_CID variable[nonce] assign[=] call[name[bytearray], parameter[call[name[os].urandom, parameter[constant[8]]]]] variable[r]...
keyword[def] identifier[InternalInit] ( identifier[self] ): literal[string] identifier[self] . identifier[cid] = identifier[UsbHidTransport] . identifier[U2FHID_BROADCAST_CID] identifier[nonce] = identifier[bytearray] ( identifier[os] . identifier[urandom] ( literal[int] )) identifier[r] = ident...
def InternalInit(self): """Initializes the device and obtains channel id.""" self.cid = UsbHidTransport.U2FHID_BROADCAST_CID nonce = bytearray(os.urandom(8)) r = self.InternalExchange(UsbHidTransport.U2FHID_INIT, nonce) if len(r) < 17: raise errors.HidError('unexpected init reply len') # de...
def on_put(self, req, resp, handler=None, **kwargs): """Respond on PUT HTTP request assuming resource update flow. This request handler assumes that PUT requests are associated with resource update/modification. Thus default flow for such requests is: * Modify existing resource instanc...
def function[on_put, parameter[self, req, resp, handler]]: constant[Respond on PUT HTTP request assuming resource update flow. This request handler assumes that PUT requests are associated with resource update/modification. Thus default flow for such requests is: * Modify existing reso...
keyword[def] identifier[on_put] ( identifier[self] , identifier[req] , identifier[resp] , identifier[handler] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[self] . identifier[handle] ( identifier[handler] keyword[or] identifier[self] . identifier[update] , identifi...
def on_put(self, req, resp, handler=None, **kwargs): """Respond on PUT HTTP request assuming resource update flow. This request handler assumes that PUT requests are associated with resource update/modification. Thus default flow for such requests is: * Modify existing resource instance an...
def ensure_timezone(func, argname, arg): """Argument preprocessor that converts the input into a tzinfo object. Examples -------- >>> from zipline.utils.preprocess import preprocess >>> @preprocess(tz=ensure_timezone) ... def foo(tz): ... return tz >>> foo('utc') <UTC> """ ...
def function[ensure_timezone, parameter[func, argname, arg]]: constant[Argument preprocessor that converts the input into a tzinfo object. Examples -------- >>> from zipline.utils.preprocess import preprocess >>> @preprocess(tz=ensure_timezone) ... def foo(tz): ... return tz >>>...
keyword[def] identifier[ensure_timezone] ( identifier[func] , identifier[argname] , identifier[arg] ): literal[string] keyword[if] identifier[isinstance] ( identifier[arg] , identifier[tzinfo] ): keyword[return] identifier[arg] keyword[if] identifier[isinstance] ( identifier[arg] , identi...
def ensure_timezone(func, argname, arg): """Argument preprocessor that converts the input into a tzinfo object. Examples -------- >>> from zipline.utils.preprocess import preprocess >>> @preprocess(tz=ensure_timezone) ... def foo(tz): ... return tz >>> foo('utc') <UTC> """ ...
def _get_leftMargin(self): """ This must return an int or float. If the glyph has no outlines, this must return `None`. Subclasses may override this method. """ bounds = self.bounds if bounds is None: return None xMin, yMin, xMax, yMax = bound...
def function[_get_leftMargin, parameter[self]]: constant[ This must return an int or float. If the glyph has no outlines, this must return `None`. Subclasses may override this method. ] variable[bounds] assign[=] name[self].bounds if compare[name[bounds] is const...
keyword[def] identifier[_get_leftMargin] ( identifier[self] ): literal[string] identifier[bounds] = identifier[self] . identifier[bounds] keyword[if] identifier[bounds] keyword[is] keyword[None] : keyword[return] keyword[None] identifier[xMin] , identifier[yMin]...
def _get_leftMargin(self): """ This must return an int or float. If the glyph has no outlines, this must return `None`. Subclasses may override this method. """ bounds = self.bounds if bounds is None: return None # depends on [control=['if'], data=[]] (xMin, yMi...
def overlap1d(l1,l2,PAx,PBx,gamma): """ The one-dimensional component of the overlap integral. Taken from THO eq. 2.12 >>> isclose(overlap1d(0,0,0,0,1),1.0) True """ total = 0 for i in range(1+int(floor(0.5*(l1+l2)))): total += binomial_prefactor(2*i,l1,l2,PAx,PBx)* \ ...
def function[overlap1d, parameter[l1, l2, PAx, PBx, gamma]]: constant[ The one-dimensional component of the overlap integral. Taken from THO eq. 2.12 >>> isclose(overlap1d(0,0,0,0,1),1.0) True ] variable[total] assign[=] constant[0] for taget[name[i]] in starred[call[name[range],...
keyword[def] identifier[overlap1d] ( identifier[l1] , identifier[l2] , identifier[PAx] , identifier[PBx] , identifier[gamma] ): literal[string] identifier[total] = literal[int] keyword[for] identifier[i] keyword[in] identifier[range] ( literal[int] + identifier[int] ( identifier[floor] ( literal[i...
def overlap1d(l1, l2, PAx, PBx, gamma): """ The one-dimensional component of the overlap integral. Taken from THO eq. 2.12 >>> isclose(overlap1d(0,0,0,0,1),1.0) True """ total = 0 for i in range(1 + int(floor(0.5 * (l1 + l2)))): total += binomial_prefactor(2 * i, l1, l2, PAx, PBx) * ...
def add_parameter(self, field_name, param_name, param_value): """ Add a parameter to a field into script_fields The ScriptFields object will be returned, so calls to this can be chained. """ try: self.fields[field_name]['params'][param_name] = param_value exc...
def function[add_parameter, parameter[self, field_name, param_name, param_value]]: constant[ Add a parameter to a field into script_fields The ScriptFields object will be returned, so calls to this can be chained. ] <ast.Try object at 0x7da2046218d0> return[name[self]]
keyword[def] identifier[add_parameter] ( identifier[self] , identifier[field_name] , identifier[param_name] , identifier[param_value] ): literal[string] keyword[try] : identifier[self] . identifier[fields] [ identifier[field_name] ][ literal[string] ][ identifier[param_name] ]= identif...
def add_parameter(self, field_name, param_name, param_value): """ Add a parameter to a field into script_fields The ScriptFields object will be returned, so calls to this can be chained. """ try: self.fields[field_name]['params'][param_name] = param_value # depends on [control=...
def read(cls, source): """Read ``source`` into a ``METSDocument`` instance. This is an instance constructor. The ``source`` may be a path to a METS file, a file-like object, or a string of XML. """ if hasattr(source, "read"): return cls.fromfile(source) if os....
def function[read, parameter[cls, source]]: constant[Read ``source`` into a ``METSDocument`` instance. This is an instance constructor. The ``source`` may be a path to a METS file, a file-like object, or a string of XML. ] if call[name[hasattr], parameter[name[source], constant[r...
keyword[def] identifier[read] ( identifier[cls] , identifier[source] ): literal[string] keyword[if] identifier[hasattr] ( identifier[source] , literal[string] ): keyword[return] identifier[cls] . identifier[fromfile] ( identifier[source] ) keyword[if] identifier[os] . ident...
def read(cls, source): """Read ``source`` into a ``METSDocument`` instance. This is an instance constructor. The ``source`` may be a path to a METS file, a file-like object, or a string of XML. """ if hasattr(source, 'read'): return cls.fromfile(source) # depends on [control=['i...
def log_start(task, logger="TaskLogger"): """Begin logging of a task Convenience function to log a task in the default TaskLogger Parameters ---------- task : str Name of the task to be started logger : str, optional (default: "TaskLogger") Unique name of the logger to retr...
def function[log_start, parameter[task, logger]]: constant[Begin logging of a task Convenience function to log a task in the default TaskLogger Parameters ---------- task : str Name of the task to be started logger : str, optional (default: "TaskLogger") Unique name of ...
keyword[def] identifier[log_start] ( identifier[task] , identifier[logger] = literal[string] ): literal[string] identifier[tasklogger] = identifier[get_tasklogger] ( identifier[logger] ) identifier[tasklogger] . identifier[start_task] ( identifier[task] ) keyword[return] identifier[tasklogger]
def log_start(task, logger='TaskLogger'): """Begin logging of a task Convenience function to log a task in the default TaskLogger Parameters ---------- task : str Name of the task to be started logger : str, optional (default: "TaskLogger") Unique name of the logger to retr...
def is_legal_priority(self, packet: DataPacket): """ Check if the given packet has high enough priority for the stored values for the packet's universe. :param packet: the packet to check :return: returns True if the priority is good. Otherwise False """ # check if the pa...
def function[is_legal_priority, parameter[self, packet]]: constant[ Check if the given packet has high enough priority for the stored values for the packet's universe. :param packet: the packet to check :return: returns True if the priority is good. Otherwise False ] if <...
keyword[def] identifier[is_legal_priority] ( identifier[self] , identifier[packet] : identifier[DataPacket] ): literal[string] keyword[if] identifier[packet] . identifier[universe] keyword[not] keyword[in] identifier[self] . identifier[callbacks] . identifier[keys] () keyword[or] iden...
def is_legal_priority(self, packet: DataPacket): """ Check if the given packet has high enough priority for the stored values for the packet's universe. :param packet: the packet to check :return: returns True if the priority is good. Otherwise False """ # check if the packet's p...
def request_sensor_list(self, req, msg): """Sensor list""" if msg.arguments: name = (msg.arguments[0],) keys = (name, ) if name not in self.fake_sensor_infos: return ("fail", "Unknown sensor name.") else: keys = self.fake_sensor_inf...
def function[request_sensor_list, parameter[self, req, msg]]: constant[Sensor list] if name[msg].arguments begin[:] variable[name] assign[=] tuple[[<ast.Subscript object at 0x7da1b0569120>]] variable[keys] assign[=] tuple[[<ast.Name object at 0x7da1b0568310>]] ...
keyword[def] identifier[request_sensor_list] ( identifier[self] , identifier[req] , identifier[msg] ): literal[string] keyword[if] identifier[msg] . identifier[arguments] : identifier[name] =( identifier[msg] . identifier[arguments] [ literal[int] ],) identifier[keys] =( ...
def request_sensor_list(self, req, msg): """Sensor list""" if msg.arguments: name = (msg.arguments[0],) keys = (name,) if name not in self.fake_sensor_infos: return ('fail', 'Unknown sensor name.') # depends on [control=['if'], data=[]] # depends on [control=['if'], data=[]...
def get_instances(self, session): """Returns a dict of `VM OpaqueRef` (str) -> `xapi.VM`.""" LOG.debug("Getting instances from Xapi") recs = session.xenapi.VM.get_all_records() # NOTE(asadoughi): Copied from xen-networking-scripts/utils.py is_inst = lambda r: (r['power_state']....
def function[get_instances, parameter[self, session]]: constant[Returns a dict of `VM OpaqueRef` (str) -> `xapi.VM`.] call[name[LOG].debug, parameter[constant[Getting instances from Xapi]]] variable[recs] assign[=] call[name[session].xenapi.VM.get_all_records, parameter[]] variable[is_in...
keyword[def] identifier[get_instances] ( identifier[self] , identifier[session] ): literal[string] identifier[LOG] . identifier[debug] ( literal[string] ) identifier[recs] = identifier[session] . identifier[xenapi] . identifier[VM] . identifier[get_all_records] () ident...
def get_instances(self, session): """Returns a dict of `VM OpaqueRef` (str) -> `xapi.VM`.""" LOG.debug('Getting instances from Xapi') recs = session.xenapi.VM.get_all_records() # NOTE(asadoughi): Copied from xen-networking-scripts/utils.py is_inst = lambda r: r['power_state'].lower() == 'running' an...
def phase_select_property(phase=None, s=None, l=None, g=None, V_over_F=None): r'''Determines which phase's property should be set as a default, given the phase a chemical is, and the property values of various phases. For the case of liquid-gas phase, returns None. If the property is not available for t...
def function[phase_select_property, parameter[phase, s, l, g, V_over_F]]: constant[Determines which phase's property should be set as a default, given the phase a chemical is, and the property values of various phases. For the case of liquid-gas phase, returns None. If the property is not available ...
keyword[def] identifier[phase_select_property] ( identifier[phase] = keyword[None] , identifier[s] = keyword[None] , identifier[l] = keyword[None] , identifier[g] = keyword[None] , identifier[V_over_F] = keyword[None] ): literal[string] keyword[if] identifier[phase] == literal[string] : keyword[r...
def phase_select_property(phase=None, s=None, l=None, g=None, V_over_F=None): """Determines which phase's property should be set as a default, given the phase a chemical is, and the property values of various phases. For the case of liquid-gas phase, returns None. If the property is not available for th...
def join(cls, splits): """ Join an array of ids into a compound id string """ segments = [] for split in splits: segments.append('"{}",'.format(split)) if len(segments) > 0: segments[-1] = segments[-1][:-1] jsonString = '[{}]'.format(''.joi...
def function[join, parameter[cls, splits]]: constant[ Join an array of ids into a compound id string ] variable[segments] assign[=] list[[]] for taget[name[split]] in starred[name[splits]] begin[:] call[name[segments].append, parameter[call[constant["{}",].format,...
keyword[def] identifier[join] ( identifier[cls] , identifier[splits] ): literal[string] identifier[segments] =[] keyword[for] identifier[split] keyword[in] identifier[splits] : identifier[segments] . identifier[append] ( literal[string] . identifier[format] ( identifier[spl...
def join(cls, splits): """ Join an array of ids into a compound id string """ segments = [] for split in splits: segments.append('"{}",'.format(split)) # depends on [control=['for'], data=['split']] if len(segments) > 0: segments[-1] = segments[-1][:-1] # depends on [co...
def get_url_args(url): """ Returns a dictionary from a URL params """ url_data = urllib.parse.urlparse(url) arg_dict = urllib.parse.parse_qs(url_data.query) return arg_dict
def function[get_url_args, parameter[url]]: constant[ Returns a dictionary from a URL params ] variable[url_data] assign[=] call[name[urllib].parse.urlparse, parameter[name[url]]] variable[arg_dict] assign[=] call[name[urllib].parse.parse_qs, parameter[name[url_data].query]] return[name[arg_...
keyword[def] identifier[get_url_args] ( identifier[url] ): literal[string] identifier[url_data] = identifier[urllib] . identifier[parse] . identifier[urlparse] ( identifier[url] ) identifier[arg_dict] = identifier[urllib] . identifier[parse] . identifier[parse_qs] ( identifier[url_data] . identifier[q...
def get_url_args(url): """ Returns a dictionary from a URL params """ url_data = urllib.parse.urlparse(url) arg_dict = urllib.parse.parse_qs(url_data.query) return arg_dict
def seq_list_nested(b, d, x=0, top_level=True): ''' Create a nested list of iteratively increasing values. b: branching factor d: max depth x: starting value (default = 0) ''' x += 1 if d == 0: ret = [x] else: val = x ret = [] for i in range(b): ...
def function[seq_list_nested, parameter[b, d, x, top_level]]: constant[ Create a nested list of iteratively increasing values. b: branching factor d: max depth x: starting value (default = 0) ] <ast.AugAssign object at 0x7da1b1528eb0> if compare[name[d] equal[==] constant[0]] be...
keyword[def] identifier[seq_list_nested] ( identifier[b] , identifier[d] , identifier[x] = literal[int] , identifier[top_level] = keyword[True] ): literal[string] identifier[x] += literal[int] keyword[if] identifier[d] == literal[int] : identifier[ret] =[ identifier[x] ] keyword[else]...
def seq_list_nested(b, d, x=0, top_level=True): """ Create a nested list of iteratively increasing values. b: branching factor d: max depth x: starting value (default = 0) """ x += 1 if d == 0: ret = [x] # depends on [control=['if'], data=[]] else: val = x r...
def load_intent(self, name, file_name, reload_cache=False): """ Loads an intent, optionally checking the cache first Args: name (str): The associated name of the intent file_name (str): The location of the intent file reload_cache (bool): Whether to refresh a...
def function[load_intent, parameter[self, name, file_name, reload_cache]]: constant[ Loads an intent, optionally checking the cache first Args: name (str): The associated name of the intent file_name (str): The location of the intent file reload_cache (bool):...
keyword[def] identifier[load_intent] ( identifier[self] , identifier[name] , identifier[file_name] , identifier[reload_cache] = keyword[False] ): literal[string] identifier[self] . identifier[intents] . identifier[load] ( identifier[name] , identifier[file_name] , identifier[reload_cache] ) ...
def load_intent(self, name, file_name, reload_cache=False): """ Loads an intent, optionally checking the cache first Args: name (str): The associated name of the intent file_name (str): The location of the intent file reload_cache (bool): Whether to refresh all o...
def IsFile(self): """Determines if the file entry is a file. Returns: bool: True if the file entry is a file. """ if self._stat_object is None: self._stat_object = self._GetStat() if self._stat_object is not None: self.entry_type = self._stat_object.type return self.entry_type...
def function[IsFile, parameter[self]]: constant[Determines if the file entry is a file. Returns: bool: True if the file entry is a file. ] if compare[name[self]._stat_object is constant[None]] begin[:] name[self]._stat_object assign[=] call[name[self]._GetStat, parameter[]...
keyword[def] identifier[IsFile] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_stat_object] keyword[is] keyword[None] : identifier[self] . identifier[_stat_object] = identifier[self] . identifier[_GetStat] () keyword[if] identifier[self] . identifier[_stat_...
def IsFile(self): """Determines if the file entry is a file. Returns: bool: True if the file entry is a file. """ if self._stat_object is None: self._stat_object = self._GetStat() # depends on [control=['if'], data=[]] if self._stat_object is not None: self.entry_type = self....
def parse_field(field: str) -> Tuple[str, Optional[str]]: """Parses fields with underscores, and return field and suffix. Example: foo => foo, None metric.foo => metric, foo """ _field = field.split('.') _field = [f.strip() for f in _field] if len(_field) == 1 and _field[0]: ...
def function[parse_field, parameter[field]]: constant[Parses fields with underscores, and return field and suffix. Example: foo => foo, None metric.foo => metric, foo ] variable[_field] assign[=] call[name[field].split, parameter[constant[.]]] variable[_field] assign[=] ...
keyword[def] identifier[parse_field] ( identifier[field] : identifier[str] )-> identifier[Tuple] [ identifier[str] , identifier[Optional] [ identifier[str] ]]: literal[string] identifier[_field] = identifier[field] . identifier[split] ( literal[string] ) identifier[_field] =[ identifier[f] . identifie...
def parse_field(field: str) -> Tuple[str, Optional[str]]: """Parses fields with underscores, and return field and suffix. Example: foo => foo, None metric.foo => metric, foo """ _field = field.split('.') _field = [f.strip() for f in _field] if len(_field) == 1 and _field[0]: ...
def pg_ctl(self, cmd, *args, **kwargs): """Builds and executes pg_ctl command :returns: `!True` when return_code == 0, otherwise `!False`""" pg_ctl = [self._pgcommand('pg_ctl'), cmd] return subprocess.call(pg_ctl + ['-D', self._data_dir] + list(args), **kwargs) == 0
def function[pg_ctl, parameter[self, cmd]]: constant[Builds and executes pg_ctl command :returns: `!True` when return_code == 0, otherwise `!False`] variable[pg_ctl] assign[=] list[[<ast.Call object at 0x7da1b21b8730>, <ast.Name object at 0x7da1b21ba4a0>]] return[compare[call[name[subproces...
keyword[def] identifier[pg_ctl] ( identifier[self] , identifier[cmd] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[pg_ctl] =[ identifier[self] . identifier[_pgcommand] ( literal[string] ), identifier[cmd] ] keyword[return] identifier[subprocess] . identifier[ca...
def pg_ctl(self, cmd, *args, **kwargs): """Builds and executes pg_ctl command :returns: `!True` when return_code == 0, otherwise `!False`""" pg_ctl = [self._pgcommand('pg_ctl'), cmd] return subprocess.call(pg_ctl + ['-D', self._data_dir] + list(args), **kwargs) == 0
def update_package_versions(self, batch_request, feed_id): """UpdatePackageVersions. [Preview API] Update several packages from a single feed in a single request. The updates to the packages do not happen atomically. :param :class:`<NuGetPackagesBatchRequest> <azure.devops.v5_0.nuget.models.NuGe...
def function[update_package_versions, parameter[self, batch_request, feed_id]]: constant[UpdatePackageVersions. [Preview API] Update several packages from a single feed in a single request. The updates to the packages do not happen atomically. :param :class:`<NuGetPackagesBatchRequest> <azure.de...
keyword[def] identifier[update_package_versions] ( identifier[self] , identifier[batch_request] , identifier[feed_id] ): literal[string] identifier[route_values] ={} keyword[if] identifier[feed_id] keyword[is] keyword[not] keyword[None] : identifier[route_values] [ literal...
def update_package_versions(self, batch_request, feed_id): """UpdatePackageVersions. [Preview API] Update several packages from a single feed in a single request. The updates to the packages do not happen atomically. :param :class:`<NuGetPackagesBatchRequest> <azure.devops.v5_0.nuget.models.NuGetPac...
def modify_folder_grant( self, folder_ids, perm, zid=None, grantee_name=None, gt='usr', flags=None ): """ :param folder_ids: list of ids :param perm: permission to grant to the user on folder(s) :param zid: id of user to grant r...
def function[modify_folder_grant, parameter[self, folder_ids, perm, zid, grantee_name, gt, flags]]: constant[ :param folder_ids: list of ids :param perm: permission to grant to the user on folder(s) :param zid: id of user to grant rights :param grantee_name: email address of user...
keyword[def] identifier[modify_folder_grant] ( identifier[self] , identifier[folder_ids] , identifier[perm] , identifier[zid] = keyword[None] , identifier[grantee_name] = keyword[None] , identifier[gt] = literal[string] , identifier[flags] = keyword[None] ): literal[string] identifier[f_ids...
def modify_folder_grant(self, folder_ids, perm, zid=None, grantee_name=None, gt='usr', flags=None): """ :param folder_ids: list of ids :param perm: permission to grant to the user on folder(s) :param zid: id of user to grant rights :param grantee_name: email address of user to grant ...
def visit_exec(self, node, parent): """visit an Exec node by returning a fresh instance of it""" newnode = nodes.Exec(node.lineno, node.col_offset, parent) newnode.postinit( self.visit(node.body, newnode), _visit_or_none(node, "globals", self, newnode), _visit...
def function[visit_exec, parameter[self, node, parent]]: constant[visit an Exec node by returning a fresh instance of it] variable[newnode] assign[=] call[name[nodes].Exec, parameter[name[node].lineno, name[node].col_offset, name[parent]]] call[name[newnode].postinit, parameter[call[name[self].v...
keyword[def] identifier[visit_exec] ( identifier[self] , identifier[node] , identifier[parent] ): literal[string] identifier[newnode] = identifier[nodes] . identifier[Exec] ( identifier[node] . identifier[lineno] , identifier[node] . identifier[col_offset] , identifier[parent] ) identifier...
def visit_exec(self, node, parent): """visit an Exec node by returning a fresh instance of it""" newnode = nodes.Exec(node.lineno, node.col_offset, parent) newnode.postinit(self.visit(node.body, newnode), _visit_or_none(node, 'globals', self, newnode), _visit_or_none(node, 'locals', self, newnode)) retu...
def ProcessClients(self, responses): """Does the work.""" del responses end = rdfvalue.RDFDatetime.Now() - db.CLIENT_STATS_RETENTION client_urns = export_utils.GetAllClients(token=self.token) for batch in collection.Batch(client_urns, 10000): with data_store.DB.GetMutationPool() as mutation_...
def function[ProcessClients, parameter[self, responses]]: constant[Does the work.] <ast.Delete object at 0x7da1b1d93e20> variable[end] assign[=] binary_operation[call[name[rdfvalue].RDFDatetime.Now, parameter[]] - name[db].CLIENT_STATS_RETENTION] variable[client_urns] assign[=] call[name[exp...
keyword[def] identifier[ProcessClients] ( identifier[self] , identifier[responses] ): literal[string] keyword[del] identifier[responses] identifier[end] = identifier[rdfvalue] . identifier[RDFDatetime] . identifier[Now] ()- identifier[db] . identifier[CLIENT_STATS_RETENTION] identifier[client...
def ProcessClients(self, responses): """Does the work.""" del responses end = rdfvalue.RDFDatetime.Now() - db.CLIENT_STATS_RETENTION client_urns = export_utils.GetAllClients(token=self.token) for batch in collection.Batch(client_urns, 10000): with data_store.DB.GetMutationPool() as mutation_...
def data_slice(self, slice_ind): """ Returns a slice of datapoints """ if self.height is None: return self.data[slice_ind] return self.data[slice_ind, ...]
def function[data_slice, parameter[self, slice_ind]]: constant[ Returns a slice of datapoints ] if compare[name[self].height is constant[None]] begin[:] return[call[name[self].data][name[slice_ind]]] return[call[name[self].data][tuple[[<ast.Name object at 0x7da1b1219cf0>, <ast.Constant objec...
keyword[def] identifier[data_slice] ( identifier[self] , identifier[slice_ind] ): literal[string] keyword[if] identifier[self] . identifier[height] keyword[is] keyword[None] : keyword[return] identifier[self] . identifier[data] [ identifier[slice_ind] ] keyword[return] id...
def data_slice(self, slice_ind): """ Returns a slice of datapoints """ if self.height is None: return self.data[slice_ind] # depends on [control=['if'], data=[]] return self.data[slice_ind, ...]
def MOVT(cpu, dest, src): """ MOVT writes imm16 to Rd[31:16]. The write does not affect Rd[15:0]. :param Armv7Operand dest: The destination operand; register :param Armv7Operand src: The source operand; 16-bit immediate """ assert src.type == 'immediate' imm = sr...
def function[MOVT, parameter[cpu, dest, src]]: constant[ MOVT writes imm16 to Rd[31:16]. The write does not affect Rd[15:0]. :param Armv7Operand dest: The destination operand; register :param Armv7Operand src: The source operand; 16-bit immediate ] assert[compare[name[src].t...
keyword[def] identifier[MOVT] ( identifier[cpu] , identifier[dest] , identifier[src] ): literal[string] keyword[assert] identifier[src] . identifier[type] == literal[string] identifier[imm] = identifier[src] . identifier[read] () identifier[low_halfword] = identifier[dest] . ide...
def MOVT(cpu, dest, src): """ MOVT writes imm16 to Rd[31:16]. The write does not affect Rd[15:0]. :param Armv7Operand dest: The destination operand; register :param Armv7Operand src: The source operand; 16-bit immediate """ assert src.type == 'immediate' imm = src.read() ...
def main(argv=None): # IGNORE:C0111 ''' Main Entry ''' by = None reqres = check_requirements() if reqres == CheckResult.Error: perr("Requirement checking failed") sys.exit(const.EFatal) try: result = const.ENoError if argv is None: argv = sys.argv else: sys.argv.extend(argv) setuphandlers() ...
def function[main, parameter[argv]]: constant[ Main Entry ] variable[by] assign[=] constant[None] variable[reqres] assign[=] call[name[check_requirements], parameter[]] if compare[name[reqres] equal[==] name[CheckResult].Error] begin[:] call[name[perr], parameter[constant...
keyword[def] identifier[main] ( identifier[argv] = keyword[None] ): literal[string] identifier[by] = keyword[None] identifier[reqres] = identifier[check_requirements] () keyword[if] identifier[reqres] == identifier[CheckResult] . identifier[Error] : identifier[perr] ( literal[string] ) identifier[sy...
def main(argv=None): # IGNORE:C0111 ' Main Entry ' by = None reqres = check_requirements() if reqres == CheckResult.Error: perr('Requirement checking failed') sys.exit(const.EFatal) # depends on [control=['if'], data=[]] try: result = const.ENoError if argv is None:...
def toggle_wrap_mode(self, checked): """Toggle wrap mode""" if self.tabwidget is None: return for editor in self.editors: editor.toggle_wrap_mode(checked) self.set_option('wrap', checked)
def function[toggle_wrap_mode, parameter[self, checked]]: constant[Toggle wrap mode] if compare[name[self].tabwidget is constant[None]] begin[:] return[None] for taget[name[editor]] in starred[name[self].editors] begin[:] call[name[editor].toggle_wrap_mode, parameter[name...
keyword[def] identifier[toggle_wrap_mode] ( identifier[self] , identifier[checked] ): literal[string] keyword[if] identifier[self] . identifier[tabwidget] keyword[is] keyword[None] : keyword[return] keyword[for] identifier[editor] keyword[in] identifier[self] . iden...
def toggle_wrap_mode(self, checked): """Toggle wrap mode""" if self.tabwidget is None: return # depends on [control=['if'], data=[]] for editor in self.editors: editor.toggle_wrap_mode(checked) # depends on [control=['for'], data=['editor']] self.set_option('wrap', checked)
def split_auth_from_netloc(netloc): """ Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). """ if '@' not in netloc: return netloc, (None, None) # Split from the right because that's how urllib.parse.urlsplit() # behaves if more than o...
def function[split_auth_from_netloc, parameter[netloc]]: constant[ Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). ] if compare[constant[@] <ast.NotIn object at 0x7da2590d7190> name[netloc]] begin[:] return[tuple[[<ast.Name object at...
keyword[def] identifier[split_auth_from_netloc] ( identifier[netloc] ): literal[string] keyword[if] literal[string] keyword[not] keyword[in] identifier[netloc] : keyword[return] identifier[netloc] ,( keyword[None] , keyword[None] ) identifier[auth] , identifie...
def split_auth_from_netloc(netloc): """ Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). """ if '@' not in netloc: return (netloc, (None, None)) # depends on [control=['if'], data=['netloc']] # Split from the right because that's how url...
def delete_polygon(self, polygon): """ Deletes on the Agro API the Polygon identified by the ID of the provided polygon object. :param polygon: the `pyowm.agro10.polygon.Polygon` object to be deleted :type polygon: `pyowm.agro10.polygon.Polygon` instance :returns: `None` if dele...
def function[delete_polygon, parameter[self, polygon]]: constant[ Deletes on the Agro API the Polygon identified by the ID of the provided polygon object. :param polygon: the `pyowm.agro10.polygon.Polygon` object to be deleted :type polygon: `pyowm.agro10.polygon.Polygon` instance ...
keyword[def] identifier[delete_polygon] ( identifier[self] , identifier[polygon] ): literal[string] keyword[assert] identifier[polygon] . identifier[id] keyword[is] keyword[not] keyword[None] identifier[status] , identifier[_] = identifier[self] . identifier[http_client] . identifier[...
def delete_polygon(self, polygon): """ Deletes on the Agro API the Polygon identified by the ID of the provided polygon object. :param polygon: the `pyowm.agro10.polygon.Polygon` object to be deleted :type polygon: `pyowm.agro10.polygon.Polygon` instance :returns: `None` if deletion...
def levels_to_accepting_states(self) -> dict: """Return a dict from states to level, i.e. the number of steps to reach any accepting state. level = -1 if the state cannot reach any accepting state""" res = {accepting_state: 0 for accepting_state in self._accepting_states} level = 0 ...
def function[levels_to_accepting_states, parameter[self]]: constant[Return a dict from states to level, i.e. the number of steps to reach any accepting state. level = -1 if the state cannot reach any accepting state] variable[res] assign[=] <ast.DictComp object at 0x7da204346680> variabl...
keyword[def] identifier[levels_to_accepting_states] ( identifier[self] )-> identifier[dict] : literal[string] identifier[res] ={ identifier[accepting_state] : literal[int] keyword[for] identifier[accepting_state] keyword[in] identifier[self] . identifier[_accepting_states] } identifie...
def levels_to_accepting_states(self) -> dict: """Return a dict from states to level, i.e. the number of steps to reach any accepting state. level = -1 if the state cannot reach any accepting state""" res = {accepting_state: 0 for accepting_state in self._accepting_states} level = 0 # least fixpo...
async def fetchone(self) -> Optional[sqlite3.Row]: """Fetch a single row.""" return await self._execute(self._cursor.fetchone)
<ast.AsyncFunctionDef object at 0x7da1b1dc7ee0>
keyword[async] keyword[def] identifier[fetchone] ( identifier[self] )-> identifier[Optional] [ identifier[sqlite3] . identifier[Row] ]: literal[string] keyword[return] keyword[await] identifier[self] . identifier[_execute] ( identifier[self] . identifier[_cursor] . identifier[fetchone] )
async def fetchone(self) -> Optional[sqlite3.Row]: """Fetch a single row.""" return await self._execute(self._cursor.fetchone)
def get_dict_for_attrs(obj, attrs): """ Returns dictionary for each attribute from given ``obj``. """ data = {} for attr in attrs: data[attr] = getattr(obj, attr) return data
def function[get_dict_for_attrs, parameter[obj, attrs]]: constant[ Returns dictionary for each attribute from given ``obj``. ] variable[data] assign[=] dictionary[[], []] for taget[name[attr]] in starred[name[attrs]] begin[:] call[name[data]][name[attr]] assign[=] call[na...
keyword[def] identifier[get_dict_for_attrs] ( identifier[obj] , identifier[attrs] ): literal[string] identifier[data] ={} keyword[for] identifier[attr] keyword[in] identifier[attrs] : identifier[data] [ identifier[attr] ]= identifier[getattr] ( identifier[obj] , identifier[attr] ) key...
def get_dict_for_attrs(obj, attrs): """ Returns dictionary for each attribute from given ``obj``. """ data = {} for attr in attrs: data[attr] = getattr(obj, attr) # depends on [control=['for'], data=['attr']] return data
def GetRootKey(self): """Retrieves the Windows Registry root key. Returns: WinRegistryKey: Windows Registry root key. Raises: RuntimeError: if there are multiple matching mappings and the correct mapping cannot be resolved. """ root_registry_key = virtual.VirtualWinRegistryKe...
def function[GetRootKey, parameter[self]]: constant[Retrieves the Windows Registry root key. Returns: WinRegistryKey: Windows Registry root key. Raises: RuntimeError: if there are multiple matching mappings and the correct mapping cannot be resolved. ] variable[root_r...
keyword[def] identifier[GetRootKey] ( identifier[self] ): literal[string] identifier[root_registry_key] = identifier[virtual] . identifier[VirtualWinRegistryKey] ( literal[string] ) keyword[for] identifier[mapped_key] keyword[in] identifier[self] . identifier[_MAPPED_KEYS] : identifier[key_...
def GetRootKey(self): """Retrieves the Windows Registry root key. Returns: WinRegistryKey: Windows Registry root key. Raises: RuntimeError: if there are multiple matching mappings and the correct mapping cannot be resolved. """ root_registry_key = virtual.VirtualWinRegistryKe...
def _validate_sections(bundle, add_error): """Check that the base bundle sections are valid. The bundle argument is a YAML decoded bundle content. A bundle is composed of series, services, machines and relations. Only the services section is mandatory. Use the given add_error callable to register...
def function[_validate_sections, parameter[bundle, add_error]]: constant[Check that the base bundle sections are valid. The bundle argument is a YAML decoded bundle content. A bundle is composed of series, services, machines and relations. Only the services section is mandatory. Use the given...
keyword[def] identifier[_validate_sections] ( identifier[bundle] , identifier[add_error] ): literal[string] keyword[if] keyword[not] identifier[isdict] ( identifier[bundle] ): identifier[add_error] ( literal[string] ) keyword[return] keyword[None] , keyword[None] , keyword[None] ,...
def _validate_sections(bundle, add_error): """Check that the base bundle sections are valid. The bundle argument is a YAML decoded bundle content. A bundle is composed of series, services, machines and relations. Only the services section is mandatory. Use the given add_error callable to register...
def _combine_document_events(new_event, old_events): ''' Attempt to combine a new event with a list of previous events. The ``old_event`` will be scanned in reverse, and ``.combine(new_event)`` will be called on each. If a combination can be made, the function will return immediately. Otherwise, ``new_...
def function[_combine_document_events, parameter[new_event, old_events]]: constant[ Attempt to combine a new event with a list of previous events. The ``old_event`` will be scanned in reverse, and ``.combine(new_event)`` will be called on each. If a combination can be made, the function will return...
keyword[def] identifier[_combine_document_events] ( identifier[new_event] , identifier[old_events] ): literal[string] keyword[for] identifier[event] keyword[in] identifier[reversed] ( identifier[old_events] ): keyword[if] identifier[event] . identifier[combine] ( identifier[new_event] ): ...
def _combine_document_events(new_event, old_events): """ Attempt to combine a new event with a list of previous events. The ``old_event`` will be scanned in reverse, and ``.combine(new_event)`` will be called on each. If a combination can be made, the function will return immediately. Otherwise, ``new_...
def cors_setup(self, request): """ Sets up the CORS headers response based on the settings used for the API. :param request: <pyramid.request.Request> """ def cors_headers(request, response): if request.method.lower() == 'options': response.headers.up...
def function[cors_setup, parameter[self, request]]: constant[ Sets up the CORS headers response based on the settings used for the API. :param request: <pyramid.request.Request> ] def function[cors_headers, parameter[request, response]]: if compare[call[name[requ...
keyword[def] identifier[cors_setup] ( identifier[self] , identifier[request] ): literal[string] keyword[def] identifier[cors_headers] ( identifier[request] , identifier[response] ): keyword[if] identifier[request] . identifier[method] . identifier[lower] ()== literal[string] : ...
def cors_setup(self, request): """ Sets up the CORS headers response based on the settings used for the API. :param request: <pyramid.request.Request> """ def cors_headers(request, response): if request.method.lower() == 'options': response.headers.update({'-'.join(...
def login(self, token, use_token=True, mount_point=DEFAULT_MOUNT_POINT): """Login using GitHub access token. Supported methods: POST: /auth/{mount_point}/login. Produces: 200 application/json :param token: GitHub personal API token. :type token: str | unicode :para...
def function[login, parameter[self, token, use_token, mount_point]]: constant[Login using GitHub access token. Supported methods: POST: /auth/{mount_point}/login. Produces: 200 application/json :param token: GitHub personal API token. :type token: str | unicode :pa...
keyword[def] identifier[login] ( identifier[self] , identifier[token] , identifier[use_token] = keyword[True] , identifier[mount_point] = identifier[DEFAULT_MOUNT_POINT] ): literal[string] identifier[params] ={ literal[string] : identifier[token] , } identifier[api_path] =...
def login(self, token, use_token=True, mount_point=DEFAULT_MOUNT_POINT): """Login using GitHub access token. Supported methods: POST: /auth/{mount_point}/login. Produces: 200 application/json :param token: GitHub personal API token. :type token: str | unicode :param us...
def TPAGB_properties(self): """ Temporary, use for now same function in nugrid_set.py! Returns many TPAGB parameters which are TPstart,TPmods,TP_max_env,TPend,min_m_TP,max_m_TP,DUPmods,DUPm_min_h Same function in nugrid_set.py. Parameters ---------- """...
def function[TPAGB_properties, parameter[self]]: constant[ Temporary, use for now same function in nugrid_set.py! Returns many TPAGB parameters which are TPstart,TPmods,TP_max_env,TPend,min_m_TP,max_m_TP,DUPmods,DUPm_min_h Same function in nugrid_set.py. Parameters ...
keyword[def] identifier[TPAGB_properties] ( identifier[self] ): literal[string] identifier[peak_lum_model] , identifier[h1_mass_min_DUP_model] = identifier[self] . identifier[find_TP_attributes] ( literal[int] , identifier[t0_model] = identifier[self] . identifier[find_first_TP] (), identifier[co...
def TPAGB_properties(self): """ Temporary, use for now same function in nugrid_set.py! Returns many TPAGB parameters which are TPstart,TPmods,TP_max_env,TPend,min_m_TP,max_m_TP,DUPmods,DUPm_min_h Same function in nugrid_set.py. Parameters ---------- """ ...
def _ensure_plottable(*args): """ Raise exception if there is anything in args that can't be plotted on an axis by matplotlib. """ numpy_types = [np.floating, np.integer, np.timedelta64, np.datetime64] other_types = [datetime] try: import cftime cftime_datetime = [cftime.date...
def function[_ensure_plottable, parameter[]]: constant[ Raise exception if there is anything in args that can't be plotted on an axis by matplotlib. ] variable[numpy_types] assign[=] list[[<ast.Attribute object at 0x7da18dc9ba00>, <ast.Attribute object at 0x7da18dc9b970>, <ast.Attribute obje...
keyword[def] identifier[_ensure_plottable] (* identifier[args] ): literal[string] identifier[numpy_types] =[ identifier[np] . identifier[floating] , identifier[np] . identifier[integer] , identifier[np] . identifier[timedelta64] , identifier[np] . identifier[datetime64] ] identifier[other_types] =[ id...
def _ensure_plottable(*args): """ Raise exception if there is anything in args that can't be plotted on an axis by matplotlib. """ numpy_types = [np.floating, np.integer, np.timedelta64, np.datetime64] other_types = [datetime] try: import cftime cftime_datetime = [cftime.date...
def get_commands_from_commanddict(commanddict): """ <Purpose> Extracts the commands that are contained in the command dictionary. The arguments of these commands are not included. <Arguments> commanddict: A command dictionary in the format specified in seash_dictionary. <Exceptions> None...
def function[get_commands_from_commanddict, parameter[commanddict]]: constant[ <Purpose> Extracts the commands that are contained in the command dictionary. The arguments of these commands are not included. <Arguments> commanddict: A command dictionary in the format specified in seash_dic...
keyword[def] identifier[get_commands_from_commanddict] ( identifier[commanddict] ): literal[string] keyword[if] keyword[not] identifier[commanddict] : keyword[return] [] identifier[commands] =[] keyword[for] identifier[command] keyword[in] identifier[commanddict] : identifier[has_user_arg...
def get_commands_from_commanddict(commanddict): """ <Purpose> Extracts the commands that are contained in the command dictionary. The arguments of these commands are not included. <Arguments> commanddict: A command dictionary in the format specified in seash_dictionary. <Exceptions> No...
def get_biopax_stmts(self, filter=False, query='pathsbetween', database_filter=None): """Get relevant statements from Pathway Commons. Performs a "paths between" query for the genes in :py:attr:`gene_list` and uses the results to build statements. This function caches t...
def function[get_biopax_stmts, parameter[self, filter, query, database_filter]]: constant[Get relevant statements from Pathway Commons. Performs a "paths between" query for the genes in :py:attr:`gene_list` and uses the results to build statements. This function caches two files: the li...
keyword[def] identifier[get_biopax_stmts] ( identifier[self] , identifier[filter] = keyword[False] , identifier[query] = literal[string] , identifier[database_filter] = keyword[None] ): literal[string] keyword[if] identifier[self] . identifier[basename] keyword[is] keyword[not] keywor...
def get_biopax_stmts(self, filter=False, query='pathsbetween', database_filter=None): """Get relevant statements from Pathway Commons. Performs a "paths between" query for the genes in :py:attr:`gene_list` and uses the results to build statements. This function caches two files: the list of...
def read_raster_window( input_files, tile, indexes=None, resampling="nearest", src_nodata=None, dst_nodata=None, gdal_opts=None ): """ Return NumPy arrays from an input raster. NumPy arrays are reprojected and resampled to tile properties from input raster. If tile boundarie...
def function[read_raster_window, parameter[input_files, tile, indexes, resampling, src_nodata, dst_nodata, gdal_opts]]: constant[ Return NumPy arrays from an input raster. NumPy arrays are reprojected and resampled to tile properties from input raster. If tile boundaries cross the antimeridian, dat...
keyword[def] identifier[read_raster_window] ( identifier[input_files] , identifier[tile] , identifier[indexes] = keyword[None] , identifier[resampling] = literal[string] , identifier[src_nodata] = keyword[None] , identifier[dst_nodata] = keyword[None] , identifier[gdal_opts] = keyword[None] ): literal[st...
def read_raster_window(input_files, tile, indexes=None, resampling='nearest', src_nodata=None, dst_nodata=None, gdal_opts=None): """ Return NumPy arrays from an input raster. NumPy arrays are reprojected and resampled to tile properties from input raster. If tile boundaries cross the antimeridian, data...
def g_(self, X): """ computes h() :param X: :return: """ if self._interpol: if not hasattr(self, '_g_interp'): if self._lookup: x = self._x_lookup g_x = self._g_lookup else: ...
def function[g_, parameter[self, X]]: constant[ computes h() :param X: :return: ] if name[self]._interpol begin[:] if <ast.UnaryOp object at 0x7da1b04a7ca0> begin[:] if name[self]._lookup begin[:] va...
keyword[def] identifier[g_] ( identifier[self] , identifier[X] ): literal[string] keyword[if] identifier[self] . identifier[_interpol] : keyword[if] keyword[not] identifier[hasattr] ( identifier[self] , literal[string] ): keyword[if] identifier[self] . identifier[...
def g_(self, X): """ computes h() :param X: :return: """ if self._interpol: if not hasattr(self, '_g_interp'): if self._lookup: x = self._x_lookup g_x = self._g_lookup # depends on [control=['if'], data=[]] else: ...
def validate_path_parameters(target_path, api_path, path_parameters, context): """ Helper function for validating a request path """ base_path = context.get('basePath', '') full_api_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + api_path) parameter_values = get_path_parameter_values( ...
def function[validate_path_parameters, parameter[target_path, api_path, path_parameters, context]]: constant[ Helper function for validating a request path ] variable[base_path] assign[=] call[name[context].get, parameter[constant[basePath], constant[]]] variable[full_api_path] assign[=]...
keyword[def] identifier[validate_path_parameters] ( identifier[target_path] , identifier[api_path] , identifier[path_parameters] , identifier[context] ): literal[string] identifier[base_path] = identifier[context] . identifier[get] ( literal[string] , literal[string] ) identifier[full_api_path] = iden...
def validate_path_parameters(target_path, api_path, path_parameters, context): """ Helper function for validating a request path """ base_path = context.get('basePath', '') full_api_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + api_path) parameter_values = get_path_parameter_values(targe...
def render(self, name, value, attrs=None): '''Render the widget as HTML inputs for display on a form. :param name: form field base name :param value: date value :param attrs: - unused :returns: HTML text with three inputs for year/month/day ''' # expects a value...
def function[render, parameter[self, name, value, attrs]]: constant[Render the widget as HTML inputs for display on a form. :param name: form field base name :param value: date value :param attrs: - unused :returns: HTML text with three inputs for year/month/day ] ...
keyword[def] identifier[render] ( identifier[self] , identifier[name] , identifier[value] , identifier[attrs] = keyword[None] ): literal[string] identifier[year] , identifier[month] , identifier[day] = literal[string] , literal[string] , literal[string] keyword[if] identifier[v...
def render(self, name, value, attrs=None): """Render the widget as HTML inputs for display on a form. :param name: form field base name :param value: date value :param attrs: - unused :returns: HTML text with three inputs for year/month/day """ # expects a value in forma...
def dem(bounds, src_crs, dst_crs, out_file, resolution): """Dump BC DEM to TIFF """ if not dst_crs: dst_crs = "EPSG:3005" bcdata.get_dem(bounds, out_file=out_file, src_crs=src_crs, dst_crs=dst_crs, resolution=resolution)
def function[dem, parameter[bounds, src_crs, dst_crs, out_file, resolution]]: constant[Dump BC DEM to TIFF ] if <ast.UnaryOp object at 0x7da18eb54fa0> begin[:] variable[dst_crs] assign[=] constant[EPSG:3005] call[name[bcdata].get_dem, parameter[name[bounds]]]
keyword[def] identifier[dem] ( identifier[bounds] , identifier[src_crs] , identifier[dst_crs] , identifier[out_file] , identifier[resolution] ): literal[string] keyword[if] keyword[not] identifier[dst_crs] : identifier[dst_crs] = literal[string] identifier[bcdata] . identifier[get_dem] ( i...
def dem(bounds, src_crs, dst_crs, out_file, resolution): """Dump BC DEM to TIFF """ if not dst_crs: dst_crs = 'EPSG:3005' # depends on [control=['if'], data=[]] bcdata.get_dem(bounds, out_file=out_file, src_crs=src_crs, dst_crs=dst_crs, resolution=resolution)
def get_authentic_node_name(self, node_name: str) -> Optional[str]: """ Returns the exact, authentic node name for the given node name if a node corresponding to the given name exists in the graph (maybe not locally yet) or `None` otherwise. By default, this method checks whether a...
def function[get_authentic_node_name, parameter[self, node_name]]: constant[ Returns the exact, authentic node name for the given node name if a node corresponding to the given name exists in the graph (maybe not locally yet) or `None` otherwise. By default, this method checks whether a...
keyword[def] identifier[get_authentic_node_name] ( identifier[self] , identifier[node_name] : identifier[str] )-> identifier[Optional] [ identifier[str] ]: literal[string] identifier[node] : identifier[Node] = identifier[self] . identifier[_nodes] . identifier[get_node_by_name] ( identifier[node_...
def get_authentic_node_name(self, node_name: str) -> Optional[str]: """ Returns the exact, authentic node name for the given node name if a node corresponding to the given name exists in the graph (maybe not locally yet) or `None` otherwise. By default, this method checks whether a node wit...
def create_from_request_pdu(pdu): """ Create instance from request PDU. :param pdu: A request PDU. :return: Instance of this class. """ _, starting_address, quantity, byte_count = \ struct.unpack('>BHHB', pdu[:6]) # Values are 16 bit, so each value takes up ...
def function[create_from_request_pdu, parameter[pdu]]: constant[ Create instance from request PDU. :param pdu: A request PDU. :return: Instance of this class. ] <ast.Tuple object at 0x7da20ed9a8f0> assign[=] call[name[struct].unpack, parameter[constant[>BHHB], call[name[pdu]][<a...
keyword[def] identifier[create_from_request_pdu] ( identifier[pdu] ): literal[string] identifier[_] , identifier[starting_address] , identifier[quantity] , identifier[byte_count] = identifier[struct] . identifier[unpack] ( literal[string] , identifier[pdu] [: literal[int] ]) iden...
def create_from_request_pdu(pdu): """ Create instance from request PDU. :param pdu: A request PDU. :return: Instance of this class. """ (_, starting_address, quantity, byte_count) = struct.unpack('>BHHB', pdu[:6]) # Values are 16 bit, so each value takes up 2 bytes. fmt = '>' + ...
def _lockfile(self): """Pipfile.lock divided by PyPI and external dependencies.""" pfile = pipfile.load(self.pipfile_location, inject_env=False) lockfile = json.loads(pfile.lock()) for section in ("default", "develop"): lock_section = lockfile.get(section, {}) for...
def function[_lockfile, parameter[self]]: constant[Pipfile.lock divided by PyPI and external dependencies.] variable[pfile] assign[=] call[name[pipfile].load, parameter[name[self].pipfile_location]] variable[lockfile] assign[=] call[name[json].loads, parameter[call[name[pfile].lock, parameter[]]...
keyword[def] identifier[_lockfile] ( identifier[self] ): literal[string] identifier[pfile] = identifier[pipfile] . identifier[load] ( identifier[self] . identifier[pipfile_location] , identifier[inject_env] = keyword[False] ) identifier[lockfile] = identifier[json] . identifier[loads] ( id...
def _lockfile(self): """Pipfile.lock divided by PyPI and external dependencies.""" pfile = pipfile.load(self.pipfile_location, inject_env=False) lockfile = json.loads(pfile.lock()) for section in ('default', 'develop'): lock_section = lockfile.get(section, {}) for key in list(lock_sectio...
def azimuth(poly): """Azimuth of a polygon poly""" num = len(poly) - 1 vec = unit_normal(poly[0], poly[1], poly[num]) vec_azi = np.array([vec[0], vec[1], 0]) vec_n = np.array([0, 1, 0]) # update by Santosh # angle2vecs gives the smallest angle between the vectors # so for a west wall ang...
def function[azimuth, parameter[poly]]: constant[Azimuth of a polygon poly] variable[num] assign[=] binary_operation[call[name[len], parameter[name[poly]]] - constant[1]] variable[vec] assign[=] call[name[unit_normal], parameter[call[name[poly]][constant[0]], call[name[poly]][constant[1]], call[...
keyword[def] identifier[azimuth] ( identifier[poly] ): literal[string] identifier[num] = identifier[len] ( identifier[poly] )- literal[int] identifier[vec] = identifier[unit_normal] ( identifier[poly] [ literal[int] ], identifier[poly] [ literal[int] ], identifier[poly] [ identifier[num] ]) iden...
def azimuth(poly): """Azimuth of a polygon poly""" num = len(poly) - 1 vec = unit_normal(poly[0], poly[1], poly[num]) vec_azi = np.array([vec[0], vec[1], 0]) vec_n = np.array([0, 1, 0]) # update by Santosh # angle2vecs gives the smallest angle between the vectors # so for a west wall ang...