omlish 0.0.0.dev315__py3-none-any.whl → 0.0.0.dev317__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 +2 -2
- omlish/collections/utils.py +99 -5
- omlish/formats/json/encoding.py +3 -0
- omlish/formats/json/literals.py +90 -4
- omlish/formats/json/rendering.py +4 -2
- omlish/formats/json5/rendering.py +44 -0
- omlish/http/coro/server.py +1 -2
- omlish/lang/__init__.py +7 -7
- omlish/lang/cached/function.py +66 -9
- omlish/lang/generators.py +3 -5
- omlish/lang/params.py +7 -9
- omlish/lite/maybes.py +163 -17
- omlish/logs/callers.py +3 -0
- omlish/logs/color.py +3 -0
- omlish/logs/filters.py +8 -1
- omlish/logs/handlers.py +3 -0
- omlish/logs/json.py +3 -0
- omlish/logs/noisy.py +3 -0
- omlish/logs/proxy.py +3 -0
- omlish/logs/utils.py +3 -0
- omlish/sockets/ports.py +24 -7
- omlish/testing/pytest/plugins/switches.py +103 -44
- {omlish-0.0.0.dev315.dist-info → omlish-0.0.0.dev317.dist-info}/METADATA +1 -1
- {omlish-0.0.0.dev315.dist-info → omlish-0.0.0.dev317.dist-info}/RECORD +28 -28
- {omlish-0.0.0.dev315.dist-info → omlish-0.0.0.dev317.dist-info}/WHEEL +1 -1
- omlish/lang/maybes.py +0 -157
- {omlish-0.0.0.dev315.dist-info → omlish-0.0.0.dev317.dist-info}/entry_points.txt +0 -0
- {omlish-0.0.0.dev315.dist-info → omlish-0.0.0.dev317.dist-info}/licenses/LICENSE +0 -0
- {omlish-0.0.0.dev315.dist-info → omlish-0.0.0.dev317.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
omlish/.manifests.json,sha256=orgsRvtpHu8tdhaCvlP9v3P495OJopYYiHKjK68WtWg,8587
|
2
|
-
omlish/__about__.py,sha256=
|
2
|
+
omlish/__about__.py,sha256=XvJduE7LyT8sT8wf4Tcj6mGwYJh0_bub6Rmk7aliJpA,3478
|
3
3
|
omlish/__init__.py,sha256=SsyiITTuK0v74XpKV8dqNaCmjOlan1JZKrHQv5rWKPA,253
|
4
4
|
omlish/c3.py,sha256=rer-TPOFDU6fYq_AWio_AmA-ckZ8JDY5shIzQ_yXfzA,8414
|
5
5
|
omlish/cached.py,sha256=MLap_p0rdGoDIMVhXVHm1tsbcWobJF0OanoodV03Ju8,542
|
@@ -87,7 +87,7 @@ omlish/collections/mappings.py,sha256=iXb7oq1rCQak0KgzblgrzWCJLrkfJAYHFvl9lprOVU
|
|
87
87
|
omlish/collections/ordered.py,sha256=7zTbrAt12rf6i33XHkQERKar258fJacaw_WbtGEBgWo,2338
|
88
88
|
omlish/collections/ranked.py,sha256=McB8C2UQfUvrbmxGTpBz1-EZuyCLkBFtktzncMdt8_Y,2287
|
89
89
|
omlish/collections/unmodifiable.py,sha256=X7kKhPFdZF4m28SfLDxZL-riWlhbZffdPv35aTP30YM,4753
|
90
|
-
omlish/collections/utils.py,sha256=
|
90
|
+
omlish/collections/utils.py,sha256=1LED_KLXsEb39Byhql7BD5ObHoSkFn2OyUdnHsKXKNo,4091
|
91
91
|
omlish/collections/cache/__init__.py,sha256=D1gO71VcwxFTZP9gAc9isHfg_TEdalwhsJcgGLvS9hg,233
|
92
92
|
omlish/collections/cache/descriptor.py,sha256=F9aRsF-xOUcNMzTwIWrUpKTjop1Z-oItQqJDwVaR0FU,5026
|
93
93
|
omlish/collections/cache/impl.py,sha256=Y18OcAsNL6dIWuk89UlZBpqq0iBU-P4VDio6eis43Us,14760
|
@@ -262,10 +262,10 @@ omlish/formats/ini/sections.py,sha256=7wYyZdVTQbMPFpjQEACKJfAEPzUBrogINsrvFgxJoZ
|
|
262
262
|
omlish/formats/json/__init__.py,sha256=HXFv4VDTBhx0k5U4JYWZqxziBwzJoPX51QK3xIboT8U,786
|
263
263
|
omlish/formats/json/codecs.py,sha256=E5KErfqsgGZq763ixXLT3qysbk5MIsypT92xG5aSaIs,796
|
264
264
|
omlish/formats/json/consts.py,sha256=A0cTAGGLyjo-gcYIQrL4JIaardI0yPMhQoNmh42BaRg,387
|
265
|
-
omlish/formats/json/encoding.py,sha256=
|
265
|
+
omlish/formats/json/encoding.py,sha256=iwoYyJePibgvRDZ6e9b2OlXmOBJEczquRNoiffVf3hE,502
|
266
266
|
omlish/formats/json/json.py,sha256=Mdqv2vdMi7gp96eV0BIYH5UdWpjWfsh-tSMZeywG-08,331
|
267
|
-
omlish/formats/json/literals.py,sha256=
|
268
|
-
omlish/formats/json/rendering.py,sha256=
|
267
|
+
omlish/formats/json/literals.py,sha256=MMou9UIoztL9EyX2Zhv3Kzfq8eaKMfGNCFhL16n-fTk,7532
|
268
|
+
omlish/formats/json/rendering.py,sha256=0S_ppr5ihkUW7PP0mipZXHr72otqwUCNfanwopcboag,4571
|
269
269
|
omlish/formats/json/types.py,sha256=ueO9-uOU2eVWowJf0LH1fHFLjZ6fTIZyq9qybcLQaiQ,147
|
270
270
|
omlish/formats/json/backends/__init__.py,sha256=gnaNDCxy_KmmPUPDnjxO5_WjuWxLGbI9FYWx8ZJuQUU,97
|
271
271
|
omlish/formats/json/backends/base.py,sha256=WqtyoM82pyM0NyqpPwndrebr1bUVU1QlpmVQNrcAO8c,1114
|
@@ -287,6 +287,7 @@ omlish/formats/json5/codec.py,sha256=ldnxCRo0JP1fkGLt0mMxJlLvNxqIF_1KUCcSp1HtI-M
|
|
287
287
|
omlish/formats/json5/errors.py,sha256=AHkR9ySjAoQdUrizpqgL8fg0M5oe5mHZkml3KZHEvC4,38
|
288
288
|
omlish/formats/json5/literals.py,sha256=rj4-9KFXfgdq5oK_eUkp57cgoMQ8T0gRaG9ga430he4,2429
|
289
289
|
omlish/formats/json5/parsing.py,sha256=CWJHfe_FXCQuyDk00a7PI5wOdROq7Tc3fbWrNuwaKCw,2346
|
290
|
+
omlish/formats/json5/rendering.py,sha256=Kf-yA4AB3BqyjellBOFTGrMxxpIUsmgHIFzVRSJkQnE,1112
|
290
291
|
omlish/formats/json5/_antlr/Json5Lexer.py,sha256=LnURBD0tL35VHNpxqM4DOPrTkE_9oONHtbftRM26tak,23239
|
291
292
|
omlish/formats/json5/_antlr/Json5Listener.py,sha256=37Jhzu7tQEw6gLIxtcZtV5Yjn08kS-GkxF7d0KjXyo8,2097
|
292
293
|
omlish/formats/json5/_antlr/Json5Parser.py,sha256=YU9bP89nq97A8ZCrjIcbgoBg4z76-N-6IMFGQe_ws54,19679
|
@@ -335,7 +336,7 @@ omlish/http/clients/httpx.py,sha256=Grl9_sG7QNIZj8HqaU7XduAsBDyfXl36RjbYQzQqal0,
|
|
335
336
|
omlish/http/clients/urllib.py,sha256=DVKFPLQzANiZmwnlbFw5pWs5ZPLLvvgCb3UInvCSqPE,2701
|
336
337
|
omlish/http/coro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
337
338
|
omlish/http/coro/fdio.py,sha256=bd9K4EYVWbXV3e3npDPXI9DuDAruJiyDmrgFpgNcjzY,4035
|
338
|
-
omlish/http/coro/server.py,sha256=
|
339
|
+
omlish/http/coro/server.py,sha256=r8qfVLn-wdB_GI0n41NjhHg72JU5K8-JZgU-KhuVoDs,18259
|
339
340
|
omlish/http/coro/simple.py,sha256=inWA_ss6Nz5Rqmy4dL9_SGah4anYoDecDTRQqVIGYeY,3200
|
340
341
|
omlish/http/coro/sockets.py,sha256=rtpZZ-XCOfC5tXr4Fmo1HSn-8f5nxfIOlJaPUkQeDyU,1654
|
341
342
|
omlish/inject/__init__.py,sha256=pY-A8Q4v08-Xa4a-XdZ3lSFC3OwCO2T9HhesB67Q4tQ,1895
|
@@ -402,7 +403,7 @@ omlish/iterators/iterators.py,sha256=RxW35yQ5ed8vBQ22IqpDXFx-i5JiLQdp7-pkMZXhJJ8
|
|
402
403
|
omlish/iterators/recipes.py,sha256=wOwOZg-zWG9Zc3wcAxJFSe2rtavVBYwZOfG09qYEx_4,472
|
403
404
|
omlish/iterators/tools.py,sha256=c4hArZEVV8y9_dFfmRwakusv1cWJLT4MkTkGRjnGN5U,2556
|
404
405
|
omlish/iterators/unique.py,sha256=Nw0pSaNEcHAkve0ugfLPvJcirDOn9ECyC5wIL8JlJKI,1395
|
405
|
-
omlish/lang/__init__.py,sha256=
|
406
|
+
omlish/lang/__init__.py,sha256=Zs5YE5F7rq2cdEqK2e6QuamTQGGwLaM0OP_RNOmcT1A,5921
|
406
407
|
omlish/lang/attrs.py,sha256=i7euRF81uNF8QDmUVXSK_BtqLGshaMi4VVdUnMjiMwg,5050
|
407
408
|
omlish/lang/casing.py,sha256=cFUlbDdXLhwnWwcYx4qnM5c4zGX7hIRUfcjiZbxUD28,4636
|
408
409
|
omlish/lang/clsdct.py,sha256=HAGIvBSbCefzRjXriwYSBLO7QHKRv2UsE78jixOb-fA,1828
|
@@ -413,13 +414,12 @@ omlish/lang/datetimes.py,sha256=mrTtA67JYpfQwSlzdPcBtvm6dAyYM_dXNnlxFwFQH0M,228
|
|
413
414
|
omlish/lang/descriptors.py,sha256=zBtgO9LjdSTGHNUgiIqswh78WOVoGH6KzS0NbgB1Wls,6572
|
414
415
|
omlish/lang/enums.py,sha256=F9tflHfaAoV2MpyuhZzpfX9-H55M3zNa9hCszsngEo8,111
|
415
416
|
omlish/lang/functions.py,sha256=75JhKRNhe2iDeqN7yCdLTw_q5k1VFpdphypqb4yy2I0,6298
|
416
|
-
omlish/lang/generators.py,sha256=
|
417
|
+
omlish/lang/generators.py,sha256=a4D5HU_mySs2T2z3xCmE_s3t4QJkj0YRrK4-hhpGd0A,5197
|
417
418
|
omlish/lang/imports.py,sha256=y9W9Y-d_cQ35QCLuSIPoa6vnEqSErFCz8b-34IH128U,10552
|
418
419
|
omlish/lang/iterables.py,sha256=StoGp9yaP3njdLKHoWYcEevO3eE8SHEPYl5_avZob24,2149
|
419
|
-
omlish/lang/maybes.py,sha256=pb1YrxmpXy-hWKmWR89GxXqZq1MoUD1uuTaTX30peh0,3697
|
420
420
|
omlish/lang/objects.py,sha256=nbxBHfQHVw0OG4qeSTP2GvIiFIcH2tbbitY8y-mYPPo,5959
|
421
421
|
omlish/lang/outcomes.py,sha256=mpFy_VoM-b74L1aCFsjsZVUHx_icZ1AHMOKeVesjOp4,8628
|
422
|
-
omlish/lang/params.py,sha256=
|
422
|
+
omlish/lang/params.py,sha256=sfbNoGrKCsAtubFufj_uh_WKshIgA8fqJ4PmLH1PH00,6639
|
423
423
|
omlish/lang/recursion.py,sha256=1VfSqzKO-8Is3t9LKw0W4jwPfE0aBS70EUlbUxAx4eE,1900
|
424
424
|
omlish/lang/resolving.py,sha256=ei9LDyJexsMMHB9z8diUkNmynWhd_da7h7TqrMYM6lA,1611
|
425
425
|
omlish/lang/resources.py,sha256=WKkAddC3ctMK1bvGw-elGe8ZxAj2IaUTKVSu2nfgHTo,2839
|
@@ -427,7 +427,7 @@ omlish/lang/strings.py,sha256=kJmRFd1D36xXcjd9MdB12BCwF_-MVhNr-TpWj7hMi_4,4252
|
|
427
427
|
omlish/lang/sys.py,sha256=b4qOPiJZQru_mbb04FNfOjYWUxlV2becZOoc-yya_rQ,411
|
428
428
|
omlish/lang/typing.py,sha256=Zdad9Zv0sa-hIaUXPrzPidT7sDVpRcussAI7D-j-I1c,3296
|
429
429
|
omlish/lang/cached/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
430
|
-
omlish/lang/cached/function.py,sha256=
|
430
|
+
omlish/lang/cached/function.py,sha256=tch6VlDljfUUFMP61RY0LYXYyNwj1Sy8CAQQQMHCypA,11344
|
431
431
|
omlish/lang/cached/property.py,sha256=WHYyg4-6EA86TcNMfbXTjVhjEZPc0kngt9hfY3WN5w8,2768
|
432
432
|
omlish/lang/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
433
433
|
omlish/lang/classes/abstract.py,sha256=n4rDlDraUKxPF0GtOWEFZ6mEzEDmP7Z8LSI6Jww_thw,3715
|
@@ -453,7 +453,7 @@ omlish/lite/inject.py,sha256=-tTsOqqef-Ix5Tgl2DP_JAsNWJQDFUptERl3lk14Uzs,29007
|
|
453
453
|
omlish/lite/json.py,sha256=7-02Ny4fq-6YAu5ynvqoijhuYXWpLmfCI19GUeZnb1c,740
|
454
454
|
omlish/lite/logs.py,sha256=CWFG0NKGhqNeEgryF5atN2gkPYbUdTINEw_s1phbINM,51
|
455
455
|
omlish/lite/marshal.py,sha256=4DCbLoimLwJakihpvMjJ_kpc7v9aZQY8P3-gkoqEGUE,18471
|
456
|
-
omlish/lite/maybes.py,sha256=
|
456
|
+
omlish/lite/maybes.py,sha256=hAIzp2pmPccnULwKiA8vaxiTJj6av3dvrqhhDfMLte0,4353
|
457
457
|
omlish/lite/pycharm.py,sha256=pUOJevrPClSqTCEOkQBO11LKX2003tfDcp18a03QFrc,1163
|
458
458
|
omlish/lite/reflect.py,sha256=pzOY2PPuHH0omdtglkN6DheXDrGopdL3PtTJnejyLFU,2189
|
459
459
|
omlish/lite/reprs.py,sha256=QI5VBtvq_TW1TojWL25c04QfOABLi8Smt5jc5J-bArc,2008
|
@@ -468,18 +468,18 @@ omlish/lite/typing.py,sha256=U3-JaEnkDSYxK4tsu_MzUn3RP6qALBe5FXQXpD-licE,1090
|
|
468
468
|
omlish/logs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
469
469
|
omlish/logs/abc.py,sha256=ho4ABKYMKX-V7g4sp1BByuOLzslYzLlQ0MESmjEpT-o,8005
|
470
470
|
omlish/logs/all.py,sha256=Er2NIcDvlMpuAcRr9b_uMHeoERU7I6lu5oLrDGRdV0U,728
|
471
|
-
omlish/logs/callers.py,sha256=
|
472
|
-
omlish/logs/color.py,sha256=
|
471
|
+
omlish/logs/callers.py,sha256=aCAT-B161IB211x5CGMYGbzzrNut7xWGYJ_E1rZpan0,1148
|
472
|
+
omlish/logs/color.py,sha256=u1-6ulsxTWMPyeKu-pCQyF5_ljuEeuG4FG7i6DTzHe0,670
|
473
473
|
omlish/logs/configs.py,sha256=XOc8rWxfPpPMxJESVD2mLCUoLtbQnGnZwvYhhqe7DD8,772
|
474
|
-
omlish/logs/filters.py,sha256=
|
475
|
-
omlish/logs/handlers.py,sha256=
|
476
|
-
omlish/logs/json.py,sha256=
|
477
|
-
omlish/logs/noisy.py,sha256=
|
474
|
+
omlish/logs/filters.py,sha256=rNmRtoAktUT-CG__hgqW-8aSdR9ocby4pUmP1wKf4Vk,370
|
475
|
+
omlish/logs/handlers.py,sha256=wymFmRO8fcBePyfir9U4FIHzWuyW0D_HwEQAiIQLwAk,324
|
476
|
+
omlish/logs/json.py,sha256=muekHkKmGIqq_wr-tV94WwXjNFtUBbFeRdni-JhrCkA,1371
|
477
|
+
omlish/logs/noisy.py,sha256=hWpbseerZqlHdEPEajDTSmcRhx8LmmNAxz_7GBZAO9s,353
|
478
478
|
omlish/logs/protocol.py,sha256=dfAR0_5kLEAkx0nhuWBhWMTVjWjhEl2uL-MxejrW1lk,4732
|
479
|
-
omlish/logs/proxy.py,sha256=
|
479
|
+
omlish/logs/proxy.py,sha256=hypbn_x-lGJChP6iHPN3ZkyEA9rw1tbAnGd4aAuc0fk,2352
|
480
480
|
omlish/logs/standard.py,sha256=FbKdF2Z4Na5i2TNwKn0avLJXyICe2JKsPufjvKCHGn0,3162
|
481
481
|
omlish/logs/timing.py,sha256=XrFUHIPT4EHDujLKbGs9fGFMmoM3NEP8xPRaESJr7bQ,1513
|
482
|
-
omlish/logs/utils.py,sha256=
|
482
|
+
omlish/logs/utils.py,sha256=OkFWf1exmWImmT7BaSiIC7c0Fk9tAis-PRqo8H4ny3c,398
|
483
483
|
omlish/manifests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
484
484
|
omlish/manifests/base.py,sha256=D1WvJYcBR_njkc0gpALpFCWh1h3agb9qgqphnbbPlm4,935
|
485
485
|
omlish/manifests/load.py,sha256=9mdsS3egmSX9pymO-m-y2Fhs4p6ruOdbsYaKT1-1Hwg,6655
|
@@ -581,7 +581,7 @@ omlish/sockets/addresses.py,sha256=vbVeQBkzI513H4vRv-JS89QtRbr9U8v5zqkm3oODl_s,1
|
|
581
581
|
omlish/sockets/bind.py,sha256=J1SfFFFnVf3H5nqESDX2NGEY8DmjyIMUXZciZM33zQY,8003
|
582
582
|
omlish/sockets/handlers.py,sha256=Gj6xZoo4vommge8XvkehYw3B7O4aql2P4qzZIIa0p24,462
|
583
583
|
omlish/sockets/io.py,sha256=lfhTkB7NnAIx9kuQhAkwgsEUXY78Mp1_WtYrIQNS_k8,1408
|
584
|
-
omlish/sockets/ports.py,sha256=
|
584
|
+
omlish/sockets/ports.py,sha256=6sp1jVTYuhuAGQ9NB12sFklPkygLhhrNMO9Wa9PcFeU,1772
|
585
585
|
omlish/sockets/wait.py,sha256=OtLbcoLYzksl4GU0TNbQpzzVWGxp2iRLgo2cGZZfFFM,1559
|
586
586
|
omlish/sockets/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
587
587
|
omlish/sockets/server/handlers.py,sha256=PPsb1X5oU9dN8jfztaMGsRiqWTyEANT-1aSLbS6bUVg,3867
|
@@ -749,7 +749,7 @@ omlish/testing/pytest/plugins/pydevd.py,sha256=5moE64LrNRV6gKRaeCuONDiwuh-4UFxJP
|
|
749
749
|
omlish/testing/pytest/plugins/repeat.py,sha256=jiZCI-17042jBvUEbZCxNwqWtr7s3EhTBSeSHh_Uz4E,497
|
750
750
|
omlish/testing/pytest/plugins/skips.py,sha256=eMir_n777Kk2BvOwjQzRROKL4iAMYKSHFwWCHJ-bdPI,1040
|
751
751
|
omlish/testing/pytest/plugins/spacing.py,sha256=tzq-L-exegHe2BImumkYIsVcUwpUUhLJJOuSrsKDuCU,706
|
752
|
-
omlish/testing/pytest/plugins/switches.py,sha256=
|
752
|
+
omlish/testing/pytest/plugins/switches.py,sha256=azw-pqSQfZYs7YlKsPK1bzerg20pX55YXejZgIxJu9U,5166
|
753
753
|
omlish/testing/pytest/plugins/utils.py,sha256=L5C622UXcA_AUKDcvyh5IMiRfqSGGz0McdhwZWvfMlU,261
|
754
754
|
omlish/testing/pytest/plugins/asyncs/__init__.py,sha256=TTNhFmP_krug1973sq_bpWBTIvg68-1nbuVLSs92Z6k,41
|
755
755
|
omlish/testing/pytest/plugins/asyncs/consts.py,sha256=0NOCkzV43dOu3u97BqYMQ4mPG8JuFncpWibkOZpCqX4,55
|
@@ -853,9 +853,9 @@ omlish/typedvalues/holder.py,sha256=ZTnHiw-K38ciOBLEdwgrltr7Xp8jjEs_0Lp69DH-G-o,
|
|
853
853
|
omlish/typedvalues/marshal.py,sha256=hWHRLcrGav7lvXJDtb9bNI0ickl4SKPQ6F4BbTpqw3A,4219
|
854
854
|
omlish/typedvalues/reflect.py,sha256=Ih1YgU-srUjsvBn_P7C66f73_VCvcwqE3ffeBnZBgt4,674
|
855
855
|
omlish/typedvalues/values.py,sha256=ym46I-q2QJ_6l4UlERqv3yj87R-kp8nCKMRph0xQ3UA,1307
|
856
|
-
omlish-0.0.0.
|
857
|
-
omlish-0.0.0.
|
858
|
-
omlish-0.0.0.
|
859
|
-
omlish-0.0.0.
|
860
|
-
omlish-0.0.0.
|
861
|
-
omlish-0.0.0.
|
856
|
+
omlish-0.0.0.dev317.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
857
|
+
omlish-0.0.0.dev317.dist-info/METADATA,sha256=4Z0c7koet4xBZgji9URV0S85ozghSxQShBteed3cg4s,4416
|
858
|
+
omlish-0.0.0.dev317.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
859
|
+
omlish-0.0.0.dev317.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
|
860
|
+
omlish-0.0.0.dev317.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
|
861
|
+
omlish-0.0.0.dev317.dist-info/RECORD,,
|
omlish/lang/maybes.py
DELETED
@@ -1,157 +0,0 @@
|
|
1
|
-
import abc
|
2
|
-
import typing as ta
|
3
|
-
|
4
|
-
from ..lite.maybes import Maybe as _LiteMaybe
|
5
|
-
from ..lite.maybes import as_maybe as _as_lite_maybe
|
6
|
-
|
7
|
-
|
8
|
-
T = ta.TypeVar('T')
|
9
|
-
U = ta.TypeVar('U')
|
10
|
-
|
11
|
-
|
12
|
-
##
|
13
|
-
|
14
|
-
|
15
|
-
class ValueNotPresentException(BaseException):
|
16
|
-
pass
|
17
|
-
|
18
|
-
|
19
|
-
class Maybe(abc.ABC, ta.Generic[T]):
|
20
|
-
@property
|
21
|
-
@abc.abstractmethod
|
22
|
-
def present(self) -> bool:
|
23
|
-
raise NotImplementedError
|
24
|
-
|
25
|
-
@abc.abstractmethod
|
26
|
-
def must(self) -> T:
|
27
|
-
raise NotImplementedError
|
28
|
-
|
29
|
-
@abc.abstractmethod
|
30
|
-
def __call__(self) -> T:
|
31
|
-
raise NotImplementedError
|
32
|
-
|
33
|
-
@abc.abstractmethod
|
34
|
-
def __iter__(self) -> ta.Iterator[T]:
|
35
|
-
raise NotImplementedError
|
36
|
-
|
37
|
-
@abc.abstractmethod
|
38
|
-
def __getitem__(self, item: int) -> T:
|
39
|
-
raise NotImplementedError
|
40
|
-
|
41
|
-
@abc.abstractmethod
|
42
|
-
def if_present(self, consumer: ta.Callable[[T], None]) -> None:
|
43
|
-
raise NotImplementedError
|
44
|
-
|
45
|
-
@abc.abstractmethod
|
46
|
-
def filter(self, predicate: ta.Callable[[T], bool]) -> 'Maybe[T]':
|
47
|
-
raise NotImplementedError
|
48
|
-
|
49
|
-
@abc.abstractmethod
|
50
|
-
def map(self, mapper: ta.Callable[[T], U]) -> 'Maybe[U]':
|
51
|
-
raise NotImplementedError
|
52
|
-
|
53
|
-
@abc.abstractmethod
|
54
|
-
def flat_map(self, mapper: ta.Callable[[T], 'Maybe[U]']) -> 'Maybe[U]':
|
55
|
-
raise NotImplementedError
|
56
|
-
|
57
|
-
@abc.abstractmethod
|
58
|
-
def or_else(self, other: T | U) -> T | U:
|
59
|
-
raise NotImplementedError
|
60
|
-
|
61
|
-
@abc.abstractmethod
|
62
|
-
def or_else_get(self, supplier: ta.Callable[[], U]) -> T | U:
|
63
|
-
raise NotImplementedError
|
64
|
-
|
65
|
-
@abc.abstractmethod
|
66
|
-
def or_else_raise(self, exception_supplier: ta.Callable[[], Exception]) -> T:
|
67
|
-
raise NotImplementedError
|
68
|
-
|
69
|
-
|
70
|
-
class _Maybe(Maybe[T], tuple):
|
71
|
-
__slots__ = ()
|
72
|
-
|
73
|
-
def __init_subclass__(cls, **kwargs):
|
74
|
-
raise TypeError
|
75
|
-
|
76
|
-
@property
|
77
|
-
def present(self) -> bool:
|
78
|
-
return bool(self)
|
79
|
-
|
80
|
-
def must(self) -> T:
|
81
|
-
if not self:
|
82
|
-
raise ValueNotPresentException
|
83
|
-
return self[0]
|
84
|
-
|
85
|
-
__call__ = must
|
86
|
-
|
87
|
-
def __iter__(self) -> ta.Iterator[T]:
|
88
|
-
raise TypeError
|
89
|
-
|
90
|
-
locals()['__iter__'] = tuple.__iter__
|
91
|
-
|
92
|
-
def __getitem__(self, item: int) -> T: # type: ignore
|
93
|
-
raise TypeError
|
94
|
-
|
95
|
-
locals()['__getitem__'] = tuple.__getitem__
|
96
|
-
|
97
|
-
def if_present(self, consumer: ta.Callable[[T], None]) -> None:
|
98
|
-
if self:
|
99
|
-
consumer(self[0])
|
100
|
-
|
101
|
-
def filter(self, predicate: ta.Callable[[T], bool]) -> Maybe[T]:
|
102
|
-
return self if self and predicate(self[0]) else _empty
|
103
|
-
|
104
|
-
def map(self, mapper: ta.Callable[[T], U]) -> Maybe[U]:
|
105
|
-
if self:
|
106
|
-
return just(mapper(self[0]))
|
107
|
-
return _empty # noqa
|
108
|
-
|
109
|
-
def flat_map(self, mapper: ta.Callable[[T], Maybe[U]]) -> Maybe[U]:
|
110
|
-
if self:
|
111
|
-
value = mapper(self[0])
|
112
|
-
if not isinstance(value, Maybe):
|
113
|
-
raise TypeError(value)
|
114
|
-
return value
|
115
|
-
return _empty # noqa
|
116
|
-
|
117
|
-
def or_else(self, other: T | U) -> T | U:
|
118
|
-
return self.must() if self else other
|
119
|
-
|
120
|
-
def or_else_get(self, supplier: ta.Callable[[], T | U]) -> T | U:
|
121
|
-
return self.must() if self else supplier()
|
122
|
-
|
123
|
-
def or_else_raise(self, exception_supplier: ta.Callable[[], Exception]) -> T:
|
124
|
-
if self:
|
125
|
-
return self.must()
|
126
|
-
raise exception_supplier()
|
127
|
-
|
128
|
-
|
129
|
-
#
|
130
|
-
|
131
|
-
|
132
|
-
def just(v: T) -> Maybe[T]:
|
133
|
-
return tuple.__new__(_Maybe, (v,)) # noqa
|
134
|
-
|
135
|
-
|
136
|
-
_empty = tuple.__new__(_Maybe, ())
|
137
|
-
|
138
|
-
|
139
|
-
def empty() -> Maybe[T]:
|
140
|
-
return _empty # noqa
|
141
|
-
|
142
|
-
|
143
|
-
def maybe(o: T | None) -> Maybe[T]:
|
144
|
-
if o is None:
|
145
|
-
return _empty # noqa
|
146
|
-
return just(o)
|
147
|
-
|
148
|
-
|
149
|
-
##
|
150
|
-
|
151
|
-
|
152
|
-
@_as_lite_maybe.register
|
153
|
-
def _(obj: Maybe) -> _LiteMaybe:
|
154
|
-
if obj.present:
|
155
|
-
return _LiteMaybe.just(obj.must())
|
156
|
-
else:
|
157
|
-
return _LiteMaybe.empty()
|
File without changes
|
File without changes
|
File without changes
|