vools 0.7.4__tar.gz → 0.7.7__tar.gz
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.
- {vools-0.7.4/vools.egg-info → vools-0.7.7}/PKG-INFO +613 -624
- {vools-0.7.4 → vools-0.7.7}/README.md +33 -44
- {vools-0.7.4 → vools-0.7.7}/pyproject.toml +5 -5
- {vools-0.7.4 → vools-0.7.7}/setup.cfg +4 -4
- {vools-0.7.4 → vools-0.7.7}/tests/test_functions.py +48 -48
- vools-0.7.7/tests/test_md.py +231 -0
- vools-0.7.7/tests/test_md_advanced.py +432 -0
- vools-0.7.7/tests/test_md_integration.py +142 -0
- vools-0.7.7/tests/test_md_phase3.py +481 -0
- vools-0.7.7/tests/test_md_phase4.py +718 -0
- vools-0.7.7/tests/test_md_phase5.py +146 -0
- vools-0.7.7/tests/test_md_phase6.py +225 -0
- {vools-0.7.4 → vools-0.7.7}/vools/README.md +3 -0
- {vools-0.7.4 → vools-0.7.7}/vools/__init__.py +563 -557
- vools-0.7.7/vools/actus/__init__.py +136 -0
- vools-0.7.7/vools/actus/adapter.py +603 -0
- vools-0.7.7/vools/actus/author.py +368 -0
- vools-0.7.7/vools/actus/cli.py +2419 -0
- vools-0.7.7/vools/actus/concurrency.py +141 -0
- vools-0.7.7/vools/actus/constants.py +30 -0
- vools-0.7.7/vools/actus/dependency.py +417 -0
- vools-0.7.7/vools/actus/desktop.py +176 -0
- vools-0.7.7/vools/actus/errors.py +30 -0
- vools-0.7.7/vools/actus/eventbus.py +180 -0
- vools-0.7.7/vools/actus/evolution.py +651 -0
- vools-0.7.7/vools/actus/executor.py +567 -0
- vools-0.7.7/vools/actus/export.py +196 -0
- vools-0.7.7/vools/actus/frontmatter.py +113 -0
- vools-0.7.7/vools/actus/health.py +247 -0
- vools-0.7.7/vools/actus/highlight.py +263 -0
- vools-0.7.7/vools/actus/importsys.py +331 -0
- vools-0.7.7/vools/actus/indexer.py +136 -0
- vools-0.7.7/vools/actus/installer.py +620 -0
- vools-0.7.7/vools/actus/intent.py +175 -0
- vools-0.7.7/vools/actus/jump.py +536 -0
- vools-0.7.7/vools/actus/loophelpers.py +187 -0
- vools-0.7.7/vools/actus/mcp_server.py +2140 -0
- vools-0.7.7/vools/actus/mcp_sse.py +160 -0
- vools-0.7.7/vools/actus/mdtest.py +363 -0
- vools-0.7.7/vools/actus/model.py +248 -0
- vools-0.7.7/vools/actus/notify.py +351 -0
- vools-0.7.7/vools/actus/omega.py +743 -0
- vools-0.7.7/vools/actus/panel.py +259 -0
- vools-0.7.7/vools/actus/panel_init.py +5 -0
- vools-0.7.7/vools/actus/project.py +676 -0
- vools-0.7.7/vools/actus/project_io.py +235 -0
- vools-0.7.7/vools/actus/pytest_compat.py +346 -0
- vools-0.7.7/vools/actus/records.py +288 -0
- vools-0.7.7/vools/actus/registry.py +693 -0
- vools-0.7.7/vools/actus/runtimes.py +556 -0
- vools-0.7.7/vools/actus/sandbox.py +142 -0
- vools-0.7.7/vools/actus/scaffold.py +347 -0
- vools-0.7.7/vools/actus/security.py +466 -0
- vools-0.7.7/vools/actus/selfheal.py +321 -0
- vools-0.7.7/vools/actus/template.py +390 -0
- vools-0.7.7/vools/actus/triggers.py +488 -0
- vools-0.7.7/vools/actus/trust.py +52 -0
- vools-0.7.7/vools/actus/trust_model.py +600 -0
- vools-0.7.7/vools/actus/validate.py +402 -0
- vools-0.7.7/vools/actus/vault.py +308 -0
- vools-0.7.7/vools/actus/visibility.py +567 -0
- vools-0.7.7/vools/actus/viz.py +323 -0
- vools-0.7.7/vools/actus/webhook.py +499 -0
- vools-0.7.7/vools/actus/workflow.py +506 -0
- {vools-0.7.4 → vools-0.7.7}/vools/api/curry_cmd.py +106 -98
- {vools-0.7.4 → vools-0.7.7}/vools/api/memoize_cmd.py +134 -125
- {vools-0.7.4 → vools-0.7.7}/vools/api/ops_cmd.py +122 -112
- {vools-0.7.4 → vools-0.7.7}/vools/api/seq_cmd.py +140 -129
- {vools-0.7.4 → vools-0.7.7}/vools/cache/memorize.py +171 -171
- {vools-0.7.4 → vools-0.7.7}/vools/cache/once.py +176 -176
- {vools-0.7.4 → vools-0.7.7}/vools/cache/persist.py +305 -305
- {vools-0.7.4 → vools-0.7.7}/vools/config.py +135 -135
- {vools-0.7.4 → vools-0.7.7}/vools/core/base.py +81 -81
- {vools-0.7.4 → vools-0.7.7}/vools/core/config.py +110 -110
- {vools-0.7.4 → vools-0.7.7}/vools/core/dataclass_compat.py +204 -204
- {vools-0.7.4 → vools-0.7.7}/vools/core/exceptions.py +52 -52
- {vools-0.7.4 → vools-0.7.7}/vools/crypto/core.py +779 -779
- {vools-0.7.4 → vools-0.7.7}/vools/curried/__init__.py +180 -180
- vools-0.7.7/vools/data/itor.dll +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/data/itor.py +854 -854
- {vools-0.7.4 → vools-0.7.7}/vools/data/itor_nim.py +153 -147
- {vools-0.7.4 → vools-0.7.7}/vools/data/seq.py +1375 -1375
- {vools-0.7.4 → vools-0.7.7}/vools/data/vlist.py +960 -960
- {vools-0.7.4 → vools-0.7.7}/vools/datetime/dates_format.py +1003 -1003
- {vools-0.7.4 → vools-0.7.7}/vools/datetime/vdate_class.py +782 -782
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/control.py +519 -519
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/curry_core.py +578 -578
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/curry_decorator.py +491 -491
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/curry_delay.py +456 -456
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/overcurry.py +201 -201
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/rself.py +257 -257
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/selector.py +433 -433
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/shotcut.py +411 -411
- {vools-0.7.4 → vools-0.7.7}/vools/encoding/__init__.py +53 -20
- {vools-0.7.4 → vools-0.7.7}/vools/encoding/core.py +875 -875
- {vools-0.7.4 → vools-0.7.7}/vools/functional/__init__.py +410 -410
- {vools-0.7.4 → vools-0.7.7}/vools/functional/arrow_func.py +529 -529
- {vools-0.7.4 → vools-0.7.7}/vools/functional/box.py +662 -662
- {vools-0.7.4 → vools-0.7.7}/vools/functional/iif.py +577 -577
- {vools-0.7.4 → vools-0.7.7}/vools/functional/pipe_ops.py +534 -534
- {vools-0.7.4 → vools-0.7.7}/vools/functional/placeholder.py +789 -789
- {vools-0.7.4 → vools-0.7.7}/vools/functional/placeholder_impl.py +1417 -1417
- {vools-0.7.4 → vools-0.7.7}/vools/functional/result.py +281 -281
- vools-0.7.7/vools/lib/linux/libvools_bridge_safe_eval.so +0 -0
- vools-0.7.7/vools/lib/linux/libvools_crypto.so +0 -0
- vools-0.7.7/vools/lib/linux/libvools_curried.so +0 -0
- vools-0.7.7/vools/lib/linux/libvools_datetime.so +0 -0
- vools-0.7.7/vools/lib/linux/libvools_encoding.so +0 -0
- vools-0.7.7/vools/lib/linux/libvools_seq.so +0 -0
- vools-0.7.7/vools/lib/windows/libgcc_s_seh-1.dll +0 -0
- vools-0.7.7/vools/lib/windows/libstdc++-6.dll +0 -0
- vools-0.7.7/vools/lib/windows/libwinpthread-1.dll +0 -0
- vools-0.7.7/vools/lib/windows/vools_crypto.dll +0 -0
- vools-0.7.7/vools/lib/windows/vools_curried.dll +0 -0
- vools-0.7.7/vools/lib/windows/vools_datetime.dll +0 -0
- vools-0.7.7/vools/lib/windows/vools_encoding.dll +0 -0
- vools-0.7.7/vools/lib/windows/vools_seq.dll +0 -0
- vools-0.7.7/vools/md/__init__.py +70 -0
- vools-0.7.7/vools/md/advanced.py +622 -0
- vools-0.7.7/vools/md/cli.py +98 -0
- vools-0.7.7/vools/md/ecosystem.py +688 -0
- vools-0.7.7/vools/md/generator.py +117 -0
- vools-0.7.7/vools/md/html.py +158 -0
- vools-0.7.7/vools/md/parser.py +519 -0
- vools-0.7.7/vools/md/utils.py +337 -0
- {vools-0.7.4 → vools-0.7.7}/vools/oop/__init__.py +39 -35
- {vools-0.7.4 → vools-0.7.7}/vools/oop/calltype.py +293 -293
- vools-0.7.7/vools/oop/derive.py +196 -0
- {vools-0.7.4 → vools-0.7.7}/vools/oop/extend.py +796 -796
- {vools-0.7.4 → vools-0.7.7}/vools/oop/fusion.py +386 -386
- {vools-0.7.4 → vools-0.7.7}/vools/oop/method_extend.py +109 -109
- {vools-0.7.4 → vools-0.7.7}/vools/oop/mixer.py +206 -206
- {vools-0.7.4 → vools-0.7.7}/vools/oop/selector.py +10 -10
- {vools-0.7.4 → vools-0.7.7}/vools/security/_constants.py +70 -70
- {vools-0.7.4 → vools-0.7.7}/vools/security/expression_handler.py +333 -333
- {vools-0.7.4 → vools-0.7.7}/vools/security/hash.py +3 -0
- {vools-0.7.4 → vools-0.7.7}/vools/security/safe_eval.py +409 -406
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/backends/base.py +93 -93
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/backends/json_backend.py +191 -191
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/backends/msgpack_backend.py +102 -102
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/backends/pickle_backend.py +66 -66
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/callable/__init__.py +153 -153
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/callable/decorator_handler.py +93 -93
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/callable/functional_handler.py +108 -108
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/codec.py +451 -437
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/config.py +37 -37
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/context.py +64 -64
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/core.py +226 -226
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/decorators.py +294 -294
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/sentinel.py +52 -46
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/type_registry.py +230 -230
- {vools-0.7.4 → vools-0.7.7}/vools/sql/core/builder.py +825 -819
- {vools-0.7.4 → vools-0.7.7}/vools/sql/core/config.py +50 -45
- {vools-0.7.4 → vools-0.7.7}/vools/sql/core/connection.py +198 -193
- {vools-0.7.4 → vools-0.7.7}/vools/sql/core/decorators.py +429 -422
- {vools-0.7.4 → vools-0.7.7}/vools/sql/core/dialect.py +182 -173
- {vools-0.7.4 → vools-0.7.7}/vools/sql/core/result.py +437 -431
- {vools-0.7.4 → vools-0.7.7}/vools/sql/core/types.py +246 -235
- {vools-0.7.4 → vools-0.7.7}/vools/sql/manager.py +583 -567
- {vools-0.7.4 → vools-0.7.7}/vools/sql/postgres/connection.py +256 -251
- {vools-0.7.4 → vools-0.7.7}/vools/sql/postgres/dialect.py +175 -170
- {vools-0.7.4 → vools-0.7.7}/vools/sql/spark/connection.py +505 -500
- {vools-0.7.4 → vools-0.7.7}/vools/sql/spark/dialect.py +181 -176
- {vools-0.7.4 → vools-0.7.7}/vools/sql/spark/scala_bridge.py +1 -1
- {vools-0.7.4 → vools-0.7.7}/vools/sql/sqlite/connection.py +219 -214
- {vools-0.7.4 → vools-0.7.7}/vools/sql/sqlite/dialect.py +171 -166
- {vools-0.7.4 → vools-0.7.7}/vools/sys/cmd.py +421 -416
- {vools-0.7.4 → vools-0.7.7}/vools/sys/compile_cmd.py +168 -163
- {vools-0.7.4 → vools-0.7.7}/vools/sys/dll.py +426 -421
- {vools-0.7.4 → vools-0.7.7}/vools/sys/dll_cmd.py +154 -149
- {vools-0.7.4 → vools-0.7.7}/vools/sys/env_cmd.py +100 -95
- {vools-0.7.4 → vools-0.7.7}/vools/sys/exe.py +326 -321
- {vools-0.7.4 → vools-0.7.7}/vools/sys/fire_app.py +33 -27
- {vools-0.7.4 → vools-0.7.7}/vools/sys/run_cmd.py +72 -67
- {vools-0.7.4 → vools-0.7.7}/vools/task/core/models.py +108 -108
- {vools-0.7.4 → vools-0.7.7}/vools/task/core/queue.py +252 -252
- {vools-0.7.4 → vools-0.7.7}/vools/task/core/storage.py +317 -317
- {vools-0.7.4 → vools-0.7.7}/vools/task/core/worker.py +303 -303
- {vools-0.7.4 → vools-0.7.7}/vools/task/decorators/task_decorator.py +321 -321
- {vools-0.7.4 → vools-0.7.7}/vools/task/rules/dag.py +319 -319
- {vools-0.7.4 → vools-0.7.7}/vools/task/rules/engine.py +393 -393
- {vools-0.7.4 → vools-0.7.7}/vools/task/rules/rule.py +197 -197
- {vools-0.7.4 → vools-0.7.7}/vools/utils/__init__.py +73 -73
- {vools-0.7.4 → vools-0.7.7}/vools/utils/hoder.py +84 -84
- {vools-0.7.4 → vools-0.7.7/vools.egg-info}/PKG-INFO +613 -624
- {vools-0.7.4 → vools-0.7.7}/vools.egg-info/SOURCES.txt +81 -0
- {vools-0.7.4 → vools-0.7.7}/vools.egg-info/requires.txt +8 -8
- {vools-0.7.4 → vools-0.7.7}/LICENSE +0 -0
- {vools-0.7.4 → vools-0.7.7}/NOTICE +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/__main__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/api/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/api/typer_app.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/cache/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/cache/sigcache.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/asyncio_mod.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/bridges.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/contextvars_mod.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/delegates.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/futures.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/multiprocessing_mod.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/queues.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/sched_mod.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/spawns.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/subprocess_mod.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/concurrent/threading_mod.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/core/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/core/asyncio_compat.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/core/contextvars_compat.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/core/datetime_compat.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/core/inspect_compat.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/crypto/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/curried/collection.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/curried/composition.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/curried/core.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/curried/iteration.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/curried/math.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/curried/predicate.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/curried/string.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/data/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/data/qax.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/data/table.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/data/validator.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/data/vtext.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/datetime/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/datetime/utils.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/bridge_decorator.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/cache.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/curried.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/flex_pos.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/lazy.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/overload.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/overloads.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/decorators/trd.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/functional/funcs.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/security/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/backends/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/serialize/backends/vb_json_backend.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/sql/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/sql/core/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/sql/postgres/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/sql/spark/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/sql/sqlite/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/sys/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/sys/env.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/task/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/task/core/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/task/decorators/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/task/rules/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/task/utils/__init__.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/utils/stuff.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools/utils/tools.py +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools.egg-info/dependency_links.txt +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools.egg-info/entry_points.txt +0 -0
- {vools-0.7.4 → vools-0.7.7}/vools.egg-info/top_level.txt +0 -0
|
@@ -1,624 +1,613 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: vools
|
|
3
|
-
Version: 0.7.
|
|
4
|
-
Summary: Python 函数式编程工具集
|
|
5
|
-
Author-email: Victor <victortop921129@gmail.com>
|
|
6
|
-
License: Apache License
|
|
7
|
-
Version 2.0, January 2004
|
|
8
|
-
http://www.apache.org/licenses/
|
|
9
|
-
|
|
10
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
-
|
|
12
|
-
1. Definitions.
|
|
13
|
-
|
|
14
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
-
|
|
17
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
-
the copyright owner that is granting the License.
|
|
19
|
-
|
|
20
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
-
other entities that control, are controlled by, or are under common
|
|
22
|
-
control with that entity. For the purposes of this definition,
|
|
23
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
-
direction or management of such entity, whether by contract or
|
|
25
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
-
|
|
28
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
-
exercising permissions granted by this License.
|
|
30
|
-
|
|
31
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
-
including but not limited to software source code, documentation
|
|
33
|
-
source, and configuration files.
|
|
34
|
-
|
|
35
|
-
"Object" form shall mean any form resulting from mechanical
|
|
36
|
-
transformation or translation of a Source form, including but
|
|
37
|
-
not limited to compiled object code, generated documentation,
|
|
38
|
-
and conversions to other media types.
|
|
39
|
-
|
|
40
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
-
Object form, made available under the License, as indicated by a
|
|
42
|
-
copyright notice that is included in or attached to the work
|
|
43
|
-
(an example is provided in the Appendix below).
|
|
44
|
-
|
|
45
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
-
form, that is based on (or derived from) the Work and for which the
|
|
47
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
-
of this License, Derivative Works shall not include works that remain
|
|
50
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
-
the Work and Derivative Works thereof.
|
|
52
|
-
|
|
53
|
-
"Contribution" shall mean any work of authorship, including
|
|
54
|
-
the original version of the Work and any modifications or additions
|
|
55
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
-
means any form of electronic, verbal, or written communication sent
|
|
60
|
-
to the Licensor or its representatives, including but not limited to
|
|
61
|
-
communication on electronic mailing lists, source code control systems,
|
|
62
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
-
excluding communication that is conspicuously marked or otherwise
|
|
65
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
-
|
|
67
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
-
subsequently incorporated within the Work.
|
|
70
|
-
|
|
71
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
-
Work and such Derivative Works in Source or Object form.
|
|
77
|
-
|
|
78
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
-
(except as stated in this section) patent license to make, have made,
|
|
82
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
-
where such license applies only to those patent claims licensable
|
|
84
|
-
by such Contributor that are necessarily infringed by their
|
|
85
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
-
institute patent litigation against any entity (including a
|
|
88
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
-
or contributory patent infringement, then any patent licenses
|
|
91
|
-
granted to You under this License for that Work shall terminate
|
|
92
|
-
as of the date such litigation is filed.
|
|
93
|
-
|
|
94
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
-
modifications, and in Source or Object form, provided that You
|
|
97
|
-
meet the following conditions:
|
|
98
|
-
|
|
99
|
-
(a) You must give any other recipients of the Work or
|
|
100
|
-
Derivative Works a copy of this License; and
|
|
101
|
-
|
|
102
|
-
(b) You must cause any modified files to carry prominent notices
|
|
103
|
-
stating that You changed the files; and
|
|
104
|
-
|
|
105
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
-
that You distribute, all copyright, patent, trademark, and
|
|
107
|
-
attribution notices from the Source form of the Work,
|
|
108
|
-
excluding those notices that do not pertain to any part of
|
|
109
|
-
the Derivative Works; and
|
|
110
|
-
|
|
111
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
-
distribution, then any Derivative Works that You distribute must
|
|
113
|
-
include a readable copy of the attribution notices contained
|
|
114
|
-
within such NOTICE file, excluding those notices that do not
|
|
115
|
-
pertain to any part of the Derivative Works, in at least one
|
|
116
|
-
of the following places: within a NOTICE text file distributed
|
|
117
|
-
as part of the Derivative Works; within the Source form or
|
|
118
|
-
documentation, if provided along with the Derivative Works; or,
|
|
119
|
-
within a display generated by the Derivative Works, if and
|
|
120
|
-
wherever such third-party notices normally appear. The contents
|
|
121
|
-
of the NOTICE file are for informational purposes only and
|
|
122
|
-
do not modify the License. You may add Your own attribution
|
|
123
|
-
notices within Derivative Works that You distribute, alongside
|
|
124
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
-
that such additional attribution notices cannot be construed
|
|
126
|
-
as modifying the License.
|
|
127
|
-
|
|
128
|
-
You may add Your own copyright statement to Your modifications and
|
|
129
|
-
may provide additional or different license terms and conditions
|
|
130
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
-
the conditions stated in this License.
|
|
134
|
-
|
|
135
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
-
this License, without any additional terms or conditions.
|
|
139
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
-
the terms of any separate license agreement you may have executed
|
|
141
|
-
with Licensor regarding such Contributions.
|
|
142
|
-
|
|
143
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
-
except as required for reasonable and customary use in describing the
|
|
146
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
-
|
|
148
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
-
implied, including, without limitation, any warranties or conditions
|
|
153
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
-
appropriateness of using or redistributing the Work and assume any
|
|
156
|
-
risks associated with Your exercise of permissions under this License.
|
|
157
|
-
|
|
158
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
-
unless required by applicable law (such as deliberate and grossly
|
|
161
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
-
liable to You for damages, including any direct, indirect, special,
|
|
163
|
-
incidental, or consequential damages of any character arising as a
|
|
164
|
-
result of this License or out of the use or inability to use the
|
|
165
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
-
other commercial damages or losses), even if such Contributor
|
|
168
|
-
has been advised of the possibility of such damages.
|
|
169
|
-
|
|
170
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
-
or other liability obligations and/or rights consistent with this
|
|
174
|
-
License. However, in accepting such obligations, You may act only
|
|
175
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
-
defend, and hold each Contributor harmless for any liability
|
|
178
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
-
of your accepting any such warranty or additional liability.
|
|
180
|
-
|
|
181
|
-
END OF TERMS AND CONDITIONS
|
|
182
|
-
|
|
183
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
-
|
|
185
|
-
To apply the Apache License to your work, attach the following
|
|
186
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
187
|
-
replaced with your own identifying information. (Don't include
|
|
188
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
-
comment syntax for the file format. We also recommend that a
|
|
190
|
-
file or class name and description of purpose be included on the
|
|
191
|
-
same "printed page" as the copyright notice for easier
|
|
192
|
-
identification within third-party archives.
|
|
193
|
-
|
|
194
|
-
Copyright [yyyy] [name of copyright owner]
|
|
195
|
-
|
|
196
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
-
you may not use this file except in compliance with the License.
|
|
198
|
-
You may obtain a copy of the License at
|
|
199
|
-
|
|
200
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
-
|
|
202
|
-
Unless required by applicable law or agreed to in writing, software
|
|
203
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
-
See the License for the specific language governing permissions and
|
|
206
|
-
limitations under the License.
|
|
207
|
-
|
|
208
|
-
Project-URL: Homepage, https://github.com/vicTop-cw/vools
|
|
209
|
-
Project-URL: Repository, https://github.com/vicTop-cw/vools
|
|
210
|
-
Project-URL: Issues, https://github.com/vicTop-cw/vools/issues
|
|
211
|
-
Classifier: Programming Language :: Python :: 3
|
|
212
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
213
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
214
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
215
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
216
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
217
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
218
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
219
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
220
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
221
|
-
Classifier: Operating System :: OS Independent
|
|
222
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
223
|
-
Classifier: Intended Audience :: Developers
|
|
224
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
225
|
-
Classifier: Typing :: Typed
|
|
226
|
-
Requires-Python: >=3.6
|
|
227
|
-
Description-Content-Type: text/markdown
|
|
228
|
-
License-File: LICENSE
|
|
229
|
-
License-File: NOTICE
|
|
230
|
-
Provides-Extra: dev
|
|
231
|
-
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
232
|
-
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
233
|
-
Requires-Dist: black>=23.0; extra == "dev"
|
|
234
|
-
Requires-Dist: isort>=5.12; extra == "dev"
|
|
235
|
-
Requires-Dist: flake8>=6.0; extra == "dev"
|
|
236
|
-
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
237
|
-
Requires-Dist: pre-commit>=3.0; extra == "dev"
|
|
238
|
-
Provides-Extra: serialize
|
|
239
|
-
Requires-Dist: msgpack>=1.0; extra == "serialize"
|
|
240
|
-
Requires-Dist: orjson>=3.9; extra == "serialize"
|
|
241
|
-
Provides-Extra: rx
|
|
242
|
-
Requires-Dist: vools-rx==0.7.
|
|
243
|
-
Provides-Extra: bridges
|
|
244
|
-
Requires-Dist: vools-bridges==0.7.
|
|
245
|
-
Provides-Extra: dll32
|
|
246
|
-
Requires-Dist: vools-dll32==0.7.
|
|
247
|
-
Provides-Extra: xl
|
|
248
|
-
Requires-Dist: vools-xl==0.7.
|
|
249
|
-
Provides-Extra: all
|
|
250
|
-
Requires-Dist: vools-rx==0.7.
|
|
251
|
-
Requires-Dist: vools-bridges==0.7.
|
|
252
|
-
Requires-Dist: vools-dll32==0.7.
|
|
253
|
-
Requires-Dist: vools-xl==0.7.
|
|
254
|
-
Provides-Extra: cli
|
|
255
|
-
Requires-Dist: typer>=0.12.0; extra == "cli"
|
|
256
|
-
Requires-Dist: typing-extensions>=4.0.0; extra == "cli"
|
|
257
|
-
Requires-Dist: fire>=0.5.0; extra == "cli"
|
|
258
|
-
Provides-Extra: docs
|
|
259
|
-
Requires-Dist: mkdocs>=1.6; extra == "docs"
|
|
260
|
-
Requires-Dist: mkdocs-material>=9.0; extra == "docs"
|
|
261
|
-
Requires-Dist: pymdown-extensions>=10.0; extra == "docs"
|
|
262
|
-
Requires-Dist: mkdocs-minify-plugin>=0.8; extra == "docs"
|
|
263
|
-
Dynamic: license-file
|
|
264
|
-
|
|
265
|
-
# vools - Python 函数式编程工具集
|
|
266
|
-
|
|
267
|
-
[](https://pypi.org/project/vools/)
|
|
268
|
-
[](https://pypi.org/project/vools/)
|
|
269
|
-
[](LICENSE)
|
|
270
|
-
[](https://victop-cw.github.io/vools/)
|
|
271
|
-
|
|
272
|
-
📚 **完整文档**: [https://victop-cw.github.io/vools/](https://victop-cw.github.io/vools/)
|
|
273
|
-
|
|
274
|
-
一个强大的 Python 函数式编程工具集,提供装饰器、函数式编程工具、数据处理工具、响应式编程等。
|
|
275
|
-
|
|
276
|
-
## 特性
|
|
277
|
-
|
|
278
|
-
- **装饰器**: memorize、once、lazy、retry、curry、overload 等
|
|
279
|
-
- **函数式编程**: Seq、Ops、管道操作、占位符、箭头函数
|
|
280
|
-
- **数据处理**: 链式序列操作、列表/文本增强工具
|
|
281
|
-
- **响应式编程**: Observable、Subject、丰富的操作符
|
|
282
|
-
- **任务调度**: TaskQueue、WorkerPool、DAG 调度器
|
|
283
|
-
- **序列化**: 支持 JSON、MsgPack、Pickle 等多种格式
|
|
284
|
-
- **编码/加密**: Base64、URL 编码、哈希函数
|
|
285
|
-
- **多语言桥接**: 支持 27+ 种编程语言(Lua、Rust、Go、Java、Kotlin、Swift、Dart、MoonBit 等),统一装饰器接口
|
|
286
|
-
- **编译器自动发现**: 自动探测本机和 WSL 环境中的编译器,支持注册表搜索、常见安装路径、通配符路径展开
|
|
287
|
-
- **跨语言操作符**: Scala / Kotlin / Nim 隐式双元操作符,支持函数组合与数据管道处理
|
|
288
|
-
|
|
289
|
-
## 安装
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
pip install vools
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
或从源码安装:
|
|
296
|
-
|
|
297
|
-
```bash
|
|
298
|
-
git clone https://github.com/vicTop-cw/vools.git
|
|
299
|
-
cd vools
|
|
300
|
-
pip install .
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### 环境要求
|
|
304
|
-
|
|
305
|
-
- Python 3.6+
|
|
306
|
-
|
|
307
|
-
### 依赖
|
|
308
|
-
|
|
309
|
-
- `attrs >= 22.1` (Python < 3.7 时需要,用于 dataclass 兼容)
|
|
310
|
-
- `contextvars` (Python < 3.7 时需要)
|
|
311
|
-
|
|
312
|
-
## 快速开始
|
|
313
|
-
|
|
314
|
-
### 装饰器
|
|
315
|
-
|
|
316
|
-
```python
|
|
317
|
-
from vools import memorize, once, retry, overload
|
|
318
|
-
|
|
319
|
-
# 缓存装饰器
|
|
320
|
-
@memorize(duration=60)
|
|
321
|
-
def expensive_function(x):
|
|
322
|
-
return x ** 2
|
|
323
|
-
|
|
324
|
-
# 只执行一次
|
|
325
|
-
@once
|
|
326
|
-
def initialize():
|
|
327
|
-
return 42
|
|
328
|
-
|
|
329
|
-
# 重试装饰器
|
|
330
|
-
@retry(times=3, delay=1)
|
|
331
|
-
def risky_operation():
|
|
332
|
-
pass
|
|
333
|
-
|
|
334
|
-
# 函数重载
|
|
335
|
-
@overload
|
|
336
|
-
def process(x: int) -> int:
|
|
337
|
-
return x * 2
|
|
338
|
-
|
|
339
|
-
@process.register
|
|
340
|
-
def process(x: str) -> str:
|
|
341
|
-
return x.upper()
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
### 函数式编程
|
|
345
|
-
|
|
346
|
-
```python
|
|
347
|
-
from vools import Seq, Ops, _, g, iif, pipe
|
|
348
|
-
|
|
349
|
-
# Seq 链式操作
|
|
350
|
-
result = Seq(range(10)).filter(lambda x: x % 2 == 0).map(lambda x: x * 2).collect()
|
|
351
|
-
# [0, 4, 8, 12, 16]
|
|
352
|
-
|
|
353
|
-
# Ops 管道操作
|
|
354
|
-
result = range(10) | Ops.filter(lambda x: x > 3) | Ops.map(lambda x: x * 2) | Ops.sum()
|
|
355
|
-
# 84
|
|
356
|
-
|
|
357
|
-
# 占位符
|
|
358
|
-
f = _ + 1
|
|
359
|
-
print(f(2)) # 3
|
|
360
|
-
|
|
361
|
-
# 箭头函数
|
|
362
|
-
f = g("x, y => x + y")
|
|
363
|
-
print(f(3, 4)) # 7
|
|
364
|
-
|
|
365
|
-
# 条件表达式
|
|
366
|
-
result = iif(True, "yes", "no") # "yes"
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### 柯里化
|
|
370
|
-
|
|
371
|
-
```python
|
|
372
|
-
from vools import curry, stuff
|
|
373
|
-
|
|
374
|
-
@curry
|
|
375
|
-
def add(a, b, c):
|
|
376
|
-
return a + b + c
|
|
377
|
-
|
|
378
|
-
print(add(1)(2)(3)) # 6
|
|
379
|
-
|
|
380
|
-
@stuff
|
|
381
|
-
def multiply(a, b):
|
|
382
|
-
return a * b
|
|
383
|
-
|
|
384
|
-
result = multiply(2)(3)()
|
|
385
|
-
print(result) # 6
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### 响应式编程
|
|
389
|
-
|
|
390
|
-
```python
|
|
391
|
-
from vools import Observable
|
|
392
|
-
|
|
393
|
-
# 创建 Observable
|
|
394
|
-
obs = Observable.from_iterable([1, 2, 3, 4, 5])
|
|
395
|
-
|
|
396
|
-
# 链式操作符
|
|
397
|
-
result = []
|
|
398
|
-
obs.pipe(
|
|
399
|
-
Ops.filter(lambda x: x % 2 == 0),
|
|
400
|
-
Ops.map(lambda x: x * 2),
|
|
401
|
-
Ops.take(2)
|
|
402
|
-
).subscribe(lambda x: result.append(x))
|
|
403
|
-
|
|
404
|
-
print(result) # [4, 8]
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
###
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
|
530
|
-
|
|
531
|
-
| `
|
|
532
|
-
| `
|
|
533
|
-
| `
|
|
534
|
-
| `
|
|
535
|
-
| `
|
|
536
|
-
| `
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
| `
|
|
544
|
-
| `
|
|
545
|
-
| `
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
|
553
|
-
|
|
554
|
-
| `
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
-
|
|
573
|
-
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
|
582
|
-
|
|
583
|
-
|
|
|
584
|
-
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
5. 打开 Pull Request
|
|
615
|
-
|
|
616
|
-
## 许可证
|
|
617
|
-
|
|
618
|
-
Apache License 2.0 - 详见 [LICENSE](LICENSE) 文件
|
|
619
|
-
|
|
620
|
-
## 联系方式
|
|
621
|
-
|
|
622
|
-
- 作者: Victor
|
|
623
|
-
- 邮箱: victortop921129@gmail.com
|
|
624
|
-
- 项目: https://github.com/vicTop-cw/vools
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vools
|
|
3
|
+
Version: 0.7.7
|
|
4
|
+
Summary: Python 函数式编程工具集
|
|
5
|
+
Author-email: Victor <victortop921129@gmail.com>
|
|
6
|
+
License: Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and
|
|
122
|
+
do not modify the License. You may add Your own attribution
|
|
123
|
+
notices within Derivative Works that You distribute, alongside
|
|
124
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
+
that such additional attribution notices cannot be construed
|
|
126
|
+
as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a
|
|
190
|
+
file or class name and description of purpose be included on the
|
|
191
|
+
same "printed page" as the copyright notice for easier
|
|
192
|
+
identification within third-party archives.
|
|
193
|
+
|
|
194
|
+
Copyright [yyyy] [name of copyright owner]
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
|
+
limitations under the License.
|
|
207
|
+
|
|
208
|
+
Project-URL: Homepage, https://github.com/vicTop-cw/vools
|
|
209
|
+
Project-URL: Repository, https://github.com/vicTop-cw/vools
|
|
210
|
+
Project-URL: Issues, https://github.com/vicTop-cw/vools/issues
|
|
211
|
+
Classifier: Programming Language :: Python :: 3
|
|
212
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
213
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
214
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
215
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
216
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
217
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
218
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
219
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
220
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
221
|
+
Classifier: Operating System :: OS Independent
|
|
222
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
223
|
+
Classifier: Intended Audience :: Developers
|
|
224
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
225
|
+
Classifier: Typing :: Typed
|
|
226
|
+
Requires-Python: >=3.6
|
|
227
|
+
Description-Content-Type: text/markdown
|
|
228
|
+
License-File: LICENSE
|
|
229
|
+
License-File: NOTICE
|
|
230
|
+
Provides-Extra: dev
|
|
231
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
232
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
233
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
234
|
+
Requires-Dist: isort>=5.12; extra == "dev"
|
|
235
|
+
Requires-Dist: flake8>=6.0; extra == "dev"
|
|
236
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
237
|
+
Requires-Dist: pre-commit>=3.0; extra == "dev"
|
|
238
|
+
Provides-Extra: serialize
|
|
239
|
+
Requires-Dist: msgpack>=1.0; extra == "serialize"
|
|
240
|
+
Requires-Dist: orjson>=3.9; extra == "serialize"
|
|
241
|
+
Provides-Extra: rx
|
|
242
|
+
Requires-Dist: vools-rx==0.7.6; extra == "rx"
|
|
243
|
+
Provides-Extra: bridges
|
|
244
|
+
Requires-Dist: vools-bridges==0.7.6; extra == "bridges"
|
|
245
|
+
Provides-Extra: dll32
|
|
246
|
+
Requires-Dist: vools-dll32==0.7.6; extra == "dll32"
|
|
247
|
+
Provides-Extra: xl
|
|
248
|
+
Requires-Dist: vools-xl==0.7.6; extra == "xl"
|
|
249
|
+
Provides-Extra: all
|
|
250
|
+
Requires-Dist: vools-rx==0.7.6; extra == "all"
|
|
251
|
+
Requires-Dist: vools-bridges==0.7.6; extra == "all"
|
|
252
|
+
Requires-Dist: vools-dll32==0.7.6; extra == "all"
|
|
253
|
+
Requires-Dist: vools-xl==0.7.6; extra == "all"
|
|
254
|
+
Provides-Extra: cli
|
|
255
|
+
Requires-Dist: typer>=0.12.0; extra == "cli"
|
|
256
|
+
Requires-Dist: typing-extensions>=4.0.0; extra == "cli"
|
|
257
|
+
Requires-Dist: fire>=0.5.0; extra == "cli"
|
|
258
|
+
Provides-Extra: docs
|
|
259
|
+
Requires-Dist: mkdocs>=1.6; extra == "docs"
|
|
260
|
+
Requires-Dist: mkdocs-material>=9.0; extra == "docs"
|
|
261
|
+
Requires-Dist: pymdown-extensions>=10.0; extra == "docs"
|
|
262
|
+
Requires-Dist: mkdocs-minify-plugin>=0.8; extra == "docs"
|
|
263
|
+
Dynamic: license-file
|
|
264
|
+
|
|
265
|
+
# vools - Python 函数式编程工具集
|
|
266
|
+
|
|
267
|
+
[](https://pypi.org/project/vools/)
|
|
268
|
+
[](https://pypi.org/project/vools/)
|
|
269
|
+
[](LICENSE)
|
|
270
|
+
[](https://victop-cw.github.io/vools/)
|
|
271
|
+
|
|
272
|
+
📚 **完整文档**: [https://victop-cw.github.io/vools/](https://victop-cw.github.io/vools/)
|
|
273
|
+
|
|
274
|
+
一个强大的 Python 函数式编程工具集,提供装饰器、函数式编程工具、数据处理工具、响应式编程等。
|
|
275
|
+
|
|
276
|
+
## 特性
|
|
277
|
+
|
|
278
|
+
- **装饰器**: memorize、once、lazy、retry、curry、overload 等
|
|
279
|
+
- **函数式编程**: Seq、Ops、管道操作、占位符、箭头函数
|
|
280
|
+
- **数据处理**: 链式序列操作、列表/文本增强工具
|
|
281
|
+
- **响应式编程**: Observable、Subject、丰富的操作符
|
|
282
|
+
- **任务调度**: TaskQueue、WorkerPool、DAG 调度器
|
|
283
|
+
- **序列化**: 支持 JSON、MsgPack、Pickle 等多种格式
|
|
284
|
+
- **编码/加密**: Base64、URL 编码、哈希函数
|
|
285
|
+
- **多语言桥接**: 支持 27+ 种编程语言(Lua、Rust、Go、Java、Kotlin、Swift、Dart、MoonBit 等),统一装饰器接口
|
|
286
|
+
- **编译器自动发现**: 自动探测本机和 WSL 环境中的编译器,支持注册表搜索、常见安装路径、通配符路径展开
|
|
287
|
+
- **跨语言操作符**: Scala / Kotlin / Nim 隐式双元操作符,支持函数组合与数据管道处理
|
|
288
|
+
|
|
289
|
+
## 安装
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
pip install vools
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
或从源码安装:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
git clone https://github.com/vicTop-cw/vools.git
|
|
299
|
+
cd vools
|
|
300
|
+
pip install .
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 环境要求
|
|
304
|
+
|
|
305
|
+
- Python 3.6+
|
|
306
|
+
|
|
307
|
+
### 依赖
|
|
308
|
+
|
|
309
|
+
- `attrs >= 22.1` (Python < 3.7 时需要,用于 dataclass 兼容)
|
|
310
|
+
- `contextvars` (Python < 3.7 时需要)
|
|
311
|
+
|
|
312
|
+
## 快速开始
|
|
313
|
+
|
|
314
|
+
### 装饰器
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
from vools import memorize, once, retry, overload
|
|
318
|
+
|
|
319
|
+
# 缓存装饰器
|
|
320
|
+
@memorize(duration=60)
|
|
321
|
+
def expensive_function(x):
|
|
322
|
+
return x ** 2
|
|
323
|
+
|
|
324
|
+
# 只执行一次
|
|
325
|
+
@once
|
|
326
|
+
def initialize():
|
|
327
|
+
return 42
|
|
328
|
+
|
|
329
|
+
# 重试装饰器
|
|
330
|
+
@retry(times=3, delay=1)
|
|
331
|
+
def risky_operation():
|
|
332
|
+
pass
|
|
333
|
+
|
|
334
|
+
# 函数重载
|
|
335
|
+
@overload
|
|
336
|
+
def process(x: int) -> int:
|
|
337
|
+
return x * 2
|
|
338
|
+
|
|
339
|
+
@process.register
|
|
340
|
+
def process(x: str) -> str:
|
|
341
|
+
return x.upper()
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### 函数式编程
|
|
345
|
+
|
|
346
|
+
```python
|
|
347
|
+
from vools import Seq, Ops, _, g, iif, pipe
|
|
348
|
+
|
|
349
|
+
# Seq 链式操作
|
|
350
|
+
result = Seq(range(10)).filter(lambda x: x % 2 == 0).map(lambda x: x * 2).collect()
|
|
351
|
+
# [0, 4, 8, 12, 16]
|
|
352
|
+
|
|
353
|
+
# Ops 管道操作
|
|
354
|
+
result = range(10) | Ops.filter(lambda x: x > 3) | Ops.map(lambda x: x * 2) | Ops.sum()
|
|
355
|
+
# 84
|
|
356
|
+
|
|
357
|
+
# 占位符
|
|
358
|
+
f = _ + 1
|
|
359
|
+
print(f(2)) # 3
|
|
360
|
+
|
|
361
|
+
# 箭头函数
|
|
362
|
+
f = g("x, y => x + y")
|
|
363
|
+
print(f(3, 4)) # 7
|
|
364
|
+
|
|
365
|
+
# 条件表达式
|
|
366
|
+
result = iif(True, "yes", "no") # "yes"
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### 柯里化
|
|
370
|
+
|
|
371
|
+
```python
|
|
372
|
+
from vools import curry, stuff
|
|
373
|
+
|
|
374
|
+
@curry
|
|
375
|
+
def add(a, b, c):
|
|
376
|
+
return a + b + c
|
|
377
|
+
|
|
378
|
+
print(add(1)(2)(3)) # 6
|
|
379
|
+
|
|
380
|
+
@stuff
|
|
381
|
+
def multiply(a, b):
|
|
382
|
+
return a * b
|
|
383
|
+
|
|
384
|
+
result = multiply(2)(3)()
|
|
385
|
+
print(result) # 6
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### 响应式编程
|
|
389
|
+
|
|
390
|
+
```python
|
|
391
|
+
from vools import Observable
|
|
392
|
+
|
|
393
|
+
# 创建 Observable
|
|
394
|
+
obs = Observable.from_iterable([1, 2, 3, 4, 5])
|
|
395
|
+
|
|
396
|
+
# 链式操作符
|
|
397
|
+
result = []
|
|
398
|
+
obs.pipe(
|
|
399
|
+
Ops.filter(lambda x: x % 2 == 0),
|
|
400
|
+
Ops.map(lambda x: x * 2),
|
|
401
|
+
Ops.take(2)
|
|
402
|
+
).subscribe(lambda x: result.append(x))
|
|
403
|
+
|
|
404
|
+
print(result) # [4, 8]
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### 编译器自动发现(独立包 vools-bridges)
|
|
408
|
+
|
|
409
|
+
> 需要先安装:`pip install vools-bridges`
|
|
410
|
+
|
|
411
|
+
自动探测本机和 WSL 环境中所有已安装的编译器,无需手动配置 PATH。
|
|
412
|
+
|
|
413
|
+
```python
|
|
414
|
+
from vools_bridges import discover_all, get_discovery_report, configure_from_discovery
|
|
415
|
+
|
|
416
|
+
# 一键发现所有编译器(本机 + WSL)
|
|
417
|
+
result = discover_all(include_wsl=True)
|
|
418
|
+
|
|
419
|
+
# 查看格式化报告
|
|
420
|
+
print(get_discovery_report())
|
|
421
|
+
|
|
422
|
+
# 自动配置管理器
|
|
423
|
+
configure_from_discovery(include_wsl=True)
|
|
424
|
+
|
|
425
|
+
# 检查特定语言是否可用
|
|
426
|
+
from vools_bridges import get_helper
|
|
427
|
+
nim_helper = get_helper('nim')
|
|
428
|
+
if nim_helper.is_available():
|
|
429
|
+
print(f"Nim 编译器路径: {nim_helper.get_compiler_path()}")
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### 跨语言隐式操作符(Scala / Kotlin / Nim)
|
|
433
|
+
|
|
434
|
+
#### Scala
|
|
435
|
+
|
|
436
|
+
```scala
|
|
437
|
+
import com.example.operators.Operators._
|
|
438
|
+
|
|
439
|
+
def genA(): String = "Hello"
|
|
440
|
+
def genB(s: String): String = s"$s, World!"
|
|
441
|
+
|
|
442
|
+
val merged = genA _ #> genB _
|
|
443
|
+
merged() // "Hello, World!"
|
|
444
|
+
|
|
445
|
+
val doubled = List(1, 2, 3) |>> (_ * 2)
|
|
446
|
+
// List(2, 4, 6)
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
#### Kotlin
|
|
450
|
+
|
|
451
|
+
```kotlin
|
|
452
|
+
import com.example.operators.Operators._
|
|
453
|
+
|
|
454
|
+
fun genA(): String = "Hello"
|
|
455
|
+
fun genB(s: String): String = "$s, World!"
|
|
456
|
+
|
|
457
|
+
val merged = genA `#gt` genB
|
|
458
|
+
println(merged()) // "Hello, World!"
|
|
459
|
+
|
|
460
|
+
val doubled = listOf(1, 2, 3).pipeMap { it * 2 }
|
|
461
|
+
// [2, 4, 6]
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
#### Nim
|
|
465
|
+
|
|
466
|
+
```nim
|
|
467
|
+
import operators
|
|
468
|
+
|
|
469
|
+
proc genA(): string = "Hello"
|
|
470
|
+
proc genB(s: string): string = s & ", World!"
|
|
471
|
+
|
|
472
|
+
let merged = compose01(genA, genB)
|
|
473
|
+
echo merged() # "Hello, World!"
|
|
474
|
+
|
|
475
|
+
let doubled = pipeMap(@[1, 2, 3], proc(x: int): int = x * 2)
|
|
476
|
+
echo doubled # @[2, 4, 6]
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## 项目结构
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
vools/
|
|
483
|
+
├── api/ # CLI 命令行接口
|
|
484
|
+
├── actus/ # Actus 动作引擎核心(执行器/工作流/注册表/安全)
|
|
485
|
+
├── concurrent/ # 并发工具集(跨语言桥接委托/队列/线程)
|
|
486
|
+
├── data/ # 增强数据类型(VList/VText/VDate/Table/Qax)
|
|
487
|
+
├── decorators/ # 装饰器(memorize/once/retry/curry/overload/flex_pos)
|
|
488
|
+
├── functional/ # 函数式编程(Seq/Ops/Box/iif/pipe/placeholder)
|
|
489
|
+
├── md/ # Markdown 处理(解析/生成/HTML/模板/预览)
|
|
490
|
+
├── oop/ # 面向对象工具(extend/calltype/method_extend)
|
|
491
|
+
├── reactive/ # 响应式编程(Observable/Subject)
|
|
492
|
+
├── serialize/ # 序列化(codec/json/msgpack/pickle)
|
|
493
|
+
├── sql/ # SQL 引擎(SQLite/PostgreSQL/Spark/方言/构建器)
|
|
494
|
+
├── sys/ # 系统命令(cmd/dll/compile/run/env/fire)
|
|
495
|
+
├── task/ # 任务调度(队列/工作池/线程池/DAG)
|
|
496
|
+
├── utils/ # 工具函数(cache/tools/funcs)
|
|
497
|
+
├── config.py # 全局配置
|
|
498
|
+
└── # bridges/ 已拆分为独立分发包 vools-bridges
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
> `bridge/` 子包已拆分为独立分发包 **vools-bridges**(`pip install vools-bridges`),
|
|
502
|
+
> 通过 `pip install vools[bridges]` 安装后使用 `import vools_bridges`。
|
|
503
|
+
|
|
504
|
+
## 详细文档
|
|
505
|
+
|
|
506
|
+
- [用户指南](USER_GUIDE.md)
|
|
507
|
+
- [快速入门](docs/getting-started/quickstart.md)
|
|
508
|
+
- [函数式编程](docs/functional/index.md)
|
|
509
|
+
- [响应式编程](docs/reactive/index.md)
|
|
510
|
+
- [装饰器](docs/core/decorators.md)
|
|
511
|
+
- [多语言桥接](docs/bridge/index.md)(独立包 vools-bridges)
|
|
512
|
+
- [跨语言操作符](docs/scala_nim_kotlin-implicit-operators/README.md)
|
|
513
|
+
|
|
514
|
+
### 装饰器
|
|
515
|
+
|
|
516
|
+
| 装饰器 | 说明 |
|
|
517
|
+
|--------|------|
|
|
518
|
+
| `memorize(duration=N)` | 时间缓存 |
|
|
519
|
+
| `once()` | 单次执行 |
|
|
520
|
+
| `lazy()` | 延迟执行 |
|
|
521
|
+
| `repeat(cnt, delay)` | 重复执行 |
|
|
522
|
+
| `retry(times, delay)` | 失败重试 |
|
|
523
|
+
| `curry()` | 柯里化 |
|
|
524
|
+
| `overload()` | 函数重载 |
|
|
525
|
+
| `stuff()` | 分步柯里化 |
|
|
526
|
+
|
|
527
|
+
### 函数式工具
|
|
528
|
+
|
|
529
|
+
| 工具 | 说明 |
|
|
530
|
+
|------|------|
|
|
531
|
+
| `Seq(iterable)` | 链式序列操作 |
|
|
532
|
+
| `Ops` | 管道操作符 |
|
|
533
|
+
| `P(func)` | 管道函数包装 |
|
|
534
|
+
| `_`, `_1`, `_2`, `_3` | 占位符 |
|
|
535
|
+
| `g("x, y => ...")` | 箭头函数 |
|
|
536
|
+
| `iif(cond, t, f)` | 条件表达式 |
|
|
537
|
+
| `Box(obj)` | 对象包装器 |
|
|
538
|
+
|
|
539
|
+
### 数据类型
|
|
540
|
+
|
|
541
|
+
| 类型 | 说明 |
|
|
542
|
+
|------|------|
|
|
543
|
+
| `VList(list)` | 增强列表 |
|
|
544
|
+
| `VText(str)` | 增强文本 |
|
|
545
|
+
| `VDate` | 日期处理 |
|
|
546
|
+
|
|
547
|
+
### 响应式
|
|
548
|
+
|
|
549
|
+
| 类型 | 说明 |
|
|
550
|
+
|------|------|
|
|
551
|
+
| `Observable` | 可观察对象 |
|
|
552
|
+
| `Subject` | 主题 |
|
|
553
|
+
| `BehaviorSubject` | 行为主题 |
|
|
554
|
+
| `ReplaySubject` | 回放主题 |
|
|
555
|
+
|
|
556
|
+
## 详细文档
|
|
557
|
+
|
|
558
|
+
- [用户指南](USER_GUIDE.md)
|
|
559
|
+
- [快速入门](docs/getting-started/quickstart.md)
|
|
560
|
+
- [函数式编程](docs/functional/index.md)
|
|
561
|
+
- [响应式编程](docs/reactive/index.md)
|
|
562
|
+
- [装饰器](docs/core/decorators.md)
|
|
563
|
+
- [多语言桥接](docs/bridge/index.md)
|
|
564
|
+
- [跨语言操作符](docs/scala_nim_kotlin-implicit-operators/README.md)
|
|
565
|
+
|
|
566
|
+
## 性能对比
|
|
567
|
+
|
|
568
|
+
vools 通过 **vools-bridges** 独立包桥接 Nim/Rust/Go 等编译型语言,为高频核心函数提供可选的高性能实现。以下是典型硬件上的基准测试结果(实际数据因硬件而异):
|
|
569
|
+
|
|
570
|
+
| 模块 | 函数 | 纯 Python | 桥接加速 | 提升倍数 |
|
|
571
|
+
|------|------|----------|----------|---------|
|
|
572
|
+
| serialize.codec | pickle_encode | ~120 us | ~18 us | 6-8x |
|
|
573
|
+
| serialize.codec | pickle_decode | ~100 us | ~15 us | 6-7x |
|
|
574
|
+
| security.hash | sha256_hex | ~15 us | ~3 us | 5x |
|
|
575
|
+
| security.hash | md5_hex | ~12 us | ~2 us | 6x |
|
|
576
|
+
| security.hash | sha1_hex | ~10 us | ~2 us | 5x |
|
|
577
|
+
| security.hash | sha512_hex | ~18 us | ~4 us | 4.5x |
|
|
578
|
+
| data.seq | base64_encode | ~8 us | ~2 us | 4x |
|
|
579
|
+
| data.seq | base64_decode | ~7 us | ~2 us | 3.5x |
|
|
580
|
+
| serialize | json_encode | ~50 us | ~15 us | 3x |
|
|
581
|
+
| serialize | json_decode | ~45 us | ~12 us | 4x |
|
|
582
|
+
| data.seq | zlib_compress | ~500 us | ~100 us | 5x |
|
|
583
|
+
| data.seq | zlib_decompress | ~200 us | ~50 us | 4x |
|
|
584
|
+
| cache.sigcache | hash_signature | ~50 us | ~8 us | 6x |
|
|
585
|
+
|
|
586
|
+
**注意**:
|
|
587
|
+
- 桥接库为可选增强,未安装时自动使用纯 Python 实现
|
|
588
|
+
- 测试数据为 1KB 左右的小数据,大数据量提升更显著
|
|
589
|
+
- 详细基准测试方法请参见 [基准测试文档](docs/appendix/benchmark.md)
|
|
590
|
+
|
|
591
|
+
## 更新日志
|
|
592
|
+
|
|
593
|
+
详细的版本更新记录请查看 [CHANGELOG.md](CHANGELOG.md)。
|
|
594
|
+
|
|
595
|
+
## 贡献
|
|
596
|
+
|
|
597
|
+
欢迎提交 Issue 和 Pull Request!
|
|
598
|
+
|
|
599
|
+
1. Fork 项目
|
|
600
|
+
2. 创建功能分支 (`git checkout -b feature/AmazingFeature`)
|
|
601
|
+
3. 提交更改 (`git commit -m 'Add AmazingFeature'`)
|
|
602
|
+
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
|
603
|
+
5. 打开 Pull Request
|
|
604
|
+
|
|
605
|
+
## 许可证
|
|
606
|
+
|
|
607
|
+
Apache License 2.0 - 详见 [LICENSE](LICENSE) 文件
|
|
608
|
+
|
|
609
|
+
## 联系方式
|
|
610
|
+
|
|
611
|
+
- 作者: Victor
|
|
612
|
+
- 邮箱: victortop921129@gmail.com
|
|
613
|
+
- 项目: https://github.com/vicTop-cw/vools
|