omlish 0.0.0.dev113__py3-none-any.whl → 0.0.0.dev115__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
omlish/__about__.py CHANGED
@@ -1,5 +1,5 @@
1
- __version__ = '0.0.0.dev113'
2
- __revision__ = 'eafea7b4602b808e2955b7dbea769403091c6548'
1
+ __version__ = '0.0.0.dev115'
2
+ __revision__ = '9d4ad28e59d50cd44f6cb07f119785f8d967c977'
3
3
 
4
4
 
5
5
  #
omlish/diag/pydevd.py CHANGED
@@ -130,6 +130,24 @@ def is_running() -> bool:
130
130
  return get_setup() is not None
131
131
 
132
132
 
133
+ #
134
+
135
+
136
+ @lang.cached_function
137
+ def _pydevd_constants() -> types.ModuleType | None:
138
+ try:
139
+ return __import__('_pydevd_bundle.pydevd_constants').pydevd_constants
140
+ except ImportError:
141
+ return None
142
+
143
+
144
+ def get_global_debugger() -> ta.Any | None:
145
+ if (pc := _pydevd_constants()) is None:
146
+ return None
147
+
148
+ return pc.get_global_debugger()
149
+
150
+
133
151
  ##
134
152
 
135
153
 
omlish/docker/__init__.py CHANGED
@@ -17,7 +17,6 @@ from .helpers import ( # noqa
17
17
  DOCKER_FOR_MAC_HOSTNAME,
18
18
  DOCKER_HOST_PLATFORM_KEY,
19
19
  get_docker_host_platform,
20
- is_likely_in_docker,
21
20
  timebomb_payload,
22
21
  )
23
22
 
@@ -27,3 +26,11 @@ from .hub import ( # noqa
27
26
  select_latest_tag,
28
27
  split_tag_suffix,
29
28
  )
29
+
30
+
31
+ ##
32
+
33
+
34
+ from ..lite.docker import ( # noqa
35
+ is_likely_in_docker,
36
+ )
omlish/docker/helpers.py CHANGED
@@ -1,7 +1,5 @@
1
1
  import os
2
- import re
3
2
  import shlex
4
- import sys
5
3
 
6
4
 
7
5
  ##
@@ -26,17 +24,6 @@ def timebomb_payload(delay_s: float, name: str = _DEFAULT_TIMEBOMB_NAME) -> str:
26
24
  DOCKER_FOR_MAC_HOSTNAME = 'docker.for.mac.localhost'
27
25
 
28
26
 
29
- _LIKELY_IN_DOCKER_PATTERN = re.compile(r'^overlay / .*/(docker|desktop-containerd)/')
30
-
31
-
32
- def is_likely_in_docker() -> bool:
33
- if getattr(sys, 'platform') != 'linux':
34
- return False
35
- with open('/proc/mounts') as f:
36
- ls = f.readlines()
37
- return any(_LIKELY_IN_DOCKER_PATTERN.match(l) for l in ls)
38
-
39
-
40
27
  ##
41
28
 
42
29
 
omlish/lite/docker.py ADDED
@@ -0,0 +1,13 @@
1
+ import re
2
+ import sys
3
+
4
+
5
+ _LIKELY_IN_DOCKER_PATTERN = re.compile(r'^overlay / .*/(docker|desktop-containerd)/')
6
+
7
+
8
+ def is_likely_in_docker() -> bool:
9
+ if getattr(sys, 'platform') != 'linux':
10
+ return False
11
+ with open('/proc/mounts') as f:
12
+ ls = f.readlines()
13
+ return any(_LIKELY_IN_DOCKER_PATTERN.match(l) for l in ls)
@@ -1,6 +1,7 @@
1
1
  import inspect
2
2
  import json
3
3
  import math
4
+ import re
4
5
 
5
6
  from . import exceptions
6
7
 
@@ -84,7 +85,6 @@ class Functions(metaclass=FunctionRegistry):
84
85
  return function(self, *resolved_args)
85
86
 
86
87
  def _validate_arguments(self, args, signature, function_name):
87
-
88
88
  if len(signature) == 0:
89
89
  return self._type_check(args, signature, function_name)
90
90
 
@@ -242,9 +242,9 @@ class Functions(metaclass=FunctionRegistry):
242
242
  except ValueError:
243
243
  return None
244
244
 
245
- @signature({'types': ['array', 'string']}, {'types': []})
246
- def _func_contains(self, subject, search):
247
- return search in subject
245
+ @signature({'types': ['array', 'string']}, {'types': [], 'variadic': True})
246
+ def _func_contains(self, subject, *searches):
247
+ return any(search in subject for search in searches)
248
248
 
249
249
  @signature({'types': ['string', 'array', 'object']})
250
250
  def _func_length(self, arg):
@@ -592,3 +592,13 @@ class Functions(metaclass=FunctionRegistry):
592
592
 
593
593
  def _convert_to_jmespath_type(self, pyobject):
594
594
  return TYPES_MAP.get(pyobject, 'unknown')
595
+
596
+ #
597
+
598
+ @signature({'types': ['string']}, {'types': ['string']})
599
+ def _func_match(self, string, pattern):
600
+ return re.match(pattern, string) is not None
601
+
602
+ @signature({'types': ['array', 'string']}, {'types': [], 'variadic': True})
603
+ def _func_in(self, subject, *searches):
604
+ return subject in searches
@@ -5,8 +5,20 @@ from ._registry import register
5
5
  @register
6
6
  class PydevdPlugin:
7
7
 
8
+ def pytest_addoption(self, parser):
9
+ parser.addoption('--no-pydevd', action='store_true', default=False, help='Disables pydevd debugging')
10
+
8
11
  def pytest_collection(self, session):
9
- setup = opd.get_setup()
10
- if setup is not None:
12
+ if opd.get_setup() is not None:
11
13
  if hasattr(session.config, '_env_timeout'):
12
14
  session.config._env_timeout = None # noqa
15
+
16
+ # if (dbg := opd.get_global_debugger()) is not None:
17
+ # dbg.set_unit_tests_debugging_mode()
18
+
19
+ def pytest_exception_interact(self, node, call, report):
20
+ if opd.get_setup() is not None:
21
+ if not node.session.config.option.no_pydevd:
22
+ opd.debug_unhandled_exception(call.excinfo._excinfo) # noqa
23
+
24
+ return report
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omlish
3
- Version: 0.0.0.dev113
3
+ Version: 0.0.0.dev115
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=CxGnj-UiRPlZgmgWoovDWrOnqpSEmBy_kqA7cdfSA3w,1431
2
- omlish/__about__.py,sha256=UxymFoEqTP-bPtqBabCzEoJesLLJ54WQjXVoPYATbEc,3352
2
+ omlish/__about__.py,sha256=NV0IFo-PHlUzRvf2cYXtIlRNgpJ9sbUjkHeWtq-Sntk,3352
3
3
  omlish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  omlish/argparse.py,sha256=cqKGAqcxuxv_s62z0gq29L9KAvg_3-_rFvXKjVpRJjo,8126
5
5
  omlish/c3.py,sha256=4vogWgwPb8TbNS2KkZxpoWbwjj7MuHG2lQG-hdtkvjI,8062
@@ -156,7 +156,7 @@ omlish/diag/procfs.py,sha256=vBovaMvAUKdl7FbtFq3TNsSmdhs8DaYfhoEsKeWYta8,9704
156
156
  omlish/diag/procstats.py,sha256=UkqxREqfd-38xPYZ9T1SIJISz5ARQCEhTtOZrxtm2dE,777
157
157
  omlish/diag/ps.py,sha256=1JWxZen3fVG-20R6ZZ8BtO_gpzw_5bhHZiKdoHkgxoU,1004
158
158
  omlish/diag/pycharm.py,sha256=7-r_F-whXt8v-0dehxAX-MeMFPM3iZXX9IfeL0GfUtk,4643
159
- omlish/diag/pydevd.py,sha256=z9cy0fdmGkQf2fYKmOdAt6oPMBNMKXbz0XxK6capldI,7178
159
+ omlish/diag/pydevd.py,sha256=UN55ZjkWLCVyHxE2CNRRYamuvSKfzWsn0D5oczRTXO4,7536
160
160
  omlish/diag/threads.py,sha256=1-x02VCDZ407gfbtXm1pWK-ubqhqfePm9PMqkHCVoqk,3642
