Skip to content

Commit

Permalink
blacken all gen'd libs (googleapis#6792)
Browse files Browse the repository at this point in the history
* blacken all gen'd libs
  • Loading branch information
crwilcox authored and Erik Webb committed Dec 3, 2018
1 parent 096a09d commit 52b4639
Show file tree
Hide file tree
Showing 371 changed files with 170,983 additions and 109,470 deletions.
2 changes: 2 additions & 0 deletions asset/google/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

try:
import pkg_resources

pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
2 changes: 2 additions & 0 deletions asset/google/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

try:
import pkg_resources

pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
6 changes: 1 addition & 5 deletions asset/google/cloud/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@
from google.cloud.asset_v1beta1 import enums
from google.cloud.asset_v1beta1 import types

__all__ = (
'enums',
'types',
'AssetServiceClient',
)
__all__ = ("enums", "types", "AssetServiceClient")
6 changes: 1 addition & 5 deletions asset/google/cloud/asset_v1beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,4 @@ class AssetServiceClient(asset_service_client.AssetServiceClient):
enums = enums


__all__ = (
'enums',
'types',
'AssetServiceClient',
)
__all__ = ("enums", "types", "AssetServiceClient")
138 changes: 71 additions & 67 deletions asset/google/cloud/asset_v1beta1/gapic/asset_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,18 @@
from google.longrunning import operations_pb2
from google.protobuf import timestamp_pb2

_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
'google-cloud-asset', ).version
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-asset").version


class AssetServiceClient(object):
"""Asset service definition."""

SERVICE_ADDRESS = 'cloudasset.googleapis.com:443'
SERVICE_ADDRESS = "cloudasset.googleapis.com:443"
"""The default address of the service."""

# The name of the interface for this client. This is the key used to
# find the method configuration in the client_config dictionary.
_INTERFACE_NAME = 'google.cloud.asset.v1beta1.AssetService'
_INTERFACE_NAME = "google.cloud.asset.v1beta1.AssetService"

@classmethod
def from_service_account_file(cls, filename, *args, **kwargs):
Expand All @@ -65,9 +64,8 @@ def from_service_account_file(cls, filename, *args, **kwargs):
Returns:
AssetServiceClient: The constructed client.
"""
credentials = service_account.Credentials.from_service_account_file(
filename)
kwargs['credentials'] = credentials
credentials = service_account.Credentials.from_service_account_file(filename)
kwargs["credentials"] = credentials
return cls(*args, **kwargs)

from_service_account_json = from_service_account_file
Expand All @@ -76,16 +74,17 @@ def from_service_account_file(cls, filename, *args, **kwargs):
def project_path(cls, project):
"""Return a fully-qualified project string."""
return google.api_core.path_template.expand(
'projects/{project}',
project=project,
"projects/{project}", project=project
)

def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None):
def __init__(
self,
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
):
"""Constructor.
Args:
Expand Down Expand Up @@ -119,18 +118,19 @@ def __init__(self,
# Raise deprecation warnings for things we want to go away.
if client_config is not None:
warnings.warn(
'The `client_config` argument is deprecated.',
"The `client_config` argument is deprecated.",
PendingDeprecationWarning,
stacklevel=2)
stacklevel=2,
)
else:
client_config = asset_service_client_config.config

if channel:
warnings.warn(
'The `channel` argument is deprecated; use '
'`transport` instead.',
"The `channel` argument is deprecated; use " "`transport` instead.",
PendingDeprecationWarning,
stacklevel=2)
stacklevel=2,
)

# Instantiate the transport.
# The transport is responsible for handling serialization and
Expand All @@ -139,25 +139,24 @@ def __init__(self,
if callable(transport):
self.transport = transport(
credentials=credentials,
default_class=asset_service_grpc_transport.
AssetServiceGrpcTransport,
default_class=asset_service_grpc_transport.AssetServiceGrpcTransport,
)
else:
if credentials:
raise ValueError(
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
"Received both a transport instance and "
"credentials; these are mutually exclusive."
)
self.transport = transport
else:
self.transport = asset_service_grpc_transport.AssetServiceGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
address=self.SERVICE_ADDRESS, channel=channel, credentials=credentials
)

if client_info is None:
client_info = google.api_core.gapic_v1.client_info.ClientInfo(
gapic_version=_GAPIC_LIBRARY_VERSION, )
gapic_version=_GAPIC_LIBRARY_VERSION
)
else:
client_info.gapic_version = _GAPIC_LIBRARY_VERSION
self._client_info = client_info
Expand All @@ -167,7 +166,8 @@ def __init__(self,
# (Ordinarily, these are the defaults specified in the `*_config.py`
# file next to this one.)
self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
client_config['interfaces'][self._INTERFACE_NAME], )
client_config["interfaces"][self._INTERFACE_NAME]
)

