Closed aj3sh closed 1 year ago
Here is a similar implementation on cpython's strptime
.
https://github.com/python/cpython/blob/bf89d4283a28dd00836f2c312a9255f543f93fc7/Lib/_strptime.py#L293
The conditions for the keys 'Y', 'm', 'd', 'M', and 'S' in the if statements are the same. Likewise, there are other keys that share the same conditions. We can combine them to reduce cognitive complexity.
cc: @sugat009
While running the flake8 linting on this repo through the GitHub actions, an error
C901
is raised. Below is the detailed error log.The file nepali/datetime/parser/validators.py contains the logic for date parsing and the transform method is part of it.
Major Flake8 issues were fixed through PR #44, but a cognitive complexity issue was still detected and left to be addressed in this issue.
Here is the code.