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