Verifies that all the envs have the same observation and action space.
329979
def _verify_same_spaces(self):
    """"""

    # Pre-conditions: self._envs is initialized.

    if self._envs is None:
      raise ValueError("Environments not initialized.")

    if not isinstance(self._envs, list):
      tf.logging.warning("Not checking observation and action space "
                         "compatibility across envs, since there is just one.")
      return

    # NOTE: We compare string representations of observation_space and
    # action_space because compositional classes like space.Tuple don't return
    # true on object comparison.

    if not all(
        str(env.observation_space) == str(self.observation_space)
        for env in self._envs):
      err_str = ("All environments should have the same observation space, but "
                 "don't.")
      tf.logging.error(err_str)
      # Log all observation spaces.
      for i, env in enumerate(self._envs):
        tf.logging.error("Env[%d] has observation space [%s]", i,
                         env.observation_space)
      raise ValueError(err_str)

    if not all(
        str(env.action_space) == str(self.action_space) for env in self._envs):
      err_str = "All environments should have the same action space, but don't."
      tf.logging.error(err_str)
      # Log all action spaces.
      for i, env in enumerate(self._envs):
        tf.logging.error("Env[%d] has action space [%s]", i, env.action_space)
      raise ValueError(err_str)
1187359
private static boolean multiPointEqualsEnvelope_(MultiPoint multipoint_a,
			Envelope envelope_b, double tolerance,
			ProgressTracker progress_tracker) {
		Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
		multipoint_a.queryEnvelope2D(env_a);
		envelope_b.queryEnvelope2D(env_b);

		if (env_b.getHeight() > tolerance || env_b.getWidth() > tolerance)
			return false;

		// only true if all the points of the multi_point degenerate to a point
		// equal to the envelope
		return envelopeEqualsEnvelope_(env_a, env_b, tolerance,
				progress_tracker);
	}
954586
def all_same_area(self):
        """"""
        all_areas = [x.attrs.get('area', None) for x in self.values()]
        all_areas = [x for x in all_areas if x is not None]
        return all(all_areas[0] == x for x in all_areas[1:])
1245795
def verify(self):
        
        for row in range(self.nrows()):
            result = self.verify_row(row)
            if result != 0:
                return result
        return 0
87523
static boolean pointDisjointEnvelope_(Point2D pt_a, Envelope2D env_b,
			double tolerance, ProgressTracker progress_tracker) {
		Envelope2D env_b_inflated = new Envelope2D();
		env_b_inflated.setCoords(env_b);
		env_b_inflated.inflate(tolerance, tolerance);
		return !env_b_inflated.contains(pt_a);
	}
1106268
def sameState (s1, s2):
    
    if (len(s1[1]) != len(s2[1])) or (s1[2] != s2[2]):
        return False
    for arcIndex in range(0, len(s1[1])):
        arc1 = s1[1][arcIndex]
        arc2 = s2[1][arcIndex]
        if arc1[:-1] != arc2[:-1]:
            return False
    return True
530113
private ESat isConsistent() {
        int[][] l = new int[nbDims][nbBins];
        for (int i = 0; i < bins.length; i++) {
            if (bins[i].isInstantiated()) {
                for (int d = 0; d < nbDims; d++) {
                    int v = bins[i].getValue();
                    l[d][v] += iSizes[d][i];
                    if (l[d][v] > loads[d][v].getUB()) {
                        return ESat.FALSE;
                    }
                }
            }
        }
        return ESat.TRUE;
    }
244958
def verify(self):
        
        for expectation in self.exp_list:
            if hasattr(expectation, "verify") and not expectation.verify():
                return False
        return True
1257426
def _check_kets(*ops, same_space=False, disjunct_space=False):
    """"""
    if not all([(isinstance(o, State) and o.isket) for o in ops]):
        raise TypeError("All operands must be Kets")
    if same_space:
        if not len({o.space for o in ops if o is not ZeroKet}) == 1:
            raise UnequalSpaces(str(ops))
    if disjunct_space:
        spc = TrivialSpace
        for o in ops:
            if o.space & spc > TrivialSpace:
                raise OverlappingSpaces(str(ops))
            spc *= o.space
719306
def rollout(env, acts):
    
    total_rew = 0
    env.reset()
    steps = 0
    for act in acts:
        _obs, rew, done, _info = env.step(act)
        steps += 1
        total_rew += rew
        if done:
            break

    return steps, total_rew
1348397
def have_the_same_dimensions matrix
    if (matrix.is_a?Matrix and matrix.columns == @columns and matrix.lines == @lines)
      true
    else
      false
    end
  end
174617
private static boolean envelopeTouchesEnvelope_(Envelope2D env_a,
			Envelope2D env_b, double tolerance, ProgressTracker progress_tracker) {
		if (env_a.getHeight() <= tolerance && env_a.getWidth() <= tolerance) {// treat
																				// env_a
																				// as
																				// point
			Point2D pt_a = env_a.getCenter();
			return pointTouchesEnvelope_(pt_a, env_b, tolerance,
					progress_tracker);
		}

		if (env_b.getHeight() <= tolerance && env_b.getWidth() <= tolerance) {// treat
																				// env_b
																				// as
																				// point
			Point2D pt_b = env_b.getCenter();
			return pointTouchesEnvelope_(pt_b, env_a, tolerance,
					progress_tracker);
		}

		Envelope2D _env_a;
		Envelope2D _env_b;

		if (env_a.getHeight() > tolerance
				&& env_a.getWidth() > tolerance
				&& (env_b.getHeight() <= tolerance || env_b.getWidth() <= tolerance)) {
			// swap a and b
			_env_a = env_b;
			_env_b = env_a;
		} else {
			_env_a = env_a;
			_env_b = env_b;
		}

		if (_env_a.getHeight() <= tolerance || _env_a.getWidth() <= tolerance) {// treat
																				// env_a
																				// as
																				// line

			if (_env_b.getHeight() <= tolerance
					|| _env_b.getWidth() <= tolerance) {// treat env_b as line

				Line line_a = new Line(), line_b = new Line();
				double[] scalars_a = new double[2];
				double[] scalars_b = new double[2];
				Point2D pt = new Point2D();
				_env_a.queryLowerLeft(pt);
				line_a.setStartXY(pt);
				_env_a.queryUpperRight(pt);
				line_a.setEndXY(pt);
				_env_b.queryLowerLeft(pt);
				line_b.setStartXY(pt);
				_env_b.queryUpperRight(pt);
				line_b.setEndXY(pt);

				line_a.intersect(line_b, null, scalars_a, scalars_b, tolerance);
				int count = line_a.intersect(line_b, null, null, null,
						tolerance);

				if (count != 1)
					return false;

				return scalars_a[0] == 0.0 || scalars_a[1] == 1.0
						|| scalars_b[0] == 0.0 || scalars_b[1] == 1.0;
			}

			// treat env_b as area

			Envelope2D env_b_deflated = new Envelope2D(), env_inter = new Envelope2D();
			env_b_deflated.setCoords(_env_b);
			env_b_deflated.inflate(-tolerance, -tolerance);
			env_inter.setCoords(env_b_deflated);
			env_inter.intersect(_env_a);

			if (!env_inter.isEmpty()
					&& (env_inter.getHeight() > tolerance || env_inter
							.getWidth() > tolerance))
				return false;

			assert (!envelopeDisjointEnvelope_(_env_a, _env_b, tolerance,
					progress_tracker));
			return true; // we already know they intersect within a tolerance
		}

		Envelope2D env_inter = new Envelope2D();
		env_inter.setCoords(_env_a);
		env_inter.intersect(_env_b);

		if (!env_inter.isEmpty() && env_inter.getHeight() > tolerance
				&& env_inter.getWidth() > tolerance)
			return false;

		return true; // we already know they intersect within a tolerance
	}
812207
def matches_factor_conditions(s, env):
    """""""
    env_labels = set(env.name.split('-'))
    labels = set(bash_expand(s))
    return bool(labels & env_labels)
62708
function envelopeIsEqual(env1, env2) {
  const envX1 = env1.geometry.coordinates.map(c => c[0]),
    envY1 = env1.geometry.coordinates.map(c => c[1]),
    envX2 = env2.geometry.coordinates.map(c => c[0]),
    envY2 = env2.geometry.coordinates.map(c => c[1]);

  return Math.max(null, envX1) === Math.max(null, envX2) &&
    Math.max(null, envY1) === Math.max(null, envY2) &&
    Math.min(null, envX1) === Math.min(null, envX2) &&
    Math.min(null, envY1) === Math.min(null, envY2);
}
494311
def observe_multi(self, keys, master_only=False):
        """"""
        return _Base.observe_multi(self, keys, master_only=master_only)
371370
def _assert_equal_channels(axis):
    
    for i0 in axis:
        for i1 in axis:
            if not all(i0 == i1):
                raise ValueError('The channels for all the trials should have '
                                 'the same labels, in the same order.')
822310
def satisfy_all(self, **params):
        """"""
        verbosity = params.get('verbosity', 0)
        default_phase = params.get('default_phase', 2)
        propagation_limit = params.get('propagation_limit', -1)
        decision_limit = params.get('decision_limit', -1)
        seed = params.get('seed', 1)
        yield from picosat.satisfy_all(self.nvars, self.clauses, verbosity,
                                       default_phase, propagation_limit,
                                       decision_limit, seed)