chocolate-0.0.2/0000755000175000017500000000000013662244506013362 5ustar rleerlee00000000000000chocolate-0.0.2/PKG-INFO0000644000175000017500000000263413662244506014464 0ustar rleerlee00000000000000Metadata-Version: 2.1 Name: chocolate Version: 0.0.2 Summary: An improvement to Python's kwargs Home-page: https://github.com/seungjaeryanlee/chocolate Author: Seungjae Ryan Lee Author-email: seungjaeryanlee@github.com License: UNKNOWN Description: # Chocolate **Chocolate** is a Python package that improves Python's `**kwargs`. ```python from chocolate import filter_args # Here is some function. def example_function(arg1, arg2: int, arg3=3, arg4: str = ""): print(f"{arg1} {arg2} {arg3} {arg4}") # We can give this function a dictionary of arguments using **kwargs. kwargs = {"arg1": 1, "arg2": 2, "arg4": "4"} example_function(**kwargs) # But what if the **kwargs dictionary has additional keys? broken_kwargs = {"arg1": "This", "arg2": "does", "undefined_arg": "not", "arg3": "work"} try: example_function(**broken_kwargs) except Exception as exception: print(exception) # Chocolate can take care of that! example_function(**filter_args(broken_kwargs, example_function)) ``` Platform: UNKNOWN Classifier: Programming Language :: Python :: 3 Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Requires-Python: >=3.6 Description-Content-Type: text/markdown chocolate-0.0.2/README.md0000644000175000017500000000135713662244325014646 0ustar rleerlee00000000000000# Chocolate **Chocolate** is a Python package that improves Python's `**kwargs`. ```python from chocolate import filter_args # Here is some function. def example_function(arg1, arg2: int, arg3=3, arg4: str = ""): print(f"{arg1} {arg2} {arg3} {arg4}") # We can give this function a dictionary of arguments using **kwargs. kwargs = {"arg1": 1, "arg2": 2, "arg4": "4"} example_function(**kwargs) # But what if the **kwargs dictionary has additional keys? broken_kwargs = {"arg1": "This", "arg2": "does", "undefined_arg": "not", "arg3": "work"} try: example_function(**broken_kwargs) except Exception as exception: print(exception) # Chocolate can take care of that! example_function(**filter_args(broken_kwargs, example_function)) ``` chocolate-0.0.2/chocolate/0000755000175000017500000000000013662244506015323 5ustar rleerlee00000000000000chocolate-0.0.2/chocolate/__init__.py0000644000175000017500000000006213662244266017435 0ustar rleerlee00000000000000from .filter import * __all__ = ["filter_args"] chocolate-0.0.2/chocolate/filter.py0000644000175000017500000000045013662244255017162 0ustar rleerlee00000000000000import inspect def _get_subdict(original_dict, subdict_keys): return {k:v for k,v in original_dict.items() if k in subdict_keys} def filter_args(all_kwargs, func): args = inspect.getfullargspec(func).args filtered_kwargs = _get_subdict(all_kwargs, args) return filtered_kwargs chocolate-0.0.2/chocolate.egg-info/0000755000175000017500000000000013662244506017015 5ustar rleerlee00000000000000chocolate-0.0.2/chocolate.egg-info/PKG-INFO0000644000175000017500000000263413662244506020117 0ustar rleerlee00000000000000Metadata-Version: 2.1 Name: chocolate Version: 0.0.2 Summary: An improvement to Python's kwargs Home-page: https://github.com/seungjaeryanlee/chocolate Author: Seungjae Ryan Lee Author-email: seungjaeryanlee@github.com License: UNKNOWN Description: # Chocolate **Chocolate** is a Python package that improves Python's `**kwargs`. ```python from chocolate import filter_args # Here is some function. def example_function(arg1, arg2: int, arg3=3, arg4: str = ""): print(f"{arg1} {arg2} {arg3} {arg4}") # We can give this function a dictionary of arguments using **kwargs. kwargs = {"arg1": 1, "arg2": 2, "arg4": "4"} example_function(**kwargs) # But what if the **kwargs dictionary has additional keys? broken_kwargs = {"arg1": "This", "arg2": "does", "undefined_arg": "not", "arg3": "work"} try: example_function(**broken_kwargs) except Exception as exception: print(exception) # Chocolate can take care of that! example_function(**filter_args(broken_kwargs, example_function)) ``` Platform: UNKNOWN Classifier: Programming Language :: Python :: 3 Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Requires-Python: >=3.6 Description-Content-Type: text/markdown chocolate-0.0.2/chocolate.egg-info/SOURCES.txt0000644000175000017500000000030013662244506020672 0ustar rleerlee00000000000000README.md setup.py chocolate/__init__.py chocolate/filter.py chocolate.egg-info/PKG-INFO chocolate.egg-info/SOURCES.txt chocolate.egg-info/dependency_links.txt chocolate.egg-info/top_level.txtchocolate-0.0.2/chocolate.egg-info/dependency_links.txt0000644000175000017500000000000113662244506023063 0ustar rleerlee00000000000000 chocolate-0.0.2/chocolate.egg-info/top_level.txt0000644000175000017500000000001213662244506021540 0ustar rleerlee00000000000000chocolate chocolate-0.0.2/setup.cfg0000644000175000017500000000004613662244506015203 0ustar rleerlee00000000000000[egg_info] tag_build = tag_date = 0 chocolate-0.0.2/setup.py0000644000175000017500000000127513662244433015100 0ustar rleerlee00000000000000import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="chocolate", # Replace with your own username version="0.0.2", author="Seungjae Ryan Lee", author_email="seungjaeryanlee@github.com", description="An improvement to Python's kwargs", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/seungjaeryanlee/chocolate", packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], python_requires='>=3.6', )