yandex-cloud / python-sdk

Yandex.Cloud Python SDK
MIT License
85 stars 27 forks source link

Fix `_service_for_ctor` service lookup bug from #85 #86

Closed Piatachock closed 8 months ago

Piatachock commented 8 months ago

More specific service entries must precede more common ones, else former will not be used at all:

In [2]: from yandex.cloud.logging.v1.log_group_service_pb2_grpc import LogGroupServiceStub

In [3]: import inspect

In [4]: inspect.getmodule(LogGroupServiceStub)
Out[4]: <module 'yandex.cloud.logging.v1.log_group_service_pb2_grpc' from 'contrib/libs/yandex-cloud-api-protos/yandex/cloud/logging/v1/log_group_service__int___pb2_grpc.py'>

In [5]: m = inspect.getmodule(LogGroupServiceStub)

In [6]: m.__name__
Out[6]: 'yandex.cloud.logging.v1.log_group_service_pb2_grpc'

In [7]: from yandexcloud._sdk import _service_for_ctor

In [8]: _service_for_ctor(LogGroupServiceStub)
Out[8]: 'logging'