The function was introduced in 65112bad7e
to handle the differences between Python 2 & 3 byte handling. Now that
Python 3 supports byte formatting, can drop the unnecessary
compatibility shim in favor of native features.
Similar to the recent adoption of Black. isort is a Python utility to
sort imports alphabetically and automatically separate into sections. By
using isort, contributors can quickly and automatically conform to the
projects style without thinking. Just let the tool do it.
Uses the configuration recommended by the Black to avoid conflicts of
style.
Rewrite TestImageQt.test_deprecated to no rely on import order.
When bytes warnings are enabled with the '-b' argument, the PdfDict
class would emit a warning.
https://docs.python.org/3/using/cmdline.html#miscellaneous-options
> -b
>
> Issue a warning when comparing bytes or bytearray with str or bytes
> with int.
Object attributes are always type str, so can safely encode them without
a type check. Observe:
$ python3
>>> o = object()
>>> setattr(o, b'foo', b'bar')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: attribute name must be string, not 'bytes'