mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 10:56:49 +00:00
simplify, flake9
This commit is contained in:
parent
0a4bc385c5
commit
fc9671a812
@ -106,7 +106,7 @@ def migrate_crawler(options):
|
||||
|
||||
for fp, converter in conversions:
|
||||
existed = fp.exists()
|
||||
newfp = crawler._maybe_upgrade_pickle_to_json(fp, converter)
|
||||
newfp = crawler._upgrade_pickle_to_json(fp, converter)
|
||||
if existed:
|
||||
print("Converted '{}' to '{}'".format(fp.path, newfp.path), file=out)
|
||||
else:
|
||||
|
@ -101,7 +101,7 @@ def _convert_pickle_state_to_json(state):
|
||||
}
|
||||
|
||||
|
||||
def _maybe_upgrade_pickle_to_json(state_path, convert_pickle):
|
||||
def _upgrade_pickle_to_json(state_path, convert_pickle):
|
||||
"""
|
||||
:param FilePath state_path: the filepath to ensure is json
|
||||
|
||||
@ -110,14 +110,9 @@ def _maybe_upgrade_pickle_to_json(state_path, convert_pickle):
|
||||
|
||||
:returns FilePath: the local path where the state is stored
|
||||
|
||||
If this state path is JSON, simply return it.
|
||||
|
||||
If this state is pickle, convert to the JSON format and return the
|
||||
JSON path.
|
||||
"""
|
||||
if state_path.path.endswith(".json"):
|
||||
return state_path
|
||||
|
||||
json_state_path = state_path.siblingExtension(".json")
|
||||
|
||||
# if there's no file there at all, we're done because there's
|
||||
|
@ -12,9 +12,7 @@ import os
|
||||
import struct
|
||||
from allmydata.storage.crawler import (
|
||||
ShareCrawler,
|
||||
MigratePickleFileError,
|
||||
_confirm_json_format,
|
||||
_maybe_upgrade_pickle_to_json,
|
||||
_convert_cycle_data,
|
||||
)
|
||||
from allmydata.storage.shares import get_share_file
|
||||
|
@ -47,7 +47,6 @@ from allmydata.web.storage import (
|
||||
remove_prefix
|
||||
)
|
||||
from allmydata.scripts.admin import (
|
||||
MigrateCrawlerOptions,
|
||||
migrate_crawler,
|
||||
)
|
||||
from allmydata.scripts.runner import (
|
||||
|
Loading…
x
Reference in New Issue
Block a user