Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: typing fixes following mypy 1.14.0 #1458

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion eodag/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,9 @@ def serve_rest(
try:
pid = os.fork()
except OSError as e:
raise Exception("%s [%d]" % (e.strerror, e.errno))
raise Exception(
"%s [%d]" % (e.strerror, e.errno) if e.errno is not None else e.strerror
)

if pid == 0:
os.setsid()
Expand Down
4 changes: 3 additions & 1 deletion eodag/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,10 @@ class DiscoverProductTypes(TypedDict, total=False):
#: Mapping for product type metadata (e.g. ``abstract``, ``licence``) which can be parsed from the provider
#: result
generic_product_type_parsable_metadata: Dict[str, str]
#: Mapping for product type properties which can be parsed from the result that are not product type metadata
#: Mapping for product type properties which can be parsed from the result and are not product type metadata
generic_product_type_parsable_properties: Dict[str, str]
#: Mapping for product type properties which cannot be parsed from the result and are not product type metadata
generic_product_type_unparsable_properties: Dict[str, str]
#: URL to fetch data for a single collection
single_collection_fetch_url: str
#: Query string to be added to the fetch_url to filter for a collection
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/search/data_request_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class DataRequestSearch(Search):
(``Dict[str, str]``): mapping for product type metadata (e.g. ``abstract``, ``licence``) which can be parsed
from the provider result
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.generic_product_type_parsable_properties`
(``Dict[str, str]``): mapping for product type properties which can be parsed from the result that are not
(``Dict[str, str]``): mapping for product type properties which can be parsed from the result and are not
product type metadata
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.single_collection_fetch_url` (``str``): url to fetch
data for a single collection; used if product type metadata is not available from the endpoint given in
Expand Down
13 changes: 10 additions & 3 deletions eodag/plugins/search/qssearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ class QueryStringSearch(Search):
(``Dict[str, str]``): mapping for product type metadata (e.g. ``abstract``, ``licence``) which can be parsed
from the provider result
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.generic_product_type_parsable_properties`
(``Dict[str, str]``): mapping for product type properties which can be parsed from the result that are not
(``Dict[str, str]``): mapping for product type properties which can be parsed from the result and are not
product type metadata
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.generic_product_type_unparsable_properties`
(``Dict[str, str]``): mapping for product type properties which cannot be parsed from the result and are not
product type metadata
* :attr:`~eodag.config.PluginConfig.DiscoverProductTypes.single_collection_fetch_url` (``str``): url to fetch
data for a single collection; used if product type metadata is not available from the endpoint given in
Expand Down Expand Up @@ -1038,9 +1041,13 @@ def do_search(
logger.debug(
"Could not extract total_items_nb from search results"
)
if getattr(self.config, "merge_responses", False):
if (
getattr(self.config, "merge_responses", False)
and self.config.result_type == "json"
):
json_result = cast(list[dict[str, Any]], result)
results = (
[dict(r, **result[i]) for i, r in enumerate(results)]
[dict(r, **json_result[i]) for i, r in enumerate(results)]
if results
else result
)
Expand Down
Loading