• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

localstack / localstack / 17313033552

27 Aug 2025 03:39PM UTC coverage: 86.838% (-0.002%) from 86.84%
17313033552

push

github

web-flow
Remove jsonpickle serializer (#13064)

2 of 2 new or added lines in 2 files covered. (100.0%)

32 existing lines in 4 files now uncovered.

67064 of 77229 relevant lines covered (86.84%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.78
/localstack-core/localstack/state/codecs.py
1
"""Factory for encoders and decoders"""
2

3
from localstack import config
1✔
4
from localstack.state import Decoder, Encoder
1✔
5
from localstack.state.pickle import PickleDecoder, PickleEncoder
1✔
6

7
ENCODERS = {
1✔
8
    "dill": PickleEncoder,
9
}
10
"""Encoders that map to the name of ``STATE_SERIALIZATION_BACKEND``."""
1✔
11

12
DECODERS = {
1✔
13
    "dill": PickleDecoder,
14
}
15
"""Decoders that map to the name of ``STATE_SERIALIZATION_BACKEND``."""
1✔
16

17

18
def create_encoder(encoder_type: str) -> Encoder:
1✔
19
    cls = ENCODERS.get(encoder_type)
1✔
20
    if cls is None:
1✔
UNCOV
21
        raise ValueError(f"Unknown encoder type: {encoder_type}")
×
22
    return cls()
1✔
23

24

25
def create_decoder(decoder_type: str) -> Decoder:
1✔
26
    cls = DECODERS.get(decoder_type, PickleDecoder)
1✔
27
    if cls is None:
1✔
UNCOV
28
        raise ValueError(f"Unknown decoder type: {decoder_type}")
×
29
    return cls()
1✔
30

31

32
def get_default_encoder() -> Encoder:
1✔
33
    """
34
    Gets the default encoder based on the state serialization backend defined in the configuration
35
    ``STATE_SERIALIZATION_BACKEND``.
36

37
    If the serialization backend specified in the configuration leads to an error
38
    (such as an invalid backend), a ``PickleEncoder`` is returned as a fallback.
39

40
    :return: The default encoder for state serialization.
41
    """
42
    try:
1✔
43
        return create_encoder(config.STATE_SERIALIZATION_BACKEND)
1✔
UNCOV
44
    except ValueError:
×
UNCOV
45
        return PickleEncoder()
×
46

47

48
def get_default_decoder() -> Decoder:
1✔
49
    """
50
    Gets the default decoder based on the state serialization backend defined in the configuration
51
    ``STATE_SERIALIZATION_BACKEND``.
52

53
    If the serialization backend specified in the configuration leads to an error
54
    (such as an invalid backend), a ``PickleDecoder`` is returned as a fallback.
55

56
    :return: The default decoder for state serialization.
57
    """
58
    try:
1✔
59
        return create_decoder(config.STATE_SERIALIZATION_BACKEND)
1✔
UNCOV
60
    except ValueError:
×
UNCOV
61
        return PickleDecoder()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc