Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ruff pre-commit #26

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ repos:
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.199'
hooks:
- id: ruff
# Respect `exclude` and `extend-exclude` settings.
args: ["--force-exclude"]
2 changes: 1 addition & 1 deletion plugins/cell/txl_cell/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def source(self, value: List[str]):
def outputs(self) -> List[Dict[str:Any]]:
return self.outputs

@source.setter
@outputs.setter
def outputs(self, value: List[Dict[str:Any]]):
self.outputs = value

Expand Down
2 changes: 0 additions & 2 deletions plugins/editors/txl_editors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
__version__ = "0.1.4"

from .components import Editors
3 changes: 2 additions & 1 deletion plugins/file_browser/txl_filebrowser/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def __init__(
)

def process_label(self, label: TextType):
"""Process a str or Text in to a label. Maybe overridden in a subclass to change modify how labels are rendered.
"""Process a str or Text in to a label. Maybe overridden in a subclass to change
modify how labels are rendered.
Args:
label (TextType): Label.
Returns:
Expand Down
1 change: 0 additions & 1 deletion plugins/jpterm/txl_jpterm/main_area.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from textual.widget import Widget
from textual.widgets import Static

from txl.base import MainArea as AbstractMainArea

Expand Down
1 change: 0 additions & 1 deletion plugins/launcher/txl_launcher/components.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from asphalt.core import Component, Context
from textual.app import ComposeResult
from textual.widget import Widget
from textual.widgets import Button
from txl.base import Launcher, MainArea
Expand Down
2 changes: 0 additions & 2 deletions plugins/notebook/txl_notebook/components.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Any, Dict, List

from asphalt.core import Component, Context
from jupyter_ydoc import YNotebook
from txl.base import Notebook, NotebookFactory
Expand Down
2 changes: 0 additions & 2 deletions plugins/notebook_editor/txl_notebook_editor/components.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pathlib import Path

from asphalt.core import Component, Context
from textual.binding import Binding
from textual.containers import Container
Expand Down
5 changes: 3 additions & 2 deletions plugins/notebook_viewer/txl_notebook_viewer/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ def update_viewer(self):
)
theme = "ansi_dark"

if not "cells" in self.nb:
if "cells" not in self.nb:
return

for cell in self.nb["cells"]:
execution_count = (
f"[green]In [[#66ff00]{cell['execution_count'] or ' '}[/#66ff00]]:[/green]"
f"[green]In [[#66ff00]{cell['execution_count'] or ' '}"
"[/#66ff00]]:[/green]"
if "execution_count" in cell
else ""
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/remote_contents/txl_remote_contents/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __aiter__(self):
async def __anext__(self) -> bytes:
try:
message = await self.recv()
except:
except BaseException:
raise StopAsyncIteration()
return message

Expand Down
1 change: 0 additions & 1 deletion plugins/text_viewer/txl_text_viewer/components.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from asphalt.core import Component, Context
from rich.syntax import Syntax
from rich.traceback import Traceback
from textual.scroll_view import ScrollView
from textual.widgets import Static
from txl.base import Editor, Editors, Contents, FileOpenEvent
from txl.hooks import register_component
Expand Down
2 changes: 1 addition & 1 deletion txl/txl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def source(self, value: List[str]):
def outputs(self) -> List[Dict[str, Any]]:
...

@source.setter
@outputs.setter
@abstractmethod
def outputs(self, value: List[Dict[str, Any]]):
...
Expand Down