mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
Apply Python 3 futurize transform libmodernize.fixes.fix_filter
Refer to #256
This commit is contained in:
committed by
Tim Abbott
parent
d3b63f9a2d
commit
def027a1ec
@@ -1,7 +1,9 @@
|
|||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python2.7
|
||||||
|
from __future__ import absolute_import
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from six.moves import filter
|
||||||
|
|
||||||
class Record:
|
class Record:
|
||||||
pass
|
pass
|
||||||
@@ -178,7 +180,7 @@ def check_our_files():
|
|||||||
if 'base.html' in fn: return False
|
if 'base.html' in fn: return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
templates = filter(ok, templates)
|
templates = list(filter(ok, templates))
|
||||||
|
|
||||||
|
|
||||||
assert len(templates) >= 10 # sanity check that we are actually doing work
|
assert len(templates) >= 10 # sanity check that we are actually doing work
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python2.7
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@@ -9,6 +10,7 @@ import traceback
|
|||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from six.moves import filter
|
||||||
|
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option('--full',
|
parser.add_option('--full',
|
||||||
@@ -54,7 +56,7 @@ if not files and not options.modified:
|
|||||||
# If no files are specified on the command line, use the entire git checkout
|
# If no files are specified on the command line, use the entire git checkout
|
||||||
files = map(str.strip, subprocess.check_output(['git', 'ls-files']).split('\n'))
|
files = map(str.strip, subprocess.check_output(['git', 'ls-files']).split('\n'))
|
||||||
|
|
||||||
files = filter(bool, files) # remove empty file caused by trailing \n
|
files = list(filter(bool, files)) # remove empty file caused by trailing \n
|
||||||
|
|
||||||
if not files:
|
if not files:
|
||||||
raise Exception('There are no files to check!')
|
raise Exception('There are no files to check!')
|
||||||
@@ -77,7 +79,7 @@ for filepath in files:
|
|||||||
|
|
||||||
by_lang[exn].append(filepath)
|
by_lang[exn].append(filepath)
|
||||||
|
|
||||||
by_lang['.sh'] = filter(None, map(str.strip, subprocess.check_output("grep --files-with-matches '#!.*\(ba\)\?sh' $(find scripts/ tools/ bin/ -type f | grep -v [.])", shell=True).split('\n')))
|
by_lang['.sh'] = [_f for _f in map(str.strip, subprocess.check_output("grep --files-with-matches '#!.*\(ba\)\?sh' $(find scripts/ tools/ bin/ -type f | grep -v [.])", shell=True).split('\n')) if _f]
|
||||||
|
|
||||||
# Invoke the appropriate lint checker for each language,
|
# Invoke the appropriate lint checker for each language,
|
||||||
# and also check files for extra whitespace.
|
# and also check files for extra whitespace.
|
||||||
|
|||||||
Reference in New Issue
Block a user