Skip to main content

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


Download files

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

Source Distribution

dm-tree-0.1.7.tar.gz (35.1 kB view details)

Uploaded Source

Built Distributions

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

dm_tree-0.1.7-cp310-cp310-win_amd64.whl (90.9 kB view details)

Uploaded CPython 3.10Windows x86-64

dm_tree-0.1.7-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (142.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64

dm_tree-0.1.7-cp310-cp310-macosx_11_0_arm64.whl (105.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dm_tree-0.1.7-cp310-cp310-macosx_10_9_x86_64.whl (109.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

dm_tree-0.1.7-cp310-cp310-macosx_10_9_universal2.whl (156.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

dm_tree-0.1.7-cp39-cp39-win_amd64.whl (90.3 kB view details)

Uploaded CPython 3.9Windows x86-64

dm_tree-0.1.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (142.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

dm_tree-0.1.7-cp39-cp39-macosx_11_0_arm64.whl (105.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

dm_tree-0.1.7-cp39-cp39-macosx_10_9_x86_64.whl (109.5 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

dm_tree-0.1.7-cp39-cp39-macosx_10_9_universal2.whl (156.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

dm_tree-0.1.7-cp38-cp38-win_amd64.whl (91.0 kB view details)

Uploaded CPython 3.8Windows x86-64

dm_tree-0.1.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (142.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

dm_tree-0.1.7-cp38-cp38-macosx_11_0_arm64.whl (105.2 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

dm_tree-0.1.7-cp38-cp38-macosx_10_9_x86_64.whl (109.5 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

dm_tree-0.1.7-cp38-cp38-macosx_10_9_universal2.whl (156.8 kB view details)

Uploaded CPython 3.8macOS 10.9+ universal2 (ARM64, x86-64)

dm_tree-0.1.7-cp37-cp37m-win_amd64.whl (91.2 kB view details)

Uploaded CPython 3.7mWindows x86-64

dm_tree-0.1.7-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (143.3 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

dm_tree-0.1.7-cp37-cp37m-macosx_10_9_x86_64.whl (108.9 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

dm_tree-0.1.7-cp36-cp36m-win_amd64.whl (91.3 kB view details)

Uploaded CPython 3.6mWindows x86-64

dm_tree-0.1.7-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (143.3 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

dm_tree-0.1.7-cp36-cp36m-macosx_10_9_x86_64.whl (108.9 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file dm-tree-0.1.7.tar.gz.

File metadata

  • Download URL: dm-tree-0.1.7.tar.gz
  • Upload date:
  • Size: 35.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.9

File hashes

Hashes for dm-tree-0.1.7.tar.gz
Algorithm Hash digest
SHA256 30fec8aca5b92823c0e796a2f33b875b4dccd470b57e91e6c542405c5f77fd2a
MD5 5f7b74b20db59f4e56ec4cde51ce540b
BLAKE2b-256 1ceda9848a5d3dff0fc5c9c6f5120ae98c152ff47700a731958ff034a576ee27

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: dm_tree-0.1.7-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 90.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.9

File hashes

Hashes for dm_tree-0.1.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9edc1783a08d87c4e130781f55cbd904d6a564f7cce7dfb63f9ef3bee8e38209
MD5 059c477c936bb4f2675b6b9b8173a125
BLAKE2b-256 8ca721f23354c25c8e7cbc62fb7deab309fd3f0ef15d631ee7ca8fbd8b14027e

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 57edb6fbd88fcdd9908547cbf21045a9d663c0d9e5983dca7e6f9cf8b6584bb5
MD5 47d597459cc285d16b61a12053f3c65a
BLAKE2b-256 ea796ffc064e91c9c013f9a6344f14f360a30681e560289e5f0b953e8de46bf0

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1410fa2f2cc8dc7c01386f4e93ddeeb56765574ffafb632a9b6bd96496195b10
MD5 943124d200209b70ca0c57cf16219706
BLAKE2b-256 a8036a887583412d6789f14349c3e2a79c7faf3339054308fa0af201744737a6

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d377bd621b485db42c4aeea0eabbd8f6274b89a9c338c2c1bf69a40c3b86a1fd
MD5 e3c78783a4d27ebb6db43844391f7f51
BLAKE2b-256 faf4a25167983f1185c51a4b4a7fca3e335f080f4dca277a6853f204e4e6db1b

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3fae437135b6cbbdd51e96488a35e78c3617defa0b65265e7e8752d506f933fd
MD5 c2ee8f1aa75731a50feda6e3d305e884
BLAKE2b-256 17f2e1463f47e40fe37abbf874481b60738630cacda89e3d7938d01bcceaf5a0

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: dm_tree-0.1.7-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 90.3 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.9

File hashes

Hashes for dm_tree-0.1.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3ca0a58e219b7b0bc201fea4679971188d0a9028a2543c16803a84e8f8c7eb2c
MD5 697c803fcb362f4322f2cd288e67c3fe
BLAKE2b-256 1d14e0758245bbe29b76e668046481b5bffa518a3e1b6c86214337c63f840c4d

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 1379a02df36e2bbff9819ceafa55ccd436b15af398803f781f372f8ead7ed871
MD5 b891374af758f1ace45ebb8bd16345a7
BLAKE2b-256 4f12a6a0270967d277f41c8d684fe02f662104f9aa2d9b9d4c053e7121f0d94c

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7fa0740b7fbae2c3a43a3114a514891b5d6c383050828f36aa1816cf40f73a6a
MD5 51786ad124e47e813cd9e08748cbabcd
BLAKE2b-256 fc6d2f8cd13fa2dff3730c6d45ae97a1a91b49362ebb95ba8be17de20687fcab

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2a843608e078d1622ebb5e50962a8c718d3fa1ab9461b95a12395a803545b2f5
MD5 3f6235716e2198471c1f8d4f2b86546f
BLAKE2b-256 4977184ca10d11b01d254672b5e3841da56a167458d8087e213a3bc7fa7ac936

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 51b9bdf1109b47cc22884b1919e6fe38edf28b5aa02e7c661bb760a0e7cf0157
MD5 c2dd739575dd16939c335388e583b177
BLAKE2b-256 25357197fc5dc0361ea4c3c7d081cbf88c2698ce0a7e32c0859ee9a52f5f44a7

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: dm_tree-0.1.7-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 91.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.9

File hashes

Hashes for dm_tree-0.1.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7f1f3dca9d669f3c09654ff6d69cfafd86a7f967c3095405b2692ee8d8ef3cfd
MD5 5be3ffd5425b96bbbef1e49e8077b88e
BLAKE2b-256 e2c552796ca5f8ef2d757f96ae86dbc7fd7a2e114d6c317243ccb74d43eb9b2e

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3b00885c21267934a3d3c68660811d3f891c9539fd53712f5b2423c6d74bf1e6
MD5 4584d36ba2e43e5af799b39c346e3025
BLAKE2b-256 a9ab75bdff27661484b916369d94e507fad4a6c04b5f876898187d6936294b47

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3166304411d14c50a5da1c583e24d6069b44de0c9e06479cb36cdf048a466945
MD5 42aff990dcae8658f029c41af72bcbf9
BLAKE2b-256 0fc35663f83202231fc74799d213e21bbafde78119534ca7c21ae5da47fa3d6b

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 20f24cad4decbf4c1f176a959d16e877c73df33b07d7d1f078a5b8abe72f79f8
MD5 e124066bcd271b3f8f8b19f6da11aa37
BLAKE2b-256 e8d754a5f2edbfa84fd13990cd83409a1db3976b2af4747aabb7255b606e732c

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp38-cp38-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4992ac5c42af1d73042cd2d3af4e7892d3750e6c1bb8e5a4f81534aa6515f350
MD5 6beffc3fdba9f6983a4443b54090bc16
BLAKE2b-256 19c92854eacb2ed412c8f63c14f106e01a526ed143a8fb900da880cbe4228a1f

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: dm_tree-0.1.7-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 91.2 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.9

File hashes

Hashes for dm_tree-0.1.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0f01743cc2247170e64798c6b4b31853717054bf9ceec47a1b1b8c2a4baf5792
MD5 02a1adb69ca4d64b4cd7d26d7dc6a2fc
BLAKE2b-256 978286a8035998656bb9c1b5ff430b6a5220cf725c5eaaf66bd53a1362fc7f8c

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 91c6240e47c9d80dbd7de5a29a2ca663143717a72c613130ba8ac4354fa741a9
MD5 1099bca060e1074df38816161457fa98
BLAKE2b-256 a4b5f4c721d479c6db0ea15c0fc2ed46c0a06b013e8930bc876aea030ede4805

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f3e2bd9b9c05d1a0039f7c128d8b055c8a05708ef569cdbbeec0a2946e425bd4
MD5 10fbbd4847f3e09bc6273b440e1d22da
BLAKE2b-256 59bb1815a35d12fe37c66c2d517772b2b13160853465027445f7d7cb034c96d9

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: dm_tree-0.1.7-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 91.3 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.9

File hashes

Hashes for dm_tree-0.1.7-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a085f500b295a6bf439c538e9058c7798ecb8c7d0dc916291f3d8d79d6124d17
MD5 e19209a1d39e2d2a83fe6481c883124e
BLAKE2b-256 023c48884a1f5e354b555a9441156bc7a8434de87529d353573d61b03a743ac2

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b4364fc9a5721a2b840ac8ea75b8f58b430bec9fdc8b99304d2aecb3cfe46b1b
MD5 2acd971cb70e89bb35f0c8a904c29da0
BLAKE2b-256 21d46add54e8de33800930269f5aa2c85a954cf4cfbddb7af10549b829ff9a93

See more details on using hashes here.

File details

Details for the file dm_tree-0.1.7-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dm_tree-0.1.7-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 98fce150ceebb0a818f0eace1616004031cfa5e3375f50599ad790ff52414ba9
MD5 fd106f62c00685d81aa33f8ced8c0f93
BLAKE2b-256 da8b249cb013fc7d6f079af42725b956e60a7e7e914f540d2d2015ad4cd8c3cf

See more details on using hashes here.

Supported by

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