Skip to content

Commit

Permalink
Merge branch 'maint/flake8-pyproject' into 'main'
Browse files Browse the repository at this point in the history
MAINT: Upgrade flake8 config

See merge request heka/medkit!235

changelog: MAINT: Upgrade flake8 config
  • Loading branch information
ghisvail committed Nov 23, 2023
2 parents 6ddd8a8 + f20bb6d commit f5119ac
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
9 changes: 0 additions & 9 deletions .flake8

This file was deleted.

4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ repos:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: '5.0.4'
rev: '6.1.0'
hooks:
- id: flake8
additional_dependencies:
- flake8-pyproject

default_language_version:
python: python3
6 changes: 4 additions & 2 deletions medkit/core/text/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
]

import abc
from collections.abc import Iterable
from enum import IntEnum
from typing import Any, Callable, Dict, List, Optional

Expand Down Expand Up @@ -158,15 +159,16 @@ def _run_one_to_n_function(
all_output_data = []
for input_data in all_input_data:
output_data = self._function(input_data, **self._kwargs)
if type(output_data) == list:
is_iterable = isinstance(output_data, Iterable)
if is_iterable:
all_output_data.extend(output_data)
else:
all_output_data.append(output_data)
if (
function_type == CustomTextOpType.CREATE_ONE_TO_N
and self._prov_tracer is not None
):
if type(output_data) == list:
if is_iterable:
for data in output_data:
self._prov_tracer.add_prov(
data_item=data,
Expand Down
12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,22 @@ priority = "primary"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"


[tool.black]
line-length = 88
preview = true
extend-exclude = ".venv"

[tool.flake8]
max-line-length = 88
select = ["C", "E", "F", "W", "B", "B950"]
extend-ignore = ["E203", "E402", "E501", "W503"]
exclude = [
".git",
".venv",
"__pycache__",
"docs",
]

[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
Expand Down

0 comments on commit f5119ac

Please sign in to comment.