Completed
Pull Request — master (#179)
by Björn
40:43 queued 15:44
created

neovim.api.Window.__init__()   A

Complexity

Conditions 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1
Metric Value
cc 1
dl 0
loc 12
ccs 5
cts 5
cp 1
crap 1
rs 9.4285

1 Method

Rating   Name   Duplication   Size   Complexity  
A neovim.api.Window.buffer() 0 4 1
1
"""API for working with Nvim windows."""
2 6
from .common import Remote
0 ignored issues
show
Configuration introduced by
Unable to import 'common' (unindent does not match any outer indentation level (<string>, line 46))

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
3
4
5 6
__all__ = ('Window')
6
7
8 6
class Window(Remote):
0 ignored issues
show
Coding Style introduced by
This class has no __init__ method.
Loading history...
9
10
    """A remote Nvim window."""
11
12 6
    _api_prefix = "window_"
13
14
    @property
15
    def buffer(self):
16
        """Get the `Buffer` currently being displayed by the window."""
17
        return self._session.request('window_get_buffer', self)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
18 6
19 6
    @property
20 6
    def cursor(self):
21
        """Get the (row, col) tuple with the current cursor position."""
22 6
        return self._session.request('window_get_cursor', self)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
23
24
    @cursor.setter
25 6
    def cursor(self, pos):
26
        """Set the (row, col) tuple as the new cursor position."""
27
        return self._session.request('window_set_cursor', self, pos)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
28 6
29
    @property
30 6
    def height(self):
31
        """Get the window height in rows."""
32
        return self._session.request('window_get_height', self)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
33 6
34
    @height.setter
35 6
    def height(self, height):
36
        """Set the window height in rows."""
37
        return self._session.request('window_set_height', self, height)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
38 6
39
    @property
40 6
    def width(self):
41
        """Get the window width in rows."""
42
        return self._session.request('window_get_width', self)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
43 6
44
    @width.setter
45 6
    def width(self, width):
46
        """Set the window height in rows."""
47
        return self._session.request('window_set_width', self, width)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
48 6
49
    @property
50 6
    def row(self):
51
        """0-indexed, on-screen window position(row) in display cells."""
52
        return self._session.request('window_get_position', self)[0]
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
53 6
54
    @property
55 6
    def col(self):
56
        """0-indexed, on-screen window position(col) in display cells."""
57
        return self._session.request('window_get_position', self)[1]
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
58 6
59
    @property
60 6
    def tabpage(self):
61
        """Get the `Tabpage` that contains the window."""
62
        return self._session.request('window_get_tabpage', self)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
63 6
64
    @property
65 6
    def valid(self):
66
        """Return True if the window still exists."""
67
        return self._session.request('window_is_valid', self)
0 ignored issues
show
Bug introduced by
The Instance of Window does not seem to have a member named _session.

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

The member could have been renamed or removed.

Loading history...
68