Skip to content

Commit

Permalink
Disable false pytype positives in types.py
Browse files Browse the repository at this point in the history
  • Loading branch information
plamut committed Sep 17, 2021
1 parent 314eb51 commit 024451a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions google/cloud/pubsub_v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
BatchSettings = collections.namedtuple(
"BatchSettings", ["max_bytes", "max_latency", "max_messages"]
)
BatchSettings.__new__.__defaults__ = (
BatchSettings.__new__.__defaults__ = ( # pytype: disable=attribute-error
1 * 1000 * 1000, # max_bytes: 1 MB
0.01, # max_latency: 10 ms
100, # max_messages: 100
Expand Down Expand Up @@ -78,11 +78,13 @@ class LimitExceededBehavior(str, enum.Enum):
PublishFlowControl = collections.namedtuple(
"PublishFlowControl", ["message_limit", "byte_limit", "limit_exceeded_behavior"]
)
# pytype: disable=attribute-error
PublishFlowControl.__new__.__defaults__ = (
10 * BatchSettings.__new__.__defaults__[2], # message limit
10 * BatchSettings.__new__.__defaults__[0], # byte limit
LimitExceededBehavior.IGNORE, # desired behavior
)
# pytype: enable=attribute-error
PublishFlowControl.__doc__ = "The client flow control settings for message publishing."
PublishFlowControl.message_limit.__doc__ = (
"The maximum number of messages awaiting to be published."
Expand All @@ -101,7 +103,7 @@ class LimitExceededBehavior(str, enum.Enum):
PublisherOptions = collections.namedtuple(
"PublisherOptions", ["enable_message_ordering", "flow_control", "retry", "timeout"]
)
PublisherOptions.__new__.__defaults__ = (
PublisherOptions.__new__.__defaults__ = ( # pytype: disable=attribute-error
False, # enable_message_ordering: False
PublishFlowControl(), # default flow control settings
gapic_v1.method.DEFAULT, # use default api_core value for retry
Expand Down Expand Up @@ -138,7 +140,7 @@ class LimitExceededBehavior(str, enum.Enum):
"max_duration_per_lease_extension",
],
)
FlowControl.__new__.__defaults__ = (
FlowControl.__new__.__defaults__ = ( # pytype: disable=attribute-error
100 * 1024 * 1024, # max_bytes: 100mb
1000, # max_messages: 1000
1 * 60 * 60, # max_lease_duration: 1 hour.
Expand Down

0 comments on commit 024451a

Please sign in to comment.