Skip to content

Commit

Permalink
Remove ruff rule exclusions and fix underlying issues (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
goodmami authored Nov 17, 2023
1 parent cdedc14 commit dc58d48
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
5 changes: 0 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ select = [
"F", # Pyflakes
"W", # pycodestyle
]
ignore = [
"B007",
"B028",
"B904",
]
target-version = "py38"

[tool.ruff.per-file-ignores]
Expand Down
2 changes: 1 addition & 1 deletion wn/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _validate(args):
with open(args.output_file, 'w') as outfile:
json.dump(report, outfile, indent=2)
else:
for code, check in report.items():
for _code, check in report.items():
if not check['items']:
continue
print(f' {check["message"]}')
Expand Down
11 changes: 6 additions & 5 deletions wn/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,8 @@ def __init__(
if missing:
warnings.warn(
f'lexicon dependencies not available: {missing}',
wn.WnWarning
wn.WnWarning,
stacklevel=2,
)
expand = ' '.join(
f'{id}:{ver}' for id, ver, _id in deps if _id is not None
Expand All @@ -1160,7 +1161,7 @@ def word(self, id: str) -> Word:
try:
return Word(*next(iterable), self)
except StopIteration:
raise wn.Error(f'no such lexical entry: {id}')
raise wn.Error(f'no such lexical entry: {id}') from None

def words(
self,
Expand All @@ -1183,7 +1184,7 @@ def synset(self, id: str) -> Synset:
try:
return Synset(*next(iterable), self)
except StopIteration:
raise wn.Error(f'no such synset: {id}')
raise wn.Error(f'no such synset: {id}') from None

def synsets(
self,
Expand All @@ -1210,7 +1211,7 @@ def sense(self, id: str) -> Sense:
try:
return Sense(*next(iterable), self)
except StopIteration:
raise wn.Error(f'no such sense: {id}')
raise wn.Error(f'no such sense: {id}') from None

def senses(
self,
Expand All @@ -1233,7 +1234,7 @@ def ili(self, id: str) -> ILI:
try:
return ILI(*next(iterable))
except StopIteration:
raise wn.Error(f'no such ILI: {id}')
raise wn.Error(f'no such ILI: {id}') from None

def ilis(self, status: Optional[str] = None) -> List[ILI]:
"""Return the list of ILIs in this wordnet.
Expand Down

0 comments on commit dc58d48

Please sign in to comment.