argenta 1.0.0a1__tar.gz → 1.0.0a2__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.
Files changed (62) hide show
  1. {argenta-1.0.0a1 → argenta-1.0.0a2}/PKG-INFO +1 -98
  2. {argenta-1.0.0a1 → argenta-1.0.0a2}/README.md +0 -97
  3. argenta-1.0.0a2/mock/local_test.py +6 -0
  4. {argenta-1.0.0a1 → argenta-1.0.0a2}/pyproject.toml +1 -1
  5. argenta-1.0.0a2/src/argenta/router/__init__.py +4 -0
  6. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/router/entity.py +8 -8
  7. argenta-1.0.0a2/tests/unit_tests/test_app.py +73 -0
  8. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/unit_tests/test_command.py +16 -0
  9. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/unit_tests/test_router.py +6 -6
  10. argenta-1.0.0a1/mock/local_test.py +0 -13
  11. argenta-1.0.0a1/src/argenta/router/__init__.py +0 -4
  12. {argenta-1.0.0a1 → argenta-1.0.0a2}/.github/workflows/ruff.yml +0 -0
  13. {argenta-1.0.0a1 → argenta-1.0.0a2}/.github/workflows/tests.yml +0 -0
  14. {argenta-1.0.0a1 → argenta-1.0.0a2}/.gitignore +0 -0
  15. {argenta-1.0.0a1 → argenta-1.0.0a2}/LICENSE +0 -0
  16. {argenta-1.0.0a1 → argenta-1.0.0a2}/imgs/mock_app_preview1.png +0 -0
  17. {argenta-1.0.0a1 → argenta-1.0.0a2}/imgs/mock_app_preview2.png +0 -0
  18. {argenta-1.0.0a1 → argenta-1.0.0a2}/imgs/mock_app_preview3.png +0 -0
  19. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/__init__.py +0 -0
  20. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/default_mock_app/__init__.py +0 -0
  21. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/default_mock_app/main.py +0 -0
  22. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/mock_app/__init__.py +0 -0
  23. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/mock_app/handlers/__init__.py +0 -0
  24. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/mock_app/handlers/handlers_implementation/__init__.py +0 -0
  25. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/mock_app/handlers/handlers_implementation/help_command.py +0 -0
  26. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/mock_app/handlers/routers.py +0 -0
  27. {argenta-1.0.0a1 → argenta-1.0.0a2}/mock/mock_app/main.py +0 -0
  28. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/__init__.py +0 -0
  29. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/__init__.py +0 -0
  30. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/__init__.py +0 -0
  31. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/autocompleter/__init__.py +0 -0
  32. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/autocompleter/entity.py +0 -0
  33. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/defaults.py +0 -0
  34. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/dividing_line/__init__.py +0 -0
  35. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/dividing_line/models.py +0 -0
  36. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/exceptions.py +0 -0
  37. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/models.py +0 -0
  38. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/registered_routers/__init__.py +0 -0
  39. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/app/registered_routers/entity.py +0 -0
  40. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/command/__init__.py +0 -0
  41. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/command/exceptions.py +0 -0
  42. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/command/flag/__init__.py +0 -0
  43. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/command/flag/defaults.py +0 -0
  44. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/command/flag/models.py +0 -0
  45. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/command/models.py +0 -0
  46. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/orchestrator/__init__.py +0 -0
  47. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/orchestrator/argparser/__init__.py +0 -0
  48. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/orchestrator/argparser/arguments/__init__.py +0 -0
  49. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/orchestrator/argparser/arguments/models.py +0 -0
  50. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/orchestrator/argparser/entity.py +0 -0
  51. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/orchestrator/entity.py +0 -0
  52. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/router/command_handler/__init__.py +0 -0
  53. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/router/command_handler/entity.py +0 -0
  54. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/router/defaults.py +0 -0
  55. {argenta-1.0.0a1 → argenta-1.0.0a2}/src/argenta/router/exceptions.py +0 -0
  56. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/__init__.py +0 -0
  57. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/system_tests/__init__.py +0 -0
  58. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/system_tests/test_system_handling_non_standard_behavior.py +0 -0
  59. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/system_tests/test_system_handling_normal_behavior.py +0 -0
  60. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/unit_tests/__init__.py +0 -0
  61. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/unit_tests/test_dividing_line.py +0 -0
  62. {argenta-1.0.0a1 → argenta-1.0.0a2}/tests/unit_tests/test_flag.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: argenta
3
- Version: 1.0.0a1
3
+ Version: 1.0.0a2
4
4
  Summary: Python library for creating TUI
5
5
  Author-email: kolo <kolo.is.main@gmail.com>
6
6
  License: MIT
@@ -347,22 +347,6 @@ Public. Sets the handler for exit command when entering a command
347
347
 
348
348
  ---
349
349
 
350
- <a id="argenta.app.models.App.run_polling"></a>
351
-
352
- #### run\_polling
353
-
354
- ```python
355
- def run_polling() -> None
356
- ```
357
-
358
- Private. Starts the user input processing cycle
359
-
360
- **Returns**:
361
-
362
- `None`
363
-
364
- ---
365
-
366
350
  <a id="argenta.app.models.App.include_router"></a>
367
351
 
368
352
  #### include\_router
@@ -507,26 +491,6 @@ Public. The static dividing line
507
491
 
508
492
  ---
509
493
 
510
- <a id="argenta.app.dividing_line.models.StaticDividingLine.get_full_static_line"></a>
511
-
512
- #### get\_full\_static\_line
513
-
514
- ```python
515
- def get_full_static_line(is_override: bool) -> str
516
- ```
517
-
518
- Private. Returns the full line of the dividing line
519
-
520
- **Arguments**:
521
-
522
- - `is_override`: has the default text layout been redefined
523
-
524
- **Returns**:
525
-
526
- full line of dividing line as str
527
-
528
- ---
529
-
530
494
  <a id="argenta.app.dividing_line.models.DynamicDividingLine"></a>
531
495
 
532
496
  ## DynamicDividingLine Objects
@@ -555,27 +519,6 @@ Public. The dynamic dividing line
555
519
 
556
520
  ---
557
521
 
558
- <a id="argenta.app.dividing_line.models.DynamicDividingLine.get_full_dynamic_line"></a>
559
-
560
- #### get\_full\_dynamic\_line
561
-
562
- ```python
563
- def get_full_dynamic_line(length: int, is_override: bool) -> str
564
- ```
565
-
566
- Private. Returns the full line of the dividing line
567
-
568
- **Arguments**:
569
-
570
- - `length`: the length of the dividing line
571
- - `is_override`: has the default text layout been redefined
572
-
573
- **Returns**:
574
-
575
- full line of dividing line as str
576
-
577
- ---
578
-
579
522
  <a id="argenta.app.exceptions"></a>
580
523
 
581
524
  # `.app.exceptions`
@@ -1246,46 +1189,6 @@ Public. Registers handler for invalid input flag
1246
1189
 
1247
1190
  ---
1248
1191
 
1249
- <a id="argenta.router.entity.Router.input_command_handler"></a>
1250
-
1251
- #### input\_command\_handler
1252
-
1253
- ```python
1254
- def input_command_handler(input_command: InputCommand) -> None
1255
- ```
1256
-
1257
- Private. One handler for all input commands
1258
-
1259
- **Arguments**:
1260
-
1261
- - `input_command`: input command as InputCommand
1262
-
1263
- **Returns**:
1264
-
1265
- `None`
1266
-
1267
- ---
1268
-
1269
- <a id="argenta.router.entity.Router.set_command_register_ignore"></a>
1270
-
1271
- #### set\_command\_register\_ignore
1272
-
1273
- ```python
1274
- def set_command_register_ignore(_: bool) -> None
1275
- ```
1276
-
1277
- Private. Sets the router behavior on the input commands register
1278
-
1279
- **Arguments**:
1280
-
1281
- - `_`: is command register ignore
1282
-
1283
- **Returns**:
1284
-
1285
- `None`
1286
-
1287
- ---
1288
-
1289
1192
  <a id="argenta.router.entity.Router.get_triggers"></a>
1290
1193
 
1291
1194
  #### get\_triggers
@@ -334,22 +334,6 @@ Public. Sets the handler for exit command when entering a command
334
334
 
335
335
  ---
336
336
 
337
- <a id="argenta.app.models.App.run_polling"></a>
338
-
339
- #### run\_polling
340
-
341
- ```python
342
- def run_polling() -> None
343
- ```
344
-
345
- Private. Starts the user input processing cycle
346
-
347
- **Returns**:
348
-
349
- `None`
350
-
351
- ---
352
-
353
337
  <a id="argenta.app.models.App.include_router"></a>
354
338
 
355
339
  #### include\_router
@@ -494,26 +478,6 @@ Public. The static dividing line
494
478
 
495
479
  ---
496
480
 
497
- <a id="argenta.app.dividing_line.models.StaticDividingLine.get_full_static_line"></a>
498
-
499
- #### get\_full\_static\_line
500
-
501
- ```python
502
- def get_full_static_line(is_override: bool) -> str
503
- ```
504
-
505
- Private. Returns the full line of the dividing line
506
-
507
- **Arguments**:
508
-
509
- - `is_override`: has the default text layout been redefined
510
-
511
- **Returns**:
512
-
513
- full line of dividing line as str
514
-
515
- ---
516
-
517
481
  <a id="argenta.app.dividing_line.models.DynamicDividingLine"></a>
518
482
 
519
483
  ## DynamicDividingLine Objects
@@ -542,27 +506,6 @@ Public. The dynamic dividing line
542
506
 
543
507
  ---
544
508
 
545
- <a id="argenta.app.dividing_line.models.DynamicDividingLine.get_full_dynamic_line"></a>
546
-
547
- #### get\_full\_dynamic\_line
548
-
549
- ```python
550
- def get_full_dynamic_line(length: int, is_override: bool) -> str
551
- ```
552
-
553
- Private. Returns the full line of the dividing line
554
-
555
- **Arguments**:
556
-
557
- - `length`: the length of the dividing line
558
- - `is_override`: has the default text layout been redefined
559
-
560
- **Returns**:
561
-
562
- full line of dividing line as str
563
-
564
- ---
565
-
566
509
  <a id="argenta.app.exceptions"></a>
567
510
 
568
511
  # `.app.exceptions`
@@ -1233,46 +1176,6 @@ Public. Registers handler for invalid input flag
1233
1176
 
1234
1177
  ---
1235
1178
 
1236
- <a id="argenta.router.entity.Router.input_command_handler"></a>
1237
-
1238
- #### input\_command\_handler
1239
-
1240
- ```python
1241
- def input_command_handler(input_command: InputCommand) -> None
1242
- ```
1243
-
1244
- Private. One handler for all input commands
1245
-
1246
- **Arguments**:
1247
-
1248
- - `input_command`: input command as InputCommand
1249
-
1250
- **Returns**:
1251
-
1252
- `None`
1253
-
1254
- ---
1255
-
1256
- <a id="argenta.router.entity.Router.set_command_register_ignore"></a>
1257
-
1258
- #### set\_command\_register\_ignore
1259
-
1260
- ```python
1261
- def set_command_register_ignore(_: bool) -> None
1262
- ```
1263
-
1264
- Private. Sets the router behavior on the input commands register
1265
-
1266
- **Arguments**:
1267
-
1268
- - `_`: is command register ignore
1269
-
1270
- **Returns**:
1271
-
1272
- `None`
1273
-
1274
- ---
1275
-
1276
1179
  <a id="argenta.router.entity.Router.get_triggers"></a>
1277
1180
 
1278
1181
  #### get\_triggers
@@ -0,0 +1,6 @@
1
+ from argenta.app import App
2
+ from argenta.command.models import InputCommand
3
+
4
+ app = App()
5
+ app._all_registered_triggers_in_lower = ['fr', 'Tre', 'Pre']
6
+ print(app._is_unknown_command(InputCommand('fr')))
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "argenta"
3
- version = "1.0.0-alpha1"
3
+ version = "1.0.0-alpha2"
4
4
  description = "Python library for creating TUI"
5
5
  authors = [{ name = "kolo", email = "kolo.is.main@gmail.com" }]
6
6
  requires-python = ">=3.11, <4.0"
@@ -0,0 +1,4 @@
1
+ __all__ = ["Router"]
2
+
3
+
4
+ from argenta.router.entity import Router
@@ -1,13 +1,13 @@
1
1
  from typing import Callable
2
2
  from inspect import getfullargspec
3
- from src.argenta.command import Command
4
- from src.argenta.command.models import InputCommand
5
- from src.argenta.router.command_handler.entity import CommandHandlers, CommandHandler
6
- from src.argenta.command.flag.models import Flag, Flags, InputFlags
7
- from src.argenta.router.exceptions import (RepeatedFlagNameException,
8
- TooManyTransferredArgsException,
9
- RequiredArgumentNotPassedException,
10
- TriggerContainSpacesException)
3
+ from argenta.command import Command
4
+ from argenta.command.models import InputCommand
5
+ from argenta.router.command_handler.entity import CommandHandlers, CommandHandler
6
+ from argenta.command.flag.models import Flag, Flags, InputFlags
7
+ from argenta.router.exceptions import (RepeatedFlagNameException,
8
+ TooManyTransferredArgsException,
9
+ RequiredArgumentNotPassedException,
10
+ TriggerContainSpacesException)
11
11
 
12
12
 
13
13
  class Router:
@@ -0,0 +1,73 @@
1
+ from argenta.command.models import InputCommand, Command
2
+ from argenta.app import App
3
+
4
+ import unittest
5
+
6
+
7
+ class MyTestCase(unittest.TestCase):
8
+ def test_is_exit_command1(self):
9
+ app = App()
10
+ self.assertEqual(app._is_exit_command(InputCommand('q')), True)
11
+
12
+ def test_is_exit_command5(self):
13
+ app = App()
14
+ self.assertEqual(app._is_exit_command(InputCommand('Q')), True)
15
+
16
+ def test_is_exit_command2(self):
17
+ app = App(ignore_command_register=False)
18
+ self.assertEqual(app._is_exit_command(InputCommand('q')), False)
19
+
20
+ def test_is_exit_command3(self):
21
+ app = App(exit_command=Command('quit'))
22
+ self.assertEqual(app._is_exit_command(InputCommand('quit')), True)
23
+
24
+ def test_is_exit_command4(self):
25
+ app = App(exit_command=Command('quit'))
26
+ self.assertEqual(app._is_exit_command(InputCommand('qUIt')), True)
27
+
28
+ def test_is_exit_command6(self):
29
+ app = App(ignore_command_register=False,
30
+ exit_command=Command('quit'))
31
+ self.assertEqual(app._is_exit_command(InputCommand('qUIt')), False)
32
+
33
+ def test_is_unknown_command1(self):
34
+ app = App()
35
+ app.set_unknown_command_handler(lambda command: None)
36
+ app._all_registered_triggers_in_lower = ['fr', 'tr', 'de']
37
+ self.assertEqual(app._is_unknown_command(InputCommand('fr')), False)
38
+
39
+ def test_is_unknown_command2(self):
40
+ app = App()
41
+ app.set_unknown_command_handler(lambda command: None)
42
+ app._all_registered_triggers_in_lower = ['fr', 'tr', 'de']
43
+ self.assertEqual(app._is_unknown_command(InputCommand('cr')), True)
44
+
45
+ def test_is_unknown_command3(self):
46
+ app = App(ignore_command_register=False)
47
+ app.set_unknown_command_handler(lambda command: None)
48
+ app._all_registered_triggers_in_default_case = ['Pr', 'tW', 'deQW']
49
+ self.assertEqual(app._is_unknown_command(InputCommand('pr')), True)
50
+
51
+ def test_is_unknown_command4(self):
52
+ app = App(ignore_command_register=False)
53
+ app.set_unknown_command_handler(lambda command: None)
54
+ app._all_registered_triggers_in_default_case = ['Pr', 'tW', 'deQW']
55
+ self.assertEqual(app._is_unknown_command(InputCommand('tW')), False)
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
@@ -31,3 +31,19 @@ class TestInputCommand(unittest.TestCase):
31
31
  command = Command('some', flags=Flags(Flag('test'), Flag('more')))
32
32
  self.assertEqual(command.validate_input_flag(InputFlag('more')), True)
33
33
 
34
+ def test_validate_incorrect_input_flag1(self):
35
+ command = Command('some', flags=Flags(Flag('test')))
36
+ self.assertEqual(command.validate_input_flag(InputFlag('more')), False)
37
+
38
+ def test_validate_incorrect_input_flag2(self):
39
+ command = Command('some', flags=Flags(Flag('test'), Flag('more')))
40
+ self.assertEqual(command.validate_input_flag(InputFlag('case')), False)
41
+
42
+ def test_validate_incorrect_input_flag3(self):
43
+ command = Command('some')
44
+ self.assertEqual(command.validate_input_flag(InputFlag('case')), False)
45
+
46
+ def test_isinstance_parse_correct_raw_command(self):
47
+ cmd = InputCommand.parse('ssh --host 192.168.0.3')
48
+ self.assertIsInstance(cmd, InputCommand)
49
+
@@ -1,10 +1,10 @@
1
1
  from argenta.command.flag import InputFlags, InputFlag, Flag, Flags
2
- from src.argenta.router import Router
3
- from src.argenta.command import Command
4
- from src.argenta.router.exceptions import (TriggerContainSpacesException,
5
- RepeatedFlagNameException,
6
- TooManyTransferredArgsException,
7
- RequiredArgumentNotPassedException)
2
+ from argenta.router import Router
3
+ from argenta.command import Command
4
+ from argenta.router.exceptions import (TriggerContainSpacesException,
5
+ RepeatedFlagNameException,
6
+ TooManyTransferredArgsException,
7
+ RequiredArgumentNotPassedException)
8
8
 
9
9
  import unittest
10
10
  import re
@@ -1,13 +0,0 @@
1
- from argenta.command.flag.defaults import PredefinedFlags
2
-
3
- router = Router()
4
- flag = PredefinedFlags.SHORT_HELP
5
-
6
- @router.command(Command('test', flags=flag))
7
- def test(args: InputFlags):
8
- print(f'help for {args.get_flag('h').get_name()} flag')
9
-
10
- app = App(override_system_messages=True,
11
- print_func=print)
12
- app.include_router(router)
13
- app.run_polling()
@@ -1,4 +0,0 @@
1
- __all__ = ["Router"]
2
-
3
-
4
- from src.argenta.router.entity import Router
File without changes
File without changes
File without changes
File without changes
File without changes