swizzle 2.3.2__tar.gz → 2.4.0__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.
- {swizzle-2.3.2/swizzle.egg-info → swizzle-2.4.0}/PKG-INFO +9 -19
- {swizzle-2.3.2 → swizzle-2.4.0}/README.md +2 -2
- swizzle-2.4.0/pyproject.toml +46 -0
- swizzle-2.4.0/setup.py +15 -0
- {swizzle-2.3.2 → swizzle-2.4.0}/swizzle/__init__.py +29 -9
- {swizzle-2.3.2 → swizzle-2.4.0/swizzle.egg-info}/PKG-INFO +9 -19
- {swizzle-2.3.2 → swizzle-2.4.0}/swizzle.egg-info/SOURCES.txt +1 -0
- {swizzle-2.3.2 → swizzle-2.4.0}/swizzle.egg-info/top_level.txt +1 -0
- swizzle-2.3.2/setup.py +0 -43
- {swizzle-2.3.2 → swizzle-2.4.0}/LICENSE +0 -0
- {swizzle-2.3.2 → swizzle-2.4.0}/setup.cfg +0 -0
- {swizzle-2.3.2 → swizzle-2.4.0}/swizzle/trie.py +0 -0
- {swizzle-2.3.2 → swizzle-2.4.0}/swizzle.egg-info/dependency_links.txt +0 -0
@@ -1,33 +1,23 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: swizzle
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.4.0
|
4
4
|
Summary: Swizzle enables the retrieval of multiple attributes, similar to swizzling in computer graphics.
|
5
|
-
|
6
|
-
Author: Jan T. Müller
|
7
|
-
Author-email: mail@jantmueller.com
|
5
|
+
Author-email: "Jan T. Müller" <mail@jantmueller.com>
|
8
6
|
License: MIT
|
9
|
-
Project-URL:
|
10
|
-
Project-URL:
|
11
|
-
Project-URL:
|
7
|
+
Project-URL: homepage, https://github.com/janthmueller/swizzle
|
8
|
+
Project-URL: documentation, https://github.com/janthmueller/swizzle/blob/main/README.md
|
9
|
+
Project-URL: source, https://github.com/janthmueller/swizzle
|
10
|
+
Project-URL: tracker, https://github.com/janthmueller/swizzle/issues
|
11
|
+
Keywords: swizzle,attributes,graphics,development
|
12
12
|
Classifier: Intended Audience :: Developers
|
13
13
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
15
15
|
Classifier: Operating System :: OS Independent
|
16
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
17
|
-
Requires-Python: >=3.
|
17
|
+
Requires-Python: >=3.8
|
18
18
|
Description-Content-Type: text/markdown
|
19
19
|
License-File: LICENSE
|
20
|
-
Dynamic: author
|
21
|
-
Dynamic: author-email
|
22
|
-
Dynamic: classifier
|
23
|
-
Dynamic: description
|
24
|
-
Dynamic: description-content-type
|
25
|
-
Dynamic: home-page
|
26
|
-
Dynamic: license
|
27
20
|
Dynamic: license-file
|
28
|
-
Dynamic: project-url
|
29
|
-
Dynamic: requires-python
|
30
|
-
Dynamic: summary
|
31
21
|
|
32
22
|
# Swizzle
|
33
23
|
|
@@ -134,7 +124,7 @@ Create swizzled named tuples inspired by `namedtuple`:
|
|
134
124
|
```python
|
135
125
|
from swizzle import swizzledtuple
|
136
126
|
|
137
|
-
Vector = swizzledtuple('Vector', 'x y z')
|
127
|
+
Vector = swizzledtuple('Vector', 'x y z') # Equivalent to swizzle.t('Vector', 'x y z')
|
138
128
|
|
139
129
|
v = Vector(1, 2, 3)
|
140
130
|
|
@@ -103,7 +103,7 @@ Create swizzled named tuples inspired by `namedtuple`:
|
|
103
103
|
```python
|
104
104
|
from swizzle import swizzledtuple
|
105
105
|
|
106
|
-
Vector = swizzledtuple('Vector', 'x y z')
|
106
|
+
Vector = swizzledtuple('Vector', 'x y z') # Equivalent to swizzle.t('Vector', 'x y z')
|
107
107
|
|
108
108
|
v = Vector(1, 2, 3)
|
109
109
|
|
@@ -161,4 +161,4 @@ Inspired by swizzling in graphics programming, Swizzle brings similar flexibilit
|
|
161
161
|
|
162
162
|
---
|
163
163
|
|
164
|
-
Give Swizzle a try and see how it can simplify your Python projects!
|
164
|
+
Give Swizzle a try and see how it can simplify your Python projects!
|
@@ -0,0 +1,46 @@
|
|
1
|
+
[build-system]
|
2
|
+
requires = ["setuptools>=61"]
|
3
|
+
build-backend = "setuptools.build_meta"
|
4
|
+
|
5
|
+
[project]
|
6
|
+
name = "swizzle"
|
7
|
+
version = "2.4.0"
|
8
|
+
readme = "README.md"
|
9
|
+
|
10
|
+
description = "Swizzle enables the retrieval of multiple attributes, similar to swizzling in computer graphics."
|
11
|
+
requires-python = ">=3.8"
|
12
|
+
|
13
|
+
keywords = ["swizzle", "attributes", "graphics", "development"]
|
14
|
+
|
15
|
+
classifiers = [
|
16
|
+
"Intended Audience :: Developers",
|
17
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
18
|
+
"License :: OSI Approved :: MIT License",
|
19
|
+
"Operating System :: OS Independent",
|
20
|
+
"Programming Language :: Python :: 3 :: Only"
|
21
|
+
]
|
22
|
+
|
23
|
+
[[project.authors]]
|
24
|
+
name = "Jan T. Müller"
|
25
|
+
email = "mail@jantmueller.com"
|
26
|
+
|
27
|
+
[project.license]
|
28
|
+
text = "MIT"
|
29
|
+
|
30
|
+
[project.urls]
|
31
|
+
homepage = "https://github.com/janthmueller/swizzle"
|
32
|
+
documentation = "https://github.com/janthmueller/swizzle/blob/main/README.md"
|
33
|
+
source = "https://github.com/janthmueller/swizzle"
|
34
|
+
tracker = "https://github.com/janthmueller/swizzle/issues"
|
35
|
+
|
36
|
+
[tool.setuptools.packages.find]
|
37
|
+
exclude = ["tests"]
|
38
|
+
|
39
|
+
[tool.semantic_release]
|
40
|
+
version_toml = ["pyproject.toml:project.version"]
|
41
|
+
commit_parser = "conventional"
|
42
|
+
branch = "main"
|
43
|
+
upload_to_repository = true
|
44
|
+
upload_to_release = true
|
45
|
+
build_command = "python -m build"
|
46
|
+
|
swizzle-2.4.0/setup.py
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Copyright (c) 2024 Jan T. Müller <mail@jantmueller.com>
|
2
|
+
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from setuptools import setup
|
6
|
+
|
7
|
+
if sys.version_info < (3, 8):
|
8
|
+
sys.exit("ERROR: swizzle requires Python 3.8+")
|
9
|
+
|
10
|
+
setup()
|
11
|
+
|
12
|
+
|
13
|
+
# python setup.py sdist bdist_wheel
|
14
|
+
# twine check dist/*
|
15
|
+
# twine upload dist/* -> insert token
|
@@ -4,8 +4,9 @@ import builtins
|
|
4
4
|
import sys as _sys
|
5
5
|
import types
|
6
6
|
import unicodedata
|
7
|
-
from enum import
|
7
|
+
from enum import EnumMeta
|
8
8
|
from functools import wraps
|
9
|
+
from importlib.metadata import version as get_version
|
9
10
|
from keyword import iskeyword as _iskeyword
|
10
11
|
from operator import itemgetter as _itemgetter
|
11
12
|
|
@@ -16,21 +17,32 @@ try:
|
|
16
17
|
except ImportError:
|
17
18
|
_tuplegetter = lambda index, doc: property(_itemgetter(index), doc=doc)
|
18
19
|
|
19
|
-
_type = builtins.type
|
20
20
|
|
21
|
-
|
21
|
+
try:
|
22
|
+
from importlib.metadata import PackageNotFoundError
|
23
|
+
from importlib.metadata import version as _version
|
24
|
+
|
25
|
+
__version__ = _version("swizzle")
|
26
|
+
except PackageNotFoundError:
|
27
|
+
try:
|
28
|
+
from setuptools_scm import get_version
|
22
29
|
|
30
|
+
__version__ = get_version(root=".", relative_to=__file__)
|
31
|
+
except Exception:
|
32
|
+
__version__ = "0.0.0-dev"
|
33
|
+
|
34
|
+
_type = builtins.type
|
23
35
|
MISSING = object()
|
24
36
|
|
25
37
|
|
26
38
|
def swizzledtuple(
|
27
39
|
typename,
|
28
40
|
field_names,
|
41
|
+
arrange_names=None,
|
29
42
|
*,
|
30
43
|
rename=False,
|
31
44
|
defaults=None,
|
32
45
|
module=None,
|
33
|
-
arrange_names=None,
|
34
46
|
sep=None,
|
35
47
|
):
|
36
48
|
"""
|
@@ -175,7 +187,7 @@ def swizzledtuple(
|
|
175
187
|
if num_fields == 1:
|
176
188
|
arg_list += ","
|
177
189
|
repr_fmt = "(" + ", ".join(f"{name}=%r" for name in arrange_names) + ")"
|
178
|
-
_dict, _tuple, _len,
|
190
|
+
_dict, _tuple, _len, _zip = dict, tuple, len, zip
|
179
191
|
|
180
192
|
namespace = {
|
181
193
|
"_tuple_new": tuple_new,
|
@@ -441,8 +453,16 @@ def swizzle_attributes_retriever(
|
|
441
453
|
)
|
442
454
|
|
443
455
|
if type == swizzledtuple:
|
444
|
-
|
445
|
-
|
456
|
+
|
457
|
+
seen = set()
|
458
|
+
field_names, field_values = zip(
|
459
|
+
*[
|
460
|
+
(name, matched_attributes[i])
|
461
|
+
for i, name in enumerate(arranged_names)
|
462
|
+
if name not in seen and not seen.add(name)
|
463
|
+
]
|
464
|
+
)
|
465
|
+
|
446
466
|
name = "swizzledtuple"
|
447
467
|
if hasattr(obj, "__name__"):
|
448
468
|
name = obj.__name__
|
@@ -500,7 +520,7 @@ def swizzle(cls=None, meta=False, sep=None, type=tuple, only_attrs=None):
|
|
500
520
|
class SwizzledMetaType(meta_cls):
|
501
521
|
pass
|
502
522
|
|
503
|
-
if meta_cls ==
|
523
|
+
if meta_cls == EnumMeta:
|
504
524
|
|
505
525
|
def cfem_dummy(*args, **kwargs):
|
506
526
|
pass
|
@@ -511,7 +531,7 @@ def swizzle(cls=None, meta=False, sep=None, type=tuple, only_attrs=None):
|
|
511
531
|
class SwizzledClass(cls, metaclass=SwizzledMetaType):
|
512
532
|
pass
|
513
533
|
|
514
|
-
if meta_cls ==
|
534
|
+
if meta_cls == EnumMeta:
|
515
535
|
SwizzledMetaType._check_for_existing_members_ = cfem
|
516
536
|
|
517
537
|
# Preserve metadata on swizzled meta and class
|
@@ -1,33 +1,23 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: swizzle
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.4.0
|
4
4
|
Summary: Swizzle enables the retrieval of multiple attributes, similar to swizzling in computer graphics.
|
5
|
-
|
6
|
-
Author: Jan T. Müller
|
7
|
-
Author-email: mail@jantmueller.com
|
5
|
+
Author-email: "Jan T. Müller" <mail@jantmueller.com>
|
8
6
|
License: MIT
|
9
|
-
Project-URL:
|
10
|
-
Project-URL:
|
11
|
-
Project-URL:
|
7
|
+
Project-URL: homepage, https://github.com/janthmueller/swizzle
|
8
|
+
Project-URL: documentation, https://github.com/janthmueller/swizzle/blob/main/README.md
|
9
|
+
Project-URL: source, https://github.com/janthmueller/swizzle
|
10
|
+
Project-URL: tracker, https://github.com/janthmueller/swizzle/issues
|
11
|
+
Keywords: swizzle,attributes,graphics,development
|
12
12
|
Classifier: Intended Audience :: Developers
|
13
13
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
15
15
|
Classifier: Operating System :: OS Independent
|
16
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
17
|
-
Requires-Python: >=3.
|
17
|
+
Requires-Python: >=3.8
|
18
18
|
Description-Content-Type: text/markdown
|
19
19
|
License-File: LICENSE
|
20
|
-
Dynamic: author
|
21
|
-
Dynamic: author-email
|
22
|
-
Dynamic: classifier
|
23
|
-
Dynamic: description
|
24
|
-
Dynamic: description-content-type
|
25
|
-
Dynamic: home-page
|
26
|
-
Dynamic: license
|
27
20
|
Dynamic: license-file
|
28
|
-
Dynamic: project-url
|
29
|
-
Dynamic: requires-python
|
30
|
-
Dynamic: summary
|
31
21
|
|
32
22
|
# Swizzle
|
33
23
|
|
@@ -134,7 +124,7 @@ Create swizzled named tuples inspired by `namedtuple`:
|
|
134
124
|
```python
|
135
125
|
from swizzle import swizzledtuple
|
136
126
|
|
137
|
-
Vector = swizzledtuple('Vector', 'x y z')
|
127
|
+
Vector = swizzledtuple('Vector', 'x y z') # Equivalent to swizzle.t('Vector', 'x y z')
|
138
128
|
|
139
129
|
v = Vector(1, 2, 3)
|
140
130
|
|
swizzle-2.3.2/setup.py
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# Copyright (c) 2024 Jan T. Müller <mail@jantmueller.com>
|
2
|
-
|
3
|
-
import sys
|
4
|
-
import os
|
5
|
-
from setuptools import setup, find_packages
|
6
|
-
import swizzle
|
7
|
-
|
8
|
-
if sys.version_info < (3, 6):
|
9
|
-
sys.exit("ERROR: swizzle requires Python 3.6+")
|
10
|
-
|
11
|
-
with open("README.md", "r", encoding="utf-8") as fh:
|
12
|
-
long_description = fh.read()
|
13
|
-
|
14
|
-
setup(
|
15
|
-
name="swizzle",
|
16
|
-
version=swizzle.__version__,
|
17
|
-
packages=find_packages(exclude=["tests"]),
|
18
|
-
author="Jan T. Müller",
|
19
|
-
author_email="mail@jantmueller.com",
|
20
|
-
description="Swizzle enables the retrieval of multiple attributes, similar to swizzling in computer graphics.",
|
21
|
-
long_description=long_description,
|
22
|
-
long_description_content_type="text/markdown",
|
23
|
-
url="https://github.com/janthmueller/swizzle",
|
24
|
-
project_urls={
|
25
|
-
"Documentation": "https://github.com/janthmueller/swizzle/blob/main/README.md",
|
26
|
-
"Source": "https://github.com/janthmueller/swizzle",
|
27
|
-
"Tracker": "https://github.com/janthmueller/swizzle/issues",
|
28
|
-
},
|
29
|
-
license="MIT",
|
30
|
-
classifiers=[
|
31
|
-
"Intended Audience :: Developers",
|
32
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
33
|
-
"License :: OSI Approved :: MIT License",
|
34
|
-
"Operating System :: OS Independent",
|
35
|
-
"Programming Language :: Python :: 3 :: Only",
|
36
|
-
],
|
37
|
-
python_requires=">=3.6",
|
38
|
-
)
|
39
|
-
|
40
|
-
|
41
|
-
# python setup.py sdist bdist_wheel
|
42
|
-
# twine check dist/*
|
43
|
-
# twine upload dist/* -> insert token
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|