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:
parent
df935627c4
commit
7346171bd2
1 changed files with 5 additions and 4 deletions
9
dnf-json
9
dnf-json
|
|
@ -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 = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue