Sculpting
Library for sculpting objects from others
Installing
pip install sculpting
Examples
Create an object based on another
from dataclasses import dataclass
from pyhandling import by, then
from sculpting import Sculpture
@dataclass
class User:
id: int
username: str
password: str
original = User(0, "William", "1234")
sculture = Sculpture(
original,
name="username",
password_hash=(getattr |by| "password") |then>> hash
)
which is mapped with the original
sculture.name
sculture.password_hash
William
1670106271132722890
even with its modification
sculture.name = "Not William"
original.username
Not William
which can be custom
from sculpting import AttributeMap, changing_attribute_map_for
from sculpting.tools import setting_of_attr
transforming_sculpture = Sculpture(
original,
id_of_others=AttributeMap(
getattr |by| "id_of_others",
setting_of_attr("id_of_others", value_transformer=tuple)
),
# Shortcut for recording above
synonym_for_id_of_others=changing_attribute_map_for("id_of_others", tuple)
)
transforming_sculpture.synonym_for_id_of_others = range(1, 5)
original.id_of_others
(1, 2, 3, 4)
using standard tools
from datetime import datetime
from time import sleep
from pyhandling import close, operation_by, eventually, returnly
from sculpting import read_only_attribute_map_as
from sculpting.tools import once
standard_tool_sculpture_from = (
close(Sculpture)(
id=read_only_attribute_map_as((getattr |by| 'id') |then>> operation_by('*', 2)),
creation_time=once(eventually(datetime.now))
)
|then>> returnly(getattr |by| "creation_time")
)
standard_tool_sculpture = standard_tool_sculpture_from(original)
print(datetime.now().time(), "- at initialization")
sleep(3)
print(standard_tool_sculpture.creation_time.time(), "- at getting")
16:10:16.045444 - at initialization
16:10:16.045444 - at getting
Metadata
Release files for sculpting 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sculpting-1.0.1.tar.gz | 17.7 kB | Without provenance | Details for sculpting-1.0.1.tar.gz |
Release files / sculpting-1.0.1.tar.gz
| Download URL | sculpting-1.0.1.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e7d0f44582b5d167084186b24ca74a71f339862404a98ebaf7a1a6d2ae58e6c
|
|
BLAKE2b-256 checksum How to use checksums |
1e9a326d58b2c9ce6469fe699e43406c03ca31135433f7ae282aaf866240054d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0
|
Security for sculpting 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.