File tree 5 files changed +31
-2
lines changed
5 files changed +31
-2
lines changed Original file line number Diff line number Diff line change
1
+ from patchwork .common .utils .utils import open_with_chardet
2
+ from patchwork .step import Step
3
+ from patchwork .steps .ReadFile .typed import ReadFileInputs
4
+
5
+
6
+ class ReadFile (Step ):
7
+ def __init__ (self , inputs ):
8
+ super ().__init__ (inputs )
9
+ missing_keys = ReadFileInputs .__required_keys__ .difference (inputs .keys ())
10
+ if len (missing_keys ) > 0 :
11
+ raise ValueError (f"Missing required data: { missing_keys } " )
12
+
13
+ self .file = inputs ["file_path" ]
14
+
15
+ def run (self ):
16
+ with open_with_chardet ("r" , self .file ) as f :
17
+ file_contents = f .read ()
18
+
19
+ return dict (file_content = file_contents )
Original file line number Diff line number Diff line change
1
+ from typing_extensions import TypedDict
2
+
3
+
4
+ class ReadFileInputs (TypedDict ):
5
+ file_path : str
6
+
7
+
8
+ class ReadFileOutputs (TypedDict ):
9
+ file_content : str
Original file line number Diff line number Diff line change 43
43
"CallAPI" ,
44
44
"CallCode2Prompt" ,
45
45
"CallLLM" ,
46
- "Combine"
46
+ "Combine" ,
47
47
"CommitChanges" ,
48
48
"CreateIssue" ,
49
49
"CreateIssueComment" ,
63
63
"PreparePR" ,
64
64
"PreparePrompt" ,
65
65
"QueryEmbeddings" ,
66
+ "ReadFile" ,
66
67
"ReadIssues" ,
67
68
"ReadPRDiffs" ,
68
69
"ScanDepscan" ,
Original file line number Diff line number Diff line change 1
1
[tool .poetry ]
2
2
name = " patchwork-cli"
3
- version = " 0.0.44.dev1 "
3
+ version = " 0.0.44.dev2 "
4
4
description = " "
5
5
authors = [" patched.codes" ]
6
6
license = " AGPL"
You can’t perform that action at this time.
0 commit comments