From a25cb3dce5c00c4755e8323f713d7ae48fcb5200 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 20 May 2020 15:51:14 +0200 Subject: [PATCH] cosmetics on datatypes.TextType make __repr__ more nice and include in __all__ Change-Id: Iecfe6326f2d35a2210c03f7bd8c84dc2830b19ea Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/23120 Tested-by: JenkinsCodeReview Reviewed-by: Enrico Faulhaber Reviewed-by: Markus Zolliker --- secop/datatypes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/secop/datatypes.py b/secop/datatypes.py index 55ed4a1..0090ce2 100644 --- a/secop/datatypes.py +++ b/secop/datatypes.py @@ -40,7 +40,7 @@ __all__ = [ 'DataType', 'get_datatype', 'FloatRange', 'IntRange', 'ScaledInteger', 'BoolType', 'EnumType', - 'BLOBType', 'StringType', + 'BLOBType', 'StringType', 'TextType', 'TupleOf', 'ArrayOf', 'StructOf', 'CommandType', 'StatusType', ] @@ -592,7 +592,9 @@ class TextType(StringType): super(TextType, self).__init__(0, maxchars) def __repr__(self): - return 'TextType(%d, %d)' % (self.minchars, self.maxchars) + if self.maxchars == UNLIMITED: + return 'TextType()' + return 'TextType(%d)' % (self.maxchars) def copy(self): # DataType.copy will not work, because it is exported as 'string'