44
55import calendar
66import datetime
7- import warnings
87
98from .date import Date
109from .time import Time
2019 MINUTES_PER_HOUR , SECONDS_PER_MINUTE ,
2120 SECONDS_PER_DAY
2221)
23- from .utils import CallableTimestamp
2422
2523
2624class Pendulum (Date , datetime .datetime ):
@@ -378,57 +376,6 @@ def create(cls, year=None, month=None, day=None,
378376
379377 return cls .instance (dt , tz )
380378
381- @classmethod
382- def create_from_date (cls , year = None , month = None , day = None , tz = 'UTC' ):
383- """
384- Create a Pendulum instance from just a date.
385- The time portion is set to 00:00:00.
386-
387- :type year: int
388- :type month: int
389- :type day: int
390- :type tz: tzinfo or str or None
391-
392- :rtype: Pendulum
393- """
394- warnings .warn (
395- 'create_from_date() is deprecated. '
396- 'It will be removed in the next major version. '
397- 'Use create(year, month, day) instead.' ,
398- category = DeprecationWarning ,
399- stacklevel = 2
400- )
401-
402- return cls .create (year , month , day , tz = tz )
403-
404- @classmethod
405- def create_from_time (cls , hour = 0 , minute = 0 , second = 0 ,
406- microsecond = 0 , tz = 'UTC' ):
407- """
408- Create a Pendulum instance from just a time.
409- The date portion is set to today.
410-
411- :type hour: int
412- :type minute: int
413- :type second: int
414- :type microsecond: int
415- :type tz: tzinfo or str or int or None
416-
417- :rtype: Pendulum
418- """
419- warnings .warn (
420- 'create_from_time() is deprecated. '
421- 'It will be removed in the next major version. '
422- 'Use create(hour=hour, minute=minute, second=second) instead.' ,
423- category = DeprecationWarning ,
424- stacklevel = 2
425- )
426-
427- return cls .now (tz ).replace (
428- hour = hour , minute = minute , second = second ,
429- microsecond = microsecond
430- )
431-
432379 @classmethod
433380 def create_from_format (cls , time , fmt , tz = UTC ):
434381 """
@@ -554,15 +501,11 @@ def tzinfo(self):
554501 def fold (self ):
555502 return self ._fold
556503
557- @property
558504 def timestamp (self ):
559505 if self ._timestamp is None :
560506 delta = self ._datetime - self ._EPOCH
561507
562- self ._timestamp = CallableTimestamp (
563- delta .days * SECONDS_PER_DAY + delta .seconds
564- )
565- self ._timestamp .set_float (delta .total_seconds ())
508+ self ._timestamp = delta .total_seconds ()
566509
567510 return self ._timestamp
568511
@@ -648,29 +591,6 @@ def on(self, year, month, day):
648591 year = int (year ), month = int (month ), day = int (day )
649592 )
650593
651- def with_date (self , year , month , day ):
652- """
653- Returns a new instance with the current date set to a different date.
654-
655- :param year: The year
656- :type year: int
657-
658- :param month: The month
659- :type month: int
660-
661- :param day: The day
662- :type day: int
663-
664- :rtype: Pendulum
665- """
666- warnings .warn (
667- 'with_date() is deprecated. Use on() instead.' ,
668- category = DeprecationWarning ,
669- stacklevel = 2
670- )
671-
672- return self .on (year , month , day )
673-
674594 def at (self , hour , minute , second , microsecond = 0 ):
675595 """
676596 Returns a new instance with the current time to a different time.
@@ -694,32 +614,6 @@ def at(self, hour, minute, second, microsecond=0):
694614 microsecond = microsecond
695615 )
696616
697- def with_time (self , hour , minute , second , microsecond = 0 ):
698- """
699- Returns a new instance with the current time set to a different time.
700-
701- :param hour: The hour
702- :type hour: int
703-
704- :param minute: The minute
705- :type minute: int
706-
707- :param second: The second
708- :type second: int
709-
710- :param microsecond: The microsecond
711- :type microsecond: int
712-
713- :rtype: Pendulum
714- """
715- warnings .warn (
716- 'with_time() is deprecated. Use at() instead.' ,
717- category = DeprecationWarning ,
718- stacklevel = 2
719- )
720-
721- return self .at (hour , minute , second , microsecond )
722-
723617 def with_date_time (self , year , month , day , hour , minute , second , microsecond = 0 ):
724618 """
725619 Return a new instance with the date and time set to the given values.
0 commit comments