1
0
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:
Jan Decaluwe 2016-03-21 14:40:47 +01:00
parent 6d47ba9d25
commit ac9ad7bcd0
7 changed files with 28 additions and 22 deletions

View File

@ -41,7 +41,7 @@ _error.NrOfArgs = "decorated function should not have arguments"
_error.DecNrOfArgs = "decorator should 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 caller namespace and return sigdict
Lookup signals in then namespace of a caller. This is used to add Lookup signals in then namespace of a caller. This is used to add
@ -73,7 +73,7 @@ def always(*args):
sigargs.append(arg.sig) sigargs.append(arg.sig)
elif not isinstance(arg, delay): elif not isinstance(arg, delay):
raise AlwaysError(_error.DecArgType) raise AlwaysError(_error.DecArgType)
sigdict = _getSigdict(sigargs, callinfo.symdict) sigdict = _get_sigdict(sigargs, callinfo.symdict)
def _always_decorator(func): def _always_decorator(func):
if not isinstance(func, FunctionType): if not isinstance(func, FunctionType):
@ -111,20 +111,20 @@ class _Always(_Instantiator):
bt = None bt = None
break break
# now set waiter class # now set waiter class
W = _Waiter w = _Waiter
if bt is delay: if bt is delay:
W = _DelayWaiter w = _DelayWaiter
elif len(self.senslist) == 1: elif len(self.senslist) == 1:
if bt is _Signal: if bt is _Signal:
W = _SignalWaiter w = _SignalWaiter
elif bt is _WaiterList: elif bt is _WaiterList:
W = _EdgeWaiter w = _EdgeWaiter
else: else:
if bt is _Signal: if bt is _Signal:
W = _SignalTupleWaiter w = _SignalTupleWaiter
elif bt is _WaiterList: elif bt is _WaiterList:
W = _EdgeTupleWaiter w = _EdgeTupleWaiter
return W return w
def genfunc(self): def genfunc(self):
senslist = self.senslist senslist = self.senslist

View File

@ -26,7 +26,7 @@ from types import FunctionType
from myhdl import AlwaysError, intbv from myhdl import AlwaysError, intbv
from myhdl._util import _isGenFunc from myhdl._util import _isGenFunc
from myhdl._Signal import _Signal, _WaiterList, _isListOfSigs 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 from myhdl._instance import _getCallInfo
# evacuate this later # evacuate this later
@ -70,7 +70,7 @@ def always_seq(edge, reset):
reset._read = True reset._read = True
reset._used = True reset._used = True
sigargs.append(reset) sigargs.append(reset)
sigdict = _getSigdict(sigargs, callinfo.symdict) sigdict = _get_sigdict(sigargs, callinfo.symdict)
def _always_seq_decorator(func): def _always_seq_decorator(func):
if not isinstance(func, FunctionType): if not isinstance(func, FunctionType):
@ -104,7 +104,7 @@ class _AlwaysSeq(_Always):
func, senslist, callinfo=callinfo, sigdict=sigdict) func, senslist, callinfo=callinfo, sigdict=sigdict)
if self.inouts: if self.inouts:
raise AlwaysSeqError(_error.SigAugAssign, v.inouts) raise AlwaysSeqError(_error.SigAugAssign, self.inouts)
if self.embedded_func: if self.embedded_func:
raise AlwaysSeqError(_error.EmbeddedFunction) raise AlwaysSeqError(_error.EmbeddedFunction)
@ -129,7 +129,7 @@ class _AlwaysSeq(_Always):
def reset_vars(self): def reset_vars(self):
for v in self.varregs: for v in self.varregs:
# only intbv's for now # only intbv's for now
n, reg, init = v _, reg, init = v
reg._val = init reg._val = init
def genfunc_reset(self): def genfunc_reset(self):

View File

@ -28,7 +28,7 @@ import myhdl
from myhdl import BlockError, BlockInstanceError, Cosimulation from myhdl import BlockError, BlockInstanceError, Cosimulation
from myhdl._instance import _Instantiator from myhdl._instance import _Instantiator
from myhdl._util import _flatten from myhdl._util import _flatten
from myhdl._extractHierarchy import (_MemInfo, _makeMemInfo, from myhdl._extractHierarchy import (_makeMemInfo,
_UserVerilogCode, _UserVhdlCode) _UserVerilogCode, _UserVhdlCode)
from myhdl._Signal import _Signal, _isListOfSigs from myhdl._Signal import _Signal, _isListOfSigs
@ -128,7 +128,7 @@ class _Block(object):
raise BlockError(_error.ArgType) raise BlockError(_error.ArgType)
if isinstance(inst, (_Block, _Instantiator)): if isinstance(inst, (_Block, _Instantiator)):
if not inst.modctxt: if not inst.modctxt:
raise BlockError(_error.InstanceError % (self.mod.name, inst.callername)) raise BlockError(_error.InstanceError % (self.name, inst.callername))
def _updateNamespaces(self): def _updateNamespaces(self):
# dicts to keep track of objects used in Instantiator objects # dicts to keep track of objects used in Instantiator objects

View File

@ -1,3 +1,5 @@
#pylint: disable=all
import sys import sys
import types import types

View File

@ -17,6 +17,8 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# pylint: disable=redefined-builtin
""" module with the concat function. """ module with the concat function.
""" """

View File

@ -1,3 +1,5 @@
#pylint: disable=invalid-name
import ast import ast
from myhdl._intbv import intbv from myhdl._intbv import intbv

View File

@ -39,9 +39,9 @@ load-plugins=
# no Warning level messages displayed, use"--disable=all --enable=classes # no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W" # --disable=W"
#disable= #disable=
#disabled for now: no docstring, no __init__, protected member access, #disabled for now
#too few public methods disable=missing-docstring,no-init,protected-access,too-few-public-methods,
disable=C0111, W0232, W0212, R0903 old-style-class, too-many-branches, redefined-builtin
[REPORTS] [REPORTS]
@ -170,10 +170,10 @@ const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
class-rgx=[A-Z_][a-zA-Z0-9]+$ class-rgx=[A-Z_][a-zA-Z0-9]+$
# Regular expression which should only match correct function names # 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 # 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 # Regular expression which should only match correct instance attribute names
attr-rgx=[a-z_][a-z0-9_]{2,30}$ attr-rgx=[a-z_][a-z0-9_]{2,30}$
@ -210,7 +210,7 @@ docstring-min-length=-1
[DESIGN] [DESIGN]
# Maximum number of arguments for function / method # 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 # Argument names that match this expression will be ignored. Default to name
# with leading underscore # with leading underscore
@ -232,7 +232,7 @@ max-statements=50
max-parents=7 max-parents=7
# Maximum number of attributes for a class (see R0902). # 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). # Minimum number of public methods for a class (see R0903).
min-public-methods=2 min-public-methods=2