Skip to content
Snippets Groups Projects
Commit 97e29c93 authored by Felix Fischer's avatar Felix Fischer :shrimp:
Browse files

Use types from typing to support python 3.8

parent 53671f6f
Branches
Tags
1 merge request!51Stix
Pipeline #1120481 failed
......@@ -9,7 +9,6 @@ variables:
cache:
paths:
- .cache/pip
- venv/
stages:
- test
......@@ -31,6 +30,36 @@ secret_detection:
- source venv/bin/activate
- pip install "."
pyright:
stage: static analysis
needs: [flake8]
before_script:
- *python
- pip install pyright
script:
- pyright src/ --outputjson > report_raw.json
after_script:
- cat report_raw.json
artifacts:
paths:
- report_raw.json
code-quality:
stage: static analysis
needs:
- job: pyright
artifacts: true
image: node:21
before_script:
- npm i -g pyright-to-gitlab-ci
script:
- pyright-to-gitlab-ci --src report_raw.json --output report.json --base_path .
artifacts:
paths:
- report.json
reports:
codequality: report.json
pylint:
stage: static analysis
script:
......@@ -63,22 +92,6 @@ mypy:
- mypy src/scientific_plots
- mypy src/
pyright:
stage: static analysis
needs: [flake8]
image: node:21
before_script:
- npm i -g pyright
- npm i -g pyright-to-gitlab-ci
script:
- pyright src/ --outputjson > report_raw.json || true
- cat report_raw.json
- pyright-to-gitlab-ci --src report_raw.json --output report.json --base_path .
artifacts:
paths:
- report.json
reports:
codequality: report.json
python-tests:
stage: testing
......
......@@ -12,7 +12,8 @@ from subprocess import Popen, PIPE
from sys import __stdout__
from os import mkdir
from os.path import dirname, exists
from typing import Iterable, Optional, List, Callable, TypeVar, Union, Any
from typing import (
Iterable, Optional, List, Callable, TypeVar, Union, Any, Tuple)
from pathlib import Path
from collections import OrderedDict
......@@ -84,10 +85,10 @@ def filter_function(x: str) -> bool:
return True
def filter_argv(X: list[str]) -> list[str]:
def filter_argv(X: List[str]) -> List[str]:
"""removes unessecery entries from
argv which have been generated by abaqus"""
Y: list[str] = list(X)
Y: List[str] = list(X)
for i, x in enumerate(X):
if not filter_function(x):
del Y[i]
......@@ -96,7 +97,7 @@ def filter_argv(X: list[str]) -> list[str]:
return Y
def dumb_plot(X: list[float], Y: list[float],
def dumb_plot(X: List[float], Y: List[float],
title: str = "title", log: bool = False) -> None:
"""plot X and Y using dumb gnuplot"""
try:
......@@ -124,12 +125,12 @@ def dumb_plot(X: list[float], Y: list[float],
def read_file(filename: Union[str, Path],
header: int = 0,
type_: type = float) -> tuple[list[float], ...]:
type_: type = float) -> Tuple[List[float], ...]:
"""read a file with given filename into
a python-tuple. Skip n='header' lines in the beginning
of the document"""
# reads a given file and returns lists
lists: list[list[float]] = []
lists: List[List[float]] = []
with open(filename, "r", encoding="utf-8") as input_file:
for i, line in enumerate(input_file):
if i < header:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment