Skip to content

Commit 31cac38

Browse files
Black is now used to format Python code and ruff to lint Python code.
1 parent 46177b1 commit 31cac38

File tree

200 files changed

+11410
-7482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+11410
-7482
lines changed

.pre-commit-config.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- repo: https://github.com/psf/black-pre-commit-mirror
10+
rev: 23.9.1
11+
hooks:
12+
- id: black
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.0.291
15+
hooks:
16+
- id: ruff

README.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ Please see the python-oracledb home page for links to documentation,
22
installation instructions, and source code:
33

44
https://oracle.github.io/python-oracledb/index.html
5-

THIRD_PARTY_LICENSES.txt

-1
Original file line numberDiff line numberDiff line change
@@ -453,4 +453,3 @@ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
453453
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
454454
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
455455
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
456-

doc/src/_ext/oracle_deprecated.py

+20-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#------------------------------------------------------------------------------
2-
# Copyright (c) 2022, Oracle and/or its affiliates.
1+
# -----------------------------------------------------------------------------
2+
# Copyright (c) 2022, 2023, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -20,20 +20,21 @@
2020
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2121
# See the License for the specific language governing permissions and
2222
# limitations under the License.
23-
#------------------------------------------------------------------------------
23+
# -----------------------------------------------------------------------------
2424

25-
#------------------------------------------------------------------------------
25+
# -----------------------------------------------------------------------------
2626
# oracle_deprecated.py
2727
#
28-
# Overrides the 'deprecated' directive so that it can a componment name can be
29-
# used in conjunction with the version.
30-
#------------------------------------------------------------------------------
28+
# Overrides the 'deprecated' directive so that a componment name can be used in
29+
# conjunction with the version.
30+
# -----------------------------------------------------------------------------
3131

3232

3333
from docutils import nodes
3434
from docutils.parsers.rst import Directive
3535
from sphinx import addnodes
3636

37+
3738
class DriverDeprecated(Directive):
3839
has_content = True
3940
required_arguments = 1
@@ -43,22 +44,22 @@ class DriverDeprecated(Directive):
4344
def run(self):
4445
node = addnodes.versionmodified()
4546
node.document = self.state.document
46-
node['type'] = self.name
47-
node['version'] = self.arguments[0]
48-
text = 'Deprecated since {}.'.format(self.arguments[0])
49-
classes = ['versionmodified', 'deprecated']
50-
para = nodes.paragraph('', '',
51-
nodes.inline('', text, classes=classes),
52-
translatable=False)
47+
node["type"] = self.name
48+
node["version"] = self.arguments[0]
49+
text = "Deprecated since {}.".format(self.arguments[0])
50+
classes = ["versionmodified", "deprecated"]
51+
para = nodes.paragraph(
52+
"", "", nodes.inline("", text, classes=classes), translatable=False
53+
)
5354
node.append(para)
54-
ret: List[Node] = [node]
55-
return ret
55+
return [node]
56+
5657

5758
def setup(app):
5859
app.add_directive("deprecated", DriverDeprecated, override=True)
5960

6061
return {
61-
'version': '0.1',
62-
'parallel_read_safe': True,
63-
'parallel_write_safe': True,
62+
"version": "0.1",
63+
"parallel_read_safe": True,
64+
"parallel_write_safe": True,
6465
}

doc/src/_ext/table_with_summary.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#------------------------------------------------------------------------------
1+
# -----------------------------------------------------------------------------
22
# Copyright (c) 2022, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
@@ -20,59 +20,59 @@
2020
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2121
# See the License for the specific language governing permissions and
2222
# limitations under the License.
23-
#------------------------------------------------------------------------------
23+
# -----------------------------------------------------------------------------
2424

25-
#------------------------------------------------------------------------------
25+
# -----------------------------------------------------------------------------
2626
# table_with_summary.py
2727
#
2828
# Defines a directive (list-table-with-summary) that adds support for a summary
2929
# option on top of the regular "list-table" directive.
30-
#------------------------------------------------------------------------------
30+
# -----------------------------------------------------------------------------
3131

3232
import sphinx
3333
from docutils.parsers.rst import directives
3434
from docutils.parsers.rst.directives import tables
3535

3636
from packaging import version
3737

38-
class ListTableWithSummary(tables.ListTable):
3938

40-
option_spec = {'summary': directives.unchanged}
39+
class ListTableWithSummary(tables.ListTable):
40+
option_spec = {"summary": directives.unchanged}
4141
option_spec.update(tables.ListTable.option_spec)
4242

4343
def run(self):
4444
result = super().run()
45-
summary = self.options.get('summary')
45+
summary = self.options.get("summary")
4646
if summary:
4747
table_node = result[0]
4848
table_node["summary"] = summary
4949
return result
5050

5151

5252
class HTMLTranslator(sphinx.writers.html5.HTML5Translator):
53-
5453
def visit_table(self, node):
55-
if version.parse(sphinx.__version__) > version.parse('4.2.0'):
54+
if version.parse(sphinx.__version__) > version.parse("4.2.0"):
5655
self._table_row_indices = [0]
5756
else:
5857
self._table_row_index = 0
5958

6059
atts = {}
61-
classes = [cls.strip(' \t\n') \
62-
for cls in self.settings.table_style.split(',')]
60+
classes = [
61+
cls.strip(" \t\n") for cls in self.settings.table_style.split(",")
62+
]
6363
classes.insert(0, "docutils") # compat
6464

6565
# set align-default if align not specified to give a default style
66-
classes.append('align-%s' % node.get('align', 'default'))
66+
classes.append("align-%s" % node.get("align", "default"))
6767

68-
if 'width' in node:
69-
atts['style'] = 'width: %s' % node['width']
70-
if 'summary' in node:
71-
atts['summary'] = node['summary']
72-
tag = self.starttag(node, 'table', CLASS=' '.join(classes), **atts)
68+
if "width" in node:
69+
atts["style"] = "width: %s" % node["width"]
70+
if "summary" in node:
71+
atts["summary"] = node["summary"]
72+
tag = self.starttag(node, "table", CLASS=" ".join(classes), **atts)
7373
self.body.append(tag)
7474

7575

7676
def setup(app):
77-
app.add_directive('list-table-with-summary', ListTableWithSummary)
77+
app.add_directive("list-table-with-summary", ListTableWithSummary)
7878
app.set_translator("html", HTMLTranslator, override=True)

doc/src/conf.py

+44-35
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
#
33
# python-oracledb documentation build configuration file
44
#
5-
# This file is execfile()d with the current directory set to its containing dir.
5+
# This file is execfile()d with the current directory set to its containing dir
66
#
77
# The contents of this file are pickled, so don't put values in the namespace
8-
# that aren't pickleable (module imports are okay, they're removed automatically).
8+
# that aren't pickleable (module imports are okay, they're removed
9+
# automatically).
910
#
1011
# All configuration values have a default value; values that are commented out
1112
# serve to show the default value.
@@ -19,23 +20,28 @@
1920
# General configuration
2021
# ---------------------
2122

22-
# Add any Sphinx extension module names here, as strings. They can be extensions
23-
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
24-
extensions = ["table_with_summary", "oracle_deprecated", 'sphinx_rtd_theme']
23+
# Add any Sphinx extension module names here, as strings. They can be
24+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
25+
extensions = ["table_with_summary", "oracle_deprecated", "sphinx_rtd_theme"]
2526

2627
# Add any paths that contain templates here, relative to this directory.
27-
templates_path = ['.templates']
28+
templates_path = [".templates"]
2829

2930
# The suffix of source filenames.
30-
source_suffix = '.rst'
31+
source_suffix = ".rst"
3132

3233
# The root toctree document.
33-
root_doc = master_doc = 'index'
34+
root_doc = master_doc = "index"
3435

3536
# General substitutions.
36-
project = 'python-oracledb'
37-
copyright = u'2016, 2023, Oracle and/or its affiliates. All rights reserved. Portions Copyright © 2007-2015, Anthony Tuininga. All rights reserved. Portions Copyright © 2001-2007, Computronix (Canada) Ltd., Edmonton, Alberta, Canada. All rights reserved'
38-
author = 'Oracle'
37+
project = "python-oracledb"
38+
copyright = (
39+
"2016, 2023, Oracle and/or its affiliates. All rights reserved. "
40+
"Portions Copyright © 2007-2015, Anthony Tuininga. All rights reserved. "
41+
"Portions Copyright © 2001-2007, Computronix (Canada) Ltd., "
42+
"Edmonton, Alberta, Canada. All rights reserved"
43+
)
44+
author = "Oracle"
3945

4046
# The default replacements for |version| and |release|, also used in various
4147
# other places throughout the built documents.
@@ -56,26 +62,26 @@
5662

5763
# There are two options for replacing |today|: either, you set today to some
5864
# non-false value, then it is used:
59-
#today = ''
65+
# today = ''
6066
# Else, today_fmt is used as the format for a strftime call.
61-
today_fmt = '%B %d, %Y'
67+
today_fmt = "%B %d, %Y"
6268

6369
# List of documents that shouldn't be included in the build.
64-
#unused_docs = []
70+
# unused_docs = []
6571

6672
# If true, '()' will be appended to :func: etc. cross-reference text.
67-
#add_function_parentheses = True
73+
# add_function_parentheses = True
6874

6975
# If true, the current module name will be prepended to all description
7076
# unit titles (such as .. function::).
71-
#add_module_names = True
77+
# add_module_names = True
7278

7379
# If true, sectionauthor and moduleauthor directives will be shown in the
7480
# output. They are ignored by default.
75-
#show_authors = False
81+
# show_authors = False
7682

7783
# The name of the Pygments (syntax highlighting) style to use.
78-
pygments_style = 'sphinx'
84+
pygments_style = "sphinx"
7985

8086

8187
# Options for HTML output
@@ -87,64 +93,67 @@
8793
# html_style = 'default.css'
8894

8995
# The theme to use for readthedocs.
90-
html_theme = 'sphinx_rtd_theme'
96+
html_theme = "sphinx_rtd_theme"
9197

9298
# Add any paths that contain custom static files (such as style sheets) here,
9399
# relative to this directory. They are copied after the builtin static files,
94100
# so a file named "default.css" will overwrite the builtin "default.css".
95-
html_static_path = ['.static']
101+
html_static_path = [".static"]
96102

97103
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
98104
# using the given strftime format.
99-
html_last_updated_fmt = '%b %d, %Y'
105+
html_last_updated_fmt = "%b %d, %Y"
100106

101107
# If true, SmartyPants will be used to convert quotes and dashes to
102108
# typographically correct entities.
103-
#html_use_smartypants = True
109+
# html_use_smartypants = True
104110

105111
# Content template for the index page.
106-
#html_index = ''
112+
# html_index = ''
107113

108114
# Custom sidebar templates, maps document names to template names.
109-
#html_sidebars = {}
115+
# html_sidebars = {}
110116

111117
# Additional templates that should be rendered to pages, maps page names to
112118
# template names.
113-
#html_additional_pages = {}
119+
# html_additional_pages = {}
114120

115121
# If false, no module index is generated.
116-
#html_use_modindex = True
122+
# html_use_modindex = True
117123

118124
# If true, the reST sources are included in the HTML build as _sources/<name>.
119125
html_copy_source = False
120126

121127
# Output file base name for HTML help builder.
122-
htmlhelp_basename = 'oracledbdoc'
128+
htmlhelp_basename = "oracledbdoc"
123129

124130
numfig = True
125131

132+
126133
# Display tables with no horizontal scrollbar
127134
def setup(app):
128-
app.add_css_file('custom.css')
135+
app.add_css_file("custom.css")
136+
129137

130138
# Options for LaTeX output
131139
# ------------------------
132140

133141
# The paper size ('letter' or 'a4').
134-
#latex_paper_size = 'letter'
142+
# latex_paper_size = 'letter'
135143

136144
# The font size ('10pt', '11pt' or '12pt').
137-
#latex_font_size = '10pt'
145+
# latex_font_size = '10pt'
138146

139147
# Grouping the document tree into LaTeX files. List of tuples
140-
# (source start file, target name, title, author, document class [howto/manual]).
141-
#latex_documents = []
148+
# (source start file, target name, title, author, document class
149+
# [howto/manual]).
150+
# latex_documents = []
142151

143152
# Additional stuff for the LaTeX preamble.
144-
#latex_preamble = ''
153+
# latex_preamble = ''
145154

146155
# Documents to append as an appendix to all manuals.
147-
#latex_appendices = []
156+
# latex_appendices = []
148157

149158
# If false, no module index is generated.
150-
#latex_use_modindex = True
159+
# latex_use_modindex = True

doc/src/release_notes.rst

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Common Changes
3636
Client 23c is also required.
3737
#) Added support for parsing the ``FAILOVER`` clause in full connect
3838
descriptors.
39+
#) Black is now used to format Python code and ruff to lint Python code.
3940

4041

4142
oracledb 1.4.1 (September 2023)

pyproject.toml

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
[build-system]
22
requires = ["setuptools >= 40.6.0", "wheel", "cython"]
33
build-backend = "setuptools.build_meta"
4+
5+
[tool.black]
6+
line-length = 79
7+
target-version = ["py37", "py38", "py39", "py310", "py311", "py312"]
8+
required-version = 23
9+
10+
[tool.ruff]
11+
line-length = 79
12+
target-version = "py38"
13+
exclude = ["templates"]

0 commit comments

Comments
 (0)