Skip to content

Commit

Permalink
parse_obj → model_validate
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Oct 29, 2024
1 parent eb9ff2d commit 68cdf54
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions conda_lock/lockfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ def parse_conda_lock_file(path: pathlib.Path) -> Lockfile:
content = yaml.safe_load(f)
version = content.pop("version", None)
if version == 1:
lockfile = lockfile_v1_to_v2(LockfileV1.parse_obj(content))
lockfile = lockfile_v1_to_v2(LockfileV1.model_validate(content))
elif version == 2:
lockfile = Lockfile.parse_obj(content)
lockfile = Lockfile.model_validate(content)
elif version is None:
raise MissingLockfileVersion(f"{path} is missing a version")
else:
Expand Down
2 changes: 1 addition & 1 deletion conda_lock/pypi_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def _compute_hash(link: Link, lock_spec_hash: Optional[str]) -> HashModel:
hashes: Dict[str, str] = {}
if link.hash_name is not None and link.hash is not None:
hashes[link.hash_name] = link.hash
return HashModel.parse_obj(hashes)
return HashModel.model_validate(hashes)
else:
# A hash was provided in the lock spec, so that takes precedence
algo, value = lock_spec_hash.split(":")
Expand Down
2 changes: 1 addition & 1 deletion conda_lock/virtual_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def virtual_package_repo_from_specification(
data = yaml.safe_load(fp)
logging.debug("Virtual package spec: %s", data)

spec = VirtualPackageSpec.parse_obj(data)
spec = VirtualPackageSpec.model_validate(data)

repodata = _init_fake_repodata()
for subdir, subdir_spec in spec.subdirs.items():
Expand Down

0 comments on commit 68cdf54

Please sign in to comment.