-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ray.py
36 lines (26 loc) · 959 Bytes
/
ray.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from __future__ import annotations
import functools
import inspect
from typing import Iterator, AsyncIterator, Union, Callable, Any, Iterable, AsyncIterable, Tuple
def __ray__(*GLOBAL_ARGS, **GLOBAL_KWARGS):
class Ray:
@staticmethod
def __new__(cls, *args, **kwargs):
return super().__new__(cls)
def __init__(self, *args, **kwargs) -> Ray:
pass
# def initial(self) -> Ray: raise NotImplementedError
# def self(self) -> Ray: raise NotImplementedError
# def terminal(self) -> Ray: raise NotImplementedError
@staticmethod
def none() -> Ray: raise NotImplementedError
@staticmethod
def boolean() -> Ray: return (Ray.none * 2).orbit
@staticmethod
def function(func: Callable[[Any, ...], Any]):
return Ray()
pass
for name, fn in inspect.getmembers(Ray, inspect.isfunction):
if name == '__new__' or name == '__init__' or name == 'function': continue
return Ray
Ray = __ray__()