text:
package org.innovateuk.ifs.assessment.dashboard.viewmodel;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.time.LocalDate;

/**
 * Holder of model attributes for the active competitions shown on the Assessment Dashboard.
 */
public class AssessorDashboardActiveCompetitionViewModel {

    private long competitionId;
    private String displayLabel;
    private long progressAssessed;
    private long progressTotal;
    private long pendingAssessments;
    private LocalDate submitDeadline;
    private long daysLeft;
    private long daysLeftPercentage;
    private boolean competitionAlwaysOpen;
    private long assessmentPeriodId;
    private long batchIndex;

    public AssessorDashboardActiveCompetitionViewModel(long competitionId, String displayLabel, long progressAssessed,
                                                       long progressTotal, long pendingAssessments, LocalDate submitDeadline,
                                                       long daysLeft, long daysLeftPercentage, boolean competitionAlwaysOpen,
                                                       long assessmentPeriodId, long batchIndex) {
        this.competitionId = competitionId;
        this.displayLabel = displayLabel;
        this.progressAssessed = progressAssessed;
        this.progressTotal = progressTotal;
        this.pendingAssessments = pendingAssessments;
        this.submitDeadline = submitDeadline;
        this.daysLeft = daysLeft;
        this.daysLeftPercentage = daysLeftPercentage;
        this.competitionAlwaysOpen = competitionAlwaysOpen;
        this.assessmentPeriodId = assessmentPeriodId;
        this.batchIndex = batchIndex;
    }

    public long getCompetitionId() {
        return competitionId;
    }

    public void setCompetitionId(long competitionId) {
        this.competitionId = competitionId;
    }

    public String getDisplayLabel() {
        return displayLabel;
    }

    public void setDisplayLabel(String displayLabel) {
        this.displayLabel = displayLabel;
    }

    public long getProgressAssessed() {
        return progressAssessed;
    }

    public void setProgressAssessed(long progressAssessed) {
        this.progressAssessed = progressAssessed;
    }

    public long getProgressTotal() {
        return progressTotal;
    }

    public void setProgressTotal(long progressTotal) {
        this.progressTotal = progressTotal;
    }

    public long getPendingAssessments() {
        return pendingAssessments;
    }

    public void setPendingAssessments(long pendingAssessments) {
        this.pendingAssessments = pendingAssessments;
    }

    public LocalDate getSubmitDeadline() {
        return submitDeadline;
    }

    public void setSubmitDeadline(LocalDate submitDeadline) {
        this.submitDeadline = submitDeadline;
    }

    public long getDaysLeft() {
        return daysLeft;
    }

    public void setDaysLeft(long daysLeft) {
        this.daysLeft = daysLeft;
    }

    public long getDaysLeftPercentage() {
        return daysLeftPercentage;
    }

    public void setDaysLeftPercentage(long daysLeftPercentage) {
        this.daysLeftPercentage = daysLeftPercentage;
    }

    public boolean hasPendingAssessments(){
        return pendingAssessments != 0;
    }

    public boolean hasApplicationsToAssess(){
        return progressTotal - progressAssessed != 0;
    }

    public boolean isCompetitionAlwaysOpen() {
        return competitionAlwaysOpen;
    }

    public long getAssessmentPeriodId() { return assessmentPeriodId; }

    public void setAssessmentPeriodId(long assessmentPeriodId) { this.assessmentPeriodId = assessmentPeriodId; }

    public long getBatchIndex() { return batchIndex; }

    public void setBatchIndex(long batchIndex) {
        this.batchIndex = batchIndex;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        AssessorDashboardActiveCompetitionViewModel that = (AssessorDashboardActiveCompetitionViewModel) o;

        return new EqualsBuilder()
                .append(progressAssessed, that.progressAssessed)
                .append(progressTotal, that.progressTotal)
                .append(pendingAssessments, that.pendingAssessments)
                .append(daysLeft, that.daysLeft)
                .append(daysLeftPercentage, that.daysLeftPercentage)
                .append(competitionId, that.competitionId)
                .append(displayLabel, that.displayLabel)
                .append(submitDeadline, that.submitDeadline)
                .append(competitionAlwaysOpen, that.competitionAlwaysOpen)
                .append(assessmentPeriodId, that.assessmentPeriodId)
                .append(batchIndex, that.batchIndex)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(competitionId)
                .append(displayLabel)
                .append(progressAssessed)
                .append(progressTotal)
                .append(pendingAssessments)
                .append(submitDeadline)
                .append(daysLeft)
                .append(daysLeftPercentage)
                .append(competitionAlwaysOpen)
                .append(assessmentPeriodId)
                .append(batchIndex)
                .toHashCode();
    }
}


text:
<?php

namespace Batna\SiebelBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class BatnaSiebelBundle extends Bundle
{
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Core.Pipeline;

namespace Azure.AI.FormRecognizer.Training
{
    ///
    /// Tracks the status of a long-running operation for training a model from a collection of custom forms.
    ///
    public class TrainingOperation : Operation<CustomFormModel>
    {
        /// Provides communication with the Form Recognizer Azure Cognitive Service through its REST API.
        private readonly ServiceRestClient _serviceClient;

        /// The last HTTP response received from the server. <c>null</c> until the first response is received.
        private Response _response;

        /// The result of the long-running operation. <c>null</c> until result is received on status update.
        private CustomFormModel _value;

        /// <c>true</c> if the long-running operation has completed. Otherwise, <c>false</c>.
        private bool _hasCompleted;

        /// <inheritdoc/>
        public override string Id { get; }

        /// <inheritdoc/>
        public override CustomFormModel Value => OperationHelpers.GetValue(ref _value);

        /// <inheritdoc/>
        public override bool HasCompleted => _hasCompleted;

        /// <inheritdoc/>
        public override bool HasValue => _value != null;
        // TODO: This will make the model available even if status is failed to train.
        // is it useful to make the value available if training has failed?
        // https://github.com/Azure/azure-sdk-for-net/issues/10392

        /// <inheritdoc/>
        public override Response GetRawResponse() => _response;

        /// <inheritdoc/>
        public override ValueTask<Response<CustomFormModel>> WaitForCompletionAsync(CancellationToken cancellationToken = default) =>
            this.DefaultWaitForCompletionAsync(cancellationToken);

        /// <inheritdoc/>
        public override ValueTask<Response<CustomFormModel>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) =>
            this.DefaultWaitForCompletionAsync(pollingInterval, cancellationToken);

        ///
        /// Initializes a new instance of the <see cref="TrainingOperation"/> class for mocking.
        ///
        protected TrainingOperation()
        {
        }

        internal TrainingOperation(string location, ServiceRestClient allOperations)
        {
            _serviceClient = allOperations;

            // TODO: validate this
            // https://github.com/Azure/azure-sdk-for-net/issues/10385
            Id = location.Split('/').Last();
        }

        ///
        /// Initializes a new instance of the <see cref="TrainingOperation"/> class.
        ///
        /// <param name="operationId">The ID of this operation.</param>
        /// <param name="client">The client used to check for completion.</param>
        public TrainingOperation(string operationId, FormTrainingClient client)
        {
            Id = operationId;
            _serviceClient = client.ServiceClient;
        }

        /// <inheritdoc/>
        public override Response UpdateStatus(CancellationToken cancellationToken = default) =>
            UpdateStatusAsync(false, cancellationToken).EnsureCompleted();

        /// <inheritdoc/>
        public override async ValueTask<Response> UpdateStatusAsync(CancellationToken cancellationToken = default) =>
            await UpdateStatusAsync(true, cancellationToken).ConfigureAwait(false);

        ///
        /// Calls the server to get updated status of the long-running operation.
        ///
        /// <param name="async">When <c>true</c>, the method will be executed asynchronously; otherwise, it will execute synchronously.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
        /// <returns>The HTTP response from the service.</returns>
        private async ValueTask<Response> UpdateStatusAsync(bool async, CancellationToken cancellationToken)
        {
            if (!_hasCompleted)
            {
                // Include keys is always set to true -- the service does not have a use case for includeKeys: false.
                Response<Model_internal> update = async
                    ? await _serviceClient.GetCustomModelAsync(new Guid(Id), includeKeys: true, cancellationToken).ConfigureAwait(false)
                    : _serviceClient.GetCustomModel(new Guid(Id), includeKeys: true, cancellationToken);

                if (update.Value.ModelInfo.Status != CustomFormModelStatus.Training)
                {
                    _hasCompleted = true;
                    _value = new CustomFormModel(update.Value);
                }

                _response = update.GetRawResponse();
            }

            return GetRawResponse();
        }
    }
}


text:
import sys
import PyV8

class FileWrapper(object):
    def __init__(self, fname, mode):
        self.f = open(fname, mode)

    def seek(self, seekto=None):
        if seekto is None:
            return self.f.seek()
        return self.f.seek(seekto)

    def close(self):
        return self.f.close()

    def write(self, bytes):
        return self.f.write(bytes)

    def read(self, bytes=None):
        if bytes is None:
            return self.f.read()
        return self.f.read(bytes)

