Skip to content

Commit 5339c5f

Browse files
committed
STY: Changes to abide by PEP8.
1 parent 5af2de3 commit 5339c5f

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

botcity/web/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .bot import WebBot, Browser, BROWSER_CONFIGS, By # noqa: F401, F403
22
from .parsers import table_to_dict, data_from_row, sanitize_header # noqa: F401, F403
3-
from .util import element_as_select # noqa: F401, F403
3+
from .util import element_as_select # noqa: F401, F403
44

55
from botcity.web._version import get_versions
66
__version__ = get_versions()['version']

botcity/web/bot.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,8 @@ def wait_for_downloads(self, timeout: int = 120000):
10611061
# waits for all the files to be completed
10621062
WebDriverWait(self._driver, timeout/1000.0, 1).until(wait_method)
10631063

1064-
def find_elements(self, selector: str, by: By = By.CSS_SELECTOR, waiting_time=10000, ensure_visible: bool = True) -> List[WebElement]:
1064+
def find_elements(self, selector: str, by: By = By.CSS_SELECTOR,
1065+
waiting_time=10000, ensure_visible: bool = True) -> List[WebElement]:
10651066
"""Find elements using the specified selector with selector type specified by `by`.
10661067
10671068
Args:
@@ -1084,7 +1085,10 @@ def find_elements(self, selector: str, by: By = By.CSS_SELECTOR, waiting_time=10
10841085
...
10851086
```
10861087
"""
1087-
condition = EC.visibility_of_all_elements_located if ensure_visible else EC.presence_of_all_elements_located
1088+
if ensure_visible:
1089+
condition = EC.visibility_of_all_elements_located
1090+
else:
1091+
condition = EC.presence_of_all_elements_located
10881092

10891093
try:
10901094
elements = WebDriverWait(
@@ -1097,7 +1101,8 @@ def find_elements(self, selector: str, by: By = By.CSS_SELECTOR, waiting_time=10
10971101
print("Exception on find_elements", ex)
10981102
return None
10991103

1100-
def find_element(self, selector: str, by: str = By.CSS_SELECTOR, waiting_time=10000, ensure_visible: bool = False, ensure_clickable: bool = False) -> WebElement:
1104+
def find_element(self, selector: str, by: str = By.CSS_SELECTOR, waiting_time=10000,
1105+
ensure_visible: bool = False, ensure_clickable: bool = False) -> WebElement:
11011106
"""Find an element using the specified selector with selector type specified by `by`.
11021107
If more than one element is found, the first instance is returned.
11031108

botcity/web/parsers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def sanitize_header(labels: List[str]):
2828
label = label.lower()
2929

3030
# remove punctuations
31-
label = ''.join([l for l in label if l not in string.punctuation])
31+
label = ''.join([l for l in label if l not in string.punctuation]) # noqa: E741
3232

3333
# replace spaces with underscores
3434
label = label.replace(" ", "_")
@@ -47,7 +47,8 @@ def sanitize_header(labels: List[str]):
4747
return labels
4848

4949

50-
def table_to_dict(table: WebElement, has_header: bool = True, skip_rows: int = 0, header_tag: str = "th") -> List[Dict]:
50+
def table_to_dict(table: WebElement, has_header: bool = True,
51+
skip_rows: int = 0, header_tag: str = "th") -> List[Dict]:
5152
"""Convert a table WebElement to a dict of lists.
5253
5354
Args:

0 commit comments

Comments
 (0)