pickle->cPickle
This commit is contained in:
parent
515305e950
commit
50877923ea
|
@ -33,7 +33,7 @@
|
|||
|
||||
"""Configuration class used to access/create/modify configuration files."""
|
||||
|
||||
import pickle
|
||||
import cPickle
|
||||
|
||||
import deluge.common
|
||||
from deluge.log import LOG as log
|
||||
|
@ -71,7 +71,7 @@ class Config:
|
|||
# Un-pickle the file and update the config dictionary
|
||||
log.debug("Opening pickled file for load..")
|
||||
pkl_file = open(filename, "rb")
|
||||
filedump = pickle.load(pkl_file)
|
||||
filedump = cPickle.load(pkl_file)
|
||||
self.config.update(filedump)
|
||||
pkl_file.close()
|
||||
except IOError:
|
||||
|
@ -91,7 +91,7 @@ class Config:
|
|||
try:
|
||||
log.debug("Opening pickled file for comparison..")
|
||||
pkl_file = open(filename, "rb")
|
||||
filedump = pickle.load(pkl_file)
|
||||
filedump = cPickle.load(pkl_file)
|
||||
pkl_file.close()
|
||||
if filedump == self.config:
|
||||
# The config has not changed so lets just return
|
||||
|
@ -103,7 +103,7 @@ class Config:
|
|||
try:
|
||||
log.debug("Opening pickled file for save..")
|
||||
pkl_file = open(filename, "wb")
|
||||
pickle.dump(self.config, pkl_file)
|
||||
cPickle.dump(self.config, pkl_file)
|
||||
log.debug("Closing pickled file..")
|
||||
pkl_file.close()
|
||||
except IOError:
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import pickle
|
||||
import dbus
|
||||
import dbus.service
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
"""TorrentManager handles Torrent objects"""
|
||||
|
||||
import pickle
|
||||
import cPickle
|
||||
import os.path
|
||||
import os
|
||||
|
||||
|
@ -305,7 +305,7 @@ class TorrentManager:
|
|||
log.debug("Opening torrent state file for load.")
|
||||
state_file = open(deluge.common.get_config_dir("torrents.state"),
|
||||
"rb")
|
||||
state = pickle.load(state_file)
|
||||
state = cPickle.load(state_file)
|
||||
state_file.close()
|
||||
except IOError:
|
||||
log.warning("Unable to load state file.")
|
||||
|
@ -329,7 +329,7 @@ class TorrentManager:
|
|||
log.debug("Saving torrent state file.")
|
||||
state_file = open(deluge.common.get_config_dir("torrents.state"),
|
||||
"wb")
|
||||
pickle.dump(state, state_file)
|
||||
cPickle.dump(state, state_file)
|
||||
state_file.close()
|
||||
except IOError:
|
||||
log.warning("Unable to save state file.")
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
# statement from all source files in the program, then also delete it here.
|
||||
|
||||
import os.path
|
||||
import pickle
|
||||
|
||||
import dbus
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
|
|
Loading…
Reference in New Issue