Skip to content

Commit

Permalink
PEP8: E305 expected 2 blank lines after class or function definition,…
Browse files Browse the repository at this point in the history
… found 1
  • Loading branch information
dwaynebailey committed Dec 6, 2016
1 parent 702ca65 commit e07a57c
Show file tree
Hide file tree
Showing 41 changed files with 53 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/odf_xliff/test_odf_xliff.py
Expand Up @@ -60,6 +60,7 @@ def args(src, tgt, **kwargs):
def xliff___eq__(self, other):
return self.units == other.units


xliff.xlifffile.__eq__ = xliff___eq__


Expand All @@ -69,6 +70,7 @@ def print_diff(store1, store2):
for line in difflib.unified_diff(store1_lines, store2_lines):
print(line)


SOURCE_ODF = u'test_2.odt'
REFERENCE_XLF = u'test_2-test_odf2xliff-reference.xlf'
GENERATED_XLF_ITOOLS = u'test_2-test_odf2xliff-itools.xlf'
Expand Down
1 change: 1 addition & 0 deletions tools/mozilla/buildxpi.py
Expand Up @@ -283,6 +283,7 @@ def create_option_parser():

return p


if __name__ == '__main__':
args = create_option_parser().parse_args()

Expand Down
1 change: 1 addition & 0 deletions tools/mozilla/get_moz_enUS.py
Expand Up @@ -126,6 +126,7 @@ def create_option_parser():

return p


if __name__ == '__main__':
args = create_option_parser().parse_args()
srccheckout = args.srcdir
Expand Down
1 change: 1 addition & 0 deletions tools/mozilla/mozcronbuild.py
Expand Up @@ -94,5 +94,6 @@ def main_cmd_line():

main(langs, args.verbose)


if __name__ == '__main__':
main_cmd_line()
2 changes: 2 additions & 0 deletions translate/convert/po2dtd.py
Expand Up @@ -33,6 +33,8 @@

def dtdwarning(message, category, filename, lineno, line=None):
return "Warning: %s\n" % message


warnings.formatwarning = dtdwarning


Expand Down
1 change: 1 addition & 0 deletions translate/convert/po2oo.py
Expand Up @@ -185,6 +185,7 @@ class oofilteroptions(object):
includereview = False
autocorrect = False


options = oofilteroptions()
filter = oocheckfilter(options, [checks.OpenOfficeChecker, checks.StandardUnitChecker], checks.openofficeconfig)

Expand Down
1 change: 1 addition & 0 deletions translate/convert/po2prop.py
Expand Up @@ -266,5 +266,6 @@ def main(argv=None):
parser.passthrough.append("remove_untranslated")
parser.run(argv)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions translate/convert/po2rc.py
Expand Up @@ -121,5 +121,6 @@ def main(argv=None):
parser.add_fuzzy_option()
parser.run(argv)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions translate/convert/po2sub.py
Expand Up @@ -82,5 +82,6 @@ def main(argv=None):
parser.add_fuzzy_option()
parser.run(argv)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions translate/convert/xliff2oo.py
Expand Up @@ -188,6 +188,7 @@ class oofilteroptions(object):
includereview = False
autocorrect = False


options = oofilteroptions()
filter = oocheckfilter(options, [checks.OpenOfficeChecker, checks.StandardUnitChecker], checks.openofficeconfig)

Expand Down
3 changes: 3 additions & 0 deletions translate/filters/checks.py
Expand Up @@ -170,6 +170,7 @@ class SeriousFilterFailure(FilterFailure):

pass


#(tag, attribute, value) specifies a certain attribute which can be changed/
#ignored if it exists inside tag. In the case where there is a third element
#in the tuple, it indicates a property value that can be ignored if present
Expand Down Expand Up @@ -1961,6 +1962,7 @@ def credits(self, str1, str2):

# code to actually run the tests (use unittest?)