# Save a dictionary of cached API call functions.
# These are the actual callables which invoke the proper
Expand All @@ -176,15 +176,17 @@ def __init__(self,
self._inner_api_calls = {}

# Service calls
def export_assets(self,
parent,
output_config,
read_time=None,
asset_types=None,
content_type=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
def export_assets(
self,
parent,
output_config,
read_time=None,
asset_types=None,
content_type=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Exports assets with time and resource types to a given Cloud Storage
location. The output format is newline-delimited JSON. This API
Expand Down Expand Up @@ -253,15 +255,15 @@ def export_assets(self,
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if 'export_assets' not in self._inner_api_calls:
if "export_assets" not in self._inner_api_calls:
self._inner_api_calls[
'export_assets'] = google.api_core.gapic_v1.method.wrap_method(
self.transport.export_assets,
default_retry=self._method_configs['ExportAssets'].retry,
default_timeout=self._method_configs['ExportAssets'].
timeout,
client_info=self._client_info,
)
"export_assets"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.export_assets,
default_retry=self._method_configs["ExportAssets"].retry,
default_timeout=self._method_configs["ExportAssets"].timeout,
client_info=self._client_info,
)

request = asset_service_pb2.ExportAssetsRequest(
parent=parent,
Expand All @@ -270,8 +272,9 @@ def export_assets(self,
asset_types=asset_types,
content_type=content_type,
)
operation = self._inner_api_calls['export_assets'](
request, retry=retry, timeout=timeout, metadata=metadata)
operation = self._inner_api_calls["export_assets"](
request, retry=retry, timeout=timeout, metadata=metadata
)
return google.api_core.operation.from_gapic(
operation,
self.transport._operations_client,
Expand All @@ -280,14 +283,15 @@ def export_assets(self,
)

def batch_get_assets_history(
self,
parent,
content_type,
read_time_window,
asset_names=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
self,
parent,
content_type,
read_time_window,
asset_names=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Batch gets the update history of assets that overlap a time window. For
RESOURCE content, this API outputs history with asset in both non-delete
Expand Down Expand Up @@ -350,22 +354,22 @@ def batch_get_assets_history(
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if 'batch_get_assets_history' not in self._inner_api_calls:
if "batch_get_assets_history" not in self._inner_api_calls:
self._inner_api_calls[
'batch_get_assets_history'] = google.api_core.gapic_v1.method.wrap_method(
self.transport.batch_get_assets_history,
default_retry=self.
_method_configs['BatchGetAssetsHistory'].retry,
default_timeout=self.
_method_configs['BatchGetAssetsHistory'].timeout,
client_info=self._client_info,
)
"batch_get_assets_history"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.batch_get_assets_history,
default_retry=self._method_configs["BatchGetAssetsHistory"].retry,
default_timeout=self._method_configs["BatchGetAssetsHistory"].timeout,
client_info=self._client_info,
)

request = asset_service_pb2.BatchGetAssetsHistoryRequest(
parent=parent,
content_type=content_type,
read_time_window=read_time_window,
asset_names=asset_names,
)
return self._inner_api_calls['batch_get_assets_history'](
request, retry=retry, timeout=timeout, metadata=metadata)
return self._inner_api_calls["batch_get_assets_history"](
request, retry=retry, timeout=timeout, metadata=metadata
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"google.cloud.asset.v1beta1.AssetService": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": []
"non_idempotent": [],
},
"retry_params": {
"default": {
Expand All @@ -13,21 +13,21 @@
"initial_rpc_timeout_millis": 20000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000
"total_timeout_millis": 600000,
}
},
"methods": {
"ExportAssets": {
"timeout_millis": 600000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
"retry_params_name": "default",
},
"BatchGetAssetsHistory": {
"timeout_millis": 600000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
}
}
"retry_params_name": "default",
},
},
}
}
}
2 changes: 2 additions & 0 deletions asset/google/cloud/asset_v1beta1/gapic/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class NullValue(enum.IntEnum):
Attributes:
NULL_VALUE (int): Null value.
"""

NULL_VALUE = 0


Expand All @@ -40,6 +41,7 @@ class ContentType(enum.IntEnum):
RESOURCE (int): Resource metadata.
IAM_POLICY (int): The actual IAM policy set on a resource.
"""

CONTENT_TYPE_UNSPECIFIED = 0
RESOURCE = 1
IAM_POLICY = 2
Loading

0 comments on commit 52b4639

Please sign in to comment.