omlish 0.0.0.dev256__py3-none-any.whl → 0.0.0.dev257__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.
omlish/__about__.py CHANGED
@@ -1,5 +1,5 @@
1
- __version__ = '0.0.0.dev256'
2
- __revision__ = '41ce70ebb24f5066558a05aaf75e9f6b94de11c1'
1
+ __version__ = '0.0.0.dev257'
2
+ __revision__ = '62df4004126a5530d242ba70bd0dfdc429b20ae1'
3
3
 
4
4
 
5
5
  #
@@ -42,10 +42,10 @@ class Future(lang.Abstract, ta.Awaitable[lang.Outcome[T]]):
42
42
  raise NotImplementedError
43
43
 
44
44
  def set_value(self, v: T) -> None:
45
- self.set_outcome(lang.Value(v))
45
+ self.set_outcome(lang.value(v))
46
46
 
47
47
  def set_error(self, e: BaseException) -> None:
48
- self.set_outcome(lang.Error(e))
48
+ self.set_outcome(lang.error(e))
49
49
 
50
50
 
51
51
  ##
omlish/lang/__init__.py CHANGED
@@ -217,6 +217,8 @@ from .outcomes import ( # noqa
217
217
  Value,
218
218
  acapture,
219
219
  capture,
220
+ error,
221
+ value,
220
222
  )
221
223
 
222
224
  from .params import ( # noqa
omlish/lang/outcomes.py CHANGED
@@ -14,11 +14,16 @@
14
14
  # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15
15
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
16
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ """
18
+ TODO:
19
+ - hide Value and Error classes like Maybes
20
+ """
17
21
  import abc
18
22
  import dataclasses as dc
19
23
  import typing as ta
20
24
 
21
25
 
26
+ T = ta.TypeVar('T')
22
27
  ValueT_co = ta.TypeVar('ValueT_co', covariant=True)
23
28
  ResultT = ta.TypeVar('ResultT')
24
29
  ArgsT = ta.ParamSpec('ArgsT')
@@ -227,6 +232,10 @@ class Value(Outcome[ValueT_co], ta.Generic[ValueT_co]):
227
232
  return await agen.asend(self._value)
228
233
 
229
234
 
235
+ def value(v: T) -> Outcome[T]:
236
+ return Value(v)
237
+
238
+
230
239
  #
231
240
 
232
241
 
@@ -286,6 +295,10 @@ class Error(Outcome[ta.NoReturn]):
286
295
  return await agen.athrow(self._error)
287
296
 
288
297
 
298
+ def error(e: BaseException) -> Outcome[T]:
299
+ return Error(e)
300
+
301
+
289
302
  ##
290
303
 
291
304
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: omlish
3
- Version: 0.0.0.dev256
3
+ Version: 0.0.0.dev257
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=x26AIwDzScUvnX-p4xlq6Zc5QYrAo0Vmgf1qHc1KL_M,8253
2
- omlish/__about__.py,sha256=cOMhDxR5wugqDQKvpcilkCXkPARgj9bTuboNWlXD0DE,3380
2
+ omlish/__about__.py,sha256=irtXLzobfvt8KMSteKtCL_pI7wHzOQYda3aaJQXQZB8,3380
3
3
  omlish/__init__.py,sha256=SsyiITTuK0v74XpKV8dqNaCmjOlan1JZKrHQv5rWKPA,253
4
4
  omlish/c3.py,sha256=ubu7lHwss5V4UznbejAI0qXhXahrU01MysuHOZI9C4U,8116
5
5
  omlish/cached.py,sha256=MLap_p0rdGoDIMVhXVHm1tsbcWobJF0OanoodV03Ju8,542
@@ -98,7 +98,7 @@ omlish/asyncs/trio.py,sha256=fmZ5b_lKdVV8NQ3euCUutWgnkqTFzSnOjvJSA_jvmrE,367
98
98
  omlish/asyncs/trio_asyncio.py,sha256=oqdOHy0slj9PjVxaDf3gJkq9AAgg7wYZbB469jOftVw,1327
99
99
  omlish/asyncs/anyio/__init__.py,sha256=sX7bciyRquaPeDAz16phkg_Lnw_AbJgUkayy5Aw8o2M,1695
100
100
  omlish/asyncs/anyio/backends.py,sha256=jJIymWoiedaEJJm82gvKiJ41EWLQZ-bcyNHpbDpKKi4,1584
101
- omlish/asyncs/anyio/futures.py,sha256=3dmb9DqxSWP2gRtzujqiJcfpbNIVhyEv5KBRInRs388,2052
101
+ omlish/asyncs/anyio/futures.py,sha256=Nm1gLerZEnHk-rlsmr0UfK168IWIK6zA8EebZFtoY_E,2052
102
102
  omlish/asyncs/anyio/signals.py,sha256=ySSut5prdnoy0-5Ws5V1M4cC2ON_vY550vU10d2NHk8,893
103
103
  omlish/asyncs/anyio/streams.py,sha256=gNRAcHR0L8OtNioqKFbq0Z_apYAWKHFipZ2MUBp8Vg0,2228
104
104
  omlish/asyncs/anyio/sync.py,sha256=maggE0mH-TxmefX3vfa27DuDEaE5-yQKn84Mj3mOSVU,1569
@@ -406,7 +406,7 @@ omlish/iterators/iterators.py,sha256=iTQQwBE6Wzoy36dnbPIws17zbjE3zNN4KwVw4Fzh-gY
406
406
  omlish/iterators/recipes.py,sha256=53mkexitMhkwXQZbL6DrhpT0WePQ_56uXd5Jaw3DfzI,467
407
407
  omlish/iterators/tools.py,sha256=Pi4ybXytUXVZ3xwK89xpPImQfYYId9p1vIFQvVqVLqA,2551
408
408
  omlish/iterators/unique.py,sha256=0jAX3kwzVfRNhe0Tmh7kVP_Q2WBIn8POo_O-rgFV0rQ,1390
409
- omlish/lang/__init__.py,sha256=oscoxTO7_oMaTcLxOX_NvHfWsfmQ28G6UcWeqXR0d90,5035
409
+ omlish/lang/__init__.py,sha256=ovWbqkbQJNefmYR3VR_NwsRyEOguh62Rw6bimwcTaRI,5057
410
410
  omlish/lang/attrs.py,sha256=fofCKN0X8TMu1yGqHpLpNLih9r9HWl3D3Vn3b6O791w,3891
411
411
  omlish/lang/clsdct.py,sha256=sJYadm-fwzti-gsi98knR5qQUxriBmOqQE_qz3RopNk,1743
412
412
  omlish/lang/cmp.py,sha256=5vbzWWbqdzDmNKAGL19z6ZfUKe5Ci49e-Oegf9f4BsE,1346
@@ -421,7 +421,7 @@ omlish/lang/imports.py,sha256=Gdl6xCF89xiMOE1yDmdvKWamLq8HX-XPianO58Jdpmw,9218
421
421
  omlish/lang/iterables.py,sha256=HOjcxOwyI5bBApDLsxRAGGhTTmw7fdZl2kEckxRVl-0,1994
422
422
  omlish/lang/maybes.py,sha256=dAgrUoAhCgyrHRqa73CkaGnpXwGc-o9n-NIThrNXnbU,3416
423
423
  omlish/lang/objects.py,sha256=ih3z47DysrW11Vf3vF8rdALsnhK19Afp6wTU8AHAPWM,4982
424
- omlish/lang/outcomes.py,sha256=yuNstlFj36gN9s_wcigcSXn7F08a2XTmwmNMgzGeMjM,8432
424
+ omlish/lang/outcomes.py,sha256=mpFy_VoM-b74L1aCFsjsZVUHx_icZ1AHMOKeVesjOp4,8628
425
425
  omlish/lang/params.py,sha256=QmNVBfJsfxjDG5ilDPgHV7sK4UwRztkSQdLTo0umb8I,6648
426
426
  omlish/lang/resolving.py,sha256=OuN2mDTPNyBUbcrswtvFKtj4xgH4H4WglgqSKv3MTy0,1606
427
427
  omlish/lang/resources.py,sha256=WKkAddC3ctMK1bvGw-elGe8ZxAj2IaUTKVSu2nfgHTo,2839
@@ -764,9 +764,9 @@ omlish/text/parts.py,sha256=Q9NvoyEGQKIWgiPD4D_Qc66cWAuyEKE033dT9m7c3Wk,6662
764
764
  omlish/text/random.py,sha256=jNWpqiaKjKyTdMXC-pWAsSC10AAP-cmRRPVhm59ZWLk,194
765
765
  omlish/text/go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
766
766
  omlish/text/go/quoting.py,sha256=N9EYdnFdEX_A8fOviH-1w4jwV3XOQ7VU2WsoUNubYVY,9137
767
- omlish-0.0.0.dev256.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
768
- omlish-0.0.0.dev256.dist-info/METADATA,sha256=zL7YX2rpkMFfh9x-gH60SU4EE1a0EuKuaT4Nn97JIjA,4176
769
- omlish-0.0.0.dev256.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
770
- omlish-0.0.0.dev256.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
771
- omlish-0.0.0.dev256.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
772
- omlish-0.0.0.dev256.dist-info/RECORD,,
767
+ omlish-0.0.0.dev257.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
768
+ omlish-0.0.0.dev257.dist-info/METADATA,sha256=SCBiML7sTPFB9bgHA3gYkm7D8wlrNpOjJZQFCf_s_Zk,4176
769
+ omlish-0.0.0.dev257.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
770
+ omlish-0.0.0.dev257.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
771
+ omlish-0.0.0.dev257.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
772
+ omlish-0.0.0.dev257.dist-info/RECORD,,