openofficeconfig = CheckerConfig(
accelmarkers=["~"],
varmatches=[("&", ";"), ("%", "%"), ("%", None), ("%", 0), ("$(", ")"),
Expand All @@ -1985,6 +1987,7 @@ def __init__(self, **kwargs):
checkerconfig.update(openofficeconfig)
StandardChecker.__init__(self, **kwargs)


libreofficeconfig = CheckerConfig(
accelmarkers=["~"],
varmatches=[("&", ";"), ("%", "%"), ("%", None), ("%", 0), ("$(", ")"),
Expand Down
1 change: 1 addition & 0 deletions translate/filters/prefilters.py
Expand Up @@ -147,6 +147,7 @@ def filtermarkedvariables(str1):
return fstr1
return filtermarkedvariables


# a list of special words with punctuation
# all apostrophes in the middle of the word are handled already
wordswithpunctuation = ["'n", "'t"] # Afrikaans
Expand Down
1 change: 1 addition & 0 deletions translate/lang/af.py
Expand Up @@ -62,6 +62,7 @@ def capsstart(cls, text):
return common.Common.capsstart(stripped[match.end():])
return common.Common.capsstart(text)


cyr2lat = {
u"А": "A", u"а": "a",
u"Б": "B", u"б": "b",
Expand Down
1 change: 1 addition & 0 deletions translate/lang/data.py
Expand Up @@ -371,6 +371,7 @@ def languagematch(languagecode, otherlanguagecode):
(otherlanguagecode.startswith(languagecode) and
variant_re.match(otherlanguagecode[len(languagecode):])))


dialect_name_re = re.compile(r"(.+)\s\(([^)\d]{,25})\)$")
# The limit of 25 characters on the country name is so that "Interlingua (...)"
# (see above) is correctly interpreted.
Expand Down
1 change: 1 addition & 0 deletions translate/lang/identify.py
Expand Up @@ -126,6 +126,7 @@ def identify_target_lang(self, instore):
return None
return self.identify_lang(text)


if __name__ == "__main__":
from sys import argv
script_dir = path.abspath(path.dirname(argv[0]))
Expand Down
1 change: 1 addition & 0 deletions translate/lang/ngram.py
Expand Up @@ -169,6 +169,7 @@ def save(self, folder, ext='.lm'):
for v, k in self.ngrams[lang].sorted_by_score():
fp.write("%s\t %d\n" % (k, v))


if __name__ == '__main__':
# Should you want to generate your own .lm files
#conf = Generate('/tmp')
Expand Down
1 change: 1 addition & 0 deletions translate/lang/team.py
Expand Up @@ -434,6 +434,7 @@ def guess_language(team_string):
return None
return lang


if __name__ == "__main__":
from sys import argv
from translate.storage import factory
Expand Down
1 change: 1 addition & 0 deletions translate/misc/ourdom.py
Expand Up @@ -159,6 +159,7 @@ def createElementNS(self, namespaceURI, qualifiedName):
e.ownerDocument = self
return e


theDOMImplementation = DOMImplementation()

# an ExpatBuilder that allows us to use the above modifications
Expand Down
1 change: 1 addition & 0 deletions translate/misc/progressbar.py
Expand Up @@ -159,6 +159,7 @@ def test(progressbar):
progressbar.show("Some message")
time.sleep(0.2)


if __name__ == '__main__':
p = HashProgressBar(0, 100, 50)
test(p)
1 change: 1 addition & 0 deletions translate/misc/quote.py
Expand Up @@ -355,6 +355,7 @@ def mozillaescapemarginspaces(source):
else:
return escapespace(source[0]) + source[1:-1] + escapespace(source[-1])


propertyescapes = {
# escapes that are self-escaping
"\\": "\\", "'": "'", '"': '"',
Expand Down
1 change: 1 addition & 0 deletions translate/misc/xml_helpers.py
Expand Up @@ -100,6 +100,7 @@ def namespaced(namespace, name):
else:
return name


MULTIWHITESPACE_PATTERN = r"[\n\r\t ]+"
MULTIWHITESPACE_RE = re.compile(MULTIWHITESPACE_PATTERN, re.MULTILINE)

Expand Down
1 change: 1 addition & 0 deletions translate/search/lshtein.py
Expand Up @@ -68,6 +68,7 @@ def native_distance(a, b, stopvalue=0):
"""
return Levenshtein.distance(a, b)


try:
import Levenshtein as Levenshtein
distance = native_distance
Expand Down
2 changes: 2 additions & 0 deletions translate/storage/catkeys.py
Expand Up @@ -96,6 +96,8 @@ class CatkeysDialect(csv.Dialect):
delimiter = "\t"
lineterminator = "\n"
quoting = csv.QUOTE_NONE


csv.register_dialect("catkeys", CatkeysDialect)


Expand Down
1 change: 1 addition & 0 deletions translate/storage/cpo.py
Expand Up @@ -209,6 +209,7 @@ def setup_call_types(gpo):
gpo.po_message_set_msgstr_plural.argtypes = [po_message_t, c_int, STRING]
gpo.po_message_set_range.argtypes = [po_message_t, c_int, c_int]


# Load libgettextpo
gpo = None
# 'gettextpo' is recognised on Unix, while only 'libgettextpo' is recognised on
Expand Down
1 change: 1 addition & 0 deletions translate/storage/csvl10n.py
Expand Up @@ -96,6 +96,7 @@ class DefaultDialect(csv.excel):
quoting = csv.QUOTE_NONNUMERIC
escapechar = '\\'


csv.register_dialect('default', DefaultDialect)


Expand Down
1 change: 1 addition & 0 deletions translate/storage/factory.py
Expand Up @@ -86,6 +86,7 @@ def _examine_txt(storefile):
storefile.seek(0)
return pseudo_extension


hiddenclasses = {"txt": _examine_txt}


Expand Down
2 changes: 2 additions & 0 deletions translate/storage/omegat.py
Expand Up @@ -58,6 +58,8 @@ class OmegaTDialect(csv.Dialect):
delimiter = "\t"
lineterminator = "\r\n"
quoting = csv.QUOTE_NONE


csv.register_dialect("omegat", OmegaTDialect)


Expand Down
2 changes: 2 additions & 0 deletions translate/storage/oo.py
Expand Up @@ -61,6 +61,7 @@ def __init__(self, normalchars):
def __getitem__(self, key):
return self.normalchars.get(key, u"_")


unormalizetable = unormalizechar(normalfilenamechars.decode("ascii"))


Expand Down Expand Up @@ -129,6 +130,7 @@ def unescape_text(text):
return text.replace("\\\\", "\a").replace("\\n", "\n").replace("\\t", "\t") \
.replace("\\r", "\r").replace("\a", "\\\\")


helptagre = re.compile('''<[/]??[a-z_\-]+?(?:| +[a-z]+?=".*?") *[/]??>''')


Expand Down
1 change: 1 addition & 0 deletions translate/storage/placeables/general.py
Expand Up @@ -345,6 +345,7 @@ def to_general_placeables(tree,

return newtree


# The order of these parsers are very important
parsers = [
NewlinePlaceable.parse,
Expand Down
4 changes: 4 additions & 0 deletions translate/storage/placeables/lisa.py
Expand Up @@ -65,6 +65,7 @@ def make_unknown(klass, node, xml_space="preserve"):

return klass(sub=sub, id=id, rid=rid, xid=xid, xml_node=node)


_class_dictionary = {
#u'bpt': (xliff.Bpt, not_yet_implemented),
u'bx': (xliff.Bx, make_empty_replacement_placeable),
Expand Down Expand Up @@ -151,6 +152,7 @@ def unknown_placeable_as_dom_node(placeable):

return node


_placeable_dictionary = {
xliff.Bpt: lambda placeable: placeable_as_dom_node(placeable, 'bpt'),
xliff.Bx: lambda placeable: placeable_as_dom_node(placeable, 'bx'),
Expand Down Expand Up @@ -215,4 +217,6 @@ def parse_xliff(pstr):
except Exception as exc:
raise
return None


xliff.parsers = [parse_xliff]
1 change: 1 addition & 0 deletions translate/storage/poparser.py
Expand Up @@ -243,6 +243,7 @@ def parse_msgid_plural(parse_state, unit):
parse_message(parse_state, 'msgid_plural', 12, unit.msgid_plural, unit.msgid_pluralcomments)
return len(unit.msgid_plural) > 0 or len(unit.msgid_pluralcomments) > 0


MSGSTR_ARRAY_ENTRY_LEN = len('msgstr[')


Expand Down
1 change: 1 addition & 0 deletions translate/storage/properties.py
Expand Up @@ -223,6 +223,7 @@ def _key_strip(key):
newkey += key[len(newkey):len(newkey)+1]
return newkey.lstrip()


dialects = {}
default_dialect = "java"

Expand Down
1 change: 1 addition & 0 deletions translate/storage/test_mo.py
Expand Up @@ -22,6 +22,7 @@
class TestMOUnit(test_base.TestTranslationUnit):
UnitClass = mo.mounit


posources = [
r'''
msgid ""
Expand Down
2 changes: 2 additions & 0 deletions translate/storage/utx.py
Expand Up @@ -62,6 +62,8 @@ class UtxDialect(csv.Dialect):
# differences
lineterminator = "\r\n"
quoting = csv.QUOTE_NONE


csv.register_dialect("utx", UtxDialect)


Expand Down
1 change: 1 addition & 0 deletions translate/storage/versioncontrol/svn.py
Expand Up @@ -28,6 +28,7 @@ def is_available():
exitcode, output, error = run_command(["svn", "--version"])
return exitcode == 0


_version = None


Expand Down
2 changes: 2 additions & 0 deletions translate/storage/wordfast.py
Expand Up @@ -194,6 +194,8 @@ class WordfastDialect(csv.Dialect):
delimiter = "\t"
lineterminator = "\r\n"
quoting = csv.QUOTE_NONE


csv.register_dialect("wordfast", WordfastDialect)


Expand Down
2 changes: 1 addition & 1 deletion translate/storage/xml_extract/test_misc.py
Expand Up @@ -53,8 +53,8 @@ def get_even_and_total(parent_node, node, even_lst, total):

assert ([2, 4, 6, 8], 36) == misc.reduce_tree(get_even_and_total, test_tree_2, test_tree_2, get_children, [], 0)

# compose_mappings

# compose_mappings
left_mapping = {1: u'a', 2: u'b', 3: u'c', 4: u'd', 5: u'e'}
right_mapping = {u'a': -1, u'b': -2, u'd': -4, u'e': -5, u'f': -6}

Expand Down
1 change: 1 addition & 0 deletions translate/storage/yaml.py
Expand Up @@ -88,6 +88,7 @@ class YAMLDumper(yaml.SafeDumper):
def represent_unsorted(self, data):
return self.represent_dict(data.items())


YAMLDumper.add_representer(UnsortableOrderedDict, YAMLDumper.represent_unsorted)


Expand Down
1 change: 1 addition & 0 deletions translate/tools/build_tmdb.py
Expand Up @@ -97,5 +97,6 @@ def main():

Builder(args.tmdb_file, args.source_lang, args.target_lang, args.files)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions translate/tools/pocount.py
Expand Up @@ -363,5 +363,6 @@ def main():

summarizer(args.files, args.style, args.incomplete_only)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions translate/tools/podebug.py
Expand Up @@ -43,6 +43,7 @@ def add_prefix(prefix, stringelems):
break
return stringelems


podebug_parsers = general.parsers
podebug_parsers.remove(general.CapsPlaceable.parse)
podebug_parsers.remove(general.CamelCasePlaceable.parse)
Expand Down

0 comments on commit e07a57c

Please sign in to comment.