Skip to content

Commit 8ea16b1

Browse files
Tweak formatting to comply with PEP 8 and remove extraneous comments.
1 parent c92d251 commit 8ea16b1

5 files changed

Lines changed: 40 additions & 46 deletions

File tree

samples/DatabaseShutdown.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323

2424
# first shutdown() call must specify the mode, if DBSHUTDOWN_ABORT is used,
2525
# there is no need for any of the other steps
26-
connection.shutdown(mode = cx_Oracle.DBSHUTDOWN_IMMEDIATE)
26+
connection.shutdown(mode=cx_Oracle.DBSHUTDOWN_IMMEDIATE)
2727

2828
# now close and dismount the database
2929
cursor = connection.cursor()
3030
cursor.execute("alter database close normal")
3131
cursor.execute("alter database dismount")
3232

3333
# perform the final shutdown call
34-
connection.shutdown(mode = cx_Oracle.DBSHUTDOWN_FINAL)
34+
connection.shutdown(mode=cx_Oracle.DBSHUTDOWN_FINAL)

samples/Query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
print("Fetch many rows")
3636
cursor.execute(sql)
37-
res = cursor.fetchmany(numRows=3)
37+
res = cursor.fetchmany(3)
3838
print(res)
3939
print()
4040

samples/Subclassing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#------------------------------------------------------------------------------
66
# Subclassing.py
77
#
8-
# Demonstrate how to subclass cx_Oracle connections and cursors in order to
8+
# Demonstrate how to subclass cx_Oracle connections and cursors in order to
99
# add additional functionality (like logging) or create specialized interfaces
1010
# for paticular applications.
1111
#------------------------------------------------------------------------------

samples/TypeHandlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def building_out_converter(obj):
5252

5353
def input_type_handler(cursor, value, numElements):
5454
if isinstance(value, Building):
55-
return cursor.var(cx_Oracle.OBJECT, arraysize = numElements,
56-
inconverter = building_in_converter, typename = obj_type.name)
55+
return cursor.var(cx_Oracle.OBJECT, arraysize=numElements,
56+
inconverter=building_in_converter, typename=obj_type.name)
5757

5858
def output_type_handler(cursor, name, default_type, size, precision, scale):
5959
if default_type == cx_Oracle.OBJECT:

setup.py

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
"""Setup script for cx_Oracle.
2-
3-
Windows platforms:
4-
python setup.py build --compiler=mingw32 install
5-
6-
Unix platforms
7-
python setup.py build install
8-
1+
"""
2+
Setup script for cx_Oracle.
93
"""
104

115
import os
@@ -25,58 +19,58 @@
2519
BUILD_VERSION = "8.2.0-dev"
2620

2721
# setup extra link and compile args
28-
extraLinkArgs = []
29-
extraCompileArgs = []
22+
extra_link_args = []
23+
extra_compile_args = []
3024
if sys.platform == "aix4":
31-
extraCompileArgs.append("-qcpluscmt")
25+
extra_compile_args.append("-qcpluscmt")
3226
elif sys.platform == "aix5":
33-
extraCompileArgs.append("-DAIX5")
27+
extra_compile_args.append("-DAIX5")
3428
elif sys.platform == "cygwin":
35-
extraLinkArgs.append("-Wl,--enable-runtime-pseudo-reloc")
29+
extra_link_args.append("-Wl,--enable-runtime-pseudo-reloc")
3630
elif sys.platform == "darwin":
37-
extraLinkArgs.append("-shared-libgcc")
31+
extra_link_args.append("-shared-libgcc")
3832

3933
# define cx_Oracle sources
40-
sourceDir = "src"
41-
sources = [os.path.join(sourceDir, n) \
42-
for n in sorted(os.listdir(sourceDir)) if n.endswith(".c")]
34+
source_dir = "src"
35+
sources = [os.path.join(source_dir, n) \
36+
for n in sorted(os.listdir(source_dir)) if n.endswith(".c")]
4337
depends = ["src/cxoModule.h"]
4438

4539
# define ODPI-C sources, libraries and include directories; if the environment
4640
# variables ODPIC_INC_DIR and ODPIC_LIB_DIR are both set, assume these
4741
# locations contain a compiled installation of ODPI-C; otherwise, use the
4842
# source of ODPI-C found in the odpi subdirectory
49-
dpiIncludeDir = os.environ.get("ODPIC_INC_DIR")
50-
dpiLibDir = os.environ.get("ODPIC_LIB_DIR")
51-
if dpiIncludeDir and dpiLibDir:
52-
dpiSources = []
53-
includeDirs = [dpiIncludeDir]
43+
dpi_include_dir = os.environ.get("ODPIC_INC_DIR")
44+
dpi_lib_dir = os.environ.get("ODPIC_LIB_DIR")
45+
if dpi_include_dir and dpi_lib_dir:
46+
dpi_sources = []
47+
include_dirs = [dpi_include_dir]
5448
libraries = ["odpic"]
55-
libraryDirs = [dpiLibDir]
49+
library_dirs = [dpi_lib_dir]
5650
else:
57-
includeDirs = ["odpi/include", "odpi/src"]
58-
dpiSourceDir = os.path.join("odpi", "src")
59-
dpiSources = [os.path.join(dpiSourceDir, n) \
60-
for n in sorted(os.listdir(dpiSourceDir)) if n.endswith(".c")]
51+
include_dirs = ["odpi/include", "odpi/src"]
52+
dpi_source_dir = os.path.join("odpi", "src")
53+
dpi_sources = [os.path.join(dpi_source_dir, n) \
54+
for n in sorted(os.listdir(dpi_source_dir)) if n.endswith(".c")]
6155
depends.extend(["odpi/include/dpi.h", "odpi/src/dpiImpl.h",
6256
"odpi/src/dpiErrorMessages.h"])
6357
libraries = []
64-
libraryDirs = []
58+
library_dirs = []
6559

6660
# setup the extension
6761
extension = setuptools.Extension(
68-
name = "cx_Oracle",
69-
include_dirs = includeDirs,
70-
extra_compile_args = extraCompileArgs,
71-
define_macros = [("CXO_BUILD_VERSION", BUILD_VERSION)],
72-
extra_link_args = extraLinkArgs,
73-
sources = sources + dpiSources,
74-
depends = depends,
75-
libraries = libraries,
76-
library_dirs = libraryDirs)
62+
name="cx_Oracle",
63+
include_dirs=include_dirs,
64+
extra_compile_args=extra_compile_args,
65+
define_macros=[("CXO_BUILD_VERSION", BUILD_VERSION)],
66+
extra_link_args=extra_link_args,
67+
sources=sources + dpi_sources,
68+
depends=depends,
69+
libraries=libraries,
70+
library_dirs=library_dirs)
7771

7872
# perform the setup
7973
setuptools.setup(
80-
version = BUILD_VERSION,
81-
data_files = [ ("cx_Oracle-doc", ["LICENSE.txt", "README.txt"]) ],
82-
ext_modules = [extension])
74+
version=BUILD_VERSION,
75+
data_files=[ ("cx_Oracle-doc", ["LICENSE.txt", "README.txt"]) ],
76+
ext_modules=[extension])

0 commit comments

Comments
 (0)