Skip to content

Commit d9659d0

Browse files
committed
Deprecated encode_if_unicode
1 parent ae0033b commit d9659d0

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

laterpay/compat.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
# -*- coding: utf-8 -*-
2+
import warnings
23

34
import six
45

56

6-
def encode_if_unicode(value, encoding='utf-8'):
7+
def encode_if_unicode(value, encoding='utf-8'): # pragma: no cover
78
"""
89
Encode and return a ``value`` using specified ``encoding``.
910
1011
Encoding is done only if ``value`` is a ``unicode`` instance
1112
(utf-8 encoding is used as default).
13+
14+
.. deprecated:: 5.0.0
15+
16+
Use :func:`laterpay.compat.stringify` instead.
1217
"""
18+
warnings.warn(
19+
'laterpay.compat.encode_if_unicode is deprecated and will be removed '
20+
'in future versions. Use laterpay.compat.stringify instead',
21+
DeprecationWarning
22+
)
23+
1324
if six.PY2 and isinstance(value, six.text_type):
1425
value = value.encode(encoding)
1526
return value

setup.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ show_missing = True
66

77
[coverage:run]
88
branch = True
9-
omit =
10-
laterpay/compat.py
119
source = laterpay
1210

1311
[flake8]

0 commit comments

Comments
 (0)