Completed
Push — doc-style ( 67e2d5...5a50e0 )
by Kyle
01:25
created

console_fill_foreground()   C

Complexity

Conditions 7

Size

Total Lines 27

Duplication

Lines 27
Ratio 100 %

Importance

Changes 7
Bugs 1 Features 1
Metric Value
cc 7
c 7
b 1
f 1
dl 27
loc 27
rs 5.5
1
"""This module handles backward compatibility with the ctypes libtcodpy module.
2
"""
3
4
from __future__ import absolute_import as _
5
6
import threading as _threading
7
8
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...
9
10
from tcod.tcod import _int, _cdata, _unpack_char_p
11
from tcod.tcod import _bytes, _unicode, _fmt_bytes, _fmt_unicode
12
from tcod.tcod import _CDataWrapper
13
from tcod.tcod import _PropagateException
14
from tcod.tcod import BSP as Bsp
15
from tcod.tcod import Key, Mouse, HeightMap, Console, Image
0 ignored issues
show
Unused Code introduced by
Unused Image imported from tcod.tcod
Loading history...
16
17
class ConsoleBuffer(object):
18
    """Simple console that allows direct (fast) access to cells. simplifies
19
    use of the "fill" functions.
20
21
    Args:
22
        width (int): Width of the new ConsoleBuffer.
23
        height (int): Height of the new ConsoleBuffer.
24
        back_r (int): Red background color, from 0 to 255.
25
        back_g (int): Green background color, from 0 to 255.
26
        back_b (int): Blue background color, from 0 to 255.
27
        fore_r (int): Red foreground color, from 0 to 255.
28
        fore_g (int): Green foreground color, from 0 to 255.
29
        fore_b (int): Blue foreground color, from 0 to 255.
30
        char (AnyStr): A single character str or bytes object.
31
    """
32
    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/79).

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

Loading history...
33
        """initialize with given width and height. values to fill the buffer
34
        are optional, defaults to black with no characters.
35
        """
36
        n = width * height
0 ignored issues
show
Unused Code introduced by
The variable n seems to be unused.
Loading history...
37
        self.width = width
38
        self.height = height
39
        self.clear(back_r, back_g, back_b, fore_r, fore_g, fore_b, char)
40
41
    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/79).

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

Loading history...
42
        """Clears the console.  Values to fill it with are optional, defaults
43
        to black with no characters.
44
45
        Args:
46
            back_r (int): Red background color, from 0 to 255.
47
            back_g (int): Green background color, from 0 to 255.
48
            back_b (int): Blue background color, from 0 to 255.
49
            fore_r (int): Red foreground color, from 0 to 255.
50
            fore_g (int): Green foreground color, from 0 to 255.
51
            fore_b (int): Blue foreground color, from 0 to 255.
52
            char (AnyStr): A single character str or bytes object.
53
        """
54
        n = self.width * self.height
55
        self.back_r = [back_r] * n
56
        self.back_g = [back_g] * n
57
        self.back_b = [back_b] * n
58
        self.fore_r = [fore_r] * n
59
        self.fore_g = [fore_g] * n
60
        self.fore_b = [fore_b] * n
61
        self.char = [ord(char)] * n
62
63
    def copy(self):
64
        """Returns a copy of this ConsoleBuffer.
65
66
        Returns:
67
            ConsoleBuffer: A new ConsoleBuffer copy.
68
        """
69
        other = ConsoleBuffer(0, 0)
70
        other.width = self.width
71
        other.height = self.height
72
        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...
73
        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...
74
        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...
75
        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...
76
        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...
77
        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...
78
        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...
79
        return other
80
81
    def set_fore(self, x, y, r, g, b, char):
82
        """Set the character and foreground color of one cell.
83
84
        Args:
85
            x (int): X position to change.
86
            y (int): Y position to change.
87
            r (int): Red foreground color, from 0 to 255.
88
            g (int): Green foreground color, from 0 to 255.
89
            b (int): Blue foreground color, from 0 to 255.
90
            char (AnyStr): A single character str or bytes object.
91
        """
92
        i = self.width * y + x
93
        self.fore_r[i] = r
94
        self.fore_g[i] = g
95
        self.fore_b[i] = b
96
        self.char[i] = ord(char)
97
98
    def set_back(self, x, y, r, g, b):
99
        """Set the background color of one cell.
100
101
        Args:
102
            x (int): X position to change.
103
            y (int): Y position to change.
104
            r (int): Red background color, from 0 to 255.
105
            g (int): Green background color, from 0 to 255.
106
            b (int): Blue background color, from 0 to 255.
107
            char (AnyStr): A single character str or bytes object.
108
        """
109
        i = self.width * y + x
110
        self.back_r[i] = r
111
        self.back_g[i] = g
112
        self.back_b[i] = b
113
114
    def set(self, x, y, back_r, back_g, back_b, fore_r, fore_g, fore_b, char):
115
        """Set the background color, foreground color and character of one cell.
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (80/79).

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

Loading history...
116
117
        Args:
118
            x (int): X position to change.
119
            y (int): Y position to change.
120
            back_r (int): Red background color, from 0 to 255.
121
            back_g (int): Green background color, from 0 to 255.
122
            back_b (int): Blue background color, from 0 to 255.
123
            fore_r (int): Red foreground color, from 0 to 255.
124
            fore_g (int): Green foreground color, from 0 to 255.
125
            fore_b (int): Blue foreground color, from 0 to 255.
126
            char (AnyStr): A single character str or bytes object.
127
        """
128
        i = self.width * y + x
129
        self.back_r[i] = back_r
130
        self.back_g[i] = back_g
131
        self.back_b[i] = back_b
132
        self.fore_r[i] = fore_r
133
        self.fore_g[i] = fore_g
134
        self.fore_b[i] = fore_b
135
        self.char[i] = ord(char)
136
137
    def blit(self, dest, fill_fore=True, fill_back=True):
138
        """Use libtcod's "fill" functions to write the buffer to a console.
139
140
        Args:
141
            dest (Console): Console object to modify.
142
            fill_fore (bool):
143
                If True, fill the foreground color and characters.
144
            fill_back (bool):
145
                If True, fill the background color.
146
        """
147
        dest = _cdata(dest)
148
        if (console_get_width(dest) != self.width or
149
            console_get_height(dest) != self.height):
150
            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/79).

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

Loading history...
151
152
        if fill_back:
153
            lib.TCOD_console_fill_background(dest or ffi.NULL,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_fill_background.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
154
                                              ffi.new('int[]', self.back_r),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
155
                                              ffi.new('int[]', self.back_g),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
156
                                              ffi.new('int[]', self.back_b))
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
157
        if fill_fore:
158
            lib.TCOD_console_fill_foreground(dest or ffi.NULL,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_fill_foreground.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
159
                                              ffi.new('int[]', self.fore_r),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
160
                                              ffi.new('int[]', self.fore_g),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
161
                                              ffi.new('int[]', self.fore_b))
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
162
            lib.TCOD_console_fill_char(dest or ffi.NULL,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_fill_char.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
163
                                        ffi.new('int[]', self.char))
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
164
165
class Dice(_CDataWrapper):
166
    """
167
168
    Args:
169
        nb_dices (int): Number of dice.
170
        nb_faces (int): Number of sides on a die.
171
        multiplier (float): Multiplier.
172
        addsub (float): Addition.
173
174
    .. versionchanged:: 2.0
175
        This class now acts like the other CData wrapped classes
176
        and no longer acts like a list.
177
178
    .. deprecated:: 2.0
179
        You should make your own dice functions instead of using this class
180
        which is tied to a CData object.
181
    """
182
183
    def __init__(self, *args, **kargs):
184
        super(Dice, self).__init__(*args, **kargs)
185
        if self.cdata == ffi.NULL:
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
186
            self._init(*args, **kargs)
187
188
    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...
189
        self.cdata = ffi.new('TCOD_dice_t*')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
190
        self.nb_dices = nb_dices
191
        self.nb_faces = nb_faces
192
        self.multiplier = multiplier
193
        self.addsub = addsub
194
195
    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...
196
        return self.nb_rolls
197
    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...
198
        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...
199
    nb_dices = property(_get_nb_dices, _set_nb_dices)
200
201
    def __str__(self):
202
        add = '+(%s)' % self.addsub if self.addsub != 0 else ''
203
        return '%id%ix%s%s' % (self.nb_dices, self.nb_faces,
204
                               self.multiplier, add)
205
206
    def __repr__(self):
207
        return ('%s(nb_dices=%r,nb_faces=%r,multiplier=%r,addsub=%r)' %
208
                (self.__class__.__name__, self.nb_dices, self.nb_faces,
209
                 self.multiplier, self.addsub))
210
211
def bsp_new_with_size(x, y, w, h):
212
    """Create a new BSP instance with the given rectangle.
213
214
    Args:
215
        x (int): Rectangle left coordinate.
216
        y (int): Rectangle top coordinate.
217
        w (int): Rectangle width.
218
        h (int): Rectangle height.
219
220
    Returns:
221
        BSP: A new BSP instance.
222
223
    .. deprecated:: 2.0
224
       Call the :any:`BSP` class instead.
225
    """
226
    return Bsp(x, y, w, h)
227
228
def bsp_split_once(node, horizontal, position):
229
    """
230
    .. deprecated:: 2.0
231
       Use :any:`BSP.split_once` instead.
232
    """
233
    node.split_once('h' if horizontal else 'v', position)
234
235
def bsp_split_recursive(node, randomizer, nb, minHSize, minVSize, maxHRatio,
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...
236
                        maxVRatio):
237
    node.split_recursive(nb, minHSize, minVSize,
238
                         maxHRatio, maxVRatio, randomizer)
239
240
def bsp_resize(node, x, y, w, h):
241
    """
242
    .. deprecated:: 2.0
243
       Use :any:`BSP.resize` instead.
244
    """
245
    node.resize(x, y, w, h)
246
247
def bsp_left(node):
248
    """
249
    .. deprecated:: 2.0
250
       Use :any:`BSP.get_left` instead.
251
    """
252
    return node.get_left()
253
254
def bsp_right(node):
255
    """
256
    .. deprecated:: 2.0
257
       Use :any:`BSP.get_right` instead.
258
    """
259
    return node.get_right()
260
261
def bsp_father(node):
262
    """
263
    .. deprecated:: 2.0
264
       Use :any:`BSP.get_parent` instead.
265
    """
266
    return node.get_parent()
267
268
def bsp_is_leaf(node):
269
    """
270
    .. deprecated:: 2.0
271
       Use :any:`BSP.is_leaf` instead.
272
    """
273
    return node.is_leaf()
