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,)}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

namedtreemap-0.0.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

namedtreemap-0.0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file namedtreemap-0.0.1.tar.gz.

File metadata

  • Download URL: namedtreemap-0.0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for namedtreemap-0.0.1.tar.gz
Algorithm Hash digest
SHA256 96cadfcdf981497c96dac159bd00c2cb80b9155d034424c41e0c04c096403341
MD5 b90a0f87b4657ecd2623186874a33aba
BLAKE2b-256 6a2e635f15ba775e0d143a587f2ed6619249136349cbe471e8d8cbc3b0ed2724

See more details on using hashes here.

File details

Details for the file namedtreemap-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: namedtreemap-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for namedtreemap-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31ae8bd8b569ef4d7dccbcd7e17f8a27d948925167b3db6e55d19bb32b0eafaa
MD5 9f31d832b0ca460f8d7495294776b33e
BLAKE2b-256 d8c8a64fc1ac7018b0c7fc4ab758bdda6ba85e5babd042e702d26bc89ef98337

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page