Commit db0f8473 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Don't shadow built-ins.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@958 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7b3d9eea
...@@ -51,8 +51,8 @@ class Dispatcher: ...@@ -51,8 +51,8 @@ class Dispatcher:
class Application(object): class Application(object):
"""The storage node application.""" """The storage node application."""
def __init__(self, file, section): def __init__(self, filename, section):
config = ConfigurationManager(file, section) config = ConfigurationManager(filename, section)
self.name = config.getName() self.name = config.getName()
logging.debug('the name is %s', self.name) logging.debug('the name is %s', self.name)
......
...@@ -176,12 +176,12 @@ class ThreadContext(object): ...@@ -176,12 +176,12 @@ class ThreadContext(object):
_threads_dict = {} _threads_dict = {}
def __getThreadData(self): def __getThreadData(self):
id = get_ident() thread_id = get_ident()
try: try:
result = self._threads_dict[id] result = self._threads_dict[thread_id
except KeyError: except KeyError:
self.clear(id) self.clear(thread_id)
result = self._threads_dict[id] result = self._threads_dict[thread_id]
return result return result
def __getattr__(self, name): def __getattr__(self, name):
...@@ -195,10 +195,10 @@ class ThreadContext(object): ...@@ -195,10 +195,10 @@ class ThreadContext(object):
thread_data = self.__getThreadData() thread_data = self.__getThreadData()
thread_data[name] = value thread_data[name] = value
def clear(self, id=None): def clear(self, thread_id=None):
if id is None: if thread_id is None:
id = get_ident() thread_id = get_ident()
self._threads_dict[id] = { self._threads_dict[thread_id] = {
'tid': None, 'tid': None,
'txn': None, 'txn': None,
'data_dict': {}, 'data_dict': {},
...@@ -215,8 +215,8 @@ class Application(object): ...@@ -215,8 +215,8 @@ class Application(object):
def __init__(self, master_nodes, name, connector, **kw): def __init__(self, master_nodes, name, connector, **kw):
# XXX: use a configuration entry # XXX: use a configuration entry
from neo import buildFormatString from neo import buildFormatString
format = buildFormatString('CLIENT') fmt = buildFormatString('CLIENT')
logging.basicConfig(level=logging.DEBUG, format=format) logging.basicConfig(level=logging.DEBUG, format=fmt)
em = EventManager() em = EventManager()
# Start polling thread # Start polling thread
self.poll_thread = ThreadedPoll(em) self.poll_thread = ThreadedPoll(em)
......
...@@ -56,8 +56,8 @@ if VERBOSE_LOCKING: ...@@ -56,8 +56,8 @@ if VERBOSE_LOCKING:
self.waiting = [] self.waiting = []
self._note('%s@%X created by %r', self.__class__.__name__, id(self), LockUser(1)) self._note('%s@%X created by %r', self.__class__.__name__, id(self), LockUser(1))
def _note(self, format, *args): def _note(self, fmt, *args):
sys.stderr.write(format % args + '\n') sys.stderr.write(fmt % args + '\n')
sys.stderr.flush() sys.stderr.flush()
def _getOwner(self): def _getOwner(self):
......
...@@ -41,9 +41,9 @@ from neo.connector import getConnectorHandler ...@@ -41,9 +41,9 @@ from neo.connector import getConnectorHandler
class Application(object): class Application(object):
"""The master node application.""" """The master node application."""
def __init__(self, file, section): def __init__(self, filename, section):
config = ConfigurationManager(file, section) config = ConfigurationManager(filename, section)
self.connector_handler = getConnectorHandler(config.getConnector()) self.connector_handler = getConnectorHandler(config.getConnector())
self.name = config.getName() self.name = config.getName()
......
...@@ -416,8 +416,8 @@ class Packet(object): ...@@ -416,8 +416,8 @@ class Packet(object):
def getId(self): def getId(self):
return self._id return self._id
def setId(self, id): def setId(self, packet_id):
self._id = id self._id = packet_id
def getType(self): def getType(self):
return self._type return self._type
...@@ -494,11 +494,11 @@ def _checkNodeState(state): ...@@ -494,11 +494,11 @@ def _checkNodeState(state):
raise PacketMalformedError('invalid node state %d' % state) raise PacketMalformedError('invalid node state %d' % state)
return node_state return node_state
def _checkNodeType(type): def _checkNodeType(node_type):
node_type = node_types.get(type) _node_type = node_types.get(node_type)
if node_type is None: if node_type is None:
raise PacketMalformedError('invalid node type %d' % type) raise PacketMalformedError('invalid node type %d' % node_type)
return node_type return _node_type
def _checkAddress(address): def _checkAddress(address):
if address == '\0' * 6: if address == '\0' * 6:
...@@ -531,13 +531,13 @@ def _encodePTID(ptid): ...@@ -531,13 +531,13 @@ def _encodePTID(ptid):
return INVALID_PTID return INVALID_PTID
return ptid return ptid
def _readString(buffer, name, offset=0): def _readString(buf, name, offset=0):
buffer = buffer[offset:] buf = buf[offset:]
(size, ) = unpack('!L', buffer[:4]) (size, ) = unpack('!L', buf[:4])
string = buffer[4:4+size] string = buf[4:4+size]
if len(string) != size: if len(string) != size:
raise PacketMalformedError("can't read string <%s>" % name) raise PacketMalformedError("can't read string <%s>" % name)
return (string, buffer[offset+size:]) return (string, buf[offset+size:])
# packet decoding # packet decoding
@handle_errors @handle_errors
......
...@@ -39,8 +39,8 @@ from neo.bootstrap import BootstrapManager ...@@ -39,8 +39,8 @@ from neo.bootstrap import BootstrapManager
class Application(object): class Application(object):
"""The storage node application.""" """The storage node application."""
def __init__(self, file, section, reset = False): def __init__(self, filename, section, reset=False):
config = ConfigurationManager(file, section) config = ConfigurationManager(filename, section)
self.name = config.getName() self.name = config.getName()
logging.debug('the name is %s', self.name) logging.debug('the name is %s', self.name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment