many pylint fixes
This commit is contained in:
parent
4ce860a6ed
commit
15837b7c3c
@ -3,11 +3,12 @@
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import pprint
|
||||
import pygame
|
||||
import pprint # pylint: disable=unused-import
|
||||
import re
|
||||
import sys
|
||||
|
||||
import pygame
|
||||
|
||||
# The guide in tiles/guide.png is quite helpful.
|
||||
|
||||
# TODO: sort the stuff in free/ and noncommercial/
|
||||
@ -92,7 +93,7 @@ def unglob(list_of_globs):
|
||||
result = []
|
||||
for file in list_of_globs:
|
||||
globbed_files = glob.glob(file)
|
||||
assert len(globbed_files) > 0, 'glob for %s should be non-empty' % file
|
||||
assert globbed_files, 'glob for %s should be non-empty' % file
|
||||
result.extend(globbed_files)
|
||||
result.sort()
|
||||
return result
|
||||
@ -104,7 +105,7 @@ def input_wh(prompt):
|
||||
try:
|
||||
cols, rows = [int(x) for x in geometry.split(' ')]
|
||||
return cols, rows
|
||||
except:
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
||||
@ -240,15 +241,15 @@ def edit_sprite_metadata(filename, metadata=None):
|
||||
|
||||
def annotate_sprites(all_metadata, sprite_files):
|
||||
pygame.init()
|
||||
surface = pygame.display.set_mode((1200, 900), pygame.RESIZABLE)
|
||||
pygame.display.set_mode((1200, 900), pygame.RESIZABLE)
|
||||
|
||||
for filename in sprite_files:
|
||||
sprite_metadata, quit = edit_sprite_metadata(
|
||||
sprite_metadata, should_quit = edit_sprite_metadata(
|
||||
filename, all_metadata.get(filename))
|
||||
all_metadata[filename] = sprite_metadata
|
||||
with open('sprites.json', 'w') as f:
|
||||
json.dump(all_metadata, f, sort_keys=True, indent=2)
|
||||
if quit:
|
||||
if should_quit:
|
||||
return
|
||||
|
||||
|
||||
@ -284,7 +285,8 @@ def stitch_sprites(metadata, filename_base):
|
||||
print('\n# named sprites:', len(sprites))
|
||||
print('result will be %dx%d' % (total_width, max_height))
|
||||
|
||||
output = pygame.Surface((total_width, max_height), pygame.SRCALPHA)
|
||||
output = pygame.surface.Surface(
|
||||
(total_width, max_height), flags=pygame.SRCALPHA)
|
||||
output_json = {}
|
||||
xpos = 0
|
||||
for sprite_name, sprite in sprites.items():
|
||||
@ -309,7 +311,6 @@ def stitch_sprites(metadata, filename_base):
|
||||
json.dump(output_json, json_file, sort_keys=True, indent=2)
|
||||
|
||||
|
||||
|
||||
def main(args):
|
||||
os.chdir(os.path.expanduser('~/time_fantasy'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user