SF.net SVN: fclient: [462] trunk/fcp2/src/fcp2/test_fcp/dummy_io.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-01 11:27:38
|
Revision: 462
http://fclient.svn.sourceforge.net/fclient/?rev=462&view=rev
Author: jUrner
Date: 2008-07-01 04:27:47 -0700 (Tue, 01 Jul 2008)
Log Message:
-----------
for ease of use, all necessary symbols are now imported to main
Modified Paths:
--------------
trunk/fcp2/src/fcp2/test_fcp/dummy_io.py
Modified: trunk/fcp2/src/fcp2/test_fcp/dummy_io.py
===================================================================
--- trunk/fcp2/src/fcp2/test_fcp/dummy_io.py 2008-07-01 11:27:41 UTC (rev 461)
+++ trunk/fcp2/src/fcp2/test_fcp/dummy_io.py 2008-07-01 11:27:47 UTC (rev 462)
@@ -11,9 +11,8 @@
def __del__(self): sys.path.pop(0)
hack = _RelImportHack(3)
-from fcp2 import client
-from fcp2.client import iohandler
-from fcp2 import consts
+import fcp2
+from fcp2 import iohandler
del hack
#<-- rel import hack
@@ -33,30 +32,30 @@
def connect(self, **kwargs):
if not self._allowConnect:
- raise consts.IOConnectFailedError('Refused')
+ raise fcp2.ErrorIOConnectFailed('Refused')
self._isOpen = True
def read(self, n):
if self._isBroken:
- raise consts.IOBrokenError('Broken')
+ raise fcp2.ErrorIOBroken('Broken')
if not self.isOpen():
- raise consts.IOClosedError('Closed')
+ raise fcp2.ErrorIOClosed('Closed')
if self._reverseDirection:
if not self.writeBuffer:
- raise consts.IOTimeoutError('Timeout')
+ raise fcp2.ErrorIOTimeout('Timeout')
bytes, self.writeBuffer = self.writeBuffer[ :n], self.writeBuffer[n: ]
else:
if not self.readBuffer:
- raise consts.IOTimeoutError('Timeout')
+ raise fcp2.ErrorIOTimeout('Timeout')
bytes, self.readBuffer = self.readBuffer[ :n], self.readBuffer[n: ]
return bytes
def write(self, bytes):
if self._isBroken:
- raise consts.IOBrokenError('Broken')
+ raise fcp2.ErrorIOBroken('Broken')
if not self.isOpen():
- raise consts.IOClosedError('Closed')
+ raise fcp2.ErrorIOClosed('Closed')
self.writeBuffer += bytes
def close(self):
@@ -68,7 +67,7 @@
self.readBuffer = ''
self.writeBuffer = ''
else:
- raise consts.IOClosedError('Closed')
+ raise fcp2.ErrorIOClosed('Closed')
def isOpen(self):
return self._isOpen
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|