Skip to content

Commit 74043a6

Browse files
authored
Merge pull request #3400 from pygame-community/ankith26-update-precommit
Run `pre-commit autoupdate`
2 parents a0fc4db + 5577153 commit 74043a6

File tree

6 files changed

+38
-33
lines changed

6 files changed

+38
-33
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
repos:
88
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v4.6.0
9+
rev: v5.0.0
1010
hooks:
1111
- id: end-of-file-fixer
1212
exclude: |
@@ -26,7 +26,7 @@ repos:
2626
)$
2727
2828
- repo: https://github.com/astral-sh/ruff-pre-commit
29-
rev: v0.4.2
29+
rev: v0.11.5
3030
hooks: # See pyproject.toml for configuration options.
3131
- id: ruff
3232
name: ruff-sort-imports
@@ -35,7 +35,7 @@ repos:
3535
types_or: [ python, pyi, jupyter ]
3636

3737
- repo: https://github.com/pre-commit/mirrors-clang-format
38-
rev: v18.1.4
38+
rev: v20.1.0
3939
hooks:
4040
- id: clang-format
4141
exclude: |

buildconfig/stubs/pygame/sprite.pyi

+7-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ class AbstractGroup(Generic[_TSprite]):
165165
self, *sprites: Union[_TSprite, AbstractGroup[_TSprite], Iterable[_TSprite]]
166166
) -> bool: ...
167167
def update(self, *args: Any, **kwargs: Any) -> None: ...
168-
def draw(self, surface: Surface, bgd: Optional[Surface] = None, special_flags: int = 0) -> list[Union[FRect, Rect]]: ...
168+
def draw(
169+
self, surface: Surface, bgd: Optional[Surface] = None, special_flags: int = 0
170+
) -> list[Union[FRect, Rect]]: ...
169171
def clear(
170172
self,
171173
surface: Surface,
@@ -226,7 +228,10 @@ class LayeredUpdates(AbstractGroup[_TSprite]):
226228
class LayeredDirty(LayeredUpdates[_TDirtySprite]):
227229
def __init__(self, *sprites: _TDirtySprite, **kwargs: Any) -> None: ...
228230
def draw(
229-
self, surface: Surface, bgd: Optional[Surface] = None, special_flags: Optional[int] = None
231+
self,
232+
surface: Surface,
233+
bgd: Optional[Surface] = None,
234+
special_flags: Optional[int] = None,
230235
) -> list[Union[FRect, Rect]]: ...
231236
# clear breaks Liskov substitution principle in code
232237
def clear(self, surface: Surface, bgd: Surface) -> None: ... # type: ignore[override]

src_c/.clang-format

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ DerivePointerAlignment: false
1010
InsertBraces: true
1111
# These settings are mirrored in .editorconfig. Keep them in sync.
1212
IndentWidth: 4
13-
Language: Cpp
1413
PointerAlignment: Right
1514
ReflowComments: true
1615
SpaceBeforeParens: ControlStatements

src_c/freetype/ft_layout.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#define FX16_WIDE_FACTOR (FX16_ONE / 12)
3434

3535
#define SLANT_FACTOR 0.22
36-
static FT_Matrix slant_matrix = {FX16_ONE, (FT_Fixed)(SLANT_FACTOR *FX16_ONE),
36+
static FT_Matrix slant_matrix = {FX16_ONE, (FT_Fixed)(SLANT_FACTOR * FX16_ONE),
3737
0, FX16_ONE};
3838

3939
static FT_Matrix unit_matrix = {FX16_ONE, 0, 0, FX16_ONE};

src_c/freetype/ft_wrap.c

+26-25
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ ft_wrap_quit(pgFontObject *);
3838
*
3939
*********************************************************/
4040
void
41-
_PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id){
41+
_PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id)
42+
{
4243
#undef __FTERRORS_H__
4344
#define FT_ERRORDEF(e, v, s) {e, s},
4445
#define FT_ERROR_START_LIST {
@@ -48,37 +49,37 @@ _PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id){
4849
} \
4950
} \
5051
;
51-
static const struct {int err_code;
52-
const char *err_msg;
53-
}
54-
ft_errors[] =
52+
static const struct {
53+
int err_code;
54+
const char *err_msg;
55+
} ft_errors[] =
5556
#include FT_ERRORS_H
5657

57-
const int maxlen = (int)(sizeof(ft->_error_msg)) - 1;
58-
int i;
59-
const char *ft_msg;
58+
const int maxlen = (int)(sizeof(ft->_error_msg)) - 1;
59+
int i;
60+
const char *ft_msg;
6061

61-
ft_msg = 0;
62-
for (i = 0; ft_errors[i].err_msg; ++i) {
63-
if (error_id == ft_errors[i].err_code) {
64-
ft_msg = ft_errors[i].err_msg;
65-
break;
62+
ft_msg = 0;
63+
for (i = 0; ft_errors[i].err_msg; ++i) {
64+
if (error_id == ft_errors[i].err_code) {
65+
ft_msg = ft_errors[i].err_msg;
66+
break;
67+
}
6668
}
67-
}
6869

69-
if (error_id && ft_msg) {
70-
int ret = PyOS_snprintf(ft->_error_msg, sizeof(ft->_error_msg), "%.*s: %s",
71-
maxlen - 3, error_msg, ft_msg);
72-
if (ret >= 0) {
73-
/* return after successfully copying full or truncated error.
74-
* If ret < 0, PyOS_snprintf failed so try to strncpy error
75-
* message */
76-
return;
70+
if (error_id && ft_msg) {
71+
int ret = PyOS_snprintf(ft->_error_msg, sizeof(ft->_error_msg),
72+
"%.*s: %s", maxlen - 3, error_msg, ft_msg);
73+
if (ret >= 0) {
74+
/* return after successfully copying full or truncated error.
75+
* If ret < 0, PyOS_snprintf failed so try to strncpy error
76+
* message */
77+
return;
78+
}
7779
}
78-
}
7980

80-
strncpy(ft->_error_msg, error_msg, maxlen);
81-
ft->_error_msg[maxlen] = '\0'; /* in case of message truncation */
81+
strncpy(ft->_error_msg, error_msg, maxlen);
82+
ft->_error_msg[maxlen] = '\0'; /* in case of message truncation */
8283
}
8384

8485
const char *

src_c/include/_pygame.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ typedef struct pg_bufferinfo_s {
184184
(*(int (*)(void))PYGAMEAPI_GET_SLOT(base, 23))
185185

186186
#define pg_GetDefaultConvertFormat \
187-
(*(PG_PixelFormatEnum(*)(void))PYGAMEAPI_GET_SLOT(base, 27))
187+
(*(PG_PixelFormatEnum (*)(void))PYGAMEAPI_GET_SLOT(base, 27))
188188

189189
#define pg_SetDefaultConvertFormat \
190190
(*(void (*)(Uint32))PYGAMEAPI_GET_SLOT(base, 28))

0 commit comments

Comments
 (0)