[1902] | 1 | ''' __init__.py ''' |
---|
[1029] | 2 | |
---|
| 3 | |
---|
[1902] | 4 | #import element tree and the parser api |
---|
[2642] | 5 | try: #python 2.5 |
---|
| 6 | from xml.etree.cElementTree import * |
---|
| 7 | except ImportError: |
---|
| 8 | try: |
---|
| 9 | # if you've installed it yourself it comes this way |
---|
| 10 | from cElementTree import * |
---|
| 11 | except ImportError: |
---|
| 12 | # if you've egged it this is the way it comes |
---|
| 13 | from elementtree.cElementTree import * |
---|
| 14 | |
---|
[1902] | 15 | import csml.parser |
---|
| 16 | import ops_Dataset |
---|
| 17 | import ops_FileExtract |
---|
[2473] | 18 | import ops_RawFileExtract |
---|
[1902] | 19 | import ops_ArrayGenerator |
---|
| 20 | import ops_AbstractFeature |
---|
| 21 | import ops_PointFeature |
---|
| 22 | import ops_PointSeriesFeature |
---|
| 23 | import ops_ProfileFeature |
---|
| 24 | import ops_ProfileSeriesFeature |
---|
| 25 | import ops_GridFeature |
---|
| 26 | import ops_GridSeriesFeature |
---|
| 27 | import ops_TrajectoryFeature |
---|
[3013] | 28 | import ops_RaggedSectionFeature |
---|
[1902] | 29 | import csmlContainer |
---|
[2584] | 30 | import types |
---|
[1029] | 31 | |
---|
[2584] | 32 | def getFuncsInModule(mod): |
---|
| 33 | fs = [] |
---|
| 34 | for key, item in mod.__dict__.items(): |
---|
| 35 | if type(item) is types.FunctionType: |
---|
| 36 | fs.append(item) |
---|
| 37 | return fs |
---|
[1029] | 38 | |
---|
| 39 | |
---|
[2584] | 40 | def appendMethods(obj, mod): |
---|
| 41 | for func in getFuncsInModule(mod): |
---|
| 42 | setattr(obj, func.__name__, func) |
---|
[1029] | 43 | |
---|
[2473] | 44 | |
---|
[3022] | 45 | operationsMap={csml.parser.Dataset:ops_Dataset, csml.parser.FileExtract:ops_FileExtract, csml.parser.RawFileExtract: ops_RawFileExtract, csml.parser.AbstractFeature:ops_AbstractFeature, csml.parser.GridSeriesFeature:ops_GridSeriesFeature, csml.parser.GridFeature:ops_GridFeature, csml.parser.PointSeriesFeature:ops_PointSeriesFeature,csml.parser.ProfileSeriesFeature:ops_ProfileSeriesFeature,csml.parser.TrajectoryFeature:ops_TrajectoryFeature, csml.parser.RaggedSectionFeature:ops_RaggedSectionFeature} |
---|
[1352] | 46 | |
---|
[1029] | 47 | |
---|
[2584] | 48 | for parserItem in operationsMap: |
---|
| 49 | appendMethods(parserItem, operationsMap[parserItem]) |
---|
[1029] | 50 | |
---|