Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from datetime import timedelta 

2 

3from pendulum.utils._compat import PY2 

4from pendulum.utils._compat import encode 

5 

6 

7class TransitionType: 

8 def __init__(self, offset, is_dst, abbr): 

9 self._offset = offset 

10 self._is_dst = is_dst 

11 self._abbr = abbr 

12 

13 self._utcoffset = timedelta(seconds=offset) 

14 

15 @property 

16 def offset(self): # type: () -> int 

17 return self._offset 

18 

19 @property 

20 def abbreviation(self): # type: () -> str 

21 if PY2: 

22 return encode(self._abbr) 

23 

24 return self._abbr 

25 

26 def is_dst(self): # type: () -> bool 

27 return self._is_dst 

28 

29 def utcoffset(self): # type: () -> timedelta 

30 return self._utcoffset 

31 

32 def __repr__(self): # type: () -> str 

33 return "TransitionType({}, {}, {})".format( 

34 self._offset, self._is_dst, self._abbr 

35 )