Completed
Push — master ( 7116cd...1374a1 )
by Kyle
53s
created

pycall_parser_end_struct()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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...
Unused Code introduced by
absolute_import was imported with wildcard, but is not used.
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
        dest = dest.console_c if dest else ffi.NULL
159
        if (console_get_width(dest) != self.width or
160
            console_get_height(dest) != self.height):
161
            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...
162
163
        if fill_back:
164
            lib.TCOD_console_fill_background(dest or ffi.NULL,
165
                                              ffi.new('int[]', self.back_r),
166
                                              ffi.new('int[]', self.back_g),
167
                                              ffi.new('int[]', self.back_b))
168
        if fill_fore:
169
            lib.TCOD_console_fill_foreground(dest or ffi.NULL,
170
                                              ffi.new('int[]', self.fore_r),
171
                                              ffi.new('int[]', self.fore_g),
172
                                              ffi.new('int[]', self.fore_b))
173
            lib.TCOD_console_fill_char(dest or ffi.NULL,
174
                                        ffi.new('int[]', self.char))
175
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
    .. versionchanged:: 2.0
187
        This class now acts like the other CData wrapped classes
188
        and no longer acts like a list.
189
190
    .. deprecated:: 2.0
191
        You should make your own dice functions instead of using this class
192
        which is tied to a CData object.
193
    """
194
195
    def __init__(self, *args, **kargs):
196
        super(Dice, self).__init__(*args, **kargs)
197
        if self.cdata == ffi.NULL:
198
            self._init(*args, **kargs)
199
200
    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...
201
        self.cdata = ffi.new('TCOD_dice_t*')
202
        self.nb_dices = nb_dices
203
        self.nb_faces = nb_faces
204
        self.multiplier = multiplier
205
        self.addsub = addsub
206
207
    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...
208
        return self.nb_rolls
209
    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...
210
        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...
211
    nb_dices = property(_get_nb_dices, _set_nb_dices)
212
213
    def __str__(self):
214
        add = '+(%s)' % self.addsub if self.addsub != 0 else ''
215
        return '%id%ix%s%s' % (self.nb_dices, self.nb_faces,
216
                               self.multiplier, add)
217
218
    def __repr__(self):
219
        return ('%s(nb_dices=%r,nb_faces=%r,multiplier=%r,addsub=%r)' %
220
                (self.__class__.__name__, self.nb_dices, self.nb_faces,
221
                 self.multiplier, self.addsub))
222
223
224
class Key(_CDataWrapper):
225
    """Key Event instance
226
227
    Attributes:
228
        vk (int): TCOD_keycode_t key code
229
        c (int): character if vk == TCODK_CHAR else 0
230
        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...
231
        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...
232
        lalt (bool): True when left alt is held.
233
        lctrl (bool): True when left control is held.
234
        lmeta (bool): True when left meta key is held.
235
        ralt (bool): True when right alt is held.
236
        rctrl (bool): True when right control is held.
237
        rmeta (bool): True when right meta key is held.
238
        shift (bool): True when any shift is held.
239
    """
240
241
    _BOOL_ATTRIBUTES = ('lalt', 'lctrl', 'lmeta',
242
                        'ralt', 'rctrl', 'rmeta', 'pressed', 'shift')
243
244
    def __init__(self, *args, **kargs):
245
        super(Key, self).__init__(*args, **kargs)
246
        if self.cdata == ffi.NULL:
247
            self.cdata = ffi.new('TCOD_key_t*')
248
249
    def __getattr__(self, attr):
250
        if attr in self._BOOL_ATTRIBUTES:
251
            return bool(getattr(self.cdata, attr))
252
        if attr == 'c':
253
            return ord(getattr(self.cdata, attr))
254
        if attr == 'text':
255
            return _unpack_char_p(getattr(self.cdata, attr))
256
        return super(Key, self).__getattr__(attr)
257
258
    def __repr__(self):
259
        """Return a representation of this Key object."""
260
        params = []
261
        params.append('vk=%r, c=%r, text=%r, pressed=%r' %
262
                      (self.vk, self.c, self.text, self.pressed))
263
        for attr in ['shift', 'lalt', 'lctrl', 'lmeta',
264
                     'ralt', 'rctrl', 'rmeta']:
265
            if getattr(self, attr):
266
                params.append('%s=%r' % (attr, getattr(self, attr)))
267
        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...
268
269
270
class Mouse(_CDataWrapper):
271
    """Mouse event instance
272
273
    Attributes:
274
        x (int): Absolute mouse position at pixel x.
275
        y (int):
276
        dx (int): Movement since last update in pixels.
277
        dy (int):
278
        cx (int): Cell coordinates in the root console.
279
        cy (int):
280
        dcx (int): Movement since last update in console cells.
281
        dcy (int):
282
        lbutton (bool): Left button status.
283
        rbutton (bool): Right button status.
284
        mbutton (bool): Middle button status.
285
        lbutton_pressed (bool): Left button pressed event.
286
        rbutton_pressed (bool): Right button pressed event.
287
        mbutton_pressed (bool): Middle button pressed event.
288
        wheel_up (bool): Wheel up event.
289
        wheel_down (bool): Wheel down event.
290
    """
291
292
    def __init__(self, *args, **kargs):
293
        super(Mouse, self).__init__(*args, **kargs)
294
        if self.cdata == ffi.NULL:
295
            self.cdata = ffi.new('TCOD_mouse_t*')
296
297
    def __repr__(self):
298
        """Return a representation of this Mouse object."""
299
        params = []
300
        for attr in ['x', 'y', 'dx', 'dy', 'cx', 'cy', 'dcx', 'dcy']:
301
            params.append('%s=%r' % (attr, getattr(self, attr)))
302
        for attr in ['lbutton', 'rbutton', 'mbutton',
303
                     'lbutton_pressed', 'rbutton_pressed', 'mbutton_pressed',
304
                     'wheel_up', 'wheel_down']:
305
            if getattr(self, attr):
306
                params.append('%s=%r' % (attr, getattr(self, attr)))
307
        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...
308
309
310
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...
311
    """Create a new BSP instance with the given rectangle.
312
313
    Args:
314
        x (int): Rectangle left coordinate.
315
        y (int): Rectangle top coordinate.
316
        w (int): Rectangle width.
317
        h (int): Rectangle height.
318
319
    Returns:
320
        BSP: A new BSP instance.
321
322
    .. deprecated:: 2.0
323
       Call the :any:`BSP` class instead.
324
    """
325
    return Bsp(x, y, w, h)
326
327
def bsp_split_once(node, horizontal, position):
328
    """
329
    .. deprecated:: 2.0
330
       Use :any:`BSP.split_once` instead.
331
    """
332
    node.split_once(horizontal, position)
333
334
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...
335
                        maxVRatio):
336
    """
337
    .. deprecated:: 2.0
338
       Use :any:`BSP.split_recursive` instead.
339
    """
340
    node.split_recursive(nb, minHSize, minVSize,
341
                         maxHRatio, maxVRatio, randomizer)
342
343
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...
344
    """
345
    .. deprecated:: 2.0
346
        Assign directly to :any:`BSP` attributes instead.
347
    """
348
    node.x = x
349
    node.y = y
350
    node.width = w
351
    node.height = h
352
353
def bsp_left(node):
354
    """
355
    .. deprecated:: 2.0
356
       Use :any:`BSP.children` instead.
357
    """
358
    return None if not node.children else node.children[0]
359
360
def bsp_right(node):
361
    """
362
    .. deprecated:: 2.0
363
       Use :any:`BSP.children` instead.
364
    """
365
    return None if not node.children else node.children[1]
366
367
def bsp_father(node):
368
    """
369
    .. deprecated:: 2.0
370
       Use :any:`BSP.parent` instead.
371
    """
372
    return node.parent
373
374
def bsp_is_leaf(node):
375
    """
376
    .. deprecated:: 2.0
377
       Use :any:`BSP.children` instead.
378
    """
379
    return not node.children
380
381
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...
382
    """
383
    .. deprecated:: 2.0
384
       Use :any:`BSP.contains` instead.
385
    """
386
    return node.contains(cx, cy)
387
388
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...
389
    """
390
    .. deprecated:: 2.0
391
       Use :any:`BSP.find_node` instead.
392
    """
393
    return node.find_node(cx, cy)
394
395
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...
396
    """pack callback into a handle for use with the callback
397
    _pycall_bsp_callback
398
    """
399
    for node in node_iter:
400
        callback(node, userData)
401
402
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...
403
    """Traverse this nodes hierarchy with a callback.
404
405
    .. deprecated:: 2.0
406
       Use :any:`BSP.walk` instead.
407
    """
408
    _bsp_traverse(node._iter_pre_order(), callback, userData)
409
410
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...
411
    """Traverse this nodes hierarchy with a callback.
412
413
    .. deprecated:: 2.0
414
       Use :any:`BSP.walk` instead.
415
    """
416
    _bsp_traverse(node._iter_in_order(), callback, userData)
417
418
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...
419
    """Traverse this nodes hierarchy with a callback.
420
421
    .. deprecated:: 2.0
422
       Use :any:`BSP.walk` instead.
423
    """
424
    _bsp_traverse(node._iter_post_order(), callback, userData)
425
426
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...
427
    """Traverse this nodes hierarchy with a callback.
428
429
    .. deprecated:: 2.0
430
       Use :any:`BSP.walk` instead.
431
    """
432
    _bsp_traverse(node._iter_level_order(), callback, userData)
433
434
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...
435
    """Traverse this nodes hierarchy with a callback.
436
437
    .. deprecated:: 2.0
438
       Use :any:`BSP.walk` instead.
439
    """
440
    _bsp_traverse(node._iter_inverted_level_order(), callback, userData)
441
442
def bsp_remove_sons(node):
443
    """Delete all children of a given node.  Not recommended.
444
445
    .. note::
446
       This function will add unnecessary complexity to your code.
447
       Don't use it.
448
449
    .. deprecated:: 2.0
450
       BSP deletion is automatic.
451
    """
452
    node.children = ()
453
454
def bsp_delete(node):
0 ignored issues
show
Unused Code introduced by
The argument node seems to be unused.
Loading history...
455
    """Exists for backward compatibility.  Does nothing.
456
457
    BSP's created by this library are automatically garbage collected once
458
    there are no references to the tree.
459
    This function exists for backwards compatibility.
460
461
    .. deprecated:: 2.0
462
       BSP deletion is automatic.
463
    """
464
    pass
465
466
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...
467
    """Return the linear interpolation between two colors.
468
469
    ``a`` is the interpolation value, with 0 returing ``c1``,
470
    1 returning ``c2``, and 0.5 returing a color halfway between both.
471
472
    Args:
473
        c1 (Union[Tuple[int, int, int], Sequence[int]]):
474
            The first color.  At a=0.
475
        c2 (Union[Tuple[int, int, int], Sequence[int]]):
476
            The second color.  At a=1.
477
        a (float): The interpolation value,
478
479
    Returns:
480
        Color: The interpolated Color.
481
    """
482
    return Color._new_from_cdata(lib.TCOD_color_lerp(c1, c2, a))
483
484
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...
485
    """Set a color using: hue, saturation, and value parameters.
486
487
    Does not return a new Color.  ``c`` is modified inplace.
488
489
    Args:
490
        c (Union[Color, List[Any]]): A Color instance, or a list of any kind.
491
        h (float): Hue, from 0 to 360.
492
        s (float): Saturation, from 0 to 1.
493
        v (float): Value, from 0 to 1.
494
    """
495
    new_color = ffi.new('TCOD_color_t*')
496
    lib.TCOD_color_set_HSV(new_color, h, s, v)
497
    c[:] = new_color.r, new_color.g, new_color.b
498
499
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...
500
    """Return the (hue, saturation, value) of a color.
501
502
    Args:
503
        c (Union[Tuple[int, int, int], Sequence[int]]):
504
            An (r, g, b) sequence or Color instance.
505
506
    Returns:
507
        Tuple[float, float, float]:
508
            A tuple with (hue, saturation, value) values, from 0 to 1.
509
    """
510
    hsv = ffi.new('float [3]')
511
    lib.TCOD_color_get_HSV(c, hsv, hsv + 1, hsv + 2)
512
    return hsv[0], hsv[1], hsv[2]
513
514
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...
515
    """Scale a color's saturation and value.
516
517
    Does not return a new Color.  ``c`` is modified inplace.
518
519
    Args:
520
        c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list.
521
        scoef (float): Saturation multiplier, from 0 to 1.
522
                       Use 1 to keep current saturation.
523
        vcoef (float): Value multiplier, from 0 to 1.
524
                       Use 1 to keep current value.
525
    """
526
    color_p = ffi.new('TCOD_color_t*')
527
    color_p.r, color_p.g, color_p.b = c.r, c.g, c.b
528
    lib.TCOD_color_scale_HSV(color_p, scoef, vcoef)
529
    c[:] = color_p.r, color_p.g, color_p.b
530
531
def color_gen_map(colors, indexes):
532
    """Return a smoothly defined scale of colors.
533
534
    If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
535
    will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
536
    All in-betweens will be filled with a gradient.
537
538
    Args:
539
        colors (Iterable[Union[Tuple[int, int, int], Sequence[int]]]):
540
            Array of colors to be sampled.
541
        indexes (Iterable[int]): A list of indexes.
542
543
    Returns:
544
        List[Color]: A list of Color instances.
545
546
    Example:
547
        >>> tcod.color_gen_map([(0, 0, 0), (255, 128, 0)], [0, 5])
548
        [Color(0,0,0), Color(51,25,0), Color(102,51,0), Color(153,76,0), \
549
Color(204,102,0), Color(255,128,0)]
550
    """
551
    ccolors = ffi.new('TCOD_color_t[]', colors)
552
    cindexes = ffi.new('int[]', indexes)
553
    cres = ffi.new('TCOD_color_t[]', max(indexes) + 1)
554
    lib.TCOD_color_gen_map(cres, len(colors), ccolors, cindexes)
555
    return [Color._new_from_cdata(cdata) for cdata in cres]
556
557
558
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...
559
                      renderer=RENDERER_GLSL):
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'RENDERER_GLSL'
Loading history...
560
    """Set up the primary display and return the root console.
561
562
    Args:
563
        w (int): Width in character tiles for the root console.
564
        h (int): Height in character tiles for the root console.
565
        title (AnyStr):
566
            This string will be displayed on the created windows title bar.
567
        renderer: Rendering mode for libtcod to use.
568
569
    Returns:
570
        Console:
571
            Returns a special Console instance representing the root console.
572
    """
573
    lib.TCOD_console_init_root(w, h, _bytes(title), fullscreen, renderer)
574
    return tcod.console.Console._from_cdata(ffi.NULL) # root console is null
575
576
577
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...
578
                            nb_char_horiz=0, nb_char_vertic=0):
579
    """Load a custom font file.
580
581
    Call this before function before calling :any:`tcod.console_init_root`.
582
583
    Flags can be a mix of the following:
584
585
    * tcod.FONT_LAYOUT_ASCII_INCOL
586
    * tcod.FONT_LAYOUT_ASCII_INROW
587
    * tcod.FONT_TYPE_GREYSCALE
588
    * tcod.FONT_TYPE_GRAYSCALE
589
    * tcod.FONT_LAYOUT_TCOD
590
591
    Args:
592
        fontFile (AnyStr): Path to a font file.
593
        flags (int):
594
        nb_char_horiz (int):
595
        nb_char_vertic (int):
596
    """
597
    lib.TCOD_console_set_custom_font(_bytes(fontFile), flags,
598
                                     nb_char_horiz, nb_char_vertic)
599
600
601
def console_get_width(con):
602
    """Return the width of a console.
603
604
    Args:
605
        con (Console): Any Console instance.
606
607
    Returns:
608
        int: The width of a Console.
609
610
    .. deprecated:: 2.0
611
        Use `Console.get_width` instead.
612
    """
613
    return lib.TCOD_console_get_width(con.console_c if con else ffi.NULL)
614
615
def console_get_height(con):
616
    """Return the height of a console.
617
618
    Args:
619
        con (Console): Any Console instance.
620
621
    Returns:
622
        int: The height of a Console.
623
624
    .. deprecated:: 2.0
625
        Use `Console.get_hright` instead.
626
    """
627
    return lib.TCOD_console_get_height(con.console_c if con else ffi.NULL)
628
629
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...
630
    """Set a character code to new coordinates on the tile-set.
631
632
    `asciiCode` must be within the bounds created during the initialization of
633
    the loaded tile-set.  For example, you can't use 255 here unless you have a
634
    256 tile tile-set loaded.  This applies to all functions in this group.
635
636
    Args:
637
        asciiCode (int): The character code to change.
638
        fontCharX (int): The X tile coordinate on the loaded tileset.
639
                         0 is the leftmost tile.
640
        fontCharY (int): The Y tile coordinate on the loaded tileset.
641
                         0 is the topmost tile.
642
    """
643
    lib.TCOD_console_map_ascii_code_to_font(_int(asciiCode), fontCharX,
644
                                                              fontCharY)
645
646
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...
647
                                    fontCharY):
648
    """Remap a contiguous set of codes to a contiguous set of tiles.
649
650
    Both the tile-set and character codes must be contiguous to use this
651
    function.  If this is not the case you may want to use
652
    :any:`console_map_ascii_code_to_font`.
653
654
    Args:
655
        firstAsciiCode (int): The starting character code.
656
        nbCodes (int): The length of the contiguous set.
657
        fontCharX (int): The starting X tile coordinate on the loaded tileset.
658
                         0 is the leftmost tile.
659
        fontCharY (int): The starting Y tile coordinate on the loaded tileset.
660
                         0 is the topmost tile.
661
662
    """
663
    lib.TCOD_console_map_ascii_codes_to_font(_int(firstAsciiCode), nbCodes,
664
                                              fontCharX, fontCharY)
665
666
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...
667
    """Remap a string of codes to a contiguous set of tiles.
668
669
    Args:
670
        s (AnyStr): A string of character codes to map to new values.
671
                    The null character `'\x00'` will prematurely end this
672
                    function.
673
        fontCharX (int): The starting X tile coordinate on the loaded tileset.
674
                         0 is the leftmost tile.
675
        fontCharY (int): The starting Y tile coordinate on the loaded tileset.
676
                         0 is the topmost tile.
677
    """
678
    lib.TCOD_console_map_string_to_font_utf(_unicode(s), fontCharX, fontCharY)
679
680
def console_is_fullscreen():
681
    """Returns True if the display is fullscreen.
682
683
    Returns:
684
        bool: True if the display is fullscreen, otherwise False.
685
    """
686
    return bool(lib.TCOD_console_is_fullscreen())
687
688
def console_set_fullscreen(fullscreen):
689
    """Change the display to be fullscreen or windowed.
690
691
    Args:
692
        fullscreen (bool): Use True to change to fullscreen.
693
                           Use False to change to windowed.
694
    """
695
    lib.TCOD_console_set_fullscreen(fullscreen)
696
697
def console_is_window_closed():
698
    """Returns True if the window has received and exit event."""
699
    return lib.TCOD_console_is_window_closed()
700
701
def console_set_window_title(title):
702
    """Change the current title bar string.
703
704
    Args:
705
        title (AnyStr): A string to change the title bar to.
706
    """
707
    lib.TCOD_console_set_window_title(_bytes(title))
708
709
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...
710
    lib.TCOD_console_credits()
711
712
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...
713
    lib.TCOD_console_credits_reset()
714
715
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...
716
    return lib.TCOD_console_credits_render(x, y, alpha)
717
718
def console_flush():
719
    """Update the display to represent the root consoles current state."""
720
    lib.TCOD_console_flush()
721
722
# drawing on a console
723
def console_set_default_background(con, col):
724
    """Change the default background color for a console.
725
726
    Args:
727
        con (Console): Any Console instance.
728
        col (Union[Tuple[int, int, int], Sequence[int]]):
729
            An (r, g, b) sequence or Color instance.
730
    """
731
    lib.TCOD_console_set_default_background(
732
        con.console_c if con else ffi.NULL, col)
733
734
def console_set_default_foreground(con, col):
735
    """Change the default foreground color for a console.
736
737
    Args:
738
        con (Console): Any Console instance.
739
        col (Union[Tuple[int, int, int], Sequence[int]]):
740
            An (r, g, b) sequence or Color instance.
741
    """
742
    lib.TCOD_console_set_default_foreground(
743
        con.console_c if con else ffi.NULL, col)
744
745
def console_clear(con):
746
    """Reset a console to its default colors and the space character.
747
748
    Args:
749
        con (Console): Any Console instance.
750
751
    .. seealso::
752
       :any:`console_set_default_background`
753
       :any:`console_set_default_foreground`
754
    """
755
    return lib.TCOD_console_clear(con.console_c if con else ffi.NULL)
756
757
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...
758
    """Draw the character c at x,y using the default colors and a blend mode.
759
760
    Args:
761
        con (Console): Any Console instance.
762
        x (int): Character x position from the left.
763
        y (int): Character y position from the top.
764
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
765
        flag (int): Blending mode to use, defaults to BKGND_DEFAULT.
766
    """
767
    lib.TCOD_console_put_char(
768
        con.console_c if con else ffi.NULL, x, y, _int(c), flag)
769
770
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...
771
    """Draw the character c at x,y using the colors fore and back.
772
773
    Args:
774
        con (Console): Any Console instance.
775
        x (int): Character x position from the left.
776
        y (int): Character y position from the top.
777
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
778
        fore (Union[Tuple[int, int, int], Sequence[int]]):
779
            An (r, g, b) sequence or Color instance.
780
        back (Union[Tuple[int, int, int], Sequence[int]]):
781
            An (r, g, b) sequence or Color instance.
782
    """
783
    lib.TCOD_console_put_char_ex(con.console_c if con else ffi.NULL, x, y,
784
                                 _int(c), fore, back)
785
786
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...
787
    """Change the background color of x,y to col using a blend mode.
788
789
    Args:
790
        con (Console): Any Console instance.
791
        x (int): Character x position from the left.
792
        y (int): Character y position from the top.
793
        col (Union[Tuple[int, int, int], Sequence[int]]):
794
            An (r, g, b) sequence or Color instance.
795
        flag (int): Blending mode to use, defaults to BKGND_SET.
796
    """
797
    lib.TCOD_console_set_char_background(
798
        con.console_c if con else ffi.NULL, x, y, col, flag)
799
800
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...
801
    """Change the foreground color of x,y to col.
802
803
    Args:
804
        con (Console): Any Console instance.
805
        x (int): Character x position from the left.
806
        y (int): Character y position from the top.
807
        col (Union[Tuple[int, int, int], Sequence[int]]):
808
            An (r, g, b) sequence or Color instance.
809
    """
810
    lib.TCOD_console_set_char_foreground(
811
        con.console_c if con else ffi.NULL, x, y, col)
812
813
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...
814
    """Change the character at x,y to c, keeping the current colors.
815
816
    Args:
817
        con (Console): Any Console instance.
818
        x (int): Character x position from the left.
819
        y (int): Character y position from the top.
820
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
821
    """
822
    lib.TCOD_console_set_char(
823
        con.console_c if con else ffi.NULL, x, y, _int(c))
824
825
def console_set_background_flag(con, flag):
826
    """Change the default blend mode for this console.
827
828
    Args:
829
        con (Console): Any Console instance.
830
        flag (int): Blend mode to use by default.
831
    """
832
    lib.TCOD_console_set_background_flag(
833
        con.console_c if con else ffi.NULL, flag)
834
835
def console_get_background_flag(con):
836
    """Return this consoles current blend mode.
837
838
    Args:
839
        con (Console): Any Console instance.
840
    """
841
    return lib.TCOD_console_get_background_flag(
842
        con.console_c if con else ffi.NULL)
843
844
def console_set_alignment(con, alignment):
845
    """Change this consoles current alignment mode.
846
847
    * tcod.LEFT
848
    * tcod.CENTER
849
    * tcod.RIGHT
850
851
    Args:
852
        con (Console): Any Console instance.
853
        alignment (int):
854
    """
855
    lib.TCOD_console_set_alignment(
856
        con.console_c if con else ffi.NULL, alignment)
857
858
def console_get_alignment(con):
859
    """Return this consoles current alignment mode.
860
861
    Args:
862
        con (Console): Any Console instance.
863
    """
864
    return lib.TCOD_console_get_alignment(con.console_c if con else ffi.NULL)
865
866
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...
867
    """Print a color formatted string on a console.
868
869
    Args:
870
        con (Console): Any Console instance.
871
        x (int): Character x position from the left.
872
        y (int): Character y position from the top.
873
        fmt (AnyStr): A unicode or bytes string optionaly using color codes.
874
    """
875
    lib.TCOD_console_print_utf(
876
        con.console_c if con else ffi.NULL, x, y, _fmt_unicode(fmt))
877
878
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...
879
    """Print a string on a console using a blend mode and alignment mode.
880
881
    Args:
882
        con (Console): Any Console instance.
883
        x (int): Character x position from the left.
884
        y (int): Character y position from the top.
885
    """
886
    lib.TCOD_console_print_ex_utf(con.console_c if con else ffi.NULL,
887
                                  x, y, flag, alignment, _fmt_unicode(fmt))
888
889
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...
890
    """Print a string constrained to a rectangle.
891
892
    If h > 0 and the bottom of the rectangle is reached,
893
    the string is truncated. If h = 0,
894
    the string is only truncated if it reaches the bottom of the console.
895
896
897
898
    Returns:
899
        int: The number of lines of text once word-wrapped.
900
    """
901
    return lib.TCOD_console_print_rect_utf(
902
        con.console_c if con else ffi.NULL, x, y, w, h, _fmt_unicode(fmt))
903
904
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...
905
    """Print a string constrained to a rectangle with blend and alignment.
906
907
    Returns:
908
        int: The number of lines of text once word-wrapped.
909
    """
910
    return lib.TCOD_console_print_rect_ex_utf(
911
        con.console_c if con else ffi.NULL,
912
        x, y, w, h, flag, alignment, _fmt_unicode(fmt))
913
914
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...
915
    """Return the height of this text once word-wrapped into this rectangle.
916
917
    Returns:
918
        int: The number of lines of text once word-wrapped.
919
    """
920
    return lib.TCOD_console_get_height_rect_utf(
921
        con.console_c if con else ffi.NULL, x, y, w, h, _fmt_unicode(fmt))
922
923
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...
924
    """Draw a the background color on a rect optionally clearing the text.
925
926
    If clr is True the affected tiles are changed to space character.
927
    """
928
    lib.TCOD_console_rect(
929
        con.console_c if con else ffi.NULL, x, y, w, h, clr, flag)
930
931
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...
932
    """Draw a horizontal line on the console.
933
934
    This always uses the character 196, the horizontal line character.
935
    """
936
    lib.TCOD_console_hline(con.console_c if con else ffi.NULL, x, y, l, flag)
937
938
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...
939
    """Draw a vertical line on the console.
940
941
    This always uses the character 179, the vertical line character.
942
    """
943
    lib.TCOD_console_vline(con.console_c if con else ffi.NULL, x, y, l, flag)
944
945
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...
946
    """Draw a framed rectangle with optinal text.
947
948
    This uses the default background color and blend mode to fill the
949
    rectangle and the default foreground to draw the outline.
950
951
    fmt will be printed on the inside of the rectangle, word-wrapped.
952
    """
953
    lib.TCOD_console_print_frame(
954
        con.console_c if con else ffi.NULL,
955
        x, y, w, h, clear, flag, _fmt_bytes(fmt))
956
957
def console_set_color_control(con, fore, back):
958
    """Configure :any:`color controls`.
959
960
    Args:
961
        con (int): :any:`Color control` constant to modify.
962
        fore (Union[Tuple[int, int, int], Sequence[int]]):
963
            An (r, g, b) sequence or Color instance.
964
        back (Union[Tuple[int, int, int], Sequence[int]]):
965
            An (r, g, b) sequence or Color instance.
966
    """
967
    lib.TCOD_console_set_color_control(con, fore, back)
968
969
def console_get_default_background(con):
970
    """Return this consoles default background color."""
971
    return Color._new_from_cdata(
972
        lib.TCOD_console_get_default_background(
973
            con.console_c if con else ffi.NULL))
974
975
def console_get_default_foreground(con):
976
    """Return this consoles default foreground color."""
977
    return Color._new_from_cdata(
978
        lib.TCOD_console_get_default_foreground(
979
            con.console_c if con else ffi.NULL))
980
981
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...
982
    """Return the background color at the x,y of this console."""
983
    return Color._new_from_cdata(
984
        lib.TCOD_console_get_char_background(
985
            con.console_c if con else ffi.NULL, x, y))
986
987
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...
988
    """Return the foreground color at the x,y of this console."""
989
    return Color._new_from_cdata(
990
        lib.TCOD_console_get_char_foreground(
991
            con.console_c if con else ffi.NULL, x, y))
992
993
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...
994
    """Return the character at the x,y of this console."""
995
    return lib.TCOD_console_get_char(con.console_c if con else ffi.NULL, x, y)
996
997
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...
998
    lib.TCOD_console_set_fade(fade, fadingColor)
999
1000
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...
1001
    return lib.TCOD_console_get_fade()
1002
1003
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...
1004
    return Color._new_from_cdata(lib.TCOD_console_get_fading_color())
1005
1006
# handling keyboard input
1007
def console_wait_for_keypress(flush):
1008
    """Block until the user presses a key, then returns a new Key.
1009
1010
    Args:
1011
        flush bool: If True then the event queue is cleared before waiting
1012
                    for the next event.
1013
1014
    Returns:
1015
        Key: A new Key instance.
1016
    """
1017
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
1018
    lib.TCOD_console_wait_for_keypress_wrapper(k.cdata, flush)
1019
    return k
1020
1021
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...
1022
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
1023
    lib.TCOD_console_check_for_keypress_wrapper(k.cdata, flags)
1024
    return k
1025
1026
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...
1027
    return lib.TCOD_console_is_key_pressed(key)
1028
1029
# using offscreen consoles
1030
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...
1031
    """Return an offscreen console of size: w,h."""
1032
    return tcod.console.Console(w, h)
1033
1034
def console_from_file(filename):
1035
    """Return a new console object from a filename.
1036
1037
    The file format is automactially determined.  This can load REXPaint `.xp`,
1038
    ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files.
1039
1040
    Args:
1041
        filename (Text): The path to the file, as a string.
1042
1043
    Returns: A new :any`Console` instance.
1044
    """
1045
    return tcod.console.Console._from_cdata(
1046
        lib.TCOD_console_from_file(filename.encode('utf-8')))
1047
1048
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...
1049
    """Blit the console src from x,y,w,h to console dst at xdst,ydst."""
1050
    lib.TCOD_console_blit(
1051
        src.console_c if src else ffi.NULL, x, y, w, h,
1052
        dst.console_c if dst else ffi.NULL, xdst, ydst, ffade, bfade)
1053
1054
def console_set_key_color(con, col):
1055
    """Set a consoles blit transparent color."""
1056
    lib.TCOD_console_set_key_color(con.console_c if con else ffi.NULL, col)
1057
    if hasattr(con, 'set_key_color'):
1058
        con.set_key_color(col)
1059
1060
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...
1061
    con = con.console_c if con else ffi.NULL
1062
    if con == ffi.NULL:
1063
        lib.TCOD_console_delete(con)
1064
1065
# fast color filling
1066 View Code Duplication
def console_fill_foreground(con, r, g, b):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
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...
1067
    """Fill the foregound of a console with r,g,b.
1068
1069
    Args:
1070
        con (Console): Any Console instance.
1071
        r (Sequence[int]): An array of integers with a length of width*height.
1072
        g (Sequence[int]): An array of integers with a length of width*height.
1073
        b (Sequence[int]): An array of integers with a length of width*height.
1074
    """
1075
    if len(r) != len(g) or len(r) != len(b):
1076
        raise TypeError('R, G and B must all have the same size.')
1077
    if (isinstance(r, _np.ndarray) and isinstance(g, _np.ndarray) and
1078
            isinstance(b, _np.ndarray)):
1079
        #numpy arrays, use numpy's ctypes functions
1080
        r = _np.ascontiguousarray(r, dtype=_np.intc)
1081
        g = _np.ascontiguousarray(g, dtype=_np.intc)
1082
        b = _np.ascontiguousarray(b, dtype=_np.intc)
1083
        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...
1084
        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...
1085
        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...
1086
    else:
1087
        # otherwise convert using ffi arrays
1088
        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...
1089
        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...
1090
        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...
1091
1092
    lib.TCOD_console_fill_foreground(con.console_c if con else ffi.NULL,
1093
                                     cr, cg, cb)
1094
1095 View Code Duplication
def console_fill_background(con, r, g, b):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
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...
1096
    """Fill the backgound of a console with r,g,b.
1097
1098
    Args:
1099
        con (Console): Any Console instance.
1100
        r (Sequence[int]): An array of integers with a length of width*height.
1101
        g (Sequence[int]): An array of integers with a length of width*height.
1102
        b (Sequence[int]): An array of integers with a length of width*height.
1103
    """
1104
    if len(r) != len(g) or len(r) != len(b):
1105
        raise TypeError('R, G and B must all have the same size.')
1106
    if (isinstance(r, _np.ndarray) and isinstance(g, _np.ndarray) and
1107
            isinstance(b, _np.ndarray)):
1108
        #numpy arrays, use numpy's ctypes functions
1109
        r = _np.ascontiguousarray(r, dtype=_np.intc)
1110
        g = _np.ascontiguousarray(g, dtype=_np.intc)
1111
        b = _np.ascontiguousarray(b, dtype=_np.intc)
1112
        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...
1113
        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...
1114
        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...
1115
    else:
1116
        # otherwise convert using ffi arrays
1117
        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...
1118
        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...
1119
        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...
1120
1121
    lib.TCOD_console_fill_background(con.console_c if con else ffi.NULL,
1122
                                     cr, cg, cb)
1123
1124
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...
1125
    """Fill the character tiles of a console with an array.
1126
1127
    Args:
1128
        con (Console): Any Console instance.
1129
        arr (Sequence[int]): An array of integers with a length of width*height.
1130
    """
1131
    if isinstance(arr, _np.ndarray):
1132
        #numpy arrays, use numpy's ctypes functions
1133
        arr = _np.ascontiguousarray(arr, dtype=_np.intc)
1134
        carr = ffi.cast('int *', arr.ctypes.data)
1135
    else:
1136
        #otherwise convert using the ffi module
1137
        carr = ffi.new('int[]', arr)
1138
1139
    lib.TCOD_console_fill_char(con.console_c if con else ffi.NULL, carr)
1140
1141
def console_load_asc(con, filename):
1142
    """Update a console from a non-delimited ASCII `.asc` file."""
1143
    return lib.TCOD_console_load_asc(
1144
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1145
1146
def console_save_asc(con, filename):
1147
    """Save a console to a non-delimited ASCII `.asc` file."""
1148
    return lib.TCOD_console_save_asc(
1149
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1150
1151
def console_load_apf(con, filename):
1152
    """Update a console from an ASCII Paint `.apf` file."""
1153
    return lib.TCOD_console_load_apf(
1154
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1155
1156
def console_save_apf(con, filename):
1157
    """Save a console to an ASCII Paint `.apf` file."""
1158
    return lib.TCOD_console_save_apf(
1159
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1160
1161
def console_load_xp(con, filename):
1162
    """Update a console from a REXPaint `.xp` file."""
1163
    return lib.TCOD_console_load_xp(
1164
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1165
1166
def console_save_xp(con, filename, compress_level=9):
1167
    """Save a console to a REXPaint `.xp` file."""
1168
    return lib.TCOD_console_save_xp(
1169
        con.console_c if con else ffi.NULL,
1170
        filename.encode('utf-8'),
1171
        compress_level,
1172
        )
1173
1174
def console_from_xp(filename):
1175
    """Return a single console from a REXPaint `.xp` file."""
1176
    return tcod.console.Console._from_cdata(
1177
        lib.TCOD_console_from_xp(filename.encode('utf-8')))
1178
1179
def console_list_load_xp(filename):
1180
    """Return a list of consoles from a REXPaint `.xp` file."""
1181
    tcod_list = lib.TCOD_console_list_from_xp(filename.encode('utf-8'))
1182
    if tcod_list == ffi.NULL:
1183
        return None
1184
    try:
1185
        python_list = []
1186
        lib.TCOD_list_reverse(tcod_list)
1187
        while not lib.TCOD_list_is_empty(tcod_list):
1188
            python_list.append(
1189
                tcod.console.Console._from_cdata(lib.TCOD_list_pop(tcod_list)),
1190
                )
1191
        return python_list
1192
    finally:
1193
        lib.TCOD_list_delete(tcod_list)
1194
1195
def console_list_save_xp(console_list, filename, compress_level=9):
1196
    """Save a list of consoles to a REXPaint `.xp` file."""
1197
    tcod_list = lib.TCOD_list_new()
1198
    try:
1199
        for console in console_list:
1200
            lib.TCOD_list_push(tcod_list,
1201
                               console.console_c if console else ffi.NULL)
1202
        return lib.TCOD_console_list_save_xp(
1203
            tcod_list, filename.encode('utf-8'), compress_level
1204
            )
1205
    finally:
1206
        lib.TCOD_list_delete(tcod_list)
1207
1208
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...
1209
    """Return a new AStar using the given Map.
1210
1211
    Args:
1212
        m (Map): A Map instance.
1213
        dcost (float): The path-finding cost of diagonal movement.
1214
                       Can be set to 0 to disable diagonal movement.
1215
    Returns:
1216
        AStar: A new AStar instance.
1217
    """
1218
    return tcod.path.AStar(m, dcost)
1219
1220
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...
1221
    """Return a new AStar using the given callable function.
1222
1223
    Args:
1224
        w (int): Clipping width.
1225
        h (int): Clipping height.
1226
        func (Callable[[int, int, int, int, Any], float]):
1227
        userData (Any):
1228
        dcost (float): A multiplier for the cost of diagonal movement.
1229
                       Can be set to 0 to disable diagonal movement.
1230
    Returns:
1231
        AStar: A new AStar instance.
1232
    """
1233
    return tcod.path.AStar(
1234
        tcod.path._EdgeCostFunc((func, userData), w, h),
1235
        dcost,
1236
        )
1237
1238
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...
1239
    """Find a path from (ox, oy) to (dx, dy).  Return True if path is found.
1240
1241
    Args:
1242
        p (AStar): An AStar instance.
1243
        ox (int): Starting x position.
1244
        oy (int): Starting y position.
1245
        dx (int): Destination x position.
1246
        dy (int): Destination y position.
1247
    Returns:
1248
        bool: True if a valid path was found.  Otherwise False.
1249
    """
1250
    return lib.TCOD_path_compute(p._path_c, ox, oy, dx, dy)
1251
1252
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...
1253
    """Get the current origin position.
1254
1255
    This point moves when :any:`path_walk` returns the next x,y step.
1256
1257
    Args:
1258
        p (AStar): An AStar instance.
1259
    Returns:
1260
        Tuple[int, int]: An (x, y) point.
1261
    """
1262
    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...
1263
    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...
1264
    lib.TCOD_path_get_origin(p._path_c, x, y)
1265
    return x[0], y[0]
1266
1267
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...
1268
    """Get the current destination position.
1269
1270
    Args:
1271
        p (AStar): An AStar instance.
1272
    Returns:
1273
        Tuple[int, int]: An (x, y) point.
1274
    """
1275
    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...
1276
    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...
1277
    lib.TCOD_path_get_destination(p._path_c, x, y)
1278
    return x[0], y[0]
1279
1280
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...
1281
    """Return the current length of the computed path.
1282
1283
    Args:
1284
        p (AStar): An AStar instance.
1285
    Returns:
1286
        int: Length of the path.
1287
    """
1288
    return lib.TCOD_path_size(p._path_c)
1289
1290
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...
1291
    """Reverse the direction of a path.
1292
1293
    This effectively swaps the origin and destination points.
1294
1295
    Args:
1296
        p (AStar): An AStar instance.
1297
    """
1298
    lib.TCOD_path_reverse(p._path_c)
1299
1300
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...
1301
    """Get a point on a path.
1302
1303
    Args:
1304
        p (AStar): An AStar instance.
1305
        idx (int): Should be in range: 0 <= inx < :any:`path_size`
1306
    """
1307
    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...
1308
    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...
1309
    lib.TCOD_path_get(p._path_c, idx, x, y)
1310
    return x[0], y[0]
1311
1312
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...
1313
    """Return True if a path is empty.
1314
1315
    Args:
1316
        p (AStar): An AStar instance.
1317
    Returns:
1318
        bool: True if a path is empty.  Otherwise False.
1319
    """
1320
    return lib.TCOD_path_is_empty(p._path_c)
1321
1322
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...
1323
    """Return the next (x, y) point in a path, or (None, None) if it's empty.
1324
1325
    When ``recompute`` is True and a previously valid path reaches a point
1326
    where it is now blocked, a new path will automatically be found.
1327
1328
    Args:
1329
        p (AStar): An AStar instance.
1330
        recompute (bool): Recompute the path automatically.
1331
    Returns:
1332
        Union[Tuple[int, int], Tuple[None, None]]:
1333
            A single (x, y) point, or (None, None)
1334
    """
1335
    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...
1336
    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...
1337
    if lib.TCOD_path_walk(p._path_c, x, y, recompute):
1338
        return x[0], y[0]
1339
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1340
1341
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...
1342
    """Does nothing."""
1343
    pass
1344
1345
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...
1346
    return tcod.path.Dijkstra(m, dcost)
1347
1348
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...
1349
    return tcod.path.Dijkstra(
1350
        tcod.path._EdgeCostFunc((func, userData), w, h),
1351
        dcost,
1352
        )
1353
1354
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...
1355
    lib.TCOD_dijkstra_compute(p._path_c, ox, oy)
1356
1357
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...
1358
    return lib.TCOD_dijkstra_path_set(p._path_c, x, y)
1359
1360
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...
1361
    return lib.TCOD_dijkstra_get_distance(p._path_c, x, y)
1362
1363
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...
1364
    return lib.TCOD_dijkstra_size(p._path_c)
1365
1366
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...
1367
    lib.TCOD_dijkstra_reverse(p._path_c)
1368
1369
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...
1370
    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...
1371
    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...
1372
    lib.TCOD_dijkstra_get(p._path_c, idx, x, y)
1373
    return x[0], y[0]
1374
1375
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...
1376
    return lib.TCOD_dijkstra_is_empty(p._path_c)
1377
1378
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...
1379
    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...
1380
    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...
1381
    if lib.TCOD_dijkstra_path_walk(p._path_c, x, y):
1382
        return x[0], y[0]
1383
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1384
1385
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...
1386
    pass
1387
1388
def _heightmap_cdata(array):
1389
    """Return a new TCOD_heightmap_t instance using an array.
1390
1391
    Formatting is verified during this function.
1392
    """
1393
    if not array.flags['C_CONTIGUOUS']:
1394
        raise ValueError('array must be a C-style contiguous segment.')
1395
    if array.dtype != _np.float32:
1396
        raise ValueError('array dtype must be float32, not %r' % array.dtype)
1397
    width, height = array.shape
1398
    pointer = ffi.cast('float *', array.ctypes.data)
1399
    return ffi.new('TCOD_heightmap_t *', (width, height, pointer))
1400
1401
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...
1402
    """Return a new numpy.ndarray formatted for use with heightmap functions.
1403
1404
    You can pass a numpy array to any heightmap function as long as all the
1405
    following are true::
1406
    * The array is 2 dimentional.
1407
    * The array has the C_CONTIGUOUS flag.
1408
    * The array's dtype is :any:`dtype.float32`.
1409
1410
    Args:
1411
        w (int): The width of the new HeightMap.
1412
        h (int): The height of the new HeightMap.
1413
1414
    Returns:
1415
        numpy.ndarray: A C-contiguous mapping of float32 values.
1416
    """
1417
    return _np.ndarray((h, w), _np.float32)
1418
1419
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...
1420
    """Set the value of a point on a heightmap.
1421
1422
    Args:
1423
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1424
        x (int): The x position to change.
1425
        y (int): The y position to change.
1426
        value (float): The value to set.
1427
1428
    .. deprecated:: 2.0
1429
        Do ``hm[y, x] = value`` instead.
