{ "info": { "author": "Per Ake Mattias", "author_email": "PerAkeMattias@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Utilities" ], "description": "**About** \r\n \r\ngoldfinch is simple package which removes invalid filename characters from a filename. Pass in a string or unicode (with or without invalid characters) and get valid filename returned (as unicode). \r\n\r\nIn general, goldfinch will remove invalid filename characters like <>:\"/\\|?* and characters above the 0-255 character set. The default is is to attempt to convert to ascii characters using _unicodedata_.\r\n\r\n**Install**\r\n\r\npip install goldfinch \r\nor \r\neasy_install -U goldfinch \r\n\r\n**Why use goldfinch**\r\n \r\nThe only real usecase for this package is when one creates filenames on the fly and there is no way of knowing what exactly will be passed as the filename. I find it particularly useful when I scrape websites. \r\n\r\nSo, instead of this happening: \r\n\t>>> fileName = 'this is a filename with some invalid characters in it <>:\"/\\|?*'\r\n\t>>> file = open(fileName,\"w\")\r\n\tTraceback (most recent call last):\r\n\tFile \"\", line 1, in \r\n\tIOError: [Errno 2] No such file or directory: 'this is a filename with some invalid characters in it <>:\"/\\\\|?*' \r\n\r\nDo this:\r\n\t>>> from goldfinch import validFileName as vfn \r\n\t>>> fileName = 'this is a filename with some invalid characters in it <>:\"/\\|?*' \r\n\t>>> file = open(vfn(fileName),\"w\") \r\n\r\n**Examples** \r\n \r\nThere are three (space, initCap, and ascii) options available when normalizing a filename.\r\n \r\nThe default is 'space=\"underscore\", initCap=True, ascii=True'.\r\n \r\n- For space the options are underscore, remove, and keep. The default is underscore which will replace a space with an underscore (_).\r\n\r\n- initCap is a True & False option. True which is the default will convert the first character in a word to cap and leave all others lowercase.\r\n \r\n- ascii is also a True & False option. Once again True is the default which will convert something like this \u00c5\u00e5\u00c4\u00e4\u00d6 to this AaAaO. False will leave characters as-is. \r\n\r\nUse default setting:\r\n\t>>> fileName = 'THIS IS a filename with \u00c5\u00e5\u00c4\u00e4\u00d6 some characters that will not work like these: <>:\"/\\|?*'\r\n\t>>> vfn(fileName)\r\n\t'This_Is_A_Filename_With_Aaaao_Some_Characters_That_Will_Not_Work_Like_These' \r\n\r\nDefault with unicode input: \r\n\t>>> fileName = u'THIS IS a filename with \u00c5\u00e5\u00c4\u00e4\u00d6 some characters that will not work like these: <>:\"/\\|?*'\r\n\t>>> vfn(fileName) \r\n\t'This_Is_A_Filename_With_Aaaao_Some_Characters_That_Will_Not_Work_Like_These' \r\n\r\nWith initCap = False: \r\n\t>>> vfn(fileName, initCap = False) \r\n\t'THIS_IS_a_filename_with_AaAaO_some_characters_that_will_not_work_like_these_' \r\n\r\nWith space = 'remove': \r\n\t>>> vfn(fileName, space = 'remove') \r\n\t'ThisIsAFilenameWithAaaaoSomeCharactersThatWillNotWorkLikeThese'", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/PerAkeMattias/goldfinch", "keywords": "filename", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "goldfinch", "package_url": "https://pypi.org/project/goldfinch/", "platform": "Any", "project_url": "https://pypi.org/project/goldfinch/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/PerAkeMattias/goldfinch" }, "release_url": "https://pypi.org/project/goldfinch/0.4/", "requires_dist": null, "requires_python": null, "summary": "Use to make sure that filenames will always be valid- Now in Python 3 too", "version": "0.4" }, "last_serial": 1300231, "releases": { "0.1": [], "0.2": [], "0.3": [ { "comment_text": "", "digests": { "md5": "cac07687e144fef38db8418e675f2ead", "sha256": "a2289307d76afc504503cab9eeda32581b662241d57cf8acb5af59c838be0b67" }, "downloads": -1, "filename": "goldfinch-0.3.zip", "has_sig": false, "md5_digest": "cac07687e144fef38db8418e675f2ead", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2967, "upload_time": "2014-10-02T02:26:10", "url": "https://files.pythonhosted.org/packages/8a/f2/326ecba2609a4aaf041e390813fdeea34fb5fc75c814dd4e97a45f5b6133/goldfinch-0.3.zip" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "2f2a7470997c091993fa05f186f64c4a", "sha256": "18dfce7e074820bc15272d6b9e71449f4730539d20b5ac992a982837783dbeff" }, "downloads": -1, "filename": "goldfinch-0.3.1.tar.gz", "has_sig": false, "md5_digest": "2f2a7470997c091993fa05f186f64c4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2669, "upload_time": "2014-10-03T02:04:28", "url": "https://files.pythonhosted.org/packages/c3/8a/177358d689e96d49c5e77a49cfc36c899f972aeaad99f352229c9a3041de/goldfinch-0.3.1.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "d8e5664a6d13cbba483b5b77bab9451e", "sha256": "cbfdc568b967046f8c1a54d2c29a7faa09ad5a52ee3061f962259bce5b63791f" }, "downloads": -1, "filename": "goldfinch-0.4.tar.gz", "has_sig": false, "md5_digest": "d8e5664a6d13cbba483b5b77bab9451e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2784, "upload_time": "2014-10-04T01:50:01", "url": "https://files.pythonhosted.org/packages/ea/8a/b75ba84e6151e8496ec612be847847b9d00e074c4222a4b443c0782a0b8a/goldfinch-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d8e5664a6d13cbba483b5b77bab9451e", "sha256": "cbfdc568b967046f8c1a54d2c29a7faa09ad5a52ee3061f962259bce5b63791f" }, "downloads": -1, "filename": "goldfinch-0.4.tar.gz", "has_sig": false, "md5_digest": "d8e5664a6d13cbba483b5b77bab9451e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2784, "upload_time": "2014-10-04T01:50:01", "url": "https://files.pythonhosted.org/packages/ea/8a/b75ba84e6151e8496ec612be847847b9d00e074c4222a4b443c0782a0b8a/goldfinch-0.4.tar.gz" } ] }