code: def _cdf_cvm(x, n=None):
      """
      Calculate the cdf of the Cramér-von Mises statistic for a finite sample
      size n. If N is None, use the asymptotic cdf (n=inf).
  
      See equation 1.8 in Csorgo, S. and Faraway, J. (1996) for finite samples,
      1.2 for the asymptotic cdf.
  
      The function is not expected to be accurate for large values of x, say
      x > 2, when the cdf is very close to 1 and it might return values > 1
      in that case, e.g. _cdf_cvm(2.0, 12) = 1.0000027556716846.
      """
      x = np.asarray(x)
      if n is None:
          y = _cdf_cvm_inf(x)
      else:
          # support of the test statistic is [12/n, n/3], see 1.1 in [2]
          y = np.zeros_like(x, dtype="float")
          sup = (1.0 / (12 * n) < x) & (x < n / 3.0)
          # note: _psi1_mod does not include the term _cdf_cvm_inf(x) / 12
          # therefore, we need to add it here
          y[sup] = (
              _cdf_cvm_inf(x[sup]) * (1 + 1.0 / (12 * n))
              + _psi1_mod(x[sup]) / n
          )
          y[x >= n / 3] = 1
  
      if y.ndim == 0:
          return y[()]
      return y
  
imports: from collections import namedtuple
  from dataclasses import make_dataclass
  import numpy
  import warnings
  from itertools import combinations
  import scipy.stats
  from scipy.optimize import shgo
  from .None import distributions
  from ._continuous_distns import chi2, norm
  from scipy.special import gamma, kv, gammaln
  from .None import _wilcoxon_data
label_desc: Use image node_id 4 for calling a global function with example usage: _cdf_cvm(x, n) and returns: y, y