Skip to content

Commit b72a4ca

Browse files
authored
Merge pull request #501 from languitar/chore/drop-python-3-10
build!: drop Python 3.10 support
2 parents c5b4ab1 + 7088644 commit b72a4ca

File tree

5 files changed

+17
-26
lines changed

5 files changed

+17
-26
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
strategy:
5353
max-parallel: 4
5454
matrix:
55-
python-version: ["3.10", "3.11", "3.12", "3.13"]
55+
python-version: ["3.11", "3.12", "3.13"]
5656

5757
steps:
5858
- name: Clone repo

passgithelper.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@
55
.. codeauthor:: Johannes Wienke
66
"""
77

8-
98
import abc
109
import argparse
1110
import configparser
1211
import fnmatch
1312
import logging
1413
import os
15-
import os.path
1614
from pathlib import Path
1715
import re
1816
import subprocess
1917
import sys
20-
from typing import Dict, IO, Mapping, Optional, Pattern, Sequence, Text
18+
from typing import IO, Mapping, Optional, Pattern, Sequence, Text
2119

2220
import xdg.BaseDirectory
2321

@@ -108,7 +106,7 @@ def parse(mapping_file: IO) -> configparser.ConfigParser:
108106
return parse(file_handle)
109107

110108

111-
def parse_request() -> Dict[str, str]:
109+
def parse_request() -> dict[str, str]:
112110
"""Parse the request of the git credential API from stdin.
113111
114112
Returns:
@@ -189,11 +187,10 @@ def __init__(self, prefix_length: int, option_suffix: Text = "") -> None:
189187
super().__init__(option_suffix)
190188
self._prefix_length = prefix_length
191189

192-
@abc.abstractmethod
193190
def configure(self, config: configparser.SectionProxy) -> None:
194191
"""Configure the amount of characters to skip."""
195192
self._prefix_length = config.getint(
196-
"skip{suffix}".format(suffix=self._option_suffix),
193+
f"skip{self._option_suffix}",
197194
fallback=self._prefix_length,
198195
)
199196

@@ -232,9 +229,7 @@ def __init__(self, line: int, prefix_length: int, option_suffix: Text = "") -> N
232229
def configure(self, config: configparser.SectionProxy) -> None:
233230
"""See base class method."""
234231
super().configure(config)
235-
self._line = config.getint(
236-
"line{suffix}".format(suffix=self._option_suffix), fallback=self._line
237-
)
232+
self._line = config.getint(f"line{self._option_suffix}", fallback=self._line)
238233

239234
def _get_raw(
240235
self, entry_name: Text, entry_lines: Sequence[Text] # noqa: ARG002
@@ -266,16 +261,16 @@ def _build_matcher(self, regex: str) -> Pattern:
266261
matcher = re.compile(regex)
267262
if matcher.groups != 1:
268263
raise ValueError(
269-
'Provided regex "{regex}" must contain a single '
270-
"capture group for the value to return.".format(regex=regex)
264+
f'Provided regex "{regex}" must contain a single '
265+
"capture group for the value to return."
271266
)
272267
return matcher
273268

274269
def configure(self, config: configparser.SectionProxy) -> None:
275270
"""See base class method."""
276271
self._regex = self._build_matcher(
277272
config.get(
278-
"regex{suffix}".format(suffix=self._option_suffix),
273+
f"regex{self._option_suffix}",
279274
fallback=self._regex.pattern,
280275
)
281276
)
@@ -446,9 +441,9 @@ def get_password(
446441
password = password_extractor.get_value(pass_target, lines)
447442
username = username_extractor.get_value(pass_target, lines)
448443
if password:
449-
print("password={password}".format(password=password)) # noqa: T201
444+
print(f"password={password}") # noqa: T201
450445
if "username" not in request and username:
451-
print("username={username}".format(username=username)) # noqa: T201
446+
print(f"username={username}") # noqa: T201
452447

453448

454449
def handle_skip() -> None:
@@ -481,18 +476,14 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
481476
mapping = parse_mapping(args.mapping)
482477
except Exception as error: # ok'ish for the main function
483478
LOGGER.critical("Unable to parse mapping file", exc_info=True)
484-
print( # noqa: T201
485-
"Unable to parse mapping file: {error}".format(error=error), file=sys.stderr
486-
)
479+
print(f"Unable to parse mapping file: {error}", file=sys.stderr) # noqa: T201
487480
sys.exit(1)
488481

489482
if action == "get":
490483
try:
491484
get_password(request, mapping)
492485
except Exception as error: # ok'ish for the main function
493-
print( # noqa: T201
494-
"Unable to retrieve entry: {error}".format(error=error), file=sys.stderr
495-
)
486+
print(f"Unable to retrieve entry: {error}", file=sys.stderr) # noqa: T201
496487
sys.exit(1)
497488
else:
498489
LOGGER.info("Action %s is currently not supported", action)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
33

44
[tool.ruff]
55
src = ["src"]
6-
target-version = "py310"
6+
target-version = "py311"
77

88
[tool.ruff.lint]
99
select = [

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords =
1212
credentials
1313
password store
1414
classifiers =
15-
Programming Language :: Python :: 3
15+
Programming Language :: Python :: 3.11
1616
Topic :: Utilities
1717
License :: OSI Approved ::
1818
GNU Lesser General Public License v3 or later (LGPLv3+)
@@ -22,6 +22,7 @@ project_urls =
2222
[options]
2323
install_requires =
2424
pyxdg
25+
python_requires = >=3.11
2526
py_modules =
2627
passgithelper
2728

tox.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = coverage-clean,test-py{310,311,312,313}, check, coverage
2+
envlist = coverage-clean,test-py{311,312,313}, check, coverage
33

44
[testenv]
55
extras = test
@@ -18,7 +18,7 @@ commands = coverage erase
1818
depends =
1919

2020
[testenv:coverage]
21-
depends = test-py{39,310,311,312,313}
21+
depends = test-py{311,312,313}
2222
deps =
2323
coverage
2424
skip_install = true
@@ -40,7 +40,6 @@ commands =
4040

4141
[gh-actions]
4242
python =
43-
3.10: py310, coverage
4443
3.11: py311, coverage
4544
3.12: py312, coverage
4645
3.13: py313, coverage

0 commit comments

Comments
 (0)