Skip to main content

Automatically select, check and bundle keyword arguments from 'kwargs' dictionaries

Project description

The documentation has not been created yet - sorry - you will have to make do with the following example code for now:

def exampleFct(aaa, bbb, **kwargs):
    """
        :param aaa: just a dummy.
        :param bbb: just a dummy.
        :return: 'None'.
        
        An example function for using 'ParamBundle' to automatically select, 
        check (for completeness and correct types) and bundle keyword arguments
        into an instance of an enhanced dictionary class, which also and in 
        particular mirrors items to attributes and attributes to items 
        automatically.
    """
     
    try:
           ### determine the mandatory as well as the optional parameters and belonging parameter types ###
           ### and extract, check and bundle the belonging parts of 'kwargs' into 'args'.
           args = ParamBundle()
           args.registerMandatories(ccc=int, ddd=float)
           args.registerOptionals(eee=(int,float,type(None)), fff=None)
           args.update( kwargs )
           
           if args.isComplete() == False:
              print (">>>>>>>>>> MANDATORY PARAMETERS INCOMPLETE <<<<<<<<<<")
           
    except Exception as ee:
           print ("Error in exampleFct: function called with wrong arguments (%s)!" % ee)

Furthermore you should try out:

python paramBundle.py --test

and have a look at the output! Last but not least the code of the belonging selftest() function and the functions called from there can provide some insights.

Further infomations and links can be found on my homepage

https://www.blackward.de

Have Fun!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

paramBundle-0.50-py2.py3-none-any.whl (9.2 kB view hashes)

Uploaded Python 2 Python 3

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