Skip to content

Commit 3786706

Browse files
committed
Make pre-check happy
1 parent ca24e93 commit 3786706

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

salt/modules/aptpkg.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
)
4646
from salt.modules.cmdmod import _parse_env
4747
from salt.utils.pkg.deb import (
48-
_invalid,
4948
Deb822SourceEntry,
5049
Section,
5150
SourceEntry,
5251
SourcesList,
52+
_invalid,
5353
)
5454
from salt.utils.versions import warn_until_date
5555

@@ -2661,7 +2661,9 @@ def mod_repo(repo, saltenv="base", aptkey=True, **kwargs):
26612661
if not mod_source:
26622662
apt_source_file = kwargs.get("file")
26632663
if not apt_source_file:
2664-
raise SaltInvocationError("missing 'file' argument when defining a new repository")
2664+
raise SaltInvocationError(
2665+
"missing 'file' argument when defining a new repository"
2666+
)
26652667

26662668
if not apt_source_file.endswith(".list"):
26672669
section = Section("")

salt/utils/pkg/deb.py

+10-23
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ def __init__(self, key, doc):
162162
self.key = key
163163
self.__doc__ = doc
164164

165-
def __get__(
166-
self, obj, objtype = None
167-
):
165+
def __get__(self, obj, objtype=None):
168166
if obj is None:
169167
return self
170168
return obj.section.get(self.key, None)
@@ -181,9 +179,7 @@ def __init__(self, key, doc):
181179
self.key = key
182180
self.__doc__ = doc
183181

184-
def __get__(
185-
self, obj, objtype = None
186-
):
182+
def __get__(self, obj, objtype=None):
187183
if obj is None:
188184
return self
189185
return SourceEntry.mysplit(obj.section.get(self.key, ""))
@@ -199,7 +195,7 @@ def __init__(self, parent):
199195
def __get__(
200196
self,
201197
obj,
202-
objtype = None,
198+
objtype=None,
203199
):
204200
if obj is None:
205201
return self
@@ -224,7 +220,7 @@ def __init__(
224220
self,
225221
section,
226222
file,
227-
list = None,
223+
list=None,
228224
):
229225
if section is None:
230226
self.section = Section("")
@@ -344,8 +340,7 @@ def merge(self, other):
344340
if not isinstance(other, Deb822SourceEntry):
345341
return False
346342
if self.comment != other.comment and not any(
347-
"Added by software-properties" in c
348-
for c in (self.comment, other.comment)
343+
"Added by software-properties" in c for c in (self.comment, other.comment)
349344
):
350345
return False
351346

@@ -564,7 +559,7 @@ def file(self):
564559
class SourceEntry:
565560
"""single sources.list entry"""
566561

567-
def __init__(self, line, file = None):
562+
def __init__(self, line, file=None):
568563
self.invalid = False # is the source entry valid
569564
self.disabled = False # is it disabled ('#' in front)
570565
self.type = "" # what type (deb, deb-src)
@@ -579,9 +574,7 @@ def __init__(self, line, file = None):
579574
if file is None:
580575
file = _APT_SOURCES_LIST
581576
if file.endswith(".sources"):
582-
raise ValueError(
583-
"Classic SourceEntry cannot be written to .sources file"
584-
)
577+
raise ValueError("Classic SourceEntry cannot be written to .sources file")
585578
self.file = file # the file that the entry is located in
586579
self._parse_sources(line)
587580
self.template = None # type DistInfo.Suite
@@ -778,9 +771,7 @@ def __iter__(self):
778771
types"""
779772
yield from self.list
780773

781-
def __find(
782-
self, *predicates, **attrs
783-
):
774+
def __find(self, *predicates, **attrs):
784775
uri = attrs.pop("uri", None)
785776
for source in self.exploded_list():
786777
if uri and source.uri and uri.rstrip("/") != source.uri.rstrip("/"):
@@ -910,9 +901,7 @@ def load(self, file):
910901
with open(file) as f:
911902
if file.endswith(".sources"):
912903
for section in File(f):
913-
self.list.append(
914-
Deb822SourceEntry(section, file, list=self)
915-
)
904+
self.list.append(Deb822SourceEntry(section, file, list=self))
916905
else:
917906
for line in f:
918907
source = SourceEntry(line, file)
@@ -996,9 +985,7 @@ def exploded_list(self):
996985
for typ in entry.types:
997986
for uri in entry.uris:
998987
for sui in entry.suites:
999-
res.append(
1000-
ExplodedDeb822SourceEntry(entry, typ, uri, sui)
1001-
)
988+
res.append(ExplodedDeb822SourceEntry(entry, typ, uri, sui))
1002989

1003990
return res
1004991

0 commit comments

Comments
 (0)