From: Daniele Varrazzo Date: Sun, 16 May 2021 01:38:00 +0000 (+0200) Subject: Uniform date/time loaders naming X-Git-Tag: 3.0.dev0~39^2~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7872e6d1f08569cc04f8b74b1da7443fb73a8d27;p=thirdparty%2Fpsycopg.git Uniform date/time loaders naming Just use the type name with one uppercase, no camels here. --- diff --git a/psycopg3/psycopg3/types/__init__.py b/psycopg3/psycopg3/types/__init__.py index 3826058bc..511dcbf02 100644 --- a/psycopg3/psycopg3/types/__init__.py +++ b/psycopg3/psycopg3/types/__init__.py @@ -96,12 +96,12 @@ from .date import ( DateBinaryLoader as DateBinaryLoader, TimeLoader as TimeLoader, TimeBinaryLoader as TimeBinaryLoader, - TimeTzLoader as TimeTzLoader, - TimeTzBinaryLoader as TimeTzBinaryLoader, + TimetzLoader as TimetzLoader, + TimetzBinaryLoader as TimetzBinaryLoader, TimestampLoader as TimestampLoader, TimestampBinaryLoader as TimestampBinaryLoader, - TimestampTzLoader as TimestampTzLoader, - TimestampTzBinaryLoader as TimestampTzBinaryLoader, + TimestamptzLoader as TimestamptzLoader, + TimestamptzBinaryLoader as TimestamptzBinaryLoader, IntervalLoader as IntervalLoader, IntervalBinaryLoader as IntervalBinaryLoader, ) @@ -227,12 +227,12 @@ def register_default_globals(ctx: AdaptContext) -> None: DateBinaryLoader.register("date", ctx) TimeLoader.register("time", ctx) TimeBinaryLoader.register("time", ctx) - TimeTzLoader.register("timetz", ctx) - TimeTzBinaryLoader.register("timetz", ctx) + TimetzLoader.register("timetz", ctx) + TimetzBinaryLoader.register("timetz", ctx) TimestampLoader.register("timestamp", ctx) TimestampBinaryLoader.register("timestamp", ctx) - TimestampTzLoader.register("timestamptz", ctx) - TimestampTzBinaryLoader.register("timestamptz", ctx) + TimestamptzLoader.register("timestamptz", ctx) + TimestamptzBinaryLoader.register("timestamptz", ctx) IntervalLoader.register("interval", ctx) IntervalBinaryLoader.register("interval", ctx) diff --git a/psycopg3/psycopg3/types/date.py b/psycopg3/psycopg3/types/date.py index 430294c83..5b3dee5fb 100644 --- a/psycopg3/psycopg3/types/date.py +++ b/psycopg3/psycopg3/types/date.py @@ -348,7 +348,7 @@ class TimeBinaryLoader(Loader): ) from None -class TimeTzLoader(Loader): +class TimetzLoader(Loader): format = Format.TEXT _py37 = sys.version_info >= (3, 7) @@ -394,7 +394,7 @@ class TimeTzLoader(Loader): raise DataError(f"can't manage timetz {s!r}: {e}") from None -class TimeTzBinaryLoader(Loader): +class TimetzBinaryLoader(Loader): format = Format.BINARY @@ -423,7 +423,7 @@ class TimeTzBinaryLoader(Loader): if sys.version_info < (3, 7): setattr( - TimeTzBinaryLoader, "_tz_from_sec", TimeTzBinaryLoader._tz_from_sec_36 + TimetzBinaryLoader, "_tz_from_sec", TimetzBinaryLoader._tz_from_sec_36 ) @@ -545,7 +545,7 @@ class TimestampBinaryLoader(Loader): ) from None -class TimestampTzLoader(Loader): +class TimestamptzLoader(Loader): format = Format.TEXT _re_format = re.compile( @@ -614,7 +614,7 @@ class TimestampTzLoader(Loader): ) -class TimestampTzBinaryLoader(Loader): +class TimestamptzBinaryLoader(Loader): format = Format.BINARY