opendate 0.1.13__py3-none-any.whl → 0.1.20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of opendate might be problematic. Click here for more details.

date/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = '0.1.13'
1
+ __version__ = '0.1.20'
2
2
 
3
3
  import datetime as _datetime
4
4
 
@@ -15,7 +15,6 @@ from date.date import Date
15
15
  from date.date import DateTime
16
16
  from date.date import Entity
17
17
  from date.date import Interval
18
- from date.date import IntervalError
19
18
  from date.date import LCL
20
19
  from date.date import EST
21
20
  from date.date import GMT
@@ -26,33 +25,69 @@ from date.date import WeekDay
26
25
  from date.date import WEEKDAY_SHORTNAME
27
26
  from date.date import expect_date
28
27
  from date.date import expect_datetime
28
+ from date.date import expect_time
29
+ from date.date import expect_date_or_datetime
29
30
  from date.date import expect_native_timezone
30
31
  from date.date import expect_utc_timezone
31
32
  from date.date import prefer_native_timezone
32
33
  from date.date import prefer_utc_timezone
33
34
  from date.date import Timezone
34
- from date.extras import overlap_days
35
35
  from date.extras import is_business_day
36
36
  from date.extras import is_within_business_hours
37
+ from date.extras import overlap_days
37
38
 
38
39
 
39
40
  timezone = Timezone
40
41
 
41
42
 
42
- def date(*args, **kwargs):
43
- return Date(*args, **kwargs)
44
-
45
-
46
- def datetime(*args, **kwargs):
47
- return DateTime(*args, **kwargs)
48
-
49
-
50
- def time(*args, **kwargs):
51
- return Time(*args, **kwargs)
43
+ def date(year: int, month: int, day: int) -> Date:
44
+ """Create new Date
45
+ """
46
+ return Date(year, month, day)
47
+
48
+
49
+ def datetime(
50
+ year: int,
51
+ month: int,
52
+ day: int,
53
+ hour: int = 0,
54
+ minute: int = 0,
55
+ second: int = 0,
56
+ microsecond: int = 0,
57
+ tzinfo: str | float | _zoneinfo.ZoneInfo | _datetime.tzinfo | None = UTC, # note that this is different from our DateTime
58
+ fold: int = 0, # different from pendulum
59
+ ) -> DateTime:
60
+ """Create new DateTime
61
+ """
62
+ return DateTime(
63
+ year,
64
+ month,
65
+ day,
66
+ hour=hour,
67
+ minute=minute,
68
+ second=second,
69
+ microsecond=microsecond,
70
+ tzinfo=tzinfo,
71
+ fold=fold,
72
+ )
73
+
74
+
75
+ def time(
76
+ hour: int,
77
+ minute: int = 0,
78
+ second: int = 0,
79
+ microsecond: int = 0,
80
+ tzinfo: str | float | _zoneinfo.ZoneInfo | _datetime.tzinfo | None = UTC, # review this choice
81
+ ) -> Time:
82
+ """Create new Time
83
+ """
84
+ return Time(hour, minute, second, microsecond, tzinfo)
52
85
 
53
86
 
54
- def interval(*args, **kwargs):
55
- return Interval(*args, **kwargs)
87
+ def interval(self, begdate: Date | DateTime, enddate: Date | DateTime):
88
+ """Create new Interval
89
+ """
90
+ return Interval(begdate, enddate)
56
91
 
57
92
 
58
93
  def parse(s: str | None, fmt: str = None, entity: Entity = NYSE, raise_err: bool = False) -> DateTime | None:
@@ -93,12 +128,13 @@ __all__ = [
93
128
  'Entity',
94
129
  'expect_date',
95
130
  'expect_datetime',
131
+ 'expect_time',
132
+ 'expect_date_or_datetime',
96
133
  'expect_native_timezone',
97
134
  'expect_utc_timezone',
98
135
  'instance',
99
136
  'Interval',
100
137
  'interval',
101
- 'IntervalError',
102
138
  'is_business_day',
103
139
  'is_within_business_hours',
104
140
  'LCL',
@@ -113,4 +149,8 @@ __all__ = [
113
149
  'timezone',
114
150
  'today',
115
151
  'WeekDay',
152
+ 'EST',
153
+ 'GMT',
154
+ 'UTC',
155
+ 'WEEKDAY_SHORTNAME',
116
156
  ]