From dfbb4c24f6e059bed45d19e45a3e6647202f8f20 Mon Sep 17 00:00:00 2001 From: David Pape Date: Thu, 19 Dec 2024 15:04:39 +0100 Subject: [PATCH] =?UTF-8?q?`SchemaOrgSoftware{Publication=20=E2=86=92=20Ap?= =?UTF-8?q?plication}`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parapraxis :-) --- docs/source/_ext/plugin_markup.py | 6 +++--- src/hermes/commands/marketplace.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/source/_ext/plugin_markup.py b/docs/source/_ext/plugin_markup.py index 6cb73f4c..d8c1d635 100644 --- a/docs/source/_ext/plugin_markup.py +++ b/docs/source/_ext/plugin_markup.py @@ -16,7 +16,7 @@ from hermes.commands.marketplace import ( SchemaOrgOrganization, - SchemaOrgSoftwarePublication, + SchemaOrgSoftwareApplication, schema_org_hermes, ) @@ -44,7 +44,7 @@ def keywordify(text: str) -> str: return re.sub(r"[^a-z]", "-", text) -def plugin_to_schema_org(plugin: Dict[str, Any]) -> SchemaOrgSoftwarePublication: +def plugin_to_schema_org(plugin: Dict[str, Any]) -> SchemaOrgSoftwareApplication: """Convert plugin metadata from the used JSON format to Schema.org. The ``plugin`` is transformed into a ``schema:SoftwareApplication``. For most @@ -63,7 +63,7 @@ def plugin_to_schema_org(plugin: Dict[str, Any]) -> SchemaOrgSoftwarePublication harvested_files = plugin.get("harvested_files", []) keywords += [f"hermes-harvest-{keywordify(file)}" for file in harvested_files] - return SchemaOrgSoftwarePublication( + return SchemaOrgSoftwareApplication( name=plugin.get("name"), url=plugin.get("repository_url"), install_url=plugin.get("pypi_url"), diff --git a/src/hermes/commands/marketplace.py b/src/hermes/commands/marketplace.py index 5f3d9080..a6a35192 100644 --- a/src/hermes/commands/marketplace.py +++ b/src/hermes/commands/marketplace.py @@ -46,7 +46,7 @@ class SchemaOrgOrganization(SchemaOrgModel): name: str -class SchemaOrgSoftwarePublication(SchemaOrgModel): +class SchemaOrgSoftwareApplication(SchemaOrgModel): """Validation and serialization of ``schema:SoftwarePublication``. This model does not incorporate all possible fields and is meant to be used merely @@ -60,11 +60,11 @@ class SchemaOrgSoftwarePublication(SchemaOrgModel): install_url: Optional[str] = None abstract: Optional[str] = None author: Optional[SchemaOrgOrganization] = None - is_part_of: Optional["SchemaOrgSoftwarePublication"] = None + is_part_of: Optional["SchemaOrgSoftwareApplication"] = None keywords: List["str"] = None -schema_org_hermes = SchemaOrgSoftwarePublication(id_=hermes_doi, name="hermes") +schema_org_hermes = SchemaOrgSoftwareApplication(id_=hermes_doi, name="hermes") class PluginMarketPlaceParser(HTMLParser): @@ -73,7 +73,7 @@ class PluginMarketPlaceParser(HTMLParser): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.is_json_ld: bool = False - self.plugins: List[SchemaOrgSoftwarePublication] = [] + self.plugins: List[SchemaOrgSoftwareApplication] = [] def handle_starttag(self, tag, attrs): if tag == "script" and ("type", "application/ld+json") in attrs: @@ -84,7 +84,7 @@ def handle_endtag(self, tag): def handle_data(self, data): if self.is_json_ld: - plugin = SchemaOrgSoftwarePublication.model_validate_json(data) + plugin = SchemaOrgSoftwareApplication.model_validate_json(data) self.plugins.append(plugin)