Commit c1647c31 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Improve compliance with pylint for the module selector.

parent 8233e214
......@@ -7,7 +7,8 @@ from gluon.dal import Field
from plugin_dbui import Selector
class SelectorActiveItemsException(BaseException): pass
class SelectorActiveItemsException(BaseException):
pass
class SelectorActiveItems(Selector):
......@@ -45,7 +46,6 @@ class SelectorActiveItems(Selector):
else:
raise SelectorActiveItemsException("Period is not defined.")
def get_years(self):
"""
@rtype: list
......@@ -61,7 +61,6 @@ class SelectorActiveItems(Selector):
return range(start, end + 1)
def query(self, table):
"""Build the database query for the database table
including inner join for foreign keys, selector constraints and
......@@ -86,7 +85,6 @@ class SelectorActiveItems(Selector):
return query
def reset_period(self):
"""Reset the period to the initial values.
......@@ -95,7 +93,6 @@ class SelectorActiveItems(Selector):
self._period_start, self._period_end = self._cache_period
self._cache_period = None
def set_year(self, year):
"""Modify the period attributes in order to query records active
during the given year.
......@@ -105,7 +102,7 @@ class SelectorActiveItems(Selector):
"""
# keep original period
if self._cache_period == None:
if self._cache_period is None:
self._cache_period = (self._period_start, self._period_end)
self._period_start = date(year, 1, 1)
......@@ -155,7 +152,6 @@ class MySelector(SelectorActiveItems):
db.history.is_over = Field.Virtual('is_over', self._is_over, ftype='boolean')
db.history.is_start = Field.Virtual('is_start', self._is_start, ftype='boolean')
def _age(self, row):
"""Compute the age of the person associated to the history record, now.
......@@ -172,7 +168,6 @@ class MySelector(SelectorActiveItems):
return value
def _coverage(self, row):
"""Compute the time coverage of the history record with respect
to the period range.
......@@ -204,7 +199,6 @@ class MySelector(SelectorActiveItems):
return value
def _duration(self, row):
"""Compute the duration of the history record.
The end date is C{now} when the history record is not finished.
......@@ -224,7 +218,7 @@ class MySelector(SelectorActiveItems):
if start and end and start <= now <= end:
value = now - start
elif start and end == None and start <= now:
elif start and end is None and start <= now:
value = now - start
elif start and end and end < now:
......@@ -232,7 +226,6 @@ class MySelector(SelectorActiveItems):
return value
def _fte(self, row):
"""Compute the full time equivalent of the person associated
to the history record. It is the product of the time coverage
......@@ -251,7 +244,6 @@ class MySelector(SelectorActiveItems):
return value
def _is_end(self, row):
"""Return true is the history record ends during the period range.
......@@ -272,7 +264,6 @@ class MySelector(SelectorActiveItems):
return False
def _is_over(self, row):
"""Return true is the history record is over now.
......@@ -291,7 +282,6 @@ class MySelector(SelectorActiveItems):
return False
def _is_start(self, row):
"""Return true is the history record starts during the period range.
......@@ -312,7 +302,6 @@ class MySelector(SelectorActiveItems):
return False
def query(self, table):
"""Supersede the base class method to handle quality constraints.
......@@ -361,8 +350,5 @@ class MySelector(SelectorActiveItems):
return query
def reset_extra_queries(self):
self._extra_queries = []
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment