Skip to content

Commit

Permalink
some pylint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ConceptJunkie committed Dec 30, 2023
1 parent c70cd8b commit 67bf481
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 93 deletions.
82 changes: 2 additions & 80 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,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=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
disable=parameter-unpacking,
raw-checker-failed,
bad-inline-option,
locally-disabled,
Expand All @@ -78,68 +69,6 @@ disable=print-statement,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
bad-whitespace, # new disabled errors
no-name-in-module,
trailing-newlines,
missing-function-docstring,
Expand Down Expand Up @@ -257,7 +186,7 @@ function-naming-style=camelCase

# Good variable names which should always be accepted, separated by a comma.
good-names=_

# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted
good-names-rgxs=[a-z],[a-z][a-z0-9]
Expand Down Expand Up @@ -328,13 +257,6 @@ max-line-length=120
# Maximum number of lines in a module.
max-module-lines=1000

# 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

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down
6 changes: 3 additions & 3 deletions rpn/makeHelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
PROGRAM_NAME = 'makeHelp'
PROGRAM_DESCRIPTION = 'rpnChilada help generator'

MAX_EXAMPLE_COUNT = 2445 # This needs to be manually updated when the help examples are modified.
MAX_EXAMPLE_COUNT = 2451 # This needs to be manually updated when the help examples are modified.

os.chdir( getUserDataPath( ) ) # SkyField doesn't like running in the root directory
os.chdir( getUserDataPath( ) ) # SkyField doesn't like running in the root directory

startTime = time_ns( )

Expand Down Expand Up @@ -1402,7 +1402,7 @@ def makeCommandExample( command, indent=0, slow=False ):

tzwhere has been replaced with timezonefinder.

The 'change_digits' operator was added.
The 'change_digits' operator was added.

And finally after about 8 years (since version 6.4.0), the Windows binary is
back!
Expand Down
4 changes: 2 additions & 2 deletions rpn/math/rpnNumberTheory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,8 @@ def makePythagoreanTriplesOperator( n ):
@argValidator( [ IntValidator( 1 ), IntValidator( 1 ) ] )
def makePythagoreanQuadrupleOperator( a, b ):
# pylint: disable=invalid-name
odd1 = ( fmod( a, 2 ) == 1 )
odd2 = ( fmod( b, 2 ) == 1 )
odd1 = fmod( a, 2 ) == 1
odd2 = fmod( b, 2 ) == 1

if odd1 and odd2:
raise ValueError( "'make_pyth_4' arguments cannot both be odd" )
Expand Down
2 changes: 1 addition & 1 deletion rpn/math/rpnPolytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#******************************************************************************

def getNthGeneralizedPolygonalNumber( n, k ):
negative = ( fmod( n, 2 ) == 0 )
negative = fmod( n, 2 ) == 0

n = floor( fdiv( fadd( n, 1 ), 2 ) )

Expand Down
2 changes: 1 addition & 1 deletion rpn/rpnOperators.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
isHarmonicDivisorNumberOperator, isKHyperperfectOperator, isKPerfectOperator, isKPolydivisibleOperator, \
isKSemiprimeOperator, isKSphenicOperator, isPerfectOperator, isPerniciousOperator, isPolite, \
isPolydivisibleOperator, isPowerfulOperator, isPronicOperator, isRoughOperator, isRuthAaronNumberOperator, \
isSemiprimeOperator, isSmoothOperator, isSociableListOperator, isSphenicOperator, isSquareFreeOperator, \
isSemiprimeOperator, isSmoothOperator, isSphenicOperator, isSquareFreeOperator, \
isUnusualOperator, makeContinuedFractionOperator, makeEulerBrickOperator, makePythagoreanQuadrupleOperator, \
makePythagoreanTripleOperator, makePythagoreanTriplesOperator, solveFrobeniusOperator, getVanEckOperator

Expand Down
2 changes: 1 addition & 1 deletion rpn/science/rpnPhysics.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def calculateBlackHoleMass( measurement ):
if 'time' in arguments:
lifetime = arguments[ 'time' ]

return getRoot( divide( getProduct( [ lifetime, mpmathify( "1.8083" ),
return getRoot( divide( getProduct( [ lifetime, mpmathify( '1.8083' ),
getConstant( 'reduced_planck_constant' ),
getPower( getConstant( 'speed_of_light' ), 4 ) ] ),
getProduct( [ 5120, pi,
Expand Down
5 changes: 1 addition & 4 deletions rpn/special/rpnLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from rpn.time.rpnDateTimeClass import RPNDateTime

from rpn.units.rpnMeasurementClass import RPNMeasurement
from rpn.special.rpnLocationLookup import loadLocationCache, saveLocationCache, lookUpLocation
from rpn.special.rpnLocationLookup import lookUpLocation

from rpn.special.rpnLocationLookup import lookUpTimeZone
from rpn.util.rpnUtils import oneArgFunctionEvaluator, twoArgFunctionEvaluator
Expand Down Expand Up @@ -67,9 +67,6 @@ def getLocation( name ):
result.setLat( latitude )
result.setLong( longitude )

g.locationCache[ name ] = [ name, result.getLat( ), result.getLong( ) ]
saveLocationCache( g.locationCache )

return result


Expand Down
3 changes: 3 additions & 0 deletions rpn/special/rpnLocationLookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def lookUpLocation( name ):
if location is None:
raise ValueError( 'location lookup failed, try a different search term' )

g.locationCache[ name ] = [ name, location.latitude, location.longitude ]
saveLocationCache( g.locationCache )

return location.latitude, location.longitude


Expand Down
2 changes: 1 addition & 1 deletion rpn/util/rpnOutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#******************************************************************************

def formatNumber( number, outputRadix, leadingZero, integerGrouping, integerDelimiter, decimalDelimiter ):
negative = ( number < 0 )
negative = number < 0

if outputRadix == g.fibBase:
strInteger = convertToFibBase( floor( number ) )
Expand Down

0 comments on commit 67bf481

Please sign in to comment.