From 1612b4b0f3378c489e8572e9afd4d50c31d34ebc Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 06:37:46 +0000 Subject: [PATCH 1/2] refactor: Remove `return` statement which is not inside a function A `return` statement should not be used outside of a function or method. This will raise a `SyntaxError`. Make sure that your code and indentation are correct. --- return_not_implemented.py | 1 - 1 file changed, 1 deletion(-) diff --git a/return_not_implemented.py b/return_not_implemented.py index c9d7e580b..a77f493d5 100644 --- a/return_not_implemented.py +++ b/return_not_implemented.py @@ -22,4 +22,3 @@ def __radd__(self, other): if __name__ == "__main__": complex_num = ComplexNumber(2, 5) real_num = RealNumber(32) - return real_num + complex_num From f0873972c3029f7db8d3b65a087acaf64b12dcea Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 06:37:55 +0000 Subject: [PATCH 2/2] style: Format code with black --- return_not_implemented.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/return_not_implemented.py b/return_not_implemented.py index a77f493d5..5fa47dd0a 100644 --- a/return_not_implemented.py +++ b/return_not_implemented.py @@ -1,24 +1,28 @@ class RealNumber: """Represents a real number.""" - def __init__(self, val): - self.val = val - - def __add__(self, other): + + def __init__(self, val): + self.val = val + + def __add__(self, other): raise NotImplementedError - + + class ComplexNumber: """Represents an imaginary number.""" - def __init__(self, x, y): + + def __init__(self, x, y): self.x = x - self.y = y - - def __add__(self, other): - return self.val + other.val - - def __radd__(self, other): - res = (self.x + other.val, self.y) + self.y = y + + def __add__(self, other): + return self.val + other.val + + def __radd__(self, other): + res = (self.x + other.val, self.y) return res + if __name__ == "__main__": complex_num = ComplexNumber(2, 5) real_num = RealNumber(32)