Skip to content

Commit e91b1ef

Browse files
authored
Turn on disallow_untyped_calls except for sphinx_js.parsers (#271)
1 parent b1c7548 commit e91b1ef

6 files changed

Lines changed: 22 additions & 20 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ updates:
88
groups:
99
github-actions:
1010
patterns:
11-
- "*" # Group all Actions updates into a single larger pull request
11+
- "*" # Group all Actions updates into a single larger pull request
1212
schedule:
1313
interval: weekly

README.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ misleadingly under an "Arguments" heading. Still, it's better than nothing
255255
until we can do it properly.
256256

257257
If you are using typedoc, it also is possible to destructure keyword arguments
258-
by using the `@destructure` tag::
258+
by using the ``@destructure`` tag::
259259

260260
/**
261261
* @param options
@@ -446,7 +446,7 @@ Typescript: Cross references
446446
----------------------------
447447

448448
Typescript types will be converted to cross references. To render cross
449-
references, you can define a hook in ``conf.py`` called `ts_type_xref_formatter`. It
449+
references, you can define a hook in ``conf.py`` called ``ts_type_xref_formatter``. It
450450
should take two arguments: the first argument is the sphinx confix, and the
451451
second is an ``sphinx_js.ir.TypeXRef`` object. This has a ``name`` field and two
452452
variants:
@@ -465,7 +465,7 @@ place of the type. For example:
465465
name = rst.escape(xref.name)
466466
return f":js:{xref.kind}:`{name}`"
467467
else:
468-
# Otherwise, don't insert a xref
468+
# Otherwise, don't insert a xref
469469
return xref.name
470470
471471
@@ -495,20 +495,20 @@ Configuration Reference
495495
If using TypeDoc, specify the path of ``tsconfig.json`` file
496496

497497
``ts_type_xref_formatter``
498-
A function for formatting typescript type cross referenes. See the
498+
A function for formatting typescript type cross references. See the
499499
"Typescript: Cross references" section below.
500500

501501
``ts_type_bold``
502-
Make all typescript types bold if `true`.
502+
Make all typescript types bold if ``true``.
503503

504504
``ts_sphinx_js_config``
505505
A link to a typescript config file.
506506

507-
The `ts_sphinx_js_config` file
507+
The ``ts_sphinx_js_config`` file
508508
------------------------------
509509

510510
This file should be a typescript module. It's executed in a context where it can
511-
import `typedoc` and `sphinx_js`. These functions take TypeDoc IR objects as
511+
import ``typedoc`` and ``sphinx_js``. These functions take TypeDoc IR objects as
512512
arguments. Since the TypeDoc IR is unstable, this config may often break when
513513
switching TypeDoc versions. However, these hooks are very powerful so using them
514514
may be worthwhile anyways. This API is experimental and may change in the
@@ -522,7 +522,7 @@ functions::
522522
* ``shouldDestructureArg: (param: ParameterReflection) => boolean``
523523

524524
This function takes a ``ParameterReflection`` and decides if it should be
525-
destructured. If so, it's equivalent to putting a `@destructure` tag for the
525+
destructured. If so, it's equivalent to putting a ``@destructure`` tag for the
526526
argument. For example:
527527

528528
.. code_block:: ts
@@ -544,7 +544,7 @@ functions::
544544
changes.
545545

546546
For example, this ``postConvert`` hook removes the constructor from classes marked with
547-
`@hideconstructor`.
547+
``@hideconstructor``.
548548

549549
.. code_block:: ts
550550

@@ -556,7 +556,7 @@ functions::
556556
}
557557
}
558558

559-
To use it, you'll also need to add a tag defintion for `@hideconstructor` to your `tsdoc.json` file:
559+
To use it, you'll also need to add a tag definition for ``@hideconstructor`` to your ``tsdoc.json`` file:
560560

561561
.. code_block:: json
562562

@@ -652,7 +652,7 @@ Version History
652652
===============
653653

654654
5.0.0: (Unreleased)
655-
* Droped support for Python 3.9 (pyodide/sphinx-js-fork#7)
655+
* Dropped support for Python 3.9 (pyodide/sphinx-js-fork#7)
656656
* Dropped support for typedoc 0.15, added support for typedoc 0.25--0.28
657657
(pyodide/sphinx-js-fork#11, pyodide/sphinx-js-fork#22,
658658
pyodide/sphinx-js-fork#31, pyodide/sphinx-js-fork#39,
@@ -665,7 +665,7 @@ Version History
665665
(pyodide/sphinx-js-fork#25)
666666
* Only monkeypatch Sphinx classes when sphinx_js extension is used
667667
(pyodide/sphinx-js-fork#27)
668-
* Allow using installation of ``typedoc`` or ``jsdoc`` from `node_modules`
668+
* Allow using installation of ``typedoc`` or ``jsdoc`` from ``node_modules``
669669
instead of requiring global install. (pyodide/sphinx-js-fork#33)
670670
* Handle markdown style codepens correctly in typedoc comments.
671671
(pyodide/sphinx-js-fork#47)
@@ -697,7 +697,7 @@ Version History
697697
* Fixed crash when objects are reexported. (pyodide/sphinx-js-fork#126)
698698
* Added ``jsdoc_tsconfig_path`` which can specify the path to the
699699
``tsconfig.json`` file that should be used. (pyodide/sphinx-js-fork#116)
700-
* Added a `js:interface` directive (pyodide/sphinx-js-fork#138).
700+
* Added a ``js:interface`` directive (pyodide/sphinx-js-fork#138).
701701
* Removed parentheses from xrefs to classes (pyodide/sphinx-js-fork#155).
702702
* Added a ``:js:typealias:`` directive (pyodide/sphinx-js-fork#156).
703703
* Added rendering for conditional, indexed access, inferred, mapped, optional,
@@ -750,7 +750,7 @@ Version History
750750

751751
3.1.1: (March 23rd, 2021)
752752
* Rewrite large parts of the suffix tree that powers path lookup. This fixes
753-
several crasher.
753+
several crashes.
754754

755755
3.1: (September 10th, 2020)
756756
* Re-architect language analysis. There is now a well-documented intermediate

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ warn_unused_configs = true
7272
check_untyped_defs = true
7373
disallow_any_generics = true
7474
disallow_subclassing_any = true
75-
disallow_untyped_calls = false
75+
disallow_untyped_calls = true
7676
disallow_untyped_defs = true
7777
disallow_incomplete_defs = true
7878
disallow_untyped_decorators = true
@@ -86,6 +86,7 @@ strict_equality = true
8686
[[tool.mypy.overrides]]
8787
module = "sphinx_js.parsers"
8888
disallow_untyped_defs = false
89+
disallow_untyped_calls = false
8990

9091

9192
[tool.ruff]

sphinx_js/renderers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,8 @@ def format_table(self, items: list[tuple[str, str, str]]) -> list[Node]:
844844
def append_row(column_texts: list[tuple[str, str]]) -> None:
845845
row = nodes.row("")
846846
source, line = self._directive.state_machine.get_source_and_line()
847+
assert source
848+
assert line
847849
for [text, cls] in column_texts:
848850
node = nodes.paragraph("")
849851
vl = StringList()

tests/test_build_js/test_build_js.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
from tests.testing import SphinxBuildTestCase
44

5-
6-
SPHINX_VERSION = tuple(int(part) for part in sphinx_version.split('.'))
5+
SPHINX_VERSION = tuple(int(part) for part in sphinx_version.split("."))
76

87
# NOTE(willkg): This is the version of Sphinx that removes trailing " --" from
98
# :params: lines when there is no description.

tests/test_ir.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_missing_default():
6060
is_static=False,
6161
is_private=False,
6262
readonly=False,
63-
type=[]
63+
type=[],
6464
)
6565
attr_dict = {k: v for k, v in getmembers(attribute_base) if not k.startswith("_")}
6666

@@ -78,7 +78,7 @@ def attr_with(**kwargs):
7878
is_async=False,
7979
params=[],
8080
exceptions=[],
81-
returns=[]
81+
returns=[],
8282
)
8383
func_dict = {k: v for k, v in getmembers(function_base) if not k.startswith("_")}
8484

0 commit comments

Comments
 (0)