GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#44)
by
unknown
01:14
created

qtsass.watchers.qt   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 48
dl 0
loc 82
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A QtWatcher.stop() 0 3 1
A QtWatcher.setup() 0 6 2
A QtWatcher.join() 0 2 1
A QtWatcher.connect() 0 3 1
A QtWatcher.start() 0 2 1
A QtWatcher.disconnect() 0 3 1
1
# -*- coding: utf-8 -*-
2
# -----------------------------------------------------------------------------
3
# Copyright (c) 2015 Yann Lanthony
4
# Copyright (c) 2017-2018 Spyder Project Contributors
5
#
6
# Licensed under the terms of the MIT License
7
# (See LICENSE.txt for details)
8
# -----------------------------------------------------------------------------
9
"""Contains the Qt implementation of the Watcher api."""
10
11
# yapf: disable
12
13
from __future__ import absolute_import
14
15
# Third party imports
16
QT_BINDING = None
17
if not QT_BINDING:
18
    try:
19
        from PySide2.QtWidgets import QApplication
20
        from PySide2.QtCore import QFileSystemWatcher
21
        QT_BINDING = 'pyside2'
22
    except ImportError:
23
        pass
24
if not QT_BINDING:
25
    try:
26
        from PyQt5.QtWidgets import QApplication
27
        from PyQt5.QtCore import QFileSystemWatcher
28
        QT_BINDING = 'pyqt5'
29
    except ImportError:
30
        pass
31
if not QT_BINDING:
32
    try:
33
        from PySide.QtGui import QApplication
34
        from PySide.QtCore import QFileSystemWatcher
35
        QT_BINDING == 'pyside'
36
    except ImportError:
37
        pass
38
if not QT_BINDING:
39
    from PyQt4.QtGui import QApplication
40
    from PyQt4.QtCore import QFileSystemWatcher
41
    QT_BINDING == 'pyqt4'
42
43
# Local imports
44
from qtsass.watchers.api import Watcher
45
46
# yapf: enable
47
48
49
# TODO: This doesn't work yet.
50
51
52
class QtWatcher(Watcher):
53
    """The Qt implementation of the Watcher api. Uses a QFileSystemWatcher
54
    to monitor the filesystem.
55
    """
56
    _qt_binding = QT_BINDING
57
58
    def setup(self):
59
        self._qapp = QApplication.instance()
0 ignored issues
show
introduced by
The variable QApplication does not seem to be defined in case BooleanNotNode on line 17 is False. Are you sure this can never be the case?
Loading history...
60
        if not self._qapp:
61
            raise RuntimeError('QtWatcher created before QApplication.')
62
63
        self._qfswatcher = QFileSystemWatcher()
0 ignored issues
show
introduced by
The variable QFileSystemWatcher does not seem to be defined in case BooleanNotNode on line 17 is False. Are you sure this can never be the case?
Loading history...
64
65
    def connect(self, fn):
66
        self._qfswatcher.fileChanged.connect(fn)
67
        self._qfswatcher.directoryChanged.connect(fn)
68
69
    def disconnect(self, fn):
70
        self._qfswatcher.fileChanged.disconnect(fn)
71
        self._qfswatcher.directoryChanged.disconnect(fn)
72
73
    def start(self):
74
        self._qfswatcher.addPath(self._watch_dir)
75
76
    def stop(self):
77
        self._qfswatcher.removePath(self._watch_dir)
78
        self._qfswatcher = None
79
80
    def join(self):
81
        """Nothing to join here. Unlike PollingWatcher and WatchdogWatcher."""
82