Simplify Single Exception Tuple
Sourcery refactoring id:
Replace length-one exception tuple with exception.
try: read_file() except (FileNotFoundError,) as e: log_error(e) create_file()
try: read_file() except FileNotFoundError as e: log_error(e) create_file()
Python supports catching multiple exception types at once by using tuples. However, when only a single exception type is being handled, there is no need to wrap it in a tuple.
Using the exception type itself makes your code easier to read, and your intent clearer.