import hist
import tensorflow as tf
from .. import z as z
from .._interfaces import ZfitBinnedData as ZfitBinnedData, ZfitData as ZfitData, ZfitSpace as ZfitSpace
from .._variables.axis import binning_to_histaxes as binning_to_histaxes, histaxes_to_binning as histaxes_to_binning
from ..core.baseobject import convert_param_values as convert_param_values
from ..settings import ztypes as ztypes
from ..util import ztyping as ztyping
from ..util.exception import BreakingAPIChangeError as BreakingAPIChangeError, ShapeIncompatibleError as ShapeIncompatibleError
from ..z import numpy as znp
from _typeshed import Incomplete
from collections.abc import Callable as Callable
from uhi.typing.plottable import PlottableHistogram
from zfit_interface.typing import TensorLike as TensorLike

def convert_hist2binneddata(data: ZfitBinnedData | PlottableHistogram, *, none_if_fail=None) -> ZfitBinnedData: ...

class BinnedHolder:
    space: Incomplete
    values: Incomplete
    variances: Incomplete
    def __init__(self, space, values, variances) -> None: ...
    @classmethod
    def from_hist(cls, h: hist.NamedHist): ...
    def with_obs(self, obs: ztyping.ObsTypeInput): ...
    def with_variances(self, variances: znp.array | None): ...

def move_axis_obs(original, target, values, variances=None): ...

flow: bool

class BinnedData(ZfitBinnedData):
    USE_HASH: bool
    holder: BinnedHolder
    name: Incomplete
    label: Incomplete
    def __init__(self, *, h: BinnedHolder | hist.NamedHist | ZfitBinnedData, use_hash=None, name: str | None = None, label: str | None = None) -> None: ...
    def with_variances(self, variances: znp.array) -> BinnedData: ...
    def enable_hashing(self) -> None: ...
    @classmethod
    def from_tensor(cls, space: ZfitSpace, values: znp.array, variances: znp.array | None = None, name: str | None = None, label: str | None = None, use_hash: bool | None = None) -> BinnedData: ...
    @classmethod
    def from_unbinned(cls, space: ZfitSpace, data: ZfitData, *, use_hash: bool | None = None, name: str | None = None, label: str | None = None) -> BinnedData: ...
    @classmethod
    def from_hist(cls, h: hist.NamedHist) -> BinnedData: ...
    def with_obs(self, obs: ztyping.ObsTypeInput) -> BinnedData: ...
    @property
    def hashint(self) -> int | None: ...
    @property
    def kind(self): ...
    @property
    def n_obs(self) -> int: ...
    @property
    def rank(self) -> int: ...
    @property
    def obs(self): ...
    def to_hist(self) -> hist.Hist: ...
    @property
    def space(self): ...
    @property
    def axes(self): ...
    @property
    def binning(self): ...
    def values(self) -> znp.array: ...
    def variances(self) -> None | znp.array: ...
    def counts(self): ...
    @property
    def data_range(self): ...
    @property
    def num_entries(self): ...
    @property
    def shape(self): ...
    @property
    def samplesize(self) -> float: ...
    @property
    def nevents(self): ...
    @property
    def n_events(self): ...
    def __eq__(self, other): ...
    def __hash__(self): ...
    def to_unbinned(self): ...

class BinnedSamplerData(BinnedData):
    params: Incomplete
    n: Incomplete
    holder: Incomplete
    def __init__(self, h: BinnedHolder | hist.NamedHist | ZfitBinnedData, *, sample_and_variances_func: Callable | None = None, sample_holder: tf.Variable = None, variances_holder: tf.Variable = None, n: ztyping.NumericalScalarType | Callable = None, params: ztyping.ParamValuesMap = None, name: str | None = None, label: str | None = None) -> None: ...
    @property
    def fixed_params(self): ...
    @property
    def n_samples(self): ...
    @property
    def hashint(self) -> int | None: ...
    @classmethod
    def get_cache_counting(cls): ...
    @classmethod
    def from_sample(cls, sample_func: Callable, n: ztyping.NumericalScalarType, obs: ztyping.ObsTypeInput, fixed_params=None): ...
    @classmethod
    def from_sampler(cls, *, sample_func: Callable | None = None, sample_and_variances_func: Callable | None = None, n: ztyping.NumericalScalarType, obs: ztyping.AxesTypeInput, params: ztyping.ParamValuesMap = None, fixed_params=None, name: str | None = None, label: str | None = None): ...
    def resample(self, params: ztyping.ParamValuesMap = None, *, n: int | tf.Tensor = None, param_values: ztyping.ParamValuesMap = None): ...
    def update_data(self, sample: TensorLike, variances: TensorLike | None = None): ...
    def values(self) -> znp.array: ...
    def variances(self) -> znp.array: ...
