Skip to content

Commit

Permalink
Merge pull request #149 from libtcod/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
HexDecimal committed Mar 13, 2024
2 parents c7d71e5 + 396f279 commit 7cefc61
Show file tree
Hide file tree
Showing 56 changed files with 60 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -15,7 +15,7 @@ repos:
- id: fix-byte-order-marker
- id: detect-private-key
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.2
hooks:
- id: ruff
args: [--fix-only, --exit-non-zero-on-fix]
Expand Down
1 change: 1 addition & 0 deletions build_libtcod.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Parse and compile libtcod and SDL sources for CFFI."""

from __future__ import annotations

import contextlib
Expand Down
1 change: 1 addition & 0 deletions build_sdl.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Build script to parse SDL headers and generate CFFI bindings."""

from __future__ import annotations

import io
Expand Down
1 change: 1 addition & 0 deletions examples/audio_tone.py
Expand Up @@ -3,6 +3,7 @@
Opens an audio device using SDL and plays a square wave for 1 second.
"""

import math
import time
from typing import Any
Expand Down
1 change: 1 addition & 0 deletions examples/cavegen.py
Expand Up @@ -6,6 +6,7 @@
This will print the result to the console, so be sure to run this from the
command line.
"""

from typing import Any

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions examples/distribution/PyInstaller/main.py
Expand Up @@ -4,6 +4,7 @@
# example script. This work is published from: United States.
# https://creativecommons.org/publicdomain/zero/1.0/
"""PyInstaller main script example."""

import sys
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions examples/distribution/cx_Freeze/main.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""cx_Freeze main script example."""

import tcod.console
import tcod.context
import tcod.event
Expand Down
1 change: 1 addition & 0 deletions examples/eventget.py
Expand Up @@ -4,6 +4,7 @@
# published from: United States.
# https://creativecommons.org/publicdomain/zero/1.0/
"""An demonstration of event handling using the tcod.event module."""

from typing import List, Set

import tcod.context
Expand Down
1 change: 1 addition & 0 deletions examples/framerate.py
Expand Up @@ -4,6 +4,7 @@
# published from: United States.
# https://creativecommons.org/publicdomain/zero/1.0/
"""A system to control time since the original libtcod tools are deprecated."""

import statistics
import time
from collections import deque
Expand Down
1 change: 1 addition & 0 deletions examples/samples_tcod.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""This code demonstrates various usages of python-tcod."""

# To the extent possible under law, the libtcod maintainers have waived all
# copyright and related or neighboring rights to these samples.
# https://creativecommons.org/publicdomain/zero/1.0/
Expand Down
1 change: 1 addition & 0 deletions examples/sdl-hello-world.py
@@ -1,4 +1,5 @@
"""Hello world using tcod's SDL API and using Pillow for the TTF rendering."""

from pathlib import Path

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions examples/thread_jobs.py
Expand Up @@ -13,6 +13,7 @@
Typically the field-of-view tasks run good but not great, and the path-finding
tasks run poorly.
"""

import concurrent.futures
import multiprocessing
import platform
Expand Down
1 change: 1 addition & 0 deletions examples/ttf.py
Expand Up @@ -5,6 +5,7 @@
pip install freetype-py
"""

# To the extent possible under law, the libtcod maintainers have waived all
# copyright and related or neighboring rights to this example script.
# https://creativecommons.org/publicdomain/zero/1.0/
Expand Down
1 change: 1 addition & 0 deletions libtcodpy.py
@@ -1,4 +1,5 @@
"""Deprecated module alias for tcod.libtcodpy, use 'import tcod as libtcodpy' instead."""

import warnings

from tcod.libtcodpy import * # noqa: F403
Expand Down
1 change: 1 addition & 0 deletions scripts/generate_charmap_table.py
Expand Up @@ -3,6 +3,7 @@
Uses the tabulate module from PyPI.
"""

from __future__ import annotations

import argparse
Expand Down
1 change: 1 addition & 0 deletions scripts/get_release_description.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Print the description used for GitHub Releases."""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions scripts/tag_release.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Automate tagged releases of this project."""

from __future__ import annotations

import argparse
Expand Down
1 change: 1 addition & 0 deletions setup.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Python-tcod setup script."""

from __future__ import annotations

