11'''
2- Copyright (c) 2017 HERE Europe B.V.
2+ Copyright (c) 2025 HERE Europe B.V.
33 See the LICENSE file in the root of this project for license details.
44'''
55
2929 """
3030
3131
32- def open_archive (path , archive = None , module_name = None ):
32+ def open_archive (path , archive = None , module_name = None , root_namespace = None ):
3333 """
3434 Opens archive at a given path.
3535 Archive schema is read and python bindings are generated on the fly.
@@ -38,6 +38,7 @@ def open_archive(path, archive=None, module_name=None):
3838 :param archive: Archive name to open (in case multiple archives reside in one directory)
3939 if None, will be implied. If cannot be implied, RuntimeError is raised.
4040 :param module_name: Module name to create. If None, will match the highest-level namespace.
41+ :param root_namespace: Root namespace to pick in case of multiple top level namespaces.
4142 :return: tuple archive, module
4243 """
4344 if not os .path .exists (path ):
@@ -73,7 +74,8 @@ def open_archive(path, archive=None, module_name=None):
7374 try :
7475 module , archive_type = \
7576 Engine (schema .read ().decode ()).render_python_module (module_name = module_name ,
76- archive_name = archive_name )
77+ archive_name = archive_name ,
78+ root_namespace = root_namespace )
7779 except FlatdataSyntaxError as err :
7880 raise RuntimeError ("Error reading schema: %s " % err )
7981
@@ -87,12 +89,14 @@ def main():
8789 help = "Path to archive" )
8890 parser .add_argument ("-a" , "--archive" , type = str , dest = "archive" , required = False , default = None ,
8991 help = "Name of the archive" )
92+ parser .add_argument ("-n" , "--namespace" , type = str , dest = "namespace" , required = False , default = None ,
93+ help = "Root namespace to pick in case of multiple top level namespaces" )
9094 parser .add_argument ("--non-interactive" , type = str , dest = "non_interactive" , required = False ,
9195 default = None ,
9296 help = "Python code to execute in non-interactive mode" )
9397 args = parser .parse_args ()
9498
95- archive , _ = open_archive (args .path , args .archive )
99+ archive , _ = open_archive (args .path , args .archive , None , args . namespace )
96100
97101 pd .set_option ('display.max_rows' , 30 )
98102 pd .set_option ('expand_frame_repr' , False )
0 commit comments