Skip to content

Commit e6a1655

Browse files
authored
fix typing in decl-param plus upgraded versions of workflow actions (#9)
* fix typing in `decl-param.py` * upgraded versions of workflow action
1 parent 1d91b62 commit e6a1655

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies
@@ -43,7 +43,7 @@ jobs:
4343
run: |
4444
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=msrc.appconfig --cov=msrc.appconfig_decl --cov-report=xml --cov-report=html
4545
- name: Upload pytest test results
46-
uses: actions/upload-artifact@v2
46+
uses: actions/upload-artifact@v3
4747
with:
4848
name: pytest-results-${{ matrix.python-version }}
4949
path: |

msrc-appconfig-param/msrc/appconfig_decl/decl_param.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22
from msrc.appconfig.schema import (
33
Element, AtomicType, TupleType, Schema, SchemaSource)
4-
from typing import Optional, Tuple, Union, Type, cast
4+
from typing import Optional, Tuple, Union, Type, Any, cast
55
import param
66
import enum
77

@@ -14,8 +14,8 @@ class IntTuple(param.NumericTuple):
1414
def _validate(self, val: object):
1515
super()._validate(val)
1616
# NumeriTuple ensures val is a numeric tuple
17-
val = cast(Tuple[object, ...], val)
1817
if val is not None:
18+
val = cast(Tuple[object, ...], val)
1919
for i, n in enumerate(val):
2020
if not isinstance(n, int):
2121
raise ValueError(
@@ -55,7 +55,9 @@ def make_element(
5555
t = TupleType(AtomicType.INT, f.length)
5656
elif isinstance(f, param.NumericTuple):
5757
t = TupleType(AtomicType.FLOAT, f.length)
58-
elif isinstance(f, param.List) and f.class_ is None:
58+
# pyright 1.1.292 inference makes param.List.class_ be Type[object]
59+
# which is incorrect.
60+
elif isinstance(f, param.List) and cast(Any, f.class_) is None:
5961
raise ValueError("List parameter %s doesn't specify type of "
6062
"list items using class_ keyword.")
6163
elif isinstance(f, param.List) and issubclass(f.class_, bool):

0 commit comments

Comments
 (0)