Skip to content

fixup_pubsub_v1_keywords.py generates incorrect output in some cases  #199

@rvandegrift

Description

@rvandegrift

I just tried the fixup script and ran into a few issues.

  1. It generates this change even though PublisherClient.publish does not take the new style parameters:
-        publisher_client.publish(topic, bytes(json.dumps(message), 'utf-8'))
+        publisher_client.publish(request = {'topic': topic, 'messages': bytes(json.dumps(message), 'utf-8')})
  1. It generates this change even though request and keyword args are documented to be mutually exclusive:
-        response = subscriber.pull(subscription_path, max_messages=NUM_MESSAGES, timeout=TIMEOUT)
+        response = subscriber.pull(
+            request = {'subscription': subscription_path, 'max_messages': NUM_MESSAGES}, timeout=TIMEOUT,
+        )
  1. all of the generated request keyword arguments break pep8 (they should not have spaces around =)

Stylistically, I find the keyword arguments better to read than all of the inline dicts for the request syntax. It'd be great if the tool had an option to emit the keyword args version.

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the googleapis/python-pubsub API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions