Skip to content

Commit 6aa0918

Browse files
committed
Flake8 fixes
1 parent 07a6da0 commit 6aa0918

File tree

10 files changed

+15
-21
lines changed

10 files changed

+15
-21
lines changed

src/SeleniumLibrary/base/context.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ def is_text_present(self, text):
9595

9696
def is_element_enabled(self, locator, tag=None):
9797
element = self.find_element(locator, tag)
98-
return (element.is_enabled() and
99-
element.get_attribute('readonly') is None)
98+
return element.is_enabled() and element.get_attribute('readonly') is None
10099

101100
def is_visible(self, locator):
102101
element = self.find_element(locator, required=False)

src/SeleniumLibrary/base/robotlibcore.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
def keyword(name=None, tags=()):
2929
if callable(name):
3030
return keyword()(name)
31+
3132
def decorator(func):
3233
func.robot_name = name
3334
func.robot_tags = tags

src/SeleniumLibrary/keywords/alert.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from selenium.webdriver.support.ui import WebDriverWait
2020

2121
from SeleniumLibrary.base import keyword, LibraryComponent
22-
from SeleniumLibrary.utils import is_truthy, secs_to_timestr
22+
from SeleniumLibrary.utils import secs_to_timestr
2323

2424

2525
class AlertKeywords(LibraryComponent):
@@ -134,8 +134,6 @@ def _wait_alert(self, timeout=None):
134134
try:
135135
return wait.until(EC.alert_is_present())
136136
except TimeoutException:
137-
raise AssertionError('Alert not found in %s.'
138-
% secs_to_timestr(timeout))
137+
raise AssertionError('Alert not found in %s.' % secs_to_timestr(timeout))
139138
except WebDriverException as err:
140-
raise AssertionError('An exception occurred waiting for alert: %s'
141-
% err)
139+
raise AssertionError('An exception occurred waiting for alert: %s' % err)

src/SeleniumLibrary/keywords/browsermanagement.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def open_browser(self, url=None, browser='firefox', alias=None,
8989
Headless Chrome are new additions in SeleniumLibrary 3.1.0
9090
and require Selenium 3.8.0 or newer.
9191
92-
After opening the browser, it is possible to use optional
92+
After opening the browser, it is possible to use optional
9393
``url`` to navigate the browser to the desired address.
9494
9595
Optional ``alias`` is an alias given for this browser instance and
@@ -205,7 +205,7 @@ def open_browser(self, url=None, browser='firefox', alias=None,
205205
``options``.
206206
207207
Example the ``options`` argument can be used to launch Chomium-based
208-
applications which utilize the
208+
applications which utilize the
209209
[https://bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver|Chromium Embedded Framework]
210210
. To lauch Chomium-based application, use ``options`` to define
211211
`binary_location` attribute and use `add_argument` method to define
@@ -270,7 +270,7 @@ def open_browser(self, url=None, browser='firefox', alias=None,
270270
accepting an instance of the `selenium.webdriver.FirefoxProfile`
271271
and support defining FirefoxProfile with methods and
272272
attributes are new in SeleniumLibrary 4.0.
273-
273+
274274
Making ``url`` optional is new in SeleniumLibrary 4.1.
275275
276276
The ``executable_path`` argument is new in SeleniumLibrary 4.2.
@@ -304,8 +304,7 @@ def _make_new_browser(self, url=None, browser='firefox', alias=None,
304304
try:
305305
driver.get(url)
306306
except Exception:
307-
self.debug("Opened browser with session id %s but failed "
308-
"to open url '%s'." % (driver.session_id, url))
307+
self.debug("Opened browser with session id %s but failed to open url '%s'." % (driver.session_id, url))
309308
raise
310309
self.debug('Opened browser with session id %s.' % driver.session_id)
311310
return index

src/SeleniumLibrary/keywords/cookie.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ def delete_cookie(self, name):
4343
def get_cookies(self, as_dict=False):
4444
"""Returns all cookies of the current page.
4545
46-
If ``as_dict`` argument evaluates as false, see `Boolean arguments`
47-
for more details, then cookie information is returned as
46+
If ``as_dict`` argument evaluates as false, see `Boolean arguments`
47+
for more details, then cookie information is returned as
4848
a single string in format ``name1=value1; name2=value2; name3=value3``.
4949
When ``as_dict`` argument evaluates as true, cookie information
50-
is returned as Robot Framework dictionary format. The string format
50+
is returned as Robot Framework dictionary format. The string format
5151
can be used, for example, for logging purposes or in headers when
5252
sending HTTP requests. The dictionary format is helpful when
5353
the result can be passed to requests library's Create Session

src/SeleniumLibrary/keywords/formelement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def choose_file(self, locator, file_path):
203203
points at a file and when using Selenium Grid, Selenium will
204204
[https://seleniumhq.github.io/selenium/docs/api/py/webdriver_remote/selenium.webdriver.remote.command.html?highlight=upload#selenium.webdriver.remote.command.Command.UPLOAD_FILE|magically],
205205
transfer the file from the machine where the tests are executed
206-
to the Selenium Grid node where the browser is running.
206+
to the Selenium Grid node where the browser is running.
207207
Then Selenium will send the file path, from the nodes file
208208
system, to the browser.
209209

src/SeleniumLibrary/keywords/selectelement.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
from selenium.common.exceptions import NoSuchElementException
1817
from selenium.webdriver.support.ui import Select
1918

2019
from SeleniumLibrary.base import LibraryComponent, keyword

src/SeleniumLibrary/keywords/waiting.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def wait_until_location_contains(self, expected, timeout=None, message=None):
9494
"Location did not contain '%s' in <TIMEOUT>." % expected,
9595
timeout, message)
9696

97-
9897
@keyword
9998
def wait_until_page_contains(self, text, timeout=None, error=None):
10099
"""Waits until ``text`` appears on the current page.

src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ def create_driver(self, browser, desired_capabilities, remote_url, profile_dir=N
7171
if service_log_path:
7272
logger.info('Browser driver log file created to: %s' % service_log_path)
7373
self._create_directory(service_log_path)
74-
if (creation_method == self.create_firefox
75-
or creation_method == self.create_headless_firefox):
74+
if creation_method == self.create_firefox or creation_method == self.create_headless_firefox:
7675
return creation_method(desired_capabilities, remote_url, profile_dir, options=options,
7776
service_log_path=service_log_path, executable_path=executable_path)
7877
return creation_method(desired_capabilities, remote_url, options=options,

src/SeleniumLibrary/locators/elementfinder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def _parse_locator(self, locator):
240240
if index != -1:
241241
prefix = locator[:index].strip()
242242
if prefix in self._strategies:
243-
return prefix, locator[index+1:].lstrip()
243+
return prefix, locator[index + 1:].lstrip()
244244
return 'default', locator
245245

246246
def _get_locator_separator_index(self, locator):

0 commit comments

Comments
 (0)