commonmeta-py 0.128__py3-none-any.whl → 0.129__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 CHANGED
@@ -10,7 +10,7 @@ commonmeta-py is a Python library to convert scholarly metadata
10
10
  """
11
11
 
12
12
  __title__ = "commonmeta-py"
13
- __version__ = "0.128"
13
+ __version__ = "0.129"
14
14
  __author__ = "Martin Fenner"
15
15
  __license__ = "MIT"
16
16
 
commonmeta/doi_utils.py CHANGED
@@ -356,7 +356,7 @@ def generate_wordpress_doi(prefix: str, slug: str, guid: str) -> str:
356
356
  return doi
357
357
 
358
358
 
359
- def generate_doi_from_guid(prefix: str, guid: str) -> str:
359
+ def generate_doi_from_guid(prefix: str, guid: str, checksum=True) -> Optional[str]:
360
360
  """Validates a GUID that is a DOI"""
361
361
  import base32_lib as base32
362
362
 
@@ -374,13 +374,11 @@ def generate_doi_from_guid(prefix: str, guid: str) -> str:
374
374
  suffix = doi.split("/")[-1]
375
375
 
376
376
  try:
377
- number = base32.decode(suffix, checksum=True)
377
+ number = base32.decode(suffix, checksum)
378
378
  if number != 0:
379
379
  return doi
380
380
  except (ValueError, IndexError):
381
- pass
382
-
383
- return ""
381
+ return None
384
382
 
385
383
 
386
384
  def generate_substack_doi(prefix: str, guid: str) -> str:
@@ -75,7 +75,10 @@ def read_jsonfeed(data: Optional[dict], **kwargs) -> Commonmeta:
75
75
  elif generator == "Substack" and prefix and guid:
76
76
  _id = generate_substack_doi(prefix, guid)
77
77
  elif prefix and guid:
78
- _id = generate_doi_from_guid(prefix, guid)
78
+ # don't use checksum as some legacy GUIDs (generated with commonmeta Go between May 2024
79
+ # and April 2025) don't have valued checksum
80
+ guid = guid[:-2] # remove checksum
81
+ _id = generate_doi_from_guid(prefix, guid, checksum=False)
79
82
 
80
83
  # If still no DOI but prefix provided and not registered for DOI generation
81
84
  elif py_.get(meta, "blog.prefix") and not py_.get(meta, "blog.doi_reg", False):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commonmeta-py
3
- Version: 0.128
3
+ Version: 0.129
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=xyW49190_8VsMvwhkGXYHBt4mg3KIclELe5Le3a1Ubs,2118
1
+ commonmeta/__init__.py,sha256=nPzfcuE2fYAyGTTViV59VAGrNY25hfNfaouB6J9OXY0,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=pdBpBosLNq3RS9buO-Voqawc9Ay1eSt-xP5O97iOft4,8480
6
6
  commonmeta/constants.py,sha256=wSTEUiHeRdXLwjXEQD9AU2hxFyEKi5OTX2iHOKO6nF0,19844
7
7
  commonmeta/date_utils.py,sha256=H2cCobX0JREIUOT_cCigGd3MG7prGiQpXk1m4ZNrFwU,6318
8
- commonmeta/doi_utils.py,sha256=cOogLatKg6qea2jgMd3yLALSTfaTNUgr-IkBXIK4xZw,11498
8
+ commonmeta/doi_utils.py,sha256=WCERy6sJ8C7KRxYU-ZGnvmFe6YIdl_jtYO4lQ23aeYA,11510
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=zcPxxuyAGW8W7w0-VwP9AhpX97qVWHQJUIJ5p4bBbfE,15655
25
+ commonmeta/readers/jsonfeed_reader.py,sha256=sLwQwoFuOJ5yVqSi-EQVHSCo0VkwY_l6WxLGURP8yPo,15889
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
@@ -83,8 +83,8 @@ commonmeta/writers/datacite_writer.py,sha256=bcinpwhq7XnVthKHH8-sdXA34dSlvFH4ImY
83
83
  commonmeta/writers/inveniordm_writer.py,sha256=tiuq9JEkz02l615yVe9wUcJQqiIPJLUqNDyofEE8Aus,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.128.dist-info/METADATA,sha256=aggchv6KLQbyfB1-NnInl13Ly-PlxLeSI3kVk1usD5k,7656
87
- commonmeta_py-0.128.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
88
- commonmeta_py-0.128.dist-info/entry_points.txt,sha256=U4w4BoRuS3rN5t5Y-uYSyOeU5Lh_VRVMS9OIDzIgw4w,50
89
- commonmeta_py-0.128.dist-info/licenses/LICENSE,sha256=wsIvxF9Q9GC9vA_s79zTWP3BkXJdfUNRmALlU8GbW1s,1074
90
- commonmeta_py-0.128.dist-info/RECORD,,
86
+ commonmeta_py-0.129.dist-info/METADATA,sha256=cza-xH9MAPp1KGy_yyrDnXHaN63rR_6_YFeajR1blyI,7656
87
+ commonmeta_py-0.129.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
88
+ commonmeta_py-0.129.dist-info/entry_points.txt,sha256=U4w4BoRuS3rN5t5Y-uYSyOeU5Lh_VRVMS9OIDzIgw4w,50
89
+ commonmeta_py-0.129.dist-info/licenses/LICENSE,sha256=wsIvxF9Q9GC9vA_s79zTWP3BkXJdfUNRmALlU8GbW1s,1074
90
+ commonmeta_py-0.129.dist-info/RECORD,,