Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-103636: add enums for days and months in calendar module#103642

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanfurman merged 7 commits intopython:mainfromAgent-Hellboy:fix-issue-103636
Apr 25, 2023

Conversation

Agent-Hellboy
Copy link
Contributor

@Agent-HellboyAgent-Hellboy commentedApr 20, 2023
edited by bedevere-bot
Loading

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@merwokmerwok changed the titlegh-103636: Convert Calander consts to enum and add consts for monthsgh-103636: add enums for days and months in calendar moduleApr 20, 2023
@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@arhadthedevarhadthedev added the stdlibPython modules in the Lib dir labelApr 20, 2023
@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@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 phraseI 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.

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@Agent-Hellboy
Copy link
ContributorAuthor

Agent-Hellboy commentedApr 20, 2023
edited
Loading

I have made the requested changes; please review again
and I have kept

# Constants for months referenced laterJanuary = 1February = 2

as it is

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@Agent-Hellboy
Copy link
ContributorAuthor

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

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

@sunmy2019
Copy link
Member

what should I do?

If you think test cases are necessary, add what you expect users to do.
eg.

forminMonth:calendar.weekday(2021,m,2)==calendar.weekday(2021,m.value,2)

though I think this change is okay with no test case.

Agent-Hellboy reacted with thumbs up emoji

@Agent-Hellboy
Copy link
ContributorAuthor

though I think this change is okay with no test case.

Yes, if you want i can change the return type of function returning 0-6 for days to enum , if not then i guess this is okay without test.

@Agent-Hellboy
Copy link
ContributorAuthor

Agent-Hellboy commentedApr 22, 2023
edited
Loading

Hi@sunmy2019 ,@hugovk
should we raise a deprecation warning forJanuary, February

deprecated_names= ['January','February']def__getattr__(name):print(name)ifnameindeprecated_names:warnings.warn(f"{name} is deprecated",DeprecationWarning)returnname

I picked the code fromhttps://peps.python.org/pep-0562/

why name is picking__path__?

@sunmy2019
Copy link
Member

Hi@sunmy2019 ,@hugovk should we raise a deprecation warning forJanuary, February

The question is, are we gonna deprecate these two names.


My opinion:

I think it's better to directly removeJanuary andFebruary since they weren't in__all__ before. They are never in the public API.

We don't need to provide compatibility over non-public names unless it is widely used by others. No one should use these names since only 2 of the 12 months exist.


But since@ethanfurman requested "as-is". I would interpret it as "Do not change these things, and we are not going to deprecate them for compatibility".

@Agent-Hellboy
Copy link
ContributorAuthor

Agent-Hellboy commentedApr 22, 2023
edited
Loading

But since@ethanfurman requested "as-is". I would interpret it as "Do not change these things, and we are not going to deprecate them for compatibility".

okay, sure

Btw, I got it why doesn't it worksin Python 3.12, __getattr__ is not getting called for module-level attributes

@ambv
Copy link
Contributor

The "DO-NOT-MERGE / unresolved review" check is there to denote outstanding red code review.

@ethanfurman
Copy link
Member

But since@ethanfurman requested "as-is". I would interpret it as "Do not change these things, and we are not going to deprecate them for compatibility".

My apologies, that was a misunderstanding -- I meant the initial change was fine as-is (in other words, no need to make the same change as above by iterating directly overMonth).

Please put that change back in place, and remove theJanuary andFebruary constants.

Copy link
Member

@ethanfurmanethanfurman left a comment

Choose a reason for hiding this comment

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

Please restore the change I had confusingly labeled "leave as-is" and remove theJanuary andFebruary constants.

@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 phraseI 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.

@Agent-Hellboy
Copy link
ContributorAuthor

I have made the requested changes; please review again

I guess the below error is not related to the change

D:\a\1\s\Modules\_tkinter.c(53,10): fatal  error C1083: Cannot open include file: 'tcl.h': No such file or directory [D:\a\1\s\PCbuild\_tkinter.vcxproj]D:\a\1\s\Modules\tkappinit.c(16,10): fatal  error C1083: Cannot open include file: 'tcl.h': No such file or directory [D:\a\1\s\PCbuild\_tkinter.vcxproj]    0 Warning(s)    75 Error(s)Time Elapsed 00:04:34.47##[error]Cmd.exe exited with code '1'.Finishing: Build CPython

@bedevere-bot
Copy link

Thanks for making the requested changes!

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

Copy link
Member

@ethanfurmanethanfurman left a comment

Choose a reason for hiding this comment

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

Looks good! We can commit what you've done so far, or, if you want to keep going, you can modify any function that is currently just returning anint to return the appropriateMonth orDay instead.

@Agent-Hellboy
Copy link
ContributorAuthor

Thanks@ethanfurman, I can create a new PR for the same

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@hugovkhugovkhugovk left review comments

@TeamSpen210TeamSpen210TeamSpen210 left review comments

@AA-TurnerAA-TurnerAA-Turner left review comments

@sunmy2019sunmy2019sunmy2019 requested changes

@Eclips4Eclips4Eclips4 left review comments

@ethanfurmanethanfurmanethanfurman approved these changes

Assignees
No one assigned
Labels
stdlibPython modules in the Lib dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

10 participants
@Agent-Hellboy@bedevere-bot@AA-Turner@sunmy2019@ambv@ethanfurman@hugovk@TeamSpen210@Eclips4@arhadthedev

[8]ページ先頭

©2009-2025 Movatter.jp