Rename storage.save() to storage.dump().

The name matches the load/dump in the json library.
Import olny storage from mopidy.internal (not all of mopidy.internal).
This commit is contained in:
Jens Luetjen 2016-03-31 21:55:32 +02:00
parent 7928caeb71
commit 3251722a28
4 changed files with 6 additions and 6 deletions

View File

@ -184,7 +184,7 @@ class Core(
history=self.history._export_state(),
playback=self.playback._export_state(),
mixer=self.mixer._export_state())
storage.save(file_name, data)
storage.dump(file_name, data)
logger.debug('Save state done.')
def _load_state(self, coverage):

View File

@ -35,7 +35,7 @@ def load(path):
return {}
def save(path, data):
def dump(path, data):
"""
Serialize data to file.

View File

@ -9,7 +9,7 @@ import sys
import mopidy
from mopidy import compat, local, models
from mopidy import internal
from mopidy.internal import storage as internal_storage
from mopidy.internal import timer
from mopidy.local import search, storage, translator
@ -99,7 +99,7 @@ class JsonLibrary(local.Library):
self._json_file)
self._tracks = {}
else:
library = internal.storage.load(self._json_file)
library = internal_storage.load(self._json_file)
self._tracks = dict((t.uri, t) for t in
library.get('tracks', []))
with timer.time_logger('Building browse cache'):
@ -167,7 +167,7 @@ class JsonLibrary(local.Library):
self._tracks.pop(uri, None)
def close(self):
internal.storage.save(self._json_file,
internal_storage.dump(self._json_file,
{'version': mopidy.__version__,
'tracks': self._tracks.values()})

View File

@ -81,7 +81,7 @@ class CoreActorExportRestoreTest(unittest.TestCase):
file_path = os.path.join(self.temp_dir, 'core', 'state.json.gz')
data = {}
storage.save(file_path, data)
storage.dump(file_path, data)
self.assertTrue(os.path.isfile(file_path), 'missing persistent file')
self.core.setup().get()