mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-29 12:23:42 +03:00
Dropped simple type wrapper functions
These functions don't need to exist: exposing the type in the module is enough. It is actually better as one may use isinstance and such.
This commit is contained in:
parent
1b322a9b19
commit
a2b01cdf42
|
@ -194,17 +194,3 @@ PyTypeObject asisType = {
|
|||
0, /*tp_alloc*/
|
||||
asis_new, /*tp_new*/
|
||||
};
|
||||
|
||||
|
||||
/** module-level functions **/
|
||||
|
||||
PyObject *
|
||||
psyco_AsIs(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return NULL;
|
||||
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&asisType, obj, NULL);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,6 @@ typedef struct {
|
|||
|
||||
} asisObject;
|
||||
|
||||
/* functions exported to psycopgmodule.c */
|
||||
|
||||
HIDDEN PyObject *psyco_AsIs(PyObject *module, PyObject *args);
|
||||
#define psyco_AsIs_doc \
|
||||
"AsIs(obj) -> new AsIs wrapper object"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -299,17 +299,3 @@ PyTypeObject binaryType = {
|
|||
0, /*tp_alloc*/
|
||||
binary_new, /*tp_new*/
|
||||
};
|
||||
|
||||
|
||||
/** module-level functions **/
|
||||
|
||||
PyObject *
|
||||
psyco_Binary(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *str;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &str))
|
||||
return NULL;
|
||||
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&binaryType, str, NULL);
|
||||
}
|
||||
|
|
|
@ -40,13 +40,6 @@ typedef struct {
|
|||
PyObject *conn;
|
||||
} binaryObject;
|
||||
|
||||
/* functions exported to psycopgmodule.c */
|
||||
|
||||
HIDDEN PyObject *psyco_Binary(PyObject *module, PyObject *args);
|
||||
#define psyco_Binary_doc \
|
||||
"Binary(buffer) -> new binary object\n\n" \
|
||||
"Build an object capable to hold a binary string value."
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -260,17 +260,3 @@ PyTypeObject listType = {
|
|||
0, /*tp_alloc*/
|
||||
list_new, /*tp_new*/
|
||||
};
|
||||
|
||||
|
||||
/** module-level functions **/
|
||||
|
||||
PyObject *
|
||||
psyco_List(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return NULL;
|
||||
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&listType, obj, NULL);
|
||||
}
|
||||
|
|
|
@ -39,10 +39,6 @@ typedef struct {
|
|||
PyObject *connection;
|
||||
} listObject;
|
||||
|
||||
HIDDEN PyObject *psyco_List(PyObject *module, PyObject *args);
|
||||
#define psyco_List_doc \
|
||||
"List(list, enc) -> new quoted list"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -191,17 +191,3 @@ PyTypeObject pbooleanType = {
|
|||
0, /*tp_alloc*/
|
||||
pboolean_new, /*tp_new*/
|
||||
};
|
||||
|
||||
|
||||
/** module-level functions **/
|
||||
|
||||
PyObject *
|
||||
psyco_Boolean(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return NULL;
|
||||
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&pbooleanType, obj, NULL);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,6 @@ typedef struct {
|
|||
|
||||
} pbooleanObject;
|
||||
|
||||
/* functions exported to psycopgmodule.c */
|
||||
|
||||
HIDDEN PyObject *psyco_Boolean(PyObject *module, PyObject *args);
|
||||
#define psyco_Boolean_doc \
|
||||
"Boolean(obj) -> new boolean value"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -247,17 +247,3 @@ PyTypeObject pdecimalType = {
|
|||
0, /*tp_alloc*/
|
||||
pdecimal_new, /*tp_new*/
|
||||
};
|
||||
|
||||
|
||||
/** module-level functions **/
|
||||
|
||||
PyObject *
|
||||
psyco_Decimal(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return NULL;
|
||||
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&pdecimalType, obj, NULL);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,6 @@ typedef struct {
|
|||
|
||||
} pdecimalObject;
|
||||
|
||||
/* functions exported to psycopgmodule.c */
|
||||
|
||||
HIDDEN PyObject *psyco_Decimal(PyObject *module, PyObject *args);
|
||||
#define psyco_Decimal_doc \
|
||||
"Decimal(obj) -> new decimal.Decimal value"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -220,17 +220,3 @@ PyTypeObject pfloatType = {
|
|||
0, /*tp_alloc*/
|
||||
pfloat_new, /*tp_new*/
|
||||
};
|
||||
|
||||
|
||||
/** module-level functions **/
|
||||
|
||||
PyObject *
|
||||
psyco_Float(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return NULL;
|
||||
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&pfloatType, obj, NULL);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,6 @@ typedef struct {
|
|||
|
||||
} pfloatObject;
|
||||
|
||||
/* functions exported to psycopgmodule.c */
|
||||
|
||||
HIDDEN PyObject *psyco_Float(PyObject *module, PyObject *args);
|
||||
#define psyco_Float_doc \
|
||||
"Float(obj) -> new float value"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -206,17 +206,3 @@ PyTypeObject pintType = {
|
|||
0, /*tp_alloc*/
|
||||
pint_new, /*tp_new*/
|
||||
};
|
||||
|
||||
|
||||
/** module-level functions **/
|
||||
|
||||
PyObject *
|
||||
psyco_Int(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return NULL;
|
||||
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&pintType, obj, NULL);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,6 @@ typedef struct {
|
|||
|
||||
} pintObject;
|
||||
|
||||
/* functions exported to psycopgmodule.c */
|
||||
|
||||
HIDDEN PyObject *psyco_Int(PyObject *module, PyObject *args);
|
||||
#define psyco_Int_doc \
|
||||
"Int(obj) -> new int value"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -287,17 +287,3 @@ PyTypeObject qstringType = {
|
|||
0, /*tp_alloc*/
|
||||
qstring_new, /*tp_new*/
|
||||
};
|
||||
|
||||
|
||||
/** module-level functions **/
|
||||
|
||||
PyObject *
|
||||
psyco_QuotedString(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *str;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &str))
|
||||
return NULL;
|
||||
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&qstringType, str, NULL);
|
||||
}
|
||||
|
|
|
@ -41,12 +41,6 @@ typedef struct {
|
|||
connectionObject *conn;
|
||||
} qstringObject;
|
||||
|
||||
/* functions exported to psycopgmodule.c */
|
||||
|
||||
HIDDEN PyObject *psyco_QuotedString(PyObject *module, PyObject *args);
|
||||
#define psyco_QuotedString_doc \
|
||||
"QuotedString(str, enc) -> new quoted string"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -678,20 +678,6 @@ static PyMethodDef psycopgMethods[] = {
|
|||
{"new_array_type", (PyCFunction)typecast_array_from_python,
|
||||
METH_VARARGS|METH_KEYWORDS, typecast_array_from_python_doc},
|
||||
|
||||
{"AsIs", (PyCFunction)psyco_AsIs,
|
||||
METH_VARARGS, psyco_AsIs_doc},
|
||||
{"QuotedString", (PyCFunction)psyco_QuotedString,
|
||||
METH_VARARGS, psyco_QuotedString_doc},
|
||||
{"Boolean", (PyCFunction)psyco_Boolean,
|
||||
METH_VARARGS, psyco_Boolean_doc},
|
||||
{"Int", (PyCFunction)psyco_Int,
|
||||
METH_VARARGS, psyco_Int_doc},
|
||||
{"Float", (PyCFunction)psyco_Float,
|
||||
METH_VARARGS, psyco_Float_doc},
|
||||
{"Decimal", (PyCFunction)psyco_Decimal,
|
||||
METH_VARARGS, psyco_Decimal_doc},
|
||||
{"Binary", (PyCFunction)psyco_Binary,
|
||||
METH_VARARGS, psyco_Binary_doc},
|
||||
{"Date", (PyCFunction)psyco_Date,
|
||||
METH_VARARGS, psyco_Date_doc},
|
||||
{"Time", (PyCFunction)psyco_Time,
|
||||
|
@ -704,8 +690,6 @@ static PyMethodDef psycopgMethods[] = {
|
|||
METH_VARARGS, psyco_TimeFromTicks_doc},
|
||||
{"TimestampFromTicks", (PyCFunction)psyco_TimestampFromTicks,
|
||||
METH_VARARGS, psyco_TimestampFromTicks_doc},
|
||||
{"List", (PyCFunction)psyco_List,
|
||||
METH_VARARGS, psyco_List_doc},
|
||||
|
||||
{"DateFromPy", (PyCFunction)psyco_DateFromPy,
|
||||
METH_VARARGS, psyco_DateFromPy_doc},
|
||||
|
@ -912,6 +896,14 @@ INIT_MODULE(_psycopg)(void)
|
|||
PyModule_AddObject(module, "Notify", (PyObject*)¬ifyType);
|
||||
PyModule_AddObject(module, "Xid", (PyObject*)&xidType);
|
||||
PyModule_AddObject(module, "Diagnostics", (PyObject*)&diagnosticsType);
|
||||
PyModule_AddObject(module, "AsIs", (PyObject*)&asisType);
|
||||
PyModule_AddObject(module, "Binary", (PyObject*)&binaryType);
|
||||
PyModule_AddObject(module, "Boolean", (PyObject*)&pbooleanType);
|
||||
PyModule_AddObject(module, "Decimal", (PyObject*)&pdecimalType);
|
||||
PyModule_AddObject(module, "Int", (PyObject*)&pintType);
|
||||
PyModule_AddObject(module, "Float", (PyObject*)&pfloatType);
|
||||
PyModule_AddObject(module, "List", (PyObject*)&listType);
|
||||
PyModule_AddObject(module, "QuotedString", (PyObject*)&qstringType);
|
||||
#ifdef PSYCOPG_EXTENSIONS
|
||||
PyModule_AddObject(module, "lobject", (PyObject*)&lobjectType);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user