Skip to content

Commit

Permalink
adodbapi: improve module docstrings, top-of-file comments and version…
Browse files Browse the repository at this point in the history
… infos
  • Loading branch information
Avasam committed Oct 4, 2024
1 parent 842fbef commit 4cf15f9
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 54 deletions.
5 changes: 2 additions & 3 deletions adodbapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
threadsafety as threadsafety,
)

version = "adodbapi v" + __version__


def Binary(aString):
"""This function constructs an object capable of holding a binary (long) string value."""
Expand Down Expand Up @@ -76,6 +78,3 @@ def TimestampFromTicks(ticks):
ticks value (number of seconds since the epoch;
see the documentation of the standard Python time module for details)."""
return Timestamp(*time.gmtime(ticks)[:6])


version = "adodbapi v" + __version__
4 changes: 2 additions & 2 deletions adodbapi/ado_consts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ADO enumerated constants documented on MSDN:
# http://msdn.microsoft.com/en-us/library/ms678353(VS.85).aspx
"""ADO enumerated constants documented on MSDN: \
http://msdn.microsoft.com/en-us/library/ms678353(VS.85).aspx"""

# IsolationLevelEnum
adXactUnspecified = -1
Expand Down
2 changes: 1 addition & 1 deletion adodbapi/apibase.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""adodbapi.apibase - A python DB API 2.0 (PEP 249) interface to Microsoft ADO
"""adodbapi - A python DB API 2.0 (PEP 249) interface to Microsoft ADO
Copyright (C) 2002 Henrik Ekelund, version 2.1 by Vernon Cole
* http://sourceforge.net/projects/pywin32
Expand Down
2 changes: 1 addition & 1 deletion adodbapi/examples/db_print.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" db_print.py -- a simple demo for ADO database reads."""
"""a simple demo for ADO database reads."""

import sys

Expand Down
2 changes: 1 addition & 1 deletion adodbapi/examples/db_table_names.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" db_table_names.py -- a simple demo for ADO database table listing."""
"""a simple demo for ADO database table listing."""

import sys

Expand Down
4 changes: 2 additions & 2 deletions adodbapi/is64bit.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""is64bit.Python() --> boolean value of detected Python word size. is64bit.os() --> os build version"""

import sys


def Python():
"""boolean value of detected Python word size."""
return sys.maxsize > 2147483647


def os():
"""os build version"""
import platform

pm = platform.machine()
Expand Down
2 changes: 1 addition & 1 deletion adodbapi/process_connect_string.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" a clumsy attempt at a macro language to let the programmer execute code on the server (ex: determine 64bit)"""
"""a clumsy attempt at a macro language to let the programmer execute code on the server (ex: determine 64bit)"""

from . import is64bit

Expand Down
3 changes: 1 addition & 2 deletions adodbapi/schema_table.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""call using an open ADO connection --> list of table names"""

from . import adodbapi


def names(connection_object):
"""call using an open ADO connection --> list of table names"""
ado = connection_object.adoConn
schema = ado.OpenSchema(20) # constant = adSchemaTables

Expand Down
8 changes: 3 additions & 5 deletions adodbapi/setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
"""adodbapi -- a pure Python PEP 249 DB-API package using Microsoft ADO
"""adodbapi - a pure Python PEP 249 DB-API package using Microsoft ADO
Adodbapi can be run on CPython 3.5 and later.
Adodbapi can be run on CPython 3.7 and later.
"""

NAME = "adodbapi"
MAINTAINER = "Vernon Cole"
MAINTAINER_EMAIL = "[email protected]"
DESCRIPTION = (
"""A pure Python package implementing PEP 249 DB-API using Microsoft ADO."""
)
DESCRIPTION = "A pure Python package implementing PEP 249 DB-API using Microsoft ADO."
URL = "http://sourceforge.net/projects/adodbapi"
LICENSE = "LGPL"
CLASSIFIERS = [
Expand Down
39 changes: 21 additions & 18 deletions adodbapi/test/adodbapitest.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
""" Unit tests version 2.6.1.0 for adodbapi"""
"""\
Unit tests for adodbapi
-----------------------
"""
adodbapi - A python DB API 2.0 interface to Microsoft ADO
adodbapi - A python DB API 2.0 interface to Microsoft ADO
Copyright (C) 2002 Henrik Ekelund
Copyright (C) 2002 Henrik Ekelund
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Updates by Vernon Cole
Updates by Vernon Cole
"""

__version__ = "2.6.1.0"

import copy
import datetime
import decimal
Expand Down Expand Up @@ -1584,8 +1587,8 @@ def __exit__(self, exc_type, exc_val, exc_tb):
mysuite = copy.deepcopy(suite)
with cleanup_manager():
defaultDateConverter = adodbapi.dateconverter
print(__doc__)
print("Default Date Converter is %s" % (defaultDateConverter,))
print(str(__doc__).split("\n")[0], "version", __version__)
print(f"Default Date Converter is {defaultDateConverter}")
dateconverter = defaultDateConverter
unittest.TextTestRunner().run(mysuite)

Expand Down
12 changes: 8 additions & 4 deletions adodbapi/test/adodbapitestconfig.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Configure this to _YOUR_ environment in order to run the testcases.
"testADOdbapiConfig.py v 2.6.2.B00"
"""Configure this to _YOUR_ environment in order to run the testcases."""

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
Expand All @@ -14,11 +13,15 @@
import platform
import random
import sys
from pathlib import Path

import is64bit
import setuptestframework
import tryconnection

__version__ = "2.6.2.B00"
version = f"{Path(__file__).name} v{__version__}"

print("\nPython", sys.version)
node = platform.node()
try:
Expand Down Expand Up @@ -70,8 +73,9 @@

import adodbapi # will (hopefully) be imported using the "pth" discovered above

print(adodbapi.version) # show version
print(__doc__)
# show versions
print(adodbapi.version)
print(version)

verbose = False
for a in sys.argv:
Expand Down
14 changes: 7 additions & 7 deletions adodbapi/test/dbapi20.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python
""" Python DB API 2.0 driver compliance unit test suite.
"""Python DB API 2.0 driver compliance unit test suite.
This software is Public Domain and may be used without restrictions.
This software is Public Domain and may be used without restrictions.
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time I read the subject line with 'Anal Compliance' in it. All around
this is turning out to be a thoroughly unwholesome unit test."
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time I read the subject line with 'Anal Compliance' in it. All around
this is turning out to be a thoroughly unwholesome unit test."
-- Ian Bicking
-- Ian Bicking
"""

__version__ = "$Revision: 1.15.0 $"[11:-2]
Expand Down
4 changes: 2 additions & 2 deletions adodbapi/test/is64bit.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""is64bit.Python() --> boolean value of detected Python word size. is64bit.os() --> os build version"""

import sys


def Python():
"""boolean value of detected Python word size."""
return sys.maxsize > 2147483647


def os():
"""os build version"""
import platform

pm = platform.machine()
Expand Down
8 changes: 5 additions & 3 deletions adodbapi/test/setuptestframework.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/python2
# Configure this in order to run the testcases.
"setuptestframework.py v 2.6.0.8"
#!/usr/bin/env python
"""Configure this in order to run the testcases."""

import os
import shutil
import tempfile

__version__ = "2.6.0.8"


def maketemp():
temphome = tempfile.gettempdir()
Expand Down
6 changes: 4 additions & 2 deletions adodbapi/test/test_adodbapi_dbapi20.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
print("This module depends on the dbapi20 compliance tests created by Stuart Bishop")
print("(see db-sig mailing list history for info)")
"""This module depends on the dbapi20 compliance tests created by Stuart Bishop
(see db-sig mailing list history for info)"""

print(__doc__)
import platform
import sys
import unittest
Expand Down

0 comments on commit 4cf15f9

Please sign in to comment.