From d95c8227f7e90aa5de56b09eca11fd5cb26f2315 2023-11-24 14:30:55 From: Nils Müller Date: 2023-11-24 14:30:55 Subject: [PATCH] Format existing code with black --- diff --git a/IPython/utils/tz.py b/IPython/utils/tz.py index dbe1e8e..fbcfb00 100644 --- a/IPython/utils/tz.py +++ b/IPython/utils/tz.py @@ -5,25 +5,26 @@ Timezone utilities Just UTC-awareness right now """ -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Copyright (C) 2013 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Imports -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- from datetime import tzinfo, timedelta, datetime -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Code -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # constant for zero offset ZERO = timedelta(0) + class tzUTC(tzinfo): """tzinfo object for UTC (zero offset)""" @@ -39,10 +40,13 @@ UTC = tzUTC() # type: ignore[abstract] def utc_aware(unaware): """decorator for adding UTC tzinfo to datetime's utcfoo methods""" + def utc_method(*args, **kwargs): dt = unaware(*args, **kwargs) return dt.replace(tzinfo=UTC) + return utc_method + utcfromtimestamp = utc_aware(datetime.utcfromtimestamp) utcnow = utc_aware(datetime.utcnow)