Completed
Push — master ( dc9ee9...7a06e5 )
by Kyle
58s
created

console_init_root()   B

Complexity

Conditions 2

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 2
c 3
b 0
f 0
dl 0
loc 25
rs 8.8571
1
"""This module handles backward compatibility with the ctypes libtcodpy module.
2
"""
3
4
from __future__ import absolute_import as _
5
6
import os
7
import sys
8
9
import threading as _threading
10
11
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...
12
13
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...
14
15
from tcod.tcod import _int, _unpack_char_p
16
from tcod.tcod import _bytes, _unicode, _fmt_bytes, _fmt_unicode
17
from tcod.tcod import _CDataWrapper
18
from tcod.tcod import _PropagateException
19
20
import tcod.bsp
21
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...
22
import tcod.console
23
import tcod.image
24
import tcod.map
25
import tcod.noise
26
import tcod.path
27
import tcod.random
28
29
Bsp = tcod.bsp.BSP
30
31
32
class ConsoleBuffer(object):
33
    """Simple console that allows direct (fast) access to cells. simplifies
34
    use of the "fill" functions.
35
36
    Args:
37
        width (int): Width of the new ConsoleBuffer.
38
        height (int): Height of the new ConsoleBuffer.
39
        back_r (int): Red background color, from 0 to 255.
40
        back_g (int): Green background color, from 0 to 255.
41
        back_b (int): Blue background color, from 0 to 255.
42
        fore_r (int): Red foreground color, from 0 to 255.
43
        fore_g (int): Green foreground color, from 0 to 255.
44
        fore_b (int): Blue foreground color, from 0 to 255.
45
        char (AnyStr): A single character str or bytes object.
46
    """
47
    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...
48
        """initialize with given width and height. values to fill the buffer
49
        are optional, defaults to black with no characters.
50
        """
51
        self.width = width
52
        self.height = height
53
        self.clear(back_r, back_g, back_b, fore_r, fore_g, fore_b, char)
54
55
    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...
56
        """Clears the console.  Values to fill it with are optional, defaults
57
        to black with no characters.
58
59
        Args:
60
            back_r (int): Red background color, from 0 to 255.
61
            back_g (int): Green background color, from 0 to 255.
62
            back_b (int): Blue background color, from 0 to 255.
63
            fore_r (int): Red foreground color, from 0 to 255.
64
            fore_g (int): Green foreground color, from 0 to 255.
65
            fore_b (int): Blue foreground color, from 0 to 255.
66
            char (AnyStr): A single character str or bytes object.
67
        """
68
        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...
69
        self.back_r = [back_r] * n
70
        self.back_g = [back_g] * n
71
        self.back_b = [back_b] * n
72
        self.fore_r = [fore_r] * n
73
        self.fore_g = [fore_g] * n
74
        self.fore_b = [fore_b] * n
75
        self.char = [ord(char)] * n
76
77
    def copy(self):
78
        """Returns a copy of this ConsoleBuffer.
79
80
        Returns:
81
            ConsoleBuffer: A new ConsoleBuffer copy.
82
        """
83
        other = ConsoleBuffer(0, 0)
84
        other.width = self.width
85
        other.height = self.height
86
        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...
87
        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...
88
        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...
89
        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...
90
        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...
91
        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...
92
        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...
93
        return other
94
95
    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...
96
        """Set the character and foreground color of one cell.
97
98
        Args:
99
            x (int): X position to change.
100
            y (int): Y position to change.
101
            r (int): Red foreground color, from 0 to 255.
102
            g (int): Green foreground color, from 0 to 255.
103
            b (int): Blue foreground color, from 0 to 255.
104
            char (AnyStr): A single character str or bytes object.
105
        """
106
        i = self.width * y + x
107
        self.fore_r[i] = r
108
        self.fore_g[i] = g
109
        self.fore_b[i] = b
110
        self.char[i] = ord(char)
111
112
    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...
113
        """Set the background color of one cell.
114
115
        Args:
116
            x (int): X position to change.
117
            y (int): Y position to change.
118
            r (int): Red background color, from 0 to 255.
119
            g (int): Green background color, from 0 to 255.
120
            b (int): Blue background color, from 0 to 255.
121
            char (AnyStr): A single character str or bytes object.
122
        """
123
        i = self.width * y + x
124
        self.back_r[i] = r
125
        self.back_g[i] = g
126
        self.back_b[i] = b
127
128
    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...
129
        """Set the background color, foreground color and character of one cell.
130
131
        Args:
132
            x (int): X position to change.
133
            y (int): Y position to change.
134
            back_r (int): Red background color, from 0 to 255.
135
            back_g (int): Green background color, from 0 to 255.
136
            back_b (int): Blue background color, from 0 to 255.
137
            fore_r (int): Red foreground color, from 0 to 255.
138
            fore_g (int): Green foreground color, from 0 to 255.
139
            fore_b (int): Blue foreground color, from 0 to 255.
140
            char (AnyStr): A single character str or bytes object.
141
        """
142
        i = self.width * y + x
143
        self.back_r[i] = back_r
144
        self.back_g[i] = back_g
145
        self.back_b[i] = back_b
146
        self.fore_r[i] = fore_r
147
        self.fore_g[i] = fore_g
148
        self.fore_b[i] = fore_b
149
        self.char[i] = ord(char)
150
151
    def blit(self, dest, fill_fore=True, fill_back=True):
152
        """Use libtcod's "fill" functions to write the buffer to a console.
153
154
        Args:
155
            dest (Console): Console object to modify.
156
            fill_fore (bool):
157
                If True, fill the foreground color and characters.
158
            fill_back (bool):
159
                If True, fill the background color.
160
        """
161
        if not dest:
162
            dest = tcod.console.Console._from_cdata(ffi.NULL)
163
        if (dest.width != self.width or
164
            dest.height != self.height):
165
            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...
166
167
        if fill_back:
168
            bg = dest.bg.ravel()
0 ignored issues
show
Coding Style Naming introduced by
The name bg does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

Loading history...
175
            fg[0::3] = self.fore_r
176
            fg[1::3] = self.fore_g
177
            fg[2::3] = self.fore_b
178
            dest.ch.ravel()[:] = self.char
179
180
class Dice(_CDataWrapper):
181
    """
182
183
    Args:
184
        nb_dices (int): Number of dice.
185
        nb_faces (int): Number of sides on a die.
186
        multiplier (float): Multiplier.
187
        addsub (float): Addition.
188
189
    .. deprecated:: 2.0
190
        You should make your own dice functions instead of using this class
191
        which is tied to a CData object.
192
    """
193
194
    def __init__(self, *args, **kargs):
195
        super(Dice, self).__init__(*args, **kargs)
196
        if self.cdata == ffi.NULL:
197
            self._init(*args, **kargs)
198
199
    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...
200
        self.cdata = ffi.new('TCOD_dice_t*')
201
        self.nb_dices = nb_dices
202
        self.nb_faces = nb_faces
203
        self.multiplier = multiplier
204
        self.addsub = addsub
205
206
    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...
207
        return self.nb_rolls
208
    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...
209
        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...
210
    nb_dices = property(_get_nb_dices, _set_nb_dices)
211
212
    def __str__(self):
213
        add = '+(%s)' % self.addsub if self.addsub != 0 else ''
214
        return '%id%ix%s%s' % (self.nb_dices, self.nb_faces,
215
                               self.multiplier, add)
216
217
    def __repr__(self):
218
        return ('%s(nb_dices=%r,nb_faces=%r,multiplier=%r,addsub=%r)' %
219
                (self.__class__.__name__, self.nb_dices, self.nb_faces,
220
                 self.multiplier, self.addsub))
221
222
223
class Key(_CDataWrapper):
224
    """Key Event instance
225
226
    Attributes:
227
        vk (int): TCOD_keycode_t key code
228
        c (int): character if vk == TCODK_CHAR else 0
229
        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...
230
        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...
231
        lalt (bool): True when left alt is held.
232
        lctrl (bool): True when left control is held.
233
        lmeta (bool): True when left meta key is held.
234
        ralt (bool): True when right alt is held.
235
        rctrl (bool): True when right control is held.
236
        rmeta (bool): True when right meta key is held.
237
        shift (bool): True when any shift is held.
238
    """
239
240
    _BOOL_ATTRIBUTES = ('lalt', 'lctrl', 'lmeta',
241
                        'ralt', 'rctrl', 'rmeta', 'pressed', 'shift')
242
243
    def __init__(self, *args, **kargs):
244
        super(Key, self).__init__(*args, **kargs)
245
        if self.cdata == ffi.NULL:
246
            self.cdata = ffi.new('TCOD_key_t*')
247
248
    def __getattr__(self, attr):
249
        if attr in self._BOOL_ATTRIBUTES:
250
            return bool(getattr(self.cdata, attr))
251
        if attr == 'c':
252
            return ord(getattr(self.cdata, attr))
253
        if attr == 'text':
254
            return _unpack_char_p(getattr(self.cdata, attr))
255
        return super(Key, self).__getattr__(attr)
256
257
    def __repr__(self):
258
        """Return a representation of this Key object."""
259
        params = []
260
        params.append('vk=%r, c=%r, text=%r, pressed=%r' %
261
                      (self.vk, self.c, self.text, self.pressed))
262
        for attr in ['shift', 'lalt', 'lctrl', 'lmeta',
263
                     'ralt', 'rctrl', 'rmeta']:
264
            if getattr(self, attr):
265
                params.append('%s=%r' % (attr, getattr(self, attr)))
266
        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...
267
268
269
class Mouse(_CDataWrapper):
270
    """Mouse event instance
271
272
    Attributes:
273
        x (int): Absolute mouse position at pixel x.
274
        y (int):
275
        dx (int): Movement since last update in pixels.
276
        dy (int):
277
        cx (int): Cell coordinates in the root console.
278
        cy (int):
279
        dcx (int): Movement since last update in console cells.
280
        dcy (int):
281
        lbutton (bool): Left button status.
282
        rbutton (bool): Right button status.
283
        mbutton (bool): Middle button status.
284
        lbutton_pressed (bool): Left button pressed event.
285
        rbutton_pressed (bool): Right button pressed event.
286
        mbutton_pressed (bool): Middle button pressed event.
287
        wheel_up (bool): Wheel up event.
288
        wheel_down (bool): Wheel down event.
289
    """
290
291
    def __init__(self, *args, **kargs):
292
        super(Mouse, self).__init__(*args, **kargs)
293
        if self.cdata == ffi.NULL:
294
            self.cdata = ffi.new('TCOD_mouse_t*')
295
296
    def __repr__(self):
297
        """Return a representation of this Mouse object."""
298
        params = []
299
        for attr in ['x', 'y', 'dx', 'dy', 'cx', 'cy', 'dcx', 'dcy']:
300
            if getattr(self, attr) == 0:
301
                continue
302
            params.append('%s=%r' % (attr, getattr(self, attr)))
303
        for attr in ['lbutton', 'rbutton', 'mbutton',
304
                     'lbutton_pressed', 'rbutton_pressed', 'mbutton_pressed',
305
                     'wheel_up', 'wheel_down']:
306
            if getattr(self, attr):
307
                params.append('%s=%r' % (attr, getattr(self, attr)))
308
        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...
309
310
311
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...
312
    """Create a new BSP instance with the given rectangle.
313
314
    Args:
315
        x (int): Rectangle left coordinate.
316
        y (int): Rectangle top coordinate.
317
        w (int): Rectangle width.
318
        h (int): Rectangle height.
319
320
    Returns:
321
        BSP: A new BSP instance.
322
323
    .. deprecated:: 2.0
324
       Call the :any:`BSP` class instead.
325
    """
326
    return Bsp(x, y, w, h)
327
328
def bsp_split_once(node, horizontal, position):
329
    """
330
    .. deprecated:: 2.0
331
       Use :any:`BSP.split_once` instead.
332
    """
333
    node.split_once(horizontal, position)
334
335
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...
336
                        maxVRatio):
337
    """
338
    .. deprecated:: 2.0
339
       Use :any:`BSP.split_recursive` instead.
340
    """
341
    node.split_recursive(nb, minHSize, minVSize,
342
                         maxHRatio, maxVRatio, randomizer)
343
344
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...
345
    """
346
    .. deprecated:: 2.0
347
        Assign directly to :any:`BSP` attributes instead.
348
    """
349
    node.x = x
350
    node.y = y
351
    node.width = w
352
    node.height = h
353
354
def bsp_left(node):
355
    """
356
    .. deprecated:: 2.0
357
       Use :any:`BSP.children` instead.
358
    """
359
    return None if not node.children else node.children[0]
360
361
def bsp_right(node):
362
    """
363
    .. deprecated:: 2.0
364
       Use :any:`BSP.children` instead.
365
    """
366
    return None if not node.children else node.children[1]
367
368
def bsp_father(node):
369
    """
370
    .. deprecated:: 2.0
371
       Use :any:`BSP.parent` instead.
372
    """
373
    return node.parent
374
375
def bsp_is_leaf(node):
376
    """
377
    .. deprecated:: 2.0
378
       Use :any:`BSP.children` instead.
379
    """
380
    return not node.children
381
382
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...
383
    """
384
    .. deprecated:: 2.0
385
       Use :any:`BSP.contains` instead.
386
    """
387
    return node.contains(cx, cy)
388
389
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...
390
    """
391
    .. deprecated:: 2.0
392
       Use :any:`BSP.find_node` instead.
393
    """
394
    return node.find_node(cx, cy)
395
396
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...
397
    """pack callback into a handle for use with the callback
398
    _pycall_bsp_callback
399
    """
400
    for node in node_iter:
401
        callback(node, userData)
402
403
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...
404
    """Traverse this nodes hierarchy with a callback.
405
406
    .. deprecated:: 2.0
407
       Use :any:`BSP.walk` instead.
408
    """
409
    _bsp_traverse(node._iter_pre_order(), callback, userData)
410
411
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...
412
    """Traverse this nodes hierarchy with a callback.
413
414
    .. deprecated:: 2.0
415
       Use :any:`BSP.walk` instead.
416
    """
417
    _bsp_traverse(node._iter_in_order(), callback, userData)
418
419
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...
420
    """Traverse this nodes hierarchy with a callback.
421
422
    .. deprecated:: 2.0
423
       Use :any:`BSP.walk` instead.
424
    """
425
    _bsp_traverse(node._iter_post_order(), callback, userData)
426
427
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...
428
    """Traverse this nodes hierarchy with a callback.
429
430
    .. deprecated:: 2.0
431
       Use :any:`BSP.walk` instead.
432
    """
433
    _bsp_traverse(node._iter_level_order(), callback, userData)
434
435
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...
436
    """Traverse this nodes hierarchy with a callback.
437
438
    .. deprecated:: 2.0
439
       Use :any:`BSP.walk` instead.
440
    """
441
    _bsp_traverse(node._iter_inverted_level_order(), callback, userData)
442
443
def bsp_remove_sons(node):
444
    """Delete all children of a given node.  Not recommended.
445
446
    .. note::
447
       This function will add unnecessary complexity to your code.
448
       Don't use it.
449
450
    .. deprecated:: 2.0
451
       BSP deletion is automatic.
452
    """
453
    node.children = ()
454
455
def bsp_delete(node):
0 ignored issues
show
Unused Code introduced by
The argument node seems to be unused.
Loading history...
456
    """Exists for backward compatibility.  Does nothing.
457
458
    BSP's created by this library are automatically garbage collected once
459
    there are no references to the tree.
460
    This function exists for backwards compatibility.
461
462
    .. deprecated:: 2.0
463
       BSP deletion is automatic.
464
    """
465
    pass
466
467
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...
468
    """Return the linear interpolation between two colors.
469
470
    ``a`` is the interpolation value, with 0 returing ``c1``,
471
    1 returning ``c2``, and 0.5 returing a color halfway between both.
472
473
    Args:
474
        c1 (Union[Tuple[int, int, int], Sequence[int]]):
475
            The first color.  At a=0.
476
        c2 (Union[Tuple[int, int, int], Sequence[int]]):
477
            The second color.  At a=1.
478
        a (float): The interpolation value,
479
480
    Returns:
481
        Color: The interpolated Color.
482
    """
483
    return Color._new_from_cdata(lib.TCOD_color_lerp(c1, c2, a))
484
485
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...
486
    """Set a color using: hue, saturation, and value parameters.
487
488
    Does not return a new Color.  ``c`` is modified inplace.
489
490
    Args:
491
        c (Union[Color, List[Any]]): A Color instance, or a list of any kind.
492
        h (float): Hue, from 0 to 360.
493
        s (float): Saturation, from 0 to 1.
494
        v (float): Value, from 0 to 1.
495
    """
496
    new_color = ffi.new('TCOD_color_t*')
497
    lib.TCOD_color_set_HSV(new_color, h, s, v)
498
    c[:] = new_color.r, new_color.g, new_color.b
499
500
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...
501
    """Return the (hue, saturation, value) of a color.
502
503
    Args:
504
        c (Union[Tuple[int, int, int], Sequence[int]]):
505
            An (r, g, b) sequence or Color instance.
506
507
    Returns:
508
        Tuple[float, float, float]:
509
            A tuple with (hue, saturation, value) values, from 0 to 1.
510
    """
511
    hsv = ffi.new('float [3]')
512
    lib.TCOD_color_get_HSV(c, hsv, hsv + 1, hsv + 2)
513
    return hsv[0], hsv[1], hsv[2]
514
515
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...
516
    """Scale a color's saturation and value.
517
518
    Does not return a new Color.  ``c`` is modified inplace.
519
520
    Args:
521
        c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list.
522
        scoef (float): Saturation multiplier, from 0 to 1.
523
                       Use 1 to keep current saturation.
524
        vcoef (float): Value multiplier, from 0 to 1.
525
                       Use 1 to keep current value.
526
    """
527
    color_p = ffi.new('TCOD_color_t*')
528
    color_p.r, color_p.g, color_p.b = c.r, c.g, c.b
529
    lib.TCOD_color_scale_HSV(color_p, scoef, vcoef)
530
    c[:] = color_p.r, color_p.g, color_p.b
531
532
def color_gen_map(colors, indexes):
533
    """Return a smoothly defined scale of colors.
534
535
    If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
536
    will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
537
    All in-betweens will be filled with a gradient.
538
539
    Args:
540
        colors (Iterable[Union[Tuple[int, int, int], Sequence[int]]]):
541
            Array of colors to be sampled.
542
        indexes (Iterable[int]): A list of indexes.
543
544
    Returns:
545
        List[Color]: A list of Color instances.
546
547
    Example:
548
        >>> tcod.color_gen_map([(0, 0, 0), (255, 128, 0)], [0, 5])
549
        [Color(0,0,0), Color(51,25,0), Color(102,51,0), Color(153,76,0), \
550
Color(204,102,0), Color(255,128,0)]
551
    """
552
    ccolors = ffi.new('TCOD_color_t[]', colors)
553
    cindexes = ffi.new('int[]', indexes)
554
    cres = ffi.new('TCOD_color_t[]', max(indexes) + 1)
555
    lib.TCOD_color_gen_map(cres, len(colors), ccolors, cindexes)
556
    return [Color._new_from_cdata(cdata) for cdata in cres]
557
558
559
def console_init_root(w, h, title=None, 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...
560
                      renderer=RENDERER_SDL, order='C'):
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'RENDERER_SDL'
Loading history...
561
    """Set up the primary display and return the root console.
562
563
    .. versionchanged:: 4.3
564
        Added `order` parameter.
565
        `title` parameter is now optional.
566
567
    Args:
568
        w (int): Width in character tiles for the root console.
569
        h (int): Height in character tiles for the root console.
570
        title (Optional[AnyStr]):
571
            This string will be displayed on the created windows title bar.
572
        renderer: Rendering mode for libtcod to use.
573
        order (str): Which numpy memory order to use.
574
575
    Returns:
576
        Console:
577
            Returns a special Console instance representing the root console.
578
    """
579
    if title is None:
580
        # Use the scripts filename as the title.
581
        title = os.path.basename(sys.argv[0])
582
    lib.TCOD_console_init_root(w, h, _bytes(title), fullscreen, renderer)
583
    return tcod.console.Console._from_cdata(ffi.NULL, order)
584
585
586
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...
587
                            nb_char_horiz=0, nb_char_vertic=0):
588
    """Load a custom font file.
589
590
    Call this before function before calling :any:`tcod.console_init_root`.
591
592
    Flags can be a mix of the following:
593
594
    * tcod.FONT_LAYOUT_ASCII_INCOL
595
    * tcod.FONT_LAYOUT_ASCII_INROW
596
    * tcod.FONT_TYPE_GREYSCALE
597
    * tcod.FONT_TYPE_GRAYSCALE
598
    * tcod.FONT_LAYOUT_TCOD
599
600
    Args:
601
        fontFile (AnyStr): Path to a font file.
602
        flags (int):
603
        nb_char_horiz (int):
604
        nb_char_vertic (int):
605
    """
606
    lib.TCOD_console_set_custom_font(_bytes(fontFile), flags,
607
                                     nb_char_horiz, nb_char_vertic)
608
609
610
def console_get_width(con):
611
    """Return the width of a console.
612
613
    Args:
614
        con (Console): Any Console instance.
615
616
    Returns:
617
        int: The width of a Console.
618
619
    .. deprecated:: 2.0
620
        Use `Console.get_width` instead.
621
    """
622
    return lib.TCOD_console_get_width(con.console_c if con else ffi.NULL)
623
624
def console_get_height(con):
625
    """Return the height of a console.
626
627
    Args:
628
        con (Console): Any Console instance.
629
630
    Returns:
631
        int: The height of a Console.
632
633
    .. deprecated:: 2.0
634
        Use `Console.get_hright` instead.
635
    """
636
    return lib.TCOD_console_get_height(con.console_c if con else ffi.NULL)
637
638
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...
639
    """Set a character code to new coordinates on the tile-set.
640
641
    `asciiCode` must be within the bounds created during the initialization of
642
    the loaded tile-set.  For example, you can't use 255 here unless you have a
643
    256 tile tile-set loaded.  This applies to all functions in this group.
644
645
    Args:
646
        asciiCode (int): The character code to change.
647
        fontCharX (int): The X tile coordinate on the loaded tileset.
648
                         0 is the leftmost tile.
649
        fontCharY (int): The Y tile coordinate on the loaded tileset.
650
                         0 is the topmost tile.
651
    """
652
    lib.TCOD_console_map_ascii_code_to_font(_int(asciiCode), fontCharX,
653
                                                              fontCharY)
654
655
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...
656
                                    fontCharY):
657
    """Remap a contiguous set of codes to a contiguous set of tiles.
658
659
    Both the tile-set and character codes must be contiguous to use this
660
    function.  If this is not the case you may want to use
661
    :any:`console_map_ascii_code_to_font`.
662
663
    Args:
664
        firstAsciiCode (int): The starting character code.
665
        nbCodes (int): The length of the contiguous set.
666
        fontCharX (int): The starting X tile coordinate on the loaded tileset.
667
                         0 is the leftmost tile.
668
        fontCharY (int): The starting Y tile coordinate on the loaded tileset.
669
                         0 is the topmost tile.
670
671
    """
672
    lib.TCOD_console_map_ascii_codes_to_font(_int(firstAsciiCode), nbCodes,
673
                                              fontCharX, fontCharY)
674
675
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...
676
    """Remap a string of codes to a contiguous set of tiles.
677
678
    Args:
679
        s (AnyStr): A string of character codes to map to new values.
680
                    The null character `'\x00'` will prematurely end this
681
                    function.
682
        fontCharX (int): The starting X tile coordinate on the loaded tileset.
683
                         0 is the leftmost tile.
684
        fontCharY (int): The starting Y tile coordinate on the loaded tileset.
685
                         0 is the topmost tile.
686
    """
687
    lib.TCOD_console_map_string_to_font_utf(_unicode(s), fontCharX, fontCharY)
688
689
def console_is_fullscreen():
690
    """Returns True if the display is fullscreen.
691
692
    Returns:
693
        bool: True if the display is fullscreen, otherwise False.
694
    """
695
    return bool(lib.TCOD_console_is_fullscreen())
696
697
def console_set_fullscreen(fullscreen):
698
    """Change the display to be fullscreen or windowed.
699
700
    Args:
701
        fullscreen (bool): Use True to change to fullscreen.
702
                           Use False to change to windowed.
703
    """
704
    lib.TCOD_console_set_fullscreen(fullscreen)
705
706
def console_is_window_closed():
707
    """Returns True if the window has received and exit event."""
708
    return lib.TCOD_console_is_window_closed()
709
710
def console_set_window_title(title):
711
    """Change the current title bar string.
712
713
    Args:
714
        title (AnyStr): A string to change the title bar to.
715
    """
716
    lib.TCOD_console_set_window_title(_bytes(title))
717
718
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...
719
    lib.TCOD_console_credits()
720
721
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...
722
    lib.TCOD_console_credits_reset()
723
724
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...
725
    return lib.TCOD_console_credits_render(x, y, alpha)
726
727
def console_flush():
728
    """Update the display to represent the root consoles current state."""
729
    lib.TCOD_console_flush()
730
731
# drawing on a console
732
def console_set_default_background(con, col):
733
    """Change the default background color for a console.
734
735
    Args:
736
        con (Console): Any Console instance.
737
        col (Union[Tuple[int, int, int], Sequence[int]]):
738
            An (r, g, b) sequence or Color instance.
739
    """
740
    lib.TCOD_console_set_default_background(
741
        con.console_c if con else ffi.NULL, col)
742
743
def console_set_default_foreground(con, col):
744
    """Change the default foreground color for a console.
745
746
    Args:
747
        con (Console): Any Console instance.
748
        col (Union[Tuple[int, int, int], Sequence[int]]):
749
            An (r, g, b) sequence or Color instance.
750
    """
751
    lib.TCOD_console_set_default_foreground(
752
        con.console_c if con else ffi.NULL, col)
753
754
def console_clear(con):
755
    """Reset a console to its default colors and the space character.
756
757
    Args:
758
        con (Console): Any Console instance.
759
760
    .. seealso::
761
       :any:`console_set_default_background`
762
       :any:`console_set_default_foreground`
763
    """
764
    return lib.TCOD_console_clear(con.console_c if con else ffi.NULL)
765
766
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...
767
    """Draw the character c at x,y using the default colors and a blend mode.
768
769
    Args:
770
        con (Console): Any Console instance.
771
        x (int): Character x position from the left.
772
        y (int): Character y position from the top.
773
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
774
        flag (int): Blending mode to use, defaults to BKGND_DEFAULT.
775
    """
776
    lib.TCOD_console_put_char(
777
        con.console_c if con else ffi.NULL, x, y, _int(c), flag)
778
779
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...
780
    """Draw the character c at x,y using the colors fore and back.
781
782
    Args:
783
        con (Console): Any Console instance.
784
        x (int): Character x position from the left.
785
        y (int): Character y position from the top.
786
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
787
        fore (Union[Tuple[int, int, int], Sequence[int]]):
788
            An (r, g, b) sequence or Color instance.
789
        back (Union[Tuple[int, int, int], Sequence[int]]):
790
            An (r, g, b) sequence or Color instance.
791
    """
792
    lib.TCOD_console_put_char_ex(con.console_c if con else ffi.NULL, x, y,
793
                                 _int(c), fore, back)
794
795
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...
796
    """Change the background color of x,y to col using a blend mode.
797
798
    Args:
799
        con (Console): Any Console instance.
800
        x (int): Character x position from the left.
801
        y (int): Character y position from the top.
802
        col (Union[Tuple[int, int, int], Sequence[int]]):
803
            An (r, g, b) sequence or Color instance.
804
        flag (int): Blending mode to use, defaults to BKGND_SET.
805
    """
806
    lib.TCOD_console_set_char_background(
807
        con.console_c if con else ffi.NULL, x, y, col, flag)
808
809
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...
810
    """Change the foreground color of x,y to col.
811
812
    Args:
813
        con (Console): Any Console instance.
814
        x (int): Character x position from the left.
815
        y (int): Character y position from the top.
816
        col (Union[Tuple[int, int, int], Sequence[int]]):
817
            An (r, g, b) sequence or Color instance.
818
    """
819
    lib.TCOD_console_set_char_foreground(
820
        con.console_c if con else ffi.NULL, x, y, col)
821
822
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...
823
    """Change the character at x,y to c, keeping the current colors.
824
825
    Args:
826
        con (Console): Any Console instance.
827
        x (int): Character x position from the left.
828
        y (int): Character y position from the top.
829
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
830
    """
831
    lib.TCOD_console_set_char(
832
        con.console_c if con else ffi.NULL, x, y, _int(c))
833
834
def console_set_background_flag(con, flag):
835
    """Change the default blend mode for this console.
836
837
    Args:
838
        con (Console): Any Console instance.
839
        flag (int): Blend mode to use by default.
840
    """
841
    lib.TCOD_console_set_background_flag(
842
        con.console_c if con else ffi.NULL, flag)
843
844
def console_get_background_flag(con):
845
    """Return this consoles current blend mode.
846
847
    Args:
848
        con (Console): Any Console instance.
849
    """
850
    return lib.TCOD_console_get_background_flag(
851
        con.console_c if con else ffi.NULL)
852
853
def console_set_alignment(con, alignment):
854
    """Change this consoles current alignment mode.
855
856
    * tcod.LEFT
857
    * tcod.CENTER
858
    * tcod.RIGHT
859
860
    Args:
861
        con (Console): Any Console instance.
862
        alignment (int):
863
    """
864
    lib.TCOD_console_set_alignment(
865
        con.console_c if con else ffi.NULL, alignment)
866
867
def console_get_alignment(con):
868
    """Return this consoles current alignment mode.
869
870
    Args:
871
        con (Console): Any Console instance.
872
    """
873
    return lib.TCOD_console_get_alignment(con.console_c if con else ffi.NULL)
874
875
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...
876
    """Print a color formatted string on a console.
877
878
    Args:
879
        con (Console): Any Console instance.
880
        x (int): Character x position from the left.
881
        y (int): Character y position from the top.
882
        fmt (AnyStr): A unicode or bytes string optionaly using color codes.
883
    """
884
    lib.TCOD_console_print_utf(
885
        con.console_c if con else ffi.NULL, x, y, _fmt_unicode(fmt))
886
887
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...
888
    """Print a string on a console using a blend mode and alignment mode.
889
890
    Args:
891
        con (Console): Any Console instance.
892
        x (int): Character x position from the left.
893
        y (int): Character y position from the top.
894
    """
895
    lib.TCOD_console_print_ex_utf(con.console_c if con else ffi.NULL,
896
                                  x, y, flag, alignment, _fmt_unicode(fmt))
897
898
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...
899
    """Print a string constrained to a rectangle.
900
901
    If h > 0 and the bottom of the rectangle is reached,
902
    the string is truncated. If h = 0,
903
    the string is only truncated if it reaches the bottom of the console.
904
905
906
907
    Returns:
908
        int: The number of lines of text once word-wrapped.
909
    """
910
    return lib.TCOD_console_print_rect_utf(
911
        con.console_c if con else ffi.NULL, x, y, w, h, _fmt_unicode(fmt))
912
913
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...
914
    """Print a string constrained to a rectangle with blend and alignment.
915
916
    Returns:
917
        int: The number of lines of text once word-wrapped.
918
    """
919
    return lib.TCOD_console_print_rect_ex_utf(
920
        con.console_c if con else ffi.NULL,
921
        x, y, w, h, flag, alignment, _fmt_unicode(fmt))
922
923
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...
924
    """Return the height of this text once word-wrapped into this rectangle.
925
926
    Returns:
927
        int: The number of lines of text once word-wrapped.
928
    """
929
    return lib.TCOD_console_get_height_rect_utf(
930
        con.console_c if con else ffi.NULL, x, y, w, h, _fmt_unicode(fmt))
931
932
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...
933
    """Draw a the background color on a rect optionally clearing the text.
934
935
    If clr is True the affected tiles are changed to space character.
936
    """
937
    lib.TCOD_console_rect(
938
        con.console_c if con else ffi.NULL, x, y, w, h, clr, flag)
939
940
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...
941
    """Draw a horizontal line on the console.
942
943
    This always uses the character 196, the horizontal line character.
944
    """
945
    lib.TCOD_console_hline(con.console_c if con else ffi.NULL, x, y, l, flag)
946
947
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...
948
    """Draw a vertical line on the console.
949
950
    This always uses the character 179, the vertical line character.
951
    """
952
    lib.TCOD_console_vline(con.console_c if con else ffi.NULL, x, y, l, flag)
953
954
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...
955
    """Draw a framed rectangle with optinal text.
956
957
    This uses the default background color and blend mode to fill the
958
    rectangle and the default foreground to draw the outline.
959
960
    fmt will be printed on the inside of the rectangle, word-wrapped.
961
    """
962
    lib.TCOD_console_print_frame(
963
        con.console_c if con else ffi.NULL,
964
        x, y, w, h, clear, flag, _fmt_bytes(fmt))
965
966
def console_set_color_control(con, fore, back):
967
    """Configure :any:`color controls`.
968
969
    Args:
970
        con (int): :any:`Color control` constant to modify.
971
        fore (Union[Tuple[int, int, int], Sequence[int]]):
972
            An (r, g, b) sequence or Color instance.
973
        back (Union[Tuple[int, int, int], Sequence[int]]):
974
            An (r, g, b) sequence or Color instance.
975
    """
976
    lib.TCOD_console_set_color_control(con, fore, back)
977
978
def console_get_default_background(con):
979
    """Return this consoles default background color."""
980
    return Color._new_from_cdata(
981
        lib.TCOD_console_get_default_background(
982
            con.console_c if con else ffi.NULL))
983
984
def console_get_default_foreground(con):
985
    """Return this consoles default foreground color."""
986
    return Color._new_from_cdata(
987
        lib.TCOD_console_get_default_foreground(
988
            con.console_c if con else ffi.NULL))
989
990
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...
991
    """Return the background color at the x,y of this console."""
992
    return Color._new_from_cdata(
993
        lib.TCOD_console_get_char_background(
994
            con.console_c if con else ffi.NULL, x, y))
995
996
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...
997
    """Return the foreground color at the x,y of this console."""
998
    return Color._new_from_cdata(
999
        lib.TCOD_console_get_char_foreground(
1000
            con.console_c if con else ffi.NULL, x, y))
1001
1002
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...
1003
    """Return the character at the x,y of this console."""
1004
    return lib.TCOD_console_get_char(con.console_c if con else ffi.NULL, x, y)
1005
1006
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...
1007
    lib.TCOD_console_set_fade(fade, fadingColor)
1008
1009
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...
1010
    return lib.TCOD_console_get_fade()
1011
1012
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...
1013
    return Color._new_from_cdata(lib.TCOD_console_get_fading_color())
1014
1015
# handling keyboard input
1016
def console_wait_for_keypress(flush):
1017
    """Block until the user presses a key, then returns a new Key.
1018
1019
    Args:
1020
        flush bool: If True then the event queue is cleared before waiting
1021
                    for the next event.
1022
1023
    Returns:
1024
        Key: A new Key instance.
1025
    """
1026
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
1027
    lib.TCOD_console_wait_for_keypress_wrapper(k.cdata, flush)
1028
    return k
1029
1030
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...
1031
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
1032
    lib.TCOD_console_check_for_keypress_wrapper(k.cdata, flags)
1033
    return k
1034
1035
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...
1036
    return lib.TCOD_console_is_key_pressed(key)
1037
1038
# using offscreen consoles
1039
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...
1040
    """Return an offscreen console of size: w,h."""
1041
    return tcod.console.Console(w, h)
1042
1043
def console_from_file(filename):
1044
    """Return a new console object from a filename.
1045
1046
    The file format is automactially determined.  This can load REXPaint `.xp`,
1047
    ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files.
1048
1049
    Args:
1050
        filename (Text): The path to the file, as a string.
1051
1052
    Returns: A new :any`Console` instance.
1053
    """
1054
    return tcod.console.Console._from_cdata(
1055
        lib.TCOD_console_from_file(filename.encode('utf-8')))
1056
1057
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...
1058
    """Blit the console src from x,y,w,h to console dst at xdst,ydst."""
1059
    lib.TCOD_console_blit(
1060
        src.console_c if src else ffi.NULL, x, y, w, h,
1061
        dst.console_c if dst else ffi.NULL, xdst, ydst, ffade, bfade)
1062
1063
def console_set_key_color(con, col):
1064
    """Set a consoles blit transparent color."""
1065
    lib.TCOD_console_set_key_color(con.console_c if con else ffi.NULL, col)
1066 View Code Duplication
    if hasattr(con, 'set_key_color'):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1067
        con.set_key_color(col)
1068
1069
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...
1070
    con = con.console_c if con else ffi.NULL
1071
    if con == ffi.NULL:
1072
        lib.TCOD_console_delete(con)
1073
1074
# fast color filling
1075
def console_fill_foreground(con, r, g, b):
0 ignored issues
show
Coding Style Naming introduced by
The name r does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading history...
1076
    """Fill the foregound of a console with r,g,b.
1077
1078
    Args:
1079
        con (Console): Any Console instance.
1080
        r (Sequence[int]): An array of integers with a length of width*height.
1081
        g (Sequence[int]): An array of integers with a length of width*height.
1082
        b (Sequence[int]): An array of integers with a length of width*height.
1083
    """
1084
    if len(r) != len(g) or len(r) != len(b):
1085
        raise TypeError('R, G and B must all have the same size.')
1086
    if (isinstance(r, _np.ndarray) and isinstance(g, _np.ndarray) and
1087
            isinstance(b, _np.ndarray)):
1088
        #numpy arrays, use numpy's ctypes functions
1089
        r = _np.ascontiguousarray(r, dtype=_np.intc)
1090
        g = _np.ascontiguousarray(g, dtype=_np.intc)
1091
        b = _np.ascontiguousarray(b, dtype=_np.intc)
1092
        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...
1093
        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...
1094
        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...
1095 View Code Duplication
    else:
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1096
        # otherwise convert using ffi arrays
1097
        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...
1098
        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...
1099
        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...
1100
1101
    lib.TCOD_console_fill_foreground(con.console_c if con else ffi.NULL,
1102
                                     cr, cg, cb)
1103
1104
def console_fill_background(con, r, g, b):
0 ignored issues
show
Coding Style Naming introduced by
The name r does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading history...
1105
    """Fill the backgound of a console with r,g,b.
1106
1107
    Args:
1108
        con (Console): Any Console instance.
1109
        r (Sequence[int]): An array of integers with a length of width*height.
1110
        g (Sequence[int]): An array of integers with a length of width*height.
1111
        b (Sequence[int]): An array of integers with a length of width*height.
1112
    """
1113
    if len(r) != len(g) or len(r) != len(b):
1114
        raise TypeError('R, G and B must all have the same size.')
1115
    if (isinstance(r, _np.ndarray) and isinstance(g, _np.ndarray) and
1116
            isinstance(b, _np.ndarray)):
1117
        #numpy arrays, use numpy's ctypes functions
1118
        r = _np.ascontiguousarray(r, dtype=_np.intc)
1119
        g = _np.ascontiguousarray(g, dtype=_np.intc)
1120
        b = _np.ascontiguousarray(b, dtype=_np.intc)
1121
        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...
1122
        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...
1123
        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...
1124
    else:
1125
        # otherwise convert using ffi arrays
1126
        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...
1127
        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...
1128
        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...
1129
1130
    lib.TCOD_console_fill_background(con.console_c if con else ffi.NULL,
1131
                                     cr, cg, cb)
1132
1133
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...
1134
    """Fill the character tiles of a console with an array.
1135
1136
    Args:
1137
        con (Console): Any Console instance.
1138
        arr (Sequence[int]): An array of integers with a length of width*height.
1139
    """
1140
    if isinstance(arr, _np.ndarray):
1141
        #numpy arrays, use numpy's ctypes functions
1142
        arr = _np.ascontiguousarray(arr, dtype=_np.intc)
1143
        carr = ffi.cast('int *', arr.ctypes.data)
1144
    else:
1145
        #otherwise convert using the ffi module
1146
        carr = ffi.new('int[]', arr)
1147
1148
    lib.TCOD_console_fill_char(con.console_c if con else ffi.NULL, carr)
1149
1150
def console_load_asc(con, filename):
1151
    """Update a console from a non-delimited ASCII `.asc` file."""
