Skip to content

Commit 65544e2

Browse files
authored
chore: swap to using ruff for codestyle (#1706)
* chore: swap to using ruff for codestyle This includes black and isort, which was currently used. * docs: add info to CHANGES * fix: remove unused imports * fix: remove f-string usage where not needed * tests: remove sort in tox * fix: sort, ignore and adjust imports * fix: ignore unused variables in flow tests * fix: remove unsued variable * fix: type references * fix: object type checks * style: general formatting
1 parent f9c2dc8 commit 65544e2

30 files changed

+39
-63
lines changed

.github/workflows/python-package.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ jobs:
5050
run: |
5151
tox -e codestyle
5252
53-
- name: Lint - sort
54-
if: ${{ matrix.python-version == '3.12' }}
55-
run: |
56-
tox -e sort
57-
5853
- name: Security
5954
if: ${{ matrix.python-version == '3.12' }}
6055
run: |

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fixes:
1212
- docs: fix telegram install command (#1697)
1313
- chore: add python versions to test (#1705)
1414
- chore: remove python 3.8 support (#1707)
15+
- chore: use ruff for formatting (#1706)
1516

1617
v6.2.0 (2024-01-01)
1718
-------------------

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15-
import subprocess, sys, os
15+
import subprocess
16+
import sys
17+
import os
1618
sys.path.append(os.path.abspath('_themes'))
1719
sys.path.append(os.path.abspath('_themes/err'))
1820
sys.path.append(os.path.abspath('../'))

errbot/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
import logging
44
import re
55
import shlex
6-
import sys
76
from functools import wraps
8-
from typing import Any, Callable, List, Optional, Tuple
7+
from typing import Any, Callable, Optional, Tuple
98

109
from .backends.base import AWAY, DND, OFFLINE, ONLINE, Message # noqa
1110
from .botplugin import ( # noqa
@@ -16,7 +15,7 @@
1615
ShlexArgParser,
1716
ValidationException,
1817
)
19-
from .core_plugins.wsview import WebView, route
18+
from .core_plugins.wsview import route
2019
from .flow import FLOW_END, BotFlow, Flow, FlowRoot
2120

2221
__all__ = [

errbot/backend_plugin_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PluginNotFoundException(Exception):
1515

1616

1717
def enumerate_backend_plugins(
18-
all_plugins_paths: List[Union[str, Path]]
18+
all_plugins_paths: List[Union[str, Path]],
1919
) -> Iterator[PluginInfo]:
2020
plugin_places = [Path(root) for root in all_plugins_paths]
2121
for path in plugin_places:

errbot/backends/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import time
55
from abc import ABC, abstractmethod
66
from collections import defaultdict, deque
7-
from typing import Any, BinaryIO, List, Mapping, Optional, Sequence, Tuple
7+
from typing import Any, BinaryIO, List, Mapping, Optional, Sequence, Tuple, Type
88

99
log = logging.getLogger(__name__)
1010

@@ -391,7 +391,7 @@ def extras(self) -> Mapping:
391391
return self._extras
392392

393393
@property
394-
def flow(self) -> "errbot.Flow":
394+
def flow(self) -> Type["errbot.Flow"]: # noqa: F821
395395
"""
396396
Get the conversation flow for this message.
397397

errbot/backends/irc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
bg_default=NSC("\x03,"),
5050
fx_reset=NSC("\x03"),
5151
fx_bold=NSC("\x02"),
52-
fx_italic=NSC("\x1D"),
53-
fx_underline=NSC("\x1F"),
54-
fx_not_italic=NSC("\x0F"),
55-
fx_not_underline=NSC("\x0F"),
56-
fx_normal=NSC("\x0F"),
52+
fx_italic=NSC("\x1d"),
53+
fx_underline=NSC("\x1f"),
54+
fx_not_italic=NSC("\x0f"),
55+
fx_not_underline=NSC("\x0f"),
56+
fx_normal=NSC("\x0f"),
5757
fixed_width="",
5858
end_fixed_width="",
5959
inline_code="",

errbot/backends/telegram_messenger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
import sys
3-
from typing import Any, BinaryIO, List, Optional, Union
3+
from typing import Any, BinaryIO, Optional, Union
44

55
from errbot.backends.base import (
66
ONLINE,

errbot/backends/xmpp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from datetime import datetime
66
from functools import lru_cache
77
from time import sleep
8-
from typing import Callable, List, Optional, Tuple
8+
from typing import Callable, List, Optional, Tuple, Union
99

1010
from errbot.backends.base import (
1111
AWAY,
@@ -28,7 +28,6 @@
2828
try:
2929
from slixmpp import JID, ClientXMPP
3030
from slixmpp.exceptions import IqError
31-
from slixmpp.xmlstream import cert, resolver
3231

3332
except ImportError:
3433
log.exception("Could not start the XMPP backend")

errbot/botplugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def recurse_check_structure(sample: Any, to_check: Any) -> None:
4444
recurse_check_structure(sample[0], element)
4545
return
4646

47-
if sample_type == dict:
47+
if sample_type == dict: # noqa: E721
4848
for key in sample:
4949
if key not in to_check:
5050
raise ValidationException(f"{to_check} doesn't contain the key {key}.")
@@ -128,7 +128,7 @@ def __init__(
128128
self.definition = cmd_type(*((function,) + cmd_args), **cmd_kwargs)
129129

130130
def append_args(self, args, kwargs):
131-
from errbot import arg_botcmd, update_wrapper
131+
from errbot import update_wrapper
132132

133133
if hasattr(self.definition, "_err_command_parser"):
134134
update_wrapper(self.definition, args, kwargs)

0 commit comments

Comments
 (0)