mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
experiment with pylint
This commit is contained in:
parent
6d47ba9d25
commit
ac9ad7bcd0
@ -41,7 +41,7 @@ _error.NrOfArgs = "decorated function should not have arguments"
|
||||
_error.DecNrOfArgs = "decorator should have arguments"
|
||||
|
||||
|
||||
def _getSigdict(sigs, symdict):
|
||||
def _get_sigdict(sigs, symdict):
|
||||
"""Lookup signals in caller namespace and return sigdict
|
||||
|
||||
Lookup signals in then namespace of a caller. This is used to add
|
||||
@ -73,7 +73,7 @@ def always(*args):
|
||||
sigargs.append(arg.sig)
|
||||
elif not isinstance(arg, delay):
|
||||
raise AlwaysError(_error.DecArgType)
|
||||
sigdict = _getSigdict(sigargs, callinfo.symdict)
|
||||
sigdict = _get_sigdict(sigargs, callinfo.symdict)
|
||||
|
||||
def _always_decorator(func):
|
||||
if not isinstance(func, FunctionType):
|
||||
@ -111,20 +111,20 @@ class _Always(_Instantiator):
|
||||
bt = None
|
||||
break
|
||||
# now set waiter class
|
||||
W = _Waiter
|
||||
w = _Waiter
|
||||
if bt is delay:
|
||||
W = _DelayWaiter
|
||||
w = _DelayWaiter
|
||||
elif len(self.senslist) == 1:
|
||||
if bt is _Signal:
|
||||
W = _SignalWaiter
|
||||
w = _SignalWaiter
|
||||
elif bt is _WaiterList:
|
||||
W = _EdgeWaiter
|
||||
w = _EdgeWaiter
|
||||
else:
|
||||
if bt is _Signal:
|
||||
W = _SignalTupleWaiter
|
||||
w = _SignalTupleWaiter
|
||||
elif bt is _WaiterList:
|
||||
W = _EdgeTupleWaiter
|
||||
return W
|
||||
w = _EdgeTupleWaiter
|
||||
return w
|
||||
|
||||
def genfunc(self):
|
||||
senslist = self.senslist
|
||||
|
@ -26,7 +26,7 @@ from types import FunctionType
|
||||
from myhdl import AlwaysError, intbv
|
||||
from myhdl._util import _isGenFunc
|
||||
from myhdl._Signal import _Signal, _WaiterList, _isListOfSigs
|
||||
from myhdl._always import _Always, _getSigdict
|
||||
from myhdl._always import _Always, _get_sigdict
|
||||
from myhdl._instance import _getCallInfo
|
||||
|
||||
# evacuate this later
|
||||
@ -70,7 +70,7 @@ def always_seq(edge, reset):
|
||||
reset._read = True
|
||||
reset._used = True
|
||||
sigargs.append(reset)
|
||||
sigdict = _getSigdict(sigargs, callinfo.symdict)
|
||||
sigdict = _get_sigdict(sigargs, callinfo.symdict)
|
||||
|
||||
def _always_seq_decorator(func):
|
||||
if not isinstance(func, FunctionType):
|
||||
@ -104,7 +104,7 @@ class _AlwaysSeq(_Always):
|
||||
func, senslist, callinfo=callinfo, sigdict=sigdict)
|
||||
|
||||
if self.inouts:
|
||||
raise AlwaysSeqError(_error.SigAugAssign, v.inouts)
|
||||
raise AlwaysSeqError(_error.SigAugAssign, self.inouts)
|
||||
|
||||
if self.embedded_func:
|
||||
raise AlwaysSeqError(_error.EmbeddedFunction)
|
||||
@ -129,7 +129,7 @@ class _AlwaysSeq(_Always):
|
||||
def reset_vars(self):
|
||||
for v in self.varregs:
|
||||
# only intbv's for now
|
||||
n, reg, init = v
|
||||
_, reg, init = v
|
||||
reg._val = init
|
||||
|
||||
def genfunc_reset(self):
|
||||
|
@ -28,7 +28,7 @@ import myhdl
|
||||
from myhdl import BlockError, BlockInstanceError, Cosimulation
|
||||
from myhdl._instance import _Instantiator
|
||||
from myhdl._util import _flatten
|
||||
from myhdl._extractHierarchy import (_MemInfo, _makeMemInfo,
|
||||
from myhdl._extractHierarchy import (_makeMemInfo,
|
||||
_UserVerilogCode, _UserVhdlCode)
|
||||
from myhdl._Signal import _Signal, _isListOfSigs
|
||||
|
||||
@ -128,7 +128,7 @@ class _Block(object):
|
||||
raise BlockError(_error.ArgType)
|
||||
if isinstance(inst, (_Block, _Instantiator)):
|
||||
if not inst.modctxt:
|
||||
raise BlockError(_error.InstanceError % (self.mod.name, inst.callername))
|
||||
raise BlockError(_error.InstanceError % (self.name, inst.callername))
|
||||
|
||||
def _updateNamespaces(self):
|
||||
# dicts to keep track of objects used in Instantiator objects
|
||||
|
@ -1,3 +1,5 @@
|
||||
#pylint: disable=all
|
||||
|
||||
import sys
|
||||
import types
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# pylint: disable=redefined-builtin
|
||||
|
||||
""" module with the concat function.
|
||||
|
||||
"""
|
||||
|
@ -1,3 +1,5 @@
|
||||
#pylint: disable=invalid-name
|
||||
|
||||
import ast
|
||||
|
||||
from myhdl._intbv import intbv
|
||||
|
14
pylintrc
14
pylintrc
@ -39,9 +39,9 @@ load-plugins=
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
#disable=
|
||||
#disabled for now: no docstring, no __init__, protected member access,
|
||||
#too few public methods
|
||||
disable=C0111, W0232, W0212, R0903
|
||||
#disabled for now
|
||||
disable=missing-docstring,no-init,protected-access,too-few-public-methods,
|
||||
old-style-class, too-many-branches, redefined-builtin
|
||||
|
||||
[REPORTS]
|
||||
|
||||
@ -170,10 +170,10 @@ const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
|
||||
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Regular expression which should only match correct function names
|
||||
function-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
function-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match correct method names
|
||||
method-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
method-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match correct instance attribute names
|
||||
attr-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
@ -210,7 +210,7 @@ docstring-min-length=-1
|
||||
[DESIGN]
|
||||
|
||||
# Maximum number of arguments for function / method
|
||||
max-args=5
|
||||
max-args=7
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore
|
||||
@ -232,7 +232,7 @@ max-statements=50
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=7
|
||||
max-attributes=13
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=2
|
||||
|
Loading…
x
Reference in New Issue
Block a user