openquake.gem-taxonomy-data 1.4.0.2.dev16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
openquake/__init__.py ADDED
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+ # vim: tabstop=4 shiftwidth=4 softtabstop=4
3
+ #
4
+ # Copyright (C) 2010-2025 GEM Foundation
5
+ #
6
+ # OpenQuake GEM Building Taxonomy Data is free software: you can redistribute
7
+ # it and/or modify it under the terms of the GNU Affero General Public
8
+ # License as published by the Free Software Foundation, either version 3
9
+ # of the License, or (at your option) any later version.
10
+ #
11
+ # OpenQuake is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Affero General Public License
17
+ # along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ __import__('pkg_resources').declare_namespace(__name__)
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ # vim: tabstop=4 shiftwidth=4 softtabstop=4
3
+ #
4
+ # Copyright (C) 2024 GEM Foundation
5
+ #
6
+ # Openquake Gem Taxonomy is free software: you can redistribute it and/or
7
+ # modify it # under the terms of the GNU Affero General Public License as
8
+ # published by the Free Software Foundation, either version 3 of the
9
+ # License, or (at your option) any later version.
10
+ #
11
+ # OpenQuake is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Affero General Public License
17
+ # along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ from .classes import GemTaxonomyData
20
+
21
+ __version__ = '1.4.0.2.dev16'
22
+
23
+ __all__ = ['__version__', 'GemTaxonomyData']
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*-
2
+ # vim: tabstop=4 shiftwidth=4 softtabstop=4
3
+ #
4
+ # Copyright (C) 2024 GEM Foundation
5
+ #
6
+ # Openquake Gem Taxonomy is free software: you can redistribute it and/or
7
+ # modify it # under the terms of the GNU Affero General Public License as
8
+ # published by the Free Software Foundation, either version 3 of the
9
+ # License, or (at your option) any later version.
10
+ #
11
+ # OpenQuake is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Affero General Public License
17
+ # along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.
18
+ import os
19
+ import json
20
+
21
+
22
+ class GemTaxonomyData:
23
+ BASE_DATA_PATH = os.path.join(os.path.dirname(__file__), 'data')
24
+
25
+ def load(self, standard_version='latest'):
26
+ if standard_version == 'latest':
27
+ raise ValueError('latest not yet implemented.')
28
+
29
+ if '/' in standard_version or '\\' in standard_version:
30
+ raise ValueError('no file separators are allowed.')
31
+
32
+ return json.load(open(os.path.join(
33
+ self.BASE_DATA_PATH,
34
+ 'taxonomy%s_standard.json' % standard_version)))