Refactor convertiJour function (+doc)
Couple issues here:
- Function doesn't return a number, but a datetime, whereas doc says otherwise.
- The ValueError should not be handled there, for a couple of reasons: the first is cognitive complexity, that function has 5 args, and only needs 2 to make its job: process a string to a datetime. Secondly, if it raises a ValueError, it indeed should be handled, but not by that function, as it should not know the context in which it is called. That's the role of the code calling the function to decide what to do with that error.
Suggestion: simplify the parameters needed to call that function, and handle the exception in the surrounding code by using a for loop instead of list comprehension (perfs don't really matter here...): analyseSondages.py#L122 and analyseSondages.py#L130
Edited by anathexis