Commit e4d23152 authored by Yoshinori Okuji's avatar Yoshinori Okuji

More fixes with pyflakes.

git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@78 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 185787ff
import socket import socket
import errno import errno
import logging import logging
from select import select
from neo.protocol import Packet, ProtocolError from neo.protocol import Packet, ProtocolError
from neo.event import IdleEvent from neo.event import IdleEvent
......
from time import time from time import time
import logging
from neo.protocol import RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, BROKEN_STATE, \ from neo.protocol import RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, BROKEN_STATE, \
MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE
from neo.util import dump
class Node(object): class Node(object):
"""This class represents a node.""" """This class represents a node."""
......
...@@ -276,7 +276,7 @@ class Packet(object): ...@@ -276,7 +276,7 @@ class Packet(object):
return self.error(msg_id, NOT_READY_CODE, 'not ready: ' + error_message) return self.error(msg_id, NOT_READY_CODE, 'not ready: ' + error_message)
def brokenNodeDisallowedError(self, msg_id, error_message): def brokenNodeDisallowedError(self, msg_id, error_message):
return self.error(msg_id, BROKEN_NODE_DISALLOWED_ERROR, return self.error(msg_id, BROKEN_NODE_DISALLOWED_CODE,
'broken node disallowed error: ' + error_message) 'broken node disallowed error: ' + error_message)
def oidNotFound(self, msg_id, error_message): def oidNotFound(self, msg_id, error_message):
...@@ -791,6 +791,7 @@ class Packet(object): ...@@ -791,6 +791,7 @@ class Packet(object):
def _decodeNotifyPartitionChanges(self): def _decodeNotifyPartitionChanges(self):
try: try:
ptid, n = unpack('!8sL', self._body[:12]) ptid, n = unpack('!8sL', self._body[:12])
cell_list = []
for i in xrange(n): for i in xrange(n):
cell = unpack('!L16sH', self._body[12+i*22:34+i*22]) cell = unpack('!L16sH', self._body[12+i*22:34+i*22])
cell_list.append(cell) cell_list.append(cell)
...@@ -1076,8 +1077,8 @@ class Packet(object): ...@@ -1076,8 +1077,8 @@ class Packet(object):
def _decodeAnswerObjectHistory(self): def _decodeAnswerObjectHistory(self):
try: try:
oid, length = unpack('!8sH', self._body[:10]) oid, length = unpack('!8sH', self._body[:10])
history_list = () history_list = []
for x in xrange(length): for i in xrange(length):
serial, size = unpack('!8sL', self._body[10+i*12:22+i*12]) serial, size = unpack('!8sL', self._body[10+i*12:22+i*12])
history_list.append(tuple(serial, size)) history_list.append(tuple(serial, size))
except: except:
......
import logging
from neo.protocol import UP_TO_DATE_STATE, OUT_OF_DATE_STATE, FEEDING_STATE, \ from neo.protocol import UP_TO_DATE_STATE, OUT_OF_DATE_STATE, FEEDING_STATE, \
DISCARDED_STATE, RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \ DISCARDED_STATE, RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \
BROKEN_STATE BROKEN_STATE
...@@ -120,7 +118,7 @@ class PartitionTable(object): ...@@ -120,7 +118,7 @@ class PartitionTable(object):
for cell in row: for cell in row:
if cell.getNode() == node: if cell.getNode() == node:
row.remove(cell) row.remove(cell)
if state != FEEDING_STATE: if cell.getState() != FEEDING_STATE:
self.count_dict[node] = self.count_dict.get(node, 0) - 1 self.count_dict[node] = self.count_dict.get(node, 0) - 1
break break
......
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