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

CI: format check using Ruff #1557

Merged
merged 4 commits into from
Jun 28, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install ruff tox
- name: Format check using Ruff
run: ruff format --check
- name: Run lint
run: tox
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ venv/
*.sqlite3
.vscode
.mypy_cache
.ruff_cache
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ repos:
rev: v2.37.3
hooks:
- id: pyupgrade
- repo: https://github.com/psf/black
rev: 22.6.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.4.10
hooks:
- id: black
- id: ruff-format
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
Expand Down
1 change: 0 additions & 1 deletion examples/simple_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class Patron(graphene.ObjectType):


class Query(graphene.ObjectType):

patron = graphene.Field(Patron)

def resolve_patron(root, info):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
"data": {"node": {"id": "U2hpcDox", "name": "X-Wing"}}
}

snapshots[
"test_str_schema 1"
] = '''type Query {
snapshots["test_str_schema 1"] = '''type Query {
rebels: Faction
empire: Faction
node(
Expand Down
1 change: 0 additions & 1 deletion graphene/relay/tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class SharedNodeFields:

shared = String()
something_else = String()

Expand Down
4 changes: 1 addition & 3 deletions graphene/types/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ def __call__(cls, *args, **kwargs): # noqa: N805
def __iter__(cls):
return cls._meta.enum.__iter__()

def from_enum(
cls, enum, name=None, description=None, deprecation_reason=None
): # noqa: N805
def from_enum(cls, enum, name=None, description=None, deprecation_reason=None): # noqa: N805
name = name or enum.__name__
description = description or enum.__doc__ or "An enumeration."
meta_dict = {
Expand Down
2 changes: 1 addition & 1 deletion graphene/types/tests/test_scalars_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_serializes_output_string():
assert String.serialize(-1.1) == "-1.1"
assert String.serialize(True) == "true"
assert String.serialize(False) == "false"
assert String.serialize("\U0001F601") == "\U0001F601"
assert String.serialize("\U0001f601") == "\U0001f601"


def test_serializes_output_boolean():
Expand Down
1 change: 0 additions & 1 deletion graphene/utils/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def __init__(
cache_map=None,
loop=None,
):

self._loop = loop

if batch_load_fn is not None:
Expand Down
3 changes: 0 additions & 3 deletions graphene/utils/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def deprecated(reason):
"""

if isinstance(reason, string_types):

# The @deprecated is used with a 'reason'.
#
# .. code-block:: python
Expand All @@ -27,7 +26,6 @@ def deprecated(reason):
# pass

def decorator(func1):

if inspect.isclass(func1):
fmt1 = f"Call to deprecated class {func1.__name__} ({reason})."
else:
Expand All @@ -43,7 +41,6 @@ def new_func1(*args, **kwargs):
return decorator

elif inspect.isclass(reason) or inspect.isfunction(reason):

# The @deprecated is used without any 'reason'.
#
# .. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run_tests(self):
"coveralls>=3.3,<4",
]

dev_requires = ["black==22.3.0", "flake8>=4,<5"] + tests_require
dev_requires = ["ruff==0.4.10", "flake8>=4,<5"] + tests_require

setup(
name="graphene",
Expand Down
Loading