import platform
Expand Down
1 change: 1 addition & 0 deletions tcod/__init__.py
Expand Up @@ -6,6 +6,7 @@
Read the documentation online: https://python-tcod.readthedocs.io/en/latest/
"""

from __future__ import annotations

from pkgutil import extend_path
Expand Down
1 change: 1 addition & 0 deletions tcod/__pyinstaller/__init__.py
@@ -1,4 +1,5 @@
"""PyInstaller entry point for tcod."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tcod/__pyinstaller/hook-tcod.py
Expand Up @@ -5,6 +5,7 @@
If this hook is ever modified then the contributed hook needs to be removed from:
https://github.com/pyinstaller/pyinstaller-hooks-contrib
"""

from PyInstaller.utils.hooks import collect_dynamic_libs # type: ignore

hiddenimports = ["_cffi_backend"]
Expand Down
1 change: 1 addition & 0 deletions tcod/_internal.py
@@ -1,4 +1,5 @@
"""Internal helper functions used by the rest of the library."""

from __future__ import annotations

import functools
Expand Down
1 change: 1 addition & 0 deletions tcod/bsp.py
Expand Up @@ -24,6 +24,7 @@
else:
print('Dig a room for %s.' % node)
"""

from __future__ import annotations

from typing import Any, Iterator
Expand Down
1 change: 1 addition & 0 deletions tcod/cffi.py
@@ -1,4 +1,5 @@
"""This module handles loading of the libtcod cffi API."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions tcod/color.py
@@ -1,4 +1,5 @@
"""Old libtcod color management."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions tcod/console.py
Expand Up @@ -4,6 +4,7 @@
To render a console you need a tileset and a window to render to.
See :ref:`getting-started` for info on how to set those up.
"""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions tcod/constants.py
Expand Up @@ -2,6 +2,7 @@
This module is auto-generated by `build_libtcod.py`.
"""

from tcod.color import Color

FOV_BASIC = 0
Expand Down
1 change: 1 addition & 0 deletions tcod/context.py
Expand Up @@ -22,6 +22,7 @@
.. versionadded:: 11.12
"""

from __future__ import annotations

import copy
Expand Down
24 changes: 4 additions & 20 deletions tcod/event.py
Expand Up @@ -79,6 +79,7 @@
.. versionadded:: 8.4
"""

from __future__ import annotations

import enum
Expand Down Expand Up @@ -444,12 +445,7 @@ def tile(self, xy: tuple[int, int]) -> None:
self._tile = Point(*xy)

def __repr__(self) -> str:
return ("tcod.event.{}(position={!r}, tile={!r}, state={})").format(
self.__class__.__name__,
tuple(self.position),
tuple(self.tile),
MouseButtonMask(self.state),
)
return f"tcod.event.{self.__class__.__name__}(position={tuple(self.position)!r}, tile={tuple(self.tile)!r}, state={MouseButtonMask(self.state)})"

