minor fixes
This commit is contained in:
@@ -56,6 +56,12 @@ async def time_picker(
|
|||||||
|
|
||||||
if not current_value:
|
if not current_value:
|
||||||
current_value = time(0, 0)
|
current_value = time(0, 0)
|
||||||
|
else:
|
||||||
|
remainder = current_value.minute % 5
|
||||||
|
if remainder >= 3:
|
||||||
|
current_value += timedelta(minutes=(5 - remainder))
|
||||||
|
else:
|
||||||
|
current_value -= timedelta(minutes=remainder)
|
||||||
|
|
||||||
for i in range(12):
|
for i in range(12):
|
||||||
keyboard_builder.row(
|
keyboard_builder.row(
|
||||||
@@ -173,7 +179,7 @@ async def date_picker(
|
|||||||
else:
|
else:
|
||||||
start_date = current_value
|
start_date = current_value
|
||||||
|
|
||||||
start_date = current_value.replace(day=1)
|
start_date = start_date.replace(day=1)
|
||||||
|
|
||||||
previous_month = start_date - timedelta(days=1)
|
previous_month = start_date - timedelta(days=1)
|
||||||
next_month = start_date.replace(day=28) + timedelta(days=4)
|
next_month = start_date.replace(day=28) + timedelta(days=4)
|
||||||
|
|||||||
@@ -86,13 +86,16 @@ class BotEntityMetaclass(SQLModelMetaclass):
|
|||||||
field_descriptor.is_list = is_list = True
|
field_descriptor.is_list = is_list = True
|
||||||
field_descriptor.type_base = type_ = get_args(type_)[0]
|
field_descriptor.type_base = type_ = get_args(type_)[0]
|
||||||
|
|
||||||
if type_origin == Union and isinstance(get_args(type_)[0], ForwardRef):
|
if type_origin is Union:
|
||||||
|
args = get_args(type_)
|
||||||
|
if isinstance(args[0], ForwardRef):
|
||||||
field_descriptor.is_optional = is_optional = True
|
field_descriptor.is_optional = is_optional = True
|
||||||
field_descriptor.type_base = type_ = get_args(type_)[
|
field_descriptor.type_base = type_ = args[0].__forward_arg__
|
||||||
0
|
elif args[1] is NoneType:
|
||||||
].__forward_arg__
|
field_descriptor.is_optional = is_optional = True
|
||||||
|
field_descriptor.type_base = type_ = args[0]
|
||||||
|
|
||||||
if type_origin == UnionType and get_args(type_)[1] == NoneType:
|
if type_origin is UnionType and get_args(type_)[1] is NoneType:
|
||||||
field_descriptor.is_optional = is_optional = True
|
field_descriptor.is_optional = is_optional = True
|
||||||
field_descriptor.type_base = type_ = get_args(type_)[0]
|
field_descriptor.type_base = type_ = get_args(type_)[0]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user