Skip to content

Commit

Permalink
Silence flake8 linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
UmbralReaper committed Jul 9, 2021
1 parent f1e9ec2 commit dda9fe5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
3 changes: 2 additions & 1 deletion tools/copy_from.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def get_data(argsDict, resource_name):
for resource_filename in resource_sources:
if resource_filename.endswith(".json"):
try:
with open(resource_filename, encoding="utf-8") as resource_file:
with open(
resource_filename, encoding="utf-8") as resource_file:
resource += json.load(resource_file)
except FileNotFoundError:
exit("Failed: could not find {}".format(resource_filename))
Expand Down
4 changes: 3 additions & 1 deletion tools/generate_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,9 @@ def read_personal_token(filename):
return None

try:
with open(pathlib.Path(str(filename)).expanduser(), encoding="utf-8") as token_file:
with open(
pathlib.Path(str(filename)).expanduser(),
encoding="utf-8") as token_file:
match = re.search('(?P<token>\\S+)', token_file.read(),
flags=re.MULTILINE)
if match is not None:
Expand Down
4 changes: 3 additions & 1 deletion tools/gfx_tools/list_tileset_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
tileset_dirname = args.tileset_dir

# loading data
with open(os.path.join(tileset_dirname, TILE_CONFIG_NAME), encoding="utf-8") as fh:
with open(
os.path.join(tileset_dirname, TILE_CONFIG_NAME),
encoding="utf-8") as fh:
sprites = json.load(fh)[SPRITES_LIST_KEY]

for sprite_data in sprites:
Expand Down
3 changes: 2 additions & 1 deletion tools/merge_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def get_data(argsDict, resource_name):
for resource_filename in resource_sources:
if resource_filename.endswith(".json"):
try:
with open(resource_filename, encoding="utf-8") as resource_file:
with open(
resource_filename, encoding="utf-8") as resource_file:
resource += json.load(resource_file)
except FileNotFoundError:
exit("Failed: could not find {}".format(resource_filename))
Expand Down
3 changes: 2 additions & 1 deletion tools/vehicle_reformatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def get_data(argsDict, resource_name):
for resource_filename in resource_sources:
if resource_filename.endswith(".json"):
try:
with open(resource_filename, encoding="utf-8") as resource_file:
with open(
resource_filename, encoding="utf-8") as resource_file:
resource += json.load(resource_file)
except FileNotFoundError:
exit("Failed: could not find {}".format(resource_filename))
Expand Down
11 changes: 8 additions & 3 deletions utilities/make_iso.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ def tile_convert(otile, main_id, new_tile_number):
pass

print('reading ' + old_tileset_name + '/tile_config.json')
with open(old_tileset_name + '/tile_config.json', encoding="utf-8") as old_tile_config_json_file:
with open(
old_tileset_name + '/tile_config.json',
encoding="utf-8") as old_tile_config_json_file:
otc = json.load(old_tile_config_json_file)

oheight = otc['tile_info'][0]['height']
Expand Down Expand Up @@ -292,13 +294,16 @@ def tile_convert(otile, main_id, new_tile_number):
if os.system(command):
raise RuntimeError("Failed to merge tiles into %s" % new_tileset_name)

with open(new_tileset_name + '/tile_config.json', 'w', encoding="utf-8") as tile_config_json:
with open(new_tileset_name + '/tile_config.json', 'w',
encoding="utf-8") as tile_config_json: # noqa: E128
json.dump(
ntc, tile_config_json,
sort_keys=True, indent=2, separators=(',', ': '), ensure_ascii=False)

#TODO: replace tiles.png with first filename from json
with open(new_tileset_name + '/tileset.txt', 'w', encoding="utf-8") as new_tileset_txt_file:
with open(
new_tileset_name + '/tileset.txt',
'w', encoding="utf-8") as new_tileset_txt_file:
new_tileset_txt_file.write(
'#Generated by make_iso.py from flat tileset ' +
old_tileset_name + '\n' +
Expand Down

0 comments on commit dda9fe5

Please sign in to comment.