Skip to content

Commit 6af3323

Browse files
committed
Merge pull request #42 from LeanderCS/31
31 | Use cython to increase performance
2 parents 5b1da59 + 3130062 commit 6af3323

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1087
-1149
lines changed

.github/workflows/publish-to-pypi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
env:
2727
TWINE_USERNAME: __token__
2828
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
29-
run: twine upload dist/*
29+
run: twine upload dist/*.tar.gz

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ __pycache__/
55

66
# C extensions
77
*.so
8+
*.c
9+
*.cpp
810

911
# Distribution / packaging
1012
.Python

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM python:3.7-slim
22

33
WORKDIR /app
44

5-
RUN apt-get update && apt-get install -y gcc python3-dev git
5+
RUN apt-get update && apt-get install -y gcc g++ python3-dev git
66

77
COPY pyproject.toml /app
88

MANIFEST.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
include docs/index.rst
1+
include docs/source/index.rst
22
include LICENSE
3-
include docs/changelog.rst
3+
include docs/source/changelog.rst
4+
recursive-include flask_inputfilter *.py *.pyx *.c *.cpp
45
prune tests

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ Definition
6767
6868
class UpdateZipcodeInputFilter(InputFilter):
6969
def __init__(self):
70-
super().__init__()
7170
7271
self.add(
7372
'id',

docs/source/changelog.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ Changelog
33

44
All notable changes to this project will be documented in this file.
55

6+
[0.4.0a1] - 2025-04-17
7+
----------------------
8+
9+
Changed
10+
^^^^^^^
11+
- InputFilter now uses cython for performance improvements.
12+
- Made super().__init__() call optional. You will only need to call it,
13+
if you are wanting to limit the allowed methods.
14+
15+
616
[0.3.1] - 2025-04-14
717
--------------------
818

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project = "flask-inputfilter"
22
copyright = "2025, Leander Cain Slotosch"
33
author = "Leander Cain Slotosch"
4-
release = "0.3.1"
4+
release = "0.4.0a1"
55

66
extensions = ["sphinx_rtd_theme"]
77

docs/source/guides/frontend_validation.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Example implementation
2424
2525
class UpdateZipcodeInputFilter(InputFilter):
2626
def __init__(self):
27-
super().__init__()
2827
2928
self.add(
3029
'id',

docs/source/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ Definition
6363
6464
class UpdateZipcodeInputFilter(InputFilter):
6565
def __init__(self):
66-
super().__init__()
6766
6867
self.add(
6968
'id',

docs/source/options/condition.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Example
2020
2121
class TestInputFilter(InputFilter):
2222
def __init__(self):
23-
super().__init__()
2423
2524
self.add(
2625
'username',
@@ -89,7 +88,6 @@ Validates that the length of the array from ``first_array_field`` is equal to th
8988
9089
class ArrayLengthFilter(InputFilter):
9190
def __init__(self):
92-
super().__init__()
9391
9492
self.add(
9593
'list1',
@@ -129,7 +127,6 @@ Validates that the array in ``longer_field`` has more elements than the array in
129127
130128
class ArrayComparisonFilter(InputFilter):
131129
def __init__(self):
132-
super().__init__()
133130
134131
self.add(
135132
'list1',
@@ -171,7 +168,6 @@ Executes the provided callable with the input data. The condition passes if the
171168
172169
class CustomFilter(InputFilter):
173170
def __init__(self):
174-
super().__init__()
175171
176172
self.add(
177173
'age',
@@ -205,7 +201,6 @@ Validates that the values of ``first_field`` and ``second_field`` are equal. Fai
205201
206202
class EqualFieldsFilter(InputFilter):
207203
def __init__(self):
208-
super().__init__()
209204
210205
self.add(
211206
'password'
@@ -242,7 +237,6 @@ Counts the number of specified fields present in the data and validates that the
242237
243238
class ExactFieldsFilter(InputFilter):
244239
def __init__(self):
245-
super().__init__()
246240
247241
self.add(
248242
'field1'
@@ -284,7 +278,6 @@ Validates that exactly ``n`` fields among the specified ones have the given valu
284278
285279
class MatchFieldsFilter(InputFilter):
286280
def __init__(self):
287-
super().__init__()
288281
289282
self.add(
290283
'field1'
@@ -320,7 +313,6 @@ Validates that only one field among the specified fields exists in the input dat
320313
321314
class OneFieldFilter(InputFilter):
322315
def __init__(self):
323-
super().__init__()
324316
325317
self.add(
326318
'email'
@@ -357,7 +349,6 @@ Validates that exactly one of the specified fields has the given value.
357349
358350
class OneMatchFilter(InputFilter):
359351
def __init__(self):
360-
super().__init__()
361352
362353
self.add(
363354
'option1'
@@ -395,7 +386,6 @@ Validates that the integer value from ``bigger_field`` is greater than the value
395386
396387
class NumberComparisonFilter(InputFilter):
397388
def __init__(self):
398-
super().__init__()
399389
400390
self.add(
401391
'field_should_be_bigger',
@@ -434,7 +424,6 @@ Validates that the count of the specified fields present is greater than or equa
434424
435425
class MinimumFieldsFilter(InputFilter):
436426
def __init__(self):
437-
super().__init__()
438427
439428
self.add(
440429
'field1'
@@ -476,7 +465,6 @@ Validates that the count of fields matching the given value is greater than or e
476465
477466
class MinimumMatchFilter(InputFilter):
478467
def __init__(self):
479-
super().__init__()
480468
481469
self.add(
482470
'field1'
@@ -513,7 +501,6 @@ Validates that the values of ``first_field`` and ``second_field`` are not equal.
513501
514502
class DifferenceFilter(InputFilter):
515503
def __init__(self):
516-
super().__init__()
517504
518505
self.add(
519506
'field1'
@@ -549,7 +536,6 @@ Validates that at least one field from the specified list is present. Fails if n
549536
550537
class OneFieldRequiredFilter(InputFilter):
551538
def __init__(self):
552-
super().__init__()
553539
554540
self.add(
555541
'email'
@@ -586,7 +572,6 @@ Validates that at least one field from the specified list has the given value.
586572
587573
class OneMatchRequiredFilter(InputFilter):
588574
def __init__(self):
589-
super().__init__()
590575
591576
self.add(
592577
'option1'
@@ -624,7 +609,6 @@ If the value of ``condition_field`` matches the specified value (or is in the sp
624609
625610
class ConditionalRequiredFilter(InputFilter):
626611
def __init__(self):
627-
super().__init__()
628612
629613
self.add(
630614
'status'
@@ -667,7 +651,6 @@ Validates that the string in ``longer_field`` has a greater length than the stri
667651
668652
class StringLengthFilter(InputFilter):
669653
def __init__(self):
670-
super().__init__()
671654
672655
self.add(
673656
'description'
@@ -704,7 +687,6 @@ Validates that the date in ``smaller_date_field`` is earlier than the date in ``
704687
705688
class DateOrderFilter(InputFilter):
706689
def __init__(self):
707-
super().__init__()
708690
709691
self.add(
710692
'start_date'

0 commit comments

Comments
 (0)