rbx.cp 0.9.1__py3-none-any.whl → 0.9.2__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.
@@ -1,7 +1,8 @@
1
1
  import contextvars
2
- from enum import Enum
3
2
  from typing import Callable, Optional, Union
4
3
 
4
+ from rbx.autoenum import AutoEnum, alias
5
+
5
6
  Condition = Union[bool, Callable[[], bool]]
6
7
 
7
8
 
@@ -15,11 +16,11 @@ class ConditionedContext:
15
16
  return self.when()
16
17
 
17
18
 
18
- class CacheLevel(Enum):
19
- NO_CACHE = 0
20
- CACHE_TRANSIENTLY = 1
21
- CACHE_COMPILATION = 2
22
- CACHE_ALL = 3
19
+ class CacheLevel(AutoEnum):
20
+ NO_CACHE = alias('none')
21
+ CACHE_TRANSIENTLY = alias('transient')
22
+ CACHE_COMPILATION = alias('compilation')
23
+ CACHE_ALL = alias('all')
23
24
 
24
25
 
25
26
  cache_level_var = contextvars.ContextVar('cache_level', default=CacheLevel.CACHE_ALL)
@@ -30,11 +31,11 @@ def is_compilation_only() -> bool:
30
31
 
31
32
 
32
33
  def is_transient() -> bool:
33
- return cache_level_var.get().value <= CacheLevel.CACHE_TRANSIENTLY.value
34
+ return cache_level_var.get() == CacheLevel.CACHE_TRANSIENTLY or is_no_cache()
34
35
 
35
36
 
36
37
  def is_no_cache() -> bool:
37
- return cache_level_var.get().value <= CacheLevel.NO_CACHE.value
38
+ return cache_level_var.get() == CacheLevel.NO_CACHE
38
39
 
39
40
 
40
41
  class cache_level(ConditionedContext):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rbx.cp
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary:
5
5
  Author: Roberto Sales
6
6
  Requires-Python: >=3.9.1,<4.0.0
@@ -124,7 +124,7 @@ rbx/grading/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
124
124
  rbx/grading/caching.py,sha256=X20v-ZCmcT6OXvWzq2VBdACi6_cEYWB2phkiJ34CNeg,15306
125
125
  rbx/grading/conftest.py,sha256=820Uw3AE-dwAfwLhXjgq_PixpDI1-JEXsOPYf4VT5H8,971
126
126
  rbx/grading/debug_context.py,sha256=kuAXEI8yRG8xfhS9WKKIRh9X0e5JUD8zvl_cpczJTC8,699
127
- rbx/grading/grading_context.py,sha256=DFEG7dUK6acjE1c49i91BCWXqhD36DVU0gVbD-77gCU,3340
127
+ rbx/grading/grading_context.py,sha256=TaRyLwPkkxvspQIFUFk8Ok0T8EST2pHMMNoVDx9lbFU,3416
128
128
  rbx/grading/judge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  rbx/grading/judge/cacher.py,sha256=wtRnVE_Es9xcqIgrhn6WzUoB90aihUuKaFyuVsusngg,20323
130
130
  rbx/grading/judge/digester.py,sha256=gtOIe_iL4PEWA7OKelW1gjSI-nBvbOpDPJGV8VQyjSg,912
@@ -239,8 +239,8 @@ rbx/testcase.py,sha256=yKOq3CAJZ1YTmInvnoIs0u1iJnRj_X85XiWbLI-p9d8,1951
239
239
  rbx/testcase_rendering.py,sha256=nfmv6dSEqd4aR3TsaODwkKGK6AXty_DDKtWf_ejiQpI,2084
240
240
  rbx/testing_utils.py,sha256=x_PqD8Zd2PkN91NxVHUnSTs044-1WK5KKtttKQBXpFs,2083
241
241
  rbx/utils.py,sha256=YvN0q1vaLR9HxUfXKOTx1iN6Bp_fI8YNTQiJ8TNq7eM,4957
242
- rbx_cp-0.9.1.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
243
- rbx_cp-0.9.1.dist-info/METADATA,sha256=Pn1vVMzkP6Kv11iw_UMCy5CMfYjz_FJD92yiB0fuoQQ,4586
244
- rbx_cp-0.9.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
245
- rbx_cp-0.9.1.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
246
- rbx_cp-0.9.1.dist-info/RECORD,,
242
+ rbx_cp-0.9.2.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
243
+ rbx_cp-0.9.2.dist-info/METADATA,sha256=-X0CkdEeIPf0Xnt25cpKEVfp49-N3GN4f_CG5lmmRG0,4586
244
+ rbx_cp-0.9.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
245
+ rbx_cp-0.9.2.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
246
+ rbx_cp-0.9.2.dist-info/RECORD,,
File without changes