equal
deleted
inserted
replaced
28 import types |
28 import types |
29 import warnings |
29 import warnings |
30 import zlib |
30 import zlib |
31 |
31 |
32 from six import PY2, binary_type, text_type |
32 from six import PY2, binary_type, text_type |
33 from six.moves import builtins |
33 |
34 |
|
35 from logilab.common.deprecation import deprecated |
|
36 from logilab.common.logging_ext import set_log_methods |
34 from logilab.common.logging_ext import set_log_methods |
37 from yams.constraints import BASE_CONVERTERS, BASE_CHECKERS |
35 from yams.constraints import BASE_CONVERTERS, BASE_CHECKERS |
38 from yams.schema import role_name as rname |
36 from yams.schema import role_name as rname |
39 |
37 |
40 from cubicweb.__pkginfo__ import version as __version__ # noqa |
38 from cubicweb.__pkginfo__ import version as __version__ # noqa |
66 |
64 |
67 |
65 |
68 # '_' is available to mark internationalized string but should not be used to |
66 # '_' is available to mark internationalized string but should not be used to |
69 # do the actual translation |
67 # do the actual translation |
70 _ = text_type |
68 _ = text_type |
71 if not hasattr(builtins, '_'): |
|
72 builtins._ = deprecated("[3.22] Use 'from cubicweb import _'")(_) |
|
73 |
|
74 |
|
75 # convert eid to the right type, raise ValueError if it's not a valid eid |
|
76 @deprecated('[3.17] typed_eid() was removed. replace it with int() when needed.') |
|
77 def typed_eid(eid): |
|
78 return int(eid) |
|
79 |
69 |
80 |
70 |
81 class Binary(BytesIO): |
71 class Binary(BytesIO): |
82 """class to hold binary data. Use BytesIO to prevent use of unicode data""" |
72 """class to hold binary data. Use BytesIO to prevent use of unicode data""" |
83 _allowed_types = (binary_type, bytearray, buffer if PY2 else memoryview) # noqa: F405 |
73 _allowed_types = (binary_type, bytearray, buffer if PY2 else memoryview) # noqa: F405 |