From 6012b9bf21f1e987b50056c2d780f0160c364bab Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 28 May 2020 09:49:59 -0700 Subject: [PATCH] chore: use latest sphinx (#12) --- .../docs/conf.py | 5 +- .../services/reservation_service/client.py | 36 ++++++------- .../noxfile.py | 2 +- .../synth.metadata | 8 +-- .../test_reservation_service.py | 54 +++++++++---------- 5 files changed, 51 insertions(+), 54 deletions(-) diff --git a/packages/google-cloud-bigquery-reservation/docs/conf.py b/packages/google-cloud-bigquery-reservation/docs/conf.py index 3d4c331155b5..75044379916f 100644 --- a/packages/google-cloud-bigquery-reservation/docs/conf.py +++ b/packages/google-cloud-bigquery-reservation/docs/conf.py @@ -38,6 +38,7 @@ "sphinx.ext.napoleon", "sphinx.ext.todo", "sphinx.ext.viewcode", + "recommonmark", ] # autodoc/autosummary flags @@ -49,10 +50,6 @@ # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] diff --git a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/client.py b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/client.py index 21a4397f5068..e1e63e1efa2b 100644 --- a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/client.py +++ b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/client.py @@ -146,24 +146,6 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file - @staticmethod - def capacity_commitment_path( - project: str, location: str, capacity_commitment: str - ) -> str: - """Return a fully-qualified capacity_commitment string.""" - return "projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}".format( - project=project, location=location, capacity_commitment=capacity_commitment - ) - - @staticmethod - def parse_capacity_commitment_path(path: str) -> Dict[str, str]: - """Parse a capacity_commitment path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/capacityCommitments/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - @staticmethod def bi_reservation_path(project: str, location: str) -> str: """Return a fully-qualified bi_reservation string.""" @@ -217,6 +199,24 @@ def parse_assignment_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def capacity_commitment_path( + project: str, location: str, capacity_commitment: str + ) -> str: + """Return a fully-qualified capacity_commitment string.""" + return "projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}".format( + project=project, location=location, capacity_commitment=capacity_commitment + ) + + @staticmethod + def parse_capacity_commitment_path(path: str) -> Dict[str, str]: + """Parse a capacity_commitment path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/capacityCommitments/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + def __init__( self, *, diff --git a/packages/google-cloud-bigquery-reservation/noxfile.py b/packages/google-cloud-bigquery-reservation/noxfile.py index 8b5d42432b3b..e69f54092039 100644 --- a/packages/google-cloud-bigquery-reservation/noxfile.py +++ b/packages/google-cloud-bigquery-reservation/noxfile.py @@ -138,7 +138,7 @@ def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx<3.0.0", "alabaster", "recommonmark") + session.install("sphinx", "alabaster", "recommonmark") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/packages/google-cloud-bigquery-reservation/synth.metadata b/packages/google-cloud-bigquery-reservation/synth.metadata index 54c7a1df9718..1a46165bf85f 100644 --- a/packages/google-cloud-bigquery-reservation/synth.metadata +++ b/packages/google-cloud-bigquery-reservation/synth.metadata @@ -4,22 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-bigquery-reservation.git", - "sha": "c724e7db67ea1efd73b7ab0d097475187d9f5cc8" + "sha": "bd99c23ca4b29514be055cd949e24cdf2d422519" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "edd3b80fb770548d6ad780105f1782de6ff73ea0", - "internalRef": "311053644" + "sha": "eafa840ceec23b44a5c21670288107c661252711", + "internalRef": "313488995" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "470789cee75ce93c41348ad6aa4c49363a80399b" + "sha": "71b8a272549c06b5768d00fa48d3ae990e871bec" } } ], diff --git a/packages/google-cloud-bigquery-reservation/tests/unit/reservation_v1/test_reservation_service.py b/packages/google-cloud-bigquery-reservation/tests/unit/reservation_v1/test_reservation_service.py index 3b77d6ab532b..5dcfb24b1a88 100644 --- a/packages/google-cloud-bigquery-reservation/tests/unit/reservation_v1/test_reservation_service.py +++ b/packages/google-cloud-bigquery-reservation/tests/unit/reservation_v1/test_reservation_service.py @@ -2083,33 +2083,6 @@ def test_reservation_service_grpc_transport_channel_mtls_with_adc( assert transport.grpc_channel == mock_grpc_channel -def test_capacity_commitment_path(): - project = "squid" - location = "clam" - capacity_commitment = "whelk" - - expected = "projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}".format( - project=project, location=location, capacity_commitment=capacity_commitment - ) - actual = ReservationServiceClient.capacity_commitment_path( - project, location, capacity_commitment - ) - assert expected == actual - - -def test_parse_capacity_commitment_path(): - expected = { - "project": "octopus", - "location": "oyster", - "capacity_commitment": "nudibranch", - } - path = ReservationServiceClient.capacity_commitment_path(**expected) - - # Check that the path construction is reversible. - actual = ReservationServiceClient.parse_capacity_commitment_path(path) - assert expected == actual - - def test_bi_reservation_path(): project = "squid" location = "clam" @@ -2181,3 +2154,30 @@ def test_parse_assignment_path(): # Check that the path construction is reversible. actual = ReservationServiceClient.parse_assignment_path(path) assert expected == actual + + +def test_capacity_commitment_path(): + project = "squid" + location = "clam" + capacity_commitment = "whelk" + + expected = "projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}".format( + project=project, location=location, capacity_commitment=capacity_commitment + ) + actual = ReservationServiceClient.capacity_commitment_path( + project, location, capacity_commitment + ) + assert expected == actual + + +def test_parse_capacity_commitment_path(): + expected = { + "project": "octopus", + "location": "oyster", + "capacity_commitment": "nudibranch", + } + path = ReservationServiceClient.capacity_commitment_path(**expected) + + # Check that the path construction is reversible. + actual = ReservationServiceClient.parse_capacity_commitment_path(path) + assert expected == actual