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

Wrong return type in endpoints property #485

Open
Abuelodelanada opened this issue May 18, 2023 · 0 comments
Open

Wrong return type in endpoints property #485

Abuelodelanada opened this issue May 18, 2023 · 0 comments

Comments

@Abuelodelanada
Copy link
Contributor

Abuelodelanada commented May 18, 2023

The return type of this property is wrong

def endpoints(self) -> List[Dict[str, str]]:

For instance in, grafana_agent.py we append a Dict[str, Dict[str, str]] rather than a Dict[str, str]

        prometheus_endpoints = self._remote_write.endpoints

        if self._cloud.prometheus_ready:
            prometheus_endpoints.append(
                {
                    "url": self._cloud.prometheus_url,
                    "basic_auth": {
                        "username": self._cloud.credentials.username,
                        "password": self._cloud.credentials.password,
                    },
                }
            )

And this is fine.

$ tox -e static-charm
static-charm: commands[0]> pyright /home/jose/trabajos/canonical/repos/grafana-agent-k8s-operator/src
/home/jose/trabajos/canonical/repos/grafana-agent-k8s-operator/src/grafana_agent.py
  /home/jose/trabajos/canonical/repos/grafana-agent-k8s-operator/src/grafana_agent.py:430:17 - error: Argument of type "dict[str, Unknown | str | dict[str, Unknown | str]]" cannot be assigned to parameter "__object" of type "Dict[str, str]" in function "append" (reportGeneralTypeIssues)
  /home/jose/trabajos/canonical/repos/grafana-agent-k8s-operator/src/grafana_agent.py:453:13 - error: Argument of type "dict[str, str]" cannot be assigned to parameter "__value" of type "str" in function "__setitem__"
    "dict[str, str]" is incompatible with "str" (reportGeneralTypeIssues)
2 errors, 0 warnings, 0 informations 
static-charm: exit 1 (3.81 seconds) /home/jose/trabajos/canonical/repos/grafana-agent-k8s-operator> pyright /home/jose/trabajos/canonical/repos/grafana-agent-k8s-operator/src pid=3883833
  static-charm: FAIL code 1 (3.87=setup[0.06]+cmd[3.81] seconds)
  evaluation failed :( (3.96 seconds)
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

No branches or pull requests

1 participant