MCPcopy Index your code
hub / github.com/clips/pattern / _format

Function _format

pattern/db/__init__.py:1023–1029  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

1021 This is useful when constructing queries with relations to other tables.
1022 """
1023 def _format(s):
1024 if not "." in s:
1025 # Field could be wrapped in a function: year(date) => year(table.date).
1026 p = s.endswith(")") and re.match(r"^("+sql_functions+r")\(", s, re.I) or None
1027 i = p and len(p.group(0)) or 0
1028 return "%s%s.%s" % (s[:i], table, s[i:])
1029 return s
1030 if isinstance(field, (list, tuple)):
1031 return [_format(f) for f in field]
1032 return _format(field)

Callers 1

absFunction · 0.70

Calls 3

lenFunction · 0.85
matchMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…