commonmeta-py 0.68__py3-none-any.whl → 0.70__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 +0 -4
- commonmeta/readers/json_feed_reader.py +2 -12
- commonmeta/readers/schema_org_reader.py +0 -3
- commonmeta/writers/inveniordm_writer.py +5 -5
- {commonmeta_py-0.68.dist-info → commonmeta_py-0.70.dist-info}/METADATA +1 -1
- {commonmeta_py-0.68.dist-info → commonmeta_py-0.70.dist-info}/RECORD +10 -10
- {commonmeta_py-0.68.dist-info → commonmeta_py-0.70.dist-info}/LICENSE +0 -0
- {commonmeta_py-0.68.dist-info → commonmeta_py-0.70.dist-info}/WHEEL +0 -0
- {commonmeta_py-0.68.dist-info → commonmeta_py-0.70.dist-info}/entry_points.txt +0 -0
commonmeta/__init__.py
CHANGED
commonmeta/doi_utils.py
CHANGED
@@ -138,7 +138,6 @@ def encode_doi(prefix, number: Optional[int] = None, checksum: bool = True) -> s
|
|
138
138
|
suffix = base32.encode(number, split_every=5, checksum=checksum)
|
139
139
|
else:
|
140
140
|
suffix = base32.generate(length=10, split_every=5, checksum=True)
|
141
|
-
print("s", suffix)
|
142
141
|
return f"https://doi.org/{prefix}/{suffix}"
|
143
142
|
|
144
143
|
|
@@ -149,12 +148,9 @@ def decode_doi(doi: str, checksum: bool = True) -> int:
|
|
149
148
|
if doi is None:
|
150
149
|
return 0
|
151
150
|
suffix = doi.split("/", maxsplit=1)[1]
|
152
|
-
print(suffix, checksum)
|
153
151
|
if checksum:
|
154
152
|
number = base32.decode(suffix, checksum=True)
|
155
|
-
print("n", number)
|
156
153
|
number = base32.decode(suffix)
|
157
|
-
print("nn", number)
|
158
154
|
return number
|
159
155
|
except ValueError:
|
160
156
|
return 0
|
@@ -184,7 +184,7 @@ def get_references(references: list) -> list:
|
|
184
184
|
id_ = normalize_doi(reference.get("id"))
|
185
185
|
else:
|
186
186
|
id_ = normalize_url(reference.get("id", None))
|
187
|
-
|
187
|
+
|
188
188
|
return compact(
|
189
189
|
{
|
190
190
|
"id": id_,
|
@@ -195,17 +195,7 @@ def get_references(references: list) -> list:
|
|
195
195
|
}
|
196
196
|
)
|
197
197
|
|
198
|
-
|
199
|
-
"""number reference"""
|
200
|
-
reference["key"] = f"ref{index + 1}"
|
201
|
-
return reference
|
202
|
-
|
203
|
-
references = [get_reference(i) for i in references]
|
204
|
-
return [
|
205
|
-
number_reference(i, index)
|
206
|
-
for index, i in enumerate(references)
|
207
|
-
if i is not None
|
208
|
-
]
|
198
|
+
return [get_reference(i) for i in references]
|
209
199
|
|
210
200
|
|
211
201
|
def get_funding_references(meta: Optional[dict]) -> Optional[list]:
|
@@ -105,7 +105,6 @@ def get_schema_org(pid: str, **kwargs) -> dict:
|
|
105
105
|
|
106
106
|
# load html meta tags
|
107
107
|
data = get_html_meta(soup)
|
108
|
-
print(data)
|
109
108
|
# load site-specific metadata
|
110
109
|
data |= web_translator(soup, url)
|
111
110
|
|
@@ -119,7 +118,6 @@ def get_schema_org(pid: str, **kwargs) -> dict:
|
|
119
118
|
None,
|
120
119
|
)
|
121
120
|
if json_ld is not None:
|
122
|
-
print(json_ld)
|
123
121
|
data |= json_ld
|
124
122
|
|
125
123
|
# if @id is a DOI, get metadata from Crossref or DataCite
|
@@ -137,7 +135,6 @@ def get_schema_org(pid: str, **kwargs) -> dict:
|
|
137
135
|
# author and creator are synonyms
|
138
136
|
if data.get("author", None) is None and data.get("creator", None) is not None:
|
139
137
|
data["author"] = data["creator"]
|
140
|
-
print(data)
|
141
138
|
return data | {"via": "schema_org", "state": "findable"}
|
142
139
|
|
143
140
|
|
@@ -280,12 +280,12 @@ def to_inveniordm_reference(reference: dict) -> dict:
|
|
280
280
|
else:
|
281
281
|
unstructured = reference.get("unstructured")
|
282
282
|
|
283
|
-
|
284
|
-
unstructured = unstructured.rstrip(" .")
|
285
|
-
|
286
|
-
if identifier:
|
283
|
+
if reference.get("id", None):
|
287
284
|
# remove duplicate ID from unstructured reference
|
288
|
-
unstructured = unstructured.replace(
|
285
|
+
unstructured = unstructured.replace(reference.get("id"), "")
|
286
|
+
|
287
|
+
# remove optional trailing whitespace
|
288
|
+
unstructured = unstructured.rstrip()
|
289
289
|
|
290
290
|
return compact(
|
291
291
|
{
|
@@ -1,4 +1,4 @@
|
|
1
|
-
commonmeta/__init__.py,sha256=
|
1
|
+
commonmeta/__init__.py,sha256=TAmXnOcVH9NyZ55JjhDdPqmZeJTJvPLQfYYU9_JtMBk,1875
|
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
|
@@ -6,7 +6,7 @@ commonmeta/cli.py,sha256=sOI9BJTePnljVcXcZ95N7TKXDT283XpjUaak7bMnbr0,6076
|
|
6
6
|
commonmeta/constants.py,sha256=AFm8gSo4WGnTdJOm1SOGLK602BctcQbaWU_tKCkgn_4,18087
|
7
7
|
commonmeta/crossref_utils.py,sha256=qJlTZtfKR2shAXQDm8VBYUujKFkTtZTUz19GuMUANaI,22198
|
8
8
|
commonmeta/date_utils.py,sha256=rJRV4YmWKQWU__iAV8www3cqwaefC0iRKyHwvxrr_XY,6316
|
9
|
-
commonmeta/doi_utils.py,sha256=
|
9
|
+
commonmeta/doi_utils.py,sha256=s2J95V9rWPbGsh5oNXht3yJkJ0NmVLRlOXDPXjnN-Ck,9152
|
10
10
|
commonmeta/metadata.py,sha256=cjvCcxW1FMtKCbNKan0zXX0FN6z5orHFGPYsgkp6fSI,12480
|
11
11
|
commonmeta/readers/__init__.py,sha256=vOf7UsOKNoh_ZCuyexxhAmPMt8wjB-pF_CfpWRaN8pk,45
|
12
12
|
commonmeta/readers/bibtex_reader.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -19,10 +19,10 @@ commonmeta/readers/csl_reader.py,sha256=IO8uj-L_BzPFWgfRzYCF9VbK5rBPBzDqak7iBELg
|
|
19
19
|
commonmeta/readers/datacite_reader.py,sha256=CdOtxhthrakBoQMsLTdPx6sUCmqtEWo5ICYE6ZsWDdo,12026
|
20
20
|
commonmeta/readers/datacite_xml_reader.py,sha256=nhnO92fZihr1HZlbXjyem-HJXc9_DWLgJ2zeltuPMIg,13041
|
21
21
|
commonmeta/readers/inveniordm_reader.py,sha256=jzv0rXzT8OCdPD_MShBXTnlwD-F9tpTX7OKZGn8smzs,7480
|
22
|
-
commonmeta/readers/json_feed_reader.py,sha256=
|
22
|
+
commonmeta/readers/json_feed_reader.py,sha256=8C9tEH6KAh7nUWLW4myAXkhdMue-ViL9wqaajqb_B1s,13390
|
23
23
|
commonmeta/readers/kbase_reader.py,sha256=ehKXQsJyPCtaq2FmBxNb2Jb5Nktpx8pNscpmEM6N0A4,6763
|
24
24
|
commonmeta/readers/ris_reader.py,sha256=v6qOd-i2OcMTEFy5RGd3MlYthJcYSU6yzmZ5yHDzmII,3677
|
25
|
-
commonmeta/readers/schema_org_reader.py,sha256=
|
25
|
+
commonmeta/readers/schema_org_reader.py,sha256=iK71dvjK6oqYneJ51j4-qFmBh5G3pmjQMzt_U6tK9_o,17077
|
26
26
|
commonmeta/resources/cff_v1.2.0.json,sha256=MpfjDYgX7fN9PLiG54ISZ2uu9WItNqfh-yaRuTf6Ptg,46691
|
27
27
|
commonmeta/resources/commonmeta_v0.12.json,sha256=HUSNReXh2JN3Q6YWSt7CE69js8dh50OlpMYGTyU98oU,16762
|
28
28
|
commonmeta/resources/commonmeta_v0.13.json,sha256=2-WSZGijR13zVu97S_YHXr-cyeLW7hzHXYMlr6nIjdw,15787
|
@@ -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=6N-93R1emcOsZrUTIhPBVd_Fv1C8Z5EAFYI0mYjoYaY,2797
|
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=5U1_3pCXH2F5a3Jj8d3a-DiRBkGFZ4g4k9TD2JTgRqs,11427
|
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.70.dist-info/LICENSE,sha256=746hEF2wZCKkcckk5-_DcBLtHewfaEMS4iXTlA1PVwk,1074
|
73
|
+
commonmeta_py-0.70.dist-info/METADATA,sha256=8sjl96yizbRpmlRJ2GWPfPPd-ohZ_p0A2tGqYndTG7M,8279
|
74
|
+
commonmeta_py-0.70.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
75
|
+
commonmeta_py-0.70.dist-info/entry_points.txt,sha256=vbcDw3_2lMTKdcAL2VUF4DRYRpKuzXVYLMCdgKVf88U,49
|
76
|
+
commonmeta_py-0.70.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|