sequence
stringlengths
546
16.2k
code
stringlengths
108
19.3k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:qteReplaceAppletInLayout; 3, parameters; 3, 4; 3, 5; 3, 11; 3, 18; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:newApplet; 7, type; 7, 8; 8, tuple; 8, 9; 8, 10; 9, identifier:QtmacsApplet; 10, identifier:str; 11, typed_def...
def qteReplaceAppletInLayout(self, newApplet: (QtmacsApplet, str), oldApplet: (QtmacsApplet, str)=None, windowObj: QtmacsWindow=None): """ Replace ``oldApplet`` with ``newApplet`` in the window layout. If ``oldApplet`` is **None*...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:qteRemoveAppletFromLayout; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:applet; 7, type; 7, 8; 8, tuple; 8, 9; 8, 10; 9, identifier:QtmacsApplet; 10, identifier:str; 11, block; 11, 12; 11, 14; 11...
def qteRemoveAppletFromLayout(self, applet: (QtmacsApplet, str)): """ Remove ``applet`` from the window layout. This method removes ``applet`` and implicitly deletes obsolete (ie. half-full) splitters in the process. If ``applet`` is the only visible applet in the layout then it...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:qteKillApplet; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:appletID; 7, type; 7, 8; 8, identifier:str; 9, block; 9, 10; 9, 12; 9, 13; 9, 27; 9, 55; 9, 56; 9, 71; 9, 72; 9, 78; 9, 79; 9, 87; 9, 88...
def qteKillApplet(self, appletID: str): """ Destroy the applet with ID ``appletID``. This method removes ``appletID`` from Qtmacs permanently - no questions asked. It is the responsibility of the (macro) programmer to use it responsibly. If the applet was visible then t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:qteRunHook; 3, parameters; 3, 4; 3, 5; 3, 9; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:hookName; 7, type; 7, 8; 8, identifier:str; 9, typed_default_parameter; 9, 10; 9, 11; 9, 13; 10, identifier:msgObj; 11, type; 11, 12...
def qteRunHook(self, hookName: str, msgObj: QtmacsMessage=None): """ Trigger the hook named ``hookName`` and pass on ``msgObj``. This will call all slots associated with ``hookName`` but without calling the event loop in between. Therefore, if one slots changes the state of the ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:qteMacroNameMangling; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:macroCls; 6, block; 6, 7; 6, 9; 6, 10; 6, 23; 6, 24; 6, 25; 6, 26; 6, 41; 6, 42; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, expression_statement;...
def qteMacroNameMangling(self, macroCls): """ Convert the class name of a macro class to macro name. The name mangling inserts a '-' character after every capital letter and then lowers the entire string. Example: if the class name of ``macroCls`` is 'ThisIsAMacro' then...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:qteRegisterMacro; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 11; 4, identifier:self; 5, identifier:macroCls; 6, typed_default_parameter; 6, 7; 6, 8; 6, 10; 7, identifier:replaceMacro; 8, type; 8, 9; 9, identifier:bool; 10, False; 11, typed_default_pa...
def qteRegisterMacro(self, macroCls, replaceMacro: bool=False, macroName: str=None): """ Register a macro. If ``macroName`` is **None** then its named is deduced from its class name (see ``qteMacroNameMangling`` for details). Multiple macros with the sa...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:qteGetMacroObject; 3, parameters; 3, 4; 3, 5; 3, 9; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:macroName; 7, type; 7, 8; 8, identifier:str; 9, typed_parameter; 9, 10; 9, 11; 10, identifier:widgetObj; 11, type; 11, 12; 12...
def qteGetMacroObject(self, macroName: str, widgetObj: QtGui.QWidget): """ Return macro that is name- and signature compatible with ``macroName`` and ``widgetObj``. The method considers all macros with name ``macroName`` and returns the one that matches 'best'. To determine this...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:qteGetAllMacroNames; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, typed_default_parameter; 5, 6; 5, 7; 5, 11; 6, identifier:widgetObj; 7, type; 7, 8; 8, attribute; 8, 9; 8, 10; 9, identifier:QtGui; 10, identifier:QWidget; 11, None; 12, bl...
def qteGetAllMacroNames(self, widgetObj: QtGui.QWidget=None): """ Return all macro names known to Qtmacs as a list. If ``widgetObj`` is **None** then the names of all registered macros are returned as a tuple. Otherwise, only those macro compatible with ``widgetObj`` are returne...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:qteBindKeyGlobal; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:keysequence; 6, typed_parameter; 6, 7; 6, 8; 7, identifier:macroName; 8, type; 8, 9; 9, identifier:str; 10, block; 10, 11; 10, 13; 10, 14; 10, 15; 10, 22; 10,...
def qteBindKeyGlobal(self, keysequence, macroName: str): """ Associate ``macroName`` with ``keysequence`` in all current applets. This method will bind ``macroName`` to ``keysequence`` in the global key map and **all** local key maps. This also applies for all applets (a...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:qteRegisterApplet; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:cls; 6, typed_default_parameter; 6, 7; 6, 8; 6, 10; 7, identifier:replaceApplet; 8, type; 8, 9; 9, identifier:bool; 10, False; 11, block; 11, 12; 11, 14; 11,...
def qteRegisterApplet(self, cls, replaceApplet: bool=False): """ Register ``cls`` as an applet. The name of the applet is the class name of ``cls`` itself. For instance, if the applet was defined and registered as class NewApplet17(QtmacsApplet): ......
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:start; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 10; 7, 14; 7, 18; 7, 25; 7, 121; 7, 127; 7, 132; 7, 138; 7, 198; 7, 262; 8, expression_statement; 8, 9; 9, comment...
def start(self, **kwargs): """ Start the commands of this organizer Parameters ---------- ``**kwargs`` Any keyword from the :attr:`commands` or :attr:`parser_commands` attribute Returns ------- argparse.Namespace The n...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:app_main; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:experiment; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:last; 10, False; 11, defaul...
def app_main(self, experiment=None, last=False, new=False, verbose=False, verbosity_level=None, no_modification=False, match=False): """ The main function for parsing global arguments Parameters ---------- experiment: str The id of t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 28; 2, function_name:configure; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:global_config; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:project_config;...
def configure(self, global_config=False, project_config=False, ifile=None, forcing=None, serial=False, nprocs=None, update_from=None, **kwargs): """ Configure the project and experiments Parameters ---------- global_config: bool If...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:generate_basic_type_docs; 3, parameters; 3, 4; 3, 5; 4, identifier:fields; 5, identifier:existing_types; 6, block; 6, 7; 6, 9; 6, 10; 6, 11; 6, 12; 6, 138; 6, 142; 6, 143; 6, 144; 6, 345; 6, 367; 6, 374; 7, expression_statement; 7, 8; 8, commen...
def generate_basic_type_docs(fields, existing_types): """Map resource types to their RAML equivalents. Expects fields to be a list of modules - each module would be something like pale.fields. Expects existing_types to be a list of dict of existing types, which will take precedence and prevent a new typ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:generate_doc_dict; 3, parameters; 3, 4; 3, 5; 4, identifier:module; 5, identifier:user; 6, block; 6, 7; 6, 9; 6, 18; 6, 30; 6, 37; 6, 53; 6, 57; 6, 105; 6, 112; 6, 128; 7, expression_statement; 7, 8; 8, comment; 9, import_from_statement; 9, 10;...
def generate_doc_dict(module, user): """Compile a Pale module's documentation into a python dictionary. The returned dictionary is suitable to be rendered by a JSON formatter, or passed to a template engine, or manipulated in some other way. """ from pale import extract_endpoints, extract_resources...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_driver; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:desired_capabilities; 7, None; 8, block; 8, 9; 8, 11; 8, 17; 8, 28; 8, 35; 8, 43; 8, 47; 8, 344; 8, 345; 8, 346; 8, 347; 8, 348; 8, 388; ...
def get_driver(self, desired_capabilities=None): """ Creates a Selenium driver on the basis of the configuration file upon which this object was created. :param desired_capabilities: Capabilities that the caller desires to override. This have priority over those ...
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; 4, identifier:self; 5, identifier:typedef; 6, identifier:value; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 10, expression_statement; 10, 11; 11, comment; 12, try...
def load(self, typedef, value, **kwargs): """ Return the result of the bound load method for a typedef Looks up the load function that was bound to the engine for a typedef, and return the result of passing the given `value` and any `context` to that function. Parameter...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:qteSetLexer; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:lexer; 6, block; 6, 7; 6, 9; 6, 33; 6, 34; 6, 40; 6, 63; 6, 64; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 24; 10, boolean_operator:and; 10, 11...
def qteSetLexer(self, lexer): """ Specify the lexer to use. The only difference between this method and the native ``setLexer`` method is that expects ``lexer`` to be class, not an instance. Another feature is that this method knows which ``lexer`` class was installed la...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:get_function_args; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:func; 5, default_parameter; 5, 6; 5, 7; 6, identifier:no_self; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:no_varargs; 10, False; 11, block; 11, 12; 11, 14; 11, 2...
def get_function_args(func, no_self=False, no_varargs=False): """ Return tuple of the function argument names in the order of the function signature. :param func: Function :type func: function object :param no_self: Flag that indicates whether the function argument *self*, if ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_close_callable; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:node; 6, default_parameter; 6, 7; 6, 8; 7, identifier:force; 8, False; 9, block; 9, 10; 9, 12; 9, 13; 9, 14; 9, 15; 9, 27; 9, 35; 9, 36; 9, 37; 9, 38; 9, 39; 9,...
def _close_callable(self, node, force=False): """Record last line number of callable.""" # Only nodes that have a line number can be considered for closing # callables. Similarly, only nodes with lines greater than the one # already processed can be considered for closing callables ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:qteRemoveKey; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:keysequence; 7, type; 7, 8; 8, identifier:QtmacsKeysequence; 9, block; 9, 10; 9, 12; 9, 13; 9, 14; 9, 18; 9, 19; 9, 23; 9, 24; 9, 25; 9, ...
def qteRemoveKey(self, keysequence: QtmacsKeysequence): """ Remove ``keysequence`` from this key map. |Args| * ``keysequence`` (**QtmacsKeysequence**): key sequence to remove from this key map. |Returns| **None** |Raises| * **QtmacsArgument...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:find_labels; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:key; 6, default_parameter; 6, 7; 6, 8; 7, identifier:find_in_name; 8, True; 9, default_parameter; 9, 10; 9, 11; 10, identifier:find_in_units; 11, False; 12, ...
def find_labels(self,key,find_in_name=True,find_in_units=False): """ Takes a string or a function to find a set of label indizes that match. If the string starts with a '~', the label only has to contain the string. """ if type(key) is str: found_...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_get_constrained_labels; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:remove_dimensions; 7, False; 8, dictionary_splat_pattern; 8, 9; 9, identifier:kwargs; 10, block; 10, 11; 10, 13; 10, ...
def _get_constrained_labels(self,remove_dimensions=False,**kwargs): """ returns labels which have updated minima and maxima, depending on the kwargs supplied to this """ new_labels = [] for label_no,label in enumerate(self.labels): new_label = LabelDim...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:populate_field_values; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:data; 6, block; 6, 7; 6, 9; 6, 38; 6, 79; 6, 225; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 16; 10, not_operator; 10, 11; 11, attrib...
def populate_field_values(self, data): """Load resource data and populate field values""" if not self._meta.case_sensitive_fields: data = {k.lower(): v for k, v in six.iteritems(data)} if self._meta.match_fuzzy_keys: # String any non-alphanumeric chars from each key ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:build_contact; 3, parameters; 3, 4; 3, 5; 4, identifier:request; 5, default_parameter; 5, 6; 5, 7; 6, identifier:slug; 7, string:""; 8, block; 8, 9; 8, 11; 8, 21; 8, 31; 8, 37; 8, 43; 8, 62; 8, 63; 8, 136; 8, 451; 9, expression_statement; 9, 10...
def build_contact(request, slug=""): """ Builds appropriate contact form based on options set in the contact_form controller. """ controller = get_object_or_404(ContactFormController, slug=slug) site = Site.objects.get_current() UserModel = get_user_model() user = request.user ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:stop_task; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:task_tag; 6, default_parameter; 6, 7; 6, 8; 7, identifier:stop_dependent; 8, True; 9, default_parameter; 9, 10; 9, 11; 10, identifier:stop_requirements; 11, Fa...
def stop_task(self, task_tag, stop_dependent=True, stop_requirements=False): """ Stop task with the given task tag. If task already stopped, then nothing happens. :param task_tag: task to stop :param stop_dependent: if True, then every task, that require the given task as dependency, will be \ stopped before. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:diffs2persistence; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:rev_docs; 5, default_parameter; 5, 6; 5, 7; 6, identifier:window_size; 7, integer:50; 8, default_parameter; 8, 9; 8, 10; 9, identifier:revert_radius; 10, integer:1...
def diffs2persistence(rev_docs, window_size=50, revert_radius=15, sunset=None, verbose=False): """ Processes a sorted and page-partitioned sequence of revision documents into and adds a 'persistence' field to them containing statistics about how each token "added" in the revision p...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:qteAddWidget; 3, parameters; 3, 4; 3, 5; 3, 11; 3, 16; 3, 21; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:widgetObj; 7, type; 7, 8; 8, attribute; 8, 9; 8, 10; 9, identifier:QtGui; 10, identifier:QWidget; 11, typed_default...
def qteAddWidget(self, widgetObj: QtGui.QWidget, isFocusable: bool=True, widgetSignature: str=None, autoBind: bool=True): """ Augment the standard Qt ``widgetObj`` with Qtmacs specific fields. Example: from a programmers perspective there is no difference between:: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:qteSetWidgetFocusOrder; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:widList; 7, type; 7, 8; 8, identifier:tuple; 9, block; 9, 10; 9, 12; 9, 13; 9, 22; 9, 23; 9, 29; 9, 30; 9, 42; 9, 43; 9, 74; 9,...
def qteSetWidgetFocusOrder(self, widList: tuple): """ Change the focus order of the widgets in this applet. This method re-arranges the internal (cyclic) widget list so that all widgets specified in ``widList`` will be focused in the given order. |Args| * ``wid...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 37; 2, function_name:qteNextWidget; 3, parameters; 3, 4; 3, 5; 3, 10; 3, 17; 3, 22; 3, 27; 3, 32; 4, identifier:self; 5, typed_default_parameter; 5, 6; 5, 7; 5, 9; 6, identifier:numSkip; 7, type; 7, 8; 8, identifier:int; 9, integer:1; 10, typed_default_parameter; ...
def qteNextWidget(self, numSkip: int=1, ofsWidget: QtGui.QWidget=None, skipVisible: bool=False, skipInvisible: bool=True, skipFocusable: bool=False, skipUnfocusable: bool=True): """ Return the next widget in cyclic order. If ``of...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:qteMakeWidgetActive; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:widgetObj; 7, type; 7, 8; 8, attribute; 8, 9; 8, 10; 9, identifier:QtGui; 10, identifier:QWidget; 11, block; 11, 12; 11, 14; 11, ...
def qteMakeWidgetActive(self, widgetObj: QtGui.QWidget): """ Give keyboard focus to ``widgetObj``. If ``widgetObj`` is **None** then the internal focus state is reset, but the focus manger will automatically activate the first available widget again. |Args| * `...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:make_result; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 4, identifier:self; 5, identifier:result_class; 6, default_parameter; 6, 7; 6, 8; 7, identifier:node; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:p...
def make_result(self, result_class, node=None, prev_node=None, remember=True, key_chunks=None, notify=True, **kwargs): """Makes an etcd result. If `remember` is ``True``, it keeps the result in the history and triggers events if waiting. `key_chunks` is the result of ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 6; 2, function_name:_get_class_frame_source; 3, parameters; 3, 4; 4, identifier:class_name; 5, comment; 6, block; 6, 7; 6, 9; 6, 185; 7, expression_statement; 7, 8; 8, comment; 9, for_statement; 9, 10; 9, 11; 9, 16; 10, identifier:frame_info; 11, call; 11, 1...
def _get_class_frame_source(class_name): # type: (str) -> Optional[str] """Return the source code for a class by checking the frame stack. This is necessary because it is not possible to get the source of a class being created by a metaclass directly. Args: class_name: The class to look fo...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 6; 2, function_name:_create_typed_object_meta; 3, parameters; 3, 4; 4, identifier:get_fset; 5, comment; 6, block; 6, 7; 6, 9; 6, 54; 6, 302; 7, expression_statement; 7, 8; 8, comment; 9, function_definition; 9, 10; 9, 11; 9, 15; 9, 16; 10, function_name:_get...
def _create_typed_object_meta(get_fset): # type: (Callable[[str, str, Type[_T]], Callable[[_T], None]]) -> type """Create a metaclass for typed objects. Args: get_fset: A function that takes three parameters: the name of an attribute, the name of the private attribute that holds the ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_build_module_db; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 18; 5, 74; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:tdict; 11, call; 11, 12; 11, 15...
def _build_module_db(self): """ Build database of module callables sorted by line number. The database is a dictionary whose keys are module file names and whose values are lists of dictionaries containing name and line number of callables in that module """ tdic...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:merge; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:cls; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 25; 9, 37; 9, 71; 9, 77; 9, 86; 9, 187; 10, expressi...
def merge(cls, *args, **kwargs): """Create a new Ent from one or more existing Ents. Keys in the later Ent objects will overwrite the keys of the previous Ents. Later keys of different type than in earlier Ents will be bravely ignored. The following keyword arguments are recogn...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:diff; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:cls; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 25; 9, 37; 9, 71; 9, 77; 9, 83; 9, 208; 10, expressio...
def diff(cls, *args, **kwargs): """Create a new Ent representing the differences in two or more existing Ents. Keys in the later Ents with values that differ from the earlier Ents will be present in the final Ent with the latest value seen for that key. Later keys of different type tha...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_sorted_keys_items; 3, parameters; 3, 4; 4, identifier:dobj; 5, block; 5, 6; 5, 8; 5, 19; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:keys; 11, call; 11, 12; 11, 13; 12, ...
def _sorted_keys_items(dobj): """Return dictionary items sorted by key.""" keys = sorted(dobj.keys()) for key in keys: yield key, dobj[key]
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:get_or_create_exh_obj; 3, parameters; 3, 4; 3, 7; 3, 10; 4, default_parameter; 4, 5; 4, 6; 5, identifier:full_cname; 6, False; 7, default_parameter; 7, 8; 7, 9; 8, identifier:exclude; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, identif...
def get_or_create_exh_obj(full_cname=False, exclude=None, callables_fname=None): r""" Return global exception handler if set, otherwise create a new one and return it. :param full_cname: Flag that indicates whether fully qualified function/method/class property names are obtained for...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_property_search; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:fobj; 6, block; 6, 7; 6, 9; 6, 10; 6, 22; 6, 33; 6, 44; 6, 45; 6, 68; 6, 79; 6, 94; 6, 113; 6, 114; 6, 118; 6, 211; 6, 212; 6, 221; 6, 234; 6, 293; 7, expression_sta...
def _property_search(self, fobj): """Return full name if object is a class property, otherwise return None.""" # Get class object scontext = fobj.f_locals.get("self", None) class_obj = scontext.__class__ if scontext is not None else None if not class_obj: del fobj, sc...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_execute; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:request; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 11; 8, 321; 8, 330; 8, 358; 8, 364; 8, 415; 9, expression_statement; 9, 10; 10, co...
def _execute(self, request, **kwargs): """The top-level execute function for the endpoint. This method is intended to remain as-is, and not be overridden. It gets called by your HTTP framework's route handler, and performs the following actions to process the request: ``authent...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:add_entity_errors; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:property_name; 6, default_parameter; 6, 7; 6, 8; 7, identifier:direct_errors; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:schema_errors...
def add_entity_errors( self, property_name, direct_errors=None, schema_errors=None ): """ Attach nested entity errors Accepts a list errors coming from validators attached directly, or a dict of errors produced by a nested schema. :param prope...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:add_collection_errors; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:property_name; 6, default_parameter; 6, 7; 6, 8; 7, identifier:direct_errors; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:collectio...
def add_collection_errors( self, property_name, direct_errors=None, collection_errors=None ): """ Add collection errors Accepts a list errors coming from validators attached directly, or a list of schema results for each item in the collection. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:merge_errors; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:errors_local; 6, identifier:errors_remote; 7, block; 7, 8; 7, 10; 7, 312; 7, 313; 8, expression_statement; 8, 9; 9, comment; 10, for_statement; 10, 11; 10, 12; 10,...
def merge_errors(self, errors_local, errors_remote): """ Merge errors Recursively traverses error graph to merge remote errors into local errors to return a new joined graph. :param errors_local: dict, local errors, will be updated :param errors_remote: dict, remote erro...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:cursorPositionChangedEvent; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 17; 5, 25; 5, 33; 5, 34; 5, 35; 5, 36; 5, 47; 5, 54; 5, 65; 5, 66; 5, 67; 5, 68; 5, 69; 5, 96; 5, 97; 5, 105; 5, 106; 5, 107; 5, 108; 5, 109; 5,...
def cursorPositionChangedEvent(self): """ Update the highlighting. This is an overloaded version of the native Qt slot of ``QTextEdit``. In this class, the purpose of this slot is to check if the character to the right of the cursor needs highlighting, assuming ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:scenarios; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:generate_seed; 7, False; 8, block; 8, 9; 8, 11; 8, 18; 8, 30; 8, 84; 8, 85; 8, 86; 8, 90; 8, 94; 8, 158; 8, 173; 8, 174; 8, 175; 8, 176; 8...
def scenarios(self, generate_seed=False): """ Generator function. Spits out scenarios for this experiment """ seed = prime_numbers(1000) sweeps_all = self.experiment["sweeps"].keys() if "combinations" in self.experiment: if isinstance(self.experiment["combinat...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:subdict_by_keys; 3, parameters; 3, 4; 3, 5; 4, identifier:dict_obj; 5, identifier:keys; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, return_statement; 9, 10; 10, dictionary_comprehension; 10, 11; 10, 16; 11, pair; 11, 12;...
def subdict_by_keys(dict_obj, keys): """Returns a sub-dict composed solely of the given keys. Parameters ---------- dict_obj : dict The dict to create a sub-dict from. keys : list of str The keys to keep in the sub-dict. Keys not present in the given dict will be ignored. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:deep_merge_dict; 3, parameters; 3, 4; 3, 5; 4, identifier:base; 5, identifier:priority; 6, block; 6, 7; 6, 9; 6, 26; 6, 35; 6, 72; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 23; 10, boolean_operator:or; 10, 11; 10, 17...
def deep_merge_dict(base, priority): """Recursively merges the two given dicts into a single dict. Treating base as the the initial point of the resulting merged dict, and considering the nested dictionaries as trees, they are merged os: 1. Every path to every leaf in priority would be represented in t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:norm_int_dict; 3, parameters; 3, 4; 4, identifier:int_dict; 5, block; 5, 6; 5, 8; 5, 16; 5, 27; 5, 41; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:norm_dict; 11, call; 11...
def norm_int_dict(int_dict): """Normalizes values in the given dict with int values. Parameters ---------- int_dict : list A dict object mapping each key to an int value. Returns ------- dict A dict where each key is mapped to its relative part in the sum of all dic...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:sum_num_dicts; 3, parameters; 3, 4; 3, 5; 4, identifier:dicts; 5, default_parameter; 5, 6; 5, 7; 6, identifier:normalize; 7, False; 8, block; 8, 9; 8, 11; 8, 15; 8, 39; 8, 47; 9, expression_statement; 9, 10; 10, comment; 11, expression_statemen...
def sum_num_dicts(dicts, normalize=False): """Sums the given dicts into a single dict mapping each key to the sum of its mappings in all given dicts. Parameters ---------- dicts : list A list of dict objects mapping each key to an numeric value. normalize : bool, default False I...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:reverse_dict; 3, parameters; 3, 4; 4, identifier:dict_obj; 5, block; 5, 6; 5, 8; 5, 12; 5, 31; 5, 49; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:new_dict; 11, dictionary...
def reverse_dict(dict_obj): """Reverse a dict, so each value in it maps to a sorted list of its keys. Parameters ---------- dict_obj : dict A key-value dict. Returns ------- dict A dict where each value maps to a sorted list of all the unique keys that mapped to it....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:flatten_dict; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:dict_obj; 5, default_parameter; 5, 6; 5, 7; 6, identifier:separator; 7, string:'.'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:flatten_lists; 10, False; 11, block; 11, 12; 11, ...
def flatten_dict(dict_obj, separator='.', flatten_lists=False): """Flattens the given dict into a single-level dict with flattend keys. Parameters ---------- dict_obj : dict A possibly nested dict. separator : str, optional The character to use as a separator between keys. Defaults ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:key_value_nested_generator; 3, parameters; 3, 4; 4, identifier:dict_obj; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, for_statement; 8, 9; 8, 12; 8, 17; 9, pattern_list; 9, 10; 9, 11; 10, identifier:key; 11, identifier:va...
def key_value_nested_generator(dict_obj): """Recursively iterate over key-value pairs of nested dictionaries. Parameters ---------- dict_obj : dict The outer-most dict to iterate on. Returns ------- generator A generator over key-value pairs in all nested dictionaries. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:key_tuple_value_nested_generator; 3, parameters; 3, 4; 4, identifier:dict_obj; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, for_statement; 8, 9; 8, 12; 8, 17; 9, pattern_list; 9, 10; 9, 11; 10, identifier:key; 11, identif...
def key_tuple_value_nested_generator(dict_obj): """Recursively iterate over key-tuple-value pairs of nested dictionaries. Parameters ---------- dict_obj : dict The outer-most dict to iterate on. Returns ------- generator A generator over key-tuple-value pairs in all nested ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:release_lock; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:verbose; 7, identifier:VERBOSE; 8, default_parameter; 8, 9; 8, 10; 9, identifier:raiseError; 10, identifier:RAISE_ERROR; 11, blo...
def release_lock(self, verbose=VERBOSE, raiseError=RAISE_ERROR): """ Release the lock when set and close file descriptor if opened. :Parameters: #. verbose (bool): Whether to be verbose about errors when encountered #. raiseError (bool): Whether to raise error exception ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:guess_codec; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:file; 5, default_parameter; 5, 6; 5, 7; 6, identifier:errors; 7, string:"strict"; 8, default_parameter; 8, 9; 8, 10; 9, identifier:require_char; 10, False; 11, block; 11, 12; 11, 14; ...
def guess_codec(file, errors="strict", require_char=False): """Look at file contents and guess its correct encoding. File must be open in binary mode and positioned at offset 0. If BOM record is present then it is assumed to be UTF-8 or UTF-16 encoded file. GEDCOM header is searched for CHAR record and...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:read_record; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:offset; 6, block; 6, 7; 6, 9; 6, 17; 6, 21; 6, 22; 6, 26; 6, 173; 6, 226; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, call; 10, 11; 10,...
def read_record(self, offset): """Read next complete record from a file starting at given position. Reads the record at given position and all its sub-records. Stops reading at EOF or next record with the same or higher (smaller) level number. File position after return from this method...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_make_record; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:parent; 6, identifier:gline; 7, block; 7, 8; 7, 10; 7, 72; 7, 73; 7, 79; 7, 104; 7, 146; 7, 147; 7, 159; 8, expression_statement; 8, 9; 9, comment; 10, if_statemen...
def _make_record(self, parent, gline): """Process next record. This method created new record from the line read from file if needed and/or updates its parent record. If the parent record tag is ``BLOB`` and new record tag is ``CONT`` then record is skipped entirely and None is ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:parse; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:gvid; 6, default_parameter; 6, 7; 6, 8; 7, identifier:exception; 8, True; 9, block; 9, 10; 9, 12; 9, 27; 9, 36; 9, 59; 9, 147; 9, 186; 9, 197; 9, 214; 9, 222; 9, 228; 9, 2...
def parse(cls, gvid, exception=True): """ Parse a string value into the geoid of this class. :param gvid: String value to parse. :param exception: If true ( default) raise an eception on parse erorrs. If False, return a 'null' geoid. :return: """ if gvid...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:filter_pastdate; 3, parameters; 3, 4; 3, 5; 4, identifier:string; 5, default_parameter; 5, 6; 5, 7; 6, identifier:default; 7, None; 8, block; 8, 9; 8, 11; 8, 21; 8, 31; 8, 32; 8, 57; 8, 77; 8, 121; 8, 178; 8, 184; 9, expression_statement; 9, 10...
def filter_pastdate(string, default=None): """Coerce to a date not beyond the current date If only a day is given, assumes the current month if that day has passed or is the current day, otherwise assumes the previous month. If a day and month are given, but no year, assumes the current year if the...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:get_rooms; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:lid; 6, default_parameter; 6, 7; 6, 8; 7, identifier:start; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:end; 11, None; 12, block; 12, 13; 12, 1...
def get_rooms(self, lid, start=None, end=None): """Returns a list of rooms and their availabilities, grouped by category. :param lid: The ID of the location to retrieve rooms for. :type lid: int :param start: The start range for the availabilities to retrieve, in YYYY-MM-DD format. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 28; 2, function_name:reconstruct_ancestral_states; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 3, 25; 4, identifier:tree; 5, identifier:character; 6, identifier:states; 7, default_parameter; 7, 8; 7, 9; 8, identifier:prediction_method...
def reconstruct_ancestral_states(tree, character, states, prediction_method=MPPA, model=F81, params=None, avg_br_len=None, num_nodes=None, num_tips=None, force_joint=True): """ Reconstructs ancestral states for the given character on the given tr...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:acr; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:tree; 5, identifier:df; 6, default_parameter; 6, 7; 6, 8; 7, identifier:prediction_method; 8, identifier:MPPA; 9, default_parameter; 9, 10; 9, 11; 10, identifier:model; 11...
def acr(tree, df, prediction_method=MPPA, model=F81, column2parameters=None, force_joint=True): """ Reconstructs ancestral states for the given tree and all the characters specified as columns of the given annotation dataframe. :param df: dataframe indexed with tree node names and containing ch...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:export_bert; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:data; 5, identifier:electrodes; 6, identifier:filename; 7, block; 7, 8; 7, 10; 7, 11; 7, 49; 7, 57; 7, 69; 7, 76; 7, 77; 7, 85; 7, 93; 7, 107; 7, 121; 7, 122; 7, 123; 7, 136; 7, 154; 7...
def export_bert(data, electrodes, filename): """Export to unified data format used in pyGIMLi & BERT. Parameters ---------- data : :py:class:`pandas.DataFrame` DataFrame with at least a, b, m, n and r. electrodes : :py:class:`pandas.DataFrame` DataFrame with electrode positions. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_sort_dd_skips; 3, parameters; 3, 4; 3, 5; 4, identifier:configs; 5, identifier:dd_indices_all; 6, block; 6, 7; 6, 9; 6, 28; 6, 46; 6, 47; 6, 56; 6, 73; 6, 74; 6, 78; 6, 105; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9...
def _sort_dd_skips(configs, dd_indices_all): """Given a set of dipole-dipole configurations, sort them according to their current skip. Parameters ---------- configs: Nx4 numpy.ndarray Dipole-Dipole configurations Returns ------- dd_configs_sorted: dict dictionary with ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:get_label; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:parameter; 5, identifier:ptype; 6, default_parameter; 6, 7; 6, 8; 7, identifier:flavor; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:mpl; 11, None; 12, block; 12, 1...
def get_label(parameter, ptype, flavor=None, mpl=None): """Return the label of a given SIP parameter Parameters ---------- parameter: string type of parameter, e.g. rmag|rpha|cre|cim ptype: string material|meas. Either return the material property (e.g. resistivity) or the m...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:convert; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:input_format; 5, identifier:output_format; 6, identifier:data; 7, default_parameter; 7, 8; 7, 9; 8, identifier:one_spectrum; 9, False; 10, block; 10, 11; 10, 13; 10, 20; 10, 35; 10,...
def convert(input_format, output_format, data, one_spectrum=False): """ Convert from the given format to the requested format Parameters ---------- input_format : format of input data (parameter 'data') output_format : format of output data data : numpy array containing data in specified in...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:plot_ps_extra; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:dataobj; 5, identifier:key; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 11; 8, 32; 8, 61; 8, 107; 8, 116; 8, 129; 8, 138; 8, 152; 8, 153; 8, 159; 8, 1...
def plot_ps_extra(dataobj, key, **kwargs): """Create grouped pseudoplots for one or more time steps Parameters ---------- dataobj: :class:`reda.containers.ERT` An ERT container with loaded data key: string The column name to plot subquery: string, optional cbmin: float, opti...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:plot_pseudodepths; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:configs; 5, identifier:nr_electrodes; 6, default_parameter; 6, 7; 6, 8; 7, identifier:spacing; 8, integer:1; 9, default_parameter; 9, 10; 9, 11; 10, i...
def plot_pseudodepths(configs, nr_electrodes, spacing=1, grid=None, ctypes=None, dd_merge=False, **kwargs): """Plot pseudodepths for the measurements. If grid is given, then the actual electrode positions are used, and the parameter 'spacing' is ignored' Parameters ---------- ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:complete; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:uio; 6, default_parameter; 6, 7; 6, 8; 7, identifier:dropped; 8, False; 9, block; 9, 10; 9, 12; 9, 22; 10, expression_statement; 10, 11; 11, comment; 12, if_statement;...
def complete(self, uio, dropped=False): """Query for all missing information in the transaction""" if self.dropped and not dropped: # do nothing for dropped xn, unless specifically told to return for end in ['src', 'dst']: if getattr(self, end): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:gen_dipole_dipole; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:self; 5, identifier:skipc; 6, default_parameter; 6, 7; 6, 8; 7, identifier:skipv; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, ident...
def gen_dipole_dipole(self, skipc, skipv=None, stepc=1, stepv=1, nr_voltage_dipoles=10, before_current=False, start_skip=0, ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:split_into_normal_and_reciprocal; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:pad; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:return_indices; 10, False; 11, block; 11, 12...
def split_into_normal_and_reciprocal(self, pad=False, return_indices=False): """Split the stored configurations into normal and reciprocal measurements ** *Rule 1: the normal configuration contains the smallest electrode number of the four involv...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:gen_reciprocals; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:append; 7, False; 8, block; 8, 9; 8, 11; 8, 12; 8, 30; 8, 56; 8, 82; 8, 83; 8, 112; 8, 118; 8, 136; 9, expression_statement; 9, 10; ...
def gen_reciprocals(self, append=False): """ Generate reciprocal configurations, sort by AB, and optionally append to configurations. Parameters ---------- append : bool Append reciprocals to configs (the default is False). Examples -------- ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:gen_configs_permutate; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:injections_raw; 6, default_parameter; 6, 7; 6, 8; 7, identifier:only_same_dipole_length; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, i...
def gen_configs_permutate(self, injections_raw, only_same_dipole_length=False, ignore_crossed_dipoles=False, silent=False): """ Create measurement configurations out of a pool of current ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:to_pg_scheme; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:container; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:positions; 10, None; 11, block; 11, 12; 11, 14; 11, 28; 11,...
def to_pg_scheme(self, container=None, positions=None): """Convert the configuration to a pygimli measurement scheme Parameters ---------- container: reda.containers.ERT.ERT an ERT data container (we take the electrode positions from here) positions = None R...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:try_sending; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:msg; 6, identifier:timeout_secs; 7, identifier:max_attempts; 8, block; 8, 9; 8, 11; 8, 22; 8, 33; 8, 37; 9, expression_statement; 9, 10; 10, comment; 11, if_s...
async def try_sending(self,msg,timeout_secs, max_attempts): """Coroutine used to send message to the device when a response or ack is needed. This coroutine will try to send up to max_attempts time the message, waiting timeout_secs for an answer. If no answer is received, it will consider that ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:apply_correction_factors; 3, parameters; 3, 4; 3, 5; 4, identifier:df; 5, identifier:correction_file; 6, block; 6, 7; 6, 9; 6, 160; 6, 186; 6, 212; 6, 224; 6, 232; 6, 245; 6, 421; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 1...
def apply_correction_factors(df, correction_file): """Apply correction factors for a pseudo-2D measurement setup. See Weigand and Kemna, 2017, Biogeosciences, for detailed information. """ if isinstance(correction_file, (list, tuple)): corr_data_raw = np.vstack( [np.loadtxt(x) for x ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:alter_zero_tip_allowed_states; 3, parameters; 3, 4; 3, 5; 4, identifier:tree; 5, identifier:feature; 6, block; 6, 7; 6, 9; 6, 16; 6, 24; 6, 64; 6, 65; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10...
def alter_zero_tip_allowed_states(tree, feature): """ Alters the bottom-up likelihood arrays for zero-distance tips to make sure they do not contradict with other zero-distance tip siblings. :param tree: ete3.Tree, the tree of interest :param feature: str, character for which the likelihood is alte...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:choose_ancestral_states_mppa; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:tree; 5, identifier:feature; 6, identifier:states; 7, default_parameter; 7, 8; 7, 9; 8, identifier:force_joint; 9, True; 10, block; 10, 11; 10, 13; 10, 21; 10, ...
def choose_ancestral_states_mppa(tree, feature, states, force_joint=True): """ Chooses node ancestral states based on their marginal probabilities using MPPA method. :param force_joint: make sure that Joint state is chosen even if it has a low probability. :type force_joint: bool :param tree: tree ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:parse; 3, parameters; 3, 4; 4, identifier:text; 5, block; 5, 6; 5, 8; 5, 9; 5, 21; 5, 22; 5, 26; 5, 27; 5, 31; 5, 32; 5, 233; 5, 234; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11;...
def parse(text): """Parses input text, matches and replaces using avrodict If a valid replacement is found, returns the replaced string. If no replacement is found, returns the input text. Usage: :: from pyavrophonetic import avro avro.parse("ami banglay gan gai") """ # Sanit...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:process_match; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:match; 5, identifier:fixed_text; 6, identifier:cur; 7, identifier:cur_end; 8, block; 8, 9; 8, 11; 8, 12; 8, 13; 8, 17; 8, 18; 8, 38; 8, 39; 8, 75; 8, 76; 8, 77; 8, 302; 8, 303;...
def process_match(match, fixed_text, cur, cur_end): """Processes a single match in rules""" # Set our tools # -- Initial/default value for replace replace = True # -- Set check cursor depending on match['type'] if match['type'] == 'prefix': chk = cur - 1 else: # suffix ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:scatter_norrec; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:filename; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:individual; 10, False; 11, block; 11, 12; 11, 14; 11, 15; ...
def scatter_norrec(self, filename=None, individual=False): """Create a scatter plot for all diff pairs Parameters ---------- filename : string, optional if given, save plot to file individual : bool, optional if set to True, return one figure for each ro...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:get_spectrum; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:nr_id; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:abmn; 10, None; 11, default_parameter; 11, 12; 11, 13; 1...
def get_spectrum(self, nr_id=None, abmn=None, plot_filename=None): """Return a spectrum and its reciprocal counter part, if present in the dataset. Optimally, refer to the spectrum by its normal-reciprocal id. Returns ------- spectrum_nor : :py:class:`reda.eis.plots.sip_response...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:import_bin; 3, parameters; 3, 4; 3, 5; 4, identifier:filename; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 10; 7, 19; 7, 29; 7, 60; 7, 194; 7, 221; 7, 236; 7, 237; 7, 249; 7, 257; 7, 265; 7, 273; 7, 281; 7, 289; ...
def import_bin(filename, **kwargs): """Read a .bin file generated by the IRIS Instruments Syscal Pro System and return a curated dataframe for further processing. This dataframe contains only information currently deemed important. Use the function reda.importers.iris_syscal_pro_binary._import_bin to ex...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 43; 2, function_name:datoms; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 3, 38; 3, 41; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:index; 7, string:'aevt'; 8, default_parameter; 8, 9; 8, 1...
def datoms(self, index='aevt', e='', a='', v='', limit=0, offset=0, chunk=100, start='', end='', since='', as_of='', history='', **kwargs): """ Returns a lazy generator that will only fetch groups of datoms at the chunk size specified. http://docs.datomic.com/clo...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:add; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 19; 9, 32; 9, 149; 9, 151; 9, 174; 9, 176; 9, 205; 9,...
def add(self, *args, **kwargs): """ Accumulate datums for the transaction Start a transaction on an existing db connection >>> tx = TX(db) Get get an entity object with a tempid >>> ref = add() >>> ref = add(0) >>> ref = add(None) >>> ref = add(False) Entity id passed as first arg...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:parsimonious_acr; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:tree; 5, identifier:character; 6, identifier:prediction_method; 7, identifier:states; 8, identifier:num_nodes; 9, identifier:num_tips; 10, block; 10, 11; 10, 13...
def parsimonious_acr(tree, character, prediction_method, states, num_nodes, num_tips): """ Calculates parsimonious states on the tree and stores them in the corresponding feature. :param states: numpy array of possible states :param prediction_method: str, ACCTRAN (accelerated transformation), DELTRAN ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:load_seit_data; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:directory; 5, default_parameter; 5, 6; 5, 7; 6, identifier:frequency_file; 7, string:'frequencies.dat'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:data_prefix; 10, str...
def load_seit_data(directory, frequency_file='frequencies.dat', data_prefix='volt_', **kwargs): """Load sEIT data from data directory. This function loads data previously exported from reda using reda.exporters.crtomo.write_files_to_directory Parameters ---------- directory : str...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:parse_date; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:date; 6, block; 6, 7; 6, 9; 6, 32; 6, 70; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 15; 10, comparison_operator:is; 10, 11; 10, 14; 11, attribu...
def parse_date(self, date): """Parse the date and return a datetime object The heuristic for determining the date is: - if ``date_format`` is set, parse using strptime - if one field of 8 digits, YYYYMMDD - split by '-' or '/' - (TODO: substitute string months with t...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:commit; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:if_match; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:wait; 10, True; 11, default_parameter; 11, 12; 11, 13; 12, ...
def commit(self, if_match=None, wait=True, timeout=None): """Apply all the changes on the current model. :param wait: Whether to wait until the operation is completed :param timeout: The maximum amount of time required for this operation to be completed. If o...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:plot_histograms; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:ertobj; 5, identifier:keys; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 11; 8, 12; 8, 33; 8, 47; 8, 59; 8, 63; 8, 73; 8, 127; 8, 418; 8, 427; 9, exp...
def plot_histograms(ertobj, keys, **kwargs): """Generate histograms for one or more keys in the given container. Parameters ---------- ertobj : container instance or :class:`pandas.DataFrame` data object which contains the data. keys : str or list of strings which keys (column names...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:plot_histograms_extra_dims; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:dataobj; 5, identifier:keys; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 11; 8, 32; 8, 61; 8, 65; 8, 102; 8, 106; 8, 113; 8, 123; 8, 147;...
def plot_histograms_extra_dims(dataobj, keys, **kwargs): """Produce histograms grouped by the extra dimensions. Extra dimensions are: * timesteps * frequency Parameters ---------- dataobj : :py:class:`pandas.DataFrame` or reda container The data container/data frame which holds th...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 2, function_name:request; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 4, identifier:self; 5, identifier:method; 6, identifier:url; 7, default_parameter; 7, 8; 7, 9; 8, identifier:params; 9, None; 10, default_parameter; 10, 11; 10,...
async def request(self, method, url, params=None, headers=None, data=None, json=None, token_refresh_attempts=2, **kwargs): """Make an asynchronous HTTP request. Args: method (str): HTTP method to use for the request. url (str): URL to ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:unflatten; 3, parameters; 3, 4; 3, 5; 4, identifier:processed; 5, identifier:merge_rules; 6, block; 6, 7; 6, 9; 6, 15; 6, 193; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identi...
def unflatten(processed, merge_rules): """ Unflattens a processed object into a JSON object. """ unflattened = OrderedDict() for key in processed: current_node = unflattened for end, part in enumerate(key, 1): # If this is a path to an item of an array. # See...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:translate; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 12; 5, 110; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:translations; 11, list:[]; 12, for_st...
def translate(self): """ Create all translations objects for this Translatable instance. @rtype: list of Translation objects @return: Returns a list of translations objects """ translations = [] for lang in settings.LANGUAGES: # do not create an trans...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:set_translation; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:lang; 6, identifier:field; 7, identifier:text; 8, block; 8, 9; 8, 11; 8, 12; 8, 16; 8, 35; 8, 36; 8, 49; 8, 55; 8, 61; 8, 62; 8, 91; 8, 134; 8, 135; 8, 14...
def set_translation(self, lang, field, text): """ Store a translation string in the specified field for a Translatable istance @type lang: string @param lang: a string with the name of the language @type field: string @param field: a string with the name that we...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:jsonify; 3, parameters; 3, 4; 3, 5; 3, 9; 4, identifier:o; 5, default_parameter; 5, 6; 5, 7; 6, identifier:max_depth; 7, unary_operator:-; 7, 8; 8, integer:1; 9, default_parameter; 9, 10; 9, 11; 10, identifier:parse_enums; 11, identifier:PARSE...
def jsonify(o, max_depth=-1, parse_enums=PARSE_KEEP): """ Walks through object o, and attempts to get the property instead of the key, if available. This means that for our VDev objects we can easily get a dict of all the 'parsed' values. """ if max_depth == 0: return o max_depth -= 1 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:b58encode; 3, parameters; 3, 4; 3, 5; 4, identifier:val; 5, default_parameter; 5, 6; 5, 7; 6, identifier:charset; 7, identifier:DEFAULT_CHARSET; 8, block; 8, 9; 8, 11; 8, 65; 8, 87; 8, 103; 8, 110; 8, 123; 8, 130; 8, 139; 8, 146; 8, 154; 8, 176...
def b58encode(val, charset=DEFAULT_CHARSET): """Encode input to base58check encoding. :param bytes val: The value to base58check encode. :param bytes charset: (optional) The character set to use for encoding. :return: the encoded bytestring. :rtype: bytes :raises: TypeError: if `val` is not byt...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:m2m_callback; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, identifier:sender; 5, identifier:instance; 6, identifier:action; 7, identifier:reverse; 8, identifier:model; 9, identifier:pk_set; 10, identifier:using; 11, dict...
def m2m_callback(sender, instance, action, reverse, model, pk_set, using, **kwargs): """ Many 2 Many relationship signall receivver. Detect Many 2 Many relationship changes and append these to existing model or create if needed. These get not recorded from the pre_save or post_save method and must ther...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:normalize_allele_name; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:raw_allele; 5, default_parameter; 5, 6; 5, 7; 6, identifier:omit_dra1; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:infer_class2_pair; 10, True; 11, block; 11,...
def normalize_allele_name(raw_allele, omit_dra1=False, infer_class2_pair=True): """MHC alleles are named with a frustratingly loose system. It's not uncommon to see dozens of different forms for the same allele. Note: this function works with both class I and class II allele names (including alpha/beta...