Skip to content

Commit dcd5c31

Browse files
committed
Extend typing in docstub
1 parent a111ba3 commit dcd5c31

5 files changed

Lines changed: 22 additions & 5 deletions

File tree

src/docstub/_analysis.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ class TypesDatabase:
410410
----------
411411
current_source : Path | None
412412
source_pkgs : list[Path]
413+
known_imports: dict[str, KnownImport]
414+
stats : dict[str, Any]
413415
414416
Examples
415417
--------

src/docstub/_cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ def report_execution_time():
144144
@click.help_option("-h", "--help")
145145
@report_execution_time()
146146
def main(source_dir, out_dir, config_path, verbose):
147+
"""
148+
Parameters
149+
----------
150+
source_dir : Path
151+
out_dir : Path
152+
config_path : Path
153+
verbose : str
154+
"""
147155
_setup_logging(verbose=verbose)
148156

149157
source_dir = Path(source_dir)

src/docstub/_docstrings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ class DoctypeTransformer(lark.visitors.Transformer):
150150
151151
Attributes
152152
----------
153-
blacklisted_qualnames : frozenset[str]
153+
types_db : ~.TypesDatabase
154+
replace_doctypes : dict[str, str]
155+
stats : dict[str, Any]
156+
blacklisted_qualnames : ClassVar[frozenset[str]]
154157
All Python keywords [1]_ are blacklisted from use in qualnames except for ``True``
155158
``False`` and ``None``.
156159

src/docstub/_stubs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ class Py2StubTransformer(cst.CSTTransformer):
291291
292292
Attributes
293293
----------
294-
types_db : ~.TypesDatabase
294+
types_db : ~.TypesDatabase | None
295+
replace_doctypes : dict[str, str] | None
296+
transformer : ~.DoctypeTransformer
295297
296298
References
297299
----------

src/docstub/_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ class ContextFormatter:
156156
More details
157157
"""
158158

159-
path: Path = None
160-
line: int = None
161-
column: int = None
159+
# docstub: off
160+
path: Path | None = None
161+
line: int | None = None
162+
column: int | None = None
163+
# docstub: on
162164

163165
def with_line(self, line=None, *, offset=0):
164166
"""Return a new copy with a modified line.

0 commit comments

Comments
 (0)