libres 0.9.0__py3-none-any.whl → 0.9.1__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
@@ -5,7 +5,7 @@ from libres.db import new_scheduler
5
5
 
6
6
  registry = create_default_registry()
7
7
 
8
- __version__ = '0.9.0'
8
+ __version__ = '0.9.1'
9
9
  __all__ = (
10
10
  'new_scheduler',
11
11
  'registry'
@@ -82,6 +82,8 @@ class Registry:
82
82
  """
83
83
 
84
84
  contexts: dict[str, Context]
85
+ # FIXME: Why do we allow this to be None? Do we make use
86
+ # of this anywhere?
85
87
  master_context: Context | None = None
86
88
 
87
89
  def __init__(self) -> None:
libres/db/scheduler.py CHANGED
@@ -269,7 +269,7 @@ class Scheduler(ContextServicesMixin):
269
269
  allocations = allocations.with_entities(Allocation.id)
270
270
  allocations = allocations.filter(Allocation.group.in_(groups))
271
271
 
272
- query = self.managed_allocations()
272
+ query: Query[Allocation] = self.managed_allocations()
273
273
  query = query.join(ReservedSlot)
274
274
  query = query.filter(
275
275
  ReservedSlot.reservation_token == token
@@ -1629,8 +1629,6 @@ class Scheduler(ContextServicesMixin):
1629
1629
  assert start
1630
1630
  assert end
1631
1631
 
1632
- start, end = self._prepare_range(start, end)
1633
-
1634
1632
  assert whole_day in ('yes', 'no', 'any')
1635
1633
  assert groups in ('yes', 'no', 'any')
1636
1634
 
@@ -1645,7 +1643,7 @@ class Scheduler(ContextServicesMixin):
1645
1643
  else:
1646
1644
  day_numbers = None
1647
1645
 
1648
- query = self.allocations_in_range(start, end)
1646
+ query = self.allocations_in_range(*self._prepare_range(start, end))
1649
1647
  query = query.order_by(Allocation._start)
1650
1648
 
1651
1649
  allocations = []
@@ -1657,13 +1655,19 @@ class Scheduler(ContextServicesMixin):
1657
1655
 
1658
1656
  if not self.is_allocation_exposed(allocation):
1659
1657
  continue
1660
-
1661
- s = datetime.combine(allocation.start.date(), start.time())
1662
- e = datetime.combine(allocation.end.date(), end.time())
1663
-
1664
- # the raw dates will be UTC
1665
- s = sedate.replace_timezone(s, 'UTC')
1666
- e = sedate.replace_timezone(e, 'UTC')
1658
+ allocation_start = allocation.display_start()
1659
+ # NOTE: We want the correct timezone, but we don't want the
1660
+ # date to be on the next day for a full-day reservation
1661
+ # so we skip the microsecond addition
1662
+ allocation_end = sedate.to_timezone(allocation.end, self.timezone)
1663
+ s = sedate.standardize_date(datetime.combine(
1664
+ allocation_start.date(),
1665
+ start.time()
1666
+ ), self.timezone)
1667
+ e = sedate.standardize_date(datetime.combine(
1668
+ allocation_end.date(),
1669
+ end.time()
1670
+ ), self.timezone)
1667
1671
 
1668
1672
  if not allocation.overlaps(s, e):
1669
1673
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libres
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: A library to reserve things
5
5
  Home-page: http://github.com/seantis/libres/
6
6
  Author: Denis Krienbühl
@@ -142,6 +142,13 @@ After this, create a new release on Github.
142
142
  Changelog
143
143
  ---------
144
144
 
145
+ 0.9.1 (05.08.2025)
146
+ ~~~~~~~~~~~~~~~~~~~
147
+
148
+ - Fixes bug in `Scheduler.search_allocations` when the searched
149
+ time range contains multiple DST <-> ST transitions.
150
+ [Daverball]
151
+
145
152
  0.9.0 (23.05.2025)
146
153
  ~~~~~~~~~~~~~~~~~~~
147
154
 
@@ -1,15 +1,15 @@
1
1
  libres/.gitignore,sha256=tyWYoDW7-zMdsfiJIVONRWJ5JmqJCTHzBOsi_rkIYZg,49
2
- libres/__init__.py,sha256=PvqWkTPcr2krxpiiHWHCJEJ0-goR_I_aTo41XWRlQvQ,243
2
+ libres/__init__.py,sha256=d2iNp33yOxIx7AAvW064M_9oiCtEl9Zxr1WVwK8Vl1U,243
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=AZMmFVqTVSkK3pomhoamLWOeqynY23g_uf32yjhgrRQ,7353
6
6
  libres/context/exposure.py,sha256=0krsky3XYplG7Uf5oLlQgdXp6XuEDjN2JGe3ljgLM14,287
7
- libres/context/registry.py,sha256=9UZcTQFZnTfHS1ERC8O8wXZqTwsxIz795q5Mi7UvnMg,4894
7
+ libres/context/registry.py,sha256=JfV-QccpDbAEq154aHu7_-hznr5kXYY58czZ-0-m8vA,4986
8
8
  libres/context/session.py,sha256=bVvZ7cvSKffGrzxpDM7vKrGgwAPWRoS4No6HK1--xlg,2488
9
9
  libres/context/settings.py,sha256=IkdG67QUUuk_sQMXiwsJgelrsbx6M-7f72uJBA2JoJA,1374
10
10
  libres/db/__init__.py,sha256=Fks6T8aEacYVvXB9U1v182zKX7SuEUAkC5hTK50AuQk,145
11
11
  libres/db/queries.py,sha256=mVLMcFh7tbAOOp8fveB1T-ZBt0X3hQiaN5Krt5Mmhhs,10917
12
- libres/db/scheduler.py,sha256=L9I-vj3Y71h7rtPyaqfE4dD6QzZ79NiS48oXissY35w,64355
12
+ libres/db/scheduler.py,sha256=Pg-bgyrMgCE54K7sXxChNw_NTIdviCZSO7_X0LG0o34,64711
13
13
  libres/db/models/__init__.py,sha256=IL52K-0tg_v6zuiiE2k4UQNqneeb8CLUUVo_t_OBU-g,325
14
14
  libres/db/models/allocation.py,sha256=Zi-H3HGz4Xt9VhwUZmoUMc8xGr8rPBNiHGumnYcjlwI,29005
15
15
  libres/db/models/base.py,sha256=Y2Lc60vJ1Du73D0sLozVNi1TfhtrQ3i_64NV7hsnc4g,117
@@ -26,8 +26,8 @@ libres/modules/errors.py,sha256=afcvKDfu7XYnGt6CfTG1gpmCaoMTPgtxwmTe2Cyz9qc,2146
26
26
  libres/modules/events.py,sha256=-YHwFJKory8RSIRTths5LBn92sodEPkhARH_a1Xml3c,5299
27
27
  libres/modules/rasterizer.py,sha256=-KYG03YkaPNnyohl_HrEJZqdHrhmGesbLgxxPahNTCc,3155
28
28
  libres/modules/utils.py,sha256=W5Kuu9LhhUWZMKLAhw7DmQEuNYb9aXWpW_HXCn62lhU,1871
29
- libres-0.9.0.dist-info/licenses/LICENSE,sha256=w1rojULT3naueSnr4r62MSQipL4VPtsfEcTFmSKpVuI,1069
30
- libres-0.9.0.dist-info/METADATA,sha256=-nJfZgAP64skrmh5Xh3GwywW0Un7KznV_AbSq9CD6Xg,10048
31
- libres-0.9.0.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
32
- libres-0.9.0.dist-info/top_level.txt,sha256=Exs6AnhZc0UTcsD5Ylyx1P89j19hJ4Dy13jxQyZwi3k,7
33
- libres-0.9.0.dist-info/RECORD,,
29
+ libres-0.9.1.dist-info/licenses/LICENSE,sha256=w1rojULT3naueSnr4r62MSQipL4VPtsfEcTFmSKpVuI,1069
30
+ libres-0.9.1.dist-info/METADATA,sha256=e-7a5dHP6OCJ5ob5wsH1-Wk4pr0qVMMZDU3wtzd4Y98,10222
31
+ libres-0.9.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
32
+ libres-0.9.1.dist-info/top_level.txt,sha256=Exs6AnhZc0UTcsD5Ylyx1P89j19hJ4Dy13jxQyZwi3k,7
33
+ libres-0.9.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5