|
4 | 4 |
|
5 | 5 | import os
|
6 | 6 | import json
|
7 |
| -from collections import OrderedDict |
8 | 7 |
|
9 | 8 |
|
10 | 9 | class SHConfig:
|
@@ -42,26 +41,26 @@ class SHConfig:
|
42 | 41 | class _SHConfig:
|
43 | 42 | """ Internal class holding configuration parameters
|
44 | 43 | """
|
45 |
| - CONFIG_PARAMS = OrderedDict([ |
46 |
| - ('instance_id', ''), |
47 |
| - ('sh_client_id', ''), |
48 |
| - ('sh_client_secret', ''), |
49 |
| - ('sh_base_url', 'https://services.sentinel-hub.com'), |
50 |
| - ('geopedia_wms_url', 'https://service.geopedia.world'), |
51 |
| - ('geopedia_rest_url', 'https://www.geopedia.world/rest'), |
52 |
| - ('aws_access_key_id', ''), |
53 |
| - ('aws_secret_access_key', ''), |
54 |
| - ('aws_metadata_url', 'https://roda.sentinel-hub.com'), |
55 |
| - ('aws_s3_l1c_bucket', 'sentinel-s2-l1c'), |
56 |
| - ('aws_s3_l2a_bucket', 'sentinel-s2-l2a'), |
57 |
| - ('opensearch_url', 'http://opensearch.sentinel-hub.com/resto/api/collections/Sentinel2'), |
58 |
| - ('max_wfs_records_per_query', 100), |
59 |
| - ('max_opensearch_records_per_query', 500), |
60 |
| - ('max_download_attempts', 4), |
61 |
| - ('download_sleep_time', 5), |
62 |
| - ('download_timeout_seconds', 120), |
63 |
| - ('number_of_download_processes', 1) |
64 |
| - ]) |
| 44 | + CONFIG_PARAMS = { |
| 45 | + 'instance_id': '', |
| 46 | + 'sh_client_id': '', |
| 47 | + 'sh_client_secret': '', |
| 48 | + 'sh_base_url': 'https://services.sentinel-hub.com', |
| 49 | + 'geopedia_wms_url': 'https://service.geopedia.world', |
| 50 | + 'geopedia_rest_url': 'https://www.geopedia.world/rest', |
| 51 | + 'aws_access_key_id': '', |
| 52 | + 'aws_secret_access_key': '', |
| 53 | + 'aws_metadata_url': 'https://roda.sentinel-hub.com', |
| 54 | + 'aws_s3_l1c_bucket': 'sentinel-s2-l1c', |
| 55 | + 'aws_s3_l2a_bucket': 'sentinel-s2-l2a', |
| 56 | + 'opensearch_url': 'http://opensearch.sentinel-hub.com/resto/api/collections/Sentinel2', |
| 57 | + 'max_wfs_records_per_query': 100, |
| 58 | + 'max_opensearch_records_per_query': 500, |
| 59 | + 'max_download_attempts': 4, |
| 60 | + 'download_sleep_time': 5, |
| 61 | + 'download_timeout_seconds': 120, |
| 62 | + 'number_of_download_processes': 1 |
| 63 | + } |
65 | 64 |
|
66 | 65 | def __init__(self):
|
67 | 66 | self.instance_id = ''
|
@@ -118,12 +117,12 @@ def load_configuration(self):
|
118 | 117 | setattr(self, prop, config[prop])
|
119 | 118 |
|
120 | 119 | def get_config(self):
|
121 |
| - """ Returns ordered dictionary with configuration parameters |
| 120 | + """ Returns a dictionary with configuration parameters |
122 | 121 |
|
123 |
| - :return: Ordered dictionary |
124 |
| - :rtype: collections.OrderedDict |
| 122 | + :return: A dictionary |
| 123 | + :rtype: dict |
125 | 124 | """
|
126 |
| - config = OrderedDict((prop, getattr(self, prop)) for prop in self.CONFIG_PARAMS) |
| 125 | + config = {prop: getattr(self, prop) for prop in self.CONFIG_PARAMS} |
127 | 126 | if config['instance_id'] is None:
|
128 | 127 | config['instance_id'] = ''
|
129 | 128 | return config
|
@@ -231,9 +230,9 @@ def get_config_dict(self):
|
231 | 230 | """ Get a dictionary representation of `SHConfig` class
|
232 | 231 |
|
233 | 232 | :return: A dictionary with configuration parameters
|
234 |
| - :rtype: OrderedDict |
| 233 | + :rtype: dict |
235 | 234 | """
|
236 |
| - return OrderedDict((prop, getattr(self, prop)) for prop in self._instance.CONFIG_PARAMS) |
| 235 | + return {prop: getattr(self, prop) for prop in self._instance.CONFIG_PARAMS} |
237 | 236 |
|
238 | 237 | def get_config_location(self):
|
239 | 238 | """ Returns location of configuration file on disk
|
|
0 commit comments