Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6cc280d

Browse files
Update dependencies (#31)
1 parent 3903438 commit 6cc280d

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
12+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11-dev"]
1313

1414
steps:
1515
- uses: actions/checkout@v1

autotyping/autotyping.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
import libcst
88
from libcst.codemod import CodemodContext, VisitorBasedCodemodCommand
99
from libcst.codemod.visitors import AddImportsVisitor
10-
from libcst.metadata import PositionProvider
10+
from libcst.metadata import CodePosition, CodeRange, PositionProvider
11+
12+
_DEFAULT_POSITION = CodePosition(0, 0)
13+
_DEFAULT_CODE_RANGE = CodeRange(_DEFAULT_POSITION, _DEFAULT_POSITION)
1114

1215

1316
@dataclass
@@ -294,7 +297,9 @@ def leave_FunctionDef(
294297
lineno_node = original_node.decorators[0]
295298
else:
296299
lineno_node = original_node
297-
pos = self.get_metadata(PositionProvider, lineno_node).start
300+
pos = self.get_metadata(
301+
PositionProvider, lineno_node, _DEFAULT_CODE_RANGE
302+
).start
298303
key = (self.context.filename, pos.line, pos.column)
299304
suggestion = self.state.pyanalyze_suggestions.get(key)
300305
if suggestion is not None and not (
@@ -442,7 +447,9 @@ def leave_Param(
442447
if original_node.annotation is not None:
443448
return updated_node
444449
if self.state.pyanalyze_suggestions and self.context.filename:
445-
pos = self.get_metadata(PositionProvider, original_node).start
450+
pos = self.get_metadata(
451+
PositionProvider, original_node, _DEFAULT_CODE_RANGE
452+
).start
446453
key = (self.context.filename, pos.line, pos.column)
447454
suggestion = self.state.pyanalyze_suggestions.get(key)
448455
if suggestion is not None and not (

tox.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
minversion=2.3.1
3-
envlist = py36,py37,py38,py39,py310,black,pyanalyze
3+
envlist = py36,py37,py38,py39,py310,py311,black,pyanalyze
44

55
[testenv]
66
deps =
@@ -11,13 +11,13 @@ commands =
1111

1212
[testenv:black]
1313
deps =
14-
black == 21.12b0
14+
black == 22.6.0
1515
commands =
1616
black --check .
1717

1818
[testenv:pyanalyze]
1919
deps =
20-
pyanalyze == 0.5.0
20+
pyanalyze == 0.7.0
2121
commands =
2222
python -m pyanalyze -e missing_return_annotation -e missing_parameter_annotation autotyping
2323

@@ -28,3 +28,4 @@ python =
2828
3.8: py38
2929
3.9: py39, black, pyanalyze
3030
3.10: py310
31+
3.11-dev: py311

0 commit comments

Comments
 (0)