Skip to content

Commit 6bec53f

Browse files
yuriverweijCopilot
andcommitted
fixes for copilot review comments.
Co-authored-by: Copilot <copilot@github.com>
1 parent 25da5f2 commit 6bec53f

8 files changed

Lines changed: 20 additions & 26 deletions

File tree

File renamed without changes.

‎CONTRIBUTING.rst‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ Development commands
125125

126126
Use `invoke`_ tasks for common local checks and test runs::
127127

128-
inv format --check # Check formatting with Ruff
129-
inv format # Format source files with Ruff
130-
inv lint # Run Ruff lint checks
131-
inv lint --fix # Apply safe Ruff lint fixes
132-
inv utest # Run unit tests
133-
inv atest # Run acceptance tests (headlesschrome)
128+
inv formatter --check # Check formatting with Ruff
129+
inv formatter # Format source files with Ruff
130+
inv lint # Run Ruff lint checks
131+
inv lint --fix # Apply safe Ruff lint fixes
132+
inv utest # Run unit tests
133+
inv atest # Run acceptance tests (headlesschrome)
134134

135135
Run these before opening a pull request so local results are close to CI.
136136
Use the project virtual environment and pinned dependencies from

‎atest/run.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
import platform
4242
import time
43-
from unittest import runner
4443
import zipfile
4544
from contextlib import contextmanager
4645
import os

‎src/SeleniumLibrary/keywords/expectedconditions.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
import string
15-
1614
from selenium.webdriver.support import expected_conditions as EC
1715
from selenium.webdriver.support.wait import WebDriverWait
1816

@@ -23,7 +21,7 @@
2321
class ExpectedConditionKeywords(LibraryComponent):
2422
@keyword
2523
def wait_for_expected_condition(
26-
self, condition: string, *args, timeout: float | None = 10
24+
self, condition: str, *args, timeout: float | None = 10
2725
):
2826
"""Waits until ``condition`` is true or ``timeout`` expires.
2927
@@ -64,5 +62,5 @@ def wait_for_expected_condition(
6462
message=f"Expected Condition not met within set timeout of {timeout}s",
6563
)
6664

67-
def _parse_condition(self, condition: string):
65+
def _parse_condition(self, condition: str):
6866
return condition.replace(" ", "_").lower()

‎src/SeleniumLibrary/keywords/runonfailure.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ def register_keyword_to_run_on_failure(self, keyword: str | None) -> str:
6363
def resolve_keyword(name):
6464
if name is None:
6565
return None
66-
if (
67-
isinstance(name, str) and name.upper() == "NOTHING"
68-
) or name.upper() == "NONE":
66+
if isinstance(name, str) and name.upper() in ("NOTHING", "NONE"):
6967
return None
7068
return name

‎src/SeleniumLibrary/keywords/screenshot.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def set_screenshot_directory(self, path: None | str) -> str:
7171
return previous
7272

7373
@keyword
74-
def capture_page_screenshot(self, filename: str = DEFAULT_FILENAME_PAGE) -> str:
74+
def capture_page_screenshot(
75+
self, filename: str = DEFAULT_FILENAME_PAGE
76+
) -> str | None:
7577
"""Takes a screenshot of the current page and embeds it into a log file.
7678
7779
``filename`` argument specifies the name of the file to write the
@@ -148,7 +150,7 @@ def capture_element_screenshot(
148150
self,
149151
locator: Locator,
150152
filename: str = DEFAULT_FILENAME_ELEMENT,
151-
) -> str:
153+
) -> str | None:
152154
"""Captures a screenshot from the element identified by ``locator`` and embeds it into log file.
153155
154156
See `Capture Page Screenshot` for details about ``filename`` argument.

‎src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,6 @@ def _get_index(self, alias_or_index):
466466

467467

468468
class SeleniumService:
469-
""" """
470-
471469
def create(self, browser, service):
472470
if not service:
473471
return None

‎tasks.py‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
import bs4
55
from docutils.core import publish_cmdline
66
from invoke import task
7-
from rellu import initialize_labels, ReleaseNotesGenerator, Version
7+
from rellu import ReleaseNotesGenerator, Version, initialize_labels
88
from rellu.tasks import clean # noqa
99
from robot.libdoc import libdoc
1010

11-
1211
assert Path.cwd() == Path(__file__).parent
1312

1413
VERSION_PATTERN = '__version__ = "(.*)"'
@@ -110,7 +109,7 @@ def project_docs(ctx):
110109
"docs/index.html",
111110
]
112111
publish_cmdline(writer_name="html5", argv=args)
113-
print(Path(args[-1]).absolute())
112+
print(Path(args[-1]).absolute()) # noqa : T201
114113

115114

116115
@task
@@ -133,13 +132,13 @@ def set_version(ctx, version):
133132
"""
134133
version = Version(version, VERSION_PATH, VERSION_PATTERN)
135134
version.write()
136-
print(version)
135+
print(version) # noqa : T201
137136

138137

139138
@task
140139
def print_version(ctx):
141140
"""Print the current project version."""
142-
print(Version(path=VERSION_PATH))
141+
print(Version(path=VERSION_PATH)) # noqa : T201
143142

144143

145144
@task
@@ -187,18 +186,18 @@ def init_labels(ctx, username=None, password=None):
187186

188187
@task
189188
def lint(ctx, fix=False):
190-
"""Run Ruff lint checkse.
189+
"""Run Ruff lint checks.
191190
192191
Args:
193192
fix: Apply safe fixes when True. Defaults to False.
194193
"""
195-
cmd = f"{sys.executable} -m ruff check --config pyproject.toml src/ utest/" # atest/"
194+
cmd = f"{sys.executable} -m ruff check --config pyproject.toml tasks.py src/ utest/" # atest/"
196195
if fix:
197196
cmd = f"{cmd} --fix"
198197
ctx.run(cmd)
199198

200199
@task
201-
def format(ctx, check=False):
200+
def formatter(ctx, check=False):
202201
"""Run Ruff formatter.
203202
204203
Args:

0 commit comments

Comments
 (0)