diff --git a/requirements.txt b/requirements.txt index 2ecb7b0efe2..a115f5dccb4 100755 --- a/requirements.txt +++ b/requirements.txt @@ -18,6 +18,6 @@ parameterized==0.6.1 beautifulsoup4>=4.6.0 pyotp>=2.2.6 boto>=2.49.0 -flake8==3.5.0 +flake8==3.6.0 PyVirtualDisplay==0.2.1 -e . diff --git a/seleniumbase/common/encryption.py b/seleniumbase/common/encryption.py index c2bbcfe5697..93373a0fc60 100755 --- a/seleniumbase/common/encryption.py +++ b/seleniumbase/common/encryption.py @@ -118,18 +118,18 @@ def decrypt(string): rem4 = (len(string) + ord_string_sum(string)) % 2 if len(string) % 2 != 0: if rem3 == 1: - string = (chr(ord(string[-1]) - 5 - rem1) + string + - chr(ord(string[-1]) - 13 - rem1)) + string = (chr(ord(string[-1]) - 5 - rem1) + string + '' + '' + chr(ord(string[-1]) - 13 - rem1)) else: - string = (chr(ord(string[-1]) - 11 - rem1) + string + - chr(ord(string[-1]) - 23 - rem1)) + string = (chr(ord(string[-1]) - 11 - rem1) + string + '' + '' + chr(ord(string[-1]) - 23 - rem1)) elif len(string) > 1: if rem4 == 1: - string = (chr(ord(string[0]) - 19 + rem2) + string + - chr(ord(string[0]) - 7 - rem2)) + string = (chr(ord(string[0]) - 19 + rem2) + string + '' + '' + chr(ord(string[0]) - 7 - rem2)) else: - string = (chr(ord(string[0]) - 26 + rem2) + string + - chr(ord(string[0]) - 12 - rem2)) + string = (chr(ord(string[0]) - 26 + rem2) + string + '' + '' + chr(ord(string[0]) - 12 - rem2)) rem5 = (len(string) + ord_string_sum(string)) % 23 string = rotate(string, rem5) result = str_xor(shuffle_string(string)[::-1], xor_key) diff --git a/seleniumbase/core/s3_manager.py b/seleniumbase/core/s3_manager.py index d6f18335d4d..27206515b0f 100755 --- a/seleniumbase/core/s3_manager.py +++ b/seleniumbase/core/s3_manager.py @@ -64,7 +64,7 @@ def upload_index_file(self, test_address, timestamp): index = self.get_key(file_name) index_str = [] for completed_file in already_uploaded_files: - index_str.append("%s" % (completed_file, completed_file)) index.set_contents_from_string( "
".join(index_str), diff --git a/seleniumbase/core/tour_helper.py b/seleniumbase/core/tour_helper.py index 256abf56c56..4f362d6e9ae 100755 --- a/seleniumbase/core/tour_helper.py +++ b/seleniumbase/core/tour_helper.py @@ -278,8 +278,8 @@ def play_shepherd_tour(driver, tour_steps, msg_dur, name=None, interval=0): stop_ms = start_ms + (interval * 1000.0) now_ms = time.time() * 1000.0 if now_ms >= stop_ms: - if ((element == latest_element) and - (shep_text == latest_text)): + if ((element == latest_element) and ( + shep_text == latest_text)): driver.execute_script("Shepherd.activeTour.next()") try: latest_element = driver.execute_script( diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index d4952026626..ec5c1d79e87 100755 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -2793,9 +2793,9 @@ def tearDown(self): test_logpath = self.log_path + "/" + test_id if not os.path.exists(test_logpath): os.makedirs(test_logpath) - if ((not self.with_screen_shots) and - (not self.with_basic_test_info) and - (not self.with_page_source)): + if ((not self.with_screen_shots) and ( + not self.with_basic_test_info) and ( + not self.with_page_source)): # Log everything if nothing specified (if testing_base) log_helper.log_screenshot(test_logpath, self.driver) log_helper.log_test_failure_data( diff --git a/seleniumbase/fixtures/email_manager.py b/seleniumbase/fixtures/email_manager.py index 74f0f83a77c..6581775aea6 100755 --- a/seleniumbase/fixtures/email_manager.py +++ b/seleniumbase/fixtures/email_manager.py @@ -478,7 +478,7 @@ def fixup(text): except KeyError: pass return text # leave as is - return re.sub("&#?\w+;", fixup, html) + return re.sub(r"&#?\w+;", fixup, html) def decode_quoted_printable(self, html): """ diff --git a/seleniumbase/fixtures/js_utils.py b/seleniumbase/fixtures/js_utils.py index 86a51829b42..19909dbf67f 100755 --- a/seleniumbase/fixtures/js_utils.py +++ b/seleniumbase/fixtures/js_utils.py @@ -129,8 +129,8 @@ def activate_jquery(driver): def are_quotes_escaped(string): - if (string.count("\\'") != string.count("'") or - string.count('\\"') != string.count('"')): + if (string.count("\\'") != string.count("'") or ( + string.count('\\"') != string.count('"'))): return True return False diff --git a/seleniumbase/fixtures/page_utils.py b/seleniumbase/fixtures/page_utils.py index f0d2932094c..822f34915b5 100755 --- a/seleniumbase/fixtures/page_utils.py +++ b/seleniumbase/fixtures/page_utils.py @@ -24,9 +24,8 @@ def is_xpath_selector(selector): """ A basic method to determine if a selector is an xpath selector. """ - if (selector.startswith('/') or - selector.startswith('./') or - selector.startswith('(')): + if (selector.startswith('/') or selector.startswith('./') or ( + selector.startswith('('))): return True return False @@ -35,8 +34,7 @@ def is_link_text_selector(selector): """ A basic method to determine if a selector is a link text selector. """ - if (selector.startswith('link=') or - selector.startswith('link_text=')): + if (selector.startswith('link=') or selector.startswith('link_text=')): return True return False diff --git a/seleniumbase/fixtures/xpath_to_css.py b/seleniumbase/fixtures/xpath_to_css.py index dd8badffc4c..ce58deabbd7 100755 --- a/seleniumbase/fixtures/xpath_to_css.py +++ b/seleniumbase/fixtures/xpath_to_css.py @@ -5,27 +5,27 @@ import re _sub_regexes = { - "tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\*)", - "attribute": "[.a-zA-Z_:][-\w:.]*(\(\))?)", - "value": "\s*[\w/:][-/\w\s,:;.]*" + "tag": r"([a-zA-Z][a-zA-Z0-9]{0,10}|\*)", + "attribute": r"[.a-zA-Z_:][-\w:.]*(\(\))?)", + "value": r"\s*[\w/:][-/\w\s,:;.]*" } _validation_re = ( - "(?P" - "(" - "^id\([\"\']?(?P%(value)s)[\"\']?\)" - "|" - "(?P