Skip to main content

Cuboid Raptor's Lib Rary, A Garbage Collection Of Garbage For Your Garbage Needs™

Project description

This is a random library I made with random garbage I made that occasionally can help with programming. It’s just the must random code crammed into one poopy doopy thing maintained by a dumbo octopus, so use this at your own risk. Also sorry if the docs are garbage I’m lazy ight

Docs…?

  • crlib.recursion() ; A context manager that lets you temporarily set your recursion depth. Use:

    with crlib.recursion(<some recursion limit here>):
        <do something here>

    Your recursion limit will be reset after.

  • crlib.suppress() ; A suppression context manager, use it with the “with” keyword like crlib.recursion(). This will temporarily suppress stdout and stderr, preventing anything from being printed to console, even with sys.stderr.write. This will, however, not silence error messages, although that’s probably a good thing.

  • crlib.pubsub() ; Class that lets you use a publish subscribe model. You can create an instance, then publish/subscribe to that instance.:

    ps = crlib.pubsub()
    
        def foo(bar):
            return bar + 1
    
        sid = ps.subscribe("baz", foo)
    
        print(ps.publish("baz", [7]))
    
        ps.unsubscribe(sid)

    This will print [8]. There is also crlib.pubsub().clear(), which clears all subscribers and crlib.pubsub().view(), which will pretty print the cache.

  • crlib.find_args(func) ; Tries, tries, to return a list of all arguments of function.

  • crlib.blob(in, out) ; Takes a binary input file and converts it into a python script so that when said script is imported and the .unblob(out) method is run, it unblobs it’s data to out. Can be used for easy pyinstallering.

  • crlib.test() ; idfk figure it out

  • crlib.gc() ; Nuclear bomb every variable in namespace, absolutely the most performant GC out there.

  • crlib.cfor() ; C-style for loops

  • crlib.lazy_import() ; Lazy import, you can do it in bulk with lists, and use semicolons as import as and slashes are try: import except; import For example, "numpy;np" imports numpy as np, and ujson;json/json tries to import ujson as json, and if ujson doesn’t exist on your python installation, it imports json instead.

  • crlib.nh_cache() ; FIFO cache that supports non-hashable objects and can deepcopy return values if needed.

  • crlib.lru_cache() ; Extension of functools.lru_cache that supports deepcopying results with copy arg

  • crlib.silence(func) ; Runs functions and prints tb + return error message and continues if error

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

crlib-1.2.1.tar.gz (18.4 kB view details)

Uploaded Source

File details

Details for the file crlib-1.2.1.tar.gz.

File metadata

  • Download URL: crlib-1.2.1.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for crlib-1.2.1.tar.gz
Algorithm Hash digest
SHA256 267f96c0241a8a350178b0b16fa1a3604b5fc2f389d088c070802ad0103ac791
MD5 7b716f365ae14a299b3315107bffc82c
BLAKE2b-256 bc127dd73308ca64168b0be1c2ba75ef1566371b817bcda2f60f73c729bbc208

See more details on using hashes here.

Supported by

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