Some pylint improvements

This commit is contained in:
Richard Clay
2018-11-14 16:07:21 +00:00
committed by Nick Hall
parent fb886c5954
commit 29b0e824a2

View File

@@ -61,6 +61,7 @@ from gramps.gen.datehandler import parser
from gramps.gen.display.place import displayer as _pd from gramps.gen.display.place import displayer as _pd
from gramps.gen.proxy import CacheProxyDb from gramps.gen.proxy import CacheProxyDb
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Private Functions # Private Functions
@@ -159,6 +160,7 @@ def draw_pie_chart(doc, center_x, center_y, radius, data, start=0):
start, start + incr) start, start + incr)
start += incr start += incr
def draw_legend(doc, start_x, start_y, data, title, label_style): def draw_legend(doc, start_x, start_y, data, title, label_style):
""" """
Draws a legend for a graph in the specified document. The data passed is Draws a legend for a graph in the specified document. The data passed is
@@ -199,9 +201,11 @@ def draw_legend(doc, start_x, start_y, data, title, label_style):
start_x + (3 * size), start_y - (size * 0.25)) start_x + (3 * size), start_y - (size * 0.25))
start_y += size * 1.3 start_y += size * 1.3
_TTT = time.localtime(time.time()) _TTT = time.localtime(time.time())
_TODAY = parser.parse("%04d-%02d-%02d" % _TTT[:3]) _TODAY = parser.parse("%04d-%02d-%02d" % _TTT[:3])
def estimate_age(dbase, person, def estimate_age(dbase, person,
end_handle=None, start_handle=None, today=_TODAY): end_handle=None, start_handle=None, today=_TODAY):
""" """
@@ -292,6 +296,7 @@ def estimate_age(dbase, person,
age = (lower, upper) age = (lower, upper)
return age return age
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Global options and their names # Global options and their names
@@ -317,6 +322,7 @@ def _T_(value): # enable deferred translations (see Python docs 22.1.3.4)
return value return value
# _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh # _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Data extraction methods from the database # Data extraction methods from the database
@@ -647,7 +653,6 @@ class Extract:
else: else:
chart[1][key] = 1 chart[1][key] = 1
def collect_data(self, dbase, people, menu, genders, def collect_data(self, dbase, people, menu, genders,
year_from, year_to, no_years, cb_progress, rlocale): year_from, year_to, no_years, cb_progress, rlocale):
"""goes through the database and collects the selected personal """goes through the database and collects the selected personal
@@ -722,10 +727,12 @@ class Extract:
self.get_person_data(person, data) self.get_person_data(person, data)
return data return data
# GLOBAL: required so that we get access to _Extract.extractors[] # GLOBAL: required so that we get access to _Extract.extractors[]
# Unfortunately class variables cannot reference instance methods :-/ # Unfortunately class variables cannot reference instance methods :-/
_Extract = Extract() _Extract = Extract()
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Statistics report # Statistics report
@@ -862,7 +869,6 @@ class StatisticsChart(Report):
self._user.step_progress() self._user.step_progress()
self._user.end_progress() self._user.end_progress()
def output_piechart(self, title1, typename, data, lookup): def output_piechart(self, title1, typename, data, lookup):
# set layout variables # set layout variables
@@ -905,7 +911,6 @@ class StatisticsChart(Report):
text = self._("%s (persons):") % self._(typename) text = self._("%s (persons):") % self._(typename)
draw_legend(self.doc, legendx, yoffset, chart_data, text, 'SC-legend') draw_legend(self.doc, legendx, yoffset, chart_data, text, 'SC-legend')
def output_barchart(self, title1, typename, data, lookup): def output_barchart(self, title1, typename, data, lookup):
pt2cm = utils.pt2cm pt2cm = utils.pt2cm
@@ -974,6 +979,7 @@ class StatisticsChart(Report):
return return
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# StatisticsChartOptions # StatisticsChartOptions