Skip to content

Commit

Permalink
Merge pull request #16 from mtausig/flake
Browse files Browse the repository at this point in the history
Improve codestyle
  • Loading branch information
lxp authored Oct 7, 2020
2 parents 7181e8e + 3d1a5fc commit 3ab9902
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: check-manifest .

- name: Run flake
continue-on-error: true
continue-on-error: false
run: flake8 --exclude=build,venv --ignore= --max-line-length=200 --max-complexity=75 --show-source --statistics .

- name: Check distribution
Expand Down
34 changes: 17 additions & 17 deletions lib/cfv/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,10 +735,10 @@ class FooSum_Base(TextChksumType):
def do_test_chksumfile_print_testingline(self, file):
TextChksumType.do_test_chksumfile_print_testingline(self, file, parse_commentline(file.peekline(512), ';#'))

def do_test_chksumline(self, l):
if l[0] in ';#':
def do_test_chksumline(self, line):
if line[0] in ';#':
return
x = self._foosum_rem.match(l)
x = self._foosum_rem.match(line)
if not x:
return -1
if x.group(2) == ' ':
Expand Down Expand Up @@ -897,8 +897,8 @@ def auto_chksumfile_match(file, _autorem=re.compile(r'MD5 \(.+\) = [0-9a-fA-F]{3

_bsdmd5rem = re.compile(r'MD5 \((.+)\) = ([0-9a-fA-F]{32})[\r\n]*$')

def do_test_chksumline(self, l):
x = self._bsdmd5rem.match(l)
def do_test_chksumline(self, line):
x = self._bsdmd5rem.match(line)
if not x:
return -1
self.test_file(x.group(1), unhexlify(x.group(2)))
Expand Down Expand Up @@ -1397,10 +1397,10 @@ def do_test_chksumfile_print_testingline(self, file):
# override the default testing line to show first SFV comment line, if any
TextChksumType.do_test_chksumfile_print_testingline(self, file, parse_commentline(file.peekline(512), ';'))

def do_test_chksumline(self, l):
if l[0] == ';':
def do_test_chksumline(self, line):
if line[0] == ';':
return
x = self._sfvrem.match(l)
x = self._sfvrem.match(line)
if not x:
return -1
self.test_file(x.group(1), unhexlify(x.group(2)))
Expand Down Expand Up @@ -1502,8 +1502,8 @@ def auto_chksumfile_match(file, _autorem=re.compile(_csvfnautore + '[0-9]+,[0-9a

_csvrem = re.compile(_csvfnre + r'([0-9]+),([0-9a-fA-F]{8}),')

def do_test_chksumline(self, l):
x = self._csvrem.match(l)
def do_test_chksumline(self, line):
x = self._csvrem.match(line)
if not x:
return -1
self.test_file(csvunquote(x.group(1), x.group(2)), unhexlify(x.group(4)), int(x.group(3)))
Expand Down Expand Up @@ -1534,8 +1534,8 @@ def auto_chksumfile_match(file, _autorem=re.compile(r'%s[0-9]+,[0-9a-fA-F]{8},%s

_csv4rem = re.compile(r'%s([0-9]+),([0-9a-fA-F]{8}),%s' % (_csvfnre, _csvstrre))

def do_test_chksumline(self, l):
x = self._csv4rem.match(l)
def do_test_chksumline(self, line):
x = self._csv4rem.match(line)
if not x:
return -1
name = csvunquote(x.group(1), x.group(2))
Expand Down Expand Up @@ -1569,8 +1569,8 @@ def auto_chksumfile_match(file, _autorem=re.compile(_csvfnautore + '[0-9]+,[\n\r

_csv2rem = re.compile(_csvfnre + r'([0-9]+),')

def do_test_chksumline(self, l):
x = self._csv2rem.match(l)
def do_test_chksumline(self, line):
x = self._csv2rem.match(line)
if not x:
return -1
self.test_file(csvunquote(x.group(1), x.group(2)), None, int(x.group(3)))
Expand Down Expand Up @@ -1646,11 +1646,11 @@ def do_test_chksumfile_print_testingline(self, file):
_commentboundary = re.compile(r'^-+(\s+-+){1,4}\s*$')
_nstrip = re.compile(r'[.,]')

def do_test_chksumline(self, l):
if self._commentboundary.match(l):
def do_test_chksumline(self, line):
if self._commentboundary.match(line):
self.in_comments = not self.in_comments
return
x = self._crcrem.match(l)
x = self._crcrem.match(line)
if not x:
if self.in_comments:
return
Expand Down
2 changes: 1 addition & 1 deletion lib/cfv/osutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def path_split(filename):
return parts


def strippath(filename, num='a', _splitdrivere=re.compile(r'[a-z]:[/\\]', re.I)):
def strippath(filename, num='a', _splitdrivere=re.compile(r'[a-z]:[/\\]', re.IGNORECASE)):
"""Strip off path components from the left side of the filename.
>>> strippath(os.path.join('c:','foo','bar','baz'))
Expand Down
6 changes: 3 additions & 3 deletions lib/cfv/strutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from StringIO import StringIO


def safesort(l):
def safesort(line):
sl = []
ul = []
for s in l:
for s in line:
if isinstance(s, str):
sl.append(s)
else:
ul.append(s)
sl.sort()
ul.sort()
l[:] = ul + sl
line[:] = ul + sl


def showfn(s):
Expand Down
2 changes: 1 addition & 1 deletion test/cfvtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def isatty(self):
def write(self, s):
pass

def writelines(self, l):
def writelines(self, lines):
pass

def flush(self):
Expand Down

0 comments on commit 3ab9902

Please sign in to comment.