pyintervals 1.0.2__tar.gz → 1.0.3__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.
- {pyintervals-1.0.2 → pyintervals-1.0.3}/PKG-INFO +37 -3
- {pyintervals-1.0.2 → pyintervals-1.0.3}/README.rst +36 -2
- {pyintervals-1.0.2 → pyintervals-1.0.3}/pyproject.toml +1 -1
- {pyintervals-1.0.2 → pyintervals-1.0.3}/CHANGELOG.rst +0 -0
- {pyintervals-1.0.2 → pyintervals-1.0.3}/LICENSE +0 -0
- {pyintervals-1.0.2 → pyintervals-1.0.3}/src/pyintervals/__init__.py +0 -0
- {pyintervals-1.0.2 → pyintervals-1.0.3}/src/pyintervals/constants.py +0 -0
- {pyintervals-1.0.2 → pyintervals-1.0.3}/src/pyintervals/interval.py +0 -0
- {pyintervals-1.0.2 → pyintervals-1.0.3}/src/pyintervals/interval_handler.py +0 -0
- {pyintervals-1.0.2 → pyintervals-1.0.3}/src/pyintervals/py.typed +0 -0
- {pyintervals-1.0.2 → pyintervals-1.0.3}/src/pyintervals/search.py +0 -0
- {pyintervals-1.0.2 → pyintervals-1.0.3}/src/pyintervals/time_value_node.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pyintervals
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Efficient interval operations.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: interval,timespan
|
|
@@ -127,7 +127,41 @@ for the time you are curious about, 12:30 in this case. This will take `O(n)` ti
|
|
|
127
127
|
|
|
128
128
|
Linear time is nice but can we not improve it? Well, with **pyintervals**, you can!
|
|
129
129
|
What we essentially are curious about is the status of that beautiful store at a given time.
|
|
130
|
-
**pintervals**
|
|
130
|
+
**pintervals** allows you to fetch this value in `O(log n)` time.
|
|
131
|
+
|
|
132
|
+
.. code-block:: python
|
|
133
|
+
|
|
134
|
+
# Add open times with value 1
|
|
135
|
+
mon_interval_1 = Interval(start=datetime(2025,7,21,9,00),end=datetime(2025,7,21,12,0), value=1)
|
|
136
|
+
mon_interval_2 = Interval(start=datetime(2025,7,21,13,00),end=datetime(2025,7,21,16,0), value=1)
|
|
137
|
+
tue_interval_1 = Interval(start=datetime(2025,7,22,9,00),end=datetime(2025,7,22,12,0), value=1)
|
|
138
|
+
tue_interval_2 = Interval(start=datetime(2025,7,22,13,00),end=datetime(2025,7,22,16,0), value=1)
|
|
139
|
+
|
|
140
|
+
capacity = IntervalHandler()
|
|
141
|
+
capacity.add(
|
|
142
|
+
[
|
|
143
|
+
mon_interval_1,
|
|
144
|
+
mon_interval_2,
|
|
145
|
+
tue_interval_1,
|
|
146
|
+
tue_interval_2,
|
|
147
|
+
]
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# Check the capacity, which indicates open when value is positive
|
|
151
|
+
capacity.value_at_time(datetime(2025,7,21,9,30))
|
|
152
|
+
>>> 1 # Open
|
|
153
|
+
|
|
154
|
+
capacity.value_at_time(datetime(2025,7,21,12,30))
|
|
155
|
+
>>> 0 # Closed
|
|
156
|
+
|
|
157
|
+
capacity.value_at_time(datetime(2025,7,22,13,00))
|
|
158
|
+
>>> 1 # Open
|
|
159
|
+
|
|
160
|
+
capacity.value_at_time(datetime(2025,7,22,16,00))
|
|
161
|
+
>>> 0 # Closed
|
|
162
|
+
|
|
163
|
+
capacity.value_at_time(datetime(2025,7,22,15,59))
|
|
164
|
+
>>> 1 # Open
|
|
131
165
|
|
|
132
166
|
See roadmap_ for the list of available and upcoming features.
|
|
133
167
|
|
|
@@ -157,7 +191,7 @@ Features:
|
|
|
157
191
|
- Interval Handler:
|
|
158
192
|
- ✅ Own intervals with associated values
|
|
159
193
|
- ✅ Provide value projection graph
|
|
160
|
-
-
|
|
194
|
+
- ✅ Query value over time
|
|
161
195
|
- 🚧 Access intervals overlapping with a specific timespan
|
|
162
196
|
- Single-level Pegging:
|
|
163
197
|
- 🚧 Introduce object association to Intervals
|
|
@@ -105,7 +105,41 @@ for the time you are curious about, 12:30 in this case. This will take `O(n)` ti
|
|
|
105
105
|
|
|
106
106
|
Linear time is nice but can we not improve it? Well, with **pyintervals**, you can!
|
|
107
107
|
What we essentially are curious about is the status of that beautiful store at a given time.
|
|
108
|
-
**pintervals**
|
|
108
|
+
**pintervals** allows you to fetch this value in `O(log n)` time.
|
|
109
|
+
|
|
110
|
+
.. code-block:: python
|
|
111
|
+
|
|
112
|
+
# Add open times with value 1
|
|
113
|
+
mon_interval_1 = Interval(start=datetime(2025,7,21,9,00),end=datetime(2025,7,21,12,0), value=1)
|
|
114
|
+
mon_interval_2 = Interval(start=datetime(2025,7,21,13,00),end=datetime(2025,7,21,16,0), value=1)
|
|
115
|
+
tue_interval_1 = Interval(start=datetime(2025,7,22,9,00),end=datetime(2025,7,22,12,0), value=1)
|
|
116
|
+
tue_interval_2 = Interval(start=datetime(2025,7,22,13,00),end=datetime(2025,7,22,16,0), value=1)
|
|
117
|
+
|
|
118
|
+
capacity = IntervalHandler()
|
|
119
|
+
capacity.add(
|
|
120
|
+
[
|
|
121
|
+
mon_interval_1,
|
|
122
|
+
mon_interval_2,
|
|
123
|
+
tue_interval_1,
|
|
124
|
+
tue_interval_2,
|
|
125
|
+
]
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# Check the capacity, which indicates open when value is positive
|
|
129
|
+
capacity.value_at_time(datetime(2025,7,21,9,30))
|
|
130
|
+
>>> 1 # Open
|
|
131
|
+
|
|
132
|
+
capacity.value_at_time(datetime(2025,7,21,12,30))
|
|
133
|
+
>>> 0 # Closed
|
|
134
|
+
|
|
135
|
+
capacity.value_at_time(datetime(2025,7,22,13,00))
|
|
136
|
+
>>> 1 # Open
|
|
137
|
+
|
|
138
|
+
capacity.value_at_time(datetime(2025,7,22,16,00))
|
|
139
|
+
>>> 0 # Closed
|
|
140
|
+
|
|
141
|
+
capacity.value_at_time(datetime(2025,7,22,15,59))
|
|
142
|
+
>>> 1 # Open
|
|
109
143
|
|
|
110
144
|
See roadmap_ for the list of available and upcoming features.
|
|
111
145
|
|
|
@@ -135,7 +169,7 @@ Features:
|
|
|
135
169
|
- Interval Handler:
|
|
136
170
|
- ✅ Own intervals with associated values
|
|
137
171
|
- ✅ Provide value projection graph
|
|
138
|
-
-
|
|
172
|
+
- ✅ Query value over time
|
|
139
173
|
- 🚧 Access intervals overlapping with a specific timespan
|
|
140
174
|
- Single-level Pegging:
|
|
141
175
|
- 🚧 Introduce object association to Intervals
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|