libres 0.7.1__py3-none-any.whl → 0.7.3__py3-none-any.whl

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.
libres/__init__.py CHANGED
@@ -3,7 +3,7 @@ from libres.db import new_scheduler
3
3
 
4
4
  registry = create_default_registry()
5
5
 
6
- __version__ = '0.7.1'
6
+ __version__ = '0.7.3'
7
7
  __all__ = (
8
8
  'new_scheduler',
9
9
  'registry'
libres/db/scheduler.py CHANGED
@@ -18,6 +18,7 @@ from libres.modules import utils
18
18
 
19
19
  import typing as _t
20
20
  if _t.TYPE_CHECKING:
21
+ from sedate.types import DateLike
21
22
  from sqlalchemy.orm import Query
22
23
  from typing_extensions import NotRequired, Self, TypeAlias, TypedDict
23
24
 
@@ -893,8 +894,8 @@ class Scheduler(ContextServicesMixin):
893
894
 
894
895
  def remove_unused_allocations(
895
896
  self,
896
- start: datetime,
897
- end: datetime,
897
+ start: 'DateLike',
898
+ end: 'DateLike',
898
899
  days: _t.Optional[_t.Iterable[_t.Union['Day', 'DayNumber']]] = None,
899
900
  exclude_groups: bool = False
900
901
  ) -> int:
@@ -916,7 +917,7 @@ class Scheduler(ContextServicesMixin):
916
917
  be excluded, regardless of what this parameter is set to.
917
918
  """
918
919
 
919
- start, end = self._prepare_range(
920
+ start_dt, end_dt = self._prepare_range(
920
921
  sedate.as_datetime(start),
921
922
  sedate.as_datetime(end)
922
923
  )
@@ -957,22 +958,22 @@ class Scheduler(ContextServicesMixin):
957
958
  groups = groups.having(
958
959
  and_(
959
960
  func.count(Allocation.id) == 1,
960
- start <= func.min(Allocation._start),
961
- func.max(Allocation._end) <= end
961
+ start_dt <= func.min(Allocation._start),
962
+ func.max(Allocation._end) <= end_dt
962
963
  )
963
964
  )
964
965
  else:
965
966
  groups = groups.having(
966
967
  and_(
967
- start <= func.min(Allocation._start),
968
- func.max(Allocation._end) <= end
968
+ start_dt <= func.min(Allocation._start),
969
+ func.max(Allocation._end) <= end_dt
969
970
  )
970
971
  )
971
972
 
972
973
  # all allocations
973
974
  candidates = self.managed_allocations()
974
- candidates = candidates.filter(start <= Allocation._start)
975
- candidates = candidates.filter(Allocation._end <= end)
975
+ candidates = candidates.filter(start_dt <= Allocation._start)
976
+ candidates = candidates.filter(Allocation._end <= end_dt)
976
977
 
977
978
  # .. without the ones with slots
978
979
  candidates = candidates.filter(not_(Allocation.id.in_(slots)))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: libres
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Summary: A library to reserve things
5
5
  Home-page: http://github.com/seantis/libres/
6
6
  Author: Denis Krienbühl
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.8
18
18
  Classifier: Programming Language :: Python :: 3.9
19
19
  Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
21
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
23
  Requires-Python: >=3.8
23
24
  Description-Content-Type: text/x-rst
@@ -25,26 +26,26 @@ License-File: LICENSE
25
26
  Requires-Dist: python-dateutil
26
27
  Requires-Dist: psycopg2-binary
27
28
  Requires-Dist: pytz
28
- Requires-Dist: sedate >=1.0.0
29
- Requires-Dist: SQLAlchemy <2,>=0.9
29
+ Requires-Dist: sedate>=1.0.0
30
+ Requires-Dist: SQLAlchemy<2,>=0.9
30
31
  Provides-Extra: dev
31
- Requires-Dist: bandit[toml] ; extra == 'dev'
32
- Requires-Dist: flake8 ; extra == 'dev'
33
- Requires-Dist: flake8-bugbear ; extra == 'dev'
34
- Requires-Dist: pre-commit ; extra == 'dev'
35
- Requires-Dist: tox ; extra == 'dev'
32
+ Requires-Dist: bandit[toml]; extra == "dev"
33
+ Requires-Dist: flake8; extra == "dev"
34
+ Requires-Dist: flake8-bugbear; extra == "dev"
35
+ Requires-Dist: pre-commit; extra == "dev"
36
+ Requires-Dist: tox; extra == "dev"
36
37
  Provides-Extra: mypy
37
- Requires-Dist: mypy ; extra == 'mypy'
38
- Requires-Dist: sqlalchemy-stubs ; extra == 'mypy'
39
- Requires-Dist: types-psycopg2 ; extra == 'mypy'
40
- Requires-Dist: types-python-dateutil ; extra == 'mypy'
41
- Requires-Dist: types-pytz ; extra == 'mypy'
42
- Requires-Dist: typing-extensions ; extra == 'mypy'
38
+ Requires-Dist: mypy; extra == "mypy"
39
+ Requires-Dist: sqlalchemy-stubs; extra == "mypy"
40
+ Requires-Dist: types-psycopg2; extra == "mypy"
41
+ Requires-Dist: types-python-dateutil; extra == "mypy"
42
+ Requires-Dist: types-pytz; extra == "mypy"
43
+ Requires-Dist: typing-extensions; extra == "mypy"
43
44
  Provides-Extra: test
44
- Requires-Dist: jsonpickle ; extra == 'test'
45
- Requires-Dist: pytest ; extra == 'test'
46
- Requires-Dist: pytest-codecov[git] ; extra == 'test'
47
- Requires-Dist: testing.postgresql ; extra == 'test'
45
+ Requires-Dist: jsonpickle; extra == "test"
46
+ Requires-Dist: pytest; extra == "test"
47
+ Requires-Dist: pytest-codecov[git]; extra == "test"
48
+ Requires-Dist: testing.postgresql; extra == "test"
48
49
 
49
50
  Libres
50
51
  ======
@@ -135,6 +136,18 @@ After this, create a new release on Github.
135
136
  Changelog
136
137
  ---------
137
138
 
139
+ 0.7.3 (2024-08-21)
140
+ ~~~~~~~~~~~~~~~~~~~
141
+
142
+ - Adds support for Python 3.12.
143
+ [Daverball]
144
+
145
+ 0.7.2 (2024-02-07)
146
+ ~~~~~~~~~~~~~~~~~~~
147
+
148
+ - Fixes another incorrect type annotation in `Scheduler`.
149
+ [Daverball]
150
+
138
151
  0.7.1 (2024-01-18)
139
152
  ~~~~~~~~~~~~~~~~~~~
140
153
 
@@ -1,5 +1,5 @@
1
1
  libres/.gitignore,sha256=tyWYoDW7-zMdsfiJIVONRWJ5JmqJCTHzBOsi_rkIYZg,49
2
- libres/__init__.py,sha256=N9x5NDwywqesaFCjJhGUN_yVxXmSh6Op_FIrXGzLF64,207
2
+ libres/__init__.py,sha256=gZ1PsCC77HhOe3BNP2M-JThC0Yx3p_2FMdmrke9n3VQ,207
3
3
  libres/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  libres/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  libres/context/core.py,sha256=KHM0kEWtUx8OEBhkhjYMzgYQde5tO7VwvKMSvOWvd9U,7054
@@ -9,7 +9,7 @@ libres/context/session.py,sha256=3aTj7Tt_xSSxCn3NqpLFnJkFfj6Eusovzx-JZLcz4FI,247
9
9
  libres/context/settings.py,sha256=JNMVWRdXfqdbxgiXp8nivBI49mF8J-Q5xi3Ui-_op-Q,1322
10
10
  libres/db/__init__.py,sha256=FUqf3TZ5WGnOlOXXDfgfG8VBrzirfTR82eePQS53naU,95
11
11
  libres/db/queries.py,sha256=V0L-QJlRkt30k6qHriwMkNGX2MU8idWreVPgsYiaZV0,10864
12
- libres/db/scheduler.py,sha256=hFp0H1bi9VC0FMCO9Y3qF22JY2RWIdLUgs8Q6y3fnL4,64549
12
+ libres/db/scheduler.py,sha256=og5cDFvRNATMj-U9UGYZVj0aqxKtsWpm2ne_Ic0mj3I,64615
13
13
  libres/db/models/__init__.py,sha256=OvQEL2iMk1GbeXyCz8rQGv0mBvzol2C3wRsDVa9zJWY,289
14
14
  libres/db/models/allocation.py,sha256=UWwXVtb-b_9dyVVXZ_Bo0vqGIK0xbgxmvfBDl3uYQHs,28675
15
15
  libres/db/models/base.py,sha256=UPY_Z6G4bNhkIur1d04gb4KfBrEk2ZpE0lY8bNJrhkg,81
@@ -26,8 +26,8 @@ libres/modules/errors.py,sha256=0cRiCKHekaLj0_RVdt6H-VP7dSkI3TQTzjX8u7VUOrI,2120
26
26
  libres/modules/events.py,sha256=n1RdSmCuhCccmeKk5dOoQ-1q75f-uJh9dIcY2h33cIg,5283
27
27
  libres/modules/rasterizer.py,sha256=9Bvp4uSCOtAW8XIfPukjwnTaine1iyFQAHH3uXZiHVo,3006
28
28
  libres/modules/utils.py,sha256=Xy_U6074hEY_EwVGJyFqYWI4zL2Mv0-JS5bGW7S7s0M,1793
29
- libres-0.7.1.dist-info/LICENSE,sha256=w1rojULT3naueSnr4r62MSQipL4VPtsfEcTFmSKpVuI,1069
30
- libres-0.7.1.dist-info/METADATA,sha256=2VTULI1rcl1aKPobVp2KbDFmrqNOGLeLorFtoWZGyBk,8968
31
- libres-0.7.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
32
- libres-0.7.1.dist-info/top_level.txt,sha256=Exs6AnhZc0UTcsD5Ylyx1P89j19hJ4Dy13jxQyZwi3k,7
33
- libres-0.7.1.dist-info/RECORD,,
29
+ libres-0.7.3.dist-info/LICENSE,sha256=w1rojULT3naueSnr4r62MSQipL4VPtsfEcTFmSKpVuI,1069
30
+ libres-0.7.3.dist-info/METADATA,sha256=ek0WQ0MaY_WvOf0u3UUtOKn2GUuplGkZ-RDfp30JIPk,9202
31
+ libres-0.7.3.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
32
+ libres-0.7.3.dist-info/top_level.txt,sha256=Exs6AnhZc0UTcsD5Ylyx1P89j19hJ4Dy13jxQyZwi3k,7
33
+ libres-0.7.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: setuptools (73.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5