Skip to content

Commit be9e7d7

Browse files
author
BuildTools
committed
Fixed indentation, added stubs
1 parent a16e23c commit be9e7d7

File tree

5 files changed

+39
-11
lines changed

5 files changed

+39
-11
lines changed

buildconfig/stubs/pygame/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,10 @@ from .constants import (
597597
K_y as K_y,
598598
K_z as K_z,
599599
LIL_ENDIAN as LIL_ENDIAN,
600+
LINE_RENDER_DEFAULT as LINE_RENDER_DEFAULT,
601+
LINE_RENDER_GEOMETRY as LINE_RENDER_GEOMETRY,
602+
LINE_RENDER_LINE as LINE_RENDER_LINE,
603+
LINE_RENDER_POINT as LINE_RENDER_POINT,
600604
LOCALECHANGED as LOCALECHANGED,
601605
MIDIIN as MIDIIN,
602606
MIDIOUT as MIDIOUT,

buildconfig/stubs/pygame/constants.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ K_x: int
519519
K_y: int
520520
K_z: int
521521
LIL_ENDIAN: int
522+
LINE_RENDER_DEFAULT: int
523+
LINE_RENDER_GEOMETRY: int
524+
LINE_RENDER_LINE: int
525+
LINE_RENDER_POINT: int
522526
LOCALECHANGED: int
523527
MIDIIN: int
524528
MIDIOUT: int
@@ -1191,4 +1195,8 @@ __all__ = [
11911195
"FLASH_CANCEL",
11921196
"FLASH_BRIEFLY",
11931197
"FLASH_UNTIL_FOCUSED",
1198+
"LINE_RENDER_DEFAULT",
1199+
"LINE_RENDER_POINT",
1200+
"LINE_RENDER_LINE",
1201+
"LINE_RENDER_GEOMETRY",
11941202
]

buildconfig/stubs/pygame/locals.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,10 @@ K_x: int
520520
K_y: int
521521
K_z: int
522522
LIL_ENDIAN: int
523+
LINE_RENDER_DEFAULT: int
524+
LINE_RENDER_GEOMETRY: int
525+
LINE_RENDER_LINE: int
526+
LINE_RENDER_POINT: int
523527
LOCALECHANGED: int
524528
MIDIIN: int
525529
MIDIOUT: int
@@ -1193,6 +1197,10 @@ __all__ = [
11931197
"FLASH_CANCEL",
11941198
"FLASH_BRIEFLY",
11951199
"FLASH_UNTIL_FOCUSED",
1200+
"LINE_RENDER_DEFAULT",
1201+
"LINE_RENDER_POINT",
1202+
"LINE_RENDER_LINE",
1203+
"LINE_RENDER_GEOMETRY",
11961204
"Rect",
11971205
"Color",
11981206
]

src_c/render.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,29 +1188,33 @@ static PyObject *
11881188
get_line_render_method(PyObject *self, PyObject *Py_UNUSED(ignored))
11891189
{
11901190
const char *hint = SDL_GetHint(SDL_HINT_RENDER_LINE_METHOD);
1191-
return PyLong_FromLong(hint == NULL ? 0 : hint[0] - '0'); // hint is a char between 0-3
1191+
return PyLong_FromLong(
1192+
hint == NULL ? 0 : hint[0] - '0'); // hint is a char between 0-3
11921193
}
11931194

11941195
static PyObject *
11951196
set_line_render_method(PyObject *self, PyObject *args)
11961197
{
11971198
int method;
11981199
if (!PyArg_ParseTuple(args, "i", &method)) {
1199-
return RAISE(PyExc_ValueError, "Invalid line render method: must be an int"
1200-
" (use LINE_RENDER_* constants)");
1200+
return RAISE(PyExc_ValueError,
1201+
"Invalid line render method: must be an int"
1202+
" (use LINE_RENDER_* constants)");
12011203
}
12021204
if (method < 0 || 3 < method) {
1203-
return RAISE(PyExc_ValueError, "Invalid line render method: must be between"
1204-
" 0 and 3 (use LINE_RENDER_* constants)");
1205+
return RAISE(PyExc_ValueError,
1206+
"Invalid line render method: must be between"
1207+
" 0 and 3 (use LINE_RENDER_* constants)");
12051208
}
12061209

12071210
// SDL_SetHint expects the method as a string
12081211
char hint[2];
1209-
hint[0] = method + '0'; // ascii char manipulation
1212+
hint[0] = method + '0'; // ascii char manipulation
12101213
hint[1] = '\0';
1211-
1212-
if (SDL_SetHint(SDL_HINT_RENDER_LINE_METHOD, hint))
1214+
1215+
if (SDL_SetHint(SDL_HINT_RENDER_LINE_METHOD, hint)) {
12131216
Py_RETURN_TRUE;
1217+
}
12141218
Py_RETURN_FALSE;
12151219
}
12161220
#endif

test/render_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,17 @@ def test_correct_argument(self):
494494
_render.set_line_render_method("foo")
495495
with self.assertRaises(ValueError):
496496
_render.set_line_render_method(None)
497-
497+
498498
def test_get_set_line_render_method(self):
499499
if _render.set_line_render_method(pygame.LINE_RENDER_DEFAULT):
500-
self.assertEqual(pygame.LINE_RENDER_DEFAULT, _render.get_line_render_method())
500+
self.assertEqual(
501+
pygame.LINE_RENDER_DEFAULT, _render.get_line_render_method()
502+
)
501503
if _render.set_line_render_method(pygame.LINE_RENDER_POINT):
502504
self.assertEqual(pygame.LINE_RENDER_POINT, _render.get_line_render_method())
503505
if _render.set_line_render_method(pygame.LINE_RENDER_LINE):
504506
self.assertEqual(pygame.LINE_RENDER_LINE, _render.get_line_render_method())
505507
if _render.set_line_render_method(pygame.LINE_RENDER_GEOMETRY):
506-
self.assertEqual(pygame.LINE_RENDER_GEOMETRY, _render.get_line_render_method())
508+
self.assertEqual(
509+
pygame.LINE_RENDER_GEOMETRY, _render.get_line_render_method()
510+
)

0 commit comments

Comments
 (0)