Title: Incomplete types for now(tz=...) methods · Issue #607 · python-pendulum/pendulum · GitHub
Open Graph Title: Incomplete types for now(tz=...) methods · Issue #607 · python-pendulum/pendulum
X Title: Incomplete types for now(tz=...) methods · Issue #607 · python-pendulum/pendulum
Description: I am on the latest Pendulum version. I have searched the issues of this repo and believe that this is not a duplicate. OS version and name: n/a Pendulum version: 2.1.2 Issue The functions pendulum.now and DateTime.now are currently typed...
Open Graph Description: I am on the latest Pendulum version. I have searched the issues of this repo and believe that this is not a duplicate. OS version and name: n/a Pendulum version: 2.1.2 Issue The functions pendulum....
X Description: I am on the latest Pendulum version. I have searched the issues of this repo and believe that this is not a duplicate. OS version and name: n/a Pendulum version: 2.1.2 Issue The functions pendulum....
Opengraph URL: https://github.com/python-pendulum/pendulum/issues/607
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incomplete types for now(tz=...) methods","articleBody":"- [x] I am on the [latest](https://github.com/sdispater/pendulum/releases/latest) Pendulum version.\r\n- [x] I have searched the [issues](https://github.com/sdispater/pendulum/issues) of this repo and believe that this is not a duplicate.\r\n\r\n- **OS version and name**: n/a\r\n- **Pendulum version**: 2.1.2\r\n\r\n## Issue\r\nThe functions `pendulum.now` and `DateTime.now` are currently typed with\r\n```python\r\nOptional[Union[str, _Timezone]]\r\n```\r\nHowever, the underlying `_safe_timezone` function also accepts `int` and `float`. (Though, _it's_ type doesn't declare `int`, only `float`, that should be okay because of mypy's duck typing...)\r\n\r\nI'm pretty sure [Line 201](https://github.com/sdispater/pendulum/blob/master/pendulum/__init__.py#L201) should be changed to\r\n```python\r\ndef now(tz: Optional[Union[str, float, Timezone]] = None) -> DateTime:\r\n```\r\nand [Line 118](https://github.com/sdispater/pendulum/blob/master/pendulum/datetime.py#L118) should be changed to\r\n```python\r\n def now(cls, tz: Optional[Union[str, float, Timezone]] = None) -> \"DateTime\":\r\n```\r\n\r\nThese also may need to include `_datetime.tzinfo`, but I wasn't sure about the indirect import.","author":{"url":"https://github.com/mfulgo","@type":"Person","name":"mfulgo"},"datePublished":"2022-03-09T22:08:28Z","url":"https://github.com/python-pendulum/pendulum/issues/607"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:938b45fd-27cf-82a3-c15e-36ba50cc8ad3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9FA0:17C468:ABF90:EDC4A:6B046332 |
| html-safe-nonce | 0c89fda8320e05f155f6fe930af980a849ace962eed7e7fa1e93a2d3947d07eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RkEwOjE3QzQ2ODpBQkY5MDpFREM0QTo2QjA0NjMzMiIsInZpc2l0b3JfaWQiOiI2ODgxMjc4NjcyMjM0NjM2MDgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8581ad8c24fcd95153c5f22851d78192b8184bd5956d5ae25288eae625287baa |
| hovercard-subject-tag | issue:1164491983 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-pendulum/pendulum/607/issue_layout |
| twitter:image | https://opengraph.githubassets.com/118d72e0db7e57aa204a636f18a3cd5902f5a60d6ecbcabb9d130878094b38c7/python-pendulum/pendulum/issues/607 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/118d72e0db7e57aa204a636f18a3cd5902f5a60d6ecbcabb9d130878094b38c7/python-pendulum/pendulum/issues/607 |
| og:image:alt | I am on the latest Pendulum version. I have searched the issues of this repo and believe that this is not a duplicate. OS version and name: n/a Pendulum version: 2.1.2 Issue The functions pendulum.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mfulgo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-pendulum/pendulum git https://github.com/python-pendulum/pendulum.git |
| octolytics-dimension-user_id | 191041900 |
| octolytics-dimension-user_login | python-pendulum |
| octolytics-dimension-repository_id | 62095504 |
| octolytics-dimension-repository_nwo | python-pendulum/pendulum |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 62095504 |
| octolytics-dimension-repository_network_root_nwo | python-pendulum/pendulum |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03e114520787ad27289207f153520ef97461127c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width