listpick 0.1.16.3__py3-none-any.whl → 0.1.16.4__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.

Potentially problematic release.


This version of listpick might be problematic. Click here for more details.

@@ -16,6 +16,7 @@ import logging
16
16
 
17
17
  logger = logging.getLogger('picker_log')
18
18
  import concurrent.futures
19
+ import re
19
20
 
20
21
  def generate_columns(funcs: list, files: list) -> list[list[str]]:
21
22
  """
@@ -79,7 +80,7 @@ def command_to_func(command: str) -> Callable:
79
80
  """
80
81
  logger.info("function: command_to_func (generate_data.py)")
81
82
 
82
- func = lambda arg: subprocess.run(command.format(repr(arg)), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.decode("utf-8")
83
+ func = lambda arg: subprocess.run(replace_braces(command, repr(arg)), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.decode("utf-8").strip()
83
84
  return func
84
85
 
85
86
  def load_environment(envs:dict):
@@ -91,6 +92,12 @@ def load_environment(envs:dict):
91
92
  if "cwd" in envs:
92
93
  os.chdir(os.path.expandvars(os.path.expanduser(envs["cwd"])))
93
94
 
95
+ def replace_braces(text, s):
96
+ text = re.sub(r'\{\{(.*?)\}\}', r'@@\1@@', text)
97
+ text = re.sub(r'\{\}', s, text)
98
+ text = re.sub(r'@@(.*?)@@', r'{{\1}}', text)
99
+ return text
100
+
94
101
 
95
102
  def read_toml(file_path) -> Tuple[dict, list, list]:
96
103
  """
@@ -25,6 +25,8 @@ import logging
25
25
  import threading
26
26
  from queue import PriorityQueue
27
27
  import time
28
+ import re
29
+ import shlex
28
30
 
29
31
  logger = logging.getLogger('picker_log')
30
32
 
@@ -84,7 +86,7 @@ def command_to_func(command: str) -> Callable:
84
86
  """
85
87
  logger.info("function: command_to_func (generate_data.py)")
86
88
 
87
- func = lambda arg: subprocess.run(command.format(repr(arg)), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.decode("utf-8").strip()
89
+ func = lambda arg: subprocess.run(replace_braces(command, arg), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.decode("utf-8").strip()
88
90
  return func
89
91
 
90
92
  def load_environment(envs:dict):
@@ -96,6 +98,11 @@ def load_environment(envs:dict):
96
98
  if "cwd" in envs:
97
99
  os.chdir(os.path.expandvars(os.path.expanduser(envs["cwd"])))
98
100
 
101
+ def replace_braces(text, s):
102
+ text = re.sub(r'\{\{(.*?)\}\}', r'@@\1@@', text)
103
+ text = re.sub(r'\{\}', shlex.quote(s), text)
104
+ text = re.sub(r'@@(.*?)@@', r'{{\1}}', text)
105
+ return text
99
106
 
100
107
  def read_toml(file_path) -> Tuple[dict, list, list]:
101
108
  """
listpick/utils/utils.py CHANGED
@@ -14,6 +14,7 @@ import tempfile
14
14
  import os
15
15
  from typing import Tuple, Dict
16
16
  import logging
17
+ import shlex
17
18
 
18
19
  logger = logging.getLogger('picker_log')
19
20
 
@@ -290,9 +291,7 @@ def openFiles(files: list[str]) -> str:
290
291
  apps[app] = [t]
291
292
 
292
293
  return apps
293
- for i in range(len(files)):
294
- if ' ' in files[i] and files[i][0] not in ["'", '"']:
295
- files[i] = repr(files[i])
294
+ files = [shlex.quote(file) for file in files]
296
295
 
297
296
  types = get_mime_types(files)
298
297
  apps = get_applications(types.keys())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: listpick
3
- Version: 0.1.16.3
3
+ Version: 0.1.16.4
4
4
  Summary: Listpick is a powerful TUI data tool for creating TUI apps or viewing/comparing tabulated data.
5
5
  Home-page: https://github.com/grimandgreedy/listpick
6
6
  Author: Grim
@@ -17,8 +17,8 @@ listpick/utils/clipboard_operations.py,sha256=ORdNm2kgGbfs51xJSvgJPERgoSmBgT11ax
17
17
  listpick/utils/config.py,sha256=MEnAZg2Rhfl38XofEIN0uoVAOY7I0ftc79Evk3fOiVw,1654
18
18
  listpick/utils/dump.py,sha256=60YVIMNtBoYvWhmzfTJOsNGcetOvcCB3_T7yv-bYTPQ,3838
19
19
  listpick/utils/filtering.py,sha256=59_YIEYRV0ovnjF4iyuShq276FMAx5gBD9m3mE9IqJg,1237
20
- listpick/utils/generate_data.py,sha256=YxkAPDkQnkeBmxQq8K7n6so-OUKC8DCPZqoqixYO2jw,4438
21
- listpick/utils/generate_data_multithreaded.py,sha256=AvAeejmDujwTAueLnl9giC2NKxhrOmk1IILVQgE5M-g,6305
20
+ listpick/utils/generate_data.py,sha256=TCGwDrN49Xx33AdURpQRGi6Xi2uwjt96rEeWWYS8mFE,4649
21
+ listpick/utils/generate_data_multithreaded.py,sha256=eWtv-gDdlTWwURKdg2cThrRI0I02JQNmQIr6q9GqtDc,6527
22
22
  listpick/utils/graphing.py,sha256=ugjAH8js_iH7hulg4SySxb_W_f8B6GhTaceN5i7DID4,6954
23
23
  listpick/utils/keycodes.py,sha256=ZGkw1-4szxPnP81wj80r92L6_neIOlBBjQltEieCwnk,2696
24
24
  listpick/utils/options_selectors.py,sha256=fQqTCAqRsrMhZwXUtsPBm47svkaUaeJqWsMW7Q4JTYY,3083
@@ -29,10 +29,10 @@ listpick/utils/searching.py,sha256=Xk5UIqamNHL2L90z3ACB_Giqdpi9iRKoAJ6pKaqaD7Q,3
29
29
  listpick/utils/sorting.py,sha256=WZZiVlVA3Zkcpwji3U5SNFlQ14zVEk3cZJtQirBkecQ,5329
30
30
  listpick/utils/table_to_list_of_lists.py,sha256=XBj7eGBDF15BRME-swnoXyOfZWxXCxrXp0pzsBfcJ5g,12224
31
31
  listpick/utils/user_input.py,sha256=oyJZPAwA7UGAclPhdPL44tKnPIVNHWhX-tZEnCdBKC0,4318
32
- listpick/utils/utils.py,sha256=QptLnqT15Z3G7xoq-6Q8e4-aZRFClTdb3h0l42di11s,13810
33
- listpick-0.1.16.3.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
34
- listpick-0.1.16.3.dist-info/METADATA,sha256=8HD-1Fi-J4ZjWaMRNveU7xUjzepKEUXsXAB_mpl7RQI,8128
35
- listpick-0.1.16.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- listpick-0.1.16.3.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
37
- listpick-0.1.16.3.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
38
- listpick-0.1.16.3.dist-info/RECORD,,
32
+ listpick/utils/utils.py,sha256=nsR6orCBQy3rTXrCweq8cV-RzRVU15v3J9NclPeAOJk,13741
33
+ listpick-0.1.16.4.dist-info/licenses/LICENSE.txt,sha256=2mP-MRHJptADDNE9VInMNg1tE-C6Qv93Z4CCQKrpg9w,1061
34
+ listpick-0.1.16.4.dist-info/METADATA,sha256=VwWPk2nx7z_mnZJz8ips6nLYm0_YZcIxP6Y8KLegyIA,8128
35
+ listpick-0.1.16.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ listpick-0.1.16.4.dist-info/entry_points.txt,sha256=-QCf_BKIkUz35Y9nkYpjZWs2Qg0KfRna2PAs5DnF6BE,43
37
+ listpick-0.1.16.4.dist-info/top_level.txt,sha256=5mtsGEz86rz3qQDe0D463gGjAfSp6A3EWg4J4AGYr-Q,9
38
+ listpick-0.1.16.4.dist-info/RECORD,,