Tree is a library for working with nested data structures.
Project description
Tree
tree is a library for working with nested data structures. In a way, tree
generalizes the builtin map function which only supports flat sequences,
and allows to apply a function to each "leaf" preserving the overall
structure.
>>> import tree
>>> structure = [[1], [[[2, 3]]], [4]]
>>> tree.flatten(structure)
[1, 2, 3, 4]
>>> tree.map_structure(lambda v: v**2, structure)
[[1], [[[4, 9]]], [16]]
tree is backed by an optimized C++ implementation suitable for use in
demanding applications, such as machine learning models.
Installation
From PyPI:
$ pip install dm-tree
Directly from github using pip:
$ pip install git+git://github.com/deepmind/tree.git
Build from source:
$ python setup.py install
Support
If you are having issues, please let us know by filing an issue on our issue tracker.
License
The project is licensed under the Apache 2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dm_tree-0.1.9.tar.gz.
File metadata
- Download URL: dm_tree-0.1.9.tar.gz
- Upload date:
- Size: 35.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4c7db3d3935a5a2d5e4b383fc26c6b0cd6f78c6d4605d3e7b518800ecd5342b
|
|
| MD5 |
c683dfcde579753a782dbe969c0dc85a
|
|
| BLAKE2b-256 |
a683ce29720ccf934c6cfa9b9c95ebbe96558386e66886626066632b5e44afed
|
File details
Details for the file dm_tree-0.1.9-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 153.1 kB
- Tags: CPython 3.13t, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1f5d1e96b3a7de22b25b13a5eb30f41f8cf9c02dd4479a24920de99e780903c
|
|
| MD5 |
a00e32764ee8562c31ad83cde3de00ab
|
|
| BLAKE2b-256 |
c53715603079854394f16e3833a7b50696c1f3cbf30a2243a119f64f18a16f36
|
File details
Details for the file dm_tree-0.1.9-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 147.3 kB
- Tags: CPython 3.13t, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6893fcdc5cf1a4f459cfc383526d35d42e7c671ae565d7e429a2f2cb2cb93e89
|
|
| MD5 |
f4b58014fc4d4db64e7f4924a3c3db37
|
|
| BLAKE2b-256 |
841d3cdbeeb3f6937a47a26cee502bffeccc2e55b97dfcce8a1d1135ea1b5b47
|
File details
Details for the file dm_tree-0.1.9-cp313-cp313t-macosx_10_13_universal2.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp313-cp313t-macosx_10_13_universal2.whl
- Upload date:
- Size: 180.8 kB
- Tags: CPython 3.13t, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b06e7a5da1c31a82521a60060573527e8d24b9920fdd20b2ec86f08412737598
|
|
| MD5 |
2739c92f84f207d3c5faa326bac0432b
|
|
| BLAKE2b-256 |
ee3c5b40f8862390e9172e776cf610f3791c1af01f140a5698799fbe4a97206f
|
File details
Details for the file dm_tree-0.1.9-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 102.0 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e97c34fcb44941c36b7ee81dcdbceba0fbe728bddcc77e5837ab2eb665bcbff8
|
|
| MD5 |
7e670fb0e583aa2b700e1f4620a2f571
|
|
| BLAKE2b-256 |
0dee529ce999770b4d621a64af86c60cfee52f0cdd7294752105179ebf1c07c6
|
File details
Details for the file dm_tree-0.1.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 153.0 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f68b0efad76703dd4648586c75618a48cdd671b68c3266fe980e323c15423607
|
|
| MD5 |
29adae20310aee754d2d6bf600a11dbe
|
|
| BLAKE2b-256 |
e50af4d72ffb64ab3edc1fa66261f81ee3b4142ab14cd8aa1dfc7bbeca5ee4ba
|
File details
Details for the file dm_tree-0.1.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 147.2 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d05622d074353cf434049206e53c12147903a048c4bd7d77f2800d427413ad78
|
|
| MD5 |
a57dbe6e61549d6b4213e83593d265a6
|
|
| BLAKE2b-256 |
376a512abdf7f20acc6cd6fce77f7663014d129aa313b5953aa2603d58fdb0c9
|
File details
Details for the file dm_tree-0.1.9-cp313-cp313-macosx_10_13_universal2.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp313-cp313-macosx_10_13_universal2.whl
- Upload date:
- Size: 175.0 kB
- Tags: CPython 3.13, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfa33c2e028155810ad1b4e11928707bf47489516763a86e79cab2954d23bf68
|
|
| MD5 |
cd836f8d6d0f6be49e70359e73d27db9
|
|
| BLAKE2b-256 |
5f13823788cd0f7964cadcfa56d1e0f9e5e987ee73b5db6273bc00168f524f1a
|
File details
Details for the file dm_tree-0.1.9-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 102.0 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9020a5ce256fcc83aa4bc190cc96dd66e87685db0a6e501b0c06aa492c2e38fc
|
|
| MD5 |
5f09c32a0cd49007c7ac9cc7d626749a
|
|
| BLAKE2b-256 |
ea974f78412f73a9350bc8f934441bae5b68b102c8f4240a7f06b4114b51d6de
|
File details
Details for the file dm_tree-0.1.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 153.0 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2334cfe9d2ed4293f9f1c7aefba0657deaab9ea74b5fadd966f6d01d9b6b42d9
|
|
| MD5 |
4a664589c28183c19d23940097eccf21
|
|
| BLAKE2b-256 |
865227607a275c12858b979b8e943d2bd3bd0f9028503bb7079d5830a8b3cac0
|
File details
Details for the file dm_tree-0.1.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 147.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80c43417814b1181d3367b335460bfdd30b79ee187a64220e11f6ddd093a4b15
|
|
| MD5 |
5eaaf1928c9851cf64530f7432640a75
|
|
| BLAKE2b-256 |
8110120cd40556407879c1069941bd8b0d1a75754128c1a5bf0e27dbcf2a49fc
|
File details
Details for the file dm_tree-0.1.9-cp312-cp312-macosx_10_13_universal2.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 175.0 kB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8d20eeab7fde77a3ed71f07716021eb0edfb4812a128eb381d108af3a310257
|
|
| MD5 |
37940019d2efbafa99d0e3efe6b005f6
|
|
| BLAKE2b-256 |
ee0261aa90ab695918b4389d75c99bf0ec3cd0abacf1cadbef4053626f23ce34
|
File details
Details for the file dm_tree-0.1.9-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 101.5 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12f4cc6cd52a39aa38ff31577b6d79b6136a9a89273a876bf62335c9f65c27bf
|
|
| MD5 |
b207fdf05f44b2c2ce3aff60bc583c01
|
|
| BLAKE2b-256 |
353ea46933e0157b0ac87619a754ce1a796b2afc6386fca7c11f95c010f40745
|
File details
Details for the file dm_tree-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 152.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
294dc1cecf87552a45cdd5ddb215e7f5295a5a47c46f1f0a0463c3dd02a527d7
|
|
| MD5 |
61187f4946843ddd9d96e5fe4462e56b
|
|
| BLAKE2b-256 |
e846939fbf81177c7cb3b1e5ddebd696237b3be9520769cce882f064de497103
|
File details
Details for the file dm_tree-0.1.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 146.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e660d1779ddcbd1348410d08f67db4870d413a3ec4ba8b4b045bd5ce4bd8f35c
|
|
| MD5 |
cdb394988870a47fdfd0177439434437
|
|
| BLAKE2b-256 |
3e0757459f32cf5683c25b596ab58f42a3305f91876c2f03d2fa6e9d0df75fcb
|
File details
Details for the file dm_tree-0.1.9-cp311-cp311-macosx_10_9_universal2.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 173.6 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d7d784afaeb4b67d87d858261aaf02503939ddc1f09c4cca70728f9892ab004
|
|
| MD5 |
2723695b37ab6d1e223193cc74d8392f
|
|
| BLAKE2b-256 |
acb62d2de9f8901ccc5b6f34aea678e732816853015b9d756c86efcec189bf4b
|
File details
Details for the file dm_tree-0.1.9-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 101.5 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ae3cbff592bb3f2e197f5a8030de4a94e292e6cdd85adeea0b971d07a1b85f2
|
|
| MD5 |
9e69c0c820e3ee50e437e8d8ea65fcfe
|
|
| BLAKE2b-256 |
bf208b96a34a15c5c4d1d6af44795963fa44381716975aabac83beab4fe80974
|
File details
Details for the file dm_tree-0.1.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 152.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
831699d2c60a1b38776a193b7143ae0acad0a687d87654e6d3342584166816bc
|
|
| MD5 |
710e5a2bb4a3a19f8426adabd0135533
|
|
| BLAKE2b-256 |
7c79ba0f7274164eb6bd06a36c2f8cb21b0debc32fd9ba8e73a7c9e50c90041b
|
File details
Details for the file dm_tree-0.1.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 146.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54d5616015412311df154908069fcf2c2d8786f6088a2ae3554d186cdf2b1e15
|
|
| MD5 |
a397bbc8fbeb5e2b3a40649d0825340c
|
|
| BLAKE2b-256 |
d16a64924e102f559c1380263a28a751f20a1bdd18e85ea599e216feead84adf
|
File details
Details for the file dm_tree-0.1.9-cp310-cp310-macosx_10_9_universal2.whl.
File metadata
- Download URL: dm_tree-0.1.9-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 173.6 kB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d5b28ee2e461b6af65330c143806a6d0945dcabbb8d22d2ba863e6dabd9254e
|
|
| MD5 |
fde3e14e6f1094bb0486d6815a2ebdb3
|
|
| BLAKE2b-256 |
77d288f685534d87072a5174fe229e77aab6b7da50092d5151ebc172f6270b5c
|