Skip to content

Commit 6490a9c

Browse files
authored
Bump to 1.0.5 (#17)
* Bump to 1.0.5 * Embed fixed type hints * simplify imports (due to typing requirement) * voting mypy
1 parent 1320870 commit 6490a9c

File tree

8 files changed

+24
-85
lines changed

8 files changed

+24
-85
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ python:
77
- 3.5
88
- 3.6
99
- &mainstream_python 3.7-dev
10-
- &pypy pypy
11-
- pypy3.5
10+
- pypy
11+
- &pypy pypy3.5
1212
install:
1313
- &upgrade_python_toolset pip install --upgrade pip setuptools wheel
1414
- pip install tox-travis
@@ -27,7 +27,7 @@ jobs:
2727
- *upgrade_python_toolset
2828
- pip install tox
2929
script:
30-
- tox -e pylint,bandit
30+
- tox -e pylint,bandit,mypy
3131
after_success: skip
3232

3333
- stage: Code style check

advanced_descriptors/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'AdvancedProperty',
2222
)
2323

24-
__version__ = '1.0.4'
24+
__version__ = '1.0.5'
2525
__author__ = "Alexey Stepanov"
2626
__author_email__ = 'penguinolog@gmail.com'
2727
__maintainers__ = {

advanced_descriptors/advanced_property.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515

1616
"""Property with class-wide getter."""
1717

18-
try: # pragma: no cover
19-
import typing # noqa # pylint: disable=unused-import
20-
except ImportError: # pragma: no cover
21-
typing = None
18+
import typing # noqa: F401 # pylint: disable=unused-import
2219

2320
__all__ = (
2421
'AdvancedProperty',
@@ -153,8 +150,8 @@ def __init__(
153150

154151
def __get__(
155152
self,
156-
instance, # type: typing.Optional[object]
157-
owner # type: typing.Type[object]
153+
instance, # type: typing.Optional[typing.Any]
154+
owner # type: typing.Any
158155
): # type: (...) -> typing.Any
159156
"""Get descriptor.
160157

advanced_descriptors/advanced_property.pyi

Lines changed: 0 additions & 37 deletions
This file was deleted.

advanced_descriptors/separate_class_method.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@
1515

1616
"""Separate class and instance methods with the same name."""
1717

18-
import six
18+
import typing # noqa: F401 # pylint: disable=unused-import
1919

20-
try: # pragma: no cover
21-
import typing # pylint: disable=unused-import
22-
except ImportError: # pragma: no cover
23-
# noinspection PyRedeclaration
24-
typing = None
20+
import six
2521

2622
__all__ = (
2723
'SeparateClassMethod',
@@ -118,8 +114,8 @@ def __init__(
118114

119115
def __get__(
120116
self,
121-
instance, # type: typing.Optional[object]
122-
owner # type: typing.Type[object]
117+
instance, # type: typing.Optional[typing.Any]
118+
owner # type: typing.Any
123119
): # type: (...) -> typing.Callable[..., typing.Any]
124120
"""Get descriptor.
125121
@@ -131,16 +127,16 @@ def __get__(
131127
raise AttributeError()
132128

133129
@six.wraps(self.__class_method)
134-
def class_method(*args, **kwargs):
130+
def class_method(*args, **kwargs): # type: (typing.Tuple, typing.Dict) -> typing.Any
135131
"""Bound class method."""
136-
return self.__class_method(owner, *args, **kwargs)
132+
return self.__class_method(owner, *args, **kwargs) # type: ignore
137133

138134
return class_method
139135

140136
@six.wraps(self.__instance_method)
141-
def instance_method(*args, **kwargs):
137+
def instance_method(*args, **kwargs): # type: (typing.Tuple, typing.Dict) -> typing.Any
142138
"""Bound instance method."""
143-
return self.__instance_method(instance, *args, **kwargs)
139+
return self.__instance_method(instance, *args, **kwargs) # type: ignore
144140

145141
return instance_method
146142

advanced_descriptors/separate_class_method.pyi

Lines changed: 0 additions & 24 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def _extension(modpath):
7070
binding=True,
7171
embedsignature=True,
7272
overflowcheck=True,
73+
language_level=3,
7374
)
7475
) if cythonize is not None and PY3 else []
7576

tox.ini

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[tox]
77
minversion = 2.0
8-
envlist = pep8, pep257, py{27,34,35,36,37,py,py3}, pylint, bandit, py{34,35,36,37}-nocov, docs,
8+
envlist = pep8, pylint, mypy, bandit, pep257, py{27,34,35,36,37,py,py3}, py{34,35,36,37}-nocov, docs,
99
skipsdist = True
1010
skip_missing_interpreters = True
1111

@@ -87,7 +87,7 @@ commands = pip install ./ -vvv -U
8787

8888
[testenv:pylint]
8989
deps =
90-
pylint
90+
pylint<2
9191
-r{toxinidir}/CI_REQUIREMENTS.txt
9292
commands = pylint advanced_descriptors
9393

@@ -123,3 +123,9 @@ deps =
123123
.
124124
pipdeptree
125125
commands = pipdeptree
126+
127+
[testenv:mypy]
128+
deps =
129+
mypy>=0.620
130+
-r{toxinidir}/CI_REQUIREMENTS.txt
131+
commands = mypy --strict advanced_descriptors

0 commit comments

Comments
 (0)