Skip to content

Commit 72d4357

Browse files
authored
Merge pull request #447 from ton-blockchain/revert-432-fix/int_parse
Revert "Do not try to cast NoneType to int"
2 parents e85a541 + 9a7e431 commit 72d4357

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

mytoncore/mytoncore.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -903,20 +903,20 @@ def GetConfig32(self):
903903
self.local.add_log("start GetConfig32 function", "debug")
904904
config32 = Dict()
905905
result = self.liteClient.Run("getconfig 32")
906-
config32["totalValidators"] = int(parse(result, "total:", ' ') or 0)
907-
config32["mainValidators"] = int(parse(result, "main:", ' ') or 0)
908-
config32["startWorkTime"] = int(parse(result, "utime_since:", ' ') or 0)
909-
config32["endWorkTime"] = int(parse(result, "utime_until:", ' ') or 0)
906+
config32["totalValidators"] = int(parse(result, "total:", ' '))
907+
config32["mainValidators"] = int(parse(result, "main:", ' '))
908+
config32["startWorkTime"] = int(parse(result, "utime_since:", ' '))
909+
config32["endWorkTime"] = int(parse(result, "utime_until:", ' '))
910910
lines = result.split('\n')
911911
validators = list()
912912
for line in lines:
913913
if "public_key:" in line:
914914
validatorAdnlAddr = parse(line, "adnl_addr:x", ')')
915915
pubkey = parse(line, "pubkey:x", ')')
916916
try:
917-
validatorWeight = int(parse(line, "weight:", ' ') or 0)
917+
validatorWeight = int(parse(line, "weight:", ' '))
918918
except ValueError:
919-
validatorWeight = int(parse(line, "weight:", ')') or 0)
919+
validatorWeight = int(parse(line, "weight:", ')'))
920920
buff = Dict()
921921
buff["adnlAddr"] = validatorAdnlAddr
922922
buff["pubkey"] = pubkey
@@ -940,21 +940,21 @@ def GetConfig34(self):
940940
self.local.add_log("start GetConfig34 function", "debug")
941941
config34 = Dict()
942942
result = self.liteClient.Run("getconfig 34")
943-
config34["totalValidators"] = int(parse(result, "total:", ' ') or 0)
944-
config34["mainValidators"] = int(parse(result, "main:", ' ') or 0)
945-
config34["startWorkTime"] = int(parse(result, "utime_since:", ' ') or 0)
946-
config34["endWorkTime"] = int(parse(result, "utime_until:", ' ') or 0)
947-
config34["totalWeight"] = int(parse(result, "total_weight:", ' ') or 0)
943+
config34["totalValidators"] = int(parse(result, "total:", ' '))
944+
config34["mainValidators"] = int(parse(result, "main:", ' '))
945+
config34["startWorkTime"] = int(parse(result, "utime_since:", ' '))
946+
config34["endWorkTime"] = int(parse(result, "utime_until:", ' '))
947+
config34["totalWeight"] = int(parse(result, "total_weight:", ' '))
948948
lines = result.split('\n')
949949
validators = list()
950950
for line in lines:
951951
if "public_key:" in line:
952952
validatorAdnlAddr = parse(line, "adnl_addr:x", ')')
953953
pubkey = parse(line, "pubkey:x", ')')
954954
try:
955-
validatorWeight = int(parse(line, "weight:", ' ') or 0)
955+
validatorWeight = int(parse(line, "weight:", ' '))
956956
except ValueError:
957-
validatorWeight = int(parse(line, "weight:", ')') or 0)
957+
validatorWeight = int(parse(line, "weight:", ')'))
958958
buff = Dict()
959959
buff["adnlAddr"] = validatorAdnlAddr
960960
buff["pubkey"] = pubkey
@@ -979,9 +979,9 @@ def GetConfig36(self):
979979
config36 = dict()
980980
try:
981981
result = self.liteClient.Run("getconfig 36")
982-
config36["totalValidators"] = int(parse(result, "total:", ' ') or 0)
983-
config36["startWorkTime"] = int(parse(result, "utime_since:", ' ') or 0)
984-
config36["endWorkTime"] = int(parse(result, "utime_until:", ' ') or 0)
982+
config36["totalValidators"] = int(parse(result, "total:", ' '))
983+
config36["startWorkTime"] = int(parse(result, "utime_since:", ' '))
984+
config36["endWorkTime"] = int(parse(result, "utime_until:", ' '))
985985
lines = result.split('\n')
986986
validators = list()
987987
for line in lines:

0 commit comments

Comments
 (0)