# Create a python class to be used in the context
class Global(PyV8.JSClass):
    def __init__(self, argv=None, path=None):
        PyV8.JSClass.__init__(self)

        if argv is None:
            self.argv = sys.argv
        else:
            self.argv = argv

        if path is None:
            self.path = sys.path
        else:
            self.path = path

    # Funcs to initialize sys
    def pyv8_sys_get_stdin(self):
        return sys.stdin

    def pyv8_sys_get_stdout(self):
        return sys.stdout

    def pyv8_sys_get_stderr(self):
        return sys.stderr

    def pyv8_sys_get_argv(self):
        return self.argv[:]

    def pyv8_sys_get_path(self):
        return self.path[:]

    def pyv8_open(self, fname, mode):
        return FileWrapper(fname, mode)

    def pyv8_import_module(self, parent_name, module_name):
        #print "pyv8_import_module", parent_name, module_name
        exec "import " + module_name
        return locals()[module_name]

    def pyv8_load(self, modules):
        for i in range(len(modules)):
            fname = modules[i]
            try:
                fp = open(fname, 'rb')
                txt = fp.read()# historically js files were ascii or latin1 only, we only generate ascii to be safer
                fp.close()
                """ # Use this if encoding problems in generated javascript files
                for index, line in enumerate(txt.split("\n")):
                    assert isinstance(txt, str)
                    try:
                        line.decode("ascii")
                    except UnicodeError:
                        import sys
                        print >> sys.stderr, "BUGGY LINE", index + 1, "-", repr(line)
                """
                x = self.__context__.eval(txt, fname)
            except Exception, e:
                import traceback
                import sys
                traceback.print_exc(file=sys.stderr)
                raise ImportError("Failed to load %s: '%s'" % (fname, e))


text:
<?xml version="1.0" encoding="UTF-8"?>
<LearningStandards>
  <LearningStandardItem xml:lang="en" RefID="64842E79F9BF4ce5A4D36776B1B27881">
    <RefURI>http://corestandards.org/ELA-Literacy/W/5/9/b/</RefURI>
    <StandardHierarchyLevel>
      <number>6</number>
      <description>Component</description>
    </StandardHierarchyLevel>
    <StatementCodes>
      <StatementCode>CCSS.ELA-Literacy.W.5.9b</StatementCode>
    </StatementCodes>
    <Statements>
      <Statement>Apply <i>grade 5 Reading standards</i> to informational texts (e.g., &ldquo;Explain how an author uses reasons and evidence to support particular points in a text, identifying which reasons and evidence support which point[s]&rdquo;).</Statement>
    </Statements>
    <GradeLevels>
      <GradeLevel>05</GradeLevel>
    </GradeLevels>
    <LearningStandardDocumentRefId>0FAC40650F514a459951A657F942B845</LearningStandardDocumentRefId>
    <RelatedLearningStandardItems>
      <LearningStandardItemRefId RelationshipType="childOf">1F660FD3F00148cdA44B0D5BC3B48218</LearningStandardItemRefId>
    </RelatedLearningStandardItems>
  </LearningStandardItem>
</LearningStandards>


text:
#ifndef TINYSTL_BUFFER_H
#define TINYSTL_BUFFER_H

#include <TinySTL/allocator.h>
#include <TinySTL/new.h>
#include <TinySTL/traits.h>

namespace tinystl {

	template<typename T, typename Alloc = TINYSTL_ALLOCATOR>
	struct buffer {
		T* first;
		T* last;
		T* capacity;
	};

	template<typename T>
	static inline void buffer_destroy_range_traits(T* first, T* last, pod_traits<T, false>) {
		for (; first < last; ++first)
			first->~T();
	}

	template<typename T>
	static inline void buffer_destroy_range_traits(T*, T*, pod_traits<T, true>) {
	}

	template<typename T>
	static inline void buffer_destroy_range(T* first, T* last) {
		buffer_destroy_range_traits(first, last, pod_traits<T>());
	}

	template<typename T>
	static inline void buffer_fill_urange_traits(T* first, T* last, const T& value, pod_traits<T, false>) {
		for (; first < last; ++first)
			new(placeholder(), first) T(value);
	}

	template<typename T>
	static inline void buffer_fill_urange_traits(T* first, T* last, const T& value, pod_traits<T, true>) {
		for (; first < last; ++first)
			*first = value;
	}

	template<typename T>
	static inline void buffer_move_urange_traits(T* dest, T* first, T* last, pod_traits<T, false>) {
		for (T* it = first; it != last; ++it, ++dest)
			move_construct(dest, *it);
		buffer_destroy_range(first, last);
	}

	template<typename T>
	static inline void buffer_move_urange_traits(T* dest, T* first, T* last, pod_traits<T, true>) {
		for (; first != last; ++first, ++dest)
			*dest = *first;
	}

	template<typename T>
	static inline void buffer_bmove_urange_traits(T* dest, T* first, T* last, pod_traits<T, false>) {
		dest += (last - first);
		for (T* it = last; it != first; --it, --dest) {
			move_construct(dest - 1, *(it - 1));
			buffer_destroy_range(it - 1, it);
		}
	}

