File: PKG-INFO

package info (click to toggle)
python-chocolate 0.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 100 kB
  • sloc: python: 29; makefile: 3
file content (41 lines) | stat: -rw-r--r-- 1,436 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Metadata-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