pypet/annotations.py
def f_get(self, *args):
        """Returns annotations

        If len(args)>1, then returns a list of annotations.

        `f_get(X)` with *X* integer will return the annotation with name `annotation_X`.

        If the annotation contains only a single entry you can call `f_get()` without arguments.
        If you call `f_get()` and the annotation contains more than one element a ValueError is
        thrown.

        """

        if len(args) == 0:
            if len(self._dict) == 1:
                return self._dict[list(self._dict.keys())[0]]
            elif len(self._dict) > 1:
                raise ValueError('Your annotation contains more than one entry: '
                                 '`%s` Please use >>f_get<< with one of these.' %
                                 (str(list(self._dict.keys()))))
            else:
                raise AttributeError('Your annotation is empty, cannot access data.')

        result_list = []
        for name in args:
            name = self._translate_key(name)
            try:
                result_list.append(self._dict[name])
            except KeyError:
                raise AttributeError('Your annotation does not contain %s.' % name)

        if len(args) == 1:
            return result_list[0]
        else:
            return tuple(result_list)
def f_get(self, *args):
        """Returns annotations

        If len(args)>1, then returns a list of annotations.

        `f_get(X)` with *X* integer will return the annotation with name `annotation_X`.

        If the annotation contains only a single entry you can call `f_get()` without arguments.
        If you call `f_get()` and the annotation contains more than one element a ValueError is
        thrown.

        """

        if len(args) == 0:
            if len(self._dict) == 1:
                return self._dict[list(self._dict.keys())[0]]
            elif len(self._dict) > 1:
                raise ValueError('Your annotation contains more than one entry: '
                                 '`%s` Please use >>f_get<< with one of these.' %
                                 (str(list(self._dict.keys()))))
            else:
                raise AttributeError('Your annotation is empty, cannot access data.')

        result_list = []
        for name in args:
            name = self._translate_key(name)
            try:
                result_list.append(self._dict[name])
            except KeyError:
                raise AttributeError('Your annotation does not contain %s.' % name)

        if len(args) == 1:
            return result_list[0]
        else:
            return tuple(result_list)
def f_get ( self , * args ) : if len ( args ) == 0 : if len ( self . _dict ) == 1 : return self . _dict [ list ( self . _dict . keys ( ) ) [ 0 ] ] elif len ( self . _dict ) > 1 : raise ValueError ( 'Your annotation contains more than one entry: ' '`%s` Please use >>f_get<< with one of these.' % ( str ( list ( self . _dict . keys ( ) ) ) ) ) else : raise AttributeError ( 'Your annotation is empty, cannot access data.' ) result_list = [ ] for name in args : name = self . _translate_key ( name ) try : result_list . append ( self . _dict [ name ] ) except KeyError : raise AttributeError ( 'Your annotation does not contain %s.' % name ) if len ( args ) == 1 : return result_list [ 0 ] else : return tuple ( result_list )
Returns annotations

        If len(args)>1, then returns a list of annotations.

        `f_get(X)` with *X* integer will return the annotation with name `annotation_X`.

        If the annotation contains only a single entry you can call `f_get()` without arguments.
        If you call `f_get()` and the annotation contains more than one element a ValueError is
        thrown.
Returns annotations