Issues (838)

tcod/libtcod.py (11 issues)

1
"""This module handles loading of the libtcod cffi API.
2
"""
3
from __future__ import absolute_import as _
4
5
import sys as _sys
6
import os as _os
7
8
import platform as _platform
9
10
11
from tcod import __path__
12
13
if _sys.platform == 'win32':
14
    # add Windows dll's to PATH
15
    _bits, _linkage = _platform.architecture()
0 ignored issues
show
Coding Style Naming introduced by
The name _bits does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

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

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

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

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

Loading history...
Coding Style Naming introduced by
The name _linkage does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

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

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

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

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

Loading history...
16
    _os.environ['PATH'] = '%s;%s' % (
17
        _os.path.join(__path__[0], 'x86' if _bits == '32bit' else 'x64'),
18
        _os.environ['PATH'],
19
        )
20
21
def _import_library_functions(lib):
22
    # imports libtcod namespace into thie module
23
    # does not override existing names
24
    g = globals()
0 ignored issues
show
Coding Style Naming introduced by
The name g does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

Loading history...
25
    for name in dir(lib):
26
        if name[:5] == 'TCOD_':
27
            if name.isupper():
28
                g[name[5:]] = getattr(lib, name) # const names
29
        elif name.startswith('FOV'):
30
            g[name] = getattr(lib, name) # fov const names
31
        elif name[:6] == 'TCODK_': # key name
32
            g['KEY_' + name[6:]] = getattr(lib, name)
33
34
NOISE_DEFAULT_HURST = 0.5
35
NOISE_DEFAULT_LACUNARITY = 2.0
36
37
def FOV_PERMISSIVE(p) :
0 ignored issues
show
Coding Style Naming introduced by
The name FOV_PERMISSIVE does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

Loading history...
38
    return FOV_PERMISSIVE_0+p
39
40
def BKGND_ALPHA(a):
0 ignored issues
show
Coding Style Naming introduced by
The name BKGND_ALPHA does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

Loading history...
41
    return BKGND_ALPH | (int(a * 255) << 8)
42
43
def BKGND_ADDALPHA(a):
0 ignored issues
show
Coding Style Naming introduced by
The name BKGND_ADDALPHA does not conform to the function naming conventions ([a-z_][a-z0-9_]{2,30}$).

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

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

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

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

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

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

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

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

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

Loading history...
44
    return BKGND_ADDA | (int(a * 255) << 8)
45
46
class _Mock(object):
47
    """Mock object needed for ReadTheDocs."""
48
49
    TCOD_RENDERER_GLSL = 0
50
    TCOD_RENDERER_OPENGL = 1
51
    TCOD_RENDERER_SDL = 2
52
    TCOD_FONT_LAYOUT_ASCII_INCOL = 1
53
    TCOD_BKGND_SET = 1
54
    TCOD_BKGND_DEFAULT = 13
55
    TCOD_KEY_RELEASED = 2
56
    TCOD_NOISE_DEFAULT = 0
57
    TCOD_NOISE_SIMPLEX = 2
58
    TCOD_NOISE_WAVELET = 4
59
    FOV_RESTRICTIVE = 12
60
61
    TCOD_RNG_MT = 0
62
    TCOD_RNG_CMWC = 1
63
64
    CData = () # This gets passed to an isinstance call.
65
66
    @staticmethod
67
    def def_extern():
68
        """Pass def_extern call silently."""
69
        return lambda func:func
70
71
    def __getattr__(self, attr):
72
        """This object pretends to have everything."""
73
        return self
74
75
    def __call__(self, *args, **kargs):
76
        """Suppress any other calls"""
77
        return self
78
79
    def __str__(self):
80
        """Just have ? in case anything leaks as a parameter default."""
81
        return '?'
82
83
84
if _os.environ.get('READTHEDOCS'):
85
    # Mock the lib and ffi objects needed to compile docs for readthedocs.io
86
    # Allows an import without building the cffi module first.
87
    lib = ffi = _Mock()
0 ignored issues
show
Coding Style Naming introduced by
The name lib does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

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

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

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

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

Loading history...
Coding Style Naming introduced by
The name ffi does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

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

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

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

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

Loading history...
88
else:
89
    from tcod._libtcod import lib, ffi
90
91
_import_library_functions(lib)
92