simplify, flake9

This commit is contained in:
meejah 2021-11-30 18:25:32 -07:00
parent 0a4bc385c5
commit fc9671a812
4 changed files with 2 additions and 10 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View 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 (