Skip to content

Commit 4fc8dc8

Browse files
fix some type hints in issues.py and types.py
1 parent 3da0b99 commit 4fc8dc8

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

ydb/issues.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ def __init__(
6666
class Error(Exception):
6767
status = None
6868

69-
def __init__(self, message: str, issues=None):
69+
def __init__(
70+
self,
71+
message: str,
72+
issues: typing.Optional[typing.Interable[_IssueMessage]] = None
73+
):
7074
super(Error, self).__init__(message)
7175
self.issues = issues
7276
self.message = message

ydb/types.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import struct
1010
from google.protobuf import struct_pb2
1111

12-
from .table import TableClientSettings
12+
from . import table
1313

1414

1515
if typing.TYPE_CHECKING:
@@ -22,7 +22,7 @@
2222

2323
def _from_date(
2424
x: ydb_value_pb2.Value,
25-
table_client_settings: TableClientSettings
25+
table_client_settings: table.TableClientSettings
2626
) -> typing.Union[date, int]:
2727
if table_client_settings is not None and table_client_settings._native_date_in_result_sets:
2828
return _EPOCH.date() + timedelta(days=x.uint32_value)
@@ -38,7 +38,7 @@ def _to_date(pb: ydb_value_pb2.Value, value: typing.Union[date, int]) -> None:
3838

3939
def _from_datetime_number(
4040
x: typing.Union[float, datetime],
41-
table_client_settings: TableClientSettings
41+
table_client_settings: table.TableClientSettings
4242
) -> datetime:
4343
if table_client_settings is not None and table_client_settings._native_datetime_in_result_sets:
4444
return datetime.utcfromtimestamp(x)
@@ -47,7 +47,7 @@ def _from_datetime_number(
4747

4848
def _from_json(
4949
x: typing.Union[str, bytearray, bytes],
50-
table_client_settings: TableClientSettings
50+
table_client_settings: table.TableClientSettings
5151
):
5252
if table_client_settings is not None and table_client_settings._native_json_in_result_sets:
5353
return json.loads(x)
@@ -56,7 +56,7 @@ def _from_json(
5656

5757
def _to_uuid(
5858
value_pb: ydb_value_pb2.Value,
59-
table_client_settings: TableClientSettings
59+
table_client_settings: table.TableClientSettings
6060
) -> uuid.UUID:
6161
return uuid.UUID(bytes_le=struct.pack("QQ", value_pb.low_128, value_pb.high_128))
6262

@@ -68,7 +68,7 @@ def _from_uuid(pb: ydb_value_pb2.Value, value: uuid.UUID):
6868

6969
def _from_interval(
7070
value_pb: ydb_value_pb2.Value,
71-
table_client_settings: TableClientSettings
71+
table_client_settings: table.TableClientSettings
7272
) -> typing.Union[timedelta, int]:
7373
if table_client_settings is not None and table_client_settings._native_interval_in_result_sets:
7474
return timedelta(microseconds=value_pb.int64_value)
@@ -88,7 +88,7 @@ def _to_interval(pb: ydb_value_pb2.Value, value: typing.Union[timedelta, int]) -
8888

8989
def _from_timestamp(
9090
value_pb: ydb_value_pb2.Value,
91-
table_client_settings: TableClientSettings
91+
table_client_settings: table.TableClientSettings
9292
) -> typing.Union[datetime, int]:
9393
if table_client_settings is not None and table_client_settings._native_timestamp_in_result_sets:
9494
return _EPOCH + timedelta(microseconds=value_pb.uint64_value)
@@ -172,7 +172,7 @@ def __init__(
172172
def get_value(
173173
self,
174174
value_pb: ydb_value_pb2.Value,
175-
table_client_settings: TableClientSettings
175+
table_client_settings: table.TableClientSettings
176176
):
177177
"""
178178
Extracts value from protocol buffer

0 commit comments

Comments
 (0)