Skip to content

Commit aab12a7

Browse files
author
Justus Pendleton
committed
assorted pyflakes fixes
I (re-)discovered pyflakes today and ran it over to roundup code to see what it had to say. It reported a ton of "imported module foo but you're not actually using it" warnings and a couple of actual errors that this patch fixes. The code was wrong but it was mostly stuff that never gets executed...like hyperdb.Choice.
1 parent fc29531 commit aab12a7

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

roundup/backends/back_postgresql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: back_postgresql.py,v 1.41 2007-09-25 19:49:19 jpend Exp $
1+
#$Id: back_postgresql.py,v 1.42 2007-09-27 06:12:57 jpend Exp $
22
#
33
# Copyright (c) 2003 Martynas Sklyzmantas, Andrey Lebedev <[email protected]>
44
#
@@ -108,7 +108,7 @@ def db_exists(config):
108108
return 0
109109

110110
class Sessions(sessions_rdbms.Sessions):
111-
def set(*args, **kwargs):
111+
def set(self, *args, **kwargs):
112112
try:
113113
sessions_rdbms.Sessions.set(*args, **kwargs)
114114
except ProgrammingError, err:

roundup/backends/rdbms_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: rdbms_common.py,v 1.190 2007-09-16 06:51:48 jpend Exp $
18+
#$Id: rdbms_common.py,v 1.191 2007-09-27 06:12:57 jpend Exp $
1919
""" Relational database (SQL) backend common code.
2020

2121
Basics:
@@ -637,7 +637,7 @@ def drop_class(self, cn, spec):
637637
properties = spec[1]
638638
# figure the multilinks
639639
mls = []
640-
for propanme, prop in properties:
640+
for propname, prop in properties:
641641
if isinstance(prop, Multilink):
642642
mls.append(propname)
643643

roundup/backends/sessions_dbm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: sessions_dbm.py,v 1.7 2006-04-27 04:59:37 richard Exp $
1+
#$Id: sessions_dbm.py,v 1.8 2007-09-27 06:12:57 jpend Exp $
22
"""This module defines a very basic store that's used by the CGI interface
33
to store session and one-time-key information.
44

@@ -8,6 +8,7 @@
88
__docformat__ = 'restructuredtext'
99

1010
import anydbm, whichdb, os, marshal, time
11+
from roundup import hyperdb
1112

1213
class BasicDatabase:
1314
''' Provide a nice encapsulation of an anydbm store.

roundup/hyperdb.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: hyperdb.py,v 1.129 2007-01-10 18:17:00 schlatterbeck Exp $
18+
# $Id: hyperdb.py,v 1.130 2007-09-27 06:12:56 jpend Exp $
1919

2020
"""Hyperdatabase implementation, especially field types.
2121
"""
@@ -81,7 +81,7 @@ def from_raw(self, value, **kw):
8181
try:
8282
value = password.Password(value)
8383
except password.PasswordValueError, message:
84-
raise HyperdbValueError, 'property %s: %s'%(propname, message)
84+
raise HyperdbValueError, 'property %s: %s'%(kw['propname'], message)
8585
return value
8686
def sort_repr (self, cls, val, name):
8787
if not val:
@@ -487,7 +487,7 @@ def _set_val(self, val):
487487
else:
488488
self._val = val
489489
self.has_values = True
490-
490+
491491
val = property(lambda self: self._val, _set_val)
492492

493493
def _sort(self, val):
@@ -1136,7 +1136,7 @@ def filter(self, search_matches, filterspec, sort=[], group=[]):
11361136
for all issues where a message was added by a certain user in
11371137
the last week with a filterspec of
11381138
{'messages.author' : '42', 'messages.creation' : '.-1w;'}
1139-
1139+
11401140
Implementation note:
11411141
This implements a non-optimized version of Transitive search
11421142
using _filter implemented in a backend class. A more efficient
@@ -1291,7 +1291,7 @@ def __init__(self, db, classname, **properties):
12911291
property.
12921292
'''
12931293
if not properties.has_key('content'):
1294-
properties['content'] = hyperdb.String(indexme='yes')
1294+
properties['content'] = String(indexme='yes')
12951295

12961296
def export_propnames(self):
12971297
''' Don't export the "content" property
@@ -1390,6 +1390,6 @@ def Choice(name, db, *options):
13901390
cl = Class(db, name, name=String(), order=String())
13911391
for i in range(len(options)):
13921392
cl.create(name=options[i], order=i)
1393-
return hyperdb.Link(name)
1393+
return Link(name)
13941394

13951395
# vim: set filetype=python sts=4 sw=4 et si :

0 commit comments

Comments
 (0)