Skip to content

Commit

Permalink
fix: ran linting
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethEnevoldsen committed Dec 6, 2023
1 parent 464feef commit 76abfdd
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
@@ -1,6 +1,6 @@
# GitHub action to run linting

name: run-pre-commit
name: run linting

on:
pull_request:
Expand All @@ -19,7 +19,7 @@ jobs:
python-version: "3.9"
cache: "pip"

- name: Install pre-commit
- name: Install dependencies
run: make install

- name: Lint
Expand Down
3 changes: 2 additions & 1 deletion docs/evaluation/utils.py
Expand Up @@ -6,12 +6,13 @@
import numpy as np
import pandas as pd
import spacy
from evaluation.datasets import datasets
from spacy.language import Language
from spacy.scorer import Scorer
from spacy.tokens import Doc
from spacy.training import Example

from evaluation.datasets import datasets


def bootstrap(
examples: List[Example],
Expand Down
3 changes: 2 additions & 1 deletion docs/performance_ner.ipynb
Expand Up @@ -70,8 +70,8 @@
"outputs": [],
"source": [
"import spacy\n",
"from spacy.tokens import Span\n",
"from spacy import displacy\n",
"from spacy.tokens import Span\n",
"\n",
"text = \"\"\"To kendte russiske historikere Andronik Mirganjan og Igor Klamkin tror ikke, at Rusland kan udvikles uden en \"jernnæve\".\"\"\"\n",
"nlp = spacy.blank(\"da\")\n",
Expand Down Expand Up @@ -549,6 +549,7 @@
],
"source": [
"from functools import partial\n",
"\n",
"from evaluation.models import openai_model_loader_fine_ner\n",
"\n",
"MODELS_ = MODELS.copy()\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/robustness.ipynb
Expand Up @@ -63,8 +63,8 @@
},
"outputs": [],
"source": [
"import spacy\n",
"import dacy\n",
"import spacy\n",
"\n",
"# load models\n",
"spacy_small = spacy.load(\"da_core_news_sm\")\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/sentiment.ipynb
Expand Up @@ -345,8 +345,8 @@
}
],
"source": [
"import spacy\n",
"import asent\n",
"import spacy\n",
"\n",
"# load a spacy pipeline\n",
"# equivalent to a dacy.load()\n",
Expand Down
2 changes: 1 addition & 1 deletion makefile
Expand Up @@ -9,7 +9,7 @@ static-type-check:
lint:
@echo "--- 🧹 Running linters ---"
ruff format . # running ruff formatting
ruff . --fix # running ruff linting
ruff src/ --fix # running ruff linting

test:
@echo "--- 🧪 Running tests ---"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Expand Up @@ -105,11 +105,11 @@ where = ["src"]
omit = ["**/tests/*", "**/about.py", "**/dev/*"]

[tool.pyright]
exclude = [".*venv*", ".tox"]
exclude = [".*venv*"]
pythonPlatform = "Darwin"

[tool.ruff]
extend-include = ["*.ipynb"]
# extend-include = ["*.ipynb"]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = [
"A",
Expand Down
4 changes: 2 additions & 2 deletions src/dacy/datasets/dane.py
Expand Up @@ -20,7 +20,7 @@ def dane( # noqa
n_sents: int = 1,
open_unverified_connection: bool = False,
**kwargs, # noqa
) -> Union[List[Corpus], Corpus]: # type: ignore
) -> Union[List[Corpus], Corpus]: # type: ignore
"""Reads the DaNE dataset as a spacy Corpus.
Args:
Expand Down Expand Up @@ -110,5 +110,5 @@ def dane( # noqa
for split in splits:
corpora.append(Corpus(save_path / paths[split])) # type: ignore
if len(corpora) == 1:
return corpora[0] # type: ignore
return corpora[0] # type: ignore
return corpora
6 changes: 3 additions & 3 deletions src/dacy/datasets/names.py
Expand Up @@ -81,7 +81,7 @@ def muslim_names() -> Dict[str, List[str]]: # type: ignore
return load_names(ethnicity="muslim")


def danish_names() -> Dict[str, List[str]]: # type: ignore
def danish_names() -> Dict[str, List[str]]: # type: ignore
"""Returns a dictionary of Danish names.
Returns:
Expand All @@ -98,7 +98,7 @@ def danish_names() -> Dict[str, List[str]]: # type: ignore
return load_names(ethnicity="danish")


def female_names() -> Dict[str, List[str]]: # type: ignore
def female_names() -> Dict[str, List[str]]: # type: ignore
"""Returns a dictionary of Danish female names.
Returns:
Expand All @@ -114,7 +114,7 @@ def female_names() -> Dict[str, List[str]]: # type: ignore
return load_names(ethnicity="danish", gender="female", min_prop_gender=0.5)


def male_names() -> Dict[str, List[str]]: # type: ignore
def male_names() -> Dict[str, List[str]]: # type: ignore
"""Returns a dictionary of Danish male names.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion src/dacy/download.py
Expand Up @@ -112,7 +112,7 @@ def download_model(
+ " list of all models",
)

mdl = model.split("-")[0] # type: ignore
mdl = model.split("-")[0] # type: ignore
if mdl in get_installed_models() and not force and version(mdl) == mdl_version:
return mdl
install(models_url[model])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_hate_speech.py
@@ -1,4 +1,4 @@
import dacy # noqa
import dacy
import spacy


Expand Down
2 changes: 1 addition & 1 deletion tests/test_sentiment.py
@@ -1,4 +1,4 @@
import dacy # noqa
import dacy
import spacy


Expand Down

0 comments on commit 76abfdd

Please sign in to comment.