Skip to content

Commit d6fef31

Browse files
committed
ruff --fix on stubfiles
1 parent 669f289 commit d6fef31

File tree

6 files changed

+3
-49
lines changed

6 files changed

+3
-49
lines changed

typings/portion/__init__.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
This type stub file was generated by pyright.
33
"""
44

5-
import importlib.metadata
65
from .api import create_api
7-
from .const import Bound, inf
6+
from .const import inf
87
from .dict import IntervalDict
98
from .func import closed, closedopen, empty, iterate, open, openclosed, singleton
109
from .interval import AbstractDiscreteInterval, Interval

typings/portion/api.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def partial(
1111
Convenient helper that combines functools.update_wrapper and
1212
functools.partial. It has exactly the same signature than functools.partial.
1313
"""
14-
...
1514

1615
def create_api(interval, *, interval_dict=..., name=...): # -> ModuleType:
1716
"""Create a spe
@@ -27,4 +26,3 @@ def create_api(interval, *, interval_dict=..., name=...): # -> ModuleType:
2726
:param interval_dict: a subclass of IntervalDict.
2827
:param name: the name of the new module.
2928
"""
30-
...

typings/portion/dict.pyi

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ This type stub file was generated by pyright.
44

55
from collections.abc import Iterable, Iterator, Mapping, MutableMapping
66
from typing import Generic, Optional, Protocol, TypeVar, Union, overload
7+
78
from sortedcontainers.sorteddict import ItemsView, KeysView, ValuesView
9+
810
from .interval import Interval
911

1012
V = TypeVar("V")
@@ -51,21 +53,18 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
5153
5254
:param mapping_or_iterable: optional mapping or iterable.
5355
"""
54-
...
5556

5657
def clear(self): # -> None:
5758
"""
5859
Remove all items from the IntervalDict.
5960
"""
60-
...
6161

6262
def copy(self): # -> Self:
6363
"""
6464
Return a shallow copy.
6565
6666
:return: a shallow copy.
6767
"""
68-
...
6968

7069
@overload
7170
def get(
@@ -88,7 +87,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
8887
:param default: default value (default to None).
8988
:return: an IntervalDict, or a single value if key is not an Interval.
9089
"""
91-
...
9290

9391
def find(self, value: V) -> Interval:
9492
"""
@@ -98,7 +96,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
9896
:param value: value to look for.
9997
:return: an Interval instance.
10098
"""
101-
...
10299

103100
def items(self) -> ItemsView[Interval, V]:
104101
"""
@@ -107,7 +104,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
107104
108105
:return: a view object.
109106
"""
110-
...
111107

112108
def keys(self) -> KeysView[Interval]:
113109
"""
@@ -116,7 +112,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
116112
117113
:return: a view object.
118114
"""
119-
...
120115

121116
def values(self) -> ValuesView[V]:
122117
"""
@@ -125,15 +120,13 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
125120
126121
:return: a view object.
127122
"""
128-
...
129123

130124
def domain(self) -> Interval:
131125
"""
132126
Return an Interval corresponding to the domain of this IntervalDict.
133127
134128
:return: an Interval.
135129
"""
136-
...
137130

138131
@overload
139132
def pop(self, key: Interval, default: Optional[V] = ...) -> IntervalDict[V]: ...
@@ -154,7 +147,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
154147
:param default: optional default value.
155148
:return: an IntervalDict, or a single value if key is not an Interval.
156149
"""
157-
...
158150

159151
def popitem(self) -> tuple[Interval, V]:
160152
"""
@@ -163,7 +155,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
163155
164156
:return: a (key, value) pair.
165157
"""
166-
...
167158

168159
@overload
169160
def setdefault(
@@ -182,7 +173,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
182173
:param default: default value (default to None).
183174
:return: an IntervalDict, or a single value if key is not an Interval.
184175
"""
185-
...
186176

