ovld 0.3.5__tar.gz → 0.3.7__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.
- ovld-0.3.7/.envrc +1 -0
- ovld-0.3.7/.github/workflows/python-package.yml +61 -0
- ovld-0.3.7/.gitignore +5 -0
- ovld-0.3.7/.python-version +1 -0
- {ovld-0.3.5 → ovld-0.3.7}/PKG-INFO +6 -16
- ovld-0.3.7/pyproject.toml +42 -0
- ovld-0.3.7/requirements-dev.lock +25 -0
- ovld-0.3.7/requirements.lock +12 -0
- {ovld-0.3.5 → ovld-0.3.7/src}/ovld/core.py +2 -0
- ovld-0.3.7/src/ovld/version.py +1 -0
- ovld-0.3.7/tests/__init__.py +0 -0
- ovld-0.3.7/tests/modules/gingerbread.py +3 -0
- ovld-0.3.7/tests/test_global.py +52 -0
- ovld-0.3.7/tests/test_ovld.py +1169 -0
- ovld-0.3.7/tests/test_typemap.py +145 -0
- ovld-0.3.7/tests/test_utils.py +174 -0
- ovld-0.3.5/ovld/version.py +0 -1
- ovld-0.3.5/pyproject.toml +0 -32
- {ovld-0.3.5 → ovld-0.3.7}/LICENSE +0 -0
- {ovld-0.3.5 → ovld-0.3.7}/README.md +0 -0
- {ovld-0.3.5 → ovld-0.3.7/src}/ovld/__init__.py +0 -0
- {ovld-0.3.5 → ovld-0.3.7/src}/ovld/mro.py +0 -0
- {ovld-0.3.5 → ovld-0.3.7/src}/ovld/utils.py +0 -0
ovld-0.3.7/.envrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
. .venv/bin/activate
|
@@ -0,0 +1,61 @@
|
|
1
|
+
name: Python package
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
lint:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
python-version: ['3.12']
|
15
|
+
steps:
|
16
|
+
- name: Check out the code
|
17
|
+
uses: actions/checkout@v3
|
18
|
+
- name: Install rye
|
19
|
+
uses: eifinger/setup-rye@v4
|
20
|
+
- name: Pin Python version
|
21
|
+
run: rye pin ${{ matrix.python-version }}
|
22
|
+
- name: Sync dependencies
|
23
|
+
run: rye sync
|
24
|
+
- name: Lint check
|
25
|
+
run: rye check
|
26
|
+
- name: Check formatting
|
27
|
+
run: rye format --check
|
28
|
+
|
29
|
+
test:
|
30
|
+
runs-on: ubuntu-latest
|
31
|
+
strategy:
|
32
|
+
matrix:
|
33
|
+
settings:
|
34
|
+
- python: '3.8'
|
35
|
+
coverage: false
|
36
|
+
- python: '3.9'
|
37
|
+
coverage: false
|
38
|
+
- python: '3.10'
|
39
|
+
coverage: false
|
40
|
+
- python: '3.11'
|
41
|
+
coverage: false
|
42
|
+
- python: '3.12'
|
43
|
+
coverage: true
|
44
|
+
steps:
|
45
|
+
- name: Check out the code
|
46
|
+
uses: actions/checkout@v3
|
47
|
+
- name: Install rye
|
48
|
+
uses: eifinger/setup-rye@v4
|
49
|
+
- name: Pin Python version
|
50
|
+
run: rye pin ${{ matrix.settings.python }}
|
51
|
+
- name: Sync dependencies
|
52
|
+
run: rye sync
|
53
|
+
- name: Test with pytest
|
54
|
+
if: ${{ !matrix.settings.coverage }}
|
55
|
+
run: rye run pytest
|
56
|
+
- name: Test with pytest and coverage
|
57
|
+
if: ${{ matrix.settings.coverage }}
|
58
|
+
run: rye run pytest --cov=src --cov-report term-missing
|
59
|
+
- name: Verify coverage
|
60
|
+
if: ${{ matrix.settings.coverage }}
|
61
|
+
run: rye run coverage report | tail -1 | egrep "TOTAL +[0-9]+ +0 +100%"
|
ovld-0.3.7/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.12.4
|
@@ -1,20 +1,11 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: ovld
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.7
|
4
4
|
Summary: Overloading Python functions
|
5
|
-
|
6
|
-
License: MIT
|
7
|
-
|
8
|
-
|
9
|
-
Requires-Python: >=3.8,<4.0
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
17
|
-
Project-URL: Repository, https://github.com/breuleux/ovld
|
5
|
+
Author-email: Olivier Breuleux <breuleux@gmail.com>
|
6
|
+
License-Expression: MIT
|
7
|
+
License-File: LICENSE
|
8
|
+
Requires-Python: >=3.8
|
18
9
|
Description-Content-Type: text/markdown
|
19
10
|
|
20
11
|
|
@@ -328,4 +319,3 @@ bad([1], [2])
|
|
328
319
|
The functions on the stack have names like `bad.entry`, `bad.dispatch`, `bad[list, list]` and `bad[*, *]` (`*` stands for `object`), which lets you better understand what happened just from the stack trace.
|
329
320
|
|
330
321
|
This also means profilers will be able to differentiate between these paths and between variants, even if they share code paths.
|
331
|
-
|
@@ -0,0 +1,42 @@
|
|
1
|
+
[project]
|
2
|
+
name = "ovld"
|
3
|
+
version = "0.3.7"
|
4
|
+
description = "Overloading Python functions"
|
5
|
+
authors = [
|
6
|
+
{ name = "Olivier Breuleux", email = "breuleux@gmail.com" }
|
7
|
+
]
|
8
|
+
dependencies = []
|
9
|
+
readme = "README.md"
|
10
|
+
license = "MIT"
|
11
|
+
homepage = "https://github.com/breuleux/ovld"
|
12
|
+
repository = "https://github.com/breuleux/ovld"
|
13
|
+
requires-python = ">= 3.8"
|
14
|
+
|
15
|
+
[build-system]
|
16
|
+
requires = ["hatchling"]
|
17
|
+
build-backend = "hatchling.build"
|
18
|
+
|
19
|
+
[tool.rye]
|
20
|
+
managed = true
|
21
|
+
dev-dependencies = [
|
22
|
+
"codefind~=0.1.6",
|
23
|
+
"pytest>=8.3.2",
|
24
|
+
"pytest-cov>=5.0.0",
|
25
|
+
"uv>=0.2.30",
|
26
|
+
]
|
27
|
+
|
28
|
+
[tool.hatch.metadata]
|
29
|
+
allow-direct-references = true
|
30
|
+
|
31
|
+
[tool.hatch.build.targets.wheel]
|
32
|
+
packages = ["src/ovld"]
|
33
|
+
|
34
|
+
[tool.ruff]
|
35
|
+
line-length = 80
|
36
|
+
|
37
|
+
[tool.ruff.lint]
|
38
|
+
extend-select = ["I"]
|
39
|
+
ignore = ["E241", "F722", "E501", "E203", "F811", "F821"]
|
40
|
+
|
41
|
+
[tool.ruff.lint.per-file-ignores]
|
42
|
+
"__init__.py" = ["F401", "F403"]
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# generated by rye
|
2
|
+
# use `rye lock` or `rye sync` to update this lockfile
|
3
|
+
#
|
4
|
+
# last locked with the following flags:
|
5
|
+
# pre: false
|
6
|
+
# features: []
|
7
|
+
# all-features: false
|
8
|
+
# with-sources: false
|
9
|
+
# generate-hashes: false
|
10
|
+
# universal: false
|
11
|
+
|
12
|
+
-e file:.
|
13
|
+
codefind==0.1.6
|
14
|
+
coverage==7.6.0
|
15
|
+
# via pytest-cov
|
16
|
+
iniconfig==2.0.0
|
17
|
+
# via pytest
|
18
|
+
packaging==24.1
|
19
|
+
# via pytest
|
20
|
+
pluggy==1.5.0
|
21
|
+
# via pytest
|
22
|
+
pytest==8.3.2
|
23
|
+
# via pytest-cov
|
24
|
+
pytest-cov==5.0.0
|
25
|
+
uv==0.2.30
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# generated by rye
|
2
|
+
# use `rye lock` or `rye sync` to update this lockfile
|
3
|
+
#
|
4
|
+
# last locked with the following flags:
|
5
|
+
# pre: false
|
6
|
+
# features: []
|
7
|
+
# all-features: false
|
8
|
+
# with-sources: false
|
9
|
+
# generate-hashes: false
|
10
|
+
# universal: false
|
11
|
+
|
12
|
+
-e file:.
|
@@ -0,0 +1 @@
|
|
1
|
+
version = "0.3.7"
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
from ovld import ovld, ovld_dispatch
|
2
|
+
|
3
|
+
_ovld_exc = None
|
4
|
+
try:
|
5
|
+
|
6
|
+
@ovld
|
7
|
+
def pluralize(x: int):
|
8
|
+
return x + 1
|
9
|
+
|
10
|
+
@ovld
|
11
|
+
def pluralize(x: str):
|
12
|
+
return x + "s"
|
13
|
+
|
14
|
+
except Exception as exc:
|
15
|
+
_ovld_exc = exc
|
16
|
+
|
17
|
+
|
18
|
+
_ovld_dispatch_exc = None
|
19
|
+
try:
|
20
|
+
|
21
|
+
@ovld_dispatch
|
22
|
+
def roesti(self, x):
|
23
|
+
return self.resolve(x, x)(x, x)
|
24
|
+
|
25
|
+
@ovld
|
26
|
+
def roesti(self, x: int, y: int):
|
27
|
+
return x * y
|
28
|
+
|
29
|
+
@ovld
|
30
|
+
def roesti(self, x: str, y: str):
|
31
|
+
return x + y
|
32
|
+
|
33
|
+
@ovld
|
34
|
+
def roesti(self, xs: list, _):
|
35
|
+
return [self(x) for x in xs]
|
36
|
+
|
37
|
+
except Exception as exc:
|
38
|
+
_ovld_dispatch_exc = exc
|
39
|
+
|
40
|
+
|
41
|
+
def test_global_ovld():
|
42
|
+
if _ovld_exc:
|
43
|
+
raise _ovld_exc
|
44
|
+
assert pluralize(10) == 11
|
45
|
+
assert pluralize("alouette") == "alouettes"
|
46
|
+
|
47
|
+
|
48
|
+
def test_global_ovld_dispatch():
|
49
|
+
if _ovld_dispatch_exc:
|
50
|
+
raise _ovld_dispatch_exc
|
51
|
+
assert roesti(10) == 100
|
52
|
+
assert roesti("alouette") == "alouettealouette"
|