Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevn sobolevn commented Jan 5, 2022

Things I've changed:

  1. Used MONDAY constant everywhere 0 was used as a default day. It is way more readable, you don't have to guess what 0 is in this context.
  2. I've added all day constants to __all__, this is the only thing I doubt. I don't know what policy is about __all__, so this can be reverted if I am not correct. But, initially I though that it is useful to have them when from calendar import * and this way they are automatically tested by test__all__
  3. Since they are now in __all__, I've updated the test case. Now we check that they are still present
  4. Docs are updated, now :const:MONDAY is clickable

https://bugs.python.org/issue46266



.. class:: Calendar(firstweekday=0)
.. class:: Calendar(firstweekday=MONDAY)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave this as 0.



.. class:: LocaleTextCalendar(firstweekday=0, locale=None)
.. class:: LocaleTextCalendar(firstweekday=MONDAY, locale=None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave all the defaults as 0.



.. class:: LocaleHTMLCalendar(firstweekday=0, locale=None)
.. class:: LocaleHTMLCalendar(firstweekday=MONDAY, locale=None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this one.

Lib/calendar.py Outdated
"""

def __init__(self, firstweekday=0):
def __init__(self, firstweekday=MONDAY):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave all of these as 0 as well.

Lib/calendar.py Outdated
"""

def __init__(self, firstweekday=0, locale=None):
def __init__(self, firstweekday=MONDAY, locale=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too.

Lib/calendar.py Outdated
month and weekday names in the specified locale.
"""
def __init__(self, firstweekday=0, locale=None):
def __init__(self, firstweekday=MONDAY, locale=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@sobolevn
Copy link
Member Author

sobolevn commented Jan 5, 2022

Thanks for the review!

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@rhettinger: please review the changes made to this pull request.

@rhettinger rhettinger merged commit e5894ca into python:main Jan 5, 2022
@sobolevn
Copy link
Member Author

sobolevn commented Jan 5, 2022

Thank you, @rhettinger! 👍

@rhettinger rhettinger added the needs backport to 3.10 only security fixes label Jan 5, 2022
@miss-islington
Copy link
Contributor

Thanks @sobolevn for the PR, and @rhettinger for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-30424 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jan 5, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 5, 2022
)

(cherry picked from commit e5894ca)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
vstinner pushed a commit that referenced this pull request Jan 23, 2022
…H-30424)

(cherry picked from commit e5894ca)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants