MCPcopy Create free account
hub / github.com/pytorch/executorch / from_line

Method from_line

scripts/pick_doc_commits.py:99–104  ·  view source on GitHub ↗

Creates a Commit from a string of the form ' [ ]'.

(line: str)

Source from the content-addressed store, hash-verified

97
98 @staticmethod
99 def from_line(line: str) -> "Commit":
100 """Creates a Commit from a string of the form '<hash> [<message>]'."""
101 parts = line.split(" ", maxsplit=1)
102 parts = [part.strip() for part in parts if part.strip()]
103 assert len(parts) >= 1, f"Expected at least one part in line '{line}'"
104 return Commit(hash=parts[0], message=parts[1] if len(parts) > 1 else "")
105
106 def __repr__(self):
107 return f"Commit('{self.hash[:8]}', '{self.message}')"

Callers 1

mainFunction · 0.80

Calls 2

CommitClass · 0.85
splitMethod · 0.80

Tested by

no test coverage detected