From be244217aa3409b59dd73b1f1a08e44701410423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Thu, 8 Feb 2018 17:39:59 +0100 Subject: [PATCH] Refactor trivial piece of code overcomplicated --- src/event_handlers/source_code_event_handler.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/event_handlers/source_code_event_handler.py b/src/event_handlers/source_code_event_handler.py index 3f128cf..aa57777 100644 --- a/src/event_handlers/source_code_event_handler.py +++ b/src/event_handlers/source_code_event_handler.py @@ -96,7 +96,4 @@ def map_file_extension_to_language(filename): '.cs': 'csharp' } _, extension = splitext(filename) - language = 'text' - try: language = language_map[extension] - except KeyError: log.debug('No such extension in list, falling back to default: "{}".'.format(language)) - return language \ No newline at end of file + return language_map.get(extension, 'text') \ No newline at end of file