Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jfthuong opened this issue Jan 20, 2020 · 0 comments
Open

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

jfthuong opened this issue Jan 20, 2020 · 0 comments

Comments

@jfthuong
Copy link

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)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant