Skip to content

Commit

Permalink
Add ruff and fix items for files not modified in other PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
pydanny committed Oct 22, 2023
1 parent ee5d09c commit 1a7c3b2
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 34 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lint:
black .
ruff check . --fix
55 changes: 30 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ dependencies = [
dev = [
"black", # code auto-formatting
"coverage==7.3.2", # testing
"isort", # code auto-formatting
"mypy", # linting
"myst-parser", # markdown parsing
"pytest", # testing
"ruff==0.0.292", # linting
"ruff", # linting
"sphinx", # documentation
"pre-commit==3.4.0", # manages and maintains pre-commit hooks
]
Expand All @@ -61,30 +60,36 @@ package-dir = {"" = "src"}
[project.scripts]
hist = "interviewkit.cli:app"


# Isort
# -----

[tool.isort]
line_length = 99
profile = "black"
default_section = "THIRDPARTY"
lines_after_imports = 2


# Mypy
# Ruff
# ----

[tool.mypy]
files = "."
[tool.ruff]
select = [
"E", # pycodestyle
"F", # pyflakes
"I", # isort
]
ignore = [
"E501", # line too long - black takes care of this for us
]

# Use strict defaults
strict = true
warn_unreachable = true
warn_no_return = true
[tool.ruff.per-file-ignores]
# Allow unused imports in __init__ files as these are convenience imports
"**/__init__.py" = [ "F401" ]

[tool.ruff.isort]
lines-after-imports = 2
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"project",
"local-folder",
]

[[tool.mypy.overrides]]
# Don't require test functions to include types
module = "tests.*"
allow_untyped_defs = true
disable_error_code = "attr-defined"
[tool.ruff.isort.sections]
"project" = [
"src",
"tests",
]
5 changes: 2 additions & 3 deletions src/interviewkit/cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import sys
import typer

from pathlib import Path
from typing_extensions import Annotated

import typer
from slicer import audio_slicing
from transcript import transcribe_from_paths
from typing_extensions import Annotated


__version__ = '0.0.1'
Expand Down
4 changes: 2 additions & 2 deletions src/interviewkit/interview.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from random import choice
from interviewee import Interviewee
from enum import StrEnum, auto

from interviewee import Interviewee
from transcript import Transcript


Expand Down
3 changes: 2 additions & 1 deletion src/interviewkit/slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
python interviewkit/slicer.py data/Martine+Barrat_FINAL.mp3 80:30 90:40
"""
import shutil
import sys
from pathlib import Path
import shutil


try:
import pydub
Expand Down
9 changes: 6 additions & 3 deletions src/interviewkit/transcript_using_m5.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import sys
from pathlib import Path

from rich.console import Console
import sys
from transformers import T5Tokenizer, T5ForConditionalGeneration
from transformers import T5ForConditionalGeneration, T5Tokenizer


try:
import whisper
except ImportError:
print("Please install Whisper: pip install openai-whisper")
exit(1)

from whisper.utils import get_writer
from pydantic import BaseModel
from whisper.utils import get_writer


console = Console()

Expand Down

0 comments on commit 1a7c3b2

Please sign in to comment.