Sitelet https://github.com/appium/python-client/commit/b142e00e3f47065752c80f71f2f8cb80bf2500f7
Skip to content

Commit b142e00

Browse files
authored
ci: add pylint_quotes for pylint to use single quote as primary method (#886)
1 parent fb8415e commit b142e00

22 files changed

Lines changed: 41 additions & 36 deletions

‎.pylintrc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,3 +551,7 @@ known-third-party=enchant
551551
# Exceptions that will emit a warning when being caught. Defaults to
552552
# "Exception"
553553
overgeneral-exceptions=Exception
554+
555+
string-quote=single
556+
triple-quote=single
557+
docstring-quote=double

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ black: ## Run black
1616
.PHONY: pylint
1717
pylint: ## Run pylint
1818
# TODO Remove --disable=E1136 when no errors in py39
19-
python -m pylint $(ARGS) --rcfile .pylintrc appium test --disable=E1136
19+
python -m pylint $(ARGS) --load-plugins pylint_quotes --rcfile .pylintrc appium test --disable=E1136
2020

2121
.PHONY: mypy
2222
mypy: ## Run mypy

‎Pipfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mypy = "<2.0"
1111
mock = "~=5.0"
1212
pre-commit = "~=2.21"
1313
pylint = "~=2.17.3"
14+
pylint-quotes = "~=0.2.3"
1415
pytest = "~=7.4"
1516
pytest-cov = "~=4.1"
1617
python-dateutil = "~=2.8"

‎appium/webdriver/common/multi_action.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class MultiAction:
3838

3939
def __init__(self, driver: 'WebDriver', element: Optional['WebElement'] = None) -> None:
4040
warnings.warn(
41-
"[Deprecated] 'MultiAction' action is deprecated. Please use W3C actions instead.", DeprecationWarning
41+
'[Deprecated] \'MultiAction\' action is deprecated. Please use W3C actions instead.', DeprecationWarning
4242
)
4343

4444
self._driver = driver

‎appium/webdriver/common/touch_action.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TouchAction:
4242

4343
def __init__(self, driver: Optional['WebDriver'] = None):
4444
warnings.warn(
45-
"[Deprecated] 'TouchAction' action is deprecated. Please use W3C actions instead.", DeprecationWarning
45+
'[Deprecated] \'TouchAction\' action is deprecated. Please use W3C actions instead.', DeprecationWarning
4646
)
4747

4848
self._driver = driver

‎appium/webdriver/extensions/action_helpers.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def scroll(self, origin_el: WebElement, destination_el: WebElement, duration: Op
4646
if duration is None:
4747
duration = 600
4848

49-
touch_input = PointerInput(interaction.POINTER_TOUCH, "touch")
49+
touch_input = PointerInput(interaction.POINTER_TOUCH, 'touch')
5050

5151
actions = ActionChains(self)
5252
actions.w3c_actions = ActionBuilder(self, mouse=touch_input)
@@ -96,7 +96,7 @@ def tap(self, positions: List[Tuple[int, int]], duration: Optional[int] = None)
9696
"""
9797
if len(positions) == 1:
9898
actions = ActionChains(self)
99-
actions.w3c_actions = ActionBuilder(self, mouse=PointerInput(interaction.POINTER_TOUCH, "touch"))
99+
actions.w3c_actions = ActionBuilder(self, mouse=PointerInput(interaction.POINTER_TOUCH, 'touc'))
100100
x = positions[0][0]
101101
y = positions[0][1]
102102
actions.w3c_actions.pointer_action.move_to_location(x, y)
@@ -145,7 +145,7 @@ def swipe(self, start_x: int, start_y: int, end_x: int, end_y: int, duration: in
145145
Returns:
146146
Union['WebDriver', 'ActionHelpers']: Self instance
147147
"""
148-
touch_input = PointerInput(interaction.POINTER_TOUCH, "touch")
148+
touch_input = PointerInput(interaction.POINTER_TOUCH, 'touch')
149149

150150
actions = ActionChains(self)
151151
actions.w3c_actions = ActionBuilder(self, mouse=touch_input)
@@ -174,7 +174,7 @@ def flick(self, start_x: int, start_y: int, end_x: int, end_y: int) -> 'WebDrive
174174
Union['WebDriver', 'ActionHelpers']: Self instance
175175
"""
176176
actions = ActionChains(self)
177-
actions.w3c_actions = ActionBuilder(self, mouse=PointerInput(interaction.POINTER_TOUCH, "touch"))
177+
actions.w3c_actions = ActionBuilder(self, mouse=PointerInput(interaction.POINTER_TOUCH, 'touch'))
178178
actions.w3c_actions.pointer_action.move_to_location(start_x, start_y)
179179
actions.w3c_actions.pointer_action.pointer_down()
180180
actions.w3c_actions.pointer_action.move_to_location(end_x, end_y)

‎appium/webdriver/extensions/location.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ def set_location(
6363
Union['WebDriver', 'Location']: Self instance
6464
"""
6565
data = {
66-
"location": {
67-
"latitude": latitude,
68-
"longitude": longitude,
66+
'location': {
67+
'latitude': latitude,
68+
'longitude': longitude,
6969
}
7070
}
7171
if altitude is not None:

‎appium/webdriver/extensions/settings.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def update_settings(self, settings: Dict[str, Any]) -> 'WebDriver':
4242
Args:
4343
settings: dictionary of settings to apply to the current test session
4444
"""
45-
self.execute(Command.UPDATE_SETTINGS, {"settings": settings})
45+
self.execute(Command.UPDATE_SETTINGS, {'settings': settings})
4646
return cast('WebDriver', self)
4747

4848
def _add_commands(self) -> None:

‎appium/webdriver/webdriver.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def __init__(
285285
instance = extension(self.execute)
286286
method_name = instance.method_name()
287287
if hasattr(WebDriver, method_name):
288-
logger.debug(f"Overriding the method '{method_name}'")
288+
logger.debug(f'Overriding the method \'{method_name}\'')
289289

290290
# add a new method named 'instance.method_name()' and call it
291291
setattr(WebDriver, method_name, getattr(instance, method_name))
@@ -519,7 +519,7 @@ def orientation(self, value: str) -> None:
519519
if value.upper() in allowed_values:
520520
self.execute(Command.SET_SCREEN_ORIENTATION, {'orientation': value})
521521
else:
522-
raise WebDriverException("You can only set the orientation to 'LANDSCAPE' and 'PORTRAIT'")
522+
raise WebDriverException('You can only set the orientation to \'LANDSCAPE\' and \'PORTRAIT\'')
523523

524524
def assert_extension_exists(self, ext_name: str) -> 'WebDriver':
525525
"""

‎appium/webdriver/webelement.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def find_element(self, by: str = AppiumBy.ID, value: Union[str, Dict, None] = No
112112
# by = By.CSS_SELECTOR
113113
# value = '[name="%s"]' % value
114114

115-
return self._execute(RemoteCommand.FIND_CHILD_ELEMENT, {"using": by, "value": value})['value']
115+
return self._execute(RemoteCommand.FIND_CHILD_ELEMENT, {'using': by, 'value': value})['value']
116116

117117
def find_elements(self, by: str = AppiumBy.ID, value: Union[str, Dict, None] = None) -> List['WebElement']:
118118
"""Find elements given a AppiumBy strategy and locator
@@ -142,7 +142,7 @@ def find_elements(self, by: str = AppiumBy.ID, value: Union[str, Dict, None] = N
142142
# by = By.CSS_SELECTOR
143143
# value = '[name="%s"]' % value
144144

145-
return self._execute(RemoteCommand.FIND_CHILD_ELEMENTS, {"using": by, "value": value})['value']
145+
return self._execute(RemoteCommand.FIND_CHILD_ELEMENTS, {'using': by, 'value': value})['value']
146146

147147
def clear(self) -> 'WebElement':
148148
"""Clears text.

0 commit comments

Comments
 (0)