From b60109d3806ec0c65cf8d6076790f33a5d9d90e4 Mon Sep 17 00:00:00 2001 From: Oz Tiram Date: Sun, 10 Dec 2023 20:03:21 +0100 Subject: [PATCH] Address some pylint warnings --- src/plette/lockfiles.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plette/lockfiles.py b/src/plette/lockfiles.py index 33414ea..f060da1 100644 --- a/src/plette/lockfiles.py +++ b/src/plette/lockfiles.py @@ -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) @@ -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