• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / RestrictedPython / 27829956296

19 Jun 2026 01:55PM UTC coverage: 98.86% (-0.01%) from 98.874%
27829956296

Pull #317

github

web-flow
Merge 9298f0590 into 643a43f83
Pull Request #317: Type Annotations for RestrictedPython

217 of 225 branches covered (96.44%)

219 of 220 new or added lines in 8 files covered. (99.55%)

2601 of 2631 relevant lines covered (98.86%)

0.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/RestrictedPython/_types.py
1
import ast
1✔
2
import sys
1✔
3
import typing
1✔
4

5

6
_T = typing.TypeVar('_T')
1✔
7

8

9
def cast_not_none(var: _T | None) -> _T:
1✔
10
    return typing.cast(_T, var)
1✔
11

12

13
# T_pos_ast are subtypes of ast.AST that have a position
14
# (have attributes: lineno, end_lineno, col_offset, and end_col_offset).
15
#
16
# ast.type_param is a new type in python 3.12 that has a position.
17
# TODO: Remove `else` when Support for Python 3.11 is dropped.
18
if sys.version_info >= (3, 12):
1!
19
    T_pos_ast: typing.TypeAlias = (
1✔
20
        ast.stmt | ast.expr | ast.excepthandler | ast.arg | ast.keyword
21
        | ast.alias | ast.pattern | ast.type_param)
22
else:
NEW
23
    T_pos_ast: typing.TypeAlias = (
×
24
        ast.stmt | ast.expr | ast.excepthandler | ast.arg | ast.keyword
25
        | ast.alias | ast.pattern)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc