Thread: SF.net SVN: fclient: [466] trunk/fcp2/src/fcp2/types.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-01 11:28:24
|
Revision: 466
http://fclient.svn.sourceforge.net/fclient/?rev=466&view=rev
Author: jUrner
Date: 2008-07-01 04:28:33 -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/types.py
Modified: trunk/fcp2/src/fcp2/types.py
===================================================================
--- trunk/fcp2/src/fcp2/types.py 2008-07-01 11:28:16 UTC (rev 465)
+++ trunk/fcp2/src/fcp2/types.py 2008-07-01 11:28:33 UTC (rev 466)
@@ -24,7 +24,7 @@
#*************************************************************************************
#
#*************************************************************************************
-class FcpType(object):
+class Type(object):
@classmethod
def pythonToFcp(clss, value):
@@ -35,7 +35,7 @@
return value
-class FcpTypeString(FcpType):
+class TypeString(Type):
@classmethod
def pythonToFcp(clss, value):
@@ -46,7 +46,7 @@
return value
-class FcpTypeBool(FcpType):
+class TypeBool(Type):
@classmethod
def pythonToFcp(clss, value):
@@ -57,7 +57,7 @@
return value == consts.FcpTrue
-class FcpTypeInt(FcpType):
+class TypeInt(Type):
@classmethod
def pythonToFcp(clss, value):
@@ -68,7 +68,7 @@
return int(value)
-class FcpTypeFloat(FcpType):
+class TypeFloat(Type):
@classmethod
def pythonToFcp(clss, value):
@@ -80,7 +80,7 @@
# GetFailed sets the ExpectedDataLenght field to '' (empty string). Fix this to show up as -1
-class FcpTypeInt_GetFailed_ExpectedDataLenght(FcpType):
+class TypeInt_GetFailed_ExpectedDataLenght(Type):
@classmethod
def pythonToFcp(clss, value):
@@ -93,7 +93,7 @@
return int(value)
-class FcpTypeIntWithBounds(FcpType):
+class TypeIntWithBounds(Type):
def __init__(self, lowerBound, upperBound):
self.lowerBound = lowerBound
@@ -106,7 +106,7 @@
return int(value)
-class FcpTypeBase64EncodedString(FcpType):
+class TypeBase64EncodedString(Type):
@classmethod
def pythonToFcp(clss, value):
@@ -117,7 +117,7 @@
return base64.b64decode(value)
-class FcpTypeTime(FcpType):
+class TypeTime(Type):
@classmethod
def pythonToFcp(clss, value):
@@ -127,19 +127,19 @@
def fcpToPython(clss, value):
return int(value) / 1000
-class FcpTypeTimeDelta(FcpType):
+class TypeTimeDelta(Type):
"""Time durations passed as tuple((int) number, modifier).
For modifiers see : L{consts.TimeDeltaPostfix}. Number can be -1
aswell, meaniong 'not set' or 'undefined'.
- >>> FcpTypeTimeDelta.fcpToPython('1000day')
+ >>> TypeTimeDelta.fcpToPython('1000day')
(1000, 'day')
- >>> FcpTypeTimeDelta.fcpToPython('arbitrary')
+ >>> TypeTimeDelta.fcpToPython('arbitrary')
(-1, '')
- >>> FcpTypeTimeDelta.pythonToFcp( (1000, 'day') )
+ >>> TypeTimeDelta.pythonToFcp( (1000, 'day') )
'1000day'
"""
@@ -160,31 +160,31 @@
return (num, tail)
return (-1, consts.TimeDeltaPostfix.Second)
-class FcpTypePercent(FcpTypeFloat): pass
-class FcpTypeUri(FcpType): pass
+class TypePercent(TypeFloat): pass
+class TypeUri(Type): pass
-class FcpTypeIP(FcpType): pass
-class FcpTypeIPList(FcpType): pass
-class FcpTypeIPort(FcpType): pass
-class FcpTypeStringList(FcpType): pass
-class FcpTypeDirname(FcpType): pass
-class FcpTypeFilename(FcpType): pass
-class FcpTypeByteAmount(FcpType):
+class TypeIP(Type): pass
+class TypeIPList(Type): pass
+class TypeIPort(Type): pass
+class TypeStringList(Type): pass
+class TypeDirname(Type): pass
+class TypeFilename(Type): pass
+class TypeByteAmount(Type):
"""Byte amounts are passed as tuple((int, float) number, modifier).
For modifiers see : L{consts.ByteAmountPostfix}. Number of bytes can be -1
aswell, meaniong 'not set' or 'undefined'.
- >>> FcpTypeByteAmount.fcpToPython('1000k')
+ >>> TypeByteAmount.fcpToPython('1000k')
(1000, 'k')
- >>> FcpTypeByteAmount.fcpToPython('1.3k')
+ >>> TypeByteAmount.fcpToPython('1.3k')
(1.3, 'k')
- >>> FcpTypeByteAmount.fcpToPython('arbitrary')
+ >>> TypeByteAmount.fcpToPython('arbitrary')
(-1, '')
- >>> FcpTypeByteAmount.pythonToFcp( (1000, 'k') )
+ >>> TypeByteAmount.pythonToFcp( (1000, 'k') )
'1000k'
"""
@@ -207,14 +207,14 @@
return (num, tail)
return (-1, consts.ByteAmountPostfix.Bytes)
-class FcpTypePercent(FcpTypeFloat): pass
-class FcpTypeUri(FcpType): pass
+class TypePercent(TypeFloat): pass
+class TypeUri(Type): pass
# special choice types for config message
-class FcpTypeChoiceFProxyCss(FcpType):
+class TypeChoiceFProxyCss(Type):
Clean = 'Clean'
Boxed = 'boxed'
GrayAndBlue = 'grayandblue'
@@ -223,7 +223,7 @@
ChoicesAll = (Clean, Boxed, GrayAndBlue, Sky)
ChoicesAllowMultiple = False
-class FcpTypeChoiceLoggerPriority(FcpType):
+class TypeChoiceLoggerPriority(Type):
Error = 'ERROR'
Normal = 'NORMAL'
Minor = 'MINOR'
@@ -232,7 +232,7 @@
ChoicesAll = (Error, Normal, Minor, Debug)
ChoicesAllowMultiple = False
-class FcpTypeChoiceNodeDownloadAllowedDirs(FcpType):
+class TypeChoiceNodeDownloadAllowedDirs(Type):
All = 'all'
Downloads = 'downloads'
Nowhere = ''
@@ -240,13 +240,13 @@
ChoicesAll = (All, Downloads, Nowhere)
ChoicesAllowMultiple = False
-class FcpTypeChoiceNodeUploadAllowedDirs(FcpType):
+class TypeChoiceNodeUploadAllowedDirs(Type):
All = 'all'
Nowhere = ''
ChoicesAll = (All, Nowhere)
ChoicesAllowMultiple = False
-class FcpTypeChoicePriorityPolicy(FcpType):
+class TypeChoicePriorityPolicy(Type):
Hard = 'HARD'
Soft = 'SOFT'
@@ -254,7 +254,7 @@
ChoicesAllowMultiple = False
-class FcpTypeChoiceSSLVersion(FcpType):
+class TypeChoiceSSLVersion(Type):
Stl = 'STL'
SslV3 = 'SSLV3'
TlsV1 = 'TLSv1'
@@ -262,6 +262,8 @@
ChoicesAll = (Stl, SslV3, TlsV1)
ChoicesAllowMultiple = False
+
+__all__ = [i for i in dir() if i[0].isupper() and not i.startswith('_')]
#********************************************************************************************
#
#********************************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-02 07:05:30
|
Revision: 484
http://fclient.svn.sourceforge.net/fclient/?rev=484&view=rev
Author: jUrner
Date: 2008-07-02 00:05:37 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
fixed broken docstrings
Modified Paths:
--------------
trunk/fcp2/src/fcp2/types.py
Modified: trunk/fcp2/src/fcp2/types.py
===================================================================
--- trunk/fcp2/src/fcp2/types.py 2008-07-02 07:05:32 UTC (rev 483)
+++ trunk/fcp2/src/fcp2/types.py 2008-07-02 07:05:37 UTC (rev 484)
@@ -130,7 +130,7 @@
class TypeTimeDelta(Type):
"""Time durations passed as tuple((int) number, modifier).
- For modifiers see : L{consts.TimeDeltaPostfix}. Number can be -1
+ For modifiers see : L{consts.ConstTimeDeltaPostfix}. Number can be -1
aswell, meaniong 'not set' or 'undefined'.
>>> TypeTimeDelta.fcpToPython('1000day')
@@ -172,7 +172,7 @@
class TypeByteAmount(Type):
"""Byte amounts are passed as tuple((int, float) number, modifier).
- For modifiers see : L{consts.ByteAmountPostfix}. Number of bytes can be -1
+ For modifiers see : L{consts.ConstByteAmountPostfix}. Number of bytes can be -1
aswell, meaniong 'not set' or 'undefined'.
>>> TypeByteAmount.fcpToPython('1000k')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-05 12:45:04
|
Revision: 504
http://fclient.svn.sourceforge.net/fclient/?rev=504&view=rev
Author: jUrner
Date: 2008-07-05 05:45:13 -0700 (Sat, 05 Jul 2008)
Log Message:
-----------
symbol names where broken
Modified Paths:
--------------
trunk/fcp2/src/fcp2/types.py
Modified: trunk/fcp2/src/fcp2/types.py
===================================================================
--- trunk/fcp2/src/fcp2/types.py 2008-07-05 12:42:19 UTC (rev 503)
+++ trunk/fcp2/src/fcp2/types.py 2008-07-05 12:45:13 UTC (rev 504)
@@ -155,10 +155,10 @@
result = clss.NumberPattern.split(value)
if len(result) == 3:
foo, foundInt, tail = result
- if tail in consts.TimeDeltaPostfix.MembersAll:
+ if tail in consts.ConstTimeDeltaPostfix.MembersAll:
num = int(foundInt)
return (num, tail)
- return (-1, consts.TimeDeltaPostfix.Second)
+ return (-1, consts.ConstTimeDeltaPostfix.Second)
class TypePercent(TypeFloat): pass
class TypeUri(Type): pass
@@ -199,13 +199,13 @@
result = clss.NumberPattern.split(value)
if len(result) == 4:
foo, foundFloat, foundInt, tail = result
- if tail in consts.ByteAmountPostfix.MembersAll:
+ if tail in consts.ConstByteAmountPostfix.MembersAll:
if foundFloat:
num = float(foundFloat)
else:
num = int(foundInt)
return (num, tail)
- return (-1, consts.ByteAmountPostfix.Bytes)
+ return (-1, consts.ConstByteAmountPostfix.Bytes)
class TypePercent(TypeFloat): pass
class TypeUri(Type): pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|