274
275
def bsp_contains(node, cx, cy):
276
    """
277
    .. deprecated:: 2.0
278
       Use :any:`BSP.contains` instead.
279
    """
280
    return node.contains(cx, cy)
281
282
def bsp_find_node(node, cx, cy):
283
    """
284
    .. deprecated:: 2.0
285
       Use :any:`BSP.find_node` instead.
286
    """
287
    return node.find_node(cx, cy)
288
289
def _bsp_traverse(node, func, callback, userData):
290
    """pack callback into a handle for use with the callback
291
    _pycall_bsp_callback
292
    """
293
    with _PropagateException() as propagate:
294
        handle = ffi.new_handle((callback, userData, propagate))
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new_handle.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
295
        func(node.cdata, lib._pycall_bsp_callback, handle)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named _pycall_bsp_callback.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
296
297
def bsp_traverse_pre_order(node, callback, userData=0):
298
    """Traverse this nodes hierarchy with a callback.
299
300
    .. deprecated:: 2.0
301
       Use :any:`BSP.walk` instead.
302
    """
303
    _bsp_traverse(node, lib.TCOD_bsp_traverse_pre_order, callback, userData)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_bsp_traverse_pre_order.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
304
305
def bsp_traverse_in_order(node, callback, userData=0):
306
    """Traverse this nodes hierarchy with a callback.
307
308
    .. deprecated:: 2.0
309
       Use :any:`BSP.walk` instead.
310
    """
311
    _bsp_traverse(node, lib.TCOD_bsp_traverse_in_order, callback, userData)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_bsp_traverse_in_order.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
312
313
def bsp_traverse_post_order(node, callback, userData=0):
314
    """Traverse this nodes hierarchy with a callback.
315
316
    .. deprecated:: 2.0
317
       Use :any:`BSP.walk` instead.
318
    """
319
    _bsp_traverse(node, lib.TCOD_bsp_traverse_post_order, callback, userData)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_bsp_traverse_post_order.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
320
321
def bsp_traverse_level_order(node, callback, userData=0):
322
    """Traverse this nodes hierarchy with a callback.
323
324
    .. deprecated:: 2.0
325
       Use :any:`BSP.walk` instead.
326
    """
327
    _bsp_traverse(node, lib.TCOD_bsp_traverse_level_order, callback, userData)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_bsp_traverse_level_order.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
328
329
def bsp_traverse_inverted_level_order(node, callback, userData=0):
330
    """Traverse this nodes hierarchy with a callback.
331
332
    .. deprecated:: 2.0
333
       Use :any:`BSP.walk` instead.
334
    """
335
    _bsp_traverse(node, lib.TCOD_bsp_traverse_inverted_level_order,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_bsp_traverse_inverted_level_order.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
336
                  callback, userData)
337
338
def bsp_remove_sons(node):
339
    """Delete all children of a given node.  Not recommended.
340
341
    .. note::
342
       This function will add unnecessary complexity to your code.
343
       Don't use it.
344
345
    .. deprecated:: 2.0
346
       BSP deletion is automatic.
347
    """
348
    node._invalidate_children()
349
    lib.TCOD_bsp_remove_sons(node.cdata)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_bsp_remove_sons.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
350
351
def bsp_delete(node):
0 ignored issues
show
Unused Code introduced by
The argument node seems to be unused.
Loading history...
352
    """Exists for backward compatibility.  Does nothing.
353
354
    BSP's created by this library are automatically garbage collected once
355
    there are no references to the tree.
356
    This function exists for backwards compatibility.
357
358
    .. deprecated:: 2.0
359
       BSP deletion is automatic.
360
    """
361
    pass
362
363
def color_lerp(c1, c2, a):
364
    """Return the linear interpolation between two colors.
365
366
    ``a`` is the interpolation value, with 0 returing ``c1``,
367
    1 returning ``c2``, and 0.5 returing a color halfway between both.
368
369
    Args:
370
        c1 (Union[Tuple[int, int, int], Sequence[int]]):
371
            The first color.  At a=0.
372
        c2 (Union[Tuple[int, int, int], Sequence[int]]):
373
            The second color.  At a=1.
374
        a (float): The interpolation value,
375
376
    Returns:
377
        Color: The interpolated Color.
378
    """
379
    return Color.from_cdata(lib.TCOD_color_lerp(c1, c2, a))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_color_lerp.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
380
381
def color_set_hsv(c, h, s, v):
382
    """Set a color using: hue, saturation, and value parameters.
383
384
    Does not return a new Color.  Instead the provided color is modified.
385
386
    Args:
387
        c (Color): Must be a color instance.
388
        h (float): Hue, from 0 to 1.
389
        s (float): Saturation, from 0 to 1.
390
        v (float): Value, from 0 to 1.
391
    """
392
    new_color = ffi.new('TCOD_color_t*')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
393
    lib.TCOD_color_set_HSV(new_color, h, s, v)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_color_set_HSV.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
394
    c.r = new_color.r
395
    c.g = new_color.g
396
    c.b = new_color.b
397
398
def color_get_hsv(c):
399
    """Return the (hue, saturation, value) of a color.
400
401
    Args:
402
        c (Union[Tuple[int, int, int], Sequence[int]]):
403
            An (r, g, b) sequence or Color instance.
404
405
    Returns:
406
        Tuple[float, float, float]:
407
            A tuple with (hue, saturation, value) values, from 0 to 1.
408
    """
409
    h = ffi.new('float *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
410
    s = ffi.new('float *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
411
    v = ffi.new('float *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
412
    lib.TCOD_color_get_HSV(c, h, s, v)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_color_get_HSV.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
413
    return h[0], s[0], v[0]
414
415
def color_scale_HSV(c, scoef, vcoef):
416
    """Scale a color's saturation and value.
417
418
    Does not return a new Color.  Instead the provided color is modified.
419
420
    Args:
421
        c (Color): Must be a Color instance.
422
        scoef (float): Saturation multiplier, from 0 to 1.
423
                       Use 1 to keep current saturation.
424
        vcoef (float): Value multiplier, from 0 to 1.
425
                       Use 1 to keep current value.
426
    """
427
    color_p = ffi.new('TCOD_color_t*')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
428
    color_p.r, color_p.g, color_p.b = c.r, c.g, c.b
429
    lib.TCOD_color_scale_HSV(color_p, scoef, vcoef)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_color_scale_HSV.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
430
    c.r, c.g, c.b = color_p.r, color_p.g, color_p.b
431
432
def color_gen_map(colors, indexes):
433
    """Return a smoothly defined scale of colors.
434
435
    If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
436
    will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
437
    All in-betweens will be filled with a gradient.
438
439
    Args:
440
        colors (Iterable[Union[Tuple[int, int, int], Sequence[int]]]):
441
            Array of colors to be sampled.
442
        indexes (Iterable[int]): A list of indexes.
443
444
    Returns:
445
        List[Color]: A list of Color instances.
446
447
    Example:
448
        >>> tcod.color_gen_map([(0, 0, 0), (255, 128, 0)], [0, 5])
449
        [Color(0,0,0), Color(51,25,0), Color(102,51,0), Color(153,76,0), \
450
Color(204,102,0), Color(255,128,0)]
451
    """
452
    ccolors = ffi.new('TCOD_color_t[]', colors)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
453
    cindexes = ffi.new('int[]', indexes)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
454
    cres = ffi.new('TCOD_color_t[]', max(indexes) + 1)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
455
    lib.TCOD_color_gen_map(cres, len(colors), ccolors, cindexes)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_color_gen_map.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
456
    return [Color.from_cdata(cdata) for cdata in cres]
457
458
_numpy = None
459
460
def _numpy_available():
461
    'check if numpy is available and lazily load it when needed'
462
    global _numpy
463
    if _numpy is None:
464
        try:
465
            import numpy as _numpy
0 ignored issues
show
Comprehensibility Bug introduced by
_numpy is re-defining a name which is already available in the outer-scope (previously defined on line 458).

It is generally a bad practice to shadow variables from the outer-scope. In most cases, this is done unintentionally and might lead to unexpected behavior:

param = 5

class Foo:
    def __init__(self, param):   # "param" would be flagged here
        self.param = param
Loading history...
466
        except ImportError:
467
            _numpy = False
468
    return _numpy
469
470
# initializing the console
471
def console_init_root(w, h, title, fullscreen=False,
472
                      renderer=RENDERER_SDL):
473
    """Set up the primary display and return the root console.
474
475
    Note:
476
        Currently only the SDL renderer is supported at the moment.
477
        Do not attempt to change it.
478
479
    Args:
480
        w (int): Width in character tiles for the root console.
481
        h (int): Height in character tiles for the root console.
482
        title (AnyStr):
483
            This string will be displayed on the created windows title bar.
484
        renderer: Rendering mode for libtcod to use.
485
486
    Returns:
487
        Console:
488
            Returns a special Console instance representing the root console.
489
    """
490
    lib.TCOD_console_init_root(w, h, _bytes(title), fullscreen, renderer)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_init_root.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
491
    return Console(ffi.NULL) # root console is null
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
492
493
494
def console_set_custom_font(fontFile, flags=FONT_LAYOUT_ASCII_INCOL,
495
                            nb_char_horiz=0, nb_char_vertic=0):
496
    """Load a custom font file.
497
498
    Call this before function before calling :any:`tcod.console_init_root`.
499
500
    Flags can be a mix of the following:
501
502
    * tcod.FONT_LAYOUT_ASCII_INCOL
503
    * tcod.FONT_LAYOUT_ASCII_INROW
504
    * tcod.FONT_TYPE_GREYSCALE
505
    * tcod.FONT_TYPE_GRAYSCALE
506
    * tcod.FONT_LAYOUT_TCOD
507
508
    Args:
509
        fontFile (AnyStr): Path to a font file.
510
        flags (int):
511
        nb_char_horiz (int):
512
        nb_char_vertic (int):
513
    """
514
    lib.TCOD_console_set_custom_font(_bytes(fontFile), flags,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_custom_font.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
515
                                     nb_char_horiz, nb_char_vertic)
516
517
518
def console_get_width(con):
519
    """Return the width of a console.
520
521
    Args:
522
        con (Console): Any Console instance.
523
524
    Returns:
525
        int: The width of a Console.
526
527
    .. deprecated:: 2.0
528
        Use `Console.get_width` instead.
529
    """
530
    return lib.TCOD_console_get_width(_cdata(con))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_width.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
531
532
def console_get_height(con):
533
    """Return the height of a console.
534
535
    Args:
536
        con (Console): Any Console instance.
537
538
    Returns:
539
        int: The height of a Console.
540
541
    .. deprecated:: 2.0
542
        Use `Console.get_hright` instead.
543
    """
544
    return lib.TCOD_console_get_height(_cdata(con))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_height.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
545
546
def console_map_ascii_code_to_font(asciiCode, fontCharX, fontCharY):
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...
547
    lib.TCOD_console_map_ascii_code_to_font(_int(asciiCode), fontCharX,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_map_ascii_code_to_font.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
548
                                                              fontCharY)
549
550
def console_map_ascii_codes_to_font(firstAsciiCode, nbCodes, fontCharX,
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...
551
                                    fontCharY):
552
    lib.TCOD_console_map_ascii_codes_to_font(_int(firstAsciiCode), nbCodes,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_map_ascii_codes_to_font.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
553
                                              fontCharX, fontCharY)
554
555
def console_map_string_to_font(s, fontCharX, fontCharY):
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...
556
    lib.TCOD_console_map_string_to_font_utf(_unicode(s), fontCharX, fontCharY)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_map_string_to_font_utf.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
557
558
def console_is_fullscreen():
559
    """Returns True if the display is fullscreen.
560
561
    Returns:
562
        bool: True if the display is fullscreen, otherwise False.
563
    """
564
    return bool(lib.TCOD_console_is_fullscreen())
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_is_fullscreen.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
565
566
def console_set_fullscreen(fullscreen):
567
    """Change the display to be fullscreen or windowed.
568
569
    Args:
570
        fullscreen (bool): Use True to change to fullscreen.
571
                           Use False to change to windowed.
572
    """
573
    lib.TCOD_console_set_fullscreen(fullscreen)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_fullscreen.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
574
575
def console_is_window_closed():
576
    """Returns True if the window has received and exit event."""
577
    return lib.TCOD_console_is_window_closed()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_is_window_closed.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
578
579
def console_set_window_title(title):
580
    """Change the current title bar string.
581
582
    Args:
583
        title (AnyStr): A string to change the title bar to.
584
    """
585
    lib.TCOD_console_set_window_title(_bytes(title))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_window_title.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
586
587
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...
588
    lib.TCOD_console_credits()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_credits.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
589
590
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...
591
    lib.TCOD_console_credits_reset()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_credits_reset.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
592
593
def console_credits_render(x, y, alpha):
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...
594
    return lib.TCOD_console_credits_render(x, y, alpha)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_credits_render.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
595
596
def console_flush():
597
    """Update the display to represent the root consoles current state."""
598
    lib.TCOD_console_flush()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_flush.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
599
600
# drawing on a console
601
def console_set_default_background(con, col):
602
    """Change the default background color for a console.
603
604
    Args:
605
        con (Console): Any Console instance.
606
        col (Union[Tuple[int, int, int], Sequence[int]]):
607
            An (r, g, b) sequence or Color instance.
608
    """
609
    lib.TCOD_console_set_default_background(_cdata(con), col)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_default_background.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
610
611
def console_set_default_foreground(con, col):
612
    """Change the default foreground color for a console.
613
614
    Args:
615
        con (Console): Any Console instance.
616
        col (Union[Tuple[int, int, int], Sequence[int]]):
617
            An (r, g, b) sequence or Color instance.
618
    """
619
    lib.TCOD_console_set_default_foreground(_cdata(con), col)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_default_foreground.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
620
621
def console_clear(con):
622
    """Reset a console to its default colors and the space character.
623
624
    Args:
625
        con (Console): Any Console instance.
626
627
    .. seealso::
628
       :any:`console_set_default_background`
629
       :any:`console_set_default_foreground`
630
    """
631
    return lib.TCOD_console_clear(_cdata(con))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_clear.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
632
633
def console_put_char(con, x, y, c, flag=BKGND_DEFAULT):
634
    """Draw the character c at x,y using the default colors and a blend mode.
635
636
    Args:
637
        con (Console): Any Console instance.
638
        x (int): Character x position from the left.
639
        y (int): Character y position from the top.
640
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
641
        flag (int): Blending mode to use, defaults to BKGND_DEFAULT.
642
    """
643
    lib.TCOD_console_put_char(_cdata(con), x, y, _int(c), flag)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_put_char.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
644
645
def console_put_char_ex(con, x, y, c, fore, back):
646
    """Draw the character c at x,y using the colors fore and back.
647
648
    Args:
649
        con (Console): Any Console instance.
650
        x (int): Character x position from the left.
651
        y (int): Character y position from the top.
652
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
653
        fore (Union[Tuple[int, int, int], Sequence[int]]):
654
            An (r, g, b) sequence or Color instance.
655
        back (Union[Tuple[int, int, int], Sequence[int]]):
656
            An (r, g, b) sequence or Color instance.
657
    """
658
    lib.TCOD_console_put_char_ex(_cdata(con), x, y,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_put_char_ex.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
659
                                 _int(c), fore, back)
660
661
def console_set_char_background(con, x, y, col, flag=BKGND_SET):
662
    """Change the background color of x,y to col using a blend mode.
663
664
    Args:
665
        con (Console): Any Console instance.
666
        x (int): Character x position from the left.
667
        y (int): Character y position from the top.
668
        col (Union[Tuple[int, int, int], Sequence[int]]):
669
            An (r, g, b) sequence or Color instance.
670
        flag (int): Blending mode to use, defaults to BKGND_SET.
671
    """
672
    lib.TCOD_console_set_char_background(_cdata(con), x, y, col, flag)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_char_background.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
673
674
def console_set_char_foreground(con, x, y, col):
675
    """Change the foreground color of x,y to col.
676
677
    Args:
678
        con (Console): Any Console instance.
679
        x (int): Character x position from the left.
680
        y (int): Character y position from the top.
681
        col (Union[Tuple[int, int, int], Sequence[int]]):
682
            An (r, g, b) sequence or Color instance.
683
    """
684
    lib.TCOD_console_set_char_foreground(_cdata(con), x, y, col)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_char_foreground.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
685
686
def console_set_char(con, x, y, c):
687
    """Change the character at x,y to c, keeping the current colors.
688
689
    Args:
690
        con (Console): Any Console instance.
691
        x (int): Character x position from the left.
692
        y (int): Character y position from the top.
693
        c (Union[int, AnyStr]): Character to draw, can be an integer or string.
694
    """
695
    lib.TCOD_console_set_char(_cdata(con), x, y, _int(c))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_char.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
696
697
def console_set_background_flag(con, flag):
698
    """Change the default blend mode for this console.
699
700
    Args:
701
        con (Console): Any Console instance.
702
        flag (int): Blend mode to use by default.
703
    """
704
    lib.TCOD_console_set_background_flag(_cdata(con), flag)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_background_flag.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
705
706
def console_get_background_flag(con):
707
    """Return this consoles current blend mode.
708
709
    Args:
710
        con (Console): Any Console instance.
711
    """
712
    return lib.TCOD_console_get_background_flag(_cdata(con))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_background_flag.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
713
714
def console_set_alignment(con, alignment):
715
    """Change this consoles current alignment mode.
716
717
    * tcod.LEFT
718
    * tcod.CENTER
719
    * tcod.RIGHT
720
721
    Args:
722
        con (Console): Any Console instance.
723
        alignment (int):
724
    """
725
    lib.TCOD_console_set_alignment(_cdata(con), alignment)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_alignment.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
726
727
def console_get_alignment(con):
728
    """Return this consoles current alignment mode.
729
730
    Args:
731
        con (Console): Any Console instance.
732
    """
733
    return lib.TCOD_console_get_alignment(_cdata(con))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_alignment.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
734
735
def console_print(con, x, y, fmt):
736
    """Print a color formatted string on a console.
737
738
    Args:
739
        con (Console): Any Console instance.
740
        x (int): Character x position from the left.
741
        y (int): Character y position from the top.
742
        fmt (AnyStr): A unicode or bytes string optionaly using color codes.
743
    """
744
    lib.TCOD_console_print_utf(_cdata(con), x, y, _fmt_unicode(fmt))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_print_utf.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
745
746
def console_print_ex(con, x, y, flag, alignment, fmt):
747
    """Print a string on a console using a blend mode and alignment mode.
748
749
    Args:
750
        con (Console): Any Console instance.
751
        x (int): Character x position from the left.
752
        y (int): Character y position from the top.
753
    """
754
    lib.TCOD_console_print_ex_utf(_cdata(con), x, y,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_print_ex_utf.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
755
                                   flag, alignment, _fmt_unicode(fmt))
756
757
def console_print_rect(con, x, y, w, h, fmt):
758
    """Print a string constrained to a rectangle.
759
760
    If h > 0 and the bottom of the rectangle is reached,
761
    the string is truncated. If h = 0,
762
    the string is only truncated if it reaches the bottom of the console.
763
764
765
766
    Returns:
767
        int: The number of lines of text once word-wrapped.
768
    """
769
    return lib.TCOD_console_print_rect_utf(_cdata(con), x, y, w, h,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_print_rect_utf.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
770
                                            _fmt_unicode(fmt))
771
772
def console_print_rect_ex(con, x, y, w, h, flag, alignment, fmt):
773
    """Print a string constrained to a rectangle with blend and alignment.
774
775
    Returns:
776
        int: The number of lines of text once word-wrapped.
777
    """
778
    return lib.TCOD_console_print_rect_ex_utf(_cdata(con), x, y, w, h,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_print_rect_ex_utf.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
779
                                              flag, alignment,
780
                                              _fmt_unicode(fmt))
781
782
def console_get_height_rect(con, x, y, w, h, fmt):
783
    """Return the height of this text once word-wrapped into this rectangle.
784
785
    Returns:
786
        int: The number of lines of text once word-wrapped.
787
    """
788
    return lib.TCOD_console_get_height_rect_utf(_cdata(con), x, y, w, h,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_height_rect_utf.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
789
                                                 _fmt_unicode(fmt))
790
791
def console_rect(con, x, y, w, h, clr, flag=BKGND_DEFAULT):
792
    """Draw a the background color on a rect optionally clearing the text.
793
794
    If clr is True the affected tiles are changed to space character.
795
    """
796
    lib.TCOD_console_rect(_cdata(con), x, y, w, h, clr, flag)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_rect.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
797
798
def console_hline(con, x, y, l, flag=BKGND_DEFAULT):
799
    """Draw a horizontal line on the console.
800
801
    This always uses the character 196, the horizontal line character.
802
    """
803
    lib.TCOD_console_hline(_cdata(con), x, y, l, flag)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_hline.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
804
805
def console_vline(con, x, y, l, flag=BKGND_DEFAULT):
806
    """Draw a vertical line on the console.
807
808
    This always uses the character 179, the vertical line character.
809
    """
810
    lib.TCOD_console_vline(_cdata(con), x, y, l, flag)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_vline.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
811
812
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/79).

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

Loading history...
813
    """Draw a framed rectangle with optinal text.
814
815
    This uses the default background color and blend mode to fill the
816
    rectangle and the default foreground to draw the outline.
817
818
    fmt will be printed on the inside of the rectangle, word-wrapped.
819
    """
820
    lib.TCOD_console_print_frame(_cdata(con), x, y, w, h, clear, flag,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_print_frame.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
821
                                  _fmt_bytes(fmt))
822
823
def console_set_color_control(con, fore, back):
824
    """Configure color control codes.
825
826
    Args:
827
        con (int): Color control constant to modify.
828
        fore (Union[Tuple[int, int, int], Sequence[int]]):
829
            An (r, g, b) sequence or Color instance.
830
        back (Union[Tuple[int, int, int], Sequence[int]]):
831
            An (r, g, b) sequence or Color instance.
832
    """
833
    lib.TCOD_console_set_color_control(_cdata(con), fore, back)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_color_control.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
834
835
def console_get_default_background(con):
836
    """Return this consoles default background color."""
837
    return Color.from_cdata(lib.TCOD_console_get_default_background(_cdata(con)))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (81/79).

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

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_default_background.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
838
839
def console_get_default_foreground(con):
840
    """Return this consoles default foreground color."""
841
    return Color.from_cdata(lib.TCOD_console_get_default_foreground(_cdata(con)))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (81/79).

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

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_default_foreground.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
842
843
def console_get_char_background(con, x, y):
844
    """Return the background color at the x,y of this console."""
845
    return Color.from_cdata(lib.TCOD_console_get_char_background(_cdata(con), x, y))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (84/79).

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

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_char_background.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
846
847
def console_get_char_foreground(con, x, y):
848
    """Return the foreground color at the x,y of this console."""
849
    return Color.from_cdata(lib.TCOD_console_get_char_foreground(_cdata(con), x, y))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (84/79).

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

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_char_foreground.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
850
851
def console_get_char(con, x, y):
852
    """Return the character at the x,y of this console."""
853
    return lib.TCOD_console_get_char(_cdata(con), x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_char.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
854
855
def console_set_fade(fade, fadingColor):
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...
856
    lib.TCOD_console_set_fade(fade, fadingColor)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_fade.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
857
858
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...
859
    return lib.TCOD_console_get_fade()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_fade.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
860
861
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...
862
    return Color.from_cdata(lib.TCOD_console_get_fading_color())
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_get_fading_color.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
863
864
# handling keyboard input
865
def console_wait_for_keypress(flush):
866
    """Block until the user presses a key, then returns a new Key.
867
868
    Args:
869
        flush bool: If True then the event queue is cleared before waiting
870
                    for the next event.
871
872
    Returns:
873
        Key: A new Key instance.
874
    """
875
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
876
    lib.TCOD_console_wait_for_keypress_wrapper(k.cdata, flush)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_wait_for_keypress_wrapper.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
877
    return k
878
879
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...
880
    k=Key()
0 ignored issues
show
Coding Style introduced by
Exactly one space required around assignment
k=Key()
^
Loading history...
881
    lib.TCOD_console_check_for_keypress_wrapper(k.cdata, flags)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_check_for_keypress_wrapper.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
882
    return k
883
884
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...
885
    return lib.TCOD_console_is_key_pressed(key)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_is_key_pressed.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
886
887
def console_set_keyboard_repeat(initial_delay, interval):
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...
888
    lib.TCOD_console_set_keyboard_repeat(initial_delay, interval)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_keyboard_repeat.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
889
890
def console_disable_keyboard_repeat():
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...
891
    lib.TCOD_console_disable_keyboard_repeat()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_disable_keyboard_repeat.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
892
893
# using offscreen consoles
894
def console_new(w, h):
895
    """Return an offscreen console of size: w,h."""
896
    return Console(ffi.gc(lib.TCOD_console_new(w, h), lib.TCOD_console_delete))
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
897
def console_from_file(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...
898
    return Console(lib.TCOD_console_from_file(_bytes(filename)))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_from_file.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
899
900
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...
901
    """Blit the console src from x,y,w,h to console dst at xdst,ydst."""
902
    lib.TCOD_console_blit(_cdata(src), x, y, w, h,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_blit.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
903
                          _cdata(dst), xdst, ydst, ffade, bfade)
904
905
def console_set_key_color(con, col):
906
    """Set a consoles blit transparent color."""
907
    lib.TCOD_console_set_key_color(_cdata(con), col)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_set_key_color.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
908
909
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...
910
    con = _cdata(con)
911
    if con == ffi.NULL:
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
912
        lib.TCOD_console_delete(con)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
913
914
# fast color filling
915 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...
916
    """Fill the foregound of a console with r,g,b.
917
918
    Args:
919
        con (Console): Any Console instance.
920
        r (Sequence[int]): An array of integers with a length of width*height.
921
        g (Sequence[int]): An array of integers with a length of width*height.
922
        b (Sequence[int]): An array of integers with a length of width*height.
923
    """
924
    if len(r) != len(g) or len(r) != len(b):
925
        raise TypeError('R, G and B must all have the same size.')
926
    if (_numpy_available() and isinstance(r, _numpy.ndarray) and
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ndarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
927
        isinstance(g, _numpy.ndarray) and isinstance(b, _numpy.ndarray)):
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ndarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
928
        #numpy arrays, use numpy's ctypes functions
929
        r = _numpy.ascontiguousarray(r, dtype=_numpy.intc)
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ascontiguousarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of bool does not seem to have a member named intc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
930
        g = _numpy.ascontiguousarray(g, dtype=_numpy.intc)
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ascontiguousarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of bool does not seem to have a member named intc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
931
        b = _numpy.ascontiguousarray(b, dtype=_numpy.intc)
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ascontiguousarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of bool does not seem to have a member named intc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
932
        cr = ffi.cast('int *', r.ctypes.data)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named cast.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
933
        cg = ffi.cast('int *', g.ctypes.data)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named cast.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
934
        cb = ffi.cast('int *', b.ctypes.data)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named cast.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
935
    else:
936
        # otherwise convert using ffi arrays
937
        cr = ffi.new('int[]', r)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
938
        cg = ffi.new('int[]', g)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
939
        cb = ffi.new('int[]', b)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
940
941
    lib.TCOD_console_fill_foreground(_cdata(con), cr, cg, cb)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_fill_foreground.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
942
943 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...
944
    """Fill the backgound of a console with r,g,b.
945
946
    Args:
947
        con (Console): Any Console instance.
948
        r (Sequence[int]): An array of integers with a length of width*height.
949
        g (Sequence[int]): An array of integers with a length of width*height.
950
        b (Sequence[int]): An array of integers with a length of width*height.
951
    """
952
    if len(r) != len(g) or len(r) != len(b):
953
        raise TypeError('R, G and B must all have the same size.')
954
    if (_numpy_available() and isinstance(r, _numpy.ndarray) and
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ndarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
955
        isinstance(g, _numpy.ndarray) and isinstance(b, _numpy.ndarray)):
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ndarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
956
        #numpy arrays, use numpy's ctypes functions
957
        r = _numpy.ascontiguousarray(r, dtype=_numpy.intc)
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ascontiguousarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of bool does not seem to have a member named intc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
958
        g = _numpy.ascontiguousarray(g, dtype=_numpy.intc)
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ascontiguousarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of bool does not seem to have a member named intc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
959
        b = _numpy.ascontiguousarray(b, dtype=_numpy.intc)
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ascontiguousarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of bool does not seem to have a member named intc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
960
        cr = ffi.cast('int *', r.ctypes.data)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named cast.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
961
        cg = ffi.cast('int *', g.ctypes.data)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named cast.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
962
        cb = ffi.cast('int *', b.ctypes.data)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named cast.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
963
    else:
964
        # otherwise convert using ffi arrays
965
        cr = ffi.new('int[]', r)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
966
        cg = ffi.new('int[]', g)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
967
        cb = ffi.new('int[]', b)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
968
969
    lib.TCOD_console_fill_background(_cdata(con), cr, cg, cb)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_fill_background.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
970
971
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...
972
    """Fill the character tiles of a console with an array.
973
974
    Args:
975
        con (Console): Any Console instance.
976
        arr (Sequence[int]): An array of integers with a length of width*height.
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (80/79).

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

Loading history...
977
    """
978
    if (_numpy_available() and isinstance(arr, _numpy.ndarray) ):
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after if.
Loading history...
Coding Style introduced by
No space allowed before bracket
if (_numpy_available() and isinstance(arr, _numpy.ndarray) ):
^
Loading history...
Bug introduced by
The Instance of bool does not seem to have a member named ndarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
979
        #numpy arrays, use numpy's ctypes functions
980
        arr = _numpy.ascontiguousarray(arr, dtype=_numpy.intc)
0 ignored issues
show
Bug introduced by
The Instance of bool does not seem to have a member named ascontiguousarray.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of bool does not seem to have a member named intc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
981
        carr = ffi.cast('int *', arr.ctypes.data)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named cast.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
982
    else:
983
        #otherwise convert using the ffi module
984
        carr = ffi.new('int[]', arr)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
985
986
    lib.TCOD_console_fill_char(_cdata(con), carr)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_fill_char.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
987
988
def console_load_asc(con, 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...
989
    return lib.TCOD_console_load_asc(_cdata(con), _bytes(filename))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_load_asc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
990
991
def console_save_asc(con, 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...
992
    lib.TCOD_console_save_asc(_cdata(con),_bytes(filename))
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_console_save_asc(_cdata(con),_bytes(filename))
^
Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_save_asc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
993
994
def console_load_apf(con, 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...
995
    return lib.TCOD_console_load_apf(_cdata(con),_bytes(filename))
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return lib.TCOD_console_load_apf(_cdata(con),_bytes(filename))
^
Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_load_apf.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
996
997
def console_save_apf(con, 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...
998
    lib.TCOD_console_save_apf(_cdata(con),_bytes(filename))
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_console_save_apf(_cdata(con),_bytes(filename))
^
Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_console_save_apf.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
999
1000
@ffi.def_extern()
1001
def _pycall_path_func(x1, y1, x2, y2, handle):
1002
    '''static float _pycall_path_func( int xFrom, int yFrom, int xTo, int yTo, void *user_data );
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (97/79).

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

Loading history...
1003
    '''
1004
    func, propagate_manager, user_data = ffi.from_handle(handle)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named from_handle.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1005
    try:
1006
        return func(x1, y1, x2, y2, *user_data)
1007
    except BaseException:
1008
        propagate_manager.propagate(*_sys.exc_info())
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable '_sys'
Loading history...
1009
        return None
1010
1011
def path_new_using_map(m, dcost=1.41):
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...
1012
    return (ffi.gc(lib.TCOD_path_new_using_map(m, dcost),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_new_using_map.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1013
                    lib.TCOD_path_delete), _PropagateException())
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1014
1015
def path_new_using_function(w, h, func, userData=0, dcost=1.41):
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...
1016
    propagator = _PropagateException()
1017
    handle = ffi.new_handle((func, propagator, (userData,)))
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new_handle.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1018
    return (ffi.gc(lib.TCOD_path_new_using_function(w, h, lib._pycall_path_func,
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (80/79).

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

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_new_using_function.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named _pycall_path_func.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1019
            handle, dcost), lib.TCOD_path_delete), propagator, handle)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1020
1021
def path_compute(p, ox, oy, dx, dy):
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...
1022
    with p[1]:
1023
        return lib.TCOD_path_compute(p[0], ox, oy, dx, dy)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_compute.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1024
1025
def path_get_origin(p):
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...
1026
    x = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1027
    y = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1028
    lib.TCOD_path_get_origin(p[0], x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_get_origin.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1029
    return x[0], y[0]
1030
1031
def path_get_destination(p):
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...
1032
    x = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1033
    y = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1034
    lib.TCOD_path_get_destination(p[0], x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_get_destination.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1035
    return x[0], y[0]
1036
1037
def path_size(p):
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...
1038
    return lib.TCOD_path_size(p[0])
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_size.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1039
1040
def path_reverse(p):
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...
1041
    lib.TCOD_path_reverse(p[0])
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_reverse.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1042
1043
def path_get(p, idx):
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...
1044
    x = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1045
    y = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1046
    lib.TCOD_path_get(p[0], idx, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_get.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1047
    return x[0], y[0]
1048
1049
def path_is_empty(p):
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...
1050
    return lib.TCOD_path_is_empty(p[0])
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_is_empty.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1051
1052
def path_walk(p, recompute):
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
    x = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1054
    y = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1055
    with p[1]:
1056
        if lib.TCOD_path_walk(p[0], x, y, recompute):
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_path_walk.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1057
            return x[0], y[0]
1058
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1059
1060
def path_delete(p):
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 p seems to be unused.
Loading history...
1061
    pass
1062
1063
def dijkstra_new(m, dcost=1.41):
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...
1064
    return (ffi.gc(lib.TCOD_dijkstra_new(m, dcost),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1065
                    lib.TCOD_dijkstra_delete), _PropagateException())
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1066
1067
def dijkstra_new_using_function(w, h, func, userData=0, dcost=1.41):
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...
1068
    propagator = _PropagateException()
1069
    handle = ffi.new_handle((func, propagator, (userData,)))
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new_handle.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1070
    return (ffi.gc(lib.TCOD_dijkstra_new_using_function(w, h,
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_new_using_function.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1071
                    lib._pycall_path_func, handle, dcost),
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named _pycall_path_func.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1072
                    lib.TCOD_dijkstra_delete), propagator, handle)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1073
1074
def dijkstra_compute(p, ox, oy):
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...
1075
    with p[1]:
1076
        lib.TCOD_dijkstra_compute(p[0], ox, oy)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_compute.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1077
1078
def dijkstra_path_set(p, x, y):
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...
1079
    return lib.TCOD_dijkstra_path_set(p[0], x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_path_set.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1080
1081
def dijkstra_get_distance(p, x, y):
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...
1082
    return lib.TCOD_dijkstra_get_distance(p[0], x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_get_distance.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1083
1084
def dijkstra_size(p):
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...
1085
    return lib.TCOD_dijkstra_size(p[0])
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_size.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1086
1087
def dijkstra_reverse(p):
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...
1088
    lib.TCOD_dijkstra_reverse(p[0])
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_reverse.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1089
1090
def dijkstra_get(p, idx):
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...
1091
    x = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1092
    y = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1093
    lib.TCOD_dijkstra_get(p[0], idx, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_get.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1094
    return x[0], y[0]
1095
1096
def dijkstra_is_empty(p):
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...
1097
    return lib.TCOD_dijkstra_is_empty(p[0])
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_is_empty.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1098
1099
def dijkstra_path_walk(p):
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...
1100
    x = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1101
    y = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1102
    if lib.TCOD_dijkstra_path_walk(p[0], x, y):
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_dijkstra_path_walk.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1103
        return x[0], y[0]
1104
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1105
1106
def dijkstra_delete(p):
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 p seems to be unused.
Loading history...
1107
    pass
1108
1109
def heightmap_new(w, h):
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...
1110
    return HeightMap(w, h)
1111
1112
def heightmap_set_value(hm, x, y, value):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

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

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

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

Loading history...
1113
    lib.TCOD_heightmap_set_value(hm.cdata, x, y, value)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_set_value.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1114
1115
def heightmap_add(hm, value):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

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

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

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

Loading history...
1116
    lib.TCOD_heightmap_add(hm.cdata, value)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_add.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1117
1118
def heightmap_scale(hm, value):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

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

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

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

Loading history...
1119
    lib.TCOD_heightmap_scale(hm.cdata, value)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_scale.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1120
1121
def heightmap_clear(hm):
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...
1122
    lib.TCOD_heightmap_clear(hm.cdata)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_clear.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1123
1124
def heightmap_clamp(hm, mi, ma):
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...
1125
    lib.TCOD_heightmap_clamp(hm.cdata, mi, ma)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_clamp.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1126
1127
def heightmap_copy(hm1, hm2):
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...
1128
    lib.TCOD_heightmap_copy(hm1.cdata, hm2.cdata)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_copy.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1129
1130
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 introduced by
This function should have a docstring.

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

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

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

Loading history...
1131
    lib.TCOD_heightmap_normalize(hm.cdata, mi, ma)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_normalize.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1132
1133
def heightmap_lerp_hm(hm1, hm2, hm3, coef):
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...
1134
    lib.TCOD_heightmap_lerp_hm(hm1.cdata, hm2.cdata, hm3.cdata, coef)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_lerp_hm.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1135
1136
def heightmap_add_hm(hm1, hm2, hm3):
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...
1137
    lib.TCOD_heightmap_add_hm(hm1.cdata, hm2.cdata, hm3.cdata)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_add_hm.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1138
1139
def heightmap_multiply_hm(hm1, hm2, hm3):
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...
1140
    lib.TCOD_heightmap_multiply_hm(hm1.cdata, hm2.cdata, hm3.cdata)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_multiply_hm.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1141
1142
def heightmap_add_hill(hm, x, y, radius, 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...
1143
    lib.TCOD_heightmap_add_hill(hm.cdata, x, y, radius, height)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_add_hill.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1144
1145
def heightmap_dig_hill(hm, x, y, radius, 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...
1146
    lib.TCOD_heightmap_dig_hill(hm.cdata, x, y, radius, height)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_dig_hill.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1147
1148
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/79).

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

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...
1149
    lib.TCOD_heightmap_rain_erosion(hm.cdata, nbDrops, erosionCoef,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_rain_erosion.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1150
                                     sedimentationCoef, rnd or ffi.NULL)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1151
1152
def heightmap_kernel_transform(hm, kernelsize, dx, dy, weight, minLevel,
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...
1153
                               maxLevel):
1154
    cdx = ffi.new('int[]', dx)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1155
    cdy = ffi.new('int[]', dy)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1156
    cweight = ffi.new('float[]', weight)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1157
    lib.TCOD_heightmap_kernel_transform(hm.cdata, kernelsize, cdx, cdy, cweight,
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (80/79).

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

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_kernel_transform.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1158
                                         minLevel, maxLevel)
1159
1160
def heightmap_add_voronoi(hm, nbPoints, nbCoef, coef, rnd=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...
1161
    ccoef = ffi.new('float[]', coef)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1162
    lib.TCOD_heightmap_add_voronoi(hm.cdata, nbPoints, nbCoef, ccoef, rnd or ffi.NULL)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (86/79).

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

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_add_voronoi.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1163
1164
def heightmap_add_fbm(hm, noise, mulx, muly, addx, addy, octaves, delta, scale):
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (80/79).

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

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...
1165
    lib.TCOD_heightmap_add_fbm(hm.cdata, noise, mulx, muly, addx, addy,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_add_fbm.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1166
                                octaves, delta, scale)
1167
def heightmap_scale_fbm(hm, noise, mulx, muly, addx, addy, octaves, delta,
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...
1168
                        scale):
1169
    lib.TCOD_heightmap_scale_fbm(hm.cdata, noise, mulx, muly, addx, addy,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_scale_fbm.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1170
                                  octaves, delta, scale)
1171
1172
def heightmap_dig_bezier(hm, px, py, startRadius, startDepth, endRadius,
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...
1173
                         endDepth):
1174
    #IARRAY = c_int * 4
1175
    cpx = ffi.new('int[4]', px)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1176
    cpy = ffi.new('int[4]', py)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1177
    lib.TCOD_heightmap_dig_bezier(hm.cdata, cpx, cpy, startRadius,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_dig_bezier.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1178
                                   startDepth, endRadius,
1179
                                   endDepth)
1180
1181
def heightmap_get_value(hm, x, y):
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...
1182
    return lib.TCOD_heightmap_get_value(hm.cdata, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_get_value.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1183
1184
def heightmap_get_interpolated_value(hm, x, y):
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...
1185
    return lib.TCOD_heightmap_get_interpolated_value(hm.cdata, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_get_interpolated_value.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1186
1187
def heightmap_get_slope(hm, x, y):
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...
1188
    return lib.TCOD_heightmap_get_slope(hm.cdata, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_get_slope.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1189
1190
def heightmap_get_normal(hm, x, y, waterLevel):
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...
1191
    #FARRAY = c_float * 3
1192
    cn = ffi.new('float[3]')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1193
    lib.TCOD_heightmap_get_normal(hm.cdata, x, y, cn, waterLevel)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_get_normal.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1194
    return tuple(cn)
1195
1196
def heightmap_count_cells(hm, mi, ma):
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...
1197
    return lib.TCOD_heightmap_count_cells(hm.cdata, mi, ma)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_count_cells.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1198
1199
def heightmap_has_land_on_border(hm, waterlevel):
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...
1200
    return lib.TCOD_heightmap_has_land_on_border(hm.cdata, waterlevel)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_has_land_on_border.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1201
1202
def heightmap_get_minmax(hm):
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...
1203
    mi = ffi.new('float *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1204
    ma = ffi.new('float *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1205
    lib.TCOD_heightmap_get_minmax(hm.cdata, mi, ma)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_heightmap_get_minmax.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1206
    return mi[0], ma[0]
1207
1208
def heightmap_delete(hm):
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 hm seems to be unused.
Loading history...
1209
    pass
1210
1211
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...
1212
    return ffi.gc(lib.TCOD_image_new(width, height), lib.TCOD_image_delete)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1213
1214
def image_clear(image,col):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def image_clear(image,col):
^
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...
1215
    lib.TCOD_image_clear(image,col)
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_image_clear(image,col)
^
Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_clear.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1216
1217
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...
1218
    lib.TCOD_image_invert(image)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_invert.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1219
1220
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...
1221
    lib.TCOD_image_hflip(image)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_hflip.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1222
1223
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...
1224
    lib.TCOD_image_rotate90(image,num)
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_image_rotate90(image,num)
^
Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_rotate90.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1225
1226
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...
1227
    lib.TCOD_image_vflip(image)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_vflip.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1228
1229
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...
1230
    lib.TCOD_image_scale(image, neww, newh)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_scale.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1231
1232
def image_set_key_color(image,col):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def image_set_key_color(image,col):
^
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...
1233
    lib.TCOD_image_set_key_color(image, col)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_set_key_color.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1234
1235
def image_get_alpha(image,x,y):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def image_get_alpha(image,x,y):
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
def image_get_alpha(image,x,y):
^
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...
1236
    return lib.TCOD_image_get_alpha(image, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_get_alpha.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1237
1238
def image_is_pixel_transparent(image,x,y):
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
def image_is_pixel_transparent(image,x,y):
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
def image_is_pixel_transparent(image,x,y):
^
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...
1239
    return lib.TCOD_image_is_pixel_transparent(image, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_is_pixel_transparent.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1240
1241
def image_load(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...
1242
    return ffi.gc(lib.TCOD_image_load(_bytes(filename)),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_load.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1243
                   lib.TCOD_image_delete)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1244
1245
def image_from_console(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...
1246
    return ffi.gc(lib.TCOD_image_from_console(_cdata(console)),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_from_console.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1247
                   lib.TCOD_image_delete)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1248
1249
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...
1250
    lib.TCOD_image_refresh_console(image, _cdata(console))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_refresh_console.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1251
1252
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...
1253
    w = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1254
    h = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1255
    lib.TCOD_image_get_size(image, w, h)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_get_size.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1256
    return w[0], h[0]
1257
1258
def image_get_pixel(image, x, y):
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...
1259
    return lib.TCOD_image_get_pixel(image, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_get_pixel.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1260
1261
def image_get_mipmap_pixel(image, x0, y0, x1, y1):
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...
1262
    return lib.TCOD_image_get_mipmap_pixel(image, x0, y0, x1, y1)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_get_mipmap_pixel.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1263
1264
def image_put_pixel(image, x, y, 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...
1265
    lib.TCOD_image_put_pixel(image, x, y, col)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_put_pixel.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1266
    ##lib.TCOD_image_put_pixel_wrapper(image, x, y, col)
1267
1268
def image_blit(image, console, x, y, bkgnd_flag, scalex, scaley, angle):
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...
1269
    lib.TCOD_image_blit(image, _cdata(console), x, y, bkgnd_flag,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_blit.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1270
                         scalex, scaley, angle)
1271
1272
def image_blit_rect(image, console, x, y, w, h, bkgnd_flag):
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...
1273
    lib.TCOD_image_blit_rect(image, _cdata(console), x, y, w, h, bkgnd_flag)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_blit_rect.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1274
1275
def image_blit_2x(image, console, dx, dy, sx=0, sy=0, w=-1, h=-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...
1276
    lib.TCOD_image_blit_2x(image, _cdata(console), dx,dy,sx,sy,w,h)
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_image_blit_2x(image, _cdata(console), dx,dy,sx,sy,w,h)
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_image_blit_2x(image, _cdata(console), dx,dy,sx,sy,w,h)
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_image_blit_2x(image, _cdata(console), dx,dy,sx,sy,w,h)
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_image_blit_2x(image, _cdata(console), dx,dy,sx,sy,w,h)
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_image_blit_2x(image, _cdata(console), dx,dy,sx,sy,w,h)
^
Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_blit_2x.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1277
1278
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...
1279
    lib.TCOD_image_save(image, _bytes(filename))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_image_save.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1280
1281
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...
1282
    pass
1283
1284
def line_init(xo, yo, xd, yd):
1285
    """Initilize a line whose points will be returned by `line_step`.
1286
1287
    This function does not return anything on its own.
1288
1289
    Does not include the origin point.
1290
1291
    Args:
1292
        xo (int): X starting point.
1293
        yo (int): Y starting point.
1294
        xd (int): X destination point.
1295
        yd (int): Y destination point.
1296
1297
    .. deprecated:: 2.0
1298
       Use `line_iter` instead.
1299
    """
1300
    lib.TCOD_line_init(xo, yo, xd, yd)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_line_init.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1301
1302
def line_step():
1303
    """After calling line_init returns (x, y) points of the line.
1304
1305
    Once all points are exhausted this function will return (None, None)
1306
1307
    Returns:
1308
        Union[Tuple[int, int], Tuple[None, None]]:
1309
            The next (x, y) point of the line setup by line_init,
1310
            or (None, None) if there are no more points.
1311
1312
    .. deprecated:: 2.0
1313
       Use `line_iter` instead.
1314
    """
1315
    x = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1316
    y = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1317
    ret = lib.TCOD_line_step(x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_line_step.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1318
    if not ret:
1319
        return x[0], y[0]
1320
    return None,None
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return None,None
^
Loading history...
1321
1322
_line_listener_lock = _threading.Lock()
1323
1324
def line(xo, yo, xd, yd, py_callback):
1325
    """ Iterate over a line using a callback function.
1326
1327
    Your callback function will take x and y parameters and return True to
1328
    continue iteration or False to stop iteration and return.
1329
1330
    This function includes both the start and end points.
1331
1332
    Args:
1333
        xo (int): X starting point.
1334
        yo (int): Y starting point.
1335
        xd (int): X destination point.
1336
        yd (int): Y destination point.
1337
        py_callback (Callable[[int, int], bool]):
1338
            A callback which takes x and y parameters and returns bool.
1339
1340
    Returns:
1341
        bool: False if the callback cancels the line interation by
1342
              returning False or None, otherwise True.
1343
1344
    .. deprecated:: 2.0
1345
       Use `line_iter` instead.
1346
    """
1347
    with _PropagateException() as propagate:
1348
        with _line_listener_lock:
1349
            @ffi.def_extern(onerror=propagate)
1350
            def _pycall_line_listener(x, y):
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 variable _pycall_line_listener seems to be unused.
Loading history...
1351
                return py_callback(x, y)
1352
            return bool(lib.TCOD_line(xo, yo, xd, yd,
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_line.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1353
                                       lib._pycall_line_listener))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named _pycall_line_listener.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1354
1355
def line_iter(xo, yo, xd, yd):
1356
    """ returns an iterator
1357
1358
    This iterator does not include the origin point.
1359
1360
    Args:
1361
        xo (int): X starting point.
1362
        yo (int): Y starting point.
1363
        xd (int): X destination point.
1364
        yd (int): Y destination point.
1365
1366
    Returns:
1367
        Iterator[Tuple[int,int]]: An iterator of (x,y) points.
1368
    """
1369
    data = ffi.new('TCOD_bresenham_data_t *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1370
    lib.TCOD_line_init_mt(xo, yo, xd, yd, data)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_line_init_mt.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1371
    x = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1372
    y = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1373
    done = False
0 ignored issues
show
Unused Code introduced by
The variable done seems to be unused.
Loading history...
1374
    while not lib.TCOD_line_step_mt(x, y, data):
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_line_step_mt.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1375
        yield (x[0], y[0])
1376
1377
FOV_BASIC = 0
1378
FOV_DIAMOND = 1
1379
FOV_SHADOW = 2
1380
FOV_PERMISSIVE_0 = 3
1381
FOV_PERMISSIVE_1 = 4
1382
FOV_PERMISSIVE_2 = 5
1383
FOV_PERMISSIVE_3 = 6
1384
FOV_PERMISSIVE_4 = 7
1385
FOV_PERMISSIVE_5 = 8
1386
FOV_PERMISSIVE_6 = 9
1387
FOV_PERMISSIVE_7 = 10
1388
FOV_PERMISSIVE_8 = 11
1389
FOV_RESTRICTIVE = 12
1390
NB_FOV_ALGORITHMS = 13
1391
1392
def map_new(w, h):
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...
1393
    return ffi.gc(lib.TCOD_map_new(w, h), lib.TCOD_map_delete)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1394
1395
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...
1396
    return lib.TCOD_map_copy(source, dest)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_copy.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1397
1398
def map_set_properties(m, x, y, isTrans, isWalk):
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...
1399
    lib.TCOD_map_set_properties(m, x, y, isTrans, isWalk)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_set_properties.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1400
1401
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 introduced by
This function should have a docstring.

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

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

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

Loading history...
1402
    lib.TCOD_map_clear(m, walkable, transparent)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_clear.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1403
1404
def map_compute_fov(m, x, y, radius=0, light_walls=True, algo=FOV_RESTRICTIVE ):
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (80/79).

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

Loading history...
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 introduced by
This function should have a docstring.

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

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

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

Loading history...
1405
    lib.TCOD_map_compute_fov(m, x, y, radius, light_walls, algo)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_compute_fov.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1406
1407
def map_is_in_fov(m, x, y):
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...
1408
    return lib.TCOD_map_is_in_fov(m, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_is_in_fov.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1409
1410
def map_is_transparent(m, x, y):
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...
1411
    return lib.TCOD_map_is_transparent(m, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_is_transparent.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1412
1413
def map_is_walkable(m, x, y):
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...
1414
    return lib.TCOD_map_is_walkable(m, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_is_walkable.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1415
1416
def map_delete(m):
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 m seems to be unused.
Loading history...
1417
    pass
1418
1419
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...
1420
    return lib.TCOD_map_get_width(map)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_get_width.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1421
1422
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...
1423
    return lib.TCOD_map_get_height(map)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_map_get_height.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1424
1425
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...
1426
    lib.TCOD_mouse_show_cursor(visible)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_mouse_show_cursor.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1427
1428
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...
1429
    return lib.TCOD_mouse_is_cursor_visible()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_mouse_is_cursor_visible.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1430
1431
def mouse_move(x, y):
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...
1432
    lib.TCOD_mouse_move(x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_mouse_move.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1433
1434
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...
1435
    return Mouse(lib.TCOD_mouse_get_status())
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_mouse_get_status.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1436
1437
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...
1438
    lib.TCOD_namegen_parse(_bytes(filename), random or ffi.NULL)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_namegen_parse.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1439
1440
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...
1441
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name), False))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_namegen_generate.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1442
1443
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...
1444
    return _unpack_char_p(lib.TCOD_namegen_generate(_bytes(name),
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_namegen_generate.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1445
                                                     _bytes(rule), False))
1446
1447
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...
1448
    sets = lib.TCOD_namegen_get_sets()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_namegen_get_sets.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1449
    try:
1450
        lst = []
1451
        while not lib.TCOD_list_is_empty(sets):
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_list_is_empty.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1452
            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/79).

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

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named cast.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_list_pop.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1453
    finally:
1454
        lib.TCOD_list_delete(sets)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_list_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1455
    return lst
1456
1457
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...
1458
    lib.TCOD_namegen_destroy()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_namegen_destroy.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1459
1460
def noise_new(dim, h=NOISE_DEFAULT_HURST, l=NOISE_DEFAULT_LACUNARITY,
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...
1461
        random=None):
1462
    return ffi.gc(lib.TCOD_noise_new(dim, h, l, random or ffi.NULL),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_noise_new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1463
                   lib.TCOD_noise_delete)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_noise_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1464
1465
def noise_set_type(n, typ):
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...
1466
    lib.TCOD_noise_set_type(n,typ)
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
lib.TCOD_noise_set_type(n,typ)
^
Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_noise_set_type.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1467
1468
def noise_get(n, f, typ=NOISE_DEFAULT):
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...
1469
    return lib.TCOD_noise_get_ex(n, ffi.new('float[]', f), typ)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_noise_get_ex.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1470
1471
def noise_get_fbm(n, f, oc, typ=NOISE_DEFAULT):
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...
1472
    return lib.TCOD_noise_get_fbm_ex(n, ffi.new('float[]', f), oc, typ)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_noise_get_fbm_ex.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1473
1474
def noise_get_turbulence(n, f, oc, typ=NOISE_DEFAULT):
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...
1475
    return lib.TCOD_noise_get_turbulence_ex(n, ffi.new('float[]', f), oc, typ)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_noise_get_turbulence_ex.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1476
1477
def noise_delete(n):
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 n seems to be unused.
Loading history...
1478
    pass
1479
1480
_chr = chr
1481
try:
1482
    _chr = unichr # Python 2
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'unichr'
Loading history...
1483
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...
1484
    pass
1485
1486
def _unpack_union(type, union):
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...
1487
    '''
1488
        unpack items from parser new_property (value_converter)
1489
    '''
1490
    if type == lib.TCOD_TYPE_BOOL:
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_BOOL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1491
        return bool(union.b)
1492
    elif type == lib.TCOD_TYPE_CHAR:
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_CHAR.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1493
        return _unicode(union.c)
1494
    elif type == lib.TCOD_TYPE_INT:
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_INT.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1495
        return union.i
1496
    elif type == lib.TCOD_TYPE_FLOAT:
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_FLOAT.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1497
        return union.f
1498
    elif (type == lib.TCOD_TYPE_STRING or
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_STRING.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1499
         lib.TCOD_TYPE_VALUELIST15 >= type >= lib.TCOD_TYPE_VALUELIST00):
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_VALUELIST15.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_VALUELIST00.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1500
         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...
1501
    elif type == lib.TCOD_TYPE_COLOR:
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_COLOR.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1502
        return Color.from_cdata(union.col)
1503
    elif type == lib.TCOD_TYPE_DICE:
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_DICE.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1504
        return Dice(union.dice)
1505
    elif type & lib.TCOD_TYPE_LIST:
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_TYPE_LIST.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1506
        return _convert_TCODList(union.list, type & 0xFF)
1507
    else:
1508
        raise RuntimeError('Unknown libtcod type: %i' % type)
1509
1510
def _convert_TCODList(clist, 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...
1511
    return [_unpack_union(type, lib.TDL_list_get_union(clist, i))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TDL_list_get_union.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1512
            for i in range(lib.TCOD_list_size(clist))]
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_list_size.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1513
1514
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...
1515
    return ffi.gc(lib.TCOD_parser_new(), lib.TCOD_parser_delete)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1516
1517
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...
1518
    return lib.TCOD_parser_new_struct(parser, name)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_new_struct.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1519
1520
# prevent multiple threads from messing with def_extern callbacks
1521
_parser_callback_lock = _threading.Lock()
1522
1523
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...
1524
    if not listener:
1525
        lib.TCOD_parser_run(parser, _bytes(filename), ffi.NULL)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_run.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1526
        return
1527
1528
    propagate_manager = _PropagateException()
1529
    propagate = propagate_manager.propagate
1530
1531
    with _parser_callback_lock:
1532
        clistener = ffi.new('TCOD_parser_listener_t *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1533
1534
        @ffi.def_extern(onerror=propagate)
1535
        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...
1536
            return listener.end_struct(struct, _unpack_char_p(name))
1537
1538
        @ffi.def_extern(onerror=propagate)
1539
        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...
1540
            return listener.new_flag(_unpack_char_p(name))
1541
1542
        @ffi.def_extern(onerror=propagate)
1543
        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...
1544
            return listener.new_property(_unpack_char_p(propname), type,
1545
                                         _unpack_union(type, value))
1546
1547
        @ffi.def_extern(onerror=propagate)
1548
        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...
1549
            return listener.end_struct(struct, _unpack_char_p(name))
1550
1551
        @ffi.def_extern(onerror=propagate)
1552
        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...
1553
            listener.error(_unpack_char_p(msg))
1554
1555
        clistener.new_struct = lib.pycall_parser_new_struct
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named pycall_parser_new_struct.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1556
        clistener.new_flag = lib.pycall_parser_new_flag
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named pycall_parser_new_flag.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1557
        clistener.new_property = lib.pycall_parser_new_property
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named pycall_parser_new_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1558
        clistener.end_struct = lib.pycall_parser_end_struct
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named pycall_parser_end_struct.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1559
        clistener.error = lib.pycall_parser_error
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named pycall_parser_error.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1560
1561
        with propagate_manager:
1562
            lib.TCOD_parser_run(parser, _bytes(filename), clistener)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_run.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1563
1564
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...
1565
    pass
1566
1567
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...
1568
    return bool(lib.TCOD_parser_get_bool_property(parser, _bytes(name)))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_get_bool_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1569
1570
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...
1571
    return lib.TCOD_parser_get_int_property(parser, _bytes(name))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_get_int_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1572
1573
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...
1574
    return _chr(lib.TCOD_parser_get_char_property(parser, _bytes(name)))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_get_char_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1575
1576
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...
1577
    return lib.TCOD_parser_get_float_property(parser, _bytes(name))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_get_float_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1578
1579
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...
1580
    return _unpack_char_p(lib.TCOD_parser_get_string_property(parser, _bytes(name)))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (84/79).

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

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_get_string_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1581
1582
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...
1583
    return Color.from_cdata(lib.TCOD_parser_get_color_property(parser, _bytes(name)))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (85/79).

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

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_get_color_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1584
1585
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...
1586
    d = ffi.new('TCOD_dice_t *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1587
    lib.TCOD_parser_get_dice_property_py(parser, _bytes(name), d)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_get_dice_property_py.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1588
    return Dice(d)
1589
1590
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...
1591
    clist = lib.TCOD_parser_get_list_property(parser, _bytes(name), type)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_parser_get_list_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1592
    return _convert_TCODList(clist, type)
1593
1594
RNG_MT = 0
1595
RNG_CMWC = 1
1596
1597
DISTRIBUTION_LINEAR = 0
1598
DISTRIBUTION_GAUSSIAN = 1
1599
DISTRIBUTION_GAUSSIAN_RANGE = 2
1600
DISTRIBUTION_GAUSSIAN_INVERSE = 3
1601
DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = 4
1602
1603
def random_get_instance():
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...
1604
    return lib.TCOD_random_get_instance()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_get_instance.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1605
1606
def random_new(algo=RNG_CMWC):
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...
1607
    return ffi.gc(lib.TCOD_random_new(algo), lib.TCOD_random_delete)
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1608
1609
def random_new_from_seed(seed, algo=RNG_CMWC):
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...
1610
    return ffi.gc(lib.TCOD_random_new_from_seed(algo, seed),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_new_from_seed.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1611
                   lib.TCOD_random_delete)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1612
1613
def random_set_distribution(rnd, dist):
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...
1614
	lib.TCOD_random_set_distribution(rnd or ffi.NULL, dist)
0 ignored issues
show
Coding Style introduced by
Found indentation with tabs instead of spaces
Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_set_distribution.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1615
1616
def random_get_int(rnd, mi, ma):
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...
1617
    return lib.TCOD_random_get_int(rnd or ffi.NULL, mi, ma)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_get_int.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1618
1619
def random_get_float(rnd, mi, ma):
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...
1620
    return lib.TCOD_random_get_float(rnd or ffi.NULL, mi, ma)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_get_float.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1621
1622
def random_get_double(rnd, mi, ma):
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...
1623
    return lib.TCOD_random_get_double(rnd or ffi.NULL, mi, ma)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_get_double.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1624
1625
def random_get_int_mean(rnd, mi, ma, mean):
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...
1626
    return lib.TCOD_random_get_int_mean(rnd or ffi.NULL, mi, ma, mean)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_get_int_mean.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1627
1628
def random_get_float_mean(rnd, mi, ma, mean):
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...
1629
    return lib.TCOD_random_get_float_mean(rnd or ffi.NULL, mi, ma, mean)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_get_float_mean.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1630
1631
def random_get_double_mean(rnd, mi, ma, mean):
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...
1632
    return lib.TCOD_random_get_double_mean(rnd or ffi.NULL, mi, ma, mean)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_get_double_mean.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1633
1634
def random_save(rnd):
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...
1635
    return ffi.gc(lib.TCOD_random_save(rnd or ffi.NULL),
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named gc.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_save.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1636
                   lib.TCOD_random_delete)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_delete.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1637
1638
def random_restore(rnd, backup):
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...
1639
    lib.TCOD_random_restore(rnd or ffi.NULL, backup)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_random_restore.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1640
1641
def random_delete(rnd):
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 rnd seems to be unused.
Loading history...
1642
    pass
1643
1644
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...
1645
    lib.TCOD_struct_add_flag(struct, name)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_struct_add_flag.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1646
1647
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...
1648
    lib.TCOD_struct_add_property(struct, name, typ, mandatory)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_struct_add_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1649
1650
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...
1651
    CARRAY = c_char_p * (len(value_list) + 1)
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'c_char_p'
Loading history...
1652
    cvalue_list = CARRAY()
1653
    for i in range(len(value_list)):
1654
        cvalue_list[i] = cast(value_list[i], 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...
1655
    cvalue_list[len(value_list)] = 0
1656
    lib.TCOD_struct_add_value_list(struct, name, cvalue_list, mandatory)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_struct_add_value_list.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1657
1658
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...
1659
    lib.TCOD_struct_add_list_property(struct, name, typ, mandatory)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_struct_add_list_property.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1660
1661
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...
1662
    lib.TCOD_struct_add_structure(struct, sub_struct)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_struct_add_structure.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1663
1664
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...
1665
    return _unpack_char_p(lib.TCOD_struct_get_name(struct))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_struct_get_name.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1666
1667
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...
1668
    return lib.TCOD_struct_is_mandatory(struct, name)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_struct_is_mandatory.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1669
1670
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...
1671
    return lib.TCOD_struct_get_type(struct, name)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_struct_get_type.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1672
1673
# high precision time functions
1674
def sys_set_fps(fps):
1675
    """Set the maximum frame rate.
1676
1677
    You can disable the frame limit again by setting fps to 0.
1678
1679
    Args:
1680
        fps (int): A frame rate limit (i.e. 60)
1681
    """
1682
    lib.TCOD_sys_set_fps(fps)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_set_fps.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1683
1684
def sys_get_fps():
1685
    """Return the current frames per second.
1686
1687
    This the actual frame rate, not the frame limit set by
1688
    :any:`tcod.sys_set_fps`.
1689
1690
    This number is updated every second.
1691
1692
    Returns:
1693
        int: The currently measured frame rate.
1694
    """
1695
    return lib.TCOD_sys_get_fps()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_get_fps.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1696
1697
def sys_get_last_frame_length():
1698
    """Return the delta time of the last rendered frame in seconds.
1699
1700
    Returns:
1701
        float: The delta time of the last rendered frame.
1702
    """
1703
    return lib.TCOD_sys_get_last_frame_length()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_get_last_frame_length.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1704
1705
def sys_sleep_milli(val):
1706
    """Sleep for 'val' milliseconds.
1707
1708
    Args:
1709
        val (int): Time to sleep for in milliseconds.
1710
1711
    .. deprecated:: 2.0
1712
       Use :any:`time.sleep` instead.
1713
    """
1714
    lib.TCOD_sys_sleep_milli(val)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_sleep_milli.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1715
1716
def sys_elapsed_milli():
1717
    """Get number of milliseconds since the start of the program.
1718
1719
    Returns:
1720
        int: Time since the progeam has started in milliseconds.
1721
1722
    .. deprecated:: 2.0
1723
       Use :any:`time.clock` instead.
1724
    """
1725
    return lib.TCOD_sys_elapsed_milli()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_elapsed_milli.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1726
1727
def sys_elapsed_seconds():
1728
    """Get number of seconds since the start of the program.
1729
1730
    Returns:
1731
        float: Time since the progeam has started in seconds.
1732
1733
    .. deprecated:: 2.0
1734
       Use :any:`time.clock` instead.
1735
    """
1736
    return lib.TCOD_sys_elapsed_seconds()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_elapsed_seconds.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1737
1738
def sys_set_renderer(renderer):
1739
    """Change the current rendering mode to renderer.
1740
1741
    .. deprecated:: 2.0
1742
       RENDERER_GLSL and RENDERER_OPENGL are not currently available.
1743
    """
1744
    lib.TCOD_sys_set_renderer(renderer)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_set_renderer.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1745
1746
def sys_get_renderer():
1747
    """Return the current rendering mode.
1748
1749
    """
1750
    return lib.TCOD_sys_get_renderer()
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_get_renderer.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1751
1752
# easy screenshots
1753
def sys_save_screenshot(name=None):
1754
    """Save a screenshot to a file.
1755
1756
    By default this will automatically save screenshots in the working
1757
    directory.
1758
1759
    The automatic names are formatted as screenshotNNN.png.  For example:
1760
    screenshot000.png, screenshot001.png, etc.  Whichever is available first.
1761
1762
    Args:
1763
        file Optional[AnyStr]: File path to save screenshot.
1764
    """
1765
    if name is not None:
1766
        name = _bytes(name)
1767
    lib.TCOD_sys_save_screenshot(name or ffi.NULL)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_save_screenshot.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of _MockFFI does not seem to have a member named NULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1768
1769
# custom fullscreen resolution
1770
def sys_force_fullscreen_resolution(width, height):
1771
    """Force a specific resolution in fullscreen.
1772
1773
    Will use the smallest available resolution so that:
1774
1775
    * resolution width >= width and
1776
      resolution width >= root console width * font char width
1777
    * resolution height >= height and
1778
      resolution height >= root console height * font char height
1779
1780
    Args:
1781
        width (int): The desired resolution width.
1782
        height (int): The desired resolution height.
1783
    """
1784
    lib.TCOD_sys_force_fullscreen_resolution(width, height)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_force_fullscreen_resolution.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1785
1786
def sys_get_current_resolution():
1787
    """Return the current resolution as (width, height)
1788
1789
    Returns:
1790
        Tuple[int,int]: The current resolution.
1791
    """
1792
    w = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1793
    h = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1794
    lib.TCOD_sys_get_current_resolution(w, h)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_get_current_resolution.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1795
    return w[0], h[0]
1796
1797
def sys_get_char_size():
1798
    """Return the current fonts character size as (width, height)
1799
1800
    Returns:
1801
        Tuple[int,int]: The current font glyph size in (width, height)
1802
    """
1803
    w = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1804
    h = ffi.new('int *')
0 ignored issues
show
Bug introduced by
The Instance of _MockFFI does not seem to have a member named new.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1805
    lib.TCOD_sys_get_char_size(w, h)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_get_char_size.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1806
    return w[0], h[0]
1807
1808
# update font bitmap
1809
def sys_update_char(asciiCode, fontx, fonty, img, x, y):
1810
    """Dynamically update the current frot with img.
1811
1812
    All cells using this asciiCode will be updated
1813
    at the next call to :any:`tcod.console_flush`.
1814
1815
    Args:
1816
        asciiCode (int): Ascii code corresponding to the character to update.
1817
        fontx (int): Left coordinate of the character
1818
                     in the bitmap font (in tiles)
1819
        fonty (int): Top coordinate of the character
1820
                     in the bitmap font (in tiles)
1821
        img (Image): An image containing the new character bitmap.
1822
        x (int): Left pixel of the character in the image.
1823
        y (int): Top pixel of the character in the image.
1824
    """
1825
    lib.TCOD_sys_update_char(_int(asciiCode), fontx, fonty, img, x, y)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_update_char.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1826
1827
def sys_register_SDL_renderer(callback):
1828
    """Register a custom randering function with libtcod.
1829
1830
    The callack will receive a :any:`CData <ffi-cdata>` void* to an
1831
    SDL_Surface* struct.
1832
1833
    The callback is called on every call to :any:`tcod.console_flush`.
1834
1835
    Args:
1836
        callback Callable[[CData], None]:
1837
            A function which takes a single argument.
1838
    """
1839
    with _PropagateException() as propagate:
1840
        @ffi.def_extern(onerror=propagate)
1841
        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...
Unused Code introduced by
The variable _pycall_sdl_hook seems to be unused.
Loading history...
1842
            callback(sdl_surface)
1843
        lib.TCOD_sys_register_SDL_renderer(lib._pycall_sdl_hook)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_register_SDL_renderer.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of object does not seem to have a member named _pycall_sdl_hook.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1844
1845
def sys_check_for_event(mask, k, m):
1846
    """Check for events.
1847
1848
    mask can be any of the following:
1849
1850
    * tcod.EVENT_NONE
1851
    * tcod.EVENT_KEY_PRESS
1852
    * tcod.EVENT_KEY_RELEASE
1853
    * tcod.EVENT_KEY
1854
    * tcod.EVENT_MOUSE_MOVE
1855
    * tcod.EVENT_MOUSE_PRESS
1856
    * tcod.EVENT_MOUSE_RELEASE
1857
    * tcod.EVENT_MOUSE
1858
    * tcod.EVENT_FINGER_MOVE
1859
    * tcod.EVENT_FINGER_PRESS
1860
    * tcod.EVENT_FINGER_RELEASE
1861
    * tcod.EVENT_FINGER
1862
    * tcod.EVENT_ANY
1863
1864
    Args:
1865
        mask (int): Event types to wait for.
1866
        k (Optional[Key]): A tcod.Key instance which might be updated with
1867
                           an event.  Can be None.
1868
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
1869
                             with an event.  Can be None.
1870
    """
1871
    return lib.TCOD_sys_check_for_event(mask, _cdata(k), _cdata(m))
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_check_for_event.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1872
1873
def sys_wait_for_event(mask, k, m, flush):
1874
    """Wait for events.
1875
1876
    mask can be any of the following:
1877
1878
    * tcod.EVENT_NONE
1879
    * tcod.EVENT_KEY_PRESS
1880
    * tcod.EVENT_KEY_RELEASE
1881
    * tcod.EVENT_KEY
1882
    * tcod.EVENT_MOUSE_MOVE
1883
    * tcod.EVENT_MOUSE_PRESS
1884
    * tcod.EVENT_MOUSE_RELEASE
1885
    * tcod.EVENT_MOUSE
1886
    * tcod.EVENT_FINGER_MOVE
1887
    * tcod.EVENT_FINGER_PRESS
1888
    * tcod.EVENT_FINGER_RELEASE
1889
    * tcod.EVENT_FINGER
1890
    * tcod.EVENT_ANY
1891
1892
    If flush is True then the buffer will be cleared before waiting. Otherwise
1893
    each available event will be returned in the order they're recieved.
1894
1895
    Args:
1896
        mask (int): Event types to wait for.
1897
        k (Optional[Key]): A tcod.Key instance which might be updated with
1898
                           an event.  Can be None.
1899
        m (Optional[Mouse]): A tcod.Mouse instance which might be updated
1900
                             with an event.  Can be None.
1901
        flush (bool): Clear the event buffer before waiting.
1902
    """
1903
    return lib.TCOD_sys_wait_for_event(mask, _cdata(k), _cdata(m), flush)
0 ignored issues
show
Bug introduced by
The Instance of object does not seem to have a member named TCOD_sys_wait_for_event.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
1904
1905
__all__ = [_name for _name in list(globals()) if _name[0] != '_']
1906