Remove trailing whitespace

This commit is contained in:
Nick Hall 2016-05-10 16:52:57 +01:00
parent f688a96e9a
commit e76a27ddd3
21 changed files with 100 additions and 100 deletions

View File

@ -388,8 +388,8 @@ class ArgParser:
for ind in cleandbg:
del options[ind]
if (len(options) > 0 and self.open is None and self.imports == []
and self.removes == []
if (len(options) > 0 and self.open is None and self.imports == []
and self.removes == []
and not (self.list or self.list_more or self.list_table or
self.help)):
# Extract and convert to unicode the arguments in the list.

View File

@ -48,7 +48,7 @@ class User(user.User):
This class provides a means to interact with the user via CLI.
It implements the interface in :class:`.gen.user.User`
"""
def __init__(self, callback=None, error=None, auto_accept=False, quiet=False,
def __init__(self, callback=None, error=None, auto_accept=False, quiet=False,
uistate=None, dbstate=None):
"""
Init.
@ -110,7 +110,7 @@ class User(user.User):
"""
self._fileout.write("\r100%\n")
def prompt(self, title, message, accept_label, reject_label,
def prompt(self, title, message, accept_label, reject_label,
parent=None, default_label=None):
"""
Prompt the user with a message to select an alternative.

View File

@ -9,7 +9,7 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
@ -49,50 +49,50 @@ from ._datehandler import register_datehandler
class DateParserIs(DateParser):
"""
Convert a text string into a Date object, expecting a date
notation in the Icelandic language. If the date cannot be converted,
notation in the Icelandic language. If the date cannot be converted,
the text string is assigned.
"""
# modifiers before the date
modifier_to_int = {
'fyrir' : Date.MOD_BEFORE,
'á undan' : Date.MOD_BEFORE,
'eftir' : Date.MOD_AFTER,
'í kringum' : Date.MOD_ABOUT,
'fyrir' : Date.MOD_BEFORE,
'á undan' : Date.MOD_BEFORE,
'eftir' : Date.MOD_AFTER,
'í kringum' : Date.MOD_ABOUT,
'uþb' : Date.MOD_ABOUT
}
bce = ["f Kr"]
calendar_to_int = {
'gregoríanskt ' : Date.CAL_GREGORIAN,
'g' : Date.CAL_GREGORIAN,
'júlíanskt' : Date.CAL_JULIAN,
'j' : Date.CAL_JULIAN,
'hebreskt' : Date.CAL_HEBREW,
'h' : Date.CAL_HEBREW,
'íslamskt' : Date.CAL_ISLAMIC,
'múslimskt' : Date.CAL_ISLAMIC,
'i' : Date.CAL_ISLAMIC,
'franskt' : Date.CAL_FRENCH,
'franska lýðveldisins' : Date.CAL_FRENCH,
'f' : Date.CAL_FRENCH,
'persneskt' : Date.CAL_PERSIAN,
'p' : Date.CAL_PERSIAN,
'sænskt' : Date.CAL_SWEDISH,
's' : Date.CAL_SWEDISH,
'gregoríanskt ' : Date.CAL_GREGORIAN,
'g' : Date.CAL_GREGORIAN,
'júlíanskt' : Date.CAL_JULIAN,
'j' : Date.CAL_JULIAN,
'hebreskt' : Date.CAL_HEBREW,
'h' : Date.CAL_HEBREW,
'íslamskt' : Date.CAL_ISLAMIC,
'múslimskt' : Date.CAL_ISLAMIC,
'i' : Date.CAL_ISLAMIC,
'franskt' : Date.CAL_FRENCH,
'franska lýðveldisins' : Date.CAL_FRENCH,
'f' : Date.CAL_FRENCH,
'persneskt' : Date.CAL_PERSIAN,
'p' : Date.CAL_PERSIAN,
'sænskt' : Date.CAL_SWEDISH,
's' : Date.CAL_SWEDISH,
}
quality_to_int = {
'áætlað' : Date.QUAL_ESTIMATED,
'reiknað' : Date.QUAL_CALCULATED,
'áætlað' : Date.QUAL_ESTIMATED,
'reiknað' : Date.QUAL_CALCULATED,
}
def init_strings(self):
DateParser.init_strings(self)
self._span = re.compile("(frá)?\s*(?P<start>.+)\s*(til|--|)\s*(?P<stop>.+)",
self._span = re.compile("(frá)?\s*(?P<start>.+)\s*(til|--|)\s*(?P<stop>.+)",
re.IGNORECASE)
self._range = re.compile("(milli)\s+(?P<start>.+)\s+og\s+(?P<stop>.+)",
self._range = re.compile("(milli)\s+(?P<start>.+)\s+og\s+(?P<stop>.+)",
re.IGNORECASE)
#-------------------------------------------------------------------------
@ -102,41 +102,41 @@ class DateParserIs(DateParser):
#-------------------------------------------------------------------------
class DateDisplayIs(DateDisplay):
"""
Icelandic language date display class.
Icelandic language date display class.
"""
long_months = ( "", "janúar", "febrúar", "mars", "apríl", "maí",
"júní", "júlí", "ágúst", "september", "október",
long_months = ( "", "janúar", "febrúar", "mars", "apríl", "maí",
"júní", "júlí", "ágúst", "september", "október",
"nóvember", "desember" )
short_months = ( "", "jan", "feb", "mar", "apr", "maí", "jún",
short_months = ( "", "jan", "feb", "mar", "apr", "maí", "jún",
"júl", "ágú", "sep", "okt", "nóv", "des" )
formats = (
"ÁÁÁÁ-MM-DD (ISO)",
"Tölulegt",
"Mánuður dagur, ár",
"Mán Dag Ár",
"Dagur mánuður ár",
"Dag Mán Ár",
"ÁÁÁÁ-MM-DD (ISO)",
"Tölulegt",
"Mánuður dagur, ár",
"Mán Dag Ár",
"Dagur mánuður ár",
"Dag Mán Ár",
)
# this must agree with DateDisplayEn's "formats" definition
# (since no locale-specific _display_gregorian exists, here)
calendar = (
"",
"júlíanskt",
"hebreskt",
"franska lýðveldisins",
"persneskt",
"íslamskt",
"sænskt"
"",
"júlíanskt",
"hebreskt",
"franska lýðveldisins",
"persneskt",
"íslamskt",
"sænskt"
)
_mod_str = ("", "fyrir ", "eftir ", "uþb ", "", "", "")
_qual_str = ("", "reiknað ", "reiknað ")
_bce_str = "%s f. Kr"
def display(self, date):
@ -164,12 +164,12 @@ class DateDisplayIs(DateDisplay):
d1 = self.display_cal[cal](start)
d2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
return "%smilli %s og %s%s" % (qual_str, d1, d2,
return "%smilli %s og %s%s" % (qual_str, d1, d2,
scal)
else:
text = self.display_cal[date.get_calendar()](start)
scal = self.format_extras(cal, newyear)
return "%s%s%s%s" % (qual_str, self._mod_str[mod],
return "%s%s%s%s" % (qual_str, self._mod_str[mod],
text, scal)
#-------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@ def make_closure(surname):
Test closure.
"""
from gramps.gen.lib import Person
return (lambda person:
return (lambda person:
(person.primary_name.surname_list[0].surname == surname and
person.gender == Person.MALE))
@ -51,9 +51,9 @@ class ClosureTest(unittest.TestCase):
def test_01(self):
self.check(
(lambda family: (family.private and
family.mother_handle.gramps_id != "I0001"),
['AND', [['private', '==', True],
(lambda family: (family.private and
family.mother_handle.gramps_id != "I0001"),
['AND', [['private', '==', True],
['mother_handle.gramps_id', '!=', 'I0001']]]))
def test_02(self):

View File

@ -26,10 +26,10 @@ import copy
class ParseFilter(Visitor):
def visitName(self, node):
return node.id
def visitNum(self, node):
return node.n
def visitlong(self, node):
return node
@ -39,8 +39,8 @@ class ParseFilter(Visitor):
return [self.process_field(expr), "==", True]
elif len(expr) == 3:
# (field, op, value)
return [self.process_field(expr[0]),
expr[1],
return [self.process_field(expr[0]),
expr[1],
self.process_value(expr[2])]
else:
# list of exprs
@ -64,7 +64,7 @@ class ParseFilter(Visitor):
"""
Handle LIKE()
"""
return [self.process_field(self.visit(node.args[0])),
return [self.process_field(self.visit(node.args[0])),
self.visit(node.func),
self.process_value(self.visit(node.args[1]))]
@ -75,8 +75,8 @@ class ParseFilter(Visitor):
return [self.visit(node) for node in list]
def visitCompare(self, node):
return [self.process_field(self.visit(node.left)),
" ".join(self.visit(node.ops)),
return [self.process_field(self.visit(node.left)),
" ".join(self.visit(node.ops)),
self.process_value(self.visit(node.comparators[0]))]
def visitAttribute(self, node):
@ -129,7 +129,7 @@ class ParseFilter(Visitor):
return node.arg
def visitSubscript(self, node):
return "%s[%s]" % (self.visit(node.value),
return "%s[%s]" % (self.visit(node.value),
self.visit(node.slice))
def visitIndex(self, node):

View File

@ -127,7 +127,7 @@ class BaseTest(unittest.TestCase):
def test_HasNickname(self):
rule = HasNickname([])
self.assertEqual(self.filter_with_rule(rule), set([
b'cc8205d883763f02abd', b'GNUJQCL9MD64AM56OH', b'Q8HKQC3VMRM1M6M7ES',
b'cc8205d883763f02abd', b'GNUJQCL9MD64AM56OH', b'Q8HKQC3VMRM1M6M7ES',
]))
def test_HasUnknownGender(self):

View File

@ -233,9 +233,9 @@ class TableObject(BaseObject):
Return all seconday fields and their types
"""
from .handle import HandleClass
return ([(key.lower(), value)
return ([(key.lower(), value)
for (key, value) in cls.get_schema().items()
if value in [str, int, float, bool] or
if value in [str, int, float, bool] or
isinstance(value, HandleClass)] +
cls.get_extra_secondary_fields())

View File

@ -56,12 +56,12 @@ class FieldBaseTest(unittest.TestCase):
def test_field_access01(self):
person = self.db.get_person_from_gramps_id("I0001")
self.assertEqual(person.get_field("primary_name.surname_list.0.surname"),
self.assertEqual(person.get_field("primary_name.surname_list.0.surname"),
"Smith")
def test_field_join01(self):
family = self.db.get_family_from_gramps_id("F0001")
self.assertEqual(family.get_field("father_handle.primary_name.surname_list.0.surname", self.db),
self.assertEqual(family.get_field("father_handle.primary_name.surname_list.0.surname", self.db),
"Smith")
if __name__ == "__main__":

View File

@ -186,7 +186,7 @@ class FilterProxyDb(ProxyDbBase):
return self.__tables[table]
elif func in self.__tables[table].keys():
return self.__tables[table][func]
else:
else:
return super().get_table_func(table, func)
def get_person_from_handle(self, handle):

View File

@ -209,7 +209,7 @@ class LivingProxyDb(ProxyDbBase):
return self.__tables[table]
elif func in self.__tables[table].keys():
return self.__tables[table][func]
else:
else:
return super().get_table_func(table, func)
def get_person_from_handle(self, handle):

View File

@ -169,7 +169,7 @@ class PrivateProxyDb(ProxyDbBase):
return self.__tables[table]
elif func in self.__tables[table].keys():
return self.__tables[table][func]
else:
else:
return super().get_table_func(table, func)
def get_person_from_handle(self, handle):

View File

@ -237,7 +237,7 @@ class ProxyDbBase(DbReadBase):
return self.__tables[table]
elif func in self.__tables[table].keys():
return self.__tables[table][func]
else:
else:
return super().get_table_func(table, func)
def is_open(self):

View File

@ -198,7 +198,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase):
return self.__tables[table]
elif func in self.__tables[table].keys():
return self.__tables[table][func]
else:
else:
return super().get_table_func(table, func)
def queue_object(self, obj_type, handle, reference=True):

View File

@ -412,7 +412,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
return self.__tables[table]
elif func in self.__tables[table].keys():
return self.__tables[table][func]
else:
else:
return super().get_table_func(table, func)
def catch_db_error(func):
@ -2544,7 +2544,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
else:
bsddb_version = _("Unknown")
return {
_("DB-API version"): "n/a",
_("DB-API version"): "n/a",
_("Number of people"): self.get_number_of_people(),
_("Number of families"): self.get_number_of_families(),
_("Number of sources"): self.get_number_of_sources(),

View File

@ -33,16 +33,16 @@ class MySQL:
query = query.replace("desc", "desc_")
## LIMIT offset, count
## count can be -1, for all
## LIMIT -1
## LIMIT -1
## LIMIT offset, -1
query = query.replace("LIMIT -1",
query = query.replace("LIMIT -1",
"LIMIT 18446744073709551615") ##
match = re.match(".* LIMIT (.*), (.*) ", query)
if match and match.groups():
offset, count = match.groups()
if count == "-1":
count = "18446744073709551615"
query = re.sub("(.*) LIMIT (.*), (.*) ",
query = re.sub("(.*) LIMIT (.*), (.*) ",
"\\1 LIMIT %s, %s " % (offset, count),
query)
return query

View File

@ -30,16 +30,16 @@ class Postgresql:
query = query.replace("desc", "desc_")
## LIMIT offset, count
## count can be -1, for all
## LIMIT -1
## LIMIT -1
## LIMIT offset, -1
query = query.replace("LIMIT -1",
query = query.replace("LIMIT -1",
"LIMIT all") ##
match = re.match(".* LIMIT (.*), (.*) ", query)
if match and match.groups():
offset, count = match.groups()
if count == "-1":
count = "all"
query = re.sub("(.*) LIMIT (.*), (.*) ",
query = re.sub("(.*) LIMIT (.*), (.*) ",
"\\1 LIMIT %s OFFSET %s " % (count, offset),
query)
return query

View File

@ -246,7 +246,7 @@ class Citations(Gramplet, DbGUIElement):
model, iter_ = treeview.get_selection().get_selected()
if iter_:
handle = model.get_value(iter_, 0)
# bug 9094.
# bug 9094.
# str(model.get_path(iter_)) return something like NNN:MMM
# So if we have only NNN, it's a node
# removing the str() solves the problem.

View File

@ -66,8 +66,8 @@ class Gallery(Gramplet):
photo.set_uistate(self.uistate, media_handle)
else:
photo = Photo(self.uistate.screen_height() < 1000)
photo.set_pixbuf(full_path,
get_thumbnail_image(full_path,
photo.set_pixbuf(full_path,
get_thumbnail_image(full_path,
mime_type,
media_ref.get_rectangle()))
self.image_list.append(photo)

View File

@ -40,12 +40,12 @@ import gramps.gen.relationship
#-------------------------------------------------------------------------
_cousin_level = [ "", "", #brother/sister, frændi/frænka -- these are taken care of separately
"þremenningur", "fjórmenningur", "fimmmenningur",
"þremenningur", "fjórmenningur", "fimmmenningur",
"sexmenningur", "sjömenningur", "áttmenningur",
"nímenningur", "tímenningur", "ellefumenningur",
"nímenningur", "tímenningur", "ellefumenningur",
"tólfmenningur", "þrettánmenningur", "fjórtánmenningur",
"fimtánmenningur", "sekstenmenning", "syttenmenning",
"attenmenning", "nittenmenning", "tyvemenning" ]
"attenmenning", "nittenmenning", "tyvemenning" ]
_cousin_terms = _cousin_level + ["frændi", "frænka"]
#-------------------------------------------------------------------------
@ -69,7 +69,7 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
def get_cousin(self, level):
if level > len(_cousin_level)-1:
# FIXME: use Norwegian term term here,
# FIXME: use Norwegian term term here,
# UPDATED by Frode: unsure about the expretion "en fjern slektning", should it be just "fjern slektning".
# Need to see it used in the program to get the understanding.
return "fjarskyldur ættingi"
@ -239,14 +239,14 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
return (self.get_ancestors_cousin(other_person, secondRel, firstRel), common)
else:
return (self.get_cousins_descendant(other_person, firstRel, secondRel), common)
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,
reltocommon_a, reltocommon_b,
only_birth=True,
only_birth=True,
in_law_a=False, in_law_b=False):
return self.get_relationship(reltocommon_a, reltocommon_b, gender_a, gender_b)[0];
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
in_law_a=False, in_law_b=False):
return self.get_two_way_rel(gender_b, "", "")
@ -258,7 +258,7 @@ if __name__ == "__main__":
# python src/plugins/rel/rel_no.py
# (Above not needed here)
"""TRANSLATORS, copy this if statement at the bottom of your
"""TRANSLATORS, copy this if statement at the bottom of your
rel_xx.py module, and test your work with:
python src/plugins/rel/rel_xx.py
"""

View File

@ -2193,9 +2193,9 @@ class CheckIntegrity:
self.text.write(
# translators: leave all/any {...} untranslated
ngettext("{quantity} family "
"with no parents or children found, removed.\n",
"with no parents or children found, removed.\n",
"{quantity} families "
"with no parents or children found, removed.\n",
"with no parents or children found, removed.\n",
efam).format(quantity=efam)
)
if efam == 1:

View File

@ -239,8 +239,8 @@ def capture(stdin):
sys.exit = oldexit
if stdin:
sys.stdin = oldin
output[0] = output[0].getvalue()
output[1] = output[1].getvalue()
output[0] = output[0].getvalue()
output[1] = output[1].getvalue()
class Gramps:
def __init__(self, user=None, dbstate=None):