-
Notifications
You must be signed in to change notification settings - Fork 38
simplify 'no expiration' #363
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
base: main
Are you sure you want to change the base?
Conversation
1b2ccf3 to
cacb617
Compare
Instead of having 2050-01-01 as 'magic no expiration date', just leave this field out.
cacb617 to
3d7ed77
Compare
| for name, refs in actions.items() | ||
| for ref, details in refs.items() | ||
| if date.today() < details.get("expires_at") or details.get("keep") | ||
| if (not details or "expires_at" not in details or date.today() < details["expires_at"]) or details.get("keep") |
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.
Just for my personal Python education...
Can details actually be None? (similar in L151 + L162)
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.
yes, it looks like the yaml parser we're using turns a key without any children into None instead of an empty dict. I guess that makes sense since at the yaml level it's not possible to distinguish between "a key without a value" and "a key without children". To make this nicer we'd have to do some kind of 'model-based yaml parsing', which might not be worth it.
|
|
||
| import ruyaml | ||
|
|
||
| indefinitely = date(2050, 1, 1) |
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.
👍
snazy
left a comment
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.
LGTM - thanks for the clarification!
+1
Instead of having 2050-01-01 as 'magic no expiration date', just leave this field out.