Convert .format() to f-strings with flynt

This commit is contained in:
Philip Sargent
2022-11-23 10:51:49 +00:00
parent aca92cb1af
commit aaf6a6c7cf
4 changed files with 19 additions and 21 deletions

View File

@@ -103,7 +103,7 @@ def do_item(year, item):
contents_path = os.path.join(".", item, "contents.json")
#print "Trying to read file %s" % (contents_path)
if not os.path.isfile(contents_path):
print("Creating file %s from template" % (contents_path))
print(f"Creating file {contents_path} from template")
json_file = open(contents_path, "w")
json.dump(blank_json, json_file, sort_keys=True, indent = 1)
json_file.close()
@@ -112,7 +112,7 @@ def do_item(year, item):
try:
data = json.load(json_file)
except:
print("FAILURE parsing JSON file %s" % (contents_path))
print(f"FAILURE parsing JSON file {contents_path}")
# Python bug: https://github.com/ShinNoNoir/twitterwebsearch/issues/12
raise
if not data["people"]:
@@ -135,7 +135,7 @@ def do_item(year, item):
write_required = True
#print write_required
if write_required:
print("Writing file %s" % (contents_path))
print(f"Writing file {contents_path}")
json_file = open(contents_path, "w")
json.dump(data, json_file, indent = 1)
json_file.close()
@@ -236,7 +236,7 @@ def do_item(year, item):
"cave": data["cave"],
"name": data["name"],
"date": data["date"],
"people": reduce(operator.add, [" %s," % person for person in data["people"]], ""),
"people": reduce(operator.add, [f" {person}," for person in data["people"]], ""),
"description": "http://expo.survex.com"+data["description url"],
"description_needed": description_needed,
"loser_dir": loser_dir,