Skip to main content

Overview

The funcinputs project holds the class FuncInput. The objects of this class represent the entire input that can be passed to a function when the function is called. Each FuncInput object has a list of positional arguments (the property is called args) and a dict of keyword arguments (the property is called kwargs). One can do everything with a FuncInput object that can be done with a list or a dict e.g. indexers, appending, or updating.

Installation

To install funcinputs, you can use pip. Open your terminal and run:

pip install funcinputs

Usage

Once funcinputs is installed, you can use it as follows:

from funcinputs import FuncInput

x = FuncInput(args=[9, "foo"], kwargs={"bar":12.75})
print(x) # FuncInput(args=[9, 'foo'], kwargs={'bar': 12.75})
x += FuncInput(args=[2], kwargs={"baz":"spam"})
print(x) # FuncInput(args=[9, 'foo', 2], kwargs={'bar': 12.75, 'baz': 'spam'})
x.append(19)
print(x) # FuncInput(args=[9, 'foo', 2, 19], kwargs={'bar': 12.75, 'baz': 'spam'})

Features

The class FuncInput combines the features of list and dict:

  • Properties:

    • args: represents positional arguments in the shape of a list

    • kwargs: represents the keyword-arguments as a dict (the keys must be limited to the type str)

  • Methods:

    • append: Appends to args

    • clear_all: Combines clear_args and clear_kwargs

    • clear_args: Clears args

    • clear_kwargs: Clears kwargs

    • copy: Makes a copy

    • count: Counts in args

    • exec: Executes a function and returns the result

    • extend: Extends args

    • get: Gets value from kwargs

    • index: Gets index from args

    • insert: Inserts into args

    • items: Returns kwargs.items() converted to a list

    • keys: Returns kwargs.keys() converted to a list

    • pop: Pops value in kwargs if the key is of the type str, otherwise args

    • popitem: Pops item in kwargs

    • remove: Removes from args

    • reverse: Reverses args

    • setdefault: Sets default for kwargs

    • sort: Sorts args

    • update: Updates kwargs

    • values: Returns kwargs.values() converted to a list

  • Other Features:

    • addition: Creates a FuncInput object from two other objects. The property args and the property kwargs are each joined together

    • indexing: If the key is of the type str then kwargs is altered in the normal way, otherwise args

License

This project is licensed under the MIT License.

Credits

Thank you for using funcinputs!

Metadata

Release files for funcinputs 1.1.2

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

Source distribution (sdist)

Source distribution for funcinputs 1.1.2
File Size Uploaded
funcinputs-1.1.2.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for funcinputs 1.1.2
File Interpreter ABI Platform
funcinputs-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / funcinputs-1.1.2.tar.gz

Download URL funcinputs-1.1.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
926ca33b6a741efb66cd1e30b635113fb5a2e4d309f0445388f71aa0b95718a7
BLAKE2b-256 checksum
How to use checksums
82c81b5c134149ab252dd017e1fa7d5683a2110b4493c5c7d2f79a8e0f93b6d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / funcinputs-1.1.2-py3-none-any.whl

Download URL funcinputs-1.1.2-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ca068aa5447ee3379f02665b6a3f22aae2a2d8b92d202ab2cdcad8f06f3c495
BLAKE2b-256 checksum
How to use checksums
c397e9000328878c969cdebeba4c01d013562d3c9131e059f0b18cec2d0cadc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

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