pyallel 1.3.7__tar.gz → 1.3.8__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.7 → pyallel-1.3.8}/PKG-INFO +1 -1
- {pyallel-1.3.7 → pyallel-1.3.8}/pyproject.toml +1 -1
- pyallel-1.3.8/src/pyallel/errors.py +10 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/main.py +2 -2
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/process_group_manager.py +16 -23
- pyallel-1.3.7/src/pyallel/errors.py +0 -2
- {pyallel-1.3.7 → pyallel-1.3.8}/LICENSE +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/README.md +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/__init__.py +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/colours.py +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/constants.py +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/parser.py +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/printer.py +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/process.py +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/process_group.py +0 -0
- {pyallel-1.3.7 → pyallel-1.3.8}/src/pyallel/py.typed +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class PyallelError(Exception):
|
|
2
|
+
"""Base error for issues raised by pyallel"""
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class InvalidLinesModifierError(PyallelError):
|
|
6
|
+
"""Raised when the lines modifier is invalid"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class NoCommandsForProcessGroupError(PyallelError):
|
|
10
|
+
"""Raised when no commands have been provided for a process group"""
|
|
@@ -7,7 +7,7 @@ import traceback
|
|
|
7
7
|
|
|
8
8
|
from pyallel import constants
|
|
9
9
|
from pyallel.colours import Colours
|
|
10
|
-
from pyallel.errors import
|
|
10
|
+
from pyallel.errors import PyallelError
|
|
11
11
|
from pyallel.parser import Arguments, create_parser
|
|
12
12
|
from pyallel.printer import (
|
|
13
13
|
InteractiveConsolePrinter,
|
|
@@ -40,7 +40,7 @@ def entry_point(*args: str) -> int:
|
|
|
40
40
|
|
|
41
41
|
try:
|
|
42
42
|
process_group_manager = ProcessGroupManager.from_args(*parsed_args.commands)
|
|
43
|
-
except
|
|
43
|
+
except PyallelError as e:
|
|
44
44
|
print(f"{colours.red_bold}Error: {str(e)}{colours.reset_colour}")
|
|
45
45
|
return 1
|
|
46
46
|
|
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import signal
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
|
+
from pyallel.errors import NoCommandsForProcessGroupError
|
|
6
7
|
from pyallel.process import ProcessOutput
|
|
7
8
|
from pyallel.process_group import ProcessGroupOutput, ProcessGroup
|
|
8
9
|
|
|
@@ -113,39 +114,31 @@ class ProcessGroupManager:
|
|
|
113
114
|
|
|
114
115
|
@classmethod
|
|
115
116
|
def from_args(cls, *args: str) -> ProcessGroupManager:
|
|
116
|
-
last_separator_index = 0
|
|
117
117
|
commands: list[str] = []
|
|
118
118
|
process_groups: list[ProcessGroup] = []
|
|
119
119
|
progress_group_id = 1
|
|
120
120
|
process_id = 1
|
|
121
121
|
|
|
122
|
-
for
|
|
123
|
-
if arg
|
|
124
|
-
|
|
125
|
-
pg = ProcessGroup.from_commands(
|
|
126
|
-
progress_group_id, process_id, args[0]
|
|
127
|
-
)
|
|
128
|
-
else:
|
|
129
|
-
pg = ProcessGroup.from_commands(
|
|
130
|
-
progress_group_id, process_id, *commands[last_separator_index:]
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
process_groups.append(pg)
|
|
134
|
-
process_id += len(pg.processes)
|
|
135
|
-
last_separator_index = i
|
|
136
|
-
progress_group_id += 1
|
|
122
|
+
for arg in args:
|
|
123
|
+
if arg != ":::":
|
|
124
|
+
commands.append(arg)
|
|
137
125
|
continue
|
|
138
126
|
|
|
139
|
-
commands
|
|
127
|
+
if not commands:
|
|
128
|
+
raise NoCommandsForProcessGroupError(
|
|
129
|
+
f"no commands provided for process group {progress_group_id}, did you forgot to provide them before the ::: symbol?"
|
|
130
|
+
)
|
|
140
131
|
|
|
141
|
-
|
|
142
|
-
|
|
132
|
+
pg = ProcessGroup.from_commands(progress_group_id, process_id, *commands)
|
|
133
|
+
process_groups.append(pg)
|
|
134
|
+
process_id += len(pg.processes)
|
|
135
|
+
progress_group_id += 1
|
|
136
|
+
commands.clear()
|
|
143
137
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
progress_group_id, process_id, *commands
|
|
138
|
+
if commands:
|
|
139
|
+
process_groups.append(
|
|
140
|
+
ProcessGroup.from_commands(progress_group_id, process_id, *commands)
|
|
147
141
|
)
|
|
148
|
-
)
|
|
149
142
|
|
|
150
143
|
process_group_manager = cls(process_groups=process_groups)
|
|
151
144
|
|
|
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
|
|
File without changes
|