Skip to content

Commit 8f04ae3

Browse files
Replace deprecated pydantic .dict() with .model_dump(). Formatting fixes.
1 parent 63215c4 commit 8f04ae3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pyff/resource.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
An abstraction layer for metadata fetchers. Supports both synchronous and asynchronous fetchers with cache.
44
55
"""
6+
67
from __future__ import annotations
78

89
import os
@@ -192,7 +193,7 @@ class ResourceInfo(BaseModel):
192193
state: Optional[ResourceLoadState] = None
193194
http_headers: Dict[str, Any] = Field({})
194195
reason: Optional[str] = None
195-
status_code: Optional[str] = None # HTTP status code as string. TODO: change to int
196+
status_code: Optional[str] = None # HTTP status code as string. TODO: change to int
196197
parser_info: Optional[ParserInfo] = None
197198
expired: Optional[bool] = None
198199
exception: Optional[BaseException] = None
@@ -221,6 +222,7 @@ def _format_key(k: str) -> str:
221222

222223
return res
223224

225+
224226
class Resource(Watchable):
225227
def __init__(self, url: Optional[str], opts: ResourceOpts):
226228
super().__init__()
@@ -280,7 +282,7 @@ def cleanup(self) -> Iterable[Callable]: # TODO: move classes to make this work
280282
def __str__(self):
281283
return "Resource {} expires at {} using ".format(
282284
self.url if self.url is not None else "(root)", self.expire_time
283-
) + ",".join(["{}={}".format(k, v) for k, v in sorted(list(self.opts.dict().items()))])
285+
) + ",".join(["{}={}".format(k, v) for k, v in sorted(list(self.opts.model_dump().items()))])
284286

285287
def reload(self, fail_on_error=False):
286288
with non_blocking_lock(self.lock):
@@ -485,7 +487,7 @@ def parse(self, getter: Callable[[str], Response]) -> Deque[Resource]:
485487
info.expired = False
486488

487489
if info.parser_info:
488-
for (eid, error) in list(info.parser_info.validation_errors.items()):
490+
for eid, error in list(info.parser_info.validation_errors.items()):
489491
log.error(error)
490492
else:
491493
log.debug(f'Parser did not produce anything (probably ok) when parsing {self.url} {info}')

0 commit comments

Comments
 (0)