diff options
| author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2022-01-06 12:14:33 -0500 |
|---|---|---|
| committer | sqla-tester <sqla-tester@sqlalchemy.org> | 2022-01-06 12:14:33 -0500 |
| commit | 0980de38a8144f6755aadf550a5c1077ce1a2416 (patch) | |
| tree | 58335a5496af595deba7423cd4b07d673d708f5c /examples | |
| parent | 21ee595ba9ef3e7abc8982fac7bf488c904cf9c9 (diff) | |
| download | sqlalchemy-0980de38a8144f6755aadf550a5c1077ce1a2416.tar.gz | |
Remove redundant code for EOL Python <= 3.6
<!-- Provide a general summary of your proposed changes in the Title field above -->
### Description
<!-- Describe your changes in detail -->
There's a few bits and pieces of code to support Python <= 3.6 which are no longer needed and can be removed, to slightly simplify the codebase.
### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)
-->
This pull request is:
- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests. one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.
**Have a nice day!**
Closes: #7544
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7544
Pull-request-sha: 282b4a91282902a57807aa2541b75b272b547127
Change-Id: I9ddf15fcf72551d52e3f027f337c7fee4aa9083b
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/space_invaders/space_invaders.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/examples/space_invaders/space_invaders.py b/examples/space_invaders/space_invaders.py index 1690145db..bc97d62e2 100644 --- a/examples/space_invaders/space_invaders.py +++ b/examples/space_invaders/space_invaders.py @@ -2,7 +2,6 @@ import curses import logging import random import re -import sys import textwrap import time @@ -20,11 +19,6 @@ from sqlalchemy.orm import relationship from sqlalchemy.orm import Session -_PY3 = sys.version_info > (3, 0) -if _PY3: - xrange = range - - logging.basicConfig( filename="space_invaders.log", format="%(asctime)s,%(msecs)03d %(levelname)-5.5s %(message)s", @@ -158,7 +152,7 @@ class GlyphCoordinate(Base): glyph = self.glyph data = glyph.glyph_for_state(self, state) for color, char in [ - (data[i], data[i + 1]) for i in xrange(0, len(data), 2) + (data[i], data[i + 1]) for i in range(0, len(data), 2) ]: x = self.x + col @@ -190,7 +184,7 @@ class GlyphCoordinate(Base): glyph = self.glyph x = min(max(self.x, 0), MAX_X) width = min(glyph.width, MAX_X - x) or 1 - for y_a in xrange(self.y, self.y + glyph.height): + for y_a in range(self.y, self.y + glyph.height): y = y_a window.addstr(y + VERT_PADDING, x + HORIZ_PADDING, " " * width) @@ -455,9 +449,9 @@ def init_positions(session): ("enemy1", 10), ) for (ship_vert, (etype, score)) in zip( - xrange(5, 30, ENEMY_VERT_SPACING), arrangement + range(5, 30, ENEMY_VERT_SPACING), arrangement ): - for ship_horiz in xrange(0, 50, 10): + for ship_horiz in range(0, 50, 10): session.add( GlyphCoordinate( session, etype, ship_horiz, ship_vert, score=score |