161
161
  omlish/diag/_pycharm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  omlish/diag/_pycharm/runhack.py,sha256=eJlaUXIcFzAjOop_793RwNS_KF9NmhLv0i22xRVVeo0,34951
@@ -170,10 +170,10 @@ omlish/dispatch/_dispatch3.py,sha256=Vnu5DfoPWFJLodudBqoZBXGTi2wYk-Az56MXJgdQvwc
170
170
  omlish/dispatch/dispatch.py,sha256=8XQiLVoAq4u2oO0DnDSXQB9Q5qDk569l4CIFBqwDSyc,3847
171
171
  omlish/dispatch/functions.py,sha256=S8ElsLi6DKxTdtFGigWaF0vAquwy2sK-3f4iRLaYq70,1522
172
172
  omlish/dispatch/methods.py,sha256=XHjwwC9Gn4iDWxbyLAcbdSwRgVaq-8Bnn5cAwf5oZdA,5403
173
- omlish/docker/__init__.py,sha256=dmda-4zBo0UM_CMws_1MOwtyObdF79LB0HF5IT3sDVk,482
173
+ omlish/docker/__init__.py,sha256=NYVbZRHpvRx0HYKjn5dZ5XeFDYa9zRKg6zqPGw6IvWs,527
174
174
  omlish/docker/cli.py,sha256=gtb9kitVfGnd4cr587NsVVk8D5Ok5y5SAsqD_SwGrSA,2565
175
175
  omlish/docker/compose.py,sha256=4drmnGQzbkOFJ9B6XSg9rnXkJeZz1ETmdcMe1PE790U,1237
176
- omlish/docker/helpers.py,sha256=4gd82lpFh5bQFmKOkxgVU-QyuDcGR4341qW75UcFiX0,949
176
+ omlish/docker/helpers.py,sha256=9uyHpPVbsB2jqTzvU7jiLzTkDN1omqofse1w4B4GH5E,612
177
177
  omlish/docker/hub.py,sha256=7LIuJGdA-N1Y1dmo50ynKM1KUTcnQM_5XbtPbdT_QLU,3940
178
178
  omlish/docker/manifests.py,sha256=LR4FpOGNUT3bZQ-gTjB6r_-1C3YiG30QvevZjrsVUQM,7068
179
179
  omlish/formats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -299,6 +299,7 @@ omlish/lite/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
299
299
  omlish/lite/cached.py,sha256=2Yuoi1edt2nnq3RxF3xDS40RZABmHrnommwv8iGEYQE,690
300
300
  omlish/lite/check.py,sha256=ouJme9tkzWXKymm_xZDK4mngdYSkxDrok6CSegvf-1w,1015
301
301
  omlish/lite/contextmanagers.py,sha256=_n6a9xhn06BD8H6A_SDtcipMrSBpzBqcxI0Ob2juomM,1226
302
+ omlish/lite/docker.py,sha256=3IVZZtIm7-UdB2SwArmN_MosTva1_KifyYp3YWjODbE,337
302
303
  omlish/lite/io.py,sha256=lcpI1cS_Kn90tvYMg8ZWkSlYloS4RFqXCk-rKyclhdg,3148
303
304
  omlish/lite/json.py,sha256=7-02Ny4fq-6YAu5ynvqoijhuYXWpLmfCI19GUeZnb1c,740
304
305
  omlish/lite/logs.py,sha256=vkFkSX0Izb2P-NNMqqNLSec0BzeLOtHoQWgdXwQuDPU,6007
@@ -371,7 +372,7 @@ omlish/specs/jmespath/__main__.py,sha256=wIXm6bs08etNG_GZlN2rBkADPb0rKfL2HSkm8sp
371
372
  omlish/specs/jmespath/ast.py,sha256=Rzx2xbKTCydEQOYF0-mjnNe8vWSpZZ-dkphuqauPCWM,3047
372
373
  omlish/specs/jmespath/cli.py,sha256=3qHhwVC80qT7Z9JVC0nNL5YvfTxkjirnH5LAoBfVwcM,1748
373
374
  omlish/specs/jmespath/exceptions.py,sha256=Co1HiUBPFNwFgZY3FV_ayuZoSgZIAmDcImImxauYNxc,4435
374
- omlish/specs/jmespath/functions.py,sha256=DoHhEE2WW0f-UBWFolqzcELPJ9SrB9oASwqnorRtwbk,19452
375
+ omlish/specs/jmespath/functions.py,sha256=p566qLwgikvq1aydfFwAnONgNiT0o5NEa9-RJHYli2c,19836
375
376
  omlish/specs/jmespath/lexer.py,sha256=DVS5K2YyTLYk0tG1KqSg3YgCh_6V17mOXTcqWMUHkWE,12651
376
377
  omlish/specs/jmespath/parser.py,sha256=331aQYZ3fIzXBOquhN6bBGV8qNcOcnLJw4JqvU1VFNw,23948
377
378
  omlish/specs/jmespath/scope.py,sha256=MufJ-DmNsHGQ91Tck55p0W7Y0MDplMuoGWrhCi9bOws,1411
@@ -454,7 +455,7 @@ omlish/testing/pytest/plugins/asyncs.py,sha256=SV6oKCy50CGkzLGYX-CT4MfWNqsrH8ONE
454
455
  omlish/testing/pytest/plugins/depskip.py,sha256=xithY-OMtjwhv8mcRNkv-WI_PSQtHldQ8H1s60MIXkk,2673
455
456
  omlish/testing/pytest/plugins/logging.py,sha256=1zs6Xe54wiaSjabCviaFXwKkoN97CKm3mA5mEoUeJGs,380
456
457
  omlish/testing/pytest/plugins/managermarks.py,sha256=AP3ty-QB-8O5DkulwUOudBlUOvXMHhBfNyY-0yCmejk,1520
457
- omlish/testing/pytest/plugins/pydevd.py,sha256=u1fxfCgFw4wGKBkMV_H_l9WI8JoUwlRff4iHEr_WYeE,319
458
+ omlish/testing/pytest/plugins/pydevd.py,sha256=1RCkuqD6Zeq-GcfS9vj33_9xZ41NtVx1yu7aKWi9FuA,827
458
459
  omlish/testing/pytest/plugins/repeat.py,sha256=flSQzE9GFOWksVKz-mUGnpxJpv3yRqn1G4K8pW7JHs0,498
459
460
  omlish/testing/pytest/plugins/skips.py,sha256=EoZDg1uWccgbAegmzqI85c7RliycD1e2J4Y7vfDRhwM,1041
460
461
  omlish/testing/pytest/plugins/spacing.py,sha256=JQQhi9q3c523Ro1a_K_9RGAb7HotiO74N8bYX2VESFE,707
@@ -467,9 +468,9 @@ omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,329
467
468
  omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
468
469
  omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
469
470
  omlish/text/random.py,sha256=jNWpqiaKjKyTdMXC-pWAsSC10AAP-cmRRPVhm59ZWLk,194
470
- omlish-0.0.0.dev113.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
471
- omlish-0.0.0.dev113.dist-info/METADATA,sha256=xC9V1ccs4B4hZjho38fd41vMPlTr4W1MFcTA9tYwTEU,4000
472
- omlish-0.0.0.dev113.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
473
- omlish-0.0.0.dev113.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
474
- omlish-0.0.0.dev113.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
475
- omlish-0.0.0.dev113.dist-info/RECORD,,
471
+ omlish-0.0.0.dev115.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
472
+ omlish-0.0.0.dev115.dist-info/METADATA,sha256=1_71TCuVNGY5BzK9UEwEvJT_HvvwJgqWBP4sH41JNQg,4000
473
+ omlish-0.0.0.dev115.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
474
+ omlish-0.0.0.dev115.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
475
+ omlish-0.0.0.dev115.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
476
+ omlish-0.0.0.dev115.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.4.0)
2
+ Generator: setuptools (75.5.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5