Completed
Push — master ( dc3d89...4876a7 )
by Kyle
47s
created

Mouse.__repr__()   B

Complexity

Conditions 5

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
c 1
b 0
f 0
dl 0
loc 13
rs 8.5454
1
"""This module handles backward compatibility with the ctypes libtcodpy module.
2
"""
3
4
from __future__ import absolute_import as _
5
6
import threading as _threading
7
8
import numpy as _np
0 ignored issues
show
Configuration introduced by
The import numpy could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
9
10
from tcod.libtcod import *
0 ignored issues
show
Coding Style introduced by
The usage of wildcard imports like tcod.libtcod should generally be avoided.
Loading history...
Unused Code introduced by
BKGND_ALPHA was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
FOV_PERMISSIVE was imported with wildcard, but is not used.
Loading history...
Unused Code introduced by
BKGND_ADDALPHA was imported with wildcard, but is not used.
Loading history...
11
12
from tcod.tcod import _int, _unpack_char_p
13
from tcod.tcod import _bytes, _unicode, _fmt_bytes, _fmt_unicode
14
from tcod.tcod import _CDataWrapper
15
from tcod.tcod import _PropagateException
16
17
import tcod.bsp
18
from tcod.color import *
0 ignored issues
show
Coding Style introduced by
The usage of wildcard imports like tcod.color should generally be avoided.
Loading history...
19
import tcod.console
20
import tcod.image
21
import tcod.map
22
import tcod.noise
23
import tcod.path
24
import tcod.random
25
26
Bsp = tcod.bsp.BSP
27
28
29
class ConsoleBuffer(object):
30
    """Simple console that allows direct (fast) access to cells. simplifies
31
    use of the "fill" functions.
32
33
    Args:
34
        width (int): Width of the new ConsoleBuffer.
35
        height (int): Height of the new ConsoleBuffer.
36
        back_r (int): Red background color, from 0 to 255.
37
        back_g (int): Green background color, from 0 to 255.
38
        back_b (int): Blue background color, from 0 to 255.
39
        fore_r (int): Red foreground color, from 0 to 255.
40
        fore_g (int): Green foreground color, from 0 to 255.
41
        fore_b (int): Blue foreground color, from 0 to 255.
42
        char (AnyStr): A single character str or bytes object.
43
    """
