Skip to content

Commit

Permalink
changes based on pylint feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ConceptJunkie committed Jan 3, 2024
1 parent 67bf481 commit 6671837
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 27 deletions.
5 changes: 2 additions & 3 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,9 @@ known-third-party=enchant
# Couples of modules and preferred modules, separated by a comma.
preferred-modules=


[EXCEPTIONS]

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
35 changes: 14 additions & 21 deletions rpn/math/factorise.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,24 @@
# pylint: disable=invalid-name

from builtins import ValueError
from math import sqrt, log2, ceil, floor
from math import gcd, sqrt, log2, ceil, floor

import random
import sys

if sys.version_info[ 0 ] == 3 and sys.version_info[ 1 ] >= 9:
from math import gcd
else:
from fractions import gcd

"""
This script factorises a natural number given as a command line
parameter into its prime factors. It first attempts to use trial
division to find very small factors, then uses Brent's version of the
Pollard rho algorithm [1] to find slightly larger factors. If any large
factors remain, it uses the Self-Initializing Quadratic Sieve (SIQS) [2]
to factorise those.
[1] Brent, Richard P. 'An improved Monte Carlo factorization algorithm.'
BIT Numerical Mathematics 20.2 (1980): 176-184.
[2] Contini, Scott Patrick. 'Factoring integers with the self-
initializing quadratic sieve.' (1997).
"""

# This script factorises a natural number given as a command line
# parameter into its prime factors. It first attempts to use trial
# division to find very small factors, then uses Brent's version of the
# Pollard rho algorithm [1] to find slightly larger factors. If any large
# factors remain, it uses the Self-Initializing Quadratic Sieve (SIQS) [2]
# to factorise those.
#
# [1] Brent, Richard P. 'An improved Monte Carlo factorization algorithm.'
# BIT Numerical Mathematics 20.2 (1980): 176-184.
#
# [2] Contini, Scott Patrick. 'Factoring integers with the self-
# initializing quadratic sieve.' (1997).
3
# Some tuning parameters
MAX_DIGITS_POLLARD = 30
POLLARD_QUICK_ITERATIONS = 20
Expand Down
5 changes: 3 additions & 2 deletions rpn/math/rpnNumberTheory.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from rpn.util.rpnSettings import setAccuracy
from rpn.util.rpnUtils import getMPFIntegerAsString, listArgFunctionEvaluator, \
listAndOneArgFunctionEvaluator, oneArgFunctionEvaluator, setAccuracyForN, \
twoArgFunctionEvaluator, parallel
twoArgFunctionEvaluator
from rpn.util.rpnValidator import argValidator, ComplexValidator, IntValidator, ListValidator, RealValidator


Expand Down Expand Up @@ -1579,7 +1579,8 @@ def getAliquotSequenceGenerator( n, k ):

if b == 1:
break
elif b in results:

if b in results:
break

a = b
Expand Down
1 change: 0 additions & 1 deletion rpn/special/rpnLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#
#******************************************************************************

import datetime
import ephem
import pendulum

Expand Down

0 comments on commit 6671837

Please sign in to comment.