argenta 0.5.0b0__py3-none-any.whl → 1.0.0__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.
Files changed (36) hide show
  1. argenta/app/autocompleter/entity.py +57 -13
  2. argenta/app/defaults.py +7 -4
  3. argenta/app/dividing_line/models.py +55 -13
  4. argenta/app/models.py +376 -178
  5. argenta/app/registered_routers/entity.py +20 -7
  6. argenta/command/__init__.py +1 -1
  7. argenta/command/exceptions.py +22 -3
  8. argenta/command/flag/__init__.py +2 -2
  9. argenta/command/flag/defaults.py +21 -11
  10. argenta/command/flag/models.py +73 -92
  11. argenta/command/flags/__init__.py +16 -0
  12. argenta/command/flags/models.py +90 -0
  13. argenta/command/models.py +124 -39
  14. argenta/orchestrator/__init__.py +4 -0
  15. argenta/orchestrator/argparser/__init__.py +4 -0
  16. argenta/orchestrator/argparser/arguments/__init__.py +8 -0
  17. argenta/orchestrator/argparser/arguments/models.py +56 -0
  18. argenta/orchestrator/argparser/entity.py +59 -0
  19. argenta/orchestrator/entity.py +35 -0
  20. argenta/response/__init__.py +5 -0
  21. argenta/response/entity.py +29 -0
  22. argenta/response/status.py +8 -0
  23. argenta/router/__init__.py +1 -1
  24. argenta/router/command_handler/entity.py +57 -11
  25. argenta/router/defaults.py +1 -2
  26. argenta/router/entity.py +181 -92
  27. argenta/router/exceptions.py +17 -6
  28. argenta-1.0.0.dist-info/METADATA +70 -0
  29. argenta-1.0.0.dist-info/RECORD +37 -0
  30. {argenta-0.5.0b0.dist-info → argenta-1.0.0.dist-info}/WHEEL +1 -1
  31. argenta/app/exceptions.py +0 -15
  32. argenta/router/command_handlers/__init__.py +0 -0
  33. argenta/router/command_handlers/entity.py +0 -21
  34. argenta-0.5.0b0.dist-info/METADATA +0 -603
  35. argenta-0.5.0b0.dist-info/RECORD +0 -29
  36. {argenta-0.5.0b0.dist-info → argenta-1.0.0.dist-info/licenses}/LICENSE +0 -0
@@ -1,21 +1,34 @@
1
+ from typing import Iterator
2
+
1
3
  from argenta.router import Router
2
4
 
3
5
 
4
6
  class RegisteredRouters:
5
7
  def __init__(self, registered_routers: list[Router] = None) -> None:
8
+ """
9
+ Private. Combines registered routers
10
+ :param registered_routers: list of the registered routers
11
+ :return: None
12
+ """
6
13
  self._registered_routers = registered_routers if registered_routers else []
7
14
 
8
15
  def get_registered_routers(self) -> list[Router]:
16
+ """
17
+ Private. Returns the registered routers
18
+ :return: registered routers as list[Router]
19
+ """
9
20
  return self._registered_routers
10
21
 
11
- def add_registered_router(self, router: Router):
22
+ def add_registered_router(self, router: Router) -> None:
23
+ """
24
+ Private. Adds a new registered router
25
+ :param router: registered router
26
+ :return: None
27
+ """
12
28
  self._registered_routers.append(router)
13
29
 
14
- def add_registered_routers(self, *routers: Router):
15
- self._registered_routers.extend(routers)
16
-
17
- def __iter__(self):
30
+ def __iter__(self) -> Iterator[Router]:
18
31
  return iter(self._registered_routers)
19
32
 
20
- def __next__(self):
21
- return next(iter(self._registered_routers))
33
+ def __next__(self) -> Router:
34
+ return next(iter(self._registered_routers))
@@ -1,3 +1,3 @@
1
1
  __all__ = ["Command"]
2
2
 
