MCPcopy Index your code
hub / github.com/nodejs/node / split_template_path

Function split_template_path

tools/inspector_protocol/jinja2/loaders.py:22–34  ·  view source on GitHub ↗

Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error.

(template)

Source from the content-addressed store, hash-verified

20
21
22def split_template_path(template):
23 """Split a path into segments and perform a sanity check. If it detects
24 '..' in the path it will raise a `TemplateNotFound` error.
25 """
26 pieces = []
27 for piece in template.split('/'):
28 if path.sep in piece \
29 or (path.altsep and path.altsep in piece) or \
30 piece == path.pardir:
31 raise TemplateNotFound(template)
32 elif piece and piece != '.':
33 pieces.append(piece)
34 return pieces
35
36
37class BaseLoader(object):

Callers 2

get_sourceMethod · 0.70
get_sourceMethod · 0.70

Calls 3

TemplateNotFoundClass · 0.90
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected