Skip to content

chore: fix mypy warnings in experimentation/

What does this merge request do and why?

This MR fixes all mypy warnings on ai_gateway/experimentation folder.

# Remove `ai_gateway/experimentation` from https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/blob/main/Makefile#L18
❯ make check-mypy
Installing lint dependencies...
Installing dependencies from lock file

No dependencies to install or update

Installing the current project: ai_gateway (0.1.0)
Running mypy check...
ai_gateway/experimentation/base.py:22: error: Incompatible default for argument "variants" (default has type "None", argument has type "list[Any]")  [assignment]
ai_gateway/experimentation/base.py:22: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
ai_gateway/experimentation/base.py:22: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
ai_gateway/experimentation/base.py:22: error: Incompatible default for argument "weights" (default has type "None", argument has type "list[Any]")  [assignment]
ai_gateway/experimentation/experiments/exp_truncate_suffix.py:27: error: Argument 2 to "from_language_id" of "CodeParser" has incompatible type "LanguageId | None"; expected "LanguageId"  [arg-type]
ai_gateway/experimentation/provider.py:8: error: Incompatible return value type (got "dependency_injector.providers.List", expected "list[Experiment]")  [return-value]
Found 4 errors in 3 files (checked 112 source files)
make: *** [Makefile:100: check-mypy] Error 1

How to set up and validate locally

  1. Check out to this merge request's branch.
  2. Ensure the following command does not result in any warnings.
    make check-mypy

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.

Contributes to #715 (closed)

Edited by Tan Le

Merge request reports

Loading