MCPcopy Create free account
hub / github.com/ArthurHeitmann/arctic_shift / processFile

Function processFile

scripts/processFiles.py:15–41  ·  view source on GitHub ↗
(path: str)

Source from the content-addressed store, hash-verified

13recursive = False
14
15def processFile(path: str):
16 print(f"Processing file {path}")
17 with open(path, "rb") as f:
18 jsonStream = getFileJsonStream(path, f)
19 if jsonStream is None:
20 print(f"Skipping unknown file {path}")
21 return
22 progressLog = FileProgressLog(path, f)
23 for row in jsonStream:
24 progressLog.onRow()
25 # PUT YOUR CODE HERE
26
27 # example fields
28 author = row["author"]
29 subreddit = row["subreddit"]
30 id = row["id"]
31 created = row["created_utc"]
32 score = row["score"]
33 # posts only
34 # title = row["title"]
35 # body = row["selftext"]
36 # url = row["url"]
37 # comments only
38 # body = row["body"]
39 # parent = row["parent_id"] # id/name of the parent comment or post (e.g. t3_abc123 or t1_abc123)
40 # link_id = row["link_id"] # id/name of the post (e.g. t3_abc123)
41 progressLog.logProgress("\n")
42
43
44def processFolder(path: str):

Callers 2

processFolderFunction · 0.85
mainFunction · 0.85

Calls 4

onRowMethod · 0.95
logProgressMethod · 0.95
getFileJsonStreamFunction · 0.90
FileProgressLogClass · 0.90

Tested by

no test coverage detected