From 8682c5b8c3271e4cd9cabfb9689aa2f951f49346 Mon Sep 17 00:00:00 2001 From: beenje Date: Tue, 28 Jul 2015 22:46:52 +0200 Subject: [PATCH] Cleanup class methods definition A method not using cls or self should be defined as a static method (not a class method) --- arrow/arrow.py | 8 ++++---- arrow/parser.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arrow/arrow.py b/arrow/arrow.py index cefebb3e4..954436fd2 100644 --- a/arrow/arrow.py +++ b/arrow/arrow.py @@ -828,8 +828,8 @@ def for_json(self): # internal tools. - @classmethod - def _get_tzinfo(cls, tz_expr): + @staticmethod + def _get_tzinfo(tz_expr): if tz_expr is None: return dateutil_tz.tzutc() @@ -882,8 +882,8 @@ def _get_iteration_params(cls, end, limit): else: return end, sys.maxsize - @classmethod - def _get_timestamp_from_input(cls, timestamp): + @staticmethod + def _get_timestamp_from_input(timestamp): try: return float(timestamp) diff --git a/arrow/parser.py b/arrow/parser.py index 09f47a63d..93bf4722b 100644 --- a/arrow/parser.py +++ b/arrow/parser.py @@ -225,8 +225,8 @@ def _parse_token(self, token, value, parts): ): parts['am_pm'] = 'pm' - @classmethod - def _build_datetime(cls, parts): + @staticmethod + def _build_datetime(parts): timestamp = parts.get('timestamp') @@ -263,24 +263,24 @@ def _parse_multiformat(self, string, formats): return _datetime - @classmethod - def _map_lookup(cls, input_map, key): + @staticmethod + def _map_lookup(input_map, key): try: return input_map[key] except KeyError: raise ParserError('Could not match "{0}" to {1}'.format(key, input_map)) - @classmethod - def _try_timestamp(cls, string): + @staticmethod + def _try_timestamp(string): try: return float(string) except: return None - @classmethod - def _choice_re(cls, choices, flags=0): + @staticmethod + def _choice_re(choices, flags=0): return re.compile('({0})'.format('|'.join(choices)), flags=flags)