Skip to content

Commit

Permalink
Fix lint issues about the multikey in processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Jan 30, 2024
1 parent d702995 commit 4d0bc54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 6 additions & 3 deletions QuickOSM/core/query_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ def area(self) -> list:
def _convert_to_multitypes(type_multi_request: str) -> List[MultiType]:
"""Converts a string of comma separated 'AND'/'OR's to a list of MultiType equivalents.
:param type_multi_request: A string of comma separated 'AND'/'OR's provided from input of processing algorithms
:param type_multi_request: A string of comma separated 'AND'/'OR's provided from input of processing
algorithms
:type type_multi_request: str
:return: list of MultiType
Expand All @@ -177,7 +178,8 @@ def _convert_to_multitypes(type_multi_request: str) -> List[MultiType]:
elif type_ == 'OR':
types.append(MultiType.OR)
else:
raise QueryFactoryException(tr('Only values "AND"/"OR" are allowed as logical operators.'))
raise QueryFactoryException(
tr('Only values "AND"/"OR" are allowed as logical operators.'))
return types

def _check_parameters(self) -> bool:
Expand Down Expand Up @@ -245,7 +247,8 @@ def _check_parameters(self) -> bool:
raise QueryFactoryException(
tr('Too many logical operators were provided.')
)
elif len(self._type_multi_request) < len(self._key) - 1:

if len(self._type_multi_request) < len(self._key) - 1:
raise QueryFactoryException(
tr('Not enough logical operators were provided.')
)
Expand Down
10 changes: 7 additions & 3 deletions QuickOSM/quick_osm_processing/build_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)

from QuickOSM.core.utilities.tools import get_setting
from QuickOSM.definitions.osm import QueryType, MultiType
from QuickOSM.definitions.osm import QueryType
from QuickOSM.definitions.overpass import OVERPASS_SERVERS
from QuickOSM.qgis_plugin_tools.tools.i18n import tr

Expand Down Expand Up @@ -184,10 +184,14 @@ def add_top_parameters(self):
self.addParameter(param)

param = QgsProcessingParameterString(
self.TYPE_MULTI_REQUEST, tr('Operator types to combine multiple keys and values with'), optional=True
self.TYPE_MULTI_REQUEST,
tr('Operator types to combine multiple keys and values with'),
optional=True
)

# TODO: expand help string
help_string = tr(
'The logical operators used to combine keys and values, if there are multiple.' # TODO: expand help string
'The logical operators used to combine keys and values, if there are multiple.'
)
param.setHelp(help_string)
self.addParameter(param)
Expand Down

0 comments on commit 4d0bc54

Please sign in to comment.