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

Overhaul many things #11

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

NickCrews
Copy link

@NickCrews NickCrews commented Apr 6, 2022

See CHANGELOG.md for the big-picture of what has changed.

Hopefully this isn't too overwhelming. Each commit individually is pretty small and probably understandable. First I would read the CHANGELOG for a high level, and then just browse through each commit individually, they pretty much are self-explanatory. Occasionally I forgot to adjust a test or documentation at the same time as the actual change, but then I went back later and corrected them.

See https://github.com/NickCrews/pyusps/actions?query=branch%3Areturn-errors for an example of what the CI runs look like.

See thelinuxkid#10

Switching away from *args makes it so that
single inputs are handled consistently.
Otherwise, users won't know what sort of response
to expect from passing a single input:
Will they get a single item back, or a list
of length one?
Just make it so you always pass a list.

Or, in fact, make it so that this accepts any iterable, not just a list
or some other iterable with a __len__ method.
Only used inside this one function, so put it there.
See thelinuxkid#10

- still allows you to catch ValueErrors
- still acts just like a ValueError
- Differentiates between errors from USPS,
  and the ValueError you get if you supply more than 5 addresses
dicts are ordered in any recent version of python,
so just use them.

This also fixes up the README to be up to date with the previous
changes.
Before we raised an error when the USPS API
freacked out about the bad XML,
but really this should be fine, just return
an empty list

This also adds a test for the previous change, where we
support iterables of inputs, not just sized ones.
These old error types really don't make sense per their
intended use described at
https://docs.python.org/3/library/exceptions.html#bltin-exceptions

Also update the README to be up to date with previous changes.
IDK why it includes that, but it does.
Before each input had to have the `get()` method,
but now it only needs the `__getitem__()` method.
@NickCrews
Copy link
Author

@thelinuxkid here is a PR, let me know if this is too big for you to look at at once, I can cut it down into smaller PRs if so. Thanks for taking a look!

@thelinuxkid
Copy link
Owner

Thanks Nick. Give me a few days to take a look at this.

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.

None yet

2 participants