Skip to content

Commit

Permalink
pyupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
hofbi committed Aug 24, 2022
1 parent 0054b8c commit c4f3419
Show file tree
Hide file tree
Showing 44 changed files with 372 additions and 291 deletions.
2 changes: 0 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ IncludeCategories:
Priority: 4
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
...

---
Language: Json
BasedOnStyle: Google
Expand Down
4 changes: 3 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ misc*,
modernize*,
readability*,
-modernize-use-trailing-return-type,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-llvmlibc-implementation-in-namespace,
-llvmlibc-callee-namespace,
-llvmlibc-restrict-system-libc-headers,
-bugprone-easily-swappable-parameters,
-readability-identifier-length,
-readability-suspicious-call-argument,
'

WarningsAsErrors: '*'
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- compiler: gcc
- compiler: clang
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build ${{ matrix.compiler }}
run: |
use_${{ matrix.compiler }}.sh
Expand All @@ -28,7 +28,7 @@ jobs:
make test
make coverage
cd ..
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ matrix.compiler }} == 'gcc'
with:
path: build/ccov/all-merged
Expand All @@ -37,11 +37,11 @@ jobs:
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -50,7 +50,7 @@ jobs:
run: make test
- name: Coverage
run: make coverage_reports
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: tools/htmlcov
name: artifacts-python
Expand All @@ -61,27 +61,27 @@ jobs:
steps:
- name: Install rsync
run: apk add rsync
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build
run: |
cd docs
make html
make pdf
cd ..
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: docs/output
name: artifacts-docs

slides:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build
run: |
mkdir -p build && chmod -R 0777 build
make slides
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: slides/build
name: artifacts-slides
Expand All @@ -94,9 +94,9 @@ jobs:
- slides
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
- name: Prepare Deploy
run: |
mkdir -p public
Expand All @@ -113,7 +113,7 @@ jobs:
echo "# This branch is for deployment only" >> public/README.md
- name: Deploy Artifacts
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@v4.2.5
uses: JamesIves/github-pages-deploy-action@v4.4.0
with:
branch: gh-pages
folder: public
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand Down
4 changes: 3 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ python_tests:
paths:
- tools/htmlcov
reports:
cobertura: tools/coverage.xml
coverage_report:
coverage_format: cobertura
path: tools/coverage.xml

pages:
<<: *no_schedule
Expand Down
26 changes: 20 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,30 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-case-conflict
- id: check-symlinks
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
language_version: python3
args: [--quiet]
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.0
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries, '88', --wrap-descriptions, '81']
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
hooks:
- id: clang-format
- repo: https://github.com/cpplint/cpplint
rev: 1.6.0
rev: 1.6.1
hooks:
- id: cpplint
- repo: https://github.com/cheshirekow/cmake-format-precommit
Expand All @@ -34,9 +44,13 @@ repos:
additional_dependencies: ["cmakelang"]
exclude: "cmake/.*"
- repo: https://github.com/PyCQA/flake8
rev: 5.0.2
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8-use-pathlib
- flake8-bugbear
- flake8-comprehensions
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
Expand All @@ -46,7 +60,7 @@ repos:
rev: v0.971
hooks:
- id: mypy
args: [--python-version, "3.8"]
args: [--python-version, "3.10"]
- repo: https://github.com/PyCQA/pylint
rev: v2.14.5
hooks:
Expand All @@ -55,7 +69,7 @@ repos:
rev: v2.37.3
hooks:
- id: pyupgrade
args: [--py38-plus, --keep-runtime-typing]
args: [--py310-plus, --keep-runtime-typing]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
hooks:
Expand Down
23 changes: 15 additions & 8 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ ignore=venv

[BASIC]

# Naming style matching correct argument names.
argument-naming-style=snake_case
# Stick to snake case, but accept setUp and tearDown from unittest
method-rgx=(([a-z_][a-z0-9_]*)|(setUp)|(tearDown))$

[MESSAGES CONTROL]

# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
confidence=

disable=
missing-function-docstring,
import-error, # disabled since pre-commit runs pylint in a separate venv
unspecified-encoding,
fixme,
too-few-public-methods

[FORMAT]

# Maximum number of characters on a single line.
max-line-length=120

[MESSAGES CONTROL]

# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
confidence=HIGH
2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

sudo apt-get update
sudo apt-get install -y \
build-essential \
clang-format \
clang-tidy \
cppcheck \
iwyu \
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage
pre-commit

-r tools/requirements.txt
coverage
pre-commit
11 changes: 5 additions & 6 deletions tools/create_gitlab_projects.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""Create GitLab repositories from folder"""
"""Create GitLab repositories from folder."""

import sys
from argparse import Namespace
from typing import List

from sel_tools.config import REPO_DIR
from sel_tools.gitlab_api.create_repo import (
Expand All @@ -12,9 +11,9 @@
from sel_tools.utils.args import ArgumentParserFactory


def parse_arguments(arguments: List[str]) -> Namespace:
"""Parse CLI arguments"""
factory = ArgumentParserFactory.DefaultParser(__doc__)
def parse_arguments(arguments: list[str]) -> Namespace:
"""Parse CLI arguments."""
factory = ArgumentParserFactory.default_parser(__doc__)
factory.add_repo_base_name()
factory.add_group_id()
factory.add_repo_info_dir()
Expand All @@ -26,7 +25,7 @@ def parse_arguments(arguments: List[str]) -> Namespace:


def main() -> None:
"""main"""
"""main."""
arguments = parse_arguments(sys.argv)
student_repos, group_name = create_repos(
arguments.source_path,
Expand Down
11 changes: 5 additions & 6 deletions tools/export_files.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
"""Export files for students"""
"""Export files for students."""

import sys
from argparse import Namespace
from typing import List

from sel_tools.file_export.copy_item import copy_item
from sel_tools.file_export.export_item import visit_exported_item
from sel_tools.utils import args


def parse_arguments(arguments: List[str]) -> Namespace:
"""Parse CLI arguments"""
factory = args.ArgumentParserFactory.DefaultParser(__doc__)
def parse_arguments(arguments: list[str]) -> Namespace:
"""Parse CLI arguments."""
factory = args.ArgumentParserFactory.default_parser(__doc__)
factory.parser.add_argument(
"source_path",
type=args.dir_path,
Expand All @@ -24,7 +23,7 @@ def parse_arguments(arguments: List[str]) -> Namespace:


def main() -> None:
"""main"""
"""main."""
arguments = parse_arguments(sys.argv)

copy_item(arguments.source_path, arguments.output_dir)
Expand Down
Loading

0 comments on commit c4f3419

Please sign in to comment.