Skip to content

Commit

Permalink
Address some pylint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
oz123 committed Dec 10, 2023
1 parent 08b8545 commit b60109d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/plette/lockfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,23 @@ def with_meta_from(cls, pipfile, categories=None):
"requires": _copy_jsonsafe(getattr(pipfile, "requires", {})),
},
}

data["_meta"].update(asdict(pipfile.sources))

if categories is None:
data["default"] = _copy_jsonsafe(getattr(pipfile, "packages", {}))
data["develop"] = _copy_jsonsafe(getattr(pipfile, "dev-packages", {}))
else:
for category in categories:
if category == "default" or category == "packages":
if category in ["default", "packages"]:
data["default"] = _copy_jsonsafe(getattr(pipfile,"packages", {}))
elif category == "develop" or category == "dev-packages":
data["develop"] = _copy_jsonsafe(getattr(pipfile,"dev-packages", {}))
elif category in ["develop", "dev-packages"]:
data["develop"] = _copy_jsonsafe(
getattr(pipfile,"dev-packages", {}))
else:
data[category] = _copy_jsonsafe(getattr(pipfile, category, {}))
if "default" not in data:
data["default"] = {}
data["default"] = {}
if "develop" not in data:
data["develop"] = {}
return cls(data)
Expand All @@ -155,7 +158,7 @@ def __getitem__(self, key):
value = self[key]
try:
if key == "_meta":
return Meta(value)
return Meta(**value)
return PackageCollection(value)
except KeyError:
return value
Expand Down

0 comments on commit b60109d

Please sign in to comment.