Commit Graph

30 Commits

Author SHA1 Message Date
Ram Rachum
e219671be1 Fix exception causes in PdfParser.py 2020-06-12 00:34:40 +03:00
Hugo van Kemenade
29d36c9260
Merge pull request #4388 from jdufresne/str-bytes-shim
Remove leftover Python 2 compatibility shim
2020-01-29 14:41:59 +02:00
Jon Dufresne
c84c736e5b Remove unnecessary make_bytes() function
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.
2020-01-26 15:16:04 -08:00
Jon Dufresne
d57d02e827 Remove leftover Python 2 compatibility shim
In Python 3, __str__ should not return bytes.
2020-01-26 14:46:27 -08:00
Hugo
865b17d5cf Remove Python 2-compatibility code 2019-10-07 16:23:22 +03:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03:00
Hugo
af770a6c55 Drop support for EOL Python 2.7 2019-10-07 14:30:59 +03:00
Jon Dufresne
d50445ff30 Introduce isort to automate import ordering and formatting
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.
2019-07-06 16:11:35 -07:00
Hugo
53a7e35004 Format with Black 2019-06-10 18:22:46 +03:00
Jon Dufresne
9296e4f3a2 Merge multiple isinstance() calls to one 2019-03-02 08:24:08 -08:00
Hugo
df6d429789
Merge pull request #3580 from jdufresne/bytes-warning
Fix 'BytesWarning: Comparison between bytes and string' in PdfDict
2019-02-27 23:38:45 +02:00
Hugo
6d0e4a838f Flake8: Fix F821 undefined name; to prevent introducting Mypy depedency 2019-01-30 11:54:12 +02:00
Jon Dufresne
c41ec5b115 Fix 'BytesWarning: Comparison between bytes and string' in PdfDict
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'
2019-01-13 09:38:13 -08:00
Hugo
c75910dbc3 noqa some Py2/3 compat lines and others 2018-12-04 23:25:27 +02:00
Hugo
ceebfc6fe8 flake8: E501 line too long 2018-11-11 19:01:11 +02:00
Hugo
e2deb07608
Merge pull request #3274 from radarhere/pdf
Improve PDF document info
2018-09-29 17:43:05 +03:00
Andrew Murray
9b0d4baa8c Continuation line under-indented for visual indent 2018-09-27 20:31:01 +10:00
Andrew Murray
fc57658635 Added PDF creation and modification date info 2018-08-25 00:58:49 +10:00
Andrew Murray
c2189235af Line too long 2018-07-02 19:26:02 +10:00
Andrew Murray
e7815ccd62 Block comment should start with '# ' 2018-07-02 19:21:44 +10:00
Andrew Murray
fe42591f5f Removed redundant backslash between brackets 2018-07-02 19:20:48 +10:00
Martin Thoma
32e721498a
Use cls instead of klass as first argument
This is captured by N804 / https://www.python.org/dev/peps/pep-0008/?#function-and-method-arguments
of PEP8
2018-07-01 14:10:58 +02:00
Andrew Murray
1947d65c7b Removed unnecessary init method 2018-06-03 16:43:30 +10:00
Andrew Murray
765a6c7e74 Updated redirected URLs 2018-04-30 14:20:32 +10:00
Hugo
04a1f71b4c
Merge pull request #3105 from radarhere/py3
Change Python version checks to use util
2018-04-22 18:37:33 +03:00
Andrew Murray
b4e6cdadac Added py3 variable to _util 2018-04-20 09:19:13 +10:00
Andrew Murray
cbc056f43d Fixed whitespace 2018-04-18 16:00:57 +10:00
Dvořák Václav
24ecfe315a issue #2959: fix wrong Parent of pre-existing Page objects when appending 2018-03-03 23:32:47 +01:00
Dvořák Václav
113d67214c issue #2959: change asserts into raises 2018-03-03 21:08:20 +01:00
Dvořák Václav
c15a0b2fce issue #2959: rename pdfParser.py to PdfParser.py 2018-01-31 00:35:55 +01:00