Completed
Push — master ( 899a8d...978a6c )
by Kyle
48s
created

console_fill_foreground()   B

Complexity

Conditions 6

Size

Total Lines 27

Duplication

Lines 27
Ratio 100 %

Importance

Changes 0
Metric Value
cc 6
c 0
b 0
f 0
dl 27
loc 27
rs 7.5384
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
from tcod.tcod import _console
20
21
import tcod.bsp
22
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...
23
import tcod.console
24
import tcod.image
25
import tcod.map
26
import tcod.noise
27
import tcod.path
28
import tcod.random
29
30
Bsp = tcod.bsp.BSP
31
32
33
class ConsoleBuffer(object):
34
    """Simple console that allows direct (fast) access to cells. simplifies
35
    use of the "fill" functions.
36
37
    Args:
38
        width (int): Width of the new ConsoleBuffer.
39
        height (int): Height of the new ConsoleBuffer.
40
        back_r (int): Red background color, from 0 to 255.
41
        back_g (int): Green background color, from 0 to 255.
42
        back_b (int): Blue background color, from 0 to 255.
43
        fore_r (int): Red foreground color, from 0 to 255.
44
        fore_g (int): Green foreground color, from 0 to 255.
45
        fore_b (int): Blue foreground color, from 0 to 255.
46
        char (AnyStr): A single character str or bytes object.
47
    """
48
    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...
49
        """initialize with given width and height. values to fill the buffer
50
        are optional, defaults to black with no characters.
51
        """
52
        self.width = width
53
        self.height = height
54
        self.clear(back_r, back_g, back_b, fore_r, fore_g, fore_b, char)
55
56
    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...
57
        """Clears the console.  Values to fill it with are optional, defaults
58
        to black with no characters.
59
60
        Args:
61
            back_r (int): Red background color, from 0 to 255.
62
            back_g (int): Green background color, from 0 to 255.
63
            back_b (int): Blue background color, from 0 to 255.
64
            fore_r (int): Red foreground color, from 0 to 255.
65
            fore_g (int): Green foreground color, from 0 to 255.
66
            fore_b (int): Blue foreground color, from 0 to 255.
67
            char (AnyStr): A single character str or bytes object.
68
        """
69
        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...
70
        self.back_r = [back_r] * n
71
        self.back_g = [back_g] * n
72
        self.back_b = [back_b] * n
73
        self.fore_r = [fore_r] * n
74
        self.fore_g = [fore_g] * n
75
        self.fore_b = [fore_b] * n
76
        self.char = [ord(char)] * n
77
78
    def copy(self):
79
        """Returns a copy of this ConsoleBuffer.
80
81
        Returns:
82
            ConsoleBuffer: A new ConsoleBuffer copy.
83
        """
84
        other = ConsoleBuffer(0, 0)
85
        other.width = self.width
86
        other.height = self.height
87
        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...
88
        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...
89
        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...
90
        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...
91
        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...
92
        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...
93
        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...
94
        return other
95
96
    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...
97
        """Set the character and foreground color of one cell.
98
99
        Args:
100
            x (int): X position to change.
101
            y (int): Y position to change.
102
            r (int): Red foreground color, from 0 to 255.
103
            g (int): Green foreground color, from 0 to 255.
104
            b (int): Blue foreground color, from 0 to 255.
105
            char (AnyStr): A single character str or bytes object.
106
        """
107
        i = self.width * y + x
108
        self.fore_r[i] = r
109
        self.fore_g[i] = g
110
        self.fore_b[i] = b
111
        self.char[i] = ord(char)
112
113
    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...
114
        """Set the background color of one cell.
115
116
        Args:
117
            x (int): X position to change.
118
            y (int): Y position to change.
119
            r (int): Red background color, from 0 to 255.
120
            g (int): Green background color, from 0 to 255.
121
            b (int): Blue background color, from 0 to 255.
122
            char (AnyStr): A single character str or bytes object.
123
        """
124
        i = self.width * y + x
125
        self.back_r[i] = r
126
        self.back_g[i] = g
127
        self.back_b[i] = b
128
129
    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...
130
        """Set the background color, foreground color and character of one cell.
131
132
        Args:
133
            x (int): X position to change.
134
            y (int): Y position to change.
135
            back_r (int): Red background color, from 0 to 255.
136
            back_g (int): Green background color, from 0 to 255.
137
            back_b (int): Blue background color, from 0 to 255.
138
            fore_r (int): Red foreground color, from 0 to 255.
139
            fore_g (int): Green foreground color, from 0 to 255.
140
            fore_b (int): Blue foreground color, from 0 to 255.
141
            char (AnyStr): A single character str or bytes object.
142
        """
143
        i = self.width * y + x
144
        self.back_r[i] = back_r
145
        self.back_g[i] = back_g
146
        self.back_b[i] = back_b
147
        self.fore_r[i] = fore_r
148
        self.fore_g[i] = fore_g
149
        self.fore_b[i] = fore_b
150
        self.char[i] = ord(char)
151
152
    def blit(self, dest, fill_fore=True, fill_back=True):
153
        """Use libtcod's "fill" functions to write the buffer to a console.
154
155
        Args:
156
            dest (Console): Console object to modify.
157
            fill_fore (bool):
158
                If True, fill the foreground color and characters.
159
            fill_back (bool):
160
                If True, fill the background color.
161
        """
162
        if not dest:
163
            dest = tcod.console.Console._from_cdata(ffi.NULL)
164
        if (dest.width != self.width or
165
            dest.height != self.height):
166
            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...
167
168
        if fill_back:
169
            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...
170
            bg[0::3] = self.back_r
171
            bg[1::3] = self.back_g
172
            bg[2::3] = self.back_b
173
174
        if fill_fore:
175
            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...
176
            fg[0::3] = self.fore_r
177
            fg[1::3] = self.fore_g
178
            fg[2::3] = self.fore_b
179
            dest.ch.ravel()[:] = self.char
180
181
class Dice(_CDataWrapper):
182
    """
183
184
    Args:
185
        nb_dices (int): Number of dice.
186
        nb_faces (int): Number of sides on a die.
187
        multiplier (float): Multiplier.
188
        addsub (float): Addition.
189
190
    .. deprecated:: 2.0
191
        You should make your own dice functions instead of using this class
192
        which is tied to a CData object.
193
    """
194
195
    def __init__(self, *args, **kargs):
196
        super(Dice, self).__init__(*args, **kargs)
197
        if self.cdata == ffi.NULL:
198
            self._init(*args, **kargs)
199
200
    def _init(self, nb_dices=0, nb_faces=0, multiplier=0, addsub=0):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading history...
232
        lalt (bool): True when left alt is held.
233
        lctrl (bool): True when left control is held.
234
        lmeta (bool): True when left meta key is held.
235
        ralt (bool): True when right alt is held.
236
        rctrl (bool): True when right control is held.
237
        rmeta (bool): True when right meta key is held.
238
        shift (bool): True when any shift is held.
239
    """
240
241
    _BOOL_ATTRIBUTES = ('lalt', 'lctrl', 'lmeta',
242
                        'ralt', 'rctrl', 'rmeta', 'pressed', 'shift')
243
244
    def __init__(self, *args, **kargs):
245
        super(Key, self).__init__(*args, **kargs)
246
        if self.cdata == ffi.NULL:
247
            self.cdata = ffi.new('TCOD_key_t*')
248
249
    def __getattr__(self, attr):
250
        if attr in self._BOOL_ATTRIBUTES:
251
            return bool(getattr(self.cdata, attr))
252
        if attr == 'c':
253
            return ord(getattr(self.cdata, attr))
254
        if attr == 'text':
255
            return _unpack_char_p(getattr(self.cdata, attr))
256
        return super(Key, self).__getattr__(attr)
257
258
    def __repr__(self):
259
        """Return a representation of this Key object."""
260
        params = []
261
        params.append('vk=%r, c=%r, text=%r, pressed=%r' %
262
                      (self.vk, self.c, self.text, self.pressed))
263
        for attr in ['shift', 'lalt', 'lctrl', 'lmeta',
264
                     'ralt', 'rctrl', 'rmeta']:
265
            if getattr(self, attr):
266
                params.append('%s=%r' % (attr, getattr(self, attr)))
267
        return ('%s(%s)' % (self.__class__.__name__, ', '.join(params)))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after return.
Loading history...
268
269
270
class Mouse(_CDataWrapper):
271
    """Mouse event instance
272
273
    Attributes:
274
        x (int): Absolute mouse position at pixel x.
275
        y (int):
276
        dx (int): Movement since last update in pixels.
277
        dy (int):
278
        cx (int): Cell coordinates in the root console.
279
        cy (int):
280
        dcx (int): Movement since last update in console cells.
281
        dcy (int):
282
        lbutton (bool): Left button status.
283
        rbutton (bool): Right button status.
284
        mbutton (bool): Middle button status.
285
        lbutton_pressed (bool): Left button pressed event.
286
        rbutton_pressed (bool): Right button pressed event.
287
        mbutton_pressed (bool): Middle button pressed event.
288
        wheel_up (bool): Wheel up event.
289
        wheel_down (bool): Wheel down event.
290
    """
291
292
    def __init__(self, *args, **kargs):
293
        super(Mouse, self).__init__(*args, **kargs)
294
        if self.cdata == ffi.NULL:
295
            self.cdata = ffi.new('TCOD_mouse_t*')
296
297
    def __repr__(self):
298
        """Return a representation of this Mouse object."""
299
        params = []
300
        for attr in ['x', 'y', 'dx', 'dy', 'cx', 'cy', 'dcx', 'dcy']:
301
            if getattr(self, attr) == 0:
302
                continue
303
            params.append('%s=%r' % (attr, getattr(self, attr)))
304
        for attr in ['lbutton', 'rbutton', 'mbutton',
305
                     'lbutton_pressed', 'rbutton_pressed', 'mbutton_pressed',
306
                     'wheel_up', 'wheel_down']:
307
            if getattr(self, attr):
308
                params.append('%s=%r' % (attr, getattr(self, attr)))
309
        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...
310
311
312
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...
313
    """Create a new BSP instance with the given rectangle.
314
315
    Args:
316
        x (int): Rectangle left coordinate.
317
        y (int): Rectangle top coordinate.
318
        w (int): Rectangle width.
319
        h (int): Rectangle height.
320
321
    Returns:
322
        BSP: A new BSP instance.
323
324
    .. deprecated:: 2.0
325
       Call the :any:`BSP` class instead.
326
    """
327
    return Bsp(x, y, w, h)
328
329
def bsp_split_once(node, horizontal, position):
330
    """
331
    .. deprecated:: 2.0
332
       Use :any:`BSP.split_once` instead.
333
    """
334
    node.split_once(horizontal, position)
335
336
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...
337
                        maxVRatio):
338
    """
339
    .. deprecated:: 2.0
340
       Use :any:`BSP.split_recursive` instead.
341
    """
342
    node.split_recursive(nb, minHSize, minVSize,
343
                         maxHRatio, maxVRatio, randomizer)
344
345
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...
346
    """
347
    .. deprecated:: 2.0
348
        Assign directly to :any:`BSP` attributes instead.
349
    """
350
    node.x = x
351
    node.y = y
352
    node.width = w
353
    node.height = h
354
355
def bsp_left(node):
356
    """
357
    .. deprecated:: 2.0
358
       Use :any:`BSP.children` instead.
359
    """
360
    return None if not node.children else node.children[0]
361
362
def bsp_right(node):
363
    """
364
    .. deprecated:: 2.0
365
       Use :any:`BSP.children` instead.
