{ "info": { "author": "Tim Savannah", "author_email": "kata198@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "A utility class for parsing command-line arguments.\n\nConstructor:\n\n | @param names list - This is a list of \"names\" which should reflect each argument.\n | @param shortOptions list - This is a list of short (-x val) options. Length should match names. If no short option is available, use 'None'. Omit the leading -\n | @param longOptions list - This is a list of long (--xyz val or --xyz= val) options. If no long option is available, use 'None'. Omit the leading --\n | @param staticOptions list - This is a list of static options (arguments that have meaning just being present, without taking an additional value).\n | Any members of this list will be present in the results of #parse, set to True is present, otherwise False.\n | @param multipleStaticOptions - A dictionary for multiple static arguments that resolve to one value. Key is the \"name\", values are all potential values. Ex: {'cheese' : ['--cheddar', 'gouda'] } presence of either 'gouda' or '--cheddar' in results would set cheese to True, otherwise False.\n | @param allowOtherArguments default False - if False, consider non-specified arguments as errors. Regardless of value, unmatched params will be in 'unmatched' key of return value.\n\nFunctions:\n\n | def parse(args)\n | parse - Parses provided arguments and returns information on them. If using sys.argv, omit the first argument.\n\n | @return - dict keys are\n | 'result' => dictionary of result name->value\n | 'errors' => list of strings of errors or empty list\n | 'warnings' => list of strings of warnings, or empty list\n | 'unmatched' => list of strings of unmatched params, in order\n\nExample:\n\n | In [1]: from ArgumentParser import ArgumentParser\n | In [2]: parser = ArgumentParser(['firstName', 'lastName', 'birthday'], \n | ...: ['f', 'l', 'b'], \n | ...: ['first-name', 'last-name', 'birthday'], \n | ...: ['--citizen'] \n | )\n |\n | In [3]: parser.parse('-f Tim --last-name=savannah --birthday 6/28'.split(' '))\n | Out[3]:\n | {'errors': [],\n | 'result': {'--citizen': False,\n | 'birthday': '6/28',\n | 'firstName': 'Tim',\n | 'lastName': 'savannah'},\n | 'warnings': [],\n | 'unmatched' : []}\n |\n | In [4]: parser.parse('-f Tim --last-name=savannah --citizen'.split(' '))\n | Out[4]:\n | {'errors': [],\n | 'result': {'--citizen': True, 'firstName': 'Tim', 'lastName': 'savannah'},\n | 'warnings': [],\n | 'unmatched': []}\n\nExample2:\n\n | >>> from ArgumentParser import ArgumentParser\n | >>> parser = ArgumentParser(['name'], ['n'], ['name'], None, False)\n | >>> parser.parse('-n hello some other args'.split(' '))\n | {'errors': [\"Unknown argument 'some' (at position 2)\", \"Unknown argument 'other' (at position 3)\", \"Unknown argument 'args' (at position 4)\"], 'result': {'name': 'hello'}, 'unmatched': ['some', 'other', 'args'], 'warnings': []}\n | >>> parser = ArgumentParser(['name'], ['n'], ['name'], None, True)\n | >>> parser.parse('-n hello some other args'.split(' '))\n | {'errors': [], 'result': {'name': 'hello'}, 'unmatched': ['some', 'other', 'args'], 'warnings': []}\n\nExample3:\n\n | >>> import ArgumentParser\n | >>> parser = ArgumentParser.ArgumentParser( ('one', 'two'), ('o', 't'), ('uno', 'dos'), ('x'), {'cheese' : ['cheddar', 'gouda'], 'baby' : {'child', 'infant'}} )\n | >>> parser.parse(['-o', '1', 'cheddar'])\n | {'errors': [], 'result': {'baby': False, 'cheese': True, 'x': False, 'one': '1'}, 'unmatched': [], 'warnings': []}", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "argument parser,argumentparser,argument,parser,argv,sys.argv,commandline,cmd,args", "license": "LGPLv3", "maintainer": null, "maintainer_email": null, "name": "argumentparser", "package_url": "https://pypi.org/project/argumentparser/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/argumentparser/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/argumentparser/1.2.1/", "requires_dist": null, "requires_python": null, "summary": "Python 2/3 compatible commandline argument parser", "version": "1.2.1" }, "last_serial": 1609615, "releases": { "1.2": [ { "comment_text": "", "digests": { "md5": "488a53a4ecb77186dfa71c6633d4a155", "sha256": "a3488ab7df6f83e4dd2d44a4842edd25feb81f9c7baeb5885fcf533953d32aa7" }, "downloads": -1, "filename": "argumentparser-1.2.tar.gz", "has_sig": false, "md5_digest": "488a53a4ecb77186dfa71c6633d4a155", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2701, "upload_time": "2015-04-07T15:08:18", "url": "https://files.pythonhosted.org/packages/93/56/b1a624cad7155c2bfa9f2e61091a9cb59d21c5ee5918ae96d692d6c22d03/argumentparser-1.2.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "dab01673e973a3e6772d37f19436992e", "sha256": "f996cc1ca7b9f7cec470150bdcbaf66c712f4de0d029307c4b25ec9d1b1aee08" }, "downloads": -1, "filename": "argumentparser-1.2.1.tar.gz", "has_sig": false, "md5_digest": "dab01673e973a3e6772d37f19436992e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3980, "upload_time": "2015-04-08T18:11:35", "url": "https://files.pythonhosted.org/packages/29/4f/0e8c08ed6bcb44269e0f044c3a3bab7d3fa4ff1bbb9fb9e501e32ae52a75/argumentparser-1.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dab01673e973a3e6772d37f19436992e", "sha256": "f996cc1ca7b9f7cec470150bdcbaf66c712f4de0d029307c4b25ec9d1b1aee08" }, "downloads": -1, "filename": "argumentparser-1.2.1.tar.gz", "has_sig": false, "md5_digest": "dab01673e973a3e6772d37f19436992e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3980, "upload_time": "2015-04-08T18:11:35", "url": "https://files.pythonhosted.org/packages/29/4f/0e8c08ed6bcb44269e0f044c3a3bab7d3fa4ff1bbb9fb9e501e32ae52a75/argumentparser-1.2.1.tar.gz" } ] }