-
After creating a list of dictionaries, pychecker 0.8.18 seems to confuse it with a string - I get the message "Iterating over a string (records)" on the "for record in records:" line of the following code (copied verbatim from the source). The code runs fine, so I'm inclined to think it's a bug.
run_sql returns a list of lists, corresponding to the records and columns of the select statement...
2009-12-08 10:45:03 UTC by engmark
-
Under python 2.6 (distutils 2.6.2)
[C:\Temp\pychecker-0.8.18]python setup.py bdist_wininst -k
...
[C:\Temp\pychecker-0.8.18]type build\bdist.win32\wininst\SCRIPTS\pychecker.bat
C:\python26\python.exe ages\pychecker\checker.py %*
The problem seems to be this line in setup.py:
if root:
package_path = package_path[len(root):]
Commenting it out gives...
2009-11-24 00:55:18 UTC by pauldubois
-
This patch works for me
--- checker.py.orig 2009-11-23 16:38:46.204718300 -0800
+++ checker.py 2009-11-23 16:39:44.395569900 -0800
@@ -815,7 +815,8 @@
warnings = []
utils.initConfig(_cfg)
- for file, (moduleName, moduleDir) in zip(files, getModules(files)) :
+ for file in files:
+ for (moduleName, moduleDir) in getModules(files) :
if...
2009-11-24 00:41:25 UTC by pauldubois
-
I think the issue is with this line in checker.py:
for file, (moduleName, moduleDir) in zip(files, getModules(files)) :
since getModules() un-globs and flattens, len(getModules(files)) may be greater (or less than!) len(files), which causes problems for the zip.
For example, 'pychecker.bat *.py' only checks one module even if *.py un-globs to many.
2009-11-24 00:38:08 UTC by pauldubois
-
0.8.17, Debian Lenny
If this is not feasible, it's probably fine.
-=--=-=-=-=-=-=-=-=-=-=-=-
def foo():
return bar
if __name__ == "__main__":
bar = "bad"
-=--=-=-=-=-=-=-=-=-=-=-=-
I get no warnings when checking this, though I get the obvious 'no bar found' when running.
If I run pychecker on a file that has imported this file, it works fine in detecting that the variable...
2009-11-20 01:19:44 UTC by Reid Price
-
> In general the used_no error will appear wherever the wef line is*
* If wef appears after foo.
2009-11-20 00:24:47 UTC by Reid Price
-
Simplified:
-=-=-=-=-=-=-=-=-=-
foo = lambda used_no: ((used_no, i) for i in xrange(1))
def bar(used_yes):
return ((used_yes, i) for i in xrange(1)
#wef = lambda used_also: [(used_also, i) for i in xrange(1)]
-=-=-=-=-=-=-=-=-=-
$ pychecker parameter_unused.py
Processing parameter_unused...
Warnings...
parameter_unused.py:1: Parameter (used_no) not used
Uncommenting the 'wef ='...
2009-11-20 00:23:36 UTC by Reid Price
-
Processing parameter_unused...
Warnings...
parameter_unused.py:6: Parameter (item) not used.
2009-11-20 00:05:25 UTC by Reid Price
-
0.8.17, Debian Lenny
def filter_function(items, desc):
# items is a dictionary of dictionaries
# desc is a dictionary
satisfies = lambda item: all(items[item][req] == desc[req] for req in desc)
return filter(satisfies, items)
.
2009-11-20 00:02:51 UTC by Reid Price
-
#!/usr/bin/python
def a_dict():
return {1:2}
def main():
dict_a = {
'hello': 'world'
}
dict_a.update(a_dict())
dict_b = {
'hello': 'again'
}
dict_b.update(a_dict())
main()
Gives the warning ../../../test.py:11: Object (dict_a) has no attribute (update)
Note that the corresponding operation for dict_b does not give a warning.
2009-11-04 10:44:32 UTC by nobody