-
-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathbase.py
More file actions
27 lines (22 loc) · 734 Bytes
/
base.py
File metadata and controls
27 lines (22 loc) · 734 Bytes
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
from abc import ABC, abstractmethod
from vectorcode.cli_utils import Config
class RewriterBase(ABC): # pragma: nocover
def __init__(self, config: Config) -> None:
super().__init__()
self.config = config
@classmethod
def create(cls, configs: Config):
try:
return cls(configs)
except Exception as e:
e.add_note(
"\n"
+ (
cls.__doc__
or f"There was an issue initialising {cls}. Please doublecheck your configuration."
)
)
raise
@abstractmethod
async def rewrite(self, original_query: list[str]) -> list[str]:
raise NotImplementedError