Skip to main content

SDK of vortezwohl.

Project description

vortezwohl-sdk

Useful Python SDKs

Installation

  • With pip

    pip install -U vortezwohl
    
  • With uv

    uv add -U vortezwohl
    
  • From github

    pip install -U git+https://github.com/vortezwohl/vortezwohl-sdk.git
    

Quick Start

  • Thread Pool

    • Import SDKs

      import random
      import time
      
      from vortezwohl.concurrent import ThreadPool
      
    • Create callables

      def job1(x: int, y: int) -> int:
          res = x + y
          time.sleep(res / 2)
          return res
      
      
      def job2() -> int:
          _delay = random.randint(1, 4)
          time.sleep(_delay / 2)
          return _delay
      
      
      def job3(x) -> int:
          time.sleep(x / 2)
          return x
      
    • Gather jobs (tasks)

      with ThreadPool() as t:
          for fn, param, result in t.gather(jobs=[job1, job1, job1, job2, job2, job3], 
                                          arguments=[(1, 2), (2, 3), {'x': 3, 'y': 4}, None, None, 5]):
              print('fn={}, param={}, result={}'.format(fn, param, result))
      

      stdout:

      fn=<function job2 at 0x00000183016C0180>, param=None, result=1
      fn=<function job1 at 0x00000183013B63E0>, param=(1, 2), result=3
      fn=<function job2 at 0x00000183016C0180>, param=None, result=3
      fn=<function job1 at 0x00000183013B63E0>, param=(2, 3), result=5
      fn=<function job3 at 0x00000183016C0220>, param=5, result=5
      fn=<function job1 at 0x00000183013B63E0>, param={'x': 3, 'y': 4}, result=7
      
    • Submit jobs respectively

      with ThreadPool() as t:
          t.submit(job1, 1, 2)
          t.submit(job1, 2, 3)
          t.submit(job1, x=3, y=4)
          t.submit(job2)
          t.submit(job2)
          t.submit(job3, 5)
          for fn, param, result in t.next_result:
              print('fn={}, param={}, result={}'.format(fn, param, result))
      

      stdout:

      fn=<function job2 at 0x000001B82B61C0E0>, param=None, result=2
      fn=<function job1 at 0x000001B82B31A480>, param=(1, 2), result=3
      fn=<function job2 at 0x000001B82B61C0E0>, param=None, result=4
      fn=<function job1 at 0x000001B82B31A480>, param=(2, 3), result=5
      fn=<function job3 at 0x000001B82B61C180>, param=(5,), result=5
      fn=<function job1 at 0x000001B82B31A480>, param={'x': 3, 'y': 4}, result=7
      
  • Seed Generator

    • Import SDKs

      import random
      
      from vortezwohl.random import next_seed
      
    • Do random stuff

      for _ in range(10):
          next_seed()
          print(random.randint(1, 10))
      

      stdout:

      3
      4
      4
      8
      9
      6
      8
      7
      1
      10
      

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vortezwohl-0.0.6.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vortezwohl-0.0.6-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file vortezwohl-0.0.6.tar.gz.

File metadata

  • Download URL: vortezwohl-0.0.6.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for vortezwohl-0.0.6.tar.gz
Algorithm Hash digest
SHA256 a41c5702879696818cff294036bc2c3d27fa6c4b4c1a322bf77c6fcdde97c6bf
MD5 40294c3c85b2e7be8fd1fb9318adfd7a
BLAKE2b-256 47758a2d77dc2326f438966e62a936943694c36d3cca5c4bb78eccf97d73cb6c

See more details on using hashes here.

File details

Details for the file vortezwohl-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: vortezwohl-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for vortezwohl-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3fa6c1157b6e8d6b2a868b81591e4d86c1791fb52d35512b4cbbd74f5529c9c4
MD5 14d7dbe9411de9ed23c43a3face28f71
BLAKE2b-256 808a94456e1e82a1a464a41ef463b951769ecd7750393d5ecb32baed96303182

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page