summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <sthibault@debian.org>2018-05-28 18:17:30 +0000
committerSamuel Thibault <sthibault@debian.org>2018-05-28 18:17:30 +0000
commit8d92acf68dabacf696638036c852342a8537f04d (patch)
treebe961a8b4e238c272e5020da43388321bb1e266c
parent8939723b6c2d5e910a8c69e28e5febecaa63a756 (diff)
parent66a67c60ab658e2f6a0f7111225b87ca91cbff44 (diff)
downloadinstallation-guide-8d92acf68dabacf696638036c852342a8537f04d.zip
Merge branch 'pep8' into 'master'
PEP8 fixes See merge request installer-team/installation-guide!1
-rwxr-xr-xpo/fi/list-unkn-words.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/po/fi/list-unkn-words.py b/po/fi/list-unkn-words.py
index 9858b6550..791c4d91e 100755
--- a/po/fi/list-unkn-words.py
+++ b/po/fi/list-unkn-words.py
@@ -23,6 +23,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Author: Tapio Lehtonen <tale@debian.org>
"""
+
def handleCommandLine():
""" Get arguments and options from command line. """
from optparse import OptionParser
@@ -35,14 +36,14 @@ Print out unknown words found in filename. Options
added this option to be compatible with enchant."""
parser = OptionParser(usage=usage)
parser.set_defaults(verbose=False, listonly=True, wordlists=[])
- parser.add_option("-p", "--wordlist",
+ parser.add_option("-p", "--wordlist",
action="append", type="string", dest="wordlists",
help="File with OK words one per line.",
metavar="Wordlist")
- parser.add_option("-d", "--language",
+ parser.add_option("-d", "--language",
action="store", type="string", dest="language",
help=lhelpstr)
- parser.add_option("-l", "--listonly",
+ parser.add_option("-l", "--listonly",
action="store_true", dest="listonly",
help=lonlyhelpstr)
parser.add_option("-v", action="store_true", dest="verbose",
@@ -65,7 +66,7 @@ added this option to be compatible with enchant."""
print "Proofreading using language ", options.language, "."
else:
print "Proofreading using default language."
-
+
return (options, args)
@@ -82,8 +83,8 @@ if __name__ == "__main__":
print "options ", o
print "arguments ", a
- #Try opening filename, if file can not be read we exit
- #right now since nothing to do.
+ # Try opening filename, if file can not be read we exit
+ # right now since nothing to do.
try:
textF = open(a[0], "r")
except IOError, value:
@@ -101,7 +102,7 @@ if __name__ == "__main__":
print "Checker wants Unicode text to check."
else:
print "Checker wants normal strings text to check."
- #Read in Personal word lists, may be several files
+ # Read in Personal word lists, may be several files
for pN in o.wordlists:
try:
pF = open(pN, "r")
@@ -109,8 +110,8 @@ if __name__ == "__main__":
print "Error, personal word list could not be opened for reading ", pN
sys.exit(5)
for word in pF.readlines():
- if len(word) > 0: # Don't add empty words
- if (word[0] != "#" and word[0] != " "): #Don't add comment lines
+ if len(word) > 0: # Don't add empty words
+ if (word[0] != "#" and word[0] != " "): # Don't add comment lines
# Workaroud for Debian bug #545848
checker.dict.add(word)
# When bug is fixed, replace above line with
@@ -118,13 +119,13 @@ if __name__ == "__main__":
pF.close()
- unknWords={}
- #Find unknown words and count number of occurrences for each.
+ unknWords = {}
+ # Find unknown words and count number of occurrences for each.
for text in textF.readlines():
utext = unicode(text, "utf-8")
if o.verbose:
print "Text as read:"
- print text
+ print text
print "Text to check is:"
for u in utext:
print u.encode("utf-8"),
@@ -141,8 +142,8 @@ if __name__ == "__main__":
else:
unknWords[err.word] = 1
textF.close()
-
- #Sort alphabetically and print out as count word
+
+ # Sort alphabetically and print out as count word
wlist = unknWords.keys()
wlist.sort()
for w in wlist: