commonmeta-py 0.29__tar.gz → 0.31__tar.gz

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.
Files changed (74) hide show
  1. {commonmeta_py-0.29 → commonmeta_py-0.31}/PKG-INFO +1 -1
  2. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/__init__.py +1 -1
  3. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/inveniordm_reader.py +1 -1
  4. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/json_feed_reader.py +10 -4
  5. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/inveniordm_writer.py +22 -10
  6. {commonmeta_py-0.29 → commonmeta_py-0.31}/pyproject.toml +1 -1
  7. {commonmeta_py-0.29 → commonmeta_py-0.31}/LICENSE +0 -0
  8. {commonmeta_py-0.29 → commonmeta_py-0.31}/README.md +0 -0
  9. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/api_utils.py +0 -0
  10. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/author_utils.py +0 -0
  11. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/base_utils.py +0 -0
  12. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/cli.py +0 -0
  13. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/constants.py +0 -0
  14. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/crossref_utils.py +0 -0
  15. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/date_utils.py +0 -0
  16. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/doi_utils.py +0 -0
  17. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/metadata.py +0 -0
  18. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/__init__.py +0 -0
  19. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/bibtex_reader.py +0 -0
  20. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/cff_reader.py +0 -0
  21. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/codemeta_reader.py +0 -0
  22. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/commonmeta_reader.py +0 -0
  23. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/crossref_reader.py +0 -0
  24. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/crossref_xml_reader.py +0 -0
  25. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/csl_reader.py +0 -0
  26. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/datacite_reader.py +0 -0
  27. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/datacite_xml_reader.py +0 -0
  28. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/kbase_reader.py +0 -0
  29. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/ris_reader.py +0 -0
  30. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/readers/schema_org_reader.py +0 -0
  31. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/cff_v1.2.0.json +0 -0
  32. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/commonmeta_v0.12.json +0 -0
  33. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/commonmeta_v0.13.json +0 -0
  34. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/commonmeta_v0.14.json +0 -0
  35. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/AccessIndicators.xsd +0 -0
  36. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/JATS-journalpublishing1-3d2-mathml3-elements.xsd +0 -0
  37. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/JATS-journalpublishing1-3d2-mathml3.xsd +0 -0
  38. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/JATS-journalpublishing1-elements.xsd +0 -0
  39. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/JATS-journalpublishing1-mathml3-elements.xsd +0 -0
  40. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/JATS-journalpublishing1-mathml3.xsd +0 -0
  41. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/JATS-journalpublishing1.xsd +0 -0
  42. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/clinicaltrials.xsd +0 -0
  43. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/common5.3.1.xsd +0 -0
  44. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/crossref5.3.1.xsd +0 -0
  45. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/crossref_query_output3.0.xsd +0 -0
  46. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/fundref.xsd +0 -0
  47. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/module-ali.xsd +0 -0
  48. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref/relations.xsd +0 -0
  49. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/crossref-v0.2.json +0 -0
  50. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/csl-data.json +0 -0
  51. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/datacite-v4.5.json +0 -0
  52. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/datacite-v4.5pr.json +0 -0
  53. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/ietf-bcp-47.json +0 -0
  54. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/iso-8601.json +0 -0
  55. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/spdx/licenses.json +0 -0
  56. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/spdx-schema..json +0 -0
  57. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/styles/apa.csl +0 -0
  58. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/styles/chicago-author-date.csl +0 -0
  59. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/styles/harvard-cite-them-right.csl +0 -0
  60. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/styles/ieee.csl +0 -0
  61. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/styles/modern-language-association.csl +0 -0
  62. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/resources/styles/vancouver.csl +0 -0
  63. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/schema_utils.py +0 -0
  64. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/translators.py +0 -0
  65. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/utils.py +0 -0
  66. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/__init__.py +0 -0
  67. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/bibtex_writer.py +0 -0
  68. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/citation_writer.py +0 -0
  69. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/commonmeta_writer.py +0 -0
  70. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/crossref_xml_writer.py +0 -0
  71. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/csl_writer.py +0 -0
  72. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/datacite_writer.py +0 -0
  73. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/ris_writer.py +0 -0
  74. {commonmeta_py-0.29 → commonmeta_py-0.31}/commonmeta/writers/schema_org_writer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: commonmeta-py
3
- Version: 0.29
3
+ Version: 0.31
4
4
  Summary: Library for conversions to/from the Commonmeta scholarly metadata format
5
5
  Home-page: https://python.commonmeta.org
6
6
  License: MIT
@@ -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.29"
13
+ __version__ = "0.31"
14
14
  __author__ = "Martin Fenner"
15
15
  __license__ = "MIT"
16
16
 
@@ -79,6 +79,7 @@ def read_inveniordm(data: dict, **kwargs) -> Commonmeta:
79
79
  "title": "Zenodo",
80
80
  }
81
81
  )
82
+ publisher = {"name": "Zenodo"}
82
83
  else:
83
84
  container = py_.get(meta, "custom_fields.journal:journal")
84
85
  if container:
@@ -96,7 +97,6 @@ def read_inveniordm(data: dict, **kwargs) -> Commonmeta:
96
97
  )
97
98
  if license_:
98
99
  license_ = dict_to_spdx({"id": license_})
99
- print(license_)
100
100
  descriptions = format_descriptions(
101
101
  [
102
102
  py_.get(meta, "metadata.description"),
@@ -46,6 +46,7 @@ def read_json_feed_item(data: Optional[dict], **kwargs) -> Commonmeta:
46
46
  if data is None:
47
47
  return {"state": "not_found"}
48
48
  meta = data
49
+ print(meta)
49
50
  read_options = kwargs or {}
50
51
 
51
52
  url = normalize_url(meta.get("url", None))
@@ -65,10 +66,6 @@ def read_json_feed_item(data: Optional[dict], **kwargs) -> Commonmeta:
65
66
  title = parse_attributes(meta.get("title", None))
66
67
  titles = [{"title": sanitize(title)}] if title else None
67
68
 
68
- publisher = py_.get(meta, "blog.title", None)
69
- if publisher is not None:
70
- publisher = {"name": publisher}
71
-
72
69
  date: dict = {}
73
70
  date["published"] = (
74
71
  get_date_from_unix_timestamp(meta.get("published_at", None))
@@ -98,6 +95,15 @@ def read_json_feed_item(data: Optional[dict], **kwargs) -> Commonmeta:
98
95
  "identifierType": "ISSN" if issn else "URL",
99
96
  }
100
97
  )
98
+ publisher = (
99
+ {"name": "Front Matter"}
100
+ if is_rogue_scholar_doi(_id)
101
+ or (
102
+ container.get("identifierType", None) == "URL"
103
+ and furl(container.get("identifier", None)).host == "rogue-scholar.org"
104
+ )
105
+ else None
106
+ )
101
107
 
102
108
  description = meta.get("summary", None)
103
109
  if description is not None:
@@ -1,13 +1,12 @@
1
1
  """InvenioRDM writer for commonmeta-py"""
2
2
 
3
3
  import orjson as json
4
- import pydash as py_
5
4
 
6
- from ..utils import to_inveniordm
7
- from ..base_utils import compact, wrap, presence, parse_attributes
8
- from ..doi_utils import doi_from_url, validate_suffix
5
+ from ..base_utils import compact, wrap, parse_attributes
6
+ from ..date_utils import get_iso8601_date
7
+ from ..doi_utils import doi_from_url
9
8
  from ..constants import CM_TO_INVENIORDM_TRANSLATIONS
10
- from ..utils import pages_as_string, get_language, validate_orcid
9
+ from ..utils import get_language, validate_orcid
11
10
 
12
11
 
13
12
  def write_inveniordm(metadata):
@@ -40,6 +39,8 @@ def write_inveniordm(metadata):
40
39
  if container.get("identifierType", None) == "ISSN"
41
40
  else None
42
41
  )
42
+
43
+ subjects = [to_inveniordm_subject(i) for i in wrap(metadata.subjects)]
43
44
  data = compact(
44
45
  {
45
46
  "pids": {
@@ -60,15 +61,16 @@ def write_inveniordm(metadata):
60
61
  "publisher": metadata.publisher.get("name", None)
61
62
  if metadata.publisher
62
63
  else None,
63
- "publication_date": metadata.date.get("published")
64
+ "publication_date": get_iso8601_date(metadata.date.get("published"))
64
65
  if metadata.date.get("published", None)
65
66
  else None,
66
67
  "dates": [
67
- {"date": metadata.date.get("updated"), "type": "updated"}
68
+ {
69
+ "date": metadata.date.get("updated"),
70
+ "type": {"id": "updated"},
71
+ }
68
72
  ],
69
- "subjects": parse_attributes(
70
- wrap(metadata.subjects), content="subject", first=False
71
- ),
73
+ "subjects": subjects,
72
74
  "description": parse_attributes(
73
75
  metadata.descriptions, content="description", first=True
74
76
  ),
@@ -124,3 +126,13 @@ def to_inveniordm_creator(creator: dict) -> dict:
124
126
  }
125
127
  )
126
128
  }
129
+
130
+
131
+ def to_inveniordm_subject(subject: dict) -> dict:
132
+ """Convert subjects to inveniordm subjects"""
133
+ return compact(
134
+ {
135
+ "id": subject.get("id", None),
136
+ "subject": subject.get("subject", None),
137
+ }
138
+ )
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name="commonmeta-py"
3
- version="0.29"
3
+ version="0.31"
4
4
  repository = "https://github.com/front-matter/commonmeta-py"
5
5
  homepage = "https://python.commonmeta.org"
6
6
  documentation = "https://python.commonmeta.org"
File without changes
File without changes