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

Skip to content

Commit 17bd815

Browse files
guess_type fixups (#53)
- Shorter name for the file - Add docs - Remove unused import
1 parent ad9433c commit 17bd815

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ more transformations. The following are supported:
3737
default that is named `foo` with `bar.Baz`. For example, use
3838
`--annotate-named-param uid:my_types.Uid` to annotate any `uid`
3939
parameter in your codebase with no default as `my_types.Uid`.
40+
- `--guess-common-names`: infer certain parameter types from their names
41+
based on common patterns in open-source Python code. For example, infer
42+
that a `verbose` parameter is of type `bool`.
4043
- Annotating magical methods:
4144
- `--annotate-magics`: add type annotation to certain magic methods.
4245
Currently this does the following:
@@ -97,7 +100,6 @@ There are two shortcut flags to enable multiple transformations at once:
97100
- Do not add `None` return types to methods marked with `@abstractmethod` and
98101
to methods in stub files
99102
- Improve type inference:
100-
101103
- `"string" % ...` is always `str`
102104
- `b"bytes" % ...` is always `bytes`
103105
- An `and` or `or` operator where left and right sides are of the same type

autotyping/autotyping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from libcst.codemod.visitors import AddImportsVisitor
1111
from libcst.metadata import CodePosition, CodeRange, PositionProvider
1212

13-
from autotyping.guess_type_from_argname import guess_type_from_argname
13+
from autotyping.guess_type import guess_type_from_argname
1414

1515
_DEFAULT_POSITION = CodePosition(0, 0)
1616
_DEFAULT_CODE_RANGE = CodeRange(_DEFAULT_POSITION, _DEFAULT_POSITION)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Tuple, Optional, List, TYPE_CHECKING
1+
from typing import Tuple, Optional, List
22
import re
33

44

0 commit comments

Comments
 (0)