1152
    return lib.TCOD_console_load_asc(
1153
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1154
1155
def console_save_asc(con, filename):
1156
    """Save a console to a non-delimited ASCII `.asc` file."""
1157
    return lib.TCOD_console_save_asc(
1158
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1159
1160
def console_load_apf(con, filename):
1161
    """Update a console from an ASCII Paint `.apf` file."""
1162
    return lib.TCOD_console_load_apf(
1163
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1164
1165
def console_save_apf(con, filename):
1166
    """Save a console to an ASCII Paint `.apf` file."""
1167
    return lib.TCOD_console_save_apf(
1168
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1169
1170
def console_load_xp(con, filename):
1171
    """Update a console from a REXPaint `.xp` file."""
1172
    return lib.TCOD_console_load_xp(
1173
        con.console_c if con else ffi.NULL, filename.encode('utf-8'))
1174
1175
def console_save_xp(con, filename, compress_level=9):
1176
    """Save a console to a REXPaint `.xp` file."""
1177
    return lib.TCOD_console_save_xp(
1178
        con.console_c if con else ffi.NULL,
1179
        filename.encode('utf-8'),
1180
        compress_level,
1181
        )
1182
1183
def console_from_xp(filename):
1184
    """Return a single console from a REXPaint `.xp` file."""
1185
    return tcod.console.Console._from_cdata(
1186
        lib.TCOD_console_from_xp(filename.encode('utf-8')))
1187
1188
def console_list_load_xp(filename):
1189
    """Return a list of consoles from a REXPaint `.xp` file."""
1190
    tcod_list = lib.TCOD_console_list_from_xp(filename.encode('utf-8'))
1191
    if tcod_list == ffi.NULL:
1192
        return None
1193
    try:
1194
        python_list = []
1195
        lib.TCOD_list_reverse(tcod_list)
1196
        while not lib.TCOD_list_is_empty(tcod_list):
1197
            python_list.append(
1198
                tcod.console.Console._from_cdata(lib.TCOD_list_pop(tcod_list)),
1199
                )
1200
        return python_list
1201
    finally:
1202
        lib.TCOD_list_delete(tcod_list)
1203
1204
def console_list_save_xp(console_list, filename, compress_level=9):
1205
    """Save a list of consoles to a REXPaint `.xp` file."""
1206
    tcod_list = lib.TCOD_list_new()
1207
    try:
1208
        for console in console_list:
1209
            lib.TCOD_list_push(tcod_list,
1210
                               console.console_c if console else ffi.NULL)
1211
        return lib.TCOD_console_list_save_xp(
1212
            tcod_list, filename.encode('utf-8'), compress_level
1213
            )
1214
    finally:
1215
        lib.TCOD_list_delete(tcod_list)
1216
1217
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...
1218
    """Return a new AStar using the given Map.
1219
1220
    Args:
1221
        m (Map): A Map instance.
1222
        dcost (float): The path-finding cost of diagonal movement.
1223
                       Can be set to 0 to disable diagonal movement.
1224
    Returns:
1225
        AStar: A new AStar instance.
1226
    """
1227
    return tcod.path.AStar(m, dcost)
1228
1229
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...
1230
    """Return a new AStar using the given callable function.
1231
1232
    Args:
1233
        w (int): Clipping width.
1234
        h (int): Clipping height.
1235
        func (Callable[[int, int, int, int, Any], float]):
1236
        userData (Any):
1237
        dcost (float): A multiplier for the cost of diagonal movement.
1238
                       Can be set to 0 to disable diagonal movement.
1239
    Returns:
1240
        AStar: A new AStar instance.
1241
    """
1242
    return tcod.path.AStar(
1243
        tcod.path._EdgeCostFunc((func, userData), w, h),
1244
        dcost,
1245
        )
1246
1247
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...
1248
    """Find a path from (ox, oy) to (dx, dy).  Return True if path is found.
1249
1250
    Args:
1251
        p (AStar): An AStar instance.
1252
        ox (int): Starting x position.
1253
        oy (int): Starting y position.
1254
        dx (int): Destination x position.
1255
        dy (int): Destination y position.
1256
    Returns:
1257
        bool: True if a valid path was found.  Otherwise False.
1258
    """
1259
    return lib.TCOD_path_compute(p._path_c, ox, oy, dx, dy)
1260
1261
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...
1262
    """Get the current origin position.
1263
1264
    This point moves when :any:`path_walk` returns the next x,y step.
1265
1266
    Args:
1267
        p (AStar): An AStar instance.
1268
    Returns:
1269
        Tuple[int, int]: An (x, y) point.
1270
    """
1271
    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...
1272
    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...
1273
    lib.TCOD_path_get_origin(p._path_c, x, y)
1274
    return x[0], y[0]
1275
1276
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...
1277
    """Get the current destination position.
1278
1279
    Args:
1280
        p (AStar): An AStar instance.
1281
    Returns:
1282
        Tuple[int, int]: An (x, y) point.
1283
    """
1284
    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...
1285
    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...
1286
    lib.TCOD_path_get_destination(p._path_c, x, y)
1287
    return x[0], y[0]
1288
1289
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...
1290
    """Return the current length of the computed path.
1291
1292
    Args:
1293
        p (AStar): An AStar instance.
1294
    Returns:
1295
        int: Length of the path.
1296
    """
1297
    return lib.TCOD_path_size(p._path_c)
1298
1299
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...
1300
    """Reverse the direction of a path.
1301
1302
    This effectively swaps the origin and destination points.
1303
1304
    Args:
1305
        p (AStar): An AStar instance.
1306
    """
1307
    lib.TCOD_path_reverse(p._path_c)
1308
1309
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...
1310
    """Get a point on a path.
1311
1312
    Args:
1313
        p (AStar): An AStar instance.
1314
        idx (int): Should be in range: 0 <= inx < :any:`path_size`
1315
    """
1316
    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...
1317
    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...
1318
    lib.TCOD_path_get(p._path_c, idx, x, y)
1319
    return x[0], y[0]
1320
1321
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...
1322
    """Return True if a path is empty.
1323
1324
    Args:
1325
        p (AStar): An AStar instance.
1326
    Returns:
1327
        bool: True if a path is empty.  Otherwise False.
1328
    """
1329
    return lib.TCOD_path_is_empty(p._path_c)
1330
1331
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...
1332
    """Return the next (x, y) point in a path, or (None, None) if it's empty.
1333
1334
    When ``recompute`` is True and a previously valid path reaches a point
1335
    where it is now blocked, a new path will automatically be found.
1336
1337
    Args:
1338
        p (AStar): An AStar instance.
1339
        recompute (bool): Recompute the path automatically.
1340
    Returns:
1341
        Union[Tuple[int, int], Tuple[None, None]]:
1342
            A single (x, y) point, or (None, None)
1343
    """
1344
    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...
1345
    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...
1346
    if lib.TCOD_path_walk(p._path_c, x, y, recompute):
1347
        return x[0], y[0]
1348
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1349
1350
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...
1351
    """Does nothing."""
1352
    pass
1353
1354
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...
1355
    return tcod.path.Dijkstra(m, dcost)
1356
1357
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...
1358
    return tcod.path.Dijkstra(
1359
        tcod.path._EdgeCostFunc((func, userData), w, h),
1360
        dcost,
1361
        )
1362
1363
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...
1364
    lib.TCOD_dijkstra_compute(p._path_c, ox, oy)
1365
1366
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...
1367
    return lib.TCOD_dijkstra_path_set(p._path_c, x, y)
1368
1369
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...
1370
    return lib.TCOD_dijkstra_get_distance(p._path_c, x, y)
1371
1372
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...
1373
    return lib.TCOD_dijkstra_size(p._path_c)
1374
1375
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...
1376
    lib.TCOD_dijkstra_reverse(p._path_c)
1377
1378
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...
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
    lib.TCOD_dijkstra_get(p._path_c, idx, x, y)
1382
    return x[0], y[0]
1383
1384
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...
1385
    return lib.TCOD_dijkstra_is_empty(p._path_c)
1386
1387
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...
1388
    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...
1389
    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...
1390
    if lib.TCOD_dijkstra_path_walk(p._path_c, x, y):
1391
        return x[0], y[0]
1392
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1393
1394
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...
1395
    pass
1396
1397
def _heightmap_cdata(array):
1398
    """Return a new TCOD_heightmap_t instance using an array.
1399
1400
    Formatting is verified during this function.
1401
    """
1402
    if not array.flags['C_CONTIGUOUS']:
1403
        raise ValueError('array must be a C-style contiguous segment.')
1404
    if array.dtype != _np.float32:
1405
        raise ValueError('array dtype must be float32, not %r' % array.dtype)
1406
    width, height = array.shape
1407
    pointer = ffi.cast('float *', array.ctypes.data)
1408
    return ffi.new('TCOD_heightmap_t *', (width, height, pointer))
1409
1410
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...
1411
    """Return a new numpy.ndarray formatted for use with heightmap functions.
1412
1413
    You can pass a numpy array to any heightmap function as long as all the
1414
    following are true::
1415
    * The array is 2 dimentional.
1416
    * The array has the C_CONTIGUOUS flag.
1417
    * The array's dtype is :any:`dtype.float32`.
1418
1419
    Args:
1420
        w (int): The width of the new HeightMap.
1421
        h (int): The height of the new HeightMap.
1422
1423
    Returns:
1424
        numpy.ndarray: A C-contiguous mapping of float32 values.
1425
    """
1426
    return _np.ndarray((h, w), _np.float32)
1427
1428
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...
1429
    """Set the value of a point on a heightmap.
1430
1431
    Args:
1432
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1433
        x (int): The x position to change.
1434
        y (int): The y position to change.
1435
        value (float): The value to set.
1436
1437
    .. deprecated:: 2.0
1438
        Do ``hm[y, x] = value`` instead.
1439
    """
1440
    hm[y, x] = value
1441
1442
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...
1443
    """Add value to all values on this heightmap.
1444
1445
    Args:
1446
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1447
        value (float): A number to add to this heightmap.
1448
1449
    .. deprecated:: 2.0
1450
        Do ``hm[:] += value`` instead.
1451
    """
1452
    hm[:] += value
1453
1454
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...
1455
    """Multiply all items on this heightmap by value.
1456
1457
    Args:
1458
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1459
        value (float): A number to scale this heightmap by.
1460
1461
    .. deprecated:: 2.0
1462
        Do ``hm[:] *= value`` instead.
1463
    """
1464
    hm[:] *= value
1465
1466
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...
1467
    """Add value to all values on this heightmap.
1468
1469
    Args:
1470
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1471
1472
    .. deprecated:: 2.0
1473
        Do ``hm.array[:] = 0`` instead.
1474
    """
1475
    hm[:] = 0
1476
1477
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...
1478
    """Clamp all values on this heightmap between ``mi`` and ``ma``
1479
1480
    Args:
1481
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1482
        mi (float): The lower bound to clamp to.
1483
        ma (float): The upper bound to clamp to.
1484
1485
    .. deprecated:: 2.0
1486
        Do ``hm.clip(mi, ma)`` instead.
1487
    """
1488
    hm.clip(mi, ma)
1489
1490
def heightmap_copy(hm1, hm2):
1491
    """Copy the heightmap ``hm1`` to ``hm2``.
1492
1493
    Args:
1494
        hm1 (numpy.ndarray): The source heightmap.
1495
        hm2 (numpy.ndarray): The destination heightmap.
1496
1497
    .. deprecated:: 2.0
1498
        Do ``hm2[:] = hm1[:]`` instead.
1499
    """
1500
    hm2[:] = hm1[:]
1501
1502
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...
1503
    """Normalize heightmap values between ``mi`` and ``ma``.
1504
1505
    Args:
1506
        mi (float): The lowest value after normalization.
1507
        ma (float): The highest value after normalization.
1508
    """
1509
    lib.TCOD_heightmap_normalize(_heightmap_cdata(hm), mi, ma)
1510
1511
def heightmap_lerp_hm(hm1, hm2, hm3, coef):
1512
    """Perform linear interpolation between two heightmaps storing the result
1513
    in ``hm3``.
1514
1515
    This is the same as doing ``hm3[:] = hm1[:] + (hm2[:] - hm1[:]) * coef``
1516
1517
    Args:
1518
        hm1 (numpy.ndarray): The first heightmap.
1519
        hm2 (numpy.ndarray): The second heightmap to add to the first.
1520
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1521
        coef (float): The linear interpolation coefficient.
1522
    """
1523
    lib.TCOD_heightmap_lerp_hm(_heightmap_cdata(hm1), _heightmap_cdata(hm2),
1524
                               _heightmap_cdata(hm3), coef)
1525
1526
def heightmap_add_hm(hm1, hm2, hm3):
1527
    """Add two heightmaps together and stores the result in ``hm3``.
1528
1529
    Args:
1530
        hm1 (numpy.ndarray): The first heightmap.
1531
        hm2 (numpy.ndarray): The second heightmap to add to the first.
1532
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1533
1534
    .. deprecated:: 2.0
1535
        Do ``hm3[:] = hm1[:] + hm2[:]`` instead.
1536
    """
1537
    hm3[:] = hm1[:] + hm2[:]
1538
1539
def heightmap_multiply_hm(hm1, hm2, hm3):
1540
    """Multiplies two heightmap's together and stores the result in ``hm3``.
1541
1542
    Args:
1543
        hm1 (numpy.ndarray): The first heightmap.
1544
        hm2 (numpy.ndarray): The second heightmap to multiply with the first.
1545
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1546
1547
    .. deprecated:: 2.0
1548
        Do ``hm3[:] = hm1[:] * hm2[:]`` instead.
1549
        Alternatively you can do ``HeightMap(hm1.array[:] * hm2.array[:])``.
1550
    """
1551
    hm3[:] = hm1[:] * hm2[:]
1552
1553
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...
1554
    """Add a hill (a half spheroid) at given position.
1555
1556
    If height == radius or -radius, the hill is a half-sphere.
1557
1558
    Args:
1559
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1560
        x (float): The x position at the center of the new hill.
1561
        y (float): The y position at the center of the new hill.
1562
        radius (float): The size of the new hill.
1563
        height (float): The height or depth of the new hill.
1564
    """
1565
    lib.TCOD_heightmap_add_hill(_heightmap_cdata(hm), x, y, radius, height)
1566
1567
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...
1568
    """
1569
1570
    This function takes the highest value (if height > 0) or the lowest
1571
    (if height < 0) between the map and the hill.
1572
1573
    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...
1574
1575
    Args:
1576
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1577
        x (float): The x position at the center of the new carving.
1578
        y (float): The y position at the center of the new carving.
1579
        radius (float): The size of the carving.
1580
        height (float): The height or depth of the hill to dig out.
1581
    """
1582
    lib.TCOD_heightmap_dig_hill(_heightmap_cdata(hm), x, y, radius, height)
1583
1584
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...
1585
    """Simulate the effect of rain drops on the terrain, resulting in erosion.
1586
1587
    ``nbDrops`` should be at least hm.size.
1588
1589
    Args:
1590
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1591
        nbDrops (int): Number of rain drops to simulate.
1592
        erosionCoef (float): Amount of ground eroded on the drop's path.
1593
        sedimentationCoef (float): Amount of ground deposited when the drops
1594
                                   stops to flow.
1595
        rnd (Optional[Random]): A tcod.Random instance, or None.
1596
    """
1597
    lib.TCOD_heightmap_rain_erosion(_heightmap_cdata(hm), nbDrops, erosionCoef,
1598
                                    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...
1599
1600
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...
1601
                               maxLevel):
1602
    """Apply a generic transformation on the map, so that each resulting cell
1603
    value is the weighted sum of several neighbour cells.
1604
1605
    This can be used to smooth/sharpen the map.
1606
1607
    Args:
1608
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1609
        kernelsize (int): Should be set to the length of the parameters::
1610
                          dx, dy, and weight.
1611
        dx (Sequence[int]): A sequence of x coorinates.
1612
        dy (Sequence[int]): A sequence of y coorinates.
1613
        weight (Sequence[float]): A sequence of kernelSize cells weight.
1614
                                  The value of each neighbour cell is scaled by
1615
                                  its corresponding weight
1616
        minLevel (float): No transformation will apply to cells
1617
                          below this value.
1618
        maxLevel (float): No transformation will apply to cells
1619
                          above this value.
1620
1621
    See examples below for a simple horizontal smoothing kernel :
1622
    replace value(x,y) with
1623
    0.33*value(x-1,y) + 0.33*value(x,y) + 0.33*value(x+1,y).
1624
    To do this, you need a kernel of size 3
1625
    (the sum involves 3 surrounding cells).
1626
    The dx,dy array will contain
1627
    * dx=-1, dy=0 for cell (x-1, y)
1628
    * dx=1, dy=0 for cell (x+1, y)
1629
    * dx=0, dy=0 for cell (x, y)
1630
    * The weight array will contain 0.33 for each cell.
1631
1632
    Example:
1633
        >>> import numpy as np
1634
        >>> heightmap = np.zeros((3, 3), dtype=np.float32)
1635
        >>> heightmap[:,1] = 1
1636
        >>> dx = [-1, 1, 0]
1637
        >>> dy = [0, 0, 0]
1638
        >>> weight = [0.33, 0.33, 0.33]
1639
        >>> tcod.heightmap_kernel_transform(heightmap, 3, dx, dy, weight,
1640
        ...                                 0.0, 1.0)
1641
    """
1642
    cdx = ffi.new('int[]', dx)
1643
    cdy = ffi.new('int[]', dy)
1644
    cweight = ffi.new('float[]', weight)
1645
    lib.TCOD_heightmap_kernel_transform(_heightmap_cdata(hm), kernelsize,
1646
                                        cdx, cdy, cweight, minLevel, maxLevel)
1647
1648
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...
1649
    """Add values from a Voronoi diagram to the heightmap.
1650
1651
    Args:
1652
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1653
        nbPoints (Any): Number of Voronoi sites.
1654
        nbCoef (int): The diagram value is calculated from the nbCoef
1655
                      closest sites.
1656
        coef (Sequence[float]): The distance to each site is scaled by the
1657
                                corresponding coef.
1658
                                Closest site : coef[0],
1659
                                second closest site : coef[1], ...
1660
        rnd (Optional[Random]): A Random instance, or None.
1661
    """
1662
    nbPoints = len(coef)
1663
    ccoef = ffi.new('float[]', coef)
1664
    lib.TCOD_heightmap_add_voronoi(_heightmap_cdata(hm), nbPoints,
1665
                                   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...
1666
1667
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...
1668
    """Add FBM noise to the heightmap.
1669
1670
    The noise coordinate for each map cell is
1671
    `((x + addx) * mulx / width, (y + addy) * muly / height)`.
1672
1673
    The value added to the heightmap is `delta + noise * scale`.
1674
1675
    Args:
1676
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1677
        noise (Noise): A Noise instance.
1678
        mulx (float): Scaling of each x coordinate.
1679
        muly (float): Scaling of each y coordinate.
1680
        addx (float): Translation of each x coordinate.
1681
        addy (float): Translation of each y coordinate.
1682
        octaves (float): Number of octaves in the FBM sum.
1683
        delta (float): The value added to all heightmap cells.
1684
        scale (float): The noise value is scaled with this parameter.
1685
    """
1686
    noise = noise.noise_c if noise is not None else ffi.NULL
1687
    lib.TCOD_heightmap_add_fbm(_heightmap_cdata(hm), noise,
1688
                               mulx, muly, addx, addy, octaves, delta, scale)
1689
1690
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...
1691
                        scale):
1692
    """Multiply the heighmap values with FBM noise.
1693
1694
    Args:
1695
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1696
        noise (Noise): A Noise instance.
1697
        mulx (float): Scaling of each x coordinate.
1698
        muly (float): Scaling of each y coordinate.
1699
        addx (float): Translation of each x coordinate.
1700
        addy (float): Translation of each y coordinate.
1701
        octaves (float): Number of octaves in the FBM sum.
1702
        delta (float): The value added to all heightmap cells.
1703
        scale (float): The noise value is scaled with this parameter.
1704
    """
1705
    noise = noise.noise_c if noise is not None else ffi.NULL
1706
    lib.TCOD_heightmap_scale_fbm(_heightmap_cdata(hm), noise,
1707
                                 mulx, muly, addx, addy, octaves, delta, scale)
1708
1709
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...
1710
                         endDepth):
1711
    """Carve a path along a cubic Bezier curve.
1712
1713
    Both radius and depth can vary linearly along the path.
1714
1715
    Args:
1716
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1717
        px (Sequence[int]): The 4 `x` coordinates of the Bezier curve.
1718
        py (Sequence[int]): The 4 `y` coordinates of the Bezier curve.
1719
        startRadius (float): The starting radius size.
1720
        startDepth (float): The starting depth.
1721
        endRadius (float): The ending radius size.
1722
        endDepth (float): The ending depth.
1723
    """
1724
    lib.TCOD_heightmap_dig_bezier(_heightmap_cdata(hm), px, py, startRadius,
1725
                                   startDepth, endRadius,
1726
                                   endDepth)
1727
1728
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...
1729
    """Return the value at ``x``, ``y`` in a heightmap.
1730
1731
    Args:
1732
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1733
        x (int): The x position to pick.
1734
        y (int): The y position to pick.
1735
1736
    Returns:
1737
        float: The value at ``x``, ``y``.
1738
1739
    .. deprecated:: 2.0
1740
        Do ``value = hm[y, x]`` instead.
1741
    """
1742
    # explicit type conversion to pass test, (test should have been better.)
1743
    return float(hm[y, x])
1744
1745
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...
1746
    """Return the interpolated height at non integer coordinates.
1747
1748
    Args:
1749
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1750
        x (float): A floating point x coordinate.
1751
        y (float): A floating point y coordinate.
1752
1753
    Returns:
1754
        float: The value at ``x``, ``y``.
1755
    """
1756
    return lib.TCOD_heightmap_get_interpolated_value(_heightmap_cdata(hm),
1757
                                                     x, y)
1758
1759
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...
1760
    """Return the slope between 0 and (pi / 2) at given coordinates.
1761
1762
    Args:
1763
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1764
        x (int): The x coordinate.
1765
        y (int): The y coordinate.
1766
1767
    Returns:
1768
        float: The steepness at ``x``, ``y``.  From 0 to (pi / 2)
1769
    """
1770
    return lib.TCOD_heightmap_get_slope(_heightmap_cdata(hm), x, y)
1771
1772
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...
1773
    """Return the map normal at given coordinates.
1774
1775
    Args:
1776
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1777
        x (float): The x coordinate.
1778
        y (float): The y coordinate.
1779
        waterLevel (float): The heightmap is considered flat below this value.
1780
1781
    Returns:
1782
        Tuple[float, float, float]: An (x, y, z) vector normal.
1783
    """
1784
    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...
1785
    lib.TCOD_heightmap_get_normal(_heightmap_cdata(hm), x, y, cn, waterLevel)
1786
    return tuple(cn)
1787
1788
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...
1789
    """Return the number of map cells which value is between ``mi`` and ``ma``.
1790
1791
    Args:
1792
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1793
        mi (float): The lower bound.
1794
        ma (float): The upper bound.
1795
1796
    Returns:
1797
        int: The count of values which fall between ``mi`` and ``ma``.
1798
    """
1799
    return lib.TCOD_heightmap_count_cells(_heightmap_cdata(hm), mi, ma)
1800
1801
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...
1802
    """Returns True if the map edges are below ``waterlevel``, otherwise False.
1803
1804
    Args:
1805
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1806
        waterLevel (float): The water level to use.
1807
1808
    Returns:
1809
        bool: True if the map edges are below ``waterlevel``, otherwise False.
1810
    """
1811
    return lib.TCOD_heightmap_has_land_on_border(_heightmap_cdata(hm),
1812
                                                 waterlevel)
1813
1814
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...
1815
    """Return the min and max values of this heightmap.
1816
1817
    Args:
1818
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1819
1820
    Returns:
1821
        Tuple[float, float]: The (min, max) values.
1822
1823
    .. deprecated:: 2.0
1824
        Do ``hm.min()`` or ``hm.max()`` instead.
1825
    """
1826
    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...
1827
    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...
1828
    lib.TCOD_heightmap_get_minmax(_heightmap_cdata(hm), mi, ma)
1829
    return mi[0], ma[0]
1830
1831
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...
1832
    """Does nothing.
1833
1834
    .. deprecated:: 2.0
1835
        libtcod-cffi deletes heightmaps automatically.
1836
    """
1837
    pass
1838
1839
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...
1840
    return tcod.image.Image(width, height)
1841
1842
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...
1843
    image.clear(col)
1844
1845
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...
1846
    image.invert()
1847
1848
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...
1849
    image.hflip()
1850
1851
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...
1852
    image.rotate90(num)
1853
1854
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...
1855
    image.vflip()
1856
1857
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...
1858
    image.scale(neww, newh)
1859
1860
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...
1861
    image.set_key_color(col)
1862
1863
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...
1864
    image.get_alpha(x, y)
1865
1866
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...
1867
    lib.TCOD_image_is_pixel_transparent(image.image_c, x, y)
1868
1869
def image_load(filename):
1870
    """Load an image file into an Image instance and return it.
1871
1872
    Args:
1873
        filename (AnyStr): Path to a .bmp or .png image file.
1874
    """
1875
    return tcod.image.Image._from_cdata(
1876
        ffi.gc(lib.TCOD_image_load(_bytes(filename)),
1877
               lib.TCOD_image_delete)
1878
        )
1879
1880
def image_from_console(console):
1881
    """Return an Image with a Consoles pixel data.
1882
1883
    This effectively takes a screen-shot of the Console.
1884
1885
    Args:
1886
        console (Console): Any Console instance.
1887
    """
1888
    return tcod.image.Image._from_cdata(
1889
        ffi.gc(
1890
            lib.TCOD_image_from_console(
1891
                console.console_c if console else ffi.NULL
1892
                ),
1893
            lib.TCOD_image_delete,
1894
            )
1895
        )
1896
1897
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...
1898
    image.refresh_console(console)
1899
1900
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...
1901
    return image.width, image.height
1902
1903
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...
1904
    return image.get_pixel(x, y)
1905
1906
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...
1907
    return image.get_mipmap_pixel(x0, y0, x1, y1)
1908
1909
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...
1910
    image.put_pixel(x, y, col)
1911
1912
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...
1913
    image.blit(console, x, y, bkgnd_flag, scalex, scaley, angle)
1914
1915
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...
1916
    image.blit_rect(console, x, y, w, h, bkgnd_flag)
1917
1918
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...
1919
    image.blit_2x(console, dx, dy, sx, sy, w, h)
1920
1921
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...
1922
    image.save_as(filename)
1923
1924
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...
1925
    pass
1926
1927
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...
1928
    """Initilize a line whose points will be returned by `line_step`.
1929
1930
    This function does not return anything on its own.
1931
1932
    Does not include the origin point.
1933
1934
    Args:
1935
        xo (int): X starting point.
1936
        yo (int): Y starting point.
1937
        xd (int): X destination point.
1938
        yd (int): Y destination point.
1939
1940
    .. deprecated:: 2.0
1941
       Use `line_iter` instead.
1942
    """
1943
    lib.TCOD_line_init(xo, yo, xd, yd)
1944
1945
def line_step():
1946
    """After calling line_init returns (x, y) points of the line.
1947
1948
    Once all points are exhausted this function will return (None, None)
1949
1950
    Returns:
1951
        Union[Tuple[int, int], Tuple[None, None]]:
1952
            The next (x, y) point of the line setup by line_init,
1953
            or (None, None) if there are no more points.
1954
1955
    .. deprecated:: 2.0
1956
       Use `line_iter` instead.
1957
    """
1958
    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...
1959
    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...
1960
    ret = lib.TCOD_line_step(x, y)
1961
    if not ret:
1962
        return x[0], y[0]
1963
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1964
1965
_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...
1966
1967
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...
1968
    """ Iterate over a line using a callback function.
1969
1970
    Your callback function will take x and y parameters and return True to
1971
    continue iteration or False to stop iteration and return.
1972
1973
    This function includes both the start and end points.
1974
1975
    Args:
1976
        xo (int): X starting point.
1977
        yo (int): Y starting point.
1978
        xd (int): X destination point.
1979
        yd (int): Y destination point.
1980
        py_callback (Callable[[int, int], bool]):
1981
            A callback which takes x and y parameters and returns bool.
1982
1983
    Returns:
1984
        bool: False if the callback cancels the line interation by
1985
              returning False or None, otherwise True.
1986
1987
    .. deprecated:: 2.0
1988
       Use `line_iter` instead.
1989
    """
1990
    with _PropagateException() as propagate:
1991
        with _line_listener_lock:
1992
            @ffi.def_extern(onerror=propagate)
1993
            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...
1994
                return py_callback(x, y)
1995
            return bool(lib.TCOD_line(xo, yo, xd, yd,
1996
                                       lib._pycall_line_listener))
1997
1998
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...
1999
    """ returns an iterator
2000
2001
    This iterator does not include the origin point.
2002
2003
    Args:
2004
        xo (int): X starting point.
2005
        yo (int): Y starting point.
2006
        xd (int): X destination point.
2007
        yd (int): Y destination point.
2008
2009
    Returns:
2010
        Iterator[Tuple[int,int]]: An iterator of (x,y) points.
2011
    """
2012
    data = ffi.new('TCOD_bresenham_data_t *')
2013
    lib.TCOD_line_init_mt(xo, yo, xd, yd, data)
2014
    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...
2015
    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...
2016
    yield xo, yo
2017
    while not lib.TCOD_line_step_mt(x, y, data):
2018
        yield (x[0], y[0])
2019
2020
FOV_BASIC = 0
2021
FOV_DIAMOND = 1
2022
FOV_SHADOW = 2
2023
FOV_PERMISSIVE_0 = 3
2024
FOV_PERMISSIVE_1 = 4
2025
FOV_PERMISSIVE_2 = 5
2026
FOV_PERMISSIVE_3 = 6
2027
FOV_PERMISSIVE_4 = 7
2028
FOV_PERMISSIVE_5 = 8
2029
FOV_PERMISSIVE_6 = 9
2030
FOV_PERMISSIVE_7 = 10
2031
FOV_PERMISSIVE_8 = 11
2032
FOV_RESTRICTIVE = 12
2033
NB_FOV_ALGORITHMS = 13
2034
2035
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...
2036
    return tcod.map.Map(w, h)
2037
2038
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...
2039
    return lib.TCOD_map_copy(source.map_c, dest.map_c)
2040
2041
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...
2042
    lib.TCOD_map_set_properties(m.map_c, x, y, isTrans, isWalk)
2043
2044
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...
2045
    # walkable/transparent looks incorrectly ordered here.
2046
    # TODO: needs test.
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
2047
    lib.TCOD_map_clear(m.map_c, walkable, transparent)
2048
2049
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...
2050
    lib.TCOD_map_compute_fov(m.map_c, x, y, radius, light_walls, algo)
2051
2052
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...
2053
    return lib.TCOD_map_is_in_fov(m.map_c, x, y)
2054
2055
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...
2056
    return lib.TCOD_map_is_transparent(m.map_c, x, y)
2057
2058
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...
2059
    return lib.TCOD_map_is_walkable(m.map_c, x, y)
2060
2061
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...
2062
    pass
2063
2064
def map_get_width(map):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in map.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

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

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

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

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

Loading history...
2065
    return map.width
2066
2067
def map_get_height(map):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in map.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

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

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

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

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

Loading history...
2068
    return map.height
2069
2070
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...
2071
    lib.TCOD_mouse_show_cursor(visible)
2072
2073
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...
2074
    return lib.TCOD_mouse_is_cursor_visible()
2075
2076
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...
2077
    lib.TCOD_mouse_move(x, y)
2078
2079
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...
2080
    return Mouse(lib.TCOD_mouse_get_status())
2081
2082
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...
2083
    lib.TCOD_namegen_parse(_bytes(filename), random or ffi.NULL)
2084
2085
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...
2086
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name), False))
2087
2088
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...
2089
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name),
2090
                                                     _bytes(rule), False))
2091
2092
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...
2093
    sets = lib.TCOD_namegen_get_sets()
2094
    try:
2095
        lst = []
2096
        while not lib.TCOD_list_is_empty(sets):
2097
            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...
2098
    finally:
2099
        lib.TCOD_list_delete(sets)
2100
    return lst
2101
2102
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...
2103
    lib.TCOD_namegen_destroy()
2104
2105
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...
2106
        random=None):
2107
    """Return a new Noise instance.
2108
2109
    Args:
2110
        dim (int): Number of dimensions.  From 1 to 4.
2111
        h (float): The hurst exponent.  Should be in the 0.0-1.0 range.
2112
        l (float): The noise lacunarity.
2113
        random (Optional[Random]): A Random instance, or None.
2114
2115
    Returns:
2116
        Noise: The new Noise instance.
2117
    """
2118
    return tcod.noise.Noise(dim, hurst=h, lacunarity=l, seed=random)
2119
2120
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...
2121
    """Set a Noise objects default noise algorithm.
2122
2123
    Args:
2124
        typ (int): Any NOISE_* constant.
2125
    """
2126
    n.algorithm = typ
2127
2128
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...
2129
    """Return the noise value sampled from the ``f`` coordinate.
2130
2131
    ``f`` should be a tuple or list with a length matching
2132
    :any:`Noise.dimensions`.
2133
    If ``f`` is shoerter than :any:`Noise.dimensions` the missing coordinates
2134
    will be filled with zeros.
2135
2136
    Args:
2137
        n (Noise): A Noise instance.
2138
        f (Sequence[float]): The point to sample the noise from.
2139
        typ (int): The noise algorithm to use.
2140
2141
    Returns:
2142
        float: The sampled noise value.
2143
    """
2144
    return lib.TCOD_noise_get_ex(n.noise_c, ffi.new('float[4]', f), typ)
2145
2146
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...
2147
    """Return the fractal Brownian motion sampled from the ``f`` coordinate.
2148
2149
    Args:
2150
        n (Noise): A Noise instance.
2151
        f (Sequence[float]): The point to sample the noise from.
2152
        typ (int): The noise algorithm to use.
2153
        octaves (float): The level of level.  Should be more than 1.
2154
2155
    Returns:
2156
        float: The sampled noise value.
2157
    """
2158
    return lib.TCOD_noise_get_fbm_ex(n.noise_c, ffi.new('float[4]', f),
2159
                                     oc, typ)
2160
2161
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...
2162
    """Return the turbulence noise sampled from the ``f`` coordinate.
2163
2164
    Args:
2165
        n (Noise): A Noise instance.
2166
        f (Sequence[float]): The point to sample the noise from.
2167
        typ (int): The noise algorithm to use.
2168
        octaves (float): The level of level.  Should be more than 1.
2169
2170
    Returns:
2171
        float: The sampled noise value.
2172
    """
2173
    return lib.TCOD_noise_get_turbulence_ex(n.noise_c, ffi.new('float[4]', f),
2174
                                            oc, typ)
2175
2176
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...
2177
    """Does nothing."""
2178
    pass
2179
2180
_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...
2181
try:
2182
    _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...
2183
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...
2184
    pass
2185
2186
def _unpack_union(type_, union):
2187
    '''
2188
        unpack items from parser new_property (value_converter)
2189
    '''
2190
    if type_ == lib.TCOD_TYPE_BOOL:
2191
        return bool(union.b)
2192
    elif type_ == lib.TCOD_TYPE_CHAR:
2193
        return _unicode(union.c)
2194
    elif type_ == lib.TCOD_TYPE_INT:
2195
        return union.i
2196
    elif type_ == lib.TCOD_TYPE_FLOAT:
2197
        return union.f
2198
    elif (type_ == lib.TCOD_TYPE_STRING or
2199
         lib.TCOD_TYPE_VALUELIST15 >= type_ >= lib.TCOD_TYPE_VALUELIST00):
2200
         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...
2201
    elif type_ == lib.TCOD_TYPE_COLOR:
2202
        return Color._new_from_cdata(union.col)
2203
    elif type_ == lib.TCOD_TYPE_DICE:
2204
        return Dice(union.dice)
2205
    elif type_ & lib.TCOD_TYPE_LIST:
2206
        return _convert_TCODList(union.list, type_ & 0xFF)
2207
    else:
2208
        raise RuntimeError('Unknown libtcod type: %i' % type_)
2209
2210
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...
2211
    return [_unpack_union(type_, lib.TDL_list_get_union(clist, i))
2212
            for i in range(lib.TCOD_list_size(clist))]
2213
2214
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...
2215
    return ffi.gc(lib.TCOD_parser_new(), lib.TCOD_parser_delete)
2216
2217
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...
2218
    return lib.TCOD_parser_new_struct(parser, name)
2219
2220
# prevent multiple threads from messing with def_extern callbacks
2221
_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...
2222
_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...
2223
2224
@ffi.def_extern()
2225
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...
2226
    return _parser_listener.end_struct(struct, _unpack_char_p(name))
2227
2228
@ffi.def_extern()
2229
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...
2230
    return _parser_listener.new_flag(_unpack_char_p(name))
2231
2232
@ffi.def_extern()
2233
def _pycall_parser_new_property(propname, type, value):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in type.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

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

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

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

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

Loading history...
2234
    return _parser_listener.new_property(_unpack_char_p(propname), type,
2235
                                 _unpack_union(type, value))
2236
2237
@ffi.def_extern()
2238
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...
2239
    return _parser_listener.end_struct(struct, _unpack_char_p(name))
2240
2241
@ffi.def_extern()
2242
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...
2243
    _parser_listener.error(_unpack_char_p(msg))
2244
2245
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...
2246
    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...
2247
    if not listener:
2248
        lib.TCOD_parser_run(parser, _bytes(filename), ffi.NULL)
2249
        return
2250
2251
    propagate_manager = _PropagateException()
2252
    propagate = propagate_manager.propagate
2253
2254
    clistener = ffi.new(
2255
        'TCOD_parser_listener_t *',
2256
        {
2257
            'new_struct': lib._pycall_parser_new_struct,
2258
            'new_flag': lib._pycall_parser_new_flag,
2259
            'new_property': lib._pycall_parser_new_property,
2260
            'end_struct': lib._pycall_parser_end_struct,
2261
            'error': lib._pycall_parser_error,
2262
        },
2263
    )
2264
2265
    with _parser_callback_lock:
2266
        _parser_listener = listener
2267
        with propagate_manager:
2268
            lib.TCOD_parser_run(parser, _bytes(filename), clistener)
2269
2270
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...
2271
    pass
2272
2273
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...
2274
    return bool(lib.TCOD_parser_get_bool_property(parser, _bytes(name)))
2275
2276
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...
2277
    return lib.TCOD_parser_get_int_property(parser, _bytes(name))
2278
2279
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...
2280
    return _chr(lib.TCOD_parser_get_char_property(parser, _bytes(name)))
2281
2282
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...
2283
    return lib.TCOD_parser_get_float_property(parser, _bytes(name))
2284
2285
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...
2286
    return _unpack_char_p(
2287
        lib.TCOD_parser_get_string_property(parser, _bytes(name)))
2288
2289
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...
2290
    return Color._new_from_cdata(
2291
        lib.TCOD_parser_get_color_property(parser, _bytes(name)))
2292
2293
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...
2294
    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...
2295
    lib.TCOD_parser_get_dice_property_py(parser, _bytes(name), d)
2296
    return Dice(d)
2297
2298
def parser_get_list_property(parser, name, type):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in type.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

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

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

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

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

Loading history...
2299
    clist = lib.TCOD_parser_get_list_property(parser, _bytes(name), type)
2300
    return _convert_TCODList(clist, type)
2301
2302
RNG_MT = 0
2303
RNG_CMWC = 1
2304
2305
DISTRIBUTION_LINEAR = 0
2306
DISTRIBUTION_GAUSSIAN = 1
2307
DISTRIBUTION_GAUSSIAN_RANGE = 2
2308
DISTRIBUTION_GAUSSIAN_INVERSE = 3
2309
DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = 4
2310
2311
def random_get_instance():
2312
    """Return the default Random instance.
2313
2314
    Returns:
2315
        Random: A Random instance using the default random number generator.
2316
    """
2317
    return tcod.random.Random._new_from_cdata(
2318
        ffi.cast('mersenne_data_t*', lib.TCOD_random_get_instance()))
2319
2320
def random_new(algo=RNG_CMWC):
2321
    """Return a new Random instance.  Using ``algo``.
2322
2323
    Args:
2324
        algo (int): The random number algorithm to use.
2325
2326
    Returns:
2327
        Random: A new Random instance using the given algorithm.
2328
    """
2329
    return tcod.random.Random(algo)
2330
2331
def random_new_from_seed(seed, algo=RNG_CMWC):
2332
    """Return a new Random instance.  Using the given ``seed`` and ``algo``.
2333
2334
    Args:
2335
        seed (Hashable): The RNG seed.  Should be a 32-bit integer, but any
2336
                         hashable object is accepted.
2337
        algo (int): The random number algorithm to use.
2338
2339
    Returns:
2340
        Random: A new Random instance using the given algorithm.
2341
    """
2342
    return tcod.random.Random(algo, seed)
2343
2344
def random_set_distribution(rnd, dist):
2345
    """Change the distribution mode of a random number generator.
2346
2347
    Args:
2348
        rnd (Optional[Random]): A Random instance, or None to use the default.
2349
        dist (int): The distribution mode to use.  Should be DISTRIBUTION_*.
2350
    """
2351
    lib.TCOD_random_set_distribution(rnd.random_c if rnd else ffi.NULL, dist)
2352
2353
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...
2354
    """Return a random integer in the range: ``mi`` <= n <= ``ma``.
2355
2356
    The result is affacted by calls to :any:`random_set_distribution`.
2357
2358
    Args:
2359
        rnd (Optional[Random]): A Random instance, or None to use the default.
2360
        low (int): The lower bound of the random range, inclusive.
2361
        high (int): The upper bound of the random range, inclusive.
2362
2363
    Returns:
2364
        int: A random integer in the range ``mi`` <= n <= ``ma``.
2365
    """
2366
    return lib.TCOD_random_get_int(rnd.random_c if rnd else ffi.NULL, mi, ma)
