-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_docstrings.py
More file actions
51 lines (44 loc) · 2.06 KB
/
Copy pathfix_docstrings.py
File metadata and controls
51 lines (44 loc) · 2.06 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""Script to fix docstrings in the codebase."""
import os
with open("packages/core/src/imednet/integrations/export.py", "r") as f:
content = f.read()
content = content.replace(
"class TabularSinkConfig(SinkConfig):",
'class TabularSinkConfig(SinkConfig):\n """Configuration for tabular sinks."""',
)
content = content.replace(
"class TabularCSVSink(ExportSink):",
'class TabularCSVSink(ExportSink):\n """Sink for exporting data to CSV format."""',
)
content = content.replace(
"def __init__(self, path: str, config: Optional[TabularSinkConfig] = None):",
'def __init__(self, path: str, config: Optional[TabularSinkConfig] = None):\n """Initialize the CSV sink."""',
)
content = content.replace(
"def write_batch(self, records: Sequence[Any], *, batch_id: str) -> int:",
'def write_batch(self, records: Sequence[Any], *, batch_id: str) -> int:\n """Write a batch of records to the sink."""',
)
content = content.replace(
"def flush(self) -> None:", 'def flush(self) -> None:\n """Flush the sink."""'
)
content = content.replace(
"def close(self) -> None:", 'def close(self) -> None:\n """Close the sink."""'
)
content = content.replace(
"class TabularSQLSink(ExportSink):",
'class TabularSQLSink(ExportSink):\n """Sink for exporting data to SQL databases."""',
)
content = content.replace(
"def __init__(self, table: str, engine: Any, config: Optional[TabularSinkConfig] = None):",
'def __init__(self, table: str, engine: Any, config: Optional[TabularSinkConfig] = None):\n """Initialize the SQL sink."""',
)
with open("packages/core/src/imednet/integrations/export.py", "w") as f:
f.write(content)
with open("packages/core/src/imednet/utils/job_poller.py", "r") as f:
content = f.read()
content = content.replace(
"def __init__(self, message: str, status: JobStatus) -> None:",
'def __init__(self, message: str, status: JobStatus) -> None:\n """Initialize the JobFailedError."""',
)
with open("packages/core/src/imednet/utils/job_poller.py", "w") as f:
f.write(content)