commonmeta-py 0.127__py3-none-any.whl → 0.128__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 +12 -17
- commonmeta/writers/inveniordm_writer.py +2 -7
- {commonmeta_py-0.127.dist-info → commonmeta_py-0.128.dist-info}/METADATA +1 -1
- {commonmeta_py-0.127.dist-info → commonmeta_py-0.128.dist-info}/RECORD +8 -8
- {commonmeta_py-0.127.dist-info → commonmeta_py-0.128.dist-info}/WHEEL +0 -0
- {commonmeta_py-0.127.dist-info → commonmeta_py-0.128.dist-info}/entry_points.txt +0 -0
- {commonmeta_py-0.127.dist-info → commonmeta_py-0.128.dist-info}/licenses/LICENSE +0 -0
commonmeta/__init__.py
CHANGED
commonmeta/utils.py
CHANGED
@@ -1325,24 +1325,19 @@ def subjects_as_string(subjects):
|
|
1325
1325
|
return ", ".join(keywords)
|
1326
1326
|
|
1327
1327
|
|
1328
|
-
def string_to_slug(text):
|
1329
|
-
"""
|
1330
|
-
|
1328
|
+
def string_to_slug(text: str) -> str:
|
1329
|
+
"""Makes a string lowercase and removes non-alphanumeric characters"""
|
1330
|
+
|
1331
|
+
# Remove optional FOS (Fields of Science) prefix
|
1331
1332
|
text = text.removeprefix("FOS: ")
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
slug = re.sub(r"[^a-z0-9-]", "", slug)
|
1341
|
-
# Remove multiple consecutive hyphens
|
1342
|
-
slug = re.sub(r"-+", "-", slug)
|
1343
|
-
# Remove leading and trailing hyphens
|
1344
|
-
slug = slug.strip("-")
|
1345
|
-
return slug
|
1333
|
+
|
1334
|
+
# Convert to lowercase and keep only letters and numbers
|
1335
|
+
result = ""
|
1336
|
+
for char in text:
|
1337
|
+
if char.isalnum():
|
1338
|
+
result += char.lower()
|
1339
|
+
|
1340
|
+
return result
|
1346
1341
|
|
1347
1342
|
|
1348
1343
|
# def reverse():
|
@@ -7,7 +7,6 @@ from typing import Dict, Optional
|
|
7
7
|
import orjson as json
|
8
8
|
import pydash as py_
|
9
9
|
import requests
|
10
|
-
from urllib3._collections import HTTPHeaderDict
|
11
10
|
|
12
11
|
from ..base_utils import compact, parse_attributes, presence, wrap
|
13
12
|
from ..constants import (
|
@@ -760,17 +759,13 @@ def update_legacy_record(record, legacy_key: str, field: str = None) -> dict:
|
|
760
759
|
return record
|
761
760
|
|
762
761
|
|
763
|
-
def search_by_slug(slug: str,
|
762
|
+
def search_by_slug(slug: str, type: str, host: str, token: str) -> Optional[str]:
|
764
763
|
"""Search for a community by slug in InvenioRDM"""
|
765
764
|
headers = {
|
766
765
|
"Authorization": f"Bearer {token}",
|
767
766
|
"Content-Type": "application/json",
|
768
767
|
}
|
769
|
-
params =
|
770
|
-
params.add("q", f"slug:{slug}")
|
771
|
-
params.add("type", type_value)
|
772
|
-
params.add("type", "subject")
|
773
|
-
params.add("size", 1)
|
768
|
+
params = [("q", f"slug:{slug}"), ("type", type), ("type", "subject"), ("size", 1)]
|
774
769
|
try:
|
775
770
|
response = requests.get(
|
776
771
|
f"https://{host}/api/communities", headers=headers, params=params
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: commonmeta-py
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.128
|
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,4 +1,4 @@
|
|
1
|
-
commonmeta/__init__.py,sha256=
|
1
|
+
commonmeta/__init__.py,sha256=xyW49190_8VsMvwhkGXYHBt4mg3KIclELe5Le3a1Ubs,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
|
@@ -10,7 +10,7 @@ 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
|
12
12
|
commonmeta/translators.py,sha256=CBMK4jrXRmGZiAhCh6wsJjhbDJWbcsda8UvXFXxccAw,1363
|
13
|
-
commonmeta/utils.py,sha256=
|
13
|
+
commonmeta/utils.py,sha256=1Q6vh1mhQRTcPsEEymAPPJxBgDfNOR1ZXF_UaaW9ZoM,53612
|
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=HMFK6QIg_XIlhmYIWL4EfIyuidYl5L_0TAwyG78XPlU,6244
|
@@ -80,11 +80,11 @@ commonmeta/writers/commonmeta_writer.py,sha256=QpfyhG__7o_XpsOTCPWxGymO7YKwZi2LQ
|
|
80
80
|
commonmeta/writers/crossref_xml_writer.py,sha256=rcPOfrGxU4mX7_fFywYWDW2FFUoKW9wD-JzW8nX1ipI,33915
|
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=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.
|
87
|
-
commonmeta_py-0.
|
88
|
-
commonmeta_py-0.
|
89
|
-
commonmeta_py-0.
|
90
|
-
commonmeta_py-0.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|