Skip to content

Commit

Permalink
Update ruff and fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ev-1 committed Mar 9, 2024
1 parent 19f51ba commit 1c1466a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ clean:

# Run ruff
lint: venv
{{python}} -m ruff . --fix
{{python}} -m ruff check . --fix

# Run tests
test: venv
Expand Down
8 changes: 4 additions & 4 deletions musicbot/utils/localisation/localizer/localizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _load_localization(self, lang):
def _parse_localization_dictionary(d, lookup, prefix=None):
n_dict = {}
for k, v in d.items():
if type(v) is str:
if isinstance(v, str):
n_dict[k] = Localizer._parse_localization_string(v, lookup, prefix)
else:
n_dict[k] = v
Expand Down Expand Up @@ -137,11 +137,11 @@ def format_dict(self, d, lang=None, prefix=None, **kvpairs):
cursorQueue = [nd]
while cursorQueue:
cursor = cursorQueue.pop()
for k, v in (cursor.items() if type(cursor) == dict else enumerate(cursor)):
if type(v) == str:
for k, v in (cursor.items() if isinstance(cursor, dict) else enumerate(cursor)):
if isinstance(v, str):
# insert translations based on lang
cursor[k] = self.format_str(v, lang, prefix, **kvpairs)
elif type(v) == dict or type(v) == list:
elif isinstance(v, dict) or isinstance(v, list):
cursorQueue.append(v)

return nd
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ pythonpath = ["."]

[tool.ruff]
# Allow lines to be as long as 120 characters.
select = ["F", "E", "B", "W", "I001"]
lint.select = ["F", "E", "B", "W", "I001"]
line-length = 120

[tool.ruff.isort]
[tool.ruff.lint.isort]
section-order = ["future", "standard-library", "discord", "third-party", "first-party", "local-folder"]
[tool.ruff.isort.sections]
[tool.ruff.lint.isort.sections]
"discord" = ["discord", "lavalink"]

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ asyncio
pyyaml
BeautifulSoup4
pytest
ruff==0.0.274
ruff
pre-commit

0 comments on commit 1c1466a

Please sign in to comment.