44
    def __init__(self, width, height, back_r=0, back_g=0, back_b=0, fore_r=0, fore_g=0, fore_b=0, char=' '):
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (108/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
45
        """initialize with given width and height. values to fill the buffer
46
        are optional, defaults to black with no characters.
47
        """
48
        self.width = width
49
        self.height = height
50
        self.clear(back_r, back_g, back_b, fore_r, fore_g, fore_b, char)
51
52
    def clear(self, back_r=0, back_g=0, back_b=0, fore_r=0, fore_g=0, fore_b=0, char=' '):
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (90/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
53
        """Clears the console.  Values to fill it with are optional, defaults
54
        to black with no characters.
55
56
        Args:
57
            back_r (int): Red background color, from 0 to 255.
58
            back_g (int): Green background color, from 0 to 255.
59
            back_b (int): Blue background color, from 0 to 255.
60
            fore_r (int): Red foreground color, from 0 to 255.
61
            fore_g (int): Green foreground color, from 0 to 255.
62
            fore_b (int): Blue foreground color, from 0 to 255.
63
            char (AnyStr): A single character str or bytes object.
64
        """
65
        n = self.width * self.height
0 ignored issues
show
Coding Style Naming introduced by
The name n does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
66
        self.back_r = [back_r] * n
67
        self.back_g = [back_g] * n
68
        self.back_b = [back_b] * n
69
        self.fore_r = [fore_r] * n
70
        self.fore_g = [fore_g] * n
71
        self.fore_b = [fore_b] * n
72
        self.char = [ord(char)] * n
73
74
    def copy(self):
75
        """Returns a copy of this ConsoleBuffer.
76
77
        Returns:
78
            ConsoleBuffer: A new ConsoleBuffer copy.
79
        """
80
        other = ConsoleBuffer(0, 0)
81
        other.width = self.width
82
        other.height = self.height
83
        other.back_r = list(self.back_r)  # make explicit copies of all lists
0 ignored issues
show
Coding Style introduced by
The attribute back_r was defined outside __init__.

It is generally a good practice to initialize all attributes to default values in the __init__ method:

class Foo:
    def __init__(self, x=None):
        self.x = x
Loading history...
84
        other.back_g = list(self.back_g)
0 ignored issues
show
Coding Style introduced by
The attribute back_g was defined outside __init__.

It is generally a good practice to initialize all attributes to default values in the __init__ method:

class Foo:
    def __init__(self, x=None):
        self.x = x
Loading history...
85
        other.back_b = list(self.back_b)
0 ignored issues
show
Coding Style introduced by
The attribute back_b was defined outside __init__.

It is generally a good practice to initialize all attributes to default values in the __init__ method:

class Foo:
    def __init__(self, x=None):
        self.x = x
Loading history...
86
        other.fore_r = list(self.fore_r)
0 ignored issues
show
Coding Style introduced by
The attribute fore_r was defined outside __init__.

It is generally a good practice to initialize all attributes to default values in the __init__ method:

class Foo:
    def __init__(self, x=None):
        self.x = x
Loading history...
87
        other.fore_g = list(self.fore_g)
0 ignored issues
show
Coding Style introduced by
The attribute fore_g was defined outside __init__.

It is generally a good practice to initialize all attributes to default values in the __init__ method:

class Foo:
    def __init__(self, x=None):
        self.x = x
Loading history...
88
        other.fore_b = list(self.fore_b)
0 ignored issues
show
Coding Style introduced by
The attribute fore_b was defined outside __init__.

It is generally a good practice to initialize all attributes to default values in the __init__ method:

class Foo:
    def __init__(self, x=None):
        self.x = x
Loading history...
89
        other.char = list(self.char)
0 ignored issues
show
Coding Style introduced by
The attribute char was defined outside __init__.

It is generally a good practice to initialize all attributes to default values in the __init__ method:

class Foo:
    def __init__(self, x=None):
        self.x = x
Loading history...
90
        return other
91
92
    def set_fore(self, x, y, r, g, b, char):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name r does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name g does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name b does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
93
        """Set the character and foreground color of one cell.
94
95
        Args:
96
            x (int): X position to change.
97
            y (int): Y position to change.
98
            r (int): Red foreground color, from 0 to 255.
99
            g (int): Green foreground color, from 0 to 255.
100
            b (int): Blue foreground color, from 0 to 255.
101
            char (AnyStr): A single character str or bytes object.
102
        """
103
        i = self.width * y + x
104
        self.fore_r[i] = r
105
        self.fore_g[i] = g
106
        self.fore_b[i] = b
107
        self.char[i] = ord(char)
108
109
    def set_back(self, x, y, r, g, b):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name r does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name g does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name b does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
110
        """Set the background color of one cell.
111
112
        Args:
113
            x (int): X position to change.
114
            y (int): Y position to change.
115
            r (int): Red background color, from 0 to 255.
116
            g (int): Green background color, from 0 to 255.
117
            b (int): Blue background color, from 0 to 255.
118
            char (AnyStr): A single character str or bytes object.
119
        """
120
        i = self.width * y + x
121
        self.back_r[i] = r
122
        self.back_g[i] = g
123
        self.back_b[i] = b
124
125
    def set(self, x, y, back_r, back_g, back_b, fore_r, fore_g, fore_b, char):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
126
        """Set the background color, foreground color and character of one cell.
127
128
        Args:
129
            x (int): X position to change.
130
            y (int): Y position to change.
131
            back_r (int): Red background color, from 0 to 255.
132
            back_g (int): Green background color, from 0 to 255.
133
            back_b (int): Blue background color, from 0 to 255.
134
            fore_r (int): Red foreground color, from 0 to 255.
135
            fore_g (int): Green foreground color, from 0 to 255.
136
            fore_b (int): Blue foreground color, from 0 to 255.
137
            char (AnyStr): A single character str or bytes object.
138
        """
139
        i = self.width * y + x
140
        self.back_r[i] = back_r
141
        self.back_g[i] = back_g
142
        self.back_b[i] = back_b
143
        self.fore_r[i] = fore_r
144
        self.fore_g[i] = fore_g
145
        self.fore_b[i] = fore_b
146
        self.char[i] = ord(char)
147
148
    def blit(self, dest, fill_fore=True, fill_back=True):
149
        """Use libtcod's "fill" functions to write the buffer to a console.
150
151
        Args:
152
            dest (Console): Console object to modify.
153
            fill_fore (bool):
154
                If True, fill the foreground color and characters.
155
            fill_back (bool):
156
                If True, fill the background color.
157
        """
158
        if not dest:
159
            dest = tcod.console.Console._from_cdata(ffi.NULL)
160
        if (dest.width != self.width or
161
            dest.height != self.height):
162
            raise ValueError('ConsoleBuffer.blit: Destination console has an incorrect size.')
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (94/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
163
164
        if fill_back:
165
            bg = dest.bg.ravel()
0 ignored issues
show
Coding Style Naming introduced by
The name bg does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
166
            bg[0::3] = self.back_r
167
            bg[1::3] = self.back_g
168
            bg[2::3] = self.back_b
169
170
        if fill_fore:
171
            fg = dest.fg.ravel()
0 ignored issues
show
Coding Style Naming introduced by
The name fg does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
172
            fg[0::3] = self.fore_r
173
            fg[1::3] = self.fore_g
174
            fg[2::3] = self.fore_b
175
            dest.ch.ravel()[:] = self.char
176
177
class Dice(_CDataWrapper):
178
    """
179
180
    Args:
181
        nb_dices (int): Number of dice.
182
        nb_faces (int): Number of sides on a die.
183
        multiplier (float): Multiplier.
184
        addsub (float): Addition.
185
186
    .. deprecated:: 2.0
187
        You should make your own dice functions instead of using this class
188
        which is tied to a CData object.
189
    """
190
191
    def __init__(self, *args, **kargs):
192
        super(Dice, self).__init__(*args, **kargs)
193
        if self.cdata == ffi.NULL:
194
            self._init(*args, **kargs)
195
196
    def _init(self, nb_dices=0, nb_faces=0, multiplier=0, addsub=0):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
197
        self.cdata = ffi.new('TCOD_dice_t*')
198
        self.nb_dices = nb_dices
199
        self.nb_faces = nb_faces
200
        self.multiplier = multiplier
201
        self.addsub = addsub
202
203
    def _get_nb_dices(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
204
        return self.nb_rolls
205
    def _set_nb_dices(self, value):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
206
        self.nb_rolls = value
0 ignored issues
show
Coding Style introduced by
The attribute nb_rolls was defined outside __init__.

It is generally a good practice to initialize all attributes to default values in the __init__ method:

class Foo:
    def __init__(self, x=None):
        self.x = x
Loading history...
207
    nb_dices = property(_get_nb_dices, _set_nb_dices)
208
209
    def __str__(self):
210
        add = '+(%s)' % self.addsub if self.addsub != 0 else ''
211
        return '%id%ix%s%s' % (self.nb_dices, self.nb_faces,
212
                               self.multiplier, add)
213
214
    def __repr__(self):
215
        return ('%s(nb_dices=%r,nb_faces=%r,multiplier=%r,addsub=%r)' %
216
                (self.__class__.__name__, self.nb_dices, self.nb_faces,
217
                 self.multiplier, self.addsub))
218
219
220
class Key(_CDataWrapper):
221
    """Key Event instance
222
223
    Attributes:
224
        vk (int): TCOD_keycode_t key code
225
        c (int): character if vk == TCODK_CHAR else 0
226
        text (Text): text[TCOD_KEY_TEXT_SIZE]; text if vk == TCODK_TEXT else text[0] == '\0'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (92/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
227
        pressed (bool): does this correspond to a key press or key release event ?
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (82/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
228
        lalt (bool): True when left alt is held.
229
        lctrl (bool): True when left control is held.
230
        lmeta (bool): True when left meta key is held.
231
        ralt (bool): True when right alt is held.
232
        rctrl (bool): True when right control is held.
233
        rmeta (bool): True when right meta key is held.
234
        shift (bool): True when any shift is held.
235
    """
236
237
    _BOOL_ATTRIBUTES = ('lalt', 'lctrl', 'lmeta',
238
                        'ralt', 'rctrl', 'rmeta', 'pressed', 'shift')
239
240
    def __init__(self, *args, **kargs):
241
        super(Key, self).__init__(*args, **kargs)
242
        if self.cdata == ffi.NULL:
243
            self.cdata = ffi.new('TCOD_key_t*')
244
245
    def __getattr__(self, attr):
246
        if attr in self._BOOL_ATTRIBUTES:
247
            return bool(getattr(self.cdata, attr))
248
        if attr == 'c':
249
            return ord(getattr(self.cdata, attr))
250
        if attr == 'text':
251
            return _unpack_char_p(getattr(self.cdata, attr))
252
        return super(Key, self).__getattr__(attr)
253
254
    def __repr__(self):
255
        """Return a representation of this Key object."""
256
        params = []
257
        params.append('vk=%r, c=%r, text=%r, pressed=%r' %
258
                      (self.vk, self.c, self.text, self.pressed))
259
        for attr in ['shift', 'lalt', 'lctrl', 'lmeta',
260
                     'ralt', 'rctrl', 'rmeta']:
261
            if getattr(self, attr):
262
                params.append('%s=%r' % (attr, getattr(self, attr)))
263
        return ('%s(%s)' % (self.__class__.__name__, ', '.join(params)))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after return.
Loading history...
264
265
266
class Mouse(_CDataWrapper):
267
    """Mouse event instance
268
269
    Attributes:
270
        x (int): Absolute mouse position at pixel x.
271
        y (int):
272
        dx (int): Movement since last update in pixels.
273
        dy (int):
274
        cx (int): Cell coordinates in the root console.
275
        cy (int):
276
        dcx (int): Movement since last update in console cells.
277
        dcy (int):
278
        lbutton (bool): Left button status.
279
        rbutton (bool): Right button status.
280
        mbutton (bool): Middle button status.
281
        lbutton_pressed (bool): Left button pressed event.
282
        rbutton_pressed (bool): Right button pressed event.
283
        mbutton_pressed (bool): Middle button pressed event.
284
        wheel_up (bool): Wheel up event.
285
        wheel_down (bool): Wheel down event.
286
    """
287
288
    def __init__(self, *args, **kargs):
289
        super(Mouse, self).__init__(*args, **kargs)
290
        if self.cdata == ffi.NULL:
291
            self.cdata = ffi.new('TCOD_mouse_t*')
292
293
    def __repr__(self):
294
        """Return a representation of this Mouse object."""
295
        params = []
296
        for attr in ['x', 'y', 'dx', 'dy', 'cx', 'cy', 'dcx', 'dcy']:
297
            if getattr(self, attr) == 0:
298
                continue
299
            params.append('%s=%r' % (attr, getattr(self, attr)))
300
        for attr in ['lbutton', 'rbutton', 'mbutton',
301
                     'lbutton_pressed', 'rbutton_pressed', 'mbutton_pressed',
302
                     'wheel_up', 'wheel_down']:
303
            if getattr(self, attr):
304
                params.append('%s=%r' % (attr, getattr(self, attr)))
305
        return ('%s(%s)' % (self.__class__.__name__, ', '.join(params)))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after return.
Loading history...
306
307
308
def bsp_new_with_size(x, y, w, h):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
309
    """Create a new BSP instance with the given rectangle.
310
311
    Args:
312
        x (int): Rectangle left coordinate.
313
        y (int): Rectangle top coordinate.
314
        w (int): Rectangle width.
315
        h (int): Rectangle height.
316
317
    Returns:
318
        BSP: A new BSP instance.
319
320
    .. deprecated:: 2.0
321
       Call the :any:`BSP` class instead.
322
    """
323
    return Bsp(x, y, w, h)
324
325
def bsp_split_once(node, horizontal, position):
326
    """
327
    .. deprecated:: 2.0
328
       Use :any:`BSP.split_once` instead.
329
    """
330
    node.split_once(horizontal, position)
331
332
def bsp_split_recursive(node, randomizer, nb, minHSize, minVSize, maxHRatio,
0 ignored issues
show
Coding Style Naming introduced by
The name nb does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name minHSize does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name minVSize does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name maxHRatio does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name maxVRatio does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
333
                        maxVRatio):
334
    """
335
    .. deprecated:: 2.0
336
       Use :any:`BSP.split_recursive` instead.
337
    """
338
    node.split_recursive(nb, minHSize, minVSize,
339
                         maxHRatio, maxVRatio, randomizer)
340
341
def bsp_resize(node, x, y, w, h):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
342
    """
343
    .. deprecated:: 2.0
344
        Assign directly to :any:`BSP` attributes instead.
345
    """
346
    node.x = x
347
    node.y = y
348
    node.width = w
349
    node.height = h
350
351
def bsp_left(node):
352
    """
353
    .. deprecated:: 2.0
354
       Use :any:`BSP.children` instead.
355
    """
356
    return None if not node.children else node.children[0]
357
358
def bsp_right(node):
359
    """
360
    .. deprecated:: 2.0
361
       Use :any:`BSP.children` instead.
362
    """
363
    return None if not node.children else node.children[1]
364
365
def bsp_father(node):
366
    """
367
    .. deprecated:: 2.0
368
       Use :any:`BSP.parent` instead.
369
    """
370
    return node.parent
371
372
def bsp_is_leaf(node):
373
    """
374
    .. deprecated:: 2.0
375
       Use :any:`BSP.children` instead.
376
    """
377
    return not node.children
378
379
def bsp_contains(node, cx, cy):
0 ignored issues
show
Coding Style Naming introduced by
The name cx does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name cy does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
380
    """
381
    .. deprecated:: 2.0
382
       Use :any:`BSP.contains` instead.
383
    """
384
    return node.contains(cx, cy)
385
386
def bsp_find_node(node, cx, cy):
0 ignored issues
show
Coding Style Naming introduced by
The name cx does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name cy does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
387
    """
388
    .. deprecated:: 2.0
389
       Use :any:`BSP.find_node` instead.
390
    """
391
    return node.find_node(cx, cy)
392
393
def _bsp_traverse(node_iter, callback, userData):
0 ignored issues
show
Coding Style Naming introduced by
The name userData does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
394
    """pack callback into a handle for use with the callback
395
    _pycall_bsp_callback
396
    """
397
    for node in node_iter:
398
        callback(node, userData)
399
400
def bsp_traverse_pre_order(node, callback, userData=0):
0 ignored issues
show
Coding Style Naming introduced by
The name userData does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
401
    """Traverse this nodes hierarchy with a callback.
402
403
    .. deprecated:: 2.0
404
       Use :any:`BSP.walk` instead.
405
    """
406
    _bsp_traverse(node._iter_pre_order(), callback, userData)
407
408
def bsp_traverse_in_order(node, callback, userData=0):
0 ignored issues
show
Coding Style Naming introduced by
The name userData does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
409
    """Traverse this nodes hierarchy with a callback.
410
411
    .. deprecated:: 2.0
412
       Use :any:`BSP.walk` instead.
413
    """
414
    _bsp_traverse(node._iter_in_order(), callback, userData)
415
416
def bsp_traverse_post_order(node, callback, userData=0):
0 ignored issues
show
Coding Style Naming introduced by
The name userData does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
417
    """Traverse this nodes hierarchy with a callback.
418
419
    .. deprecated:: 2.0
420
       Use :any:`BSP.walk` instead.
421
    """
422
    _bsp_traverse(node._iter_post_order(), callback, userData)
423
424
def bsp_traverse_level_order(node, callback, userData=0):
0 ignored issues
show
Coding Style Naming introduced by
The name userData does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
425
    """Traverse this nodes hierarchy with a callback.
426
427
    .. deprecated:: 2.0
428
       Use :any:`BSP.walk` instead.
429
    """
430
    _bsp_traverse(node._iter_level_order(), callback, userData)
431
432
def bsp_traverse_inverted_level_order(node, callback, userData=0):
0 ignored issues
show
Coding Style Naming introduced by
The name bsp_traverse_inverted_level_order does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name userData does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
433
    """Traverse this nodes hierarchy with a callback.
434
435
    .. deprecated:: 2.0
436
       Use :any:`BSP.walk` instead.
437
    """
438
    _bsp_traverse(node._iter_inverted_level_order(), callback, userData)
439
440
def bsp_remove_sons(node):
441
    """Delete all children of a given node.  Not recommended.
442
443
    .. note::
444
       This function will add unnecessary complexity to your code.
445
       Don't use it.
446
447
    .. deprecated:: 2.0
448
       BSP deletion is automatic.
449
    """
450
    node.children = ()
451
452
def bsp_delete(node):
0 ignored issues
show
Unused Code introduced by
The argument node seems to be unused.
Loading history...
453
    """Exists for backward compatibility.  Does nothing.
454
455
    BSP's created by this library are automatically garbage collected once
456
    there are no references to the tree.
457
    This function exists for backwards compatibility.
458
459
    .. deprecated:: 2.0
460
       BSP deletion is automatic.
461
    """
462
    pass
463
464
def color_lerp(c1, c2, a):
0 ignored issues
show
Coding Style Naming introduced by
The name c1 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name c2 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name a does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
465
    """Return the linear interpolation between two colors.
466
467
    ``a`` is the interpolation value, with 0 returing ``c1``,
468
    1 returning ``c2``, and 0.5 returing a color halfway between both.
469
470
    Args:
471
        c1 (Union[Tuple[int, int, int], Sequence[int]]):
472
            The first color.  At a=0.
473
        c2 (Union[Tuple[int, int, int], Sequence[int]]):
474
            The second color.  At a=1.
475
        a (float): The interpolation value,
476
477
    Returns:
478
        Color: The interpolated Color.
479
    """
480
    return Color._new_from_cdata(lib.TCOD_color_lerp(c1, c2, a))
481
482
def color_set_hsv(c, h, s, v):
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name s does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name v does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
483
    """Set a color using: hue, saturation, and value parameters.
484
485
    Does not return a new Color.  ``c`` is modified inplace.
486
487
    Args:
488
        c (Union[Color, List[Any]]): A Color instance, or a list of any kind.
489
        h (float): Hue, from 0 to 360.
490
        s (float): Saturation, from 0 to 1.
491
        v (float): Value, from 0 to 1.
492
    """
493
    new_color = ffi.new('TCOD_color_t*')
494
    lib.TCOD_color_set_HSV(new_color, h, s, v)
495
    c[:] = new_color.r, new_color.g, new_color.b
496
497
def color_get_hsv(c):
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
498
    """Return the (hue, saturation, value) of a color.
499
500
    Args:
501
        c (Union[Tuple[int, int, int], Sequence[int]]):
502
            An (r, g, b) sequence or Color instance.
503
504
    Returns:
505
        Tuple[float, float, float]:
506
            A tuple with (hue, saturation, value) values, from 0 to 1.
507
    """
508
    hsv = ffi.new('float [3]')
509
    lib.TCOD_color_get_HSV(c, hsv, hsv + 1, hsv + 2)
510
    return hsv[0], hsv[1], hsv[2]
511
512
def color_scale_HSV(c, scoef, vcoef):
0 ignored issues
show
Coding Style Naming introduced by
The name color_scale_HSV does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name c does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
513
    """Scale a color's saturation and value.
514
515
    Does not return a new Color.  ``c`` is modified inplace.
516
517
    Args:
518
        c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list.
519
        scoef (float): Saturation multiplier, from 0 to 1.
520
                       Use 1 to keep current saturation.
521
        vcoef (float): Value multiplier, from 0 to 1.
522
                       Use 1 to keep current value.
523
    """
524
    color_p = ffi.new('TCOD_color_t*')
525
    color_p.r, color_p.g, color_p.b = c.r, c.g, c.b
526
    lib.TCOD_color_scale_HSV(color_p, scoef, vcoef)
527
    c[:] = color_p.r, color_p.g, color_p.b
528
529
def color_gen_map(colors, indexes):
530
    """Return a smoothly defined scale of colors.
531
532
    If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
533
    will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
534
    All in-betweens will be filled with a gradient.
535
536
    Args:
537
        colors (Iterable[Union[Tuple[int, int, int], Sequence[int]]]):
538
            Array of colors to be sampled.
539
        indexes (Iterable[int]): A list of indexes.
540
541
    Returns:
542
        List[Color]: A list of Color instances.
543
544
    Example:
545
        >>> tcod.color_gen_map([(0, 0, 0), (255, 128, 0)], [0, 5])
546
        [Color(0,0,0), Color(51,25,0), Color(102,51,0), Color(153,76,0), \
547
Color(204,102,0), Color(255,128,0)]
548
    """
549
    ccolors = ffi.new('TCOD_color_t[]', colors)
550
    cindexes = ffi.new('int[]', indexes)
551
    cres = ffi.new('TCOD_color_t[]', max(indexes) + 1)
552
    lib.TCOD_color_gen_map(cres, len(colors), ccolors, cindexes)
553
    return [Color._new_from_cdata(cdata) for cdata in cres]
554
555
556
def console_init_root(w, h, title, fullscreen=False,
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
557
                      renderer=RENDERER_SDL):
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'RENDERER_SDL'
Loading history...
558
    """Set up the primary display and return the root console.
559
560
    Args:
561
        w (int): Width in character tiles for the root console.
562
        h (int): Height in character tiles for the root console.
563
        title (AnyStr):
564
            This string will be displayed on the created windows title bar.
565
        renderer: Rendering mode for libtcod to use.
566
567
    Returns:
568
        Console:
569
            Returns a special Console instance representing the root console.
570
    """
571
    lib.TCOD_console_init_root(w, h, _bytes(title), fullscreen, renderer)
572
    return tcod.console.Console._from_cdata(ffi.NULL) # root console is null
573
574
575
def console_set_custom_font(fontFile, flags=FONT_LAYOUT_ASCII_INCOL,
0 ignored issues
show
Coding Style Naming introduced by
The name fontFile does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'FONT_LAYOUT_ASCII_INCOL'
Loading history...
576
                            nb_char_horiz=0, nb_char_vertic=0):
577
    """Load a custom font file.
578
579
    Call this before function before calling :any:`tcod.console_init_root`.
580
581
    Flags can be a mix of the following:
582
583
    * tcod.FONT_LAYOUT_ASCII_INCOL
584
    * tcod.FONT_LAYOUT_ASCII_INROW
585
    * tcod.FONT_TYPE_GREYSCALE
586
    * tcod.FONT_TYPE_GRAYSCALE
587
    * tcod.FONT_LAYOUT_TCOD
588
589
    Args:
590
        fontFile (AnyStr): Path to a font file.
591
        flags (int):
592
        nb_char_horiz (int):
593
        nb_char_vertic (int):
594
    """
595
    lib.TCOD_console_set_custom_font(_bytes(fontFile), flags,
596
                                     nb_char_horiz, nb_char_vertic)
597
598
599
def console_get_width(con):
600
    """Return the width of a console.
601
602
    Args:
603
        con (Console): Any Console instance.
604
605
    Returns:
606
        int: The width of a Console.
607
608
    .. deprecated:: 2.0
609
        Use `Console.get_width` instead.
610
    """
611
    return lib.TCOD_console_get_width(con.console_c if con else ffi.NULL)
612
613
def console_get_height(con):
614
    """Return the height of a console.
615
616
    Args:
617
        con (Console): Any Console instance.
618
619
    Returns:
620
        int: The height of a Console.
621
622
    .. deprecated:: 2.0
623
        Use `Console.get_hright` instead.
624
    """
625
    return lib.TCOD_console_get_height(con.console_c if con else ffi.NULL)
626
627
def console_map_ascii_code_to_font(asciiCode, fontCharX, fontCharY):
0 ignored issues
show
Coding Style Naming introduced by
The name asciiCode does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name fontCharX does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name fontCharY does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
628
    """Set a character code to new coordinates on the tile-set.
629
630
    `asciiCode` must be within the bounds created during the initialization of
631
    the loaded tile-set.  For example, you can't use 255 here unless you have a
632
    256 tile tile-set loaded.  This applies to all functions in this group.
633
634
    Args:
635
        asciiCode (int): The character code to change.
636
        fontCharX (int): The X tile coordinate on the loaded tileset.
637
                         0 is the leftmost tile.
638
        fontCharY (int): The Y tile coordinate on the loaded tileset.
639
                         0 is the topmost tile.
640
    """
641
    lib.TCOD_console_map_ascii_code_to_font(_int(asciiCode), fontCharX,
642
                                                              fontCharY)
643
644
def console_map_ascii_codes_to_font(firstAsciiCode, nbCodes, fontCharX,
0 ignored issues
show
Coding Style Naming introduced by
The name firstAsciiCode does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name nbCodes does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name fontCharX does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name fontCharY does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
645
                                    fontCharY):
646
    """Remap a contiguous set of codes to a contiguous set of tiles.
647
648
    Both the tile-set and character codes must be contiguous to use this
649
    function.  If this is not the case you may want to use
650
    :any:`console_map_ascii_code_to_font`.
651
652
    Args:
653
        firstAsciiCode (int): The starting character code.
654
        nbCodes (int): The length of the contiguous set.
655
        fontCharX (int): The starting X tile coordinate on the loaded tileset.
656
                         0 is the leftmost tile.
657
        fontCharY (int): The starting Y tile coordinate on the loaded tileset.
658
                         0 is the topmost tile.
659
660
    """
661
    lib.TCOD_console_map_ascii_codes_to_font(_int(firstAsciiCode), nbCodes,
662
                                              fontCharX, fontCharY)
663
664
def console_map_string_to_font(s, fontCharX, fontCharY):
0 ignored issues
show
Coding Style Naming introduced by
The name s does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name fontCharX does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name fontCharY does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
665
    """Remap a string of codes to a contiguous set of tiles.
666
667
    Args:
668
        s (AnyStr): A string of character codes to map to new values.
669
                    The null character `'\x00'` will prematurely end this
670
                    function.
671
        fontCharX (int): The starting X tile coordinate on the loaded tileset.
672
                         0 is the leftmost tile.
673
        fontCharY (int): The starting Y tile coordinate on the loaded tileset.
674
                         0 is the topmost tile.
675
    """
676
    lib.TCOD_console_map_string_to_font_utf(_unicode(s), fontCharX, fontCharY)
677
678
def console_is_fullscreen():
679
    """Returns True if the display is fullscreen.
680
681
    Returns:
682
        bool: True if the display is fullscreen, otherwise False.
683
    """
684
    return bool(lib.TCOD_console_is_fullscreen())
685
686
def console_set_fullscreen(fullscreen):
687
    """Change the display to be fullscreen or windowed.
688
689
    Args:
690
        fullscreen (bool): Use True to change to fullscreen.
691
                           Use False to change to windowed.
692
    """
693
    lib.TCOD_console_set_fullscreen(fullscreen)
694
695
def console_is_window_closed():
696
    """Returns True if the window has received and exit event."""
697
    return lib.TCOD_console_is_window_closed()
698
699
def console_set_window_title(title):
700
    """Change the current title bar string.
701
702
    Args:
703
        title (AnyStr): A string to change the title bar to.
704
    """
705
    lib.TCOD_console_set_window_title(_bytes(title))
706
707
def console_credits():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
708
    lib.TCOD_console_credits()
709
710
def console_credits_reset():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
711
    lib.TCOD_console_credits_reset()
712
713
def console_credits_render(x, y, alpha):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
714
    return lib.TCOD_console_credits_render(x, y, alpha)
715
716
def console_flush():
717
    """Update the display to represent the root consoles current state."""
718
    lib.TCOD_console_flush()
719
720
# drawing on a console
721
def console_set_default_background(con, col):
722
    """Change the default background color for a console.
723
724
    Args:
725
        con (Console): Any Console instance.
726
        col (Union[Tuple[int, int, int], Sequence[int]]):
727
            An (r, g, b) sequence or Color instance.
728
    """
729
    lib.TCOD_console_set_default_background(
730
        con.console_c if con else ffi.NULL, col)
731
732
def console_set_default_foreground(con, col):
733
    """Change the default foreground color for a console.
734
735
    Args:
736
        con (Console): Any Console instance.
737
        col (Union[Tuple[int, int, int], Sequence[int]]):
738
            An (r, g, b) sequence or Color instance.
739
    """
740
    lib.TCOD_console_set_default_foreground(
741
        con.console_c if con else ffi.NULL, col)
742
743
def console_clear(con):
744
    """Reset a console to its default colors and the space character.
745
746
    Args:
747
        con (Console): Any Console instance.
748
749
    .. seealso::
750
       :any:`console_set_default_background`
751
       :any:`console_set_default_foreground`
752
    """
753
    return lib.TCOD_console_clear(con.console_c if con else ffi.NULL)
754
755
def console_put_char(con, x, y, c, flag=BKGND_DEFAULT):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name c does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'BKGND_DEFAULT'
Loading history...
756
    """Draw the character c at x,y using the default colors and a blend mode.
757
758
    Args:
759
        con (Console): Any Console instance.
760
        x (int): Character x position from the left.
761
        y (int): Character y position from the top.
762
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
763
        flag (int): Blending mode to use, defaults to BKGND_DEFAULT.
764
    """
765
    lib.TCOD_console_put_char(
766
        con.console_c if con else ffi.NULL, x, y, _int(c), flag)
767
768
def console_put_char_ex(con, x, y, c, fore, back):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name c does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
769
    """Draw the character c at x,y using the colors fore and back.
770
771
    Args:
772
        con (Console): Any Console instance.
773
        x (int): Character x position from the left.
774
        y (int): Character y position from the top.
775
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
776
        fore (Union[Tuple[int, int, int], Sequence[int]]):
777
            An (r, g, b) sequence or Color instance.
778
        back (Union[Tuple[int, int, int], Sequence[int]]):
779
            An (r, g, b) sequence or Color instance.
780
    """
781
    lib.TCOD_console_put_char_ex(con.console_c if con else ffi.NULL, x, y,
782
                                 _int(c), fore, back)
783
784
def console_set_char_background(con, x, y, col, flag=BKGND_SET):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'BKGND_SET'
Loading history...
785
    """Change the background color of x,y to col using a blend mode.
786
787
    Args:
788
        con (Console): Any Console instance.
789
        x (int): Character x position from the left.
790
        y (int): Character y position from the top.
791
        col (Union[Tuple[int, int, int], Sequence[int]]):
792
            An (r, g, b) sequence or Color instance.
793
        flag (int): Blending mode to use, defaults to BKGND_SET.
794
    """
795
    lib.TCOD_console_set_char_background(
796
        con.console_c if con else ffi.NULL, x, y, col, flag)
797
798
def console_set_char_foreground(con, x, y, col):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
799
    """Change the foreground color of x,y to col.
800
801
    Args:
802
        con (Console): Any Console instance.
803
        x (int): Character x position from the left.
804
        y (int): Character y position from the top.
805
        col (Union[Tuple[int, int, int], Sequence[int]]):
806
            An (r, g, b) sequence or Color instance.
807
    """
808
    lib.TCOD_console_set_char_foreground(
809
        con.console_c if con else ffi.NULL, x, y, col)
810
811
def console_set_char(con, x, y, c):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name c does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
812
    """Change the character at x,y to c, keeping the current colors.
813
814
    Args:
815
        con (Console): Any Console instance.
816
        x (int): Character x position from the left.
817
        y (int): Character y position from the top.
818
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
819
    """
820
    lib.TCOD_console_set_char(
821
        con.console_c if con else ffi.NULL, x, y, _int(c))
822
823
def console_set_background_flag(con, flag):
824
    """Change the default blend mode for this console.
825
826
    Args:
827
        con (Console): Any Console instance.
828
        flag (int): Blend mode to use by default.
829
    """
830
    lib.TCOD_console_set_background_flag(
831
        con.console_c if con else ffi.NULL, flag)
832
833
def console_get_background_flag(con):
834
    """Return this consoles current blend mode.
835
836
    Args:
837
        con (Console): Any Console instance.
838
    """
839
    return lib.TCOD_console_get_background_flag(
840
        con.console_c if con else ffi.NULL)
841
842
def console_set_alignment(con, alignment):
843
    """Change this consoles current alignment mode.
844
845
    * tcod.LEFT
846
    * tcod.CENTER
847
    * tcod.RIGHT
848
849
    Args:
850
        con (Console): Any Console instance.
851
        alignment (int):
852
    """
853
    lib.TCOD_console_set_alignment(
854
        con.console_c if con else ffi.NULL, alignment)
855
856
def console_get_alignment(con):
857
    """Return this consoles current alignment mode.
858
859
    Args:
860
        con (Console): Any Console instance.
861
    """
862
    return lib.TCOD_console_get_alignment(con.console_c if con else ffi.NULL)
863
864
def console_print(con, x, y, fmt):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
865
    """Print a color formatted string on a console.
866
867
    Args:
868
        con (Console): Any Console instance.
869
        x (int): Character x position from the left.
870
        y (int): Character y position from the top.
871
        fmt (AnyStr): A unicode or bytes string optionaly using color codes.
872
    """
873
    lib.TCOD_console_print_utf(
874
        con.console_c if con else ffi.NULL, x, y, _fmt_unicode(fmt))
875
876
def console_print_ex(con, x, y, flag, alignment, fmt):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
877
    """Print a string on a console using a blend mode and alignment mode.
878
879
    Args:
880
        con (Console): Any Console instance.
881
        x (int): Character x position from the left.
882
        y (int): Character y position from the top.
883
    """
884
    lib.TCOD_console_print_ex_utf(con.console_c if con else ffi.NULL,
885
                                  x, y, flag, alignment, _fmt_unicode(fmt))
886
887
def console_print_rect(con, x, y, w, h, fmt):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
888
    """Print a string constrained to a rectangle.
889
890
    If h > 0 and the bottom of the rectangle is reached,
891
    the string is truncated. If h = 0,
892
    the string is only truncated if it reaches the bottom of the console.
893
894
895
896
    Returns:
897
        int: The number of lines of text once word-wrapped.
898
    """
899
    return lib.TCOD_console_print_rect_utf(
900
        con.console_c if con else ffi.NULL, x, y, w, h, _fmt_unicode(fmt))
901
902
def console_print_rect_ex(con, x, y, w, h, flag, alignment, fmt):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
903
    """Print a string constrained to a rectangle with blend and alignment.
904
905
    Returns:
906
        int: The number of lines of text once word-wrapped.
907
    """
908
    return lib.TCOD_console_print_rect_ex_utf(
909
        con.console_c if con else ffi.NULL,
910
        x, y, w, h, flag, alignment, _fmt_unicode(fmt))
911
912
def console_get_height_rect(con, x, y, w, h, fmt):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
913
    """Return the height of this text once word-wrapped into this rectangle.
914
915
    Returns:
916
        int: The number of lines of text once word-wrapped.
917
    """
918
    return lib.TCOD_console_get_height_rect_utf(
919
        con.console_c if con else ffi.NULL, x, y, w, h, _fmt_unicode(fmt))
920
921
def console_rect(con, x, y, w, h, clr, flag=BKGND_DEFAULT):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'BKGND_DEFAULT'
Loading history...
922
    """Draw a the background color on a rect optionally clearing the text.
923
924
    If clr is True the affected tiles are changed to space character.
925
    """
926
    lib.TCOD_console_rect(
927
        con.console_c if con else ffi.NULL, x, y, w, h, clr, flag)
928
929
def console_hline(con, x, y, l, flag=BKGND_DEFAULT):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name l does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'BKGND_DEFAULT'
Loading history...
930
    """Draw a horizontal line on the console.
931
932
    This always uses the character 196, the horizontal line character.
933
    """
934
    lib.TCOD_console_hline(con.console_c if con else ffi.NULL, x, y, l, flag)
935
936
def console_vline(con, x, y, l, flag=BKGND_DEFAULT):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name l does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'BKGND_DEFAULT'
Loading history...
937
    """Draw a vertical line on the console.
938
939
    This always uses the character 179, the vertical line character.
940
    """
941
    lib.TCOD_console_vline(con.console_c if con else ffi.NULL, x, y, l, flag)
942
943
def console_print_frame(con, x, y, w, h, clear=True, flag=BKGND_DEFAULT, fmt=b''):
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (82/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'BKGND_DEFAULT'
Loading history...
944
    """Draw a framed rectangle with optinal text.
945
946
    This uses the default background color and blend mode to fill the
947
    rectangle and the default foreground to draw the outline.
948
949
    fmt will be printed on the inside of the rectangle, word-wrapped.
950
    """
951
    lib.TCOD_console_print_frame(
952
        con.console_c if con else ffi.NULL,
953
        x, y, w, h, clear, flag, _fmt_bytes(fmt))
954
955
def console_set_color_control(con, fore, back):
956
    """Configure :any:`color controls`.
957
958
    Args:
959
        con (int): :any:`Color control` constant to modify.
960
        fore (Union[Tuple[int, int, int], Sequence[int]]):
961
            An (r, g, b) sequence or Color instance.
962
        back (Union[Tuple[int, int, int], Sequence[int]]):
963
            An (r, g, b) sequence or Color instance.
964
    """
965
    lib.TCOD_console_set_color_control(con, fore, back)
966
967
def console_get_default_background(con):
968
    """Return this consoles default background color."""
969
    return Color._new_from_cdata(
970
        lib.TCOD_console_get_default_background(
971
            con.console_c if con else ffi.NULL))
972
973
def console_get_default_foreground(con):
974
    """Return this consoles default foreground color."""
975
    return Color._new_from_cdata(
976
        lib.TCOD_console_get_default_foreground(
977
            con.console_c if con else ffi.NULL))
978
979
def console_get_char_background(con, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
980
    """Return the background color at the x,y of this console."""
981
    return Color._new_from_cdata(
982
        lib.TCOD_console_get_char_background(
983
            con.console_c if con else ffi.NULL, x, y))
984
985
def console_get_char_foreground(con, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
986
    """Return the foreground color at the x,y of this console."""
987
    return Color._new_from_cdata(
988
        lib.TCOD_console_get_char_foreground(
989
            con.console_c if con else ffi.NULL, x, y))
990
991
def console_get_char(con, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
992
    """Return the character at the x,y of this console."""
993
    return lib.TCOD_console_get_char(con.console_c if con else ffi.NULL, x, y)
994
995
def console_set_fade(fade, fadingColor):
0 ignored issues
show
Coding Style Naming introduced by
The name fadingColor does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
996
    lib.TCOD_console_set_fade(fade, fadingColor)
997
998
def console_get_fade():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
999
    return lib.TCOD_console_get_fade()
1000
1001
def console_get_fading_color():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1002
    return Color._new_from_cdata(lib.TCOD_console_get_fading_color())
1003
1004
# handling keyboard input
1005
def console_wait_for_keypress(flush):
1006
    """Block until the user presses a key, then returns a new Key.
1007
1008
    Args:
1009
        flush bool: If True then the event queue is cleared before waiting
1010
                    for the next event.
1011
1012
    Returns:
1013
        Key: A new Key instance.
1014
    """
1015
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
1016
    lib.TCOD_console_wait_for_keypress_wrapper(k.cdata, flush)
1017
    return k
1018
1019
def console_check_for_keypress(flags=KEY_RELEASED):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'KEY_RELEASED'
Loading history...
1020
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
1021
    lib.TCOD_console_check_for_keypress_wrapper(k.cdata, flags)
1022
    return k
1023
1024
def console_is_key_pressed(key):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1025
    return lib.TCOD_console_is_key_pressed(key)
1026
1027
# using offscreen consoles
1028
def console_new(w, h):
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1029
    """Return an offscreen console of size: w,h."""
1030
    return tcod.console.Console(w, h)
1031
1032
def console_from_file(filename):
1033
    """Return a new console object from a filename.
1034
1035
    The file format is automactially determined.  This can load REXPaint `.xp`,
1036
    ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files.
1037
1038
    Args:
1039
        filename (Text): The path to the file, as a string.
1040
1041
    Returns: A new :any`Console` instance.
1042
    """
1043
    return tcod.console.Console._from_cdata(
1044
        lib.TCOD_console_from_file(filename.encode('utf-8')))
1045
1046
def console_blit(src, x, y, w, h, dst, xdst, ydst, ffade=1.0,bfade=1.0):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def console_blit(src, x, y, w, h, dst, xdst, ydst, ffade=1.0,bfade=1.0):
^
Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1047
    """Blit the console src from x,y,w,h to console dst at xdst,ydst."""
1048
    lib.TCOD_console_blit(
1049
        src.console_c if src else ffi.NULL, x, y, w, h,
1050
        dst.console_c if dst else ffi.NULL, xdst, ydst, ffade, bfade)
1051
1052
def console_set_key_color(con, col):
1053
    """Set a consoles blit transparent color."""
1054
    lib.TCOD_console_set_key_color(con.console_c if con else ffi.NULL, col)
1055
    if hasattr(con, 'set_key_color'):
1056
        con.set_key_color(col)
1057
1058
def console_delete(con):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1059
    con = con.console_c if con else ffi.NULL
1060
    if con == ffi.NULL:
1061
        lib.TCOD_console_delete(con)
1062
1063
# fast color filling
1064
def console_fill_foreground(con, r, g, b):
0 ignored issues
show
Coding Style Naming introduced by
The name r does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name g does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name b does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1065
    """Fill the foregound of a console with r,g,b.
1066 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1067
    Args:
1068
        con (Console): Any Console instance.
1069
        r (Sequence[int]): An array of integers with a length of width*height.
1070
        g (Sequence[int]): An array of integers with a length of width*height.
1071
        b (Sequence[int]): An array of integers with a length of width*height.
1072
    """
1073
    if len(r) != len(g) or len(r) != len(b):
1074
        raise TypeError('R, G and B must all have the same size.')
1075
    if (isinstance(r, _np.ndarray) and isinstance(g, _np.ndarray) and
1076
            isinstance(b, _np.ndarray)):
1077
        #numpy arrays, use numpy's ctypes functions
1078
        r = _np.ascontiguousarray(r, dtype=_np.intc)
1079
        g = _np.ascontiguousarray(g, dtype=_np.intc)
1080
        b = _np.ascontiguousarray(b, dtype=_np.intc)
1081
        cr = ffi.cast('int *', r.ctypes.data)
0 ignored issues
show
Coding Style Naming introduced by
The name cr does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1082
        cg = ffi.cast('int *', g.ctypes.data)
0 ignored issues
show
Coding Style Naming introduced by
The name cg does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1083
        cb = ffi.cast('int *', b.ctypes.data)
0 ignored issues
show
Coding Style Naming introduced by
The name cb does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1084
    else:
1085
        # otherwise convert using ffi arrays
1086
        cr = ffi.new('int[]', r)
0 ignored issues
show
Coding Style Naming introduced by
The name cr does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1087
        cg = ffi.new('int[]', g)
0 ignored issues
show
Coding Style Naming introduced by
The name cg does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1088
        cb = ffi.new('int[]', b)
0 ignored issues
show
Coding Style Naming introduced by
The name cb does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1089
1090
    lib.TCOD_console_fill_foreground(con.console_c if con else ffi.NULL,
1091
                                     cr, cg, cb)
1092
1093
def console_fill_background(con, r, g, b):
0 ignored issues
show
Coding Style Naming introduced by
The name r does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name g does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name b does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1094
    """Fill the backgound of a console with r,g,b.
1095 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1096
    Args:
1097
        con (Console): Any Console instance.
1098
        r (Sequence[int]): An array of integers with a length of width*height.
1099
        g (Sequence[int]): An array of integers with a length of width*height.
1100
        b (Sequence[int]): An array of integers with a length of width*height.
1101
    """
1102
    if len(r) != len(g) or len(r) != len(b):
1103
        raise TypeError('R, G and B must all have the same size.')
1104
    if (isinstance(r, _np.ndarray) and isinstance(g, _np.ndarray) and
1105
            isinstance(b, _np.ndarray)):
1106
        #numpy arrays, use numpy's ctypes functions
1107
        r = _np.ascontiguousarray(r, dtype=_np.intc)
1108
        g = _np.ascontiguousarray(g, dtype=_np.intc)
1109
        b = _np.ascontiguousarray(b, dtype=_np.intc)
1110
        cr = ffi.cast('int *', r.ctypes.data)
0 ignored issues
show
Coding Style Naming introduced by
The name cr does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1111
        cg = ffi.cast('int *', g.ctypes.data)
0 ignored issues
show
Coding Style Naming introduced by
The name cg does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1112
        cb = ffi.cast('int *', b.ctypes.data)
0 ignored issues
show
Coding Style Naming introduced by
The name cb does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1113
    else:
1114
        # otherwise convert using ffi arrays
1115
        cr = ffi.new('int[]', r)
0 ignored issues
show
Coding Style Naming introduced by
The name cr does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1116
        cg = ffi.new('int[]', g)
0 ignored issues
show
Coding Style Naming introduced by
The name cg does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1117
        cb = ffi.new('int[]', b)
0 ignored issues
show
Coding Style Naming introduced by
The name cb does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1118
1119
    lib.TCOD_console_fill_background(con.console_c if con else ffi.NULL,
1120
                                     cr, cg, cb)
1121
1122
def console_fill_char(con,arr):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def console_fill_char(con,arr):
^
Loading history...
1123
    """Fill the character tiles of a console with an array.
1124
1125
    Args:
1126
        con (Console): Any Console instance.
1127
        arr (Sequence[int]): An array of integers with a length of width*height.
1128
    """
1129
    if isinstance(arr, _np.ndarray):
1130
        #numpy arrays, use numpy's ctypes functions
1131
        arr = _np.ascontiguousarray(arr, dtype=_np.intc)
1132
        carr = ffi.cast('int *', arr.ctypes.data)
1133
    else:
1134
        #otherwise convert using the ffi module
1135
        carr = ffi.new('int[]', arr)
1136
1137
    lib.TCOD_console_fill_char(con.console_c if con else ffi.NULL, carr)
1138
1139
def console_load_asc(con, filename):
1140
    """Update a console from a non-delimited ASCII `.asc` file."""
1141
    return lib.TCOD_console_load_asc(
1142
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1143
1144
def console_save_asc(con, filename):
1145
    """Save a console to a non-delimited ASCII `.asc` file."""
1146
    return lib.TCOD_console_save_asc(
1147
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1148
1149
def console_load_apf(con, filename):
1150
    """Update a console from an ASCII Paint `.apf` file."""
1151
    return lib.TCOD_console_load_apf(
1152
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1153
1154
def console_save_apf(con, filename):
1155
    """Save a console to an ASCII Paint `.apf` file."""
1156
    return lib.TCOD_console_save_apf(
1157
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1158
1159
def console_load_xp(con, filename):
1160
    """Update a console from a REXPaint `.xp` file."""
1161
    return lib.TCOD_console_load_xp(
1162
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1163
1164
def console_save_xp(con, filename, compress_level=9):
1165
    """Save a console to a REXPaint `.xp` file."""
1166
    return lib.TCOD_console_save_xp(
1167
        con.console_c if con else ffi.NULL,
1168
        filename.encode('utf-8'),
1169
        compress_level,
1170
        )
1171
1172
def console_from_xp(filename):
1173
    """Return a single console from a REXPaint `.xp` file."""
1174
    return tcod.console.Console._from_cdata(
1175
        lib.TCOD_console_from_xp(filename.encode('utf-8')))
1176
1177
def console_list_load_xp(filename):
1178
    """Return a list of consoles from a REXPaint `.xp` file."""
1179
    tcod_list = lib.TCOD_console_list_from_xp(filename.encode('utf-8'))
1180
    if tcod_list == ffi.NULL:
1181
        return None
1182
    try:
1183
        python_list = []
1184
        lib.TCOD_list_reverse(tcod_list)
1185
        while not lib.TCOD_list_is_empty(tcod_list):
1186
            python_list.append(
1187
                tcod.console.Console._from_cdata(lib.TCOD_list_pop(tcod_list)),
1188
                )
1189
        return python_list
1190
    finally:
1191
        lib.TCOD_list_delete(tcod_list)
1192
1193
def console_list_save_xp(console_list, filename, compress_level=9):
1194
    """Save a list of consoles to a REXPaint `.xp` file."""
1195
    tcod_list = lib.TCOD_list_new()
1196
    try:
1197
        for console in console_list:
1198
            lib.TCOD_list_push(tcod_list,
1199
                               console.console_c if console else ffi.NULL)
1200
        return lib.TCOD_console_list_save_xp(
1201
            tcod_list, filename.encode('utf-8'), compress_level
1202
            )
1203
    finally:
1204
        lib.TCOD_list_delete(tcod_list)
1205
1206
def path_new_using_map(m, dcost=1.41):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1207
    """Return a new AStar using the given Map.
1208
1209
    Args:
1210
        m (Map): A Map instance.
1211
        dcost (float): The path-finding cost of diagonal movement.
1212
                       Can be set to 0 to disable diagonal movement.
1213
    Returns:
1214
        AStar: A new AStar instance.
1215
    """
1216
    return tcod.path.AStar(m, dcost)
1217
1218
def path_new_using_function(w, h, func, userData=0, dcost=1.41):
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name userData does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1219
    """Return a new AStar using the given callable function.
1220
1221
    Args:
1222
        w (int): Clipping width.
1223
        h (int): Clipping height.
1224
        func (Callable[[int, int, int, int, Any], float]):
1225
        userData (Any):
1226
        dcost (float): A multiplier for the cost of diagonal movement.
1227
                       Can be set to 0 to disable diagonal movement.
1228
    Returns:
1229
        AStar: A new AStar instance.
1230
    """
1231
    return tcod.path.AStar(
1232
        tcod.path._EdgeCostFunc((func, userData), w, h),
1233
        dcost,
1234
        )
1235
1236
def path_compute(p, ox, oy, dx, dy):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ox does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name oy does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name dx does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name dy does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1237
    """Find a path from (ox, oy) to (dx, dy).  Return True if path is found.
1238
1239
    Args:
1240
        p (AStar): An AStar instance.
1241
        ox (int): Starting x position.
1242
        oy (int): Starting y position.
1243
        dx (int): Destination x position.
1244
        dy (int): Destination y position.
1245
    Returns:
1246
        bool: True if a valid path was found.  Otherwise False.
1247
    """
1248
    return lib.TCOD_path_compute(p._path_c, ox, oy, dx, dy)
1249
1250
def path_get_origin(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1251
    """Get the current origin position.
1252
1253
    This point moves when :any:`path_walk` returns the next x,y step.
1254
1255
    Args:
1256
        p (AStar): An AStar instance.
1257
    Returns:
1258
        Tuple[int, int]: An (x, y) point.
1259
    """
1260
    x = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1261
    y = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1262
    lib.TCOD_path_get_origin(p._path_c, x, y)
1263
    return x[0], y[0]
1264
1265
def path_get_destination(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1266
    """Get the current destination position.
1267
1268
    Args:
1269
        p (AStar): An AStar instance.
1270
    Returns:
1271
        Tuple[int, int]: An (x, y) point.
1272
    """
1273
    x = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1274
    y = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1275
    lib.TCOD_path_get_destination(p._path_c, x, y)
1276
    return x[0], y[0]
1277
1278
def path_size(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1279
    """Return the current length of the computed path.
1280
1281
    Args:
1282
        p (AStar): An AStar instance.
1283
    Returns:
1284
        int: Length of the path.
1285
    """
1286
    return lib.TCOD_path_size(p._path_c)
1287
1288
def path_reverse(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1289
    """Reverse the direction of a path.
1290
1291
    This effectively swaps the origin and destination points.
1292
1293
    Args:
1294
        p (AStar): An AStar instance.
1295
    """
1296
    lib.TCOD_path_reverse(p._path_c)
1297
1298
def path_get(p, idx):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1299
    """Get a point on a path.
1300
1301
    Args:
1302
        p (AStar): An AStar instance.
1303
        idx (int): Should be in range: 0 <= inx < :any:`path_size`
1304
    """
1305
    x = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1306
    y = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1307
    lib.TCOD_path_get(p._path_c, idx, x, y)
1308
    return x[0], y[0]
1309
1310
def path_is_empty(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1311
    """Return True if a path is empty.
1312
1313
    Args:
1314
        p (AStar): An AStar instance.
1315
    Returns:
1316
        bool: True if a path is empty.  Otherwise False.
1317
    """
1318
    return lib.TCOD_path_is_empty(p._path_c)
1319
1320
def path_walk(p, recompute):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1321
    """Return the next (x, y) point in a path, or (None, None) if it's empty.
1322
1323
    When ``recompute`` is True and a previously valid path reaches a point
1324
    where it is now blocked, a new path will automatically be found.
1325
1326
    Args:
1327
        p (AStar): An AStar instance.
1328
        recompute (bool): Recompute the path automatically.
1329
    Returns:
1330
        Union[Tuple[int, int], Tuple[None, None]]:
1331
            A single (x, y) point, or (None, None)
1332
    """
1333
    x = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1334
    y = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1335
    if lib.TCOD_path_walk(p._path_c, x, y, recompute):
1336
        return x[0], y[0]
1337
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1338
1339
def path_delete(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Unused Code introduced by
The argument p seems to be unused.
Loading history...
1340
    """Does nothing."""
1341
    pass
1342
1343
def dijkstra_new(m, dcost=1.41):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1344
    return tcod.path.Dijkstra(m, dcost)
1345
1346
def dijkstra_new_using_function(w, h, func, userData=0, dcost=1.41):
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name userData does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1347
    return tcod.path.Dijkstra(
1348
        tcod.path._EdgeCostFunc((func, userData), w, h),
1349
        dcost,
1350
        )
1351
1352
def dijkstra_compute(p, ox, oy):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ox does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name oy does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1353
    lib.TCOD_dijkstra_compute(p._path_c, ox, oy)
1354
1355
def dijkstra_path_set(p, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1356
    return lib.TCOD_dijkstra_path_set(p._path_c, x, y)
1357
1358
def dijkstra_get_distance(p, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1359
    return lib.TCOD_dijkstra_get_distance(p._path_c, x, y)
1360
1361
def dijkstra_size(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1362
    return lib.TCOD_dijkstra_size(p._path_c)
1363
1364
def dijkstra_reverse(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1365
    lib.TCOD_dijkstra_reverse(p._path_c)
1366
1367
def dijkstra_get(p, idx):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1368
    x = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1369
    y = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1370
    lib.TCOD_dijkstra_get(p._path_c, idx, x, y)
1371
    return x[0], y[0]
1372
1373
def dijkstra_is_empty(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1374
    return lib.TCOD_dijkstra_is_empty(p._path_c)
1375
1376
def dijkstra_path_walk(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1377
    x = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1378
    y = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1379
    if lib.TCOD_dijkstra_path_walk(p._path_c, x, y):
1380
        return x[0], y[0]
1381
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1382
1383
def dijkstra_delete(p):
0 ignored issues
show
Coding Style Naming introduced by
The name p does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The argument p seems to be unused.
Loading history...
1384
    pass
1385
1386
def _heightmap_cdata(array):
1387
    """Return a new TCOD_heightmap_t instance using an array.
1388
1389
    Formatting is verified during this function.
1390
    """
1391
    if not array.flags['C_CONTIGUOUS']:
1392
        raise ValueError('array must be a C-style contiguous segment.')
1393
    if array.dtype != _np.float32:
1394
        raise ValueError('array dtype must be float32, not %r' % array.dtype)
1395
    width, height = array.shape
1396
    pointer = ffi.cast('float *', array.ctypes.data)
1397
    return ffi.new('TCOD_heightmap_t *', (width, height, pointer))
1398
1399
def heightmap_new(w, h):
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1400
    """Return a new numpy.ndarray formatted for use with heightmap functions.
1401
1402
    You can pass a numpy array to any heightmap function as long as all the
1403
    following are true::
1404
    * The array is 2 dimentional.
1405
    * The array has the C_CONTIGUOUS flag.
1406
    * The array's dtype is :any:`dtype.float32`.
1407
1408
    Args:
1409
        w (int): The width of the new HeightMap.
1410
        h (int): The height of the new HeightMap.
1411
1412
    Returns:
1413
        numpy.ndarray: A C-contiguous mapping of float32 values.
1414
    """
1415
    return _np.ndarray((h, w), _np.float32)
1416
1417
def heightmap_set_value(hm, x, y, value):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1418
    """Set the value of a point on a heightmap.
1419
1420
    Args:
1421
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1422
        x (int): The x position to change.
1423
        y (int): The y position to change.
1424
        value (float): The value to set.
1425
1426
    .. deprecated:: 2.0
1427
        Do ``hm[y, x] = value`` instead.
1428
    """
1429
    hm[y, x] = value
1430
1431
def heightmap_add(hm, value):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1432
    """Add value to all values on this heightmap.
1433
1434
    Args:
1435
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1436
        value (float): A number to add to this heightmap.
1437
1438
    .. deprecated:: 2.0
1439
        Do ``hm[:] += value`` instead.
1440
    """
1441
    hm[:] += value
1442
1443
def heightmap_scale(hm, value):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1444
    """Multiply all items on this heightmap by value.
1445
1446
    Args:
1447
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1448
        value (float): A number to scale this heightmap by.
1449
1450
    .. deprecated:: 2.0
1451
        Do ``hm[:] *= value`` instead.
1452
    """
1453
    hm[:] *= value
1454
1455
def heightmap_clear(hm):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1456
    """Add value to all values on this heightmap.
1457
1458
    Args:
1459
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1460
1461
    .. deprecated:: 2.0
1462
        Do ``hm.array[:] = 0`` instead.
1463
    """
1464
    hm[:] = 0
1465
1466
def heightmap_clamp(hm, mi, ma):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1467
    """Clamp all values on this heightmap between ``mi`` and ``ma``
1468
1469
    Args:
1470
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1471
        mi (float): The lower bound to clamp to.
1472
        ma (float): The upper bound to clamp to.
1473
1474
    .. deprecated:: 2.0
1475
        Do ``hm.clip(mi, ma)`` instead.
1476
    """
1477
    hm.clip(mi, ma)
1478
1479
def heightmap_copy(hm1, hm2):
1480
    """Copy the heightmap ``hm1`` to ``hm2``.
1481
1482
    Args:
1483
        hm1 (numpy.ndarray): The source heightmap.
1484
        hm2 (numpy.ndarray): The destination heightmap.
1485
1486
    .. deprecated:: 2.0
1487
        Do ``hm2[:] = hm1[:]`` instead.
1488
    """
1489
    hm2[:] = hm1[:]
1490
1491
def heightmap_normalize(hm,  mi=0.0, ma=1.0):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def heightmap_normalize(hm, mi=0.0, ma=1.0):
^
Loading history...
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1492
    """Normalize heightmap values between ``mi`` and ``ma``.
1493
1494
    Args:
1495
        mi (float): The lowest value after normalization.
1496
        ma (float): The highest value after normalization.
1497
    """
1498
    lib.TCOD_heightmap_normalize(_heightmap_cdata(hm), mi, ma)
1499
1500
def heightmap_lerp_hm(hm1, hm2, hm3, coef):
1501
    """Perform linear interpolation between two heightmaps storing the result
1502
    in ``hm3``.
1503
1504
    This is the same as doing ``hm3[:] = hm1[:] + (hm2[:] - hm1[:]) * coef``
1505
1506
    Args:
1507
        hm1 (numpy.ndarray): The first heightmap.
1508
        hm2 (numpy.ndarray): The second heightmap to add to the first.
1509
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1510
        coef (float): The linear interpolation coefficient.
1511
    """
1512
    lib.TCOD_heightmap_lerp_hm(_heightmap_cdata(hm1), _heightmap_cdata(hm2),
1513
                               _heightmap_cdata(hm3), coef)
1514
1515
def heightmap_add_hm(hm1, hm2, hm3):
1516
    """Add two heightmaps together and stores the result in ``hm3``.
1517
1518
    Args:
1519
        hm1 (numpy.ndarray): The first heightmap.
1520
        hm2 (numpy.ndarray): The second heightmap to add to the first.
1521
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1522
1523
    .. deprecated:: 2.0
1524
        Do ``hm3[:] = hm1[:] + hm2[:]`` instead.
1525
    """
1526
    hm3[:] = hm1[:] + hm2[:]
1527
1528
def heightmap_multiply_hm(hm1, hm2, hm3):
1529
    """Multiplies two heightmap's together and stores the result in ``hm3``.
1530
1531
    Args:
1532
        hm1 (numpy.ndarray): The first heightmap.
1533
        hm2 (numpy.ndarray): The second heightmap to multiply with the first.
1534
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1535
1536
    .. deprecated:: 2.0
1537
        Do ``hm3[:] = hm1[:] * hm2[:]`` instead.
1538
        Alternatively you can do ``HeightMap(hm1.array[:] * hm2.array[:])``.
1539
    """
1540
    hm3[:] = hm1[:] * hm2[:]
1541
1542
def heightmap_add_hill(hm, x, y, radius, height):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1543
    """Add a hill (a half spheroid) at given position.
1544
1545
    If height == radius or -radius, the hill is a half-sphere.
1546
1547
    Args:
1548
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1549
        x (float): The x position at the center of the new hill.
1550
        y (float): The y position at the center of the new hill.
1551
        radius (float): The size of the new hill.
1552
        height (float): The height or depth of the new hill.
1553
    """
1554
    lib.TCOD_heightmap_add_hill(_heightmap_cdata(hm), x, y, radius, height)
1555
1556
def heightmap_dig_hill(hm, x, y, radius, height):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1557
    """
1558
1559
    This function takes the highest value (if height > 0) or the lowest
1560
    (if height < 0) between the map and the hill.
1561
1562
    It's main goal is to carve things in maps (like rivers) by digging hills along a curve.
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (91/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
1563
1564
    Args:
1565
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1566
        x (float): The x position at the center of the new carving.
1567
        y (float): The y position at the center of the new carving.
1568
        radius (float): The size of the carving.
1569
        height (float): The height or depth of the hill to dig out.
1570
    """
1571
    lib.TCOD_heightmap_dig_hill(_heightmap_cdata(hm), x, y, radius, height)
1572
1573
def heightmap_rain_erosion(hm, nbDrops, erosionCoef, sedimentationCoef, rnd=None):
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (82/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name nbDrops does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name erosionCoef does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name sedimentationCoef does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1574
    """Simulate the effect of rain drops on the terrain, resulting in erosion.
1575
1576
    ``nbDrops`` should be at least hm.size.
1577
1578
    Args:
1579
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1580
        nbDrops (int): Number of rain drops to simulate.
1581
        erosionCoef (float): Amount of ground eroded on the drop's path.
1582
        sedimentationCoef (float): Amount of ground deposited when the drops
1583
                                   stops to flow.
1584
        rnd (Optional[Random]): A tcod.Random instance, or None.
1585
    """
1586
    lib.TCOD_heightmap_rain_erosion(_heightmap_cdata(hm), nbDrops, erosionCoef,
1587
                                    sedimentationCoef, rnd.random_c if rnd else ffi.NULL)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (89/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
1588
1589
def heightmap_kernel_transform(hm, kernelsize, dx, dy, weight, minLevel,
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name dx does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name dy does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name minLevel does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name maxLevel does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1590
                               maxLevel):
1591
    """Apply a generic transformation on the map, so that each resulting cell
1592
    value is the weighted sum of several neighbour cells.
1593
1594
    This can be used to smooth/sharpen the map.
1595
1596
    Args:
1597
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1598
        kernelsize (int): Should be set to the length of the parameters::
1599
                          dx, dy, and weight.
1600
        dx (Sequence[int]): A sequence of x coorinates.
1601
        dy (Sequence[int]): A sequence of y coorinates.
1602
        weight (Sequence[float]): A sequence of kernelSize cells weight.
1603
                                  The value of each neighbour cell is scaled by
1604
                                  its corresponding weight
1605
        minLevel (float): No transformation will apply to cells
1606
                          below this value.
1607
        maxLevel (float): No transformation will apply to cells
1608
                          above this value.
1609
1610
    See examples below for a simple horizontal smoothing kernel :
1611
    replace value(x,y) with
1612
    0.33*value(x-1,y) + 0.33*value(x,y) + 0.33*value(x+1,y).
1613
    To do this, you need a kernel of size 3
1614
    (the sum involves 3 surrounding cells).
1615
    The dx,dy array will contain
1616
    * dx=-1, dy=0 for cell (x-1, y)
1617
    * dx=1, dy=0 for cell (x+1, y)
1618
    * dx=0, dy=0 for cell (x, y)
1619
    * The weight array will contain 0.33 for each cell.
1620
1621
    Example:
1622
        >>> import numpy as np
1623
        >>> heightmap = np.zeros((3, 3), dtype=np.float32)
1624
        >>> heightmap[:,1] = 1
1625
        >>> dx = [-1, 1, 0]
1626
        >>> dy = [0, 0, 0]
1627
        >>> weight = [0.33, 0.33, 0.33]
1628
        >>> tcod.heightmap_kernel_transform(heightmap, 3, dx, dy, weight,
1629
        ...                                 0.0, 1.0)
1630
    """
1631
    cdx = ffi.new('int[]', dx)
1632
    cdy = ffi.new('int[]', dy)
1633
    cweight = ffi.new('float[]', weight)
1634
    lib.TCOD_heightmap_kernel_transform(_heightmap_cdata(hm), kernelsize,
1635
                                        cdx, cdy, cweight, minLevel, maxLevel)
1636
1637
def heightmap_add_voronoi(hm, nbPoints, nbCoef, coef, rnd=None):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name nbPoints does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name nbCoef does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1638
    """Add values from a Voronoi diagram to the heightmap.
1639
1640
    Args:
1641
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1642
        nbPoints (Any): Number of Voronoi sites.
1643
        nbCoef (int): The diagram value is calculated from the nbCoef
1644
                      closest sites.
1645
        coef (Sequence[float]): The distance to each site is scaled by the
1646
                                corresponding coef.
1647
                                Closest site : coef[0],
1648
                                second closest site : coef[1], ...
1649
        rnd (Optional[Random]): A Random instance, or None.
1650
    """
1651
    nbPoints = len(coef)
1652
    ccoef = ffi.new('float[]', coef)
1653
    lib.TCOD_heightmap_add_voronoi(_heightmap_cdata(hm), nbPoints,
1654
                                   nbCoef, ccoef, rnd.random_c if rnd else ffi.NULL)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (84/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
1655
1656
def heightmap_add_fbm(hm, noise, mulx, muly, addx, addy, octaves, delta, scale):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1657
    """Add FBM noise to the heightmap.
1658
1659
    The noise coordinate for each map cell is
1660
    `((x + addx) * mulx / width, (y + addy) * muly / height)`.
1661
1662
    The value added to the heightmap is `delta + noise * scale`.
1663
1664
    Args:
1665
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1666
        noise (Noise): A Noise instance.
1667
        mulx (float): Scaling of each x coordinate.
1668
        muly (float): Scaling of each y coordinate.
1669
        addx (float): Translation of each x coordinate.
1670
        addy (float): Translation of each y coordinate.
1671
        octaves (float): Number of octaves in the FBM sum.
1672
        delta (float): The value added to all heightmap cells.
1673
        scale (float): The noise value is scaled with this parameter.
1674
    """
1675
    noise = noise.noise_c if noise is not None else ffi.NULL
1676
    lib.TCOD_heightmap_add_fbm(_heightmap_cdata(hm), noise,
1677
                               mulx, muly, addx, addy, octaves, delta, scale)
1678
1679
def heightmap_scale_fbm(hm, noise, mulx, muly, addx, addy, octaves, delta,
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1680
                        scale):
1681
    """Multiply the heighmap values with FBM noise.
1682
1683
    Args:
1684
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1685
        noise (Noise): A Noise instance.
1686
        mulx (float): Scaling of each x coordinate.
1687
        muly (float): Scaling of each y coordinate.
1688
        addx (float): Translation of each x coordinate.
1689
        addy (float): Translation of each y coordinate.
1690
        octaves (float): Number of octaves in the FBM sum.
1691
        delta (float): The value added to all heightmap cells.
1692
        scale (float): The noise value is scaled with this parameter.
1693
    """
1694
    noise = noise.noise_c if noise is not None else ffi.NULL
1695
    lib.TCOD_heightmap_scale_fbm(_heightmap_cdata(hm), noise,
1696
                                 mulx, muly, addx, addy, octaves, delta, scale)
1697
1698
def heightmap_dig_bezier(hm, px, py, startRadius, startDepth, endRadius,
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name px does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name py does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name startRadius does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name startDepth does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name endRadius does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name endDepth does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1699
                         endDepth):
1700
    """Carve a path along a cubic Bezier curve.
1701
1702
    Both radius and depth can vary linearly along the path.
1703
1704
    Args:
1705
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1706
        px (Sequence[int]): The 4 `x` coordinates of the Bezier curve.
1707
        py (Sequence[int]): The 4 `y` coordinates of the Bezier curve.
1708
        startRadius (float): The starting radius size.
1709
        startDepth (float): The starting depth.
1710
        endRadius (float): The ending radius size.
1711
        endDepth (float): The ending depth.
1712
    """
1713
    lib.TCOD_heightmap_dig_bezier(_heightmap_cdata(hm), px, py, startRadius,
1714
                                   startDepth, endRadius,
1715
                                   endDepth)
1716
1717
def heightmap_get_value(hm, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1718
    """Return the value at ``x``, ``y`` in a heightmap.
1719
1720
    Args:
1721
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1722
        x (int): The x position to pick.
1723
        y (int): The y position to pick.
1724
1725
    Returns:
1726
        float: The value at ``x``, ``y``.
1727
1728
    .. deprecated:: 2.0
1729
        Do ``value = hm[y, x]`` instead.
1730
    """
1731
    # explicit type conversion to pass test, (test should have been better.)
1732
    return float(hm[y, x])
1733
1734
def heightmap_get_interpolated_value(hm, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name heightmap_get_interpolated_value does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1735
    """Return the interpolated height at non integer coordinates.
1736
1737
    Args:
1738
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1739
        x (float): A floating point x coordinate.
1740
        y (float): A floating point y coordinate.
1741
1742
    Returns:
1743
        float: The value at ``x``, ``y``.
1744
    """
1745
    return lib.TCOD_heightmap_get_interpolated_value(_heightmap_cdata(hm),
1746
                                                     x, y)
1747
1748
def heightmap_get_slope(hm, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1749
    """Return the slope between 0 and (pi / 2) at given coordinates.
1750
1751
    Args:
1752
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1753
        x (int): The x coordinate.
1754
        y (int): The y coordinate.
1755
1756
    Returns:
1757
        float: The steepness at ``x``, ``y``.  From 0 to (pi / 2)
1758
    """
1759
    return lib.TCOD_heightmap_get_slope(_heightmap_cdata(hm), x, y)
1760
1761
def heightmap_get_normal(hm, x, y, waterLevel):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name waterLevel does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1762
    """Return the map normal at given coordinates.
1763
1764
    Args:
1765
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1766
        x (float): The x coordinate.
1767
        y (float): The y coordinate.
1768
        waterLevel (float): The heightmap is considered flat below this value.
1769
1770
    Returns:
1771
        Tuple[float, float, float]: An (x, y, z) vector normal.
1772
    """
1773
    cn = ffi.new('float[3]')
0 ignored issues
show
Coding Style Naming introduced by
The name cn does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1774
    lib.TCOD_heightmap_get_normal(_heightmap_cdata(hm), x, y, cn, waterLevel)
1775
    return tuple(cn)
1776
1777
def heightmap_count_cells(hm, mi, ma):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1778
    """Return the number of map cells which value is between ``mi`` and ``ma``.
1779
1780
    Args:
1781
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1782
        mi (float): The lower bound.
1783
        ma (float): The upper bound.
1784
1785
    Returns:
1786
        int: The count of values which fall between ``mi`` and ``ma``.
1787
    """
1788
    return lib.TCOD_heightmap_count_cells(_heightmap_cdata(hm), mi, ma)
1789
1790
def heightmap_has_land_on_border(hm, waterlevel):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1791
    """Returns True if the map edges are below ``waterlevel``, otherwise False.
1792
1793
    Args:
1794
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1795
        waterLevel (float): The water level to use.
1796
1797
    Returns:
1798
        bool: True if the map edges are below ``waterlevel``, otherwise False.
1799
    """
1800
    return lib.TCOD_heightmap_has_land_on_border(_heightmap_cdata(hm),
1801
                                                 waterlevel)
1802
1803
def heightmap_get_minmax(hm):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1804
    """Return the min and max values of this heightmap.
1805
1806
    Args:
1807
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1808
1809
    Returns:
1810
        Tuple[float, float]: The (min, max) values.
1811
1812
    .. deprecated:: 2.0
1813
        Do ``hm.min()`` or ``hm.max()`` instead.
1814
    """
1815
    mi = ffi.new('float *')
0 ignored issues
show
Coding Style Naming introduced by
The name mi does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1816
    ma = ffi.new('float *')
0 ignored issues
show
Coding Style Naming introduced by
The name ma does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1817
    lib.TCOD_heightmap_get_minmax(_heightmap_cdata(hm), mi, ma)
1818
    return mi[0], ma[0]
1819
1820
def heightmap_delete(hm):
0 ignored issues
show
Coding Style Naming introduced by
The name hm does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Unused Code introduced by
The argument hm seems to be unused.
Loading history...
1821
    """Does nothing.
1822
1823
    .. deprecated:: 2.0
1824
        libtcod-cffi deletes heightmaps automatically.
1825
    """
1826
    pass
1827
1828
def image_new(width, height):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1829
    return tcod.image.Image(width, height)
1830
1831
def image_clear(image, col):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1832
    image.clear(col)
1833
1834
def image_invert(image):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1835
    image.invert()
1836
1837
def image_hflip(image):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1838
    image.hflip()
1839
1840
def image_rotate90(image, num=1):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1841
    image.rotate90(num)
1842
1843
def image_vflip(image):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1844
    image.vflip()
1845
1846
def image_scale(image, neww, newh):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1847
    image.scale(neww, newh)
1848
1849
def image_set_key_color(image, col):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1850
    image.set_key_color(col)
1851
1852
def image_get_alpha(image, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1853
    image.get_alpha(x, y)
1854
1855
def image_is_pixel_transparent(image, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1856
    lib.TCOD_image_is_pixel_transparent(image.image_c, x, y)
1857
1858
def image_load(filename):
1859
    """Load an image file into an Image instance and return it.
1860
1861
    Args:
1862
        filename (AnyStr): Path to a .bmp or .png image file.
1863
    """
1864
    return tcod.image.Image._from_cdata(
1865
        ffi.gc(lib.TCOD_image_load(_bytes(filename)),
1866
               lib.TCOD_image_delete)
1867
        )
1868
1869
def image_from_console(console):
1870
    """Return an Image with a Consoles pixel data.
1871
1872
    This effectively takes a screen-shot of the Console.
1873
1874
    Args:
1875
        console (Console): Any Console instance.
1876
    """
1877
    return tcod.image.Image._from_cdata(
1878
        ffi.gc(
1879
            lib.TCOD_image_from_console(
1880
                console.console_c if console else ffi.NULL
1881
                ),
1882
            lib.TCOD_image_delete,
1883
            )
1884
        )
1885
1886
def image_refresh_console(image, console):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1887
    image.refresh_console(console)
1888
1889
def image_get_size(image):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1890
    return image.width, image.height
1891
1892
def image_get_pixel(image, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1893
    return image.get_pixel(x, y)
1894
1895
def image_get_mipmap_pixel(image, x0, y0, x1, y1):
0 ignored issues
show
Coding Style Naming introduced by
The name x0 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y0 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x1 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y1 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1896
    return image.get_mipmap_pixel(x0, y0, x1, y1)
1897
1898
def image_put_pixel(image, x, y, col):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1899
    image.put_pixel(x, y, col)
1900
1901
def image_blit(image, console, x, y, bkgnd_flag, scalex, scaley, angle):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1902
    image.blit(console, x, y, bkgnd_flag, scalex, scaley, angle)
1903
1904
def image_blit_rect(image, console, x, y, w, h, bkgnd_flag):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1905
    image.blit_rect(console, x, y, w, h, bkgnd_flag)
1906
1907
def image_blit_2x(image, console, dx, dy, sx=0, sy=0, w=-1, h=-1):
0 ignored issues
show
Coding Style Naming introduced by
The name dx does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name dy does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name sx does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name sy does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1908
    image.blit_2x(console, dx, dy, sx, sy, w, h)
1909
1910
def image_save(image, filename):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1911
    image.save_as(filename)
1912
1913
def image_delete(image):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The argument image seems to be unused.
Loading history...
1914
    pass
1915
1916
def line_init(xo, yo, xd, yd):
0 ignored issues
show
Coding Style Naming introduced by
The name xo does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name yo does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name xd does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name yd does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1917
    """Initilize a line whose points will be returned by `line_step`.
1918
1919
    This function does not return anything on its own.
1920
1921
    Does not include the origin point.
1922
1923
    Args:
1924
        xo (int): X starting point.
1925
        yo (int): Y starting point.
1926
        xd (int): X destination point.
1927
        yd (int): Y destination point.
1928
1929
    .. deprecated:: 2.0
1930
       Use `line_iter` instead.
1931
    """
1932
    lib.TCOD_line_init(xo, yo, xd, yd)
1933
1934
def line_step():
1935
    """After calling line_init returns (x, y) points of the line.
1936
1937
    Once all points are exhausted this function will return (None, None)
1938
1939
    Returns:
1940
        Union[Tuple[int, int], Tuple[None, None]]:
1941
            The next (x, y) point of the line setup by line_init,
1942
            or (None, None) if there are no more points.
1943
1944
    .. deprecated:: 2.0
1945
       Use `line_iter` instead.
1946
    """
1947
    x = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1948
    y = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1949
    ret = lib.TCOD_line_step(x, y)
1950
    if not ret:
1951
        return x[0], y[0]
1952
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1953
1954
_line_listener_lock = _threading.Lock()
0 ignored issues
show
Coding Style Naming introduced by
The name _line_listener_lock does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1955
1956
def line(xo, yo, xd, yd, py_callback):
0 ignored issues
show
Coding Style Naming introduced by
The name xo does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name yo does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name xd does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name yd does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1957
    """ Iterate over a line using a callback function.
1958
1959
    Your callback function will take x and y parameters and return True to
1960
    continue iteration or False to stop iteration and return.
1961
1962
    This function includes both the start and end points.
1963
1964
    Args:
1965
        xo (int): X starting point.
1966
        yo (int): Y starting point.
1967
        xd (int): X destination point.
1968
        yd (int): Y destination point.
1969
        py_callback (Callable[[int, int], bool]):
1970
            A callback which takes x and y parameters and returns bool.
1971
1972
    Returns:
1973
        bool: False if the callback cancels the line interation by
1974
              returning False or None, otherwise True.
1975
1976
    .. deprecated:: 2.0
1977
       Use `line_iter` instead.
1978
    """
1979
    with _PropagateException() as propagate:
1980
        with _line_listener_lock:
1981
            @ffi.def_extern(onerror=propagate)
1982
            def _pycall_line_listener(x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
1983
                return py_callback(x, y)
1984
            return bool(lib.TCOD_line(xo, yo, xd, yd,
1985
                                       lib._pycall_line_listener))
1986
1987
def line_iter(xo, yo, xd, yd):
0 ignored issues
show
Coding Style Naming introduced by
The name xo does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name yo does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name xd does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name yd does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1988
    """ returns an iterator
1989
1990
    This iterator does not include the origin point.
1991
1992
    Args:
1993
        xo (int): X starting point.
1994
        yo (int): Y starting point.
1995
        xd (int): X destination point.
1996
        yd (int): Y destination point.
1997
1998
    Returns:
1999
        Iterator[Tuple[int,int]]: An iterator of (x,y) points.
2000
    """
2001
    data = ffi.new('TCOD_bresenham_data_t *')
2002
    lib.TCOD_line_init_mt(xo, yo, xd, yd, data)
2003
    x = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2004
    y = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2005
    yield xo, yo
2006
    while not lib.TCOD_line_step_mt(x, y, data):
2007
        yield (x[0], y[0])
2008
2009
FOV_BASIC = 0
2010
FOV_DIAMOND = 1
2011
FOV_SHADOW = 2
2012
FOV_PERMISSIVE_0 = 3
2013
FOV_PERMISSIVE_1 = 4
2014
FOV_PERMISSIVE_2 = 5
2015
FOV_PERMISSIVE_3 = 6
2016
FOV_PERMISSIVE_4 = 7
2017
FOV_PERMISSIVE_5 = 8
2018
FOV_PERMISSIVE_6 = 9
2019
FOV_PERMISSIVE_7 = 10
2020
FOV_PERMISSIVE_8 = 11
2021
FOV_RESTRICTIVE = 12
2022
NB_FOV_ALGORITHMS = 13
2023
2024
def map_new(w, h):
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2025
    return tcod.map.Map(w, h)
2026
2027
def map_copy(source, dest):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2028
    return lib.TCOD_map_copy(source.map_c, dest.map_c)
2029
2030
def map_set_properties(m, x, y, isTrans, isWalk):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name isTrans does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name isWalk does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2031
    lib.TCOD_map_set_properties(m.map_c, x, y, isTrans, isWalk)
2032
2033
def map_clear(m,walkable=False,transparent=False):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def map_clear(m,walkable=False,transparent=False):
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
def map_clear(m,walkable=False,transparent=False):
^
Loading history...
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2034
    # walkable/transparent looks incorrectly ordered here.
2035
    # TODO: needs test.
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
2036
    lib.TCOD_map_clear(m.map_c, walkable, transparent)
2037
2038
def map_compute_fov(m, x, y, radius=0, light_walls=True, algo=FOV_RESTRICTIVE ):
0 ignored issues
show
Coding Style introduced by
No space allowed before bracket
def map_compute_fov(m, x, y, radius=0, light_walls=True, algo=FOV_RESTRICTIVE ):
^
Loading history...
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2039
    lib.TCOD_map_compute_fov(m.map_c, x, y, radius, light_walls, algo)
2040
2041
def map_is_in_fov(m, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2042
    return lib.TCOD_map_is_in_fov(m.map_c, x, y)
2043
2044
def map_is_transparent(m, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2045
    return lib.TCOD_map_is_transparent(m.map_c, x, y)
2046
2047
def map_is_walkable(m, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2048
    return lib.TCOD_map_is_walkable(m.map_c, x, y)
2049
2050
def map_delete(m):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The argument m seems to be unused.
Loading history...
2051
    pass
2052
2053
def map_get_width(map):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in map.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2054
    return map.width
2055
2056
def map_get_height(map):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in map.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2057
    return map.height
2058
2059
def mouse_show_cursor(visible):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2060
    lib.TCOD_mouse_show_cursor(visible)
2061
2062
def mouse_is_cursor_visible():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2063
    return lib.TCOD_mouse_is_cursor_visible()
2064
2065
def mouse_move(x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2066
    lib.TCOD_mouse_move(x, y)
2067
2068
def mouse_get_status():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2069
    return Mouse(lib.TCOD_mouse_get_status())
2070
2071
def namegen_parse(filename,random=None):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def namegen_parse(filename,random=None):
^
Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2072
    lib.TCOD_namegen_parse(_bytes(filename), random or ffi.NULL)
2073
2074
def namegen_generate(name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2075
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name), False))
2076
2077
def namegen_generate_custom(name, rule):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2078
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name),
2079
                                                     _bytes(rule), False))
2080
2081
def namegen_get_sets():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2082
    sets = lib.TCOD_namegen_get_sets()
2083
    try:
2084
        lst = []
2085
        while not lib.TCOD_list_is_empty(sets):
2086
            lst.append(_unpack_char_p(ffi.cast('char *', lib.TCOD_list_pop(sets))))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (83/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
2087
    finally:
2088
        lib.TCOD_list_delete(sets)
2089
    return lst
2090
2091
def namegen_destroy():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2092
    lib.TCOD_namegen_destroy()
2093
2094
def noise_new(dim, h=NOISE_DEFAULT_HURST, l=NOISE_DEFAULT_LACUNARITY,
0 ignored issues
show
Coding Style Naming introduced by
The name h does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name l does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2095
        random=None):
2096
    """Return a new Noise instance.
2097
2098
    Args:
2099
        dim (int): Number of dimensions.  From 1 to 4.
2100
        h (float): The hurst exponent.  Should be in the 0.0-1.0 range.
2101
        l (float): The noise lacunarity.
2102
        random (Optional[Random]): A Random instance, or None.
2103
2104
    Returns:
2105
        Noise: The new Noise instance.
2106
    """
2107
    return tcod.noise.Noise(dim, hurst=h, lacunarity=l, seed=random)
2108
2109
def noise_set_type(n, typ):
0 ignored issues
show
Coding Style Naming introduced by
The name n does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2110
    """Set a Noise objects default noise algorithm.
2111
2112
    Args:
2113
        typ (int): Any NOISE_* constant.
2114
    """
2115
    n.algorithm = typ
2116
2117
def noise_get(n, f, typ=NOISE_DEFAULT):
0 ignored issues
show
Coding Style Naming introduced by
The name n does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name f does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'NOISE_DEFAULT'
Loading history...
2118
    """Return the noise value sampled from the ``f`` coordinate.
2119
2120
    ``f`` should be a tuple or list with a length matching
2121
    :any:`Noise.dimensions`.
2122
    If ``f`` is shoerter than :any:`Noise.dimensions` the missing coordinates
2123
    will be filled with zeros.
2124
2125
    Args:
2126
        n (Noise): A Noise instance.
2127
        f (Sequence[float]): The point to sample the noise from.
2128
        typ (int): The noise algorithm to use.
2129
2130
    Returns:
2131
        float: The sampled noise value.
2132
    """
2133
    return lib.TCOD_noise_get_ex(n.noise_c, ffi.new('float[4]', f), typ)
2134
2135
def noise_get_fbm(n, f, oc, typ=NOISE_DEFAULT):
0 ignored issues
show
Coding Style Naming introduced by
The name n does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name f does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name oc does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'NOISE_DEFAULT'
Loading history...
2136
    """Return the fractal Brownian motion sampled from the ``f`` coordinate.
2137
2138
    Args:
2139
        n (Noise): A Noise instance.
2140
        f (Sequence[float]): The point to sample the noise from.
2141
        typ (int): The noise algorithm to use.
2142
        octaves (float): The level of level.  Should be more than 1.
2143
2144
    Returns:
2145
        float: The sampled noise value.
2146
    """
2147
    return lib.TCOD_noise_get_fbm_ex(n.noise_c, ffi.new('float[4]', f),
2148
                                     oc, typ)
2149
2150
def noise_get_turbulence(n, f, oc, typ=NOISE_DEFAULT):
0 ignored issues
show
Coding Style Naming introduced by
The name n does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name f does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name oc does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'NOISE_DEFAULT'
Loading history...
2151
    """Return the turbulence noise sampled from the ``f`` coordinate.
2152
2153
    Args:
2154
        n (Noise): A Noise instance.
2155
        f (Sequence[float]): The point to sample the noise from.
2156
        typ (int): The noise algorithm to use.
2157
        octaves (float): The level of level.  Should be more than 1.
2158
2159
    Returns:
2160
        float: The sampled noise value.
2161
    """
2162
    return lib.TCOD_noise_get_turbulence_ex(n.noise_c, ffi.new('float[4]', f),
2163
                                            oc, typ)
2164
2165
def noise_delete(n):
0 ignored issues
show
Coding Style Naming introduced by
The name n does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Unused Code introduced by
The argument n seems to be unused.
Loading history...
2166
    """Does nothing."""
2167
    pass
2168
2169
_chr = chr
0 ignored issues
show
Coding Style Naming introduced by
The name _chr does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2170
try:
2171
    _chr = unichr # Python 2
0 ignored issues
show
Coding Style Naming introduced by
The name _chr does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'unichr'
Loading history...
2172
except NameError:
0 ignored issues
show
Unused Code introduced by
This except handler seems to be unused and could be removed.

Except handlers which only contain pass and do not have an else clause can usually simply be removed:

try:
    raises_exception()
except:  # Could be removed
    pass
Loading history...
2173
    pass
2174
2175
def _unpack_union(type_, union):
2176
    '''
2177
        unpack items from parser new_property (value_converter)
2178
    '''
2179
    if type_ == lib.TCOD_TYPE_BOOL:
2180
        return bool(union.b)
2181
    elif type_ == lib.TCOD_TYPE_CHAR:
2182
        return _unicode(union.c)
2183
    elif type_ == lib.TCOD_TYPE_INT:
2184
        return union.i
2185
    elif type_ == lib.TCOD_TYPE_FLOAT:
2186
        return union.f
2187
    elif (type_ == lib.TCOD_TYPE_STRING or
2188
         lib.TCOD_TYPE_VALUELIST15 >= type_ >= lib.TCOD_TYPE_VALUELIST00):
2189
         return _unpack_char_p(union.s)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 9 were found.
Loading history...
2190
    elif type_ == lib.TCOD_TYPE_COLOR:
2191
        return Color._new_from_cdata(union.col)
2192
    elif type_ == lib.TCOD_TYPE_DICE:
2193
        return Dice(union.dice)
2194
    elif type_ & lib.TCOD_TYPE_LIST:
2195
        return _convert_TCODList(union.list, type_ & 0xFF)
2196
    else:
2197
        raise RuntimeError('Unknown libtcod type: %i' % type_)
2198
2199
def _convert_TCODList(clist, type_):
0 ignored issues
show
Coding Style Naming introduced by
The name _convert_TCODList does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2200
    return [_unpack_union(type_, lib.TDL_list_get_union(clist, i))
2201
            for i in range(lib.TCOD_list_size(clist))]
2202
2203
def parser_new():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2204
    return ffi.gc(lib.TCOD_parser_new(), lib.TCOD_parser_delete)
2205
2206
def parser_new_struct(parser, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2207
    return lib.TCOD_parser_new_struct(parser, name)
2208
2209
# prevent multiple threads from messing with def_extern callbacks
2210
_parser_callback_lock = _threading.Lock()
0 ignored issues
show
Coding Style Naming introduced by
The name _parser_callback_lock does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2211
_parser_listener = None # temporary global pointer to a listener instance
0 ignored issues
show
Coding Style Naming introduced by
The name _parser_listener does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2212
2213
@ffi.def_extern()
2214
def _pycall_parser_new_struct(struct, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2215
    return _parser_listener.end_struct(struct, _unpack_char_p(name))
2216
2217
@ffi.def_extern()
2218
def _pycall_parser_new_flag(name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2219
    return _parser_listener.new_flag(_unpack_char_p(name))
2220
2221
@ffi.def_extern()
2222
def _pycall_parser_new_property(propname, type, value):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in type.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2223
    return _parser_listener.new_property(_unpack_char_p(propname), type,
2224
                                 _unpack_union(type, value))
2225
2226
@ffi.def_extern()
2227
def _pycall_parser_end_struct(struct, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2228
    return _parser_listener.end_struct(struct, _unpack_char_p(name))
2229
2230
@ffi.def_extern()
2231
def _pycall_parser_error(msg):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2232
    _parser_listener.error(_unpack_char_p(msg))
2233
2234
def parser_run(parser, filename, listener=None):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2235
    global _parser_listener
0 ignored issues
show
Coding Style Naming introduced by
The name _parser_listener does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2236
    if not listener:
2237
        lib.TCOD_parser_run(parser, _bytes(filename), ffi.NULL)
2238
        return
2239
2240
    propagate_manager = _PropagateException()
2241
    propagate = propagate_manager.propagate
2242
2243
    clistener = ffi.new(
2244
        'TCOD_parser_listener_t *',
2245
        {
2246
            'new_struct': lib._pycall_parser_new_struct,
2247
            'new_flag': lib._pycall_parser_new_flag,
2248
            'new_property': lib._pycall_parser_new_property,
2249
            'end_struct': lib._pycall_parser_end_struct,
2250
            'error': lib._pycall_parser_error,
2251
        },
2252
    )
2253
2254
    with _parser_callback_lock:
2255
        _parser_listener = listener
2256
        with propagate_manager:
2257
            lib.TCOD_parser_run(parser, _bytes(filename), clistener)
2258
2259
def parser_delete(parser):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The argument parser seems to be unused.
Loading history...
2260
    pass
2261
2262
def parser_get_bool_property(parser, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2263
    return bool(lib.TCOD_parser_get_bool_property(parser, _bytes(name)))
2264
2265
def parser_get_int_property(parser, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2266
    return lib.TCOD_parser_get_int_property(parser, _bytes(name))
2267
2268
def parser_get_char_property(parser, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2269
    return _chr(lib.TCOD_parser_get_char_property(parser, _bytes(name)))
2270
2271
def parser_get_float_property(parser, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2272
    return lib.TCOD_parser_get_float_property(parser, _bytes(name))
2273
2274
def parser_get_string_property(parser, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2275
    return _unpack_char_p(
2276
        lib.TCOD_parser_get_string_property(parser, _bytes(name)))
2277
2278
def parser_get_color_property(parser, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2279
    return Color._new_from_cdata(
2280
        lib.TCOD_parser_get_color_property(parser, _bytes(name)))
2281
2282
def parser_get_dice_property(parser, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2283
    d = ffi.new('TCOD_dice_t *')
0 ignored issues
show
Coding Style Naming introduced by
The name d does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2284
    lib.TCOD_parser_get_dice_property_py(parser, _bytes(name), d)
2285
    return Dice(d)
2286
2287
def parser_get_list_property(parser, name, type):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in type.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

Loading history...
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2288
    clist = lib.TCOD_parser_get_list_property(parser, _bytes(name), type)
2289
    return _convert_TCODList(clist, type)
2290
2291
RNG_MT = 0
2292
RNG_CMWC = 1
2293
2294
DISTRIBUTION_LINEAR = 0
2295
DISTRIBUTION_GAUSSIAN = 1
2296
DISTRIBUTION_GAUSSIAN_RANGE = 2
2297
DISTRIBUTION_GAUSSIAN_INVERSE = 3
2298
DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = 4
2299
2300
def random_get_instance():
2301
    """Return the default Random instance.
2302
2303
    Returns:
2304
        Random: A Random instance using the default random number generator.
2305
    """
2306
    return tcod.random.Random._new_from_cdata(
2307
        ffi.cast('mersenne_data_t*', lib.TCOD_random_get_instance()))
2308
2309
def random_new(algo=RNG_CMWC):
2310
    """Return a new Random instance.  Using ``algo``.
2311
2312
    Args:
2313
        algo (int): The random number algorithm to use.
2314
2315
    Returns:
2316
        Random: A new Random instance using the given algorithm.
2317
    """
2318
    return tcod.random.Random(algo)
2319
2320
def random_new_from_seed(seed, algo=RNG_CMWC):
2321
    """Return a new Random instance.  Using the given ``seed`` and ``algo``.
2322
2323
    Args:
2324
        seed (Hashable): The RNG seed.  Should be a 32-bit integer, but any
2325
                         hashable object is accepted.
2326
        algo (int): The random number algorithm to use.
2327
2328
    Returns:
2329
        Random: A new Random instance using the given algorithm.
2330
    """
2331
    return tcod.random.Random(algo, seed)
2332
2333
def random_set_distribution(rnd, dist):
2334
    """Change the distribution mode of a random number generator.
2335
2336
    Args:
2337
        rnd (Optional[Random]): A Random instance, or None to use the default.
2338
        dist (int): The distribution mode to use.  Should be DISTRIBUTION_*.
2339
    """
2340
    lib.TCOD_random_set_distribution(rnd.random_c if rnd else ffi.NULL, dist)
2341
2342
def random_get_int(rnd, mi, ma):
0 ignored issues
show
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2343
    """Return a random integer in the range: ``mi`` <= n <= ``ma``.
2344
2345
    The result is affacted by calls to :any:`random_set_distribution`.
2346
2347
    Args:
2348
        rnd (Optional[Random]): A Random instance, or None to use the default.
2349
        low (int): The lower bound of the random range, inclusive.
2350
        high (int): The upper bound of the random range, inclusive.
2351
2352
    Returns:
2353
        int: A random integer in the range ``mi`` <= n <= ``ma``.
2354
    """
2355
    return lib.TCOD_random_get_int(rnd.random_c if rnd else ffi.NULL, mi, ma)
2356
2357
def random_get_float(rnd, mi, ma):
0 ignored issues
show
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2358
    """Return a random float in the range: ``mi`` <= n <= ``ma``.
2359
2360
    The result is affacted by calls to :any:`random_set_distribution`.
2361
2362
    Args:
2363
        rnd (Optional[Random]): A Random instance, or None to use the default.
2364
        low (float): The lower bound of the random range, inclusive.
2365
        high (float): The upper bound of the random range, inclusive.
2366
2367
    Returns:
2368
        float: A random double precision float
2369
               in the range ``mi`` <= n <= ``ma``.
2370
    """
2371
    return lib.TCOD_random_get_double(
2372
        rnd.random_c if rnd else ffi.NULL, mi, ma)
2373
2374
def random_get_double(rnd, mi, ma):
0 ignored issues
show
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2375
    """Return a random float in the range: ``mi`` <= n <= ``ma``.
2376
2377
    .. deprecated:: 2.0
2378
        Use :any:`random_get_float` instead.
2379
        Both funtions return a double precision float.
2380
    """
2381
    return lib.TCOD_random_get_double(
2382
        rnd.random_c if rnd else ffi.NULL, mi, ma)
2383
2384
def random_get_int_mean(rnd, mi, ma, mean):
0 ignored issues
show
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2385
    """Return a random weighted integer in the range: ``mi`` <= n <= ``ma``.
2386
2387
    The result is affacted by calls to :any:`random_set_distribution`.
2388
2389
    Args:
2390
        rnd (Optional[Random]): A Random instance, or None to use the default.
2391
        low (int): The lower bound of the random range, inclusive.
2392
        high (int): The upper bound of the random range, inclusive.
2393
        mean (int): The mean return value.
2394
2395
    Returns:
2396
        int: A random weighted integer in the range ``mi`` <= n <= ``ma``.
2397
    """
2398
    return lib.TCOD_random_get_int_mean(
2399
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2400
2401
def random_get_float_mean(rnd, mi, ma, mean):
0 ignored issues
show
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2402
    """Return a random weighted float in the range: ``mi`` <= n <= ``ma``.
2403
2404
    The result is affacted by calls to :any:`random_set_distribution`.
2405
2406
    Args:
2407
        rnd (Optional[Random]): A Random instance, or None to use the default.
2408
        low (float): The lower bound of the random range, inclusive.
2409
        high (float): The upper bound of the random range, inclusive.
2410
        mean (float): The mean return value.
2411
2412
    Returns:
2413
        float: A random weighted double precision float
2414
               in the range ``mi`` <= n <= ``ma``.
2415
    """
2416
    return lib.TCOD_random_get_double_mean(
2417
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2418
2419
def random_get_double_mean(rnd, mi, ma, mean):
0 ignored issues
show
Coding Style Naming introduced by
The name mi does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name ma does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2420
    """Return a random weighted float in the range: ``mi`` <= n <= ``ma``.
2421
2422
    .. deprecated:: 2.0
2423
        Use :any:`random_get_float_mean` instead.
2424
        Both funtions return a double precision float.
2425
    """
2426
    return lib.TCOD_random_get_double_mean(
2427
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2428
2429
def random_save(rnd):
2430
    """Return a copy of a random number generator.
2431
2432
    Args:
2433
        rnd (Optional[Random]): A Random instance, or None to use the default.
2434
2435
    Returns:
2436
        Random: A Random instance with a copy of the random generator.
2437
    """
2438
    return tcod.random.Random._new_from_cdata(
2439
        ffi.gc(
2440
            ffi.cast('mersenne_data_t*',
2441
                     lib.TCOD_random_save(rnd.random_c if rnd else ffi.NULL)),
2442
            lib.TCOD_random_delete),
2443
        )
2444
2445
def random_restore(rnd, backup):
2446
    """Restore a random number generator from a backed up copy.
2447
2448
    Args:
2449
        rnd (Optional[Random]): A Random instance, or None to use the default.
2450
        backup (Random): The Random instance which was used as a backup.
2451
    """
2452
    lib.TCOD_random_restore(rnd.random_c if rnd else ffi.NULL,
2453
                            backup.random_c)
2454
2455
def random_delete(rnd):
0 ignored issues
show
Unused Code introduced by
The argument rnd seems to be unused.
Loading history...
2456
    """Does nothing."""
2457
    pass
2458
2459
def struct_add_flag(struct, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2460
    lib.TCOD_struct_add_flag(struct, name)
2461
2462
def struct_add_property(struct, name, typ, mandatory):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2463
    lib.TCOD_struct_add_property(struct, name, typ, mandatory)
2464
2465
def struct_add_value_list(struct, name, value_list, mandatory):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2466
    CARRAY = c_char_p * (len(value_list) + 1)
0 ignored issues
show
Coding Style Naming introduced by
The name CARRAY does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'c_char_p'
Loading history...
2467
    cvalue_list = CARRAY()
2468
    for i, value in enumerate(value_list):
2469
        cvalue_list[i] = cast(value, c_char_p)
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'cast'
Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'c_char_p'
Loading history...
2470
    cvalue_list[len(value_list)] = 0
2471
    lib.TCOD_struct_add_value_list(struct, name, cvalue_list, mandatory)
2472
2473
def struct_add_list_property(struct, name, typ, mandatory):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2474
    lib.TCOD_struct_add_list_property(struct, name, typ, mandatory)
2475
2476
def struct_add_structure(struct, sub_struct):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2477
    lib.TCOD_struct_add_structure(struct, sub_struct)
2478
2479
def struct_get_name(struct):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2480
    return _unpack_char_p(lib.TCOD_struct_get_name(struct))
2481
2482
def struct_is_mandatory(struct, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2483
    return lib.TCOD_struct_is_mandatory(struct, name)
2484
2485
def struct_get_type(struct, name):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2486
    return lib.TCOD_struct_get_type(struct, name)
2487
2488
# high precision time functions
2489
def sys_set_fps(fps):
2490
    """Set the maximum frame rate.
2491
2492
    You can disable the frame limit again by setting fps to 0.
2493
2494
    Args:
2495
        fps (int): A frame rate limit (i.e. 60)
2496
    """
2497
    lib.TCOD_sys_set_fps(fps)
2498
2499
def sys_get_fps():
2500
    """Return the current frames per second.
2501
2502
    This the actual frame rate, not the frame limit set by
2503
    :any:`tcod.sys_set_fps`.
2504
2505
    This number is updated every second.
2506
2507
    Returns:
2508
        int: The currently measured frame rate.
2509
    """
2510
    return lib.TCOD_sys_get_fps()
2511
2512
def sys_get_last_frame_length():
2513
    """Return the delta time of the last rendered frame in seconds.
2514
2515
    Returns:
2516
        float: The delta time of the last rendered frame.
2517
    """
2518
    return lib.TCOD_sys_get_last_frame_length()
2519
2520
def sys_sleep_milli(val):
2521
    """Sleep for 'val' milliseconds.
2522
2523
    Args:
2524
        val (int): Time to sleep for in milliseconds.
2525
2526
    .. deprecated:: 2.0
2527
       Use :any:`time.sleep` instead.
2528
    """
2529
    lib.TCOD_sys_sleep_milli(val)
2530
2531
def sys_elapsed_milli():
2532
    """Get number of milliseconds since the start of the program.
2533
2534
    Returns:
2535
        int: Time since the progeam has started in milliseconds.
2536
2537
    .. deprecated:: 2.0
2538
       Use :any:`time.clock` instead.
2539
    """
2540
    return lib.TCOD_sys_elapsed_milli()
2541
2542
def sys_elapsed_seconds():
2543
    """Get number of seconds since the start of the program.
2544
2545
    Returns:
2546
        float: Time since the progeam has started in seconds.
2547
2548
    .. deprecated:: 2.0
2549
       Use :any:`time.clock` instead.
2550
    """
2551
    return lib.TCOD_sys_elapsed_seconds()
2552
2553
def sys_set_renderer(renderer):
2554
    """Change the current rendering mode to renderer.
2555
2556
    .. deprecated:: 2.0
2557
       RENDERER_GLSL and RENDERER_OPENGL are not currently available.
2558
    """
2559
    lib.TCOD_sys_set_renderer(renderer)
2560
2561
def sys_get_renderer():
2562
    """Return the current rendering mode.
2563
2564
    """
2565
    return lib.TCOD_sys_get_renderer()
2566
2567
# easy screenshots
2568
def sys_save_screenshot(name=None):
2569
    """Save a screenshot to a file.
2570
2571
    By default this will automatically save screenshots in the working
2572
    directory.
2573
2574
    The automatic names are formatted as screenshotNNN.png.  For example:
2575
    screenshot000.png, screenshot001.png, etc.  Whichever is available first.
2576
2577
    Args:
2578
        file Optional[AnyStr]: File path to save screenshot.
2579
    """
2580
    if name is not None:
2581
        name = _bytes(name)
2582
    lib.TCOD_sys_save_screenshot(name or ffi.NULL)
2583
2584
# custom fullscreen resolution
2585
def sys_force_fullscreen_resolution(width, height):
2586
    """Force a specific resolution in fullscreen.
2587
2588
    Will use the smallest available resolution so that:
2589
2590
    * resolution width >= width and
2591
      resolution width >= root console width * font char width
2592
    * resolution height >= height and
2593
      resolution height >= root console height * font char height
2594
2595
    Args:
2596
        width (int): The desired resolution width.
2597
        height (int): The desired resolution height.
2598
    """
2599
    lib.TCOD_sys_force_fullscreen_resolution(width, height)
2600
2601
def sys_get_current_resolution():
2602
    """Return the current resolution as (width, height)
2603
2604
    Returns:
2605
        Tuple[int,int]: The current resolution.
2606
    """
2607
    w = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2608
    h = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name h does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2609
    lib.TCOD_sys_get_current_resolution(w, h)
2610
    return w[0], h[0]
2611
2612
def sys_get_char_size():
2613
    """Return the current fonts character size as (width, height)
2614
2615
    Returns:
2616
        Tuple[int,int]: The current font glyph size in (width, height)
2617
    """
2618
    w = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2619
    h = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name h does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2620
    lib.TCOD_sys_get_char_size(w, h)
2621
    return w[0], h[0]
2622
2623
# update font bitmap
2624
def sys_update_char(asciiCode, fontx, fonty, img, x, y):
0 ignored issues
show
Coding Style Naming introduced by
The name asciiCode does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2625
    """Dynamically update the current frot with img.
2626
2627
    All cells using this asciiCode will be updated
2628
    at the next call to :any:`tcod.console_flush`.
2629
2630
    Args:
2631
        asciiCode (int): Ascii code corresponding to the character to update.
2632
        fontx (int): Left coordinate of the character
2633
                     in the bitmap font (in tiles)
2634
        fonty (int): Top coordinate of the character
2635
                     in the bitmap font (in tiles)
2636
        img (Image): An image containing the new character bitmap.
2637
        x (int): Left pixel of the character in the image.
2638
        y (int): Top pixel of the character in the image.
2639
    """
2640
    lib.TCOD_sys_update_char(_int(asciiCode), fontx, fonty, img, x, y)
2641
2642
def sys_register_SDL_renderer(callback):
0 ignored issues
show
Coding Style Naming introduced by
The name sys_register_SDL_renderer does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2643
    """Register a custom randering function with libtcod.
2644
2645
    Note:
2646
        This callback will only be called by the SDL renderer.
2647
2648
    The callack will receive a :any:`CData <ffi-cdata>` void* to an
2649
    SDL_Surface* struct.
2650
2651
    The callback is called on every call to :any:`tcod.console_flush`.
2652
2653
    Args:
2654
        callback Callable[[CData], None]:
2655
            A function which takes a single argument.
2656
    """
2657
    with _PropagateException() as propagate:
2658
        @ffi.def_extern(onerror=propagate)
2659
        def _pycall_sdl_hook(sdl_surface):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2660
            callback(sdl_surface)
2661
        lib.TCOD_sys_register_SDL_renderer(lib._pycall_sdl_hook)
2662
2663
def sys_check_for_event(mask, k, m):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2664
    """Check for and return an event.
2665
2666
    Args:
2667
        mask (int): :any:`Event types` to wait for.
2668
        k (Optional[Key]): A tcod.Key instance which might be updated with
2669
                           an event.  Can be None.
2670
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
2671
                             with an event.  Can be None.
2672
    """
2673
    return lib.TCOD_sys_check_for_event(
2674
        mask, k.cdata if k else ffi.NULL, m.cdata if m else ffi.NULL)
2675
2676
def sys_wait_for_event(mask, k, m, flush):
0 ignored issues
show
Coding Style Naming introduced by
The name m does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2677
    """Wait for an event then return.
2678
2679
    If flush is True then the buffer will be cleared before waiting. Otherwise
2680
    each available event will be returned in the order they're recieved.
2681
2682
    Args:
2683
        mask (int): :any:`Event types` to wait for.
2684
        k (Optional[Key]): A tcod.Key instance which might be updated with
2685
                           an event.  Can be None.
2686
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
2687
                             with an event.  Can be None.
2688
        flush (bool): Clear the event buffer before waiting.
2689
    """
2690
    return lib.TCOD_sys_wait_for_event(
2691
        mask, k.cdata if k else ffi.NULL, m.cdata if m else ffi.NULL, flush)
2692
2693
def sys_clipboard_set(text):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2694
    return lib.TCOD_sys_clipboard_set(text.encode('utf-8'))
2695
2696
def sys_clipboard_get():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2697
    return ffi.string(lib.TCOD_sys_clipboard_get()).decode('utf-8')
2698