licenses¶
The license texts of a model, e.g. for its COMBINE archive.
A model is published under two licenses: the models and the documentation
under CC BY-SA 4.0, the
source code under MIT. The texts are
resources of the package; the text of CC BY-SA 4.0 is the same for every
model, the text of MIT starts with the copyright of the model, e.g.
Copyright (c) 2024-2025 Matthias König, which is the only
part in which the MIT texts of two models differ.
write_license writes a text as cc-by-sa-4.0.txt or mit.txt into a
directory, from where the factory of a model adds it to the COMBINE archive.
License
¶
Bases: StrEnum
A license of a model, its value is the name of its file without .txt.
license_text
¶
Get the text of a license.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
license
|
License | str
|
the license, or its value ( |
required |
copyright
|
str | None
|
the year or years and the holders of the copyright, e.g.
|
None
|
Returns:
| Type | Description |
|---|---|
str
|
The text of the license, every line ends with a line feed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
for a missing or a superfluous copyright, or a copyright
which is empty, spans several lines or starts with |
write_license
¶
Write the text of a license into a directory.
The file is named after the license (cc-by-sa-4.0.txt, mit.txt) and is
written in UTF-8 with line feeds as line endings on every platform, so it
is the same file byte for byte wherever a model is created; an existing
file is replaced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
Path
|
the directory of the file, which has to exist, e.g. the folder whose files the factory of a model packs into its COMBINE archive. |
required |
license
|
License | str
|
the license, or its value ( |
required |
copyright
|
str | None
|
the year or years and the holders of the copyright, required
for MIT, see |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The path of the written file. |