dnf-json: staticify methods that don't need to be instance methods

These two methods don't rely on the object instance at all so they
should be static.
The _timestamp_to_rfc() method can be a one-liner.
This commit is contained in:
Achilleas Koutsou 2022-03-04 13:16:57 +01:00 committed by Christian Kellner
parent df935627c4
commit 7346171bd2

View file

@ -131,7 +131,8 @@ class Solver():
self.base.repos.add(self._dnfrepo(repo, self.base.conf))
self.base.fill_sack(load_system_repo=False)
def _dnfrepo(self, desc, parent_conf=None):
@staticmethod
def _dnfrepo(desc, parent_conf=None):
"""Makes a dnf.repo.Repo out of a JSON repository description"""
repo = dnf.repo.Repo(desc["id"], parent_conf)
@ -190,9 +191,9 @@ class Solver():
return checksums
def _timestamp_to_rfc3339(self, timestamp):
d = datetime.utcfromtimestamp(timestamp)
return d.strftime('%Y-%m-%dT%H:%M:%SZ')
@staticmethod
def _timestamp_to_rfc3339(timestamp):
return datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%dT%H:%M:%SZ')
def dump(self):
packages = []