187177
def update(
188178
self,
@@ -199,7 +189,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
199189
200190
:param mapping_or_iterable: mapping or iterable.
201191
"""
202-
...
203192

204193
def combine(
205194
self,
@@ -231,7 +220,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
231220
:param pass_interval: if set, provide the current interval to the how function.
232221
:return: a new IntervalDict instance.
233222
"""
234-
...
235223

236224
def as_dict(self, atomic: bool = ...) -> dict[Interval, V]:
237225
"""
@@ -240,7 +228,6 @@ class IntervalDict(Generic[V], MutableMapping[object, V]):
240228
:param atomic: whether keys are atomic intervals.
241229
:return: a Python dict.
242230
"""
243-
...
244231

245232
@overload
246233
def __getitem__(self, key: Interval) -> IntervalDict[V]: ...

typings/portion/func.pyi

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def open(lower, upper, *, klass=...): # -> Interval:
1111
:param klass: class to use for creating intervals (default to Interval).
1212
:return: an interval.
1313
"""
14-
...
1514

1615
def closed(lower, upper, *, klass=...): # -> Interval:
1716
"""
@@ -22,7 +21,6 @@ def closed(lower, upper, *, klass=...): # -> Interval:
2221
:param klass: class to use for creating intervals (default to Interval).
2322
:return: an interval.
2423
"""
25-
...
2624

2725
def openclosed(lower, upper, *, klass=...): # -> Interval:
2826
"""
@@ -33,7 +31,6 @@ def openclosed(lower, upper, *, klass=...): # -> Interval:
3331
:param klass: class to use for creating intervals (default to Interval).
3432
:return: an interval.
3533
"""
36-
...
3734

3835
def closedopen(lower, upper, *, klass=...): # -> Interval:
3936
"""
@@ -44,7 +41,6 @@ def closedopen(lower, upper, *, klass=...): # -> Interval:
4441
:param klass: class to use for creating intervals (default to Interval).
4542
:return: an interval.
4643
"""
47-
...
4844

4945
def singleton(value, *, klass=...): # -> Interval:
5046
"""
@@ -54,7 +50,6 @@ def singleton(value, *, klass=...): # -> Interval:
5450
:param klass: class to use for creating intervals (default to Interval).
5551
:return: an interval.
5652
"""
57-
...
5853

5954
def empty(*, klass=...): # -> Interval:
6055
"""
@@ -63,7 +58,6 @@ def empty(*, klass=...): # -> Interval:
6358
:param klass: class to use for creating intervals (default to Interval).
6459
:return: an interval.
6560
"""
66-
...
6761

6862
def iterate(
6963
interval, step, *, base=..., reverse=...
@@ -95,4 +89,3 @@ def iterate(
9589
:param reverse: set to True for descending order.
9690
:return: a lazy iterator.
9791
"""
98-
...

typings/portion/interval.pyi

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def mergeable(a, b):
1313
:param b: an atomic interval.
1414
:return: True if mergeable, False otherwise.
1515
"""
16-
...
1716

1817
class Interval:
1918
"""
@@ -32,7 +31,6 @@ class Interval:
3231
3332
:param intervals: zero, one or more intervals.
3433
"""
35-
...
3634

3735
@classmethod
3836
def from_atomic(cls, left, lower, upper, right): # -> Self:
@@ -44,50 +42,43 @@ class Interval:
4442
:param upper: value of the upper bound.
4543
:param right: either CLOSED or OPEN.
4644
"""
47-
...
4845

4946
@property
5047
def left(self): # -> Literal[Bound.OPEN]:
5148
"""
5249
Lowest left boundary is either CLOSED or OPEN.
5350
"""
54-
...
5551

5652
@property
5753
def lower(self): # -> _PInf:
5854
"""
5955
Lowest lower bound value.
6056
"""
61-
...
6257

6358
@property
6459
def upper(self): # -> _NInf:
6560
"""
6661
Highest upper bound value.
6762
"""
68-
...
6963

7064
@property
7165
def right(self): # -> Literal[Bound.OPEN]:
7266
"""
7367
Highest right boundary is either CLOSED or OPEN.
7468
"""
75-
...
7669

7770
@property
7871
def empty(self): # -> bool:
7972
"""
8073
True if interval is empty, False otherwise.
8174
"""
82-
...
8375

8476
@property
8577
def atomic(self): # -> bool:
8678
"""
8779
True if this interval is atomic, False otherwise.
8880
An interval is atomic if it is empty or composed of a single interval.
8981
"""
90-
...
9182

9283
@property
9384
def enclosure(self): # -> Self:
@@ -97,7 +88,6 @@ class Interval:
9788
9889
:return: an Interval instance.
9990
"""
100-
...
10191

10292
def replace(
10393
self, left=..., lower=..., upper=..., right=..., *, ignore_inf=...
@@ -121,7 +111,6 @@ class Interval:
121111
is True).
122112
:return: an Interval instance
123113
"""
124-
...
125114

126115
def apply(self, func): # -> Self:
127116
"""
@@ -137,7 +126,6 @@ class Interval:
137126
:param func: function to apply on each underlying atomic interval.
138127
:return: an Interval instance.
139128
"""
140-
...
141129

142130
def adjacent(self, other):
143131
"""
@@ -154,7 +142,6 @@ class Interval:
154142
:param other: an interval.
155143
:return: True if intervals are adjacent, False otherwise.
156144
"""
157-
...
158145

159146
def overlaps(self, other): # -> bool:
160147
"""
@@ -163,7 +150,6 @@ class Interval:
163150
:param other: an interval.
164151
:return: True if intervals overlap, False otherwise.
165152
"""
166-
...
167153

168154
def intersection(self, other):
169155
"""
@@ -172,7 +158,6 @@ class Interval:
172158
:param other: an interval.
173159
:return: the intersection of the intervals.
174160
"""
175-
...
176161

177162
def union(self, other):
178163
"""
@@ -181,7 +166,6 @@ class Interval:
181166
:param other: an interval.
182167
:return: the union of the intervals.
183168
"""
184-
...
185169

186170
def contains(self, item): # -> bool:
187171
"""
@@ -191,15 +175,13 @@ class Interval:
191175
:param item: an interval or any arbitrary comparable value.
192176
:return: True if given item is contained, False otherwise.
193177
"""
194-
...
195178

196179
def complement(self): # -> Interval:
197180
"""
198181
Return the complement of this interval.
199182
200183
:return: the complement of this interval.
201184
"""
202-
...
203185

204186
def difference(self, other):
205187
"""
@@ -208,7 +190,6 @@ class Interval:
208190
:param other: an interval.
209191
:return: the difference of the intervals.
210192
"""
211-
...
212193

213194
def __getattr__(self, name): # -> None:
214195
...

typings/portion/io.pyi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def from_string(
3838
:param klass: class to use for creating intervals (default to Interval).
3939
:return: an interval.
4040
"""
41-
...
4241

4342
def to_string(
4443
interval,
@@ -68,7 +67,6 @@ def to_string(
6867
:param ninf: string representing a negative infinity (default is '-inf').
6968
:return: a string representation for given interval.
7069
"""
71-
...
7270

7371
def from_data(data, conv=..., *, pinf=..., ninf=..., klass=...): # -> Interval:
7472
"""
@@ -81,7 +79,6 @@ def from_data(data, conv=..., *, pinf=..., ninf=..., klass=...): # -> Interval:
8179
:param klass: class to use for creating intervals (default to Interval).
8280
:return: an interval.
8381
"""
84-
...
8582

8683
def to_data(interval, conv=..., *, pinf=..., ninf=...): # -> list[Any]:
8784
"""
@@ -93,4 +90,3 @@ def to_data(interval, conv=..., *, pinf=..., ninf=...): # -> list[Any]:
9390
:param ninf: value used to encode negative infinity.
9491
:return: a list of 4-uples (left, lower, upper, right)
9592
"""
96-
...

0 commit comments

Comments
 (0)