(self, txt)
return ret
If there is a comment at the end of the signature statement, remove it
If there is a comment at the end of the signature statement, remove it
If there is a comment at the end of the signature statement remove it
def _remove_signature_comment(self, txt):
        """If there is a comment at the end of the signature statement, remove it"""
        ret = ""
        inside = None
        end_inside = {'(': ')', '{': '}', '[': ']', "'": "'", '"': '"'}
        for c in txt:
            if (inside and end_inside[inside] != c) or (not inside and c in end_inside.keys()):
                if not inside:
                    inside = c
                ret += c
                continue
            if inside and c == end_inside[inside]:
                inside = None
                ret += c
                continue
            if not inside and c == '#':
                # found a comment so signature is finished we stop parsing
                break
            ret += c
        return ret
def _remove_signature_comment ( self , txt ) : ret = "" inside = None end_inside = { '(' : ')' , '{' : '}' , '[' : ']' , "'" : "'" , '"' : '"' } for c in txt : if ( inside and end_inside [ inside ] != c ) or ( not inside and c in end_inside . keys ( ) ) : if not inside : inside = c ret += c continue if inside and c == end_inside [ inside ] : inside = None ret += c continue if not inside and c == '#' : # found a comment so signature is finished we stop parsing break ret += c return ret