Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dba5f63

Browse files
authored
Release 4.1.1 (googleads#198)
1 parent 6d4d267 commit dba5f63

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

ChangeLog

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* 4.1.1:
2+
- Fix for types.py to include classes of dependent modules
3+
14
* 4.1.0:
25
- Performance improvements
36
- Updated dependencies for more recent versions

google/ads/google_ads/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
import google.ads.google_ads.util
2121

2222

23-
VERSION = '4.1.0'
23+
VERSION = '4.1.1'

google/ads/google_ads/v2/types.py

+27-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import importlib
1919
import re
2020
import sys
21+
from inspect import getmembers, isclass
2122
from itertools import chain
2223

2324
from google.api_core.protobuf_helpers import get_messages
@@ -1626,6 +1627,27 @@
16261627
YoutubeVideoRegistrationErrorEnum='google.ads.google_ads.v2.proto.errors.youtube_video_registration_error_pb2'
16271628
)
16281629

1630+
DEPENDENT_MODULE_LIST = [
1631+
'google.longrunning.operations_pb2',
1632+
'google.protobuf.any_pb2',
1633+
'google.protobuf.empty_pb2',
1634+
'google.protobuf.field_mask_pb2',
1635+
'google.protobuf.wrappers_pb2',
1636+
'google.rpc.status_pb2']
1637+
1638+
def _get_class_from_module(module_name):
1639+
module = importlib.import_module(module_name)
1640+
for class_name, _ in getmembers(module, isclass): # from inspect module
1641+
yield class_name
1642+
1643+
def _populate_dependent_classes(module_list = DEPENDENT_MODULE_LIST):
1644+
class_list = {}
1645+
for module_name in module_list:
1646+
for cls in _get_class_from_module(module_name):
1647+
class_list[cls] = module_name
1648+
return class_list
1649+
1650+
_lazy_dependent_class_to_package_map = _populate_dependent_classes()
16291651

16301652
def _load_module(module_name):
16311653
"""Load a module by it's name.
@@ -1683,7 +1705,9 @@ def _get_message_class_by_name(class_name):
16831705
a protobuf message class definition that inherits from
16841706
google.protobuf.pyext.cpp_message.GeneratedProtocolMessageType.
16851707
"""
1686-
if class_name in _lazy_class_to_package_map:
1708+
if class_name in _lazy_dependent_class_to_package_map:
1709+
module_path = _lazy_dependent_class_to_package_map[class_name]
1710+
elif class_name in _lazy_class_to_package_map:
16871711
module_path = _lazy_class_to_package_map[class_name]
16881712
else:
16891713
raise AttributeError(f'unknown sub-module {class_name!r}.')
@@ -1707,7 +1731,8 @@ def __getattr__(name): # Requires Python >= 3.7
17071731
if name == '__all__':
17081732
converted = (util.convert_snake_case_to_upper_case(key) for
17091733
key in chain(_lazy_name_to_package_map,
1710-
_lazy_class_to_package_map))
1734+
_lazy_class_to_package_map,
1735+
_lazy_dependent_class_to_package_map))
17111736
all_names = sorted(converted)
17121737
globals()['__all__'] = all_names
17131738
return all_names

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
setup(
3636
name='google-ads',
37-
version='4.1.0',
37+
version='4.1.1',
3838
author='Google LLC',
3939
author_email='[email protected]',
4040
classifiers=[

0 commit comments

Comments
 (0)