	template<typename T>
	static inline void buffer_bmove_urange_traits(T* dest, T* first, T* last, pod_traits<T, true>) {
		dest += (last - first);
		for (T* it = last; it != first; --it, --dest)
			*(dest - 1) = *(it - 1);
	}

	template<typename T>
	static inline void buffer_move_urange(T* dest, T* first, T* last) {
		buffer_move_urange_traits(dest, first, last, pod_traits<T>());
	}

	template<typename T>
	static inline void buffer_bmove_urange(T* dest, T* first, T* last) {
		buffer_bmove_urange_traits(dest, first, last, pod_traits<T>());
	}

	template<typename T>
	static inline void buffer_fill_urange(T* first, T* last, const T& value) {
		buffer_fill_urange_traits(first, last, value, pod_traits<T>());
	}

	template<typename T, typename Alloc>
	static inline void buffer_init(buffer<T, Alloc>* b) {
		b->first = b->last = b->capacity = 0;
	}

	template<typename T, typename Alloc>
	static inline void buffer_destroy(buffer<T, Alloc>* b) {
		buffer_destroy_range(b->first, b->last);
		Alloc::static_deallocate(b->first, (size_t)((char*)b->first - (char*)b->last));
	}

	template<typename T, typename Alloc>
	static inline void buffer_reserve(buffer<T, Alloc>* b, size_t capacity) {
		if (b->first + capacity <= b->capacity)
			return;

		typedef T* pointer;
		const size_t size = (size_t)(b->last - b->first);
		pointer newfirst = (pointer)Alloc::static_allocate(sizeof(T) * capacity);
		buffer_move_urange(newfirst, b->first, b->last);
		Alloc::static_deallocate(b->first, sizeof(T) * capacity);

		b->first = newfirst;
		b->last = newfirst + size;
		b->capacity = newfirst + capacity;
	}

	template<typename T, typename Alloc>
	static inline void buffer_resize(buffer<T, Alloc>* b, size_t size, const T& value) {
		buffer_reserve(b, size);

		buffer_fill_urange(b->last, b->first + size, value);
		buffer_destroy_range(b->first + size, b->last);
		b->last = b->first + size;
	}

	template<typename T, typename Alloc>
	static inline void buffer_clear(buffer<T, Alloc>* b) {
		buffer_destroy_range(b->first, b->last);
		b->last = b->first;
	}

	template<typename T, typename Alloc>
	static inline void buffer_insert(buffer<T, Alloc>* b, T* where, const T* first, const T* last) {
		const size_t offset = (size_t)(where - b->first);
		const size_t newsize = (size_t)((b->last - b->first) + (last - first));
		if (b->first + newsize > b->capacity)
			buffer_reserve(b, (newsize * 3) / 2);

		where = b->first + offset;
		const size_t count = (size_t)(last - first);

		if (where != b->last)
			buffer_bmove_urange(where + count, where, b->last);

		for (; first != last; ++first, ++where)
			new(placeholder(), where) T(*first);

		b->last = b->first + newsize;
	}

	template<typename T, typename Alloc>
	static inline T* buffer_erase(buffer<T, Alloc>* b, T* first, T* last) {
		typedef T* pointer;
		const size_t range = (last - first);
		for (pointer it = last, end = b->last, dest = first; it != end; ++it, ++dest)
			move(*dest, *it);

		buffer_destroy_range(b->last - range, b->last);

		b->last -= range;
		return first;
	}

	template<typename T, typename Alloc>
	static inline T* buffer_erase_unordered(buffer<T, Alloc>* b, T* first, T* last) {
		typedef T* pointer;
		const size_t range = (last - first);
		const size_t tail = (b->last - last);
		pointer it = b->last - ((range < tail) ? range : tail);
		for (pointer end = b->last, dest = first; it != end; ++it, ++dest)
			move(*dest, *it);

		buffer_destroy_range(b->last - range, b->last);

		b->last -= range;
		return first;
	}

	template<typename T, typename Alloc>
	static inline void buffer_swap(buffer<T, Alloc>* b, buffer<T, Alloc>* other) {
		typedef T* pointer;
		const pointer tfirst = b->first, tlast = b->last, tcapacity = b->capacity;
		b->first = other->first, b->last = other->last, b->capacity = other->capacity;
		other->first = tfirst, other->last = tlast, other->capacity = tcapacity;
	}
}

#endif


text:
{{ 'font-style' | attr}} specifies the font style for a 3D text.

* `normal`: use a normal font style. This is default.
* `italic`: use an italic font style.

{% craftml %}
<col spacing="5">

  Normal

  Italic

</col>
{% endcraftml %}


text:
#ifndef MALLOC_WRAPPER_H
#define MALLOC_WRAPPER_H

#include <stdlib.h>

#include "nghttp2_mem.h"

/* Global variables to control the behavior of malloc() */

/* If nonzero, malloc failure mode is on */
extern int nghttp2_failmalloc;
/* If nghttp2_failstart <= nghttp2_nmalloc and nghttp2_failmalloc is
   nonzero, malloc() fails. */
extern int nghttp2_failstart;
/* If nonzero, nghttp2_nmalloc is incremented if malloc() succeeds. */
extern int nghttp2_countmalloc;
/* The number of successful invocation of malloc(). This value is only
   incremented if nghttp2_nmalloc is nonzero. */
extern int nghttp2_nmalloc;

/* Returns pointer to nghttp2_mem, which, when dereferenced, contains
   specifically instrumented memory allocators for failmalloc
   tests. */
nghttp2_mem *nghttp2_mem_fm(void);

/* Copies nghttp2_failmalloc and nghttp2_countmalloc to statically
   allocated space and sets 0 to them. This will effectively make
   malloc() work like normal malloc(). This is useful when you want to
   disable malloc() failure mode temporarily. */
void nghttp2_failmalloc_pause(void);

/* Restores the values of nghttp2_failmalloc and nghttp2_countmalloc
   with the values saved by the previous
   nghttp2_failmalloc_pause(). */
void nghttp2_failmalloc_unpause(void);

#endif /* MALLOC_WRAPPER_H */


text:
module RuboCop
  module Cop
    module Lint
      # This cop detects instances of rubocop:disable comments that can be
      # removed without causing any offenses to be reported. It's implemented
      # as a cop in that it inherits from the Cop base class and calls
      # add_offense. The unusual part of its implementation is that it doesn't
      # have any on_* methods or an investigate method. This means that it
      # doesn't take part in the investigation phase when the other cops do
      # their work. Instead, it waits until it's called in a later stage of the
      # execution. The reason it can't be implemented as a normal cop is that
      # it depends on the results of all other cops to do its work.
      #
      #
      # @example
      #   # bad
      #   # rubocop:disable Layout/LineLength
      #   x += 1
      #   # rubocop:enable Layout/LineLength
      #
      #   # good
      #   x += 1
      class RedundantCopDisableDirective < Base
        include RangeHelp
        extend AutoCorrector

        COP_NAME = 'Lint/RedundantCopDisableDirective'

        attr_accessor :offenses_to_check

        def initialize(config = nil, options = nil, offenses = nil)
          @offenses_to_check = offenses
          super(config, options)
        end

        def on_new_investigation
          return unless offenses_to_check

          cop_disabled_line_ranges = processed_source.disabled_line_ranges

          redundant_cops = Hash.new { |h, k| h[k] = Set.new }

          each_redundant_disable(cop_disabled_line_ranges,
                                 offenses_to_check) do |comment, redundant_cop|
            redundant_cops[comment].add(redundant_cop)
          end

          add_offenses(redundant_cops)
          super
        end

        private

        def previous_line_blank?(range)
          processed_source.buffer.source_line(range.line - 1).blank?
        end

        def comment_range_with_surrounding_space(range)
          if previous_line_blank?(range)
            # When the previous line is blank, it should be retained
            range_with_surrounding_space(range: range, side: :right)
          else
            # Eat the entire comment, the preceding space, and the preceding
            # newline if there is one.
            original_begin = range.begin_pos
            range = range_with_surrounding_space(range: range,
                                                 side: :left,
                                                 newlines: true)

            range_with_surrounding_space(range: range,
                                         side: :right,
                                         # Special for a comment that
                                         # begins the file: remove
                                         # the newline at the end.
                                         newlines: original_begin.zero?)
          end
        end

        def directive_range_in_list(range, ranges)
          # Is there any cop between this one and the end of the line, which
          # is NOT being removed?
          if ends_its_line?(ranges.last) && trailing_range?(ranges, range)
            # Eat the comma on the left.
            range = range_with_surrounding_space(range: range, side: :left)
            range = range_with_surrounding_comma(range, :left)
          end

          range = range_with_surrounding_comma(range, :right)
          # Eat following spaces up to EOL, but not the newline itself.
          range_with_surrounding_space(range: range,
                                       side: :right,
                                       newlines: false)
        end

        def each_redundant_disable(cop_disabled_line_ranges, offenses,
                                   &block)
          disabled_ranges = cop_disabled_line_ranges[COP_NAME] || [0..0]

          cop_disabled_line_ranges.each do |cop, line_ranges|
            each_already_disabled(line_ranges,
                                  disabled_ranges) do |comment|
              yield comment, cop
            end

            each_line_range(line_ranges, disabled_ranges, offenses,
                            cop, &block)
          end
        end

        def each_line_range(line_ranges, disabled_ranges, offenses,
                            cop)
          line_ranges.each_with_index do |line_range, ix|
            comment = processed_source.comment_at_line(line_range.begin)
            next if ignore_offense?(disabled_ranges, line_range)

            redundant_cop = find_redundant(comment, offenses, cop, line_range,
                                           line_ranges[ix + 1])
            yield comment, redundant_cop if redundant_cop
          end
        end

        def each_already_disabled(line_ranges, disabled_ranges)
          line_ranges.each_cons(2) do |previous_range, range|
            next if ignore_offense?(disabled_ranges, range)
            next if previous_range.end != range.begin

            # If a cop is disabled in a range that begins on the same line as
            # the end of the previous range, it means that the cop was
            # already disabled by an earlier comment. So it's redundant
            # whether there are offenses or not.
            comment = processed_source.comment_at_line(range.begin)

            # Comments disabling all cops don't count since it's reasonable
            # to disable a few select cops first and then all cops further
            # down in the code.
            yield comment if comment && !all_disabled?(comment)
          end
        end

        # rubocop:todo Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
        def find_redundant(comment, offenses, cop, line_range, next_line_range)
          if all_disabled?(comment)
            # If there's a disable all comment followed by a comment
            # specifically disabling `cop`, we don't report the `all`
            # comment. If the disable all comment is truly redundant, we will
            # detect that when examining the comments of another cop, and we
            # get the full line range for the disable all.
            if (next_line_range.nil? ||
                line_range.last != next_line_range.first) &&
               offenses.none? { |o| line_range.cover?(o.line) }
              'all'
            end
          else
            cop_offenses = offenses.select { |o| o.cop_name == cop }
            cop if cop_offenses.none? { |o| line_range.cover?(o.line) }
          end
        end
        # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity

        def all_disabled?(comment)
          /rubocop\s*:\s*(?:disable|todo)\s+all\b/.match?(comment.text)
        end

        def ignore_offense?(disabled_ranges, line_range)
          disabled_ranges.any? do |range|
            range.cover?(line_range.min) && range.cover?(line_range.max)
          end
        end

        def directive_count(comment)
          match = comment.text.match(CommentConfig::COMMENT_DIRECTIVE_REGEXP)
          _, cops_string = match.captures
          cops_string.split(/,\s*/).size
        end

        def add_offenses(redundant_cops)
          redundant_cops.each do |comment, cops|
            if all_disabled?(comment) ||
               directive_count(comment) == cops.size
              add_offense_for_entire_comment(comment, cops)
            else
              add_offense_for_some_cops(comment, cops)
            end
          end
        end

        def add_offense_for_entire_comment(comment, cops)
          location = comment.loc.expression
          cop_list = cops.sort.map { |c| describe(c) }

          add_offense(
            location,
            message: "Unnecessary disabling of #{cop_list.join(', ')}."
          ) do |corrector|
            range = comment_range_with_surrounding_space(location)
            corrector.remove(range)
          end
        end

        def add_offense_for_some_cops(comment, cops)
          cop_ranges = cops.map { |c| [c, cop_range(comment, c)] }
          cop_ranges.sort_by! { |_, r| r.begin_pos }
          ranges = cop_ranges.map { |_, r| r }

          cop_ranges.each do |cop, range|
            add_offense(
              range,
              message: "Unnecessary disabling of #{describe(cop)}."
            ) do |corrector|
              range = directive_range_in_list(range, ranges)
              corrector.remove(range)
            end
          end
        end

        def cop_range(comment, cop)
          matching_range(comment.loc.expression, cop) ||
            matching_range(comment.loc.expression, Badge.parse(cop).cop_name) ||
            raise("Couldn't find #{cop} in comment: #{comment.text}")
        end

        def matching_range(haystack, needle)
          offset = haystack.source.index(needle)
          return unless offset

          offset += haystack.begin_pos
          Parser::Source::Range.new(haystack.source_buffer, offset,
                                    offset + needle.size)
        end

        def trailing_range?(ranges, range)
          ranges
            .drop_while { |r| !r.equal?(range) }
            .each_cons(2)
            .map { |range1, range2| range1.end.join(range2.begin).source }
            .all? { |intervening| /\A\s*,\s*\Z/.match?(intervening) }
        end

        def describe(cop)
          if cop == 'all'
            'all cops'
          elsif all_cop_names.include?(cop)
            "`#{cop}`"
          else
            similar = NameSimilarity.find_similar_name(cop, all_cop_names)
            if similar
              "`#{cop}` (did you mean `#{similar}`?)"
            else
              "`#{cop}` (unknown cop)"
            end
          end
        end

        def all_cop_names
          @all_cop_names ||= Registry.global.names
        end

        def ends_its_line?(range)
          line = range.source_buffer.source_line(range.last_line)
          (line =~ /\s*\z/) == range.last_column
        end
      end
    end
  end