1430
    """
1431
    hm[y, x] = value
1432
1433
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...
1434
    """Add value to all values on this heightmap.
1435
1436
    Args:
1437
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1438
        value (float): A number to add to this heightmap.
1439
1440
    .. deprecated:: 2.0
1441
        Do ``hm[:] += value`` instead.
1442
    """
1443
    hm[:] += value
1444
1445
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...
1446
    """Multiply all items on this heightmap by value.
1447
1448
    Args:
1449
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1450
        value (float): A number to scale this heightmap by.
1451
1452
    .. deprecated:: 2.0
1453
        Do ``hm[:] *= value`` instead.
1454
    """
1455
    hm[:] *= value
1456
1457
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...
1458
    """Add value to all values on this heightmap.
1459
1460
    Args:
1461
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1462
1463
    .. deprecated:: 2.0
1464
        Do ``hm.array[:] = 0`` instead.
1465
    """
1466
    hm[:] = 0
1467
1468
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...
1469
    """Clamp all values on this heightmap between ``mi`` and ``ma``
1470
1471
    Args:
1472
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1473
        mi (float): The lower bound to clamp to.
1474
        ma (float): The upper bound to clamp to.
1475
1476
    .. deprecated:: 2.0
1477
        Do ``hm.clip(mi, ma)`` instead.
1478
    """
1479
    hm.clip(mi, ma)
1480
1481
def heightmap_copy(hm1, hm2):
1482
    """Copy the heightmap ``hm1`` to ``hm2``.
1483
1484
    Args:
1485
        hm1 (numpy.ndarray): The source heightmap.
1486
        hm2 (numpy.ndarray): The destination heightmap.
1487
1488
    .. deprecated:: 2.0
1489
        Do ``hm2[:] = hm1[:]`` instead.
1490
    """
1491
    hm2[:] = hm1[:]
1492
1493
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...
1494
    """Normalize heightmap values between ``mi`` and ``ma``.
1495
1496
    Args:
1497
        mi (float): The lowest value after normalization.
1498
        ma (float): The highest value after normalization.
1499
    """
1500
    lib.TCOD_heightmap_normalize(_heightmap_cdata(hm), mi, ma)
1501
1502
def heightmap_lerp_hm(hm1, hm2, hm3, coef):
1503
    """Perform linear interpolation between two heightmaps storing the result
1504
    in ``hm3``.
1505
1506
    This is the same as doing ``hm3[:] = hm1[:] + (hm2[:] - hm1[:]) * coef``
1507
1508
    Args:
1509
        hm1 (numpy.ndarray): The first heightmap.
1510
        hm2 (numpy.ndarray): The second heightmap to add to the first.
1511
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1512
        coef (float): The linear interpolation coefficient.
1513
    """
1514
    lib.TCOD_heightmap_lerp_hm(_heightmap_cdata(hm1), _heightmap_cdata(hm2),
1515
                               _heightmap_cdata(hm3), coef)
1516
1517
def heightmap_add_hm(hm1, hm2, hm3):
1518
    """Add two heightmaps together and stores the result in ``hm3``.
1519
1520
    Args:
1521
        hm1 (numpy.ndarray): The first heightmap.
1522
        hm2 (numpy.ndarray): The second heightmap to add to the first.
1523
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1524
1525
    .. deprecated:: 2.0
1526
        Do ``hm3[:] = hm1[:] + hm2[:]`` instead.
1527
    """
1528
    hm3[:] = hm1[:] + hm2[:]
1529
1530
def heightmap_multiply_hm(hm1, hm2, hm3):
1531
    """Multiplies two heightmap's together and stores the result in ``hm3``.
1532
1533
    Args:
1534
        hm1 (numpy.ndarray): The first heightmap.
1535
        hm2 (numpy.ndarray): The second heightmap to multiply with the first.
1536
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1537
1538
    .. deprecated:: 2.0
1539
        Do ``hm3[:] = hm1[:] * hm2[:]`` instead.
1540
        Alternatively you can do ``HeightMap(hm1.array[:] * hm2.array[:])``.
1541
    """
1542
    hm3[:] = hm1[:] * hm2[:]
1543
1544
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...
1545
    """Add a hill (a half spheroid) at given position.
1546
1547
    If height == radius or -radius, the hill is a half-sphere.
1548
1549
    Args:
1550
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1551
        x (float): The x position at the center of the new hill.
1552
        y (float): The y position at the center of the new hill.
1553
        radius (float): The size of the new hill.
1554
        height (float): The height or depth of the new hill.
1555
    """
1556
    lib.TCOD_heightmap_add_hill(_heightmap_cdata(hm), x, y, radius, height)
1557
1558
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...
1559
    """
1560
1561
    This function takes the highest value (if height > 0) or the lowest
1562
    (if height < 0) between the map and the hill.
1563
1564
    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...
1565
1566
    Args:
1567
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1568
        x (float): The x position at the center of the new carving.
1569
        y (float): The y position at the center of the new carving.
1570
        radius (float): The size of the carving.
1571
        height (float): The height or depth of the hill to dig out.
1572
    """
1573
    lib.TCOD_heightmap_dig_hill(_heightmap_cdata(hm), x, y, radius, height)
1574
1575
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...
1576
    """Simulate the effect of rain drops on the terrain, resulting in erosion.
1577
1578
    ``nbDrops`` should be at least hm.size.
1579
1580
    Args:
1581
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1582
        nbDrops (int): Number of rain drops to simulate.
1583
        erosionCoef (float): Amount of ground eroded on the drop's path.
1584
        sedimentationCoef (float): Amount of ground deposited when the drops
1585
                                   stops to flow.
1586
        rnd (Optional[Random]): A tcod.Random instance, or None.
1587
    """
1588
    lib.TCOD_heightmap_rain_erosion(_heightmap_cdata(hm), nbDrops, erosionCoef,
1589
                                    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...
1590
1591
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...
1592
                               maxLevel):
1593
    """Apply a generic transformation on the map, so that each resulting cell
1594
    value is the weighted sum of several neighbour cells.
1595
1596
    This can be used to smooth/sharpen the map.
1597
1598
    Args:
1599
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1600
        kernelsize (int): Should be set to the length of the parameters::
1601
                          dx, dy, and weight.
1602
        dx (Sequence[int]): A sequence of x coorinates.
1603
        dy (Sequence[int]): A sequence of y coorinates.
1604
        weight (Sequence[float]): A sequence of kernelSize cells weight.
1605
                                  The value of each neighbour cell is scaled by
1606
                                  its corresponding weight
1607
        minLevel (float): No transformation will apply to cells
1608
                          below this value.
1609
        maxLevel (float): No transformation will apply to cells
1610
                          above this value.
1611
1612
    See examples below for a simple horizontal smoothing kernel :
1613
    replace value(x,y) with
1614
    0.33*value(x-1,y) + 0.33*value(x,y) + 0.33*value(x+1,y).
1615
    To do this, you need a kernel of size 3
1616
    (the sum involves 3 surrounding cells).
1617
    The dx,dy array will contain
1618
    * dx=-1, dy=0 for cell (x-1, y)
1619
    * dx=1, dy=0 for cell (x+1, y)
1620
    * dx=0, dy=0 for cell (x, y)
1621
    * The weight array will contain 0.33 for each cell.
1622
1623
    Example:
1624
        >>> import numpy as np
1625
        >>> heightmap = np.zeros((3, 3), dtype=np.float32)
1626
        >>> heightmap[:,1] = 1
1627
        >>> dx = [-1, 1, 0]
1628
        >>> dy = [0, 0, 0]
1629
        >>> weight = [0.33, 0.33, 0.33]
1630
        >>> tcod.heightmap_kernel_transform(heightmap, 3, dx, dy, weight,
1631
        ...                                 0.0, 1.0)
1632
    """
1633
    cdx = ffi.new('int[]', dx)
1634
    cdy = ffi.new('int[]', dy)
1635
    cweight = ffi.new('float[]', weight)
1636
    lib.TCOD_heightmap_kernel_transform(_heightmap_cdata(hm), kernelsize,
1637
                                        cdx, cdy, cweight, minLevel, maxLevel)
1638
1639
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...
1640
    """Add values from a Voronoi diagram to the heightmap.
1641
1642
    Args:
1643
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1644
        nbPoints (Any): Number of Voronoi sites.
1645
        nbCoef (int): The diagram value is calculated from the nbCoef
1646
                      closest sites.
1647
        coef (Sequence[float]): The distance to each site is scaled by the
1648
                                corresponding coef.
1649
                                Closest site : coef[0],
1650
                                second closest site : coef[1], ...
1651
        rnd (Optional[Random]): A Random instance, or None.
1652
    """
1653
    nbPoints = len(coef)
1654
    ccoef = ffi.new('float[]', coef)
1655
    lib.TCOD_heightmap_add_voronoi(_heightmap_cdata(hm), nbPoints,
1656
                                   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...
1657
1658
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...
1659
    """Add FBM noise to the heightmap.
1660
1661
    The noise coordinate for each map cell is
1662
    `((x + addx) * mulx / width, (y + addy) * muly / height)`.
1663
1664
    The value added to the heightmap is `delta + noise * scale`.
1665
1666
    Args:
1667
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1668
        noise (Noise): A Noise instance.
1669
        mulx (float): Scaling of each x coordinate.
1670
        muly (float): Scaling of each y coordinate.
1671
        addx (float): Translation of each x coordinate.
1672
        addy (float): Translation of each y coordinate.
1673
        octaves (float): Number of octaves in the FBM sum.
1674
        delta (float): The value added to all heightmap cells.
1675
        scale (float): The noise value is scaled with this parameter.
1676
    """
1677
    noise = noise.noise_c if noise is not None else ffi.NULL
1678
    lib.TCOD_heightmap_add_fbm(_heightmap_cdata(hm), noise,
1679
                               mulx, muly, addx, addy, octaves, delta, scale)
1680
1681
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...
1682
                        scale):
1683
    """Multiply the heighmap values with FBM noise.
1684
1685
    Args:
1686
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1687
        noise (Noise): A Noise instance.
1688
        mulx (float): Scaling of each x coordinate.
1689
        muly (float): Scaling of each y coordinate.
1690
        addx (float): Translation of each x coordinate.
1691
        addy (float): Translation of each y coordinate.
1692
        octaves (float): Number of octaves in the FBM sum.
1693
        delta (float): The value added to all heightmap cells.
1694
        scale (float): The noise value is scaled with this parameter.
1695
    """
1696
    noise = noise.noise_c if noise is not None else ffi.NULL
1697
    lib.TCOD_heightmap_scale_fbm(_heightmap_cdata(hm), noise,
1698
                                 mulx, muly, addx, addy, octaves, delta, scale)
1699
1700
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...
1701
                         endDepth):
1702
    """Carve a path along a cubic Bezier curve.
1703
1704
    Both radius and depth can vary linearly along the path.
1705
1706
    Args:
1707
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1708
        px (Sequence[int]): The 4 `x` coordinates of the Bezier curve.
1709
        py (Sequence[int]): The 4 `y` coordinates of the Bezier curve.
1710
        startRadius (float): The starting radius size.
1711
        startDepth (float): The starting depth.
1712
        endRadius (float): The ending radius size.
1713
        endDepth (float): The ending depth.
