commonmeta-py 0.58__py3-none-any.whl → 0.59__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- commonmeta/__init__.py +1 -1
- commonmeta/utils.py +13 -5
- commonmeta/writers/inveniordm_writer.py +1 -1
- {commonmeta_py-0.58.dist-info → commonmeta_py-0.59.dist-info}/METADATA +2 -2
- {commonmeta_py-0.58.dist-info → commonmeta_py-0.59.dist-info}/RECORD +8 -8
- {commonmeta_py-0.58.dist-info → commonmeta_py-0.59.dist-info}/LICENSE +0 -0
- {commonmeta_py-0.58.dist-info → commonmeta_py-0.59.dist-info}/WHEEL +0 -0
- {commonmeta_py-0.58.dist-info → commonmeta_py-0.59.dist-info}/entry_points.txt +0 -0
commonmeta/__init__.py
CHANGED
commonmeta/utils.py
CHANGED
@@ -1092,16 +1092,24 @@ def name_to_fos(name: str) -> Optional[dict]:
|
|
1092
1092
|
return {"subject": subject}
|
1093
1093
|
|
1094
1094
|
|
1095
|
-
def encode_doi(prefix):
|
1095
|
+
def encode_doi(prefix, number: Optional[int]= None, checksum: bool = True) -> str:
|
1096
1096
|
"""Generate a DOI using the DOI prefix and a random base32 suffix"""
|
1097
|
-
|
1097
|
+
if isinstance(number, int):
|
1098
|
+
suffix = base32.encode(number, split_every=5, checksum=checksum)
|
1099
|
+
else:
|
1100
|
+
suffix = base32.generate(length=10, split_every=5, checksum=True)
|
1098
1101
|
return f"https://doi.org/{prefix}/{suffix}"
|
1099
1102
|
|
1100
1103
|
|
1101
|
-
def decode_doi(doi: str) -> int:
|
1104
|
+
def decode_doi(doi: str, checksum: bool = True) -> int:
|
1102
1105
|
"""Decode a DOI to a number"""
|
1103
|
-
|
1104
|
-
|
1106
|
+
try:
|
1107
|
+
suffix = doi.split("/", maxsplit=5)[-1]
|
1108
|
+
if checksum:
|
1109
|
+
return base32.decode(suffix, checksum=True)
|
1110
|
+
return base32.decode(suffix)
|
1111
|
+
except ValueError:
|
1112
|
+
return 0
|
1105
1113
|
|
1106
1114
|
|
1107
1115
|
def from_curie(id: Optional[str]) -> Optional[str]:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: commonmeta-py
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.59
|
4
4
|
Summary: Library for conversions to/from the Commonmeta scholarly metadata format
|
5
5
|
Home-page: https://python.commonmeta.org
|
6
6
|
License: MIT
|
@@ -38,7 +38,7 @@ Requires-Dist: nbstripout (>=0.6,<0.7)
|
|
38
38
|
Requires-Dist: nh3 (>=0.2.14,<0.3.0)
|
39
39
|
Requires-Dist: orjson (>=3.9.14,<4.0.0)
|
40
40
|
Requires-Dist: orjsonl (>=1.0.0,<2.0.0)
|
41
|
-
Requires-Dist: pikepdf (>=8.14
|
41
|
+
Requires-Dist: pikepdf (>=8.14,<10.0)
|
42
42
|
Requires-Dist: pycountry (>=23.12.11,<24.0.0)
|
43
43
|
Requires-Dist: pydash (>=7.0,<8.0)
|
44
44
|
Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
commonmeta/__init__.py,sha256=
|
1
|
+
commonmeta/__init__.py,sha256=kL83VEVl38LcgVgjuTDvDYC__UV6MEZRL0du12sjL20,1779
|
2
2
|
commonmeta/api_utils.py,sha256=-ZHGVZZhJqnjnsLtp4-PoeHYbDqL0cQme7W70BEjo4U,2677
|
3
3
|
commonmeta/author_utils.py,sha256=zBIPTgP5n7Zx57xomJ2h7x0dvC0AV8gJ2gPoYeDy5Lo,8348
|
4
4
|
commonmeta/base_utils.py,sha256=AsUElA5kT2fw_Osy7Uaj2F6MKeq9yB7d5f2V-h2lh7c,3750
|
@@ -58,7 +58,7 @@ commonmeta/resources/styles/modern-language-association.csl,sha256=HI2iU4krze1aH
|
|
58
58
|
commonmeta/resources/styles/vancouver.csl,sha256=lun3_i2oTilgsANk4LjFao2UDPQlGj_hgFgKAWC_DF8,12878
|
59
59
|
commonmeta/schema_utils.py,sha256=gg3l1jd_lFtRkQlO1DYGMVbC10nEmVTN4AWacxC4AAE,915
|
60
60
|
commonmeta/translators.py,sha256=RpGJtKNLjmz41VREZDY7KyyE2eXOi8j7m-da4jHmknI,1362
|
61
|
-
commonmeta/utils.py,sha256=
|
61
|
+
commonmeta/utils.py,sha256=S3uzmQLzY7W-I7t0GSm-9WbILb0IcfWYU7thHmE4_Hk,44401
|
62
62
|
commonmeta/writers/__init__.py,sha256=47-snms6xBHkoEXKYV1DBtH1npAtlVtvY29Z4Zr45qI,45
|
63
63
|
commonmeta/writers/bibtex_writer.py,sha256=s3hIJIgWvSG7TAriZMRQEAyuitw6ebwWSI1YcYFQ-do,4971
|
64
64
|
commonmeta/writers/citation_writer.py,sha256=RjaNh9EALxq6gfODLRWVJxGxPArGd6ZiHUlkYnCT6MA,2355
|
@@ -66,11 +66,11 @@ commonmeta/writers/commonmeta_writer.py,sha256=2qlttCfYpGhfVjrYkjzbIra7AywssRLT3
|
|
66
66
|
commonmeta/writers/crossref_xml_writer.py,sha256=0Ds494RnXfdfjWw5CLX1kwV2zP7gqffdVqO-X74Uc6c,492
|
67
67
|
commonmeta/writers/csl_writer.py,sha256=rlCeShkvC6ui9By0yVfNCMay_JfaZ4AooUPOPg-g-2M,2819
|
68
68
|
commonmeta/writers/datacite_writer.py,sha256=G7Lr0aZ4sAEdbfXe3dG4Y6AyGUKA9UWr_iiaQRDnV24,6233
|
69
|
-
commonmeta/writers/inveniordm_writer.py,sha256=
|
69
|
+
commonmeta/writers/inveniordm_writer.py,sha256=oVcXdHYtuugbfDgKO8JwTRXmP7AK2U96uK4YF0eKXAY,11399
|
70
70
|
commonmeta/writers/ris_writer.py,sha256=AcnCszS3WY9lF594NbFBtLylsA8ownnYp_XLQJ84Ios,2093
|
71
71
|
commonmeta/writers/schema_org_writer.py,sha256=5j002uCNLdlScZMNQmPjodcVWqaBh2z38zL1H4lo2hY,5741
|
72
|
-
commonmeta_py-0.
|
73
|
-
commonmeta_py-0.
|
74
|
-
commonmeta_py-0.
|
75
|
-
commonmeta_py-0.
|
76
|
-
commonmeta_py-0.
|
72
|
+
commonmeta_py-0.59.dist-info/LICENSE,sha256=746hEF2wZCKkcckk5-_DcBLtHewfaEMS4iXTlA1PVwk,1074
|
73
|
+
commonmeta_py-0.59.dist-info/METADATA,sha256=BP49AZs8BJ6GIPnRbieOEomK9qfvrfWlQAzALU6F55A,8279
|
74
|
+
commonmeta_py-0.59.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
75
|
+
commonmeta_py-0.59.dist-info/entry_points.txt,sha256=vbcDw3_2lMTKdcAL2VUF4DRYRpKuzXVYLMCdgKVf88U,49
|
76
|
+
commonmeta_py-0.59.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|