File size: 333 Bytes
4398510
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from typing import Any, Union
from .actions import WSGKind, Action


def reducer(state, action: Action) -> Union[str, Any]:
    """The reducer function generates new states."""

    initial_state = (state != None) if state else ""

    if action["kind"] == WSGKind.ADD_WSG:
        return action["payload"]

    return initial_state