Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 11f999f

Browse files
committed
fix lints
1 parent 12de05d commit 11f999f

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

cert_gen.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def generate_certificates(cert_dir="certs"):
8484
# CA END
8585

8686
# SERVER BEGIN
87-
87+
8888
# Generate new certificate for domain
8989
server_key = rsa.generate_private_key(
9090
public_exponent=65537,
@@ -150,11 +150,13 @@ def generate_certificates(cert_dir="certs"):
150150
print("\nTo trust these certificates:")
151151
print("\nOn macOS:")
152152
print(
153-
"sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain certs/server.crt"
153+
"sudo security add-trusted-cert -d -r trustRoot "
154+
"-k /Library/Keychains/System.keychain certs/server.crt"
154155
)
155156
print("\nOn Windows (PowerShell as Admin):")
156157
print(
157-
'Import-Certificate -FilePath "certs\\server.crt" -CertStoreLocation Cert:\\LocalMachine\\Root'
158+
'Import-Certificate -FilePath "certs\\server.crt" '
159+
'-CertStoreLocation Cert:\\LocalMachine\\Root'
158160
)
159161
print("\nOn Linux:")
160162
print("sudo cp certs/server.crt /usr/local/share/ca-certificates/proxy-pilot.crt")

src/codegate/ca/codegate_ca.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def generate_certificates(self) -> Tuple[str, str]:
297297

298298
# CA generated, now generate server certificate
299299

300-
## Generate new certificate for domain
300+
# Generate new certificate for domain
301301
logger.debug("Generating private key for server")
302302
server_key = rsa.generate_private_key(
303303
public_exponent=65537,
@@ -373,11 +373,13 @@ def generate_certificates(self) -> Tuple[str, str]:
373373
print("\nTo trust these certificates:")
374374
print("\nOn macOS:")
375375
print(
376-
"`sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain certs/ca.crt"
376+
"`sudo security add-trusted-cert -d -r trustRoot "
377+
"-k /Library/Keychains/System.keychain certs/ca.crt"
377378
)
378379
print("\nOn Windows (PowerShell as Admin):")
379380
print(
380-
'Import-Certificate -FilePath "certs\\ca.crt" -CertStoreLocation Cert:\\LocalMachine\\Root'
381+
'Import-Certificate -FilePath "certs\\ca.crt" '
382+
'-CertStoreLocation Cert:\\LocalMachine\\Root'
381383
)
382384
print("\nOn Linux:")
383385
print("sudo cp certs/ca.crt /usr/local/share/ca-certificates/codegate.crt")
@@ -433,7 +435,8 @@ def ensure_certificates_exist(self) -> None:
433435
self.generate_certificates()
434436
else:
435437
logger.debug(
436-
f"Certificates found at: {Config.get_config().server_cert} and {Config.get_config().server_key}"
438+
f"Certificates found at: {Config.get_config().server_cert} "
439+
"and {Config.get_config().server_key}"
437440
)
438441

439442
def get_ssl_context(self) -> ssl.SSLContext:

src/codegate/providers/copilot/provider.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ async def handle_http_request(self):
209209
self.log_decrypted_data(body, "Request Body")
210210

211211
for i in range(0, len(body), CHUNK_SIZE):
212-
chunk = body[i : i + CHUNK_SIZE]
212+
chunk = body[i: i + CHUNK_SIZE]
213213
self.target_transport.write(chunk)
214214
else:
215215
logger.debug("=" * 40)
@@ -443,14 +443,15 @@ async def get_target_url(cls, path: str) -> Optional[str]:
443443
# Then check for prefix match
444444
for route in VALIDATED_ROUTES:
445445
# For prefix matches, keep the rest of the path
446-
remaining_path = path[len(route.path) :]
446+
remaining_path = path[len(route.path):]
447447
logger.debug(f"Remaining path: {remaining_path}")
448448
# Make sure we don't end up with double slashes
449449
if remaining_path and remaining_path.startswith("/"):
450450
remaining_path = remaining_path[1:]
451451
target = urljoin(str(route.target), remaining_path)
452452
logger.debug(
453-
f"Found prefix match: {path} -> {target} (using route {route.path} -> {route.target})"
453+
f"Found prefix match: {path} -> {target} "
454+
"(using route {route.path} -> {route.target})"
454455
)
455456
return target
456457

0 commit comments

Comments
 (0)