Skip to content

Minor issue with documentation (reparse/doc/source/howto.rst) #13

Description

@jfthuong

There are few issues in documentation (https://github.com/andychase/reparse/blob/master/doc/source/howto.rst):

  1. Incorrect regex for area code [+]([0-9] \d{2}) - (\d{3}) - (\d{4}) => [+]([0-9] \d{3}) - (\d{3}) - (\d{4})
  2. Misleading examples of outputs in section 5: description indicates direct output but implementation suggests output of first function being an array
def senthill((AreaCode, Prefix, Body):
    return Phone(area_code=AreaCode, prefix=Prefix, body=Body, fax=False)

def phone(p):
    return p[0]
  1. "basic phone" returns a list and "fax phone" returns the first element: this does not match with section 6
def basic_phone(p):
    return p

def fax_phone(p):
    return p[0]._replace(fax=True)

...

print(phone_parser('+974-584-5656'))
# => [phone(area_code='974', prefix='584', body='5656', fax=False)]
print(phone_parser('Fax: +974-584-5656'))
# => [phone(area_code='974', prefix='584', body='5656', fax=True)]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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