arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.71k stars 673 forks source link

Restore datetime constructor type acceptability in factory.get() #943

Closed f0rk closed 3 years ago

f0rk commented 3 years ago

Pull Request Checklist

Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

Description of Changes

Fixes https://github.com/arrow-py/arrow/issues/942

codecov[bot] commented 3 years ago

Codecov Report

Merging #943 (cd1de8c) into master (ce69c31) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #943   +/-   ##
=======================================
  Coverage   99.73%   99.73%           
=======================================
  Files          10       10           
  Lines        1897     1899    +2     
  Branches      311      311           
=======================================
+ Hits         1892     1894    +2     
  Misses          4        4           
  Partials        1        1           
Impacted Files Coverage Δ
arrow/api.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ce69c31...cd1de8c. Read the comment docs.

f0rk commented 3 years ago

@systemcatch updated the definition to allow for a varying number of int arguments. read the commit message and let me know if you'd like a stricter but more verbose approach

systemcatch commented 3 years ago

@f0rk I'm happy with your approach, @jadchaar good to merge here?

systemcatch commented 3 years ago

@jadchaar looks good to me after some test cases.

(arrow) chris@Z490:~/arrow$ cat lol.py 
import arrow

arrow.get(2021, 3, 9)
arrow.get(2021, 3, 9, 5)
arrow.get(2021, 3, 9, 5, 10)
arrow.get(2021, 3, 9, 5, 10, 49)
arrow.get(2021, 3, 9, 5, 10, 49, 546)
arrow.get(2021, 3, 9, 5, 10, 49, 546, tzinfo="Europe/Madrid")

(arrow) chris@Z490:~/arrow$ mypy lol.py 
Success: no issues found in 1 source file