Skip to content

Fix Ruff FA100, I001 and UP006 errors#721

Merged
jaraco merged 1 commit intojaraco:mainfrom
hugovk:fix-tests
Nov 16, 2025
Merged

Fix Ruff FA100, I001 and UP006 errors#721
jaraco merged 1 commit intojaraco:mainfrom
hugovk:fix-tests

Conversation

@hugovk
Copy link
Contributor

@hugovk hugovk commented Jul 5, 2025

Fix failures on main:

=================================== FAILURES ===================================
_________________________________ test session _________________________________
conftest.py:1:1: I001 [*] Import block is un-sorted or un-formatted
  |
1 | import platform
  | ^^^^^^^^^^^^^^^ I001
  |
  = help: Organize imports


_________________________________ test session _________________________________
keyring/core.py:61:55: FA100 Add `from __future__ import annotations` to simplify `typing.Optional`
   |
61 | def get_password(service_name: str, username: str) -> typing.Optional[str]:
   |                                                       ^^^^^^^^^^^^^^^ FA100
62 |     """Get password from the specified service."""
63 |     return get_keyring().get_password(service_name, username)
   |

keyring/core.py:77:34: FA100 Add `from __future__ import annotations` to simplify `typing.Optional`
   |
76 | def get_credential(
77 |     service_name: str, username: typing.Optional[str]
   |                                  ^^^^^^^^^^^^^^^ FA100
78 | ) -> typing.Optional[credentials.Credential]:
79 |     """Get a Credential for the specified service."""
   |

keyring/core.py:78:6: FA100 Add `from __future__ import annotations` to simplify `typing.Optional`
   |
76 | def get_credential(
77 |     service_name: str, username: typing.Optional[str]
78 | ) -> typing.Optional[credentials.Credential]:
   |      ^^^^^^^^^^^^^^^ FA100
79 |     """Get a Credential for the specified service."""
80 |     return get_keyring().get_credential(service_name, username)
   |

keyring/core.py:87:25: FA100 Add `from __future__ import annotations` to simplify `typing.Optional`
   |
87 | def init_backend(limit: typing.Optional[LimitCallable] = None):
   |                         ^^^^^^^^^^^^^^^ FA100
88 |     """
89 |     Load a detected backend.
   |

keyring/core.py:94:28: FA100 Add `from __future__ import annotations` to simplify `typing.Optional`
   |
94 | def _detect_backend(limit: typing.Optional[LimitCallable] = None):
   |                            ^^^^^^^^^^^^^^^ FA100
95 |     """
96 |     Return a keyring specified in the config file or infer the best available.
   |

keyring/core.py:116:47: UP006 Use `type` instead of `typing.Type` for type annotation
    |
116 | def _load_keyring_class(keyring_name: str) -> typing.Type[backend.KeyringBackend]:
    |                                               ^^^^^^^^^^^ UP006
117 |     """
118 |     Load the keyring class indicated by name.
    |
    = help: Replace with `type`

keyring/core.py:148:19: FA100 Add `from __future__ import annotations` to simplify `typing.Optional`
    |
148 | def load_env() -> typing.Optional[backend.KeyringBackend]:
    |                   ^^^^^^^^^^^^^^^ FA100
149 |     """Load a keyring configured in the environment variable."""
150 |     try:
    |

keyring/core.py:166:22: FA100 Add `from __future__ import annotations` to simplify `typing.Optional`
    |
166 | def load_config() -> typing.Optional[backend.KeyringBackend]:
    |                      ^^^^^^^^^^^^^^^ FA100
167 |     """Load a keyring using the config file in the config root."""
    |


_________________________________ test session _________________________________
tests/test_cli.py:1:1: I001 [*] Import block is un-sorted or un-formatted
   |
 1 | / import getpass
 2 | | import itertools
 3 | | import sys
 4 | | from unittest import mock
 5 | |
 6 | | import pytest
 7 | |
 8 | | from keyring import cli
 9 | | from keyring import credentials
   | |_______________________________^ I001
10 |
11 |   flatten = itertools.chain.from_iterable
   |
   = help: Organize imports

https://github.com/jaraco/keyring/actions/runs/15014236777/job/42188495940

@jaraco jaraco merged commit ea1d763 into jaraco:main Nov 16, 2025
15 checks passed
@hugovk hugovk deleted the fix-tests branch November 16, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants