ovld 0.4.5__tar.gz → 0.4.6__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.
Files changed (158) hide show
  1. {ovld-0.4.5 → ovld-0.4.6}/.github/workflows/python-package.yml +3 -0
  2. ovld-0.4.6/.python-version +1 -0
  3. {ovld-0.4.5 → ovld-0.4.6}/PKG-INFO +1 -1
  4. {ovld-0.4.5 → ovld-0.4.6}/bench.py +0 -1
  5. ovld-0.4.6/ichk.py +39 -0
  6. {ovld-0.4.5 → ovld-0.4.6}/pyproject.toml +1 -1
  7. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/dependent.py +2 -1
  8. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/mro.py +5 -0
  9. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/types.py +11 -7
  10. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/utils.py +11 -0
  11. ovld-0.4.6/src/ovld/version.py +1 -0
  12. ovld-0.4.6/tests/__init__.py +0 -0
  13. {ovld-0.4.5 → ovld-0.4.6}/tests/test_ovld.py +23 -0
  14. {ovld-0.4.5 → ovld-0.4.6}/typo.py +13 -2
  15. {ovld-0.4.5 → ovld-0.4.6}/uv.lock +1 -1
  16. ovld-0.4.5/.python-version +0 -1
  17. ovld-0.4.5/src/ovld/version.py +0 -1
  18. {ovld-0.4.5 → ovld-0.4.6}/.bsync-snap-20220324145902.852076 +0 -0
  19. {ovld-0.4.5 → ovld-0.4.6}/.bsync-snap-20240916114026.355340 +0 -0
  20. {ovld-0.4.5 → ovld-0.4.6}/.envrc +0 -0
  21. {ovld-0.4.5 → ovld-0.4.6}/.gitignore +0 -0
  22. {ovld-0.4.5 → ovld-0.4.6}/.readthedocs.yaml +0 -0
  23. {ovld-0.4.5 → ovld-0.4.6}/LICENSE +0 -0
  24. {ovld-0.4.5 → ovld-0.4.6}/README.md +0 -0
  25. {ovld-0.4.5 → ovld-0.4.6}/add.py +0 -0
  26. {ovld-0.4.5 → ovld-0.4.6}/anal.py +0 -0
  27. {ovld-0.4.5 → ovld-0.4.6}/beary.py +0 -0
  28. {ovld-0.4.5 → ovld-0.4.6}/bench/requirements.txt +0 -0
  29. {ovld-0.4.5 → ovld-0.4.6}/benchd.py +0 -0
  30. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/__init__.py +0 -0
  31. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/common.py +0 -0
  32. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_add.py +0 -0
  33. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_ast.py +0 -0
  34. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_calc.py +0 -0
  35. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_fib.py +0 -0
  36. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_multer.py +0 -0
  37. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_regexp.py +0 -0
  38. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_trivial.py +0 -0
  39. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_tuple.py +0 -0
  40. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_tweaknum.py +0 -0
  41. {ovld-0.4.5 → ovld-0.4.6}/benchmarks/test_typechecking.py +0 -0
  42. {ovld-0.4.5 → ovld-0.4.6}/cloz.py +0 -0
  43. {ovld-0.4.5 → ovld-0.4.6}/coco.py +0 -0
  44. {ovld-0.4.5 → ovld-0.4.6}/data.py +0 -0
  45. {ovld-0.4.5 → ovld-0.4.6}/didi.py +0 -0
  46. {ovld-0.4.5 → ovld-0.4.6}/docs/compare.md +0 -0
  47. {ovld-0.4.5 → ovld-0.4.6}/docs/dependent.md +0 -0
  48. {ovld-0.4.5 → ovld-0.4.6}/docs/features.md +0 -0
  49. {ovld-0.4.5 → ovld-0.4.6}/docs/index.md +0 -0
  50. {ovld-0.4.5 → ovld-0.4.6}/docs/types.md +0 -0
  51. {ovld-0.4.5 → ovld-0.4.6}/docs/usage.md +0 -0
  52. {ovld-0.4.5 → ovld-0.4.6}/doo.py +0 -0
  53. {ovld-0.4.5 → ovld-0.4.6}/edges.py +0 -0
  54. {ovld-0.4.5 → ovld-0.4.6}/explore.py +0 -0
  55. {ovld-0.4.5 → ovld-0.4.6}/facto.py +0 -0
  56. {ovld-0.4.5 → ovld-0.4.6}/gen_comparison_table.py +0 -0
  57. {ovld-0.4.5 → ovld-0.4.6}/gen_typecheck_table.py +0 -0
  58. {ovld-0.4.5 → ovld-0.4.6}/gentest.py +0 -0
  59. {ovld-0.4.5 → ovld-0.4.6}/hello.py +0 -0
  60. {ovld-0.4.5 → ovld-0.4.6}/hntest.py +0 -0
  61. {ovld-0.4.5 → ovld-0.4.6}/klos.py +0 -0
  62. {ovld-0.4.5 → ovld-0.4.6}/kraken.py +0 -0
  63. {ovld-0.4.5 → ovld-0.4.6}/mkdocs.yml +0 -0
  64. {ovld-0.4.5 → ovld-0.4.6}/nxt.py +0 -0
  65. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.0-py3-none-any.whl +0 -0
  66. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.0.tar.gz +0 -0
  67. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.1-py3-none-any.whl +0 -0
  68. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.1.tar.gz +0 -0
  69. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.2-py3-none-any.whl +0 -0
  70. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.2.tar.gz +0 -0
  71. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.3-py3-none-any.whl +0 -0
  72. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.3.tar.gz +0 -0
  73. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.4-py3-none-any.whl +0 -0
  74. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.4.tar.gz +0 -0
  75. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.5-py3-none-any.whl +0 -0
  76. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.5.tar.gz +0 -0
  77. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.6-py3-none-any.whl +0 -0
  78. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.6.tar.gz +0 -0
  79. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.7-py3-none-any.whl +0 -0
  80. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.7.tar.gz +0 -0
  81. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.8-py3-none-any.whl +0 -0
  82. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.8.tar.gz +0 -0
  83. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.9-py3-none-any.whl +0 -0
  84. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.1.9.tar.gz +0 -0
  85. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.0-py3-none-any.whl +0 -0
  86. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.0.tar.gz +0 -0
  87. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.1-py3-none-any.whl +0 -0
  88. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.1.tar.gz +0 -0
  89. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.10-py3-none-any.whl +0 -0
  90. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.10.tar.gz +0 -0
  91. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.11-py3-none-any.whl +0 -0
  92. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.11.tar.gz +0 -0
  93. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.2-py3-none-any.whl +0 -0
  94. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.2.tar.gz +0 -0
  95. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.3-py3-none-any.whl +0 -0
  96. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.3.tar.gz +0 -0
  97. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.4-py3-none-any.whl +0 -0
  98. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.4.tar.gz +0 -0
  99. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.5-py3-none-any.whl +0 -0
  100. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.5.tar.gz +0 -0
  101. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.6-py3-none-any.whl +0 -0
  102. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.6.tar.gz +0 -0
  103. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.7-py3-none-any.whl +0 -0
  104. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.7.tar.gz +0 -0
  105. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.8-py3-none-any.whl +0 -0
  106. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.8.tar.gz +0 -0
  107. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.9-py3-none-any.whl +0 -0
  108. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.2.9.tar.gz +0 -0
  109. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.0-py3-none-any.whl +0 -0
  110. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.0.tar.gz +0 -0
  111. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.1-py3-none-any.whl +0 -0
  112. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.1.tar.gz +0 -0
  113. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.2-py3-none-any.whl +0 -0
  114. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.2.tar.gz +0 -0
  115. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.3-py3-none-any.whl +0 -0
  116. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.3.tar.gz +0 -0
  117. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.4-py3-none-any.whl +0 -0
  118. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.4.tar.gz +0 -0
  119. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.5-py3-none-any.whl +0 -0
  120. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.5.tar.gz +0 -0
  121. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.8-py3-none-any.whl +0 -0
  122. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.8.tar.gz +0 -0
  123. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.9-py3-none-any.whl +0 -0
  124. {ovld-0.4.5 → ovld-0.4.6}/old-dist/ovld-0.3.9.tar.gz +0 -0
  125. {ovld-0.4.5 → ovld-0.4.6}/one_two_three.py +0 -0
  126. {ovld-0.4.5 → ovld-0.4.6}/outoftheway.toml +0 -0
  127. {ovld-0.4.5 → ovld-0.4.6}/reddit.md +0 -0
  128. {ovld-0.4.5 → ovld-0.4.6}/reddit.py +0 -0
  129. {ovld-0.4.5 → ovld-0.4.6}/refun.py +0 -0
  130. {ovld-0.4.5 → ovld-0.4.6}/reper.py +0 -0
  131. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/__init__.py +0 -0
  132. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/abc.py +0 -0
  133. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/core.py +0 -0
  134. /ovld-0.4.5/tests/__init__.py → /ovld-0.4.6/src/ovld/py.typed +0 -0
  135. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/recode.py +0 -0
  136. {ovld-0.4.5 → ovld-0.4.6}/src/ovld/typemap.py +0 -0
  137. {ovld-0.4.5 → ovld-0.4.6}/stuff.md +0 -0
  138. {ovld-0.4.5 → ovld-0.4.6}/tb.py +0 -0
  139. {ovld-0.4.5 → ovld-0.4.6}/tensor.py +0 -0
  140. {ovld-0.4.5 → ovld-0.4.6}/tests/modules/gingerbread.py +0 -0
  141. {ovld-0.4.5 → ovld-0.4.6}/tests/test_abc.py +0 -0
  142. {ovld-0.4.5 → ovld-0.4.6}/tests/test_dependent.py +0 -0
  143. {ovld-0.4.5 → ovld-0.4.6}/tests/test_examples.py +0 -0
  144. {ovld-0.4.5 → ovld-0.4.6}/tests/test_global.py +0 -0
  145. {ovld-0.4.5 → ovld-0.4.6}/tests/test_mro.py +0 -0
  146. {ovld-0.4.5 → ovld-0.4.6}/tests/test_ovld/test_display.txt +0 -0
  147. {ovld-0.4.5 → ovld-0.4.6}/tests/test_ovld/test_display_more.txt +0 -0
  148. {ovld-0.4.5 → ovld-0.4.6}/tests/test_ovld/test_doc.txt +0 -0
  149. {ovld-0.4.5 → ovld-0.4.6}/tests/test_ovld/test_doc2.txt +0 -0
  150. {ovld-0.4.5 → ovld-0.4.6}/tests/test_ovld/test_method_doc.txt +0 -0
  151. {ovld-0.4.5 → ovld-0.4.6}/tests/test_typemap.py +0 -0
  152. {ovld-0.4.5 → ovld-0.4.6}/tests/test_types.py +0 -0
  153. {ovld-0.4.5 → ovld-0.4.6}/tests/test_utils.py +0 -0
  154. {ovld-0.4.5 → ovld-0.4.6}/todo.q +0 -0
  155. {ovld-0.4.5 → ovld-0.4.6}/toot.py +0 -0
  156. {ovld-0.4.5 → ovld-0.4.6}/world.yaml +0 -0
  157. {ovld-0.4.5 → ovld-0.4.6}/x.py +0 -0
  158. {ovld-0.4.5 → ovld-0.4.6}/zaggo +0 -0
