mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-31 07:57:26 +03:00 
			
		
		
		
	Moved relay is_node definition
This commit is contained in:
		
							parent
							
								
									f4062c3fc3
								
							
						
					
					
						commit
						a0228ae6b2
					
				|  | @ -1,9 +1,10 @@ | |||
| from .node import Node | ||||
| from .node import Node, is_node | ||||
| from .mutation import ClientIDMutation | ||||
| from .connection import Connection, ConnectionField | ||||
| 
 | ||||
| __all__ = [ | ||||
|     'Node', | ||||
|     'is_node', | ||||
|     'ClientIDMutation', | ||||
|     'Connection', | ||||
|     'ConnectionField', | ||||
|  |  | |||
|  | @ -12,18 +12,11 @@ from ..types.objecttype import ObjectType, ObjectTypeMeta | |||
| from ..types.options import Options | ||||
| from ..utils.is_base_type import is_base_type | ||||
| from ..utils.props import props | ||||
| from .node import Node | ||||
| from .node import Node, is_node | ||||
| 
 | ||||
| from ..types.utils import get_fields_in_type, yank_fields_from_attrs | ||||
| 
 | ||||
| 
 | ||||
| def is_node(objecttype): | ||||
|     for i in objecttype._meta.interfaces: | ||||
|         if issubclass(i, Node): | ||||
|             return True | ||||
|     return False | ||||
| 
 | ||||
| 
 | ||||
| class PageInfo(ObjectType): | ||||
|     has_next_page = Boolean( | ||||
|         required=True, | ||||
|  | @ -125,8 +118,8 @@ class IterableConnectionField(Field): | |||
|         else: | ||||
|             connection_type = type | ||||
|         assert issubclass(connection_type, Connection), ( | ||||
|             '{} type have to be a subclass of Connection' | ||||
|         ).format(str(self)) | ||||
|             '{} type have to be a subclass of Connection. Received "{}".' | ||||
|         ).format(str(self), connection_type) | ||||
|         return connection_type | ||||
| 
 | ||||
|     @staticmethod | ||||
|  |  | |||
|  | @ -7,6 +7,13 @@ from ..types import ObjectType, Interface, ID, Field | |||
| from ..types.interface import InterfaceMeta | ||||
| 
 | ||||
| 
 | ||||
| def is_node(objecttype): | ||||
|     for i in objecttype._meta.interfaces: | ||||
|         if issubclass(i, Node): | ||||
|             return True | ||||
|     return False | ||||
| 
 | ||||
| 
 | ||||
| def get_default_connection(cls): | ||||
|     from .connection import Connection | ||||
|     assert issubclass(cls, ObjectType), ( | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user