-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Add sign
and weekday
attributes to vWeekday
components
#750
Conversation
Pull Request Test Coverage Report for Build 12054469339Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
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.
Hi, I like your PR! I left a bot of feedback and I am wondering if the sign should be integrated into the relative variable. What are your thoughts on this?
Also, I am wondering what the sign means and since you care about the sign, I would hope you know and we can document it so others know how to use the fix.
Let me know what you think!
Thanks for the tests!
|
||
|
||
def test_simple(): | ||
weekday = vWeekday("SU") |
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 like these examples from the tests.
We also have doctests.
If you add some examples to class definition, this will help people understand your fix and how to use this class.
Like:
>>> su = vWeekday("SU") # Sunday
>>> su
>>> su.weekday
>>> su.relative
>>> su.to_ical()
>>> th = vWeekday("2TH") # second Thursday of the month?
>>> th
>>> th.weekday
>>> th.relative
>>> th.to_ical()
>>> fr = vWeekday("-1FR") # last Friday of the month?
>>> fr
>>> fr.weekday
>>> fr.relative
I am writing this here because I would like your input: What does -1 mean in your view? Is it the last weekday of the month?
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. For example, this rrule would repeat monthly on every last friday: FREQ=MONTHLY;BYDAY=-1FR
. I think using a relative BYDAY value is also allowed with a yearly frequency (rfc, page 42)
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.
It might be nice to extend the rrule documentation, too. I would say though that I open another issue for that.
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 have updated the docstring and added some doctests now :)
I have one more question: According to rfc 5545, the Wouldn't it make sense to have two different classes for weekdays then? One that only stores a weekday and one that stores a weekday and a number. Right now, icalendar always allows the number, I think. |
I think, this is good. One can always create invalid files. this package does not check validity. |
This pr adds the
sign
andweekday
properties tovWeekday
components, so that users of this library don't have to manually parse these.I decided to just make the existing variables available, but I could also combine
sign
andrelative
into one variable, if that is wanted.Fixes: #749
📚 Documentation preview 📚: https://icalendar--750.org.readthedocs.build/