|
28 | 28 | def importany(infile, **options):
|
29 | 29 | # import within function to disable warning messages by log level
|
30 | 30 | from . import importall as im
|
| 31 | + if "key" in options: |
| 32 | + key = options["key"] |
| 33 | + else: |
| 34 | + key = "" |
31 | 35 | dbs = {}
|
32 | 36 | if infile[-3:] == 'dbc':
|
33 |
| - dbs[""] = im.importDbc(infile, **options) |
| 37 | + dbs[key] = im.importDbc(infile, **options) |
34 | 38 | elif infile[-3:] == 'dbf':
|
35 |
| - dbs[""] = im.importDbf(infile, **options) |
| 39 | + dbs[key] = im.importDbf(infile, **options) |
36 | 40 | elif infile[-3:] == 'sym':
|
37 |
| - dbs[""] = im.importSym(infile, **options) |
| 41 | + dbs[key] = im.importSym(infile, **options) |
38 | 42 | elif infile[-3:] == 'kcd':
|
39 |
| - dbs[""] = im.importKcd(infile) |
| 43 | + dbs[key] = im.importKcd(infile) |
40 | 44 | elif infile[-3:] == 'xls':
|
41 |
| - dbs[""] = im.importXls(infile, **options) |
| 45 | + dbs[key] = im.importXls(infile, **options) |
42 | 46 | elif infile[-4:] == 'xlsx' :
|
43 |
| - dbs[""] = im.importXlsx(infile, **options) |
| 47 | + dbs[key] = im.importXlsx(infile, **options) |
44 | 48 | elif infile[-5:] == 'arxml':
|
45 | 49 | dbs = im.importArxml(infile, **options)
|
46 | 50 | elif infile[-4:] == 'yaml':
|
47 |
| - dbs[""] = im.importYaml(infile) |
| 51 | + dbs[key] = im.importYaml(infile) |
48 | 52 | elif infile[-4:] == 'json':
|
49 |
| - dbs[""] = im.importJson(infile) |
| 53 | + dbs[key] = im.importJson(infile) |
50 | 54 | else:
|
51 | 55 | logger.error('\nFile not recognized: ' + infile + "\n")
|
52 | 56 | logger.info("done\n")
|
|
0 commit comments