MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / __pyx_buffmt_parse_array

Function __pyx_buffmt_parse_array

eval/CIPO_evaluation/pycocotools/_mask.c:12078–12120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12076 return 0;
12077}
12078static PyObject *
12079__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
12080{
12081 const char *ts = *tsp;
12082 int i = 0, number, ndim;
12083 ++ts;
12084 if (ctx->new_count != 1) {
12085 PyErr_SetString(PyExc_ValueError,
12086 "Cannot handle repeated arrays in format string");
12087 return NULL;
12088 }
12089 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
12090 ndim = ctx->head->field->type->ndim;
12091 while (*ts && *ts != ')') {
12092 switch (*ts) {
12093 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
12094 default: break;
12095 }
12096 number = __Pyx_BufFmt_ExpectNumber(&ts);
12097 if (number == -1) return NULL;
12098 if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
12099 return PyErr_Format(PyExc_ValueError,
12100 "Expected a dimension of size %zu, got %d",
12101 ctx->head->field->type->arraysize[i], number);
12102 if (*ts != ',' && *ts != ')')
12103 return PyErr_Format(PyExc_ValueError,
12104 "Expected a comma in format string, got '%c'", *ts);
12105 if (*ts == ',') ts++;
12106 i++;
12107 }
12108 if (i != ndim)
12109 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
12110 ctx->head->field->type->ndim, i);
12111 if (!*ts) {
12112 PyErr_SetString(PyExc_ValueError,
12113 "Unexpected end of format string, expected ')'");
12114 return NULL;
12115 }
12116 ctx->is_valid_array = 1;
12117 ctx->new_count = 1;
12118 *tsp = ++ts;
12119 return Py_None;
12120}
12121static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
12122 int got_Z = 0;
12123 while (1) {

Callers 1

__Pyx_BufFmt_CheckStringFunction · 0.85

Calls 2

Tested by

no test coverage detected