Skip to content

Commit 6ceba53

Browse files
authored
Merge branch 'main' into feature/django-forms-inputobjecttype
2 parents 5f6311c + 52f9921 commit 6ceba53

File tree

31 files changed

+267
-314
lines changed

31 files changed

+267
-314
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python 3.9
15-
uses: actions/setup-python@v2
13+
- uses: actions/checkout@v3
14+
- name: Set up Python 3.11
15+
uses: actions/setup-python@v4
1616
with:
17-
python-version: 3.9
17+
python-version: '3.11'
1818
- name: Build wheel and source tarball
1919
run: |
2020
pip install wheel
2121
python setup.py sdist bdist_wheel
2222
- name: Publish a Python distribution to PyPI
23-
uses: pypa/gh-action-pypi-publish@v1.1.0
23+
uses: pypa/gh-action-pypi-publish@v1.8.6
2424
with:
2525
user: __token__
2626
password: ${{ secrets.pypi_password }}

.github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Set up Python 3.9
12-
uses: actions/setup-python@v2
10+
- uses: actions/checkout@v3
11+
- name: Set up Python 3.11
12+
uses: actions/setup-python@v4
1313
with:
14-
python-version: 3.9
14+
python-version: '3.11'
1515
- name: Install dependencies
1616
run: |
1717
python -m pip install --upgrade pip

.github/workflows/tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ jobs:
1313
include:
1414
- django: "3.2"
1515
python-version: "3.7"
16+
- django: "4.1"
17+
python-version: "3.11"
1618
steps:
17-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
1820
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v4
2022
with:
2123
python-version: ${{ matrix.python-version }}
2224
- name: Install dependencies

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
default_language_version:
2-
python: python3.9
2+
python: python3.11
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
5+
rev: v4.4.0
66
hooks:
77
- id: check-merge-conflict
88
- id: check-json
@@ -16,15 +16,15 @@ repos:
1616
- id: trailing-whitespace
1717
exclude: README.md
1818
- repo: https://github.com/asottile/pyupgrade
19-
rev: v3.2.0
19+
rev: v3.3.2
2020
hooks:
2121
- id: pyupgrade
2222
args: [--py37-plus]
2323
- repo: https://github.com/psf/black
24-
rev: 22.10.0
24+
rev: 23.3.0
2525
hooks:
2626
- id: black
2727
- repo: https://github.com/PyCQA/flake8
28-
rev: 5.0.4
28+
rev: 6.0.0
2929
hooks:
3030
- id: flake8

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ help:
66
.PHONY: dev-setup ## Install development dependencies
77
dev-setup:
88
pip install -e ".[dev]"
9+
python -m pre_commit install
910

1011
.PHONY: tests ## Run unit tests
1112
tests:

docs/filtering.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Filtering
22
=========
33

44
Graphene integrates with
5-
`django-filter <https://django-filter.readthedocs.io/en/main/>`__ to provide filtering of results.
6-
See the `usage documentation <https://django-filter.readthedocs.io/en/main/guide/usage.html#the-filter>`__
5+
`django-filter <https://django-filter.readthedocs.io/en/stable/>`__ to provide filtering of results.
6+
See the `usage documentation <https://django-filter.readthedocs.io/en/stable/guide/usage.html#the-filter>`__
77
for details on the format for ``filter_fields``.
88

99
This filtering is automatically available when implementing a ``relay.Node``.

examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class Migration(migrations.Migration):
8-
98
initial = True
109

1110
dependencies = []

examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("ingredients", "0001_initial"),
109
]

examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("ingredients", "0002_auto_20161104_0050"),
109
]

examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class Migration(migrations.Migration):
8-
98
initial = True
109

1110
dependencies = [

examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("recipes", "0001_initial"),
109
]

examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("recipes", "0002_auto_20161104_0106"),
109
]

examples/cookbook/cookbook/ingredients/migrations/0001_initial.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class Migration(migrations.Migration):
8-
98
initial = True
109

1110
dependencies = []

examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("ingredients", "0001_initial"),
109
]

examples/cookbook/cookbook/recipes/migrations/0001_initial.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class Migration(migrations.Migration):
8-
98
initial = True
109

1110
dependencies = [

examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("recipes", "0001_initial"),
109
]

graphene_django/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from .fields import DjangoConnectionField, DjangoListField
22
from .types import DjangoObjectType
33

4-
__version__ = "3.0.0"
4+
__version__ = "3.0.2"
55

66
__all__ = [
77
"__version__",

graphene_django/converter.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ class EnumWithDescriptionsType:
9696
def description(self):
9797
return str(named_choices_descriptions[self.name])
9898

99-
return_type = Enum(name, list(named_choices), type=EnumWithDescriptionsType)
99+
return_type = Enum(
100+
name,
101+
list(named_choices),
102+
type=EnumWithDescriptionsType,
103+
description="An enumeration.", # Temporary fix until https://github.com/graphql-python/graphene/pull/1502 is merged
104+
)
100105
return return_type
101106

102107

@@ -315,26 +320,7 @@ def dynamic_type():
315320
if not _type:
316321
return
317322

318-
class CustomField(Field):
319-
def wrap_resolve(self, parent_resolver):
320-
"""
321-
Implements a custom resolver which go through the `get_node` method to ensure that
322-
it goes through the `get_queryset` method of the DjangoObjectType.
323-
"""
324-
resolver = super().wrap_resolve(parent_resolver)
325-
326-
def custom_resolver(root, info, **args):
327-
fk_obj = resolver(root, info, **args)
328-
if not isinstance(fk_obj, model):
329-
# In case the resolver is a custom one that overwrites
330-
# the default Django resolver
331-
# This happens, for example, when using custom awaitable resolvers.
332-
return fk_obj
333-
return _type.get_node(info, fk_obj.pk)
334-
335-
return custom_resolver
336-
337-
return CustomField(
323+
return Field(
338324
_type,
339325
description=get_django_field_description(field),
340326
required=not field.null,

graphene_django/filter/tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class Query(graphene.ObjectType):
8787
events = DjangoFilterConnectionField(EventType)
8888

8989
def resolve_events(self, info, **kwargs):
90-
9190
events = [
9291
Event(name="Live Show", tags=["concert", "music", "rock"]),
9392
Event(name="Musical", tags=["movie", "music"]),

graphene_django/forms/mutation.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ class Meta:
8282
def __init_subclass_with_meta__(
8383
cls, form_class=None, only_fields=(), exclude_fields=(), **options
8484
):
85-
8685
if not form_class:
8786
raise Exception("form_class is required for DjangoFormMutation")
8887

@@ -129,7 +128,6 @@ def __init_subclass_with_meta__(
129128
exclude_fields=(),
130129
**options,
131130
):
132-
133131
if not form_class:
134132
raise Exception("form_class is required for DjangoModelFormMutation")
135133

graphene_django/management/commands/graphql_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_schema(self, schema, out, indent):
6363
if out == "-" or out == "-.json":
6464
self.stdout.write(json.dumps(schema_dict, indent=indent, sort_keys=True))
6565
elif out == "-.graphql":
66-
self.stdout.write(print_schema(schema))
66+
self.stdout.write(print_schema(schema.graphql_schema))
6767
else:
6868
# Determine format
6969
_, file_extension = os.path.splitext(out)

graphene_django/rest_framework/mutation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def __init_subclass_with_meta__(
7272
_meta=None,
7373
**options
7474
):
75-
7675
if not serializer_class:
7776
raise Exception("serializer_class is required for the SerializerMutation")
7877

0 commit comments

Comments
 (0)