Skip to content

Commit 7c1945b

Browse files
committed
Refactoring. Adding the None annotation to the return value
1 parent a145b48 commit 7c1945b

24 files changed

Lines changed: 94 additions & 94 deletions

‎PyGithub_examples/gist_history_to_sqlite_db.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def create_connect():
1212
return sqlite3.connect("gist_commits.sqlite")
1313

1414

15-
def init_db():
15+
def init_db() -> None:
1616
# Создание базы и таблицы
1717
with create_connect() as connect:
1818
connect.execute(

‎PyOpenGLExample/checkerboard.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
"""
1111

1212

13-
def initFun():
13+
def initFun() -> None:
1414
glClearColor(1.0, 1.0, 1.0, 0.0)
1515
glColor3f(0.0, 0.0, 0.0)
1616
glMatrixMode(GL_PROJECTION)
1717
glLoadIdentity()
1818
gluOrtho2D(0.0, 640.0, 0.0, 480.0)
1919

2020

21-
def displayFun():
21+
def displayFun() -> None:
2222
CELL_SIZE = 40
2323

2424
glClear(GL_COLOR_BUFFER_BIT)

‎PyOpenGLExample/gingerbread.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
y = 121
1919

2020

21-
def initFun():
21+
def initFun() -> None:
2222
glClearColor(1.0, 1.0, 1.0, 0.0)
2323
glColor3f(0.0, 0.0, 0.0)
2424
glPointSize(4.0)
@@ -27,7 +27,7 @@ def initFun():
2727
gluOrtho2D(0.0, 640.0, 0.0, 480.0)
2828

2929

30-
def mouseFun(button, state, xIn, yIn):
30+
def mouseFun(button, state, xIn, yIn) -> None:
3131
global x
3232
global y
3333
if button == GLUT_LEFT_BUTTON and state == GLUT_DOWN:
@@ -37,7 +37,7 @@ def mouseFun(button, state, xIn, yIn):
3737
glutPostRedisplay()
3838

3939

40-
def displayFun():
40+
def displayFun() -> None:
4141
global x
4242
global y
4343
glClear(GL_COLOR_BUFFER_BIT)

‎PyOpenGLExample/helloworld.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"""
1515

1616

17-
def initFun():
17+
def initFun() -> None:
1818
glClearColor(1.0, 1.0, 1.0, 0.0)
1919
glColor3f(0.0, 0.0, 0.0)
2020
glPointSize(4.0)
@@ -23,7 +23,7 @@ def initFun():
2323
gluOrtho2D(0.0, 640.0, 0.0, 480.0)
2424

2525

26-
def displayFun():
26+
def displayFun() -> None:
2727
glClear(GL_COLOR_BUFFER_BIT)
2828
glBegin(GL_POINTS)
2929
glVertex2i(100, 50)

‎PyOpenGLExample/maze.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939

4040
class MazeCell:
41-
def __init__(self, x, y):
41+
def __init__(self, x, y) -> None:
4242
self.x = x
4343
self.y = y
4444
self.wall_north = True
@@ -49,7 +49,7 @@ def __init__(self, x, y):
4949

5050

5151
class Maze:
52-
def __init__(self, dimx, dimy):
52+
def __init__(self, dimx, dimy) -> None:
5353
self.numx = dimx
5454
self.numy = dimy
5555

@@ -155,7 +155,7 @@ def __init__(self, dimx, dimy):
155155
# Push it back on the list since this is our next node
156156
cell_list.append(conn)
157157

158-
def draw(self):
158+
def draw(self) -> None:
159159
"""Draws the field"""
160160
glBegin(GL_LINES)
161161
for i in range(0, self.numx * self.numy):
@@ -184,7 +184,7 @@ def draw(self):
184184
maze = Maze(MAZECOLS, MAZEROWS)
185185

186186

187-
def init_fun():
187+
def init_fun() -> None:
188188
glClearColor(1.0, 1.0, 1.0, 0.0)
189189
glColor3f(0.0, 0.0, 0.0)
190190
glMatrixMode(GL_PROJECTION)
@@ -193,7 +193,7 @@ def init_fun():
193193
gluOrtho2D(-1.0, WIDTH, -1.0, HEIGHT)
194194

195195

196-
def display_fun():
196+
def display_fun() -> None:
197197
glClear(GL_COLOR_BUFFER_BIT)
198198
maze.draw()
199199
glFlush()

‎PyOpenGLExample/mouse.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@
1818

1919

2020
class Point:
21-
def __init__(self, x, y):
21+
def __init__(self, x, y) -> None:
2222
self.x = x
2323
self.y = y
2424

2525

2626
points = []
2727

2828

29-
def initFun():
29+
def initFun() -> None:
3030
glClearColor(1.0, 1.0, 1.0, 0.0)
3131
glColor3f(0.0, 0.0, 0.0)
3232
glMatrixMode(GL_PROJECTION)
3333
glLoadIdentity()
3434
gluOrtho2D(0.0, 640.0, 0.0, 480.0)
3535

3636

37-
def displayFun():
37+
def displayFun() -> None:
3838
global points
3939
glClear(GL_COLOR_BUFFER_BIT)
4040
glBegin(GL_LINE_STRIP)
@@ -45,7 +45,7 @@ def displayFun():
4545
glFlush()
4646

4747

48-
def mouseFun(button, state, x, y):
48+
def mouseFun(button, state, x, y) -> None:
4949
global points
5050
if button == GLUT_LEFT_BUTTON and state == GLUT_DOWN:
5151
p = Point(x, 480 - y)

‎PyOpenGLExample/print_text.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
height = 0
1010

1111

12-
def glSetup(w, h):
12+
def glSetup(w, h) -> None:
1313
global width, height
1414
width = w
1515
height = h
@@ -31,7 +31,7 @@ def glSetup(w, h):
3131
glMatrixMode(GL_MODELVIEW)
3232

3333

34-
def glResize(w, h):
34+
def glResize(w, h) -> None:
3535
global width, height
3636
width = w
3737
height = h
@@ -43,12 +43,12 @@ def glResize(w, h):
4343
glMatrixMode(GL_MODELVIEW)
4444

4545

46-
def glSetupCam():
46+
def glSetupCam() -> None:
4747
gluPerspective(45.0, float(width) / float(height), 0.1, 100.0)
4848
gluLookAt(0, 0, 5, 0, 0, 0, 0, 1, 0)
4949

5050

51-
def glDraw():
51+
def glDraw() -> None:
5252
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
5353
glLoadIdentity()
5454

@@ -62,7 +62,7 @@ def glDraw():
6262

6363

6464
# glut_print adapted from http://stackoverflow.com/questions/12837747/print-text-with-glut-and-python
65-
def glut_print(x, y, font, text, r, g, b, a):
65+
def glut_print(x, y, font, text, r, g, b, a) -> None:
6666
glMatrixMode(GL_PROJECTION)
6767
glLoadIdentity()
6868
gluOrtho2D(0.0, width, height, 0.0)
@@ -80,7 +80,7 @@ def glut_print(x, y, font, text, r, g, b, a):
8080
glDisable(GL_BLEND)
8181

8282

83-
def keyPressed(*args):
83+
def keyPressed(*args) -> None:
8484
ESCAPE = b"\x1b"
8585
if args[0] == ESCAPE:
8686
sys.exit()

‎PyOpenGLExample/reshape.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@
1919
"""
2020

2121

22-
def init_fun():
22+
def init_fun() -> None:
2323
glClearColor(1.0, 1.0, 1.0, 0.0)
2424
glColor3f(0.0, 0.0, 0.0)
2525
glMatrixMode(GL_PROJECTION)
2626
glLoadIdentity()
2727
gluOrtho2D(-100, 100, -100, 100)
2828

2929

30-
def reshape_fun(w, h):
30+
def reshape_fun(w, h) -> None:
3131
glViewport(0, 0, w, h)
3232
# if w > h:
3333
# glViewport((w - h) / 2, 0, h, h)
3434
# else:
3535
# glViewport(0, (h - w) / 2, w, w)
3636

3737

38-
def display_fun():
38+
def display_fun() -> None:
3939
glClear(GL_COLOR_BUFFER_BIT)
4040
glColor3f(0.0, 0.0, 1.0)
4141
glutWireTeapot(40)

‎PyOpenGLExample/rosette.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
RADIUS = 95
2424

2525

26-
def init_fun():
26+
def init_fun() -> None:
2727
glClearColor(1.0, 1.0, 1.0, 0.0)
2828
glColor3f(0.0, 0.0, 0.0)
2929
glMatrixMode(GL_PROJECTION)
3030
glLoadIdentity()
3131
gluOrtho2D(-100, 100, -100, 100)
3232

3333

34-
def reshape_fun(w, h):
34+
def reshape_fun(w, h) -> None:
3535
glViewport(0, 0, w, h)
3636

3737
# if w > h:
@@ -40,7 +40,7 @@ def reshape_fun(w, h):
4040
# glViewport(0, (h - w) / 2, w, w)
4141

4242

43-
def display_fun():
43+
def display_fun() -> None:
4444
glClear(GL_COLOR_BUFFER_BIT)
4545
glColor3f(0.0, 0.0, 1.0)
4646
xpts = []

‎PyOpenGLExample/scatter.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"""
2020

2121

22-
def initFun():
22+
def initFun() -> None:
2323
glClearColor(1.0, 1.0, 1.0, 0.0)
2424
glColor3f(0.0, 0.0, 0.0)
2525
glPointSize(1.0)
@@ -39,7 +39,7 @@ def getRandom(mode):
3939
return random.gauss(200, 40) % 400
4040

4141

42-
def displayFun():
42+
def displayFun() -> None:
4343
glClear(GL_COLOR_BUFFER_BIT)
4444
glBegin(GL_POINTS)
4545

0 commit comments

Comments
 (0)