Fix lint
This commit is contained in:
parent
278093afae
commit
016c102e57
@ -38,6 +38,7 @@ REQ_DIR = os.path.join(REPO_DIR, 'misc', 'requirements')
|
|||||||
|
|
||||||
|
|
||||||
def convert_line(line, comments):
|
def convert_line(line, comments):
|
||||||
|
"""Convert the given requirement line to place into the output."""
|
||||||
for pattern, repl in comments['replace'].items():
|
for pattern, repl in comments['replace'].items():
|
||||||
line = re.sub(pattern, repl, line)
|
line = re.sub(pattern, repl, line)
|
||||||
|
|
||||||
@ -60,6 +61,14 @@ def convert_line(line, comments):
|
|||||||
|
|
||||||
|
|
||||||
def read_comments(fobj):
|
def read_comments(fobj):
|
||||||
|
"""Find special comments in the config.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fobj: A file object for the config.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
A dict with the parsed comment data.
|
||||||
|
"""
|
||||||
comments = {
|
comments = {
|
||||||
'filter': {},
|
'filter': {},
|
||||||
'comment': {},
|
'comment': {},
|
||||||
@ -86,12 +95,15 @@ def read_comments(fobj):
|
|||||||
|
|
||||||
|
|
||||||
def get_all_names():
|
def get_all_names():
|
||||||
|
"""Get all requirement names based on filenames."""
|
||||||
for filename in glob.glob(os.path.join(REQ_DIR, 'requirements-*.txt-raw')):
|
for filename in glob.glob(os.path.join(REQ_DIR, 'requirements-*.txt-raw')):
|
||||||
basename = os.path.basename(filename)
|
basename = os.path.basename(filename)
|
||||||
yield basename[len('requirements-'):-len('.txt-raw')]
|
yield basename[len('requirements-'):-len('.txt-raw')]
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
"""Re-compile the given (or all) requirement files."""
|
||||||
|
|
||||||
names = sys.argv[1:] if len(sys.argv) > 1 else get_all_names()
|
names = sys.argv[1:] if len(sys.argv) > 1 else get_all_names()
|
||||||
|
|
||||||
for name in names:
|
for name in names:
|
||||||
|
Loading…
Reference in New Issue
Block a user