Skip to content

Commit

Permalink
Making mypy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Nov 13, 2023
1 parent 6b81a21 commit 83d28e5
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions exasol/connections.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import ssl
from pathlib import Path
from typing import (
Callable,
Optional,
Tuple,
Union,
)
from typing import Optional

import pyexasol
import sqlalchemy
import pyexasol # type: ignore
import sqlalchemy # type: ignore
import exasol.bucketfs as bfs # type: ignore

import exasol.bucketfs as bfs
from exasol.secret_store import Secrets


Expand All @@ -36,7 +31,7 @@ def _extract_ssl_options(conf: Secrets) -> dict:
Returns a dictionary in the winsocket-client format
(see https://websocket-client.readthedocs.io/en/latest/faq.html#what-else-can-i-do-with-sslopts)
"""
sslopt = {}
sslopt: dict[str, object] = {}

# Is server certificate validation required?
certificate_validation = _optional_str_to_bool(conf.get("CERTIFICATE_VALIDATION"))
Expand All @@ -63,9 +58,10 @@ def _extract_ssl_options(conf: Secrets) -> dict:
raise ValueError(f"Certificate file {client_certificate} doesn't exist.")
sslopt["certfile"] = client_certificate
private_key = conf.get("PRIVATE_KEY")
if not Path(private_key).is_file():
raise ValueError(f"Private key file {private_key} doesn't exist.")
sslopt["keyfile"] = private_key
if private_key is not None:
if not Path(private_key).is_file():
raise ValueError(f"Private key file {private_key} doesn't exist.")
sslopt["keyfile"] = private_key

return sslopt

Expand Down

0 comments on commit 83d28e5

Please sign in to comment.