Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ jobs:
working-directory: python
run: uv sync --group dev

- name: Check the generated IcePy docstring header
working-directory: python
run: |
uv run python ../scripts/generateIcePyDocs.py --check

- name: Build Ice for Python
run: |
make -C cpp srcs
Expand All @@ -61,8 +66,3 @@ jobs:
working-directory: python
run: |
uv run pyright --project ..

- name: Check the IcePy stub against the IcePy module
working-directory: python
run: |
PYTHONPATH=python uv run python ../scripts/checkIcePyStub.py
58 changes: 15 additions & 43 deletions python/modules/IcePy/BatchRequestInterceptor.cpp
Original file line number Diff line number Diff line change
@@ -1,50 +1,13 @@
// Copyright (c) ZeroC, Inc.

#include "BatchRequestInterceptor.h"
#include "DocStrings.h"
#include "Proxy.h"
#include "Thread.h"

using namespace std;
using namespace IcePy;

namespace
{
constexpr const char* batchRequestGetSize_doc = R"(getSize() -> int

Gets the size of the request.

Returns
-------
int
The number of bytes consumed by the request.)";

constexpr const char* batchRequestGetOperation_doc = R"(getOperation() -> str

Gets the name of the operation.

Returns
-------
str
The operation name.)";

constexpr const char* batchRequestGetProxy_doc = R"(getProxy() -> Ice.ObjectPrx

Gets the proxy used to create this batch request.

Returns
-------
Ice.ObjectPrx
The proxy.)";

constexpr const char* batchRequestEnqueue_doc = R"(enqueue() -> None

Queues this request.)";

constexpr const char* BatchRequestType_doc =
R"(Represents a batch request.
A batch request is created by invoking an operation on a batch-oneway or batch-datagram proxy.)";
}

namespace IcePy
{
struct BatchRequestObject
Expand Down Expand Up @@ -158,13 +121,22 @@ batchRequestEnqueue(BatchRequestObject* self, PyObject* /*args*/)
}

static PyMethodDef BatchRequestMethods[] = {
{"getSize", reinterpret_cast<PyCFunction>(batchRequestGetSize), METH_NOARGS, PyDoc_STR(batchRequestGetSize_doc)},
{"getSize",
reinterpret_cast<PyCFunction>(batchRequestGetSize),
METH_NOARGS,
PyDoc_STR(IcePy_DOC_BatchRequest_getSize)},
{"getOperation",
reinterpret_cast<PyCFunction>(batchRequestGetOperation),
METH_NOARGS,
PyDoc_STR(batchRequestGetOperation_doc)},
{"getProxy", reinterpret_cast<PyCFunction>(batchRequestGetProxy), METH_NOARGS, PyDoc_STR(batchRequestGetProxy_doc)},
{"enqueue", reinterpret_cast<PyCFunction>(batchRequestEnqueue), METH_NOARGS, PyDoc_STR(batchRequestEnqueue_doc)},
PyDoc_STR(IcePy_DOC_BatchRequest_getOperation)},
{"getProxy",
reinterpret_cast<PyCFunction>(batchRequestGetProxy),
METH_NOARGS,
PyDoc_STR(IcePy_DOC_BatchRequest_getProxy)},
{"enqueue",
reinterpret_cast<PyCFunction>(batchRequestEnqueue),
METH_NOARGS,
PyDoc_STR(IcePy_DOC_BatchRequest_enqueue)},
{} /* sentinel */
};

Expand All @@ -177,7 +149,7 @@ namespace IcePy
.tp_basicsize = sizeof(BatchRequestObject),
.tp_dealloc = (destructor)batchRequestDealloc,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = PyDoc_STR(BatchRequestType_doc),
.tp_doc = PyDoc_STR(IcePy_DOC_BatchRequest),
.tp_methods = BatchRequestMethods,
.tp_new = (newfunc)batchRequestNew,
};
Expand Down
75 changes: 41 additions & 34 deletions python/modules/IcePy/Communicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "Communicator.h"
#include "BatchRequestInterceptor.h"
#include "DefaultSliceLoader.h"
#include "DocStrings.h"
#include "Executor.h"
#include "Future.h"
#include "Ice/DisableWarnings.h"
Expand Down Expand Up @@ -1437,132 +1438,138 @@ communicatorSetDefaultLocator(CommunicatorObject* self, PyObject* args)
}

static PyMethodDef CommunicatorMethods[] = {
{"destroy", reinterpret_cast<PyCFunction>(communicatorDestroy), METH_NOARGS, PyDoc_STR("destroy() -> None")},
{"destroy",
reinterpret_cast<PyCFunction>(communicatorDestroy),
METH_NOARGS,
PyDoc_STR(IcePy_DOC_Communicator_destroy)},
{"destroyAsync",
reinterpret_cast<PyCFunction>(communicatorDestroyAsync),
METH_VARARGS,
PyDoc_STR("destroyAsync(callable: Callable, /) -> None")},
{"shutdown", reinterpret_cast<PyCFunction>(communicatorShutdown), METH_NOARGS, PyDoc_STR("shutdown() -> None")},
PyDoc_STR(IcePy_DOC_Communicator_destroyAsync)},
{"shutdown",
reinterpret_cast<PyCFunction>(communicatorShutdown),
METH_NOARGS,
PyDoc_STR(IcePy_DOC_Communicator_shutdown)},
{"waitForShutdown",
reinterpret_cast<PyCFunction>(communicatorWaitForShutdown),
METH_VARARGS,
PyDoc_STR("waitForShutdown(timeout: int, /) -> bool")},
PyDoc_STR(IcePy_DOC_Communicator_waitForShutdown)},
{"shutdownCompleted",
reinterpret_cast<PyCFunction>(communicatorShutdownCompleted),
METH_NOARGS,
PyDoc_STR("shutdownCompleted() -> Awaitable[None]")},
PyDoc_STR(IcePy_DOC_Communicator_shutdownCompleted)},
{"isShutdown",
reinterpret_cast<PyCFunction>(communicatorIsShutdown),
METH_NOARGS,
PyDoc_STR("isShutdown() -> bool")},
PyDoc_STR(IcePy_DOC_Communicator_isShutdown)},
{"stringToProxy",
reinterpret_cast<PyCFunction>(communicatorStringToProxy),
METH_VARARGS,
PyDoc_STR("stringToProxy(str: str, /) -> Ice.ObjectPrx | None")},
PyDoc_STR(IcePy_DOC_Communicator_stringToProxy)},
{"proxyToString",
reinterpret_cast<PyCFunction>(communicatorProxyToString),
METH_VARARGS,
PyDoc_STR("proxyToString(proxy: Ice.ObjectPrx | None, /) -> str")},
PyDoc_STR(IcePy_DOC_Communicator_proxyToString)},
{"propertyToProxy",
reinterpret_cast<PyCFunction>(communicatorPropertyToProxy),
METH_VARARGS,
PyDoc_STR("propertyToProxy(property: str, /) -> Ice.ObjectPrx | None")},
PyDoc_STR(IcePy_DOC_Communicator_propertyToProxy)},
{"proxyToProperty",
reinterpret_cast<PyCFunction>(communicatorProxyToProperty),
METH_VARARGS,
PyDoc_STR("proxyToProperty(proxy: Ice.ObjectPrx, property: str, /) -> dict[str, str]")},
PyDoc_STR(IcePy_DOC_Communicator_proxyToProperty)},
{"identityToString",
reinterpret_cast<PyCFunction>(communicatorIdentityToString),
METH_VARARGS,
PyDoc_STR("identityToString(identity: Ice.Identity, /) -> str")},
PyDoc_STR(IcePy_DOC_Communicator_identityToString)},
{"createObjectAdapter",
reinterpret_cast<PyCFunction>(communicatorCreateObjectAdapter),
METH_VARARGS,
PyDoc_STR("createObjectAdapter(name: str, /) -> ObjectAdapter")},
PyDoc_STR(IcePy_DOC_Communicator_createObjectAdapter)},
{"createObjectAdapterWithEndpoints",
reinterpret_cast<PyCFunction>(communicatorCreateObjectAdapterWithEndpoints),
METH_VARARGS,
PyDoc_STR("createObjectAdapterWithEndpoints(name: str, endpoints: str, /) -> ObjectAdapter")},
PyDoc_STR(IcePy_DOC_Communicator_createObjectAdapterWithEndpoints)},
{"createObjectAdapterWithRouter",
reinterpret_cast<PyCFunction>(communicatorCreateObjectAdapterWithRouter),
METH_VARARGS,
PyDoc_STR("createObjectAdapterWithRouter(name: str, router: Ice.RouterPrx, /) -> ObjectAdapter")},
PyDoc_STR(IcePy_DOC_Communicator_createObjectAdapterWithRouter)},
{"getDefaultObjectAdapter",
reinterpret_cast<PyCFunction>(communicatorGetDefaultObjectAdapter),
METH_NOARGS,
PyDoc_STR("getDefaultObjectAdapter() -> Ice.ObjectAdapter | None")},
PyDoc_STR(IcePy_DOC_Communicator_getDefaultObjectAdapter)},
{"setDefaultObjectAdapter",
reinterpret_cast<PyCFunction>(communicatorSetDefaultObjectAdapter),
METH_VARARGS,
PyDoc_STR("setDefaultObjectAdapter(adapter: Ice.ObjectAdapter | None, /) -> None")},
PyDoc_STR(IcePy_DOC_Communicator_setDefaultObjectAdapter)},
{"getImplicitContext",
reinterpret_cast<PyCFunction>(communicatorGetImplicitContext),
METH_NOARGS,
PyDoc_STR("getImplicitContext() -> ImplicitContext | None")},
PyDoc_STR(IcePy_DOC_Communicator_getImplicitContext)},
{"getProperties",
reinterpret_cast<PyCFunction>(communicatorGetProperties),
METH_NOARGS,
PyDoc_STR("getProperties() -> Properties")},
PyDoc_STR(IcePy_DOC_Communicator_getProperties)},
{"getLogger",
reinterpret_cast<PyCFunction>(communicatorGetLogger),
METH_NOARGS,
PyDoc_STR("getLogger() -> Ice.Logger | Logger")},
PyDoc_STR(IcePy_DOC_Communicator_getLogger)},
{"getDefaultRouter",
reinterpret_cast<PyCFunction>(communicatorGetDefaultRouter),
METH_NOARGS,
PyDoc_STR("getDefaultRouter() -> Ice.RouterPrx | None")},
PyDoc_STR(IcePy_DOC_Communicator_getDefaultRouter)},
{"setDefaultRouter",
reinterpret_cast<PyCFunction>(communicatorSetDefaultRouter),
METH_VARARGS,
PyDoc_STR("setDefaultRouter(router: Ice.RouterPrx | None, /) -> None")},
PyDoc_STR(IcePy_DOC_Communicator_setDefaultRouter)},
{"getDefaultLocator",
reinterpret_cast<PyCFunction>(communicatorGetDefaultLocator),
METH_NOARGS,
PyDoc_STR("getDefaultLocator() -> Ice.LocatorPrx | None")},
PyDoc_STR(IcePy_DOC_Communicator_getDefaultLocator)},
{"setDefaultLocator",
reinterpret_cast<PyCFunction>(communicatorSetDefaultLocator),
METH_VARARGS,
PyDoc_STR("setDefaultLocator(locator: Ice.LocatorPrx | None, /) -> None")},
PyDoc_STR(IcePy_DOC_Communicator_setDefaultLocator)},
{"flushBatchRequests",
reinterpret_cast<PyCFunction>(communicatorFlushBatchRequests),
METH_VARARGS,
PyDoc_STR("flushBatchRequests(compress: Ice.CompressBatch, /) -> None")},
PyDoc_STR(IcePy_DOC_Communicator_flushBatchRequests)},
{"flushBatchRequestsAsync",
reinterpret_cast<PyCFunction>(communicatorFlushBatchRequestsAsync),
METH_VARARGS,
PyDoc_STR("flushBatchRequestsAsync(compress: Ice.CompressBatch, /) -> Awaitable[None]")},
PyDoc_STR(IcePy_DOC_Communicator_flushBatchRequestsAsync)},
{"createAdmin",
reinterpret_cast<PyCFunction>(communicatorCreateAdmin),
METH_VARARGS,
PyDoc_STR("createAdmin(adminAdapter: Ice.ObjectAdapter | None, adminIdentity: Ice.Identity, /) -> Ice.ObjectPrx")},
PyDoc_STR(IcePy_DOC_Communicator_createAdmin)},
{"getAdmin",
reinterpret_cast<PyCFunction>(communicatorGetAdmin),
METH_NOARGS,
PyDoc_STR("getAdmin() -> Ice.ObjectPrx | None")},
PyDoc_STR(IcePy_DOC_Communicator_getAdmin)},
{"addAdminFacet",
reinterpret_cast<PyCFunction>(communicatorAddAdminFacet),
METH_VARARGS,
PyDoc_STR("addAdminFacet(servant: Ice.Object, facet: str, /) -> None")},
PyDoc_STR(IcePy_DOC_Communicator_addAdminFacet)},
{"findAdminFacet",
reinterpret_cast<PyCFunction>(communicatorFindAdminFacet),
METH_VARARGS,
PyDoc_STR("findAdminFacet(facet: str, /) -> Ice.Object | NativePropertiesAdmin | None")},
PyDoc_STR(IcePy_DOC_Communicator_findAdminFacet)},
{"findAllAdminFacets",
reinterpret_cast<PyCFunction>(communicatorFindAllAdminFacets),
METH_NOARGS,
PyDoc_STR("findAllAdminFacets() -> dict[str, Ice.Object | NativePropertiesAdmin]")},
PyDoc_STR(IcePy_DOC_Communicator_findAllAdminFacets)},
{"removeAdminFacet",
reinterpret_cast<PyCFunction>(communicatorRemoveAdminFacet),
METH_VARARGS,
PyDoc_STR("removeAdminFacet(facet: str, /) -> Ice.Object | None")},
PyDoc_STR(IcePy_DOC_Communicator_removeAdminFacet)},
{"_setWrapper",
reinterpret_cast<PyCFunction>(communicatorSetWrapper),
METH_VARARGS,
PyDoc_STR("_setWrapper(wrapper: Ice.Communicator, /) -> None")},
PyDoc_STR(IcePy_DOC_Communicator__setWrapper)},
{"_getWrapper",
reinterpret_cast<PyCFunction>(communicatorGetWrapper),
METH_NOARGS,
PyDoc_STR("_getWrapper() -> Ice.Communicator")},
PyDoc_STR(IcePy_DOC_Communicator__getWrapper)},
{} /* sentinel */
};

Expand All @@ -1575,7 +1582,7 @@ namespace IcePy
.tp_basicsize = sizeof(CommunicatorObject),
.tp_dealloc = reinterpret_cast<destructor>(communicatorDealloc),
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = PyDoc_STR("IcePy.Communicator"),
.tp_doc = PyDoc_STR(IcePy_DOC_Communicator),
.tp_methods = CommunicatorMethods,
.tp_init = reinterpret_cast<initproc>(communicatorInit),
.tp_new = reinterpret_cast<newfunc>(communicatorNew)};
Expand Down
Loading
Loading