Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Python 2-only code #875

Merged
merged 6 commits into from Jun 20, 2020
Merged

Conversation

stephenfin
Copy link
Contributor

This depends on #841. Remove six, unnecessary future imports, and code that is only used under the now-unsupported Python 2.7 environment.

@@ -103,7 +102,7 @@ def __init__(cls, name, bases, clsdict):
cls._classinit()


class NodeHandler(with_metaclass(MetaHelper, object)):
class NodeHandler(metaclass=MetaHelper):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Yes, this is correct. You don't need to explicit subclass object in Python 3 as discussed here.

'logging.exception' will log the stacktrace of an exception
automatically. You need to provide the message. In addition, all
'logging' calls require an argument. Resolve both issues.

Signed-off-by: Stephen Finucane <stephen@that.guru>
spinx -> sphinx

Signed-off-by: Stephen Finucane <stephen@that.guru>
The vendored 'rst2pdf.rson' module provides a number of factory methods.
Many of these factory methods provide the ability to override Python
builtins by passing arguments, e.g.:

  Tokenizer.factory(len=some_other_len_function)

We weren't using any of this functionality, which means it's unnecessary
complexity that should be removed. Do just that.

Signed-off-by: Stephen Finucane <stephen@that.guru>
We not longer need to switch between unicode and str or basetring and
str depending on whether we're Python 2 or Python 3 respectively. Just
use 'str' everywhere.

Signed-off-by: Stephen Finucane <stephen@that.guru>
This is unnecessary complexity now.
Each of these are the defaults in Python 3.x.

Signed-off-by: Stephen Finucane <stephen@that.guru>
@stephenfin
Copy link
Contributor Author

Resolved the conflicts due to the now-merged #841

Copy link
Member

@akrabat akrabat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests pass and it the diff looks plausible :)

@akrabat akrabat closed this in d4c6782 Jun 20, 2020
@akrabat akrabat merged commit d4c6782 into rst2pdf:master Jun 20, 2020
@akrabat akrabat added this to the 1.0 milestone Jun 20, 2020
@stephenfin stephenfin deleted the python3-ification branch June 20, 2020 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants