Skip to content
Snippets Groups Projects
Commit f03740a4 authored by Houzefa Abbasbhay's avatar Houzefa Abbasbhay :slight_smile:
Browse files

Format the code with ``black``

See <https://pypi.org/project/black/> & the "hacking" doc.
parent bd2ea275
No related branches found
No related tags found
No related merge requests found
......@@ -16,8 +16,8 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
......@@ -20,9 +20,9 @@
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
......@@ -25,12 +25,12 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
]
# Add any paths that contain templates here, relative to this directory.
......@@ -34,6 +34,6 @@
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
# The suffix of source filenames.
......@@ -38,5 +38,5 @@
# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"
# The encoding of source files.
......@@ -41,5 +41,5 @@
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'
# The master toctree document.
......@@ -44,5 +44,5 @@
# The master toctree document.
master_doc = 'index'
master_doc = "index"
# General information about the project.
......@@ -47,10 +47,10 @@
# General information about the project.
project = u'py3o.template'
copyright = u'2013, Florent Aide'
project = u"py3o.template"
copyright = u"2013, Florent Aide"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
......@@ -51,8 +51,8 @@
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.9.10'
version = "0.9.10"
# The full version, including alpha/beta/rc tags.
......@@ -58,5 +58,5 @@
# The full version, including alpha/beta/rc tags.
release = '0.9.10'
release = "0.9.10"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......@@ -60,7 +60,7 @@
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
......@@ -64,5 +64,5 @@
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
......@@ -68,8 +68,8 @@
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all documents.
......@@ -70,9 +70,9 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
......@@ -77,6 +77,6 @@
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
......@@ -80,7 +80,7 @@
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
......@@ -84,6 +84,6 @@
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
......@@ -88,5 +88,5 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
......@@ -91,9 +91,9 @@
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
......@@ -94,11 +94,11 @@
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = "default"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
......@@ -101,7 +101,7 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
......@@ -106,6 +106,6 @@
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
......@@ -109,6 +109,6 @@
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
......@@ -113,6 +113,6 @@
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
......@@ -116,8 +116,8 @@
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
......@@ -120,9 +120,9 @@
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
......@@ -125,8 +125,8 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
......@@ -130,7 +130,7 @@
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
......@@ -134,6 +134,6 @@
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
......@@ -138,6 +138,6 @@
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
......@@ -141,6 +141,6 @@
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}
# If false, no module index is generated.
......@@ -145,5 +145,5 @@
# If false, no module index is generated.
#html_domain_indices = True
# html_domain_indices = True
# If false, no index is generated.
......@@ -148,5 +148,5 @@
# If false, no index is generated.
#html_use_index = True
# html_use_index = True
# If true, the index is split into individual pages for each letter.
......@@ -151,5 +151,5 @@
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False
# If true, links to the reST sources are added to the pages.
......@@ -154,5 +154,5 @@
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
......@@ -157,5 +157,5 @@
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
......@@ -160,7 +160,7 @@
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
......@@ -163,7 +163,7 @@
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
......@@ -168,5 +168,5 @@
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None
# Output file base name for HTML help builder.
......@@ -171,8 +171,8 @@
# Output file base name for HTML help builder.
htmlhelp_basename = 'py3otemplatedoc'
htmlhelp_basename = "py3otemplatedoc"
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
......@@ -174,18 +174,16 @@
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
......@@ -187,11 +185,16 @@
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'py3otemplate.tex', u'py3o.template Documentation',
u'Florent Aide', 'manual'),
(
"index",
"py3otemplate.tex",
u"py3o.template Documentation",
u"Florent Aide",
"manual",
)
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
......@@ -194,8 +197,8 @@
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
......@@ -199,6 +202,6 @@
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False
# If true, show page references after internal links.
......@@ -203,5 +206,5 @@
# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
......@@ -206,5 +209,5 @@
# If true, show URL addresses after external links.
#latex_show_urls = False
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
......@@ -209,5 +212,5 @@
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []
# If false, no module index is generated.
......@@ -212,6 +215,6 @@
# If false, no module index is generated.
#latex_domain_indices = True
# latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
......@@ -219,8 +222,13 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'py3otemplate', u'py3o.template Documentation',
[u'Florent Aide'], 1)
(
"index",
"py3otemplate",
u"py3o.template Documentation",
[u"Florent Aide"],
1,
)
]
# If true, show URL addresses after external links.
......@@ -224,7 +232,7 @@
]
# If true, show URL addresses after external links.
#man_show_urls = False
# man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
......@@ -233,9 +241,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'py3otemplate', u'py3o.template Documentation',
u'Florent Aide', 'py3otemplate', 'One line description of project.',
'Miscellaneous'),
(
"index",
"py3otemplate",
u"py3o.template Documentation",
u"Florent Aide",
"py3otemplate",
"One line description of project.",
"Miscellaneous",
)
]
# Documents to append as an appendix to all manuals.
......@@ -239,6 +253,6 @@
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# texinfo_appendices = []
# If false, no module index is generated.
......@@ -243,5 +257,5 @@
# If false, no module index is generated.
#texinfo_domain_indices = True
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
......@@ -246,6 +260,6 @@
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'
# Example configuration for intersphinx: refer to the Python standard library.
......@@ -249,4 +263,4 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
intersphinx_mapping = {"http://docs.python.org/": None}
......@@ -2,9 +2,9 @@
t = Template("py3o_example_template.odt", "py3o_example_output.odt")
t.set_image_path('staticimage.logo', 'images/new_logo.png')
t.set_image_path("staticimage.logo", "images/new_logo.png")
class Item(object):
pass
......@@ -6,8 +6,9 @@
class Item(object):
pass
items = list()
item1 = Item()
......@@ -11,14 +12,14 @@
items = list()
item1 = Item()
item1.val1 = 'Item1 Value1'
item1.image = open('images/dot1.png', 'rb').read()
item1.val3 = 'Item1 Value3'
item1.Currency = 'EUR'
item1.Amount = '12345.35'
item1.InvoiceRef = '#1234'
item1.val1 = "Item1 Value1"
item1.image = open("images/dot1.png", "rb").read()
item1.val3 = "Item1 Value3"
item1.Currency = "EUR"
item1.Amount = "12345.35"
item1.InvoiceRef = "#1234"
items.append(item1)
# if you are using python 2.x you should use xrange
for i in range(124):
item = Item()
......@@ -20,14 +21,14 @@
items.append(item1)
# if you are using python 2.x you should use xrange
for i in range(124):
item = Item()
item.val1 = 'Item%s Value1' % i
item.image = open('images/dot%s.png' % (i % 2), 'rb').read()
item.val3 = 'Item%s Value3' % i
item.Currency = 'EUR'
item.Amount = '6666.77'
item.InvoiceRef = 'Reference #%04d' % i
item.val1 = "Item%s Value1" % i
item.image = open("images/dot%s.png" % (i % 2), "rb").read()
item.val3 = "Item%s Value3" % i
item.Currency = "EUR"
item.Amount = "6666.77"
item.InvoiceRef = "Reference #%04d" % i
items.append(item)
document = Item()
......@@ -31,7 +32,7 @@
items.append(item)
document = Item()
document.total = '9999999999999.999'
document.total = "9999999999999.999"
data = dict(items=items, document=document)
t.render(data)
......@@ -7,8 +7,9 @@
class Item(object):
pass
items = list()
# if you are using python 2.x you should use xrange
for i in range(124):
item = Item()
......@@ -10,7 +11,7 @@
items = list()
# if you are using python 2.x you should use xrange
for i in range(124):
item = Item()
item.col1 = 'Item%s Value1' % i
item.col1 = "Item%s Value1" % i
item.col2 = i
......@@ -16,4 +17,4 @@
item.col2 = i
item.col3 = 'type%s' % (i % 2)
item.col4 = 'Some description that never changes'
item.col3 = "type%s" % (i % 2)
item.col4 = "Some description that never changes"
......@@ -19,5 +20,5 @@
item.image = open('images/dot%s.png' % (i % 2), 'rb').read()
item.image = open("images/dot%s.png" % (i % 2), "rb").read()
items.append(item)
......
......@@ -8,4 +8,5 @@
class Item(object):
pass
item = Item()
......@@ -11,7 +12,7 @@
item = Item()
item.image = open('images/new_logo.png', 'rb').read()
item.image2 = open('images/new_logo.png', 'rb').read()
item.image3 = open('images/new_logo.png', 'rb').read()
item.image = open("images/new_logo.png", "rb").read()
item.image2 = open("images/new_logo.png", "rb").read()
item.image3 = open("images/new_logo.png", "rb").read()
data = {"object": item}
t.render(data)
......@@ -2,7 +2,6 @@
from py3o.template import Template
t = Template(
"py3o_nested_list_template.odt",
"py3o_nested_list_template_output.odt"
"py3o_nested_list_template.odt", "py3o_nested_list_template_output.odt"
)
......@@ -7,6 +6,6 @@
)
t.set_image_path('staticimage.logo', 'images/new_logo.png')
t.set_image_path("staticimage.logo", "images/new_logo.png")
class Item(object):
......@@ -20,12 +19,12 @@
items = list()
item1 = Item()
item1.val1 = 'Item1 Value1'
item1.image = open('images/dot1.png', 'rb').read()
item1.val3 = 'Item1 Value3'
item1.Currency = 'EUR'
item1.Amount = '12345.35'
item1.InvoiceRef = '#1234'
item1.val1 = "Item1 Value1"
item1.image = open("images/dot1.png", "rb").read()
item1.val3 = "Item1 Value3"
item1.Currency = "EUR"
item1.Amount = "12345.35"
item1.InvoiceRef = "#1234"
item1.lines = []
for i in range(5):
......@@ -38,12 +37,12 @@
# if you are using python 2.x you should use xrange
for i in range(3):
item = Item()
item.val1 = 'Item%s Value1' % i
item.image = open('images/dot%s.png' % (i % 2), 'rb').read()
item.val3 = 'Item%s Value3' % i
item.Currency = 'EUR'
item.Amount = '6666.77'
item.InvoiceRef = 'Reference #%04d' % i
item.val1 = "Item%s Value1" % i
item.image = open("images/dot%s.png" % (i % 2), "rb").read()
item.val3 = "Item%s Value3" % i
item.Currency = "EUR"
item.Amount = "6666.77"
item.InvoiceRef = "Reference #%04d" % i
item.lines = []
for j in range(5):
......@@ -54,7 +53,7 @@
items.append(item)
document = Item()
document.total = '9999999999999.999'
document.total = "9999999999999.999"
data = dict(items=items, document=document)
t.render(data)
from py3o.template import Template
t = Template(
"py3o_page_break_without_tail.odt",
"py3o_example_page_break_output.odt"
"py3o_page_break_without_tail.odt", "py3o_example_page_break_output.odt"
)
class Item(object):
pass
......@@ -6,9 +5,10 @@
)
class Item(object):
pass
items = list()
item1 = Item()
......@@ -12,13 +12,13 @@
items = list()
item1 = Item()
item1.val1 = 'Item1 Value1'
item1.val2 = 'Item1 Value2'
item1.val3 = 'Item1 Value3'
item1.Currency = 'EUR'
item1.Amount = '12345.35'
item1.InvoiceRef = '#1234'
item1.val1 = "Item1 Value1"
item1.val2 = "Item1 Value2"
item1.val3 = "Item1 Value3"
item1.Currency = "EUR"
item1.Amount = "12345.35"
item1.InvoiceRef = "#1234"
items.append(item1)
for i in xrange(10):
item = Item()
......@@ -21,13 +21,13 @@
items.append(item1)
for i in xrange(10):
item = Item()
item.val1 = 'Item%s Value1' % i
item.val2 = 'Item%s Value2' % i
item.val3 = 'Item%s Value3' % i
item.Currency = 'EUR'
item.Amount = '6666.77'
item.InvoiceRef = 'Reference #%04d' % i
item.val1 = "Item%s Value1" % i
item.val2 = "Item%s Value2" % i
item.val3 = "Item%s Value3" % i
item.Currency = "EUR"
item.Amount = "6666.77"
item.InvoiceRef = "Reference #%04d" % i
items.append(item)
item1 = Item()
......@@ -31,12 +31,12 @@
items.append(item)
item1 = Item()
item1.val1 = 'Item1 Value1'
item1.val2 = 'Item1 Value2'
item1.val3 = 'Item1 Value3'
item1.Currency = 'EUR'
item1.Amount = '12345.35'
item1.InvoiceRef = '#1234'
item1.val1 = "Item1 Value1"
item1.val2 = "Item1 Value2"
item1.val3 = "Item1 Value3"
item1.Currency = "EUR"
item1.Amount = "12345.35"
item1.InvoiceRef = "#1234"
items.append(item1)
document = Item()
......
......@@ -2,6 +2,6 @@
t = Template(
"py3o_example_template_single_cell.odt",
"py3o_example_output_single_cell.odt"
"py3o_example_output_single_cell.odt",
)
......@@ -6,8 +6,8 @@
)
t.set_image_path('staticimage.logo', 'images/new_logo.png')
t.set_image_path("staticimage.logo", "images/new_logo.png")
class Item(object):
pass
......@@ -9,8 +9,9 @@
class Item(object):
pass
items = list()
item1 = Item()
......@@ -14,13 +15,13 @@
items = list()
item1 = Item()
item1.val1 = 'Item1 Value1'
item1.val2 = 'Item1 Value2'
item1.val3 = 'Item1 Value3'
item1.Currency = 'EUR'
item1.Amount = '12,345.35'
item1.InvoiceRef = '#1234'
item1.val1 = "Item1 Value1"
item1.val2 = "Item1 Value2"
item1.val3 = "Item1 Value3"
item1.Currency = "EUR"
item1.Amount = "12,345.35"
item1.InvoiceRef = "#1234"
items.append(item1)
for i in xrange(1000):
item = Item()
......@@ -23,13 +24,13 @@
items.append(item1)
for i in xrange(1000):
item = Item()
item.val1 = 'Item%s Value1' % i
item.val2 = 'Item%s Value2' % i
item.val3 = 'Item%s Value3' % i
item.Currency = 'EUR'
item.Amount = '6,666.77'
item.InvoiceRef = 'Reference #%04d' % i
item.val1 = "Item%s Value1" % i
item.val2 = "Item%s Value2" % i
item.val3 = "Item%s Value3" % i
item.Currency = "EUR"
item.Amount = "6,666.77"
item.InvoiceRef = "Reference #%04d" % i
items.append(item)
document = Item()
......@@ -33,7 +34,7 @@
items.append(item)
document = Item()
document.total = '9,999,999,999,999.999'
document.total = "9,999,999,999,999.999"
data = dict(items=items, document=document)
t.render(data)
......@@ -6,8 +6,9 @@
class Item(object):
pass
items = list()
# if you are using python 2.x you should use xrange
for i in range(124):
item = Item()
......@@ -9,7 +10,7 @@
items = list()
# if you are using python 2.x you should use xrange
for i in range(124):
item = Item()
item.col1 = 'Item%s Value1' % i
item.col1 = "Item%s Value1" % i
item.col2 = i
......@@ -15,6 +16,6 @@
item.col2 = i
item.col3 = 'type%s' % (i % 2)
item.col4 = 'Some description that never changes'
item.col3 = "type%s" % (i % 2)
item.col4 = "Some description that never changes"
items.append(item)
......
# -*- encoding: utf-8 -*-
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
__import__("pkg_resources").declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
......@@ -5,3 +5,4 @@
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
......@@ -19,10 +19,7 @@
def __repr__(self): # pragma: no cover
res = super(Py3oObject, self).__repr__()
return "{}({})".format(
self.__class__.__name__,
res
)
return "{}({})".format(self.__class__.__name__, res)
def get_size(self):
"""Return the max depth of the object
......@@ -60,9 +57,9 @@
else:
diff = len(target_tup) - len(self_tup)
if diff != 0: # pragma: no cover
raise ValueError(u"Unpack Error: {} != {}".format(
target_tup, self_tup
))
raise ValueError(
u"Unpack Error: {} != {}".format(target_tup, self_tup)
)
for t in zip(target_tup, self_tup):
yield t
......@@ -176,6 +173,7 @@
The attribute direct_access will tell if this class should be considered
as a list of dict or a list of values.
"""
def __init__(self):
super(Py3oArray, self).__init__()
self.direct_access = False
......@@ -199,6 +197,7 @@
(another Py3o class or a simple value)
i.e.: i.egg -> Py3oName({'i': Py3oName({'egg': Py3oName({})})})
"""
def render(self, data):
""" This function will render the datastruct according
to the user's data
......@@ -268,6 +267,7 @@
class Py3oEnumerate(Py3oCall):
"""Represent an enumerate call"""
return_format = (None, 0)
......@@ -277,6 +277,7 @@
_ A literal list, tuple, set or dict definition
_ A tuple of variables that are the target of an unpack assignment
"""
def __init__(self, values):
super(Py3oContainer, self).__init__()
self.values = values
......@@ -290,6 +291,7 @@
""" This class holds temporary dict, or unused attribute
such as counters from enumerate()
"""
pass
......@@ -297,9 +299,7 @@
""" This class holds information about builtins
"""
builtins = {
'enumerate': Py3oEnumerate
}
builtins = {"enumerate": Py3oEnumerate}
@classmethod
def from_name(cls, name=None):
......
......@@ -14,7 +14,7 @@
# This is used as global context key in the convertor
PY3O_MODULE_KEY = '__py3o_module__'
PY3O_MODULE_KEY = "__py3o_module__"
class Py3oConvertor(ast.NodeVisitor):
......@@ -138,7 +138,7 @@
"""Call the node-class specific visit function,
and propagate the context
"""
method = 'visit_' + node.__class__.__name__.lower()
method = "visit_" + node.__class__.__name__.lower()
visitor = getattr(self, method, None)
if visitor:
return visitor(node, local_context)
......@@ -330,6 +330,5 @@
def ast2tree(node, include_attrs=True): # pragma: no cover
def _transform(node):
if isinstance(node, ast.AST):
fields = ((a, _transform(b))
for a, b in ast.iter_fields(node))
fields = ((a, _transform(b)) for a, b in ast.iter_fields(node))
if include_attrs:
......@@ -335,7 +334,9 @@
if include_attrs:
attrs = ((a, _transform(getattr(node, a)))
for a in node._attributes
if hasattr(node, a))
attrs = (
(a, _transform(getattr(node, a)))
for a in node._attributes
if hasattr(node, a)
)
return node.__class__.__name__, dict(fields), dict(attrs)
return node.__class__.__name__, dict(fields)
elif isinstance(node, list):
......@@ -343,4 +344,5 @@
elif isinstance(node, str):
return repr(node)
return node
if not isinstance(node, ast.AST):
......@@ -346,5 +348,5 @@
if not isinstance(node, ast.AST):
raise TypeError('expected AST, got %r' % node.__class__.__name__)
raise TypeError("expected AST, got %r" % node.__class__.__name__)
return _transform(node)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment