Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/dateutil/_common.py @ 2:6af9afd405e9 draft
"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
| author | shellac |
|---|---|
| date | Thu, 14 May 2020 14:56:58 -0400 |
| parents | 26e78fe6e8c4 |
| children |
comparison
equal
deleted
inserted
replaced
| 1:75ca89e9b81c | 2:6af9afd405e9 |
|---|---|
| 1 """ | |
| 2 Common code used in multiple modules. | |
| 3 """ | |
| 4 | |
| 5 | |
| 6 class weekday(object): | |
| 7 __slots__ = ["weekday", "n"] | |
| 8 | |
| 9 def __init__(self, weekday, n=None): | |
| 10 self.weekday = weekday | |
| 11 self.n = n | |
| 12 | |
| 13 def __call__(self, n): | |
| 14 if n == self.n: | |
| 15 return self | |
| 16 else: | |
| 17 return self.__class__(self.weekday, n) | |
| 18 | |
| 19 def __eq__(self, other): | |
| 20 try: | |
| 21 if self.weekday != other.weekday or self.n != other.n: | |
| 22 return False | |
| 23 except AttributeError: | |
| 24 return False | |
| 25 return True | |
| 26 | |
| 27 def __hash__(self): | |
| 28 return hash(( | |
| 29 self.weekday, | |
| 30 self.n, | |
| 31 )) | |
| 32 | |
| 33 def __ne__(self, other): | |
| 34 return not (self == other) | |
| 35 | |
| 36 def __repr__(self): | |
| 37 s = ("MO", "TU", "WE", "TH", "FR", "SA", "SU")[self.weekday] | |
| 38 if not self.n: | |
| 39 return s | |
| 40 else: | |
| 41 return "%s(%+d)" % (s, self.n) | |
| 42 | |
| 43 # vim:ts=4:sw=4:et |
