First working implementation of _n2xdig method
This commit is contained in:
@@ -123,7 +123,38 @@ class Minter(Persistent):
|
|||||||
# - s = self.legalstring[remainder] + s
|
# - s = self.legalstring[remainder] + s
|
||||||
# 7. if mask contains a 'k' then add a '+' at the end of s
|
# 7. if mask contains a 'k' then add a '+' at the end of s
|
||||||
# 8. return s
|
# 8. return s
|
||||||
return ""
|
s = ""
|
||||||
|
varwidth = 0
|
||||||
|
xdig = list(self.legalstring)
|
||||||
|
rmask = list(self.template)
|
||||||
|
rmask.reverse()
|
||||||
|
while num != 0 or not varwidth:
|
||||||
|
if not varwidth:
|
||||||
|
try:
|
||||||
|
c = rmask.pop(0)
|
||||||
|
except IndexError:
|
||||||
|
print(self)
|
||||||
|
break
|
||||||
|
match c:
|
||||||
|
case "r":
|
||||||
|
break
|
||||||
|
case "s":
|
||||||
|
break
|
||||||
|
case "e":
|
||||||
|
div = self.alphacount
|
||||||
|
case "d":
|
||||||
|
div = self.digitcount
|
||||||
|
case "z":
|
||||||
|
varwidth = 1
|
||||||
|
continue
|
||||||
|
case "k":
|
||||||
|
continue
|
||||||
|
remainder = num % div
|
||||||
|
num = int(num / div)
|
||||||
|
s = xdig[remainder] + s
|
||||||
|
if self.template[-1] == "k":
|
||||||
|
s += "+"
|
||||||
|
return s
|
||||||
|
|
||||||
def _checkbar(self, id):
|
def _checkbar(self, id):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user