Final work on adjusting attribute, method and parameter names to be

consistent and to comply with PEP 8 naming guidelines.
This commit is contained in:
Anthony Tuininga 2021-04-23 16:08:25 -06:00
parent 96f938286d
commit 8c99d1ddde
8 changed files with 90 additions and 17 deletions

View File

@ -48,6 +48,8 @@ if applicable. The most recent deprecations are listed first.
- Replace with parameter name `session_callback`
* - `maxSessionsPerShard` parameter to :meth:`cx_Oracle.SessionPool()`
- Replace with parameter name `max_sessions_per_shard`
* - `SessionPool.tnsentry`
- Replace with :data:`SessionPool.dsn`
* - `payloadType` parameter to :meth:`Connection.queue()`
- Replace with parameter name `payload_type` if using keyword parameters.
* - `ipAddress` parameter to :meth:`Connection.subscribe()`
@ -72,6 +74,8 @@ if applicable. The most recent deprecations are listed first.
- Replace with parameter name `encoding_errors`
* - `Cursor.fetchraw()`
- Replace with :meth:`Cursor.fetchmany()`
* - `newSize` parameter to :meth:`LOB.trim()`
- Replace with parameter name `new_size`
* - `Queue.deqMany`
- Replace with :meth:`Queue.deqmany()`
* - `Queue.deqOne`
@ -86,6 +90,18 @@ if applicable. The most recent deprecations are listed first.
- Replace with :meth:`Queue.enqoptions`
* - `Queue.payloadType`
- Replace with :meth:`Queue.payload_type`
* - `Subscription.ipAddress`
- Replace with :attr:`Subscription.ip_address`
* - `Message.consumerName`
- Replace with :attr:`Message.consumer_name`
* - `Message.queueName`
- Replace with :attr:`Message.queue_name`
* - `Variable.actualElements`
- Replace with :attr:`Variable.actual_elements`
* - `Variable.bufferSize`
- Replace with :attr:`Variable.buffer_size`
* - `Variable.numElements`
- Replace with :attr:`Variable.num_elements`
.. list-table:: Deprecated in 8.0

View File

@ -74,7 +74,7 @@ See :ref:`lobdata` for more information about using LOBs.
for all but supplemental characters.
.. method:: LOB.trim([newSize=0])
.. method:: LOB.trim(new_size=0)
Trim the LOB to the new size.
@ -87,7 +87,7 @@ See :ref:`lobdata` for more information about using LOBs.
.. versionadded:: 8.0
.. method:: LOB.write(data, [offset=1])
.. method:: LOB.write(data, offset=1)
Write the data to the LOB object at the given offset. The offset is in
bytes for BLOB type LOBs and in UCS-2 code points for CLOB and NCLOB type

View File

@ -185,6 +185,10 @@ SessionPool Object
This read-only attribute returns the TNS entry of the database to which a
connection has been established.
.. deprecated:: 8.2
Use the attribute :attr:`~SessionPool.dsn` instead.
.. attribute:: SessionPool.username

View File

@ -29,7 +29,7 @@ Subscription Object
subscriptions, the value is 0.
.. attribute:: Subscription.ipAddress
.. attribute:: Subscription.ip_address
This read-only attribute returns the IP address used for callback
notifications from the database server. If not set during construction,
@ -37,6 +37,12 @@ Subscription Object
.. versionadded:: 6.4
.. versionchanged:: 8.2
For consistency and compliance with the PEP 8 naming style, the
attribute `ipAddress` was renamed to `ip_address`. The old name will
continue to work for a period of time.
.. attribute:: Subscription.name
@ -106,7 +112,7 @@ Message Objects
to the callback procedure specified when a subscription is created.
.. attribute:: Message.consumerName
.. attribute:: Message.consumer_name
This read-only attribute returns the name of the consumer which generated
the notification. It will be populated if the subscription was created with
@ -115,6 +121,12 @@ Message Objects
.. versionadded:: 6.4
.. versionchanged:: 8.2
For consistency and compliance with the PEP 8 naming style, the
attribute `consumerName` was renamed to `consumer_name`. The old name
will continue to work for a period of time.
.. attribute:: Message.dbname
@ -130,7 +142,7 @@ Message Objects
:data:`~cx_Oracle.SUBSCR_QOS_QUERY` when the subscription was created.
.. attribute:: Message.queueName
.. attribute:: Message.queue_name
This read-only attribute returns the name of the queue which generated the
notification. It will only be populated if the subscription was created
@ -138,6 +150,12 @@ Message Objects
.. versionadded:: 6.4
.. versionchanged:: 8.2
For consistency and compliance with the PEP 8 naming style, the
attribute `queueName` was renamed to `queue_name`. The old name will
continue to work for a period of time.
.. attribute:: Message.registered

View File

@ -9,7 +9,7 @@ Variable Objects
The DB API definition does not define this object.
.. attribute:: Variable.actualElements
.. attribute:: Variable.actual_elements
This read-only attribute returns the actual number of elements in the
variable. This corresponds to the number of elements in a PL/SQL index-by
@ -17,11 +17,24 @@ Variable Objects
:func:`Cursor.arrayvar()`. For all other variables this value will be
identical to the attribute :attr:`~Variable.numElements`.
.. attribute:: Variable.bufferSize
.. versionchanged:: 8.2
For consistency and compliance with the PEP 8 naming style, the
attribute `actualElements` was renamed to `actual_elements`. The old
name will continue to work for a period of time.
.. attribute:: Variable.buffer_size
This read-only attribute returns the size of the buffer allocated for each
element in bytes.
.. versionchanged:: 8.2
For consistency and compliance with the PEP 8 naming style, the
attribute `bufferSize` was renamed to `buffer_size`. The old
name will continue to work for a period of time.
.. method:: Variable.getvalue([pos=0])
@ -41,12 +54,18 @@ Variable Objects
attribute is None, the value is bound directly without any conversion.
.. attribute:: Variable.numElements
.. attribute:: Variable.num_elements
This read-only attribute returns the number of elements allocated in an
array, or the number of scalar items that can be fetched into the variable
or bound to the variable.
.. versionchanged:: 8.2
For consistency and compliance with the PEP 8 naming style, the
attribute `numElements` was renamed to `num_elements`. The old
name will continue to work for a period of time.
.. attribute:: Variable.outconverter

View File

@ -236,14 +236,22 @@ static PyObject *cxoLob_write(cxoLob *lob, PyObject *args,
static PyObject *cxoLob_trim(cxoLob *lob, PyObject *args,
PyObject *keywordArgs)
{
static char *keywordList[] = { "newSize", NULL };
unsigned PY_LONG_LONG newSize;
static char *keywordList[] = { "new_size", "newSize", NULL };
unsigned PY_LONG_LONG newSize, newSizeDeprecated;
int status;
newSize = 0;
if (!PyArg_ParseTupleAndKeywords(args, keywordArgs, "|K", keywordList,
&newSize))
newSize = newSizeDeprecated = 0;
if (!PyArg_ParseTupleAndKeywords(args, keywordArgs, "|KK", keywordList,
&newSize, &newSizeDeprecated))
return NULL;
if (newSizeDeprecated > 0) {
if (newSize > 0) {
cxoError_raiseFromString(cxoProgrammingErrorException,
"new_size and newSize cannot both be specified");
return NULL;
}
newSize = newSizeDeprecated;
}
Py_BEGIN_ALLOW_THREADS
status = dpiLob_trim(lob->handle, (uint64_t) newSize);
Py_END_ALLOW_THREADS

View File

@ -416,12 +416,14 @@ static PyMemberDef cxoSubscrTypeMembers[] = {
{ "namespace", T_UINT, offsetof(cxoSubscr, namespace), READONLY },
{ "name", T_OBJECT, offsetof(cxoSubscr, name), READONLY },
{ "protocol", T_UINT, offsetof(cxoSubscr, protocol), READONLY },
{ "ipAddress", T_OBJECT, offsetof(cxoSubscr, ipAddress), READONLY },
{ "ip_address", T_OBJECT, offsetof(cxoSubscr, ipAddress), READONLY },
{ "port", T_UINT, offsetof(cxoSubscr, port), READONLY },
{ "timeout", T_UINT, offsetof(cxoSubscr, timeout), READONLY },
{ "operations", T_UINT, offsetof(cxoSubscr, operations), READONLY },
{ "qos", T_UINT, offsetof(cxoSubscr, qos), READONLY },
{ "id", T_ULONG, offsetof(cxoSubscr, id), READONLY },
// deprecated
{ "ipAddress", T_OBJECT, offsetof(cxoSubscr, ipAddress), READONLY },
{ NULL }
};
@ -433,9 +435,13 @@ static PyMemberDef cxoMessageTypeMembers[] = {
{ "txid", T_OBJECT, offsetof(cxoMessage, txId), READONLY },
{ "tables", T_OBJECT, offsetof(cxoMessage, tables), READONLY },
{ "queries", T_OBJECT, offsetof(cxoMessage, queries), READONLY },
{ "queue_name", T_OBJECT, offsetof(cxoMessage, queueName), READONLY },
{ "consumer_name", T_OBJECT, offsetof(cxoMessage, consumerName),
READONLY },
{ "registered", T_BOOL, offsetof(cxoMessage, registered), READONLY },
// deprecated
{ "queueName", T_OBJECT, offsetof(cxoMessage, queueName), READONLY },
{ "consumerName", T_OBJECT, offsetof(cxoMessage, consumerName), READONLY },
{ "registered", T_BOOL, offsetof(cxoMessage, registered), READONLY },
{ NULL }
};

View File

@ -722,10 +722,11 @@ static PyObject *cxoVar_repr(cxoVar *var)
// declaration of members
//-----------------------------------------------------------------------------
static PyMemberDef cxoMembers[] = {
{ "buffer_size", T_INT, offsetof(cxoVar, bufferSize), READONLY },
{ "bufferSize", T_INT, offsetof(cxoVar, bufferSize), READONLY },
{ "inconverter", T_OBJECT, offsetof(cxoVar, inConverter), 0 },
{ "numElements", T_INT, offsetof(cxoVar, allocatedElements),
READONLY },
{ "numElements", T_INT, offsetof(cxoVar, allocatedElements), READONLY },
{ "num_elements", T_INT, offsetof(cxoVar, allocatedElements), READONLY },
{ "outconverter", T_OBJECT, offsetof(cxoVar, outConverter), 0 },
{ "size", T_INT, offsetof(cxoVar, size), READONLY },
{ NULL }
@ -736,6 +737,7 @@ static PyMemberDef cxoMembers[] = {
// declaration of calculated members
//-----------------------------------------------------------------------------
static PyGetSetDef cxoCalcMembers[] = {
{ "actual_elements", (getter) cxoVar_externalGetActualElements, 0, 0, 0 },
{ "actualElements", (getter) cxoVar_externalGetActualElements, 0, 0, 0 },
{ "type", (getter) cxoVar_getType, 0, 0, 0 },
{ "values", (getter) cxoVar_externalGetValues, 0, 0, 0 },