Skip to content

Commit 47e6dfd

Browse files
committed
Remove rudiment json things
Update: telebot/__init__.py
1 parent 3c890a7 commit 47e6dfd

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎telebot/__init__.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import six
99

1010
import os
11-
import json
1211
import pickle
1312

1413
import logging
@@ -86,7 +85,6 @@ def dump_handlers(handlers, filename, file_mode="wb"):
8685
else:
8786
to_dump[id_] = [handler.copy_to_dump()]
8887

89-
# json.dump(to_dump, file)
9088
pickle.dump(to_dump, file)
9189

9290
if os.path.isfile(filename):
@@ -98,18 +96,17 @@ def dump_handlers(handlers, filename, file_mode="wb"):
9896
def return_load_handlers(filename, del_file_after_loading=True):
9997
if os.path.isfile(filename) and os.path.getsize(filename) > 0:
10098
with open(filename, "rb") as file:
101-
# handlers = json.load(file)
10299
handlers = pickle.load(file)
103100
result = {}
104101
for id_, handlers_ in handlers.items():
105102
for handler in handlers_:
106103

107104
tmp = Handler(handler['callback'], *handler["args"], **handler["kwargs"])
108105

109-
if int(id_) in result.keys():
110-
result[int(id_)].append(tmp)
106+
if id_ in result.keys():
107+
result[id_].append(tmp)
111108
else:
112-
result[int(id_)] = [tmp]
109+
result[id_] = [tmp]
113110

114111
if del_file_after_loading:
115112
os.remove(filename)

0 commit comments

Comments
 (0)