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

Upgrade Mypy to version 0.812 #1705

Merged
merged 3 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ flake8~=3.7
isort~=5.6
black>=19.3b0,==19.*
httpretty~=1.0
mypy==0.790
mypy==0.812
sphinx~=2.1
sphinx-rtd-theme~=0.4
sphinx-autodoc-typehints~=1.10.2
Expand Down
Empty file.
8 changes: 4 additions & 4 deletions opentelemetry-api/src/opentelemetry/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def _load_runtime_context(func: _F) -> _F:
A wrapper of the decorated method.
"""

@wraps(func) # type: ignore
def wrapper(
@wraps(func) # type: ignore[misc]
def wrapper( # type: ignore[misc]
*args: typing.Tuple[typing.Any, typing.Any],
**kwargs: typing.Dict[typing.Any, typing.Any]
) -> typing.Optional[typing.Any]:
Expand All @@ -63,9 +63,9 @@ def wrapper(
logger.error(
"Failed to load context: %s", configured_context
)
return func(*args, **kwargs) # type: ignore
return func(*args, **kwargs) # type: ignore[misc]

return wrapper # type:ignore
return typing.cast(_F, wrapper) # type: ignore[misc]


def get_value(key: str, context: typing.Optional[Context] = None) -> "object":
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-api/src/opentelemetry/util/_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
)
from time import time

def _time_ns():
def _time_ns() -> int:
return int(time() * 1e9)


Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-api/tests/baggage/test_baggage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# type: ignore

import unittest

from opentelemetry import baggage, context
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-api/tests/baggage/test_baggage_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# type: ignore

import unittest
from unittest.mock import Mock, patch

Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-api/tests/propagators/test_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# type: ignore

import unittest
from unittest.mock import Mock

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# type: ignore

import unittest

from opentelemetry import baggage, trace
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-api/tests/propagators/test_propagators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# type: ignore

from importlib import reload
from os import environ
from unittest import TestCase
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-api/tests/trace/propagation/test_textmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# type: ignore

import unittest

from opentelemetry.propagators.textmap import DictGetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# type: ignore

import typing
import unittest
from unittest.mock import Mock, patch
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ commands =
test: pytest {posargs}
coverage: {toxinidir}/scripts/coverage.sh

mypy: mypy --namespace-packages opentelemetry-api/src/opentelemetry/
mypy: mypy --namespace-packages --explicit-package-bases opentelemetry-api/src/opentelemetry/
; For test code, we don't want to enforce the full mypy strictness
mypy: mypy --namespace-packages --config-file=mypy-relaxed.ini opentelemetry-api/tests/

Expand Down