Find a license name from a license file.
Project description
Module or script to find a license name from a license text or file.
Usage
This can be used as a script:
$ licensename tests/licenses/MIT.txt MIT $ licensename tests/licenses/BSD-2-Clause.txt BSD-2-Clause
Or as a module:
>>> import licensename >>> licensename.from_file('./tests/licenses/MIT.txt') 'MIT' >>> licensename.from_file('./tests/licenses/BSD-2-Clause.txt') 'BSD-2-Clause' >>> licensename.from_text("MIT License\nyadi yadi yada…") 'MIT'
Adding a license
Known licenses are stored in src/licensename/known_licenses.py. The structure is aimed to be understandable by humans: it’s a simple dict, each level of the dict correspond to a line in the license, like:
"The LaTeX Project Public License": { "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-": { "LPPL Version 1.1 1999-07-10": "LPPL-1.1", "LPPL Version 1.2 1999-09-03": "LPPL-1.2", "LPPL Version 1.3a 2004-10-01": "LPPL-1.3a", "LPPL Version 1.3c 2008-05-04": "LPPL-1.3c" } }
reads like: If line one is “The LaTeX Project Public License”, and the line two is “=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-”, and the line three is “LPPL Version 1.1 1999-07-10”, it’s an “LPPL-1.1”, and so on.
In other worlds, first dict is for line one, second level of dicts are for line two, etc… until as string is found instead of a dict, meaning there’s no longer need for disambiguation, and it’s the license name.
Lines containing (c), (C), empty lines, or starting with Copyright are ignored.
Note
This project has been set up using PyScaffold 2.5.7. For details and usage information on PyScaffold see http://pyscaffold.readthedocs.org/.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file licensename-0.3.tar.gz
.
File metadata
- Download URL: licensename-0.3.tar.gz
- Upload date:
- Size: 768.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 266a6461cd35171bcb2967437273cc1929b63ca2ffbbf20d08c813b3ef5bd36c |
|
MD5 | f95b05adc4a8d60ffaf436f6de255788 |
|
BLAKE2b-256 | fa8c919d2a42c31644aeb56344f57ef4f89e7fff34d7e7be1976a2eb40ea60b6 |
File details
Details for the file licensename-0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: licensename-0.3-py2.py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4962361b28b3f0060f87818b093ff00541151a12e00fdacaa1306026fd4c10f6 |
|
MD5 | 6a1901f16f0a1b5879381030e1689105 |
|
BLAKE2b-256 | 37a454dd9f69dbd86ee1c7fb3e4aa79e7e8977256942c032a0d20bb70d226334 |