From baef6254aeb359a56ba02ff6664149421182366a Mon Sep 17 00:00:00 2001 From: Benjamin Kiessling Date: Wed, 17 Jan 2024 22:27:44 +0100 Subject: [PATCH] Slight linting --- kraken/ketos/segmentation.py | 2 +- kraken/kraken.py | 6 +++--- kraken/lib/layers.py | 2 +- kraken/transcribe.py | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/kraken/ketos/segmentation.py b/kraken/ketos/segmentation.py index 271df1394..c144e9fbd 100644 --- a/kraken/ketos/segmentation.py +++ b/kraken/ketos/segmentation.py @@ -49,7 +49,7 @@ def _validate_merging(ctx, param, value): try: for m in value: lexer = shlex.shlex(m, posix=True) - lexer.wordchars += '\/.+-()=^&;,.' + lexer.wordchars += r'\/.+-()=^&;,.' tokens = list(lexer) if len(tokens) != 3: raise ValueError diff --git a/kraken/kraken.py b/kraken/kraken.py index 18942b245..633d7bdfe 100644 --- a/kraken/kraken.py +++ b/kraken/kraken.py @@ -30,7 +30,7 @@ from functools import partial from rich.traceback import install -from typing import Dict, Union, List, cast, Any, IO, Callable +from typing import Dict, cast, Any, IO, Callable import click @@ -544,14 +544,14 @@ def _validate_mm(ctx, param, value): model_dict = {'ignore': []} # type: Dict[str, Union[str, List[str]]] if len(value) == 1: lexer = shlex.shlex(value[0], posix=True) - lexer.wordchars += '\/.+-()=^&;,.' + lexer.wordchars += r'\/.+-()=^&;,.' if len(list(lexer)) == 1: model_dict['default'] = value[0] return model_dict try: for m in value: lexer = shlex.shlex(m, posix=True) - lexer.wordchars += '\/.+-()=^&;,.' + lexer.wordchars += r'\/.+-()=^&;,.' tokens = list(lexer) if len(tokens) != 3: raise ValueError diff --git a/kraken/lib/layers.py b/kraken/lib/layers.py index 22ffdd6af..76f069574 100644 --- a/kraken/lib/layers.py +++ b/kraken/lib/layers.py @@ -30,7 +30,7 @@ def forward(self, *inputs, output_shape: Optional[Tuple[int, int]] = None): modules = self._modules.values() i = 0 for module in modules: - if type(inputs) == tuple: + if isinstance(inputs, tuple): inputs = module(*inputs, output_shape=output_shape if i == len(modules) - 1 else None) else: inputs = module(inputs, output_shape=output_shape if i == len(modules) - 1 else None) diff --git a/kraken/transcribe.py b/kraken/transcribe.py index fd4b645ab..5b39ee2f7 100644 --- a/kraken/transcribe.py +++ b/kraken/transcribe.py @@ -18,7 +18,6 @@ from kraken.lib.exceptions import KrakenInputException from kraken.lib.util import get_im_str -from typing import List from jinja2 import Environment, PackageLoader from io import BytesIO