1714
    """
1715
    lib.TCOD_heightmap_dig_bezier(_heightmap_cdata(hm), px, py, startRadius,
1716
                                   startDepth, endRadius,
1717
                                   endDepth)
1718
1719
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...
1720
    """Return the value at ``x``, ``y`` in a heightmap.
1721
1722
    Args:
1723
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1724
        x (int): The x position to pick.
1725
        y (int): The y position to pick.
1726
1727
    Returns:
1728
        float: The value at ``x``, ``y``.
1729
1730
    .. deprecated:: 2.0
1731
        Do ``value = hm[y, x]`` instead.
1732
    """
1733
    # explicit type conversion to pass test, (test should have been better.)
1734
    return float(hm[y, x])
1735
1736
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...
1737
    """Return the interpolated height at non integer coordinates.
1738
1739
    Args:
1740
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1741
        x (float): A floating point x coordinate.
1742
        y (float): A floating point y coordinate.
1743
1744
    Returns:
1745
        float: The value at ``x``, ``y``.
1746
    """
1747
    return lib.TCOD_heightmap_get_interpolated_value(_heightmap_cdata(hm),
1748
                                                     x, y)
1749
1750
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...
1751
    """Return the slope between 0 and (pi / 2) at given coordinates.
1752
1753
    Args:
1754
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1755
        x (int): The x coordinate.
1756
        y (int): The y coordinate.
1757
1758
    Returns:
1759
        float: The steepness at ``x``, ``y``.  From 0 to (pi / 2)
1760
    """
1761
    return lib.TCOD_heightmap_get_slope(_heightmap_cdata(hm), x, y)
1762
1763
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...
1764
    """Return the map normal at given coordinates.
1765
1766
    Args:
1767
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1768
        x (float): The x coordinate.
1769
        y (float): The y coordinate.
1770
        waterLevel (float): The heightmap is considered flat below this value.
1771
1772
    Returns:
1773
        Tuple[float, float, float]: An (x, y, z) vector normal.
1774
    """
1775
    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...
1776
    lib.TCOD_heightmap_get_normal(_heightmap_cdata(hm), x, y, cn, waterLevel)
1777
    return tuple(cn)
1778
1779
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...
1780
    """Return the number of map cells which value is between ``mi`` and ``ma``.
1781
1782
    Args:
1783
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1784
        mi (float): The lower bound.
1785
        ma (float): The upper bound.
1786
1787
    Returns:
1788
        int: The count of values which fall between ``mi`` and ``ma``.
1789
    """
1790
    return lib.TCOD_heightmap_count_cells(_heightmap_cdata(hm), mi, ma)
1791
1792
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...
1793
    """Returns True if the map edges are below ``waterlevel``, otherwise False.
1794
1795
    Args:
1796
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1797
        waterLevel (float): The water level to use.
1798
1799
    Returns:
1800
        bool: True if the map edges are below ``waterlevel``, otherwise False.
1801
    """
1802
    return lib.TCOD_heightmap_has_land_on_border(_heightmap_cdata(hm),
1803
                                                 waterlevel)
1804
1805
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...
1806
    """Return the min and max values of this heightmap.
1807
1808
    Args:
1809
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1810
1811
    Returns:
1812
        Tuple[float, float]: The (min, max) values.
1813
1814
    .. deprecated:: 2.0
1815
        Do ``hm.min()`` or ``hm.max()`` instead.
1816
    """
1817
    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...
1818
    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...
1819
    lib.TCOD_heightmap_get_minmax(_heightmap_cdata(hm), mi, ma)
1820
    return mi[0], ma[0]
1821
1822
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...
1823
    """Does nothing.
1824
1825
    .. deprecated:: 2.0
1826
        libtcod-cffi deletes heightmaps automatically.
1827
    """
1828
    pass
1829
1830
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...
1831
    return tcod.image.Image(width, height)
1832
1833
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...
1834
    image.clear(col)
1835
1836
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...
1837
    image.invert()
1838
1839
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...
1840
    image.hflip()
1841
1842
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...
1843
    image.rotate90(num)
1844
1845
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...
1846
    image.vflip()
1847
1848
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...
1849
    image.scale(neww, newh)
1850
1851
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...
1852
    image.set_key_color(col)
1853
1854
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...
1855
    image.get_alpha(x, y)
1856
1857
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...
1858
    lib.TCOD_image_is_pixel_transparent(image.image_c, x, y)
1859
1860
def image_load(filename):
1861
    """Load an image file into an Image instance and return it.
1862
1863
    Args:
1864
        filename (AnyStr): Path to a .bmp or .png image file.
1865
    """
1866
    return tcod.image.Image._from_cdata(
1867
        ffi.gc(lib.TCOD_image_load(_bytes(filename)),
1868
               lib.TCOD_image_delete)
1869
        )
1870
1871
def image_from_console(console):
1872
    """Return an Image with a Consoles pixel data.
1873
1874
    This effectively takes a screen-shot of the Console.
1875
1876
    Args:
1877
        console (Console): Any Console instance.
1878
    """
1879
    return tcod.image.Image._from_cdata(
1880
        ffi.gc(
1881
            lib.TCOD_image_from_console(
1882
                console.console_c if console else ffi.NULL
1883
                ),
1884
            lib.TCOD_image_delete,
1885
            )
1886
        )
1887
1888
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...
1889
    image.refresh_console(console)
1890
1891
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...
1892
    return image.width, image.height
1893
1894
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...
1895
    return image.get_pixel(x, y)
1896
1897
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...
1898
    return image.get_mipmap_pixel(x0, y0, x1, y1)
1899
1900
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...
1901
    image.put_pixel(x, y, col)
1902
1903
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...
1904
    image.blit(console, x, y, bkgnd_flag, scalex, scaley, angle)
1905
1906
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...
1907
    image.blit_rect(console, x, y, w, h, bkgnd_flag)
1908
1909
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...
1910
    image.blit_2x(console, dx, dy, sx, sy, w, h)
1911
1912
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...
1913
    image.save_as(filename)
1914
1915
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...
1916
    pass
1917
1918
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...
1919
    """Initilize a line whose points will be returned by `line_step`.
1920
1921
    This function does not return anything on its own.
1922
1923
    Does not include the origin point.
1924
1925
    Args:
1926
        xo (int): X starting point.
1927
        yo (int): Y starting point.
1928
        xd (int): X destination point.
1929
        yd (int): Y destination point.
1930
1931
    .. deprecated:: 2.0
1932
       Use `line_iter` instead.
1933
    """
1934
    lib.TCOD_line_init(xo, yo, xd, yd)
1935
1936
def line_step():
1937
    """After calling line_init returns (x, y) points of the line.
1938
1939
    Once all points are exhausted this function will return (None, None)
1940
1941
    Returns:
1942
        Union[Tuple[int, int], Tuple[None, None]]:
1943
            The next (x, y) point of the line setup by line_init,
1944
            or (None, None) if there are no more points.
1945
1946
    .. deprecated:: 2.0
1947
       Use `line_iter` instead.
1948
    """
1949
    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...
1950
    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...
1951
    ret = lib.TCOD_line_step(x, y)
1952
    if not ret:
1953
        return x[0], y[0]
1954
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1955
1956
_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...
1957
1958
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...
1959
    """ Iterate over a line using a callback function.
1960
1961
    Your callback function will take x and y parameters and return True to
1962
    continue iteration or False to stop iteration and return.
1963
1964
    This function includes both the start and end points.
1965
1966
    Args:
1967
        xo (int): X starting point.
1968
        yo (int): Y starting point.
1969
        xd (int): X destination point.
1970
        yd (int): Y destination point.
1971
        py_callback (Callable[[int, int], bool]):
1972
            A callback which takes x and y parameters and returns bool.
1973
1974
    Returns:
1975
        bool: False if the callback cancels the line interation by
1976
              returning False or None, otherwise True.
1977
1978
    .. deprecated:: 2.0
1979
       Use `line_iter` instead.
1980
    """
1981
    with _PropagateException() as propagate:
1982
        with _line_listener_lock:
1983
            @ffi.def_extern(onerror=propagate)
1984
            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...
1985
                return py_callback(x, y)
1986
            return bool(lib.TCOD_line(xo, yo, xd, yd,
1987
                                       lib._pycall_line_listener))
1988
1989
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...
1990
    """ returns an iterator
1991
1992
    This iterator does not include the origin point.
1993
1994
    Args:
1995
        xo (int): X starting point.
1996
        yo (int): Y starting point.
1997
        xd (int): X destination point.
1998
        yd (int): Y destination point.
1999
2000
    Returns:
2001
        Iterator[Tuple[int,int]]: An iterator of (x,y) points.
2002
    """
2003
    data = ffi.new('TCOD_bresenham_data_t *')
2004
    lib.TCOD_line_init_mt(xo, yo, xd, yd, data)
2005
    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...
2006
    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...
2007
    yield xo, yo
2008
    while not lib.TCOD_line_step_mt(x, y, data):
2009
        yield (x[0], y[0])
2010
2011
FOV_BASIC = 0
2012
FOV_DIAMOND = 1
2013
FOV_SHADOW = 2
2014
FOV_PERMISSIVE_0 = 3
2015
FOV_PERMISSIVE_1 = 4
2016
FOV_PERMISSIVE_2 = 5
2017
FOV_PERMISSIVE_3 = 6
2018
FOV_PERMISSIVE_4 = 7
2019
FOV_PERMISSIVE_5 = 8
2020
FOV_PERMISSIVE_6 = 9
2021
FOV_PERMISSIVE_7 = 10
2022
FOV_PERMISSIVE_8 = 11
2023
FOV_RESTRICTIVE = 12
2024
NB_FOV_ALGORITHMS = 13
2025
2026
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...
2027
    return tcod.map.Map(w, h)
2028
2029
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...
2030
    return lib.TCOD_map_copy(source.map_c, dest.map_c)
2031
2032
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...
2033
    lib.TCOD_map_set_properties(m.map_c, x, y, isTrans, isWalk)
2034
2035
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...
2036
    # walkable/transparent looks incorrectly ordered here.
2037
    # TODO: needs test.
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
2038
    lib.TCOD_map_clear(m.map_c, walkable, transparent)
2039
2040
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...
2041
    lib.TCOD_map_compute_fov(m.map_c, x, y, radius, light_walls, algo)
2042
2043
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...
2044
    return lib.TCOD_map_is_in_fov(m.map_c, x, y)
2045
2046
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...
2047
    return lib.TCOD_map_is_transparent(m.map_c, x, y)
2048
2049
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...
2050
    return lib.TCOD_map_is_walkable(m.map_c, x, y)
2051
2052
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...
2053
    pass
2054
2055
def map_get_width(map):
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...
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...
2056
    return map.width
2057
2058
def map_get_height(map):
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...
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...
2059
    return map.height
2060
2061
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...
2062
    lib.TCOD_mouse_show_cursor(visible)
2063
2064
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...
2065
    return lib.TCOD_mouse_is_cursor_visible()
2066
2067
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...
2068
    lib.TCOD_mouse_move(x, y)
2069
2070
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...
2071
    return Mouse(lib.TCOD_mouse_get_status())
2072
2073
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...
2074
    lib.TCOD_namegen_parse(_bytes(filename), random or ffi.NULL)
2075
2076
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...
2077
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name), False))
2078
2079
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...
2080
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name),
2081
                                                     _bytes(rule), False))
2082
2083
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...
2084
    sets = lib.TCOD_namegen_get_sets()
2085
    try:
2086
        lst = []
2087
        while not lib.TCOD_list_is_empty(sets):
2088
            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...
2089
    finally:
2090
        lib.TCOD_list_delete(sets)
2091
    return lst
2092
2093
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...
2094
    lib.TCOD_namegen_destroy()
2095
2096
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...
2097
        random=None):
2098
    """Return a new Noise instance.
2099
2100
    Args:
2101
        dim (int): Number of dimensions.  From 1 to 4.
2102
        h (float): The hurst exponent.  Should be in the 0.0-1.0 range.
2103
        l (float): The noise lacunarity.
2104
        random (Optional[Random]): A Random instance, or None.
2105
2106
    Returns:
2107
        Noise: The new Noise instance.
2108
    """
2109
    return tcod.noise.Noise(dim, hurst=h, lacunarity=l, seed=random)
2110
2111
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...
2112
    """Set a Noise objects default noise algorithm.
2113
2114
    Args:
2115
        typ (int): Any NOISE_* constant.
2116
    """
2117
    n.algorithm = typ
2118
2119
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...
2120
    """Return the noise value sampled from the ``f`` coordinate.
2121
2122
    ``f`` should be a tuple or list with a length matching
2123
    :any:`Noise.dimensions`.
2124
    If ``f`` is shoerter than :any:`Noise.dimensions` the missing coordinates
2125
    will be filled with zeros.
2126
2127
    Args:
2128
        n (Noise): A Noise instance.
2129
        f (Sequence[float]): The point to sample the noise from.
2130
        typ (int): The noise algorithm to use.
2131
2132
    Returns:
2133
        float: The sampled noise value.
2134
    """
2135
    return lib.TCOD_noise_get_ex(n.noise_c, ffi.new('float[4]', f), typ)
2136
2137
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...
2138
    """Return the fractal Brownian motion sampled from the ``f`` coordinate.
2139
2140
    Args:
2141
        n (Noise): A Noise instance.
2142
        f (Sequence[float]): The point to sample the noise from.
2143
        typ (int): The noise algorithm to use.
2144
        octaves (float): The level of level.  Should be more than 1.
2145
2146
    Returns:
2147
        float: The sampled noise value.
2148
    """
2149
    return lib.TCOD_noise_get_fbm_ex(n.noise_c, ffi.new('float[4]', f),
2150
                                     oc, typ)
2151
2152
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...
2153
    """Return the turbulence noise sampled from the ``f`` coordinate.
2154
2155
    Args:
2156
        n (Noise): A Noise instance.
2157
        f (Sequence[float]): The point to sample the noise from.
2158
        typ (int): The noise algorithm to use.
2159
        octaves (float): The level of level.  Should be more than 1.
2160
2161
    Returns:
2162
        float: The sampled noise value.
2163
    """
2164
    return lib.TCOD_noise_get_turbulence_ex(n.noise_c, ffi.new('float[4]', f),
2165
                                            oc, typ)
2166
2167
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...
2168
    """Does nothing."""
2169
    pass
2170
2171
_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...
2172
try:
2173
    _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...
2174
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...
2175
    pass
2176
2177
def _unpack_union(type_, union):
2178
    '''
2179
        unpack items from parser new_property (value_converter)
2180
    '''
2181
    if type_ == lib.TCOD_TYPE_BOOL:
2182
        return bool(union.b)
2183
    elif type_ == lib.TCOD_TYPE_CHAR:
2184
        return _unicode(union.c)
2185
    elif type_ == lib.TCOD_TYPE_INT:
2186
        return union.i
2187
    elif type_ == lib.TCOD_TYPE_FLOAT:
2188
        return union.f
2189
    elif (type_ == lib.TCOD_TYPE_STRING or
2190
         lib.TCOD_TYPE_VALUELIST15 >= type_ >= lib.TCOD_TYPE_VALUELIST00):
2191
         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...
2192
    elif type_ == lib.TCOD_TYPE_COLOR:
2193
        return Color._new_from_cdata(union.col)
2194
    elif type_ == lib.TCOD_TYPE_DICE:
2195
        return Dice(union.dice)
2196
    elif type_ & lib.TCOD_TYPE_LIST:
2197
        return _convert_TCODList(union.list, type_ & 0xFF)
2198
    else:
2199
        raise RuntimeError('Unknown libtcod type: %i' % type_)
2200
2201
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...
2202
    return [_unpack_union(type_, lib.TDL_list_get_union(clist, i))
2203
            for i in range(lib.TCOD_list_size(clist))]
2204
2205
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...
2206
    return ffi.gc(lib.TCOD_parser_new(), lib.TCOD_parser_delete)
2207
2208
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...
2209
    return lib.TCOD_parser_new_struct(parser, name)
2210
2211
# prevent multiple threads from messing with def_extern callbacks
2212
_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...
2213
_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...
2214
2215
@ffi.def_extern()
2216
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...
2217
    return _parser_listener.end_struct(struct, _unpack_char_p(name))
2218
2219
@ffi.def_extern()
2220
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...
2221
    return _parser_listener.new_flag(_unpack_char_p(name))
2222
2223
@ffi.def_extern()
2224
def _pycall_parser_new_property(propname, type, value):
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...
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...
2225
    return _parser_listener.new_property(_unpack_char_p(propname), type,
2226
                                 _unpack_union(type, value))
2227
2228
@ffi.def_extern()
2229
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...
2230
    return _parser_listener.end_struct(struct, _unpack_char_p(name))
2231
2232
@ffi.def_extern()
2233
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...
2234
    _parser_listener.error(_unpack_char_p(msg))
2235
2236
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...
2237
    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...
2238
    if not listener:
2239
        lib.TCOD_parser_run(parser, _bytes(filename), ffi.NULL)
2240
        return
2241
2242
    propagate_manager = _PropagateException()
2243
    propagate = propagate_manager.propagate
2244
2245
    clistener = ffi.new(
2246
        'TCOD_parser_listener_t *',
2247
        {
2248
            'new_struct': lib._pycall_parser_new_struct,
2249
            'new_flag': lib._pycall_parser_new_flag,
2250
            'new_property': lib._pycall_parser_new_property,
2251
            'end_struct': lib._pycall_parser_end_struct,
2252
            'error': lib._pycall_parser_error,
2253
        },
2254
    )
2255
2256
    with _parser_callback_lock:
2257
        _parser_listener = listener
2258
        with propagate_manager:
2259
            lib.TCOD_parser_run(parser, filename.encode('utf-8'), clistener)
2260
2261
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...
2262
    pass
2263
2264
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...
2265
    return bool(lib.TCOD_parser_get_bool_property(parser, _bytes(name)))
2266
2267
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...
2268
    return lib.TCOD_parser_get_int_property(parser, _bytes(name))
2269
2270
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...
2271
    return _chr(lib.TCOD_parser_get_char_property(parser, _bytes(name)))
2272
2273
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...
2274
    return lib.TCOD_parser_get_float_property(parser, _bytes(name))
2275
2276
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...
2277
    return _unpack_char_p(
2278
        lib.TCOD_parser_get_string_property(parser, _bytes(name)))
2279
2280
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...
2281
    return Color._new_from_cdata(
2282
        lib.TCOD_parser_get_color_property(parser, _bytes(name)))
2283
2284
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...
2285
    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...
2286
    lib.TCOD_parser_get_dice_property_py(parser, _bytes(name), d)
2287
    return Dice(d)
2288
2289
def parser_get_list_property(parser, name, type):
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...
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...
2290
    clist = lib.TCOD_parser_get_list_property(parser, _bytes(name), type)
2291
    return _convert_TCODList(clist, type)
2292
2293
RNG_MT = 0
2294
RNG_CMWC = 1
2295
2296
DISTRIBUTION_LINEAR = 0
2297
DISTRIBUTION_GAUSSIAN = 1
2298
DISTRIBUTION_GAUSSIAN_RANGE = 2
2299
DISTRIBUTION_GAUSSIAN_INVERSE = 3
2300
DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = 4
2301
2302
def random_get_instance():
2303
    """Return the default Random instance.
2304
2305
    Returns:
2306
        Random: A Random instance using the default random number generator.
2307
    """
2308
    return tcod.random.Random._new_from_cdata(
2309
        ffi.cast('mersenne_data_t*', lib.TCOD_random_get_instance()))
2310
2311
def random_new(algo=RNG_CMWC):
2312
    """Return a new Random instance.  Using ``algo``.
2313
2314
    Args:
2315
        algo (int): The random number algorithm to use.
2316
2317
    Returns:
2318
        Random: A new Random instance using the given algorithm.
2319
    """
2320
    return tcod.random.Random(algo)
2321
2322
def random_new_from_seed(seed, algo=RNG_CMWC):
2323
    """Return a new Random instance.  Using the given ``seed`` and ``algo``.
2324
2325
    Args:
2326
        seed (Hashable): The RNG seed.  Should be a 32-bit integer, but any
2327
                         hashable object is accepted.
2328
        algo (int): The random number algorithm to use.
2329
2330
    Returns:
2331
        Random: A new Random instance using the given algorithm.
2332
    """
2333
    return tcod.random.Random(algo, seed)
2334
2335
def random_set_distribution(rnd, dist):
2336
    """Change the distribution mode of a random number generator.
2337
2338
    Args:
2339
        rnd (Optional[Random]): A Random instance, or None to use the default.
2340
        dist (int): The distribution mode to use.  Should be DISTRIBUTION_*.
2341
    """
2342
    lib.TCOD_random_set_distribution(rnd.random_c if rnd else ffi.NULL, dist)
2343
2344
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...
2345
    """Return a random integer in the range: ``mi`` <= n <= ``ma``.
2346
2347
    The result is affacted by calls to :any:`random_set_distribution`.
2348
2349
    Args:
2350
        rnd (Optional[Random]): A Random instance, or None to use the default.
2351
        low (int): The lower bound of the random range, inclusive.
2352
        high (int): The upper bound of the random range, inclusive.
2353
2354
    Returns:
2355
        int: A random integer in the range ``mi`` <= n <= ``ma``.
2356
    """
2357
    return lib.TCOD_random_get_int(rnd.random_c if rnd else ffi.NULL, mi, ma)
2358
2359
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...
2360
    """Return a random float in the range: ``mi`` <= n <= ``ma``.
2361
2362
    The result is affacted by calls to :any:`random_set_distribution`.
2363
2364
    Args:
2365
        rnd (Optional[Random]): A Random instance, or None to use the default.
2366
        low (float): The lower bound of the random range, inclusive.
2367
        high (float): The upper bound of the random range, inclusive.
2368
2369
    Returns:
2370
        float: A random double precision float
2371
               in the range ``mi`` <= n <= ``ma``.
2372
    """
2373
    return lib.TCOD_random_get_double(
2374
        rnd.random_c if rnd else ffi.NULL, mi, ma)
2375
2376
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...
2377
    """Return a random float in the range: ``mi`` <= n <= ``ma``.
2378
2379
    .. deprecated:: 2.0
2380
        Use :any:`random_get_float` instead.
