omlish 0.0.0.dev108__py3-none-any.whl → 0.0.0.dev110__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.dev108'
2
- __revision__ = 'cbe1cf56c59d1ba006099e53058ecd40aa4a731d'
1
+ __version__ = '0.0.0.dev110'
2
+ __revision__ = '4daea83d7a4a891c1efb9970e80586f3080b71d8'
3
3
 
4
4
 
5
5
  #
omlish/formats/dotenv.py CHANGED
@@ -324,10 +324,13 @@ def _with_warn_for_invalid_lines(mappings: ta.Iterator[Binding]) -> ta.Iterator[
324
324
  yield mapping
325
325
 
326
326
 
327
+ StrMutableMappingT = ta.TypeVar('StrMutableMappingT', bound=ta.MutableMapping[str, str])
328
+
329
+
327
330
  class DotEnv:
328
331
  def __init__(
329
332
  self,
330
- path: StrPath | None,
333
+ path: StrPath | None = None,
331
334
  stream: ta.IO[str] | None = None,
332
335
  verbose: bool = False,
333
336
  encoding: str | None = None,
@@ -373,6 +376,14 @@ class DotEnv:
373
376
 
374
377
  return self._dict
375
378
 
379
+ def apply_to(self, dst: StrMutableMappingT) -> StrMutableMappingT:
380
+ for k, v in self.dict().items():
381
+ if v is not None:
382
+ dst[k] = v
383
+ elif k in dst:
384
+ del dst[k]
385
+ return dst
386
+
376
387
  def parse(self) -> ta.Iterator[tuple[str, str | None]]:
377
388
  with self._get_stream() as stream:
378
389
  for mapping in _with_warn_for_invalid_lines(parse_stream(stream)):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omlish
3
- Version: 0.0.0.dev108
3
+ Version: 0.0.0.dev110
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=hTFp9tvE72BxKloIq1s1SS0LRQlIsvMtO69Sbc47rKg,1704
2
- omlish/__about__.py,sha256=nnMnzzIpQQBYqkBJnDhTgHSf5k4qBFwZmWBnq36lwnk,3352
2
+ omlish/__about__.py,sha256=pk4fQfp4z75ABw9nMJuRv6FNxieuXF1N1YRk5YySri8,3352
3
3
  omlish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  omlish/argparse.py,sha256=Dc73G8lyoQBLvXhMYUbzQUh4SJu_OTvKUXjSUxq_ang,7499
5
5
  omlish/c3.py,sha256=4vogWgwPb8TbNS2KkZxpoWbwjj7MuHG2lQG-hdtkvjI,8062
@@ -179,7 +179,7 @@ omlish/docker/helpers.py,sha256=j2eZIqIUpy34ZmoGyIzsYuKx9HeewwYBfrGNC99EFYk,928
179
179
  omlish/docker/hub.py,sha256=7LIuJGdA-N1Y1dmo50ynKM1KUTcnQM_5XbtPbdT_QLU,3940
180
180
  omlish/docker/manifests.py,sha256=LR4FpOGNUT3bZQ-gTjB6r_-1C3YiG30QvevZjrsVUQM,7068
181
181
  omlish/formats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
182
- omlish/formats/dotenv.py,sha256=UjZl3gac-0U24sDjCCGMcCqO1UCWG2Zs8PZ4JdAg2YE,17348
182
+ omlish/formats/dotenv.py,sha256=orf37G11RM6Z6MxjBWbFAntwT8fi-ptkjN4EWoTeAsA,17689
183
183
  omlish/formats/props.py,sha256=JwFJbKblqzqnzXf7YKFzQSDfcAXzkKsfoYvad6FPy98,18945
184
184
  omlish/formats/xml.py,sha256=ggiOwSERt4d9XmZwLZiDIh5qnFJS4jdmow9m9_9USps,1491
185
185
  omlish/formats/yaml.py,sha256=wTW8ECG9jyA7qIFUqKZUro4KAKpN4IvcW_qhlrKveXM,6836
@@ -469,9 +469,9 @@ omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,329
469
469
  omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
470
470
  omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
471
471
  omlish/text/random.py,sha256=jNWpqiaKjKyTdMXC-pWAsSC10AAP-cmRRPVhm59ZWLk,194
472
- omlish-0.0.0.dev108.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
473
- omlish-0.0.0.dev108.dist-info/METADATA,sha256=YT-AOzWICV5yww_4mweKcISx4dcR21NI6du4Lgambv0,4000
474
- omlish-0.0.0.dev108.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
475
- omlish-0.0.0.dev108.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
476
- omlish-0.0.0.dev108.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
477
- omlish-0.0.0.dev108.dist-info/RECORD,,
472
+ omlish-0.0.0.dev110.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
473
+ omlish-0.0.0.dev110.dist-info/METADATA,sha256=zA3U1k7zDD9PTt4oDEX6_0hPZrnhMgz3r80NDTBlF0U,4000
474
+ omlish-0.0.0.dev110.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
475
+ omlish-0.0.0.dev110.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
476
+ omlish-0.0.0.dev110.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
477
+ omlish-0.0.0.dev110.dist-info/RECORD,,