summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2012-05-07 10:34:42 +0000
committerelie <elie>2012-05-07 10:34:42 +0000
commited9d376119a8e12b14a26d1d99443e51a29cc972 (patch)
tree218ce723d23e7de07d79c6ea9b17d9bafd534622
parentfd6edcf6a5c3efeb795e7b6c43d822fb8a48a58e (diff)
downloadpyasn1-ed9d376119a8e12b14a26d1d99443e51a29cc972.tar.gz
% args formatting improved
-rw-r--r--pyasn1/codec/ber/encoder.py4
-rw-r--r--pyasn1/type/namedtype.py8
-rw-r--r--pyasn1/type/namedval.py4
-rw-r--r--pyasn1/type/tag.py2
-rw-r--r--pyasn1/type/tagmap.py4
-rw-r--r--pyasn1/type/univ.py8
6 files changed, 15 insertions, 15 deletions
diff --git a/pyasn1/codec/ber/encoder.py b/pyasn1/codec/ber/encoder.py
index 2149b0b..1476988 100644
--- a/pyasn1/codec/ber/encoder.py
+++ b/pyasn1/codec/ber/encoder.py
@@ -149,7 +149,7 @@ class ObjectIdentifierEncoder(AbstractItemEncoder):
index = 5
else:
if len(oid) < 2:
- raise error.PyAsn1Error('Short OID %s' % value)
+ raise error.PyAsn1Error('Short OID %s' % (value,))
# Build the first twos
index = 0
@@ -326,7 +326,7 @@ class Encoder:
if baseTagSet in self.__tagMap:
concreteEncoder = self.__tagMap[baseTagSet]
else:
- raise Error('No encoder for %s' % value)
+ raise Error('No encoder for %s' % (value,))
return concreteEncoder.encode(
self, value, defMode, maxChunkSize
)
diff --git a/pyasn1/type/namedtype.py b/pyasn1/type/namedtype.py
index aa9c567..48967a5 100644
--- a/pyasn1/type/namedtype.py
+++ b/pyasn1/type/namedtype.py
@@ -60,12 +60,12 @@ class NamedTypes:
tagMap = self.__namedTypes[idx].getType().getTagMap()
for t in tagMap.getPosMap():
if t in self.__tagToPosIdx:
- raise error.PyAsn1Error('Duplicate type %s' % t)
+ raise error.PyAsn1Error('Duplicate type %s' % (t,))
self.__tagToPosIdx[t] = idx
try:
return self.__tagToPosIdx[tagSet]
except KeyError:
- raise error.PyAsn1Error('Type %s not found' % tagSet)
+ raise error.PyAsn1Error('Type %s not found' % (tagSet,))
def getNameByPosition(self, idx):
try:
@@ -79,12 +79,12 @@ class NamedTypes:
idx = idx - 1
n = self.__namedTypes[idx].getName()
if n in self.__nameToPosIdx:
- raise error.PyAsn1Error('Duplicate name %s' % n)
+ raise error.PyAsn1Error('Duplicate name %s' % (n,))
self.__nameToPosIdx[n] = idx
try:
return self.__nameToPosIdx[name]
except KeyError:
- raise error.PyAsn1Error('Name %s not found' % name)
+ raise error.PyAsn1Error('Name %s not found' % (name,))
def __buildAmbigiousTagMap(self):
ambigiousTypes = ()
diff --git a/pyasn1/type/namedval.py b/pyasn1/type/namedval.py
index 815e2d4..d0fea7c 100644
--- a/pyasn1/type/namedval.py
+++ b/pyasn1/type/namedval.py
@@ -15,10 +15,10 @@ class NamedValues:
name = namedValue
val = automaticVal
if name in self.nameToValIdx:
- raise error.PyAsn1Error('Duplicate name %s' % name)
+ raise error.PyAsn1Error('Duplicate name %s' % (name,))
self.nameToValIdx[name] = val
if val in self.valToNameIdx:
- raise error.PyAsn1Error('Duplicate value %s' % name)
+ raise error.PyAsn1Error('Duplicate value %s=%s' % (name, val))
self.valToNameIdx[val] = name
self.namedValues = self.namedValues + ((name, val),)
automaticVal = automaticVal + 1
diff --git a/pyasn1/type/tag.py b/pyasn1/type/tag.py
index 0cf67eb..1144907 100644
--- a/pyasn1/type/tag.py
+++ b/pyasn1/type/tag.py
@@ -18,7 +18,7 @@ class Tag:
def __init__(self, tagClass, tagFormat, tagId):
if tagId < 0:
raise error.PyAsn1Error(
- 'Negative tag ID (%s) not allowed' % tagId
+ 'Negative tag ID (%s) not allowed' % (tagId,)
)
self.__tag = (tagClass, tagFormat, tagId)
self.uniq = (tagClass, tagId)
diff --git a/pyasn1/type/tagmap.py b/pyasn1/type/tagmap.py
index 53e1791..7cec3a1 100644
--- a/pyasn1/type/tagmap.py
+++ b/pyasn1/type/tagmap.py
@@ -28,7 +28,7 @@ class TagMap:
def clone(self, parentType, tagMap, uniq=False):
if self.__defType is not None and tagMap.getDef() is not None:
- raise error.PyAsn1Error('Duplicate default value at %s' % self)
+ raise error.PyAsn1Error('Duplicate default value at %s' % (self,))
if tagMap.getDef() is not None:
defType = tagMap.getDef()
else:
@@ -37,7 +37,7 @@ class TagMap:
posMap = self.__posMap.copy()
for k in tagMap.getPosMap():
if uniq and k in posMap:
- raise error.PyAsn1Error('Duplicate positive key %s' % k)
+ raise error.PyAsn1Error('Duplicate positive key %s' % (k,))
posMap[k] = parentType
negMap = self.__negMap.copy()
diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py
index 3b876ac..81a5637 100644
--- a/pyasn1/type/univ.py
+++ b/pyasn1/type/univ.py
@@ -224,14 +224,14 @@ class BitString(base.AbstractSimpleAsn1Item):
return tuple(r)
else:
raise error.PyAsn1Error(
- 'Bad BIT STRING value notation %s' % value
+ 'Bad BIT STRING value notation %s' % (value,)
)
else:
for i in value.split(','):
j = self.__namedValues.getValue(i)
if j is None:
raise error.PyAsn1Error(
- 'Unknown bit identifier \'%s\'' % i
+ 'Unknown bit identifier \'%s\'' % (i,)
)
if j >= len(r):
r.extend([0]*(j-len(r)+1))
@@ -528,7 +528,7 @@ class Real(base.AbstractSimpleAsn1Item):
)
if value[1] not in (2, 10):
raise error.PyAsn1Error(
- 'Prohibited base for Real value: %s' % value[1]
+ 'Prohibited base for Real value: %s' % (value[1],)
)
if value[1] == 10:
value = self.__normalizeBase10(value)
@@ -648,7 +648,7 @@ class SetOf(base.AbstractConstructedAsn1Item):
def _verifyComponent(self, idx, value):
if self._componentType is not None and \
not self._componentType.isSuperTypeOf(value):
- raise error.PyAsn1Error('Component type error %s' % value)
+ raise error.PyAsn1Error('Component type error %s' % (value,))
def getComponentByPosition(self, idx): return self._componentValues[idx]
def setComponentByPosition(self, idx, value=None, verifyConstraints=True):