Skip to main content

Some useful stuff for functions

NamedFunction
pip install useful-functions-easier-life
    namedfunctiontest = NamedFunction(

        name="myfunction",

        execute_function=execute_several_functions_insideout(

            lambda x: x * 100, lambda x: x / 10, lambda x: x * 5, lambda x: x + 1000

        ),

        name_function=lambda: "This is my function",

        str_prefix="Surprise",

        print_before_execution="My function\n",

        str_suffix="Let's go!",

        ljust_prefix=10,

        rjust_prefix=30,

        ljust_suffix=20,

        rjust_suffix=10,

    )





    namedfunctiontest

    Out[3]:                     Surprise  This is my function Let's go!



    #Without namedfunction:

    #ca2

    #Out[7]: <function __main__.execute_several_functions_insideout.<locals>.deco(f)>



    namedfunctiontest(5)

    My function

    Out[6]: 50250.0
ignore_exceptions_decorator
    from random import choice



    @ignore_exceptions_decorator(print_exception=True, exception_value=False, disable=False)

    def testest(number):

        if number == 0:

            return True

        elif number == 1:

            print(number / 0)

        return True





    testex = [testest(choice([0, 1])) for x in range(10)]





    division by zero

    division by zero

    testex

    Out[3]: [True, True, False, True, False, True, True, True, True, True]



    #https://stackoverflow.com/questions/5929107/decorators-with-parameters



    #Blueprint for other useful stuff
execute_several_functions_insideout
    ca2 = execute_several_functions_insideout(

        lambda x: x * 100, lambda x: x / 10, lambda x: x * 5, lambda x: x + 1000

    )



    ca2(5)

    Out[6]: 50250.0



    (1000+5) * 5 / 10 * 100

    Out[18]: 50250.0
execute_several_functions_one_after_another
    allfunctions=lambda x: (x, isinstance(x,str)),lambda x: str(x) + '-1000', lambda x:x*5, lambda x: isinstance(x,str)

    ca=execute_several_functions_one_after_another(allfunctions)





    ca(101)

    Out[4]: [(101, False), '101-1000', 505, False]
ignore_exceptions
    testex = [ignore_exceptions(divmod, 50, choice([0, 1]),exception_value=(0,0)) for x in range(10)]



    testex

    Out[7]:

    [(50, 0),

     (0, 0),

     (0, 0),

     (0, 0),

     (50, 0),

     (50, 0),

     (50, 0),

     (50, 0),

     (50, 0),

     (0, 0)]

Metadata

Release files for useful-functions-easier-life 0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for useful-functions-easier-life 0.14
File Size Uploaded Provenance Actions
useful_functions_easier_life-0.14.tar.gz 5.2 kB Without provenance Details for useful_functions_easier_life-0.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for useful-functions-easier-life 0.14
File Interpreter ABI Platform Actions
useful_functions_easier_life-0.14-py3-none-any.whl Python 3 none any Details for useful_functions_easier_life-0.14-py3-none-any.whl

Total release size: 12.4 kB

Release files / useful_functions_easier_life-0.14.tar.gz

Download URL useful_functions_easier_life-0.14.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
12bfff96590b4fbab16bc26f252a00fe53764d7cf510ad7c62d2c47bc0b0b514
BLAKE2b-256 checksum
How to use checksums
563260e84ecd23a3f9940dac3183d320c9a618af240a929bd636e401a4a8a9f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / useful_functions_easier_life-0.14-py3-none-any.whl

Download URL useful_functions_easier_life-0.14-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
991a67e240c30828e165c79c9e92dd95588f65d42fe1de0ddcd1c0da6fda1b66
BLAKE2b-256 checksum
How to use checksums
59e8dad5da8ed08f9f6937244ba6546e4dd9d85864e31f59a74ffb6e26921a94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for useful-functions-easier-life 0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page