Skip to content

Commit db9be66

Browse files
chore(python): run blacken session for all directories with a noxfile (#150)
Source-Link: googleapis/synthtool@bc0de6e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:39ad8c0570e4f5d2d3124a509de4fe975e799e2b97e0f58aed88f8880d5a8b60 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent ad4c1ff commit db9be66

8 files changed

+14
-44
lines changed

privateca/snippets/create_ca_pool.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ def create_ca_pool(project_id: str, location: str, ca_pool_name: str) -> None:
3939

4040
# Create the pool request.
4141
request = privateca_v1.CreateCaPoolRequest(
42-
parent=location_path,
43-
ca_pool_id=ca_pool_name,
44-
ca_pool=ca_pool,
42+
parent=location_path, ca_pool_id=ca_pool_name, ca_pool=ca_pool,
4543
)
4644

4745
# Create the CA pool.

privateca/snippets/create_certificate.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def create_certificate(
5454

5555
# Set the Public Key and its format.
5656
public_key = privateca_v1.PublicKey(
57-
key=public_key_bytes,
58-
format_=privateca_v1.PublicKey.KeyFormat.PEM,
57+
key=public_key_bytes, format_=privateca_v1.PublicKey.KeyFormat.PEM,
5958
)
6059

6160
subject_config = privateca_v1.CertificateConfig.SubjectConfig(
@@ -67,12 +66,10 @@ def create_certificate(
6766
x509_parameters = privateca_v1.X509Parameters(
6867
key_usage=privateca_v1.KeyUsage(
6968
base_key_usage=privateca_v1.KeyUsage.KeyUsageOptions(
70-
digital_signature=True,
71-
key_encipherment=True,
69+
digital_signature=True, key_encipherment=True,
7270
),
7371
extended_key_usage=privateca_v1.KeyUsage.ExtendedKeyUsageOptions(
74-
server_auth=True,
75-
client_auth=True,
72+
server_auth=True, client_auth=True,
7673
),
7774
),
7875
)

privateca/snippets/create_certificate_authority.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,10 @@ def create_certificate_authority(
5858
x509_parameters = privateca_v1.X509Parameters(
5959
key_usage=privateca_v1.KeyUsage(
6060
base_key_usage=privateca_v1.KeyUsage.KeyUsageOptions(
61-
crl_sign=True,
62-
cert_sign=True,
61+
crl_sign=True, cert_sign=True,
6362
)
6463
),
65-
ca_options=privateca_v1.X509Parameters.CaOptions(
66-
is_ca=True,
67-
),
64+
ca_options=privateca_v1.X509Parameters.CaOptions(is_ca=True,),
6865
)
6966

7067
# Set certificate authority settings.
@@ -73,8 +70,7 @@ def create_certificate_authority(
7370
type_=privateca_v1.CertificateAuthority.Type.SELF_SIGNED,
7471
key_spec=key_version_spec,
7572
config=privateca_v1.CertificateConfig(
76-
subject_config=subject_config,
77-
x509_config=x509_parameters,
73+
subject_config=subject_config, x509_config=x509_parameters,
7874
),
7975
lifetime=duration_pb2.Duration(seconds=ca_duration),
8076
)

privateca/snippets/enable_certificate_authority.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ def enable_certificate_authority(
3838
)
3939

4040
# Create the Enable Certificate Authority Request.
41-
request = privateca_v1.EnableCertificateAuthorityRequest(
42-
name=ca_path,
43-
)
41+
request = privateca_v1.EnableCertificateAuthorityRequest(name=ca_path,)
4442

4543
# Enable the Certificate Authority.
4644
operation = caServiceClient.enable_certificate_authority(request=request)

privateca/snippets/list_certificates.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
import google.cloud.security.privateca_v1 as privateca_v1
2020

2121

22-
def list_certificates(
23-
project_id: str,
24-
location: str,
25-
ca_pool_name: str,
26-
) -> None:
22+
def list_certificates(project_id: str, location: str, ca_pool_name: str,) -> None:
2723
"""
2824
List Certificates present in the given CA pool.
2925

privateca/snippets/revoke_certificate.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222

2323

2424
def revoke_certificate(
25-
project_id: str,
26-
location: str,
27-
ca_pool_name: str,
28-
certificate_name: str,
25+
project_id: str, location: str, ca_pool_name: str, certificate_name: str,
2926
) -> None:
3027
"""
3128
Revoke an issued certificate. Once revoked, the certificate will become invalid and will expire post its lifetime.

privateca/snippets/test_certificate_authorities.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,8 @@ def test_enable_and_disable_certificate_authority(
6767

6868
out, _ = capsys.readouterr()
6969

70-
assert re.search(
71-
f"Enabled Certificate Authority: {CA_NAME}",
72-
out,
73-
)
74-
assert re.search(
75-
f"Disabled Certificate Authority: {CA_NAME}",
76-
out,
77-
)
70+
assert re.search(f"Enabled Certificate Authority: {CA_NAME}", out,)
71+
assert re.search(f"Disabled Certificate Authority: {CA_NAME}", out,)
7872

7973

8074
def test_delete_certificate_authority(capsys: typing.Any) -> None:
@@ -90,7 +84,4 @@ def test_delete_certificate_authority(capsys: typing.Any) -> None:
9084

9185
out, _ = capsys.readouterr()
9286

93-
assert re.search(
94-
f"Successfully deleted Certificate Authority: {CA_NAME}",
95-
out,
96-
)
87+
assert re.search(f"Successfully deleted Certificate Authority: {CA_NAME}", out,)

privateca/snippets/test_certificates.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ def test_create_and_revoke_certificate_authority(
7575
)
7676

7777
revoke_certificate(
78-
PROJECT,
79-
LOCATION,
80-
CA_POOL_NAME,
81-
CERT_NAME,
78+
PROJECT, LOCATION, CA_POOL_NAME, CERT_NAME,
8279
)
8380

8481
disable_certificate_authority(PROJECT, LOCATION, CA_POOL_NAME, CA_NAME)

0 commit comments

Comments
 (0)