366
    """
367
    return None if not node.children else node.children[1]
368
369
def bsp_father(node):
370
    """
371
    .. deprecated:: 2.0
372
       Use :any:`BSP.parent` instead.
373
    """
374
    return node.parent
375
376
def bsp_is_leaf(node):
377
    """
378
    .. deprecated:: 2.0
379
       Use :any:`BSP.children` instead.
380
    """
381
    return not node.children
382
383
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...
384
    """
385
    .. deprecated:: 2.0
386
       Use :any:`BSP.contains` instead.
387
    """
388
    return node.contains(cx, cy)
389
390
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...
391
    """
392
    .. deprecated:: 2.0
393
       Use :any:`BSP.find_node` instead.
394
    """
395
    return node.find_node(cx, cy)
396
397
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...
398
    """pack callback into a handle for use with the callback
399
    _pycall_bsp_callback
400
    """
401
    for node in node_iter:
402
        callback(node, userData)
403
404
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...
405
    """Traverse this nodes hierarchy with a callback.
406
407
    .. deprecated:: 2.0
408
       Use :any:`BSP.walk` instead.
409
    """
410
    _bsp_traverse(node._iter_pre_order(), callback, userData)
411
412
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...
413
    """Traverse this nodes hierarchy with a callback.
414
415
    .. deprecated:: 2.0
416
       Use :any:`BSP.walk` instead.
417
    """
418
    _bsp_traverse(node._iter_in_order(), callback, userData)
419
420
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...
421
    """Traverse this nodes hierarchy with a callback.
422
423
    .. deprecated:: 2.0
424
       Use :any:`BSP.walk` instead.
425
    """
426
    _bsp_traverse(node._iter_post_order(), callback, userData)
427
428
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...
429
    """Traverse this nodes hierarchy with a callback.
430
431
    .. deprecated:: 2.0
432
       Use :any:`BSP.walk` instead.
433
    """
434
    _bsp_traverse(node._iter_level_order(), callback, userData)
435
436
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...
437
    """Traverse this nodes hierarchy with a callback.
438
439
    .. deprecated:: 2.0
440
       Use :any:`BSP.walk` instead.
441
    """
442
    _bsp_traverse(node._iter_inverted_level_order(), callback, userData)
443
444
def bsp_remove_sons(node):
445
    """Delete all children of a given node.  Not recommended.
446
447
    .. note::
448
       This function will add unnecessary complexity to your code.
449
       Don't use it.
450
451
    .. deprecated:: 2.0
452
       BSP deletion is automatic.
453
    """
454
    node.children = ()
455
456
def bsp_delete(node):
0 ignored issues
show
Unused Code introduced by
The argument node seems to be unused.
Loading history...
457
    """Exists for backward compatibility.  Does nothing.
458
459
    BSP's created by this library are automatically garbage collected once
460
    there are no references to the tree.
461
    This function exists for backwards compatibility.
462
463
    .. deprecated:: 2.0
464
       BSP deletion is automatic.
465
    """
466
    pass
467
468
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...
469
    """Return the linear interpolation between two colors.
470
471
    ``a`` is the interpolation value, with 0 returing ``c1``,
472
    1 returning ``c2``, and 0.5 returing a color halfway between both.
473
474
    Args:
475
        c1 (Union[Tuple[int, int, int], Sequence[int]]):
476
            The first color.  At a=0.
477
        c2 (Union[Tuple[int, int, int], Sequence[int]]):
478
            The second color.  At a=1.
479
        a (float): The interpolation value,
480
481
    Returns:
482
        Color: The interpolated Color.
483
    """
484
    return Color._new_from_cdata(lib.TCOD_color_lerp(c1, c2, a))
485
486
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...
487
    """Set a color using: hue, saturation, and value parameters.
488
489
    Does not return a new Color.  ``c`` is modified inplace.
490
491
    Args:
492
        c (Union[Color, List[Any]]): A Color instance, or a list of any kind.
493
        h (float): Hue, from 0 to 360.
494
        s (float): Saturation, from 0 to 1.
495
        v (float): Value, from 0 to 1.
496
    """
497
    new_color = ffi.new('TCOD_color_t*')
498
    lib.TCOD_color_set_HSV(new_color, h, s, v)
499
    c[:] = new_color.r, new_color.g, new_color.b
500
501
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...
502
    """Return the (hue, saturation, value) of a color.
503
504
    Args:
505
        c (Union[Tuple[int, int, int], Sequence[int]]):
506
            An (r, g, b) sequence or Color instance.
507
508
    Returns:
509
        Tuple[float, float, float]:
510
            A tuple with (hue, saturation, value) values, from 0 to 1.
511
    """
512
    hsv = ffi.new('float [3]')
513
    lib.TCOD_color_get_HSV(c, hsv, hsv + 1, hsv + 2)
514
    return hsv[0], hsv[1], hsv[2]
515
516
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...
517
    """Scale a color's saturation and value.
518
519
    Does not return a new Color.  ``c`` is modified inplace.
520
521
    Args:
522
        c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list.
523
        scoef (float): Saturation multiplier, from 0 to 1.
524
                       Use 1 to keep current saturation.
525
        vcoef (float): Value multiplier, from 0 to 1.
526
                       Use 1 to keep current value.
527
    """
528
    color_p = ffi.new('TCOD_color_t*')
529
    color_p.r, color_p.g, color_p.b = c.r, c.g, c.b
530
    lib.TCOD_color_scale_HSV(color_p, scoef, vcoef)
531
    c[:] = color_p.r, color_p.g, color_p.b
532
533
def color_gen_map(colors, indexes):
534
    """Return a smoothly defined scale of colors.
535
536
    If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
537
    will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
538
    All in-betweens will be filled with a gradient.
539
540
    Args:
541
        colors (Iterable[Union[Tuple[int, int, int], Sequence[int]]]):
542
            Array of colors to be sampled.
543
        indexes (Iterable[int]): A list of indexes.
544
545
    Returns:
546
        List[Color]: A list of Color instances.
547
548
    Example:
549
        >>> tcod.color_gen_map([(0, 0, 0), (255, 128, 0)], [0, 5])
550
        [Color(0,0,0), Color(51,25,0), Color(102,51,0), Color(153,76,0), \
551
Color(204,102,0), Color(255,128,0)]
552
    """
553
    ccolors = ffi.new('TCOD_color_t[]', colors)
554
    cindexes = ffi.new('int[]', indexes)
555
    cres = ffi.new('TCOD_color_t[]', max(indexes) + 1)
556
    lib.TCOD_color_gen_map(cres, len(colors), ccolors, cindexes)
557
    return [Color._new_from_cdata(cdata) for cdata in cres]
558
559
560
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...
561
                      renderer=RENDERER_SDL, order='C'):
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'RENDERER_SDL'
Loading history...
562
    """Set up the primary display and return the root console.
563
564
    .. versionchanged:: 4.3
565
        Added `order` parameter.
566
        `title` parameter is now optional.
567
568
    Args:
569
        w (int): Width in character tiles for the root console.
570
        h (int): Height in character tiles for the root console.
571
        title (Optional[AnyStr]):
572
            This string will be displayed on the created windows title bar.
573
        renderer: Rendering mode for libtcod to use.
574
        order (str): Which numpy memory order to use.
575
576
    Returns:
577
        Console:
578
            Returns a special Console instance representing the root console.
579
    """
580
    if title is None:
581
        # Use the scripts filename as the title.
582
        title = os.path.basename(sys.argv[0])
583
    lib.TCOD_console_init_root(w, h, _bytes(title), fullscreen, renderer)
584
    return tcod.console.Console._from_cdata(ffi.NULL, order)
585
586
587
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...
588
                            nb_char_horiz=0, nb_char_vertic=0):
589
    """Load a custom font file.
590
591
    Call this before function before calling :any:`tcod.console_init_root`.
592
593
    Flags can be a mix of the following:
594
595
    * tcod.FONT_LAYOUT_ASCII_INCOL
596
    * tcod.FONT_LAYOUT_ASCII_INROW
597
    * tcod.FONT_TYPE_GREYSCALE
598
    * tcod.FONT_TYPE_GRAYSCALE
599
    * tcod.FONT_LAYOUT_TCOD
600
601
    Args:
602
        fontFile (AnyStr): Path to a font file.
603
        flags (int):
604
        nb_char_horiz (int):
605
        nb_char_vertic (int):
606
    """
607
    lib.TCOD_console_set_custom_font(_bytes(fontFile), flags,
608
                                     nb_char_horiz, nb_char_vertic)
609
610
611
def console_get_width(con):
612
    """Return the width of a console.
613
614
    Args:
615
        con (Console): Any Console instance.
616
617
    Returns:
618
        int: The width of a Console.
619
620
    .. deprecated:: 2.0
621
        Use `Console.get_width` instead.
622
    """
623
    return lib.TCOD_console_get_width(_console(con))
624
625
def console_get_height(con):
626
    """Return the height of a console.
627
628
    Args:
629
        con (Console): Any Console instance.
630
631
    Returns:
632
        int: The height of a Console.
633
634
    .. deprecated:: 2.0
635
        Use `Console.get_hright` instead.
636
    """
637
    return lib.TCOD_console_get_height(_console(con))
638
639
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...
640
    """Set a character code to new coordinates on the tile-set.
641
642
    `asciiCode` must be within the bounds created during the initialization of
643
    the loaded tile-set.  For example, you can't use 255 here unless you have a
644
    256 tile tile-set loaded.  This applies to all functions in this group.
645
646
    Args:
647
        asciiCode (int): The character code to change.
648
        fontCharX (int): The X tile coordinate on the loaded tileset.
649
                         0 is the leftmost tile.
650
        fontCharY (int): The Y tile coordinate on the loaded tileset.
651
                         0 is the topmost tile.
652
    """
653
    lib.TCOD_console_map_ascii_code_to_font(_int(asciiCode), fontCharX,
654
                                                              fontCharY)
655
656
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...
657
                                    fontCharY):
658
    """Remap a contiguous set of codes to a contiguous set of tiles.
659
660
    Both the tile-set and character codes must be contiguous to use this
661
    function.  If this is not the case you may want to use
662
    :any:`console_map_ascii_code_to_font`.
663
664
    Args:
665
        firstAsciiCode (int): The starting character code.
666
        nbCodes (int): The length of the contiguous set.
667
        fontCharX (int): The starting X tile coordinate on the loaded tileset.
668
                         0 is the leftmost tile.
669
        fontCharY (int): The starting Y tile coordinate on the loaded tileset.
670
                         0 is the topmost tile.
671
672
    """
673
    lib.TCOD_console_map_ascii_codes_to_font(_int(firstAsciiCode), nbCodes,
674
                                              fontCharX, fontCharY)
675
676
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...
677
    """Remap a string of codes to a contiguous set of tiles.
678
679
    Args:
680
        s (AnyStr): A string of character codes to map to new values.
681
                    The null character `'\x00'` will prematurely end this
682
                    function.
683
        fontCharX (int): The starting X tile coordinate on the loaded tileset.
684
                         0 is the leftmost tile.
685
        fontCharY (int): The starting Y tile coordinate on the loaded tileset.
686
                         0 is the topmost tile.
687
    """
688
    lib.TCOD_console_map_string_to_font_utf(_unicode(s), fontCharX, fontCharY)
689
690
def console_is_fullscreen():
691
    """Returns True if the display is fullscreen.
692
693
    Returns:
694
        bool: True if the display is fullscreen, otherwise False.
695
    """
696
    return bool(lib.TCOD_console_is_fullscreen())
697
698
def console_set_fullscreen(fullscreen):
699
    """Change the display to be fullscreen or windowed.
700
701
    Args:
702
        fullscreen (bool): Use True to change to fullscreen.
703
                           Use False to change to windowed.
704
    """
705
    lib.TCOD_console_set_fullscreen(fullscreen)
706
707
def console_is_window_closed():
708
    """Returns True if the window has received and exit event."""
709
    return lib.TCOD_console_is_window_closed()
710
711
def console_set_window_title(title):
712
    """Change the current title bar string.
713
714
    Args:
715
        title (AnyStr): A string to change the title bar to.
716
    """
717
    lib.TCOD_console_set_window_title(_bytes(title))
718
719
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...
720
    lib.TCOD_console_credits()
721
722
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...
723
    lib.TCOD_console_credits_reset()
724
725
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...
726
    return lib.TCOD_console_credits_render(x, y, alpha)
727
728
def console_flush():
729
    """Update the display to represent the root consoles current state."""
730
    lib.TCOD_console_flush()
731
732
# drawing on a console
733
def console_set_default_background(con, col):
734
    """Change the default background color for a console.
735
736
    Args:
737
        con (Console): Any Console instance.
738
        col (Union[Tuple[int, int, int], Sequence[int]]):
739
            An (r, g, b) sequence or Color instance.
740
    """
741
    lib.TCOD_console_set_default_background(_console(con), 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(_console(con), col)
752
753
def console_clear(con):
754
    """Reset a console to its default colors and the space character.
755
756
    Args:
757
        con (Console): Any Console instance.
758
759
    .. seealso::
760
       :any:`console_set_default_background`
761
       :any:`console_set_default_foreground`
762
    """
763
    return lib.TCOD_console_clear(_console(con))
764
765
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...
766
    """Draw the character c at x,y using the default colors and a blend mode.
767
768
    Args:
769
        con (Console): Any Console instance.
770
        x (int): Character x position from the left.
771
        y (int): Character y position from the top.
772
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
773
        flag (int): Blending mode to use, defaults to BKGND_DEFAULT.
774
    """
775
    lib.TCOD_console_put_char(_console(con), x, y, _int(c), flag)
776
777
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...
778
    """Draw the character c at x,y using the colors fore and back.
779
780
    Args:
781
        con (Console): Any Console instance.
782
        x (int): Character x position from the left.
783
        y (int): Character y position from the top.
784
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
785
        fore (Union[Tuple[int, int, int], Sequence[int]]):
786
            An (r, g, b) sequence or Color instance.
787
        back (Union[Tuple[int, int, int], Sequence[int]]):
788
            An (r, g, b) sequence or Color instance.
789
    """
790
    lib.TCOD_console_put_char_ex(_console(con), x, y, _int(c), fore, back)
791
792
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...
793
    """Change the background color of x,y to col using a blend mode.
794
795
    Args:
796
        con (Console): Any Console instance.
797
        x (int): Character x position from the left.
798
        y (int): Character y position from the top.
799
        col (Union[Tuple[int, int, int], Sequence[int]]):
800
            An (r, g, b) sequence or Color instance.
801
        flag (int): Blending mode to use, defaults to BKGND_SET.
802
    """
803
    lib.TCOD_console_set_char_background(_console(con), x, y, col, flag)
804
805
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...
806
    """Change the foreground color of x,y to col.
807
808
    Args:
809
        con (Console): Any Console instance.
810
        x (int): Character x position from the left.
811
        y (int): Character y position from the top.
812
        col (Union[Tuple[int, int, int], Sequence[int]]):
813
            An (r, g, b) sequence or Color instance.
814
    """
815
    lib.TCOD_console_set_char_foreground(_console(con), x, y, col)
816
817
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...
818
    """Change the character at x,y to c, keeping the current colors.
819
820
    Args:
821
        con (Console): Any Console instance.
822
        x (int): Character x position from the left.
823
        y (int): Character y position from the top.
824
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
825
    """
826
    lib.TCOD_console_set_char(_console(con), x, y, _int(c))
827
828
def console_set_background_flag(con, flag):
829
    """Change the default blend mode for this console.
830
831
    Args:
832
        con (Console): Any Console instance.
833
        flag (int): Blend mode to use by default.
834
    """
835
    lib.TCOD_console_set_background_flag(_console(con), flag)
836
837
def console_get_background_flag(con):
838
    """Return this consoles current blend mode.
839
840
    Args:
841
        con (Console): Any Console instance.
842
    """
843
    return lib.TCOD_console_get_background_flag(_console(con))
844
845
def console_set_alignment(con, alignment):
846
    """Change this consoles current alignment mode.
847
848
    * tcod.LEFT
849
    * tcod.CENTER
850
    * tcod.RIGHT
851
852
    Args:
853
        con (Console): Any Console instance.
854
        alignment (int):
855
    """
856
    lib.TCOD_console_set_alignment(_console(con), alignment)
857
858
def console_get_alignment(con):
859
    """Return this consoles current alignment mode.
860
861
    Args:
862
        con (Console): Any Console instance.
863
    """
864
    return lib.TCOD_console_get_alignment(_console(con))
865
866
def console_print(con, x, y, fmt):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

Loading history...
867
    """Print a color formatted string on a console.
868
869
    Args:
870
        con (Console): Any Console instance.
871
        x (int): Character x position from the left.
872
        y (int): Character y position from the top.
873
        fmt (AnyStr): A unicode or bytes string optionaly using color codes.
874
    """
875
    lib.TCOD_console_print_utf(_console(con), x, y, _fmt_unicode(fmt))
876
877
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...
878
    """Print a string on a console using a blend mode and alignment mode.
879
880
    Args:
881
        con (Console): Any Console instance.
882
        x (int): Character x position from the left.
883
        y (int): Character y position from the top.
884
    """
885
    lib.TCOD_console_print_ex_utf(_console(con),
886
                                  x, y, flag, alignment, _fmt_unicode(fmt))
887
888
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...
889
    """Print a string constrained to a rectangle.
890
891
    If h > 0 and the bottom of the rectangle is reached,
892
    the string is truncated. If h = 0,
893
    the string is only truncated if it reaches the bottom of the console.
894
895
896
897
    Returns:
898
        int: The number of lines of text once word-wrapped.
899
    """
900
    return lib.TCOD_console_print_rect_utf(
901
        _console(con), x, y, w, h, _fmt_unicode(fmt))
902
903
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...
904
    """Print a string constrained to a rectangle with blend and alignment.
905
906
    Returns:
907
        int: The number of lines of text once word-wrapped.
908
    """
909
    return lib.TCOD_console_print_rect_ex_utf(
910
        _console(con), x, y, w, h, flag, alignment, _fmt_unicode(fmt))
911
912
def console_get_height_rect(con, x, y, w, h, fmt):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading history...
Comprehensibility Best Practice introduced by
Undefined variable 'BKGND_DEFAULT'
Loading history...
922
    """Draw a the background color on a rect optionally clearing the text.
923
924
    If clr is True the affected tiles are changed to space character.
925
    """
926
    lib.TCOD_console_rect(_console(con), x, y, w, h, clr, flag)
927
928
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...
929
    """Draw a horizontal line on the console.
930
931
    This always uses the character 196, the horizontal line character.
932
    """
933
    lib.TCOD_console_hline(_console(con), x, y, l, flag)
934
935
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...
936
    """Draw a vertical line on the console.
937
938
    This always uses the character 179, the vertical line character.
939
    """
940
    lib.TCOD_console_vline(_console(con), x, y, l, flag)
941
942
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...
943
    """Draw a framed rectangle with optinal text.
944
945
    This uses the default background color and blend mode to fill the
946
    rectangle and the default foreground to draw the outline.
947
948
    fmt will be printed on the inside of the rectangle, word-wrapped.
949
    """
950
    lib.TCOD_console_print_frame(
951
        _console(con), x, y, w, h, clear, flag, _fmt_bytes(fmt))
952
953
def console_set_color_control(con, fore, back):
954
    """Configure :any:`color controls`.
955
956
    Args:
957
        con (int): :any:`Color control` constant to modify.
958
        fore (Union[Tuple[int, int, int], Sequence[int]]):
959
            An (r, g, b) sequence or Color instance.
960
        back (Union[Tuple[int, int, int], Sequence[int]]):
961
            An (r, g, b) sequence or Color instance.
962
    """
963
    lib.TCOD_console_set_color_control(con, fore, back)
964
965
def console_get_default_background(con):
966
    """Return this consoles default background color."""
967
    return Color._new_from_cdata(
968
        lib.TCOD_console_get_default_background(_console(con)))
969
970
def console_get_default_foreground(con):
971
    """Return this consoles default foreground color."""
972
    return Color._new_from_cdata(
973
        lib.TCOD_console_get_default_foreground(_console(con)))
974
975
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...
976
    """Return the background color at the x,y of this console."""
977
    return Color._new_from_cdata(
978
        lib.TCOD_console_get_char_background(_console(con), x, y))
979
980
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...
981
    """Return the foreground color at the x,y of this console."""
982
    return Color._new_from_cdata(
983
        lib.TCOD_console_get_char_foreground(_console(con), x, y))
984
985
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...
986
    """Return the character at the x,y of this console."""
987
    return lib.TCOD_console_get_char(_console(con), x, y)
988
989
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...
990
    lib.TCOD_console_set_fade(fade, fadingColor)
991
992
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...
993
    return lib.TCOD_console_get_fade()
994
995
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...
996
    return Color._new_from_cdata(lib.TCOD_console_get_fading_color())
997
998
# handling keyboard input
999
def console_wait_for_keypress(flush):
1000
    """Block until the user presses a key, then returns a new Key.
1001
1002
    Args:
1003
        flush bool: If True then the event queue is cleared before waiting
1004
                    for the next event.
1005
1006
    Returns:
1007
        Key: A new Key instance.
1008
    """
1009
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
1010
    lib.TCOD_console_wait_for_keypress_wrapper(k.cdata, flush)
1011
    return k
1012
1013
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...
1014
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
1015
    lib.TCOD_console_check_for_keypress_wrapper(k.cdata, flags)
1016
    return k
1017
1018
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...
1019
    return lib.TCOD_console_is_key_pressed(key)
1020
1021
# using offscreen consoles
1022
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...
1023
    """Return an offscreen console of size: w,h."""
1024
    return tcod.console.Console(w, h)
1025
1026
def console_from_file(filename):
1027
    """Return a new console object from a filename.
1028
1029
    The file format is automactially determined.  This can load REXPaint `.xp`,
1030
    ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files.
1031
1032
    Args:
1033
        filename (Text): The path to the file, as a string.
1034
1035
    Returns: A new :any`Console` instance.
1036
    """
1037
    return tcod.console.Console._from_cdata(
1038
        lib.TCOD_console_from_file(filename.encode('utf-8')))
1039
1040
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...
1041
    """Blit the console src from x,y,w,h to console dst at xdst,ydst."""
1042
    lib.TCOD_console_blit(
1043
        _console(src), x, y, w, h,
1044
        _console(dst), xdst, ydst, ffade, bfade)
1045
1046
def console_set_key_color(con, col):
1047
    """Set a consoles blit transparent color."""
1048
    lib.TCOD_console_set_key_color(_console(con), col)
1049
    if hasattr(con, 'set_key_color'):
1050
        con.set_key_color(col)
1051
1052
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...
1053
    con = _console(con)
1054
    if con == ffi.NULL:
1055
        lib.TCOD_console_delete(con)
1056
1057
# fast color filling
1058 View Code Duplication
def console_fill_foreground(con, r, g, b):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
Coding Style Naming introduced by
The name r does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading history...
1059
    """Fill the foregound of a console with r,g,b.
