Skip to content

Commit 53dbd87

Browse files
committed
use str
1 parent a4019fe commit 53dbd87

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

easyDataverse/dataverse.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
from copy import deepcopy
35
import json
46
from uuid import UUID
5-
from typing import Callable, Dict, List, Optional, Tuple, IO
7+
from typing import Callable, Dict, List, Optional, Tuple, IO, Type
68
from urllib import parse
79

810
import httpx
11+
from easyDataverse.base import DataverseBase
912
from easyDataverse.license import CustomLicense, License
1013
from rich.panel import Panel
1114
from rich.progress import Progress, SpinnerColumn, TextColumn
@@ -62,6 +65,12 @@ class Dataverse(BaseModel):
6265
description="The native API provided by PyDataverse to use for interacting with the Dataverse installation beyond EasyDataverse.",
6366
)
6467

68+
metadatablocks: Dict[str, Type[DataverseBase]] = Field(
69+
default_factory=dict,
70+
description="The metadatablocks available in the Dataverse installation.",
71+
exclude=True,
72+
)
73+
6574
_dataset_gen: Callable = PrivateAttr()
6675
_connected: bool = PrivateAttr(default=False)
6776

@@ -86,8 +95,8 @@ def validate_api_token(cls, v):
8695

8796
def __init__(
8897
self,
89-
server_url: HttpUrl,
90-
api_token: Optional[UUID4] = None,
98+
server_url: str,
99+
api_token: Optional[str] = None,
91100
):
92101
super().__init__(
93102
server_url=server_url,
@@ -209,6 +218,7 @@ async def _process_metadatablock(
209218
block_cls._metadatablock_name = metadatablock.data.name # type: ignore
210219

211220
dataset.add_metadatablock(block_cls())
221+
self.metadatablocks[block_cls.__name__] = block_cls # type: ignore
212222

213223
def _version_is_compliant(self) -> bool:
214224
"""Checks whether the Dataverse version is 5.13 or above.

0 commit comments

Comments
 (0)