Skip to main content

Classes to help conflate streaming data.

Project description

This module contains classes to assist with conflating streaming data. This can be used to manage the load on consuming tasks, and is especially useful if the consumers only need the current value and can thus safely discard intermediate updates.

Example:
>>> from conflateddict import ConflatedDict
>>> import random
>>>
>>> keys = ['red', 'green', 'blue', 'orange']
>>> con = ConflatedDict()
>>> for _ in range(100):
...    con[random.choice(keys)] = random.randint(0, 100)
...
>>> print(list(con.items())
[('orange', 32), ('green', 71), ('red', 71), ('blue', 80)]
>>> print(len(con))
4
>>> # After a reset, there will be no dirty values
>>> con.reset()
>>> print(list(con.items())
[]
>>> print(len(con))
0
>>> # After another update, any new dirty values will be returned
>>> con[random.choice(keys)] = random.randint(0, 100)
>>> print(list(con.items())
[('orange', 58)]
>>>
>>> # We still have access to all the values through data()
>>> print(list(con.data().items()))
[('blue', 80), ('red', 71), ('green', 71), ('orange', 58)]
>>> print(len(con.data()))
4
>>>

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

conflateddict-0.1.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

conflateddict-0.1.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file conflateddict-0.1.2.tar.gz.

File metadata

  • Download URL: conflateddict-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for conflateddict-0.1.2.tar.gz
Algorithm Hash digest
SHA256 96d9dea4f3f4993e9a3fb49c0000c73567d5020d596f3e74a4b9d37dc63321b1
MD5 d338486dc2643e9a7ce8ff5e6741d241
BLAKE2b-256 f854364cdaf29216d9c88e9fd3fee38e734ead91e84b46aa2d4d9a560359b800

See more details on using hashes here.

File details

Details for the file conflateddict-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for conflateddict-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9b24b8f4627e760f2f38e72df007fead29a13ae601c6bd9a72208a14eb12c41c
MD5 9b3e3265940b8b82703b4472eb01e2c9
BLAKE2b-256 2ff4cac8ccbc21492480192a27948cb40038a60f3cf209f669f43149fbdd6055

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