Refactor trivial piece of code overcomplicated

This commit is contained in:
Kristóf Tóth 2018-02-08 17:39:59 +01:00
parent 557318af4e
commit be244217aa

View File

@ -96,7 +96,4 @@ def map_file_extension_to_language(filename):
'.cs': 'csharp' '.cs': 'csharp'
} }
_, extension = splitext(filename) _, extension = splitext(filename)
language = 'text' return language_map.get(extension, 'text')
try: language = language_map[extension]
except KeyError: log.debug('No such extension in list, falling back to default: "{}".'.format(language))
return language