end
# rubocop:enable Lint/RedundantCopDisableDirective


text:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}

module Openshift.V1.TagEventCondition where

import GHC.Generics
import Data.Text
import Data.Aeson.TH (deriveJSON, defaultOptions, fieldLabelModifier)

-- |
data TagEventCondition = TagEventCondition
    { type_ :: Text -- ^ type of tag event condition, currently only ImportSuccess
    , status :: Text -- ^ status of the condition, one of True, False, Unknown
    , lastTransitionTime :: Maybe Text -- ^ last time the condition transitioned from one status to another
    , reason :: Maybe Text -- ^ machine-readable reason for the last condition transition
    , message :: Maybe Text -- ^ human-readable message indicating details of the last transition
    , generation :: Integer -- ^ the generation of the image stream spec tag this condition represents
    } deriving (Show, Eq, Generic)

$(deriveJSON defaultOptions{fieldLabelModifier = (\n -> if Prelude.last n == '_' then Prelude.take ((Prelude.length n) - 1 ) n else n)} ''TagEventCondition)


text:
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C

import ctypes
_EXTENSION_NAME = 'GL_ARB_draw_instanced'
def _f( function ):
    return _p.createFunction( function,_p.PLATFORM.GL,'GL_ARB_draw_instanced',error_checker=_errors._error_checker)

