pep8/pyflakes
This commit is contained in:
@@ -215,8 +215,8 @@ def main(verbosity=1):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# pylint: disable=invalid-name
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--verbose", "-v", action="count", default=0)
|
||||
args = parser.parse_args()
|
||||
ret = main(verbosity=args.verbose)
|
||||
sys.exit(ret)
|
||||
main(verbosity=args.verbose)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Utility library file for executing shell commands
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
import logging
|
||||
|
||||
@@ -42,6 +42,9 @@ def base(path1, *paths):
|
||||
|
||||
|
||||
def main(verbosity=1):
|
||||
"""
|
||||
Main entry point of script
|
||||
"""
|
||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
||||
create_dir_if_necessary(LOCALE_DIR)
|
||||
source_msgs_dir = CONFIGURATION.source_messages_dir
|
||||
@@ -215,8 +218,8 @@ def is_key_string(string):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# pylint: disable=invalid-name
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--verbose', '-v', action='count', default=0)
|
||||
args = parser.parse_args()
|
||||
ret = main(verbosity=args.verbose)
|
||||
sys.exit(ret)
|
||||
main(verbosity=args.verbose)
|
||||
|
||||
@@ -112,6 +112,9 @@ def validate_files(dir, files_to_merge):
|
||||
|
||||
|
||||
def main(strict=True, verbosity=1):
|
||||
"""
|
||||
Main entry point for script
|
||||
"""
|
||||
for locale in CONFIGURATION.translated_locales:
|
||||
merge_files(locale, fail_if_missing=strict)
|
||||
# Dummy text is not required. Don't raise exception if files are missing.
|
||||
@@ -129,6 +132,7 @@ def main(strict=True, verbosity=1):
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
parser = argparse.ArgumentParser(description="Generate merged and compiled message files.")
|
||||
parser.add_argument("--strict", action='store_true', help="Complain about missing files.")
|
||||
parser.add_argument("--verbose", "-v", action="count", default=0)
|
||||
|
||||
@@ -117,7 +117,10 @@ def segment_pofile(filename, segments):
|
||||
return files_written
|
||||
|
||||
|
||||
def main(locales=None, verbosity=1):
|
||||
def main(locales=None, verbosity=1): # pylint: disable=unused-argument
|
||||
"""
|
||||
Main entry point of script
|
||||
"""
|
||||
# This is used as a tool only to segment translation files when adding a
|
||||
# new segment. In the regular workflow, the work is done by the extract
|
||||
# phase calling the functions above.
|
||||
@@ -129,6 +132,7 @@ def main(locales=None, verbosity=1):
|
||||
if __name__ == "__main__":
|
||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
description = textwrap.dedent("""
|
||||
Segment the .po files in LOCALE(s) based on the segmenting rules in
|
||||
config.yaml.
|
||||
|
||||
@@ -56,7 +56,7 @@ class TestGenerate(TestCase):
|
||||
.mo files should exist, and be recently created (modified
|
||||
after start of test suite)
|
||||
"""
|
||||
generate.main(verbosity=0,strict=False)
|
||||
generate.main(verbosity=0, strict=False)
|
||||
for locale in CONFIGURATION.translated_locales:
|
||||
for filename in ('django', 'djangojs'):
|
||||
mofile = filename+'.mo'
|
||||
|
||||
@@ -64,10 +64,12 @@ def get_new_header(po):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# pylint: disable=invalid-name
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("command", help="push or pull")
|
||||
parser.add_argument("--verbose", "-v")
|
||||
args = parser.parse_args()
|
||||
# pylint: enable=invalid-name
|
||||
|
||||
if args.command == "push":
|
||||
push()
|
||||
|
||||
@@ -153,7 +153,7 @@ def get_parser():
|
||||
"""
|
||||
Returns an argument parser for this script.
|
||||
"""
|
||||
parser = argparse.ArgumentParser(description=(
|
||||
parser = argparse.ArgumentParser(description=( # pylint: disable=redefined-outer-name
|
||||
"Automatically finds translation errors in all edx-platform *.po files, "
|
||||
"for all languages, unless one or more language(s) is specified to check."
|
||||
))
|
||||
@@ -180,7 +180,10 @@ def get_parser():
|
||||
return parser
|
||||
|
||||
|
||||
def main(languages=None, empty=False, verbosity=1):
|
||||
def main(languages=None, empty=False, verbosity=1): # pylint: disable=unused-argument
|
||||
"""
|
||||
Main entry point for script
|
||||
"""
|
||||
languages = languages or []
|
||||
|
||||
if not languages:
|
||||
@@ -200,6 +203,7 @@ def main(languages=None, empty=False, verbosity=1):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# pylint: disable=invalid-name
|
||||
parser = get_parser()
|
||||
args = parser.parse_args()
|
||||
if args.verbose:
|
||||
@@ -207,5 +211,6 @@ if __name__ == '__main__':
|
||||
else:
|
||||
log_level = logging.WARNING
|
||||
logging.basicConfig(stream=sys.stdout, level=log_level)
|
||||
# pylint: enable=invalid-name
|
||||
|
||||
main(languages=args.language, empty=args.empty, verbosity=args.verbose)
|
||||
|
||||
Reference in New Issue
Block a user