def __str__(self) -> str:
return ("<%s, position=(x=%i, y=%i), tile=(x=%i, y=%i), state=%s>") % (
Expand Down Expand Up @@ -554,14 +550,7 @@ def from_sdl_event(cls, sdl_event: Any) -> MouseMotion:
return self

def __repr__(self) -> str:
return ("tcod.event.{}(position={!r}, motion={!r}, tile={!r}, tile_motion={!r}, state={!r})").format(
self.__class__.__name__,
tuple(self.position),
tuple(self.motion),
tuple(self.tile),
tuple(self.tile_motion),
MouseButtonMask(self.state),
)
return f"tcod.event.{self.__class__.__name__}(position={tuple(self.position)!r}, motion={tuple(self.motion)!r}, tile={tuple(self.tile)!r}, tile_motion={tuple(self.tile_motion)!r}, state={MouseButtonMask(self.state)!r})"

def __str__(self) -> str:
return ("<%s, motion=(x=%i, y=%i), tile_motion=(x=%i, y=%i)>") % (
Expand Down Expand Up @@ -621,12 +610,7 @@ def from_sdl_event(cls, sdl_event: Any) -> Any:
return self

def __repr__(self) -> str:
return "tcod.event.{}(position={!r}, tile={!r}, button={!r})".format(
self.__class__.__name__,
tuple(self.position),
tuple(self.tile),
MouseButton(self.button),
)
return f"tcod.event.{self.__class__.__name__}(position={tuple(self.position)!r}, tile={tuple(self.tile)!r}, button={MouseButton(self.button)!r})"

def __str__(self) -> str:
return "<type=%r, position=(x=%i, y=%i), tile=(x=%i, y=%i), button=%r)" % (
Expand Down
1 change: 1 addition & 0 deletions tcod/image.py
Expand Up @@ -8,6 +8,7 @@
The best it can do with consoles is convert an image into semigraphics which can be shown on non-emulated terminals.
For true pixel-based rendering you'll want to access the SDL rendering port at :any:`tcod.sdl.render`.
"""

from __future__ import annotations

from os import PathLike
Expand Down
9 changes: 2 additions & 7 deletions tcod/libtcodpy.py
@@ -1,4 +1,5 @@
"""This module handles backward compatibility with the ctypes libtcodpy module."""

from __future__ import annotations

import atexit
Expand Down Expand Up @@ -325,13 +326,7 @@ def __str__(self) -> str:
)

def __repr__(self) -> str:
return "{}(nb_dices={!r},nb_faces={!r},multiplier={!r},addsub={!r})".format(
self.__class__.__name__,
self.nb_dices,
self.nb_faces,
self.multiplier,
self.addsub,
)
return f"{self.__class__.__name__}(nb_dices={self.nb_dices!r},nb_faces={self.nb_faces!r},multiplier={self.multiplier!r},addsub={self.addsub!r})"


# reverse lookup table for KEY_X attributes, used by Key.__repr__
Expand Down
1 change: 1 addition & 0 deletions tcod/los.py
@@ -1,4 +1,5 @@
"""This modules holds functions for NumPy-based line of sight algorithms."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions tcod/map.py
@@ -1,4 +1,5 @@
"""libtcod map attributes and field-of-view functions."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions tcod/noise.py
Expand Up @@ -31,6 +31,7 @@
[ 76, 54, 85, 144, 164],
[ 63, 94, 159, 209, 203]], dtype=uint8)
"""

from __future__ import annotations

import enum
Expand Down
1 change: 1 addition & 0 deletions tcod/path.py
Expand Up @@ -15,6 +15,7 @@
All path-finding functions now respect the NumPy array shape (if a NumPy
array is used.)
"""

from __future__ import annotations

import functools
Expand Down
1 change: 1 addition & 0 deletions tcod/random.py
Expand Up @@ -6,6 +6,7 @@
However, you will need to use these generators to get deterministic results
from the :any:`Noise` and :any:`BSP` classes.
"""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions tcod/sdl/__init__.py
@@ -1,4 +1,5 @@
"""tcod.sdl package."""

from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
1 change: 1 addition & 0 deletions tcod/sdl/_internal.py
@@ -1,4 +1,5 @@
"""tcod.sdl private functions."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions tcod/sdl/audio.py
Expand Up @@ -41,6 +41,7 @@
.. versionadded:: 13.5
"""

from __future__ import annotations

import enum
Expand Down
1 change: 1 addition & 0 deletions tcod/sdl/joystick.py
Expand Up @@ -2,6 +2,7 @@
.. versionadded:: 13.8
"""

from __future__ import annotations

import enum
Expand Down
1 change: 1 addition & 0 deletions tcod/sdl/mouse.py
Expand Up @@ -6,6 +6,7 @@
.. versionadded:: 13.5
"""

from __future__ import annotations

import enum
Expand Down
1 change: 1 addition & 0 deletions tcod/sdl/render.py
Expand Up @@ -2,6 +2,7 @@
.. versionadded:: 13.4
"""

from __future__ import annotations

import enum
Expand Down
1 change: 1 addition & 0 deletions tcod/sdl/video.py
Expand Up @@ -6,6 +6,7 @@
.. versionadded:: 13.4
"""

from __future__ import annotations

import enum
Expand Down
1 change: 1 addition & 0 deletions tcod/tcod.py
Expand Up @@ -6,6 +6,7 @@
Read the documentation online: https://python-tcod.readthedocs.io/en/latest/
"""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions tcod/tileset.py
Expand Up @@ -10,6 +10,7 @@
<https://wiki.python.org/moin/PythonGameLibraries>`_ while continuing to use
python-tcod's pathfinding and field-of-view algorithms.
"""

from __future__ import annotations

import itertools
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
@@ -1,4 +1,5 @@
"""Test directory configuration."""

import random
import warnings
from typing import Callable, Iterator, Union
Expand Down

0 comments on commit 7cefc61

Please sign in to comment.