Skip to content

Commit

Permalink
OmegaConf library passes strict mypy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
omry committed Dec 28, 2019
1 parent 7c54df2 commit 2ef5397
Show file tree
Hide file tree
Showing 31 changed files with 759 additions and 576 deletions.
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ omit =
*tests*
docs/*
omegaconf/version.py
.stubs

[report]
# Don't complain if tests don't hit defensive assertion code:
exclude_lines =
pragma: no cover
raise AssertionError
raise NotImplementedError
return NotImplemented
raise TypeError
return NotImplemented
assert False
@abstractmethod

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ TODO
.eggs
.mypy_cache
/pip-wheel-metadata
/.pyre
.dmypy.json
18 changes: 18 additions & 0 deletions .pyre_configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"source_directories": [
"."
],
"search_path": [
".stubs"
],
"exclude": [
".*\\.nox/.*",
".*build/.*"
],
"ignore_all_errors": [
"docs",
".eggs",
"noxfile.py",
"setup.py"
]
}
1 change: 1 addition & 0 deletions .stubs/nox.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def __getattr__(name): ... # type: ignore
1 change: 1 addition & 0 deletions .stubs/pytest.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def __getattr__(name): ... # type: ignore
1 change: 1 addition & 0 deletions .stubs/setuptools.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def __getattr__(name): ... # type: ignore
1 change: 1 addition & 0 deletions .stubs/yaml.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def __getattr__(name): ... # type: ignore
4 changes: 4 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# type: ignore
import nox
import os

Expand Down Expand Up @@ -51,6 +52,9 @@ def lint(session):
# if this fails you need to format your code with black
session.run("black", "--check", ".")

session.run("mypy", "tests")
session.run("mypy", "omegaconf", "--strict")


@nox.session(python=PYTHON_VERSIONS)
def test_jupyter_notebook(session):
Expand Down
6 changes: 4 additions & 2 deletions omegaconf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .container import Container
from .basecontainer import BaseContainer
from .dictconfig import DictConfig
from .errors import (
MissingMandatoryValue,
Expand All @@ -8,6 +8,7 @@
UnsupportedValueType,
)
from .listconfig import ListConfig
from .base import Node
from .nodes import (
ValueNode,
BooleanNode,
Expand All @@ -27,13 +28,14 @@
"ReadonlyConfigError",
"UnsupportedValueType",
"UnsupportedKeyType",
"Container",
"BaseContainer",
"ListConfig",
"DictConfig",
"OmegaConf",
"flag_override",
"read_write",
"open_dict",
"Node",
"ValueNode",
"AnyNode",
"IntegerNode",
Expand Down
Loading

0 comments on commit 2ef5397

Please sign in to comment.