Skip to content

AttributeError: 'NoneType' object has no attribute 'group' #10

@joshlk

Description

@joshlk

Hi,

I pip installed parinx and tried the first example and got an error:

from parinx import parser
docstring = """
Return a dict.

:type zone_id: ``str``
:param zone_id: Required zone id (required)
:keyword    auth:   Initial authentication information for the node
                    (optional)

:rtype:    ``dict``
"""
result = parser.parse_docstring(docstring)
print (result)
AttributeErrorTraceback (most recent call last)
<ipython-input-67-c439f8926a10> in <module>()
     10 :rtype:    ``dict``
     11 """
---> 12 result = parser.parse_docstring(docstring)
     13 print (result)
     14 

/home/josh/anaconda2/lib/python2.7/site-packages/parinx/parser.pyc in parse_docstring(docstring, cls)
    240         #parse arguments
    241         else:
--> 242             arg_name, update_dict = _parse_docstring_field(cls, docstring_line)
    243             arguments_dict[arg_name].update(update_dict)
    244     #check fields

/home/josh/anaconda2/lib/python2.7/site-packages/parinx/parser.pyc in _parse_docstring_field(cls, field_lines)
     67     """
     68 
---> 69     match_name = __get_class_name(cls)
     70 
     71     if field_lines.startswith(':type'):

/home/josh/anaconda2/lib/python2.7/site-packages/parinx/parser.pyc in __get_class_name(cls)
    192     pattern = r"\<class (?P<cls_name>(.*?))\>"
    193     cls_match = re.match(pattern, str(cls))
--> 194     match_name = cls_match.group('cls_name').replace("'", "")
    195     return match_name
    196 

AttributeError: 'NoneType' object has no attribute 'group'

The version pip installed was 0.1.2. Do you know what the issue is?
Im using Python Anaconda. Here are some versions:

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-34-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions