Skip to content

Commit

Permalink
BF: allow for import of keyring.util.properties but with a Deprecatio…
Browse files Browse the repository at this point in the history
…n warning if used

Unfortunately it is not a complete solution to jaraco#593 since there was likely
also a breakage in API of those properties since it would lead to e.g.

	(git)lena:~/proj/misc/keyrings.alt[main]git
	$> python -c 'import keyrings.alt.file'
	Traceback (most recent call last):
	  File "<string>", line 1, in <module>
	  File "/home/yoh/proj/misc/keyrings.alt/keyrings/alt/file.py", line 67, in <module>
		class EncryptedKeyring(Encrypted, Keyring):
	  File "/home/yoh/proj/misc/keyrings.alt/keyrings/alt/file.py", line 73, in EncryptedKeyring
		@properties.ClassProperty
	  File "/home/yoh/proj/misc/keyring/keyring/util/__init__.py", line 12, in __getattr__
		return getattr(_properties, a)
	AttributeError: module 'keyring._properties_compat' has no attribute 'ClassProperty'. Did you mean: 'classproperty'?
  • Loading branch information
yarikoptic committed Sep 2, 2022
1 parent fd0f76a commit 24243af
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions keyring/util/__init__.py
@@ -1,5 +1,19 @@
import functools

# Compatibility layer to not break imports downstream
# TODO: deprecate/remove fully later
from .._compat import properties
import warnings

class _Properties_shim:
def __getattr__(self, a):
warnings.warn(
"properties from keyring.util are no longer supported, use keyring._compat",
DeprecationWarning)
return getattr(_properties, a)
properties = _Properties_shim()



def once(func):
"""
Expand Down

0 comments on commit 24243af

Please sign in to comment.