from
Sylvain Thénault <thenault at nerim dot net>
to
Wolfgang Grafen <wolfgang.grafen at marconi dot com>
cc
Sylvain Thenault <syt at logilab dot fr>
subject
Re: pylint0.2 common0.3.3 AttributeError: 'list' object has no attribute 'pure_python'
date
On Friday 10 October à 18:42, Wolfgang Grafen wrote:2003/10/10 20:02
> Hi Sylvain,
Hi !
> 1 #!/user/freepool/local/bin/python2.3
> 2 import re
> 3
> 4 re_default_arch = re.compile("^a\d+").match
> 5
> 6 def get_vhdlinfo(vhdl_architecture_fname):
> 7 # upifmain_upsfrontloop-xp-ar.vhd
> 8 entityname,arch,misc = vhdl_architecture_fname.split('-')
> 9
> 10 for_modulename = entityname.split("upifmain_ups")[1]
> 11 if not re_default_arch(arch):
> 12 upein_path = "stim/%(for_modulename)s_%(arch)s_up.ein" % vars()
> 13
> 14 else:
> 15 upein_path = "stim/%(for_modulename)s_up.ein" % vars()
> 16
> 17 upregsigname = "%(entityname)s-sigs" % vars()
> 18
> 19 def main(vhdl_architecture_fname):
> 20 pass
> 21
> 22 if __name__ == '__main__':
> 23 vhdl_architecture_fnames = []
> 24 for vhdl_architecture_fname in vhdl_architecture_fnames:
> 25 architecture_txt,configuration_txt,subst_dict = main(
> 26 vhdl_architecture_fname)
> (END)
>
>
> chios upifmain_upsstaticgen 91 % pylint pylint_example.py
> No config file found, using default configuration
> ************* Module pylint_example
> W: 0: Missing docstring
> W: 0: Missing required attribute "__revision__"
> W: 6:get_vhdlinfo: Missing docstring
> W: 6:get_vhdlinfo: Redefining variable (vhdl_architecture_fname) from outer scope (line 24)
> W: 17:get_vhdlinfo: Unused variable upregsigname
> W: 10:get_vhdlinfo: Unused variable for_modulename
> it is used in line 12 and 15
well, pylint doesn't look for used variables in string. And I'm not sure
it will detect a variable use in such a statement one day...
> W: 8:get_vhdlinfo: Unused variable misc
> W: 12:get_vhdlinfo: Unused variable upein_path
> W: 19:main: Missing docstring
> W: 19:main: Redefining variable (vhdl_architecture_fname) from outer scope (line 24)
> This variable is passed by a function-call in line 25, that is normal - so why this is a warning?
actually this is a warning because line 24 add this variable name to the
globals dictionary. Maybe it should not be a warning because this is
protected by "if __name__ == '__main__'", but strictly speaking, pylint
is right ;)
regards
--
Sylvain Thénault

