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

Fix PC encoding for Brazil #36

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

willidert
Copy link

@willidert willidert commented Apr 13, 2020

The geonames does not work for all CEPs in Brazil. I added a function that checks if the zip code is valid for geonames.

Closes #30

@rth
Copy link
Member

rth commented Apr 18, 2020

Thanks @willidert . We could add optional validation via the query_postal_code(..., validate=True) parameter, however it would need to be extensively tested to pass on all postal codes in the DB and fail on a few counter examples (see test_pgeocode.py for examples of test).

For now this is a 1 file package (pgeocode.py) with test_pgeocode.py for unit tests. So this PR should only change these two files.

To fix merge conflicts please use back see https://github.com/symerio/pgeocode/blob/master/doc/contributing.rst#code-style for more details.

test_pgeocode.py Outdated Show resolved Hide resolved
@rth
Copy link
Member

rth commented Apr 18, 2020

Also if we want to do this check, the mechanism needs to be generic enough so it can be easily extended to other countries. Maybe something like,

class _CheckPostalCode:
    def __init__(self, country):
        self.country = country

    def __call__(self, postal_code):
        if self.country == "BR":
           ...
        else:
           raise NotImplementedError

@willidert
Copy link
Author

hi @rth , i've been a little busy, sorry. I'll make the changes. Thank you very much for the suggestions and support.

@willidert willidert closed this Oct 11, 2020
@willidert
Copy link
Author

Sorry, i have problems with github actions.

@willidert willidert reopened this Oct 11, 2020
@willidert willidert requested a review from rth October 11, 2020 23:17
@willidert
Copy link
Author

Thx for the opportunity, I hope it helped. I had a little difficulty in the tests. I'm sorry if something is strange. I am available for any correction.

@rth rth changed the title Issue 30 - trying solve Fix PC encoding for Brazil Dec 13, 2022
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

Successfully merging this pull request may close these issues.

Pgeocode not working for Brazil Z.P.
2 participants