Evaluate the possible range of versions for each target, yielding the output analysis.
540571
def possible_version_evaluation(self):
    """"""
    only_broken = self.get_options().only_broken
    ranges = self._ranges
    yield 'Allowable JVM platform ranges (* = anything):'
    for target in sorted(filter(self._is_relevant, self.jvm_targets)):
      min_version = ranges.min_allowed_version.get(target)
      max_version = ranges.max_allowed_version.get(target)
      current_valid = True
      if min_version and self.jvm_version(target) < min_version:
        current_valid = False
      if max_version and self.jvm_version(target) > max_version:
        current_valid = False
      current_text = str(self.jvm_version(target))
      if not current_valid:
        current_text = self._format_error(current_text)
      elif only_broken:
        continue

      if min_version and max_version:
        range_text = '{} to {}'.format(min_version, max_version)
        if min_version > max_version:
          range_text = self._format_error(range_text)
      elif min_version:
        range_text = '{}+'.format(min_version)
      elif max_version:
        range_text = '<={}'.format(max_version)
      else:
        range_text = '*'
      yield '{address}: {range}  (is {current})'.format(address=target.address.spec,
                                                        range=range_text,
                                                        current=current_text,)
      if self.get_options().detailed or not current_valid:
        if min_version:
          min_because = [t for t in ranges.target_dependencies[target]
                         if self.jvm_version(t) == min_version]
          yield '  min={} because of dependencies:'.format(min_version)
          for dep in sorted(min_because):
            yield '    {}'.format(dep.address.spec)
        if max_version:
          max_because = [t for t in ranges.target_dependees[target]
                         if self.jvm_version(t) == max_version]
          yield '  max={} because of dependees:'.format(max_version)
          for dep in sorted(max_because):
            yield '    {}'.format(dep.address.spec)
        yield ''
464006
def get_all_targets(self):
        """"""
        result = []
        for batch in self.batches:
            result.extend(batch.targets)
        return result
398536
def evaluate(self, num_eval_batches=None):
    """"""

    num_eval_batches = num_eval_batches or self.num_eval_batches
    with tf.Graph().as_default() as graph:
      self.tensors = self.model.build_eval_graph(self.eval_data_paths,
                                                 self.batch_size)
      self.summary = tf.summary.merge_all()
      self.saver = tf.train.Saver()

    self.summary_writer = tf.summary.FileWriter(self.output_path)
    self.sv = tf.train.Supervisor(
        graph=graph,
        logdir=self.output_path,
        summary_op=None,
        global_step=None,
        saver=self.saver)

    last_checkpoint = tf.train.latest_checkpoint(self.checkpoint_path)
    with self.sv.managed_session(master='', start_standard_services=False) as session:
      self.sv.saver.restore(session, last_checkpoint)

      if not self.batch_of_examples:
        self.sv.start_queue_runners(session)
        for i in range(num_eval_batches):
          self.batch_of_examples.append(session.run(self.tensors.examples))

      for i in range(num_eval_batches):
        session.run(self.tensors.metric_updates,
                    {self.tensors.examples: self.batch_of_examples[i]})

      metric_values = session.run(self.tensors.metric_values)
      global_step = tf.train.global_step(session, self.tensors.global_step)
      summary = session.run(self.summary)
      self.summary_writer.add_summary(summary, global_step)
      self.summary_writer.flush()
      return metric_values
235747
def versions(options = {})
      batches = Enumerator.new do |y|
        options = options.merge(policy_arn: @arn)
        resp = @client.list_policy_versions(options)
        resp.each_page do |page|
          batch = []
          page.data.versions.each do |v|
            batch << PolicyVersion.new(
              arn: @arn,
              version_id: v.version_id,
              data: v,
              client: @client
            )
          end
          y.yield(batch)
        end
      end
      PolicyVersion::Collection.new(batches)
    end
306914
def version_range(guid, version, before=None, app_versions=None):
    """"""

    if app_versions is None:
        app_versions = validator.constants.APPROVED_APPLICATIONS
    app_key = None

    # Support for shorthand instead of full GUIDs.
    for app_guid, app_name in APPLICATIONS.items():
        if app_name == guid:
            guid = app_guid
            break

    for key in app_versions.keys():
        if app_versions[key]['guid'] == guid:
            app_key = key
            break

    if not app_key or version not in app_versions[app_key]['versions']:
        raise Exception('Bad GUID or version provided for version range: %s'
                        % version)

    all_versions = app_versions[app_key]['versions']
    version_pos = all_versions.index(version)
    before_pos = None
    if before is not None and before in all_versions:
        before_pos = all_versions.index(before)

    return all_versions[version_pos:before_pos]
1221703
def targets(self):
        
        logging.info('Performing analysis with {} targets folder'.format(self.analysistype))
        for sample in self.runmetadata:
            sample[self.analysistype].runanalysis = True
            sample[self.analysistype].targetpath = (os.path.join(self.targetpath,
                                                                 sample[self.analysistype].pointfindergenus))
            # There is a relatively strict databasing scheme necessary for the custom targets. Eventually,
            # there will be a helper script to combine individual files into a properly formatted combined file
            try:
                sample[self.analysistype].baitfile = glob(os.path.join(sample[self.analysistype].targetpath,
                                                                       '*.fasta'))[0]
            # If the fasta file is missing, raise a custom error
            except IndexError:
                # Combine any .tfa files in the directory into a combined targets .fasta file
                fsafiles = glob(os.path.join(sample[self.analysistype].targetpath, '*.fsa'))
                if fsafiles:
                    combinetargets(fsafiles, sample[self.analysistype].targetpath)
                try:
                    sample[self.analysistype].baitfile = glob(os.path.join(sample[self.analysistype].targetpath,
                                                                           '*.fasta'))[0]
                except IndexError as e:
                    # noinspection PyPropertyAccess
                    e.args = [
                        'Cannot find the combined fasta file in {}. Please note that the file must have a '
                        '.fasta extension'.format(sample[self.analysistype].targetpath)]
                    if os.path.isdir(sample[self.analysistype].targetpath):
                        raise
                    else:
                        sample[self.analysistype].runanalysis = False
        for sample in self.runmetadata:
            # Set the necessary attributes
            sample[self.analysistype].outputdir = os.path.join(sample.run.outputdirectory, self.analysistype)
            make_path(sample[self.analysistype].outputdir)
            sample[self.analysistype].logout = os.path.join(sample[self.analysistype].outputdir, 'logout.txt')
            sample[self.analysistype].logerr = os.path.join(sample[self.analysistype].outputdir, 'logerr.txt')
            sample[self.analysistype].baitedfastq = \
                os.path.join(sample[self.analysistype].outputdir,
                             '{at}_targetMatches.fastq.gz'.format(at=self.analysistype))
250307
def _process_version_lines(self):
        """"""
        if len(self._lines_seen["version"]) > 1:
            self._add_error(_("Multiple version lines appeared."))
        elif self._lines_seen["version"][0] != 1:
            self._add_error(_("The version must be on the first line."))
440236
def compute_targets_to_build(self, targets: Iterable[str]) -> Iterable[BuildTarget]:
        
        normalized_targets = set()
        for target in targets:
            normalized_targets.update(self._normalize_target(target))

        targets_to_parse = deque(normalized_targets)
        targets_seen = set(normalized_targets)
        targets_not_found = []
        build_targets = set()

        while targets_to_parse:
            next_target_string = targets_to_parse.popleft()
            next_target = self._parse_target(next_target_string)
            build_file = self.parser.parse_file(next_target.build_file_directory)
            if next_target.name not in build_file.targets:
                targets_not_found.append(next_target_string)
                continue
            target_to_build = build_file.targets[next_target.name]
            build_targets.add(target_to_build)

            new_targets = [
                dependency
                for dependency in target_to_build.dependencies
                if dependency not in targets_seen
            ]
            targets_to_parse.extend(new_targets)
            targets_seen.update(new_targets)

        if targets_not_found and self.fail_on_unbuilt_target:
            raise BuilderException(
                "Target(s) could not be built: {}".format(", ".join(targets_not_found)),
                targets=targets_not_found,
            )
        return build_targets
406028
def matches_sample(output, target, threshold, is_correct, actual_output):
        
        return (bool(output > threshold) == bool(target)) == is_correct and actual_output == bool(output > threshold)
1323634
def _list_available_rest_versions(self):
        """"""
        url = "https://{0}/api/api_version".format(self._target)

        data = self._request("GET", url, reestablish_session=False)
        return data["version"]
532259
def select_interpreter_for_targets(self, targets):
    """"""

    tgts_by_compatibilities, total_filter_set = self.partition_targets_by_compatibility(targets)
    allowed_interpreters = set(self.setup(filters=total_filter_set))

    # Constrain allowed_interpreters based on each target's compatibility requirements.
    for compatibility in tgts_by_compatibilities:
      compatible_with_target = set(self._matching(allowed_interpreters, compatibility))
      allowed_interpreters &= compatible_with_target

    if not allowed_interpreters:
      # Create a helpful error message.
      all_interpreter_version_strings = sorted({
        interpreter.version_string
        # NB: self.setup() requires filters to be passed, or else it will use the global interpreter
        # constraints. We allow any interpreter other than CPython 3.0-3.3, which is known to choke
        # with Pants.
        for interpreter in self.setup(filters=("CPython<3", "CPython>=3.3", "PyPy"))
      })
      unique_compatibilities = {tuple(c) for c in tgts_by_compatibilities.keys()}
      unique_compatibilities_strs = [','.join(x) for x in unique_compatibilities if x]
      tgts_by_compatibilities_strs = [t[0].address.spec for t in tgts_by_compatibilities.values()]
      raise self.UnsatisfiableInterpreterConstraintsError(dedent("""\
        Unable to detect a suitable interpreter for compatibilities: {} (Conflicting targets: {})

        Pants detected these interpreter versions on your system: {}

        Possible ways to fix this:
        * Modify your Python interpreter constraints by following https://www.pantsbuild.org/python_readme.html#configure-the-python-version.
        * Ensure the targeted Python version is installed and discoverable.
        * Modify Pants' interpreter search paths via --pants-setup-interpreter-search-paths.""".format(
          ' && '.join(sorted(unique_compatibilities_strs)),
          ', '.join(tgts_by_compatibilities_strs),
          ', '.join(all_interpreter_version_strings)
        )))
    # Return the lowest compatible interpreter.
    return min(allowed_interpreters)
72009
def get_target_errors(self):
    
    if self._target_errors: return self._target_errors
    v = []
    for i in range(len(self._target_hpas)):
      v.append(self.get_target_error(i))
    return v
393437
def calculate_permute_output_shapes(operator):
    '''
    
    '''
    check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1)
    check_input_and_output_types(operator, good_input_types=[FloatTensorType, Int64TensorType, StringTensorType],
                                 good_output_types=[FloatTensorType, Int64TensorType, StringTensorType])

    input = operator.inputs[0]
    output = operator.outputs[0]

    axes = [int(i) for i in operator.raw_operator.permute.axis]
    input_shape = copy.deepcopy(input.type.shape)
    output.type.shape = [input_shape[a] for a in axes]
861449
def generate_docker_targets():
    """"""
    output = {}
    for py_ver in python_versions.values():
        filepath = os.path.join(container_config_root, py_ver.docker_file)
        output[filepath] = generate_docker_file(py_ver)
        filepath = os.path.join(container_config_root, py_ver.compose_file)
        output[filepath] = generate_compose_file(py_ver)
    return output
868631
private function evaluateVersionTarget(
        Target\Version $version,
        APILimitationValue $value
    ): ?bool {
        // intentionally evaluate all conditions separately from the least to the most important
        $accessVote = self::ACCESS_ABSTAIN;

        // allow creating new drafts
        if ($version->newStatus === VersionInfo::STATUS_DRAFT) {
            $accessVote = self::ACCESS_GRANTED;
        }

        // ... unless there's a specific list of target translations
        if (!empty($version->allLanguageCodesList)) {
            $accessVote = $this->evaluateMatchingAnyLimitation(
                $version->allLanguageCodesList,
                $value->limitationValues
            );
        }

        // ... or there's an intent to update Version
        if (!empty($version->forUpdateLanguageCodesList) || null !== $version->forUpdateInitialLanguageCode) {
            if (!empty($version->forUpdateLanguageCodesList)) {
                $diff = array_diff($version->forUpdateLanguageCodesList, $value->limitationValues);
                $accessVote = empty($diff) ? self::ACCESS_GRANTED : self::ACCESS_DENIED;
            }

            if ($accessVote !== self::ACCESS_DENIED && null !== $version->forUpdateInitialLanguageCode) {
                $accessVote = in_array(
                    $version->forUpdateInitialLanguageCode,
                    $value->limitationValues
                )
                    ? self::ACCESS_GRANTED
                    : self::ACCESS_DENIED;
            }
        }

        return $accessVote;
    }
949754
def existing_versions(self):
        
        import glob
        pattern = self.fname + '_*' + self.ext
        for fname in glob.glob1(self.dpath, pattern):
            fpath = join(self.dpath, fname)
            yield fpath
139759
def compile_output(self, input_sample, num_samples, num_params,
                       maximum_combo, num_groups=None):
        

        if num_groups is None:
            num_groups = num_params

        self.check_input_sample(input_sample, num_groups, num_samples)

        index_list = self._make_index_list(num_samples, num_params, num_groups)

        output = np.zeros(
            (np.size(maximum_combo) * (num_groups + 1), num_params))
        for counter, combo in enumerate(maximum_combo):
            output[index_list[counter]] = np.array(
                input_sample[index_list[combo]])
        return output