Skip to main content

NamedTreemap

jax.tree_map, but for all datatypes and with input names

Getting Started

Installation

python3 -m pip install namedtreemap

Examples

import namedtreemap as ntm
from typing import Tuple, Any


def fn(prefix: Tuple[Any, ...], *items):
    print(prefix, items)
    return items[0] + 1


obj = {"3": {"2": [1, 2]}, "1": (0,)}
print("Original:", obj)  # Original: {'3': {'2': [1, 2]}, '1': (0,)}
obj = ntm.named_treemap(fn, obj, obj)
# ('3', '2', 0) (1, 1)   -   0 (int) is a list index
# ('3', '2', 1) (2, 2)   -   1 (int) is a list index
# ('1', 0.0) (0, 0)      -   0.0 (float) is a tuple index
print("Modified:", obj)  # Modified: {'3': {'2': [2, 3]}, '1': (1,)}

Metadata

Release files for namedtreemap 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for namedtreemap 0.0.1
File Size Uploaded
namedtreemap-0.0.1.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for namedtreemap 0.0.1
File Interpreter ABI Platform
namedtreemap-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.1 kB

Release files / namedtreemap-0.0.1.tar.gz

Download URL namedtreemap-0.0.1.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
96cadfcdf981497c96dac159bd00c2cb80b9155d034424c41e0c04c096403341
BLAKE2b-256 checksum
How to use checksums
6a2e635f15ba775e0d143a587f2ed6619249136349cbe471e8d8cbc3b0ed2724
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / namedtreemap-0.0.1-py3-none-any.whl

Download URL namedtreemap-0.0.1-py3-none-any.whl
Size 2.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31ae8bd8b569ef4d7dccbcd7e17f8a27d948925167b3db6e55d19bb32b0eafaa
BLAKE2b-256 checksum
How to use checksums
d8c8a64fc1ac7018b0c7fc4ab758bdda6ba85e5babd042e702d26bc89ef98337
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page