replace black, isort, pylint with ruff
this is faster enough that it's a huge qol win
This commit is contained in:
parent
c16e091a38
commit
f2f7c78e7e
6 changed files with 15 additions and 31 deletions
|
|
@ -6,10 +6,6 @@ default_language_version:
|
|||
python: python3
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
|
|
@ -27,15 +23,12 @@ repos:
|
|||
rev: v1.1.2
|
||||
hooks:
|
||||
- id: reuse
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.12.0
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.1.6
|
||||
hooks:
|
||||
- id: isort
|
||||
name: isort (python)
|
||||
args: ['--profile', 'black']
|
||||
- repo: https://github.com/pycqa/pylint
|
||||
rev: v2.17.0
|
||||
hooks:
|
||||
- id: pylint
|
||||
additional_dependencies: [click,httpx,lorem-text,simple-parsing,'textual>=0.18.0',tiktoken,websockets]
|
||||
args: ['--source-roots', 'src']
|
||||
# Run the linter.
|
||||
- id: ruff
|
||||
args: [ --fix ]
|
||||
# Run the formatter.
|
||||
- id: ruff-format
|
||||
|
|
|
|||
|
|
@ -89,9 +89,7 @@ A dialog, where USER interacts with AI. AI is helpful, kind, obedient, honest, a
|
|||
*,
|
||||
max_query_size: int = 5,
|
||||
timeout: float = 180,
|
||||
) -> AsyncGenerator[
|
||||
str, None
|
||||
]: # pylint: disable=unused-argument,too-many-locals,too-many-branches
|
||||
) -> AsyncGenerator[str, None]: # pylint: disable=unused-argument,too-many-locals,too-many-branches
|
||||
new_content: list[str] = []
|
||||
inputs = self.make_full_query(session + [User(query)], max_query_size)
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -55,9 +55,7 @@ A dialog, where USER interacts with AI. AI is helpful, kind, obedient, honest, a
|
|||
*,
|
||||
max_query_size: int = 5,
|
||||
timeout: float = 180,
|
||||
) -> AsyncGenerator[
|
||||
str, None
|
||||
]: # pylint: disable=unused-argument,too-many-locals,too-many-branches
|
||||
) -> AsyncGenerator[str, None]: # pylint: disable=unused-argument,too-many-locals,too-many-branches
|
||||
params = {
|
||||
"prompt": self.make_full_query(session + [User(query)], max_query_size),
|
||||
"stream": True,
|
||||
|
|
|
|||
|
|
@ -60,10 +60,9 @@ AI: Hello! How can I assist you today?"""
|
|||
}
|
||||
full_prompt = session + [User(query)]
|
||||
del full_prompt[1:-max_query_size]
|
||||
new_data = old_data = full_query = (
|
||||
"\n".join(f"{role_map.get(q.role,'')}{q.content}\n" for q in full_prompt)
|
||||
+ f"\n{role_map.get('assistant')}"
|
||||
)
|
||||
new_data = old_data = full_query = "\n".join(
|
||||
f"{role_map.get(q.role,'')}{q.content}\n" for q in full_prompt
|
||||
) + f"\n{role_map.get('assistant')}"
|
||||
try:
|
||||
async with websockets.connect( # pylint: disable=no-member
|
||||
f"ws://{self.parameters.server_hostname}:7860/queue/join"
|
||||
|
|
|
|||
|
|
@ -40,9 +40,7 @@ def parser_factory() -> MarkdownIt:
|
|||
return parser
|
||||
|
||||
|
||||
class ChapMarkdown(
|
||||
Markdown, can_focus=True, can_focus_children=False
|
||||
): # pylint: disable=function-redefined
|
||||
class ChapMarkdown(Markdown, can_focus=True, can_focus_children=False): # pylint: disable=function-redefined
|
||||
BINDINGS = [
|
||||
Binding("ctrl+y", "yank", "Yank text", show=True),
|
||||
Binding("ctrl+r", "resubmit", "resubmit", show=True),
|
||||
|
|
|
|||
|
|
@ -123,9 +123,7 @@ def do_session_continue(
|
|||
ctx.obj.session_filename = value
|
||||
|
||||
|
||||
def do_session_last(
|
||||
ctx: click.Context, param: click.Parameter, value: bool
|
||||
) -> None: # pylint: disable=unused-argument
|
||||
def do_session_last(ctx: click.Context, param: click.Parameter, value: bool) -> None: # pylint: disable=unused-argument
|
||||
if not value:
|
||||
return
|
||||
do_session_continue(ctx, param, last_session_path())
|
||||
|
|
|
|||
Loading…
Reference in a new issue