Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up continuous integration #20

Merged
merged 111 commits into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
112fe3e
add appveyor.yml
loicgilbert Jun 17, 2019
bdb7700
test CI
loicgilbert Jun 17, 2019
f8ae75c
test-CI
loicgilbert Jun 17, 2019
937974c
test-CI
loicgilbert Jun 17, 2019
5fa0781
test-CI
loicgilbert Jun 17, 2019
a6e356c
test-CI
loicgilbert Jun 17, 2019
34ab4ce
test-CI
loicgilbert Jun 17, 2019
8cbea68
test-Ci
loicgilbert Jun 17, 2019
9750784
test-CI
loicgilbert Jun 17, 2019
be4de32
test-CI
loicgilbert Jun 17, 2019
ebe1c7b
test-CI
loicgilbert Jun 17, 2019
9e79686
test-Ci
loicgilbert Jun 17, 2019
efe55ec
test-CI
loicgilbert Jun 17, 2019
eefccff
test-CI
loicgilbert Jun 17, 2019
d5e1e3c
test-CI
loicgilbert Jun 17, 2019
975f418
test-CI
loicgilbert Jun 17, 2019
73ab3cb
test-CI
loicgilbert Jun 17, 2019
905763a
test-CI
loicgilbert Jun 17, 2019
ed6cc74
test-CI
loicgilbert Jun 17, 2019
3514cf8
test-CI
loicgilbert Jun 18, 2019
89726d8
test-Ci
loicgilbert Jun 18, 2019
9b597f5
test-Ci
loicgilbert Jun 18, 2019
4b95794
test-CI
loicgilbert Jun 18, 2019
8a13f54
test-CI
loicgilbert Jun 18, 2019
02a3080
test-CI
loicgilbert Jun 18, 2019
d53c5ae
test-CI
loicgilbert Jun 18, 2019
6b44496
test-CI
loicgilbert Jun 18, 2019
2801ea0
test-CI
loicgilbert Jun 18, 2019
2d35b33
test-CI
loicgilbert Jun 18, 2019
7e5a02f
test-CI
loicgilbert Jun 18, 2019
9d5ec2f
test-CI
loicgilbert Jun 18, 2019
17664d6
test-CI
loicgilbert Jun 18, 2019
b8044b6
test-CI
loicgilbert Jun 18, 2019
7291220
test-CI
loicgilbert Jun 18, 2019
2834adc
test-CI
loicgilbert Jun 18, 2019
76ba2b8
test-CI
loicgilbert Jun 18, 2019
c421019
test-CI
loicgilbert Jun 18, 2019
d7d5e13
test-CI
loicgilbert Jun 18, 2019
376b684
test-CI
loicgilbert Jun 19, 2019
39d2f87
test-CI
loicgilbert Jun 19, 2019
a8935e1
test-CI
loicgilbert Jun 19, 2019
7fec17c
test-CI
loicgilbert Jun 19, 2019
ced1ca3
test-CI
loicgilbert Jun 19, 2019
b958710
test-CI
loicgilbert Jun 19, 2019
61eef93
test-CI
loicgilbert Jun 19, 2019
837c2f1
test-CI
loicgilbert Jun 19, 2019
00249a9
test-CI
loicgilbert Jun 19, 2019
db04c4f
test-CI
loicgilbert Jun 19, 2019
c8ce1c4
test-CI
loicgilbert Jun 19, 2019
b89f7f5
test-CI
loicgilbert Jun 19, 2019
011f750
test-CI
loicgilbert Jun 19, 2019
008e8b8
test-CI
loicgilbert Jun 19, 2019
258d975
test-CI
loicgilbert Jun 19, 2019
57422a7
test-CI
loicgilbert Jun 19, 2019
f4848a6
test-CI
loicgilbert Jun 19, 2019
d3a1793
test-CI
loicgilbert Jun 19, 2019
4cee4c7
test-CI
loicgilbert Jun 19, 2019
5b96ff6
test-CI
loicgilbert Jun 19, 2019
9fea9cd
test-CI
loicgilbert Jun 19, 2019
98bf745
test-CI
loicgilbert Jun 19, 2019
4a64640
test-CI
loicgilbert Jun 19, 2019
bdecf77
test-CI
loicgilbert Jun 19, 2019
1ec26d2
test-CI
loicgilbert Jun 19, 2019
d30f218
test-CI
loicgilbert Jun 19, 2019
f17e8df
test-CI
loicgilbert Jun 19, 2019
d6c3364
test-CI
loicgilbert Jun 19, 2019
a88f2ea
test-CI
loicgilbert Jun 19, 2019
b8fbc50
test-CI
loicgilbert Jun 19, 2019
ab362e2
test-CI
loicgilbert Jun 20, 2019
2e87a04
test if build is working on windows and linux
loicgilbert Jun 20, 2019
a6bf7e2
forgot to uncoment lines
loicgilbert Jun 20, 2019
47d4481
test if build don't work when error in program
loicgilbert Jun 20, 2019
180d8d2
build artifact on windows
loicgilbert Jun 20, 2019
453b633
fix artifact building
loicgilbert Jun 20, 2019
a2edb4e
build artifacts on windows and linux
loicgilbert Jun 20, 2019
212ddfd
Fix artifact building o windows and linux
loicgilbert Jun 20, 2019
fc92084
Push executable as artifact
loicgilbert Jun 20, 2019
826ad61
fix artifact creation
loicgilbert Jun 20, 2019
e6eaf71
Fix artifacts creation
loicgilbert Jun 20, 2019
8bb8f32
Fix pyinstaller on linux
loicgilbert Jun 20, 2019
50038b2
Fix pyinstaller on linux
loicgilbert Jun 20, 2019
aa7a7bc
Fix pyinstaller on linux
loicgilbert Jun 20, 2019
d3a6264
Fix pyinsaller on linux
loicgilbert Jun 20, 2019
f093bff
Fix small mistakes
loicgilbert Jun 20, 2019
364fa61
Implement CI
loicgilbert Jun 20, 2019
b37cf30
Implement CI
loicgilbert Jun 20, 2019
822656d
Delete null
loicgilbert Jun 20, 2019
c849e2b
Check appveyor build
loicgilbert Jun 27, 2019
5ba90a1
Set up CI
loicgilbert Jun 28, 2019
d0c4966
Update README.md
pavel-kirienko Jul 1, 2019
9ee7c43
Fixed the unit test invocation
pavel-kirienko Jul 2, 2019
19027cd
Fixed some of the PEP8 violations
pavel-kirienko Jul 2, 2019
20d030d
Merge pull request #25 from Zubax/pytest-fix
pavel-kirienko Jul 2, 2019
f976388
Updated Appveyor CI
loicgilbert Jul 3, 2019
dc5c988
Updated test files
loicgilbert Jul 3, 2019
170fc48
PEP8 compatibility
loicgilbert Jul 3, 2019
ecc7029
Remove mypy
loicgilbert Jul 3, 2019
83dcc94
Add links to appveyor.yml
loicgilbert Jul 4, 2019
7bc009c
Add windows build file
loicgilbert Jul 4, 2019
66d4298
Corrected appveyor.yml
loicgilbert Jul 4, 2019
6adf364
Changed PyQt version
loicgilbert Jul 5, 2019
793531c
Fix staticx error
loicgilbert Jul 5, 2019
2fd5920
Fix staticx
loicgilbert Jul 5, 2019
9ce6d7c
Added staticx
loicgilbert Jul 8, 2019
6444c92
Exclude staticx from pep8
loicgilbert Jul 8, 2019
520e46a
Fix 7z
loicgilbert Jul 8, 2019
288ef73
Merge pull request #24 from Zubax/pavel-kirienko-patch-1
loicgilbert Jul 10, 2019
7bfe95a
Delete pyqtgraph
loicgilbert Jul 10, 2019
356e14b
set staticx as a submodule
loicgilbert Jul 10, 2019
386e907
Update staticx
loicgilbert Jul 11, 2019
a084a65
Update build_linux.sh and .gitmodule
loicgilbert Jul 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "kucher/libraries/popcop"]
path = kucher/libraries/popcop
url = https://github.com/Zubax/popcop
[submodule "kucher/libraries/pyqtgraph"]
path = kucher/libraries/pyqtgraph
url = https://github.com/pyqtgraph/pyqtgraph-core
[submodule "kucher/libraries/construct"]
path = kucher/libraries/construct
url = https://github.com/construct/construct
Expand All @@ -13,3 +10,6 @@
[submodule "kucher/libraries/quamash"]
path = kucher/libraries/quamash
url = https://github.com/harvimt/quamash
[submodule "kucher/libraries/staticx"]
path = kucher/libraries/staticx
url = https://github.com/Zubax/staticx
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,22 @@ The following command line options are available:

* `--debug` - activates verbose logging; useful for troubleshooting.
* `--profile` - creates a profile file after the application is closed.
* `--test` - run unit tests.
* `-k` - can be used in conjunction with `--test` to run a specific test.
Refer to the PyTest documentation for more information.
* Other options can be provided with `--test`; they will be passed directly to
the PyTest framework.

### Running the unit tests

From the root directory, on Linux:

```bash
PYTHONPATH=kucher pytest # TODO: fix imports to make "PYTHONPATH=kucher" unnecessary
```

On Windows:

```bash
set PYTHONPATH=kucher
pytest
```


### Getting the right version of Python

Expand Down Expand Up @@ -87,3 +98,10 @@ pyenv global 3.6.4
If there was a warning that `sqlite3` has not been compiled,
make sure to resolve it first before continuing - `sqlite3` is required by Kucher.
Now run `python3 --version` and ensure that you have v3.6 as default.

### CI artifacts

The CI builds redistributable release binaries automatically.
Follow the CI status link from the [commits page](https://github.com/Zubax/kucher/commits/master)
to find the binaries for a particular commit.
The Linux binaries can be shipped directly; the Windows binaries must be signed first.
57 changes: 57 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
environment:
matrix:
# Windows & python 3.6
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON: "C:\\Python36-x64"
PYTHON_ARCH: "64"

# Windows & python 3.7
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON: "C:\\Python37-x64"
PYTHON_ARCH: "64"

# Ubuntu & python 3.6
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
PYTHON: "3.6"

# Ubuntu & python 3.7
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
PYTHON: "3.7"

stack: python %PYTHON%

install:
- "git submodule update --init --recursive"
- cmd: "SET PATH=%PYTHON%;%PATH%"
- cmd: "SET PATH=C:\\Python36-x64\\Scripts;%PATH%"
- cmd: "SET PATH=C:\\Python37-x64\\Scripts;%PATH%"
- "python -V"
- "pip --version"
- cmd: "python -m pip install -r requirements.txt"
- cmd: "python -m pip install -r requirements-dev-windows.txt"
- sh: "pip install -r requirements.txt"
- sh: "pip install -r requirements-dev-linux.txt"
- sh: "sudo add-apt-repository -y ppa:deadsnakes/ppa "
- sh: "sudo apt-get update"
- sh: "sudo apt-get -y install python3.6-dev"
- sh: "sudo apt-get -y install python3.7-dev"


build: off

test_script:
- cmd: "test_windows.bat"
# Plugins related to software display are missing on Linux. Appveyor can't handle display so we disable it. See:
# https://doc.qt.io/qt-5/embedded-linux.html
# https://github.com/ariya/phantomjs/issues/14376
- sh: "export QT_QPA_PLATFORM=offscreen"
- sh: "bash test_linux.sh"

after_test:
- cmd: "7z a zubax-kucher.7z *"
- sh: "7z a zubax-kucher.7z *"
- "appveyor PushArtifact zubax-kucher.7z"
- sh: "bash build_linux.sh"
- cmd: "build_windows.bat"
- cmd: "appveyor PushArtifact dist\\Kucher.exe"
- sh: "appveyor PushArtifact dist/Kucher"
13 changes: 11 additions & 2 deletions build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
# Before running this, make sure all PIP dependencies are installed.
#

sudo apt-get install patchelf -y
sudo apt-get install -y patchelf
sudo apt-get install -y gcc
sudo apt-get install -y scons
sudo apt-get install -y liblzma-dev
pip install backports.lzma

pyinstaller --clean --noconfirm pyinstaller.spec || exit 2
pushd kucher/libraries/staticx
scons
python setup.py install

# https://github.com/JonathonReinhart/staticx/issues/79
cd dist
popd
pushd dist
mv Kucher Kucher.tmp
staticx --loglevel DEBUG Kucher.tmp Kucher

rm -rf *.tmp
popd
3 changes: 3 additions & 0 deletions build_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REM Before running this, make sure all PIP dependencies are installed.

pyinstaller --clean --noconfirm pyinstaller.spec || exit 2
11 changes: 8 additions & 3 deletions kucher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
if sys.version_info[:2] < (3, 6):
raise ImportError('A newer version of Python is required')

from .version import *
from .main import main
from .version import * # noqa
from .main import main # noqa

#
# Configuring the third-party modules.
Expand All @@ -33,9 +33,14 @@
os.path.join(THIRDPARTY_PATH_ROOT),
os.path.join(THIRDPARTY_PATH_ROOT, 'popcop', 'python'),
os.path.join(THIRDPARTY_PATH_ROOT, 'construct'),
os.path.join(THIRDPARTY_PATH_ROOT, 'dataclasses'),
os.path.join(THIRDPARTY_PATH_ROOT, 'quamash'),
]

# 'dataclasses' module is included in Python libraries since version 3.7. For Python versions below, the dataclass
# module located in the 'libraries' directory will be used. It is not compatible with Python 3.7, so we only declare
# its path if Python version is below 3.7. Otherwise, the built-in module will be used by default.
if sys.version_info[:2] < (3, 7):
THIRDPARTY_PATH.append(os.path.join(THIRDPARTY_PATH_ROOT, 'dataclasses'))

for tp in THIRDPARTY_PATH:
sys.path.insert(0, tp)
1 change: 0 additions & 1 deletion kucher/libraries/pyqtgraph
Submodule pyqtgraph deleted from cc2d6b
1 change: 1 addition & 0 deletions kucher/libraries/staticx
Submodule staticx added at daf5bb
16 changes: 1 addition & 15 deletions kucher/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def main() -> int:
import datetime
from PyQt5.QtWidgets import QApplication
from quamash import QEventLoop
from . import THIRDPARTY_PATH_ROOT, data_dir, version, resources
from . import data_dir, version, resources
from .fuhrer import Fuhrer

data_dir.init()
Expand All @@ -70,20 +70,6 @@ def save_profile():
atexit.register(save_profile)
prof.enable()

if '--test' in sys.argv:
if not os.environ.get('PYTHONASYNCIODEBUG'):
raise RuntimeError('PYTHONASYNCIODEBUG should be set while unit testing')

import pytest
args = sys.argv[:]
args.remove('--test')
args.append('--ignore=' + THIRDPARTY_PATH_ROOT)
args.append('--capture=no')
args.append('--fulltrace')
args.append('-vv')
args.append('.')
return pytest.main(args)

# Configuring the event loop
app = QApplication(sys.argv)
loop = QEventLoop(app)
Expand Down
9 changes: 5 additions & 4 deletions kucher/model/device_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ def registers(self) -> typing.Dict[str, Register]:
"""
return self._conn.registers if self.is_connected else {}

async def connect(self,
port_name: str,
on_progress_report: typing.Optional[typing.Callable[[str, float], None]]=None) -> DeviceInfoView:
async def connect(
self,
port_name: str,
on_progress_report: typing.Optional[typing.Callable[[str, float], None]] = None) -> DeviceInfoView:
await self.disconnect()
assert not self._conn

Expand All @@ -143,7 +144,7 @@ async def connect(self,

return self._conn.device_info

async def disconnect(self, reason: str=None):
async def disconnect(self, reason: str = None):
_logger.info('Explicit disconnect request; reason: %r', reason)
if self._conn:
# noinspection PyTypeChecker
Expand Down
4 changes: 2 additions & 2 deletions kucher/model/device_model/communicator/communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ async def send(self, message: AnyMessage):

async def request(self,
message_or_type: typing.Union[Message, MessageType, StandardMessageBase, StandardMessageType],
timeout: typing.Optional[typing.Union[float, int]]=None,
predicate: typing.Optional[typing.Callable[[AnyMessage], bool]]=None) ->\
timeout: typing.Optional[typing.Union[float, int]] = None,
predicate: typing.Optional[typing.Callable[[AnyMessage], bool]] = None) ->\
typing.Optional[AnyMessage]:
"""
Sends a message, then awaits for a matching response.
Expand Down
4 changes: 2 additions & 2 deletions kucher/model/device_model/communicator/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ class Message:
"""
def __init__(self,
message_type: MessageType,
fields: typing.Optional[typing.Mapping]=None,
timestamp: typing.Optional[float]=None):
fields: typing.Optional[typing.Mapping] = None,
timestamp: typing.Optional[float] = None):
if not isinstance(message_type, MessageType):
raise TypeError('Expected MessageType not %r' % message_type)

Expand Down
6 changes: 3 additions & 3 deletions kucher/model/device_model/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ async def request(self,
MessageType,
popcop.standard.MessageBase,
typing.Type[popcop.standard.MessageBase]],
timeout: typing.Optional[typing.Union[float, int]]=None,
timeout: typing.Optional[typing.Union[float, int]] = None,
predicate: typing.Optional[typing.Callable[[typing.Union[Message,
popcop.standard.MessageBase]],
bool]]=None) ->\
bool]] = None) ->\
typing.Union[Message, popcop.standard.MessageBase]:
try:
return await self._com.request(message_or_type,
Expand Down Expand Up @@ -276,7 +276,7 @@ async def connect(event_loop: asyncio.AbstractEventLoop,
begun_at = time.monotonic()
progress = 0.0

def report(stage: str, progress_increment: float=0.01):
def report(stage: str, progress_increment: float = 0.01):
nonlocal progress
assert progress_increment > 0
progress = min(1.0, progress + progress_increment)
Expand Down
2 changes: 1 addition & 1 deletion kucher/model/device_model/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self,
flags: Flags,
update_timestamp_device_time: Decimal,
set_get_callback: SetGetCallback,
update_timestamp_monotonic: float=None):
update_timestamp_monotonic: float = None):
self._name = str(name)
self._cached_value = value
self._default_value = default_value
Expand Down
2 changes: 1 addition & 1 deletion kucher/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


def get_absolute_path(*relative_path_items: str, check_existence=False) -> str:
out = os.path.abspath(os.path.join(PACKAGE_ROOT, *relative_path_items)).replace('\\','/')
out = os.path.abspath(os.path.join(PACKAGE_ROOT, *relative_path_items)).replace('\\', '/')
if check_existence:
if not os.path.exists(out):
raise ValueError(f'The specified path does not exist: {out}')
Expand Down
2 changes: 1 addition & 1 deletion kucher/view/main_window/register_view_widget/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __init__(self, parent: QWidget):
def add_action(callback: typing.Callable[[], None],
icon_name: str,
name: str,
shortcut: typing.Optional[str]=None):
shortcut: typing.Optional[str] = None):
action = QAction(get_icon(icon_name), name, self)
# noinspection PyUnresolvedReferences
action.triggered.connect(callback)
Expand Down
20 changes: 10 additions & 10 deletions kucher/view/main_window/register_view_widget/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def default_data_handler(*_) -> QVariant:
for r in self._registers:
r.update_event.connect_weak(self, Model._on_register_update)

def iter_indices(self, root: QModelIndex=None) -> typing.Generator[QModelIndex, None, None]:
def iter_indices(self, root: QModelIndex = None) -> typing.Generator[QModelIndex, None, None]:
"""
Iterates over all indexes in this model starting from :param root:. Returns a generator of QModelIndex.
"""
Expand All @@ -137,7 +137,7 @@ def registers(self) -> typing.List[Register]:

async def read(self,
registers: typing.Iterable[Register],
progress_callback: typing.Optional[typing.Callable[[Register, int, int], None]]=None):
progress_callback: typing.Optional[typing.Callable[[Register, int, int], None]] = None):
"""
:param registers: which ones to read
:param progress_callback: (register: Register, current_register_index: int, total_registers: int) -> None
Expand Down Expand Up @@ -180,7 +180,7 @@ async def read(self,

async def write(self,
register_value_mapping: typing.Dict[Register, typing.Any],
progress_callback: typing.Optional[typing.Callable[[Register, int, int], None]]=None):
progress_callback: typing.Optional[typing.Callable[[Register, int, int], None]] = None):
"""
:param register_value_mapping: keys are registers, values are what to assign
:param progress_callback: (register: Register, current_register_index: int, total_registers: int) -> None
Expand Down Expand Up @@ -229,7 +229,7 @@ def get_register_from_index(index: QModelIndex) -> Register:
def get_font() -> QFont:
return get_monospace_font(small=True)

def index(self, row: int, column: int, parent: QModelIndex=None) -> QModelIndex:
def index(self, row: int, column: int, parent: QModelIndex = None) -> QModelIndex:
if column >= self.columnCount(parent):
return QModelIndex()

Expand All @@ -251,15 +251,15 @@ def parent(self, index: QModelIndex) -> QModelIndex:
else:
return QModelIndex()

def rowCount(self, parent: QModelIndex=None) -> int:
def rowCount(self, parent: QModelIndex = None) -> int:
# Only zero-column items have children, this is per the Qt's conventions.
# http://doc.qt.io/qt-5/qtwidgets-itemviews-simpletreemodel-example.html
if parent is not None and parent.column() > 0:
return 0

return len(self._resolve_parent_node(parent).children)

def columnCount(self, parent: QModelIndex=None) -> int:
def columnCount(self, parent: QModelIndex = None) -> int:
return len(self._COLUMNS)

def _data_display(self, index: QModelIndex) -> str:
Expand Down Expand Up @@ -373,7 +373,7 @@ def _data_decoration(self, index: QModelIndex) -> typing.Union[QPixmap, QVariant

return QVariant()

def data(self, index: QModelIndex, role: int=None):
def data(self, index: QModelIndex, role: int = None):
"""
This function is a major performance bottleneck. Look at the results of profiling, you'll see that it is
invoked hundreds of times for every minor data change. Therefore, it is heavily optimized.
Expand All @@ -382,7 +382,7 @@ def data(self, index: QModelIndex, role: int=None):
"""
return self._data_role_dispatch[role](index)

def setData(self, index: QModelIndex, value, role: int=None) -> bool:
def setData(self, index: QModelIndex, value, role: int = None) -> bool:
# As per http://doc.qt.io/qt-5/model-view-programming.html
if not index.isValid() or role != Qt.EditRole:
return False
Expand Down Expand Up @@ -424,7 +424,7 @@ def flags(self, index: QModelIndex) -> int:

return out

def headerData(self, section: int, orientation: int, role: int=None):
def headerData(self, section: int, orientation: int, role: int = None):
if orientation == Qt.Horizontal:
if role == Qt.DisplayRole:
return self._COLUMNS[section]
Expand Down Expand Up @@ -508,7 +508,7 @@ class State(enum.Enum):
state: State = State.DEFAULT
message: str = ''

def set_state(self, state: '_Node.State', message: str=''):
def set_state(self, state: '_Node.State', message: str = ''):
self.message = message
self.state = self.State(state)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class StyleOptionModifyingDelegate(QStyledItemDelegate):
def __init__(self,
parent: QObject,
*,
decoration_position: int=None,
decoration_alignment: int=None):
decoration_position: int = None,
decoration_alignment: int = None):
super(StyleOptionModifyingDelegate, self).__init__(parent)
self._decoration_position = decoration_position
self._decoration_alignment = decoration_alignment
Expand Down
Loading