Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add typing for endpoint #106

Open
PietroPasotti opened this issue Mar 7, 2023 · 1 comment · Fixed by #149
Open

add typing for endpoint #106

PietroPasotti opened this issue Mar 7, 2023 · 1 comment · Fixed by #149

Comments

@PietroPasotti
Copy link
Contributor

PietroPasotti commented Mar 7, 2023

if typing.TYPE_CHECKING:
    from typing import TypedDict  # if the smallest python version we support has it! Otherwise, you could wrap this all in a try/except and if there's an error define `_EndpointDict = dict` and that's it.
    
    class _EndpointDict(TypedDict):  
        path:str
         port:int # ?
-        metrics_endpoints: List[dict] = [DEFAULT_METRICS_ENDPOINT],
+        metrics_endpoints: List["_EndpointDict"] = [DEFAULT_METRICS_ENDPOINT],      

Originally posted by @PietroPasotti in #95 (comment)

@rbarry82
Copy link
Contributor

Fortunately, since it's all clobbered into a venv for the charm, and we don't rely on anything compiled, we may even be able to get away with it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants