{ "info": { "author": "Martin Claus", "author_email": "mclaus@geomar.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "[![pipeline status](https://git.geomar.de/martin-claus/py-namelist/badges/develop/pipeline.svg)](https://git.geomar.de/martin-claus/py-namelist/commits/develop)\n[![coverage report](https://git.geomar.de/martin-claus/py-namelist/badges/develop/coverage.svg)](https://git.geomar.de/martin-claus/py-namelist/commits/develop)\n\npy-namelist\n===========\nParse Fortran Namelists to dict-like objects and back\n\n## Download\nTo get the latest release do\n```bash\ngit clone https://git.geomar.de:martin-claus/py-namelist.git --branch v0.1.0 --depth=1\n```\nor, if you prefer the latest unstable version\n```bash\ngit clone https://git.geomar.de:martin-claus/py-namelist.git\n```\n\n\n## Usage\nTo parse a namelist file you call `parse_namelist_file(fobj)` where fobj is a file-like object offering a `read()` and `seek()` method\n(usually the standard python file object). Alternatively, you can parse a string using `parse_namelist_string(str)`.\n```python\nimport namelist\nwith open(your_nml_file) as fobj:\n\tnmls = namelist.parse_namelist_file(fobj)\n```\n`nmls` will be a list of instances of the `Namelist` class.\n\n`Namelist` is a subclass of `OrderedDict` (or `dict` if you use Python < 2.7).\nA `Namelist` instance, `nml`, is initialized with an name and optionally with initial values.\n\n```python\nnml = Namelist(\"param\", ((\"key1\", val1), ...))\n```\n\nThe name attribute will set the read-only property name of `nml`. To change, add or delete values the\nsame methods are available as for `dict`.\n```python\nprint nml.name\nnml.update({\"eggs\": 1, \"spam\": [1, 2, 3]})\ndel(nml[\"param\"])\n```\n\nTo create a Fortran readable string representation of the `Namelist` instance, just use the `str()` build-in\n```python\ns = str(nml)\n```\nor just\n```python\nprint(nml)\n```\n\nA string representation of the `Namelist` instance that can be used by `eval()` to create copies of it can be created by `repr()`\n```python\nprint repr(nml)\n```\n\n**Note**: The parsing of namelist does not have to strictly follow the Fortran standard. Hence, some namelists that are perfectly accepted by some Fortran version are not guaranteed to be correctly parsed by `parse_namelist_string()`. Always check the content of your `Namelist` object. If you do find a namelist that does not work, please create an issue at together with the namelist that does not work.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://git.geomar.de/martin-claus/py-namelist", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "namelist", "package_url": "https://pypi.org/project/namelist/", "platform": "", "project_url": "https://pypi.org/project/namelist/", "project_urls": { "Homepage": "https://git.geomar.de/martin-claus/py-namelist" }, "release_url": "https://pypi.org/project/namelist/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Parsing Fortran namelists to Python dictionaries and back.", "version": "0.1.0" }, "last_serial": 4340375, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6fd06ad4daa6626e97aadd06d9cc3f6c", "sha256": "0fff9bd6d1beaa1ecbf5d5466062cdbce5d2b66fba9c5efad8ddd0544d2f803c" }, "downloads": -1, "filename": "namelist-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6fd06ad4daa6626e97aadd06d9cc3f6c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11799, "upload_time": "2018-10-04T13:42:21", "url": "https://files.pythonhosted.org/packages/66/ab/75336718a50474f56836fe5dd66cae6a6da041fc971856b045b361a79066/namelist-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f2c3aa9174ea6ab73538e6ddaf19a4e5", "sha256": "790a23227a76b491bcd8639ba9afbd912f2a5647082be4bfa43c8ff2c1f9d25b" }, "downloads": -1, "filename": "namelist-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f2c3aa9174ea6ab73538e6ddaf19a4e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4306, "upload_time": "2018-10-04T13:42:22", "url": "https://files.pythonhosted.org/packages/b2/65/cffc162fe03fccd43652dd22bc477f290edd39321866f36de5efb1574f83/namelist-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6fd06ad4daa6626e97aadd06d9cc3f6c", "sha256": "0fff9bd6d1beaa1ecbf5d5466062cdbce5d2b66fba9c5efad8ddd0544d2f803c" }, "downloads": -1, "filename": "namelist-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6fd06ad4daa6626e97aadd06d9cc3f6c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11799, "upload_time": "2018-10-04T13:42:21", "url": "https://files.pythonhosted.org/packages/66/ab/75336718a50474f56836fe5dd66cae6a6da041fc971856b045b361a79066/namelist-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f2c3aa9174ea6ab73538e6ddaf19a4e5", "sha256": "790a23227a76b491bcd8639ba9afbd912f2a5647082be4bfa43c8ff2c1f9d25b" }, "downloads": -1, "filename": "namelist-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f2c3aa9174ea6ab73538e6ddaf19a4e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4306, "upload_time": "2018-10-04T13:42:22", "url": "https://files.pythonhosted.org/packages/b2/65/cffc162fe03fccd43652dd22bc477f290edd39321866f36de5efb1574f83/namelist-0.1.0.tar.gz" } ] }