Skip to content

Commit 6307e59

Browse files
authored
Merge pull request #174 fix grpc import workaround template
2 parents 7703dda + 143d7ce commit 6307e59

File tree

11 files changed

+26
-24
lines changed

11 files changed

+26
-24
lines changed

ydb/_apis.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# -*- coding: utf-8 -*-
2+
import typing
3+
24
# Workaround for good IDE and universal for runtime
3-
# noinspection PyUnreachableCode
4-
if False:
5+
if typing.TYPE_CHECKING:
56
from ._grpc.v4 import (
67
ydb_cms_v1_pb2_grpc,
78
ydb_discovery_v1_pb2_grpc,

ydb/_grpc/grpcwrapper/common_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
import ydb.aio
2525

2626
# Workaround for good IDE and universal for runtime
27-
# noinspection PyUnreachableCode
28-
if False:
27+
if typing.TYPE_CHECKING:
2928
from ..v4.protos import ydb_topic_pb2, ydb_issue_message_pb2
3029
else:
3130
from ..common.protos import ydb_topic_pb2, ydb_issue_message_pb2

ydb/_grpc/grpcwrapper/ydb_topic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
from ... import scheme
1111

1212
# Workaround for good IDE and universal for runtime
13-
# noinspection PyUnreachableCode
14-
if False:
13+
if typing.TYPE_CHECKING:
1514
from ..v4.protos import ydb_scheme_pb2, ydb_topic_pb2
1615
else:
1716
from ..common.protos import ydb_scheme_pb2, ydb_topic_pb2

ydb/_grpc/grpcwrapper/ydb_topic_public_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import datetime
2+
import typing
23
from dataclasses import dataclass, field
34
from enum import IntEnum
45
from typing import Optional, List, Union, Dict
56

67
# Workaround for good IDE and universal for runtime
7-
# noinspection PyUnreachableCode
8-
if False:
8+
if typing.TYPE_CHECKING:
99
from ..v4.protos import ydb_topic_pb2
1010
else:
1111
from ..common.protos import ydb_topic_pb2

ydb/_topic_common/common_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import typing
23

34
import grpc
45
import pytest
@@ -10,9 +11,8 @@
1011
)
1112
from .. import issues
1213

13-
# Workaround for good autocomplete in IDE and universal import at runtime
14-
# noinspection PyUnreachableCode
15-
if False:
14+
# Workaround for good IDE and universal for runtime
15+
if typing.TYPE_CHECKING:
1616
from ydb._grpc.v4.protos import (
1717
ydb_status_codes_pb2,
1818
ydb_topic_pb2,

ydb/_topic_reader/topic_reader_asyncio_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import datetime
3+
import typing
34
from unittest import mock
45

56
import pytest
@@ -12,9 +13,8 @@
1213
from .._grpc.grpcwrapper.ydb_topic import StreamReadMessage, Codec, OffsetsRange
1314
from .._topic_common.test_helpers import StreamMock, wait_condition, wait_for_fast
1415

15-
# Workaround for good autocomplete in IDE and universal import at runtime
16-
# noinspection PyUnreachableCode
17-
if False:
16+
# Workaround for good IDE and universal for runtime
17+
if typing.TYPE_CHECKING:
1818
from .._grpc.v4.protos import ydb_status_codes_pb2
1919
else:
2020
from .._grpc.common.protos import ydb_status_codes_pb2

ydb/aio/connection.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import asyncio
3+
import typing
34
from typing import Any, Tuple, Callable, Iterable
45
import collections
56
import grpc
@@ -24,8 +25,8 @@
2425
from ydb.settings import BaseRequestSettings
2526
from ydb import issues
2627

27-
# Workaround for good IDE and universal runtime
28-
if False:
28+
# Workaround for good IDE and universal for runtime
29+
if typing.TYPE_CHECKING:
2930
from ydb._grpc.v4 import ydb_topic_v1_pb2_grpc
3031
else:
3132
from ydb._grpc.common import ydb_topic_v1_pb2_grpc

ydb/credentials.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import abc
3+
import typing
4+
35
import six
46
from . import tracing, issues, connection
57
from . import settings as settings_impl
@@ -9,8 +11,7 @@
911
import time
1012

1113
# Workaround for good IDE and universal for runtime
12-
# noinspection PyUnreachableCode
13-
if False:
14+
if typing.TYPE_CHECKING:
1415
from ._grpc.v4.protos import ydb_auth_pb2
1516
from ._grpc.v4 import ydb_auth_v1_pb2_grpc
1617
else:

ydb/export.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import enum
2+
import typing
23

34
from . import _apis
45

56
from . import settings_impl as s_impl
67

78
# Workaround for good IDE and universal for runtime
8-
# noinspection PyUnreachableCode
9-
if False:
9+
if typing.TYPE_CHECKING:
1010
from ._grpc.v4.protos import ydb_export_pb2
1111
from ._grpc.v4 import ydb_export_v1_pb2_grpc
1212
else:

ydb/import_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import enum
2+
import typing
23

34
from . import _apis
45

56
from . import settings_impl as s_impl
67

78
# Workaround for good IDE and universal for runtime
8-
# noinspection PyUnreachableCode
9-
if False:
9+
if typing.TYPE_CHECKING:
1010
from ._grpc.v4.protos import ydb_import_pb2
1111
from ._grpc.v4 import ydb_import_v1_pb2_grpc
1212
else:

0 commit comments

Comments
 (0)