Skip to content

Commit

Permalink
Merge pull request #1463 from jralls/pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Hall committed Jul 17, 2023
2 parents 0f2d863 + 7051d3b commit ca809da
Show file tree
Hide file tree
Showing 61 changed files with 1,762 additions and 1,657 deletions.
55 changes: 1 addition & 54 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ unsafe-load-any-extension=no
# run arbitrary code
extension-pkg-whitelist=

# Allow optimization of some AST trees. This will activate a peephole AST
# optimizer, which will apply various small optimizations. For instance, it can
# be used to obtain the result of joining multiple strings with the addition
# operator. Joining a lot of strings can lead to a maximum recursion error in
# Pylint and this flag can prevent that. It has one side effect, the resulting
# AST will be different than the one from reality.
optimize-ast=no


[MESSAGES CONTROL]

# Only show warnings with the listed confidence levels. Leave empty to show
Expand All @@ -59,7 +50,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=suppressed-message,intern-builtin,round-builtin,unicode-builtin,range-builtin-not-iterating,long-builtin,basestring-builtin,setslice-method,print-statement,reload-builtin,metaclass-assignment,raising-string,next-method-called,import-star-module-level,xrange-builtin,getslice-method,zip-builtin-not-iterating,reduce-builtin,dict-iter-method,delslice-method,using-cmp-argument,hex-method,buffer-builtin,old-ne-operator,nonzero-method,backtick,parameter-unpacking,indexing-exception,file-builtin,filter-builtin-not-iterating,raw_input-builtin,execfile-builtin,oct-method,cmp-method,coerce-builtin,long-suffix,cmp-builtin,input-builtin,dict-view-method,standarderror-builtin,apply-builtin,old-raise-syntax,unichr-builtin,old-division,coerce-method,unpacking-in-except,useless-suppression,no-absolute-import,map-builtin-not-iterating,old-octal-literal
disable=suppressed-message,useless-suppression


[REPORTS]
Expand All @@ -69,11 +60,6 @@ disable=suppressed-message,intern-builtin,round-builtin,unicode-builtin,range-bu
# mypackage.mymodule.MyReporterClass.
output-format=text

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
files-output=no

# Tells whether to display a full report or only the messages
reports=yes

Expand All @@ -91,9 +77,6 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme

[BASIC]

# List of builtins function names that should not be used, separated by a comma
bad-functions=map,filter

# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,ex,Run,_,db

Expand All @@ -110,63 +93,33 @@ include-naming-hint=no
# Regular expression matching correct argument names
argument-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for argument names
argument-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Regular expression matching correct function names
function-rgx=(([a-z_][a-z0-9_]{2,30})|(_T_))$

# Naming hint for function names
function-name-hint=(([a-z_][a-z0-9_]{2,30})|(_T_))$

# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$

# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$

# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Regular expression matching correct method names
method-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for method names
method-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct class names
class-rgx=[A-Z_][a-zA-Z0-9]+$

# Naming hint for class names
class-name-hint=[A-Z_][a-zA-Z0-9]+$

# Regular expression matching correct variable names
variable-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for variable names
variable-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct attribute names
attr-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for attribute names
attr-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
Expand Down Expand Up @@ -262,12 +215,6 @@ ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# else.
single-line-if-stmt=no

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator

# Maximum number of lines in a module
max-module-lines=1000

Expand Down
6 changes: 3 additions & 3 deletions gramps/gen/datehandler/_date_fi.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ def dd_dformat04(self, date_val, inflect, long_months):
date_val[1], year, inflect, long_months
)
else:
return "{long_month.f[IN]} {year}".format(
return "{long_month.forms[IN]} {year}".format(
long_month=long_months[date_val[1]], year=year
)
else:
if not hasattr(long_months[date_val[1]], "f"): # not a Lexeme
if not hasattr(long_months[date_val[1]], "forms"): # not a Lexeme
return self.dd_dformat01(date_val) # maybe the month is zero
return "{day:d}. {long_month.f[P]} {year}".format(
return "{day:d}. {long_month.forms[P]} {year}".format(
day=date_val[0], long_month=long_months[date_val[1]], year=year
)

Expand Down
2 changes: 1 addition & 1 deletion gramps/gen/datehandler/_date_hr.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class DateDisplayHR(DateDisplay):

def format_short_month_year(self, month, year, inflect, short_months):
"""Allow a subclass to modify the year, e.g. add a period"""
if not hasattr(short_months[1], "f"): # not a Lexeme: no inflection
if not hasattr(short_months[1], "forms"): # not a Lexeme: no inflection
return "{short_month} {year}.".format(
short_month=short_months[month], year=year
)
Expand Down
6 changes: 3 additions & 3 deletions gramps/gen/datehandler/_date_ru.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ def dd_dformat04(self, date_val, inflect, long_months):
)
elif date_val[1] == 0: # month is zero but day is not (see 8477)
return self.display_iso(date_val)
elif not hasattr(long_months[date_val[1]], "f"): # not a Lexeme
elif not hasattr(long_months[date_val[1]], "forms"): # not a Lexeme
return "{day:d} {long_month} {year}".format(
day=date_val[0], long_month=long_months[date_val[1]], year=year
)
else:
return "{day:d} {long_month.f[Р]} {year}".format(
return "{day:d} {long_month.forms[Р]} {year}".format(
day=date_val[0], long_month=long_months[date_val[1]], year=year
)

Expand All @@ -167,7 +167,7 @@ def dd_dformat05(self, date_val, inflect, short_months):
day=date_val[0], short_month=short_months[date_val[1]], year=year
)
else:
return "{day:d} {short_month.f[Р]} {year}".format(
return "{day:d} {short_month.forms[Р]} {year}".format(
day=date_val[0], short_month=short_months[date_val[1]], year=year
)

Expand Down
44 changes: 22 additions & 22 deletions gramps/gen/datehandler/_datedisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,58 +182,58 @@ def __init__(self, format=None, blocale=None):
"from"
# first date in a span
# Translators: If "from <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "from"),
"to"
# second date in a span
# Translators: If "to <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "to"),
"between"
# first date in a range
# Translators: If "between <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "between"),
"and"
# second date in a range
# Translators: If "and <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "and"),
"before"
# Translators: If "before <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "before"),
"after"
# Translators: If "after <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "after"),
"about"
# Translators: If "about <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "about"),
"estimated"
# Translators: If "estimated <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "estimated"),
"calculated"
# Translators: If "calculated <Month>" needs a special inflection
# in your language, translate to "{long_month.f[X]} {year}"
# in your language, translate to "{long_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{long_month} {year}", "calculated"),
Expand All @@ -244,58 +244,58 @@ def __init__(self, format=None, blocale=None):
"from"
# first date in a span
# Translators: If "from <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "from"),
"to"
# second date in a span
# Translators: If "to <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "to"),
"between"
# first date in a range
# Translators: If "between <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "between"),
"and"
# second date in a range
# Translators: If "and <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "and"),
"before"
# Translators: If "before <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "before"),
"after"
# Translators: If "after <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "after"),
"about"
# Translators: If "about <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "about"),
"estimated"
# Translators: If "estimated <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "estimated"),
"calculated"
# Translators: If "calculated <Month>" needs a special inflection
# in your language, translate to "{short_month.f[X]} {year}"
# in your language, translate to "{short_month.forms[X]} {year}"
# (where X is one of the month-name inflections you defined)
# else leave it untranslated
: _("{short_month} {year}", "calculated"),
Expand Down Expand Up @@ -552,7 +552,7 @@ def _display_gregorian(self, date_val, **kwargs):
_display_julian = _display_swedish = _display_gregorian

def format_long_month_year(self, month, year, inflect, long_months):
if not hasattr(long_months[1], "f"): # not a Lexeme: no inflection
if not hasattr(long_months[1], "forms"): # not a Lexeme: no inflection
return "{long_month} {year}".format(
long_month=long_months[month], year=year
)
Expand All @@ -561,7 +561,7 @@ def format_long_month_year(self, month, year, inflect, long_months):
)

def format_short_month_year(self, month, year, inflect, short_months):
if not hasattr(short_months[1], "f"): # not a Lexeme: no inflection
if not hasattr(short_months[1], "forms"): # not a Lexeme: no inflection
return "{short_month} {year}".format(
short_month=short_months[month], year=year
)
Expand All @@ -570,7 +570,7 @@ def format_short_month_year(self, month, year, inflect, short_months):
)

def format_long_month(self, month, inflect, long_months):
if not hasattr(long_months[1], "f"): # not a Lexeme: no inflection
if not hasattr(long_months[1], "forms"): # not a Lexeme: no inflection
return "{long_month}".format(long_month=long_months[month])
return (
self.FORMATS_long_month_year[inflect]
Expand All @@ -579,7 +579,7 @@ def format_long_month(self, month, inflect, long_months):
)

def format_short_month(self, month, inflect, short_months):
if not hasattr(short_months[1], "f"): # not a Lexeme: no inflection
if not hasattr(short_months[1], "forms"): # not a Lexeme: no inflection
return "{short_month}".format(short_month=short_months[month])
return (
self.FORMATS_short_month_year[inflect]
Expand Down
2 changes: 1 addition & 1 deletion gramps/gen/datehandler/test/datedisplay_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def assertInflectionInDate(self, inflection, date, month=None):
if month is None:
month = date.get_month()
month_lexeme = self.months[month]
self.assertIn(month_lexeme.f[inflection],
self.assertIn(month_lexeme.forms[inflection],
self.dd.display(date))

def test_month_only_date_nominative_quality_none(self):
Expand Down
Loading

0 comments on commit ca809da

Please sign in to comment.