Skip to content

Commit

Permalink
ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
Kabir Khan committed Feb 17, 2024
1 parent 265bf4d commit 1fd8743
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ exclude = [
"dist",
"recon/prodigy/recipes.py"
]
extend-select = ["I001"]
src = ["recon", "tests", "docs/src"]
# Assume Python 3.11.
target-version = "py311"

[tool.ruff.lint]
extend-select = ["I001"]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Assume Python 3.10.
target-version = "py310"

[tool.ruff.isort]

[tool.ruff.lint.isort]
extra-standard-library = ["typing_extensions"]
known-first-party = ["recon"]
2 changes: 1 addition & 1 deletion recon/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def track_change_example(orig_example_hash: int, new_example: Example) -> None:
warnings.warn(
# fmt: off
"This dataset seems to have preset tokens. "
F"Operation: {self.name} is not currently capable of "
f"Operation: {self.name} is not currently capable of "
"handling tokens and you will "
"need to reset tokenization after this operation. "
"Applying the `recon.add_tokens.v1` operation after this "
Expand Down
6 changes: 5 additions & 1 deletion recon/prodigy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from .recipes import recon_ner_correct_stats_v1, recon_ner_correct_v1, recon_ner_merge_v1
from .recipes import (
recon_ner_correct_stats_v1,
recon_ner_correct_v1,
recon_ner_merge_v1,
)
9 changes: 4 additions & 5 deletions recon/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class AnnotationCount(BaseModel):
count: int
examples: List[Example]

def __repr_args__(self) -> 'ReprArgs':
def __repr_args__(self) -> "ReprArgs":
return [arg for arg in super().__repr_args__() if arg[0] != "examples"]


Expand Down Expand Up @@ -347,7 +347,7 @@ def __hash__(self) -> int:
def hash(self) -> int:
return prediction_error_hash(self)

def __repr_args__(self) -> 'ReprArgs':
def __repr_args__(self) -> "ReprArgs":
return [arg for arg in super().__repr_args__() if arg[0] != "examples"]


Expand Down Expand Up @@ -426,7 +426,7 @@ class EntityCoverage(BaseModel):
def __hash__(self) -> int:
return hash((self.text, self.label))

def __repr_args__(self) -> 'ReprArgs':
def __repr_args__(self) -> "ReprArgs":
return [arg for arg in super().__repr_args__() if arg[0] != "examples"]


Expand Down Expand Up @@ -489,8 +489,7 @@ def from_dict(cls, obj: Dict[str, Any]) -> "List[Correction]":
else:
raise ValueError(
"Cannot parse corrections dict. Value must be either a str of the"
" label "
+ "to change the annotation to (TO_LABEL) or a tuple of"
" label " + "to change the annotation to (TO_LABEL) or a tuple of"
" (FROM_LABEL, TO_LABEL)"
)
corrections.append(
Expand Down

0 comments on commit 1fd8743

Please sign in to comment.