code: def __init__(
      self,
      random_state: np.random.RandomState,
      crossover: tp.Union[str, float],
      parameter: tp.Optional[p.Parameter] = None,
  ):
      self.CR = 0.5
      self.crossover = crossover
      self.random_state = random_state
      if isinstance(crossover, float):
          self.CR = crossover
      elif crossover == "random":
          self.CR = self.random_state.uniform(0.0, 1.0)
      elif crossover not in [
          "twopoints",
          "onepoint",
          "rotated_twopoints",
          "voronoi",
      ]:
          raise ValueError(f'Unknown crossover "{crossover}"')
      self.shape = (
          np.array(parameter.value).shape
          if (crossover == "voronoi" and parameter is not None)
          else None
      )
  
imports: import warnings
  import numpy
  import nevergrad.common.typing
  from nevergrad.parametrization import parameter
  from .None import metamodel
  from .None import base
  from .None import oneshot
label_desc: Use image node_id 1 to create a new Crossover object  with example: obj = Crossover(random_state, crossover, parameter)