MCPcopy
hub / github.com/django/django / _line_at_position

Method _line_at_position

django/contrib/staticfiles/storage.py:235–243  ·  view source on GitHub ↗
(content, position)

Source from the content-addressed store, hash-verified

233 template = self.default_template
234
235 def _line_at_position(content, position):
236 start = content.rfind("\n", 0, position) + 1
237 end = content.find("\n", position)
238 end = end if end != -1 else len(content)
239 line_num = content.count("\n", 0, start) + 1
240 msg = f"\n{line_num}: {content[start:end]}"
241 if len(msg) > 79:
242 return f"\n{line_num}"
243 return msg
244
245 def converter(matchobj):
246 """

Callers

nothing calls this directly

Calls 2

findMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected