Skip to content

Commit

Permalink
make lint and include python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sinhaharsh committed Dec 4, 2023
1 parent 6a7f153 commit 82a344c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ deps = flake8
commands = flake8 protocol
# E203 - whitespace before ':'
ignore =
E203,
E203, W503
exclude =
docs,
*/_version.py,
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ "3.8" ]
os: [ubuntu-latest, macos-latest]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v3
Expand All @@ -30,10 +31,7 @@ jobs:
pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
make lint
- name: Test with pytest
run: |
pytest
12 changes: 6 additions & 6 deletions protocol/imaging.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import re
from abc import ABC
from bisect import insort
from collections import defaultdict
from copy import deepcopy
from datetime import datetime
from pathlib import Path
import re

import numpy as np
import pydicom
from lxml import objectify

from protocol import config as cfg, logger
from protocol.base import (BaseImagingProtocol, BaseParameter, BaseSequence,
CategoricalParameter, MultiValueCategoricalParameter,
Expand All @@ -19,7 +18,7 @@
SESSION_INFO_DICOM_TAGS as SESSION_TAGS,
ACRONYMS_DEMOGRAPHICS as ACRONYMS_DEMO,
Invalid, Unspecified, UnspecifiedType,
ProtocolType, valid_neck_coils, valid_spine_coils)
ProtocolType, valid_neck_coils)
from protocol.utils import (auto_convert, convert2ascii, get_dicom_param_value,
get_sequence_name, header_exists, import_string,
parse_csa_params, expand_number_range)
Expand Down Expand Up @@ -1360,7 +1359,7 @@ def get_value(self):
"""getter"""
if not isinstance(self._value, UnspecifiedType):
# Add 0.0 will avoid -0.0
return [0.0+np.round(v, self.decimals) for v in self._value]
return [0.0 + np.round(v, self.decimals) for v in self._value]
return self._value

def _compare_value(self, other, rtol=0, decimals=None):
Expand Down Expand Up @@ -1663,8 +1662,8 @@ def compliant(self, other, rtol=0, decimals=None, include_params=None,
f'of the protocols <{self, other}>')
continue

compliant = this_seq.compliant(that_seq, rtol, decimals,
include_params)
compliant = this_seq.compliant(that_seq, rtol, decimals,
include_params)
if not compliant:
non_compliant_sequences.append((this_seq, that_seq))

Expand All @@ -1677,6 +1676,7 @@ def __eq__(self, other):
bool_flag, _ = self.compliant(other)
return bool_flag


class SiemensMRImagingProtocol(MRImagingProtocol):
def __init__(self, name='SiemensMRProtocol',
category='MR',
Expand Down

0 comments on commit 82a344c

Please sign in to comment.