@_f
@_p.types(None,_cs.GLenum,_cs.GLint,_cs.GLsizei,_cs.GLsizei)
def glDrawArraysInstancedARB(mode,first,count,primcount):pass
@_f
@_p.types(None,_cs.GLenum,_cs.GLsizei,_cs.GLenum,ctypes.c_void_p,_cs.GLsizei)
def glDrawElementsInstancedARB(mode,count,type,indices,primcount):pass


text:
<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=admin.home
[END_COT_EXT]
==================== */

/**
 * Trashcan delete old
 *
 * @package TrashCan
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */

defined('COT_CODE') or die('Wrong URL');

require_once cot_incfile('trashcan', 'plug');
if ($cfg['plugin']['trashcan']['trash_prunedelay'] > 0)
{
	$timeago = $sys['now'] - ($cfg['plugin']['trashcan']['trash_prunedelay'] * 86400);
	$sqltmp = $db->delete($db_trash, "tr_date < $timeago");
	$deleted = $db->affectedRows;
	if ($deleted > 0)
	{
		cot_log($deleted.' old item(s) removed from the trashcan, older than '.$cfg['plugin']['trashcan']['trash_prunedelay'].' days', 'adm');
	}
}


text:
<?php
namespace app\models;

use yii\base\Model;

/**
 * Signup form
 */
class SignupForm extends Model
{
    public $email;
    public $signup_token;
    public $password;

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            ['signup_token', 'trim'],
            ['email', 'trim'],
            ['email', 'required'],
            ['email', 'email'],
            ['email', 'string', 'max' => 255],
            ['email', 'unique', 'targetClass' => '\app\models\User', 'message' => 'You are already an existing user. Proceed to login'],
            ['password', 'required'],
            ['password', 'string', 'min' => 6],
        ];
    }

    /**
     * Signs user up.
     *
     * @return User|null the saved model or null if saving fails
     */
    public function signup()
    {
        if (!$this->validate()) {
            return null;
        }

        $user = new User();
        $user->email = $this->email;
        $user->role = SignupLinks::findByEmail($this->email)->role;
        $user->setPassword($this->password);
        $user->generateAuthKey();

        return $user->save() ? $user : null;
    }
}


text:
export declare enum NetworkStatus {
    loading = 1,
    setVariables = 2,
    fetchMore = 3,
    refetch = 4,
    poll = 6,
    ready = 7,
    error = 8
}
export declare function isNetworkRequestInFlight(networkStatus?: NetworkStatus): boolean;
//# sourceMappingURL=networkStatus.d.ts.map


text:
import argparse
import os
import re
import string
import sys
import textwrap
import datetime

MAX_WIDTH = 80

def read_keywords(keywords_file):
    """
    Parses a Processing keywords.txt file, returning a dictionary of
    all keywords in the file, indexed by keyword type.

    Arguments:
    keywords_file -- full path to a Processing keywords.txt file

    """
    keywords = {}

    for line in open(keywords_file):

        # Skip blank lines and comments
        if re.match('^s*$', line):
            continue
        if re.match('^\s*#', line):
            continue

        match = re.match('^(\w+)\s*\t(\w+)\t?(\w*)', line)
        if match:
            (kw_name, kw_type, kw_loc) = match.groups()
            if kw_type in keywords:
                keywords[kw_type].add(kw_name)
            else:
                keywords[kw_type] = set([kw_name])

    return keywords

