Upgrade to Python 3

This commit is contained in:
Max Bucknell 2017-02-01 19:25:59 +00:00
parent ad82a03dfd
commit 43d286cb75

View file

@ -3,6 +3,7 @@ import os
import re import re
from os import path from os import path
from collections import OrderedDict from collections import OrderedDict
from functools import cmp_to_key
def find_in_parent(filename, starting_dir=None): def find_in_parent(filename, starting_dir=None):
'''Look up the directory tree until you find a file.''' '''Look up the directory tree until you find a file.'''
@ -84,7 +85,7 @@ def format_method(snip):
sorted_params = sort_params(params.values()) sorted_params = sort_params(params.values())
delete_param_tags(snip, params) delete_param_tags(snip, params)
place_to_insert_params = snip.snippet_start[0] + params.keys()[0] place_to_insert_params = snip.snippet_start[0] + list(params.keys())[0]
snip.buffer[place_to_insert_params:place_to_insert_params] = sorted_params snip.buffer[place_to_insert_params:place_to_insert_params] = sorted_params
arguments = generate_arguments(sorted_params) arguments = generate_arguments(sorted_params)
@ -121,7 +122,7 @@ def sort_params(params):
return 0 return 0
return sorted(params, sorter) return sorted(params, key=cmp_to_key(sorter))
def get_snippet_lines(snip): def get_snippet_lines(snip):
'''Get the relevant slice of a snippet buffer.''' '''Get the relevant slice of a snippet buffer.'''