# Path: baseband/base/utils.py
# class fixedvalue(classproperty):
#     """Property that is fixed for all instances of a class.
# 
#     Based on `astropy.utils.decorators.classproperty`, but with
#     a setter that passes if the value is identical to the fixed
#     value, and otherwise raises a `ValueError`.
#     """
#     def __set__(self, instance, value):
#         fixed_value = self.__get__(instance, type(instance))
#         if value != fixed_value:
#             raise ValueError(
#                 f"'{self.fget.__name__}' can only be set to {fixed_value}.")


import sys
import struct
import warnings
import functools
import numpy as np
from copy import copy
from astropy.utils import sharedmethod
from .utils import fixedvalue
        mask : list of int
            For each entry in ``pattern`` a bit mask with bits set for
            the parts that are invariant.
        """

        if invariants is None:
            invariants = self.invariants()

        if not invariants:
            raise ValueError("cannot create an invariant_mask without "
                             "some invariants")

        if isinstance(self, type):
            # If we are called as a classmethod, first get an instance
            # with all defaults set.  This will be our pattern.
            self = self(None, **kwargs)
            for invariant in invariants:
                value = self._header_parser.defaults[invariant]
                if value is None:
                    raise ValueError('can only set as invariant a header '
                                     'part that has a default.')
                self[invariant] = value

        # Create an all-zero version and set bits for all invariants.
        mask = self.__class__(None, **kwargs)
        for invariant in invariants:
            mask[invariant] = True

        return self.words, mask.words


# Path: baseband/base/utils.py
# class fixedvalue(classproperty):
#     """Property that is fixed for all instances of a class.
# 
#     Based on `astropy.utils.decorators.classproperty`, but with
#     a setter that passes if the value is identical to the fixed
#     value, and otherwise raises a `ValueError`.
#     """
#     def __set__(self, instance, value):
#         fixed_value = self.__get__(instance, type(instance))
#         if value != fixed_value:
#             raise ValueError(
#                 f"'{self.fget.__name__}' can only be set to {fixed_value}.")


# Path: baseband/base/header.py
import sys
import struct
import warnings
import functools
import numpy as np
from copy import copy
from astropy.utils import sharedmethod
from .utils import fixedvalue

        mask : list of int
            For each entry in ``pattern`` a bit mask with bits set for
            the parts that are invariant.
        """

        if invariants is None:
            invariants = self.invariants()

        if not invariants:
            raise ValueError("cannot create an invariant_mask without "
                             "some invariants")

        if isinstance(self, type):
            # If we are called as a classmethod, first get an instance
            # with all defaults set.  This will be our pattern.
            self = self(None, **kwargs)
            for invariant in invariants:
                value = self._header_parser.defaults[invariant]
                if value is None:
                    raise ValueError('can only set as invariant a header '
                                     'part that has a default.')
                self[invariant] = value

        # Create an all-zero version and set bits for all invariants.
        mask = self.__class__(None, **kwargs)
        for invariant in invariants:
            mask[invariant] = True

        return self.words, mask.words


    @fixedvalue