reflex 0.7.4a1__py3-none-any.whl → 0.7.4a3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +9 -1
- reflex/app.py +4 -4
- reflex/base.py +3 -3
- reflex/compiler/compiler.py +5 -0
- reflex/components/component.py +6 -3
- reflex/config.py +4 -1
- reflex/reflex.py +8 -4
- reflex/state.py +1 -1
- reflex/utils/exec.py +39 -33
- reflex/utils/net.py +107 -18
- reflex/utils/prerequisites.py +93 -8
- reflex/utils/processes.py +48 -16
- reflex/utils/redir.py +3 -1
- reflex/utils/registry.py +11 -3
- reflex/vars/base.py +0 -35
- reflex/vars/datetime.py +10 -34
- reflex/vars/number.py +16 -112
- reflex/vars/sequence.py +15 -108
- {reflex-0.7.4a1.dist-info → reflex-0.7.4a3.dist-info}/METADATA +3 -1
- {reflex-0.7.4a1.dist-info → reflex-0.7.4a3.dist-info}/RECORD +23 -23
- {reflex-0.7.4a1.dist-info → reflex-0.7.4a3.dist-info}/WHEEL +0 -0
- {reflex-0.7.4a1.dist-info → reflex-0.7.4a3.dist-info}/entry_points.txt +0 -0
- {reflex-0.7.4a1.dist-info → reflex-0.7.4a3.dist-info}/licenses/LICENSE +0 -0
reflex/utils/processes.py
CHANGED
|
@@ -10,7 +10,7 @@ import signal
|
|
|
10
10
|
import subprocess
|
|
11
11
|
from concurrent import futures
|
|
12
12
|
from pathlib import Path
|
|
13
|
-
from typing import Any, Callable, Generator, Sequence, Tuple
|
|
13
|
+
from typing import Any, Callable, Generator, Literal, Sequence, Tuple, overload
|
|
14
14
|
|
|
15
15
|
import psutil
|
|
16
16
|
import typer
|
|
@@ -142,12 +142,30 @@ def handle_port(service_name: str, port: int, auto_increment: bool) -> int:
|
|
|
142
142
|
raise typer.Exit()
|
|
143
143
|
|
|
144
144
|
|
|
145
|
+
@overload
|
|
146
|
+
def new_process(
|
|
147
|
+
args: str | list[str] | list[str | None] | list[str | Path | None],
|
|
148
|
+
run: Literal[False] = False,
|
|
149
|
+
show_logs: bool = False,
|
|
150
|
+
**kwargs,
|
|
151
|
+
) -> subprocess.Popen[str]: ...
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@overload
|
|
155
|
+
def new_process(
|
|
156
|
+
args: str | list[str] | list[str | None] | list[str | Path | None],
|
|
157
|
+
run: Literal[True],
|
|
158
|
+
show_logs: bool = False,
|
|
159
|
+
**kwargs,
|
|
160
|
+
) -> subprocess.CompletedProcess[str]: ...
|
|
161
|
+
|
|
162
|
+
|
|
145
163
|
def new_process(
|
|
146
164
|
args: str | list[str] | list[str | None] | list[str | Path | None],
|
|
147
165
|
run: bool = False,
|
|
148
166
|
show_logs: bool = False,
|
|
149
167
|
**kwargs,
|
|
150
|
-
):
|
|
168
|
+
) -> subprocess.CompletedProcess[str] | subprocess.Popen[str]:
|
|
151
169
|
"""Wrapper over subprocess.Popen to unify the launch of child processes.
|
|
152
170
|
|
|
153
171
|
Args:
|
|
@@ -163,7 +181,8 @@ def new_process(
|
|
|
163
181
|
Exit: When attempting to run a command with a None value.
|
|
164
182
|
"""
|
|
165
183
|
# Check for invalid command first.
|
|
166
|
-
if isinstance(args, list)
|
|
184
|
+
non_empty_args = list(filter(None, args)) if isinstance(args, list) else [args]
|
|
185
|
+
if isinstance(args, list) and len(non_empty_args) != len(args):
|
|
167
186
|
console.error(f"Invalid command: {args}")
|
|
168
187
|
raise typer.Exit(1)
|
|
169
188
|
|
|
@@ -190,9 +209,15 @@ def new_process(
|
|
|
190
209
|
"errors": "replace", # Avoid UnicodeDecodeError in unknown command output
|
|
191
210
|
**kwargs,
|
|
192
211
|
}
|
|
193
|
-
console.debug(f"Running command: {
|
|
194
|
-
|
|
195
|
-
|
|
212
|
+
console.debug(f"Running command: {non_empty_args}")
|
|
213
|
+
|
|
214
|
+
def subprocess_p_open(args: subprocess._CMD, **kwargs):
|
|
215
|
+
return subprocess.Popen(args, **kwargs)
|
|
216
|
+
|
|
217
|
+
fn: Callable[..., subprocess.CompletedProcess[str] | subprocess.Popen[str]] = (
|
|
218
|
+
subprocess.run if run else subprocess_p_open
|
|
219
|
+
)
|
|
220
|
+
return fn(non_empty_args, **kwargs)
|
|
196
221
|
|
|
197
222
|
|
|
198
223
|
@contextlib.contextmanager
|
|
@@ -311,6 +336,7 @@ def show_status(
|
|
|
311
336
|
process: subprocess.Popen,
|
|
312
337
|
suppress_errors: bool = False,
|
|
313
338
|
analytics_enabled: bool = False,
|
|
339
|
+
prior_processes: Tuple[subprocess.Popen, ...] = (),
|
|
314
340
|
):
|
|
315
341
|
"""Show the status of a process.
|
|
316
342
|
|
|
@@ -319,15 +345,17 @@ def show_status(
|
|
|
319
345
|
process: The process.
|
|
320
346
|
suppress_errors: If True, do not exit if errors are encountered (for fallback).
|
|
321
347
|
analytics_enabled: Whether analytics are enabled for this command.
|
|
348
|
+
prior_processes: The prior processes that have been run.
|
|
322
349
|
"""
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
350
|
+
for one_process in (*prior_processes, process):
|
|
351
|
+
with console.status(message) as status:
|
|
352
|
+
for line in stream_logs(
|
|
353
|
+
message,
|
|
354
|
+
one_process,
|
|
355
|
+
suppress_errors=suppress_errors,
|
|
356
|
+
analytics_enabled=analytics_enabled,
|
|
357
|
+
):
|
|
358
|
+
status.update(f"{message} {line}")
|
|
331
359
|
|
|
332
360
|
|
|
333
361
|
def show_progress(message: str, process: subprocess.Popen, checkpoints: list[str]):
|
|
@@ -381,6 +409,7 @@ def run_process_with_fallbacks(
|
|
|
381
409
|
show_status_message: str,
|
|
382
410
|
fallbacks: str | Sequence[str] | Sequence[Sequence[str]] | None = None,
|
|
383
411
|
analytics_enabled: bool = False,
|
|
412
|
+
prior_processes: Tuple[subprocess.Popen, ...] = (),
|
|
384
413
|
**kwargs,
|
|
385
414
|
):
|
|
386
415
|
"""Run subprocess and retry using fallback command if initial command fails.
|
|
@@ -390,7 +419,8 @@ def run_process_with_fallbacks(
|
|
|
390
419
|
show_status_message: The status message to be displayed in the console.
|
|
391
420
|
fallbacks: The fallback command to run if the initial command fails.
|
|
392
421
|
analytics_enabled: Whether analytics are enabled for this command.
|
|
393
|
-
|
|
422
|
+
prior_processes: The prior processes that have been run.
|
|
423
|
+
**kwargs: Kwargs to pass to new_process function.
|
|
394
424
|
"""
|
|
395
425
|
process = new_process(get_command_with_loglevel(args), **kwargs)
|
|
396
426
|
if not fallbacks:
|
|
@@ -399,6 +429,7 @@ def run_process_with_fallbacks(
|
|
|
399
429
|
show_status_message,
|
|
400
430
|
process,
|
|
401
431
|
analytics_enabled=analytics_enabled,
|
|
432
|
+
prior_processes=prior_processes,
|
|
402
433
|
)
|
|
403
434
|
else:
|
|
404
435
|
# Suppress errors for initial command, because we will try to fallback
|
|
@@ -411,7 +442,7 @@ def run_process_with_fallbacks(
|
|
|
411
442
|
# retry with fallback command.
|
|
412
443
|
fallback_with_args = (
|
|
413
444
|
[current_fallback, *args[1:]]
|
|
414
|
-
if isinstance(
|
|
445
|
+
if isinstance(current_fallback, str)
|
|
415
446
|
else [*current_fallback, *args[1:]]
|
|
416
447
|
)
|
|
417
448
|
console.warn(
|
|
@@ -422,6 +453,7 @@ def run_process_with_fallbacks(
|
|
|
422
453
|
show_status_message=show_status_message,
|
|
423
454
|
fallbacks=next_fallbacks,
|
|
424
455
|
analytics_enabled=analytics_enabled,
|
|
456
|
+
prior_processes=(*prior_processes, process),
|
|
425
457
|
**kwargs,
|
|
426
458
|
)
|
|
427
459
|
|
reflex/utils/redir.py
CHANGED
|
@@ -5,6 +5,8 @@ import webbrowser
|
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
7
|
|
|
8
|
+
from reflex.utils import net
|
|
9
|
+
|
|
8
10
|
from .. import constants
|
|
9
11
|
from . import console
|
|
10
12
|
|
|
@@ -38,7 +40,7 @@ def open_browser_and_wait(
|
|
|
38
40
|
console.info("[b]Complete the workflow in the browser to continue.[/b]")
|
|
39
41
|
while True:
|
|
40
42
|
try:
|
|
41
|
-
response =
|
|
43
|
+
response = net.get(poll_url, follow_redirects=True)
|
|
42
44
|
if response.is_success:
|
|
43
45
|
break
|
|
44
46
|
except httpx.RequestError as err:
|
reflex/utils/registry.py
CHANGED
|
@@ -16,10 +16,13 @@ def latency(registry: str) -> int:
|
|
|
16
16
|
int: The latency of the registry in microseconds.
|
|
17
17
|
"""
|
|
18
18
|
try:
|
|
19
|
-
|
|
19
|
+
time_to_respond = net.get(registry, timeout=2).elapsed.microseconds
|
|
20
20
|
except httpx.HTTPError:
|
|
21
21
|
console.info(f"Failed to connect to {registry}.")
|
|
22
22
|
return 10_000_000
|
|
23
|
+
else:
|
|
24
|
+
console.debug(f"Latency of {registry}: {time_to_respond}")
|
|
25
|
+
return time_to_respond
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
def average_latency(registry: str, attempts: int = 3) -> int:
|
|
@@ -32,7 +35,9 @@ def average_latency(registry: str, attempts: int = 3) -> int:
|
|
|
32
35
|
Returns:
|
|
33
36
|
The average latency of the registry in microseconds.
|
|
34
37
|
"""
|
|
35
|
-
|
|
38
|
+
registry_latency = sum(latency(registry) for _ in range(attempts)) // attempts
|
|
39
|
+
console.debug(f"Average latency of {registry}: {registry_latency}")
|
|
40
|
+
return registry_latency
|
|
36
41
|
|
|
37
42
|
|
|
38
43
|
def _get_best_registry() -> str:
|
|
@@ -41,12 +46,15 @@ def _get_best_registry() -> str:
|
|
|
41
46
|
Returns:
|
|
42
47
|
The best registry.
|
|
43
48
|
"""
|
|
49
|
+
console.debug("Getting best registry...")
|
|
44
50
|
registries = [
|
|
45
51
|
"https://registry.npmjs.org",
|
|
46
52
|
"https://r.cnpmjs.org",
|
|
47
53
|
]
|
|
48
54
|
|
|
49
|
-
|
|
55
|
+
best_registry = min(registries, key=average_latency)
|
|
56
|
+
console.debug(f"Best registry: {best_registry}")
|
|
57
|
+
return best_registry
|
|
50
58
|
|
|
51
59
|
|
|
52
60
|
def get_npm_registry() -> str:
|
reflex/vars/base.py
CHANGED
|
@@ -3016,41 +3016,6 @@ _decode_var_pattern = re.compile(_decode_var_pattern_re, flags=re.DOTALL)
|
|
|
3016
3016
|
_global_vars: dict[int, Var] = {}
|
|
3017
3017
|
|
|
3018
3018
|
|
|
3019
|
-
def _extract_var_data(value: Iterable) -> list[VarData | None]:
|
|
3020
|
-
"""Extract the var imports and hooks from an iterable containing a Var.
|
|
3021
|
-
|
|
3022
|
-
Args:
|
|
3023
|
-
value: The iterable to extract the VarData from
|
|
3024
|
-
|
|
3025
|
-
Returns:
|
|
3026
|
-
The extracted VarDatas.
|
|
3027
|
-
"""
|
|
3028
|
-
from reflex.style import Style
|
|
3029
|
-
from reflex.vars import Var
|
|
3030
|
-
|
|
3031
|
-
var_datas = []
|
|
3032
|
-
with contextlib.suppress(TypeError):
|
|
3033
|
-
for sub in value:
|
|
3034
|
-
if isinstance(sub, Var):
|
|
3035
|
-
var_datas.append(sub._var_data)
|
|
3036
|
-
elif not isinstance(sub, str):
|
|
3037
|
-
# Recurse into dict values.
|
|
3038
|
-
if hasattr(sub, "values") and callable(sub.values):
|
|
3039
|
-
var_datas.extend(_extract_var_data(sub.values())) # pyright: ignore [reportArgumentType]
|
|
3040
|
-
# Recurse into iterable values (or dict keys).
|
|
3041
|
-
var_datas.extend(_extract_var_data(sub))
|
|
3042
|
-
|
|
3043
|
-
# Style objects should already have _var_data.
|
|
3044
|
-
if isinstance(value, Style):
|
|
3045
|
-
var_datas.append(value._var_data)
|
|
3046
|
-
else:
|
|
3047
|
-
# Recurse when value is a dict itself.
|
|
3048
|
-
values = getattr(value, "values", None)
|
|
3049
|
-
if callable(values):
|
|
3050
|
-
var_datas.extend(_extract_var_data(values())) # pyright: ignore [reportArgumentType]
|
|
3051
|
-
return var_datas
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
3019
|
dispatchers: dict[GenericType, Callable[[Var], Var]] = {}
|
|
3055
3020
|
|
|
3056
3021
|
|
reflex/vars/datetime.py
CHANGED
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import dataclasses
|
|
6
6
|
from datetime import date, datetime
|
|
7
|
-
from typing import Any,
|
|
7
|
+
from typing import Any, TypeVar
|
|
8
8
|
|
|
9
9
|
from reflex.utils.exceptions import VarTypeError
|
|
10
10
|
from reflex.vars.number import BooleanVar
|
|
@@ -35,13 +35,7 @@ def raise_var_type_error():
|
|
|
35
35
|
class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
36
36
|
"""A variable that holds a datetime or date object."""
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
def __lt__(self, other: datetime_types) -> BooleanVar: ...
|
|
40
|
-
|
|
41
|
-
@overload
|
|
42
|
-
def __lt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
43
|
-
|
|
44
|
-
def __lt__(self, other: Any):
|
|
38
|
+
def __lt__(self, other: datetime_types | DateTimeVar) -> BooleanVar:
|
|
45
39
|
"""Less than comparison.
|
|
46
40
|
|
|
47
41
|
Args:
|
|
@@ -54,13 +48,7 @@ class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
|
54
48
|
raise_var_type_error()
|
|
55
49
|
return date_lt_operation(self, other)
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
def __le__(self, other: datetime_types) -> BooleanVar: ...
|
|
59
|
-
|
|
60
|
-
@overload
|
|
61
|
-
def __le__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
62
|
-
|
|
63
|
-
def __le__(self, other: Any):
|
|
51
|
+
def __le__(self, other: datetime_types | DateTimeVar) -> BooleanVar:
|
|
64
52
|
"""Less than or equal comparison.
|
|
65
53
|
|
|
66
54
|
Args:
|
|
@@ -73,13 +61,7 @@ class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
|
73
61
|
raise_var_type_error()
|
|
74
62
|
return date_le_operation(self, other)
|
|
75
63
|
|
|
76
|
-
|
|
77
|
-
def __gt__(self, other: datetime_types) -> BooleanVar: ...
|
|
78
|
-
|
|
79
|
-
@overload
|
|
80
|
-
def __gt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
81
|
-
|
|
82
|
-
def __gt__(self, other: Any):
|
|
64
|
+
def __gt__(self, other: datetime_types | DateTimeVar) -> BooleanVar:
|
|
83
65
|
"""Greater than comparison.
|
|
84
66
|
|
|
85
67
|
Args:
|
|
@@ -92,13 +74,7 @@ class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
|
92
74
|
raise_var_type_error()
|
|
93
75
|
return date_gt_operation(self, other)
|
|
94
76
|
|
|
95
|
-
|
|
96
|
-
def __ge__(self, other: datetime_types) -> BooleanVar: ...
|
|
97
|
-
|
|
98
|
-
@overload
|
|
99
|
-
def __ge__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
100
|
-
|
|
101
|
-
def __ge__(self, other: Any):
|
|
77
|
+
def __ge__(self, other: datetime_types | DateTimeVar) -> BooleanVar:
|
|
102
78
|
"""Greater than or equal comparison.
|
|
103
79
|
|
|
104
80
|
Args:
|
|
@@ -113,7 +89,7 @@ class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
|
113
89
|
|
|
114
90
|
|
|
115
91
|
@var_operation
|
|
116
|
-
def date_gt_operation(lhs:
|
|
92
|
+
def date_gt_operation(lhs: DateTimeVar | Any, rhs: DateTimeVar | Any):
|
|
117
93
|
"""Greater than comparison.
|
|
118
94
|
|
|
119
95
|
Args:
|
|
@@ -127,7 +103,7 @@ def date_gt_operation(lhs: Var | Any, rhs: Var | Any) -> CustomVarOperationRetur
|
|
|
127
103
|
|
|
128
104
|
|
|
129
105
|
@var_operation
|
|
130
|
-
def date_lt_operation(lhs:
|
|
106
|
+
def date_lt_operation(lhs: DateTimeVar | Any, rhs: DateTimeVar | Any):
|
|
131
107
|
"""Less than comparison.
|
|
132
108
|
|
|
133
109
|
Args:
|
|
@@ -141,7 +117,7 @@ def date_lt_operation(lhs: Var | Any, rhs: Var | Any) -> CustomVarOperationRetur
|
|
|
141
117
|
|
|
142
118
|
|
|
143
119
|
@var_operation
|
|
144
|
-
def date_le_operation(lhs:
|
|
120
|
+
def date_le_operation(lhs: DateTimeVar | Any, rhs: DateTimeVar | Any):
|
|
145
121
|
"""Less than or equal comparison.
|
|
146
122
|
|
|
147
123
|
Args:
|
|
@@ -155,7 +131,7 @@ def date_le_operation(lhs: Var | Any, rhs: Var | Any) -> CustomVarOperationRetur
|
|
|
155
131
|
|
|
156
132
|
|
|
157
133
|
@var_operation
|
|
158
|
-
def date_ge_operation(lhs:
|
|
134
|
+
def date_ge_operation(lhs: DateTimeVar | Any, rhs: DateTimeVar | Any):
|
|
159
135
|
"""Greater than or equal comparison.
|
|
160
136
|
|
|
161
137
|
Args:
|
|
@@ -172,7 +148,7 @@ def date_compare_operation(
|
|
|
172
148
|
lhs: DateTimeVar[DATETIME_T] | Any,
|
|
173
149
|
rhs: DateTimeVar[DATETIME_T] | Any,
|
|
174
150
|
strict: bool = False,
|
|
175
|
-
) -> CustomVarOperationReturn:
|
|
151
|
+
) -> CustomVarOperationReturn[bool]:
|
|
176
152
|
"""Check if the value is less than the other value.
|
|
177
153
|
|
|
178
154
|
Args:
|
reflex/vars/number.py
CHANGED
|
@@ -61,13 +61,7 @@ def raise_unsupported_operand_types(
|
|
|
61
61
|
class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
62
62
|
"""Base class for immutable number vars."""
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
def __add__(self, other: number_types) -> NumberVar: ...
|
|
66
|
-
|
|
67
|
-
@overload
|
|
68
|
-
def __add__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
69
|
-
|
|
70
|
-
def __add__(self, other: Any):
|
|
64
|
+
def __add__(self, other: number_types) -> NumberVar:
|
|
71
65
|
"""Add two numbers.
|
|
72
66
|
|
|
73
67
|
Args:
|
|
@@ -80,13 +74,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
80
74
|
raise_unsupported_operand_types("+", (type(self), type(other)))
|
|
81
75
|
return number_add_operation(self, +other)
|
|
82
76
|
|
|
83
|
-
|
|
84
|
-
def __radd__(self, other: number_types) -> NumberVar: ...
|
|
85
|
-
|
|
86
|
-
@overload
|
|
87
|
-
def __radd__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
88
|
-
|
|
89
|
-
def __radd__(self, other: Any):
|
|
77
|
+
def __radd__(self, other: number_types) -> NumberVar:
|
|
90
78
|
"""Add two numbers.
|
|
91
79
|
|
|
92
80
|
Args:
|
|
@@ -99,13 +87,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
99
87
|
raise_unsupported_operand_types("+", (type(other), type(self)))
|
|
100
88
|
return number_add_operation(+other, self)
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
def __sub__(self, other: number_types) -> NumberVar: ...
|
|
104
|
-
|
|
105
|
-
@overload
|
|
106
|
-
def __sub__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
107
|
-
|
|
108
|
-
def __sub__(self, other: Any):
|
|
90
|
+
def __sub__(self, other: number_types) -> NumberVar:
|
|
109
91
|
"""Subtract two numbers.
|
|
110
92
|
|
|
111
93
|
Args:
|
|
@@ -119,13 +101,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
119
101
|
|
|
120
102
|
return number_subtract_operation(self, +other)
|
|
121
103
|
|
|
122
|
-
|
|
123
|
-
def __rsub__(self, other: number_types) -> NumberVar: ...
|
|
124
|
-
|
|
125
|
-
@overload
|
|
126
|
-
def __rsub__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
127
|
-
|
|
128
|
-
def __rsub__(self, other: Any):
|
|
104
|
+
def __rsub__(self, other: number_types) -> NumberVar:
|
|
129
105
|
"""Subtract two numbers.
|
|
130
106
|
|
|
131
107
|
Args:
|
|
@@ -201,13 +177,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
201
177
|
|
|
202
178
|
return number_multiply_operation(+other, self)
|
|
203
179
|
|
|
204
|
-
|
|
205
|
-
def __truediv__(self, other: number_types) -> NumberVar: ...
|
|
206
|
-
|
|
207
|
-
@overload
|
|
208
|
-
def __truediv__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
209
|
-
|
|
210
|
-
def __truediv__(self, other: Any):
|
|
180
|
+
def __truediv__(self, other: number_types) -> NumberVar:
|
|
211
181
|
"""Divide two numbers.
|
|
212
182
|
|
|
213
183
|
Args:
|
|
@@ -221,13 +191,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
221
191
|
|
|
222
192
|
return number_true_division_operation(self, +other)
|
|
223
193
|
|
|
224
|
-
|
|
225
|
-
def __rtruediv__(self, other: number_types) -> NumberVar: ...
|
|
226
|
-
|
|
227
|
-
@overload
|
|
228
|
-
def __rtruediv__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
229
|
-
|
|
230
|
-
def __rtruediv__(self, other: Any):
|
|
194
|
+
def __rtruediv__(self, other: number_types) -> NumberVar:
|
|
231
195
|
"""Divide two numbers.
|
|
232
196
|
|
|
233
197
|
Args:
|
|
@@ -241,13 +205,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
241
205
|
|
|
242
206
|
return number_true_division_operation(+other, self)
|
|
243
207
|
|
|
244
|
-
|
|
245
|
-
def __floordiv__(self, other: number_types) -> NumberVar: ...
|
|
246
|
-
|
|
247
|
-
@overload
|
|
248
|
-
def __floordiv__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
249
|
-
|
|
250
|
-
def __floordiv__(self, other: Any):
|
|
208
|
+
def __floordiv__(self, other: number_types) -> NumberVar:
|
|
251
209
|
"""Floor divide two numbers.
|
|
252
210
|
|
|
253
211
|
Args:
|
|
@@ -261,13 +219,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
261
219
|
|
|
262
220
|
return number_floor_division_operation(self, +other)
|
|
263
221
|
|
|
264
|
-
|
|
265
|
-
def __rfloordiv__(self, other: number_types) -> NumberVar: ...
|
|
266
|
-
|
|
267
|
-
@overload
|
|
268
|
-
def __rfloordiv__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
269
|
-
|
|
270
|
-
def __rfloordiv__(self, other: Any):
|
|
222
|
+
def __rfloordiv__(self, other: number_types) -> NumberVar:
|
|
271
223
|
"""Floor divide two numbers.
|
|
272
224
|
|
|
273
225
|
Args:
|
|
@@ -281,13 +233,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
281
233
|
|
|
282
234
|
return number_floor_division_operation(+other, self)
|
|
283
235
|
|
|
284
|
-
|
|
285
|
-
def __mod__(self, other: number_types) -> NumberVar: ...
|
|
286
|
-
|
|
287
|
-
@overload
|
|
288
|
-
def __mod__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
289
|
-
|
|
290
|
-
def __mod__(self, other: Any):
|
|
236
|
+
def __mod__(self, other: number_types) -> NumberVar:
|
|
291
237
|
"""Modulo two numbers.
|
|
292
238
|
|
|
293
239
|
Args:
|
|
@@ -301,13 +247,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
301
247
|
|
|
302
248
|
return number_modulo_operation(self, +other)
|
|
303
249
|
|
|
304
|
-
|
|
305
|
-
def __rmod__(self, other: number_types) -> NumberVar: ...
|
|
306
|
-
|
|
307
|
-
@overload
|
|
308
|
-
def __rmod__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
309
|
-
|
|
310
|
-
def __rmod__(self, other: Any):
|
|
250
|
+
def __rmod__(self, other: number_types) -> NumberVar:
|
|
311
251
|
"""Modulo two numbers.
|
|
312
252
|
|
|
313
253
|
Args:
|
|
@@ -321,13 +261,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
321
261
|
|
|
322
262
|
return number_modulo_operation(+other, self)
|
|
323
263
|
|
|
324
|
-
|
|
325
|
-
def __pow__(self, other: number_types) -> NumberVar: ...
|
|
326
|
-
|
|
327
|
-
@overload
|
|
328
|
-
def __pow__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
329
|
-
|
|
330
|
-
def __pow__(self, other: Any):
|
|
264
|
+
def __pow__(self, other: number_types) -> NumberVar:
|
|
331
265
|
"""Exponentiate two numbers.
|
|
332
266
|
|
|
333
267
|
Args:
|
|
@@ -341,13 +275,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
341
275
|
|
|
342
276
|
return number_exponent_operation(self, +other)
|
|
343
277
|
|
|
344
|
-
|
|
345
|
-
def __rpow__(self, other: number_types) -> NumberVar: ...
|
|
346
|
-
|
|
347
|
-
@overload
|
|
348
|
-
def __rpow__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
349
|
-
|
|
350
|
-
def __rpow__(self, other: Any):
|
|
278
|
+
def __rpow__(self, other: number_types) -> NumberVar:
|
|
351
279
|
"""Exponentiate two numbers.
|
|
352
280
|
|
|
353
281
|
Args:
|
|
@@ -417,13 +345,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
417
345
|
"""
|
|
418
346
|
return number_trunc_operation(self)
|
|
419
347
|
|
|
420
|
-
|
|
421
|
-
def __lt__(self, other: number_types) -> BooleanVar: ...
|
|
422
|
-
|
|
423
|
-
@overload
|
|
424
|
-
def __lt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
425
|
-
|
|
426
|
-
def __lt__(self, other: Any):
|
|
348
|
+
def __lt__(self, other: number_types) -> BooleanVar:
|
|
427
349
|
"""Less than comparison.
|
|
428
350
|
|
|
429
351
|
Args:
|
|
@@ -436,13 +358,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
436
358
|
raise_unsupported_operand_types("<", (type(self), type(other)))
|
|
437
359
|
return less_than_operation(+self, +other)
|
|
438
360
|
|
|
439
|
-
|
|
440
|
-
def __le__(self, other: number_types) -> BooleanVar: ...
|
|
441
|
-
|
|
442
|
-
@overload
|
|
443
|
-
def __le__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
444
|
-
|
|
445
|
-
def __le__(self, other: Any):
|
|
361
|
+
def __le__(self, other: number_types) -> BooleanVar:
|
|
446
362
|
"""Less than or equal comparison.
|
|
447
363
|
|
|
448
364
|
Args:
|
|
@@ -481,13 +397,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
481
397
|
return not_equal_operation(+self, +other)
|
|
482
398
|
return not_equal_operation(self, other)
|
|
483
399
|
|
|
484
|
-
|
|
485
|
-
def __gt__(self, other: number_types) -> BooleanVar: ...
|
|
486
|
-
|
|
487
|
-
@overload
|
|
488
|
-
def __gt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
489
|
-
|
|
490
|
-
def __gt__(self, other: Any):
|
|
400
|
+
def __gt__(self, other: number_types) -> BooleanVar:
|
|
491
401
|
"""Greater than comparison.
|
|
492
402
|
|
|
493
403
|
Args:
|
|
@@ -500,13 +410,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
500
410
|
raise_unsupported_operand_types(">", (type(self), type(other)))
|
|
501
411
|
return greater_than_operation(+self, +other)
|
|
502
412
|
|
|
503
|
-
|
|
504
|
-
def __ge__(self, other: number_types) -> BooleanVar: ...
|
|
505
|
-
|
|
506
|
-
@overload
|
|
507
|
-
def __ge__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
508
|
-
|
|
509
|
-
def __ge__(self, other: Any):
|
|
413
|
+
def __ge__(self, other: number_types) -> BooleanVar:
|
|
510
414
|
"""Greater than or equal comparison.
|
|
511
415
|
|
|
512
416
|
Args:
|