1060
1061
    Args:
1062
        con (Console): Any Console instance.
1063
        r (Sequence[int]): An array of integers with a length of width*height.
1064
        g (Sequence[int]): An array of integers with a length of width*height.
1065
        b (Sequence[int]): An array of integers with a length of width*height.
1066
    """
1067
    if len(r) != len(g) or len(r) != len(b):
1068
        raise TypeError('R, G and B must all have the same size.')
1069
    if (isinstance(r, _np.ndarray) and isinstance(g, _np.ndarray) and
1070
            isinstance(b, _np.ndarray)):
1071
        #numpy arrays, use numpy's ctypes functions
1072
        r = _np.ascontiguousarray(r, dtype=_np.intc)
1073
        g = _np.ascontiguousarray(g, dtype=_np.intc)
1074
        b = _np.ascontiguousarray(b, dtype=_np.intc)
1075
        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...
1076
        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...
1077
        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...
1078
    else:
1079
        # otherwise convert using ffi arrays
1080
        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...
1081
        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...
1082
        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...
1083
1084
    lib.TCOD_console_fill_foreground(_console(con), cr, cg, cb)
1085
1086 View Code Duplication
def console_fill_background(con, r, g, b):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
Coding Style Naming introduced by
The name r does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading history...
1087
    """Fill the backgound of a console with r,g,b.
1088
1089
    Args:
1090
        con (Console): Any Console instance.
1091
        r (Sequence[int]): An array of integers with a length of width*height.
1092
        g (Sequence[int]): An array of integers with a length of width*height.
1093
        b (Sequence[int]): An array of integers with a length of width*height.
1094
    """
1095
    if len(r) != len(g) or len(r) != len(b):
1096
        raise TypeError('R, G and B must all have the same size.')
1097
    if (isinstance(r, _np.ndarray) and isinstance(g, _np.ndarray) and
1098
            isinstance(b, _np.ndarray)):
1099
        #numpy arrays, use numpy's ctypes functions
1100
        r = _np.ascontiguousarray(r, dtype=_np.intc)
1101
        g = _np.ascontiguousarray(g, dtype=_np.intc)
1102
        b = _np.ascontiguousarray(b, dtype=_np.intc)
1103
        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...
1104
        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...
1105
        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...
1106
    else:
1107
        # otherwise convert using ffi arrays
1108
        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...
1109
        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...
1110
        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...
1111
1112
    lib.TCOD_console_fill_background(_console(con), cr, cg, cb)
1113
1114
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...
1115
    """Fill the character tiles of a console with an array.
1116
1117
    Args:
1118
        con (Console): Any Console instance.
1119
        arr (Sequence[int]): An array of integers with a length of width*height.
1120
    """
1121
    if isinstance(arr, _np.ndarray):
1122
        #numpy arrays, use numpy's ctypes functions
1123
        arr = _np.ascontiguousarray(arr, dtype=_np.intc)
1124
        carr = ffi.cast('int *', arr.ctypes.data)
1125
    else:
1126
        #otherwise convert using the ffi module
1127
        carr = ffi.new('int[]', arr)
1128
1129
    lib.TCOD_console_fill_char(_console(con), carr)
1130
1131
def console_load_asc(con, filename):
1132
    """Update a console from a non-delimited ASCII `.asc` file."""
1133
    return lib.TCOD_console_load_asc(_console(con), filename.encode('utf-8'))
1134
1135
def console_save_asc(con, filename):
1136
    """Save a console to a non-delimited ASCII `.asc` file."""
1137
    return lib.TCOD_console_save_asc(_console(con), filename.encode('utf-8'))
1138
1139
def console_load_apf(con, filename):
1140
    """Update a console from an ASCII Paint `.apf` file."""
1141
    return lib.TCOD_console_load_apf(_console(con), filename.encode('utf-8'))
1142
1143
def console_save_apf(con, filename):
1144
    """Save a console to an ASCII Paint `.apf` file."""
1145
    return lib.TCOD_console_save_apf(_console(con), filename.encode('utf-8'))
1146
1147
def console_load_xp(con, filename):
1148
    """Update a console from a REXPaint `.xp` file."""
1149
    return lib.TCOD_console_load_xp(_console(con), filename.encode('utf-8'))
1150
1151
def console_save_xp(con, filename, compress_level=9):
1152
    """Save a console to a REXPaint `.xp` file."""
1153
    return lib.TCOD_console_save_xp(
1154
        _console(con),
1155
        filename.encode('utf-8'),
1156
        compress_level,
1157
        )
1158
1159
def console_from_xp(filename):
1160
    """Return a single console from a REXPaint `.xp` file."""
1161
    return tcod.console.Console._from_cdata(
1162
        lib.TCOD_console_from_xp(filename.encode('utf-8')))
1163
1164
def console_list_load_xp(filename):
1165
    """Return a list of consoles from a REXPaint `.xp` file."""
1166
    tcod_list = lib.TCOD_console_list_from_xp(filename.encode('utf-8'))
1167
    if tcod_list == ffi.NULL:
1168
        return None
1169
    try:
1170
        python_list = []
1171
        lib.TCOD_list_reverse(tcod_list)
1172
        while not lib.TCOD_list_is_empty(tcod_list):
1173
            python_list.append(
1174
                tcod.console.Console._from_cdata(lib.TCOD_list_pop(tcod_list)),
1175
                )
1176
        return python_list
1177
    finally:
1178
        lib.TCOD_list_delete(tcod_list)
1179
1180
def console_list_save_xp(console_list, filename, compress_level=9):
1181
    """Save a list of consoles to a REXPaint `.xp` file."""
1182
    tcod_list = lib.TCOD_list_new()
1183
    try:
1184
        for console in console_list:
1185
            lib.TCOD_list_push(tcod_list, _console(console))
1186
        return lib.TCOD_console_list_save_xp(
1187
            tcod_list, filename.encode('utf-8'), compress_level
1188
            )
1189
    finally:
1190
        lib.TCOD_list_delete(tcod_list)
1191
1192
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...
1193
    """Return a new AStar using the given Map.
1194
1195
    Args:
1196
        m (Map): A Map instance.
1197
        dcost (float): The path-finding cost of diagonal movement.
1198
                       Can be set to 0 to disable diagonal movement.
1199
    Returns:
1200
        AStar: A new AStar instance.
1201
    """
1202
    return tcod.path.AStar(m, dcost)
1203
1204
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...
1205
    """Return a new AStar using the given callable function.
1206
1207
    Args:
1208
        w (int): Clipping width.
1209
        h (int): Clipping height.
1210
        func (Callable[[int, int, int, int, Any], float]):
1211
        userData (Any):
1212
        dcost (float): A multiplier for the cost of diagonal movement.
1213
                       Can be set to 0 to disable diagonal movement.
1214
    Returns:
1215
        AStar: A new AStar instance.
1216
    """
1217
    return tcod.path.AStar(
1218
        tcod.path._EdgeCostFunc((func, userData), w, h),
1219
        dcost,
1220
        )
1221
1222
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...
1223
    """Find a path from (ox, oy) to (dx, dy).  Return True if path is found.
1224
1225
    Args:
1226
        p (AStar): An AStar instance.
1227
        ox (int): Starting x position.
1228
        oy (int): Starting y position.
1229
        dx (int): Destination x position.
1230
        dy (int): Destination y position.
1231
    Returns:
1232
        bool: True if a valid path was found.  Otherwise False.
1233
    """
1234
    return lib.TCOD_path_compute(p._path_c, ox, oy, dx, dy)
1235
1236
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...
1237
    """Get the current origin position.
1238
1239
    This point moves when :any:`path_walk` returns the next x,y step.
1240
1241
    Args:
1242
        p (AStar): An AStar instance.
1243
    Returns:
1244
        Tuple[int, int]: An (x, y) point.
1245
    """
1246
    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...
1247
    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...
1248
    lib.TCOD_path_get_origin(p._path_c, x, y)
1249
    return x[0], y[0]
1250
1251
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...
1252
    """Get the current destination position.
1253
1254
    Args:
1255
        p (AStar): An AStar instance.
1256
    Returns:
1257
        Tuple[int, int]: An (x, y) point.
1258
    """
1259
    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...
1260
    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...
1261
    lib.TCOD_path_get_destination(p._path_c, x, y)
1262
    return x[0], y[0]
1263
1264
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...
1265
    """Return the current length of the computed path.
1266
1267
    Args:
1268
        p (AStar): An AStar instance.
1269
    Returns:
1270
        int: Length of the path.
1271
    """
1272
    return lib.TCOD_path_size(p._path_c)
1273
1274
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...
1275
    """Reverse the direction of a path.
1276
1277
    This effectively swaps the origin and destination points.
1278
1279
    Args:
1280
        p (AStar): An AStar instance.
1281
    """
1282
    lib.TCOD_path_reverse(p._path_c)
1283
1284
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...
1285
    """Get a point on a path.
1286
1287
    Args:
1288
        p (AStar): An AStar instance.
1289
        idx (int): Should be in range: 0 <= inx < :any:`path_size`
1290
    """
1291
    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...
1292
    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...
1293
    lib.TCOD_path_get(p._path_c, idx, x, y)
1294
    return x[0], y[0]
1295
1296
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...
1297
    """Return True if a path is empty.
1298
1299
    Args:
1300
        p (AStar): An AStar instance.
1301
    Returns:
1302
        bool: True if a path is empty.  Otherwise False.
1303
    """
1304
    return lib.TCOD_path_is_empty(p._path_c)
1305
1306
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...
1307
    """Return the next (x, y) point in a path, or (None, None) if it's empty.
1308
1309
    When ``recompute`` is True and a previously valid path reaches a point
1310
    where it is now blocked, a new path will automatically be found.
1311
1312
    Args:
1313
        p (AStar): An AStar instance.
1314
        recompute (bool): Recompute the path automatically.
1315
    Returns:
1316
        Union[Tuple[int, int], Tuple[None, None]]:
1317
            A single (x, y) point, or (None, None)
1318
    """
1319
    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...
1320
    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...
1321
    if lib.TCOD_path_walk(p._path_c, x, y, recompute):
1322
        return x[0], y[0]
1323
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1324
1325
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...
1326
    """Does nothing."""
1327
    pass
1328
1329
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...
1330
    return tcod.path.Dijkstra(m, dcost)
1331
1332
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...
1333
    return tcod.path.Dijkstra(
1334
        tcod.path._EdgeCostFunc((func, userData), w, h),
1335
        dcost,
1336
        )
1337
1338
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...
1339
    lib.TCOD_dijkstra_compute(p._path_c, ox, oy)
1340
1341
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...
1342
    return lib.TCOD_dijkstra_path_set(p._path_c, x, y)
1343
1344
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...
1345
    return lib.TCOD_dijkstra_get_distance(p._path_c, x, y)
1346
1347
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...
1348
    return lib.TCOD_dijkstra_size(p._path_c)
1349
1350
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...
1351
    lib.TCOD_dijkstra_reverse(p._path_c)
1352
1353
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...
1354
    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...
1355
    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...
1356
    lib.TCOD_dijkstra_get(p._path_c, idx, x, y)
1357
    return x[0], y[0]
1358
1359
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...
1360
    return lib.TCOD_dijkstra_is_empty(p._path_c)
1361
1362
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...
1363
    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...
1364
    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...
1365
    if lib.TCOD_dijkstra_path_walk(p._path_c, x, y):
1366
        return x[0], y[0]
1367
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1368
1369
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...
1370
    pass
1371
1372
def _heightmap_cdata(array):
1373
    """Return a new TCOD_heightmap_t instance using an array.
1374
1375
    Formatting is verified during this function.
1376
    """
1377
    if not array.flags['C_CONTIGUOUS']:
1378
        raise ValueError('array must be a C-style contiguous segment.')
1379
    if array.dtype != _np.float32:
1380
        raise ValueError('array dtype must be float32, not %r' % array.dtype)
1381
    width, height = array.shape
1382
    pointer = ffi.cast('float *', array.ctypes.data)
1383
    return ffi.new('TCOD_heightmap_t *', (width, height, pointer))
1384
1385
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...
1386
    """Return a new numpy.ndarray formatted for use with heightmap functions.
1387
1388
    You can pass a numpy array to any heightmap function as long as all the
1389
    following are true::
1390
    * The array is 2 dimentional.
1391
    * The array has the C_CONTIGUOUS flag.
1392
    * The array's dtype is :any:`dtype.float32`.
1393
1394
    Args:
1395
        w (int): The width of the new HeightMap.
1396
        h (int): The height of the new HeightMap.
1397
1398
    Returns:
1399
        numpy.ndarray: A C-contiguous mapping of float32 values.
1400
    """
1401
    return _np.ndarray((h, w), _np.float32)
1402
1403
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...
1404
    """Set the value of a point on a heightmap.
1405
1406
    Args:
1407
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1408
        x (int): The x position to change.
1409
        y (int): The y position to change.
1410
        value (float): The value to set.
1411
1412
    .. deprecated:: 2.0
1413
        Do ``hm[y, x] = value`` instead.
1414
    """
1415
    hm[y, x] = value
1416
1417
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...
1418
    """Add value to all values on this heightmap.
1419
1420
    Args:
1421
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1422
        value (float): A number to add to this heightmap.
1423
1424
    .. deprecated:: 2.0
1425
        Do ``hm[:] += value`` instead.
1426
    """
1427
    hm[:] += value
1428
1429
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...
1430
    """Multiply all items on this heightmap by value.
1431
1432
    Args:
1433
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1434
        value (float): A number to scale this heightmap by.
1435
1436
    .. deprecated:: 2.0
1437
        Do ``hm[:] *= value`` instead.
1438
    """
1439
    hm[:] *= value
1440
1441
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...
1442
    """Add value to all values on this heightmap.
1443
1444
    Args:
1445
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1446
1447
    .. deprecated:: 2.0
1448
        Do ``hm.array[:] = 0`` instead.
1449
    """
1450
    hm[:] = 0
1451
1452
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...
1453
    """Clamp all values on this heightmap between ``mi`` and ``ma``
1454
1455
    Args:
1456
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1457
        mi (float): The lower bound to clamp to.
1458
        ma (float): The upper bound to clamp to.
1459
1460
    .. deprecated:: 2.0
1461
        Do ``hm.clip(mi, ma)`` instead.
1462
    """
1463
    hm.clip(mi, ma)
1464
1465
def heightmap_copy(hm1, hm2):
1466
    """Copy the heightmap ``hm1`` to ``hm2``.
1467
1468
    Args:
1469
        hm1 (numpy.ndarray): The source heightmap.
1470
        hm2 (numpy.ndarray): The destination heightmap.
1471
1472
    .. deprecated:: 2.0
1473
        Do ``hm2[:] = hm1[:]`` instead.
1474
    """
1475
    hm2[:] = hm1[:]
1476
1477
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...
1478
    """Normalize heightmap values between ``mi`` and ``ma``.
1479
1480
    Args:
1481
        mi (float): The lowest value after normalization.
1482
        ma (float): The highest value after normalization.
1483
    """
1484
    lib.TCOD_heightmap_normalize(_heightmap_cdata(hm), mi, ma)
1485
1486
def heightmap_lerp_hm(hm1, hm2, hm3, coef):
1487
    """Perform linear interpolation between two heightmaps storing the result
1488
    in ``hm3``.
1489
1490
    This is the same as doing ``hm3[:] = hm1[:] + (hm2[:] - hm1[:]) * coef``
1491
1492
    Args:
1493
        hm1 (numpy.ndarray): The first heightmap.
1494
        hm2 (numpy.ndarray): The second heightmap to add to the first.
1495
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1496
        coef (float): The linear interpolation coefficient.
1497
    """
1498
    lib.TCOD_heightmap_lerp_hm(_heightmap_cdata(hm1), _heightmap_cdata(hm2),
1499
                               _heightmap_cdata(hm3), coef)
1500
1501
def heightmap_add_hm(hm1, hm2, hm3):
1502
    """Add two heightmaps together and stores the result in ``hm3``.
1503
1504
    Args:
1505
        hm1 (numpy.ndarray): The first heightmap.
1506
        hm2 (numpy.ndarray): The second heightmap to add to the first.
1507
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1508
1509
    .. deprecated:: 2.0
1510
        Do ``hm3[:] = hm1[:] + hm2[:]`` instead.
1511
    """
1512
    hm3[:] = hm1[:] + hm2[:]
1513
1514
def heightmap_multiply_hm(hm1, hm2, hm3):
1515
    """Multiplies two heightmap's together and stores the result in ``hm3``.
1516
1517
    Args:
1518
        hm1 (numpy.ndarray): The first heightmap.
1519
        hm2 (numpy.ndarray): The second heightmap to multiply with the first.
1520
        hm3 (numpy.ndarray): A destination heightmap to store the result.
1521
1522
    .. deprecated:: 2.0
1523
        Do ``hm3[:] = hm1[:] * hm2[:]`` instead.
1524
        Alternatively you can do ``HeightMap(hm1.array[:] * hm2.array[:])``.
1525
    """
1526
    hm3[:] = hm1[:] * hm2[:]
1527
1528
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...
1529
    """Add a hill (a half spheroid) at given position.
1530
1531
    If height == radius or -radius, the hill is a half-sphere.
1532
1533
    Args:
1534
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1535
        x (float): The x position at the center of the new hill.
1536
        y (float): The y position at the center of the new hill.
1537
        radius (float): The size of the new hill.
1538
        height (float): The height or depth of the new hill.
1539
    """
1540
    lib.TCOD_heightmap_add_hill(_heightmap_cdata(hm), x, y, radius, height)
1541
1542
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...
1543
    """
1544
1545
    This function takes the highest value (if height > 0) or the lowest
1546
    (if height < 0) between the map and the hill.
1547
1548
    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...
1549
1550
    Args:
1551
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1552
        x (float): The x position at the center of the new carving.
1553
        y (float): The y position at the center of the new carving.
1554
        radius (float): The size of the carving.
1555
        height (float): The height or depth of the hill to dig out.
1556
    """
1557
    lib.TCOD_heightmap_dig_hill(_heightmap_cdata(hm), x, y, radius, height)
1558
1559
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...
1560
    """Simulate the effect of rain drops on the terrain, resulting in erosion.
1561
1562
    ``nbDrops`` should be at least hm.size.
1563
1564
    Args:
1565
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1566
        nbDrops (int): Number of rain drops to simulate.
1567
        erosionCoef (float): Amount of ground eroded on the drop's path.
1568
        sedimentationCoef (float): Amount of ground deposited when the drops
1569
                                   stops to flow.
1570
        rnd (Optional[Random]): A tcod.Random instance, or None.
1571
    """
1572
    lib.TCOD_heightmap_rain_erosion(_heightmap_cdata(hm), nbDrops, erosionCoef,
1573
                                    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...
1574
1575
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...
1576
                               maxLevel):
1577
    """Apply a generic transformation on the map, so that each resulting cell
1578
    value is the weighted sum of several neighbour cells.
1579
1580
    This can be used to smooth/sharpen the map.
1581
1582
    Args:
1583
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1584
        kernelsize (int): Should be set to the length of the parameters::
1585
                          dx, dy, and weight.
1586
        dx (Sequence[int]): A sequence of x coorinates.
1587
        dy (Sequence[int]): A sequence of y coorinates.
1588
        weight (Sequence[float]): A sequence of kernelSize cells weight.
1589
                                  The value of each neighbour cell is scaled by
1590
                                  its corresponding weight
1591
        minLevel (float): No transformation will apply to cells
1592
                          below this value.
1593
        maxLevel (float): No transformation will apply to cells
1594
                          above this value.
1595
1596
    See examples below for a simple horizontal smoothing kernel :
1597
    replace value(x,y) with
1598
    0.33*value(x-1,y) + 0.33*value(x,y) + 0.33*value(x+1,y).
1599
    To do this, you need a kernel of size 3
1600
    (the sum involves 3 surrounding cells).
1601
    The dx,dy array will contain
1602
    * dx=-1, dy=0 for cell (x-1, y)
1603
    * dx=1, dy=0 for cell (x+1, y)
1604
    * dx=0, dy=0 for cell (x, y)
1605
    * The weight array will contain 0.33 for each cell.
1606
1607
    Example:
1608
        >>> import numpy as np
1609
        >>> heightmap = np.zeros((3, 3), dtype=np.float32)
1610
        >>> heightmap[:,1] = 1
1611
        >>> dx = [-1, 1, 0]
1612
        >>> dy = [0, 0, 0]
1613
        >>> weight = [0.33, 0.33, 0.33]
1614
        >>> tcod.heightmap_kernel_transform(heightmap, 3, dx, dy, weight,
1615
        ...                                 0.0, 1.0)
1616
    """
1617
    cdx = ffi.new('int[]', dx)
1618
    cdy = ffi.new('int[]', dy)
1619
    cweight = ffi.new('float[]', weight)
1620
    lib.TCOD_heightmap_kernel_transform(_heightmap_cdata(hm), kernelsize,
1621
                                        cdx, cdy, cweight, minLevel, maxLevel)
1622
1623
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...
1624
    """Add values from a Voronoi diagram to the heightmap.
1625
1626
    Args:
1627
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1628
        nbPoints (Any): Number of Voronoi sites.
1629
        nbCoef (int): The diagram value is calculated from the nbCoef
1630
                      closest sites.
1631
        coef (Sequence[float]): The distance to each site is scaled by the
1632
                                corresponding coef.
1633
                                Closest site : coef[0],
1634
                                second closest site : coef[1], ...
1635
        rnd (Optional[Random]): A Random instance, or None.
1636
    """
1637
    nbPoints = len(coef)
1638
    ccoef = ffi.new('float[]', coef)
1639
    lib.TCOD_heightmap_add_voronoi(_heightmap_cdata(hm), nbPoints,
1640
                                   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...
1641
1642
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...
1643
    """Add FBM noise to the heightmap.
1644
1645
    The noise coordinate for each map cell is
1646
    `((x + addx) * mulx / width, (y + addy) * muly / height)`.
1647
1648
    The value added to the heightmap is `delta + noise * scale`.
1649
1650
    Args:
1651
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1652
        noise (Noise): A Noise instance.
1653
        mulx (float): Scaling of each x coordinate.
1654
        muly (float): Scaling of each y coordinate.
1655
        addx (float): Translation of each x coordinate.
1656
        addy (float): Translation of each y coordinate.
1657
        octaves (float): Number of octaves in the FBM sum.
1658
        delta (float): The value added to all heightmap cells.
1659
        scale (float): The noise value is scaled with this parameter.
1660
    """
1661
    noise = noise.noise_c if noise is not None else ffi.NULL
1662
    lib.TCOD_heightmap_add_fbm(_heightmap_cdata(hm), noise,
1663
                               mulx, muly, addx, addy, octaves, delta, scale)
1664
1665
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...
1666
                        scale):
1667
    """Multiply the heighmap values with FBM noise.
1668
1669
    Args:
1670
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1671
        noise (Noise): A Noise instance.
1672
        mulx (float): Scaling of each x coordinate.
1673
        muly (float): Scaling of each y coordinate.
1674
        addx (float): Translation of each x coordinate.
1675
        addy (float): Translation of each y coordinate.
1676
        octaves (float): Number of octaves in the FBM sum.
1677
        delta (float): The value added to all heightmap cells.
1678
        scale (float): The noise value is scaled with this parameter.
1679
    """
1680
    noise = noise.noise_c if noise is not None else ffi.NULL
1681
    lib.TCOD_heightmap_scale_fbm(_heightmap_cdata(hm), noise,
1682
                                 mulx, muly, addx, addy, octaves, delta, scale)
1683
1684
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...
1685
                         endDepth):
1686
    """Carve a path along a cubic Bezier curve.
1687
1688
    Both radius and depth can vary linearly along the path.
1689
1690
    Args:
1691
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1692
        px (Sequence[int]): The 4 `x` coordinates of the Bezier curve.
1693
        py (Sequence[int]): The 4 `y` coordinates of the Bezier curve.
1694
        startRadius (float): The starting radius size.
1695
        startDepth (float): The starting depth.
1696
        endRadius (float): The ending radius size.
1697
        endDepth (float): The ending depth.
1698
    """
1699
    lib.TCOD_heightmap_dig_bezier(_heightmap_cdata(hm), px, py, startRadius,
1700
                                   startDepth, endRadius,
1701
                                   endDepth)
1702
1703
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...
1704
    """Return the value at ``x``, ``y`` in a heightmap.
1705
1706
    Args:
1707
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1708
        x (int): The x position to pick.
1709
        y (int): The y position to pick.
1710
1711
    Returns:
1712
        float: The value at ``x``, ``y``.
1713
1714
    .. deprecated:: 2.0
1715
        Do ``value = hm[y, x]`` instead.
1716
    """
1717
    # explicit type conversion to pass test, (test should have been better.)
1718
    return float(hm[y, x])
1719
1720
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...
1721
    """Return the interpolated height at non integer coordinates.
1722
1723
    Args:
1724
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1725
        x (float): A floating point x coordinate.
1726
        y (float): A floating point y coordinate.
1727
1728
    Returns:
1729
        float: The value at ``x``, ``y``.
1730
    """
1731
    return lib.TCOD_heightmap_get_interpolated_value(_heightmap_cdata(hm),
1732
                                                     x, y)
1733
1734
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...
1735
    """Return the slope between 0 and (pi / 2) at given coordinates.
1736
1737
    Args:
1738
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1739
        x (int): The x coordinate.
1740
        y (int): The y coordinate.
1741
1742
    Returns:
1743
        float: The steepness at ``x``, ``y``.  From 0 to (pi / 2)
1744
    """
1745
    return lib.TCOD_heightmap_get_slope(_heightmap_cdata(hm), x, y)
1746
1747
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...
1748
    """Return the map normal at given coordinates.
1749
1750
    Args:
1751
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1752
        x (float): The x coordinate.
1753
        y (float): The y coordinate.
1754
        waterLevel (float): The heightmap is considered flat below this value.
1755
1756
    Returns:
1757
        Tuple[float, float, float]: An (x, y, z) vector normal.
1758
    """
1759
    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...
1760
    lib.TCOD_heightmap_get_normal(_heightmap_cdata(hm), x, y, cn, waterLevel)
1761
    return tuple(cn)
1762
1763
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...
1764
    """Return the number of map cells which value is between ``mi`` and ``ma``.
1765
1766
    Args:
1767
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1768
        mi (float): The lower bound.
1769
        ma (float): The upper bound.
1770
1771
    Returns:
1772
        int: The count of values which fall between ``mi`` and ``ma``.
1773
    """
1774
    return lib.TCOD_heightmap_count_cells(_heightmap_cdata(hm), mi, ma)
1775
1776
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...
1777
    """Returns True if the map edges are below ``waterlevel``, otherwise False.
1778
1779
    Args:
1780
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1781
        waterLevel (float): The water level to use.
1782
1783
    Returns:
1784
        bool: True if the map edges are below ``waterlevel``, otherwise False.
1785
    """
1786
    return lib.TCOD_heightmap_has_land_on_border(_heightmap_cdata(hm),
1787
                                                 waterlevel)
1788
1789
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...
1790
    """Return the min and max values of this heightmap.
1791
1792
    Args:
1793
        hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
1794
1795
    Returns:
1796
        Tuple[float, float]: The (min, max) values.
1797
1798
    .. deprecated:: 2.0
1799
        Do ``hm.min()`` or ``hm.max()`` instead.
1800
    """
1801
    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...
1802
    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...
1803
    lib.TCOD_heightmap_get_minmax(_heightmap_cdata(hm), mi, ma)
1804
    return mi[0], ma[0]
1805
1806
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...
1807
    """Does nothing.
1808
1809
    .. deprecated:: 2.0
1810
        libtcod-cffi deletes heightmaps automatically.
1811
    """
1812
    pass
1813
1814
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...
1815
    return tcod.image.Image(width, height)
1816
1817
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...
1818
    image.clear(col)
1819
1820
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...
1821
    image.invert()
1822
1823
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...
1824
    image.hflip()
1825
1826
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...
1827
    image.rotate90(num)
1828
1829
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...
1830
    image.vflip()
1831
1832
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...
1833
    image.scale(neww, newh)
1834
1835
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...
1836
    image.set_key_color(col)
1837
1838
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...
1839
    image.get_alpha(x, y)
1840
1841
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...
1842
    lib.TCOD_image_is_pixel_transparent(image.image_c, x, y)
1843
1844
def image_load(filename):
1845
    """Load an image file into an Image instance and return it.
1846
1847
    Args:
1848
        filename (AnyStr): Path to a .bmp or .png image file.
1849
    """
1850
    return tcod.image.Image._from_cdata(
1851
        ffi.gc(lib.TCOD_image_load(_bytes(filename)),
1852
               lib.TCOD_image_delete)
1853
        )
1854
1855
def image_from_console(console):
1856
    """Return an Image with a Consoles pixel data.
1857
1858
    This effectively takes a screen-shot of the Console.
1859
1860
    Args:
1861
        console (Console): Any Console instance.
1862
    """
1863
    return tcod.image.Image._from_cdata(
1864
        ffi.gc(
1865
            lib.TCOD_image_from_console(_console(console)),
1866
            lib.TCOD_image_delete,
1867
            )
1868
        )
1869
1870
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...
1871
    image.refresh_console(console)
1872
1873
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...
1874
    return image.width, image.height
1875
1876
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...
1877
    return image.get_pixel(x, y)
1878
1879
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...
1880
    return image.get_mipmap_pixel(x0, y0, x1, y1)
1881
1882
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...
1883
    image.put_pixel(x, y, col)
1884
1885
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...
1886
    image.blit(console, x, y, bkgnd_flag, scalex, scaley, angle)
1887
1888
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...
1889
    image.blit_rect(console, x, y, w, h, bkgnd_flag)
1890
1891
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...
1892
    image.blit_2x(console, dx, dy, sx, sy, w, h)
1893
1894
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...
1895
    image.save_as(filename)
1896
1897
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...
1898
    pass
1899
1900
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...
1901
    """Initilize a line whose points will be returned by `line_step`.
1902
1903
    This function does not return anything on its own.
1904
1905
    Does not include the origin point.
1906
1907
    Args:
1908
        xo (int): X starting point.
1909
        yo (int): Y starting point.
1910
        xd (int): X destination point.
1911
        yd (int): Y destination point.
1912
1913
    .. deprecated:: 2.0
1914
       Use `line_iter` instead.
1915
    """
1916
    lib.TCOD_line_init(xo, yo, xd, yd)
1917
1918
def line_step():
1919
    """After calling line_init returns (x, y) points of the line.
1920
1921
    Once all points are exhausted this function will return (None, None)
1922
1923
    Returns:
1924
        Union[Tuple[int, int], Tuple[None, None]]:
1925
            The next (x, y) point of the line setup by line_init,
1926
            or (None, None) if there are no more points.
1927
1928
    .. deprecated:: 2.0
1929
       Use `line_iter` instead.
1930
    """
1931
    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...
1932
    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...
1933
    ret = lib.TCOD_line_step(x, y)
1934
    if not ret:
1935
        return x[0], y[0]
1936
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1937
1938
_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...
1939
1940
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...
1941
    """ Iterate over a line using a callback function.
1942
1943
    Your callback function will take x and y parameters and return True to
1944
    continue iteration or False to stop iteration and return.
1945
1946
    This function includes both the start and end points.
1947
1948
    Args:
1949
        xo (int): X starting point.
1950
        yo (int): Y starting point.
1951
        xd (int): X destination point.
1952
        yd (int): Y destination point.
1953
        py_callback (Callable[[int, int], bool]):
1954
            A callback which takes x and y parameters and returns bool.
1955
1956
    Returns:
1957
        bool: False if the callback cancels the line interation by
1958
              returning False or None, otherwise True.
1959
1960
    .. deprecated:: 2.0
1961
       Use `line_iter` instead.
1962
    """
1963
    with _PropagateException() as propagate:
1964
        with _line_listener_lock:
1965
            @ffi.def_extern(onerror=propagate)
1966
            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...
1967
                return py_callback(x, y)
1968
            return bool(lib.TCOD_line(xo, yo, xd, yd,
1969
                                       lib._pycall_line_listener))
1970
1971
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...
1972
    """ returns an iterator
1973
1974
    This iterator does not include the origin point.
1975
1976
    Args:
1977
        xo (int): X starting point.
1978
        yo (int): Y starting point.
1979
        xd (int): X destination point.
1980
        yd (int): Y destination point.
1981
1982
    Returns:
1983
        Iterator[Tuple[int,int]]: An iterator of (x,y) points.
1984
    """
1985
    data = ffi.new('TCOD_bresenham_data_t *')
1986
    lib.TCOD_line_init_mt(xo, yo, xd, yd, data)
1987
    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...
1988
    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...
1989
    yield xo, yo
1990
    while not lib.TCOD_line_step_mt(x, y, data):
1991
        yield (x[0], y[0])
1992
1993
FOV_BASIC = 0
1994
FOV_DIAMOND = 1
1995
FOV_SHADOW = 2
1996
FOV_PERMISSIVE_0 = 3
1997
FOV_PERMISSIVE_1 = 4
1998
FOV_PERMISSIVE_2 = 5
1999
FOV_PERMISSIVE_3 = 6
2000
FOV_PERMISSIVE_4 = 7
2001
FOV_PERMISSIVE_5 = 8
2002
FOV_PERMISSIVE_6 = 9
2003
FOV_PERMISSIVE_7 = 10
2004
FOV_PERMISSIVE_8 = 11
2005
FOV_RESTRICTIVE = 12
2006
NB_FOV_ALGORITHMS = 13
2007
2008
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...
2009
    return tcod.map.Map(w, h)
2010
2011
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...
2012
    return lib.TCOD_map_copy(source.map_c, dest.map_c)
2013
2014
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...
2015
    lib.TCOD_map_set_properties(m.map_c, x, y, isTrans, isWalk)
2016
2017
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...
2018
    # walkable/transparent looks incorrectly ordered here.
2019
    # TODO: needs test.
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
2020
    lib.TCOD_map_clear(m.map_c, walkable, transparent)
2021
2022
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...
2023
    lib.TCOD_map_compute_fov(m.map_c, x, y, radius, light_walls, algo)
2024
2025
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...
2026
    return lib.TCOD_map_is_in_fov(m.map_c, x, y)
2027
2028
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...
2029
    return lib.TCOD_map_is_transparent(m.map_c, x, y)
2030
2031
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...
2032
    return lib.TCOD_map_is_walkable(m.map_c, x, y)
2033
2034
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...
2035
    pass
2036
2037
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...
2038
    return map.width
2039
2040
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...
2041
    return map.height
2042
2043
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...
2044
    lib.TCOD_mouse_show_cursor(visible)
2045
2046
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...
2047
    return lib.TCOD_mouse_is_cursor_visible()
2048
2049
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...
2050
    lib.TCOD_mouse_move(x, y)
2051
2052
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...
2053
    return Mouse(lib.TCOD_mouse_get_status())
2054
2055
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...
2056
    lib.TCOD_namegen_parse(_bytes(filename), random or ffi.NULL)
2057
2058
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...
2059
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name), False))
2060
2061
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...
2062
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name),
2063
                                                     _bytes(rule), False))
2064
2065
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...
2066
    sets = lib.TCOD_namegen_get_sets()
2067
    try:
2068
        lst = []
2069
        while not lib.TCOD_list_is_empty(sets):
2070
            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...
2071
    finally:
2072
        lib.TCOD_list_delete(sets)
2073
    return lst
2074
2075
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...
2076
    lib.TCOD_namegen_destroy()
2077
2078
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...
2079
        random=None):
2080
    """Return a new Noise instance.
2081
2082
    Args:
2083
        dim (int): Number of dimensions.  From 1 to 4.
2084
        h (float): The hurst exponent.  Should be in the 0.0-1.0 range.
2085
        l (float): The noise lacunarity.
2086
        random (Optional[Random]): A Random instance, or None.
2087
2088
    Returns:
2089
        Noise: The new Noise instance.
2090
    """
2091
    return tcod.noise.Noise(dim, hurst=h, lacunarity=l, seed=random)
2092
2093
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...
2094
    """Set a Noise objects default noise algorithm.
2095
2096
    Args:
2097
        typ (int): Any NOISE_* constant.
2098
    """
2099
    n.algorithm = typ
2100
2101
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...
2102
    """Return the noise value sampled from the ``f`` coordinate.
2103
2104
    ``f`` should be a tuple or list with a length matching
2105
    :any:`Noise.dimensions`.
2106
    If ``f`` is shoerter than :any:`Noise.dimensions` the missing coordinates
2107
    will be filled with zeros.
2108
2109
    Args:
2110
        n (Noise): A Noise instance.
2111
        f (Sequence[float]): The point to sample the noise from.
2112
        typ (int): The noise algorithm to use.
2113
2114
    Returns:
2115
        float: The sampled noise value.
2116
    """
2117
    return lib.TCOD_noise_get_ex(n.noise_c, ffi.new('float[4]', f), typ)
2118
2119
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...
2120
    """Return the fractal Brownian motion sampled from the ``f`` coordinate.
2121
2122
    Args:
2123
        n (Noise): A Noise instance.
2124
        f (Sequence[float]): The point to sample the noise from.
2125
        typ (int): The noise algorithm to use.
2126
        octaves (float): The level of level.  Should be more than 1.
2127
2128
    Returns:
2129
        float: The sampled noise value.
2130
    """
2131
    return lib.TCOD_noise_get_fbm_ex(n.noise_c, ffi.new('float[4]', f),
2132
                                     oc, typ)
2133
2134
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...
2135
    """Return the turbulence noise sampled from the ``f`` coordinate.
2136
2137
    Args:
2138
        n (Noise): A Noise instance.
2139
        f (Sequence[float]): The point to sample the noise from.
2140
        typ (int): The noise algorithm to use.
2141
        octaves (float): The level of level.  Should be more than 1.
2142
2143
    Returns:
2144
        float: The sampled noise value.
2145
    """
2146
    return lib.TCOD_noise_get_turbulence_ex(n.noise_c, ffi.new('float[4]', f),
2147
                                            oc, typ)
2148
2149
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...
2150
    """Does nothing."""
2151
    pass
2152
2153
_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...
2154
try:
2155
    _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...
2156
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...
2157
    pass
2158
2159
def _unpack_union(type_, union):
2160
    '''
2161
        unpack items from parser new_property (value_converter)
2162
    '''
2163
    if type_ == lib.TCOD_TYPE_BOOL:
2164
        return bool(union.b)
2165
    elif type_ == lib.TCOD_TYPE_CHAR:
2166
        return _unicode(union.c)
2167
    elif type_ == lib.TCOD_TYPE_INT:
2168
        return union.i
2169
    elif type_ == lib.TCOD_TYPE_FLOAT:
2170
        return union.f
2171
    elif (type_ == lib.TCOD_TYPE_STRING or
2172
         lib.TCOD_TYPE_VALUELIST15 >= type_ >= lib.TCOD_TYPE_VALUELIST00):
2173
         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...
2174
    elif type_ == lib.TCOD_TYPE_COLOR:
2175
        return Color._new_from_cdata(union.col)
2176
    elif type_ == lib.TCOD_TYPE_DICE:
2177
        return Dice(union.dice)
2178
    elif type_ & lib.TCOD_TYPE_LIST:
2179
        return _convert_TCODList(union.list, type_ & 0xFF)
2180
    else:
2181
        raise RuntimeError('Unknown libtcod type: %i' % type_)
2182
2183
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...
2184
    return [_unpack_union(type_, lib.TDL_list_get_union(clist, i))
2185
            for i in range(lib.TCOD_list_size(clist))]
2186
2187
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...
2188
    return ffi.gc(lib.TCOD_parser_new(), lib.TCOD_parser_delete)
2189
2190
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...
2191
    return lib.TCOD_parser_new_struct(parser, name)
2192
2193
# prevent multiple threads from messing with def_extern callbacks
2194
_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...
2195
_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...
2196
2197
@ffi.def_extern()
2198
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...
2199
    return _parser_listener.end_struct(struct, _unpack_char_p(name))
2200
2201
@ffi.def_extern()
2202
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...
2203
    return _parser_listener.new_flag(_unpack_char_p(name))
2204
2205
@ffi.def_extern()
2206
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...
2207
    return _parser_listener.new_property(_unpack_char_p(propname), type,
2208
                                 _unpack_union(type, value))
2209
2210
@ffi.def_extern()
2211
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...
2212
    return _parser_listener.end_struct(struct, _unpack_char_p(name))
2213
2214
@ffi.def_extern()
2215
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...
2216
    _parser_listener.error(_unpack_char_p(msg))
2217
2218
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...
2219
    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...
2220
    if not listener:
2221
        lib.TCOD_parser_run(parser, _bytes(filename), ffi.NULL)
2222
        return
2223
2224
    propagate_manager = _PropagateException()
2225
    propagate = propagate_manager.propagate
2226
2227
    clistener = ffi.new(
2228
        'TCOD_parser_listener_t *',
2229
        {
2230
            'new_struct': lib._pycall_parser_new_struct,
2231
            'new_flag': lib._pycall_parser_new_flag,
2232
            'new_property': lib._pycall_parser_new_property,
2233
            'end_struct': lib._pycall_parser_end_struct,
2234
            'error': lib._pycall_parser_error,
2235
        },
2236
    )
2237
2238
    with _parser_callback_lock:
2239
        _parser_listener = listener
2240
        with propagate_manager:
2241
            lib.TCOD_parser_run(parser, _bytes(filename), clistener)
2242
2243
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...
2244
    pass
2245
2246
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...
2247
    return bool(lib.TCOD_parser_get_bool_property(parser, _bytes(name)))
2248
2249
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...
2250
    return lib.TCOD_parser_get_int_property(parser, _bytes(name))
2251
2252
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...
2253
    return _chr(lib.TCOD_parser_get_char_property(parser, _bytes(name)))
2254
2255
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...
2256
    return lib.TCOD_parser_get_float_property(parser, _bytes(name))
2257
2258
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...
2259
    return _unpack_char_p(
2260
        lib.TCOD_parser_get_string_property(parser, _bytes(name)))
2261
2262
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...
2263
    return Color._new_from_cdata(
2264
        lib.TCOD_parser_get_color_property(parser, _bytes(name)))
2265
2266
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...
2267
    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...
2268
    lib.TCOD_parser_get_dice_property_py(parser, _bytes(name), d)
2269
    return Dice(d)
2270
2271
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...
2272
    clist = lib.TCOD_parser_get_list_property(parser, _bytes(name), type)
2273
    return _convert_TCODList(clist, type)
2274
2275
RNG_MT = 0
2276
RNG_CMWC = 1
2277
2278
DISTRIBUTION_LINEAR = 0
2279
DISTRIBUTION_GAUSSIAN = 1
2280
DISTRIBUTION_GAUSSIAN_RANGE = 2
2281
DISTRIBUTION_GAUSSIAN_INVERSE = 3
2282
DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = 4
2283
2284
def random_get_instance():
2285
    """Return the default Random instance.
2286
2287
    Returns:
2288
        Random: A Random instance using the default random number generator.
2289
    """
2290
    return tcod.random.Random._new_from_cdata(
2291
        ffi.cast('mersenne_data_t*', lib.TCOD_random_get_instance()))
2292
2293
def random_new(algo=RNG_CMWC):
2294
    """Return a new Random instance.  Using ``algo``.
2295
2296
    Args:
2297
        algo (int): The random number algorithm to use.
2298
2299
    Returns:
2300
        Random: A new Random instance using the given algorithm.
2301
    """
2302
    return tcod.random.Random(algo)
2303
2304
def random_new_from_seed(seed, algo=RNG_CMWC):
2305
    """Return a new Random instance.  Using the given ``seed`` and ``algo``.
2306
2307
    Args:
2308
        seed (Hashable): The RNG seed.  Should be a 32-bit integer, but any
2309
                         hashable object is accepted.
2310
        algo (int): The random number algorithm to use.
2311
2312
    Returns:
2313
        Random: A new Random instance using the given algorithm.
2314
    """
2315
    return tcod.random.Random(algo, seed)
2316
2317
def random_set_distribution(rnd, dist):
2318
    """Change the distribution mode of a random number generator.
2319
2320
    Args:
2321
        rnd (Optional[Random]): A Random instance, or None to use the default.
2322
        dist (int): The distribution mode to use.  Should be DISTRIBUTION_*.
2323
    """
2324
    lib.TCOD_random_set_distribution(rnd.random_c if rnd else ffi.NULL, dist)
2325
2326
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...
2327
    """Return a random integer in the range: ``mi`` <= n <= ``ma``.
2328
2329
    The result is affacted by calls to :any:`random_set_distribution`.
2330
2331
    Args:
2332
        rnd (Optional[Random]): A Random instance, or None to use the default.
2333
        low (int): The lower bound of the random range, inclusive.
2334
        high (int): The upper bound of the random range, inclusive.
2335
2336
    Returns:
2337
        int: A random integer in the range ``mi`` <= n <= ``ma``.
2338
    """
2339
    return lib.TCOD_random_get_int(rnd.random_c if rnd else ffi.NULL, mi, ma)
2340
2341
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...
2342
    """Return a random float in the range: ``mi`` <= n <= ``ma``.
2343
2344
    The result is affacted by calls to :any:`random_set_distribution`.
2345
2346
    Args:
2347
        rnd (Optional[Random]): A Random instance, or None to use the default.
2348
        low (float): The lower bound of the random range, inclusive.
2349
        high (float): The upper bound of the random range, inclusive.
2350
2351
    Returns:
2352
        float: A random double precision float
2353
               in the range ``mi`` <= n <= ``ma``.
2354
    """
2355
    return lib.TCOD_random_get_double(
2356
        rnd.random_c if rnd else ffi.NULL, mi, ma)
2357
2358
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...
2359
    """Return a random float in the range: ``mi`` <= n <= ``ma``.
2360
2361
    .. deprecated:: 2.0
2362
        Use :any:`random_get_float` instead.
2363
        Both funtions return a double precision float.
2364
    """
2365
    return lib.TCOD_random_get_double(
2366
        rnd.random_c if rnd else ffi.NULL, mi, ma)
2367
2368
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...
2369
    """Return a random weighted integer 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 (int): The lower bound of the random range, inclusive.
2376
        high (int): The upper bound of the random range, inclusive.
2377
        mean (int): The mean return value.
2378
2379
    Returns:
2380
        int: A random weighted integer in the range ``mi`` <= n <= ``ma``.
2381
    """
2382
    return lib.TCOD_random_get_int_mean(
2383
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2384
2385
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...
2386
    """Return a random weighted float in the range: ``mi`` <= n <= ``ma``.
2387
2388
    The result is affacted by calls to :any:`random_set_distribution`.
2389
2390
    Args:
2391
        rnd (Optional[Random]): A Random instance, or None to use the default.
2392
        low (float): The lower bound of the random range, inclusive.
2393
        high (float): The upper bound of the random range, inclusive.
2394
        mean (float): The mean return value.
2395
2396
    Returns:
2397
        float: A random weighted double precision float
2398
               in the range ``mi`` <= n <= ``ma``.
2399
    """
2400
    return lib.TCOD_random_get_double_mean(
2401
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2402
2403
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...
2404
    """Return a random weighted float in the range: ``mi`` <= n <= ``ma``.
2405
2406
    .. deprecated:: 2.0
2407
        Use :any:`random_get_float_mean` instead.
2408
        Both funtions return a double precision float.
2409
    """
2410
    return lib.TCOD_random_get_double_mean(
2411
        rnd.random_c if rnd else ffi.NULL, mi, ma, mean)
2412
2413
def random_save(rnd):
2414
    """Return a copy of a random number generator.
2415
2416
    Args:
2417
        rnd (Optional[Random]): A Random instance, or None to use the default.
2418
2419
    Returns:
2420
        Random: A Random instance with a copy of the random generator.
2421
    """
2422
    return tcod.random.Random._new_from_cdata(
2423
        ffi.gc(
2424
            ffi.cast('mersenne_data_t*',
2425
                     lib.TCOD_random_save(rnd.random_c if rnd else ffi.NULL)),
2426
            lib.TCOD_random_delete),
2427
        )
2428
2429
def random_restore(rnd, backup):
2430
    """Restore a random number generator from a backed up copy.
2431
2432
    Args:
2433
        rnd (Optional[Random]): A Random instance, or None to use the default.
2434
        backup (Random): The Random instance which was used as a backup.
2435
    """
2436
    lib.TCOD_random_restore(rnd.random_c if rnd else ffi.NULL,
2437
                            backup.random_c)
2438
2439
def random_delete(rnd):
0 ignored issues
show
Unused Code introduced by
The argument rnd seems to be unused.
Loading history...
2440
    """Does nothing."""
2441
    pass
2442
2443
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...
2444
    lib.TCOD_struct_add_flag(struct, name)
2445
2446
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...
2447
    lib.TCOD_struct_add_property(struct, name, typ, mandatory)
2448
2449
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...
2450
    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...
2451
    cvalue_list = CARRAY()
2452
    for i, value in enumerate(value_list):
2453
        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...
2454
    cvalue_list[len(value_list)] = 0
2455
    lib.TCOD_struct_add_value_list(struct, name, cvalue_list, mandatory)
2456
2457
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...
2458
    lib.TCOD_struct_add_list_property(struct, name, typ, mandatory)
2459
2460
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...
2461
    lib.TCOD_struct_add_structure(struct, sub_struct)
2462
2463
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...
2464
    return _unpack_char_p(lib.TCOD_struct_get_name(struct))
2465
2466
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...
2467
    return lib.TCOD_struct_is_mandatory(struct, name)
2468
2469
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...
2470
    return lib.TCOD_struct_get_type(struct, name)
2471
2472
# high precision time functions
2473
def sys_set_fps(fps):
2474
    """Set the maximum frame rate.
2475
2476
    You can disable the frame limit again by setting fps to 0.
2477
2478
    Args:
2479
        fps (int): A frame rate limit (i.e. 60)
2480
    """
2481
    lib.TCOD_sys_set_fps(fps)
2482
2483
def sys_get_fps():
2484
    """Return the current frames per second.
2485
2486
    This the actual frame rate, not the frame limit set by
2487
    :any:`tcod.sys_set_fps`.
2488
2489
    This number is updated every second.
2490
2491
    Returns:
2492
        int: The currently measured frame rate.
2493
    """
2494
    return lib.TCOD_sys_get_fps()
2495
2496
def sys_get_last_frame_length():
2497
    """Return the delta time of the last rendered frame in seconds.
2498
2499
    Returns:
2500
        float: The delta time of the last rendered frame.
2501
    """
2502
    return lib.TCOD_sys_get_last_frame_length()
2503
2504
def sys_sleep_milli(val):
2505
    """Sleep for 'val' milliseconds.
2506
2507
    Args:
2508
        val (int): Time to sleep for in milliseconds.
2509
2510
    .. deprecated:: 2.0
2511
       Use :any:`time.sleep` instead.
2512
    """
2513
    lib.TCOD_sys_sleep_milli(val)
2514
2515
def sys_elapsed_milli():
2516
    """Get number of milliseconds since the start of the program.
2517
2518
    Returns:
2519
        int: Time since the progeam has started in milliseconds.
2520
2521
    .. deprecated:: 2.0
2522
       Use :any:`time.clock` instead.
2523
    """
2524
    return lib.TCOD_sys_elapsed_milli()
2525
2526
def sys_elapsed_seconds():
2527
    """Get number of seconds since the start of the program.
2528
2529
    Returns:
2530
        float: Time since the progeam has started in seconds.
2531
2532
    .. deprecated:: 2.0
2533
       Use :any:`time.clock` instead.
2534
    """
2535
    return lib.TCOD_sys_elapsed_seconds()
2536
2537
def sys_set_renderer(renderer):
2538
    """Change the current rendering mode to renderer.
2539
2540
    .. deprecated:: 2.0
2541
       RENDERER_GLSL and RENDERER_OPENGL are not currently available.
2542
    """
2543
    lib.TCOD_sys_set_renderer(renderer)
2544
2545
def sys_get_renderer():
2546
    """Return the current rendering mode.
2547
2548
    """
2549
    return lib.TCOD_sys_get_renderer()
2550
2551
# easy screenshots
2552
def sys_save_screenshot(name=None):
2553
    """Save a screenshot to a file.
2554
2555
    By default this will automatically save screenshots in the working
2556
    directory.
2557
2558
    The automatic names are formatted as screenshotNNN.png.  For example:
2559
    screenshot000.png, screenshot001.png, etc.  Whichever is available first.
2560
2561
    Args:
2562
        file Optional[AnyStr]: File path to save screenshot.
2563
    """
2564
    if name is not None:
2565
        name = _bytes(name)
2566
    lib.TCOD_sys_save_screenshot(name or ffi.NULL)
2567
2568
# custom fullscreen resolution
2569
def sys_force_fullscreen_resolution(width, height):
2570
    """Force a specific resolution in fullscreen.
2571
2572
    Will use the smallest available resolution so that:
2573
2574
    * resolution width >= width and
2575
      resolution width >= root console width * font char width
2576
    * resolution height >= height and
2577
      resolution height >= root console height * font char height
2578
2579
    Args:
2580
        width (int): The desired resolution width.
2581
        height (int): The desired resolution height.
2582
    """
2583
    lib.TCOD_sys_force_fullscreen_resolution(width, height)
2584
2585
def sys_get_current_resolution():
2586
    """Return the current resolution as (width, height)
2587
2588
    Returns:
2589
        Tuple[int,int]: The current resolution.
2590
    """
2591
    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...
2592
    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...
2593
    lib.TCOD_sys_get_current_resolution(w, h)
2594
    return w[0], h[0]
2595
2596
def sys_get_char_size():
2597
    """Return the current fonts character size as (width, height)
2598
2599
    Returns:
2600
        Tuple[int,int]: The current font glyph size in (width, height)
2601
    """
2602
    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...
2603
    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...
2604
    lib.TCOD_sys_get_char_size(w, h)
2605
    return w[0], h[0]
2606
2607
# update font bitmap
2608
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...
2609
    """Dynamically update the current frot with img.
2610
2611
    All cells using this asciiCode will be updated
2612
    at the next call to :any:`tcod.console_flush`.
2613
2614
    Args:
2615
        asciiCode (int): Ascii code corresponding to the character to update.
2616
        fontx (int): Left coordinate of the character
2617
                     in the bitmap font (in tiles)
2618
        fonty (int): Top coordinate of the character
2619
                     in the bitmap font (in tiles)
2620
        img (Image): An image containing the new character bitmap.
2621
        x (int): Left pixel of the character in the image.
2622
        y (int): Top pixel of the character in the image.
2623
    """
2624
    lib.TCOD_sys_update_char(_int(asciiCode), fontx, fonty, img, x, y)
2625
2626
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...
2627
    """Register a custom randering function with libtcod.
2628
2629
    Note:
2630
        This callback will only be called by the SDL renderer.
2631
2632
    The callack will receive a :any:`CData <ffi-cdata>` void* to an
2633
    SDL_Surface* struct.
2634
2635
    The callback is called on every call to :any:`tcod.console_flush`.
2636
2637
    Args:
2638
        callback Callable[[CData], None]:
2639
            A function which takes a single argument.
2640
    """
2641
    with _PropagateException() as propagate:
2642
        @ffi.def_extern(onerror=propagate)
2643
        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...
2644
            callback(sdl_surface)
2645
        lib.TCOD_sys_register_SDL_renderer(lib._pycall_sdl_hook)
2646
2647
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...
2648
    """Check for and return an event.
2649
2650
    Args:
2651
        mask (int): :any:`Event types` to wait for.
2652
        k (Optional[Key]): A tcod.Key instance which might be updated with
2653
                           an event.  Can be None.
2654
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
2655
                             with an event.  Can be None.
2656
    """
2657
    return lib.TCOD_sys_check_for_event(
2658
        mask, k.cdata if k else ffi.NULL, m.cdata if m else ffi.NULL)
2659
2660
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...
2661
    """Wait for an event then return.
2662
2663
    If flush is True then the buffer will be cleared before waiting. Otherwise
2664
    each available event will be returned in the order they're recieved.
2665
2666
    Args:
2667
        mask (int): :any:`Event types` to wait for.
2668
        k (Optional[Key]): A tcod.Key instance which might be updated with
2669
                           an event.  Can be None.
2670
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
2671
                             with an event.  Can be None.
2672
        flush (bool): Clear the event buffer before waiting.
2673
    """
2674
    return lib.TCOD_sys_wait_for_event(
2675
        mask, k.cdata if k else ffi.NULL, m.cdata if m else ffi.NULL, flush)
2676
2677
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...
2678
    return lib.TCOD_sys_clipboard_set(text.encode('utf-8'))
2679
2680
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...
2681
    return ffi.string(lib.TCOD_sys_clipboard_get()).decode('utf-8')
2682