dekshell 0.2.24__py3-none-any.whl → 0.2.25__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.
@@ -4,6 +4,7 @@ import sys
4
4
  import time
5
5
  import tempfile
6
6
  import getpass
7
+ import operator
7
8
  from importlib import import_module
8
9
  from functools import reduce
9
10
  from itertools import chain
@@ -11,7 +12,7 @@ from pathlib import Path
11
12
  from io import BytesIO, StringIO
12
13
  from dektools.file import sure_dir, write_file, read_text, remove_path, sure_parent_dir, normal_path, \
13
14
  format_path_desc, read_file, split_ext, path_ext, clear_dir, copy_recurse_ignore, path_is_empty, \
14
- read_lines, seek_py_module_path, come_real_path, status_of_dir, diff_of_dir, \
15
+ read_lines, seek_py_module_path, come_real_path, status_of_dir, diff_of_dir, path_parent, \
15
16
  split_file, combine_split_files, remove_split_files, meta_split_file, tree, iglob, \
16
17
  where, where_list, which, which_list
17
18
  from dektools.hash import hash_file
@@ -41,13 +42,6 @@ def _is_true(x):
41
42
  return x not in {'false', '0', 'none', 'null', '', ' ', False, 0, None, b'', b'\0'}
42
43
 
43
44
 
44
- def _parent_dir(path, num=1):
45
- cursor = path
46
- for i in range(int(num)):
47
- cursor = os.path.dirname(cursor)
48
- return cursor
49
-
50
-
51
45
  def _list_dir_one(path, file):
52
46
  path = normal_path(path)
53
47
  for item in os.listdir(path):
@@ -245,7 +239,7 @@ default_methods = {
245
239
  'tree': _tree,
246
240
  'exists': os.path.exists,
247
241
  'empty': path_is_empty,
248
- 'parent': _parent_dir,
242
+ 'parent': path_parent,
249
243
  'abs': normal_path,
250
244
  'rel': os.path.relpath,
251
245
  'cr': come_real_path,
@@ -306,11 +300,18 @@ default_methods = {
306
300
 
307
301
  'me': lambda x: x,
308
302
  'first': lambda x, default=None: next(iter(x), default),
303
+
309
304
  'true': lambda x=True: _is_true(x),
310
305
  'false': lambda x=False: not _is_true(x),
311
306
 
312
- 'equal': lambda x, y: x == y,
313
- 'notequal': lambda x, y: x != y,
307
+ 'not_': lambda x: not x,
308
+ 'or_': lambda *x: reduce(operator.or_, x),
309
+ 'and_': lambda *x: reduce(operator.and_, x),
310
+ 'eq': lambda x, y: x == y,
311
+ 'neq': lambda x, y: x != y,
312
+ 'is_': lambda x, y: x is y,
313
+ 'nis': lambda x, y: x is not y,
314
+
314
315
  'beep': lambda x=True: sound_notify(x),
315
316
 
316
317
  'invoke': lambda __placeholder__filepath, *args, **kwargs: InvokeMarker.execute_file(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dekshell
3
- Version: 0.2.24
3
+ Version: 0.2.25
4
4
  Author-Email: sanzenwin <sanzenwin@gmail.com>
5
5
  License: MIT
6
6
  Requires-Python: >=3.8
@@ -1,12 +1,12 @@
1
- dekshell-0.2.24.dist-info/METADATA,sha256=f-mIEj9boAs1HVZhe7DCujOQ6Kjst9S8Hz0pESrZR7Q,573
2
- dekshell-0.2.24.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- dekshell-0.2.24.dist-info/entry_points.txt,sha256=d-kbfULiUTZWIBBsrQF3J_-wESncF-4K2rwHT08grlI,75
1
+ dekshell-0.2.25.dist-info/METADATA,sha256=UFqA_plZ8cNmlxdtBwbPzo7pnm2a8FZ91rk5IyuUfHg,573
2
+ dekshell-0.2.25.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ dekshell-0.2.25.dist-info/entry_points.txt,sha256=d-kbfULiUTZWIBBsrQF3J_-wESncF-4K2rwHT08grlI,75
4
4
  dekshell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  dekshell/click/__entry__.py,sha256=CMuxUzXoEe4TcHFZwv-MNFwHnu1HSZCDpXFpqQ814uM,42
6
6
  dekshell/click/__init__.py,sha256=rFzB_exzPQaIcbbms5PdHAU3NGdl2MBaYbq9v7g7BOI,1870
7
7
  dekshell/core/__init__.py,sha256=w-IeR-tO61Mv4ubZyw9LvyagudyD8SXH0YD3yKApNXk,5405
8
8
  dekshell/core/contexts/__init__.py,sha256=ynsfv37azOKfI2UKd0iPl2M6iBW-k5cb1BqSLOWuJpI,482
9
- dekshell/core/contexts/methods.py,sha256=-wyKam6IZIjk2269D8rXf85psOzFTMpCjfO_ZMd81yI,9630
9
+ dekshell/core/contexts/methods.py,sha256=7z2c0kHY5ktMiMje4fCueAHWhl4sWsjQVivSD8OSNaQ,9707
10
10
  dekshell/core/contexts/properties.py,sha256=esr51c6wDTDsuFXF2uj7WfyIGSq9H0dzqDqWzeMTNQE,2382
11
11
  dekshell/core/markers/__init__.py,sha256=_HJsxjjsyYbL7Pj6jhoeJ1WJI92qwCbdl-BKvQcGHlA,1949
12
12
  dekshell/core/markers/base/__init__.py,sha256=DDYlAIiVwmXCv4PiH042FRTwxn6Wxdnt0PsV_BSbYaY,13729
@@ -37,4 +37,4 @@ dekshell/utils/cmd.py,sha256=FfWNRRRdiiTs3xoXvaAyZ-3OzsWFRnd3m5k6sIexrhc,1209
37
37
  dekshell/utils/pkg.py,sha256=TgYqRqawoJfjkxt6UAHnp9ttmpjuHiWRFbqxADOS1VE,1337
38
38
  dekshell/utils/serializer.py,sha256=aIdF2Wzo-qHmIshv46jn1XD0X66vQ1JFdU-g3ZFbH2w,386
39
39
  dekshell/utils/shell.py,sha256=0NoA2-SOOMinbmZZipwzL-npBbzPOdWEfdPVYqq5G5g,92
40
- dekshell-0.2.24.dist-info/RECORD,,
40
+ dekshell-0.2.25.dist-info/RECORD,,