mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-03 02:17:43 +00:00
eee2b3c56a
* remove ruff comment in log.py * change log framework and fix llm_utils.py's logs * Some thoughts for logging * fix SingletonMeta's definition, maintain an instance dict for each class that inherits it * adjust log codes directory, add some tag for factor implementation logging * Update rdagent/core/conf.py * fix factor task app & log * fix log import * Streamlet framework * fix log tag to path logic * Add todos * Add example in docstring * add log tag for llm_utils.py * Capture lost content --------- Co-authored-by: Young <afe.young@gmail.com> Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
62 lines
1.5 KiB
Python
62 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from abc import abstractmethod
|
|
from pathlib import Path
|
|
|
|
|
|
class Storage:
|
|
"""
|
|
Basic storage to support saving objects;
|
|
|
|
# Usage:
|
|
|
|
The storage has mainly two kind of users:
|
|
- The logging end: you can choose any of the following method to use the object
|
|
- We can use it directly with the native logging storage
|
|
- We can use it with other logging tools; For example, serve as a handler for loggers
|
|
- The view end:
|
|
- Mainly for the subclass of `logging.base.View`
|
|
- It should provide two kind of ways to provide content
|
|
- offline content provision.
|
|
- online content preovision.
|
|
"""
|
|
|
|
@abstractmethod
|
|
def log(self, obj: object, name: str = "", **kwargs: dict) -> str | Path:
|
|
"""
|
|
|
|
Parameters
|
|
----------
|
|
obj : object
|
|
The object for logging.
|
|
name : str
|
|
The name of the object. For example "a.b.c"
|
|
We may log a lot of objects to a same name
|
|
|
|
Returns
|
|
-------
|
|
str | Path
|
|
The storage identifier of the object.
|
|
"""
|
|
...
|
|
|
|
|
|
class View:
|
|
"""
|
|
Motivation:
|
|
|
|
Display the content in the storage
|
|
"""
|
|
# TODO: pleas fix me
|
|
@abstractmethod
|
|
def display(s: Storage, watch: bool=False):
|
|
"""
|
|
|
|
Parameters
|
|
----------
|
|
s : Storage
|
|
|
|
watch : bool
|
|
should we watch the new content and display them
|
|
"""
|
|
... |