diff --git a/ckanext/unfold/adapters/_7z.py b/ckanext/unfold/adapters/_7z.py index e1ebbe0..8a59668 100644 --- a/ckanext/unfold/adapters/_7z.py +++ b/ckanext/unfold/adapters/_7z.py @@ -3,10 +3,11 @@ import logging from typing import Any -import ckan.plugins.toolkit as tk import py7zr from py7zr import FileInfo, exceptions +import ckan.plugins.toolkit as tk + import ckanext.unfold.types as unf_types import ckanext.unfold.utils as unf_utils diff --git a/ckanext/unfold/adapters/rar.py b/ckanext/unfold/adapters/rar.py index d320f70..6bb39a1 100644 --- a/ckanext/unfold/adapters/rar.py +++ b/ckanext/unfold/adapters/rar.py @@ -1,17 +1,16 @@ from __future__ import annotations import logging -from typing import Any, Optional from io import BytesIO +from typing import Any, Optional -import requests import rarfile +import requests from rarfile import Error as RarError from rarfile import RarInfo import ckan.plugins.toolkit as tk - import ckanext.unfold.types as unf_types import ckanext.unfold.utils as unf_utils diff --git a/ckanext/unfold/adapters/zip.py b/ckanext/unfold/adapters/zip.py index 32938db..0b4d45f 100644 --- a/ckanext/unfold/adapters/zip.py +++ b/ckanext/unfold/adapters/zip.py @@ -6,9 +6,10 @@ from typing import Any, Optional from zipfile import BadZipFile, LargeZipFile, ZipFile, ZipInfo -import ckan.plugins.toolkit as tk import requests +import ckan.plugins.toolkit as tk + import ckanext.unfold.types as unf_types import ckanext.unfold.utils as unf_utils diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a9a0a11 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,93 @@ +[tool.black] +# line-length = 88 +# preview = true + +[tool.ruff] +target-version = "py38" + +[tool.isort] +known_ckan = "ckan" +known_ckanext = "ckanext" +known_self = "ckanext.unfold" +sections = "FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,CKAN,CKANEXT,SELF,LOCALFOLDER" + +[tool.pytest.ini_options] +addopts = "--ckan-ini test.ini" +filterwarnings = [ + "ignore::sqlalchemy.exc.SADeprecationWarning", + "ignore::sqlalchemy.exc.SAWarning", + "ignore::DeprecationWarning", +] + +[tool.pyright] +pythonVersion = "3.8" +include = ["ckanext"] +exclude = [ + "**/test*", + "**/migration", +] +strict = [] + +strictParameterNoneValue = true # type must be Optional if default value is None + +# Check the meaning of rules here +# https://github.com/microsoft/pyright/blob/main/docs/configuration.md +reportFunctionMemberAccess = true # non-standard member accesses for functions +reportMissingImports = true +reportMissingModuleSource = true +reportMissingTypeStubs = false +reportImportCycles = true +reportUnusedImport = true +reportUnusedClass = true +reportUnusedFunction = true +reportUnusedVariable = true +reportDuplicateImport = true +reportOptionalSubscript = true +reportOptionalMemberAccess = true +reportOptionalCall = true +reportOptionalIterable = true +reportOptionalContextManager = true +reportOptionalOperand = true +reportTypedDictNotRequiredAccess = false # We are using Context in a way that conflicts with this check +reportConstantRedefinition = true +reportIncompatibleMethodOverride = true +reportIncompatibleVariableOverride = true +reportOverlappingOverload = true +reportUntypedFunctionDecorator = false +reportUnknownParameterType = true +reportUnknownArgumentType = false +reportUnknownLambdaType = false +reportUnknownMemberType = false +reportMissingTypeArgument = true +reportInvalidTypeVarUse = true +reportCallInDefaultInitializer = true +reportUnknownVariableType = true +reportUntypedBaseClass = true +reportUnnecessaryIsInstance = true +reportUnnecessaryCast = true +reportUnnecessaryComparison = true +reportAssertAlwaysTrue = true +reportSelfClsParameterName = true +reportUnusedCallResult = false # allow function calls for side-effect only (like logic.check_acces) +useLibraryCodeForTypes = true +reportGeneralTypeIssues = true +reportPropertyTypeMismatch = true +reportWildcardImportFromLibrary = true +reportUntypedClassDecorator = false # authenticator relies on repoze.who class-decorator +reportUntypedNamedTuple = true +reportPrivateUsage = true +reportPrivateImportUsage = true +reportInconsistentConstructor = true +reportMissingSuperCall = false +reportUninitializedInstanceVariable = true +reportInvalidStringEscapeSequence = true +reportMissingParameterType = true +reportImplicitStringConcatenation = false +reportUndefinedVariable = true +reportUnboundVariable = true +reportInvalidStubStatement = true +reportIncompleteStub = true +reportUnsupportedDunderAll = true +reportUnusedCoroutine = true +reportUnnecessaryTypeIgnoreComment = true +reportMatchNotExhaustive = true