Skip to content

Commit

Permalink
#314 - Switch to poetry
Browse files Browse the repository at this point in the history
- Use ruff
- Address linter issues in json.py
  • Loading branch information
reckart committed May 4, 2024
1 parent 3bf380c commit 8b7b706
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 395 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4
Expand Down
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ coverage:

# Static analysis/linting
format:
black cassis/
black tests/
isort --profile black $(PYTHON_FILES) --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=120
poetry run ruff format $(PYTHON_FILES)

lint:
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 --select=E9,F63,F7,F82 --show-source $(PYTHON_FILES)
poetry run ruff check --select=E9,F63,F7,F82 --output-format=full $(PYTHON_FILES)
# 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
poetry run flake8 --exit-zero $(PYTHON_FILES)
poetry run ruff check --exit-zero $(PYTHON_FILES)

# Docs
docs:
Expand Down
11 changes: 9 additions & 2 deletions cassis/json.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import base64
import json
import math
from collections import OrderedDict
from collections import OrderedDict, defaultdict
from io import TextIOBase, TextIOWrapper
from math import isnan
from typing import Union, IO, Optional, Dict, List
from toposort import toposort_flatten

from cassis.cas import NAME_DEFAULT_SOFA, Cas, IdGenerator, Sofa, View
from cassis.typesystem import *
from cassis.typesystem import TYPE_NAME_ANNOTATION, TypeSystem, is_predefined, merge_typesystems, TYPE_NAME_SOFA, \
FEATURE_BASE_NAME_SOFAARRAY, array_type_name_for_type, FEATURE_BASE_NAME_SOFASTRING, FEATURE_BASE_NAME_SOFAID, \
FEATURE_BASE_NAME_SOFAMIME, FEATURE_BASE_NAME_SOFANUM, FEATURE_BASE_NAME_SOFAURI, TYPE_NAME_FS_ARRAY, \
TYPE_NAME_BYTE_ARRAY, TYPE_NAME_FLOAT_ARRAY, TYPE_NAME_DOUBLE_ARRAY, TypeSystemMode, TYPE_NAME_DOCUMENT_ANNOTATION, \
Type, Feature, TYPE_NAME_TOP, is_primitive_array, TYPE_NAME_FLOAT, TYPE_NAME_DOUBLE, \
element_type_name_for_array_type, is_primitive, is_array

RESERVED_FIELD_PREFIX = "%"
REF_FEATURE_PREFIX = "@"
Expand Down
Loading

0 comments on commit 8b7b706

Please sign in to comment.