def get_syntax_block(keywords, required_types, prefix, excludes=None):
    """
    Returns a string containing part of a vim syntax definition file
    for a given set of keywords. Each line will be wrapped at MAX_WIDTH
    characters.

    Arguments:
    keywords       -- dictionary of keywords by type, as returned by
                      read_keywords.
    required_types -- the type of keywords to include. i.e. the required
                      indexes of the keywords dictionary.
    prefix         -- string to prefix to each line of output.

    Keyword arguments:
    excludes -- tuple of containing keywords to be excluded from the
                output.

    """
    type_words = []
    for type in required_types:
        type_words += keywords[type]

    # Remove non-unique keywords, then sort.
    type_words = list(set(type_words))
    type_words.sort()

    if excludes:
        type_words = [x for x in type_words if x not in excludes]

    block = textwrap.fill(' '.join(type_words), MAX_WIDTH,
                            initial_indent=prefix,
                            subsequent_indent=prefix)

    return block

class SyntaxTemplate(string.Template):
    """
    Sub-class of string.Template to override the default delimiter.
    """
    delimiter = '%%'

if __name__ == "__main__":

    # Parse arguments and options
    parser = argparse.ArgumentParser(description='''
            Generate Vim syntax file for Processing. This program takes the
            keywords.txt file supplied with processing, and uses it to create a
            Vim syntax file.
        ''')

    parser.add_argument('keywords_file', metavar='KEYWORDS_FILE', type=str,
            help='path to Processing keywords.txt')
    parser.add_argument('-t', '--template', dest='template_file',
            default='syntax.tmpl',
            help='path to syntax template file. (default: %(default)s)')

    args = parser.parse_args()

    if not os.path.isfile(args.keywords_file):
        sys.exit("Could not open keywords file %s. Does the file exist?"
                % args.keywords_file)

    if not os.path.isfile(args.template_file):
        sys.exit("Could not open syntax template file %s. Does the file exist?"
                % args.template_file)

    # Get keywords from file
    words = read_keywords(args.keywords_file)
    mapping = {}

    # Build syntax chunks for each type of syntax element, and store in a
    # dictionary for later insertion into the syntax template.
    pfunction_types = ('FUNCTION1', 'FUNCTION2', 'FUNCTION4')
    pfunction_prefix = "syn keyword processingFunction\tcontained "
    mapping['kw_functions'] = get_syntax_block(words,
                                               pfunction_types,
                                               pfunction_prefix)

    pconstant_types = ('LITERAL2',)
    pconstant_prefix = "syn keyword processingConstant\t"
    mapping['kw_constants'] = get_syntax_block(words,
                                               pconstant_types,
                                               pconstant_prefix)

    pvariable_types = ('KEYWORD2', 'KEYWORD4')
    pvariable_prefix = "syn keyword processingVariable\t"
    pvariable_excludes = ('frameRate', 'mousePressed', 'keyPressed')
    mapping['kw_variables'] = get_syntax_block(words,
                                               pvariable_types,
                                               pvariable_prefix,
                                               pvariable_excludes)

    ptype_types = ('KEYWORD5',)
    ptype_prefix = "syn keyword processingType\t"
    mapping['kw_types'] = get_syntax_block(words,
                                               ptype_types,
                                               ptype_prefix)

    # other template info - date and version
    # TODO: fix version - include a command line arg
    mapping['version'] = '1.0.0 custom'
    mapping['date'] = str(datetime.date.today())
    # Populate syntax template with syntax chunks, and print.
    with open(args.template_file) as f:
        template = SyntaxTemplate(f.read())

    print template.substitute(mapping)


text:
package org.apache.metron.writer.hdfs;

import org.apache.storm.task.TopologyContext;
import org.apache.storm.hdfs.bolt.format.FileNameFormat;

import java.util.Map;

public class PathExtensionFileNameFormat implements FileNameFormat {
  FileNameFormat delegate;
  String pathExtension;
  public PathExtensionFileNameFormat(String pathExtension, FileNameFormat delegate) {
    this.delegate = delegate;
    this.pathExtension = pathExtension;
  }

  @Override
  public void prepare(Map map, TopologyContext topologyContext) {
    this.delegate.prepare(map, topologyContext);
  }

  @Override
  public String getName(long rotation, long l1) {
    return delegate.getName(rotation, l1);
  }

  @Override
  public String getPath() {
    return delegate.getPath() + "/" + pathExtension;
  }
}


text:
// Copyright 2013 Square, Inc.
package org.assertj.android.api.widget;

import android.widget.WrapperListAdapter;

/**
 * Assertions for {@link WrapperListAdapter} instances.
 * <p>
 * This class is final. To extend use {@link AbstractWrapperListAdapterAssert}.
 */
public final class WrapperListAdapterAssert
    extends AbstractWrapperListAdapterAssert<WrapperListAdapterAssert, WrapperListAdapter> {
  public WrapperListAdapterAssert(WrapperListAdapter actual) {
    super(actual, WrapperListAdapterAssert.class);
  }
}