2367
2368
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...
2369
    """Return a random float in the range: ``mi`` <= n <= ``ma``.
2370
2371
    The result is affacted by calls to :any:`random_set_distribution`.
2372
2373
    Args:
2374
        rnd (Optional[Random]): A Random instance, or None to use the default.
2375
        low (float): The lower bound of the random range, inclusive.
2376
        high (float): The upper bound of the random range, inclusive.
2377
2378
    Returns:
2379
        float: A random double precision float
2380
               in the range ``mi`` <= n <= ``ma``.
2381
    """
2382
    return lib.TCOD_random_get_double(
2383
        rnd.random_c if rnd else ffi.NULL, mi, ma)
2384
2385
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...
2386
    """Return a random float in the range: ``mi`` <= n <= ``ma``.
2387
2388
    .. deprecated:: 2.0
2389
        Use :any:`random_get_float` instead.
2390
        Both funtions return a double precision float.
2391
    """
2392
    return lib.TCOD_random_get_double(
2393
        rnd.random_c if rnd else ffi.NULL, mi, ma)
2394
2395
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...
2396
    """Return a random weighted integer in the range: ``mi`` <= n <= ``ma``.
2397
2398
    The result is affacted by calls to :any:`random_set_distribution`.
2399
2400
    Args:
2401
        rnd (Optional[Random]): A Random instance, or None to use the default.
2402
        low (int): The lower bound of the random range, inclusive.
2403
        high (int): The upper bound of the random range, inclusive.
2404
        mean (int): The mean return value.
2405
2406
    Returns:
2407
        int: A random weighted integer in the range ``mi`` <= n <= ``ma``.
2408
    """
2409
    return lib.TCOD_random_get_int_mean(
2410
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2411
2412
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...
2413
    """Return a random weighted float in the range: ``mi`` <= n <= ``ma``.
2414
2415
    The result is affacted by calls to :any:`random_set_distribution`.
2416
2417
    Args:
2418
        rnd (Optional[Random]): A Random instance, or None to use the default.
2419
        low (float): The lower bound of the random range, inclusive.
2420
        high (float): The upper bound of the random range, inclusive.
2421
        mean (float): The mean return value.
2422
2423
    Returns:
2424
        float: A random weighted double precision float
2425
               in the range ``mi`` <= n <= ``ma``.
2426
    """
2427
    return lib.TCOD_random_get_double_mean(
2428
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2429
2430
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...
2431
    """Return a random weighted float in the range: ``mi`` <= n <= ``ma``.
2432
2433
    .. deprecated:: 2.0
2434
        Use :any:`random_get_float_mean` instead.
2435
        Both funtions return a double precision float.
2436
    """
2437
    return lib.TCOD_random_get_double_mean(
2438
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2439
2440
def random_save(rnd):
2441
    """Return a copy of a random number generator.
2442
2443
    Args:
2444
        rnd (Optional[Random]): A Random instance, or None to use the default.
2445
2446
    Returns:
2447
        Random: A Random instance with a copy of the random generator.
2448
    """
2449
    return tcod.random.Random._new_from_cdata(
2450
        ffi.gc(
2451
            ffi.cast('mersenne_data_t*',
2452
                     lib.TCOD_random_save(rnd.random_c if rnd else ffi.NULL)),
2453
            lib.TCOD_random_delete),
2454
        )
2455
2456
def random_restore(rnd, backup):
2457
    """Restore a random number generator from a backed up copy.
2458
2459
    Args:
2460
        rnd (Optional[Random]): A Random instance, or None to use the default.
2461
        backup (Random): The Random instance which was used as a backup.
2462
    """
2463
    lib.TCOD_random_restore(rnd.random_c if rnd else ffi.NULL,
2464
                            backup.random_c)
2465
2466
def random_delete(rnd):
0 ignored issues
show
Unused Code introduced by
The argument rnd seems to be unused.
Loading history...
2467
    """Does nothing."""
2468
    pass
2469
2470
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...
2471
    lib.TCOD_struct_add_flag(struct, name)
2472
2473
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...
2474
    lib.TCOD_struct_add_property(struct, name, typ, mandatory)
2475
2476
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...
2477
    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...
2478
    cvalue_list = CARRAY()
2479
    for i, value in enumerate(value_list):
2480
        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...
2481
    cvalue_list[len(value_list)] = 0
2482
    lib.TCOD_struct_add_value_list(struct, name, cvalue_list, mandatory)
2483
2484
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...
2485
    lib.TCOD_struct_add_list_property(struct, name, typ, mandatory)
2486
2487
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...
2488
    lib.TCOD_struct_add_structure(struct, sub_struct)
2489
2490
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...
2491
    return _unpack_char_p(lib.TCOD_struct_get_name(struct))
2492
2493
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...
2494
    return lib.TCOD_struct_is_mandatory(struct, name)
2495
2496
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...
2497
    return lib.TCOD_struct_get_type(struct, name)
2498
2499
# high precision time functions
2500
def sys_set_fps(fps):
2501
    """Set the maximum frame rate.
2502
2503
    You can disable the frame limit again by setting fps to 0.
2504
2505
    Args:
2506
        fps (int): A frame rate limit (i.e. 60)
2507
    """
2508
    lib.TCOD_sys_set_fps(fps)
2509
2510
def sys_get_fps():
2511
    """Return the current frames per second.
2512
2513
    This the actual frame rate, not the frame limit set by
2514
    :any:`tcod.sys_set_fps`.
2515
2516
    This number is updated every second.
2517
2518
    Returns:
2519
        int: The currently measured frame rate.
2520
    """
2521
    return lib.TCOD_sys_get_fps()
2522
2523
def sys_get_last_frame_length():
2524
    """Return the delta time of the last rendered frame in seconds.
2525
2526
    Returns:
2527
        float: The delta time of the last rendered frame.
2528
    """
2529
    return lib.TCOD_sys_get_last_frame_length()
2530
2531
def sys_sleep_milli(val):
2532
    """Sleep for 'val' milliseconds.
2533
2534
    Args:
2535
        val (int): Time to sleep for in milliseconds.
2536
2537
    .. deprecated:: 2.0
2538
       Use :any:`time.sleep` instead.
2539
    """
2540
    lib.TCOD_sys_sleep_milli(val)
2541
2542
def sys_elapsed_milli():
2543
    """Get number of milliseconds since the start of the program.
2544
2545
    Returns:
2546
        int: Time since the progeam has started in milliseconds.
2547
2548
    .. deprecated:: 2.0
2549
       Use :any:`time.clock` instead.
2550
    """
2551
    return lib.TCOD_sys_elapsed_milli()
2552
2553
def sys_elapsed_seconds():
2554
    """Get number of seconds since the start of the program.
2555
2556
    Returns:
2557
        float: Time since the progeam has started in seconds.
2558
2559
    .. deprecated:: 2.0
2560
       Use :any:`time.clock` instead.
2561
    """
2562
    return lib.TCOD_sys_elapsed_seconds()
2563
2564
def sys_set_renderer(renderer):
2565
    """Change the current rendering mode to renderer.
2566
2567
    .. deprecated:: 2.0
2568
       RENDERER_GLSL and RENDERER_OPENGL are not currently available.
2569
    """
2570
    lib.TCOD_sys_set_renderer(renderer)
2571
2572
def sys_get_renderer():
2573
    """Return the current rendering mode.
2574
2575
    """
2576
    return lib.TCOD_sys_get_renderer()
2577
2578
# easy screenshots
2579
def sys_save_screenshot(name=None):
2580
    """Save a screenshot to a file.
2581
2582
    By default this will automatically save screenshots in the working
2583
    directory.
2584
2585
    The automatic names are formatted as screenshotNNN.png.  For example:
2586
    screenshot000.png, screenshot001.png, etc.  Whichever is available first.
2587
2588
    Args:
2589
        file Optional[AnyStr]: File path to save screenshot.
2590
    """
2591
    if name is not None:
2592
        name = _bytes(name)
2593
    lib.TCOD_sys_save_screenshot(name or ffi.NULL)
2594
2595
# custom fullscreen resolution
2596
def sys_force_fullscreen_resolution(width, height):
2597
    """Force a specific resolution in fullscreen.
2598
2599
    Will use the smallest available resolution so that:
2600
2601
    * resolution width >= width and
2602
      resolution width >= root console width * font char width
2603
    * resolution height >= height and
2604
      resolution height >= root console height * font char height
2605
2606
    Args:
2607
        width (int): The desired resolution width.
2608
        height (int): The desired resolution height.
2609
    """
2610
    lib.TCOD_sys_force_fullscreen_resolution(width, height)
2611
2612
def sys_get_current_resolution():
2613
    """Return the current resolution as (width, height)
2614
2615
    Returns:
2616
        Tuple[int,int]: The current resolution.
2617
    """
2618
    w = ffi.new('int *')
0 ignored issues
show
Coding Style Naming introduced by
The name w does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

Loading history...
2620
    lib.TCOD_sys_get_current_resolution(w, h)
2621
    return w[0], h[0]
2622
2623
def sys_get_char_size():
2624
    """Return the current fonts character size as (width, height)
2625
2626
    Returns:
2627
        Tuple[int,int]: The current font glyph size in (width, height)
2628
    """
2629
    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...
2630
    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...
2631
    lib.TCOD_sys_get_char_size(w, h)
2632
    return w[0], h[0]
2633
2634
# update font bitmap
2635
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...
2636
    """Dynamically update the current frot with img.
2637
2638
    All cells using this asciiCode will be updated
2639
    at the next call to :any:`tcod.console_flush`.
2640
2641
    Args:
2642
        asciiCode (int): Ascii code corresponding to the character to update.
2643
        fontx (int): Left coordinate of the character
2644
                     in the bitmap font (in tiles)
2645
        fonty (int): Top coordinate of the character
2646
                     in the bitmap font (in tiles)
2647
        img (Image): An image containing the new character bitmap.
2648
        x (int): Left pixel of the character in the image.
2649
        y (int): Top pixel of the character in the image.
2650
    """
2651
    lib.TCOD_sys_update_char(_int(asciiCode), fontx, fonty, img, x, y)
2652
2653
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...
2654
    """Register a custom randering function with libtcod.
2655
2656
    Note:
2657
        This callback will only be called by the SDL renderer.
2658
2659
    The callack will receive a :any:`CData <ffi-cdata>` void* to an
2660
    SDL_Surface* struct.
2661
2662
    The callback is called on every call to :any:`tcod.console_flush`.
2663
2664
    Args:
2665
        callback Callable[[CData], None]:
2666
            A function which takes a single argument.
2667
    """
2668
    with _PropagateException() as propagate:
2669
        @ffi.def_extern(onerror=propagate)
2670
        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...
2671
            callback(sdl_surface)
2672
        lib.TCOD_sys_register_SDL_renderer(lib._pycall_sdl_hook)
2673
2674
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...
2675
    """Check for and return an event.
2676
2677
    Args:
2678
        mask (int): :any:`Event types` to wait for.
2679
        k (Optional[Key]): A tcod.Key instance which might be updated with
2680
                           an event.  Can be None.
2681
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
2682
                             with an event.  Can be None.
2683
    """
2684
    return lib.TCOD_sys_check_for_event(
2685
        mask, k.cdata if k else ffi.NULL, m.cdata if m else ffi.NULL)
2686
2687
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...
2688
    """Wait for an event then return.
2689
2690
    If flush is True then the buffer will be cleared before waiting. Otherwise
2691
    each available event will be returned in the order they're recieved.
2692
2693
    Args:
2694
        mask (int): :any:`Event types` to wait for.
2695
        k (Optional[Key]): A tcod.Key instance which might be updated with
2696
                           an event.  Can be None.
2697
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
2698
                             with an event.  Can be None.
2699
        flush (bool): Clear the event buffer before waiting.
2700
    """
2701
    return lib.TCOD_sys_wait_for_event(
2702
        mask, k.cdata if k else ffi.NULL, m.cdata if m else ffi.NULL, flush)
2703
2704
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...
2705
    return lib.TCOD_sys_clipboard_set(text.encode('utf-8'))
2706
2707
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...
2708
    return ffi.string(lib.TCOD_sys_clipboard_get()).decode('utf-8')
2709