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 Python2 crumbs #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
maintainer='Roman Lyashov',
maintainer_email='[email protected]',
url='http://github.com/romanlv/trml2pdf/',
install_requires=['reportlab>=3.2.0', 'six>=1.9.0'],
install_requires=['reportlab>=3.2.0'],
# dependency_links=[],
include_package_data=True,
packages=find_packages(exclude=['tests', 'tests.*']),
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ commands = pytest
deps =
pytest
reportlab>=3.2.0
six>=1.9.0
6 changes: 3 additions & 3 deletions trml2pdf/canv.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import io
import sys
# 2. 3rd parties
from six.moves import urllib
import urllib.request
from reportlab.lib.utils import ImageReader
from reportlab.graphics.barcode import code128, qr
# 3. local
Expand All @@ -34,7 +34,7 @@
encoding = 'UTF-8'


class RmlCanvas(object):
class RmlCanvas:

def __init__(self, canvas, doc_tmpl=None, doc=None):
self.canvas = canvas
Expand Down Expand Up @@ -347,7 +347,7 @@ def render(self, node):
break


class RmlDraw(object):
class RmlDraw:

def __init__(self, node, styles):
self.node = node
Expand Down
5 changes: 2 additions & 3 deletions trml2pdf/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

# 1. system
import io
import xml.dom.minidom
# 2. 3rd parties
from reportlab import platypus
Expand Down Expand Up @@ -55,7 +54,7 @@ def docinit(els):
addMapping(normal, 1, 1, bold_italic) # italic and bold


class RmlDoc(object):
class RmlDoc:

def __init__(self, data: str):
self.dom = xml.dom.minidom.parseString(data)
Expand Down Expand Up @@ -84,7 +83,7 @@ def render(self, out):
self.canvas.save()


class RmlTemplate(object):
class RmlTemplate:

def __init__(self, out, node, doc):
if not node.hasAttribute('pageSize'):
Expand Down
5 changes: 2 additions & 3 deletions trml2pdf/flowable.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

# 1. system
import sys
from six import text_type
# 2. 3rd parties
from reportlab import platypus
from reportlab.graphics.barcode import code39
Expand All @@ -39,7 +38,7 @@ def _child_get(node, childs):
return clds


class RmlFlowable(object):
class RmlFlowable:

def __init__(self, doc):
self.doc = doc
Expand All @@ -66,7 +65,7 @@ def _textual(self, node):
rc += n.data
elif n.nodeType == node.TEXT_NODE:
rc += n.toxml()
return text_type(rc)
return str(rc)

def _list(self, node):
list_style = self.styles.list_styles[node.getAttribute('style')] if node.hasAttribute('style') else platypus.flowables.ListStyle('Default')
Expand Down
2 changes: 1 addition & 1 deletion trml2pdf/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _table_style_get(style_node):
return platypus.tables.TableStyle(styles)


class RmlStyles(object):
class RmlStyles:

def __init__(self, nodes):
self.styles = {}
Expand Down
3 changes: 1 addition & 2 deletions trml2pdf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import re

import reportlab.lib.units
from six import text_type


def text_get(node):
Expand Down Expand Up @@ -65,7 +64,7 @@ def attr_get(node, attrs, attrs_dict={}):
for key in attrs_dict:
if node.hasAttribute(key):
if attrs_dict[key] == 'str':
res[key] = text_type(node.getAttribute(key))
res[key] = str(node.getAttribute(key))
elif attrs_dict[key] == 'bool':
res[key] = bool_get(node.getAttribute(key))
elif attrs_dict[key] == 'int':
Expand Down