-
Notifications
You must be signed in to change notification settings - Fork 75
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
Improve API #140
Improve API #140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Looks like the line length needs to be bumped in flake checks.
-
siphon.ncss.NCSS
import unused in examples
siphon/catalog.py
Outdated
from netCDF4 import Dataset as NC4Dataset | ||
provider = NC4Dataset | ||
except ImportError: | ||
raise ValueError('OPENDAP access requires netCDF4-python to be installed.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be using ModuleNotFoundError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consider it a ValueError
for the specified service, since the user asked for one they can't use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I agree on that still. They CAN use the service (i.e. it's available on the server), but they need a module installed locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, you convinced me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So....ModuleNotFoundError
seems to be Python 3 only. ImportError
?
siphon/catalog.py
Outdated
elif service == 'HTTPServer': | ||
provider = urlopen | ||
else: | ||
raise ValueError(service + ' does not have a built-in handler') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a bit different spelling? not a supported access method in Siphon
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely better. Have gone with: is not an access method supported by Siphon
.
siphon/catalog.py
Outdated
def __getitem__(self, item): | ||
"""Return an item either by index or name.""" | ||
try: | ||
item + '' # Raises if item not a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check the type? It's a bit more look before you leap I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's pretty much it. And I don't like having to figure out what the right type is (though here it's probably basestring
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough
Line length is set to 95 in the configs already. Where am I missing the problem about line length? |
0602949
to
f998fca
Compare
Codacy is loudly complaining about the line length. Can it be silenced? Looks like a few minor flake issues are hanging around. |
e335420
to
6242905
Compare
Found the codacy one, it uses prospector, which is in |
9abe34d
to
4354417
Compare
Looks like we may have to go with |
4354417
to
1cb5123
Compare
Note: Safe to ignore codacy - does not approve of Ryan's ask-forgiveness string type check. |
And QuantifiedCode wants me to document an internal method. |
6d5c28a
to
120afd5
Compare
Coverage just showed me that I was doing cdmremote wrong...oops. MOAR TESTS! |
120afd5
to
8104f3a
Compare
Do you guys generally do reviews before or after the automated tests are passing? |
Some of both? In general it's fine to do before, since review is more about catching things the computers don't catch, especially for us who do this a lot. |
Not to mention, as backed up as AppVeyor is on our account right now, it's likely I can address any comments now before this PR runs again... |
When getting an item by string, work as before. For all else, treat as an index into values. Works for catalog refs as well.
Parses the keys for datasets and catalog refs and extracts a datetime using a regex. Then filter using nearest time or a time range.
This gives access to the latest dataset. Partially addresses Unidata#137.
Catchlog was dumping way to much output.
8104f3a
to
3ada1e8
Compare
A lot of changes to smooth over the API:
latest
attribute to simplify access to latest dataset (Add latest, etc. attributes to Dataset #137)This leaves adding the
format
option tosubset
to future work. I also punted on best/collection since those aren't easily programmatically determined.