mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-30 23:47:55 +03:00 
			
		
		
		
	Merge branch 'master' into feature/django
This commit is contained in:
		
						commit
						7d2ec21855
					
				|  | @ -14,8 +14,9 @@ cache: | |||
|   - $HOME/docs/node_modules | ||||
| before_install: | ||||
| - | | ||||
|   if [ "$TEST_TYPE" != build_website ] && \ | ||||
|     ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs))/' | ||||
|   git_diff=$(git diff --name-only $TRAVIS_COMMIT_RANGE) | ||||
|   if [ "$?" == 0 ] && [ "$TEST_TYPE" != build_website ] && \ | ||||
|     ! echo "$git_diff" | grep -qvE '(\.md$)|(^(docs))/' | ||||
|   then | ||||
|     echo "Only docs were updated, stopping build process." | ||||
|     exit | ||||
|  |  | |||
|  | @ -63,15 +63,15 @@ class Query(graphene.ObjectType): | |||
| 
 | ||||
|     @resolve_only_args | ||||
|     def resolve_ships(self): | ||||
|         return [Ship(s) for s in get_ships()] | ||||
|         return get_ships() | ||||
| 
 | ||||
|     @resolve_only_args | ||||
|     def resolve_rebels(self): | ||||
|         return Faction(get_rebels()) | ||||
|         return get_rebels() | ||||
| 
 | ||||
|     @resolve_only_args | ||||
|     def resolve_empire(self): | ||||
|         return Faction(get_empire()) | ||||
|         return get_empire() | ||||
| 
 | ||||
| 
 | ||||
| class Mutation(graphene.ObjectType): | ||||
|  |  | |||
|  | @ -4,19 +4,13 @@ from graphql.core.type import ( | |||
| 
 | ||||
| from graphene import signals | ||||
| 
 | ||||
| from graphene.core.schema import ( | ||||
|     Schema | ||||
| ) | ||||
| 
 | ||||
| from graphene.core.classtypes import ( | ||||
| from .core import ( | ||||
|     Schema, | ||||
|     ObjectType, | ||||
|     InputObjectType, | ||||
|     Interface, | ||||
|     Mutation, | ||||
|     Scalar | ||||
| ) | ||||
| 
 | ||||
| from graphene.core.types import ( | ||||
|     Scalar, | ||||
|     BaseType, | ||||
|     LazyType, | ||||
|     Argument, | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ class ConnectionOrListField(Field): | |||
|         if not field_object_type: | ||||
|             raise SkipField() | ||||
|         if is_node(field_object_type): | ||||
|             field = DjangoConnectionField(field_object_type) | ||||
|             field = ConnectionField(field_object_type) | ||||
|         else: | ||||
|             field = Field(List(field_object_type)) | ||||
|         field.contribute_to_class(self.object_type, self.attname) | ||||
|  |  | |||
|  | @ -16,9 +16,6 @@ class Reporter(models.Model): | |||
|     def __str__(self):              # __unicode__ on Python 2 | ||||
|         return "%s %s" % (self.first_name, self.last_name) | ||||
| 
 | ||||
|     class Meta: | ||||
|         app_label = 'contrib_django' | ||||
| 
 | ||||
| 
 | ||||
| class Article(models.Model): | ||||
|     headline = models.CharField(max_length=100) | ||||
|  | @ -30,4 +27,3 @@ class Article(models.Model): | |||
| 
 | ||||
|     class Meta: | ||||
|         ordering = ('headline',) | ||||
|         app_label = 'contrib_django' | ||||
|  |  | |||
|  | @ -0,0 +1,46 @@ | |||
| from .schema import ( | ||||
|     Schema | ||||
| ) | ||||
| 
 | ||||
| from .classtypes import ( | ||||
|     ObjectType, | ||||
|     InputObjectType, | ||||
|     Interface, | ||||
|     Mutation, | ||||
|     Scalar | ||||
| ) | ||||
| 
 | ||||
| from .types import ( | ||||
|     BaseType, | ||||
|     LazyType, | ||||
|     Argument, | ||||
|     Field, | ||||
|     InputField, | ||||
|     String, | ||||
|     Int, | ||||
|     Boolean, | ||||
|     ID, | ||||
|     Float, | ||||
|     List, | ||||
|     NonNull | ||||
| ) | ||||
| 
 | ||||
| __all__ = [ | ||||
|     'Argument', | ||||
|     'String', | ||||
|     'Int', | ||||
|     'Boolean', | ||||
|     'Float', | ||||
|     'ID', | ||||
|     'List', | ||||
|     'NonNull', | ||||
|     'Schema', | ||||
|     'BaseType', | ||||
|     'LazyType', | ||||
|     'ObjectType', | ||||
|     'InputObjectType', | ||||
|     'Interface', | ||||
|     'Mutation', | ||||
|     'Scalar', | ||||
|     'Field', | ||||
|     'InputField'] | ||||
|  | @ -63,6 +63,9 @@ class Field(OrderedType): | |||
|             return NonNull(self.type) | ||||
|         return self.type | ||||
| 
 | ||||
|     def decorate_resolver(self, resolver): | ||||
|         return snake_case_args(resolver) | ||||
| 
 | ||||
|     def internal_type(self, schema): | ||||
|         resolver = self.resolver | ||||
|         description = self.description | ||||
|  | @ -85,9 +88,9 @@ class Field(OrderedType): | |||
|                 return my_resolver(instance, args, info) | ||||
|             resolver = wrapped_func | ||||
| 
 | ||||
|         resolver = snake_case_args(resolver) | ||||
|         assert type, 'Internal type for field %s is None' % str(self) | ||||
|         return GraphQLField(type, args=schema.T(arguments), resolver=resolver, | ||||
|         return GraphQLField(type, args=schema.T(arguments), | ||||
|                             resolver=self.decorate_resolver(resolver), | ||||
|                             description=description,) | ||||
| 
 | ||||
|     def __repr__(self): | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| SECRET_KEY = 1 | ||||
| 
 | ||||
| INSTALLED_APPS = [ | ||||
|     'graphene.contrib.django.tests', | ||||
|     'examples.starwars_django', | ||||
| ] | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user