@@ -40,6 +40,8 @@ jobs:
40
40
  - python: '3.11'
41
41
  coverage: false
42
42
  - python: '3.12'
43
+ coverage: false
44
+ - python: '3.13'
43
45
  coverage: true
44
46
  steps:
45
47
  - name: Check out the code
@@ -70,6 +72,7 @@ jobs:
70
72
  - python: '3.10'
71
73
  - python: '3.11'
72
74
  - python: '3.12'
75
+ - python: '3.13'
73
76
  steps:
74
77
  - name: Check out the code
75
78
  uses: actions/checkout@v3
@@ -0,0 +1 @@
1
+ 3.13
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ovld
3
- Version: 0.4.5
3
+ Version: 0.4.6
4
4
  Summary: Overloading Python functions
5
5
  Project-URL: Homepage, https://ovld.readthedocs.io/en/latest/
6
6
  Project-URL: Documentation, https://ovld.readthedocs.io/en/latest/
@@ -28,7 +28,6 @@ def smap(x: dict, y: dict):
28
28
 
29
29
  @ovld
30
30
  def smap(x: object, z: object):
31
- 1 / 0
32
31
  return x + z
33
32
 
34
33
 
ovld-0.4.6/ichk.py ADDED
@@ -0,0 +1,39 @@
1
+ from ovld.types import Dataclass
2
+
3
+
4
+ class metatron(type):
5
+ def __subclasscheck__(cls, c):
6
+ return True
7
+
8
+ # def __instancecheck__(cls, arg):
9
+ # print(cls)
10
+ # return arg == 3
11
+
12
+
13
+ class A(metaclass=metatron):
14
+ pass
15
+
16
+
17
+ class B:
18
+ pass
19
+
20
+
21
+ class C:
22
+ pass
23
+
24
+
25
+ print(issubclass(B, A))
26
+ print(isinstance(B(), A))
27
+ # print(isinstance(3, A))
28
+
29
+
30
+ def see(x):
31
+ ichk = type(x).__instancecheck__
32
+ print(id(ichk), ichk)
33
+
34
+
35
+ see(Dataclass)
36
+ see(A)
37
+ see(C)
38
+ see(object)
39
+ see(int)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ovld"
3
- version = "0.4.5"
3
+ version = "0.4.6"
4
4
  description = "Overloading Python functions"
5
5
  authors = [
6
6
  { name = "Olivier Breuleux", email = "breuleux@gmail.com" }
@@ -15,6 +15,7 @@ from .types import (
15
15
  Intersection,
16
16
  Order,
17
17
  clsstring,
18
+ get_args,
18
19
  normalize_type,
19
20
  subclasscheck,
20
21
  typeorder,
@@ -61,7 +62,7 @@ def combine(master_template, args):
61
62
  def is_dependent(t):
62
63
  if isinstance(t, DependentType):
63
64
  return True
64
- elif any(is_dependent(subt) for subt in getattr(t, "__args__", ())):
65
+ elif any(is_dependent(subt) for subt in get_args(t)):
65
66
  return True
66
67
  return False
67
68
 
@@ -3,6 +3,8 @@ from enum import Enum
3
3
  from graphlib import TopologicalSorter
4
4
  from typing import get_args, get_origin
5
5
 
6
+ from .utils import UnionTypes
7
+
6
8
 
7
9
  class Order(Enum):
8
10
  LESS = -1
@@ -121,6 +123,9 @@ def subclasscheck(t1, t2):
121
123
  ):
122
124
  return result
123
125
 
126
+ if t2 in UnionTypes:
127
+ return isinstance(t1, t2)
128
+
124
129
  o1 = get_origin(t1)
125
130
  o2 = get_origin(t2)
126
131
 
@@ -3,16 +3,18 @@ import sys
3
3
  import typing
4
4
  from dataclasses import dataclass
5
5
  from functools import partial
6
- from typing import Protocol, runtime_checkable
6
+ from typing import Protocol, get_args, runtime_checkable
7
7
 
8
8
  from .mro import Order, TypeRelationship, subclasscheck, typeorder
9
9
  from .typemap import TypeMap
10
- from .utils import UsageError, clsstring
10
+ from .utils import UnionType, UnionTypes, UsageError, clsstring
11
11
 
12
- try:
13
- from types import UnionType
14
- except ImportError: # pragma: no cover
15
- UnionType = None
12
+
13
+ def get_args(tp):
14
+ args = getattr(tp, "__args__", None)
15
+ if not isinstance(args, tuple):
16
+ args = ()
17
+ return args
16
18
 
17
19
 
18
20
  class TypeNormalizer:
@@ -37,6 +39,8 @@ class TypeNormalizer:
37
39
  t = object
38
40
  elif t is inspect._empty:
39
41
  t = object
42
+ elif t in UnionTypes:
43
+ return type[t]
40
44
  elif isinstance(t, typing._AnnotatedAlias):
41
45
  t = t.__origin__
42
46
 
@@ -82,7 +86,7 @@ class MetaMC(type):
82
86
  return super().__new__(T, name, (), {"_handler": handler})
83
87
 
84
88
  def __init__(cls, name, handler):
85
- cls.__args__ = getattr(handler, "__args__", ())
89
+ cls.__args__ = get_args(handler)
86
90
 
87
91
  def codegen(cls):
88
92
  return cls._handler.codegen()
@@ -5,6 +5,15 @@ import re
5
5
  import typing
6
6
  from itertools import count
7
7
 
8
+ try:
9
+ from types import UnionType
10
+
11
+ UnionTypes = (type(typing.Union[int, str]), UnionType)
12
+
13
+ except ImportError: # pragma: no cover
14
+ UnionType = None
15
+ UnionTypes = (type(typing.Union[int, str]),)
16
+
8
17
 
9
18
  class Named:
10
19
  """A named object.
@@ -90,6 +99,8 @@ def clsstring(cls):
90
99
  def subtler_type(obj):
91
100
  if isinstance(obj, GenericAlias):
92
101
  return type[obj]
102
+ elif isinstance(obj, UnionTypes):
103
+ return type[obj]
93
104
  elif obj is typing.Any:
94
105
  return type[object]
95
106
  elif isinstance(obj, type):
@@ -0,0 +1 @@
1
+ version = "0.4.6"
File without changes
@@ -18,6 +18,7 @@ from ovld import (
18
18
  recurse,
19
19
  )
20
20
  from ovld.dependent import Dependent, Equals, StartsWith
21
+ from ovld.types import UnionTypes
21
22
  from ovld.utils import MISSING, UsageError
22
23
 
23
24
  from .test_typemap import Animal, Bird, Mammal
@@ -1240,6 +1241,28 @@ def test_type_any():
1240
1241
  assert f(typing.Any) == "yes"
1241
1242
 
1242
1243
 
1244
+ UT = type(typing.Union[int, str])
1245
+
1246
+
1247
+ @pytest.mark.skipif(
1248
+ sys.version_info < (3, 10),
1249
+ reason="union syntax requires python3.10 or higher",
1250
+ )
1251
+ def test_union_catchall():
1252
+ @ovld
1253
+ def f(t: UnionTypes):
1254
+ return "yes"
1255
+
1256
+ @ovld
1257
+ def f(t: type[object]):
1258
+ return "no"
1259
+
1260
+ assert f(typing.Optional[float]) == "yes"
1261
+ assert f(typing.Union[int, str]) == "yes"
1262
+ assert f(int | str) == "yes"
1263
+ assert f(int) == "no"
1264
+
1265
+
1243
1266
  def test_annotated():
1244
1267
  @ovld
1245
1268
  def f(x: typing.Annotated[int, "blah"]):
@@ -1,13 +1,23 @@
1
1
  # from typing import TYPE_CHECKING
2
- # from ovld import ovld
2
+ from ovld import ovld
3
+ from ovld.core import OvldMC
4
+
3
5
  # from plum import dispatch as ovld
4
6
  # from multimethod import multimethod as ovld
5
- from runtype import multidispatch as ovld
7
+ # from runtype import multidispatch as ovld
6
8
 
7
9
  # # if TYPE_CHECKING:
8
10
  # from typing import overload
9
11
 
10
12
 
13
+ class O(metaclass=OvldMC):
14
+ def f(self, x: int):
15
+ pass
16
+
17
+ def f(self, x: str):
18
+ pass
19
+
20
+
11
21
  @ovld
12
22
  def f(x: int) -> int:
13
23
  "A"
@@ -23,3 +33,4 @@ def f(x: str) -> int:
23
33
  f
24
34
  print(f(8))
25
35
  print(f("8"))
36
+ print(f([]))
@@ -330,7 +330,7 @@ wheels = [
330
330
 
331
331
  [[package]]
332
332
  name = "ovld"
333
- version = "0.4.3"
333
+ version = "0.4.5"
334
334
  source = { editable = "." }
335
335
 
336
336
  [package.dev-dependencies]
@@ -1 +0,0 @@
1
- 3.12.4
@@ -1 +0,0 @@
1
- version = "0.4.5"
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
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
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
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
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
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
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
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
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
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
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
File without changes
File without changes
File without changes
File without changes
File without changes