Skip to content

Commit

Permalink
chore: use latest sphinx (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored May 28, 2020
1 parent 97227bf commit 6012b9b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 54 deletions.
5 changes: 1 addition & 4 deletions packages/google-cloud-bigquery-reservation/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"recommonmark",
]

# autodoc/autosummary flags
Expand All @@ -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']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<project>.+?)/locations/(?P<location>.+?)/capacityCommitments/(?P<capacity_commitment>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def bi_reservation_path(project: str, location: str) -> str:
"""Return a fully-qualified bi_reservation string."""
Expand Down Expand Up @@ -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<project>.+?)/locations/(?P<location>.+?)/capacityCommitments/(?P<capacity_commitment>.+?)$",
path,
)
return m.groupdict() if m else {}

def __init__(
self,
*,
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-bigquery-reservation/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions packages/google-cloud-bigquery-reservation/synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

0 comments on commit 6012b9b

Please sign in to comment.