{
"info": {
"author": "Aaron Iles",
"author_email": "aaron.iles@gmail.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"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.2",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": ".. _background:\n\nBackground\n----------\n\n`libmagic `_ is the library that commonly\nsupports the *file* command on Unix system, other than Max OSX which has its\nown implementation. The library handles the loading of *database* files that\ndescribe the magic numbers used to identify various file types, as well as the\nassociated mime types. The library also handles character set detections.\n\n.. _installation:\n\nInstallation\n------------\n\nBefore installing *filemagic*, the *libmagic* library will need to be\navailabile. To test this is the check for the presence of the *file* command\nand/or the *libmagic* man page. ::\n\n $ which file\n $ man libmagic\n\nOn Mac OSX, Apple has implemented their own version of the file command.\nHowever, *libmagic* can be installed using `homebrew\n`_ ::\n\n $ brew install libmagic\n\nAfter *brew* finished installing, the test for the *libmagic* man page should\npass.\n\nNow that the presence of *libmagic* has been confirmed, use `pip\n`_ to install filemagic. ::\n\n $ pip install filemagic\n\nThe *magic* module should now be availabe from the Python shell. ::\n\n >>> import magic\n\nThe next section will describe how to use the *magic.Magic* class to\nidentify file types.\n\n.. _usage:\n\nUsage\n-----\n\nThe *magic* module uses `ctypes\n`_ to wrap the primitives from\n*libmagic* in the more user friendly *magic.Magic* class. This class\nhandles initialization, loading databases and the release of resources. ::\n\n >>> import magic\n\nTo ensure that resources are correctly released by *magic.Magic*, it's\nnecessary to either explicitly call *magic.Magic.close* on instances,\nor use ``with`` statement. ::\n\n >>> with magic.Magic() as m:\n ... pass\n ...\n\n*magic.Magic* supports context managers which ensures resources are\ncorrectly released at the end of the ``with`` statements irrespective of any\nexceptions.\n\nTo identify a file from it's filename, use the\n*magic.Magic.id_filename()* method. ::\n\n >>> with magic.Magic() as m:\n ... m.id_filename('setup.py')\n ...\n 'Python script, ASCII text executable'\n\nSimilarily to identify a file from a string that has already been read, use the\n*magic.Magic.id_buffer* method. ::\n\n >>> with magic.Magic() as m:\n ... m.id_buffer('#!/usr/bin/python\\n')\n ...\n 'Python script, ASCII text executable'\n\nTo identify with mime type, rather than a textual description, pass the\n*magic.MAGIC_MIME_TYPE* flag when creating the *magic.Magic*\ninstance. ::\n\n >>> with magic.Magic(flags=magic.MAGIC_MIME_TYPE) as m:\n ... m.id_filename('setup.py')\n ...\n 'text/x-python'\n\nSimilarily, *magic.MAGIC_MIME_ENCODING* can be passed to return the\nencoding type. ::\n\n >>> with magic.Magic(flags=magic.MAGIC_MIME_ENCODING) as m:\n ... m.id_filename('setup.py')\n ...\n 'us-ascii'\n\n.. _unicode:\n\nMemory management\n-----------------\n\nThe *libmagic* library allocates memory for its own use outside that Python.\nThis memory needs to be released when a *magic.Magic* instance is no\nlonger needed. The preferred way to doing this is to explicitly call the\n*magic.Magic.close* method or use the ``with`` statement, as\ndescribed above.\n\nStarting with version 1.4 *magic.Magic* this memory will be\nautomatically cleaned up when the instance is garbage collected. However,\nunlike CPython, some Python interpreters such as `PyPy `_,\n`Jython `_ and `IronPython `_ do\nnot have deterministic garbage collection. Because of this, *filemagic* will\nissue a warning if it automatically cleans up resources.\n\nUnicode and filemagic\n---------------------\n\nOn both Python2 and Python3, *magic.Magic*'s methods will encode any\nunicode objects (the default string type for Python3) to byte strings before\nbeing passed to *libmagic*. On Python3, returned strings will be decoded to\nunicode using the default encoding type. The user **should not** be concerned\nwhether unicode or bytes are passed to *magic.Magic* methods. However,\nthe user **will** need to be aware that returned strings are always unicode on\nPython3 and byte strings on Python2.\n\n.. _issues:\n\nReporting issues\n----------------\n\nThe source code for *filemagic* is hosted on\n`Github `_.\nProblems can be reported using Github's\n`issues tracking `_ system.\n\n*filemagic* has been tested against *libmagic* 5.11. Continuous integration\nis provided by `Travis CI `_. The current build status\nis |build_status|.\n\n.. |build_status| image:: https://secure.travis-ci.org/aliles/filemagic.png?branch=master\n :target: http://travis-ci.org/#!/aliles/filemagic",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://filemagic.readthedocs.org",
"keywords": null,
"license": "ASL",
"maintainer": null,
"maintainer_email": null,
"name": "filemagic",
"package_url": "https://pypi.org/project/filemagic/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/filemagic/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "http://filemagic.readthedocs.org"
},
"release_url": "https://pypi.org/project/filemagic/1.6/",
"requires_dist": null,
"requires_python": null,
"summary": "A Python API for libmagic, the library behind the Unix file command",
"version": "1.6"
},
"last_serial": 1077646,
"releases": {
"1.0": [
{
"comment_text": "",
"digests": {
"md5": "cfdd37ba3b7cb3b82173e009eb0e2623",
"sha256": "5897769ca17117448b461bb66953815994048e9e61608ed71c363d930ea2e4e0"
},
"downloads": -1,
"filename": "filemagic-1.0.tar.gz",
"has_sig": false,
"md5_digest": "cfdd37ba3b7cb3b82173e009eb0e2623",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10143,
"upload_time": "2012-03-15T05:27:04",
"url": "https://files.pythonhosted.org/packages/41/42/50b8b4855e220fcfba5662fb7798fe7919c9dd07b3c7f05df746484e13dd/filemagic-1.0.tar.gz"
}
],
"1.1": [
{
"comment_text": "",
"digests": {
"md5": "dabec06f70059e7f3d6935f4b42de921",
"sha256": "edb82962abaa218245f1c5835471812ca6a6fe127a761071e5ce54b508ee6247"
},
"downloads": -1,
"filename": "filemagic-1.1.tar.gz",
"has_sig": false,
"md5_digest": "dabec06f70059e7f3d6935f4b42de921",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17244,
"upload_time": "2012-03-15T21:51:32",
"url": "https://files.pythonhosted.org/packages/39/43/840e29477e643dde9d500545c733041e2eec2090e7420533146413e04f85/filemagic-1.1.tar.gz"
}
],
"1.2": [
{
"comment_text": "",
"digests": {
"md5": "96cfe4df186ddb468a086deebcff2179",
"sha256": "e8a4a74441d7e8c924b3d49cf6ae350a42e8d8557bc283f668d510c1c08b7a5d"
},
"downloads": -1,
"filename": "filemagic-1.2.tar.gz",
"has_sig": false,
"md5_digest": "96cfe4df186ddb468a086deebcff2179",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18954,
"upload_time": "2012-03-26T13:38:05",
"url": "https://files.pythonhosted.org/packages/ef/22/79a0c8879762a7569108b58de45c4b0cd526d459aa1f7da8e73f6aae18ac/filemagic-1.2.tar.gz"
}
],
"1.3": [
{
"comment_text": "",
"digests": {
"md5": "9d01cc627b26191d8b8c99b59dc33efb",
"sha256": "0541ac134c9eebfc0144c7802de244797f6f42e414bd73b747116e61e94f5839"
},
"downloads": -1,
"filename": "filemagic-1.3.tar.gz",
"has_sig": false,
"md5_digest": "9d01cc627b26191d8b8c99b59dc33efb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19680,
"upload_time": "2012-05-30T04:00:28",
"url": "https://files.pythonhosted.org/packages/bb/43/cb3148ff55966128feb400b622d21b8b5ce3caed75ec023b4aff55c252c4/filemagic-1.3.tar.gz"
}
],
"1.4": [
{
"comment_text": "",
"digests": {
"md5": "370e2e6d57816e50879841bd74c89f5c",
"sha256": "390cd21a996d7f655077e132bdbdc043e7beb996db44ecd2b47d6d3f38975d70"
},
"downloads": -1,
"filename": "filemagic-1.4.tar.gz",
"has_sig": false,
"md5_digest": "370e2e6d57816e50879841bd74c89f5c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20612,
"upload_time": "2012-12-11T10:58:04",
"url": "https://files.pythonhosted.org/packages/ac/2f/8970bb4a673223d65bb371c200bd514293e7b231afc141d4a99bea62233a/filemagic-1.4.tar.gz"
}
],
"1.5": [
{
"comment_text": "",
"digests": {
"md5": "b2ac973af6c8306f29cd9daecf12dd6d",
"sha256": "f7de789e1afb46d4540267b09493eae9cacec51b05431cfc881bce086ad5de9c"
},
"downloads": -1,
"filename": "filemagic-1.5.tar.gz",
"has_sig": false,
"md5_digest": "b2ac973af6c8306f29cd9daecf12dd6d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20946,
"upload_time": "2012-12-18T12:24:27",
"url": "https://files.pythonhosted.org/packages/b7/2f/a2bb9a0dcc97784e27e9717fe4a2ed82d27c71d0b9641aa48b9702f933db/filemagic-1.5.tar.gz"
}
],
"1.6": [
{
"comment_text": "",
"digests": {
"md5": "0e5f767933a9f3d2fceafce7c4294ee5",
"sha256": "e684359ef40820fe406f0ebc5bf8a78f89717bdb7fed688af68082d991d6dbf3"
},
"downloads": -1,
"filename": "filemagic-1.6.tar.gz",
"has_sig": false,
"md5_digest": "0e5f767933a9f3d2fceafce7c4294ee5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16754,
"upload_time": "2013-05-29T11:52:55",
"url": "https://files.pythonhosted.org/packages/8f/67/a1aedccc143597eea90e79134d14c7364e90174d31443e14674919716d87/filemagic-1.6.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "0e5f767933a9f3d2fceafce7c4294ee5",
"sha256": "e684359ef40820fe406f0ebc5bf8a78f89717bdb7fed688af68082d991d6dbf3"
},
"downloads": -1,
"filename": "filemagic-1.6.tar.gz",
"has_sig": false,
"md5_digest": "0e5f767933a9f3d2fceafce7c4294ee5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16754,
"upload_time": "2013-05-29T11:52:55",
"url": "https://files.pythonhosted.org/packages/8f/67/a1aedccc143597eea90e79134d14c7364e90174d31443e14674919716d87/filemagic-1.6.tar.gz"
}
]
}