-
-
Notifications
You must be signed in to change notification settings - Fork 20
uv #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uv #196
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,19 +1,17 @@ | ||||||||||||
| import json | ||||||||||||
| from collections import Counter | ||||||||||||
| from typing import Dict | ||||||||||||
|
|
||||||||||||
| import allure | ||||||||||||
| from axe_playwright_python.sync_playwright import Axe | ||||||||||||
| from playwright.sync_api import Page | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| class AxeHelper: | ||||||||||||
|
|
||||||||||||
| def __init__(self, axe: Axe): | ||||||||||||
| self.axe = axe | ||||||||||||
|
|
||||||||||||
| def check_accessibility( | ||||||||||||
| self, page: Page, maximum_allowed_violations_by_impact: Dict[str, int] = None | ||||||||||||
| self, page: Page, maximum_allowed_violations_by_impact: dict[str, int] = None | ||||||||||||
|
Comment on lines
13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improved type hinting with modern syntax The change from However, there's a static analysis issue to fix: - def check_accessibility(
- self, page: Page, maximum_allowed_violations_by_impact: dict[str, int] = None
+ def check_accessibility(
+ self, page: Page, maximum_allowed_violations_by_impact: dict[str, int] | None = NoneThis change addresses the warning about implicit Optional types and makes the parameter typing more explicit. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.8.2)14-14: PEP 484 prohibits implicit Convert to (RUF013) |
||||||||||||
| ) -> None: | ||||||||||||
| """Checks accessibility of the page using playwright axe. | ||||||||||||
|
|
||||||||||||
|
|
@@ -33,15 +31,12 @@ def check_accessibility( | |||||||||||
| } | ||||||||||||
| results = self.axe.run(page) | ||||||||||||
| violations_count = dict( | ||||||||||||
| Counter( | ||||||||||||
| [violation["impact"] for violation in results.response["violations"]] | ||||||||||||
| ) | ||||||||||||
| Counter([violation["impact"] for violation in results.response["violations"]]) | ||||||||||||
| ) | ||||||||||||
| if violations_exceeded := { | ||||||||||||
| impact_level: violation_count | ||||||||||||
| for impact_level, violation_count in violations_count.items() | ||||||||||||
| if violation_count | ||||||||||||
| > maximum_allowed_violations_by_impact.get(impact_level, 0) | ||||||||||||
| if violation_count > maximum_allowed_violations_by_impact.get(impact_level, 0) | ||||||||||||
| }: | ||||||||||||
| allure.attach( | ||||||||||||
| body=json.dumps(results.response["violations"], indent=4), | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix type annotation causing pipeline failure
The pipeline is failing with:
TypeError: unsupported operand type(s) for |: 'module' and 'type'. This indicates either:Useris importedLooking at the imports, there's a mismatch: you import with
from enums import Userbut the enum is defined inenums/User.py.Choose one of these options to fix it:
Additionally, consider addressing these static analysis recommendations:
-> None📝 Committable suggestion
🧰 Tools
🪛 Ruff (0.8.2)
21-21: Missing return type annotation for public function
loginAdd return type annotation:
None(ANN201)
21-21: Missing docstring in public method
(D102)
🪛 GitHub Actions: Pre merge test
[error] 21-21: TypeError: unsupported operand type(s) for |: 'module' and 'type'