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

Function _unpack_fields

pattern/db/__init__.py:1353–1372  ·  view source on GitHub ↗

Replaces "*" with the actual field names. Fields from related tables keep the " ." prefix.

(table, fields=[])

Source from the content-addressed store, hash-verified

1351XML_HEADER = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
1352
1353def _unpack_fields(table, fields=[]):
1354 """ Replaces "*" with the actual field names.
1355 Fields from related tables keep the "<tablename>." prefix.
1356 """
1357 u = []
1358 for f in fields:
1359 a, b = "." in f and f.split(".", 1) or (table.name, f)
1360 if a == table.name and b == ALL:
1361 # <table>.*
1362 u.extend(f for f in table.db.tables[a].fields)
1363 elif a != table.name and b == ALL:
1364 # <related-table>.*
1365 u.extend("%s.%s" % (a, f) for f in table.db.tables[a].fields)
1366 elif a != table.name:
1367 # <related-table>.<field>
1368 u.append("%s.%s" % (a, b))
1369 else:
1370 # <field>
1371 u.append(b)
1372 return u
1373
1374def xml_format(a):
1375 """ Returns the given attribute (string, int, float, bool, None) as a quoted unicode string.

Callers 1

xmlFunction · 0.85

Calls 3

splitMethod · 0.45
extendMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…