diff --git a/packages/google-cloud-scheduler/docs/conf.py b/packages/google-cloud-scheduler/docs/conf.py index 3733362f325a..9f0d97e0912b 100644 --- a/packages/google-cloud-scheduler/docs/conf.py +++ b/packages/google-cloud-scheduler/docs/conf.py @@ -18,50 +18,50 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('..')) +sys.path.insert(0, os.path.abspath("..")) -__version__ = '0.1.0' +__version__ = "0.1.0" # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', - 'sphinx.ext.intersphinx', - 'sphinx.ext.coverage', - 'sphinx.ext.napoleon', - 'sphinx.ext.viewcode', + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.viewcode", ] # autodoc/autosummary flags -autoclass_content = 'both' -autodoc_default_flags = ['members'] +autoclass_content = "both" +autodoc_default_flags = ["members"] autosummary_generate = True # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'google-cloud-scheduler' -copyright = u'2017, Google' -author = u'Google APIs' +project = u"google-cloud-scheduler" +copyright = u"2017, Google" +author = u"Google APIs" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -70,7 +70,7 @@ # The full version, including alpha/beta/rc tags. release = __version__ # The short X.Y version. -version = '.'.join(release.split('.')[0:2]) +version = ".".join(release.split(".")[0:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -81,37 +81,37 @@ # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True @@ -120,31 +120,31 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -154,78 +154,75 @@ # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -#html_search_language = 'en' +# html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value -#html_search_options = {'type': 'default'} +# html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' +# html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'google-cloud-scheduler-doc' +htmlhelp_basename = "google-cloud-scheduler-doc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. #'preamble': '', - # Latex figure (float) alignment #'figure_align': 'htbp', } @@ -234,39 +231,51 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'google-cloud-scheduler.tex', - u'google-cloud-scheduler Documentation', author, 'manual'), + ( + master_doc, + "google-cloud-scheduler.tex", + u"google-cloud-scheduler Documentation", + author, + "manual", + ) ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, 'google-cloud-scheduler', - u'google-cloud-scheduler Documentation', [author], 1)] +man_pages = [ + ( + master_doc, + "google-cloud-scheduler", + u"google-cloud-scheduler Documentation", + [author], + 1, + ) +] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------- @@ -274,28 +283,33 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'google-cloud-scheduler', - u'google-cloud-scheduler Documentation', author, - 'google-cloud-scheduler', - 'GAPIC library for the {metadata.shortName} v1beta1 service', 'APIs'), + ( + master_doc, + "google-cloud-scheduler", + u"google-cloud-scheduler Documentation", + author, + "google-cloud-scheduler", + "GAPIC library for the {metadata.shortName} v1beta1 service", + "APIs", + ) ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False +# texinfo_no_detailmenu = False # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - 'python': ('http://python.readthedocs.org/en/latest/', None), - 'gax': ('https://gax-python.readthedocs.org/en/latest/', None), + "python": ("http://python.readthedocs.org/en/latest/", None), + "gax": ("https://gax-python.readthedocs.org/en/latest/", None), } # Napoleon settings diff --git a/packages/google-cloud-scheduler/google/__init__.py b/packages/google-cloud-scheduler/google/__init__.py index f65701dd143f..7aa71bb4e2f1 100644 --- a/packages/google-cloud-scheduler/google/__init__.py +++ b/packages/google-cloud-scheduler/google/__init__.py @@ -16,7 +16,9 @@ try: import pkg_resources + pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/packages/google-cloud-scheduler/google/cloud/__init__.py b/packages/google-cloud-scheduler/google/cloud/__init__.py index f65701dd143f..7aa71bb4e2f1 100644 --- a/packages/google-cloud-scheduler/google/cloud/__init__.py +++ b/packages/google-cloud-scheduler/google/cloud/__init__.py @@ -16,7 +16,9 @@ try: import pkg_resources + pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler.py b/packages/google-cloud-scheduler/google/cloud/scheduler.py index 18b959bbfb46..9c36258396e1 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler.py @@ -20,8 +20,4 @@ from google.cloud.scheduler_v1beta1 import enums from google.cloud.scheduler_v1beta1 import types -__all__ = ( - 'enums', - 'types', - 'CloudSchedulerClient', -) +__all__ = ("enums", "types", "CloudSchedulerClient") diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/__init__.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/__init__.py index a680792ca586..42219a4f873e 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/__init__.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/__init__.py @@ -26,8 +26,4 @@ class CloudSchedulerClient(cloud_scheduler_client.CloudSchedulerClient): enums = enums -__all__ = ( - 'enums', - 'types', - 'CloudSchedulerClient', -) +__all__ = ("enums", "types", "CloudSchedulerClient") diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client.py index dfe34ce5d465..a86a57374519 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client.py @@ -30,7 +30,9 @@ from google.cloud.scheduler_v1beta1.gapic import cloud_scheduler_client_config from google.cloud.scheduler_v1beta1.gapic import enums -from google.cloud.scheduler_v1beta1.gapic.transports import cloud_scheduler_grpc_transport +from google.cloud.scheduler_v1beta1.gapic.transports import ( + cloud_scheduler_grpc_transport, +) from google.cloud.scheduler_v1beta1.proto import cloudscheduler_pb2 from google.cloud.scheduler_v1beta1.proto import cloudscheduler_pb2_grpc from google.cloud.scheduler_v1beta1.proto import job_pb2 @@ -38,7 +40,8 @@ from google.protobuf import field_mask_pb2 _GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( - 'google-cloud-scheduler', ).version + "google-cloud-scheduler" +).version class CloudSchedulerClient(object): @@ -47,12 +50,12 @@ class CloudSchedulerClient(object): schedule asynchronous jobs. """ - SERVICE_ADDRESS = 'cloudscheduler.googleapis.com:443' + SERVICE_ADDRESS = "cloudscheduler.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.scheduler.v1beta1.CloudScheduler' + _INTERFACE_NAME = "google.cloud.scheduler.v1beta1.CloudScheduler" @classmethod def from_service_account_file(cls, filename, *args, **kwargs): @@ -68,9 +71,8 @@ def from_service_account_file(cls, filename, *args, **kwargs): Returns: CloudSchedulerClient: 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 @@ -79,15 +81,14 @@ 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 ) @classmethod def location_path(cls, project, location): """Return a fully-qualified location string.""" return google.api_core.path_template.expand( - 'projects/{project}/locations/{location}', + "projects/{project}/locations/{location}", project=project, location=location, ) @@ -96,18 +97,20 @@ def location_path(cls, project, location): def job_path(cls, project, location, job): """Return a fully-qualified job string.""" return google.api_core.path_template.expand( - 'projects/{project}/locations/{location}/jobs/{job}', + "projects/{project}/locations/{location}/jobs/{job}", project=project, location=location, job=job, ) - 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: @@ -141,18 +144,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 = cloud_scheduler_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 @@ -161,25 +165,24 @@ def __init__(self, if callable(transport): self.transport = transport( credentials=credentials, - default_class=cloud_scheduler_grpc_transport. - CloudSchedulerGrpcTransport, + default_class=cloud_scheduler_grpc_transport.CloudSchedulerGrpcTransport, ) 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 = cloud_scheduler_grpc_transport.CloudSchedulerGrpcTransport( - 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 @@ -189,7 +192,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 @@ -198,12 +202,14 @@ def __init__(self, self._inner_api_calls = {} # Service calls - def list_jobs(self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None): + def list_jobs( + self, + parent, + page_size=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): """ Lists jobs. @@ -261,38 +267,39 @@ def list_jobs(self, ValueError: If the parameters are invalid. """ # Wrap the transport method to add retry and timeout logic. - if 'list_jobs' not in self._inner_api_calls: + if "list_jobs" not in self._inner_api_calls: self._inner_api_calls[ - 'list_jobs'] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_jobs, - default_retry=self._method_configs['ListJobs'].retry, - default_timeout=self._method_configs['ListJobs'].timeout, - client_info=self._client_info, - ) + "list_jobs" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_jobs, + default_retry=self._method_configs["ListJobs"].retry, + default_timeout=self._method_configs["ListJobs"].timeout, + client_info=self._client_info, + ) - request = cloudscheduler_pb2.ListJobsRequest( - parent=parent, - page_size=page_size, - ) + request = cloudscheduler_pb2.ListJobsRequest(parent=parent, page_size=page_size) iterator = google.api_core.page_iterator.GRPCIterator( client=None, method=functools.partial( - self._inner_api_calls['list_jobs'], + self._inner_api_calls["list_jobs"], retry=retry, timeout=timeout, - metadata=metadata), + metadata=metadata, + ), request=request, - items_field='jobs', - request_token_field='page_token', - response_token_field='next_page_token', + items_field="jobs", + request_token_field="page_token", + response_token_field="next_page_token", ) return iterator - def get_job(self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None): + def get_job( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): """ Gets a job. @@ -330,25 +337,29 @@ def get_job(self, ValueError: If the parameters are invalid. """ # Wrap the transport method to add retry and timeout logic. - if 'get_job' not in self._inner_api_calls: + if "get_job" not in self._inner_api_calls: self._inner_api_calls[ - 'get_job'] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_job, - default_retry=self._method_configs['GetJob'].retry, - default_timeout=self._method_configs['GetJob'].timeout, - client_info=self._client_info, - ) + "get_job" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_job, + default_retry=self._method_configs["GetJob"].retry, + default_timeout=self._method_configs["GetJob"].timeout, + client_info=self._client_info, + ) - request = cloudscheduler_pb2.GetJobRequest(name=name, ) - return self._inner_api_calls['get_job']( - request, retry=retry, timeout=timeout, metadata=metadata) + request = cloudscheduler_pb2.GetJobRequest(name=name) + return self._inner_api_calls["get_job"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) - def create_job(self, - parent, - job, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None): + def create_job( + self, + parent, + job, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): """ Creates a job. @@ -398,28 +409,29 @@ def create_job(self, ValueError: If the parameters are invalid. """ # Wrap the transport method to add retry and timeout logic. - if 'create_job' not in self._inner_api_calls: + if "create_job" not in self._inner_api_calls: self._inner_api_calls[ - 'create_job'] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_job, - default_retry=self._method_configs['CreateJob'].retry, - default_timeout=self._method_configs['CreateJob'].timeout, - client_info=self._client_info, - ) + "create_job" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.create_job, + default_retry=self._method_configs["CreateJob"].retry, + default_timeout=self._method_configs["CreateJob"].timeout, + client_info=self._client_info, + ) - request = cloudscheduler_pb2.CreateJobRequest( - parent=parent, - job=job, + request = cloudscheduler_pb2.CreateJobRequest(parent=parent, job=job) + return self._inner_api_calls["create_job"]( + request, retry=retry, timeout=timeout, metadata=metadata ) - return self._inner_api_calls['create_job']( - request, retry=retry, timeout=timeout, metadata=metadata) - - def update_job(self, - job, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None): + + def update_job( + self, + job, + update_mask=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): """ Updates a job. @@ -475,27 +487,28 @@ def update_job(self, ValueError: If the parameters are invalid. """ # Wrap the transport method to add retry and timeout logic. - if 'update_job' not in self._inner_api_calls: + if "update_job" not in self._inner_api_calls: self._inner_api_calls[ - 'update_job'] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_job, - default_retry=self._method_configs['UpdateJob'].retry, - default_timeout=self._method_configs['UpdateJob'].timeout, - client_info=self._client_info, - ) + "update_job" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.update_job, + default_retry=self._method_configs["UpdateJob"].retry, + default_timeout=self._method_configs["UpdateJob"].timeout, + client_info=self._client_info, + ) - request = cloudscheduler_pb2.UpdateJobRequest( - job=job, - update_mask=update_mask, + request = cloudscheduler_pb2.UpdateJobRequest(job=job, update_mask=update_mask) + return self._inner_api_calls["update_job"]( + request, retry=retry, timeout=timeout, metadata=metadata ) - return self._inner_api_calls['update_job']( - request, retry=retry, timeout=timeout, metadata=metadata) - - def delete_job(self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None): + + def delete_job( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): """ Deletes a job. @@ -530,24 +543,28 @@ def delete_job(self, ValueError: If the parameters are invalid. """ # Wrap the transport method to add retry and timeout logic. - if 'delete_job' not in self._inner_api_calls: + if "delete_job" not in self._inner_api_calls: self._inner_api_calls[ - 'delete_job'] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_job, - default_retry=self._method_configs['DeleteJob'].retry, - default_timeout=self._method_configs['DeleteJob'].timeout, - client_info=self._client_info, - ) + "delete_job" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.delete_job, + default_retry=self._method_configs["DeleteJob"].retry, + default_timeout=self._method_configs["DeleteJob"].timeout, + client_info=self._client_info, + ) - request = cloudscheduler_pb2.DeleteJobRequest(name=name, ) - self._inner_api_calls['delete_job']( - request, retry=retry, timeout=timeout, metadata=metadata) + request = cloudscheduler_pb2.DeleteJobRequest(name=name) + self._inner_api_calls["delete_job"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) - def pause_job(self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None): + def pause_job( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): """ Pauses a job. @@ -590,24 +607,28 @@ def pause_job(self, ValueError: If the parameters are invalid. """ # Wrap the transport method to add retry and timeout logic. - if 'pause_job' not in self._inner_api_calls: + if "pause_job" not in self._inner_api_calls: self._inner_api_calls[ - 'pause_job'] = google.api_core.gapic_v1.method.wrap_method( - self.transport.pause_job, - default_retry=self._method_configs['PauseJob'].retry, - default_timeout=self._method_configs['PauseJob'].timeout, - client_info=self._client_info, - ) + "pause_job" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.pause_job, + default_retry=self._method_configs["PauseJob"].retry, + default_timeout=self._method_configs["PauseJob"].timeout, + client_info=self._client_info, + ) - request = cloudscheduler_pb2.PauseJobRequest(name=name, ) - return self._inner_api_calls['pause_job']( - request, retry=retry, timeout=timeout, metadata=metadata) + request = cloudscheduler_pb2.PauseJobRequest(name=name) + return self._inner_api_calls["pause_job"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) - def resume_job(self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None): + def resume_job( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): """ Resume a job. @@ -650,24 +671,28 @@ def resume_job(self, ValueError: If the parameters are invalid. """ # Wrap the transport method to add retry and timeout logic. - if 'resume_job' not in self._inner_api_calls: + if "resume_job" not in self._inner_api_calls: self._inner_api_calls[ - 'resume_job'] = google.api_core.gapic_v1.method.wrap_method( - self.transport.resume_job, - default_retry=self._method_configs['ResumeJob'].retry, - default_timeout=self._method_configs['ResumeJob'].timeout, - client_info=self._client_info, - ) + "resume_job" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.resume_job, + default_retry=self._method_configs["ResumeJob"].retry, + default_timeout=self._method_configs["ResumeJob"].timeout, + client_info=self._client_info, + ) - request = cloudscheduler_pb2.ResumeJobRequest(name=name, ) - return self._inner_api_calls['resume_job']( - request, retry=retry, timeout=timeout, metadata=metadata) + request = cloudscheduler_pb2.ResumeJobRequest(name=name) + return self._inner_api_calls["resume_job"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) - def run_job(self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None): + def run_job( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): """ Forces a job to run now. @@ -708,15 +733,17 @@ def run_job(self, ValueError: If the parameters are invalid. """ # Wrap the transport method to add retry and timeout logic. - if 'run_job' not in self._inner_api_calls: + if "run_job" not in self._inner_api_calls: self._inner_api_calls[ - 'run_job'] = google.api_core.gapic_v1.method.wrap_method( - self.transport.run_job, - default_retry=self._method_configs['RunJob'].retry, - default_timeout=self._method_configs['RunJob'].timeout, - client_info=self._client_info, - ) + "run_job" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.run_job, + default_retry=self._method_configs["RunJob"].retry, + default_timeout=self._method_configs["RunJob"].timeout, + client_info=self._client_info, + ) - request = cloudscheduler_pb2.RunJobRequest(name=name, ) - return self._inner_api_calls['run_job']( - request, retry=retry, timeout=timeout, metadata=metadata) + request = cloudscheduler_pb2.RunJobRequest(name=name) + return self._inner_api_calls["run_job"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client_config.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client_config.py index 8e65e89ff9d1..d972bce85f76 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client_config.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/cloud_scheduler_client_config.py @@ -3,7 +3,7 @@ "google.cloud.scheduler.v1beta1.CloudScheduler": { "retry_codes": { "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "non_idempotent": [] + "non_idempotent": [], }, "retry_params": { "default": { @@ -13,51 +13,51 @@ "initial_rpc_timeout_millis": 20000, "rpc_timeout_multiplier": 1.0, "max_rpc_timeout_millis": 20000, - "total_timeout_millis": 600000 + "total_timeout_millis": 600000, } }, "methods": { "ListJobs": { "timeout_millis": 10000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "default", }, "GetJob": { "timeout_millis": 10000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "default", }, "CreateJob": { "timeout_millis": 10000, "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "retry_params_name": "default", }, "UpdateJob": { "timeout_millis": 10000, "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "retry_params_name": "default", }, "DeleteJob": { "timeout_millis": 10000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "default", }, "PauseJob": { "timeout_millis": 10000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "default", }, "ResumeJob": { "timeout_millis": 10000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "default", }, "RunJob": { "timeout_millis": 10000, "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } + "retry_params_name": "default", + }, + }, } } } diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/enums.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/enums.py index 0bcdec901af4..8e2130025277 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/enums.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/enums.py @@ -32,6 +32,7 @@ class HttpMethod(enum.IntEnum): PATCH (int): HTTP PATCH OPTIONS (int): HTTP OPTIONS """ + HTTP_METHOD_UNSPECIFIED = 0 POST = 1 GET = 2 @@ -58,6 +59,7 @@ class State(enum.IntEnum): operation. To recover a job from this state, retry ``CloudScheduler.UpdateJob`` until a successful response is received. """ + STATE_UNSPECIFIED = 0 ENABLED = 1 PAUSED = 2 diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/transports/cloud_scheduler_grpc_transport.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/transports/cloud_scheduler_grpc_transport.py index 7a974dd343b2..29ec981d4ab5 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/transports/cloud_scheduler_grpc_transport.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic/transports/cloud_scheduler_grpc_transport.py @@ -27,14 +27,17 @@ class CloudSchedulerGrpcTransport(object): which can be used to take advantage of advanced features of gRPC. """ + # The scopes needed to make gRPC calls to all of the methods defined # in this service. - _OAUTH_SCOPES = ('https://www.googleapis.com/auth/cloud-platform', ) - - def __init__(self, - channel=None, - credentials=None, - address='cloudscheduler.googleapis.com:443'): + _OAUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + + def __init__( + self, + channel=None, + credentials=None, + address="cloudscheduler.googleapis.com:443", + ): """Instantiate the transport class. Args: @@ -52,29 +55,25 @@ def __init__(self, # exception (channels come with credentials baked in already). if channel is not None and credentials is not None: raise ValueError( - 'The `channel` and `credentials` arguments are mutually ' - 'exclusive.', ) + "The `channel` and `credentials` arguments are mutually " "exclusive." + ) # Create the channel. if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - ) + channel = self.create_channel(address=address, credentials=credentials) self._channel = channel # gRPC uses objects called "stubs" that are bound to the # channel and provide a basic method for each RPC. self._stubs = { - 'cloud_scheduler_stub': - cloudscheduler_pb2_grpc.CloudSchedulerStub(channel), + "cloud_scheduler_stub": cloudscheduler_pb2_grpc.CloudSchedulerStub(channel) } @classmethod - def create_channel(cls, - address='cloudscheduler.googleapis.com:443', - credentials=None): + def create_channel( + cls, address="cloudscheduler.googleapis.com:443", credentials=None + ): """Create and return a gRPC channel object. Args: @@ -89,9 +88,7 @@ def create_channel(cls, grpc.Channel: A gRPC channel object. """ return google.api_core.grpc_helpers.create_channel( - address, - credentials=credentials, - scopes=cls._OAUTH_SCOPES, + address, credentials=credentials, scopes=cls._OAUTH_SCOPES ) @property @@ -114,7 +111,7 @@ def list_jobs(self): deserialized request object and returns a deserialized response object. """ - return self._stubs['cloud_scheduler_stub'].ListJobs + return self._stubs["cloud_scheduler_stub"].ListJobs @property def get_job(self): @@ -127,7 +124,7 @@ def get_job(self): deserialized request object and returns a deserialized response object. """ - return self._stubs['cloud_scheduler_stub'].GetJob + return self._stubs["cloud_scheduler_stub"].GetJob @property def create_job(self): @@ -140,7 +137,7 @@ def create_job(self): deserialized request object and returns a deserialized response object. """ - return self._stubs['cloud_scheduler_stub'].CreateJob + return self._stubs["cloud_scheduler_stub"].CreateJob @property def update_job(self): @@ -161,7 +158,7 @@ def update_job(self): deserialized request object and returns a deserialized response object. """ - return self._stubs['cloud_scheduler_stub'].UpdateJob + return self._stubs["cloud_scheduler_stub"].UpdateJob @property def delete_job(self): @@ -174,7 +171,7 @@ def delete_job(self): deserialized request object and returns a deserialized response object. """ - return self._stubs['cloud_scheduler_stub'].DeleteJob + return self._stubs["cloud_scheduler_stub"].DeleteJob @property def pause_job(self): @@ -192,7 +189,7 @@ def pause_job(self): deserialized request object and returns a deserialized response object. """ - return self._stubs['cloud_scheduler_stub'].PauseJob + return self._stubs["cloud_scheduler_stub"].PauseJob @property def resume_job(self): @@ -210,7 +207,7 @@ def resume_job(self): deserialized request object and returns a deserialized response object. """ - return self._stubs['cloud_scheduler_stub'].ResumeJob + return self._stubs["cloud_scheduler_stub"].ResumeJob @property def run_job(self): @@ -226,4 +223,4 @@ def run_job(self): deserialized request object and returns a deserialized response object. """ - return self._stubs['cloud_scheduler_stub'].RunJob + return self._stubs["cloud_scheduler_stub"].RunJob diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/types.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/types.py index 5f2f41c8f063..a72ac9f1ebfe 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/types.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/types.py @@ -42,11 +42,7 @@ status_pb2, ] -_local_modules = [ - cloudscheduler_pb2, - job_pb2, - target_pb2, -] +_local_modules = [cloudscheduler_pb2, job_pb2, target_pb2] names = [] @@ -56,7 +52,7 @@ names.append(name) for module in _local_modules: for name, message in get_messages(module).items(): - message.__module__ = 'google.cloud.scheduler_v1beta1.types' + message.__module__ = "google.cloud.scheduler_v1beta1.types" setattr(sys.modules[__name__], name, message) names.append(name) diff --git a/packages/google-cloud-scheduler/tests/unit/gapic/v1beta1/test_cloud_scheduler_client_v1beta1.py b/packages/google-cloud-scheduler/tests/unit/gapic/v1beta1/test_cloud_scheduler_client_v1beta1.py index 5f7a62a024f9..6beb3582e250 100644 --- a/packages/google-cloud-scheduler/tests/unit/gapic/v1beta1/test_cloud_scheduler_client_v1beta1.py +++ b/packages/google-cloud-scheduler/tests/unit/gapic/v1beta1/test_cloud_scheduler_client_v1beta1.py @@ -52,10 +52,7 @@ def __init__(self, responses=[]): self.responses = responses self.requests = [] - def unary_unary(self, - method, - request_serializer=None, - response_deserializer=None): + def unary_unary(self, method, request_serializer=None, response_deserializer=None): return MultiCallableStub(method, self) @@ -66,22 +63,21 @@ class CustomException(Exception): class TestCloudSchedulerClient(object): def test_list_jobs(self): # Setup Expected Response - next_page_token = '' + next_page_token = "" jobs_element = {} jobs = [jobs_element] - expected_response = {'next_page_token': next_page_token, 'jobs': jobs} - expected_response = cloudscheduler_pb2.ListJobsResponse( - **expected_response) + expected_response = {"next_page_token": next_page_token, "jobs": jobs} + expected_response = cloudscheduler_pb2.ListJobsResponse(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup Request - parent = client.location_path('[PROJECT]', '[LOCATION]') + parent = client.location_path("[PROJECT]", "[LOCATION]") paged_list_response = client.list_jobs(parent) resources = list(paged_list_response) @@ -96,13 +92,13 @@ def test_list_jobs(self): def test_list_jobs_exception(self): channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup request - parent = client.location_path('[PROJECT]', '[LOCATION]') + parent = client.location_path("[PROJECT]", "[LOCATION]") paged_list_response = client.list_jobs(parent) with pytest.raises(CustomException): @@ -110,27 +106,27 @@ def test_list_jobs_exception(self): def test_get_job(self): # Setup Expected Response - name_2 = 'name2-1052831874' - description = 'description-1724546052' - schedule = 'schedule-697920873' - time_zone = 'timeZone36848094' + name_2 = "name2-1052831874" + description = "description-1724546052" + schedule = "schedule-697920873" + time_zone = "timeZone36848094" expected_response = { - 'name': name_2, - 'description': description, - 'schedule': schedule, - 'time_zone': time_zone + "name": name_2, + "description": description, + "schedule": schedule, + "time_zone": time_zone, } expected_response = job_pb2.Job(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup Request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") response = client.get_job(name) assert expected_response == response @@ -143,61 +139,60 @@ def test_get_job(self): def test_get_job_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") with pytest.raises(CustomException): client.get_job(name) def test_create_job(self): # Setup Expected Response - name = 'name3373707' - description = 'description-1724546052' - schedule = 'schedule-697920873' - time_zone = 'timeZone36848094' + name = "name3373707" + description = "description-1724546052" + schedule = "schedule-697920873" + time_zone = "timeZone36848094" expected_response = { - 'name': name, - 'description': description, - 'schedule': schedule, - 'time_zone': time_zone + "name": name, + "description": description, + "schedule": schedule, + "time_zone": time_zone, } expected_response = job_pb2.Job(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup Request - parent = client.location_path('[PROJECT]', '[LOCATION]') + parent = client.location_path("[PROJECT]", "[LOCATION]") job = {} response = client.create_job(parent, job) assert expected_response == response assert len(channel.requests) == 1 - expected_request = cloudscheduler_pb2.CreateJobRequest( - parent=parent, job=job) + expected_request = cloudscheduler_pb2.CreateJobRequest(parent=parent, job=job) actual_request = channel.requests[0][1] assert expected_request == actual_request def test_create_job_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup request - parent = client.location_path('[PROJECT]', '[LOCATION]') + parent = client.location_path("[PROJECT]", "[LOCATION]") job = {} with pytest.raises(CustomException): @@ -205,21 +200,21 @@ def test_create_job_exception(self): def test_update_job(self): # Setup Expected Response - name = 'name3373707' - description = 'description-1724546052' - schedule = 'schedule-697920873' - time_zone = 'timeZone36848094' + name = "name3373707" + description = "description-1724546052" + schedule = "schedule-697920873" + time_zone = "timeZone36848094" expected_response = { - 'name': name, - 'description': description, - 'schedule': schedule, - 'time_zone': time_zone + "name": name, + "description": description, + "schedule": schedule, + "time_zone": time_zone, } expected_response = job_pb2.Job(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() @@ -238,7 +233,7 @@ def test_update_job(self): def test_update_job_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() @@ -251,13 +246,13 @@ def test_update_job_exception(self): def test_delete_job(self): channel = ChannelStub() - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup Request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") client.delete_job(name) @@ -269,40 +264,40 @@ def test_delete_job(self): def test_delete_job_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") with pytest.raises(CustomException): client.delete_job(name) def test_pause_job(self): # Setup Expected Response - name_2 = 'name2-1052831874' - description = 'description-1724546052' - schedule = 'schedule-697920873' - time_zone = 'timeZone36848094' + name_2 = "name2-1052831874" + description = "description-1724546052" + schedule = "schedule-697920873" + time_zone = "timeZone36848094" expected_response = { - 'name': name_2, - 'description': description, - 'schedule': schedule, - 'time_zone': time_zone + "name": name_2, + "description": description, + "schedule": schedule, + "time_zone": time_zone, } expected_response = job_pb2.Job(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup Request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") response = client.pause_job(name) assert expected_response == response @@ -315,40 +310,40 @@ def test_pause_job(self): def test_pause_job_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") with pytest.raises(CustomException): client.pause_job(name) def test_resume_job(self): # Setup Expected Response - name_2 = 'name2-1052831874' - description = 'description-1724546052' - schedule = 'schedule-697920873' - time_zone = 'timeZone36848094' + name_2 = "name2-1052831874" + description = "description-1724546052" + schedule = "schedule-697920873" + time_zone = "timeZone36848094" expected_response = { - 'name': name_2, - 'description': description, - 'schedule': schedule, - 'time_zone': time_zone + "name": name_2, + "description": description, + "schedule": schedule, + "time_zone": time_zone, } expected_response = job_pb2.Job(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup Request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") response = client.resume_job(name) assert expected_response == response @@ -361,40 +356,40 @@ def test_resume_job(self): def test_resume_job_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") with pytest.raises(CustomException): client.resume_job(name) def test_run_job(self): # Setup Expected Response - name_2 = 'name2-1052831874' - description = 'description-1724546052' - schedule = 'schedule-697920873' - time_zone = 'timeZone36848094' + name_2 = "name2-1052831874" + description = "description-1724546052" + schedule = "schedule-697920873" + time_zone = "timeZone36848094" expected_response = { - 'name': name_2, - 'description': description, - 'schedule': schedule, - 'time_zone': time_zone + "name": name_2, + "description": description, + "schedule": schedule, + "time_zone": time_zone, } expected_response = job_pb2.Job(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup Request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") response = client.run_job(name) assert expected_response == response @@ -407,13 +402,13 @@ def test_run_job(self): def test_run_job_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch('google.api_core.grpc_helpers.create_channel') + patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = scheduler_v1beta1.CloudSchedulerClient() # Setup request - name = client.job_path('[PROJECT]', '[LOCATION]', '[JOB]') + name = client.job_path("[PROJECT]", "[LOCATION]", "[JOB]") with pytest.raises(CustomException): client.run_job(name)