diff --git a/examples/auth.py b/examples/auth.py index ec1d67a7b..cda716403 100644 --- a/examples/auth.py +++ b/examples/auth.py @@ -1,4 +1,5 @@ """Some simple authentication examples.""" + from __future__ import annotations from collections import Counter diff --git a/jira/__init__.py b/jira/__init__.py index a12411832..6ec4cff6e 100644 --- a/jira/__init__.py +++ b/jira/__init__.py @@ -1,4 +1,5 @@ """The root of JIRA package namespace.""" + from __future__ import annotations try: diff --git a/jira/client.py b/jira/client.py index 0c456a3f9..ff311bcd6 100644 --- a/jira/client.py +++ b/jira/client.py @@ -4518,9 +4518,9 @@ def deactivate_user(self, username: str) -> str | int: raise JIRAError(f"Error Deactivating {username}: {e}") else: url = self.server_url + "/secure/admin/user/EditUser.jspa" - self._options["headers"][ - "Content-Type" - ] = "application/x-www-form-urlencoded; charset=UTF-8" + self._options["headers"]["Content-Type"] = ( + "application/x-www-form-urlencoded; charset=UTF-8" + ) user = self.user(username) userInfo = { "inline": "true", diff --git a/jira/config.py b/jira/config.py index 225865ee8..8216c3119 100644 --- a/jira/config.py +++ b/jira/config.py @@ -5,6 +5,7 @@ Also, this simplifies the scripts by not having to write the same initialization code for each script. """ + from __future__ import annotations import configparser diff --git a/jira/jirashell.py b/jira/jirashell.py index 4701ce3d5..c78fc69d5 100644 --- a/jira/jirashell.py +++ b/jira/jirashell.py @@ -3,6 +3,7 @@ Script arguments support changing the server and a persistent authentication over HTTP BASIC or Kerberos. """ + from __future__ import annotations import argparse diff --git a/jira/resources.py b/jira/resources.py index 0f48aa882..5922d5087 100644 --- a/jira/resources.py +++ b/jira/resources.py @@ -608,9 +608,9 @@ def update( # type: ignore[override] # incompatible supertype ignored DashboardItemProperty """ options = self._options.copy() - options[ - "path" - ] = f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}" + options["path"] = ( + f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}" + ) self.raw["value"].update(value) self._session.put(self.JIRA_BASE_URL.format(**options), self.raw["value"]) @@ -628,9 +628,9 @@ def delete(self, dashboard_id: str, item_id: str) -> Response: # type: ignore[o Response """ options = self._options.copy() - options[ - "path" - ] = f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}" + options["path"] = ( + f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}" + ) return self._session.delete(self.JIRA_BASE_URL.format(**options)) diff --git a/make_local_jira_user.py b/make_local_jira_user.py index 8b44e9023..d8f984e91 100644 --- a/make_local_jira_user.py +++ b/make_local_jira_user.py @@ -1,4 +1,5 @@ """Attempts to create a test user, as the empty JIRA instance isn't provisioned with one.""" + from __future__ import annotations import sys diff --git a/pyproject.toml b/pyproject.toml index 1b44402f8..133e1bf3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -147,6 +147,16 @@ check_untyped_defs = false disable_error_code = "annotation-unchecked" [tool.ruff] +# Same as Black. +line-length = 88 + +# Assume Python 3.8. (minimum supported) +target-version = "py38" + +# The source code paths to consider, e.g., when resolving first- vs. third-party imports +src = ["jira", "tests"] + +[tool.ruff.lint] select = [ "E", # pydocstyle "W", # pydocstyle @@ -169,27 +179,18 @@ ignore = [ "D417", ] -# Same as Black. -line-length = 88 - # Allow unused variables when underscore-prefixed. dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" -# Assume Python 3.8. (minimum supported) -target-version = "py38" - -# The source code paths to consider, e.g., when resolving first- vs. third-party imports -src = ["jira", "tests"] - -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["jira", "tests"] required-imports = ["from __future__ import annotations"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "jira/__init__.py" = [ "E402", # ignore import order in this file ] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] # Use Google-style docstrings. convention = "google" diff --git a/tests/ruff.toml b/tests/ruff.toml index 8e70dda6b..9ed1ee61a 100644 --- a/tests/ruff.toml +++ b/tests/ruff.toml @@ -1,4 +1,5 @@ extend = "../pyproject.toml" +[lint] ignore = [ "E501", # We have way too many "line too long" errors at the moment "D", # Too many undocumented functions at the moment diff --git a/tests/tests.py b/tests/tests.py index fc101844a..f040150fa 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -8,6 +8,7 @@ resources/test_* : For tests related to resources test_* : For other tests of the non-resource elements of the jira package. """ + from __future__ import annotations import logging