1
0
Fork 0
mirror of https://github.com/veekun/pokedex.git synced 2024-08-20 18:16:34 +00:00

Working on Issue would plane that deals with the sorting of the locations firuging out a way to sort the locations in the right order.

This commit is contained in:
[Marla Windman] 2022-04-24 15:17:11 -04:00
parent 299252c165
commit 9ad8863c58

View file

@ -37,10 +37,11 @@ def main(*argv):
ambiguous_re.match(identifier), ambiguous_re.match(identifier),
identifier in ambiguous_set, identifier in ambiguous_set,
)) ))
print len(locations), ' *'[disambiguate], identifier, location_split = identifier.split('-')
print(location_split)
if disambiguate: if disambiguate:
changes = True changes = True
print u''.encode('utf-8'), #print u'→'.encode('utf-8'),
by_region = defaultdict(list) by_region = defaultdict(list)
for location in locations: for location in locations:
if location.region: if location.region:
@ -54,26 +55,26 @@ def main(*argv):
# No change # No change
new_identifier = identifier new_identifier = identifier
if len(region_locations) == 1: if len(region_locations) == 1:
location = region_locations[0] location = region_locations[0]
# The region was enough # The region was enough
print new_identifier, #print(new_identifier)
location.identifier = new_identifier location.identifier = new_identifier
else: else:
# Need to number the locations :( # Need to number the locations :(
for i, location in enumerate(region_locations, start=1): for i, location in enumerate(region_locations, start=1):
numbered_identifier = '%s-%s' % (new_identifier, i) numbered_identifier = '%s-%s' % (new_identifier, i)
print numbered_identifier, # print numbered_identifier,
location.identifier = numbered_identifier location.identifier = numbered_identifier
print print(location)
if changes: if changes:
if argv and argv[0] == '--commit': if argv and argv[0] == '--commit':
session.commit() session.commit()
print 'Committed' print('Committed')
else: else:
print 'Run with --commit to commit changes' print('Run with --commit to commit changes')
else: else:
print 'No changes needed' print('No changes needed')
if __name__ == '__main__': if __name__ == '__main__':