-
Notifications
You must be signed in to change notification settings - Fork 39
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
Clarify expression alias logic #110
Conversation
ExpressionAlias = namedtuple('ExpressionAlias', 'regular, hashed') | ||
|
||
# Non-standard expression aliases | ||
EXPR_ALIASES = { |
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.
Also pulls this up into the module scope so we're not redeclaring this mapping every time
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.
moving the aliases top module level would be ok, but not in favor of a namedtuple because users shall be allowed to update easily the aliases.
Another problem is that this change is not at all retrocompatible. To allow retrocompat, maybe using a class attribute that dictcopy the module level one would be a solution.
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.
Damn, the above comment was not validated, so you didnt saw it... sorry :(
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.
users shall be allowed to update easily the aliases.
What makes it difficult to update the aliases because we're using a named tuple? Could you share an example of what you're thinking that is more difficult?
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.
dict are mutable, not namedtuple.
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.
You could just replace it like this though right
# Replace alias with whatever you want
EXPR_ALIASES['@midnight'] = ExpressionAlias("1 2 * * *", "h h * * *")
0d4b136
to
dd01378
Compare
06366ef
to
fcf5ff8
Compare
dd01378
to
dc080ae
Compare
Updated to fix remove the conflict |
oups, the other pr i just merged broke it again :( :) . |
I'll get it fixed after I get the black formatting done :) |
Instead of using tuple indexing use a namedtuple mapped from the expression aliases. This makes readability / understanding of this logic a little easier.
dc080ae
to
e051743
Compare
Going to close this one out since this one's a bit controversial. Feel free to pull from parts of it though if you'd like! |
When i started to review #136 & & #135, what i saw is that it will be hard for someone else to do the relevant changes and so i started to do it myself as some spaghetti code that needs to be removed to implement clearly DST :-/. TBH, i though i could finish DST rework, i have NOW a large diff which is on the go locally, but is not finished yet. I hope to finish that soon with a better state that it is now. |
Instead of using tuple indexing use a namedtuple mapped from the expression aliases. This makes readability / understanding of this logic a little easier.