Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ruff rule exclusions and fix underlying issues #193

Merged
merged 4 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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