2381
        Both funtions return a double precision float.
2382
    """
2383
    return lib.TCOD_random_get_double(
2384
        rnd.random_c if rnd else ffi.NULL, mi, ma)
2385
2386
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...
2387
    """Return a random weighted integer in the range: ``mi`` <= n <= ``ma``.
2388
2389
    The result is affacted by calls to :any:`random_set_distribution`.
2390
2391
    Args:
2392
        rnd (Optional[Random]): A Random instance, or None to use the default.
2393
        low (int): The lower bound of the random range, inclusive.
2394
        high (int): The upper bound of the random range, inclusive.
2395
        mean (int): The mean return value.
2396
2397
    Returns:
2398
        int: A random weighted integer in the range ``mi`` <= n <= ``ma``.
2399
    """
2400
    return lib.TCOD_random_get_int_mean(
2401
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2402
2403
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...
2404
    """Return a random weighted float in the range: ``mi`` <= n <= ``ma``.
2405
2406
    The result is affacted by calls to :any:`random_set_distribution`.
2407
2408
    Args:
2409
        rnd (Optional[Random]): A Random instance, or None to use the default.
2410
        low (float): The lower bound of the random range, inclusive.
2411
        high (float): The upper bound of the random range, inclusive.
2412
        mean (float): The mean return value.
2413
2414
    Returns:
2415
        float: A random weighted double precision float
2416
               in the range ``mi`` <= n <= ``ma``.
2417
    """
2418
    return lib.TCOD_random_get_double_mean(
2419
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2420
2421
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...
2422
    """Return a random weighted float in the range: ``mi`` <= n <= ``ma``.
2423
2424
    .. deprecated:: 2.0
2425
        Use :any:`random_get_float_mean` instead.
2426
        Both funtions return a double precision float.
2427
    """
2428
    return lib.TCOD_random_get_double_mean(
2429
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2430
2431
def random_save(rnd):
2432
    """Return a copy of a random number generator.
2433
2434
    Args:
2435
        rnd (Optional[Random]): A Random instance, or None to use the default.
2436
2437
    Returns:
2438
        Random: A Random instance with a copy of the random generator.
2439
    """
2440
    return tcod.random.Random._new_from_cdata(
2441
        ffi.gc(
2442
            ffi.cast('mersenne_data_t*',
2443
                     lib.TCOD_random_save(rnd.random_c if rnd else ffi.NULL)),
2444
            lib.TCOD_random_delete),
2445
        )
2446
2447
def random_restore(rnd, backup):
2448
    """Restore a random number generator from a backed up copy.
2449
2450
    Args:
2451
        rnd (Optional[Random]): A Random instance, or None to use the default.
2452
        backup (Random): The Random instance which was used as a backup.
2453
    """
2454
    lib.TCOD_random_restore(rnd.random_c if rnd else ffi.NULL,
2455
                            backup.random_c)
2456
2457
def random_delete(rnd):
0 ignored issues
show
Unused Code introduced by
The argument rnd seems to be unused.
Loading history...
2458
    """Does nothing."""
2459
    pass
2460
2461
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...
2462
    lib.TCOD_struct_add_flag(struct, name)
2463
2464
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...
2465
    lib.TCOD_struct_add_property(struct, name, typ, mandatory)
2466
2467
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...
2468
    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...
2469
    cvalue_list = CARRAY()
2470
    for i, value in enumerate(value_list):
2471
        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...
2472
    cvalue_list[len(value_list)] = 0
2473
    lib.TCOD_struct_add_value_list(struct, name, cvalue_list, mandatory)
2474
2475
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...
2476
    lib.TCOD_struct_add_list_property(struct, name, typ, mandatory)
2477
2478
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...
2479
    lib.TCOD_struct_add_structure(struct, sub_struct)
2480
2481
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...
2482
    return _unpack_char_p(lib.TCOD_struct_get_name(struct))
2483
2484
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...
2485
    return lib.TCOD_struct_is_mandatory(struct, name)
2486
2487
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...
2488
    return lib.TCOD_struct_get_type(struct, name)
2489
2490
# high precision time functions
2491
def sys_set_fps(fps):
2492
    """Set the maximum frame rate.
2493
2494
    You can disable the frame limit again by setting fps to 0.
2495
2496
    Args:
2497
        fps (int): A frame rate limit (i.e. 60)
2498
    """
2499
    lib.TCOD_sys_set_fps(fps)
2500
2501
def sys_get_fps():
2502
    """Return the current frames per second.
2503
2504
    This the actual frame rate, not the frame limit set by
2505
    :any:`tcod.sys_set_fps`.
2506
2507
    This number is updated every second.
2508
2509
    Returns:
2510
        int: The currently measured frame rate.
2511
    """
2512
    return lib.TCOD_sys_get_fps()
2513
2514
def sys_get_last_frame_length():
2515
    """Return the delta time of the last rendered frame in seconds.
2516
2517
    Returns:
2518
        float: The delta time of the last rendered frame.
2519
    """
2520
    return lib.TCOD_sys_get_last_frame_length()
2521
2522
def sys_sleep_milli(val):
2523
    """Sleep for 'val' milliseconds.
2524
2525
    Args:
2526
        val (int): Time to sleep for in milliseconds.
2527
2528
    .. deprecated:: 2.0
2529
       Use :any:`time.sleep` instead.
2530
    """
2531
    lib.TCOD_sys_sleep_milli(val)
2532
2533
def sys_elapsed_milli():
2534
    """Get number of milliseconds since the start of the program.
2535
2536
    Returns:
2537
        int: Time since the progeam has started in milliseconds.
2538
2539
    .. deprecated:: 2.0
2540
       Use :any:`time.clock` instead.
2541
    """
2542
    return lib.TCOD_sys_elapsed_milli()
2543
2544
def sys_elapsed_seconds():
2545
    """Get number of seconds since the start of the program.
2546
2547
    Returns:
2548
        float: Time since the progeam has started in seconds.
2549
2550
    .. deprecated:: 2.0
2551
       Use :any:`time.clock` instead.
2552
    """
2553
    return lib.TCOD_sys_elapsed_seconds()
2554
2555
def sys_set_renderer(renderer):
2556
    """Change the current rendering mode to renderer.
2557
2558
    .. deprecated:: 2.0
2559
       RENDERER_GLSL and RENDERER_OPENGL are not currently available.
2560
    """
2561
    lib.TCOD_sys_set_renderer(renderer)
2562
2563
def sys_get_renderer():
2564
    """Return the current rendering mode.
2565
2566
    """
2567
    return lib.TCOD_sys_get_renderer()
2568
2569
# easy screenshots
2570
def sys_save_screenshot(name=None):
2571
    """Save a screenshot to a file.
2572
2573
    By default this will automatically save screenshots in the working
2574
    directory.
2575
2576
    The automatic names are formatted as screenshotNNN.png.  For example:
2577
    screenshot000.png, screenshot001.png, etc.  Whichever is available first.
2578
2579
    Args:
2580
        file Optional[AnyStr]: File path to save screenshot.
2581
    """
2582
    if name is not None:
2583
        name = _bytes(name)
2584
    lib.TCOD_sys_save_screenshot(name or ffi.NULL)
2585
2586
# custom fullscreen resolution
2587
def sys_force_fullscreen_resolution(width, height):
2588
    """Force a specific resolution in fullscreen.
2589
2590
    Will use the smallest available resolution so that:
2591
2592
    * resolution width >= width and
2593
      resolution width >= root console width * font char width
2594
    * resolution height >= height and
2595
      resolution height >= root console height * font char height
2596
2597
    Args:
2598
        width (int): The desired resolution width.
2599
        height (int): The desired resolution height.
2600
    """
2601
    lib.TCOD_sys_force_fullscreen_resolution(width, height)
2602
2603
def sys_get_current_resolution():
2604
    """Return the current resolution as (width, height)
2605
2606
    Returns:
2607
        Tuple[int,int]: The current resolution.
2608
    """
2609
    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...
2610
    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...
2611
    lib.TCOD_sys_get_current_resolution(w, h)
2612
    return w[0], h[0]
2613
2614
def sys_get_char_size():
2615
    """Return the current fonts character size as (width, height)
2616
2617
    Returns:
2618
        Tuple[int,int]: The current font glyph size in (width, height)
2619
    """
2620
    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...
2621
    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...
2622
    lib.TCOD_sys_get_char_size(w, h)
2623
    return w[0], h[0]
2624
2625
# update font bitmap
2626
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...
2627
    """Dynamically update the current frot with img.
2628
2629
    All cells using this asciiCode will be updated
2630
    at the next call to :any:`tcod.console_flush`.
2631
2632
    Args:
2633
        asciiCode (int): Ascii code corresponding to the character to update.
2634
        fontx (int): Left coordinate of the character
2635
                     in the bitmap font (in tiles)
2636
        fonty (int): Top coordinate of the character
2637
                     in the bitmap font (in tiles)
2638
        img (Image): An image containing the new character bitmap.
2639
        x (int): Left pixel of the character in the image.
2640
        y (int): Top pixel of the character in the image.
2641
    """
2642
    lib.TCOD_sys_update_char(_int(asciiCode), fontx, fonty, img, x, y)
2643
2644
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...
2645
    """Register a custom randering function with libtcod.
2646
2647
    Note:
2648
        This callback will only be called by the SDL renderer.
2649
2650
    The callack will receive a :any:`CData <ffi-cdata>` void* to an
2651
    SDL_Surface* struct.
2652
2653
    The callback is called on every call to :any:`tcod.console_flush`.
2654
2655
    Args:
2656
        callback Callable[[CData], None]:
2657
            A function which takes a single argument.
2658
    """
2659
    with _PropagateException() as propagate:
2660
        @ffi.def_extern(onerror=propagate)
2661
        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...
2662
            callback(sdl_surface)
2663
        lib.TCOD_sys_register_SDL_renderer(lib._pycall_sdl_hook)
2664
2665
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...
2666
    """Check for and return an event.
2667
2668
    Args:
2669
        mask (int): :any:`Event types` to wait for.
2670
        k (Optional[Key]): A tcod.Key instance which might be updated with
2671
                           an event.  Can be None.
2672
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
2673
                             with an event.  Can be None.
2674
    """
2675
    return lib.TCOD_sys_check_for_event(
2676
        mask, k.cdata if k else ffi.NULL, m.cdata if m else ffi.NULL)
2677
2678
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...
2679
    """Wait for an event then return.
2680
2681
    If flush is True then the buffer will be cleared before waiting. Otherwise
2682
    each available event will be returned in the order they're recieved.
2683
2684
    Args:
2685
        mask (int): :any:`Event types` to wait for.
2686
        k (Optional[Key]): A tcod.Key instance which might be updated with
2687
                           an event.  Can be None.
2688
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
2689
                             with an event.  Can be None.
2690
        flush (bool): Clear the event buffer before waiting.
2691
    """
2692
    return lib.TCOD_sys_wait_for_event(
2693
        mask, k.cdata if k else ffi.NULL, m.cdata if m else ffi.NULL, flush)
2694
2695
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...
2696
    return lib.TCOD_sys_clipboard_set(text.encode('utf-8'))
2697
2698
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...
2699
    return ffi.string(lib.TCOD_sys_clipboard_get()).decode('utf-8')
2700