MCPcopy
hub / github.com/LawRefBook/Laws / parse_file

Method parse_file

scripts/request.py:580–591  ·  view source on GitHub ↗
(self, file_path, publish_at=None)

Source from the content-addressed store, hash-verified

578 self.cache.write_law(output_path, filedata)
579
580 def parse_file(self, file_path, publish_at=None):
581 result = {}
582 with open(file_path, "r") as f:
583 data = list(filter(lambda x: x, map(
584 lambda x: x.strip(), f.readlines())))
585 title = data[0]
586 filedata = self.content_parser.parse(result, title, data[1], data[2:])
587 if not filedata:
588 return
589 output_path = self.__get_law_output_path(title, publish_at)
590 logger.debug(f"parsing {title} success")
591 self.cache.write_law(output_path, filedata)
592
593 def get_file_hash(self, title, publish_at=None) -> str:
594 _hash = md5()

Callers 1

mainFunction · 0.95

Calls 3

__get_law_output_pathMethod · 0.95
write_lawMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected