Closed Saumya-Mishra9129 closed 4 years ago
W503 can be removed. Here's how;
diff --git a/.flake8 b/.flake8
index ddce47f..0146a5f 100644
--- a/.flake8
+++ b/.flake8
@@ -4,4 +4,3 @@
# gi.require_version() is required before later imports
-# W503 line break before binary operator
-ignore = E402, W503
+ignore = E402
diff --git a/bridge.py b/bridge.py
index b4d7a60..1d0e0b8 100644
--- a/bridge.py
+++ b/bridge.py
@@ -92,7 +92,7 @@ class Bridge:
coord = int(self.world.meter_to_screen(vec.x)), \
- int(self.screen.get_height()
- - self.world.meter_to_screen(vec.y))
+ int(self.screen.get_height() -
+ self.world.meter_to_screen(vec.y))
pygame.draw.circle(self.screen,
- (int(force / 2), 255
- - int(force / 2), 0),
+ (int(force / 2), 255 -
+ int(force / 2), 0),
coord, 6)
@@ -136,4 +136,4 @@ class Bridge:
self.world.set_color((0, 0, 0))
- rearwheel = (startpoint[0] + wheelrad, startpoint[1]
- + train[1] - wheelrad / 2)
+ rearwheel = (startpoint[0] + wheelrad, startpoint[1] +
+ train[1] - wheelrad / 2)
pygame.draw.circle(self.screen, (0, 0, 0), rearwheel, wheelrad, 3)
diff --git a/tools.py b/tools.py
index 266916f..105076a 100644
--- a/tools.py
+++ b/tools.py
@@ -173,6 +173,6 @@ class GirderTool(Tool):
print self.theta, math.degrees(self.theta)
- self.game.world.add.rect(((self.pt1[0]
- + self.pt2[0]) / 2,
- (self.pt1[1]
- + self.pt2[1]) / 2),
+ self.game.world.add.rect(((self.pt1[0] +
+ self.pt2[0]) / 2,
+ (self.pt1[1] +
+ self.pt2[1]) / 2),
helpers.distance(
W503 can be removed. Here's how;
diff --git a/.flake8 b/.flake8 index ddce47f..0146a5f 100644 --- a/.flake8 +++ b/.flake8 @@ -4,4 +4,3 @@ # gi.require_version() is required before later imports -# W503 line break before binary operator -ignore = E402, W503 +ignore = E402 diff --git a/bridge.py b/bridge.py index b4d7a60..1d0e0b8 100644 --- a/bridge.py +++ b/bridge.py @@ -92,7 +92,7 @@ class Bridge: coord = int(self.world.meter_to_screen(vec.x)), \ - int(self.screen.get_height() - - self.world.meter_to_screen(vec.y)) + int(self.screen.get_height() - + self.world.meter_to_screen(vec.y)) pygame.draw.circle(self.screen, - (int(force / 2), 255 - - int(force / 2), 0), + (int(force / 2), 255 - + int(force / 2), 0), coord, 6) @@ -136,4 +136,4 @@ class Bridge: self.world.set_color((0, 0, 0)) - rearwheel = (startpoint[0] + wheelrad, startpoint[1] - + train[1] - wheelrad / 2) + rearwheel = (startpoint[0] + wheelrad, startpoint[1] + + train[1] - wheelrad / 2) pygame.draw.circle(self.screen, (0, 0, 0), rearwheel, wheelrad, 3) diff --git a/tools.py b/tools.py index 266916f..105076a 100644 --- a/tools.py +++ b/tools.py @@ -173,6 +173,6 @@ class GirderTool(Tool): print self.theta, math.degrees(self.theta) - self.game.world.add.rect(((self.pt1[0] - + self.pt2[0]) / 2, - (self.pt1[1] - + self.pt2[1]) / 2), + self.game.world.add.rect(((self.pt1[0] + + self.pt2[0]) / 2, + (self.pt1[1] + + self.pt2[1]) / 2), helpers.distance(
@quozl Have you tried to run flake8 *.py after removing W503? As it is giving me another warning W504 i.e. line break after binary operator. I have looked for both warning and found this--https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator, hope it helps.
@Saumya-Mishra9129 I agree. It is better not to hide flake8 errors. I would suggest to let the warnings be as is and not fix the flake8 warnings. Flake8 is meant to improve code readability. If the line is supposed to be at a stretch (without line breaks), let it be as of such. Please remove other changes related to this
@srevinsaju Thanks for reviewing, I will remove warning and do necessary changes once I feel there is a need to do it..
@quozl Have you tried to run flake8 *.py after removing W503?
Yes. No errors.
As it is giving me another warning W504 i.e. line break after binary operator.
Interesting. What version of Python? What version of flake8?
host:~$ python -m flake8 --version
3.5.0 (mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 2.7.17 on Linux
host:~$ dpkg-query -W | grep flake8
flake8 3.5.0-1
python-flake8 3.5.0-1
python3-flake8 3.5.0-1
host:~$
Interesting. What version of Python? What version of flake8?
I have tried with python2.7 and flake8-3.7.9. Still getting this error with this combination of versions.
So try 3.5.0?
@quozl I have checked not getting error with flake8-3.5.0, there was version problem but it seems like flake8-3.5.0 is older version of flake8. There has been many changes after this version in flake8.
Good. So in summary you've formed a view that we should use the latest version of flake8 in reviewing pull requests. We all have to upgrade. I won't do that yet, and I'll continue to verify based on the version of flake8 on the latest stable distribution of Ubuntu. Therefore I'll merge the pull request as better than what we had before, and won't plan to work on flake8 review until after 20.04 is released. It looks like 20.04 will have 3.7.9.
I have tried to fix flake8 errors and warnings. Please Review . fixes #11