# Buggy code
def _cdf(self, x, alpha, beta):
    x = np.asarray(x).reshape(1, -1)[0, :]

    x, alpha, beta = np.broadcast_arrays(x, alpha, beta)

    data_in = np.dstack((x, alpha, beta))[0]
    data_out = np.empty(shape=(len(data_in), 1))

    fft_min_points_threshold = getattr(self, "pdf_fft_min_points_threshold", None)
    fft_grid_spacing = getattr(self, "pdf_fft_grid_spacing", 0.001)
    fft_n_points_two_power = getattr(self, "pdf_fft_n_points_two_power", None)

    # group data in unique arrays of alpha, beta pairs
    uniq_param_pairs = np.vstack({tuple(row) for row in data_in[:, 1:]})
    for pair in uniq_param_pairs:
        data_mask = np.all(data_in[:, 1:] == pair, axis=-1)
        data_subset = data_in[data_mask]
        if (
            fft_min_points_threshold is None
            or len(data_subset) < fft_min_points_threshold
        ):
            data_out[data_mask] = np.array(
                [
                    levy_stable._cdf_single_value_zolotarev(_x, _alpha, _beta)
                    for _x, _alpha, _beta in data_subset
                ]
            ).reshape(len(data_subset), 1)
        else:
            warnings.warn(
                "FFT method is considered experimental for "
                + "cumulative distribution function "
                + "evaluations. Use Zolotarev’s method instead).",
                RuntimeWarning,
            )
            _alpha, _beta = pair
            _x = data_subset[:, (0,)]

            # need enough points to "cover" _x for interpolation
            h = fft_grid_spacing
            q = 16 if fft_n_points_two_power is None else int(fft_n_points_two_power)

            density_x, density = levy_stable_gen._pdf_from_cf_with_fft(
                lambda t: levy_stable_gen._cf(t, _alpha, _beta), h=h, q=q
            )
            f = interpolate.InterpolatedUnivariateSpline(density_x, np.real(density))
            data_out[data_mask] = np.array(
                [f.integral(self.a, x_1) for x_1 in _x]
            ).reshape(data_out[data_mask].shape)

    return data_out.T[0]


# Traceback (SyntaxError)
Step 1/4 : FROM python:2.7
---> f67e752245d6
Step 2/4 : RUN pip install --no-cache-dir scipy
---> Using cache
---> e8adb88b0f15
Step 3/4 : RUN find /usr/local/lib/python2.7/site-packages/scipy/ -name '*.pyc' -delete
---> Running in 6e46e320f24d
Removing intermediate container 6e46e320f24d
---> ed5be7afd25a
Step 4/4 : RUN python -c "import scipy.stats"
---> Running in 8c8ea36e3284
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/scipy/stats/__init__.py", line 367, in <module>
from .stats import *
File "/usr/local/lib/python2.7/site-packages/scipy/stats/stats.py", line 173, in <module>
from . import distributions
File "/usr/local/lib/python2.7/site-packages/scipy/stats/distributions.py", line 13, in <module>
from . import _continuous_distns
File "/usr/local/lib/python2.7/site-packages/scipy/stats/_continuous_distns.py", line 3345
SyntaxError: Non-ASCII character '\xe2' in file /usr/local/lib/python2.7/site-packages/scipy/stats/_continuous_distns.py on line 3346, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

# Fixed code
def _cdf(self, x, alpha, beta):
    x = np.asarray(x).reshape(1, -1)[0, :]

    x, alpha, beta = np.broadcast_arrays(x, alpha, beta)

    data_in = np.dstack((x, alpha, beta))[0]
    data_out = np.empty(shape=(len(data_in), 1))

    fft_min_points_threshold = getattr(self, "pdf_fft_min_points_threshold", None)
    fft_grid_spacing = getattr(self, "pdf_fft_grid_spacing", 0.001)
    fft_n_points_two_power = getattr(self, "pdf_fft_n_points_two_power", None)

    # group data in unique arrays of alpha, beta pairs
    uniq_param_pairs = np.vstack({tuple(row) for row in data_in[:, 1:]})
    for pair in uniq_param_pairs:
        data_mask = np.all(data_in[:, 1:] == pair, axis=-1)
        data_subset = data_in[data_mask]
        if (
            fft_min_points_threshold is None
            or len(data_subset) < fft_min_points_threshold
        ):
            data_out[data_mask] = np.array(
                [
                    levy_stable._cdf_single_value_zolotarev(_x, _alpha, _beta)
                    for _x, _alpha, _beta in data_subset
                ]
            ).reshape(len(data_subset), 1)
        else:
            warnings.warn(
                "FFT method is considered experimental for "
                + "cumulative distribution function "
                + "evaluations. Use Zolotarev’s method instead).",
                RuntimeWarning,
            )
            _alpha, _beta = pair
            _x = data_subset[:, (0,)]

            # need enough points to "cover" _x for interpolation
            h = fft_grid_spacing
            q = 16 if fft_n_points_two_power is None else int(fft_n_points_two_power)

            density_x, density = levy_stable_gen._pdf_from_cf_with_fft(
                lambda t: levy_stable_gen._cf(t, _alpha, _beta), h=h, q=q
            )
            f = interpolate.InterpolatedUnivariateSpline(density_x, np.real(density))
            data_out[data_mask] = np.array(
                [f.integral(self.a, x_1) for x_1 in _x]
            ).reshape(data_out[data_mask].shape)

    return data_out.T[0]