MCPcopy Index your code
hub / github.com/idank/explainshell / _extract_one

Function _extract_one

explainshell/extraction/runner.py:116–146  ·  view source on GitHub ↗

Run extractor on a single file. Returns an ``ExtractionResult`` for all expected outcomes. Raises ``FatalExtractionError`` for both explicit fatal errors from the extractor and unexpected exceptions (wrapped with traceback logged).

(extractor: Extractor, gz_path: str)

Source from the content-addressed store, hash-verified

114
115
116def _extract_one(extractor: Extractor, gz_path: str) -> ExtractionResult:
117 """Run extractor on a single file.
118
119 Returns an ``ExtractionResult`` for all expected outcomes. Raises
120 ``FatalExtractionError`` for both explicit fatal errors from the
121 extractor and unexpected exceptions (wrapped with traceback logged).
122 """
123 try:
124 return extractor.extract(gz_path)
125 # Order matters: FatalExtractionError and SkippedExtraction both inherit
126 # from ExtractionError, so they must be handled before the generic branch.
127 except FatalExtractionError:
128 raise
129 except SkippedExtraction as e:
130 return ExtractionResult(
131 gz_path=gz_path,
132 outcome=ExtractionOutcome.SKIPPED,
133 stats=e.stats,
134 error=e.reason,
135 reason_class=e.reason_class,
136 )
137 except ExtractionError as e:
138 return ExtractionResult(
139 gz_path=gz_path,
140 outcome=ExtractionOutcome.FAILED,
141 error=str(e),
142 reason_class=e.reason_class,
143 )
144 except Exception as e:
145 logger.exception("fatal unexpected exception while extracting %s", gz_path)
146 raise FatalExtractionError(str(e)) from e
147
148
149def run_sequential(

Callers 2

run_sequentialFunction · 0.85
_do_oneFunction · 0.85

Calls 3

ExtractionResultClass · 0.90
extractMethod · 0.45

Tested by

no test coverage detected