Skip to content

Commit

Permalink
changes for release
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskoenig committed Sep 14, 2023
1 parent 69b367b commit 1d73f68
Show file tree
Hide file tree
Showing 4 changed files with 2,994 additions and 2,968 deletions.
2 changes: 1 addition & 1 deletion release-notes/0.3.10.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Release notes for pymetadata 0.3.9
# Release notes for pymetadata 0.3.10
![pymetadata](https://github.com/matthiaskoenig/pymetadata/raw/develop/docs/images/favicon/pymetadata-100x100-300dpi.png)

We are pleased to release the next version of pymetadata including the
Expand Down
10 changes: 10 additions & 0 deletions release-notes/0.3.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Release notes for pymetadata 0.3.11
![pymetadata](https://github.com/matthiaskoenig/pymetadata/raw/develop/docs/images/favicon/pymetadata-100x100-300dpi.png)

We are pleased to release the next version of pymetadata including the
following changes:

## Features
- fix issue with registry: unexpected keyword argument 'deprecationOfflineDate'

Your pymetadata team
22 changes: 19 additions & 3 deletions src/pymetadata/identifiers/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
https://identifiers.org/
https://docs.identifiers.org/articles/api.html
"""
from __future__ import annotations
import inspect
import os
import time
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Optional
from typing import Dict, List, Optional, Any

import requests

Expand Down Expand Up @@ -42,6 +44,13 @@ class Resource:
authHelpUrl: Optional[str] = field(repr=False, default=None)
authHelpDescription: Optional[str] = field(repr=False, default=None)

@classmethod
def from_dict(cls, d: Dict[str, Any]) -> Resource:
"""Handle additional keyword arguments."""
return cls(
**{k: v for k, v in d.items() if k in inspect.signature(cls).parameters}
)


@dataclass
class Namespace:
Expand All @@ -61,10 +70,17 @@ class Namespace:
deprecated: bool = field(repr=False, default=False)
deprecationDate: Optional[str] = field(repr=False, default=None)

@classmethod
def from_dict(cls, d: Dict[str, Any]) -> Namespace:
"""Handle additional keyword arguments."""
return cls(
**{k: v for k, v in d.items() if k in inspect.signature(cls).parameters}
)

def __post_init__(self) -> None:
"""Set resources."""
if self.resources is not None:
self.resources = [Resource(**d) for d in self.resources]
self.resources = [Resource.from_dict(d) for d in self.resources]
else:
self.resources = list()

Expand Down Expand Up @@ -337,7 +353,7 @@ def update_registry(

ns_dict = {}
for _, data in enumerate(namespaces):
ns = Namespace(**data)
ns = Namespace.from_dict(data)
# for resource in ns.resources:
# print(resource)

Expand Down
Loading

0 comments on commit 1d73f68

Please sign in to comment.