mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-22 00:56:34 +03:00
Remove type hints - not supported in Python 3.5
This commit is contained in:
parent
f98dead1ab
commit
c45bd07cea
|
@ -1,6 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
import datetime
|
||||
from typing import List, Union
|
||||
import iso8601
|
||||
import pytz
|
||||
from calendar import timegm
|
||||
|
@ -95,7 +94,7 @@ class Field(FunctionOperatorsMixin):
|
|||
sql += self._extra_params(db)
|
||||
return sql
|
||||
|
||||
def get_db_type_args(self) -> List[str]:
|
||||
def get_db_type_args(self):
|
||||
"""Returns field type arguments"""
|
||||
return []
|
||||
|
||||
|
@ -197,14 +196,14 @@ class DateTimeField(Field):
|
|||
db_type = 'DateTime'
|
||||
|
||||
def __init__(self, default=None, alias=None, materialized=None, readonly=None, codec=None,
|
||||
timezone: Union[BaseTzInfo, str] = None):
|
||||
timezone=None):
|
||||
super().__init__(default, alias, materialized, readonly, codec)
|
||||
# assert not timezone, 'Temporarily field timezone is not supported'
|
||||
if timezone:
|
||||
timezone = timezone if isinstance(timezone, BaseTzInfo) else pytz.timezone(timezone)
|
||||
self.timezone: BaseTzInfo = timezone
|
||||
self.timezone = timezone
|
||||
|
||||
def get_db_type_args(self) -> List[str]:
|
||||
def get_db_type_args(self):
|
||||
args = []
|
||||
if self.timezone:
|
||||
args.append(escape(self.timezone.zone))
|
||||
|
@ -246,18 +245,18 @@ class DateTime64Field(DateTimeField):
|
|||
db_type = 'DateTime64'
|
||||
|
||||
def __init__(self, default=None, alias=None, materialized=None, readonly=None, codec=None,
|
||||
timezone: Union[BaseTzInfo, str] = None, precision: int = 6):
|
||||
timezone=None, precision=6):
|
||||
super().__init__(default, alias, materialized, readonly, codec, timezone)
|
||||
assert precision is None or isinstance(precision, int), 'Precision must be int type'
|
||||
self.precision = precision
|
||||
|
||||
def get_db_type_args(self) -> List[str]:
|
||||
def get_db_type_args(self):
|
||||
args = [str(self.precision)]
|
||||
if self.timezone:
|
||||
args.append(escape(self.timezone.zone))
|
||||
return args
|
||||
|
||||
def to_db_string(self, value: datetime.datetime, quote=True):
|
||||
def to_db_string(self, value, quote=True):
|
||||
"""
|
||||
Returns the field's value prepared for writing to the database
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user