Skip to content

Commit fe1313e

Browse files
authored
Add pyright job (#3)
1 parent af683e2 commit fe1313e

File tree

7 files changed

+50
-8
lines changed

7 files changed

+50
-8
lines changed

.github/workflows/pyright.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: pyright
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: 0 9 * * 4
7+
8+
jobs:
9+
on-ubuntu-latest-py37:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python 3.7
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.7
18+
- name: Set up npm
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: 14
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install pytest
26+
- name: Check types with Pyright
27+
run: |
28+
npx pyright

pyrightconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"include": ["types_linq", "tests"],
3+
"pythonVersion": "3.7",
4+
"typeCheckingMode":"strict",
5+
"reportUnknownLambdaType": "none",
6+
"reportUnknownVariableType": "none",
7+
"reportUnknownMemberType": "none",
8+
"reportUnnecessaryIsInstance": "none",
9+
"reportUnnecessaryCast": "none",
10+
"reportUnknownArgumentType": "none",
11+
"reportUnknownParameterType": "none",
12+
"reportInvalidStubStatement": "none",
13+
"reportPrivateUsage": "none"
14+
}

tests/test_usage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ def test_selectmany2_overload1(self):
910910
dinner = [(533, ['ramen', 'rice']), (16, ['pork'])]
911911
en = Enumerable(dinner)
912912
q = en.select_many2(
913-
lambda tup, i: [i] + tup[1],
913+
lambda tup, i: [i] + tup[1], # type: ignore
914914
lambda src, c: f'{src[0]}.{c}',
915915
)
916916
assert q.to_list() == ['533.0', '533.ramen', '533.rice', '16.1', '16.pork']
@@ -1598,5 +1598,5 @@ def test_fallback(self):
15981598
en3[:7]
15991599

16001600
class OnlyHasGetItemRaises(TestElementAtMethod.OnlyHasGetItem[TSource_co]):
1601-
def __getitem__(self, _):
1601+
def __getitem__(self, _): # type: ignore[override]
16021602
raise IndexError('generic error')

types_linq/enumerable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from typing import Any, Callable, Container, Deque, Dict, Iterable, Iterator, List, NoReturn, Optional, Reversible, Sequence, Set, Sized, TYPE_CHECKING, Tuple, Type, Generic, Union
2+
from typing import Any, Callable, Container, Deque, Dict, Iterable, Iterator, List, NoReturn, Optional, Reversible, Sequence, Set, Sized, TYPE_CHECKING, Type, Generic, Union
33

44
if TYPE_CHECKING:
55
from .lookup import Lookup
@@ -112,7 +112,7 @@ def inner(s: slice = index):
112112
.reverse()._every(-step)
113113
return Enumerable(inner)
114114

115-
def __getitem__(self,
115+
def __getitem__(self, # type: ignore[override]
116116
index: Union[int, slice],
117117
) -> Union[TSource_co, Enumerable[TSource_co]]:
118118
return self._getitem_impl(index, fallback=False)

types_linq/enumerable.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class Enumerable(Sequence[TSource_co], Generic[TSource_co]):
2929
'''
3030

3131
@overload
32-
def __init__(self, __iterable: Iterable[TSource_co]):
32+
def __init__(self, __iterable: Iterable[TSource_co]) -> None:
3333
'''
3434
Wraps an iterable.
3535
'''
3636

3737
@overload
38-
def __init__(self, __iterable_factory: Callable[[], Iterable[TSource_co]]):
38+
def __init__(self, __iterable_factory: Callable[[], Iterable[TSource_co]]) -> None:
3939
'''
4040
Wraps an iterable returned from the iterable factory. The factory will be called whenever
4141
an enumerating operation is performed.

types_linq/ordered_enumerable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class key:
4444
def __init__(self, elem):
4545
self.elem = elem
4646
def __lt__(self, __o: key):
47-
return comparer(selector(self.elem), selector(__o.elem)) < 0
47+
return comparer(selector(self.elem), selector(__o.elem)) < 0 # type: ignore
4848
lst.sort(key=key, reverse=curr._descending)
4949
curr = curr._parent
5050
yield from lst

types_linq/ordered_enumerable.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from typing import Callable, Generic, Iterator, Optional, overload
2+
from typing import Callable, Generic, Optional, overload
33

44
from .enumerable import Enumerable
55
from .more_typing import (

0 commit comments

Comments
 (0)