Skip to content

Commit

Permalink
fix: indentation errors and collection check - calling locate on poss…
Browse files Browse the repository at this point in the history
…ible broswer instance
  • Loading branch information
cachebag committed Jan 27, 2025
1 parent 9b2e725 commit ff17a7c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion selene/core/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def __init__(
if element.is_displayed()
]
)
if entity._is_collection(some_entity)
if isinstance(some_entity, Collection) # Narrow type to Collection
and some_entity.config._match_only_visible_elements_size
else query.size(some_entity)
),
Expand Down
21 changes: 21 additions & 0 deletions selene/core/split.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import re


def fix_long_lines(file_path, max_length=79):
with open(file_path, 'r') as file:
lines = file.readlines()

with open(file_path, 'w') as file:
for line in lines:
if len(line) > max_length:
indent = len(line) - len(line.lstrip())
while len(line) > max_length:
split_point = line[:max_length].rfind(' ')
if split_point == -1:
split_point = max_length
file.write(line[:split_point].rstrip() + '\\\n')
line = ' ' * indent + line[split_point:].lstrip()
file.write(line)


fix_long_lines("match.py")

0 comments on commit ff17a7c

Please sign in to comment.