3
- from argenta.command.models import Command
3
+ from argenta.command.models import Command
@@ -1,23 +1,42 @@
1
- from argenta.command.flag.models import InputFlag, Flag
1
+ from argenta.command.flag.models import Flag, InputFlag
2
2
 
3
3
 
4
4
  class BaseInputCommandException(Exception):
5
+ """
6
+ Private. Base exception class for all exceptions raised when parse input command
7
+ """
8
+
5
9
  pass
6
10
 
7
11
 
8
12
  class UnprocessedInputFlagException(BaseInputCommandException):
13
+ """
14
+ Private. Raised when an unprocessed input flag is detected
15
+ """
16
+
9
17
  def __str__(self):
10
18
  return "Unprocessed Input Flags"
11
19
 
12
20
 
13
21
  class RepeatedInputFlagsException(BaseInputCommandException):
22
+ """
23
+ Private. Raised when repeated input flags are detected
24
+ """
25
+
14
26
  def __init__(self, flag: Flag | InputFlag):
15
27
  self.flag = flag
28
+
16
29
  def __str__(self):
17
- return ("Repeated Input Flags\n"
18
- f"Duplicate flag was detected in the input: '{self.flag.get_string_entity()}'")
30
+ return (
31
+ "Repeated Input Flags\n"
32
+ f"Duplicate flag was detected in the input: '{self.flag.get_string_entity()}'"
33
+ )
19
34
 
20
35
 
21
36
  class EmptyInputCommandException(BaseInputCommandException):
37
+ """
38
+ Private. Raised when an empty input command is detected
39
+ """
40
+
22
41
  def __str__(self):
23
42
  return "Input Command is empty"
@@ -1,4 +1,4 @@
1
- __all__ = ('InputFlags', 'InputFlag', 'Flag', 'Flags')
1
+ __all__ = ["Flag", "InputFlag"]
2
2
 
3
3
 
4
- from argenta.command.flag.models import InputFlags, InputFlag, Flags, Flag
4
+ from argenta.command.flag.models import Flag, InputFlag
@@ -4,18 +4,28 @@ import re
4
4
 
5
5
 
6
6
  @dataclass
7
- class PredeterminedFlags:
8
- HELP = Flag(name='help', possible_values=False)
9
- SHORT_HELP = Flag(name='h', prefix='-', possible_values=False)
7
+ class PredefinedFlags:
8
+ """
9
+ Public. A dataclass with predefined flags and most frequently used flags for quick use
10
+ """
10
11
 
11
- INFO = Flag(name='info', possible_values=False)
12
- SHORT_INFO = Flag(name='i', prefix='-', possible_values=False)
12
+ HELP = Flag(name="help", possible_values=False)
13
+ SHORT_HELP = Flag(name="H", prefix="-", possible_values=False)
13
14
 
14
- ALL = Flag(name='all', possible_values=False)
15
- SHORT_ALL = Flag(name='a', prefix='-', possible_values=False)
15
+ INFO = Flag(name="info", possible_values=False)
16
+ SHORT_INFO = Flag(name="I", prefix="-", possible_values=False)
16
17
 
17
- HOST = Flag(name='host', possible_values=re.compile(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'))
18
- SHORT_HOST = Flag(name='h', prefix='-', possible_values=re.compile(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'))
18
+ ALL = Flag(name="all", possible_values=False)
19
+ SHORT_ALL = Flag(name="A", prefix="-", possible_values=False)
19
20
 
20
- PORT = Flag(name='port', possible_values=re.compile(r'^\d{1,5}$'))
21
- SHORT_PORT = Flag(name='p', prefix='-', possible_values=re.compile(r'^\d{1,5}$'))
21
+ HOST = Flag(
22
+ name="host", possible_values=re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$")
23
+ )
24
+ SHORT_HOST = Flag(
25
+ name="H",
26
+ prefix="-",
27
+ possible_values=re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$"),
28
+ )
29
+
30
+ PORT = Flag(name="port", possible_values=re.compile(r"^\d{1,5}$"))
31
+ SHORT_PORT = Flag(name="P", prefix="-", possible_values=re.compile(r"^\d{1,5}$"))
@@ -1,48 +1,66 @@
1
1
  from typing import Literal, Pattern
2
- from abc import ABC, abstractmethod
3
2
 
4
3
 
5
4
  class BaseFlag:
6
- def __init__(self, name: str,
7
- prefix: Literal['-', '--', '---'] = '--'):
5
+ def __init__(self, name: str, prefix: Literal["-", "--", "---"] = "--") -> None:
6
+ """
7
+ Private. Base class for flags
8
+ :param name: the name of the flag
9
+ :param prefix: the prefix of the flag
10
+ :return: None
11
+ """
8
12
  self._name = name
9
13
  self._prefix = prefix
10
14
 
11
- def get_string_entity(self):
15
+ def get_string_entity(self) -> str:
16
+ """
17
+ Public. Returns a string representation of the flag
18
+ :return: string representation of the flag as str
19
+ """
12
20
  string_entity: str = self._prefix + self._name
13
21
  return string_entity
14
22
 
15
- def get_name(self):
23
+ def get_name(self) -> str:
24
+ """
25
+ Public. Returns the name of the flag
26
+ :return: the name of the flag as str
27
+ """
16
28
  return self._name
17
29
 
18
- def get_prefix(self):
30
+ def get_prefix(self) -> str:
31
+ """
32
+ Public. Returns the prefix of the flag
33
+ :return: the prefix of the flag as str
34
+ """
19
35
  return self._prefix
20
36
 
21
-
22
-
23
- class InputFlag(BaseFlag):
24
- def __init__(self, name: str,
25
- prefix: Literal['-', '--', '---'] = '--',
26
- value: str = None):
27
- super().__init__(name, prefix)
28
- self._flag_value = value
29
-
30
- def get_value(self) -> str | None:
31
- return self._flag_value
32
-
33
- def set_value(self, value):
34
- self._flag_value = value
35
-
37
+ def __eq__(self, other) -> bool:
38
+ return self.get_string_entity() == other.get_string_entity()
36
39
 
37
40
 
38
41
  class Flag(BaseFlag):
39
- def __init__(self, name: str,
40
- prefix: Literal['-', '--', '---'] = '--',
41
- possible_values: list[str] | Pattern[str] | False = True):
42
+ def __init__(
43
+ self,
44
+ name: str,
45
+ prefix: Literal["-", "--", "---"] = "--",
46
+ possible_values: list[str] | Pattern[str] | False = True,
47
+ ) -> None:
48
+ """
49
+ Public. The entity of the flag being registered for subsequent processing
50
+ :param name: The name of the flag
51
+ :param prefix: The prefix of the flag
52
+ :param possible_values: The possible values of the flag, if False then the flag cannot have a value
53
+ :return: None
54
+ """
42
55
  super().__init__(name, prefix)
43
56
  self.possible_values = possible_values
44
57
 
45
58
  def validate_input_flag_value(self, input_flag_value: str | None):
59
+ """
60
+ Private. Validates the input flag value
61
+ :param input_flag_value: The input flag value to validate
62
+ :return: whether the entered flag is valid as bool
63
+ """
46
64
  if self.possible_values is False:
47
65
  if input_flag_value is None:
48
66
  return True
@@ -67,74 +85,37 @@ class Flag(BaseFlag):
67
85
  return True
68
86
 
69
87
 
88
+ class InputFlag(BaseFlag):
89
+ def __init__(
90
+ self, name: str, prefix: Literal["-", "--", "---"] = "--", value: str = None
91
+ ):
92
+ """
93
+ Public. The entity of the flag of the entered command
94
+ :param name: the name of the input flag
95
+ :param prefix: the prefix of the input flag
96
+ :param value: the value of the input flag
97
+ :return: None
98
+ """
99
+ super().__init__(name, prefix)
100
+ self._flag_value = value
70
101
 
71
- class BaseFlags(ABC):
72
- __slots__ = ('_flags',)
73
-
74
- @abstractmethod
75
- def get_flags(self):
76
- pass
77
-
78
- @abstractmethod
79
- def add_flag(self, flag: Flag | InputFlag):
80
- pass
81
-
82
- @abstractmethod
83
- def add_flags(self, flags: list[Flag] | list[InputFlag]):
84
- pass
85
-
86
- @abstractmethod
87
- def get_flag(self, name: str):
88
- pass
89
-
90
- def __iter__(self):
91
- return iter(self._flags)
92
-
93
- def __next__(self):
94
- return next(iter(self))
95
-
96
- def __getitem__(self, item):
97
- return self._flags[item]
98
-
99
-
100
-
101
- class Flags(BaseFlags, ABC):
102
- def __init__(self, *flags: Flag):
103
- self._flags = flags if flags else []
104
-
105
- def get_flags(self) -> list[Flag]:
106
- return self._flags
107
-
108
- def add_flag(self, flag: Flag):
109
- self._flags.append(flag)
110
-
111
- def add_flags(self, flags: list[Flag]):
112
- self._flags.extend(flags)
113
-
114
- def get_flag(self, name: str) -> Flag | None:
115
- if name in [flag.get_name() for flag in self._flags]:
116
- return list(filter(lambda flag: flag.get_name() == name, self._flags))[0]
117
- else:
118
- return None
119
-
120
-
121
-
122
- class InputFlags(BaseFlags, ABC):
123
- def __init__(self, *flags: InputFlag):
124
- self._flags = flags if flags else []
125
-
126
- def get_flags(self) -> list[InputFlag]:
127
- return self._flags
128
-
129
- def add_flag(self, flag: InputFlag):
130
- self._flags.append(flag)
131
-
132
- def add_flags(self, flags: list[InputFlag]):
133
- self._flags.extend(flags)
102
+ def get_value(self) -> str | None:
103
+ """
104
+ Public. Returns the value of the flag
105
+ :return: the value of the flag as str
106
+ """
107
+ return self._flag_value
134
108
 
135
- def get_flag(self, name: str) -> InputFlag | None:
136
- if name in [flag.get_name() for flag in self._flags]:
137
- return list(filter(lambda flag: flag.get_name() == name, self._flags))[0]
138
- else:
139
- return None
109
+ def set_value(self, value):
110
+ """
111
+ Private. Sets the value of the flag
112
+ :param value: the fag value to set
113
+ :return: None
114
+ """
115
+ self._flag_value = value
140
116
 
117
+ def __eq__(self, other) -> bool:
118
+ return (
119
+ self.get_string_entity() == other.get_string_entity()
120
+ and self.get_value() == other.get_value()
121
+ )
@@ -0,0 +1,16 @@
1
+ __all__ = [
2
+ "Flags",
3
+ "InputFlags",
4
+ "UndefinedInputFlags",
5
+ "InvalidValueInputFlags",
6
+ "ValidInputFlags",
7
+ ]
8
+
9
+
10
+ from argenta.command.flags.models import (
11
+ Flags,
12
+ InputFlags,
13
+ UndefinedInputFlags,
14
+ InvalidValueInputFlags,
15
+ ValidInputFlags,
16
+ )
@@ -0,0 +1,90 @@
1
+ from argenta.command.flag.models import InputFlag, Flag
2
+ from typing import Generic, TypeVar
3
+
4
+
5
+ FlagType = TypeVar("FlagType")
6
+
7
+
8
+ class BaseFlags(Generic[FlagType]):
9
+ def __init__(self, *flags: FlagType):
10
+ """
11
+ Public. A model that combines the registered flags
12
+ :param flags: the flags that will be registered
13
+ :return: None
14
+ """
15
+ self._flags = flags if flags else []
16
+
17
+ def get_flags(self) -> list[FlagType]:
18
+ """
19
+ Public. Returns a list of flags
20
+ :return: list of flags as list[FlagType]
21
+ """
22
+ return self._flags
23
+
24
+ def add_flag(self, flag: FlagType):
25
+ """
26
+ Public. Adds a flag to the list of flags
27
+ :param flag: flag to add
28
+ :return: None
29
+ """
30
+ self._flags.append(flag)
31
+
32
+ def add_flags(self, flags: list[FlagType]):
33
+ """
34
+ Public. Adds a list of flags to the list of flags
35
+ :param flags: list of flags to add
36
+ :return: None
37
+ """
38
+ self._flags.extend(flags)
39
+
40
+ def get_flag(self, name: str) -> FlagType | None:
41
+ """
42
+ Public. Returns the flag entity by its name or None if not found
43
+ :param name: the name of the flag to get
44
+ :return: entity of the flag or None
45
+ """
46
+ if name in [flag.get_name() for flag in self._flags]:
47
+ return list(filter(lambda flag: flag.get_name() == name, self._flags))[0]
48
+ else:
49
+ return None
50
+
51
+ def __iter__(self):
52
+ return iter(self._flags)
53
+
54
+ def __next__(self):
55
+ return next(iter(self))
56
+
57
+ def __getitem__(self, item):
58
+ return self._flags[item]
59
+
60
+ def __bool__(self):
61
+ return bool(self._flags)
62
+
63
+ def __eq__(self, other):
64
+ if len(self.get_flags()) != len(other.get_flags()):
65
+ return False
66
+ else:
67
+ for flag, other_flag in zip(self.get_flags(), other.get_flags()):
68
+ if not flag == other_flag:
69
+ return False
70
+ return True
71
+
72
+
73
+ class Flags(BaseFlags[Flag]):
74
+ pass
75
+
76
+
77
+ class InputFlags(BaseFlags[InputFlag]):
78
+ pass
79
+
80
+
81
+ class ValidInputFlags(InputFlags):
82
+ pass
83
+
84
+
85
+ class UndefinedInputFlags(InputFlags):
86
+ pass
87
+
88
+
89
+ class InvalidValueInputFlags(InputFlags):
90
+ pass
argenta/command/models.py CHANGED
@@ -1,73 +1,153 @@
1
- from argenta.command.flag.models import Flag, InputFlag, Flags, InputFlags
2
- from argenta.command.exceptions import (UnprocessedInputFlagException,
3
- RepeatedInputFlagsException,
4
- EmptyInputCommandException)
1
+ from argenta.command.flag.models import Flag, InputFlag
2
+ from argenta.command.flags.models import InputFlags, Flags
3
+ from argenta.command.exceptions import (
4
+ UnprocessedInputFlagException,
5
+ RepeatedInputFlagsException,
6
+ EmptyInputCommandException,
7
+ )
5
8
  from typing import Generic, TypeVar, cast, Literal
6
9
 
7
10
 
8
- InputCommandType = TypeVar('InputCommandType')
11
+ InputCommandType = TypeVar("InputCommandType")
9
12
 
10
13
 
11
14
  class BaseCommand:
12
- def __init__(self, trigger: str):
15
+ def __init__(self, trigger: str) -> None:
16
+ """
17
+ Private. Base class for all commands
18
+ :param trigger: A string trigger, which, when entered by the user, indicates that the input corresponds to the command
19
+ """
13
20
  self._trigger = trigger
14
21
 
15
22
  def get_trigger(self) -> str:
23
+ """
24
+ Public. Returns the trigger of the command
25
+ :return: the trigger of the command as str
26
+ """
16
27
  return self._trigger
17
28
 
18
29
 
19
30
  class Command(BaseCommand):
20
- def __init__(self, trigger: str,
21
- description: str = None,
22
- flags: Flag | Flags = None,
23
- aliases: list[str] = None):
31
+ def __init__(
32
+ self,
33
+ trigger: str,
34
+ description: str = None,
35
+ flags: Flag | Flags = None,
36
+ aliases: list[str] = None,
37
+ ):
38
+ """
39
+ Public. The command that can and should be registered in the Router
40
+ :param trigger: A string trigger, which, when entered by the user, indicates that the input corresponds to the command
41
+ :param description: the description of the command
42
+ :param flags: processed commands
43
+ :param aliases: string synonyms for the main trigger
44
+ """
24
45
  super().__init__(trigger)
25
- self._registered_flags: Flags = flags if isinstance(flags, Flags) else Flags(flags) if isinstance(flags, Flag) else Flags()
26
- self._description = f'Description for "{self._trigger}" command' if not description else description
27
- self._aliases = aliases
46
+ self._registered_flags: Flags = (
47
+ flags
48
+ if isinstance(flags, Flags)
49
+ else Flags(flags)
50
+ if isinstance(flags, Flag)
51
+ else Flags()
52
+ )
53
+ self._description = "Very useful command" if not description else description
54
+ self._aliases = aliases if isinstance(aliases, list) else []
28
55
 
29
56
  def get_registered_flags(self) -> Flags:
57
+ """
58
+ Private. Returns the registered flags
59
+ :return: the registered flags as Flags
60
+ """
30
61
  return self._registered_flags
31
62
 
32
- def get_aliases(self) -> list[str] | None:
63
+ def get_aliases(self) -> list[str] | list:
64
+ """
65
+ Public. Returns the aliases of the command
66
+ :return: the aliases of the command as list[str] | list
67
+ """
33
68
  return self._aliases
34
69
 
35
- def validate_input_flag(self, flag: InputFlag):
70
+ def validate_input_flag(
71
+ self, flag: InputFlag
72
+ ) -> Literal["Undefined", "Valid", "Invalid"]:
73
+ """
74
+ Private. Validates the input flag
75
+ :param flag: input flag for validation
76
+ :return: is input flag valid as bool
77
+ """
36
78
  registered_flags: Flags | None = self.get_registered_flags()
37
79
  if registered_flags:
38
80
  if isinstance(registered_flags, Flag):
39
81
  if registered_flags.get_string_entity() == flag.get_string_entity():
40
- is_valid = registered_flags.validate_input_flag_value(flag.get_value())
82
+ is_valid = registered_flags.validate_input_flag_value(
83
+ flag.get_value()
84
+ )
41
85
  if is_valid:
42
- return True
86
+ return "Valid"
87
+ else:
88
+ return "Invalid"
89
+ else:
90
+ return "Undefined"
43
91
  else:
44
92
  for registered_flag in registered_flags:
45
93
  if registered_flag.get_string_entity() == flag.get_string_entity():
46
- is_valid = registered_flag.validate_input_flag_value(flag.get_value())
94
+ is_valid = registered_flag.validate_input_flag_value(
95
+ flag.get_value()
96
+ )
47
97
  if is_valid:
48
- return True
49
- return False
98
+ return "Valid"
99
+ else:
100
+ return "Invalid"
101
+ return "Undefined"
102
+ return "Undefined"
50
103
 
51
104
  def get_description(self) -> str:
105
+ """
106
+ Private. Returns the description of the command
107
+ :return: the description of the command as str
108
+ """
52
109
  return self._description
53
110
 
54
111
 
55
-
56
112
  class InputCommand(BaseCommand, Generic[InputCommandType]):
57
- def __init__(self, trigger: str,
58
- input_flags: InputFlag | InputFlags = None):
113
+ def __init__(self, trigger: str, input_flags: InputFlag | InputFlags = None):
114
+ """
115
+ Private. The model of the input command, after parsing
116
+ :param trigger:the trigger of the command
117
+ :param input_flags: the input flags
118
+ :return: None
119
+ """
59
120
  super().__init__(trigger)
60
- self._input_flags: InputFlags = input_flags if isinstance(input_flags, InputFlags) else InputFlags(input_flags) if isinstance(input_flags, InputFlag) else InputFlags()
61
-
62
- def _set_input_flags(self, input_flags: InputFlags):
121
+ self._input_flags: InputFlags = (
122
+ input_flags
123
+ if isinstance(input_flags, InputFlags)
124
+ else InputFlags(input_flags)
125
+ if isinstance(input_flags, InputFlag)
126
+ else InputFlags()
127
+ )
128
+
129
+ def _set_input_flags(self, input_flags: InputFlags) -> None:
130
+ """
131
+ Private. Sets the input flags
132
+ :param input_flags: the input flags to set
133
+ :return: None
134
+ """
63
135
  self._input_flags = input_flags
64
136
 
65
137
  def get_input_flags(self) -> InputFlags:
138
+ """
139
+ Private. Returns the input flags
140
+ :return: the input flags as InputFlags
141
+ """
66
142
  return self._input_flags
67
143
 
68
-
69
144
  @staticmethod
70
145
  def parse(raw_command: str) -> InputCommandType:
146
+ """
147
+ Private. Parse the raw input command
148
+ :param raw_command: raw input command
149
+ :return: model of the input command, after parsing as InputCommand
150
+ """
71
151
  if not raw_command:
72
152
  raise EmptyInputCommandException()
73
153
 
@@ -78,26 +158,32 @@ class InputCommand(BaseCommand, Generic[InputCommandType]):
78
158
  current_flag_name, current_flag_value = None, None
79
159
 
80
160
  for k, _ in enumerate(list_of_tokens):
81
- if _.startswith('-'):
82
- if current_flag_name or len(_) < 2 or len(_[:_.rfind('-')]) > 3:
161
+ if _.startswith("-"):
162
+ if len(_) < 2 or len(_[: _.rfind("-")]) > 3:
83
163
  raise UnprocessedInputFlagException()
84
164
  current_flag_name = _
85
165
  else:
86
- if not current_flag_name:
166
+ if not current_flag_name or current_flag_value:
87
167
  raise UnprocessedInputFlagException()
88
168
  current_flag_value = _
89
169
 
90
170
  if current_flag_name:
91
- if not len(list_of_tokens) == k+1:
92
- if not list_of_tokens[k+1].startswith('-'):
171
+ if not len(list_of_tokens) == k + 1:
172
+ if not list_of_tokens[k + 1].startswith("-"):
93
173
  continue
94
174
 
95
- input_flag = InputFlag(name=current_flag_name[current_flag_name.rfind('-')+1:],
96
- prefix=cast(Literal['-', '--', '---'],
97
- current_flag_name[:current_flag_name.rfind('-')+1]),
98
- value=current_flag_value)
99
-
100
- all_flags = [flag.get_string_entity() for flag in input_flags.get_flags()]
175
+ input_flag = InputFlag(
176
+ name=current_flag_name[current_flag_name.rfind("-") + 1 :],
177
+ prefix=cast(
178
+ Literal["-", "--", "---"],
179
+ current_flag_name[: current_flag_name.rfind("-") + 1],
180
+ ),
181
+ value=current_flag_value,
182
+ )
183
+
184
+ all_flags = [
185
+ flag.get_string_entity() for flag in input_flags.get_flags()
186
+ ]
101
187
  if input_flag.get_string_entity() not in all_flags:
102
188
  input_flags.add_flag(input_flag)
103
189
  else:
@@ -109,4 +195,3 @@ class InputCommand(BaseCommand, Generic[InputCommandType]):
109
195
  raise UnprocessedInputFlagException()
110
196
  else:
111
197
  return InputCommand(trigger=command, input_flags=input_flags)
112
-
@@ -0,0 +1,4 @@
1
+ __all__ = ["Orchestrator"]
2
+
3
+
4
+ from argenta.orchestrator.entity import Orchestrator