MCPcopy Create free account
hub / github.com/Vanderhoof/PyDBML / parse_index

Function parse_index

pydbml/definitions/index.py:80–107  ·  view source on GitHub ↗

(id, country) [pk] // composite primary key or "created_at" or booking_date [ name: 'name', unique ]

(s, lok, tok)

Source from the content-addressed store, hash-verified

78
79
80def parse_index(s, lok, tok):
81 '''
82 (id, country) [pk] // composite primary key
83 or
84 "created_at"
85 or
86 booking_date [
87 name: 'name',
88 unique
89 ]
90 '''
91 init_dict = {}
92 if isinstance(tok['subject'], (str, ExpressionBlueprint)):
93 subjects = [tok['subject']]
94 else:
95 subjects = list(tok['subject'])
96
97 init_dict['subject_names'] = subjects
98 settings = tok.get('settings', {})
99 init_dict.update(settings)
100
101 # comments after settings have priority
102 if 'comment' in tok:
103 init_dict['comment'] = tok['comment'][0]
104 if 'comment' not in init_dict and 'comment_before' in tok:
105 comment = '\n'.join(c[0] for c in tok['comment_before'])
106 init_dict['comment'] = comment
107 return IndexBlueprint(**init_dict)
108
109
110index.set_parse_action(parse_index)

Callers

nothing calls this directly

Calls 2

IndexBlueprintClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected