runem 0.1.2__py3-none-any.whl → 0.2.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.
runem/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -1,18 +1,22 @@
1
1
  import shlex
2
2
  import typing
3
3
 
4
+ from typing_extensions import Unpack
5
+
4
6
  from runem.run_command import run_command
7
+ from runem.types.common import FilePathList
5
8
  from runem.types.runem_config import JobConfig
9
+ from runem.types.types_jobs import AllKwargs
6
10
 
7
11
 
8
12
  def validate_simple_command(command_string: str) -> typing.List[str]:
9
- # use shlex to handle parsing of the command string, a non-trivial problem.
13
+ """Use shlex to handle parsing of the command string, a non-trivial problem."""
10
14
  split_command: typing.List[str] = shlex.split(command_string)
11
15
  return split_command
12
16
 
13
17
 
14
18
  def job_runner_simple_command(
15
- **kwargs: typing.Any,
19
+ **kwargs: Unpack[AllKwargs],
16
20
  ) -> None:
17
21
  """Parses the command and tries to run it via the system.
18
22
 
@@ -22,11 +26,21 @@ def job_runner_simple_command(
22
26
  job_config: JobConfig = kwargs["job"]
23
27
  command_string: str = job_config["command"]
24
28
 
29
+ command_string_files: str = command_string
30
+ if "{file_list}" in command_string:
31
+ file_list: FilePathList = kwargs["file_list"]
32
+ file_list_with_quotes: typing.List[str] = [
33
+ f'"{str(file_path)}"' for file_path in file_list
34
+ ]
35
+ command_string_files = command_string.replace(
36
+ "{file_list}", " ".join(file_list_with_quotes)
37
+ )
38
+
25
39
  # use shlex to handle parsing of the command string, a non-trivial problem.
26
- result = validate_simple_command(command_string)
40
+ cmd = validate_simple_command(command_string_files)
27
41
 
28
42
  # preserve quotes for consistent handling of strings and avoid the "word
29
43
  # splitting" problem for unix-like shells.
30
- result_with_quotes = [f'"{token}"' if " " in token else token for token in result]
44
+ cmd_with_quotes = [f'"{token}"' if " " in token else token for token in cmd]
31
45
 
32
- run_command(cmd=result_with_quotes, **kwargs)
46
+ run_command(cmd=cmd_with_quotes, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -9,7 +9,7 @@ License-File: LICENSE
9
9
  Requires-Dist: packaging
10
10
  Requires-Dist: PyYAML
11
11
  Requires-Dist: rich
12
- Requires-Dist: typing-extensions
12
+ Requires-Dist: typing_extensions
13
13
  Provides-Extra: tests
14
14
  Requires-Dist: black==24.10.0; extra == "tests"
15
15
  Requires-Dist: coverage==7.5; extra == "tests"
@@ -1,4 +1,4 @@
1
- runem/VERSION,sha256=KXtQ8IOG01Ifj9ry94642dCs30UtLmFZaQX7o3IIx5I,6
1
+ runem/VERSION,sha256=H5MN0fEzwfl6lP46y42zQ3LPTAH_2ys_9Mpy-UlBIek,6
2
2
  runem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  runem/__main__.py,sha256=dsOiVZegpfK9JOs5n7UmbX5iwwbj7iFkEbLoVeEgAn4,136
4
4
  runem/base.py,sha256=EZfR7FIlwEdU9Vfe47Wk2DOO8GQqpKxxLNKp6YHueZ4,316
@@ -14,7 +14,7 @@ runem/informative_dict.py,sha256=U7p9z78UwOT4TAfng1iDXCEyeYz6C-XZlx9Z1pWNVrI,154
14
14
  runem/job.py,sha256=LmNXDHxDxAwyJxAAdPHIv_0bwZy2btyTPHPGO_N7euI,2986
15
15
  runem/job_execute.py,sha256=BPkeTpeTGJs3QWa0-07DZvF1f0uKO79e4yMsTxq1UHk,4656
16
16
  runem/job_filter.py,sha256=7vgG4YWJ9gyGBFjV7QbSojG5ofYoszAmxXx9HnMLkHo,5384
17
- runem/job_runner_simple_command.py,sha256=OIfj7CrPy0fPszhubUsTzORMlMC62OiNSvH5DysYL-4,1104
17
+ runem/job_runner_simple_command.py,sha256=RcM6tfw3i_idgv77MSVmoxGXIF2VfngGOYHOKiuJvX4,1625
18
18
  runem/job_wrapper.py,sha256=q5GtopZ5vhSJ581rwU4-lF9KnbL3ZYgOC8fqaCnXD_g,983
19
19
  runem/job_wrapper_python.py,sha256=rx7J_N-JXs8GgMq7Sla7B9s_ZAfofKUhEnzgMcq_bts,4303
20
20
  runem/log.py,sha256=dIrocigvIJs1ZGkAzTogXkAK-0ZW3q5FkjpDgLdeW-E,630
@@ -34,9 +34,9 @@ runem/types/runem_config.py,sha256=qG_bghm5Nr-ZTbaZbf1v8Fx447V-hgEvvRy5NZ3t-Io,5
34
34
  runem/types/types_jobs.py,sha256=wqiiBmRIJDbGlKcfOqewHGKx350w0p4_7pysMm7xGmo,4906
35
35
  tests/test_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  tests/test_types/test_public_api.py,sha256=QHiwt7CetQur65JSbFRnOzQxhCJkX5MVLymHHVd_6yc,160
37
- runem-0.1.2.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
38
- runem-0.1.2.dist-info/METADATA,sha256=UQCyI88PE3lJWibR7VmDFyIGi9xPpnykhp8QKmn9E-U,5842
39
- runem-0.1.2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
40
- runem-0.1.2.dist-info/entry_points.txt,sha256=nu0g_vBeuPihYtimbtlNusxWovylMppvJ8UxdJlJfvM,46
41
- runem-0.1.2.dist-info/top_level.txt,sha256=Zu65aVeDPh8WbChU4Mi7-Md4S3XJDPuqdQjEE3DSQno,12
42
- runem-0.1.2.dist-info/RECORD,,
37
+ runem-0.2.0.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
38
+ runem-0.2.0.dist-info/METADATA,sha256=g7u9feZjpdo9L3U8hWqYIhSx3_6K1514AL_Nxyk_gkk,5842
39
+ runem-0.2.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
40
+ runem-0.2.0.dist-info/entry_points.txt,sha256=nu0g_vBeuPihYtimbtlNusxWovylMppvJ8UxdJlJfvM,46
41
+ runem-0.2.0.dist-info/top_level.txt,sha256=Zu65aVeDPh8WbChU4Mi7-Md4S3XJDPuqdQjEE3DSQno,12
42
+ runem-0.2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
File without changes