opendate 0.1.7__py3-none-any.whl → 0.1.9__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.7'
1
+ __version__ = '0.1.9'
2
2
 
3
3
  import datetime as _datetime
4
4
 
date/date.py CHANGED
@@ -272,20 +272,22 @@ class NYSE(Entity):
272
272
  @staticmethod
273
273
  @lru_cache
274
274
  def business_days(begdate=BEGDATE, enddate=ENDDATE) -> set:
275
- return {d.date() for d in NYSE.calendar.valid_days(begdate, enddate)}
275
+ return {Date.instance(d.date())
276
+ for d in NYSE.calendar.valid_days(begdate, enddate)}
276
277
 
277
278
  @staticmethod
278
279
  @lru_cache
279
280
  def business_hours(begdate=BEGDATE, enddate=ENDDATE) -> dict:
280
281
  df = NYSE.calendar.schedule(begdate, enddate, tz=EST)
281
- open_close = [(o.to_pydatetime(), c.to_pydatetime())
282
+ open_close = [(DateTime.instance(o.to_pydatetime()),
283
+ DateTime.instance(c.to_pydatetime()))
282
284
  for o, c in zip(df.market_open, df.market_close)]
283
285
  return dict(zip(df.index.date, open_close))
284
286
 
285
287
  @staticmethod
286
288
  @lru_cache
287
289
  def business_holidays(begdate=BEGDATE, enddate=ENDDATE) -> set:
288
- return {d.date()
290
+ return {Date.instance(d.date())
289
291
  for d in map(pd.to_datetime, NYSE.calendar.holidays().holidays)
290
292
  if begdate <= d <= enddate}
291
293
 
@@ -1068,19 +1070,20 @@ class Time(_pendulum.Time):
1068
1070
 
1069
1071
  return cls(obj.hour, obj.minute, obj.second, obj.microsecond, tzinfo=tz)
1070
1072
 
1071
- @expect_time
1072
- def astimezone(self, tz: str | _zoneinfo.ZoneInfo | _datetime.tzinfo):
1073
+ def in_timezone(self, tz: str | _zoneinfo.ZoneInfo | _datetime.tzinfo):
1073
1074
  """Convert timezone
1074
1075
 
1075
- >>> Time(12, 0).astimezone(Timezone('America/Sao_Paulo'))
1076
+ >>> Time(12, 0).in_timezone(Timezone('America/Sao_Paulo'))
1076
1077
  Time(9, 0, 0, tzinfo=Timezone('America/Sao_Paulo'))
1077
1078
 
1078
- >>> Time(12, 0, tzinfo=Timezone('Europe/Moscow')).astimezone(Timezone('America/Sao_Paulo'))
1079
+ >>> Time(12, 0, tzinfo=Timezone('Europe/Moscow')).in_timezone(Timezone('America/Sao_Paulo'))
1079
1080
  Time(6, 0, 0, tzinfo=Timezone('America/Sao_Paulo'))
1080
1081
 
1081
1082
  """
1082
1083
  _dt = DateTime.combine(Date.today(), self, tzinfo=self.tzinfo or UTC)
1083
- return _dt.astimezone(tz).time()
1084
+ return _dt.in_timezone(tz).time()
1085
+
1086
+ in_tz = in_timezone
1084
1087
 
1085
1088
 
1086
1089
  class DateTime(DateBusinessMixin, _pendulum.DateTime):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opendate
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Python business datetimes
5
5
  Home-page: https://github.com/bissli/opendate
6
6
  License: MIT
@@ -0,0 +1,7 @@
1
+ date/__init__.py,sha256=GDGA1vmGaVFgt_Fi2ffsxlVdJ837_jW07k_v-O0au6g,2747
2
+ date/date.py,sha256=h9dgscFbeTbSaUDr4qgv-2X6lDiT3Co44wlyDe38Y1o,56603
3
+ date/extras.py,sha256=7xsOsdhKrmGoyLl5W4Xhg9TfuytaaIH7uKWW9PvR5sE,2832
4
+ opendate-0.1.9.dist-info/LICENSE,sha256=V4Rx8WWy7v8Fim6PHcEBszpZkDLbCHeorz1e_gr0Cbk,1111
5
+ opendate-0.1.9.dist-info/METADATA,sha256=7k56td4xBEyV0VC5Ky8K7BN-ihvD2QMSMt_mUb2LZWY,1841
6
+ opendate-0.1.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
+ opendate-0.1.9.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- date/__init__.py,sha256=Y89D6EmdQGQtJJ249F5ntB03zBzRrIvJauMtl7O1TNU,2747
2
- date/date.py,sha256=PFB5JUxNSglg-9wYlb7Ls1xtrZE6KgAa6lppJPu-S4I,56484
3
- date/extras.py,sha256=7xsOsdhKrmGoyLl5W4Xhg9TfuytaaIH7uKWW9PvR5sE,2832
4
- opendate-0.1.7.dist-info/LICENSE,sha256=V4Rx8WWy7v8Fim6PHcEBszpZkDLbCHeorz1e_gr0Cbk,1111
5
- opendate-0.1.7.dist-info/METADATA,sha256=C-bSRlSw0LmDwt-ayIwf21FTX18VxnWWCjcVYEUI5CM,1841
6
- opendate-0.1.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
- opendate-0.1.7.dist-info/RECORD,,