Skip to content

How to decrease the type checking paranoia? #1629

Discussion options

You must be logged in to vote

Maybe create a helper function like this:

def env_not_none(key: str) -> str:
    value = os.getenv(key)
    assert value is not None, f"failed to find {key}"
    return value

CONNECTION_STRING = env_not_none("CONNECTION_STRING")

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pelissarisergioo
Comment options

@Akuli
Comment options

Answer selected by pelissarisergioo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants