Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
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
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
175dadf97436c8e6f2a2f5a4d0a7ddcdc43794dddc717cea8b2c13e8029844f0c52a19ac783cfa18a064e002e1057ee1f9cdcb22a49079d1db53e789c289c54b497b27ec19457628f11File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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", | ||
| @@ -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']: | ||
Agent-Hellboy marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| warnings.warn(f"The '{name}' attribute is going to be deprecated use '{name.upper()}' instead", | ||
Agent-Hellboy marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| DeprecationWarning, | ||
| stacklevel=2) | ||
merwok marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| if name == 'January': | ||
| return JANUARY | ||
| else: | ||
| return FEBRUARY | ||
Agent-Hellboy marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| raise AttributeError(f"module {__name__} has no attribute {name}") | ||
Agent-Hellboy marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| # Constants for months | ||
| @global_enum | ||
| class Month(IntEnum): | ||
| @@ -71,6 +84,7 @@ class Day(IntEnum): | ||
merwok marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
Agent-Hellboy marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| # 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] | ||