<commit_before># -*- coding: utf-8 -*-
# pylint: disable=too-many-instance-attributes

"""Functionality to support saving and restoring the current Sonos state.

This is useful for scenarios such as when you want to switch to radio
and then back again to what was playing previously.
"""


class Snapshot(object):
    """A snapshot of the current state.

    Note:
        This does not change anything to do with the configuration
        such as which group the speaker is in, just settings that impact
        what is playing, or how it is played.

        List of sources that may be playing using root of media_uri:

        | ``x-rincon-queue``: playing from Queue
        | ``x-sonosapi-stream``: playing a stream (eg radio)
        | ``x-file-cifs``: playing file
        | ``x-rincon``: slave zone (only change volume etc. rest from
          coordinator)
    """

    def __init__(self, device, snapshot_queue=False):
        """
        Args:
            device (SoCo): The device to snapshot
            snapshot_queue (bool): Whether the queue should be snapshotted.
                Defaults to `False`.

        Warning:
            It is strongly advised that you do not snapshot the queue unless
            you really need to as it takes a very long time to restore large
            queues as it is done one track at a time.
        """
        # The device that will be snapshotted
        self.device = device

        # The values that will be stored
        # For all zones:
        self.media_uri = None
        self.is_coordinator = False
        self.is_playing_queue = False

        self.volume = None
        self.mute = None
        self.bass = None
        self.treble = None
        self.loudness = None

        # For coordinator zone playing from Queue:
        self.play_mode = None
        self.cross_fade = None
        self.playlist_position = None
        self.track_position = None

        # For coordinator zone playing a Stream:
        self.media_metadata = None

        # For all coordinator zones
        self.transport_state = None

        self.queue = None
        # Only set the queue as a list if we are going to save it
        if snapshot_queue:
            self.queue = []
<commit_msg>Added one use documentation and fixed Python 3 portnetial issue<commit_after># -*- coding: utf-8 -*-
# pylint: disable=too-many-instance-attributes

"""Functionality to support saving and restoring the current Sonos state.

This is useful for scenarios such as when you want to switch to radio
or an announcement and then back again to what was playing previously.

Warning:
    This class is deigned to be created used and destroyed. It is not
    designed to be reused or long lived. The init sets up defaults for
    one use.
"""


class Snapshot(object):
    """A snapshot of the current state.

    Note:
        This does not change anything to do with the configuration
        such as which group the speaker is in, just settings that impact
        what is playing, or how it is played.

        List of sources that may be playing using root of media_uri:

        | ``x-rincon-queue``: playing from Queue
        | ``x-sonosapi-stream``: playing a stream (eg radio)
        | ``x-file-cifs``: playing file
        | ``x-rincon``: slave zone (only change volume etc. rest from
          coordinator)
    """

    def __init__(self, device, snapshot_queue=False):
        """
        Args:
            device (SoCo): The device to snapshot
            snapshot_queue (bool): Whether the queue should be snapshotted.
                Defaults to `False`.

        Warning:
            It is strongly advised that you do not snapshot the queue unless
            you really need to as it takes a very long time to restore large
            queues as it is done one track at a time.
        """
        # The device that will be snapshotted
        self.device = device

        # The values that will be stored
        # For all zones:
        self.media_uri = None
        self.is_coordinator = False
        self.is_playing_queue = False

        self.volume = None
        self.mute = None
        self.bass = None
        self.treble = None
        self.loudness = None

        # For coordinator zone playing from Queue:
        self.play_mode = None
        self.cross_fade = None
        self.playlist_position = 0
        self.track_position = None

        # For coordinator zone playing a Stream:
        self.media_metadata = None

        # For all coordinator zones
        self.transport_state = None

        self.queue = None
        # Only set the queue as a list if we are going to save it
        if snapshot_queue:
            self.queue = []

{'fraction_non_alphanumeric': 0.06414613423959219, 'fraction_numerical': 0.0008496176720475786, 'mean_word_length': 2.0498704663212437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2080493', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1189, 'n_words': 541}