Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit c79883e

Browse files
author
Auto Format
committed
Applied code formatting
1 parent d912940 commit c79883e

22 files changed

+157
-173
lines changed

doc/source/conf.py

Lines changed: 27 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,24 @@
3434
# Add any Sphinx extension module names here, as strings. They can be
3535
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3636
# ones.
37-
extensions = ['sphinx.ext.autodoc',
38-
'sphinx.ext.doctest',
39-
'sphinx.ext.intersphinx',
40-
'sphinx.ext.coverage',
41-
'sphinx.ext.githubpages']
37+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.coverage", "sphinx.ext.githubpages"]
4238

4339
# Add any paths that contain templates here, relative to this directory.
44-
templates_path = ['_templates']
40+
templates_path = ["_templates"]
4541

4642
# The suffix(es) of source filenames.
4743
# You can specify multiple suffix as a list of string:
4844
#
4945
# source_suffix = ['.rst', '.md']
50-
source_suffix = '.rst'
46+
source_suffix = ".rst"
5147

5248
# The master toctree document.
53-
master_doc = 'index'
49+
master_doc = "index"
5450

5551
# General information about the project.
56-
project = 'pycarl'
57-
copyright = 'MOVES RWTH Aachen'
58-
author = 'Sebastian Junges, Matthias Volk'
52+
project = "pycarl"
53+
copyright = "MOVES RWTH Aachen"
54+
author = "Sebastian Junges, Matthias Volk"
5955

6056
# The version info for the project you're documenting, acts as replacement for
6157
# |version| and |release|, also used in various other places throughout the
@@ -79,7 +75,7 @@
7975
exclude_patterns = []
8076

8177
# The name of the Pygments (syntax highlighting) style to use.
82-
pygments_style = 'sphinx'
78+
pygments_style = "sphinx"
8379

8480
# If true, `todo` and `todoList` produce output, else they produce nothing.
8581
todo_include_todos = False
@@ -90,7 +86,7 @@
9086
# The theme to use for HTML and HTML Help pages. See the documentation for
9187
# a list of builtin themes.
9288
#
93-
html_theme = 'bootstrap'
89+
html_theme = "bootstrap"
9490

9591
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
9692

@@ -101,78 +97,63 @@
10197

10298
html_theme_options = {
10399
# Navigation bar title. (Default: ``project`` value)
104-
'navbar_title': "Pycarl",
105-
100+
"navbar_title": "Pycarl",
106101
# Tab name for entire site. (Default: "Site")
107-
'navbar_site_name': "Pycarl",
108-
102+
"navbar_site_name": "Pycarl",
109103
# A list of tuples containing pages or urls to link to.
110104
# Valid tuples should be in the following forms:
111105
# (name, page) # a link to a page
112106
# (name, "/aa/bb", 1) # a link to an arbitrary relative url
113107
# (name, "http://example.com", True) # arbitrary absolute url
114108
# Note the "1" or "True" value above as the third argument to indicate
115109
# an arbitrary url.
116-
'navbar_links': [
117-
("Carl", "https://github.com/moves-rwth/carl-storm", True),
118-
("Github", "https://github.com/moves-rwth/pycarl", True)
119-
],
120-
110+
"navbar_links": [("Carl", "https://github.com/moves-rwth/carl-storm", True), ("Github", "https://github.com/moves-rwth/pycarl", True)],
121111
# Render the next and previous page links in navbar. (Default: true)
122-
'navbar_sidebarrel': True,
123-
112+
"navbar_sidebarrel": True,
124113
# Render the current pages TOC in the navbar. (Default: true)
125-
'navbar_pagenav': True,
126-
114+
"navbar_pagenav": True,
127115
# Tab name for the current pages TOC. (Default: "Page")
128-
'navbar_pagenav_name': "Page",
129-
116+
"navbar_pagenav_name": "Page",
130117
# Global TOC depth for "site" navbar tab. (Default: 1)
131118
# Switching to -1 shows all levels.
132-
'globaltoc_depth': 2,
133-
119+
"globaltoc_depth": 2,
134120
# Include hidden TOCs in Site navbar?
135121
#
136122
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
137123
# non-hidden ``toctree`` directives in the same page, or else the build
138124
# will break.
139125
#
140126
# Values: "true" (default) or "false"
141-
'globaltoc_includehidden': "true",
142-
127+
"globaltoc_includehidden": "true",
143128
# HTML navbar class (Default: "navbar") to attach to <div> element.
144129
# For black navbar, do "navbar navbar-inverse"
145-
'navbar_class': "navbar navbar-inverse",
146-
130+
"navbar_class": "navbar navbar-inverse",
147131
# Fix navigation bar to top of page?
148132
# Values: "true" (default) or "false"
149-
'navbar_fixed_top': "true",
150-
133+
"navbar_fixed_top": "true",
151134
# Location of link to source.
152135
# Options are "nav" (default), "footer" or anything else to exclude.
153-
'source_link_position': "footer",
154-
136+
"source_link_position": "footer",
155137
# Bootswatch (http://bootswatch.com/) theme.
156138
#
157139
# Options are nothing (default) or the name of a valid theme
158140
# such as "cosmo" or "sandstone".
159-
'bootswatch_theme': "united",
160-
141+
"bootswatch_theme": "united",
161142
# Choose Bootstrap version.
162143
# Values: "3" (default) or "2" (in quotes)
163-
'bootstrap_version': "3",
144+
"bootstrap_version": "3",
164145
}
165146

166147
# Add any paths that contain custom static files (such as style sheets) here,
167148
# relative to this directory. They are copied after the builtin static files,
168149
# so a file named "default.css" will overwrite the builtin "default.css".
169-
html_static_path = ['_static']
150+
html_static_path = ["_static"]
170151

171152

172153
# -- Options for HTMLHelp output ------------------------------------------
173154

174155
# Output file base name for HTML help builder.
175-
htmlhelp_basename = 'pycarldoc'
156+
htmlhelp_basename = "pycarldoc"
176157

177158

178159
# -- Options for LaTeX output ---------------------------------------------
@@ -181,15 +162,12 @@
181162
# The paper size ('letterpaper' or 'a4paper').
182163
#
183164
# 'papersize': 'letterpaper',
184-
185165
# The font size ('10pt', '11pt' or '12pt').
186166
#
187167
# 'pointsize': '10pt',
188-
189168
# Additional stuff for the LaTeX preamble.
190169
#
191170
# 'preamble': '',
192-
193171
# Latex figure (float) alignment
194172
#
195173
# 'figure_align': 'htbp',
@@ -199,19 +177,15 @@
199177
# (source start file, target name, title,
200178
# author, documentclass [howto, manual, or own class]).
201179
latex_documents = [
202-
(master_doc, 'pycarl.tex', 'pycarl Documentation',
203-
'Sebastian Junges, Matthias Volk', 'manual'),
180+
(master_doc, "pycarl.tex", "pycarl Documentation", "Sebastian Junges, Matthias Volk", "manual"),
204181
]
205182

206183

207184
# -- Options for manual page output ---------------------------------------
208185

209186
# One entry per manual page. List of tuples
210187
# (source start file, name, description, authors, manual section).
211-
man_pages = [
212-
(master_doc, 'pycarl', 'pycarl Documentation',
213-
[author], 1)
214-
]
188+
man_pages = [(master_doc, "pycarl", "pycarl Documentation", [author], 1)]
215189

216190

217191
# -- Options for Texinfo output -------------------------------------------
@@ -220,10 +194,5 @@
220194
# (source start file, target name, title, author,
221195
# dir menu entry, description, category)
222196
texinfo_documents = [
223-
(master_doc, 'pycarl', 'pycarl Documentation',
224-
author, 'pycarl', 'One line description of project.',
225-
'Miscellaneous'),
197+
(master_doc, "pycarl", "pycarl Documentation", author, "pycarl", "One line description of project.", "Miscellaneous"),
226198
]
227-
228-
229-

examples/01-getting-started.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ def example_getting_started_01():
1212
print("({}) * ({}) = {}".format(pol1, pol2, result))
1313

1414

15-
if __name__ == '__main__':
15+
if __name__ == "__main__":
1616
example_getting_started_01()

lib/pycarl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22

33
if sys.version_info[0] == 2:
4-
raise ImportError('Python 2.x is not supported for pycarl.')
4+
raise ImportError("Python 2.x is not supported for pycarl.")
55

66
from . import core
77
from .core import *

lib/pycarl/cln/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def denominator(x):
1919
else:
2020
return 1
2121

22+
2223
def expand(x):
2324
if type(x) == cln.FactorizedRationalFunction:
2425
return x.rational_function()

lib/pycarl/convert/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def convert_to_gmp(data):
1515
if has_cln:
1616
from . import cln_converter
1717

18-
1918
def convert_to_cln(data):
2019
"""
2120
Convert data type to cln.

lib/pycarl/convert/cln_converter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ def convert_factorized_polynomial(polynomial):
9292
elif isinstance(polynomial, pycarl.gmp.FactorizedPolynomial):
9393
coefficient = convert_rational(polynomial.coefficient)
9494
converted = pycarl.cln.FactorizedPolynomial(coefficient)
95-
for (factor, exponent) in polynomial.factorization():
95+
for factor, exponent in polynomial.factorization():
9696
pol = convert_polynomial(factor.polynomial())
9797
factorized = pycarl.cln.create_factorized_polynomial(pol)
98-
converted *= factorized ** exponent
98+
converted *= factorized**exponent
9999
return converted
100100
else:
101101
raise TypeError("Factorized polynomial of type {} cannot be convert to cln".format(type(polynomial)))
@@ -131,8 +131,9 @@ def convert_constraint(constraint):
131131
else:
132132
raise TypeError("Constraint of type {} cannot be convert to cln".format(type(constraint)))
133133

134+
134135
def convert_formula(formula):
135-
if isinstance(formula, pycarl.cln.formula.Formula):
136+
if isinstance(formula, pycarl.cln.formula.Formula):
136137
return formula
137138
elif isinstance(formula, pycarl.gmp.formula.Formula):
138139
if formula.type == pycarl.formula.FormulaType.TRUE:
@@ -166,8 +167,7 @@ def convert(data):
166167
return convert_rational_function(data)
167168
elif isinstance(data, pycarl.cln.FactorizedPolynomial) or isinstance(data, pycarl.gmp.FactorizedPolynomial):
168169
return convert_factorized_polynomial(data)
169-
elif isinstance(data, pycarl.cln.FactorizedRationalFunction) or isinstance(data,
170-
pycarl.gmp.FactorizedRationalFunction):
170+
elif isinstance(data, pycarl.cln.FactorizedRationalFunction) or isinstance(data, pycarl.gmp.FactorizedRationalFunction):
171171
return convert_factorized_rational_function(data)
172172
elif isinstance(data, pycarl.cln.formula.Constraint) or isinstance(data, pycarl.gmp.formula.Constraint):
173173
return convert_constraint(data)

lib/pycarl/convert/gmp_converter.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ def convert_factorized_polynomial(polynomial):
9292
if has_cln and isinstance(polynomial, pycarl.cln.FactorizedPolynomial):
9393
coefficient = convert_rational(polynomial.coefficient)
9494
converted = pycarl.gmp.FactorizedPolynomial(coefficient)
95-
for (factor, exponent) in polynomial.factorization():
95+
for factor, exponent in polynomial.factorization():
9696
pol = convert_polynomial(factor.polynomial())
9797
factorized = pycarl.gmp.create_factorized_polynomial(pol)
98-
converted *= factorized ** exponent
98+
converted *= factorized**exponent
9999
return converted
100100
elif isinstance(polynomial, pycarl.gmp.FactorizedPolynomial):
101101
return polynomial
@@ -133,6 +133,7 @@ def convert_constraint(constraint):
133133
else:
134134
raise TypeError("Constraint of type {} cannot be convert to gmp".format(type(constraint)))
135135

136+
136137
def convert_formula(formula):
137138
if isinstance(formula, pycarl.gmp.formula.Formula):
138139
return formula
@@ -141,43 +142,37 @@ def convert_formula(formula):
141142
if formula.type == pycarl.formula.FormulaType.FALSE:
142143
return pycarl.gmp.formula.Formula(pycarl.gmp.formula.Constraint(False))
143144
if formula.type == pycarl.formula.FormulaType.CONSTRAINT:
144-
return convert_constraint(formula.get_constraint())
145+
return convert_constraint(formula.get_constraint())
145146
if has_cln and isinstance(formula, pycarl.cln.formula.Formula):
146147
csubformulae = [pycarl.gmp.formula.Formula(convert(subf)) for subf in formula.get_subformulas()]
147148
return pycarl.gmp.formula.Formula(formula.type, csubformulae)
148149
else:
149150
raise TypeError("Formula of type {} cannot be convert to gmp".format(type(formula)))
150151

152+
151153
def convert(data):
152154
"""
153155
Convert arbitrary data type to gmp.
154156
:param data: data structure.
155157
:return: gmp data structure.
156158
"""
157-
if (has_cln and isinstance(data, pycarl.cln.Integer)) or isinstance(data, pycarl.gmp.Integer) or isinstance(data,
158-
int):
159+
if (has_cln and isinstance(data, pycarl.cln.Integer)) or isinstance(data, pycarl.gmp.Integer) or isinstance(data, int):
159160
return convert_integer(data)
160-
elif (has_cln and isinstance(data, pycarl.cln.Rational)) or isinstance(data, pycarl.gmp.Rational) or isinstance(
161-
data, float):
161+
elif (has_cln and isinstance(data, pycarl.cln.Rational)) or isinstance(data, pycarl.gmp.Rational) or isinstance(data, float):
162162
return convert_rational(data)
163163
elif (has_cln and isinstance(data, pycarl.cln.Term)) or isinstance(data, pycarl.gmp.Term):
164164
return convert_term(data)
165165
elif (has_cln and isinstance(data, pycarl.cln.Polynomial)) or isinstance(data, pycarl.gmp.Polynomial):
166166
return convert_polynomial(data)
167167
elif (has_cln and isinstance(data, pycarl.cln.RationalFunction)) or isinstance(data, pycarl.gmp.RationalFunction):
168168
return convert_rational_function(data)
169-
elif (has_cln and isinstance(data, pycarl.cln.FactorizedPolynomial)) or isinstance(data,
170-
pycarl.gmp.FactorizedPolynomial):
169+
elif (has_cln and isinstance(data, pycarl.cln.FactorizedPolynomial)) or isinstance(data, pycarl.gmp.FactorizedPolynomial):
171170
return convert_factorized_polynomial(data)
172-
elif (has_cln and isinstance(data, pycarl.cln.FactorizedRationalFunction)) or isinstance(data,
173-
pycarl.gmp.FactorizedRationalFunction):
171+
elif (has_cln and isinstance(data, pycarl.cln.FactorizedRationalFunction)) or isinstance(data, pycarl.gmp.FactorizedRationalFunction):
174172
return convert_factorized_rational_function(data)
175-
elif (has_cln and isinstance(data, pycarl.cln.formula.Constraint)) or isinstance(data,
176-
pycarl.gmp.formula.Constraint):
173+
elif (has_cln and isinstance(data, pycarl.cln.formula.Constraint)) or isinstance(data, pycarl.gmp.formula.Constraint):
177174
return convert_constraint(data)
178-
elif (has_cln and isinstance(data, pycarl.cln.formula.Formula)) or isinstance(data,
179-
pycarl.gmp.formula.Formula):
180-
175+
elif (has_cln and isinstance(data, pycarl.cln.formula.Formula)) or isinstance(data, pycarl.gmp.formula.Formula):
181176
return convert_formula(data)
182177

183178
else:

lib/pycarl/gmp/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ def denominator(x):
1515
else:
1616
return 1
1717

18+
1819
def expand(x):
1920
if type(x) == gmp.FactorizedRationalFunction:
2021
return x.rational_function()
2122
if type(x) == gmp.FactorizedPolynomial:
2223
return x.polynomial()
2324
return x
2425

26+
2527
factorization_cache = gmp._FactorizationCache()
2628

2729

0 commit comments

Comments
 (0)