pynvim.api.tabpage   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 36
rs 10
c 0
b 0
f 0
ccs 13
cts 13
cp 1
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A Tabpage.window() 0 4 1
A Tabpage.valid() 0 4 1
A Tabpage.__init__() 0 8 1
A Tabpage.number() 0 4 1
1
"""API for working with Nvim tabpages."""
2 6
from .common import Remote, RemoteSequence
3
4
5 6
__all__ = ('Tabpage')
6
7
8 6
class Tabpage(Remote):
9
    """A remote Nvim tabpage."""
10
11 6
    _api_prefix = "nvim_tabpage_"
12
13 6
    def __init__(self, *args):
14
        """Initialize from session and code_data immutable object.
15
16
        The `code_data` contains serialization information required for
17
        msgpack-rpc calls. It must be immutable for Buffer equality to work.
18
        """
19 6
        super(Tabpage, self).__init__(*args)
20 6
        self.windows = RemoteSequence(self, 'nvim_tabpage_list_wins')
21
22 6
    @property
23
    def window(self):
24
        """Get the `Window` currently focused on the tabpage."""
25 6
        return self.request('nvim_tabpage_get_win')
26
27 6
    @property
28
    def valid(self):
29
        """Return True if the tabpage still exists."""
30 6
        return self.request('nvim_tabpage_is_valid')
31
32 6
    @property
33
    def number(self):
34
        """Get the tabpage number."""
35
        return self.request('nvim_tabpage_get_number')
36