Skip to content

Commit

Permalink
[#515] STYLE: fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
yashaka committed Mar 4, 2024
1 parent 198d33f commit 6e54f76
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 147 deletions.
2 changes: 2 additions & 0 deletions .pylint-disabled-rules
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ unsubscriptable-object,
unnecessary-lambda-assignment,
unnecessary-dunder-call,
unnecessary-ellipsis,
unused-private-member,
typevar-name-incorrect-variance,
284 changes: 143 additions & 141 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@ authors = ["Iakiv Kramarenko <yashaka@gmail.com>"]
license = "MIT"
readme = "README.md"
keywords = [
"testing",
"selenium",
"selenide",
"browser",
"pageobject",
"widget",
"wrapper"
"testing",
"selenium",
"selenide",
"browser",
"pageobject",
"widget",
"wrapper"
]
homepage = "https://yashaka.github.io/selene/"
repository = "https://github.com/yashaka/selene/"
documentation = "https://yashaka.github.io/selene/"
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Natural Language :: English",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Internet :: WWW/HTTP :: Browsers",
"Topic :: Software Development :: Testing",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Natural Language :: English",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Internet :: WWW/HTTP :: Browsers",
"Topic :: Software Development :: Testing",
]
packages = [
{include = "selene"},
{include = "selene/api"},
{include = "selene/common"},
{include = "selene/core"},
{include = "selene/support"},
{include = "selene/support/shared"},
{include = "selene/support/conditions"},
{include = "selene/py.typed"}
{include = "selene"},
{include = "selene/api"},
{include = "selene/common"},
{include = "selene/core"},
{include = "selene/support"},
{include = "selene/support/shared"},
{include = "selene/support/conditions"},
{include = "selene/py.typed"}
]

[tool.poetry.urls]
Expand Down Expand Up @@ -82,7 +82,7 @@ allow_redefinition = true # TODO: how to properly make it work o_O ?
color_output=1
exclude = [
'^test_.+\.py$',
'^.+_test\.py$',
'^.+_test\.py$',
]


Expand All @@ -92,32 +92,32 @@ target-version = ['py38']
skip-string-normalization = 1

[tool.pylint]
[tool.pylint.master]
ignore=['CVS']
jobs=1
persistent=['yes']
unsafe-load-any-extension=['no']
suggestion-mode=['yes']
fail-under=['10.0']
[tool.pylint.master]
ignore=['CVS']
jobs=1
persistent=['yes']
unsafe-load-any-extension=['no']
suggestion-mode=['yes']
fail-under=['10.0']

[tool.pylint.'MESSAGES CONTROL']
enable=['c-extension-no-member']
disable=['''no-else-return,
import-outside-toplevel,
too-many-locals,
too-many-lines,
too-many-branches,
invalid-name,
not-callable,
unused-argument,
protected-access,
pointless-string-statement,
too-few-public-methods,
too-many-public-methods,
redefined-outer-name,
missing-class-docstring,
missing-module-docstring,
missing-function-docstring,
[tool.pylint.'MESSAGES CONTROL']
enable=['c-extension-no-member']
disable=['''no-else-return,
import-outside-toplevel,
too-many-locals,
too-many-lines,
too-many-branches,
invalid-name,
not-callable,
unused-argument,
protected-access,
pointless-string-statement,
too-few-public-methods,
too-many-public-methods,
redefined-outer-name,
missing-class-docstring,
missing-module-docstring,
missing-function-docstring,
no-else-raise,
print-statement,
parameter-unpacking,
Expand Down Expand Up @@ -197,105 +197,107 @@ skip-string-normalization = 1
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape''']
[tool.pylint.'REPORTS']
evaluation=['10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)']
output-format=['colorized']
reports=['yes']
score=['yes']
comprehension-escape
unused-private-member,
typevar-name-incorrect-variance''']
[tool.pylint.'REPORTS']
evaluation=['10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)']
output-format=['colorized']
reports=['yes']
score=['yes']

[tool.pylintt.'REFACTORING']
max-nested-blocks=5
never-returning-functions=['sys.exit']
[tool.pylintt.'REFACTORING']
max-nested-blocks=5
never-returning-functions=['sys.exit']

[tool.pylint.'LOGGING']
logging-format-style=['old']
logging-modules=['logging']
[tool.pylint.'LOGGING']
logging-format-style=['old']
logging-modules=['logging']

[tool.pylint.'SPELLING']
max-spelling-suggestions=4
spelling-store-unknown-words=['no']
[tool.pylint.'SPELLING']
max-spelling-suggestions=4
spelling-store-unknown-words=['no']

[tool.pylint.'MISCELLANEOUS']
notes=['FIXME,XXX']
[tool.pylint.'MISCELLANEOUS']
notes=['FIXME,XXX']

[tool.pylint.'TYPECHECK']
contextmanager-decorators=['contextlib.contextmanager']
ignore-mixin-members=['yes']
ignore-none=['yes']
ignore-on-opaque-inference=['yes']
ignored-classes=['optparse.Values,thread._local,_thread._local']
missing-member-hint=['yes']
missing-member-hint-distance=1
missing-member-max-choices=1
[tool.pylint.'TYPECHECK']
contextmanager-decorators=['contextlib.contextmanager']
ignore-mixin-members=['yes']
ignore-none=['yes']
ignore-on-opaque-inference=['yes']
ignored-classes=['optparse.Values,thread._local,_thread._local']
missing-member-hint=['yes']
missing-member-hint-distance=1
missing-member-max-choices=1

[tool.pylint.'VARIABLES']
allow-global-unused-variables=['yes']
callbacks=['cb_,_cb']
dummy-variables-rgx=['_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_']
ignored-argument-names=['_.*|^ignored_|^unused_']
init-import=['no']
redefining-builtins-modules=['six.moves,past.builtins,future.builtins,builtins,io']
[tool.pylint.'VARIABLES']
allow-global-unused-variables=['yes']
callbacks=['cb_,_cb']
dummy-variables-rgx=['_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_']
ignored-argument-names=['_.*|^ignored_|^unused_']
init-import=['no']
redefining-builtins-modules=['six.moves,past.builtins,future.builtins,builtins,io']

[tool.pylint.'FORMAT']
ignore-long-lines=['^\s*(# )?<?https?://\S+>?$']
indent-after-paren=4
indent-string=' '
max-line-length=88
max-module-lines=1000
single-line-class-stmt=['no']
single-line-if-stmt=['no']
[tool.pylint.'FORMAT']
ignore-long-lines=['^\s*(# )?<?https?://\S+>?$']
indent-after-paren=4
indent-string=' '
max-line-length=88
max-module-lines=1000
single-line-class-stmt=['no']
single-line-if-stmt=['no']

[tool.pylint.'SIMILARITIES']
ignore-comments=['yes']
ignore-docstrings=['yes']
ignore-imports=['no']
min-similarity-lines=4
[tool.pylint.'SIMILARITIES']
ignore-comments=['yes']
ignore-docstrings=['yes']
ignore-imports=['no']
min-similarity-lines=4

[tool.pylint.'BASIC']
argument-naming-style=['snake_case']
attr-naming-style=['snake_case']
bad-names=['foo,bar,baz,toto,tutu,tata']
class-attribute-naming-style=['any']
class-naming-style=['PascalCase']
const-naming-style=['UPPER_CASE']
docstring-min-length=-1
function-naming-style=['snake_case']
good-names=['i,j,k,ex,Run,_']
include-naming-hint=['no']
inlinevar-naming-style=['any']
method-naming-style=['snake_case']
module-naming-style=['snake_case']
no-docstring-rgx=['^_']
property-classes=['abc.abstractproperty']
variable-naming-style=['snake_case']
[tool.pylint.'BASIC']
argument-naming-style=['snake_case']
attr-naming-style=['snake_case']
bad-names=['foo,bar,baz,toto,tutu,tata']
class-attribute-naming-style=['any']
class-naming-style=['PascalCase']
const-naming-style=['UPPER_CASE']
docstring-min-length=-1
function-naming-style=['snake_case']
good-names=['i,j,k,ex,Run,_']
include-naming-hint=['no']
inlinevar-naming-style=['any']
method-naming-style=['snake_case']
module-naming-style=['snake_case']
no-docstring-rgx=['^_']
property-classes=['abc.abstractproperty']
variable-naming-style=['snake_case']

[tool.pylint.'STRING']
check-quote-consistency=['no']
check-str-concat-over-line-jumps=['no']
[tool.pylint.'STRING']
check-quote-consistency=['no']
check-str-concat-over-line-jumps=['no']

[tool.pylint.'IMPORTS']
allow-wildcard-with-all=['no']
analyse-fallback-blocks=['no']
deprecated-modules=['optparse,tkinter.tix']
known-third-party=['enchant']
[tool.pylint.'IMPORTS']
allow-wildcard-with-all=['no']
analyse-fallback-blocks=['no']
deprecated-modules=['optparse,tkinter.tix']
known-third-party=['enchant']

[tool.pylint.'CLASSES']
defining-attr-methods=['__init__,__new__,setUp,__post_init__']
valid-classmethod-first-arg=['cls']
valid-metaclass-classmethod-first-arg=['cls']
[tool.pylint.'CLASSES']
defining-attr-methods=['__init__,__new__,setUp,__post_init__']
valid-classmethod-first-arg=['cls']
valid-metaclass-classmethod-first-arg=['cls']

[tool.pylint.'DESIGN']
max-args=5
max-attributes=7
max-bool-expr=5
max-branches=12
max-locals=15
max-parents=7
max-public-methods=20
max-returns=6
max-statements=80
min-public-methods=2
[tool.pylint.'DESIGN']
max-args=5
max-attributes=7
max-bool-expr=5
max-branches=12
max-locals=15
max-parents=7
max-public-methods=20
max-returns=6
max-statements=80
min-public-methods=2

[tool.pylint.'EXCEPTIONS']
overgeneral-exceptions=['BaseException,Exception']
[tool.pylint.'EXCEPTIONS']
overgeneral-exceptions=['BaseException,Exception']
14 changes: 8 additions & 6 deletions selene/core/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,13 @@ def func(element: Element):

# TODO: should we process collections too? i.e. click through all elements?
@staticmethod
def __click(self=None, /, *, xoffset=0, yoffset=0) -> Command[Element]:
def __click(
entity: Element | None = None, /, *, xoffset=0, yoffset=0
) -> Command[Element]:
def func(element: Element):
element.execute_script(
'''
const offsetX = arguments[0]
const offsetX = arguments[0]
const offsetY = arguments[1]
const rect = element.getBoundingClientRect()
Expand Down Expand Up @@ -275,10 +277,10 @@ def func(element: Element):
func,
)

if isinstance(self, Element):
if isinstance(entity, Element):
# somebody passed command as `.perform(command.js.click)`
# not as `.perform(command.js.click())`
element = self
element = entity
command.__call__(element)

return command
Expand All @@ -297,10 +299,10 @@ def __call__(self, element: Element | None = None, *, xoffset=0, yoffset=0):
def func(element: Element):
element.execute_script(
'''
const offsetX = arguments[0]
const offsetX = arguments[0]
const offsetY = arguments[1]
const rect = element.getBoundingClientRect()
function mouseEvent() {
if (typeof (Event) === 'function') {
return new MouseEvent('click', {
Expand Down

0 comments on commit 6e54f76

Please sign in to comment.