pyallel 1.3.0__tar.gz → 1.3.1__tar.gz
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.
- {pyallel-1.3.0 → pyallel-1.3.1}/PKG-INFO +1 -1
- {pyallel-1.3.0 → pyallel-1.3.1}/pyproject.toml +1 -1
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/main.py +1 -1
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/printer.py +20 -6
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/process.py +4 -4
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/process_group.py +1 -1
- {pyallel-1.3.0 → pyallel-1.3.1}/LICENSE +0 -0
- {pyallel-1.3.0 → pyallel-1.3.1}/README.md +0 -0
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/__init__.py +0 -0
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/colours.py +0 -0
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/constants.py +0 -0
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/errors.py +0 -0
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/parser.py +0 -0
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/process_group_manager.py +0 -0
- {pyallel-1.3.0 → pyallel-1.3.1}/src/pyallel/py.typed +0 -0
|
@@ -243,9 +243,9 @@ class Printer:
|
|
|
243
243
|
end="",
|
|
244
244
|
)
|
|
245
245
|
|
|
246
|
-
self.
|
|
246
|
+
self.reset()
|
|
247
247
|
|
|
248
|
-
def
|
|
248
|
+
def reset(self) -> None:
|
|
249
249
|
self._printed.clear()
|
|
250
250
|
|
|
251
251
|
|
|
@@ -260,6 +260,7 @@ def set_process_lines(
|
|
|
260
260
|
|
|
261
261
|
# Allocate lines to processes that have a fixed percentage of lines set
|
|
262
262
|
used_lines = 0
|
|
263
|
+
process_with_most_lines: ProcessOutput | None = None
|
|
263
264
|
other_processes: list[ProcessOutput] = []
|
|
264
265
|
for out in output.processes:
|
|
265
266
|
if not out.process.percentage_lines:
|
|
@@ -269,6 +270,12 @@ def set_process_lines(
|
|
|
269
270
|
out.process.lines = int(lines * out.process.percentage_lines)
|
|
270
271
|
used_lines += out.process.lines
|
|
271
272
|
|
|
273
|
+
if (
|
|
274
|
+
process_with_most_lines is None
|
|
275
|
+
or process_with_most_lines.process.lines < out.process.lines
|
|
276
|
+
):
|
|
277
|
+
process_with_most_lines = out
|
|
278
|
+
|
|
272
279
|
lines -= used_lines
|
|
273
280
|
|
|
274
281
|
# Allocate the rest of the available lines to the other processes that don't have fixed lines set
|
|
@@ -280,11 +287,18 @@ def set_process_lines(
|
|
|
280
287
|
for out in other_processes:
|
|
281
288
|
out.process.lines = tail
|
|
282
289
|
|
|
283
|
-
# If we have lines left to allocate, we give all of them to the
|
|
290
|
+
# If we have lines left to allocate, we give all of them to the process with the highest
|
|
291
|
+
# allocated lines or to the last process
|
|
284
292
|
if remainder:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
293
|
+
if process_with_most_lines:
|
|
294
|
+
process_with_most_lines.process.lines += remainder
|
|
295
|
+
else:
|
|
296
|
+
other_processes[-1].process.lines += remainder
|
|
297
|
+
else:
|
|
298
|
+
# Otherwise allocate remaining lines to the process with the highest allocated lines
|
|
299
|
+
remainder = lines
|
|
300
|
+
if remainder and process_with_most_lines:
|
|
301
|
+
process_with_most_lines.process.lines += remainder
|
|
288
302
|
|
|
289
303
|
|
|
290
304
|
def get_num_lines(line: str, columns: int | None = None) -> int:
|
|
@@ -82,7 +82,7 @@ class Process:
|
|
|
82
82
|
|
|
83
83
|
args, *parts = cmd
|
|
84
84
|
|
|
85
|
-
percentage_lines = 0
|
|
85
|
+
percentage_lines = 0
|
|
86
86
|
for arg in args.split(" "):
|
|
87
87
|
try:
|
|
88
88
|
arg, value = args.split("=")
|
|
@@ -91,17 +91,17 @@ class Process:
|
|
|
91
91
|
|
|
92
92
|
if arg == "lines":
|
|
93
93
|
try:
|
|
94
|
-
percentage_lines = int(value)
|
|
94
|
+
percentage_lines = int(value)
|
|
95
95
|
except ValueError:
|
|
96
96
|
raise InvalidLinesModifierError(
|
|
97
97
|
"lines modifier must be a number between 1 and 100"
|
|
98
98
|
)
|
|
99
99
|
|
|
100
|
-
if not 0
|
|
100
|
+
if not 0 < percentage_lines <= 100:
|
|
101
101
|
raise InvalidLinesModifierError(
|
|
102
102
|
"lines modifier must be a number between 1 and 100"
|
|
103
103
|
)
|
|
104
104
|
|
|
105
105
|
break
|
|
106
106
|
|
|
107
|
-
return cls(id, " ".join(parts), percentage_lines)
|
|
107
|
+
return cls(id, " ".join(parts), round(percentage_lines / 100, 2))
|
|
@@ -72,7 +72,7 @@ class ProcessGroup:
|
|
|
72
72
|
percentage_lines_sum += process.percentage_lines
|
|
73
73
|
processes.append(process)
|
|
74
74
|
|
|
75
|
-
if percentage_lines_sum > 1.0:
|
|
75
|
+
if round(percentage_lines_sum, 2) > 1.0:
|
|
76
76
|
raise InvalidLinesModifierError(
|
|
77
77
|
"lines modifier must not exceed 100 across all processes within each process group"
|
|
78
78
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|