Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- parrot/lib/python3.10/site-packages/numpy/random/_examples/cffi/__pycache__/parse.cpython-310.pyc +0 -0
- parrot/lib/python3.10/site-packages/numpy/random/_examples/numba/extending.py +84 -0
- parrot/lib/python3.10/site-packages/numpy/random/_examples/numba/extending_distributions.py +67 -0
- parrot/lib/python3.10/site-packages/numpy/random/tests/__pycache__/test_regression.cpython-310.pyc +0 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_fused_adamw_compositeexplicitautograd_dispatch.h +28 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_to_sparse_csc_native.h +24 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/glu_ops.h +39 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/hardswish_cuda_dispatch.h +26 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/is_distributed_ops.h +28 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/isposinf_meta_dispatch.h +25 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/pixel_unshuffle_native.h +23 -0
- vllm/lib/python3.10/site-packages/wandb/agents/__pycache__/pyagent.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/__pycache__/setup.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/setup.py +40 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/__init__.py +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/__pycache__/test_client.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/__pycache__/test_transport.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__init__.py +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/fixtures.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/schema.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_dsl.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_query.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_validation.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/fixtures.py +96 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/schema.py +146 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/test_dsl.py +293 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/test_query.py +355 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/test_validation.py +171 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/test_client.py +31 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/test_transport.py +89 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/gql.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/dsl.py +152 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/gql.py +10 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/__init__.py +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/http.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/local_schema.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/requests.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/http.py +6 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/local_schema.py +15 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/requests.py +46 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/abap.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/algol.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/algol_nu.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/arduino.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/autumn.cpython-310.pyc +0 -0
.gitattributes
CHANGED
|
@@ -1428,3 +1428,4 @@ vllm/lib/python3.10/site-packages/wandb/bin/gpu_stats filter=lfs diff=lfs merge=
|
|
| 1428 |
parrot/lib/python3.10/site-packages/pyparsing/__pycache__/core.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1429 |
parrot/lib/python3.10/site-packages/fontTools/pens/momentsPen.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1430 |
parrot/lib/python3.10/site-packages/opencv_python.libs/libQt5Test-d435aae7.so.5.15.13 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 1428 |
parrot/lib/python3.10/site-packages/pyparsing/__pycache__/core.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1429 |
parrot/lib/python3.10/site-packages/fontTools/pens/momentsPen.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1430 |
parrot/lib/python3.10/site-packages/opencv_python.libs/libQt5Test-d435aae7.so.5.15.13 filter=lfs diff=lfs merge=lfs -text
|
| 1431 |
+
vllm/lib/python3.10/site-packages/wandb/vendor/pynvml/__pycache__/pynvml.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
parrot/lib/python3.10/site-packages/numpy/random/_examples/cffi/__pycache__/parse.cpython-310.pyc
ADDED
|
Binary file (1.18 kB). View file
|
|
|
parrot/lib/python3.10/site-packages/numpy/random/_examples/numba/extending.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import numba as nb
|
| 3 |
+
|
| 4 |
+
from numpy.random import PCG64
|
| 5 |
+
from timeit import timeit
|
| 6 |
+
|
| 7 |
+
bit_gen = PCG64()
|
| 8 |
+
next_d = bit_gen.cffi.next_double
|
| 9 |
+
state_addr = bit_gen.cffi.state_address
|
| 10 |
+
|
| 11 |
+
def normals(n, state):
|
| 12 |
+
out = np.empty(n)
|
| 13 |
+
for i in range((n + 1) // 2):
|
| 14 |
+
x1 = 2.0 * next_d(state) - 1.0
|
| 15 |
+
x2 = 2.0 * next_d(state) - 1.0
|
| 16 |
+
r2 = x1 * x1 + x2 * x2
|
| 17 |
+
while r2 >= 1.0 or r2 == 0.0:
|
| 18 |
+
x1 = 2.0 * next_d(state) - 1.0
|
| 19 |
+
x2 = 2.0 * next_d(state) - 1.0
|
| 20 |
+
r2 = x1 * x1 + x2 * x2
|
| 21 |
+
f = np.sqrt(-2.0 * np.log(r2) / r2)
|
| 22 |
+
out[2 * i] = f * x1
|
| 23 |
+
if 2 * i + 1 < n:
|
| 24 |
+
out[2 * i + 1] = f * x2
|
| 25 |
+
return out
|
| 26 |
+
|
| 27 |
+
# Compile using Numba
|
| 28 |
+
normalsj = nb.jit(normals, nopython=True)
|
| 29 |
+
# Must use state address not state with numba
|
| 30 |
+
n = 10000
|
| 31 |
+
|
| 32 |
+
def numbacall():
|
| 33 |
+
return normalsj(n, state_addr)
|
| 34 |
+
|
| 35 |
+
rg = np.random.Generator(PCG64())
|
| 36 |
+
|
| 37 |
+
def numpycall():
|
| 38 |
+
return rg.normal(size=n)
|
| 39 |
+
|
| 40 |
+
# Check that the functions work
|
| 41 |
+
r1 = numbacall()
|
| 42 |
+
r2 = numpycall()
|
| 43 |
+
assert r1.shape == (n,)
|
| 44 |
+
assert r1.shape == r2.shape
|
| 45 |
+
|
| 46 |
+
t1 = timeit(numbacall, number=1000)
|
| 47 |
+
print(f'{t1:.2f} secs for {n} PCG64 (Numba/PCG64) gaussian randoms')
|
| 48 |
+
t2 = timeit(numpycall, number=1000)
|
| 49 |
+
print(f'{t2:.2f} secs for {n} PCG64 (NumPy/PCG64) gaussian randoms')
|
| 50 |
+
|
| 51 |
+
# example 2
|
| 52 |
+
|
| 53 |
+
next_u32 = bit_gen.ctypes.next_uint32
|
| 54 |
+
ctypes_state = bit_gen.ctypes.state
|
| 55 |
+
|
| 56 |
+
@nb.jit(nopython=True)
|
| 57 |
+
def bounded_uint(lb, ub, state):
|
| 58 |
+
mask = delta = ub - lb
|
| 59 |
+
mask |= mask >> 1
|
| 60 |
+
mask |= mask >> 2
|
| 61 |
+
mask |= mask >> 4
|
| 62 |
+
mask |= mask >> 8
|
| 63 |
+
mask |= mask >> 16
|
| 64 |
+
|
| 65 |
+
val = next_u32(state) & mask
|
| 66 |
+
while val > delta:
|
| 67 |
+
val = next_u32(state) & mask
|
| 68 |
+
|
| 69 |
+
return lb + val
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
print(bounded_uint(323, 2394691, ctypes_state.value))
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
@nb.jit(nopython=True)
|
| 76 |
+
def bounded_uints(lb, ub, n, state):
|
| 77 |
+
out = np.empty(n, dtype=np.uint32)
|
| 78 |
+
for i in range(n):
|
| 79 |
+
out[i] = bounded_uint(lb, ub, state)
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
bounded_uints(323, 2394691, 10000000, ctypes_state.value)
|
| 83 |
+
|
| 84 |
+
|
parrot/lib/python3.10/site-packages/numpy/random/_examples/numba/extending_distributions.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
r"""
|
| 2 |
+
Building the required library in this example requires a source distribution
|
| 3 |
+
of NumPy or clone of the NumPy git repository since distributions.c is not
|
| 4 |
+
included in binary distributions.
|
| 5 |
+
|
| 6 |
+
On *nix, execute in numpy/random/src/distributions
|
| 7 |
+
|
| 8 |
+
export ${PYTHON_VERSION}=3.8 # Python version
|
| 9 |
+
export PYTHON_INCLUDE=#path to Python's include folder, usually \
|
| 10 |
+
${PYTHON_HOME}/include/python${PYTHON_VERSION}m
|
| 11 |
+
export NUMPY_INCLUDE=#path to numpy's include folder, usually \
|
| 12 |
+
${PYTHON_HOME}/lib/python${PYTHON_VERSION}/site-packages/numpy/_core/include
|
| 13 |
+
gcc -shared -o libdistributions.so -fPIC distributions.c \
|
| 14 |
+
-I${NUMPY_INCLUDE} -I${PYTHON_INCLUDE}
|
| 15 |
+
mv libdistributions.so ../../_examples/numba/
|
| 16 |
+
|
| 17 |
+
On Windows
|
| 18 |
+
|
| 19 |
+
rem PYTHON_HOME and PYTHON_VERSION are setup dependent, this is an example
|
| 20 |
+
set PYTHON_HOME=c:\Anaconda
|
| 21 |
+
set PYTHON_VERSION=38
|
| 22 |
+
cl.exe /LD .\distributions.c -DDLL_EXPORT \
|
| 23 |
+
-I%PYTHON_HOME%\lib\site-packages\numpy\_core\include \
|
| 24 |
+
-I%PYTHON_HOME%\include %PYTHON_HOME%\libs\python%PYTHON_VERSION%.lib
|
| 25 |
+
move distributions.dll ../../_examples/numba/
|
| 26 |
+
"""
|
| 27 |
+
import os
|
| 28 |
+
|
| 29 |
+
import numba as nb
|
| 30 |
+
import numpy as np
|
| 31 |
+
from cffi import FFI
|
| 32 |
+
|
| 33 |
+
from numpy.random import PCG64
|
| 34 |
+
|
| 35 |
+
ffi = FFI()
|
| 36 |
+
if os.path.exists('./distributions.dll'):
|
| 37 |
+
lib = ffi.dlopen('./distributions.dll')
|
| 38 |
+
elif os.path.exists('./libdistributions.so'):
|
| 39 |
+
lib = ffi.dlopen('./libdistributions.so')
|
| 40 |
+
else:
|
| 41 |
+
raise RuntimeError('Required DLL/so file was not found.')
|
| 42 |
+
|
| 43 |
+
ffi.cdef("""
|
| 44 |
+
double random_standard_normal(void *bitgen_state);
|
| 45 |
+
""")
|
| 46 |
+
x = PCG64()
|
| 47 |
+
xffi = x.cffi
|
| 48 |
+
bit_generator = xffi.bit_generator
|
| 49 |
+
|
| 50 |
+
random_standard_normal = lib.random_standard_normal
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def normals(n, bit_generator):
|
| 54 |
+
out = np.empty(n)
|
| 55 |
+
for i in range(n):
|
| 56 |
+
out[i] = random_standard_normal(bit_generator)
|
| 57 |
+
return out
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
normalsj = nb.jit(normals, nopython=True)
|
| 61 |
+
|
| 62 |
+
# Numba requires a memory address for void *
|
| 63 |
+
# Can also get address from x.ctypes.bit_generator.value
|
| 64 |
+
bit_generator_address = int(ffi.cast('uintptr_t', bit_generator))
|
| 65 |
+
|
| 66 |
+
norm = normalsj(1000, bit_generator_address)
|
| 67 |
+
print(norm[:12])
|
parrot/lib/python3.10/site-packages/numpy/random/tests/__pycache__/test_regression.cpython-310.pyc
ADDED
|
Binary file (6.56 kB). View file
|
|
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_fused_adamw_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeexplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API ::std::tuple<::std::vector<at::Tensor>,::std::vector<at::Tensor>,::std::vector<at::Tensor>,::std::vector<at::Tensor>,::std::vector<at::Tensor>> _fused_adamw(at::TensorList self, at::TensorList grads, at::TensorList exp_avgs, at::TensorList exp_avg_sqs, at::TensorList max_exp_avg_sqs, at::TensorList state_steps, double lr, double beta1, double beta2, double weight_decay, double eps, bool amsgrad, bool maximize, const c10::optional<at::Tensor> & grad_scale={}, const c10::optional<at::Tensor> & found_inf={});
|
| 21 |
+
TORCH_API void _fused_adamw_out(at::TensorList out, at::TensorList self, at::TensorList grads, at::TensorList exp_avgs, at::TensorList exp_avg_sqs, at::TensorList max_exp_avg_sqs, at::TensorList state_steps, double lr, double beta1, double beta2, double weight_decay, double eps, bool amsgrad, bool maximize, const c10::optional<at::Tensor> & grad_scale={}, const c10::optional<at::Tensor> & found_inf={});
|
| 22 |
+
TORCH_API void _fused_adamw_outf(at::TensorList self, at::TensorList grads, at::TensorList exp_avgs, at::TensorList exp_avg_sqs, at::TensorList max_exp_avg_sqs, at::TensorList state_steps, double lr, double beta1, double beta2, double weight_decay, double eps, bool amsgrad, bool maximize, const c10::optional<at::Tensor> & grad_scale, const c10::optional<at::Tensor> & found_inf, at::TensorList out);
|
| 23 |
+
TORCH_API ::std::tuple<::std::vector<at::Tensor>,::std::vector<at::Tensor>,::std::vector<at::Tensor>,::std::vector<at::Tensor>,::std::vector<at::Tensor>> _fused_adamw(at::TensorList self, at::TensorList grads, at::TensorList exp_avgs, at::TensorList exp_avg_sqs, at::TensorList max_exp_avg_sqs, at::TensorList state_steps, const at::Tensor & lr, double beta1, double beta2, double weight_decay, double eps, bool amsgrad, bool maximize, const c10::optional<at::Tensor> & grad_scale={}, const c10::optional<at::Tensor> & found_inf={});
|
| 24 |
+
TORCH_API void _fused_adamw_out(at::TensorList out, at::TensorList self, at::TensorList grads, at::TensorList exp_avgs, at::TensorList exp_avg_sqs, at::TensorList max_exp_avg_sqs, at::TensorList state_steps, const at::Tensor & lr, double beta1, double beta2, double weight_decay, double eps, bool amsgrad, bool maximize, const c10::optional<at::Tensor> & grad_scale={}, const c10::optional<at::Tensor> & found_inf={});
|
| 25 |
+
TORCH_API void _fused_adamw_outf(at::TensorList self, at::TensorList grads, at::TensorList exp_avgs, at::TensorList exp_avg_sqs, at::TensorList max_exp_avg_sqs, at::TensorList state_steps, const at::Tensor & lr, double beta1, double beta2, double weight_decay, double eps, bool amsgrad, bool maximize, const c10::optional<at::Tensor> & grad_scale, const c10::optional<at::Tensor> & found_inf, at::TensorList out);
|
| 26 |
+
|
| 27 |
+
} // namespace compositeexplicitautograd
|
| 28 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_to_sparse_csc_native.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <tuple>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
TORCH_API at::Tensor & _to_sparse_csc_out(const at::Tensor & self, c10::optional<int64_t> dense_dim, at::Tensor & out);
|
| 20 |
+
TORCH_API at::Tensor dense_to_sparse_csc(const at::Tensor & self, c10::optional<int64_t> dense_dim=c10::nullopt);
|
| 21 |
+
TORCH_API at::Tensor coo_to_sparse_csc(const at::Tensor & self, c10::optional<int64_t> dense_dim=c10::nullopt);
|
| 22 |
+
TORCH_API at::Tensor sparse_compressed_to_sparse_csc(const at::Tensor & self, c10::optional<int64_t> dense_dim=c10::nullopt);
|
| 23 |
+
} // namespace native
|
| 24 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/glu_ops.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API glu_out {
|
| 18 |
+
using schema = at::Tensor & (const at::Tensor &, int64_t, at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::glu")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "glu.out(Tensor self, int dim=-1, *, Tensor(a!) out) -> Tensor(a!)")
|
| 24 |
+
static at::Tensor & call(const at::Tensor & self, int64_t dim, at::Tensor & out);
|
| 25 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t dim, at::Tensor & out);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API glu {
|
| 29 |
+
using schema = at::Tensor (const at::Tensor &, int64_t);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::glu")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "glu(Tensor self, int dim=-1) -> Tensor")
|
| 35 |
+
static at::Tensor call(const at::Tensor & self, int64_t dim);
|
| 36 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t dim);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
}} // namespace at::_ops
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/hardswish_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace cuda {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor hardswish(const at::Tensor & self);
|
| 21 |
+
TORCH_API at::Tensor & hardswish_out(at::Tensor & out, const at::Tensor & self);
|
| 22 |
+
TORCH_API at::Tensor & hardswish_outf(const at::Tensor & self, at::Tensor & out);
|
| 23 |
+
TORCH_API at::Tensor & hardswish_(at::Tensor & self);
|
| 24 |
+
|
| 25 |
+
} // namespace cuda
|
| 26 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/is_distributed_ops.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API is_distributed {
|
| 18 |
+
using schema = bool (const at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::is_distributed")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "is_distributed(Tensor self) -> bool")
|
| 24 |
+
static bool call(const at::Tensor & self);
|
| 25 |
+
static bool redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
}} // namespace at::_ops
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/isposinf_meta_dispatch.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace meta {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor isposinf(const at::Tensor & self);
|
| 21 |
+
TORCH_API at::Tensor & isposinf_out(at::Tensor & out, const at::Tensor & self);
|
| 22 |
+
TORCH_API at::Tensor & isposinf_outf(const at::Tensor & self, at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace meta
|
| 25 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/pixel_unshuffle_native.h
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <tuple>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
TORCH_API at::Tensor & pixel_unshuffle_out(const at::Tensor & self, int64_t downscale_factor, at::Tensor & out);
|
| 20 |
+
TORCH_API at::Tensor pixel_unshuffle_cpu(const at::Tensor & self, int64_t downscale_factor);
|
| 21 |
+
TORCH_API at::Tensor math_pixel_unshuffle(const at::Tensor & self, int64_t downscale_factor);
|
| 22 |
+
} // namespace native
|
| 23 |
+
} // namespace at
|
vllm/lib/python3.10/site-packages/wandb/agents/__pycache__/pyagent.cpython-310.pyc
ADDED
|
Binary file (9.68 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/__pycache__/setup.cpython-310.pyc
ADDED
|
Binary file (1.3 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/setup.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from setuptools import setup, find_packages
|
| 2 |
+
|
| 3 |
+
setup(
|
| 4 |
+
name='gql',
|
| 5 |
+
version='0.2.0',
|
| 6 |
+
description='GraphQL client for Python',
|
| 7 |
+
long_description=open('README.md').read(),
|
| 8 |
+
long_description_content_type="text/markdown",
|
| 9 |
+
url='https://github.com/graphql-python/gql',
|
| 10 |
+
author='Syrus Akbary',
|
| 11 |
+
author_email='me@syrusakbary.com',
|
| 12 |
+
license='MIT',
|
| 13 |
+
classifiers=[
|
| 14 |
+
'Development Status :: 3 - Alpha',
|
| 15 |
+
'Intended Audience :: Developers',
|
| 16 |
+
'Topic :: Software Development :: Libraries',
|
| 17 |
+
'Programming Language :: Python :: 2',
|
| 18 |
+
'Programming Language :: Python :: 2.7',
|
| 19 |
+
'Programming Language :: Python :: 3',
|
| 20 |
+
'Programming Language :: Python :: 3.5',
|
| 21 |
+
'Programming Language :: Python :: 3.6',
|
| 22 |
+
'Programming Language :: Python :: 3.7',
|
| 23 |
+
'Programming Language :: Python :: 3.8',
|
| 24 |
+
'Programming Language :: Python :: Implementation :: PyPy',
|
| 25 |
+
],
|
| 26 |
+
keywords='api graphql protocol rest relay gql client',
|
| 27 |
+
packages=find_packages(include=["gql*"]),
|
| 28 |
+
install_requires=[
|
| 29 |
+
'six>=1.10.0',
|
| 30 |
+
'graphql-core>=0.5.0,<2',
|
| 31 |
+
'promise>=2.0,<3',
|
| 32 |
+
'requests>=2.12,<3'
|
| 33 |
+
],
|
| 34 |
+
tests_require=[
|
| 35 |
+
'pytest>=3,<4',
|
| 36 |
+
'pytest-cov>=2.8,<3',
|
| 37 |
+
'mock>=3,<4',
|
| 38 |
+
'vcrpy>=2.1,<3'
|
| 39 |
+
],
|
| 40 |
+
)
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/__init__.py
ADDED
|
File without changes
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (178 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/__pycache__/test_client.cpython-310.pyc
ADDED
|
Binary file (942 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/__pycache__/test_transport.cpython-310.pyc
ADDED
|
Binary file (1.74 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__init__.py
ADDED
|
File without changes
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (187 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/fixtures.cpython-310.pyc
ADDED
|
Binary file (1.79 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/schema.cpython-310.pyc
ADDED
|
Binary file (3.45 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_dsl.cpython-310.pyc
ADDED
|
Binary file (2.23 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_query.cpython-310.pyc
ADDED
|
Binary file (5.68 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_validation.cpython-310.pyc
ADDED
|
Binary file (3.93 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/fixtures.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import namedtuple
|
| 2 |
+
|
| 3 |
+
Human = namedtuple('Human', 'id name friends appearsIn homePlanet')
|
| 4 |
+
|
| 5 |
+
luke = Human(
|
| 6 |
+
id='1000',
|
| 7 |
+
name='Luke Skywalker',
|
| 8 |
+
friends=['1002', '1003', '2000', '2001'],
|
| 9 |
+
appearsIn=[4, 5, 6],
|
| 10 |
+
homePlanet='Tatooine',
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
vader = Human(
|
| 14 |
+
id='1001',
|
| 15 |
+
name='Darth Vader',
|
| 16 |
+
friends=['1004'],
|
| 17 |
+
appearsIn=[4, 5, 6],
|
| 18 |
+
homePlanet='Tatooine',
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
han = Human(
|
| 22 |
+
id='1002',
|
| 23 |
+
name='Han Solo',
|
| 24 |
+
friends=['1000', '1003', '2001'],
|
| 25 |
+
appearsIn=[4, 5, 6],
|
| 26 |
+
homePlanet=None,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
leia = Human(
|
| 30 |
+
id='1003',
|
| 31 |
+
name='Leia Organa',
|
| 32 |
+
friends=['1000', '1002', '2000', '2001'],
|
| 33 |
+
appearsIn=[4, 5, 6],
|
| 34 |
+
homePlanet='Alderaan',
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
tarkin = Human(
|
| 38 |
+
id='1004',
|
| 39 |
+
name='Wilhuff Tarkin',
|
| 40 |
+
friends=['1001'],
|
| 41 |
+
appearsIn=[4],
|
| 42 |
+
homePlanet=None,
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
humanData = {
|
| 46 |
+
'1000': luke,
|
| 47 |
+
'1001': vader,
|
| 48 |
+
'1002': han,
|
| 49 |
+
'1003': leia,
|
| 50 |
+
'1004': tarkin,
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
Droid = namedtuple('Droid', 'id name friends appearsIn primaryFunction')
|
| 54 |
+
|
| 55 |
+
threepio = Droid(
|
| 56 |
+
id='2000',
|
| 57 |
+
name='C-3PO',
|
| 58 |
+
friends=['1000', '1002', '1003', '2001'],
|
| 59 |
+
appearsIn=[4, 5, 6],
|
| 60 |
+
primaryFunction='Protocol',
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
artoo = Droid(
|
| 64 |
+
id='2001',
|
| 65 |
+
name='R2-D2',
|
| 66 |
+
friends=['1000', '1002', '1003'],
|
| 67 |
+
appearsIn=[4, 5, 6],
|
| 68 |
+
primaryFunction='Astromech',
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
droidData = {
|
| 72 |
+
'2000': threepio,
|
| 73 |
+
'2001': artoo,
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def getCharacter(id):
|
| 78 |
+
return humanData.get(id) or droidData.get(id)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def getFriends(character):
|
| 82 |
+
return map(getCharacter, character.friends)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def getHero(episode):
|
| 86 |
+
if episode == 5:
|
| 87 |
+
return luke
|
| 88 |
+
return artoo
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def getHuman(id):
|
| 92 |
+
return humanData.get(id)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def getDroid(id):
|
| 96 |
+
return droidData.get(id)
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/schema.py
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from graphql.type import (GraphQLArgument, GraphQLEnumType, GraphQLEnumValue,
|
| 2 |
+
GraphQLField, GraphQLInterfaceType, GraphQLList,
|
| 3 |
+
GraphQLNonNull, GraphQLObjectType, GraphQLSchema,
|
| 4 |
+
GraphQLString)
|
| 5 |
+
|
| 6 |
+
from .fixtures import getDroid, getFriends, getHero, getHuman
|
| 7 |
+
|
| 8 |
+
episodeEnum = GraphQLEnumType(
|
| 9 |
+
'Episode',
|
| 10 |
+
description='One of the films in the Star Wars Trilogy',
|
| 11 |
+
values={
|
| 12 |
+
'NEWHOPE': GraphQLEnumValue(
|
| 13 |
+
4,
|
| 14 |
+
description='Released in 1977.',
|
| 15 |
+
),
|
| 16 |
+
'EMPIRE': GraphQLEnumValue(
|
| 17 |
+
5,
|
| 18 |
+
description='Released in 1980.',
|
| 19 |
+
),
|
| 20 |
+
'JEDI': GraphQLEnumValue(
|
| 21 |
+
6,
|
| 22 |
+
description='Released in 1983.',
|
| 23 |
+
)
|
| 24 |
+
}
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
characterInterface = GraphQLInterfaceType(
|
| 28 |
+
'Character',
|
| 29 |
+
description='A character in the Star Wars Trilogy',
|
| 30 |
+
fields=lambda: {
|
| 31 |
+
'id': GraphQLField(
|
| 32 |
+
GraphQLNonNull(GraphQLString),
|
| 33 |
+
description='The id of the character.'
|
| 34 |
+
),
|
| 35 |
+
'name': GraphQLField(
|
| 36 |
+
GraphQLString,
|
| 37 |
+
description='The name of the character.'
|
| 38 |
+
),
|
| 39 |
+
'friends': GraphQLField(
|
| 40 |
+
GraphQLList(characterInterface),
|
| 41 |
+
description='The friends of the character, or an empty list if they have none.'
|
| 42 |
+
),
|
| 43 |
+
'appearsIn': GraphQLField(
|
| 44 |
+
GraphQLList(episodeEnum),
|
| 45 |
+
description='Which movies they appear in.'
|
| 46 |
+
),
|
| 47 |
+
},
|
| 48 |
+
resolve_type=lambda character, *_: humanType if getHuman(character.id) else droidType,
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
humanType = GraphQLObjectType(
|
| 52 |
+
'Human',
|
| 53 |
+
description='A humanoid creature in the Star Wars universe.',
|
| 54 |
+
fields=lambda: {
|
| 55 |
+
'id': GraphQLField(
|
| 56 |
+
GraphQLNonNull(GraphQLString),
|
| 57 |
+
description='The id of the human.',
|
| 58 |
+
),
|
| 59 |
+
'name': GraphQLField(
|
| 60 |
+
GraphQLString,
|
| 61 |
+
description='The name of the human.',
|
| 62 |
+
),
|
| 63 |
+
'friends': GraphQLField(
|
| 64 |
+
GraphQLList(characterInterface),
|
| 65 |
+
description='The friends of the human, or an empty list if they have none.',
|
| 66 |
+
resolver=lambda human, *_: getFriends(human),
|
| 67 |
+
),
|
| 68 |
+
'appearsIn': GraphQLField(
|
| 69 |
+
GraphQLList(episodeEnum),
|
| 70 |
+
description='Which movies they appear in.',
|
| 71 |
+
),
|
| 72 |
+
'homePlanet': GraphQLField(
|
| 73 |
+
GraphQLString,
|
| 74 |
+
description='The home planet of the human, or null if unknown.',
|
| 75 |
+
)
|
| 76 |
+
},
|
| 77 |
+
interfaces=[characterInterface]
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
droidType = GraphQLObjectType(
|
| 81 |
+
'Droid',
|
| 82 |
+
description='A mechanical creature in the Star Wars universe.',
|
| 83 |
+
fields=lambda: {
|
| 84 |
+
'id': GraphQLField(
|
| 85 |
+
GraphQLNonNull(GraphQLString),
|
| 86 |
+
description='The id of the droid.',
|
| 87 |
+
),
|
| 88 |
+
'name': GraphQLField(
|
| 89 |
+
GraphQLString,
|
| 90 |
+
description='The name of the droid.',
|
| 91 |
+
),
|
| 92 |
+
'friends': GraphQLField(
|
| 93 |
+
GraphQLList(characterInterface),
|
| 94 |
+
description='The friends of the droid, or an empty list if they have none.',
|
| 95 |
+
resolver=lambda droid, *_: getFriends(droid),
|
| 96 |
+
),
|
| 97 |
+
'appearsIn': GraphQLField(
|
| 98 |
+
GraphQLList(episodeEnum),
|
| 99 |
+
description='Which movies they appear in.',
|
| 100 |
+
),
|
| 101 |
+
'primaryFunction': GraphQLField(
|
| 102 |
+
GraphQLString,
|
| 103 |
+
description='The primary function of the droid.',
|
| 104 |
+
)
|
| 105 |
+
},
|
| 106 |
+
interfaces=[characterInterface]
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
queryType = GraphQLObjectType(
|
| 110 |
+
'Query',
|
| 111 |
+
fields=lambda: {
|
| 112 |
+
'hero': GraphQLField(
|
| 113 |
+
characterInterface,
|
| 114 |
+
args={
|
| 115 |
+
'episode': GraphQLArgument(
|
| 116 |
+
description='If omitted, returns the hero of the whole saga. If '
|
| 117 |
+
'provided, returns the hero of that particular episode.',
|
| 118 |
+
type=episodeEnum,
|
| 119 |
+
)
|
| 120 |
+
},
|
| 121 |
+
resolver=lambda root, args, *_: getHero(args.get('episode')),
|
| 122 |
+
),
|
| 123 |
+
'human': GraphQLField(
|
| 124 |
+
humanType,
|
| 125 |
+
args={
|
| 126 |
+
'id': GraphQLArgument(
|
| 127 |
+
description='id of the human',
|
| 128 |
+
type=GraphQLNonNull(GraphQLString),
|
| 129 |
+
)
|
| 130 |
+
},
|
| 131 |
+
resolver=lambda root, args, *_: getHuman(args['id']),
|
| 132 |
+
),
|
| 133 |
+
'droid': GraphQLField(
|
| 134 |
+
droidType,
|
| 135 |
+
args={
|
| 136 |
+
'id': GraphQLArgument(
|
| 137 |
+
description='id of the droid',
|
| 138 |
+
type=GraphQLNonNull(GraphQLString),
|
| 139 |
+
)
|
| 140 |
+
},
|
| 141 |
+
resolver=lambda root, args, *_: getDroid(args['id']),
|
| 142 |
+
),
|
| 143 |
+
}
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
StarWarsSchema = GraphQLSchema(query=queryType, types=[humanType, droidType])
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/test_dsl.py
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
|
| 3 |
+
from gql import Client
|
| 4 |
+
from gql.dsl import DSLSchema
|
| 5 |
+
|
| 6 |
+
from .schema import StarWarsSchema
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
@pytest.fixture
|
| 10 |
+
def ds():
|
| 11 |
+
client = Client(schema=StarWarsSchema)
|
| 12 |
+
ds = DSLSchema(client)
|
| 13 |
+
return ds
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def test_hero_name_query(ds):
|
| 17 |
+
query = '''
|
| 18 |
+
hero {
|
| 19 |
+
name
|
| 20 |
+
}
|
| 21 |
+
'''.strip()
|
| 22 |
+
query_dsl = ds.Query.hero.select(
|
| 23 |
+
ds.Character.name
|
| 24 |
+
)
|
| 25 |
+
assert query == str(query_dsl)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_hero_name_and_friends_query(ds):
|
| 29 |
+
query = '''
|
| 30 |
+
hero {
|
| 31 |
+
id
|
| 32 |
+
name
|
| 33 |
+
friends {
|
| 34 |
+
name
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
'''.strip()
|
| 38 |
+
query_dsl = ds.Query.hero.select(
|
| 39 |
+
ds.Character.id,
|
| 40 |
+
ds.Character.name,
|
| 41 |
+
ds.Character.friends.select(
|
| 42 |
+
ds.Character.name,
|
| 43 |
+
)
|
| 44 |
+
)
|
| 45 |
+
assert query == str(query_dsl)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def test_nested_query(ds):
|
| 49 |
+
query = '''
|
| 50 |
+
hero {
|
| 51 |
+
name
|
| 52 |
+
friends {
|
| 53 |
+
name
|
| 54 |
+
appearsIn
|
| 55 |
+
friends {
|
| 56 |
+
name
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
'''.strip()
|
| 61 |
+
query_dsl = ds.Query.hero.select(
|
| 62 |
+
ds.Character.name,
|
| 63 |
+
ds.Character.friends.select(
|
| 64 |
+
ds.Character.name,
|
| 65 |
+
ds.Character.appears_in,
|
| 66 |
+
ds.Character.friends.select(
|
| 67 |
+
ds.Character.name
|
| 68 |
+
)
|
| 69 |
+
)
|
| 70 |
+
)
|
| 71 |
+
assert query == str(query_dsl)
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def test_fetch_luke_query(ds):
|
| 75 |
+
query = '''
|
| 76 |
+
human(id: "1000") {
|
| 77 |
+
name
|
| 78 |
+
}
|
| 79 |
+
'''.strip()
|
| 80 |
+
query_dsl = ds.Query.human(id="1000").select(
|
| 81 |
+
ds.Human.name,
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
assert query == str(query_dsl)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
# def test_fetch_some_id_query():
|
| 88 |
+
# query = '''
|
| 89 |
+
# query FetchSomeIDQuery($someId: String!) {
|
| 90 |
+
# human(id: $someId) {
|
| 91 |
+
# name
|
| 92 |
+
# }
|
| 93 |
+
# }
|
| 94 |
+
# '''
|
| 95 |
+
# params = {
|
| 96 |
+
# 'someId': '1000',
|
| 97 |
+
# }
|
| 98 |
+
# expected = {
|
| 99 |
+
# 'human': {
|
| 100 |
+
# 'name': 'Luke Skywalker',
|
| 101 |
+
# }
|
| 102 |
+
# }
|
| 103 |
+
# result = schema.execute(query, None, params)
|
| 104 |
+
# assert not result.errors
|
| 105 |
+
# assert result.data == expected
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
# def test_fetch_some_id_query2():
|
| 109 |
+
# query = '''
|
| 110 |
+
# query FetchSomeIDQuery($someId: String!) {
|
| 111 |
+
# human(id: $someId) {
|
| 112 |
+
# name
|
| 113 |
+
# }
|
| 114 |
+
# }
|
| 115 |
+
# '''
|
| 116 |
+
# params = {
|
| 117 |
+
# 'someId': '1002',
|
| 118 |
+
# }
|
| 119 |
+
# expected = {
|
| 120 |
+
# 'human': {
|
| 121 |
+
# 'name': 'Han Solo',
|
| 122 |
+
# }
|
| 123 |
+
# }
|
| 124 |
+
# result = schema.execute(query, None, params)
|
| 125 |
+
# assert not result.errors
|
| 126 |
+
# assert result.data == expected
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
# def test_invalid_id_query():
|
| 130 |
+
# query = '''
|
| 131 |
+
# query humanQuery($id: String!) {
|
| 132 |
+
# human(id: $id) {
|
| 133 |
+
# name
|
| 134 |
+
# }
|
| 135 |
+
# }
|
| 136 |
+
# '''
|
| 137 |
+
# params = {
|
| 138 |
+
# 'id': 'not a valid id',
|
| 139 |
+
# }
|
| 140 |
+
# expected = {
|
| 141 |
+
# 'human': None
|
| 142 |
+
# }
|
| 143 |
+
# result = schema.execute(query, None, params)
|
| 144 |
+
# assert not result.errors
|
| 145 |
+
# assert result.data == expected
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def test_fetch_luke_aliased(ds):
|
| 149 |
+
query = '''
|
| 150 |
+
luke: human(id: "1000") {
|
| 151 |
+
name
|
| 152 |
+
}
|
| 153 |
+
'''.strip()
|
| 154 |
+
query_dsl = ds.Query.human.args(id=1000).alias('luke').select(
|
| 155 |
+
ds.Character.name,
|
| 156 |
+
)
|
| 157 |
+
assert query == str(query_dsl)
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
# def test_fetch_luke_and_leia_aliased():
|
| 161 |
+
# query = '''
|
| 162 |
+
# query FetchLukeAndLeiaAliased {
|
| 163 |
+
# luke: human(id: "1000") {
|
| 164 |
+
# name
|
| 165 |
+
# }
|
| 166 |
+
# leia: human(id: "1003") {
|
| 167 |
+
# name
|
| 168 |
+
# }
|
| 169 |
+
# }
|
| 170 |
+
# '''
|
| 171 |
+
# expected = {
|
| 172 |
+
# 'luke': {
|
| 173 |
+
# 'name': 'Luke Skywalker',
|
| 174 |
+
# },
|
| 175 |
+
# 'leia': {
|
| 176 |
+
# 'name': 'Leia Organa',
|
| 177 |
+
# }
|
| 178 |
+
# }
|
| 179 |
+
# result = schema.execute(query)
|
| 180 |
+
# assert not result.errors
|
| 181 |
+
# assert result.data == expected
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
# def test_duplicate_fields():
|
| 185 |
+
# query = '''
|
| 186 |
+
# query DuplicateFields {
|
| 187 |
+
# luke: human(id: "1000") {
|
| 188 |
+
# name
|
| 189 |
+
# homePlanet
|
| 190 |
+
# }
|
| 191 |
+
# leia: human(id: "1003") {
|
| 192 |
+
# name
|
| 193 |
+
# homePlanet
|
| 194 |
+
# }
|
| 195 |
+
# }
|
| 196 |
+
# '''
|
| 197 |
+
# expected = {
|
| 198 |
+
# 'luke': {
|
| 199 |
+
# 'name': 'Luke Skywalker',
|
| 200 |
+
# 'homePlanet': 'Tatooine',
|
| 201 |
+
# },
|
| 202 |
+
# 'leia': {
|
| 203 |
+
# 'name': 'Leia Organa',
|
| 204 |
+
# 'homePlanet': 'Alderaan',
|
| 205 |
+
# }
|
| 206 |
+
# }
|
| 207 |
+
# result = schema.execute(query)
|
| 208 |
+
# assert not result.errors
|
| 209 |
+
# assert result.data == expected
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
# def test_use_fragment():
|
| 213 |
+
# query = '''
|
| 214 |
+
# query UseFragment {
|
| 215 |
+
# luke: human(id: "1000") {
|
| 216 |
+
# ...HumanFragment
|
| 217 |
+
# }
|
| 218 |
+
# leia: human(id: "1003") {
|
| 219 |
+
# ...HumanFragment
|
| 220 |
+
# }
|
| 221 |
+
# }
|
| 222 |
+
# fragment HumanFragment on Human {
|
| 223 |
+
# name
|
| 224 |
+
# homePlanet
|
| 225 |
+
# }
|
| 226 |
+
# '''
|
| 227 |
+
# expected = {
|
| 228 |
+
# 'luke': {
|
| 229 |
+
# 'name': 'Luke Skywalker',
|
| 230 |
+
# 'homePlanet': 'Tatooine',
|
| 231 |
+
# },
|
| 232 |
+
# 'leia': {
|
| 233 |
+
# 'name': 'Leia Organa',
|
| 234 |
+
# 'homePlanet': 'Alderaan',
|
| 235 |
+
# }
|
| 236 |
+
# }
|
| 237 |
+
# result = schema.execute(query)
|
| 238 |
+
# assert not result.errors
|
| 239 |
+
# assert result.data == expected
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
# def test_check_type_of_r2():
|
| 243 |
+
# query = '''
|
| 244 |
+
# query CheckTypeOfR2 {
|
| 245 |
+
# hero {
|
| 246 |
+
# __typename
|
| 247 |
+
# name
|
| 248 |
+
# }
|
| 249 |
+
# }
|
| 250 |
+
# '''
|
| 251 |
+
# expected = {
|
| 252 |
+
# 'hero': {
|
| 253 |
+
# '__typename': 'Droid',
|
| 254 |
+
# 'name': 'R2-D2',
|
| 255 |
+
# }
|
| 256 |
+
# }
|
| 257 |
+
# result = schema.execute(query)
|
| 258 |
+
# assert not result.errors
|
| 259 |
+
# assert result.data == expected
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
# def test_check_type_of_luke():
|
| 263 |
+
# query = '''
|
| 264 |
+
# query CheckTypeOfLuke {
|
| 265 |
+
# hero(episode: EMPIRE) {
|
| 266 |
+
# __typename
|
| 267 |
+
# name
|
| 268 |
+
# }
|
| 269 |
+
# }
|
| 270 |
+
# '''
|
| 271 |
+
# expected = {
|
| 272 |
+
# 'hero': {
|
| 273 |
+
# '__typename': 'Human',
|
| 274 |
+
# 'name': 'Luke Skywalker',
|
| 275 |
+
# }
|
| 276 |
+
# }
|
| 277 |
+
# result = schema.execute(query)
|
| 278 |
+
# assert not result.errors
|
| 279 |
+
# assert result.data == expected
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
def test_hero_name_query_result(ds):
|
| 283 |
+
result = ds.query(
|
| 284 |
+
ds.Query.hero.select(
|
| 285 |
+
ds.Character.name
|
| 286 |
+
)
|
| 287 |
+
)
|
| 288 |
+
expected = {
|
| 289 |
+
'hero': {
|
| 290 |
+
'name': 'R2-D2'
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
assert result == expected
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/test_query.py
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
from graphql.error import format_error
|
| 3 |
+
|
| 4 |
+
from gql import Client, gql
|
| 5 |
+
|
| 6 |
+
from .schema import StarWarsSchema
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
@pytest.fixture
|
| 10 |
+
def client():
|
| 11 |
+
return Client(schema=StarWarsSchema)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def test_hero_name_query(client):
|
| 15 |
+
query = gql('''
|
| 16 |
+
query HeroNameQuery {
|
| 17 |
+
hero {
|
| 18 |
+
name
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
''')
|
| 22 |
+
expected = {
|
| 23 |
+
'hero': {
|
| 24 |
+
'name': 'R2-D2'
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
result = client.execute(query)
|
| 28 |
+
assert result == expected
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def test_hero_name_and_friends_query(client):
|
| 32 |
+
query = gql('''
|
| 33 |
+
query HeroNameAndFriendsQuery {
|
| 34 |
+
hero {
|
| 35 |
+
id
|
| 36 |
+
name
|
| 37 |
+
friends {
|
| 38 |
+
name
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
''')
|
| 43 |
+
expected = {
|
| 44 |
+
'hero': {
|
| 45 |
+
'id': '2001',
|
| 46 |
+
'name': 'R2-D2',
|
| 47 |
+
'friends': [
|
| 48 |
+
{'name': 'Luke Skywalker'},
|
| 49 |
+
{'name': 'Han Solo'},
|
| 50 |
+
{'name': 'Leia Organa'},
|
| 51 |
+
]
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
result = client.execute(query)
|
| 55 |
+
assert result == expected
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def test_nested_query(client):
|
| 59 |
+
query = gql('''
|
| 60 |
+
query NestedQuery {
|
| 61 |
+
hero {
|
| 62 |
+
name
|
| 63 |
+
friends {
|
| 64 |
+
name
|
| 65 |
+
appearsIn
|
| 66 |
+
friends {
|
| 67 |
+
name
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
''')
|
| 73 |
+
expected = {
|
| 74 |
+
'hero': {
|
| 75 |
+
'name': 'R2-D2',
|
| 76 |
+
'friends': [
|
| 77 |
+
{
|
| 78 |
+
'name': 'Luke Skywalker',
|
| 79 |
+
'appearsIn': ['NEWHOPE', 'EMPIRE', 'JEDI'],
|
| 80 |
+
'friends': [
|
| 81 |
+
{
|
| 82 |
+
'name': 'Han Solo',
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
'name': 'Leia Organa',
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
'name': 'C-3PO',
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
'name': 'R2-D2',
|
| 92 |
+
},
|
| 93 |
+
]
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
'name': 'Han Solo',
|
| 97 |
+
'appearsIn': ['NEWHOPE', 'EMPIRE', 'JEDI'],
|
| 98 |
+
'friends': [
|
| 99 |
+
{
|
| 100 |
+
'name': 'Luke Skywalker',
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
'name': 'Leia Organa',
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
'name': 'R2-D2',
|
| 107 |
+
},
|
| 108 |
+
]
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
'name': 'Leia Organa',
|
| 112 |
+
'appearsIn': ['NEWHOPE', 'EMPIRE', 'JEDI'],
|
| 113 |
+
'friends': [
|
| 114 |
+
{
|
| 115 |
+
'name': 'Luke Skywalker',
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
'name': 'Han Solo',
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
'name': 'C-3PO',
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
'name': 'R2-D2',
|
| 125 |
+
},
|
| 126 |
+
]
|
| 127 |
+
},
|
| 128 |
+
]
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
result = client.execute(query)
|
| 132 |
+
assert result == expected
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def test_fetch_luke_query(client):
|
| 136 |
+
query = gql('''
|
| 137 |
+
query FetchLukeQuery {
|
| 138 |
+
human(id: "1000") {
|
| 139 |
+
name
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
''')
|
| 143 |
+
expected = {
|
| 144 |
+
'human': {
|
| 145 |
+
'name': 'Luke Skywalker',
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
result = client.execute(query)
|
| 149 |
+
assert result == expected
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def test_fetch_some_id_query(client):
|
| 153 |
+
query = gql('''
|
| 154 |
+
query FetchSomeIDQuery($someId: String!) {
|
| 155 |
+
human(id: $someId) {
|
| 156 |
+
name
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
''')
|
| 160 |
+
params = {
|
| 161 |
+
'someId': '1000',
|
| 162 |
+
}
|
| 163 |
+
expected = {
|
| 164 |
+
'human': {
|
| 165 |
+
'name': 'Luke Skywalker',
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
result = client.execute(query, variable_values=params)
|
| 169 |
+
assert result == expected
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def test_fetch_some_id_query2(client):
|
| 173 |
+
query = gql('''
|
| 174 |
+
query FetchSomeIDQuery($someId: String!) {
|
| 175 |
+
human(id: $someId) {
|
| 176 |
+
name
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
''')
|
| 180 |
+
params = {
|
| 181 |
+
'someId': '1002',
|
| 182 |
+
}
|
| 183 |
+
expected = {
|
| 184 |
+
'human': {
|
| 185 |
+
'name': 'Han Solo',
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
result = client.execute(query, variable_values=params)
|
| 189 |
+
assert result == expected
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
def test_invalid_id_query(client):
|
| 193 |
+
query = gql('''
|
| 194 |
+
query humanQuery($id: String!) {
|
| 195 |
+
human(id: $id) {
|
| 196 |
+
name
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
''')
|
| 200 |
+
params = {
|
| 201 |
+
'id': 'not a valid id',
|
| 202 |
+
}
|
| 203 |
+
expected = {
|
| 204 |
+
'human': None
|
| 205 |
+
}
|
| 206 |
+
result = client.execute(query, variable_values=params)
|
| 207 |
+
assert result == expected
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def test_fetch_luke_aliased(client):
|
| 211 |
+
query = gql('''
|
| 212 |
+
query FetchLukeAliased {
|
| 213 |
+
luke: human(id: "1000") {
|
| 214 |
+
name
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
''')
|
| 218 |
+
expected = {
|
| 219 |
+
'luke': {
|
| 220 |
+
'name': 'Luke Skywalker',
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
result = client.execute(query)
|
| 224 |
+
assert result == expected
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
def test_fetch_luke_and_leia_aliased(client):
|
| 228 |
+
query = gql('''
|
| 229 |
+
query FetchLukeAndLeiaAliased {
|
| 230 |
+
luke: human(id: "1000") {
|
| 231 |
+
name
|
| 232 |
+
}
|
| 233 |
+
leia: human(id: "1003") {
|
| 234 |
+
name
|
| 235 |
+
}
|
| 236 |
+
}
|
| 237 |
+
''')
|
| 238 |
+
expected = {
|
| 239 |
+
'luke': {
|
| 240 |
+
'name': 'Luke Skywalker',
|
| 241 |
+
},
|
| 242 |
+
'leia': {
|
| 243 |
+
'name': 'Leia Organa',
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
result = client.execute(query)
|
| 247 |
+
assert result == expected
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
def test_duplicate_fields(client):
|
| 251 |
+
query = gql('''
|
| 252 |
+
query DuplicateFields {
|
| 253 |
+
luke: human(id: "1000") {
|
| 254 |
+
name
|
| 255 |
+
homePlanet
|
| 256 |
+
}
|
| 257 |
+
leia: human(id: "1003") {
|
| 258 |
+
name
|
| 259 |
+
homePlanet
|
| 260 |
+
}
|
| 261 |
+
}
|
| 262 |
+
''')
|
| 263 |
+
expected = {
|
| 264 |
+
'luke': {
|
| 265 |
+
'name': 'Luke Skywalker',
|
| 266 |
+
'homePlanet': 'Tatooine',
|
| 267 |
+
},
|
| 268 |
+
'leia': {
|
| 269 |
+
'name': 'Leia Organa',
|
| 270 |
+
'homePlanet': 'Alderaan',
|
| 271 |
+
}
|
| 272 |
+
}
|
| 273 |
+
result = client.execute(query)
|
| 274 |
+
assert result == expected
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
def test_use_fragment(client):
|
| 278 |
+
query = gql('''
|
| 279 |
+
query UseFragment {
|
| 280 |
+
luke: human(id: "1000") {
|
| 281 |
+
...HumanFragment
|
| 282 |
+
}
|
| 283 |
+
leia: human(id: "1003") {
|
| 284 |
+
...HumanFragment
|
| 285 |
+
}
|
| 286 |
+
}
|
| 287 |
+
fragment HumanFragment on Human {
|
| 288 |
+
name
|
| 289 |
+
homePlanet
|
| 290 |
+
}
|
| 291 |
+
''')
|
| 292 |
+
expected = {
|
| 293 |
+
'luke': {
|
| 294 |
+
'name': 'Luke Skywalker',
|
| 295 |
+
'homePlanet': 'Tatooine',
|
| 296 |
+
},
|
| 297 |
+
'leia': {
|
| 298 |
+
'name': 'Leia Organa',
|
| 299 |
+
'homePlanet': 'Alderaan',
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
+
result = client.execute(query)
|
| 303 |
+
assert result == expected
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
def test_check_type_of_r2(client):
|
| 307 |
+
query = gql('''
|
| 308 |
+
query CheckTypeOfR2 {
|
| 309 |
+
hero {
|
| 310 |
+
__typename
|
| 311 |
+
name
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
''')
|
| 315 |
+
expected = {
|
| 316 |
+
'hero': {
|
| 317 |
+
'__typename': 'Droid',
|
| 318 |
+
'name': 'R2-D2',
|
| 319 |
+
}
|
| 320 |
+
}
|
| 321 |
+
result = client.execute(query)
|
| 322 |
+
assert result == expected
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
def test_check_type_of_luke(client):
|
| 326 |
+
query = gql('''
|
| 327 |
+
query CheckTypeOfLuke {
|
| 328 |
+
hero(episode: EMPIRE) {
|
| 329 |
+
__typename
|
| 330 |
+
name
|
| 331 |
+
}
|
| 332 |
+
}
|
| 333 |
+
''')
|
| 334 |
+
expected = {
|
| 335 |
+
'hero': {
|
| 336 |
+
'__typename': 'Human',
|
| 337 |
+
'name': 'Luke Skywalker',
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
result = client.execute(query)
|
| 341 |
+
assert result == expected
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
def test_parse_error(client):
|
| 345 |
+
result = None
|
| 346 |
+
with pytest.raises(Exception) as excinfo:
|
| 347 |
+
query = gql('''
|
| 348 |
+
qeury
|
| 349 |
+
''')
|
| 350 |
+
result = client.execute(query)
|
| 351 |
+
error = excinfo.value
|
| 352 |
+
formatted_error = format_error(error)
|
| 353 |
+
assert formatted_error['locations'] == [{'column': 13, 'line': 2}]
|
| 354 |
+
assert 'Syntax Error GraphQL request (2:13) Unexpected Name "qeury"' in formatted_error['message']
|
| 355 |
+
assert not result
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/starwars/test_validation.py
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
from graphql import graphql
|
| 3 |
+
from graphql.utils.introspection_query import introspection_query
|
| 4 |
+
|
| 5 |
+
from gql import Client, gql
|
| 6 |
+
|
| 7 |
+
from .schema import StarWarsSchema
|
| 8 |
+
|
| 9 |
+
introspection = graphql(StarWarsSchema, introspection_query).data
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@pytest.fixture
|
| 13 |
+
def local_schema():
|
| 14 |
+
return Client(schema=StarWarsSchema)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
@pytest.fixture
|
| 18 |
+
def typedef_schema():
|
| 19 |
+
return Client(type_def='''
|
| 20 |
+
schema {
|
| 21 |
+
query: Query
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
interface Character {
|
| 25 |
+
appearsIn: [Episode]
|
| 26 |
+
friends: [Character]
|
| 27 |
+
id: String!
|
| 28 |
+
name: String
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
type Droid implements Character {
|
| 32 |
+
appearsIn: [Episode]
|
| 33 |
+
friends: [Character]
|
| 34 |
+
id: String!
|
| 35 |
+
name: String
|
| 36 |
+
primaryFunction: String
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
enum Episode {
|
| 40 |
+
EMPIRE
|
| 41 |
+
JEDI
|
| 42 |
+
NEWHOPE
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
type Human implements Character {
|
| 46 |
+
appearsIn: [Episode]
|
| 47 |
+
friends: [Character]
|
| 48 |
+
homePlanet: String
|
| 49 |
+
id: String!
|
| 50 |
+
name: String
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
type Query {
|
| 54 |
+
droid(id: String!): Droid
|
| 55 |
+
hero(episode: Episode): Character
|
| 56 |
+
human(id: String!): Human
|
| 57 |
+
}''')
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
@pytest.fixture
|
| 61 |
+
def introspection_schema():
|
| 62 |
+
return Client(introspection=introspection)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
@pytest.fixture(params=['local_schema', 'typedef_schema', 'introspection_schema'])
|
| 66 |
+
def client(request):
|
| 67 |
+
return request.getfixturevalue(request.param)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def validation_errors(client, query):
|
| 71 |
+
query = gql(query)
|
| 72 |
+
try:
|
| 73 |
+
client.validate(query)
|
| 74 |
+
return False
|
| 75 |
+
except Exception:
|
| 76 |
+
return True
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def test_nested_query_with_fragment(client):
|
| 80 |
+
query = '''
|
| 81 |
+
query NestedQueryWithFragment {
|
| 82 |
+
hero {
|
| 83 |
+
...NameAndAppearances
|
| 84 |
+
friends {
|
| 85 |
+
...NameAndAppearances
|
| 86 |
+
friends {
|
| 87 |
+
...NameAndAppearances
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
fragment NameAndAppearances on Character {
|
| 93 |
+
name
|
| 94 |
+
appearsIn
|
| 95 |
+
}
|
| 96 |
+
'''
|
| 97 |
+
assert not validation_errors(client, query)
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def test_non_existent_fields(client):
|
| 101 |
+
query = '''
|
| 102 |
+
query HeroSpaceshipQuery {
|
| 103 |
+
hero {
|
| 104 |
+
favoriteSpaceship
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
'''
|
| 108 |
+
assert validation_errors(client, query)
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def test_require_fields_on_object(client):
|
| 112 |
+
query = '''
|
| 113 |
+
query HeroNoFieldsQuery {
|
| 114 |
+
hero
|
| 115 |
+
}
|
| 116 |
+
'''
|
| 117 |
+
assert validation_errors(client, query)
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
def test_disallows_fields_on_scalars(client):
|
| 121 |
+
query = '''
|
| 122 |
+
query HeroFieldsOnScalarQuery {
|
| 123 |
+
hero {
|
| 124 |
+
name {
|
| 125 |
+
firstCharacterOfName
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
'''
|
| 130 |
+
assert validation_errors(client, query)
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def test_disallows_object_fields_on_interfaces(client):
|
| 134 |
+
query = '''
|
| 135 |
+
query DroidFieldOnCharacter {
|
| 136 |
+
hero {
|
| 137 |
+
name
|
| 138 |
+
primaryFunction
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
'''
|
| 142 |
+
assert validation_errors(client, query)
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
def test_allows_object_fields_in_fragments(client):
|
| 146 |
+
query = '''
|
| 147 |
+
query DroidFieldInFragment {
|
| 148 |
+
hero {
|
| 149 |
+
name
|
| 150 |
+
...DroidFields
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
fragment DroidFields on Droid {
|
| 154 |
+
primaryFunction
|
| 155 |
+
}
|
| 156 |
+
'''
|
| 157 |
+
assert not validation_errors(client, query)
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def test_allows_object_fields_in_inline_fragments(client):
|
| 161 |
+
query = '''
|
| 162 |
+
query DroidFieldInFragment {
|
| 163 |
+
hero {
|
| 164 |
+
name
|
| 165 |
+
... on Droid {
|
| 166 |
+
primaryFunction
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
'''
|
| 171 |
+
assert not validation_errors(client, query)
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/test_client.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
import mock
|
| 3 |
+
|
| 4 |
+
from gql import Client, gql
|
| 5 |
+
from gql.transport.requests import RequestsHTTPTransport
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
@mock.patch('gql.transport.requests.RequestsHTTPTransport.execute')
|
| 9 |
+
def test_retries(execute_mock):
|
| 10 |
+
expected_retries = 3
|
| 11 |
+
execute_mock.side_effect = Exception("fail")
|
| 12 |
+
|
| 13 |
+
client = Client(
|
| 14 |
+
retries=expected_retries,
|
| 15 |
+
transport=RequestsHTTPTransport(url='http://swapi.graphene-python.org/graphql')
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
query = gql('''
|
| 19 |
+
{
|
| 20 |
+
myFavoriteFilm: film(id:"RmlsbToz") {
|
| 21 |
+
id
|
| 22 |
+
title
|
| 23 |
+
episodeId
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
''')
|
| 27 |
+
|
| 28 |
+
with pytest.raises(Exception):
|
| 29 |
+
client.execute(query)
|
| 30 |
+
|
| 31 |
+
assert execute_mock.call_count == expected_retries
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/tests/test_transport.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
import requests
|
| 3 |
+
import vcr
|
| 4 |
+
|
| 5 |
+
from gql import Client, gql
|
| 6 |
+
from gql.transport.requests import RequestsHTTPTransport
|
| 7 |
+
|
| 8 |
+
# https://github.com/graphql-python/swapi-graphene
|
| 9 |
+
URL = 'http://127.0.0.1:8000/graphql'
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@pytest.fixture
|
| 13 |
+
def client():
|
| 14 |
+
with vcr.use_cassette('tests/fixtures/vcr_cassettes/client.yaml'):
|
| 15 |
+
request = requests.get(
|
| 16 |
+
URL,
|
| 17 |
+
headers={
|
| 18 |
+
'Host': 'swapi.graphene-python.org',
|
| 19 |
+
'Accept': 'text/html',
|
| 20 |
+
}
|
| 21 |
+
)
|
| 22 |
+
request.raise_for_status()
|
| 23 |
+
csrf = request.cookies['csrftoken']
|
| 24 |
+
|
| 25 |
+
return Client(
|
| 26 |
+
transport=RequestsHTTPTransport(
|
| 27 |
+
url=URL,
|
| 28 |
+
cookies={"csrftoken": csrf},
|
| 29 |
+
headers={'x-csrftoken': csrf}),
|
| 30 |
+
fetch_schema_from_transport=True
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_hero_name_query(client):
|
| 35 |
+
query = gql('''
|
| 36 |
+
{
|
| 37 |
+
myFavoriteFilm: film(id:"RmlsbToz") {
|
| 38 |
+
id
|
| 39 |
+
title
|
| 40 |
+
episodeId
|
| 41 |
+
characters(first:5) {
|
| 42 |
+
edges {
|
| 43 |
+
node {
|
| 44 |
+
name
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
''')
|
| 51 |
+
expected = {
|
| 52 |
+
"myFavoriteFilm": {
|
| 53 |
+
"id": "RmlsbToz",
|
| 54 |
+
"title": "Return of the Jedi",
|
| 55 |
+
"episodeId": 6,
|
| 56 |
+
"characters": {
|
| 57 |
+
"edges": [
|
| 58 |
+
{
|
| 59 |
+
"node": {
|
| 60 |
+
"name": "Luke Skywalker"
|
| 61 |
+
}
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"node": {
|
| 65 |
+
"name": "C-3PO"
|
| 66 |
+
}
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"node": {
|
| 70 |
+
"name": "R2-D2"
|
| 71 |
+
}
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"node": {
|
| 75 |
+
"name": "Darth Vader"
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"node": {
|
| 80 |
+
"name": "Leia Organa"
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
]
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
with vcr.use_cassette('tests/fixtures/vcr_cassettes/execute.yaml'):
|
| 88 |
+
result = client.execute(query)
|
| 89 |
+
assert result == expected
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (274 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/gql.cpython-310.pyc
ADDED
|
Binary file (556 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/dsl.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Iterable
|
| 2 |
+
import decimal
|
| 3 |
+
from functools import partial
|
| 4 |
+
|
| 5 |
+
from wandb_graphql.language import ast
|
| 6 |
+
from wandb_graphql.language.printer import print_ast
|
| 7 |
+
from wandb_graphql.type import (GraphQLField, GraphQLList,
|
| 8 |
+
GraphQLNonNull, GraphQLEnumType)
|
| 9 |
+
|
| 10 |
+
from .utils import to_camel_case
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class DSLSchema(object):
|
| 14 |
+
def __init__(self, client):
|
| 15 |
+
self.client = client
|
| 16 |
+
|
| 17 |
+
@property
|
| 18 |
+
def schema(self):
|
| 19 |
+
return self.client.schema
|
| 20 |
+
|
| 21 |
+
def __getattr__(self, name):
|
| 22 |
+
type_def = self.schema.get_type(name)
|
| 23 |
+
return DSLType(type_def)
|
| 24 |
+
|
| 25 |
+
def query(self, *args, **kwargs):
|
| 26 |
+
return self.execute(query(*args, **kwargs))
|
| 27 |
+
|
| 28 |
+
def mutate(self, *args, **kwargs):
|
| 29 |
+
return self.query(*args, operation='mutate', **kwargs)
|
| 30 |
+
|
| 31 |
+
def execute(self, document):
|
| 32 |
+
return self.client.execute(document)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class DSLType(object):
|
| 36 |
+
def __init__(self, type):
|
| 37 |
+
self.type = type
|
| 38 |
+
|
| 39 |
+
def __getattr__(self, name):
|
| 40 |
+
formatted_name, field_def = self.get_field(name)
|
| 41 |
+
return DSLField(formatted_name, field_def)
|
| 42 |
+
|
| 43 |
+
def get_field(self, name):
|
| 44 |
+
camel_cased_name = to_camel_case(name)
|
| 45 |
+
|
| 46 |
+
if name in self.type.fields:
|
| 47 |
+
return name, self.type.fields[name]
|
| 48 |
+
|
| 49 |
+
if camel_cased_name in self.type.fields:
|
| 50 |
+
return camel_cased_name, self.type.fields[camel_cased_name]
|
| 51 |
+
|
| 52 |
+
raise KeyError('Field {} doesnt exist in type {}.'.format(name, self.type.name))
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def selections(*fields):
|
| 56 |
+
for _field in fields:
|
| 57 |
+
yield field(_field).ast
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def get_ast_value(value):
|
| 61 |
+
if isinstance(value, ast.Node):
|
| 62 |
+
return value
|
| 63 |
+
if isinstance(value, str):
|
| 64 |
+
return ast.StringValue(value=value)
|
| 65 |
+
elif isinstance(value, bool):
|
| 66 |
+
return ast.BooleanValue(value=value)
|
| 67 |
+
elif isinstance(value, (float, decimal.Decimal)):
|
| 68 |
+
return ast.FloatValue(value=value)
|
| 69 |
+
elif isinstance(value, int):
|
| 70 |
+
return ast.IntValue(value=value)
|
| 71 |
+
return None
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class DSLField(object):
|
| 75 |
+
|
| 76 |
+
def __init__(self, name, field):
|
| 77 |
+
self.field = field
|
| 78 |
+
self.ast_field = ast.Field(name=ast.Name(value=name), arguments=[])
|
| 79 |
+
self.selection_set = None
|
| 80 |
+
|
| 81 |
+
def select(self, *fields):
|
| 82 |
+
if not self.ast_field.selection_set:
|
| 83 |
+
self.ast_field.selection_set = ast.SelectionSet(selections=[])
|
| 84 |
+
self.ast_field.selection_set.selections.extend(selections(*fields))
|
| 85 |
+
return self
|
| 86 |
+
|
| 87 |
+
def __call__(self, *args, **kwargs):
|
| 88 |
+
return self.args(*args, **kwargs)
|
| 89 |
+
|
| 90 |
+
def alias(self, alias):
|
| 91 |
+
self.ast_field.alias = ast.Name(value=alias)
|
| 92 |
+
return self
|
| 93 |
+
|
| 94 |
+
def args(self, **args):
|
| 95 |
+
for name, value in args.items():
|
| 96 |
+
arg = self.field.args.get(name)
|
| 97 |
+
arg_type_serializer = get_arg_serializer(arg.type)
|
| 98 |
+
value = arg_type_serializer(value)
|
| 99 |
+
self.ast_field.arguments.append(
|
| 100 |
+
ast.Argument(
|
| 101 |
+
name=ast.Name(value=name),
|
| 102 |
+
value=get_ast_value(value)
|
| 103 |
+
)
|
| 104 |
+
)
|
| 105 |
+
return self
|
| 106 |
+
|
| 107 |
+
@property
|
| 108 |
+
def ast(self):
|
| 109 |
+
return self.ast_field
|
| 110 |
+
|
| 111 |
+
def __str__(self):
|
| 112 |
+
return print_ast(self.ast_field)
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
def field(field, **args):
|
| 116 |
+
if isinstance(field, GraphQLField):
|
| 117 |
+
return DSLField(field).args(**args)
|
| 118 |
+
elif isinstance(field, DSLField):
|
| 119 |
+
return field
|
| 120 |
+
|
| 121 |
+
raise Exception('Received incompatible query field: "{}".'.format(field))
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def query(*fields):
|
| 125 |
+
return ast.Document(
|
| 126 |
+
definitions=[ast.OperationDefinition(
|
| 127 |
+
operation='query',
|
| 128 |
+
selection_set=ast.SelectionSet(
|
| 129 |
+
selections=list(selections(*fields))
|
| 130 |
+
)
|
| 131 |
+
)]
|
| 132 |
+
)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def serialize_list(serializer, values):
|
| 136 |
+
assert isinstance(values, Iterable), 'Expected iterable, received "{}"'.format(repr(values))
|
| 137 |
+
return [serializer(v) for v in values]
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
def get_arg_serializer(arg_type):
|
| 141 |
+
if isinstance(arg_type, GraphQLNonNull):
|
| 142 |
+
return get_arg_serializer(arg_type.of_type)
|
| 143 |
+
if isinstance(arg_type, GraphQLList):
|
| 144 |
+
inner_serializer = get_arg_serializer(arg_type.of_type)
|
| 145 |
+
return partial(serialize_list, inner_serializer)
|
| 146 |
+
if isinstance(arg_type, GraphQLEnumType):
|
| 147 |
+
return lambda value: ast.EnumValue(value=arg_type.serialize(value))
|
| 148 |
+
return arg_type.serialize
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def var(name):
|
| 152 |
+
return ast.Variable(name=name)
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/gql.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from wandb_graphql.language.parser import parse
|
| 2 |
+
from wandb_graphql.language.source import Source
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def gql(request_string):
|
| 6 |
+
if isinstance(request_string, str):
|
| 7 |
+
source = Source(request_string, 'GraphQL request')
|
| 8 |
+
return parse(source)
|
| 9 |
+
else:
|
| 10 |
+
raise Exception('Received incompatible request "{}".'.format(request_string))
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/__init__.py
ADDED
|
File without changes
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/http.cpython-310.pyc
ADDED
|
Binary file (541 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/local_schema.cpython-310.pyc
ADDED
|
Binary file (770 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/requests.cpython-310.pyc
ADDED
|
Binary file (1.82 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/http.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class HTTPTransport(object):
|
| 2 |
+
|
| 3 |
+
def __init__(self, url, headers=None, cookies=None):
|
| 4 |
+
self.url = url
|
| 5 |
+
self.headers = headers
|
| 6 |
+
self.cookies = cookies
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/local_schema.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from wandb_graphql.execution import execute
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class LocalSchemaTransport(object):
|
| 5 |
+
|
| 6 |
+
def __init__(self, schema):
|
| 7 |
+
self.schema = schema
|
| 8 |
+
|
| 9 |
+
def execute(self, document, *args, **kwargs):
|
| 10 |
+
return execute(
|
| 11 |
+
self.schema,
|
| 12 |
+
document,
|
| 13 |
+
*args,
|
| 14 |
+
**kwargs
|
| 15 |
+
)
|
vllm/lib/python3.10/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/requests.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import absolute_import
|
| 2 |
+
|
| 3 |
+
import requests
|
| 4 |
+
from wandb_graphql.execution import ExecutionResult
|
| 5 |
+
from wandb_graphql.language.printer import print_ast
|
| 6 |
+
|
| 7 |
+
from .http import HTTPTransport
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class RequestsHTTPTransport(HTTPTransport):
|
| 11 |
+
def __init__(self, url, auth=None, use_json=False, timeout=None, **kwargs):
|
| 12 |
+
"""
|
| 13 |
+
:param url: The GraphQL URL
|
| 14 |
+
:param auth: Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth
|
| 15 |
+
:param use_json: Send request body as JSON instead of form-urlencoded
|
| 16 |
+
:param timeout: Specifies a default timeout for requests (Default: None)
|
| 17 |
+
"""
|
| 18 |
+
super(RequestsHTTPTransport, self).__init__(url, **kwargs)
|
| 19 |
+
self.auth = auth
|
| 20 |
+
self.default_timeout = timeout
|
| 21 |
+
self.use_json = use_json
|
| 22 |
+
|
| 23 |
+
def execute(self, document, variable_values=None, timeout=None):
|
| 24 |
+
query_str = print_ast(document)
|
| 25 |
+
payload = {
|
| 26 |
+
'query': query_str,
|
| 27 |
+
'variables': variable_values or {}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
data_key = 'json' if self.use_json else 'data'
|
| 31 |
+
post_args = {
|
| 32 |
+
'headers': self.headers,
|
| 33 |
+
'auth': self.auth,
|
| 34 |
+
'cookies': self.cookies,
|
| 35 |
+
'timeout': timeout or self.default_timeout,
|
| 36 |
+
data_key: payload
|
| 37 |
+
}
|
| 38 |
+
request = requests.post(self.url, **post_args)
|
| 39 |
+
request.raise_for_status()
|
| 40 |
+
|
| 41 |
+
result = request.json()
|
| 42 |
+
assert 'errors' in result or 'data' in result, 'Received non-compatible response "{}"'.format(result)
|
| 43 |
+
return ExecutionResult(
|
| 44 |
+
errors=result.get('errors'),
|
| 45 |
+
data=result.get('data')
|
| 46 |
+
)
|
vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (2.47 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/abap.cpython-310.pyc
ADDED
|
Binary file (928 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/algol.cpython-310.pyc
ADDED
|
Binary file (2.2 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/algol_nu.cpython-310.pyc
ADDED
|
Binary file (2.21 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/arduino.cpython-310.pyc
ADDED
|
Binary file (2.28 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/wandb/vendor/pygments/styles/__pycache__/autumn.cpython-310.pyc
ADDED
|
Binary file (1.79 kB). View file
|
|
|