use llm cache to make exp_pool

This commit is contained in:
seehi 2024-07-08 10:09:36 +08:00
parent d902a6f18c
commit c624c0ffc7
41 changed files with 844 additions and 368 deletions

View file

@ -1,5 +1,4 @@
"""class tools, including method inspection, class attributes, inheritance relationships, etc."""
import inspect
def check_methods(C, *methods):
@ -17,25 +16,3 @@ def check_methods(C, *methods):
else:
return NotImplemented
return True
def get_class_name(func) -> str:
"""Returns the class name of the object that a method belongs to.
- If `func` is a bound method or a class method, extracts the class name directly from the method.
- Returns an empty string if it's a regular function or cannot determine the class.
"""
if inspect.ismethod(func):
if inspect.isclass(func.__self__):
return func.__self__.__name__
return func.__self__.__class__.__name__
if inspect.isfunction(func):
qualname_parts = func.__qualname__.split(".")
if len(qualname_parts) > 1:
class_name = qualname_parts[-2]
if class_name.isidentifier():
return class_name
return ""