Project project_name { database_type: 'PostgreSQL' Note: 'Description of the project' }
(s, loc, tok)
| 28 | |
| 29 | |
| 30 | def parse_project(s, loc, tok): |
| 31 | ''' |
| 32 | Project project_name { |
| 33 | database_type: 'PostgreSQL' |
| 34 | Note: 'Description of the project' |
| 35 | } |
| 36 | ''' |
| 37 | init_dict = {'name': tok['name']} |
| 38 | items = {} |
| 39 | for item in tok.get('items', []): |
| 40 | if isinstance(item, NoteBlueprint): |
| 41 | init_dict['note'] = item |
| 42 | else: |
| 43 | k, v = item |
| 44 | items[k] = v |
| 45 | if items: |
| 46 | init_dict['items'] = items |
| 47 | if 'comment_before' in tok: |
| 48 | comment = '\n'.join(c[0] for c in tok['comment_before']) |
| 49 | init_dict['comment'] = comment |
| 50 | return ProjectBlueprint(**init_dict) |
| 51 | |
| 52 | |
| 53 | project.set_parse_action(parse_project) |
nothing calls this directly
no test coverage detected