sequence
stringlengths
546
16.2k
code
stringlengths
108
19.3k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:Debounce; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:threshold; 6, integer:100; 7, block; 7, 8; 7, 10; 7, 14; 7, 18; 7, 178; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, augmented_as...
def Debounce(threshold=100): """ Simple debouncing decorator for apigpio callbacks. Example: `@Debouncer() def my_cb(gpio, level, tick) print('gpio cb: {} {} {}'.format(gpio, level, tick)) ` The threshold can be given to the decorator as an argument (in millisec). This decor...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:fit; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 4, identifier:self; 5, identifier:target_type; 6, identifier:target; 7, default_parameter; 7, 8; 7, 9; 8, identifier:adjust_thickness; 9, False; 10, default_parameter; 10, 11; 10, 12; 1...
def fit(self, target_type, target, adjust_thickness=False, adjust_site_atten=False, adjust_source_vel=False): """ Fit to a target crustal amplification or site term. The fitting process adjusts the velocity, site attenuation, and layer...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:build_recipe_input; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:ob; 6, identifier:dal; 7, block; 7, 8; 7, 10; 7, 14; 7, 15; 7, 16; 7, 17; 7, 18; 7, 19; 7, 23; 7, 27; 7, 167; 7, 168; 7, 177; 7, 183; 7, 223; 7, 272; 7, 342;...
def build_recipe_input(self, ob, dal): """Build a RecipeInput object.""" result = {} # We have to decide if the ob input # is a plain description (ObservingBlock) # or if it contains the nested results (Obsres) # # it has to contain the tags corresponding to the ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:subsets_of_fileinfo_from_txt; 3, parameters; 3, 4; 4, identifier:filename; 5, block; 5, 6; 5, 8; 5, 9; 5, 29; 5, 30; 5, 53; 5, 54; 5, 58; 5, 62; 5, 66; 5, 70; 5, 74; 5, 78; 5, 82; 5, 297; 5, 306; 6, expression_statement; 6, 7; 7, comment; 8, co...
def subsets_of_fileinfo_from_txt(filename): """Returns a dictionary with subsets of FileInfo instances from a TXT file. Each subset of files must be preceded by a line: @ <number> <label> where <number> indicates the number of files in that subset, and <label> is a label for that subset. Any additi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:verify_refresh; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:request; 6, block; 6, 7; 6, 9; 6, 20; 6, 29; 6, 39; 6, 70; 6, 79; 6, 91; 6, 126; 6, 182; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 14; 10, ...
def verify_refresh(self, request): """ Verify if the request to refresh the token is valid. If valid it returns the userid which can be used to create an updated identity with ``remember_identity``. Otherwise it raises an exception based on InvalidTokenError. :param requ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:get_default_terminal; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:environ; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:fallback; 9, identifier:_UNSPECIFIED; 10, block; 10, 11; 10, 13; 10, 24; 10, 25;...
def get_default_terminal(environ=None, fallback=_UNSPECIFIED): """Get the user's default terminal program.""" if environ is None: environ = os.environ # If the option is specified in the environment, respect it. if "PIAS_OPT_TERMINAL" in environ: return environ["PIAS_OPT_TERMINAL"] #...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:bitset; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 11; 3, 14; 4, identifier:name; 5, identifier:members; 6, default_parameter; 6, 7; 6, 8; 7, identifier:base; 8, attribute; 8, 9; 8, 10; 9, identifier:bases; 10, identifier:BitSet; 11, default_paramete...
def bitset(name, members, base=bases.BitSet, list=False, tuple=False): """Return a new bitset class with given name and members. Args: name: Name of the class to be created. members: Hashable sequence of allowed bitset members. base: Base class to derive the returned class from. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_split_refextract_authors_str; 3, parameters; 3, 4; 4, identifier:authors_str; 5, block; 5, 6; 5, 8; 5, 27; 5, 31; 5, 35; 5, 150; 5, 151; 5, 161; 5, 162; 5, 163; 5, 164; 5, 165; 5, 166; 5, 194; 5, 214; 6, expression_statement; 6, 7; 7, comment;...
def _split_refextract_authors_str(authors_str): """Extract author names out of refextract authors output.""" author_seq = (x.strip() for x in RE_SPLIT_AUTH.split(authors_str) if x) res = [] current = '' for author in author_seq: if not isinstance(author, six.text_type): author =...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 30; 2, function_name:query; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 4, identifier:pattern_path; 5, identifier:dict_; 6, default_parameter; 6, 7; 6, 8; 7, identifier:max_length; 8, None; 9, default_parameter; 9, 10; 9, 11; 1...
def query(pattern_path, dict_, max_length=None, strip=False, case_sensitive=False, unique=False, deduplicate=False, string_transformations=None, hyperlink=False, return_multiple_columns=False): """Query the given dict with the given pattern path and return the result. The ``patter...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:get_reactions; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 4, default_parameter; 4, 5; 4, 6; 5, identifier:columns; 6, string:'all'; 7, default_parameter; 7, 8; 7, 9; 8, identifier:n_results; 9, integer:20; 10, default_parameter; 10, 11; 10, 12; ...
def get_reactions(columns='all', n_results=20, write_db=False, **kwargs): """ Get reactions from server Give key value strings as arguments """ if write_db or columns == 'all': columns = all_columns['reactions'] queries = {} for key, value in kwargs.items(): key = map_column...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:extract_atoms; 3, parameters; 3, 4; 4, identifier:molecule; 5, block; 5, 6; 5, 8; 5, 15; 5, 26; 5, 30; 5, 109; 5, 158; 5, 235; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 9, comparison_operator:==; 9, 10; 9, 11; 10,...
def extract_atoms(molecule): """Return a string with all atoms in molecule""" if molecule == '': return molecule try: return float(molecule) except BaseException: pass atoms = '' if not molecule[0].isalpha(): i = 0 while not molecule[i].isalpha(): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:check_reaction; 3, parameters; 3, 4; 3, 5; 4, identifier:reactants; 5, identifier:products; 6, block; 6, 7; 6, 9; 6, 34; 6, 59; 6, 70; 6, 81; 6, 88; 6, 95; 6, 99; 6, 103; 6, 138; 6, 162; 7, expression_statement; 7, 8; 8, comment; 9, expression_...
def check_reaction(reactants, products): """Check the stoichiometry and format of chemical reaction used for folder structure. list of reactants -> list of products """ reactant_list = [reactant.split('@')[0].strip( 'star').strip('gas') for reactant in reactants] product_list = [product....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 32; 2, function_name:fowler_array; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:fowlerdata; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ti; 7, float:0.0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:ts; 10...
def fowler_array(fowlerdata, ti=0.0, ts=0.0, gain=1.0, ron=1.0, badpixels=None, dtype='float64', saturation=65631, blank=0, normalize=False): """Loop over the first axis applying Fowler processing. *fowlerdata* is assumed to be a 3D numpy.ndarray containing the result of a...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:reactions; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:columns; 5, identifier:n_results; 6, identifier:write_db; 7, identifier:queries; 8, block; 8, 9; 8, 11; 8, 99; 8, 111; 8, 130; 8, 134; 8, 138; 8, 142; 8, 164; 8, 177; 9, expression...
def reactions(columns, n_results, write_db, queries): """Search for reactions""" if not isinstance(queries, dict): query_dict = {} for q in queries: key, value = q.split('=') if key == 'distinct': if value in ['True', 'true']: query_dic...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:publications; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:columns; 5, identifier:n_results; 6, identifier:queries; 7, block; 7, 8; 7, 10; 7, 97; 7, 112; 7, 132; 7, 136; 7, 140; 7, 250; 7, 263; 8, expression_statement; 8, 9; 9, comment; 10, i...
def publications(columns, n_results, queries): """Search for publications""" if not isinstance(queries, dict): query_dict = {} for q in queries: key, value = q.split('=') if key == 'distinct': if value in ['True', 'true']: query_dict.up...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:make_folders; 3, parameters; 3, 4; 3, 5; 4, identifier:template; 5, identifier:custom_base; 6, block; 6, 7; 6, 9; 6, 26; 6, 36; 6, 56; 6, 64; 6, 70; 6, 131; 6, 253; 6, 337; 6, 348; 7, expression_statement; 7, 8; 8, comment; 9, function_definiti...
def make_folders(template, custom_base): """Create a basic folder tree for dumping DFT calculcations for reaction energies. Dear all Use this command make the right structure for your folders for submitting data for Catalysis Hub's Surface Reactions. Start by creating a template file by calling: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:opensignals_hierarchy; 3, parameters; 3, 4; 3, 7; 3, 10; 4, default_parameter; 4, 5; 4, 6; 5, identifier:root; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:update; 9, False; 10, default_parameter; 10, 11; 10, 12; 11, identifier:clo...
def opensignals_hierarchy(root=None, update=False, clone=False): """ Function that generates the OpenSignalsTools Notebooks File Hierarchy programatically. ---------- Parameters ---------- root : None or str The file path where the OpenSignalsTools Environment will be stored. updat...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_generate_notebook_by_tag_body; 3, parameters; 3, 4; 3, 5; 4, identifier:notebook_object; 5, identifier:dict_by_tag; 6, block; 6, 7; 6, 9; 6, 20; 6, 26; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; ...
def _generate_notebook_by_tag_body(notebook_object, dict_by_tag): """ Internal function that is used for generation of the page where notebooks are organized by tag values. ---------- Parameters ---------- notebook_object : notebook object Object of "notebook" class where the body w...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_preprocess_params; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, identifier:kwargs; 6, block; 6, 7; 6, 9; 6, 10; 6, 255; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, for_statement; 10, 11; 10, 14; 10, 19; 11, pattern_list; 11,...
def _preprocess_params(cls, kwargs): """Returns a preprocessed dictionary of parameters. Use this to filter the kwargs passed to `new`, `create`, `build` methods. Args: **kwargs: a dictionary of parameters """ # kwargs.pop('csrf_token', None) for att...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:add_all; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:cls; 5, identifier:models; 6, default_parameter; 6, 7; 6, 8; 7, identifier:commit; 8, True; 9, default_parameter; 9, 10; 9, 11; 10, identifier:check_type; 11, False; 12, block; 12, ...
def add_all(cls, models, commit=True, check_type=False): """Batch method for adding a list of model instances to the db in one get_or_404. Args: models (list): A list of the instances to add. commit (bool, optional): Defaults to True. If False, the trans...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:peakdelta; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:v; 5, identifier:delta; 6, default_parameter; 6, 7; 6, 8; 7, identifier:x; 8, None; 9, block; 9, 10; 9, 12; 9, 16; 9, 20; 9, 35; 9, 42; 9, 60; 9, 74; 9, 86; 9, 95; 9, 103; 9, 107; 9, 218...
def peakdelta(v, delta, x=None): """ Returns two arrays function [maxtab, mintab]=peakdelta(v, delta, x) %PEAKDET Detect peaks in a vector % [MAXTAB, MINTAB] = peakdelta(V, DELTA) finds the local % maxima and minima ("peaks") in the vector V. % MAXTAB and MINTAB consist...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:parse_datetime; 3, parameters; 3, 4; 4, identifier:value; 5, block; 5, 6; 5, 8; 5, 16; 5, 74; 5, 87; 5, 96; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 8, 13; 9, comparison_operator:is; 9, 10; 9, 11; 10, identifier:...
def parse_datetime(value): """ Convert datetime string to datetime object. Helper function to convert a datetime string found in json responses to a datetime object with timezone information. The server is storing all datetime strings as UTC (ZULU time). This function supports time zone offsets. When ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:add_property_grid_widget; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:part_instance; 6, default_parameter; 6, 7; 6, 8; 7, identifier:max_height; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identi...
def add_property_grid_widget(self, part_instance, max_height=None, custom_title=False, show_headers=True, show_columns=None): """ Add a KE-chain Property Grid widget to the customization. The widget will be saved to KE-chain. :param part_instance: The p...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_generate_data_for_format; 3, parameters; 3, 4; 4, identifier:fmt; 5, block; 5, 6; 5, 8; 5, 9; 5, 13; 5, 14; 5, 15; 5, 16; 5, 20; 5, 230; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10,...
def _generate_data_for_format(fmt): """Generate a fake data dictionary to fill in the provided format string.""" # finally try some data, create some random data for the fmt. data = {} # keep track of how many "free_size" (wildcard) parameters we have # if we get two in a row then we know the patter...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:relocate_model; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:part; 5, identifier:target_parent; 6, default_parameter; 6, 7; 6, 8; 7, identifier:name; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:include_children; 11, Tru...
def relocate_model(part, target_parent, name=None, include_children=True): """ Move the `Part` model to target parent. .. versionadded:: 2.3 :param part: `Part` object to be moved :type part: :class:`Part` :param target_parent: `Part` object under which the desired `Part` is moved :type ta...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:relocate_instance; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:part; 5, identifier:target_parent; 6, default_parameter; 6, 7; 6, 8; 7, identifier:name; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:include_children; 11, ...
def relocate_instance(part, target_parent, name=None, include_children=True): """ Move the `Part` instance to target parent. .. versionadded:: 2.3 :param part: `Part` object to be moved :type part: :class:`Part` :param target_parent: `Part` object under which the desired `Part` is moved :t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:move_part_instance; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:part_instance; 5, identifier:target_parent; 6, identifier:part_model; 7, default_parameter; 7, 8; 7, 9; 8, identifier:name; 9, None; 10, default_parameter; 10, 11;...
def move_part_instance(part_instance, target_parent, part_model, name=None, include_children=True): """ Move the `Part` instance to target parent and updates the properties based on the original part instance. .. versionadded:: 2.3 :param part_instance: `Part` object to be moved :type part_instanc...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:update_part_with_properties; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:part_instance; 5, identifier:moved_instance; 6, default_parameter; 6, 7; 6, 8; 7, identifier:name; 8, None; 9, block; 9, 10; 9, 12; 9, 13; 9, 14; 9, 20; 9, 187; 9, 188;...
def update_part_with_properties(part_instance, moved_instance, name=None): """ Update the newly created part and its properties based on the original one. :param part_instance: `Part` object to be copied :type part_instance: :class:`Part` :param moved_instance: `Part` object copied :type moved_...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:_checkup; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, identifier:peaks; 5, identifier:ecg_integrated; 6, identifier:sample_rate; 7, identifier:rr_buffer; 8, identifier:spk1; 9, identifier:npk1; 10, identifier:threshold; 11, bl...
def _checkup(peaks, ecg_integrated, sample_rate, rr_buffer, spk1, npk1, threshold): """ Check each peak according to thresholds ---------- Parameters ---------- peaks : list List of local maximums that pass the first stage of conditions needed to be considered as an R peak. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:create_napp; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, default_parameter; 5, 6; 5, 7; 6, identifier:meta_package; 7, False; 8, block; 8, 9; 8, 11; 8, 17; 8, 29; 8, 33; 8, 37; 8, 42; 8, 47; 8, 52; 8, 57; 8, 62; 8, 67; 8, 72; 8, 77; 8, 82;...
def create_napp(cls, meta_package=False): """Bootstrap a basic NApp structure for you to develop your NApp. This will create, on the current folder, a clean structure of a NAPP, filling some contents on this structure. """ templates_path = SKEL_PATH / 'napp-structure/username/na...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:match_app_version; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:app; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:label; 10, None; 11, default_parameter; 11, 12...
def match_app_version(self, app=None, label=None, version=None, default=False): """Match app version against a semantic version string. Checks if a KE-chain app matches a version comparison. Uses the `semver` matcher to check. `match("2.0.0", ">=1.0.0")` => `True` `match("1.0.0", ">1.0...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 1, 17; 2, function_name:activities; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:name; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:pk; 10, None; 11, default_parameter; 11, 12; ...
def activities(self, name=None, pk=None, scope=None, **kwargs): # type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Activity] """Search for activities with optional name, pk and scope filter. If additional `keyword=value` arguments are provided, these are added to the request p...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 45; 1, 46; 2, function_name:parts; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 9; 3, 12; 3, 13; 3, 16; 3, 17; 3, 22; 3, 23; 3, 26; 3, 27; 3, 30; 3, 31; 3, 34; 3, 35; 3, 38; 3, 39; 3, 42; 3, 43; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:name; 7, N...
def parts(self, name=None, # type: Optional[str] pk=None, # type: Optional[str] model=None, # type: Optional[Part] category=Category.INSTANCE, # type: Optional[str] bucket=None, # type: Optional[str] parent=None, # type: Optional[...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 2, function_name:create_property; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 15; 3, 18; 3, 21; 4, identifier:self; 5, identifier:model; 6, identifier:name; 7, default_parameter; 7, 8; 7, 9; 8, identifier:description; 9, None; 10, default_parameter; 10, 1...
def create_property(self, model, name, description=None, property_type=PropertyType.CHAR_VALUE, default_value=None, unit=None, options=None): """Create a new property model under a given model. Use the :class:`enums.PropertyType` to select which property type to create to ensure...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:set_sort; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:request; 6, block; 6, 7; 6, 9; 6, 10; 6, 26; 6, 59; 6, 60; 6, 80; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, expression_statement; 10, 11; 11, assignment; 11...
def set_sort(self, request): """ Take the sort parameter from the get parameters and split it into the field and the prefix """ # Look for 'sort' in get request. If not available use default. sort_request = request.GET.get(self.sort_parameter, self.default_sort) i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_next_sort_string; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:field; 6, block; 6, 7; 6, 9; 6, 10; 6, 46; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, if_statement; 10, 11; 10, 16; 10, 27; 11, comparison_operat...
def get_next_sort_string(self, field): """ If we're already sorted by the field then the sort query returned reverses the sort order. """ # self.sort_field is the currect sort field if field == self.sort_field: next_sort = self.toggle_sort_order() + field ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_sort_indicator; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:field; 6, block; 6, 7; 6, 9; 6, 13; 6, 35; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifie...
def get_sort_indicator(self, field): """ Returns a sort class for the active sort only. That is, if field is not sort_field, then nothing will be returned becaues the sort is not active. """ indicator = '' if field == self.sort_field: indicator = 'sort...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:get_basic_sort_link; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:request; 6, identifier:field; 7, block; 7, 8; 7, 10; 7, 18; 7, 27; 7, 66; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, a...
def get_basic_sort_link(self, request, field): """ Thanks to del_query_parameters and get_querystring, we build the link with preserving interesting get parameters and removing the others """ query_string = self.get_querystring() sort_string = self.get_next_sort_string(fi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 2, function_name:download_as_pdf; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 16; 3, 21; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:target_dir; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:pdf_filename; 10, None; 11, defaul...
def download_as_pdf(self, target_dir=None, pdf_filename=None, paper_size=PaperSize.A4, paper_orientation=PaperOrientation.PORTRAIT, include_appendices=False): """ Retrieve the PDF of the Activity. .. versionadded:: 2.1 :param target_dir: (optional) directory pat...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 30; 2, function_name:get_project; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 3, 25; 4, default_parameter; 4, 5; 4, 6; 5, identifier:url; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:username; 9, None; 10, default_parameter; 10, 11; 1...
def get_project(url=None, username=None, password=None, token=None, scope=None, scope_id=None, env_filename=None, status=ScopeStatus.ACTIVE): """ Retrieve and return the KE-chain project to be used throughout an app. This helper is made to bootstrap a pykechain enabled python script or an j...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:options; 3, parameters; 3, 4; 4, identifier:cls; 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:sorted; 11, generator_expression; 11, 12; 11, 15; 11, 26; 12, tup...
def options(cls): """Provide a sorted list of options.""" return sorted((value, name) for (name, value) in cls.__dict__.items() if not name.startswith('__'))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:edit; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:name; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:description; 10, None; 11, default_parameter; 11, 12; 11, ...
def edit(self, name=None, description=None, version=None, **kwargs): """ Edit Service details. .. versionadded:: 1.13 :param name: (optional) name of the service to change. :type name: basestring or None :param description: (optional) description of the service. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:children; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 10; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 13; 10, 14; 10, 50; 11, not_operat...
def children(self, **kwargs): """Retrieve the children of this `Part` as `Partset`. When you call the :func:`Part.children()` method without any additional filtering options for the children, the children are cached to help speed up subsequent calls to retrieve the children. The cached children...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:update; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:name; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:update_dict; 10, None; 11, default_parameter; 11, 12; 11...
def update(self, name=None, update_dict=None, bulk=True, **kwargs): """ Edit part name and property values in one go. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve per...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:add_with_properties; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:model; 6, default_parameter; 6, 7; 6, 8; 7, identifier:name; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:update_dict; 1...
def add_with_properties(self, model, name=None, update_dict=None, bulk=True, **kwargs): """ Add a part and update its properties in one go. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:move; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:target_parent; 6, default_parameter; 6, 7; 6, 8; 7, identifier:name; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:include_children; 11, True; ...
def move(self, target_parent, name=None, include_children=True, include_instances=True): """ Move the `Part` to target parent, both of them the same category. .. versionadded:: 2.3 :param target_parent: `Part` object under which the desired `Part` is moved :type target_parent: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 69; 2, function_name:plot; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 3, 33; 3, 36; 3, 39; 3, 42; 3, 45; 3, 48; 3, 51; 3, 54; 3, 57; 3, 60; 3, 63; 3, 66; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:wor...
def plot(self, workflow=None, view=True, depth=-1, name=NONE, comment=NONE, format=NONE, engine=NONE, encoding=NONE, graph_attr=NONE, node_attr=NONE, edge_attr=NONE, body=NONE, node_styles=NONE, node_data=NONE, node_function=NONE, edge_data=NONE, max_lines=NONE, max_w...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:lookup_url; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:url; 6, identifier:klass; 7, default_parameter; 7, 8; 7, 9; 8, identifier:module; 9, None; 10, block; 10, 11; 10, 13; 10, 23; 10, 30; 11, expression_statement...
def lookup_url(self, url, klass, module=None): ''' Gets a proxy reference to the actor indicated by the URL in the parameters. It can be a local reference or a remote direction to another host. This method can be called remotely synchronously. :param srt. url: address t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:prepare_rapid_streamflow; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:path_to_rapid_qout; 6, identifier:connection_list_file; 7, block; 7, 8; 7, 10; 7, 23; 8, expression_statement; 8, 9; 9, comment; 10, expression_stateme...
def prepare_rapid_streamflow(self, path_to_rapid_qout, connection_list_file): """ Prepares RAPID streamflow for GSSHA simulation """ ihg_filename = '{0}.ihg'.format(self.project_manager.name) with tmp_chdir(self.project_manager.project_directory): # write out IHG file...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:stencil; 3, parameters; 3, 4; 4, dictionary_splat_pattern; 4, 5; 5, identifier:kwargs; 6, block; 6, 7; 6, 9; 6, 18; 6, 27; 6, 36; 6, 75; 6, 76; 6, 90; 6, 91; 6, 111; 6, 134; 6, 149; 6, 160; 6, 348; 6, 358; 6, 377; 6, 386; 6, 404; 7, expression_...
def stencil(**kwargs): """ Applying genotype calls to multi-way alignment incidence matrix :param alnfile: alignment incidence file (h5), :param gtypefile: genotype calls by GBRS (tsv), :param grpfile: gene ID to isoform ID mapping info (tsv) :return: genotyped version of alignment incidence fi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:split_tracks; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:lat; 5, identifier:lon; 6, list_splat_pattern; 6, 7; 7, identifier:args; 8, block; 8, 9; 8, 11; 8, 15; 8, 29; 8, 40; 8, 316; 8, 353; 9, expression_statement; 9, 10; 10, string:'''assu...
def split_tracks(lat,lon,*args): '''assumes eastward motion''' tracks = [] lt,ln = [lat[0]],[lon[0]] zz = [[z[0]] for z in args] for i in range(1,len(lon)): lt.append(lat[i]) for z,a in zip(zz,args): z.append(a[i]) d1 = abs(lon[...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:find_loaders; 3, parameters; 3, 4; 3, 5; 4, identifier:scheme; 5, default_parameter; 5, 6; 5, 7; 6, identifier:protocols; 7, None; 8, block; 8, 9; 8, 11; 8, 12; 8, 17; 8, 33; 8, 41; 8, 42; 8, 52; 8, 104; 8, 105; 8, 132; 8, 142; 8, 162; 9, expre...
def find_loaders(scheme, protocols=None): """ Find all loaders that match the requested scheme and protocols. :param scheme: Any valid scheme. Examples would be something like ``ini`` or ``ini+pastedeploy``. :param protocols: Zero or more :term:`loader protocol` identifiers that the lo...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:combine_dicts; 3, parameters; 3, 4; 3, 6; 3, 9; 4, list_splat_pattern; 4, 5; 5, identifier:dicts; 6, default_parameter; 6, 7; 6, 8; 7, identifier:copy; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:base; 11, None; 12, block; 12,...
def combine_dicts(*dicts, copy=False, base=None): """ Combines multiple dicts in one. :param dicts: A sequence of dicts. :type dicts: dict :param copy: If True, it returns a deepcopy of input values. :type copy: bool, optional :param base: Base dict where combine m...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:kk_dict; 3, parameters; 3, 4; 3, 6; 4, list_splat_pattern; 4, 5; 5, identifier:kk; 6, dictionary_splat_pattern; 6, 7; 7, identifier:adict; 8, block; 8, 9; 8, 11; 8, 64; 9, expression_statement; 9, 10; 10, comment; 11, for_statement; 11, 12; 11,...
def kk_dict(*kk, **adict): """ Merges and defines dictionaries with values identical to keys. :param kk: A sequence of keys and/or dictionaries. :type kk: object | dict, optional :param adict: A dictionary. :type adict: dict, optional :return: Merged dictionary. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:map_dict; 3, parameters; 3, 4; 3, 5; 3, 7; 3, 10; 4, identifier:key_map; 5, list_splat_pattern; 5, 6; 6, identifier:dicts; 7, default_parameter; 7, 8; 7, 9; 8, identifier:copy; 9, False; 10, default_parameter; 10, 11; 10, 12; 11, identifier:ba...
def map_dict(key_map, *dicts, copy=False, base=None): """ Returns a dict with new key values. :param key_map: A dictionary that maps the dict keys ({old key: new key} :type key_map: dict :param dicts: A sequence of dicts. :type dicts: dict :param copy: If True, it ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:map_list; 3, parameters; 3, 4; 3, 5; 3, 7; 3, 10; 4, identifier:key_map; 5, list_splat_pattern; 5, 6; 6, identifier:inputs; 7, default_parameter; 7, 8; 7, 9; 8, identifier:copy; 9, False; 10, default_parameter; 10, 11; 10, 12; 11, identifier:b...
def map_list(key_map, *inputs, copy=False, base=None): """ Returns a new dict. :param key_map: A list that maps the dict keys ({old key: new key} :type key_map: list[str | dict | list] :param inputs: A sequence of data. :type inputs: iterable | dict | int | float | list | tuple...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:selector; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:keys; 5, identifier:dictionary; 6, default_parameter; 6, 7; 6, 8; 7, identifier:copy; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:output_type; 11, string:'d...
def selector(keys, dictionary, copy=False, output_type='dict', allow_miss=False): """ Selects the chosen dictionary keys from the given dictionary. :param keys: Keys to select. :type keys: list, tuple, set :param dictionary: A dictionary. :type dictionary: dict ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:difference; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:others; 7, block; 7, 8; 7, 10; 7, 18; 7, 24; 7, 30; 7, 92; 7, 98; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11;...
def difference(self, *others): r"""Return a new multiset with all elements from the others removed. >>> ms = Multiset('aab') >>> sorted(ms.difference('bc')) ['a', 'a'] You can also use the ``-`` operator for the same effect. However, the operator version will only accep...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:union; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:others; 7, block; 7, 8; 7, 10; 7, 18; 7, 24; 7, 30; 7, 77; 7, 83; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, ...
def union(self, *others): r"""Return a new multiset with all elements from the multiset and the others with maximal multiplicities. >>> ms = Multiset('aab') >>> sorted(ms.union('bc')) ['a', 'a', 'b', 'c'] You can also use the ``|`` operator for the same effect. However, the ope...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:intersection; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:others; 7, block; 7, 8; 7, 10; 7, 18; 7, 24; 7, 30; 7, 95; 7, 101; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, ...
def intersection(self, *others): r"""Return a new multiset with elements common to the multiset and all others. >>> ms = Multiset('aab') >>> sorted(ms.intersection('abc')) ['a', 'b'] You can also use the ``&`` operator for the same effect. However, the operator version ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:symmetric_difference; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:other; 6, block; 6, 7; 6, 9; 6, 18; 6, 26; 6, 30; 6, 36; 6, 42; 6, 48; 6, 68; 6, 121; 6, 127; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement;...
def symmetric_difference(self, other): r"""Return a new set with elements in either the set or other but not both. >>> ms = Multiset('aab') >>> sorted(ms.symmetric_difference('abc')) ['a', 'c'] You can also use the ``^`` operator for the same effect. However, the operator versi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:times; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:factor; 6, block; 6, 7; 6, 9; 6, 20; 6, 30; 6, 38; 6, 44; 6, 54; 6, 60; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 13; 10, comparison_operator:==; 10...
def times(self, factor): """Return a new set with each element's multiplicity multiplied with the given scalar factor. >>> ms = Multiset('aab') >>> sorted(ms.times(2)) ['a', 'a', 'a', 'a', 'b', 'b'] You can also use the ``*`` operator for the same effect: >>> sorted(ms...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:union_update; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:others; 7, block; 7, 8; 7, 10; 7, 16; 7, 22; 7, 69; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, assignm...
def union_update(self, *others): r"""Update the multiset, adding elements from all others using the maximum multiplicity. >>> ms = Multiset('aab') >>> ms.union_update('bc') >>> sorted(ms) ['a', 'a', 'b', 'c'] You can also use the ``|=`` operator for the same effect. How...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:intersection_update; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:others; 7, block; 7, 8; 7, 10; 8, expression_statement; 8, 9; 9, comment; 10, for_statement; 10, 11; 10, 12; 10, 19; 11, identifier:o...
def intersection_update(self, *others): r"""Update the multiset, keeping only elements found in it and all others. >>> ms = Multiset('aab') >>> ms.intersection_update('bc') >>> sorted(ms) ['b'] You can also use the ``&=`` operator for the same effect. However, the opera...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:difference_update; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:others; 7, block; 7, 8; 7, 10; 8, expression_statement; 8, 9; 9, comment; 10, for_statement; 10, 11; 10, 12; 10, 19; 11, identifier:oth...
def difference_update(self, *others): r"""Remove all elements contained the others from this multiset. >>> ms = Multiset('aab') >>> ms.difference_update('abc') >>> sorted(ms) ['a'] You can also use the ``-=`` operator for the same effect. However, the operator version ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:symmetric_difference_update; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:other; 6, block; 6, 7; 6, 9; 6, 18; 6, 38; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, ...
def symmetric_difference_update(self, other): r"""Update the multiset to contain only elements in either this multiset or the other but not both. >>> ms = Multiset('aab') >>> ms.symmetric_difference_update('abc') >>> sorted(ms) ['a', 'c'] You can also use the ``^=`` ope...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:times_update; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:factor; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 13; 9, 19; 9, 30; 10, comparison_operator:<; 10, 11; 10, 12; 11, iden...
def times_update(self, factor): """Update each this multiset by multiplying each element's multiplicity with the given scalar factor. >>> ms = Multiset('aab') >>> ms.times_update(2) >>> sorted(ms) ['a', 'a', 'a', 'a', 'b', 'b'] You can also use the ``*=`` operator for t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:add; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:element; 6, default_parameter; 6, 7; 6, 8; 7, identifier:multiplicity; 8, integer:1; 9, block; 9, 10; 9, 12; 9, 22; 9, 30; 10, expression_statement; 10, 11; 11, comment; 12...
def add(self, element, multiplicity=1): """Adds an element to the multiset. >>> ms = Multiset() >>> ms.add('a') >>> sorted(ms) ['a'] An optional multiplicity can be specified to define how many of the element are added: >>> ms.add('b', 2) >>> sorted(ms)...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:remove; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:element; 6, default_parameter; 6, 7; 6, 8; 7, identifier:multiplicity; 8, None; 9, block; 9, 10; 9, 12; 9, 18; 9, 25; 9, 35; 9, 81; 10, expression_statement; 10, 11; 11,...
def remove(self, element, multiplicity=None): """Removes an element from the multiset. If no multiplicity is specified, the element is completely removed from the multiset: >>> ms = Multiset('aabbbc') >>> ms.remove('a') 2 >>> sorted(ms) ['b', 'b', 'b', 'c'] ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:discard; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:element; 6, default_parameter; 6, 7; 6, 8; 7, identifier:multiplicity; 8, None; 9, block; 9, 10; 9, 12; 9, 18; 10, expression_statement; 10, 11; 11, comment; 12, expres...
def discard(self, element, multiplicity=None): """Removes the `element` from the multiset. If multiplicity is ``None``, all occurrences of the element are removed: >>> ms = Multiset('aab') >>> ms.discard('a') 2 >>> sorted(ms) ['b'] Otherwise, the multip...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:async_thread; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 10; 4, identifier:sol; 5, identifier:args; 6, identifier:node_attr; 7, identifier:node_id; 8, list_splat_pattern; 8, 9; 9, identifier:a; 10, dictionary_splat_pattern; 10, 11; 11, id...
def async_thread(sol, args, node_attr, node_id, *a, **kw): """ Execute `sol._evaluate_node` in an asynchronous thread. :param sol: Solution to be updated. :type sol: schedula.utils.sol.Solution :param args: Arguments to be passed to node calls. :type args: tuple :param nod...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:pivot; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:table; 5, identifier:left; 6, identifier:top; 7, identifier:value; 8, block; 8, 9; 8, 11; 8, 15; 8, 19; 8, 23; 8, 119; 8, 121; 8, 161; 8, 168; 8, 175; 8, 179; 8, 181; 8, 238; 9, expres...
def pivot(table, left, top, value): """ Creates a cross-tab or pivot table from a normalised input table. Use this function to 'denormalize' a table of normalized records. * The table argument can be a list of dictionaries or a Table object. (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:download_hrrr_for_gssha; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 13; 3, 16; 3, 19; 4, identifier:main_directory; 5, identifier:forecast_start_date_string; 6, comment; 7, identifier:forecast_start_hour_string; 8, comment; 9, defau...
def download_hrrr_for_gssha(main_directory, forecast_start_date_string, #EX. '20160913' forecast_start_hour_string, #EX. '00' to '23' leftlon=-180, rightlon=180, toplat=90,bottomlat=-90): """ Function...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_convert_data_to_hourly; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:gssha_data_var; 6, block; 6, 7; 6, 9; 6, 32; 6, 41; 6, 45; 6, 396; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; ...
def _convert_data_to_hourly(self, gssha_data_var): """ This function converts the data to hourly data and then puts it into the data_np_array USED WHEN GENERATING HMET DATA ONLY """ time_step_hours = np.diff(self.data.time)[0]/np.timedelta64(1, 'h') calc_function ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:get_sub_dsp; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:nodes_bunch; 6, default_parameter; 6, 7; 6, 8; 7, identifier:edges_bunch; 8, None; 9, block; 9, 10; 9, 12; 9, 13; 9, 30; 9, 31; 9, 53; 9, 54; 9, 68; 9, 82; 9, 90; 9...
def get_sub_dsp(self, nodes_bunch, edges_bunch=None): """ Returns the sub-dispatcher induced by given node and edge bunches. The induced sub-dispatcher contains the available nodes in nodes_bunch and edges between those nodes, excluding those that are in edges_bunch. The availa...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:blue; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:memo; 7, None; 8, block; 8, 9; 8, 11; 8, 20; 8, 29; 8, 37; 8, 47; 8, 77; 8, 83; 8, 92; 8, 108; 8, 146; 8, 303; 9, expression_statement; 9, 10; ...
def blue(self, memo=None): """ Constructs a BlueDispatcher out of the current object. :param memo: A dictionary to cache Blueprints. :type memo: dict[T,schedula.utils.blue.Blueprint] :return: A BlueDispatcher of the current object. :rtype: schedu...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:findOutlet; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:shapefile_path; 6, block; 6, 7; 6, 9; 6, 10; 6, 11; 6, 12; 6, 17; 6, 26; 6, 35; 6, 43; 6, 51; 6, 58; 6, 68; 6, 77; 6, 85; 6, 92; 6, 103; 6, 104; 6, 112; 6, 123; 6, 131; 6,...
def findOutlet(self, shapefile_path): """ Calculate outlet location """ # determine outlet from shapefile # by getting outlet from first point in polygon # make sure the boundary geometry is valid check_watershed_boundary_geometry(shapefile_path) shapefi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_write; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:session; 6, identifier:openFile; 7, identifier:replaceParamFile; 8, block; 8, 9; 8, 11; 8, 12; 8, 18; 8, 19; 9, expression_statement; 9, 10; 10, comment; 11, comme...
def _write(self, session, openFile, replaceParamFile): """ Precipitation File Write to File Method """ # Retrieve the events associated with this PrecipFile events = self.precipEvents # Write each event to file for event in events: openFile.write('EVE...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:valueWritePreprocessor; 3, parameters; 3, 4; 3, 5; 4, identifier:valueString; 5, default_parameter; 5, 6; 5, 7; 6, identifier:replaceParamsFile; 7, None; 8, block; 8, 9; 8, 11; 8, 28; 8, 29; 8, 33; 8, 34; 8, 96; 9, expression_statement; 9, 10; ...
def valueWritePreprocessor(valueString, replaceParamsFile=None): """ Look up variable name in replace param file for the negative id given and return it. Args: valueString (str): String representing the value to be preprocessed. replaceParamsFile (gsshapy.orm.ReplaceParamFile, optional): In...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:_createGsshaPyObjects; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, identifier:self; 5, identifier:mapTables; 6, identifier:indexMaps; 7, identifier:replaceParamFile; 8, identifier:directory; 9, identifier:session; 10, i...
def _createGsshaPyObjects(self, mapTables, indexMaps, replaceParamFile, directory, session, spatial, spatialReferenceID): """ Create GSSHAPY Mapping Table ORM Objects Method """ for mt in mapTables: # Create GSSHAPY MapTable object try: # Make sure...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_valuePivot; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:session; 6, identifier:mapTable; 7, identifier:contaminant; 8, identifier:replaceParaFile; 9, block; 9, 10; 9, 12; 9, 13; 9, 63; 9, 64; 9, 69; 9, 85; 9,...
def _valuePivot(self, session, mapTable, contaminant, replaceParaFile): """ This function retrieves the values of a mapping table from the database and pivots them into the format that is required by the mapping table file. This function returns a list of strings that can be printed to the file ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:addRoughnessMapFromLandUse; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 4, identifier:self; 5, identifier:name; 6, identifier:session; 7, identifier:land_use_grid; 8, default_parameter; 8, 9; 8, 10; 9, identifier:land_use_to_roughness_...
def addRoughnessMapFromLandUse(self, name, session, land_use_grid, land_use_to_roughness_table=None, land_use_grid_id=None, ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:result; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:timeout; 7, None; 8, block; 8, 9; 8, 11; 8, 21; 8, 31; 8, 104; 8, 186; 8, 198; 8, 264; 8, 274; 9, expression_statement; 9, 10; 10, comment; 1...
def result(self, timeout=None): """ Set all asynchronous results. :param timeout: The number of seconds to wait for the result if the futures aren't done. If None, then there is no limit on the wait time. :type timeout: float :return: Update ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:_set_data_node_output; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 4, identifier:self; 5, identifier:node_id; 6, identifier:node_attr; 7, identifier:no_call; 8, default_parameter; 8, 9; 8, 10; 9, identifier:next_nds; 10, None; 11, dict...
def _set_data_node_output(self, node_id, node_attr, no_call, next_nds=None, **kw): """ Set the data node output from node estimations. :param node_id: Data node id. :type node_id: str :param node_attr: Dictionary of node att...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:_set_function_node_output; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 4, identifier:self; 5, identifier:node_id; 6, identifier:node_attr; 7, identifier:no_call; 8, default_parameter; 8, 9; 8, 10; 9, identifier:next_nds; 10, None; 11, ...
def _set_function_node_output(self, node_id, node_attr, no_call, next_nds=None, **kw): """ Set the function node output from node inputs. :param node_id: Function node id. :type node_id: str :param node_attr: Dictionary ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:_add_initial_value; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 4, identifier:self; 5, identifier:data_id; 6, identifier:value; 7, default_parameter; 7, 8; 7, 9; 8, identifier:initial_dist; 9, float:0.0; 10, default_parameter; ...
def _add_initial_value(self, data_id, value, initial_dist=0.0, fringe=None, check_cutoff=None, no_call=None): """ Add initial values updating workflow, seen, and fringe. :param fringe: Heapq of closest available nodes. :type fringe: list[(float | i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:_see_node; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:node_id; 6, identifier:fringe; 7, identifier:dist; 8, default_parameter; 8, 9; 8, 10; 9, identifier:w_wait_in; 10, integer:0; 11, block; 11, 12; 11, 14; ...
def _see_node(self, node_id, fringe, dist, w_wait_in=0): """ See a node, updating seen and fringe. :param node_id: Node id to see. :type node_id: str :param fringe: Heapq of closest available nodes. :type fringe: list[(float | int, bool, (str, Di...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:tick; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:events; 6, block; 6, 7; 6, 9; 6, 15; 6, 73; 6, 276; 6, 280; 6, 405; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, call; 10, 11; 10, 14; 11, attr...
def tick(self, events): """Execute one frame of the interpreter. Don't call more than 40 times per second. """ self.add_new_threads() if self.drag_sprite: (mx, my) = self.screen.get_mouse_pos() (ox, oy) = self.drag_offset new_position = (mx ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:evaluate; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:s; 6, identifier:value; 7, default_parameter; 7, 8; 7, 9; 8, identifier:insert; 9, None; 10, block; 10, 11; 10, 13; 10, 22; 10, 31; 10, 210; 10, 416; 11, expres...
def evaluate(self, s, value, insert=None): """Expression evaluator. * For expressions, returns the value of the expression. * For Blocks, returns a generator (or the empty list []). """ assert not isinstance(value, kurt.Script) if insert and insert.unevaluated: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_write; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:session; 6, identifier:openFile; 7, identifier:maskMap; 8, block; 8, 9; 8, 11; 8, 12; 8, 16; 8, 17; 8, 24; 8, 84; 8, 98; 8, 112; 8, 126; 8, 140; 8, 141; 8, 145; 8,...
def _write(self, session, openFile, maskMap): """ WMS Dataset File Write to File Method """ # Magic numbers FIRST_VALUE_INDEX = 12 # Write the header openFile.write('DATASET\r\n') if self.type == self.SCALAR_TYPE: openFile.write('OBJTYPE {0}\...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:get_batch; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:sentences; 5, identifier:token_dict; 6, default_parameter; 6, 7; 6, 8; 7, identifier:ignore_case; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:unk_index; 11...
def get_batch(sentences, token_dict, ignore_case=False, unk_index=1, eos_index=2): """Get a batch of inputs and outputs from given sentences. :param sentences: A list of list of tokens. :param token_dict: The dict that maps...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:get_gene_info; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:ensembl_ids; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:hgnc_symbols; 9, None; 10, block; 10, 11; 10, 13; 10, 26; 10, 39; 10, 43; 10, 47; 1...
def get_gene_info(ensembl_ids=None, hgnc_symbols=None): """Return the genes info based on the transcripts found Args: ensembl_ids (Optional[list]): list of Ensembl gene ids hgnc_symbols (Optional[list]): list of HGNC gene symbols Returns: iterable: an iterable with `Gene` objects ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:parse_mapping; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:map_path; 6, default_parameter; 6, 7; 6, 8; 7, identifier:source; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:dotfiles; 11, None; 12, block...
def parse_mapping(self, map_path, source=None, dotfiles=None): """Do a simple parse of the dotfile mapping, using semicolons to separate source file name from the target file paths.""" include_re = r"""^\s*#include\s+(".+"|'.+')""" include_re = re.compile(include_re, re.I) mappin...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_add_compounds; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:variant_obj; 6, identifier:info_dict; 7, block; 7, 8; 7, 10; 7, 14; 7, 23; 7, 108; 7, 109; 7, 126; 8, expression_statement; 8, 9; 9, comment; 10, expression_stat...
def _add_compounds(self, variant_obj, info_dict): """Check if there are any compounds and add them to the variant The compounds that are added should be sorted on rank score """ compound_list = [] compound_entry = info_dict.get('Compounds') if compound_entry:...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:dump_xml; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:props; 5, identifier:fp; 6, default_parameter; 6, 7; 6, 8; 7, identifier:comment; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:encoding; 11, string:'UTF-8'; 1...
def dump_xml(props, fp, comment=None, encoding='UTF-8', sort_keys=False): """ Write a series ``props`` of key-value pairs to a binary filehandle ``fp`` in the format of an XML properties file. The file will include both an XML declaration and a doctype declaration. :param props: A mapping or itera...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:dumps_xml; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:props; 5, default_parameter; 5, 6; 5, 7; 6, identifier:comment; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:sort_keys; 10, False; 11, block; 11, 12; 11, 14; 12, expression...
def dumps_xml(props, comment=None, sort_keys=False): """ Convert a series ``props`` of key-value pairs to a text string containing an XML properties document. The document will include a doctype declaration but not an XML declaration. :param props: A mapping or iterable of ``(key, value)`` pairs t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:gene_list; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:list_id; 6, None; 7, block; 7, 8; 7, 10; 7, 26; 7, 78; 7, 132; 7, 280; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, assignment; ...
def gene_list(list_id=None): """Display or add a gene list.""" all_case_ids = [case.case_id for case in app.db.cases()] if list_id: genelist_obj = app.db.gene_list(list_id) case_ids = [case.case_id for case in app.db.cases() if case not in genelist_obj.cases] if g...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_functarguments; 3, parameters; 3, 4; 4, identifier:func; 5, block; 5, 6; 5, 8; 5, 17; 5, 77; 5, 93; 5, 99; 5, 103; 5, 110; 5, 155; 5, 290; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11...
def get_functarguments(func): """ Recupera gli argomenti dalla funzione stessa. """ argspec = inspect.getargspec(func) if argspec.defaults is not None: args = argspec.args[:-len(argspec.defaults)] kwargs = dict( zip(argspec.args[-len(argspec.defaults):], argspec.defaults)...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:load; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:ctx; 5, identifier:variant_source; 6, identifier:family_file; 7, identifier:family_type; 8, identifier:root; 9, block; 9, 10; 9, 12; 9, 34; 9, 57; 9, 69; 9, 81; 9, 93; 9, 117; 9, ...
def load(ctx, variant_source, family_file, family_type, root): """ Load a variant source into the database. If no database was found run puzzle init first. 1. VCF: If a vcf file is used it can be loaded with a ped file 2. GEMINI: Ped information will be retreived from the gemini db """ roo...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:toposort; 3, parameters; 3, 4; 3, 5; 4, identifier:graph; 5, default_parameter; 5, 6; 5, 7; 6, identifier:pick_first; 7, string:'head'; 8, block; 8, 9; 8, 11; 8, 15; 8, 56; 8, 61; 8, 65; 8, 71; 8, 157; 8, 158; 8, 176; 9, expression_statement; 9...
def toposort(graph, pick_first='head'): """Toplogically sorts a list match graph. Tries to perform a topological sort using as tiebreaker the pick_first argument. If the graph contains cycles, raise ValueError. """ in_deg = {} for node, next_nodes in six.iteritems(graph): for next_node ...