commonmeta-py 0.98__py3-none-any.whl → 0.101__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/author_utils.py +8 -1
- commonmeta/doi_utils.py +1 -0
- commonmeta/readers/schema_org_reader.py +2 -3
- commonmeta/utils.py +5 -47
- {commonmeta_py-0.98.dist-info → commonmeta_py-0.101.dist-info}/METADATA +1 -1
- {commonmeta_py-0.98.dist-info → commonmeta_py-0.101.dist-info}/RECORD +10 -10
- {commonmeta_py-0.98.dist-info → commonmeta_py-0.101.dist-info}/WHEEL +0 -0
- {commonmeta_py-0.98.dist-info → commonmeta_py-0.101.dist-info}/entry_points.txt +0 -0
- {commonmeta_py-0.98.dist-info → commonmeta_py-0.101.dist-info}/licenses/LICENSE +0 -0
commonmeta/__init__.py
CHANGED
commonmeta/author_utils.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Author utils module for commonmeta-py"""
|
2
|
+
|
2
3
|
import re
|
3
4
|
from typing import List
|
4
5
|
from nameparser import HumanName
|
@@ -71,7 +72,11 @@ def get_one_author(author, **kwargs):
|
|
71
72
|
or next(
|
72
73
|
(
|
73
74
|
format_name_identifier(i)
|
74
|
-
for i in wrap(
|
75
|
+
for i in wrap(
|
76
|
+
author.get(
|
77
|
+
"nameIdentifiers", None or author.get("identifiers", None)
|
78
|
+
)
|
79
|
+
)
|
75
80
|
),
|
76
81
|
None,
|
77
82
|
)
|
@@ -169,6 +174,8 @@ def is_personal_name(name):
|
|
169
174
|
"Staff",
|
170
175
|
"Lab",
|
171
176
|
"Redaktion",
|
177
|
+
"Group",
|
178
|
+
"area",
|
172
179
|
]
|
173
180
|
):
|
174
181
|
return False
|
commonmeta/doi_utils.py
CHANGED
@@ -410,9 +410,8 @@ def get_html_meta(soup):
|
|
410
410
|
pid = pid.get("content", None) or pid.get("href", None)
|
411
411
|
data["@id"] = normalize_id(pid)
|
412
412
|
|
413
|
-
_type = (
|
414
|
-
|
415
|
-
or soup.select_one("meta[name='DC.type']")
|
413
|
+
_type = soup.select_one("meta[name='dc.type']") or soup.select_one(
|
414
|
+
"meta[name='DC.type']"
|
416
415
|
)
|
417
416
|
data["@type"] = _type["content"].capitalize() if _type else None
|
418
417
|
if _type is None:
|
commonmeta/utils.py
CHANGED
@@ -190,8 +190,6 @@ def normalize_url(
|
|
190
190
|
if url is None or not isinstance(url, str):
|
191
191
|
return None
|
192
192
|
url = url.strip()
|
193
|
-
if url.endswith("/"):
|
194
|
-
url = url.strip("/")
|
195
193
|
scheme = urlparse(url).scheme
|
196
194
|
if not scheme or scheme not in ["http", "https"]:
|
197
195
|
return None
|
@@ -202,55 +200,13 @@ def normalize_url(
|
|
202
200
|
return url
|
203
201
|
|
204
202
|
|
205
|
-
# def normalize_url(url: Optional[str], secure=False, fragments=False, lower=False) -> Optional[str]:
|
206
|
-
# """Normalize URL"""
|
207
|
-
# if url is None or not isinstance(url, str):
|
208
|
-
# return None
|
209
|
-
# try:
|
210
|
-
# f = furl(url.strip())
|
211
|
-
# f.path.normalize()
|
212
|
-
|
213
|
-
# # only allow http and https schemes
|
214
|
-
# if f.scheme not in ["http", "https"]:
|
215
|
-
# return None
|
216
|
-
# if secure and f.scheme == "http":
|
217
|
-
# f.set(scheme="https")
|
218
|
-
|
219
|
-
# # remove index.html
|
220
|
-
# if f.path.segments and f.path.segments[-1] in ["index.html"]:
|
221
|
-
# f.path.segments.pop(-1)
|
222
|
-
|
223
|
-
# # remove fragments
|
224
|
-
# if fragments:
|
225
|
-
# f.remove(fragment=True)
|
226
|
-
|
227
|
-
# # remove specific query parameters
|
228
|
-
# f.remove(
|
229
|
-
# [
|
230
|
-
# "origin",
|
231
|
-
# "ref",
|
232
|
-
# "referrer",
|
233
|
-
# "source",
|
234
|
-
# "utm_content",
|
235
|
-
# "utm_medium",
|
236
|
-
# "utm_campaign",
|
237
|
-
# "utm_source",
|
238
|
-
# ]
|
239
|
-
# )
|
240
|
-
|
241
|
-
# if lower:
|
242
|
-
# return f.url.lower().strip("/")
|
243
|
-
# return f.url.strip("/")
|
244
|
-
# except ValueError:
|
245
|
-
# print(f"Error normalizing url {url}")
|
246
|
-
# return None
|
247
|
-
|
248
|
-
|
249
203
|
def normalize_cc_url(url: Optional[str]):
|
250
204
|
"""Normalize Creative Commons URL"""
|
251
205
|
if url is None or not isinstance(url, str):
|
252
206
|
return None
|
253
207
|
url = normalize_url(url, secure=True)
|
208
|
+
if url and url.endswith("/"):
|
209
|
+
url = url.strip("/")
|
254
210
|
return NORMALIZED_LICENSES.get(url, url)
|
255
211
|
|
256
212
|
|
@@ -1129,7 +1085,9 @@ def replace_curie(string: Optional[str]) -> Optional[str]:
|
|
1129
1085
|
if string is None:
|
1130
1086
|
return None
|
1131
1087
|
match = re.sub(
|
1132
|
-
r"((?:doi|DOI):\s?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-]))",
|
1088
|
+
r"((?:doi|DOI):\s?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-]))",
|
1089
|
+
r"https://doi.org/\2",
|
1090
|
+
string,
|
1133
1091
|
)
|
1134
1092
|
if match is None:
|
1135
1093
|
return None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: commonmeta-py
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.101
|
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,16 +1,16 @@
|
|
1
|
-
commonmeta/__init__.py,sha256=
|
1
|
+
commonmeta/__init__.py,sha256=M2m85YjUMJYnxend54-gjHPtr6sSqCMxXdb5VyNGu8o,1912
|
2
2
|
commonmeta/api_utils.py,sha256=-ZHGVZZhJqnjnsLtp4-PoeHYbDqL0cQme7W70BEjo4U,2677
|
3
|
-
commonmeta/author_utils.py,sha256=
|
3
|
+
commonmeta/author_utils.py,sha256=4ftyfy0tZRtP8bJ_PYdrNS8Z76FNBJ38sHj5EMhds1Y,8585
|
4
4
|
commonmeta/base_utils.py,sha256=AsUElA5kT2fw_Osy7Uaj2F6MKeq9yB7d5f2V-h2lh7c,3750
|
5
5
|
commonmeta/cli.py,sha256=sOI9BJTePnljVcXcZ95N7TKXDT283XpjUaak7bMnbr0,6076
|
6
6
|
commonmeta/constants.py,sha256=aZ7v-5bomVUQ1D79ubeSGHvlHhQvtVOcTvjLy-Wagvw,18348
|
7
7
|
commonmeta/crossref_utils.py,sha256=ijcdAdV2HHUXP2twIKIQP9Ln2xsysU3n9nwQDg-ZAxU,22224
|
8
8
|
commonmeta/date_utils.py,sha256=rJRV4YmWKQWU__iAV8www3cqwaefC0iRKyHwvxrr_XY,6316
|
9
|
-
commonmeta/doi_utils.py,sha256=
|
9
|
+
commonmeta/doi_utils.py,sha256=ZBhHS66AjIHtdWlm3HGy4TIhgiesxqF4vtq4CeqaKPk,9242
|
10
10
|
commonmeta/metadata.py,sha256=cjvCcxW1FMtKCbNKan0zXX0FN6z5orHFGPYsgkp6fSI,12480
|
11
11
|
commonmeta/schema_utils.py,sha256=2DmwMAcasmNa0xBdxxeS6bIvoHz63sODk_ja5UYFTqk,915
|
12
12
|
commonmeta/translators.py,sha256=RpGJtKNLjmz41VREZDY7KyyE2eXOi8j7m-da4jHmknI,1362
|
13
|
-
commonmeta/utils.py,sha256=
|
13
|
+
commonmeta/utils.py,sha256=WuOxCNKDKEqb3xA7Iotje_ET5GuXSuk-cguAv-jMG8s,43758
|
14
14
|
commonmeta/readers/__init__.py,sha256=vOf7UsOKNoh_ZCuyexxhAmPMt8wjB-pF_CfpWRaN8pk,45
|
15
15
|
commonmeta/readers/bibtex_reader.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
commonmeta/readers/cff_reader.py,sha256=5HMFUvjE1zb-zfpQSNM8vtB0YunD0reom99hn8N0xKc,6144
|
@@ -25,7 +25,7 @@ commonmeta/readers/inveniordm_reader.py,sha256=F0syoLZ3amzkrEk8efb9WxwhMDY8QM8ct
|
|
25
25
|
commonmeta/readers/json_feed_reader.py,sha256=L2zl0Iv8F9o9JC-qjF_j7K5Lw_iJwa5LrQCNx-sxfDE,14437
|
26
26
|
commonmeta/readers/kbase_reader.py,sha256=ehKXQsJyPCtaq2FmBxNb2Jb5Nktpx8pNscpmEM6N0A4,6763
|
27
27
|
commonmeta/readers/ris_reader.py,sha256=v6qOd-i2OcMTEFy5RGd3MlYthJcYSU6yzmZ5yHDzmII,3677
|
28
|
-
commonmeta/readers/schema_org_reader.py,sha256=
|
28
|
+
commonmeta/readers/schema_org_reader.py,sha256=oZoLG9okMxzlyCuX6oNNNFwvGCFpQ3W2Pz2TpXr3vkA,17224
|
29
29
|
commonmeta/resources/cff_v1.2.0.json,sha256=MpfjDYgX7fN9PLiG54ISZ2uu9WItNqfh-yaRuTf6Ptg,46691
|
30
30
|
commonmeta/resources/commonmeta_v0.12.json,sha256=HUSNReXh2JN3Q6YWSt7CE69js8dh50OlpMYGTyU98oU,16762
|
31
31
|
commonmeta/resources/commonmeta_v0.13.json,sha256=2-WSZGijR13zVu97S_YHXr-cyeLW7hzHXYMlr6nIjdw,15787
|
@@ -70,8 +70,8 @@ commonmeta/writers/datacite_writer.py,sha256=UpDp4Brg5xrmS5T3QYoNi6PPXKdRxAo254e
|
|
70
70
|
commonmeta/writers/inveniordm_writer.py,sha256=M_VmBZ_E5x_BHSgMjt2u70c34Eij2ngoaDwYWOrJzkg,11429
|
71
71
|
commonmeta/writers/ris_writer.py,sha256=AcnCszS3WY9lF594NbFBtLylsA8ownnYp_XLQJ84Ios,2093
|
72
72
|
commonmeta/writers/schema_org_writer.py,sha256=5j002uCNLdlScZMNQmPjodcVWqaBh2z38zL1H4lo2hY,5741
|
73
|
-
commonmeta_py-0.
|
74
|
-
commonmeta_py-0.
|
75
|
-
commonmeta_py-0.
|
76
|
-
commonmeta_py-0.
|
77
|
-
commonmeta_py-0.
|
73
|
+
commonmeta_py-0.101.dist-info/METADATA,sha256=jaK_LmceW2w8DOWmgfbqps7mhWano0RdAulI9wEGVAg,7430
|
74
|
+
commonmeta_py-0.101.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
75
|
+
commonmeta_py-0.101.dist-info/entry_points.txt,sha256=U4w4BoRuS3rN5t5Y-uYSyOeU5Lh_VRVMS9OIDzIgw4w,50
|
76
|
+
commonmeta_py-0.101.dist-info/licenses/LICENSE,sha256=746hEF2wZCKkcckk5-_DcBLtHewfaEMS4iXTlA1PVwk,1074
|
77
|
+
commonmeta_py-0.101.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|