Skip to content

Commit 30faae5

Browse files
authored
Merge branch 'master' into confection1.1
2 parents 041f47b + 24255bd commit 30faae5

72 files changed

Lines changed: 85 additions & 179 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/tests.yml‎

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,13 @@ jobs:
3333
with:
3434
python-version: "3.10"
3535

36-
- name: black
37-
run: |
38-
python -m pip install black -c requirements.txt
39-
python -m black spacy --check
40-
- name: isort
41-
run: |
42-
python -m pip install isort -c requirements.txt
43-
python -m isort spacy --check
44-
- name: flake8
45-
run: |
46-
python -m pip install flake8==5.0.4
47-
python -m flake8 spacy --count --select=E901,E999,F821,F822,F823,W605 --show-source --statistics
48-
# Unfortunately cython-lint isn't working after the shift to Cython 3.
49-
#- name: cython-lint
50-
# run: |
51-
# python -m pip install cython-lint -c requirements.txt
52-
# # E501: line too log, W291: trailing whitespace, E266: too many leading '#' for block comment
53-
# cython-lint spacy --ignore E501,W291,E266
36+
- name: ruff format
37+
run: |
38+
python -m pip install ruff -c requirements.txt
39+
python -m ruff format spacy --check
40+
- name: ruff isort
41+
run: |
42+
python -m ruff check spacy --select I
5443
5544
tests:
5645
name: Test

‎spacy/__init__.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
# These are imported as part of the API
1111
from thinc.api import Config, prefer_gpu, require_cpu, require_gpu # noqa: F401
1212

13-
from . import pipeline # noqa: F401
14-
from . import util
13+
from . import (
14+
pipeline, # noqa: F401
15+
util,
16+
)
1517
from .about import __version__ # noqa: F401
1618
from .cli.info import info # noqa: F401
1719
from .errors import Errors
1820
from .glossary import explain # noqa: F401
1921
from .language import Language
2022
from .registrations import REGISTRY_POPULATED, populate_registry
21-
from .util import logger, registry # noqa: F401
22-
from .vocab import Vocab
2323

2424
# Rebuild pydantic v2 schemas that use forward references to Language/Vocab
2525
from .schemas import ( # noqa: F401
@@ -29,8 +29,9 @@
2929
ConfigSchemaPretrain,
3030
ConfigSchemaTraining,
3131
)
32-
3332
from .training import Example # noqa: F401
33+
from .util import logger, registry # noqa: F401
34+
from .vocab import Vocab
3435

3536
_rebuild_ns = {"Language": Language, "Vocab": Vocab, "Example": Example}
3637
for _schema in (

‎spacy/cli/_util.py‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
import hashlib
21
import os
3-
import shutil
42
import sys
53
from configparser import InterpolationError
64
from contextlib import contextmanager
75
from pathlib import Path
86
from typing import (
9-
TYPE_CHECKING,
107
Any,
118
Dict,
12-
Iterable,
139
List,
1410
Optional,
1511
Tuple,
@@ -21,22 +17,17 @@
2117
import typer
2218
from click import NoSuchOption
2319
from click.shell_completion import split_arg_string
24-
from thinc.api import Config, ConfigValidationError, require_gpu
20+
from thinc.api import ConfigValidationError, require_gpu
2521
from thinc.util import gpu_is_available
2622
from typer.main import get_command
2723
from wasabi import Printer, msg
2824
from weasel import app as project_cli
2925

30-
from .. import about
3126
from ..compat import Literal
32-
from ..schemas import validate
3327
from ..util import (
3428
ENV_VARS,
35-
SimpleFrozenDict,
3629
import_file,
37-
is_compatible_version,
3830
logger,
39-
make_tempdir,
4031
registry,
4132
run_command,
4233
)

‎spacy/cli/debug_diff.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
from typing import Optional
33

44
import typer
5-
from thinc.api import Config
65
from wasabi import MarkdownRenderer, Printer, diff_strings
76

87
from ..util import load_config
9-
from ._util import Arg, Opt, debug_cli, parse_config_overrides, show_validation_error
8+
from ._util import Arg, Opt, debug_cli, show_validation_error
109
from .init_config import Optimizations, init_config
1110

1211

‎spacy/cli/evaluate.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import re
22
from pathlib import Path
3-
from typing import Any, Dict, List, Optional, Union
3+
from typing import Any, Dict, List, Optional
44

55
import srsly
66
from thinc.api import fix_random_seed
77
from wasabi import Printer
88

99
from .. import displacy, util
10-
from ..scorer import Scorer
1110
from ..tokens import Doc
1211
from ..training import Corpus
1312
from ._util import Arg, Opt, app, benchmark_cli, import_code, setup_gpu

‎spacy/cli/find_threshold.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,8 @@ def filter_config(
207207
),
208208
)
209209
if hasattr(pipe, "cfg"):
210-
setattr(
211-
nlp.get_pipe(pipe_name),
212-
"cfg",
213-
set_nested_item(getattr(pipe, "cfg"), config_keys, threshold),
210+
nlp.get_pipe(pipe_name).cfg = set_nested_item(
211+
pipe.cfg, config_keys, threshold
214212
)
215213

216214
eval_scores = nlp.evaluate(dev_dataset)

‎spacy/compat.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
try: # Python 3.8+
3636
import importlib.metadata as importlib_metadata
3737
except ImportError:
38-
from catalogue import _importlib_metadata as importlib_metadata # type: ignore[no-redef] # noqa: F401
38+
from catalogue import (
39+
_importlib_metadata as importlib_metadata, # type: ignore[no-redef] # noqa: F401
40+
)
3941

4042
from thinc.api import Optimizer # noqa: F401
4143

‎spacy/lang/fa/generate_verbs_exc.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,8 @@
611611
present_ends = ["م", "ی", "د", "یم", "ید", "ند"]
612612

613613
# special case of '#هست':
614-
VERBS_EXC.update({conj: "هست" for conj in ["هست" + end for end in simple_ends]})
615-
VERBS_EXC.update({conj: "هست" for conj in ["نیست" + end for end in simple_ends]})
614+
VERBS_EXC.update(dict.fromkeys(["هست" + end for end in simple_ends], "هست"))
615+
VERBS_EXC.update(dict.fromkeys(["نیست" + end for end in simple_ends], "هست"))
616616

617617
for verb_root in verb_roots:
618618
conjugations = []
@@ -648,4 +648,4 @@
648648
)
649649
)
650650

651-
VERBS_EXC.update({conj: (past,) if past else present for conj in conjugations})
651+
VERBS_EXC.update(dict.fromkeys(conjugations, (past,) if past else present))

‎spacy/lang/ga/lemmatizer.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, List, Tuple
1+
from typing import List, Tuple
22

33
from ...pipeline import Lemmatizer
44
from ...tokens import Token

‎spacy/lang/ht/lemmatizer.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import List, Tuple
22

3-
from ...lookups import Lookups
43
from ...pipeline import Lemmatizer
54
from ...tokens import Token
65

0 commit comments

Comments
 (0)