Skip to content

Commit

Permalink
Add __all__ to package inits
Browse files Browse the repository at this point in the history
In VS Code `Pylance` when trying to import non-module names from
`pomcorn` raises `reportPrivateImportUsage`.
  • Loading branch information
M1troll committed Nov 15, 2023
1 parent e74e0b5 commit f1ff858
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 25 deletions.
29 changes: 14 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions pomcorn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
from .component import Component, ComponentWithBaseLocator, ListComponent
from .element import Element, XPathElement
from .page import Page
from .web_view import WebView
from pomcorn.component import (
Component,
ComponentWithBaseLocator,
ListComponent,
)
from pomcorn.element import Element, XPathElement
from pomcorn.page import Page
from pomcorn.web_view import WebView

__all__ = (
"Component",
"ComponentWithBaseLocator",
"ListComponent",
"Element",
"XPathElement",
"Page",
"WebView",
)
26 changes: 24 additions & 2 deletions pomcorn/locators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from .base_locators import Locator, TInitLocator, TLocator, XPathLocator
from .xpath_locators import (
from pomcorn.locators.base_locators import (
Locator,
TInitLocator,
TLocator,
XPathLocator,
)
from pomcorn.locators.xpath_locators import (
ButtonWithTextLocator,
ClassLocator,
DataTestIdLocator,
Expand All @@ -11,3 +16,20 @@
TagNameLocator,
TextAreaByLabelLocator,
)

__all__ = (
"Locator",
"TInitLocator",
"TLocator",
"XPathLocator",
"ButtonWithTextLocator",
"ClassLocator",
"DataTestIdLocator",
"ElementWithTextLocator",
"IdLocator",
"InputByLabelLocator",
"NameLocator",
"PropertyLocator",
"TagNameLocator",
"TextAreaByLabelLocator",
)
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ python = ">= 3.11, < 4.0"
# Python bindings for Selenium
# https://selenium-python.readthedocs.io/index.html
selenium = ">= 4.12"
# Fixed version until fix of https://github.com/jorisroovers/gitlint/issues/535
virtualenv = "20.24.5"

[tool.poetry.group.dev.dependencies]
# Improved REPL
Expand All @@ -53,6 +51,8 @@ ipython = ">= 8.14.0"
# A framework for managing and maintaining multi-language pre-commit hooks.
# https://pre-commit.com/
pre-commit = ">= 3.3.3"
# Fixed version until fix of https://github.com/jorisroovers/gitlint/issues/535
virtualenv = "20.24.5"
# Collection of invoke commands
# https://github.com/saritasa-nest/saritasa-python-invocations
saritasa-invocations = ">= 0.8"
Expand Down Expand Up @@ -113,17 +113,18 @@ known_pytest=[
"_pytest",
"xdist",
]
known_page_object="page_object"
sections=[
"FUTURE",
"STDLIB",
"THIRDPARTY",
"PYTEST",
"PAGE_OBJECT",
"FIRSTPARTY",
"LOCALFOLDER",
]
include_trailing_comma=true
# For sorting `__all__` sections
# Off until the issue is fixed: https://github.com/PyCQA/isort/issues/2193
# sort_reexports=true

[tool.flake8]
# F403: using wildcard imports (from … import *)
Expand Down

0 comments on commit f1ff858

Please sign in to comment.