PySyft icon indicating copy to clipboard operation
PySyft copied to clipboard

Reduce complexity of route_method_exception

Open gmuraru opened this issue 6 years ago • 7 comments

Split the code from route_method_exception into two separate functions and remove the noqa: C901.

Describe alternatives you've considered Simplify the function such that no split is required.

Additional context Code quality:

2020-04-29T13:13:32.5920184Z ./syft/exceptions.py:359:1: C901 'route_method_exception' is too complex (14)
2020-04-29T13:13:32.5920476Z def route_method_exception(exception, self, args_, kwargs_):
2020-04-29T13:13:32.5920733Z ^

gmuraru avatar Apr 30 '20 10:04 gmuraru

hey , can i work on this issue?

Nike682631 avatar May 06 '20 13:05 Nike682631

Is the issue still open?I would like to work on it? @gmuraru

imrahul361 avatar May 28 '20 04:05 imrahul361

Hey. If the issue is still present, you can grab it :D

gmuraru avatar May 28 '20 07:05 gmuraru

Can you guide through how to produce the bug?

imrahul361 avatar May 30 '20 14:05 imrahul361

This issue has been marked stale because it has been open 30 days with no activity. Leave a comment or remove the stale label to unmark it. Otherwise, this will be closed in 7 days.

github-actions[bot] avatar Jun 30 '20 00:06 github-actions[bot]

@gmuraru sir, I tried to solve the mentioned problem

2020-04-29T13:13:32.5920184Z ./syft/exceptions.py:359:1: C901 'route_method_exception' is too complex (14)
2020-04-29T13:13:32.5920476Z def route_method_exception(exception, self, args_, kwargs_):
2020-04-29T13:13:32.5920733Z ^

But, instead of converting route_method_exception to two separate methods I just reduced the if...elif statements. And it seems to work properly, it shows positive results in both Flake8 test(after removing C901) and pytest.

Will this change work instead of separating the method?

akshat1136 avatar Jul 02 '20 20:07 akshat1136

@gmuraru sir, I tried to solve the mentioned problem

2020-04-29T13:13:32.5920184Z ./syft/exceptions.py:359:1: C901 'route_method_exception' is too complex (14)
2020-04-29T13:13:32.5920476Z def route_method_exception(exception, self, args_, kwargs_):
2020-04-29T13:13:32.5920733Z ^

But, instead of converting route_method_exception to two separate methods I just reduced the if...elif statements. And it seems to work properly, it shows positive results in both Flake8 test(after removing C901) and pytest.

Will this change work instead of separating the method?

Sure!

gmuraru avatar Jul 04 '20 05:07 gmuraru