Skip to content

Commit

Permalink
add docstring for map
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Lombardi committed Jan 11, 2024
1 parent 21604f1 commit 40fb7cf
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions sdk/src/beam/abstractions/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,37 @@

class Map(BaseAbstraction):
def __init__(self, *, name: str) -> None:
"""
A distributed python dictionary.
Use this a concurrency safe key/value store, accessible both locally and within
remote containers. Serialization is done using cloudpickle, so any object that supported
by that should work here. The interface is that of a standard python dictionary.
Because this is backed by a distributed dictionary, it will persist between runs.
Parameters:
name (str):
The name of the map (any arbitrary string).
Example:
```python
from beam import Map
m = Map(name="test")
m["some_key"] = True
m["another_key"] = True
print(m["somekey"])
del m["somekey"]
for k, v in m.items():
print("key: ", k)
print("value: ", v)
```
"""
super().__init__()

self.name: str = name
Expand Down

0 comments on commit 40fb7cf

Please sign in to comment.