{ "info": { "author": "Andrew Lane", "author_email": "contact@lungers.com", "bugtrack_url": null, "classifiers": [], "description": "# ini-parser\n\n> An ini format parser and serializer for Python.\n\nSections are treated as nested dictionaries. Items before the first heading are saved on the object directly.\n\n## Usage\n\nConsider an ini-file `config.ini` that looks like this:\n\n```ini\n; this comment is being ignored\nscope = global\n\n[database]\nuser = dbuser\npassword = dbpassword\ndatabase = use_this_database\n\n[paths.default]\ndatadir = /var/lib/data\narray[] = first value\narray[] = second value\narray[] = third value\n```\n\nYou can read, manipulate and write the ini-file like so:\n\n```python\nimport ini\n\nconfig = ini.parse(open('config.ini').read())\n\nconfig['scope'] = 'local'\nconfig['database']['database'] = 'use_another_database'\nconfig['paths']['default']['tmpdir'] = '/tmp'\ndel config['paths']['default']['datadir']\nconfig['paths']['default']['array'].append('fourth value')\n\nwith open('config_modified.ini', 'w+') as f:\n f.write(ini.stringify(config, {'section': 'section'}))\n```\n\nThis will result in a file called `config_modified.ini` being written to the filesystem with the following content:\n\n```ini\n[section]\nscope = local\n\n[section.database]\nuser = dbuser\npassword = dbpassword\ndatabase = use_another_database\n\n[section.paths.default]\narray[] = first value\narray[] = second value\narray[] = third value\narray[] = fourth value\ntmpdir = /tmp\n```\n\n## API\n\n### decode(inistring)\n\nDecode the ini-style formatted `inistring` into a nested object.\n\n### parse(inistring)\n\nAlias for `decode(inistring)`\n\n### encode(object, [options])\n\nEncode the object `object` into an ini-style formatted string. If the\noptional parameter `section` is given, then all top-level properties\nof the object are put into this section and the `section`-string is\nprepended to all sub-sections, see the usage example above.\n\nThe `options` object may contain the following:\n\n- `section` A string which will be the first `section` in the encoded\n ini data. Defaults to none.\n- `whitespace` Boolean to specify whether to put whitespace around the\n `=` character. By default, whitespace is omitted, to be friendly to\n some persnickety old parsers that don't tolerate it well. But some\n find that it's more human-readable and pretty with the whitespace.\n\nIf a `string` options is passed in, then it is assumed to be the `section` value.\n\n### stringify(object, [options])\n\nAlias for `encode(object, [options])`\n\n### safe(val)\n\nEscapes the string `val` such that it is safe to be used as a key or\nvalue in an ini-file. Basically escapes quotes. For example\n\n```python\nini.safe('\"unsafe string\"')\n```\n\nwould result in\n\n```python\n\"\\\"unsafe string\\\"\"\n```\n\n### unsafe(val)\n\nUnescapes the string `val`", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/YouTwitFace/ini-parser", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ini-parser", "package_url": "https://pypi.org/project/ini-parser/", "platform": "", "project_url": "https://pypi.org/project/ini-parser/", "project_urls": { "Homepage": "https://github.com/YouTwitFace/ini-parser" }, "release_url": "https://pypi.org/project/ini-parser/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "An ini parser/serializer in Python", "version": "1.1.0" }, "last_serial": 5542731, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f4da8301a6e44b34f1cce4b507791093", "sha256": "e7d3ece6e98728af0870d95f6b363d9e29755dfb1a5e141c891bbeb890f38261" }, "downloads": -1, "filename": "ini-parser-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f4da8301a6e44b34f1cce4b507791093", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3902, "upload_time": "2019-07-16T18:18:18", "url": "https://files.pythonhosted.org/packages/6b/64/89ce35569171afe624a10a9efe339d231190323ab1f99412e07d503a2657/ini-parser-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "f1900e6ef679313861e969dae4b2e6ab", "sha256": "a9be131f488ba6bba5abd440b2e6c02e2032d9b578cef024864c78ad02d6f609" }, "downloads": -1, "filename": "ini-parser-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f1900e6ef679313861e969dae4b2e6ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3982, "upload_time": "2019-07-16T21:18:07", "url": "https://files.pythonhosted.org/packages/2e/ed/843d77644173bc9c3d8598a232112431c53561592b79aaef7449f14ec61e/ini-parser-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f1900e6ef679313861e969dae4b2e6ab", "sha256": "a9be131f488ba6bba5abd440b2e6c02e2032d9b578cef024864c78ad02d6f609" }, "downloads": -1, "filename": "ini-parser-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f1900e6ef679313861e969dae4b2e6ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3982, "upload_time": "2019-07-16T21:18:07", "url": "https://files.pythonhosted.org/packages/2e/ed/843d77644173bc9c3d8598a232112431c53561592b79aaef7449f14ec61e/ini-parser-1.1.0.tar.gz" } ] }