-
Notifications
You must be signed in to change notification settings - Fork 44
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
Allow partial reads and align with GTFS specifications for stop_lat, stop_long, and transfer_type #68
base: master
Are you sure you want to change the base?
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.
Thank you so much for the contribution!
pygtfs/gtfs_entities.py
Outdated
@@ -70,6 +70,8 @@ def in_range(self, key, value): | |||
def _validate_float_range(float_min, float_max, *field_names): | |||
@validates(*field_names) | |||
def in_range(self, key, value): | |||
if value is None: |
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.
Doesn't this make all of the in_range
validated fields nullable? What am I missing?
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.
Since some floats are nullable, this rule was previously too strict, but you're right- this solution may be overly broad.
I can look into adding a nullable
argument so this check won't fail only for nullable columns.
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.
Please check this, I think I've made the necessary change to at least allow a check on nullable columns. I still need to make it conditional on the value of another column (but I'm new to sqlalchemy)
Do you have any examples where you've successfully performed conditional checks? The checks I see only require one column at a time. For
|
No I don't have examples for that. I guess we can simply be lenient here.. I'm not a fan of standards with optional required fields. |
I'm not sure if you're interested in this change of behavior, but it may be valuable to read a GTFS file partially instead of failing due to a single malformed record.
Additionally, changed validators to match reference
4
and5
astransfer_type
stop_lat
andstop_long