(self, raw=None)
Parses the element's elements (type, name and parameters) :)
        e.g.: def methode(param1, param2='default')
        def                      -> type
        methode                  -> name
        param1, param2='default' -> parameters

        :param raw: raw data of the element (def or class). If None will use `self.element['raw']` (Default value = None)
Parses the element's elements (type, name and parameters) :)
        e.g.: def methode(param1, param2='default')
        def                      -> type
        methode                  -> name
        param1, param2='default' -> parameters
Parses the element s elements ( type name and parameters ) : ) e . g . : def methode ( param1 param2 = default ) def - > type methode - > name param1 param2 = default - > parameters
def parse_definition(self, raw=None):
        """Parses the element's elements (type, name and parameters) :)
        e.g.: def methode(param1, param2='default')
        def                      -> type
        methode                  -> name
        param1, param2='default' -> parameters

        :param raw: raw data of the element (def or class). If None will use `self.element['raw']` (Default value = None)

        """
        # TODO: retrieve return from element external code (in parameter)
        if raw is None:
            l = self.element['raw'].strip()
        else:
            l = raw.strip()
        is_class = False
        if l.startswith('async def ') or l.startswith('def ') or l.startswith('class '):
            # retrieves the type
            if l.startswith('def'):
                self.element['deftype'] = 'def'
                l = l.replace('def ', '')
            elif l.startswith('async'):
                self.element['deftype'] = 'def'
                l = l.replace('async def ', '')
            else:
                self.element['deftype'] = 'class'
                l = l.replace('class ', '')
                is_class = True
            # retrieves the name
            self.element['name'] = l[:l.find('(')].strip()
            if not is_class:
                extracted = self._extract_signature_elements(self._remove_signature_comment(l))
                # remove self and cls parameters if any and also empty params (if no param)
                remove_keys = []
                for key in extracted['parameters']:
                    if extracted['parameters'][key]['param'] in ['self', 'cls']:
                        remove_keys.append(key)
                    elif not extracted['parameters'][key]['param']:
                        remove_keys.append(key)
                for key in remove_keys:
                    del extracted['parameters'][key]
                if extracted['return_type']:
                    self.element['rtype'] = extracted['return_type'] # TODO manage this
                self.element['params'].extend(extracted['parameters'].values())
        self.parsed_elem = True
def parse_definition ( self , raw = None ) : # TODO: retrieve return from element external code (in parameter) if raw is None : l = self . element [ 'raw' ] . strip ( ) else : l = raw . strip ( ) is_class = False if l . startswith ( 'async def ' ) or l . startswith ( 'def ' ) or l . startswith ( 'class ' ) : # retrieves the type if l . startswith ( 'def' ) : self . element [ 'deftype' ] = 'def' l = l . replace ( 'def ' , '' ) elif l . startswith ( 'async' ) : self . element [ 'deftype' ] = 'def' l = l . replace ( 'async def ' , '' ) else : self . element [ 'deftype' ] = 'class' l = l . replace ( 'class ' , '' ) is_class = True # retrieves the name self . element [ 'name' ] = l [ : l . find ( '(' ) ] . strip ( ) if not is_class : extracted = self . _extract_signature_elements ( self . _remove_signature_comment ( l ) ) # remove self and cls parameters if any and also empty params (if no param) remove_keys = [ ] for key in extracted [ 'parameters' ] : if extracted [ 'parameters' ] [ key ] [ 'param' ] in [ 'self' , 'cls' ] : remove_keys . append ( key ) elif not extracted [ 'parameters' ] [ key ] [ 'param' ] : remove_keys . append ( key ) for key in remove_keys : del extracted [ 'parameters' ] [ key ] if extracted [ 'return_type' ] : self . element [ 'rtype' ] = extracted [ 'return_type' ] # TODO manage this self . element [ 'params' ] . extend ( extracted [ 'parameters' ] . values ( ) ) self . parsed_elem = True