commonmeta-py 0.133__py3-none-any.whl → 0.135__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/doi_utils.py +6 -7
- commonmeta/readers/jsonfeed_reader.py +9 -6
- commonmeta/writers/inveniordm_writer.py +3 -3
- {commonmeta_py-0.133.dist-info → commonmeta_py-0.135.dist-info}/METADATA +1 -1
- {commonmeta_py-0.133.dist-info → commonmeta_py-0.135.dist-info}/RECORD +9 -9
- {commonmeta_py-0.133.dist-info → commonmeta_py-0.135.dist-info}/WHEEL +0 -0
- {commonmeta_py-0.133.dist-info → commonmeta_py-0.135.dist-info}/entry_points.txt +0 -0
- {commonmeta_py-0.133.dist-info → commonmeta_py-0.135.dist-info}/licenses/LICENSE +0 -0
commonmeta/__init__.py
CHANGED
commonmeta/doi_utils.py
CHANGED
@@ -356,29 +356,28 @@ def generate_wordpress_doi(prefix: str, slug: str, guid: str) -> str:
|
|
356
356
|
return doi
|
357
357
|
|
358
358
|
|
359
|
-
def
|
359
|
+
def validate_doi_from_guid(prefix: str, guid: str, checksum=True) -> bool:
|
360
360
|
"""Validates a GUID that is a DOI"""
|
361
361
|
import base32_lib as base32
|
362
362
|
|
363
363
|
if not prefix:
|
364
|
-
return
|
364
|
+
return False
|
365
365
|
|
366
366
|
doi = normalize_doi(guid)
|
367
367
|
if not doi:
|
368
|
-
return
|
368
|
+
return False
|
369
369
|
|
370
370
|
p = validate_prefix(doi)
|
371
371
|
if not p or p != prefix:
|
372
|
-
return
|
372
|
+
return False
|
373
373
|
|
374
374
|
suffix = doi.split("/")[-1]
|
375
375
|
|
376
376
|
try:
|
377
377
|
number = base32.decode(suffix, checksum)
|
378
|
-
|
379
|
-
return doi
|
378
|
+
return number != 0
|
380
379
|
except (ValueError, IndexError):
|
381
|
-
return
|
380
|
+
return False
|
382
381
|
|
383
382
|
|
384
383
|
def generate_substack_doi(prefix: str, guid: str) -> str:
|
@@ -13,12 +13,12 @@ from ..date_utils import get_date_from_unix_timestamp
|
|
13
13
|
from ..doi_utils import (
|
14
14
|
doi_from_url,
|
15
15
|
encode_doi,
|
16
|
-
generate_doi_from_guid,
|
17
16
|
generate_substack_doi,
|
18
17
|
generate_wordpress_doi,
|
19
18
|
is_rogue_scholar_doi,
|
20
19
|
normalize_doi,
|
21
20
|
validate_doi,
|
21
|
+
validate_doi_from_guid,
|
22
22
|
validate_prefix,
|
23
23
|
)
|
24
24
|
from ..utils import (
|
@@ -74,11 +74,14 @@ def read_jsonfeed(data: Optional[dict], **kwargs) -> Commonmeta:
|
|
74
74
|
_id = generate_wordpress_doi(prefix, slug, guid)
|
75
75
|
elif generator == "Substack" and prefix and guid:
|
76
76
|
_id = generate_substack_doi(prefix, guid)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
# don't use checksum as some legacy GUIDs (generated with commonmeta Go between May 2024
|
78
|
+
# and April 2025) don't have valid checksum
|
79
|
+
elif (
|
80
|
+
prefix
|
81
|
+
and guid
|
82
|
+
and validate_doi_from_guid(prefix, guid[:-2], checksum=False)
|
83
|
+
):
|
84
|
+
_id = guid
|
82
85
|
|
83
86
|
# If still no DOI but prefix provided and not registered for DOI generation
|
84
87
|
elif py_.get(meta, "blog.prefix") and not py_.get(meta, "blog.doi_reg", False):
|
@@ -428,12 +428,12 @@ def push_inveniordm(metadata: Commonmeta, host: str, token: str, **kwargs) -> Di
|
|
428
428
|
if community_index is not None:
|
429
429
|
metadata.relations.pop(community_index)
|
430
430
|
|
431
|
-
# upsert record via the InvenioRDM API
|
432
|
-
record = upsert_record(metadata, host, token, record)
|
433
|
-
|
434
431
|
# optionally add record to InvenioRDM communities
|
435
432
|
record = add_record_to_communities(metadata, host, token, record)
|
436
433
|
|
434
|
+
# upsert record via the InvenioRDM API
|
435
|
+
record = upsert_record(metadata, host, token, record)
|
436
|
+
|
437
437
|
# optionally update external services
|
438
438
|
record = update_external_services(metadata, host, token, record, **kwargs)
|
439
439
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: commonmeta-py
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.135
|
4
4
|
Summary: Library for conversions to/from the Commonmeta scholarly metadata format
|
5
5
|
Project-URL: Homepage, https://python.commonmeta.org
|
6
6
|
Project-URL: Repository, https://github.com/front-matter/commonmeta-py
|
@@ -1,11 +1,11 @@
|
|
1
|
-
commonmeta/__init__.py,sha256=
|
1
|
+
commonmeta/__init__.py,sha256=LbxfPyMfkuLvqYdZYkvyLLDwI1XZGOoqB0WymoF4W-o,2118
|
2
2
|
commonmeta/api_utils.py,sha256=P8LMHHYiF4OTi97_5k4KstcBreooMkOAKZ4ebxsAv4o,2691
|
3
3
|
commonmeta/author_utils.py,sha256=3lYW5s1rOUWNTKs1FP6XLfEUY3yCLOe_3L_VdJTDMp0,8585
|
4
4
|
commonmeta/base_utils.py,sha256=-MGy9q2uTiJEkPWQUYOJMdq-3tRpNnvBwlLjvllQ5g8,11164
|
5
5
|
commonmeta/cli.py,sha256=kBDSn7hL29I_ICn8XKFFEaIWl_ZVE_KrNWpzfar9v3g,8639
|
6
6
|
commonmeta/constants.py,sha256=wSTEUiHeRdXLwjXEQD9AU2hxFyEKi5OTX2iHOKO6nF0,19844
|
7
7
|
commonmeta/date_utils.py,sha256=H2cCobX0JREIUOT_cCigGd3MG7prGiQpXk1m4ZNrFwU,6318
|
8
|
-
commonmeta/doi_utils.py,sha256=
|
8
|
+
commonmeta/doi_utils.py,sha256=uB5Zxr5ezo-5Pp_M_FCGM7jwuZ8ylRBtS1WHOCCLpsU,11491
|
9
9
|
commonmeta/file_utils.py,sha256=eFYDWyR8Gr722nvFmp542hCm-TGmO_q4ciZ85IPHpjA,2893
|
10
10
|
commonmeta/metadata.py,sha256=90aTe47d071wHxwcNsOqU5lSVPKP8wAPnPHhddj3Fuo,18443
|
11
11
|
commonmeta/schema_utils.py,sha256=zn3gqAHciUOQmrw9okR68weFs-yqPPyORFt-Zl1D3Lw,1924
|
@@ -22,7 +22,7 @@ commonmeta/readers/csl_reader.py,sha256=OxzC2AZKfv43BCah4XGYvlK_LUK-5mxXFcjdzB5v
|
|
22
22
|
commonmeta/readers/datacite_reader.py,sha256=4b_AP8m_aOUNVnVB0nU9j4-a8WTpmYJA8QPr5v35qyw,12219
|
23
23
|
commonmeta/readers/datacite_xml_reader.py,sha256=nsPc7JBbIKgx6Yaauq8vmhUE-o6K0t_MAuExv6FO2AU,13205
|
24
24
|
commonmeta/readers/inveniordm_reader.py,sha256=DtSloEZDu8bL-QLQAqAW1aDsS6ESTDZyhme379IekjY,8502
|
25
|
-
commonmeta/readers/jsonfeed_reader.py,sha256=
|
25
|
+
commonmeta/readers/jsonfeed_reader.py,sha256=2ezpXyUD7evniDG_f5R8rXhTxFVQRNJCD39VElVnLRA,15906
|
26
26
|
commonmeta/readers/kbase_reader.py,sha256=0Y9cHRNs_7kHyocN4IESXbgmXJiq4TXoxvGeUYGml1s,6896
|
27
27
|
commonmeta/readers/openalex_reader.py,sha256=4HUkBsut_iUjhUcC5c1GHgxnKsYQc-fgY43QILgVZEg,12826
|
28
28
|
commonmeta/readers/ris_reader.py,sha256=nwK8Eux0wPjwKqXFWS4Cfd6FAY7Id4Mi_hgkTwPntHs,3766
|
@@ -80,11 +80,11 @@ commonmeta/writers/commonmeta_writer.py,sha256=QpfyhG__7o_XpsOTCPWxGymO7YKwZi2LQ
|
|
80
80
|
commonmeta/writers/crossref_xml_writer.py,sha256=nyNgnyluzd9jZ6jysrSg_TpMNOQuVjfMo7pN0HUb3c0,34832
|
81
81
|
commonmeta/writers/csl_writer.py,sha256=4gDYs1EzK4_L2UIRTfs25wgHmYRwdRP2zmfxF9387oU,2779
|
82
82
|
commonmeta/writers/datacite_writer.py,sha256=bcinpwhq7XnVthKHH8-sdXA34dSlvFH4ImYH768iaQU,6428
|
83
|
-
commonmeta/writers/inveniordm_writer.py,sha256=
|
83
|
+
commonmeta/writers/inveniordm_writer.py,sha256=gZDBpgrRgIEuq8VOmtIFPsWX4Cfucbc1gVwyfLC7o4s,26726
|
84
84
|
commonmeta/writers/ris_writer.py,sha256=3SdyEvMRaPRP1SV1MB-MXBlunE7x6og7RF1zuWtetPc,2094
|
85
85
|
commonmeta/writers/schema_org_writer.py,sha256=s18_x0ReXwAGBoEAwp2q-HCgFQ-h5qRg6JyAlqCoSFE,5871
|
86
|
-
commonmeta_py-0.
|
87
|
-
commonmeta_py-0.
|
88
|
-
commonmeta_py-0.
|
89
|
-
commonmeta_py-0.
|
90
|
-
commonmeta_py-0.
|
86
|
+
commonmeta_py-0.135.dist-info/METADATA,sha256=xe3PwLb6ndfeH8zIiIeblf-GYUZnhcH8rSSndnp62wA,7656
|
87
|
+
commonmeta_py-0.135.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
88
|
+
commonmeta_py-0.135.dist-info/entry_points.txt,sha256=U4w4BoRuS3rN5t5Y-uYSyOeU5Lh_VRVMS9OIDzIgw4w,50
|
89
|
+
commonmeta_py-0.135.dist-info/licenses/LICENSE,sha256=wsIvxF9Q9GC9vA_s79zTWP3BkXJdfUNRmALlU8GbW1s,1074
|
90
|
+
commonmeta_py-0.135.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|