MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / sourcehook

Method sourcehook

tools/python-3.11.9-amd64/Lib/shlex.py:279–286  ·  view source on GitHub ↗

Hook called on a filename to be sourced.

(self, newfile)

Source from the content-addressed store, hash-verified

277 return result
278
279 def sourcehook(self, newfile):
280 "Hook called on a filename to be sourced."
281 if newfile[0] == '"':
282 newfile = newfile[1:-1]
283 # This implements cpp-like semantics for relative-path inclusion.
284 if isinstance(self.infile, str) and not os.path.isabs(newfile):
285 newfile = os.path.join(os.path.dirname(self.infile), newfile)
286 return (newfile, open(newfile, "r"))
287
288 def error_leader(self, infile=None, lineno=None):
289 "Emit a C-compiler-like, Emacs-friendly error-message leader."

Callers 1

get_tokenMethod · 0.95

Calls 2

openFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected