Skip to content

Commit 7809d80

Browse files
busunkim96parthea
andauthored
fix(deps): require google-api-core >= 1.31.5, >= 2.3.2 on v1 release (#500)
* chore(deps): allow google-api-core v2 on v1 release * chore: also update google-cloud-core * chore: run blacken * ci: fix tests * docs(samples): resolve TypeError in create_topic/delete_topic Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 79da042 commit 7809d80

19 files changed

+264
-174
lines changed

docs/conf.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
master_doc = "index"
6666

6767
# General information about the project.
68-
project = u"google-cloud-logging"
69-
copyright = u"2019, Google"
70-
author = u"Google APIs"
68+
project = "google-cloud-logging"
69+
copyright = "2019, Google"
70+
author = "Google APIs"
7171

7272
# The version info for the project you're documenting, acts as replacement for
7373
# |version| and |release|, also used in various other places throughout the
@@ -261,7 +261,7 @@
261261
(
262262
master_doc,
263263
"google-cloud-logging.tex",
264-
u"google-cloud-logging Documentation",
264+
"google-cloud-logging Documentation",
265265
author,
266266
"manual",
267267
)
@@ -296,7 +296,7 @@
296296
(
297297
master_doc,
298298
"google-cloud-logging",
299-
u"google-cloud-logging Documentation",
299+
"google-cloud-logging Documentation",
300300
[author],
301301
1,
302302
)
@@ -315,7 +315,7 @@
315315
(
316316
master_doc,
317317
"google-cloud-logging",
318-
u"google-cloud-logging Documentation",
318+
"google-cloud-logging Documentation",
319319
author,
320320
"google-cloud-logging",
321321
"google-cloud-logging Library",
@@ -340,7 +340,10 @@
340340
intersphinx_mapping = {
341341
"python": ("http://python.readthedocs.org/en/latest/", None),
342342
"google-auth": ("https://google-auth.readthedocs.io/en/stable", None),
343-
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
343+
"google.api_core": (
344+
"https://googleapis.dev/python/google-api-core/latest/",
345+
None,
346+
),
344347
"grpc": ("https://grpc.io/grpc/python/", None),
345348
}
346349

google/cloud/logging/entries.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ def from_api_repr(cls, resource, client, loggers=None):
232232
return inst
233233

234234
def to_api_repr(self):
235-
"""API repr (JSON format) for entry.
236-
"""
235+
"""API repr (JSON format) for entry."""
237236
info = {}
238237
if self.log_name is not None:
239238
info["logName"] = self.log_name
@@ -285,8 +284,7 @@ def _extract_payload(cls, resource):
285284
return resource["textPayload"]
286285

287286
def to_api_repr(self):
288-
"""API repr (JSON format) for entry.
289-
"""
287+
"""API repr (JSON format) for entry."""
290288
info = super(TextEntry, self).to_api_repr()
291289
info["textPayload"] = self.payload
292290
return info
@@ -313,8 +311,7 @@ def _extract_payload(cls, resource):
313311
return resource["jsonPayload"]
314312

315313
def to_api_repr(self):
316-
"""API repr (JSON format) for entry.
317-
"""
314+
"""API repr (JSON format) for entry."""
318315
info = super(StructEntry, self).to_api_repr()
319316
info["jsonPayload"] = self.payload
320317
return info
@@ -351,8 +348,7 @@ def payload_json(self):
351348
return self.payload
352349

353350
def to_api_repr(self):
354-
"""API repr (JSON format) for entry.
355-
"""
351+
"""API repr (JSON format) for entry."""
356352
info = super(ProtobufEntry, self).to_api_repr()
357353
info["protoPayload"] = MessageToDict(self.payload)
358354
return info

google/cloud/logging/handlers/_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
def format_stackdriver_json(record, message):
4242
"""Helper to format a LogRecord in in Stackdriver fluentd format.
4343
44-
:rtype: str
45-
:returns: JSON str to be written to the log file.
44+
:rtype: str
45+
:returns: JSON str to be written to the log file.
4646
"""
4747
subsecond, second = math.modf(record.created)
4848

google/cloud/logging/logger.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ def batch(self, client=None):
114114
return Batch(self, client)
115115

116116
def _do_log(self, client, _entry_class, payload=None, **kw):
117-
"""Helper for :meth:`log_empty`, :meth:`log_text`, etc.
118-
"""
117+
"""Helper for :meth:`log_empty`, :meth:`log_text`, etc."""
119118
client = self._require_client(client)
120119

121120
# Apply defaults

google/cloud/logging_v2/gapic/config_service_v2_client.py

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
from google.protobuf import field_mask_pb2
4141

4242

43-
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-logging",).version
43+
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
44+
"google-cloud-logging",
45+
).version
4446

4547

4648
class ConfigServiceV2Client(object):
@@ -77,7 +79,8 @@ def from_service_account_file(cls, filename, *args, **kwargs):
7779
def billing_path(cls, billing_account):
7880
"""Return a fully-qualified billing string."""
7981
return google.api_core.path_template.expand(
80-
"billingAccounts/{billing_account}", billing_account=billing_account,
82+
"billingAccounts/{billing_account}",
83+
billing_account=billing_account,
8184
)
8285

8386
@classmethod
@@ -110,7 +113,10 @@ def exclusion_path(cls, project, exclusion):
110113
@classmethod
111114
def folder_path(cls, folder):
112115
"""Return a fully-qualified folder string."""
113-
return google.api_core.path_template.expand("folders/{folder}", folder=folder,)
116+
return google.api_core.path_template.expand(
117+
"folders/{folder}",
118+
folder=folder,
119+
)
114120

115121
@classmethod
116122
def folder_exclusion_path(cls, folder, exclusion):
@@ -125,14 +131,17 @@ def folder_exclusion_path(cls, folder, exclusion):
125131
def folder_sink_path(cls, folder, sink):
126132
"""Return a fully-qualified folder_sink string."""
127133
return google.api_core.path_template.expand(
128-
"folders/{folder}/sinks/{sink}", folder=folder, sink=sink,
134+
"folders/{folder}/sinks/{sink}",
135+
folder=folder,
136+
sink=sink,
129137
)
130138

131139
@classmethod
132140
def organization_path(cls, organization):
133141
"""Return a fully-qualified organization string."""
134142
return google.api_core.path_template.expand(
135-
"organizations/{organization}", organization=organization,
143+
"organizations/{organization}",
144+
organization=organization,
136145
)
137146

138147
@classmethod
@@ -157,14 +166,17 @@ def organization_sink_path(cls, organization, sink):
157166
def project_path(cls, project):
158167
"""Return a fully-qualified project string."""
159168
return google.api_core.path_template.expand(
160-
"projects/{project}", project=project,
169+
"projects/{project}",
170+
project=project,
161171
)
162172

163173
@classmethod
164174
def sink_path(cls, project, sink):
165175
"""Return a fully-qualified sink string."""
166176
return google.api_core.path_template.expand(
167-
"projects/{project}/sinks/{sink}", project=project, sink=sink,
177+
"projects/{project}/sinks/{sink}",
178+
project=project,
179+
sink=sink,
168180
)
169181

170182
def __init__(
@@ -253,8 +265,12 @@ def __init__(
253265
)
254266
self.transport = transport
255267
else:
256-
self.transport = config_service_v2_grpc_transport.ConfigServiceV2GrpcTransport(
257-
address=api_endpoint, channel=channel, credentials=credentials,
268+
self.transport = (
269+
config_service_v2_grpc_transport.ConfigServiceV2GrpcTransport(
270+
address=api_endpoint,
271+
channel=channel,
272+
credentials=credentials,
273+
)
258274
)
259275

260276
if client_info is None:
@@ -360,7 +376,8 @@ def list_sinks(
360376
)
361377

362378
request = logging_config_pb2.ListSinksRequest(
363-
parent=parent, page_size=page_size,
379+
parent=parent,
380+
page_size=page_size,
364381
)
365382
if metadata is None:
366383
metadata = []
@@ -450,7 +467,9 @@ def get_sink(
450467
client_info=self._client_info,
451468
)
452469

453-
request = logging_config_pb2.GetSinkRequest(sink_name=sink_name,)
470+
request = logging_config_pb2.GetSinkRequest(
471+
sink_name=sink_name,
472+
)
454473
if metadata is None:
455474
metadata = []
456475
metadata = list(metadata)
@@ -554,7 +573,9 @@ def create_sink(
554573
)
555574

556575
request = logging_config_pb2.CreateSinkRequest(
557-
parent=parent, sink=sink, unique_writer_identity=unique_writer_identity,
576+
parent=parent,
577+
sink=sink,
578+
unique_writer_identity=unique_writer_identity,
558579
)
559580
if metadata is None:
560581
metadata = []
@@ -759,7 +780,9 @@ def delete_sink(
759780
client_info=self._client_info,
760781
)
761782

762-
request = logging_config_pb2.DeleteSinkRequest(sink_name=sink_name,)
783+
request = logging_config_pb2.DeleteSinkRequest(
784+
sink_name=sink_name,
785+
)
763786
if metadata is None:
764787
metadata = []
765788
metadata = list(metadata)
@@ -857,7 +880,8 @@ def list_exclusions(
857880
)
858881

859882
request = logging_config_pb2.ListExclusionsRequest(
860-
parent=parent, page_size=page_size,
883+
parent=parent,
884+
page_size=page_size,
861885
)
862886
if metadata is None:
863887
metadata = []
@@ -947,7 +971,9 @@ def get_exclusion(
947971
client_info=self._client_info,
948972
)
949973

950-
request = logging_config_pb2.GetExclusionRequest(name=name,)
974+
request = logging_config_pb2.GetExclusionRequest(
975+
name=name,
976+
)
951977
if metadata is None:
952978
metadata = []
953979
metadata = list(metadata)
@@ -1038,7 +1064,8 @@ def create_exclusion(
10381064
)
10391065

10401066
request = logging_config_pb2.CreateExclusionRequest(
1041-
parent=parent, exclusion=exclusion,
1067+
parent=parent,
1068+
exclusion=exclusion,
10421069
)
10431070
if metadata is None:
10441071
metadata = []
@@ -1142,7 +1169,9 @@ def update_exclusion(
11421169
)
11431170

11441171
request = logging_config_pb2.UpdateExclusionRequest(
1145-
name=name, exclusion=exclusion, update_mask=update_mask,
1172+
name=name,
1173+
exclusion=exclusion,
1174+
update_mask=update_mask,
11461175
)
11471176
if metadata is None:
11481177
metadata = []
@@ -1218,7 +1247,9 @@ def delete_exclusion(
12181247
client_info=self._client_info,
12191248
)
12201249

1221-
request = logging_config_pb2.DeleteExclusionRequest(name=name,)
1250+
request = logging_config_pb2.DeleteExclusionRequest(
1251+
name=name,
1252+
)
12221253
if metadata is None:
12231254
metadata = []
12241255
metadata = list(metadata)
@@ -1306,7 +1337,9 @@ def get_cmek_settings(
13061337
client_info=self._client_info,
13071338
)
13081339

1309-
request = logging_config_pb2.GetCmekSettingsRequest(name=name,)
1340+
request = logging_config_pb2.GetCmekSettingsRequest(
1341+
name=name,
1342+
)
13101343
if metadata is None:
13111344
metadata = []
13121345
metadata = list(metadata)
@@ -1422,7 +1455,9 @@ def update_cmek_settings(
14221455
)
14231456

14241457
request = logging_config_pb2.UpdateCmekSettingsRequest(
1425-
name=name, cmek_settings=cmek_settings, update_mask=update_mask,
1458+
name=name,
1459+
cmek_settings=cmek_settings,
1460+
update_mask=update_mask,
14261461
)
14271462
if metadata is None:
14281463
metadata = []

0 commit comments

Comments
 (0)