Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 12, 2024
1 parent 4c0feb5 commit 396f279
Show file tree
Hide file tree
Showing 55 changed files with 59 additions and 27 deletions.
1 change: 1 addition & 0 deletions build_libtcod.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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)})"

Check warning on line 448 in tcod/event.py

View check run for this annotation

Codecov / codecov/patch

tcod/event.py#L448

Added line #L448 was not covered by tests

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})"

Check warning on line 553 in tcod/event.py

View check run for this annotation

Codecov / codecov/patch

tcod/event.py#L553

Added line #L553 was not covered by tests

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})"

Check warning on line 613 in tcod/event.py

View check run for this annotation

Codecov / codecov/patch

tcod/event.py#L613

Added line #L613 was not covered by tests

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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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})"

Check warning on line 329 in tcod/libtcodpy.py

View check run for this annotation

Codecov / codecov/patch

tcod/libtcodpy.py#L329

Added line #L329 was not covered by tests


# reverse lookup table for KEY_X attributes, used by Key.__repr__
Expand Down
1 change: 1 addition & 0 deletions tcod/los.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test directory configuration."""

import random
import warnings
from typing import Callable, Iterator, Union
Expand Down
1 change: 1 addition & 0 deletions tests/test_console.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for tcod.console."""

import pickle
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_deprecated.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test deprecated features."""

from __future__ import annotations

import numpy as np
Expand Down
Loading

0 comments on commit 396f279

Please sign in to comment.