Skip to content

Commit

Permalink
Drop custom impl of Set and Array
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Sep 24, 2022
1 parent bd84905 commit 6b93ae8
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 749 deletions.
2 changes: 1 addition & 1 deletion edgedb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from edgedb.datatypes.datatypes import (
Tuple, NamedTuple, EnumValue, RelativeDuration, DateDuration, ConfigMemory
)
from edgedb.datatypes.datatypes import Set, Object, Array, Link, LinkSet
from edgedb.datatypes.datatypes import Object, Link, LinkSet

from .abstract import (
Executor, AsyncIOExecutor, ReadOnlyExecutor, AsyncIOReadOnlyExecutor
Expand Down
4 changes: 2 additions & 2 deletions edgedb/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ReadOnlyExecutor(BaseReadOnlyExecutor):
def _query(self, query_context: QueryContext):
...

def query(self, query: str, *args, **kwargs) -> datatypes.Set:
def query(self, query: str, *args, **kwargs) -> list:
return self._query(QueryContext(
query=QueryWithArgs(query, args, kwargs),
cache=self._get_query_cache(),
Expand Down Expand Up @@ -186,7 +186,7 @@ class AsyncIOReadOnlyExecutor(BaseReadOnlyExecutor):
async def _query(self, query_context: QueryContext):
...

async def query(self, query: str, *args, **kwargs) -> datatypes.Set:
async def query(self, query: str, *args, **kwargs) -> list:
return await self._query(QueryContext(
query=QueryWithArgs(query, args, kwargs),
cache=self._get_query_cache(),
Expand Down
264 changes: 0 additions & 264 deletions edgedb/datatypes/array.c

This file was deleted.

44 changes: 0 additions & 44 deletions edgedb/datatypes/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,50 +125,6 @@ PyObject * EdgeObject_GetItem(PyObject *, Py_ssize_t);
PyObject * EdgeObject_GetID(PyObject *ob);


/* === edgedb.Set =========================================== */

extern PyTypeObject EdgeSet_Type;

#define EdgeSet_Check(d) (Py_TYPE(d) == &EdgeSet_Type)

typedef struct {
PyObject_HEAD
Py_hash_t cached_hash;
PyObject *weakreflist;
PyObject *els;
} EdgeSetObject;

PyObject * EdgeSet_InitType(void);
PyObject * EdgeSet_New(Py_ssize_t);

int EdgeSet_SetItem(PyObject *, Py_ssize_t, PyObject *);
PyObject * EdgeSet_GetItem(PyObject *, Py_ssize_t);

int EdgeSet_AppendItem(PyObject *, PyObject *);
Py_ssize_t EdgeSet_Len(PyObject *);


/* === edgedb.Array ========================================= */

#define EDGE_ARRAY_FREELIST_SIZE 500
#define EDGE_ARRAY_FREELIST_MAXSAVE 10

extern PyTypeObject EdgeArray_Type;

#define EdgeArray_Check(d) (Py_TYPE(d) == &EdgeArray_Type)

typedef struct {
PyObject_VAR_HEAD
PyObject *weakreflist;
Py_hash_t cached_hash;
PyObject *ob_item[1];
} EdgeArrayObject;

PyObject * EdgeArray_InitType(void);
PyObject * EdgeArray_New(Py_ssize_t size);
int EdgeArray_SetItem(PyObject *, Py_ssize_t, PyObject *);


/* === edgedb.Link ========================================== */

extern PyTypeObject EdgeLink_Type;
Expand Down
16 changes: 0 additions & 16 deletions edgedb/datatypes/datatypes.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ cdef extern from "datatypes.h":
int EdgeObject_SetItem(object, Py_ssize_t, object) except -1
object EdgeObject_GetRecordDesc(object)

bint EdgeSet_Check(object)
object EdgeSet_InitType()
object EdgeSet_New(Py_ssize_t);
int EdgeSet_SetItem(object, Py_ssize_t, object) except -1
int EdgeSet_AppendItem(object, object) except -1

object EdgeArray_InitType()
object EdgeArray_New(Py_ssize_t);
int EdgeArray_SetItem(object, Py_ssize_t, object) except -1

object EdgeLink_InitType()

object EdgeLinkSet_InitType()
Expand All @@ -78,9 +68,3 @@ cdef namedtuple_new(object namedtuple_type)
cdef namedtuple_type_new(object desc)
cdef object_new(object desc)
cdef object_set(object tuple, Py_ssize_t pos, object elem)
cdef bint set_check(object set)
cdef set_new(Py_ssize_t size)
cdef set_set(object set, Py_ssize_t pos, object elem)
cdef set_append(object set, object elem)
cdef array_new(Py_ssize_t size)
cdef array_set(object array, Py_ssize_t pos, object elem)
Loading

0 comments on commit 6b93ae8

Please sign in to comment.