diff --git a/circle.yml b/circle.yml index 496f2ba..fc975d0 100644 --- a/circle.yml +++ b/circle.yml @@ -8,4 +8,4 @@ dependencies: test: post: - - pylint singer -d missing-docstring,broad-except,bare-except,too-many-return-statements,too-many-branches,too-many-arguments,no-else-return,too-few-public-methods,fixme,protected-access + - pylint singer -d missing-docstring,broad-except,bare-except,too-many-return-statements,too-many-branches,too-many-arguments,no-else-return,too-few-public-methods,fixme,protected-access,too-many-locals,inconsistent-return-statements diff --git a/singer/transform.py b/singer/transform.py index 12df723..1e5f506 100644 --- a/singer/transform.py +++ b/singer/transform.py @@ -1,10 +1,9 @@ import datetime import pendulum +from jsonschema import RefResolver from singer.logger import get_logger from singer.utils import strftime -from jsonschema import RefResolver - LOGGER = get_logger() NO_INTEGER_DATETIME_PARSING = "no-integer-datetime-parsing" diff --git a/singer/utils.py b/singer/utils.py index 715d695..0b419c6 100644 --- a/singer/utils.py +++ b/singer/utils.py @@ -11,7 +11,7 @@ from singer.catalog import Catalog DATETIME_PARSE = "%Y-%m-%dT%H:%M:%SZ" -DATETIME_FMT = "%Y-%m-%dT%H:%M:%S.%fZ" +DATETIME_FMT = "%04Y-%m-%dT%H:%M:%S.%fZ" def now(): return datetime.datetime.utcnow().replace(tzinfo=pytz.UTC) @@ -174,11 +174,11 @@ def exception_is_4xx(exception): def handle_top_exception(logger): """A decorator that will catch exceptions and log the exception's message as a CRITICAL log.""" - def decorator(fn): - @functools.wraps(fn) + def decorator(fnc): + @functools.wraps(fnc) def wrapped(*args, **kwargs): try: - return fn(*args, **kwargs) + return fnc(*args, **kwargs) except Exception as exc: logger.critical(exc) raise diff --git a/tests/test_utils.py b/tests/test_utils.py index 2b20790..4ef53f0 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -7,7 +7,7 @@ class TestFormat(unittest.TestCase): def test_small_years(self): - self.assertEqual(u.strftime(dt(90, 1, 1, tzinfo=tz.utc), '%04Y-%m-%dT%H:%M:%S.%fZ'), + self.assertEqual(u.strftime(dt(90, 1, 1, tzinfo=tz.utc)), "0090-01-01T00:00:00.000000Z")