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: issue warning for deprecated calendar constants#103833

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
Merged
Changes from1 commit
Commits
Show all changes
21 commits
Select commitHold shift + click to select a range
175dadf
gh-103636: raise warning for January and February attribute
Agent-HellboyApr 25, 2023
97436c8
add test
Agent-HellboyApr 26, 2023
e6f2a2f
📜🤖 Added by blurb_it.
blurb-it[bot]Apr 26, 2023
5a4d0a7
update docs for depration warning and new additions
Agent-HellboyApr 26, 2023
ddcdc43
dedent line in calendar test
Agent-HellboyApr 26, 2023
794dddc
fix doc
Agent-HellboyApr 26, 2023
717cea8
fix doc
Agent-HellboyApr 26, 2023
b2c13e8
fix doc
Agent-HellboyApr 26, 2023
029844f
fix doc
Agent-HellboyApr 26, 2023
0c52a19
fix doc
Agent-HellboyApr 26, 2023
ac783cf
fix spacing
merwokApr 26, 2023
a18a064
Merge branch 'main' into raise-warning-in-calendar-mod
merwokApr 26, 2023
e002e10
fix grametical mistake
Agent-HellboyApr 27, 2023
57ee1f9
Apply suggestions from code review
Agent-HellboyApr 27, 2023
cdcb22a
arrange module in alphabetical order in whats new
Agent-HellboyApr 27, 2023
49079d1
Update Doc/whatsnew/3.12.rst
Agent-HellboyApr 27, 2023
db53e78
Update Doc/whatsnew/3.12.rst
Agent-HellboyApr 27, 2023
9c289c5
fix doc
Agent-HellboyApr 27, 2023
4b497b2
Merge branch 'main' into raise-warning-in-calendar-mod
merwokApr 27, 2023
7ec1945
Update Doc/library/calendar.rst
Agent-HellboyApr 28, 2023
7628f11
Update Doc/library/calendar.rst
Agent-HellboyApr 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
gh-103636: raise warning for January and February attribute
  • Loading branch information
@Agent-Hellboy
Agent-Hellboy committedApr 25, 2023
commit175dadf4e8f23ec026e676be73fddee69a3b181a
14 changes: 14 additions & 0 deletionsLib/calendar.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@
from enum import IntEnum, global_enum
import locale as _locale
from itertools import repeat
import warnings

__all__ = ["IllegalMonthError", "IllegalWeekdayError", "setfirstweekday",
"firstweekday", "isleap", "leapdays", "weekday", "monthrange",
Expand DownExpand Up@@ -41,6 +42,18 @@ def __str__(self):
return "bad weekday number %r; must be 0 (Monday) to 6 (Sunday)" % self.weekday


def __getattr__(name):
if name in ['January','February']:
warnings.warn(f"The '{name}' attribute is going to be deprecated use '{name.upper()}' instead",
DeprecationWarning,
stacklevel=2)
if name == 'January':
return JANUARY
else:
return FEBRUARY

raise AttributeError(f"module {__name__} has no attribute {name}")

# Constants for months
@global_enum
class Month(IntEnum):
Expand DownExpand Up@@ -71,6 +84,7 @@ class Day(IntEnum):




# Number of days per month (except for February in leap years)
mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp