fastqueue-lib 0.0.15__tar.gz → 0.0.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastqueue-lib
3
- Version: 0.0.15
3
+ Version: 0.0.17
4
4
  Summary: Fast single ended queue library for python
5
5
  Author-email: Matthew Taylor <matthew.taylor.andre@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/MatthewAndreTaylor/fastqueue
@@ -19,9 +19,13 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
19
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
20
  Requires-Python: >=3.7
21
21
  Description-Content-Type: text/markdown
22
+ License-File: LICENSE
22
23
  Provides-Extra: examples
24
+ Requires-Dist: matplotlib; extra == "examples"
25
+ Requires-Dist: numpy; extra == "examples"
26
+ Requires-Dist: pandas; extra == "examples"
23
27
  Provides-Extra: tests
24
- License-File: LICENSE
28
+ Requires-Dist: pytest; extra == "tests"
25
29
 
26
30
  # fastqueue
27
31
 
@@ -31,7 +35,7 @@ License-File: LICENSE
31
35
  [![PyPI](https://img.shields.io/pypi/v/fastqueue-lib.svg)](https://pypi.org/project/fastqueue-lib/)
32
36
 
33
37
 
34
- Single ended fast queue's built in C tuned for python.
38
+ Single-ended fast queues built in C tuned for Python.
35
39
 
36
40
  ## Requirements
37
41
 
@@ -6,7 +6,7 @@
6
6
  [![PyPI](https://img.shields.io/pypi/v/fastqueue-lib.svg)](https://pypi.org/project/fastqueue-lib/)
7
7
 
8
8
 
9
- Single ended fast queue's built in C tuned for python.
9
+ Single-ended fast queues built in C tuned for Python.
10
10
 
11
11
  ## Requirements
12
12
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastqueue-lib
3
- Version: 0.0.15
3
+ Version: 0.0.17
4
4
  Summary: Fast single ended queue library for python
5
5
  Author-email: Matthew Taylor <matthew.taylor.andre@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/MatthewAndreTaylor/fastqueue
@@ -19,9 +19,13 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
19
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
20
  Requires-Python: >=3.7
21
21
  Description-Content-Type: text/markdown
22
+ License-File: LICENSE
22
23
  Provides-Extra: examples
24
+ Requires-Dist: matplotlib; extra == "examples"
25
+ Requires-Dist: numpy; extra == "examples"
26
+ Requires-Dist: pandas; extra == "examples"
23
27
  Provides-Extra: tests
24
- License-File: LICENSE
28
+ Requires-Dist: pytest; extra == "tests"
25
29
 
26
30
  # fastqueue
27
31
 
@@ -31,7 +35,7 @@ License-File: LICENSE
31
35
  [![PyPI](https://img.shields.io/pypi/v/fastqueue-lib.svg)](https://pypi.org/project/fastqueue-lib/)
32
36
 
33
37
 
34
- Single ended fast queue's built in C tuned for python.
38
+ Single-ended fast queues built in C tuned for Python.
35
39
 
36
40
  ## Requirements
37
41
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fastqueue-lib"
7
- version = "0.0.15"
7
+ version = "0.0.17"
8
8
  description="Fast single ended queue library for python"
9
9
  authors = [
10
10
  {name = "Matthew Taylor", email = "matthew.taylor.andre@gmail.com"},
@@ -4,7 +4,7 @@
4
4
  #include <Python.h>
5
5
  #include <pythread.h>
6
6
 
7
- #define CHUNKLEN 128
7
+ #define CHUNKLEN 256
8
8
  #define CHUNKEND (CHUNKLEN - 1)
9
9
 
10
10
  PyDoc_STRVAR(is_empty_doc, "Returns whether the Queue is empty.");
@@ -306,12 +306,12 @@ static PyTypeObject QueueCType = {
306
306
 
307
307
  /**
308
308
  * Single ended Python Queue with subqueue chunks
309
- * --- fastqueue.QueueC ---
309
+ * --- fastqueue.Queue ---
310
310
  */
311
311
  typedef struct QueueNode {
312
- unsigned char numEntries; // Number of entries into this node
313
- unsigned char front;
314
- unsigned char back;
312
+ Py_ssize_t numEntries; // Number of entries into the current node
313
+ Py_ssize_t front;
314
+ Py_ssize_t back;
315
315
  struct QueueNode* next;
316
316
  PyObject* py_objects[CHUNKLEN];
317
317
  } QueueNode_t;
@@ -370,8 +370,8 @@ static PyObject* Queue_copy(Queue_t* self, PyObject* args) {
370
370
  return NULL;
371
371
  }
372
372
 
373
- for (unsigned char i = 0; i < current->numEntries; ++i) {
374
- unsigned char index = (current->back + i) & CHUNKEND;
373
+ for (Py_ssize_t i = 0; i < current->numEntries; ++i) {
374
+ Py_ssize_t index = (current->back + i) & CHUNKEND;
375
375
  newNode->py_objects[index] = current->py_objects[index];
376
376
  Py_INCREF(current->py_objects[index]);
377
377
  }
@@ -427,6 +427,7 @@ static PyObject* Queue_dequeue(Queue_t* self) {
427
427
 
428
428
  if (head->numEntries <= 0 && head->next != NULL) {
429
429
  self->head = head->next;
430
+ free(head);
430
431
  }
431
432
 
432
433
  return py_object;
@@ -440,8 +441,8 @@ static int Queue_clear(Queue_t* self) {
440
441
  QueueNode_t* current = self->head;
441
442
  QueueNode_t* next;
442
443
  while (current != NULL) {
443
- for (unsigned char i = 0; i < current->numEntries; ++i) {
444
- unsigned char index = (current->back + i) & CHUNKEND;
444
+ for (Py_ssize_t i = 0; i < current->numEntries; ++i) {
445
+ Py_ssize_t index = (current->back + i) & CHUNKEND;
445
446
  if (!PyObject_IS_GC(current->py_objects[index])) {
446
447
  Py_DECREF(current->py_objects[index]);
447
448
  }
@@ -469,8 +470,8 @@ static void Queue_dealloc(Queue_t* self) {
469
470
  static int Queue_traverse(Queue_t* self, visitproc visit, void* arg) {
470
471
  QueueNode_t* current = self->head;
471
472
  while (current != NULL) {
472
- for (unsigned char i = 0; i < current->numEntries; ++i) {
473
- unsigned char index = (current->back + i) & CHUNKEND;
473
+ for (Py_ssize_t i = 0; i < current->numEntries; ++i) {
474
+ Py_ssize_t index = (current->back + i) & CHUNKEND;
474
475
  Py_VISIT(current->py_objects[index]);
475
476
  }
476
477
  current = current->next;
@@ -572,7 +573,7 @@ static int Queue_setitem(Queue_t* self, Py_ssize_t index, PyObject* object) {
572
573
  static int Queue_contains(Queue_t* self, PyObject* object) {
573
574
  QueueNode_t* current = self->head;
574
575
  while (current != NULL) {
575
- for (unsigned char i = 0; i < current->numEntries; ++i) {
576
+ for (Py_ssize_t i = 0; i < current->numEntries; ++i) {
576
577
  if (PyObject_RichCompareBool(
577
578
  object, current->py_objects[(current->back + i) & CHUNKEND],
578
579
  Py_EQ)) {
@@ -141,6 +141,11 @@ def test_mixed_extend(queue):
141
141
  assert queue.is_empty()
142
142
  assert len(queue) == 0
143
143
 
144
+ queue.extend(range(10))
145
+ assert len(queue) == 10
146
+ assert queue[0] == 0
147
+ assert queue[-1] == 9
148
+
144
149
 
145
150
  @pytest.mark.parametrize("queue", [LockQueue(), Queue(), QueueC()])
146
151
  def test_getitemQueue(queue):
File without changes
File without changes
File without changes