commonmeta-py 0.79__py3-none-any.whl → 0.81__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.79"
13
+ __version__ = "0.81"
14
14
  __author__ = "Martin Fenner"
15
15
  __license__ = "MIT"
16
16
 
@@ -166,7 +166,9 @@ def is_personal_name(name):
166
166
  "Government",
167
167
  "Count",
168
168
  "Reviewers",
169
+ "Staff",
169
170
  "Lab",
171
+ "Redkation",
170
172
  ]
171
173
  ):
172
174
  return False
@@ -70,28 +70,28 @@ def get_schema_org(pid: str, **kwargs) -> dict:
70
70
  return {"@id": url, "@type": "WebPage", "state": state, "via": "schema_org"}
71
71
  elif response.headers.get("content-type") == "application/pdf":
72
72
  try:
73
- pdf = pikepdf.Pdf.open(io.BytesIO(response.content))
74
- meta = pdf.docinfo if pdf.docinfo else {}
75
- if meta.get("/doi", None) is not None:
76
- return get_doi_meta(meta.get("/doi"))
77
- date_modified = (
78
- get_datetime_from_pdf_time(meta.get("/ModDate"))
79
- if meta.get("/ModDate", None)
80
- else None
81
- )
82
- name = meta.get("/Title", None)
83
- return compact(
84
- {
85
- "@id": url,
86
- "@type": "DigitalDocument",
87
- "via": "schema_org",
88
- "name": str(name),
89
- "datePublished": date_modified,
90
- "dateAccessed": datetime.now().isoformat("T", "seconds")
91
- if date_modified is None
92
- else None,
93
- }
94
- )
73
+ pdf = pikepdf.open(io.BytesIO(response.content))
74
+ with pdf.open_metadata() as meta:
75
+ if meta.get("/doi", None) is not None:
76
+ return get_doi_meta(meta.get("/doi"))
77
+ date_modified = (
78
+ get_datetime_from_pdf_time(meta.get("/ModDate"))
79
+ if meta.get("/ModDate", None)
80
+ else None
81
+ )
82
+ name = meta.get("/Title", None)
83
+ return compact(
84
+ {
85
+ "@id": url,
86
+ "@type": "DigitalDocument",
87
+ "via": "schema_org",
88
+ "name": str(name),
89
+ "datePublished": date_modified,
90
+ "dateAccessed": datetime.now().isoformat("T", "seconds")
91
+ if date_modified is None
92
+ else None,
93
+ }
94
+ )
95
95
  except Exception as error:
96
96
  print(error)
97
97
  return {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commonmeta-py
3
- Version: 0.79
3
+ Version: 0.81
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
@@ -28,7 +28,7 @@ Requires-Dist: httpx<0.29,>=0.28
28
28
  Requires-Dist: jsonschema~=4.21
29
29
  Requires-Dist: lxml>=4.8
30
30
  Requires-Dist: nameparser<2,>=1.1.2
31
- Requires-Dist: nbstripout<0.7,>=0.6
31
+ Requires-Dist: nbstripout<0.9,>=0.6
32
32
  Requires-Dist: nh3<0.3,>=0.2.14
33
33
  Requires-Dist: orjson<4,>=3.9.14
34
34
  Requires-Dist: orjsonl<2,>=1.0.0
@@ -45,7 +45,7 @@ Requires-Dist: sphinxcontrib-issuetracker<0.12,>=0.11
45
45
  Requires-Dist: types-beautifulsoup4~=4.11
46
46
  Requires-Dist: types-dateparser~=1.1
47
47
  Requires-Dist: types-pyyaml~=6.0
48
- Requires-Dist: types-xmltodict<0.14,>=0.13
48
+ Requires-Dist: types-xmltodict<0.15,>=0.13
49
49
  Requires-Dist: xmltodict<0.15,>=0.12
50
50
  Description-Content-Type: text/markdown
51
51
 
@@ -1,6 +1,6 @@
1
- commonmeta/__init__.py,sha256=WuLGQH6hYOxK3z8njQfrvg0lTzFL79c6hbDX0Q3f5J4,1894
1
+ commonmeta/__init__.py,sha256=ShIx7ebhipQTBuFiptd5weNAAwgD3CAQu4kSXIf4IIk,1894
2
2
  commonmeta/api_utils.py,sha256=-ZHGVZZhJqnjnsLtp4-PoeHYbDqL0cQme7W70BEjo4U,2677
3
- commonmeta/author_utils.py,sha256=EZKgH7IwvCKO4GQepvvr-4S37a5Ysu_XwdJ76d5vrCQ,8413
3
+ commonmeta/author_utils.py,sha256=VNSUjxiyz5VSByXOkBmhvs1Ap3UU6tuGXTs7XjmP-q0,8459
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=50ubqc34mqDPXp_bI--rEOoXFiNF4mz_V66lk8FsxL4,18348
@@ -25,7 +25,7 @@ commonmeta/readers/inveniordm_reader.py,sha256=uS92St68UkO4Adh3PsCu9ox81aO0kek3Y
25
25
  commonmeta/readers/json_feed_reader.py,sha256=xWOO5w8uOhK1u5IaqOeRL0-f8wtAgDzPjvtK5n6s-nY,13386
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=Xv-VjZJkhz1vpC9tVbehI6y07iHvYq2MXWFo7q-wj4Y,17091
28
+ commonmeta/readers/schema_org_reader.py,sha256=biN5SZFl744mpoSWh-kIOiJPkAVrdythzs_m4P6t5VM,17159
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
@@ -69,8 +69,8 @@ commonmeta/writers/datacite_writer.py,sha256=UpDp4Brg5xrmS5T3QYoNi6PPXKdRxAo254e
69
69
  commonmeta/writers/inveniordm_writer.py,sha256=TctfZsiB8aiXWDLijJpxjMM77aKY6-hgKeAPDMfZoh4,11438
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.79.dist-info/METADATA,sha256=DDrPS9agpje5o7zqUuSYxPVCrFfS4xja-hBDnTC6eRE,7739
73
- commonmeta_py-0.79.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
74
- commonmeta_py-0.79.dist-info/entry_points.txt,sha256=U4w4BoRuS3rN5t5Y-uYSyOeU5Lh_VRVMS9OIDzIgw4w,50
75
- commonmeta_py-0.79.dist-info/licenses/LICENSE,sha256=746hEF2wZCKkcckk5-_DcBLtHewfaEMS4iXTlA1PVwk,1074
76
- commonmeta_py-0.79.dist-info/RECORD,,
72
+ commonmeta_py-0.81.dist-info/METADATA,sha256=ureCZpjzYqjLVS8fCWsiWNBYgBupTKJ6_0MtAraecaM,7739
73
+ commonmeta_py-0.81.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
74
+ commonmeta_py-0.81.dist-info/entry_points.txt,sha256=U4w4BoRuS3rN5t5Y-uYSyOeU5Lh_VRVMS9OIDzIgw4w,50
75
+ commonmeta_py-0.81.dist-info/licenses/LICENSE,sha256=746hEF2wZCKkcckk5-_DcBLtHewfaEMS4iXTlA1PVwk,1074
76
+ commonmeta_py-0.81.dist-info/RECORD,,