def graphql_run_async(): from graphql import __version__ as version from graphql import graphql major_version = int(version.split(".")[0]) if major_version == 2: def graphql_run(*args, **kwargs): return graphql(*args, return_promise=True, **kwargs) return graphql_run else: return graphql
def delay_import(): try: from graphql import Source except ImportError: # Fallback if Source is not implemented return query from graphql import __version__ as version # For graphql2, Source objects aren't acceptable input major_version = int(version.split(".")[0]) if major_version == 2: return query return Source(query)
def graphql_version(): """Minor version tuple.""" version = framework_version() # Take first two values in version to avoid ValueErrors with pre-releases (ex: 3.2.0a0) return tuple(int(v) for v in version.split(".")[:2])
def is_graphql_2(): from graphql import __version__ as version major_version = int(version.split(".")[0]) return major_version == 2