Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88ede53

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

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

salt/modules/aptpkg.py

Lines changed: 4 additions & 2 deletions
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

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919

2020
def string_to_bool(s):
21+
"""
22+
Convert string representation of bool values to integer
23+
"""
2124
s = s.lower()
2225
if s in ("no", "false", "without", "off", "disable"):
2326
return 0
@@ -162,9 +165,7 @@ def __init__(self, key, doc):
162165
self.key = key
163166
self.__doc__ = doc
164167

165-
def __get__(
166-
self, obj, objtype = None
167-
):
168+
def __get__(self, obj, objtype=None):
168169
if obj is None:
169170
return self
170171
return obj.section.get(self.key, None)
@@ -181,9 +182,7 @@ def __init__(self, key, doc):
181182
self.key = key
182183
self.__doc__ = doc
183184

184-
def __get__(
185-
self, obj, objtype = None
186-
):
185+
def __get__(self, obj, objtype=None):
187186
if obj is None:
188187
return self
189188
return SourceEntry.mysplit(obj.section.get(self.key, ""))
@@ -199,7 +198,7 @@ def __init__(self, parent):
199198
def __get__(
200199
self,
201200
obj,
202-
objtype = None,
201+
objtype=None,
203202
):
204203
if obj is None:
205204
return self
@@ -211,6 +210,7 @@ def __set__(self, obj, value):
211210

212211

213212
def DeprecatedProperty(prop):
213+
"""Wrapper to mark deprecated properties"""
214214
return prop
215215

216216

@@ -224,7 +224,7 @@ def __init__(
224224
self,
225225
section,
226226
file,
227-
list = None,
227+
list=None,
228228
):
229229
if section is None:
230230
self.section = Section("")
@@ -344,8 +344,7 @@ def merge(self, other):
344344
if not isinstance(other, Deb822SourceEntry):
345345
return False
346346
if self.comment != other.comment and not any(
347-
"Added by software-properties" in c
348-
for c in (self.comment, other.comment)
347+
"Added by software-properties" in c for c in (self.comment, other.comment)
349348
):
350349
return False
351350

@@ -564,7 +563,7 @@ def file(self):
564563
class SourceEntry:
565564
"""single sources.list entry"""
566565

567-
def __init__(self, line, file = None):
566+
def __init__(self, line, file=None):
568567
self.invalid = False # is the source entry valid
569568
self.disabled = False # is it disabled ('#' in front)
570569
self.type = "" # what type (deb, deb-src)
@@ -579,9 +578,7 @@ def __init__(self, line, file = None):
579578
if file is None:
580579
file = _APT_SOURCES_LIST
581580
if file.endswith(".sources"):
582-
raise ValueError(
583-
"Classic SourceEntry cannot be written to .sources file"
584-
)
581+
raise ValueError("Classic SourceEntry cannot be written to .sources file")
585582
self.file = file # the file that the entry is located in
586583
self._parse_sources(line)
587584
self.template = None # type DistInfo.Suite
@@ -778,9 +775,7 @@ def __iter__(self):
778775
types"""
779776
yield from self.list
780777

781-
def __find(
782-
self, *predicates, **attrs
783-
):
778+
def __find(self, *predicates, **attrs):
784779
uri = attrs.pop("uri", None)
785780
for source in self.exploded_list():
786781
if uri and source.uri and uri.rstrip("/") != source.uri.rstrip("/"):
@@ -910,9 +905,7 @@ def load(self, file):
910905
with open(file) as f:
911906
if file.endswith(".sources"):
912907
for section in File(f):
913-
self.list.append(
914-
Deb822SourceEntry(section, file, list=self)
915-
)
908+
self.list.append(Deb822SourceEntry(section, file, list=self))
916909
else:
917910
for line in f:
918911
source = SourceEntry(line, file)
@@ -996,9 +989,7 @@ def exploded_list(self):
996989
for typ in entry.types:
997990
for uri in entry.uris:
998991
for sui in entry.suites:
999-
res.append(
1000-
ExplodedDeb822SourceEntry(entry, typ, uri, sui)
1001-
)
992+
res.append(ExplodedDeb822SourceEntry(entry, typ, uri, sui))
1002993

1003994
return res
1004995

0 commit comments

Comments
 (0)