sequence
stringlengths
546
16.2k
code
stringlengths
108
19.3k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:commit_check; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:commands; 7, string:""; 8, default_parameter; 8, 9; 8, 10; 9, identifier:req_format; 10, string:"text"; 11, block; 11, 12; 11, 1...
def commit_check(self, commands="", req_format="text"): """ Execute a commit check operation. Purpose: This method will take in string of multiple commands, | and perform and 'commit check' on the device to ensure | the commands are syntactically correct. The response can ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:connect; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 95; 5, 387; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 9, comparison_operator:==; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifi...
def connect(self): """ Establish a connection to the device. Purpose: This method is used to make a connection to the junos | device. The internal property conn_type is what | determines the type of connection we make to the device. | - 'paramiko' is used fo...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:script; 3, parameters; 3, 4; 3, 5; 4, identifier:inbox; 5, identifier:cfg; 6, block; 6, 7; 6, 9; 6, 15; 6, 47; 6, 48; 6, 49; 6, 53; 6, 64; 6, 70; 6, 106; 6, 107; 6, 132; 6, 133; 6, 139; 6, 143; 6, 296; 6, 297; 6, 319; 6, 345; 6, 346; 6, 347; 7,...
def script(inbox, cfg): """ Execute arbitrary scripts. Arguments: - cfg(``dict``) script configuartion dictionary """ script_name = cfg["id"] script_id = str(abs(hash((cfg["id"],) + tuple(inbox[0].values()))))[0:8] # LOG.log(mp.DEFAULT, "@papy;script %s:%s started" % (script_na...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_create_update_tracking_related_event; 3, parameters; 3, 4; 4, identifier:instance; 5, block; 5, 6; 5, 8; 5, 12; 5, 13; 5, 104; 5, 105; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, i...
def _create_update_tracking_related_event(instance): """ Create a TrackingEvent and TrackedFieldModification for an UPDATE event for each related model. """ events = {} # Create a dict mapping related model field to modified fields for field, related_fields in instance._tracked_related_field...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 1, 21; 2, function_name:list; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:filter; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:type; 10, None; 11, default_parameter; 11,...
def list(self, filter=None, type=None, sort=None, limit=None, page=None): # pylint: disable=redefined-builtin """Get a list of packages. :param filter: (optional) Filters to apply as a string list. :param type: (optional) `union` or `inter` as string. :param sort: (optional) Sort fields...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:clean_lines; 3, parameters; 3, 4; 4, identifier:commands; 5, block; 5, 6; 5, 8; 5, 100; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 8, 15; 8, 85; 8, 93; 9, call; 9, 10; 9, 11; 10, identifier:isinstance; 11, argument...
def clean_lines(commands): """ Generate strings that are not comments or lines with only whitespace. Purpose: This function is a generator that will read in either a | plain text file of strings(IP list, command list, etc), a | comma separated string of strings, or a list of strings. It ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:xpath; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:source_xml; 5, identifier:xpath_expr; 6, default_parameter; 6, 7; 6, 8; 7, identifier:req_format; 8, string:'string'; 9, block; 9, 10; 9, 12; 9, 16; 9, 35; 9, 36; 9, 37; 9, 85; 9, 86; 9, 96;...
def xpath(source_xml, xpath_expr, req_format='string'): """ Filter xml based on an xpath expression. Purpose: This function applies an Xpath expression to the XML | supplied by source_xml. Returns a string subtree or | subtrees that match the Xpath expression. It can also return ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:model_to_dict; 3, parameters; 3, 4; 3, 5; 4, identifier:instance; 5, dictionary_splat_pattern; 5, 6; 6, identifier:options; 7, block; 7, 8; 7, 10; 7, 17; 7, 21; 7, 53; 7, 54; 7, 55; 7, 256; 7, 257; 7, 272; 8, expression_statement; 8, 9; 9, stri...
def model_to_dict(instance, **options): "Takes a model instance and converts it into a dict." options = _defaults(options) attrs = {} if options['prehook']: if isinstance(options['prehook'], collections.Callable): instance = options['prehook'](instance) if instance is N...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 1, 22; 2, function_name:list; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:id; 6, default_parameter; 6, 7; 6, 8; 7, identifier:filter; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:type; 11, None; ...
def list(self, id, filter=None, type=None, sort=None, limit=None, page=None): # pylint: disable=invalid-name,redefined-builtin """Get a list of a device's attachments. :param id: Device ID as an int. :param filter: (optional) Filters to apply as a string list. :param type: (optional) `u...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:load_item; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:inbox; 5, default_parameter; 5, 6; 5, 7; 6, identifier:type; 7, string:"string"; 8, default_parameter; 8, 9; 8, 10; 9, identifier:remove; 10, True; 11, default_parameter; 11, 12;...
def load_item(inbox, type="string", remove=True, buffer=None): """ Loads data from a file. Determines the file type automatically ``"file"``, ``"fifo"``, ``"socket"``, but allows to specify the representation type ``"string"`` or ``"mmap"`` for memory mapped access to the file. Returns the loaded...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:write_validate; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:ctx; 5, identifier:param; 6, identifier:value; 7, block; 7, 8; 7, 10; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 16; 10, 86; 11, comparison_operator:!=...
def write_validate(ctx, param, value): """ Validate the -w option. Purpose: Validates the `-w`|`--write` option. Two arguments are expected. | The first is the mode, which must be in ['s', 'single', 'm', | 'multiple']. The mode determins if we're writing to one file for | all ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:write_out; 3, parameters; 3, 4; 4, identifier:input; 5, block; 5, 6; 5, 8; 5, 9; 5, 15; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 14; 11, pattern_list; 11, 12; 11, 13; 12,...
def write_out(input): """ Callback function to write the output from the script. @param input: A tuple containing two things: | 1. None or Tuple of file mode and destination filepath | 2. The output of the jaide command that will be either | written to sys.std...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:endpoint; 3, parameters; 3, 4; 4, identifier:request; 5, block; 5, 6; 5, 8; 5, 9; 5, 10; 5, 11; 5, 20; 5, 21; 5, 62; 5, 63; 5, 92; 5, 123; 5, 124; 5, 125; 5, 149; 5, 150; 5, 173; 5, 174; 5, 175; 5, 176; 5, 177; 5, 188; 5, 197; 5, 222; 5, 223; 5...
def endpoint(request): """Endpoint that SNS accesses. Includes logic verifying request""" # pylint: disable=too-many-return-statements,too-many-branches # In order to 'hide' the endpoint, all non-POST requests should return # the site's default HTTP404 if request.method != 'POST': raise Htt...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_process_value; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:value; 6, identifier:type; 7, block; 7, 8; 7, 10; 7, 32; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 22; 11, not_operator; 11, 12; 1...
def _process_value(self, value, type): """ Process a value that will be sent to backend :param value: the value to return :param type: hint for what sort of value this is :type type: str """ if not isinstance(value, six.string_types + (list,)): val...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:representatives; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:count; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:sorting; 10, False; 11, block; 11, 12; 11, 14; 11, 18; 11, 3...
def representatives(self, count=None, sorting=False): """ Returns a list of pairs of representative and its voting weight :param count: Max amount of representatives to return :type count: int :param sorting: If true, sorts by weight :type sorting: bool :raises...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:iterative_overlap_assembly; 3, parameters; 3, 4; 3, 5; 4, identifier:variant_sequences; 5, default_parameter; 5, 6; 5, 7; 6, identifier:min_overlap_size; 7, identifier:MIN_VARIANT_SEQUENCE_ASSEMBLY_OVERLAP_SIZE; 8, block; 8, 9; 8, 11; 8, 23; 8,...
def iterative_overlap_assembly( variant_sequences, min_overlap_size=MIN_VARIANT_SEQUENCE_ASSEMBLY_OVERLAP_SIZE): """ Assembles longer sequences from reads centered on a variant by between merging all pairs of overlapping sequences and collapsing shorter sequences onto every longer sequen...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:ortho_basis; 3, parameters; 3, 4; 3, 5; 4, identifier:normal; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ref_vec; 7, None; 8, block; 8, 9; 8, 11; 8, 12; 8, 17; 8, 24; 8, 31; 8, 38; 8, 45; 8, 46; 8, 47; 8, 51; 8, 52; 8, 68; 8, 69; 8, 84; 8,...
def ortho_basis(normal, ref_vec=None): """Generates an orthonormal basis in the plane perpendicular to `normal` The orthonormal basis generated spans the plane defined with `normal` as its normal vector. The handedness of `on1` and `on2` in the returned basis is such that: .. math:: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:orthonorm_check; 3, parameters; 3, 4; 3, 5; 3, 10; 4, identifier:a; 5, default_parameter; 5, 6; 5, 7; 6, identifier:tol; 7, attribute; 7, 8; 7, 9; 8, identifier:_DEF; 9, identifier:ORTHONORM_TOL; 10, default_parameter; 10, 11; 10, 12; 11, iden...
def orthonorm_check(a, tol=_DEF.ORTHONORM_TOL, report=False): """Checks orthonormality of the column vectors of a matrix. If a one-dimensional |nparray| is passed to `a`, it is treated as a single column vector, rather than a row matrix of length-one column vectors. The matrix `a` does not need to be ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:parallel_check; 3, parameters; 3, 4; 3, 5; 4, identifier:vec1; 5, identifier:vec2; 6, block; 6, 7; 6, 9; 6, 10; 6, 17; 6, 22; 6, 23; 6, 27; 6, 28; 6, 61; 6, 62; 6, 81; 6, 82; 6, 83; 6, 91; 6, 115; 6, 116; 7, expression_statement; 7, 8; 8, comme...
def parallel_check(vec1, vec2): """Checks whether two vectors are parallel OR anti-parallel. Vectors must be of the same dimension. Parameters ---------- vec1 length-R |npfloat_| -- First vector to compare vec2 length-R |npfloat_| -- Second vector to compare ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:vec_angle; 3, parameters; 3, 4; 3, 5; 4, identifier:vec1; 5, identifier:vec2; 6, block; 6, 7; 6, 9; 6, 10; 6, 15; 6, 22; 6, 29; 6, 30; 6, 45; 6, 46; 6, 61; 6, 62; 6, 80; 6, 81; 6, 82; 6, 99; 6, 100; 6, 117; 6, 118; 6, 119; 6, 120; 6, 144; 6, 18...
def vec_angle(vec1, vec2): """ Angle between two R-dimensional vectors. Angle calculated as: .. math:: \\arccos\\left[ \\frac{\\mathsf{vec1}\cdot\\mathsf{vec2}} {\\left\\|\\mathsf{vec1}\\right\\| \\left\\|\\mathsf{vec2}\\right\\|} \\right] Parameters -...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:ctr_mass; 3, parameters; 3, 4; 3, 5; 4, identifier:geom; 5, identifier:masses; 6, block; 6, 7; 6, 9; 6, 10; 6, 15; 6, 24; 6, 25; 6, 40; 6, 41; 6, 56; 6, 57; 6, 74; 6, 75; 6, 107; 6, 108; 6, 109; 6, 133; 6, 134; 6, 135; 6, 136; 6, 137; 6, 138; 6...
def ctr_mass(geom, masses): """Calculate the center of mass of the indicated geometry. Take a geometry and atom masses and compute the location of the center of mass. Parameters ---------- geom length-3N |npfloat_| -- Coordinates of the atoms masses length-N OR len...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:inertia_tensor; 3, parameters; 3, 4; 3, 5; 4, identifier:geom; 5, identifier:masses; 6, block; 6, 7; 6, 9; 6, 10; 6, 15; 6, 16; 6, 17; 6, 25; 6, 26; 6, 27; 6, 51; 6, 52; 6, 53; 6, 64; 6, 65; 6, 263; 6, 264; 6, 265; 7, expression_statement; 7, 8...
def inertia_tensor(geom, masses): """Generate the 3x3 moment-of-inertia tensor. Compute the 3x3 moment-of-inertia tensor for the provided geometry and atomic masses. Always recenters the geometry to the center of mass as the first step. Reference for inertia tensor: [Kro92]_, Eq. (2.26) .. t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:rot_consts; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 11; 4, identifier:geom; 5, identifier:masses; 6, default_parameter; 6, 7; 6, 8; 7, identifier:units; 8, attribute; 8, 9; 8, 10; 9, identifier:_EURC; 10, identifier:INV_INERTIA; 11, default_parame...
def rot_consts(geom, masses, units=_EURC.INV_INERTIA, on_tol=_DEF.ORTHONORM_TOL): """Rotational constants for a given molecular system. Calculates the rotational constants for the provided system with numerical value given in the units provided in `units`. The orthnormality tolerance `on_tol` is requi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_fadn_orth; 3, parameters; 3, 4; 3, 5; 4, identifier:vec; 5, identifier:geom; 6, block; 6, 7; 6, 9; 6, 10; 6, 15; 6, 22; 6, 29; 6, 36; 6, 45; 6, 46; 6, 73; 6, 74; 6, 88; 6, 89; 6, 90; 6, 107; 6, 108; 6, 109; 6, 120; 6, 121; 7, expression_statem...
def _fadn_orth(vec, geom): """First non-zero Atomic Displacement Non-Orthogonal to Vec Utility function to identify the first atomic displacement in a geometry that is (a) not the zero vector; and (b) not normal to the reference vector. Parameters ---------- vec length-3 |npfloat_| -- ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_fadn_par; 3, parameters; 3, 4; 3, 5; 4, identifier:vec; 5, identifier:geom; 6, block; 6, 7; 6, 9; 6, 10; 6, 15; 6, 22; 6, 29; 6, 36; 6, 45; 6, 46; 6, 73; 6, 74; 6, 88; 6, 89; 6, 90; 6, 107; 6, 108; 6, 109; 6, 120; 6, 121; 6, 192; 6, 193; 6, 19...
def _fadn_par(vec, geom): """First non-zero Atomic Displacement that is Non-Parallel with Vec Utility function to identify the first atomic displacement in a geometry that is both (a) not the zero vector and (b) non-(anti-)parallel with a reference vector. Parameters ---------- vec ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:reference_contexts_for_variants; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:variants; 5, identifier:context_size; 6, default_parameter; 6, 7; 6, 8; 7, identifier:transcript_id_whitelist; 8, None; 9, block; 9, 10; 9, 12; 9, 18; 9, 39; 10, ex...
def reference_contexts_for_variants( variants, context_size, transcript_id_whitelist=None): """ Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotid...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:pack_tups; 3, parameters; 3, 4; 4, list_splat_pattern; 4, 5; 5, identifier:args; 6, block; 6, 7; 6, 9; 6, 10; 6, 15; 6, 16; 6, 20; 6, 21; 6, 26; 6, 27; 6, 32; 6, 33; 6, 47; 6, 48; 6, 66; 6, 67; 6, 68; 6, 87; 6, 88; 6, 89; 6, 107; 6, 114; 6, 115...
def pack_tups(*args): """Pack an arbitrary set of iterables and non-iterables into tuples. Function packs a set of inputs with arbitrary iterability into tuples. Iterability is tested with :func:`iterable`. Non-iterable inputs are repeated in each output tuple. Iterable inputs are expanded uniforml...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:check_geom; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:c1; 5, identifier:a1; 6, identifier:c2; 7, identifier:a2; 8, default_parameter; 8, 9; 8, 10; 9, identifier:tol; 10, attribute; 10, 11; 10, 12; 11, identifier:_DEF; 12, iden...
def check_geom(c1, a1, c2, a2, tol=_DEF.XYZ_COORD_MATCH_TOL): """ Check for consistency of two geometries and atom symbol lists Cartesian coordinates are considered consistent with the input coords if each component matches to within `tol`. If coords or atoms vectors are passed that are of mismatched ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:assert_npfloatarray; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:obj; 5, identifier:varname; 6, identifier:desc; 7, identifier:exc; 8, identifier:tc; 9, identifier:errsrc; 10, block; 10, 11; 10, 13; 10, 14; 10, 19; 10, 20;...
def assert_npfloatarray(obj, varname, desc, exc, tc, errsrc): """ Assert a value is an |nparray| of NumPy floats. Pass |None| to `varname` if `obj` itself is to be checked. Otherwise, `varname` is the string name of the attribute of `obj` to check. In either case, `desc` is a string description of the...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_advance_pattern_generators; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:p; 6, block; 6, 7; 6, 9; 6, 13; 6, 83; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, iden...
def _advance_pattern_generators(self,p): """ Advance the parameters for each generator for this presentation. Picks a position for each generator that is accepted by __distance_valid for all combinations. Returns a new list of the generators, with some potentially omitt...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:register; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 10; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:settings_class; 7, identifier:NoSwitcher; 8, list_splat_pattern; 8, 9; 9, identifier:simple_checks; 10, dictionary_splat_patt...
def register(self, settings_class=NoSwitcher, *simple_checks, **conditions): """ Register a settings class with the switcher. Can be passed the settings class to register or be used as a decorator. :param settings_class: The class to register with the provided ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_load_data; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:atom_syms; 6, identifier:coords; 7, default_parameter; 7, 8; 7, 9; 8, identifier:bohrs; 9, True; 10, block; 10, 11; 10, 13; 10, 14; 10, 19; 10, 28; 10, 35; 10...
def _load_data(self, atom_syms, coords, bohrs=True): """ Internal function for making XYZ object from explicit geom data. Parameters ---------- atom_syms Squeezes to array of N |str| -- Element symbols for the XYZ. Must be valid elements as defined in ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:dist_single; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:g_num; 6, identifier:at_1; 7, identifier:at_2; 8, block; 8, 9; 8, 11; 8, 12; 8, 17; 8, 24; 8, 33; 8, 34; 8, 35; 8, 36; 8, 37; 8, 60; 8, 61; 8, 84; 8, 85; 8, 8...
def dist_single(self, g_num, at_1, at_2): """ Distance between two atoms. Parameters ---------- g_num |int| -- Index of the desired geometry at_1 |int| -- Index of the first atom at_2 |int| -- Index of the second atom Return...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:dist_iter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:g_nums; 6, identifier:ats_1; 7, identifier:ats_2; 8, default_parameter; 8, 9; 8, 10; 9, identifier:invalid_error; 10, False; 11, block; 11, 12; 11, 14; 1...
def dist_iter(self, g_nums, ats_1, ats_2, invalid_error=False): """ Iterator over selected interatomic distances. Distances are in Bohrs as with :meth:`dist_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:angle_single; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:g_num; 6, identifier:at_1; 7, identifier:at_2; 8, identifier:at_3; 9, block; 9, 10; 9, 12; 9, 13; 9, 18; 9, 27; 9, 35; 9, 36; 9, 37; 9, 38; 9, 39; 9, 6...
def angle_single(self, g_num, at_1, at_2, at_3): """ Spanning angle among three atoms. The indices `at_1` and `at_3` can be the same (yielding a trivial zero angle), but `at_2` must be different from both `at_1` and `at_3`. Parameters ---------- g_num ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:angle_iter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:self; 5, identifier:g_nums; 6, identifier:ats_1; 7, identifier:ats_2; 8, identifier:ats_3; 9, default_parameter; 9, 10; 9, 11; 10, identifier:invalid_error; 11, False...
def angle_iter(self, g_nums, ats_1, ats_2, ats_3, invalid_error=False): """ Iterator over selected atomic angles. Angles are in degrees as with :meth:`angle_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:dihed_iter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, identifier:self; 5, identifier:g_nums; 6, identifier:ats_1; 7, identifier:ats_2; 8, identifier:ats_3; 9, identifier:ats_4; 10, line_continuation:\; 11, default_par...
def dihed_iter(self, g_nums, ats_1, ats_2, ats_3, ats_4, \ invalid_error=False): """ Iterator over selected dihedral angles. Angles are in degrees as with :meth:`dihed_single`. See `above <toc-generators_>`_ for more information on ca...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:displ_single; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:g_num; 6, identifier:at_1; 7, identifier:at_2; 8, block; 8, 9; 8, 11; 8, 12; 8, 17; 8, 26; 8, 27; 8, 28; 8, 29; 8, 30; 8, 53; 8, 54; 8, 77; 8, 78; 8, 79; 8, ...
def displ_single(self, g_num, at_1, at_2): """ Displacement vector between two atoms. Returns the displacement vector pointing from `at_1` toward `at_2` from geometry `g_num`. If `at_1` == `at_2` a strict zero vector is returned. Displacement vector is returned in units of Bohr...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:displ_iter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:g_nums; 6, identifier:ats_1; 7, identifier:ats_2; 8, default_parameter; 8, 9; 8, 10; 9, identifier:invalid_error; 10, False; 11, block; 11, 12; 11, 14; ...
def displ_iter(self, g_nums, ats_1, ats_2, invalid_error=False): """ Iterator over indicated displacement vectors. Displacements are in Bohrs as with :meth:`displ_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_none_subst; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, block; 7, 8; 7, 10; 7, 11; 7, 16; 7, 17; 7, 25; 7, 29; 7, 30; 7, 51; 7, 52; 7, 53; 7, 175; 7, 176; 7, 177; 8, expression_statement; ...
def _none_subst(self, *args): """ Helper function to insert full ranges for |None| for X_iter methods. Custom method, specifically tailored, taking in the arguments from an X_iter method and performing the replacement of |None| after error-checking the arguments for a max of one |None| ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 2, function_name:new_from_files; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 12; 3, 13; 3, 18; 3, 19; 3, 22; 4, identifier:self; 5, identifier:basepath; 6, identifier:basename; 7, identifier:repo; 8, line_continuation:\; 9, default_parameter; 9, 10; ...
def new_from_files(self, basepath, basename, repo, \ bohrs=False, \ software=_E_SW.ORCA, \ repo_clobber=False, **kwargs): """ Initialize with data from files. """ # Imports import os from os import path as osp ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:from_locus_read; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:locus_read; 6, identifier:n_ref; 7, block; 7, 8; 7, 10; 7, 16; 7, 22; 7, 23; 7, 24; 7, 30; 7, 36; 7, 37; 7, 38; 7, 44; 7, 59; 7, 65; 7, 80; 7, 172; 7, 183; 7, 19...
def from_locus_read(cls, locus_read, n_ref): """ Given a single LocusRead object, return either an AlleleRead or None Parameters ---------- locus_read : LocusRead Read which overlaps a variant locus but doesn't necessarily contain the alternate nucleotide...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:mtx_refl; 3, parameters; 3, 4; 3, 5; 4, identifier:nv; 5, default_parameter; 5, 6; 5, 7; 6, identifier:reps; 7, integer:1; 8, block; 8, 9; 8, 11; 8, 12; 8, 17; 8, 24; 8, 31; 8, 32; 8, 49; 8, 50; 8, 51; 8, 69; 8, 70; 8, 84; 8, 85; 8, 103; 8, 104...
def mtx_refl(nv, reps=1): """ Generate block-diagonal reflection matrix about nv. reps must be >=1 and indicates the number of times the reflection matrix should be repeated along the block diagonal. Typically this will be the number of atoms in a geometry. .. todo:: Complete mtx_refl docstring ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:mtx_rot; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:ax; 5, identifier:theta; 6, default_parameter; 6, 7; 6, 8; 7, identifier:reps; 8, integer:1; 9, block; 9, 10; 9, 12; 9, 13; 9, 18; 9, 25; 9, 32; 9, 33; 9, 50; 9, 51; 9, 52; 9, 70; 9, 71; 9...
def mtx_rot(ax, theta, reps=1): """ Generate block-diagonal rotation matrix about ax. [copy handedness from somewhere] .. todo:: Complete mtx_rot docstring """ # Imports import numpy as np from scipy import linalg as spla from ..const import PRM # Ensure |ax| is large enough for...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:ffd; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:items; 5, identifier:targets; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 11; 8, 24; 8, 42; 8, 55; 9, expression_statement; 9, 10; 10, comment; 11, expression_s...
def ffd(items, targets, **kwargs): """First-Fit Decreasing This is perhaps the simplest packing heuristic; it simply packs items in the next available bin. This algorithm differs only from Next-Fit Decreasing in having a 'sort'; that is, the items are pre-sorted (largest to smallest). Com...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:match_variant_sequence_to_reference_context; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 4, identifier:variant_sequence; 5, identifier:reference_context; 6, identifier:min_transcript_prefix_length; 7, identifier:max_transcript_mismatch...
def match_variant_sequence_to_reference_context( variant_sequence, reference_context, min_transcript_prefix_length, max_transcript_mismatches, include_mismatches_after_variant=False, max_trimming_attempts=2): """ Iteratively trim low-coverage subsequences of a var...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:predicted_effects_for_variant; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:variant; 5, default_parameter; 5, 6; 5, 7; 6, identifier:transcript_id_whitelist; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:only_coding_changes; 10, ...
def predicted_effects_for_variant( variant, transcript_id_whitelist=None, only_coding_changes=True): """ For a given variant, return its set of predicted effects. Optionally filter to transcripts where this variant results in a non-synonymous change to the protein sequence. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_protein_sequences; 3, parameters; 3, 4; 4, identifier:protein_sequences; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, return_statement; 8, 9; 9, call; 9, 10; 9, 11; 10, identifier:list; 11, argument_list; 11, 12; 12,...
def sort_protein_sequences(protein_sequences): """ Sort protein sequences in decreasing order of priority """ return list( sorted( protein_sequences, key=ProteinSequence.ascending_sort_key, reverse=True))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 32; 2, function_name:reads_generator_to_protein_sequences_generator; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:variant_and_overlapping_reads_generator; 5, default_parameter; 5, 6; 5, 7; 6, identifier:transcript...
def reads_generator_to_protein_sequences_generator( variant_and_overlapping_reads_generator, transcript_id_whitelist=None, protein_sequence_length=PROTEIN_SEQUENCE_LENGTH, min_alt_rna_reads=MIN_ALT_RNA_READS, min_variant_sequence_coverage=MIN_VARIANT_SEQUENCE_COVERAGE, mi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:from_variant_and_transcript; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:cls; 5, identifier:variant; 6, identifier:transcript; 7, identifier:context_size; 8, block; 8, 9; 8, 11; 8, 30; 8, 49; 8, 68; 8, 85; 8, 103; 9, expression_stateme...
def from_variant_and_transcript( cls, variant, transcript, context_size): """ Extracts the reference sequence around a variant locus on a particular transcript and determines the reading frame at the start of that sequence context. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:info; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:package; 5, identifier:long_description; 6, identifier:classifiers; 7, identifier:license; 8, block; 8, 9; 8, 11; 8, 19; 9, expression_statement; 9, 10; 10, comment; 11, expression_stat...
def info(package, long_description, classifiers, license): """Get info about a package or packages. """ client = requests.Session() for name_or_url in package: package = get_package(name_or_url, client) if not package: secho(u'Invalid name or URL: "{name}"'.format(name=name_o...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:install_packages; 3, parameters; 3, 4; 3, 5; 4, identifier:packages; 5, default_parameter; 5, 6; 5, 7; 6, identifier:what_for; 7, string:'for a complete setup to work properly'; 8, block; 8, 9; 8, 11; 8, 15; 8, 22; 8, 31; 8, 196; 9, expression_...
def install_packages(packages, what_for='for a complete setup to work properly'): '''Try to install .deb packages given by list. Return True, if packages could be installed or are installed already, or if they cannot be installed but the user gives feedback to continue. Else retur...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:scan; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:host; 5, default_parameter; 5, 6; 5, 7; 6, identifier:port; 7, integer:80; 8, default_parameter; 8, 9; 8, 10; 9, identifier:url; 10, None; 11, default_parameter; 11, 12;...
def scan(host, port=80, url=None, https=False, timeout=1, max_size=65535): """ Scan a network port Parameters ---------- host : str Host or ip address to scan port : int, optional Port to scan, default=80 url : str, optional URL to perform get request to on the hos...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 45; 2, function_name:redirect; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 3, 33; 3, 36; 3, 39; 3, 42; 4, identifier:pattern; 5, identifier:to; 6, default_parameter; 6, 7; 6, 8; 7, identifier:permanent; 8, True; 9, defau...
def redirect(pattern, to, permanent=True, locale_prefix=True, anchor=None, name=None, query=None, vary=None, cache_timeout=12, decorators=None, re_flags=None, to_args=None, to_kwargs=None, prepend_locale=True, merge_query=False): """ Return a url matcher suited for urlpatterns. pa...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:FD; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 18; 5, 19; 5, 20; 5, 21; 5, 22; 5, 23; 5, 24; 5, 50; 5, 51; 5, 52; 5, 81; 5, 117; 5, 118; 5, 156; 5, 157; 5, 276; 5, 277; 5, 301; 5, 302; 5, 303; 5, 304; 6, expression_statem...
def FD(self): """ Set-up for the finite difference solution method """ if self.Verbose: print("Finite Difference Solution Technique") # Used to check for coeff_matrix here, but now doing so in self.bc_check() # called by f1d and f2d at the start # # Define a stress-based qs = q0 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:SAS_NG; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 77; 5, 78; 5, 237; 5, 238; 5, 239; 5, 240; 5, 241; 5, 249; 5, 264; 5, 265; 5, 266; 5, 270; 5, 271; 5, 272; 5, 273; 5, 320; 5, 321; 5, 344; 5, 478; 6, expression_statement...
def SAS_NG(self): """ Set-up for the ungridded superposition of analytical solutions method for solving flexure """ if self.filename: # Define the (scalar) elastic thickness self.Te = self.configGet("float", "input", "ElasticThickness") # See if it wants to be run in lat/lon ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_c3_mro; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, default_parameter; 5, 6; 5, 7; 6, identifier:abcs; 7, None; 8, block; 8, 9; 8, 11; 8, 51; 8, 61; 8, 74; 8, 78; 8, 91; 8, 126; 8, 137; 8, 151; 8, 165; 8, 179; 9, expression_statement; 9, ...
def _c3_mro(cls, abcs=None): """Computes the method resolution order using extended C3 linearization. If no *abcs* are given, the algorithm works exactly like the built-in C3 linearization used for method resolution. If given, *abcs* is a list of abstract base classes that should be inserted into ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 6; 2, function_name:singledispatch; 3, parameters; 3, 4; 4, identifier:function; 5, comment; 6, block; 6, 7; 6, 9; 6, 13; 6, 19; 6, 24; 6, 30; 6, 31; 6, 108; 6, 109; 6, 168; 6, 191; 6, 197; 6, 203; 6, 209; 6, 218; 6, 226; 6, 232; 7, expression_statement; 7, ...
def singledispatch(function): # noqa """Single-dispatch generic function decorator. Transforms a function into a generic function, which can have different behaviours depending upon the type of its first argument. The decorated function acts as the default implementation, and additional implementa...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 40; 2, function_name:createResource; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 3, 25; 3, 28; 3, 31; 3, 34; 3, 37; 4, identifier:self; 5, identifier:resource_type; 6, identifier:title; 7, default_parameter; 7, 8; 7, 9; 8, identifier:...
def createResource(self, resource_type, title, resource_file=None, resource_filename=None, abstract=None, keywords=None, edit_users=None, view_users=None, edit_groups=None, view_groups=None, metadata=None, extra_metadata=None, progress_callback=None):...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:getResourceFile; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:pid; 6, identifier:filename; 7, default_parameter; 7, 8; 7, 9; 8, identifier:destination; 9, None; 10, block; 10, 11; 10, 13; 10, 32; 10, 78; 10, 91; 10,...
def getResourceFile(self, pid, filename, destination=None): """ Get a file within a resource. :param pid: The HydroShare ID of the resource :param filename: String representing the name of the resource file to get. :param destination: String representing the directory to save the resour...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:upsert; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 12; 5, 18; 5, 31; 5, 451; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:required_parameters; 11, l...
def upsert(self): """ The main event of the utility. Create or update a Cloud Formation stack. Injecting properties where needed Args: None Returns: True if the stack create/update is started successfully else False if the start goes off in t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:dump; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:obj; 5, default_parameter; 5, 6; 5, 7; 6, identifier:fp; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:indent; 10, None; 11, default_parameter; 11, 12; 11, 13; 12, ...
def dump(obj, fp=None, indent=None, sort_keys=False, **kw): """ Dump object to a file like object or string. :param obj: :param fp: Open file like object :param int indent: Indent size, default 2 :param bool sort_keys: Optionally sort dictionary keys. :return: Yaml serialized data. """ ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_reference; 3, parameters; 3, 4; 4, identifier:root; 5, block; 5, 6; 5, 8; 5, 12; 5, 21; 5, 31; 5, 32; 5, 42; 5, 52; 5, 323; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifie...
def get_reference(root): """Read reference info from root of ReSpecTh XML file. Args: root (`~xml.etree.ElementTree.Element`): Root of ReSpecTh XML file Returns: properties (`dict`): Dictionary with reference information """ reference = {} elem = root.find('bibliographyLink') ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:ReSpecTh_to_ChemKED; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 12; 4, identifier:filename_xml; 5, default_parameter; 5, 6; 5, 7; 6, identifier:file_author; 7, string:''; 8, default_parameter; 8, 9; 8, 10; 9, identifier:file_author_orcid; 10, ...
def ReSpecTh_to_ChemKED(filename_xml, file_author='', file_author_orcid='', *, validate=False): """Convert ReSpecTh XML file to ChemKED-compliant dictionary. Args: filename_xml (`str`): Name of ReSpecTh XML file to be converted. file_author (`str`, optional): Name to override original file auth...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_cantera_composition_string; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:species_conversion; 7, None; 8, block; 8, 9; 8, 11; 8, 49; 8, 235; 9, expression_statement; 9, 10; 10, comment; 11, i...
def get_cantera_composition_string(self, species_conversion=None): """Get the composition in a string format suitable for input to Cantera. Returns a formatted string no matter the type of composition. As such, this method is not recommended for end users; instead, prefer the `get_cantera_mole_...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:compare_name; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:given_name; 5, identifier:family_name; 6, identifier:question_name; 7, block; 7, 8; 7, 10; 7, 11; 7, 19; 7, 27; 7, 35; 7, 36; 7, 69; 7, 70; 7, 80; 7, 90; 7, 100; 7, 101; 7, 118; 7, 13...
def compare_name(given_name, family_name, question_name): """Compares a name in question to a specified name separated into given and family. The name in question ``question_name`` can be of varying format, including "Kyle E. Niemeyer", "Kyle Niemeyer", "K. E. Niemeyer", "KE Niemeyer", and "K Niemeyer"...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sorted_options; 3, parameters; 3, 4; 4, identifier:sort_options; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, return_statement; 8, 9; 9, list_comprehension; 9, 10; 9, 36; 10, dictionary; 10, 11; 10, 16; 11, pair; 11, 12; ...
def sorted_options(sort_options): """Sort sort options for display. :param sort_options: A dictionary containing the field name as key and asc/desc as value. :returns: A dictionary with sorting options for Invenio-Search-JS. """ return [ { 'title': v['title'], ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 2, function_name:insert_files; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 4, identifier:self; 5, identifier:rootpath; 6, default_parameter; 6, 7; 6, 8; 7, identifier:directoryInFilter; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, id...
def insert_files(self, rootpath, directoryInFilter=None, directoryExFilter=None, compileInFilter=None, compileExFilter=None, contentInFilter=None, contentExFilter=None): """ Inserts files by recursive traversing the rootpath and inserting files according the addition filter parameters. :param s...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:make_variant; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:cls; 5, identifier:converters; 6, default_parameter; 6, 7; 6, 8; 7, identifier:re_opts; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:compiled; 11, False; ...
def make_variant(cls, converters, re_opts=None, compiled=False, strict=True): """ Creates a type converter for a number of type converter alternatives. The first matching type converter is used. REQUIRES: type_converter.pattern attribute :param converters: List of type converte...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:info; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, string:''' Returns information on all the registered checkers. Sorted by namespace and then name :returns a list of CheckerI...
def info(self): ''' Returns information on all the registered checkers. Sorted by namespace and then name :returns a list of CheckerInfo ''' return sorted(self._checkers.values(), key=lambda x: (x.ns, x.name))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:extract_from_text; 3, parameters; 3, 4; 4, identifier:text; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, return_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:tools; 12, identifier:r...
def extract_from_text(text): """ Extract HAL ids from a text. :param text: The text to extract HAL ids from. :returns: A list of matching HAL ids. >>> sorted(extract_from_text("hal-01258754 hal-01258754v2 foobar")) ['hal-01258754', 'hal-01258754v2'] """ return tools.remove_duplicates([...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:add_caveat; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:cav; 6, default_parameter; 6, 7; 6, 8; 7, identifier:key; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:loc; 11, None; 12, block; 12, 13; 12, 15...
def add_caveat(self, cav, key=None, loc=None): '''Add a caveat to the macaroon. It encrypts it using the given key pair and by looking up the location using the given locator. As a special case, if the caveat's Location field has the prefix "local " the caveat is added as a clie...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_new_caveat_id; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:base; 6, block; 6, 7; 6, 9; 6, 15; 6, 46; 6, 47; 6, 48; 6, 49; 6, 58; 6, 66; 7, expression_statement; 7, 8; 8, string:'''Return a third party caveat id This d...
def _new_caveat_id(self, base): '''Return a third party caveat id This does not duplicate any third party caveat ids already inside macaroon. If base is non-empty, it is used as the id prefix. @param base bytes @return bytes ''' id = bytearray() if len(b...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:extract_macaroons; 3, parameters; 3, 4; 4, identifier:headers_or_request; 5, block; 5, 6; 5, 8; 5, 37; 5, 41; 5, 95; 5, 102; 5, 147; 5, 148; 5, 149; 5, 150; 5, 157; 5, 176; 6, expression_statement; 6, 7; 7, string:''' Returns an array of any ma...
def extract_macaroons(headers_or_request): ''' Returns an array of any macaroons found in the given slice of cookies. If the argument implements a get_header method, that will be used instead of the get method to retrieve headers. @param headers_or_request: dict of headers or a urllib.request.Reques...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:http_error_handler; 3, parameters; 3, 4; 4, identifier:f; 5, block; 5, 6; 5, 8; 5, 52; 5, 89; 5, 308; 6, expression_statement; 6, 7; 7, comment; 8, function_definition; 8, 9; 8, 10; 8, 12; 9, function_name:hrefs_to_resources; 10, parameters; 10...
def http_error_handler(f): """Handle 404 errors returned by the API server """ def hrefs_to_resources(hrefs): for href in hrefs.replace(',', '').split(): type, uuid = href.split('/')[-2:] yield Resource(type, uuid=uuid) def hrefs_list_to_resources(hrefs_list): f...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_handle_windows; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:event; 6, block; 6, 7; 6, 9; 6, 22; 6, 72; 6, 83; 6, 87; 6, 151; 6, 173; 6, 188; 6, 328; 6, 469; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9...
def _handle_windows(self, event): """Windows key event handler.""" vkey = self._keyname(event.GetKey()) if event.Message in self.KEYS_UP + self.KEYS_DOWN: if vkey in self.MODIFIERNAMES: self._realmodifiers[vkey] = event.Message in self.KEYS_DOWN ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_handle_linux; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:keycode; 6, identifier:character; 7, identifier:press; 8, block; 8, 9; 8, 11; 8, 17; 8, 27; 8, 54; 8, 72; 9, expression_statement; 9, 10; 10, comment; 11, i...
def _handle_linux(self, keycode, character, press): """Linux key event handler.""" if character is None: return key = self._keyname(character, keycode) if key in self.MODIFIERNAMES: self._modifiers[self.MODIFIERNAMES[key]] = press self._realmodifiers[key] = ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_store_documentation; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:path; 6, identifier:html; 7, identifier:overwrite; 8, identifier:quiet; 9, block; 9, 10; 9, 12; 9, 17; 9, 28; 9, 46; 9, 68; 9, 93; 9, 118; 9, 1...
def _store_documentation(self, path, html, overwrite, quiet): """ Stores all documents on the file system. Target location is **path**. File name is the lowercase name of the document + .rst. """ echo("Storing groundwork application documents\n") echo("Application: %s" ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_show_documentation; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 12; 5, 44; 5, 59; 5, 72; 5, 89; 5, 93; 5, 97; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, iden...
def _show_documentation(self): """ Shows all documents of the current groundwork app in the console. Documents are sorted bei its names, except "main", which gets set to the beginning. """ documents = [] for key, document in self.app.documents.get().items(): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:infer_declared_from_conditions; 3, parameters; 3, 4; 3, 5; 4, identifier:conds; 5, default_parameter; 5, 6; 5, 7; 6, identifier:namespace; 7, None; 8, block; 8, 9; 8, 11; 8, 15; 8, 16; 8, 17; 8, 18; 8, 29; 8, 38; 8, 47; 8, 53; 8, 57; 8, 152; 8,...
def infer_declared_from_conditions(conds, namespace=None): ''' like infer_declared except that it is passed a set of first party caveat conditions as a list of string rather than a set of macaroons. ''' conflicts = [] # If we can't resolve that standard namespace, then we'll look for # just bare...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_cited_dois; 3, parameters; 3, 4; 4, identifier:file; 5, block; 5, 6; 5, 8; 5, 9; 5, 33; 5, 37; 5, 41; 5, 42; 5, 133; 5, 134; 5, 220; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, if_statement; 9, 10; 9, 16; 9, 17; 9, 18; 9, 26; ...
def get_cited_dois(file): """ Get the DOIs of the papers cited in a plaintext file. The file should \ have one citation per line. .. note:: This function is also used as a backend tool by most of the others \ citations processors, to factorize the code. :param file: Either...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:used_args; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 13; 5, 90; 5, 99; 5, 100; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:v...
def used_args(self): """Return args already used in the command line rtype: command.Arg generator """ # get all arguments values from the command line values = [] for idx, c in enumerate(self.words[1:]): if c.startswith('-'): continue ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_preprocess; 3, parameters; 3, 4; 4, identifier:inp; 5, block; 5, 6; 5, 8; 5, 19; 5, 30; 5, 41; 5, 52; 5, 63; 5, 74; 5, 85; 5, 96; 5, 107; 5, 118; 5, 129; 5, 140; 5, 151; 5, 337; 6, expression_statement; 6, 7; 7, comment; 8, expression_statemen...
def _preprocess(inp): """Revise wording to match canonical and expected forms.""" inp = re.sub(r'(\b)a(\b)', r'\g<1>one\g<2>', inp) inp = re.sub(r'to the (.*) power', r'to \g<1>', inp) inp = re.sub(r'to the (.*?)(\b)', r'to \g<1>\g<2>', inp) inp = re.sub(r'log of', r'log', inp) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:parseEquation; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:inp; 6, block; 6, 7; 6, 9; 6, 18; 6, 27; 6, 28; 6, 111; 6, 240; 6, 249; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 1...
def parseEquation(self, inp): """Solves the equation specified by the input string. Args: inp (str): An equation, specified in words, containing some combination of numbers, binary, and unary operations. Returns: The floating-point result of carrying out...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:activate; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:plugins; 7, list:[]; 8, block; 8, 9; 8, 11; 8, 20; 8, 38; 8, 54; 8, 58; 8, 288; 9, expression_statement; 9, 10; 10, comment; 11, expression...
def activate(self, plugins=[]): """ Activates given plugins. This calls mainly plugin.activate() and plugins register needed resources like commands, signals or documents. If given plugins have not been initialised, this is also done via :func:`_load`. :param plugins: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:dispersion_ranking_NN; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:nnm; 6, default_parameter; 6, 7; 6, 8; 7, identifier:num_norm_avg; 8, integer:50; 9, block; 9, 10; 9, 12; 9, 19; 9, 29; 9, 43; 9, 54; 9, 72; 9, 86; 9, 104...
def dispersion_ranking_NN(self, nnm, num_norm_avg=50): """Computes the spatial dispersion factors for each gene. Parameters ---------- nnm - scipy.sparse, float Square cell-to-cell nearest-neighbor matrix. num_norm_avg - int, optional, default 50 The top...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 31; 2, function_name:scatter; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:projection; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:c; 10, None; 1...
def scatter(self, projection=None, c=None, cmap='rainbow', linewidth=0.0, edgecolor='k', axes=None, colorbar=True, s=10, **kwargs): """Display a scatter plot. Displays a scatter plot using the SAM projection or another input projection with or without annotations. Param...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:parseFloat; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:words; 6, block; 6, 7; 6, 9; 6, 88; 6, 243; 6, 244; 6, 251; 6, 256; 6, 257; 6, 264; 6, 269; 6, 270; 7, expression_statement; 7, 8; 8, comment; 9, function_definition; 9, 1...
def parseFloat(self, words): """Convert a floating-point number described in words to a double. Supports two kinds of descriptions: those with a 'point' (e.g., "one point two five") and those with a fraction (e.g., "one and a quarter"). Args: words (str): Descriptio...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:run; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:cmd; 6, default_parameter; 6, 7; 6, 8; 7, identifier:stdin; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:marshal_output; 11, True; 12, dictiona...
def run(self, cmd, stdin=None, marshal_output=True, **kwargs): """Runs a p4 command and returns a list of dictionary objects :param cmd: Command to run :type cmd: list :param stdin: Standard Input to send to the process :type stdin: str :param marshal_output: Whether or ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:canonical_ops; 3, parameters; 3, 4; 4, identifier:ops; 5, block; 5, 6; 5, 8; 5, 30; 6, expression_statement; 6, 7; 7, string:''' Returns the given operations array sorted with duplicates removed. @param ops checker.Ops @return: checker...
def canonical_ops(ops): ''' Returns the given operations array sorted with duplicates removed. @param ops checker.Ops @return: checker.Ops ''' new_ops = sorted(set(ops), key=lambda x: (x.entity, x.action)) return new_ops
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:extract_from_text; 3, parameters; 3, 4; 4, identifier:text; 5, block; 5, 6; 5, 8; 5, 9; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, return_statement; 9, 10; 10, call; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, identifier:t...
def extract_from_text(text): """ Extract arXiv IDs from a text. :param text: The text to extract arXiv IDs from. :returns: A list of matching arXiv IDs, in canonical form. >>> sorted(extract_from_text('1506.06690 1506.06690v1 arXiv:1506.06690 arXiv:1506.06690v1 arxiv:1506.06690 arxiv:1506.06690v1 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:extractTimes; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:inp; 6, block; 6, 7; 6, 9; 6, 314; 6, 323; 7, expression_statement; 7, 8; 8, comment; 9, function_definition; 9, 10; 9, 11; 9, 13; 10, function_name:handleMatch; 11, par...
def extractTimes(self, inp): """Extracts time-related information from an input string. Ignores any information related to the specific date, focusing on the time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects con...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:serialize_text; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 26; 5, 44; 5, 48; 5, 65; 6, expression_statement; 6, 7; 7, string:'''Returns a serialized form of the Namepace. All the elements in the namespace are sor...
def serialize_text(self): '''Returns a serialized form of the Namepace. All the elements in the namespace are sorted by URI, joined to the associated prefix with a colon and separated with spaces. :return: bytes ''' if self._uri_to_prefix is None or len(self._uri...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:with_zero_or_one; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:converter; 6, default_parameter; 6, 7; 6, 8; 7, identifier:pattern; 8, None; 9, block; 9, 10; 9, 12; 9, 18; 9, 33; 9, 42; 9, 51; 9, 81; 9, 87; 9, 88; 9, 94; 10,...
def with_zero_or_one(cls, converter, pattern=None): """Creates a type converter for a T with 0..1 times by using the type converter for one item of T. :param converter: Type converter (function) for data type T. :param pattern: Regexp pattern for an item (=converter.pattern). :...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:stats_keyboard; 3, parameters; 3, 4; 3, 5; 4, identifier:events; 5, identifier:table; 6, block; 6, 7; 6, 9; 6, 21; 6, 29; 6, 37; 6, 50; 6, 65; 6, 74; 6, 75; 6, 203; 6, 232; 6, 390; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, ...
def stats_keyboard(events, table): """Return statistics and collated events for keyboard events.""" if len(events) < 2: return [], [] deltas, prev_dt = [], None sessions, session = [], None UNBROKEN_DELTA = datetime.timedelta(seconds=conf.KeyboardSessionMaxDelta) blank = collections.defaul...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:to_perseus; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:df; 5, identifier:path_or_file; 6, default_parameter; 6, 7; 6, 8; 7, identifier:main_columns; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:separator;...
def to_perseus(df, path_or_file, main_columns=None, separator=separator, convert_bool_to_category=True, numerical_annotation_rows = set([])): """ Save pd.DataFrame to Perseus text format. :param df: pd.DataFrame. :param path_or_file: File name or file-like object. :param mai...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:do_your_job; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 18; 5, 19; 5, 69; 5, 75; 5, 76; 5, 85; 5, 86; 5, 159; 5, 369; 5, 384; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10;...
def do_your_job(self): """ the goal of the explore agent is to move to the target while avoiding blockages on the grid. This function is messy and needs to be looked at. It currently has a bug in that the backtrack oscillates so need a new method of doing this - probably...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:save_filelist; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:self; 5, identifier:opFile; 6, identifier:opFormat; 7, default_parameter; 7, 8; 7, 9; 8, identifier:delim; 9, string:','; 10, default_parameter; 10, 11; 10, 12; 11, ide...
def save_filelist(self, opFile, opFormat, delim=',', qu='"'): """ uses a List of files and collects meta data on them and saves to an text file as a list or with metadata depending on opFormat. """ op_folder = os.path.dirname(opFile) if op_folder is not None: # ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:type; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:variant_probe_coverages; 6, default_parameter; 6, 7; 6, 8; 7, identifier:variant; 8, None; 9, block; 9, 10; 9, 12; 9, 25; 9, 29; 9, 46; 9, 63; 9, 80; 10, expression_statem...
def type(self, variant_probe_coverages, variant=None): """ Takes a list of VariantProbeCoverages and returns a Call for the Variant. Note, in the simplest case the list will be of length one. However, we may be typing the Variant on multiple backgrouds leading to multiple Var...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:process; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:versions; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, for_statement; 9, 10; 9, 11; 9, 19; 10, identifier:tool_name; 11, call; 11, 12; 11, 13; 12, iden...
def process(self, versions): """Logging version sorted ascending by tool name.""" for tool_name in sorted(versions.keys()): version = versions[tool_name] self._log("Using tool '%s', %s" % (tool_name, version))