/*******************************************************************************
 * Copyright (c) 2000, 2013 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.core;

import java.util.Hashtable;
import java.util.Map;

import org.eclipse.core.resources.*;
import org.eclipse.jdt.core.compiler.*;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.parser.*;
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.core.util.Messages;
import org.eclipse.jdt.internal.core.util.Util;

/**
 * This class is the entry point for source corrections.
 *
 * This class is intended to be instantiated by clients.
 *
 * @since 2.0
 * @noextend This class is not intended to be subclassed by clients.
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public class CorrectionEngine {

	/**
	 * This field is not intended to be used by client.
	 */
	protected int correctionStart;
	/**
	 * This field is not intended to be used by client.
	 */
	protected int correctionEnd;
	/**
	 * This field is not intended to be used by client.
	 */
	protected int prefixLength;
	/**
	 * This field is not intended to be used by client.
	 */
	protected ICompilationUnit compilationUnit;
	/**
	 * This field is not intended to be used by client.
	 */
	protected ICorrectionRequestor correctionRequestor;
	/**
	 * This field is not intended to be used by client.
	 */
	protected static final int CLASSES = 0x00000001;
	/**
	 * This field is not intended to be used by client.
	 */
	protected static final int INTERFACES = 0x00000002;
	/**
	 * This field is not intended to be used by client.
	 */
	protected static final int IMPORT = 0x00000004;
	/**
	 * This field is not intended to be used by client.
	 */
	protected static final int METHOD = 0x00000008;
	/**
	 * This field is not intended to be used by client.
	 */
	protected static final int FIELD = 0x00000010;
	/**
	 * This field is not intended to be used by client.
	 */
	protected static final int LOCAL = 0x00000020;
	/**
	 * This field is not intended to be used by client.
	 */
	protected int filter;

	/**
	 * The CorrectionEngine is responsible for computing problem corrections.
	 *
	 *  @param setting java.util.Map
	 *		set of options used to configure the code correction engine.
	 * 		CURRENTLY THERE IS NO CORRECTION SPECIFIC SETTINGS.
	 */
	public CorrectionEngine(Map setting) {
		// settings ignored for now
	}

	/**
	 * Performs code correction for the given marker,
	 * reporting results to the given correction requestor.
	 *
	 * Correction results are answered through a requestor.
	 *
	 * @param marker
	 * 		the marker which describe the problem to correct.
	 * @param targetUnit
	 * 		replace the compilation unit given by the marker. Ignored if null.
	 * @param positionOffset
	 * 		the offset of position given by the marker.
	 * @param requestor
	 * 		the given correction requestor
	 * @exception IllegalArgumentException if requestor is null
	 * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception
	 * 	when the correction failed is kept for later.
	 * @since 2.0
	 */
	public void computeCorrections(IMarker marker, ICompilationUnit targetUnit, int positionOffset, ICorrectionRequestor requestor) throws JavaModelException {

		IJavaElement element = targetUnit == null ? JavaCore.create(marker.getResource()) : targetUnit;

		if(!(element instanceof ICompilationUnit))
			return;

		ICompilationUnit unit = (ICompilationUnit) element;

		int id = marker.getAttribute(IJavaModelMarker.ID, -1);
		String[] args = Util.getProblemArgumentsFromMarker(marker.getAttribute(IJavaModelMarker.ARGUMENTS, "")); //$NON-NLS-1$
		int start = marker.getAttribute(IMarker.CHAR_START, -1);
		int end = marker.getAttribute(IMarker.CHAR_END, -1);

		computeCorrections(unit, id, start + positionOffset, end + positionOffset, args, requestor);
	}

	/**
	 * Performs code correction for the given IProblem,
	 * reporting results to the given correction requestor.
	 *
	 * Correction results are answered through a requestor.
	 *
	 * @param problem
	 * 		the problem which describe the problem to correct.
	 * @param targetUnit
	 * 		denote the compilation unit in which correction occurs. Cannot be null.
	 * @param requestor
	 * 		the given correction requestor
	 * @exception IllegalArgumentException if targetUnit or requestor is null
	 * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception
	 * 	when the correction failed is kept for later.
	 * @since 2.0
	 */
	public void computeCorrections(IProblem problem, ICompilationUnit targetUnit, ICorrectionRequestor requestor) throws JavaModelException {
		if (requestor == null) {
			throw new IllegalArgumentException(Messages.correction_nullUnit);
		}
		this.computeCorrections(
			targetUnit, problem.getID(),
			problem.getSourceStart(),
			problem.getSourceEnd(),
			problem.getArguments(),
			requestor);
	}

	/*
	 * Ask the engine to compute a correction for the specified problem
	 * of the given compilation unit.
	 * Correction results are answered through a requestor.
	 *
	 *  @param unit org.eclipse.jdt.internal.core.ICompilationUnit
	 *      the compilation unit.
	 *
	 * 	@param id int
	 * 		the id of the problem.
	 *
	 * 	@param start int
	 * 		a position in the source where the error begin.
	 *
	 *  @param end int
	 *      a position in the source where the error finish.
	 *
	 * 	@param arguments String[]
	 * 		arguments of the problem.
	 *
	 * @exception IllegalArgumentException if requestor is null
	 * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception
	 * 	when the correction failed is kept for later.
	 * @since 2.0
	 */
	private void computeCorrections(ICompilationUnit unit, int id, int start, int end, String[] arguments, ICorrectionRequestor requestor) {

		if(id == -1 || arguments == null || start == -1 || end == -1)
			return;
		if (requestor == null) {
			throw new IllegalArgumentException(Messages.correction_nullRequestor);
		}

		this.correctionRequestor = requestor;
		this.correctionStart = start;
		this.correctionEnd = end;
		this.compilationUnit = unit;

		String argument = null;
		try {
			switch (id) {
				// Type correction
				case IProblem.ImportNotFound :
					this.filter = IMPORT;
					argument = arguments[0];
					break;
				case IProblem.UndefinedType :
					this.filter = CLASSES | INTERFACES;
					argument = arguments[0];
					break;

				// Method correction
				case IProblem.UndefinedMethod :
					this.filter = METHOD;
					argument = arguments[1];
					break;

				// Field and local variable correction
				case IProblem.UndefinedField :
					this.filter = FIELD;
					argument = arguments[0];
					break;
				case IProblem.UndefinedName :
				case IProblem.UnresolvedVariable :
					this.filter = FIELD | LOCAL;
					argument = arguments[0];
					break;
			}
		} catch (ArrayIndexOutOfBoundsException e) {
			return;
		}
		if(argument != null) {
			correct(argument.toCharArray());
		}
	}

	private void correct(char[] argument) {
		try {
			String source = this.compilationUnit.getSource();
			Map<String,String> currentProjectOptions = this.compilationUnit.getJavaProject().getOptions(true);
			long sourceLevel = CompilerOptions.versionToJdkLevel(currentProjectOptions.get(JavaCore.COMPILER_SOURCE));
			long complianceLevel = CompilerOptions.versionToJdkLevel(currentProjectOptions.get(JavaCore.COMPILER_COMPLIANCE));

			Scanner scanner =
				new Scanner(
					false /*comment*/,
					false /*whitespace*/,
					false /*nls*/,
					sourceLevel,
					complianceLevel,
					null/*taskTag*/,
					null/*taskPriorities*/,
					true /*taskCaseSensitive*/,
					JavaCore.ENABLED.equals(currentProjectOptions.get(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES)));
			scanner.setSource(source.toCharArray());

			scanner.resetTo(this.correctionStart, this.correctionEnd);
			int token = 0;
			char[] argumentSource = CharOperation.NO_CHAR;

			// search last segment position
			while(true) {
				token = scanner.getNextToken();
				if (token == TerminalTokens.TokenNameEOF) return;

				char[] tokenSource = scanner.getCurrentTokenSource();

				argumentSource = CharOperation.concat(argumentSource, tokenSource);
				if(!CharOperation.prefixEquals(argumentSource, argument))
					return;

				if(CharOperation.equals(argument, argumentSource)) {
					this.correctionStart = scanner.startPosition;
					this.correctionEnd = scanner.currentPosition;
					this.prefixLength = CharOperation.lastIndexOf('.', argument) + 1;
					break;
				}

			}

			// search completion position
			int completionPosition = this.correctionStart;
			scanner.resetTo(completionPosition, this.correctionEnd);
			int position = completionPosition;

			for (int i = 0; i < 4; i++) {
				if(scanner.getNextCharAsJavaIdentifierPart()) {
					completionPosition = position;
					position = scanner.currentPosition;
				} else {
					break;
				}
			}
			Hashtable oldOptions = JavaCore.getOptions();
			try {
				Hashtable options = new Hashtable(oldOptions);
				options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.DISABLED);
				options.put(JavaCore.CODEASSIST_SUBWORD_MATCH, JavaCore.DISABLED);
				JavaCore.setOptions(options);

				this.compilationUnit.codeComplete(
					completionPosition,
					this.completionRequestor
				);
			} finally {
				JavaCore.setOptions(oldOptions);
			}
		} catch (JavaModelException | InvalidInputException e) {
			return;
		}
	}

	/**
	 * This field is not intended to be used by client.
	 */
	protected CompletionRequestor completionRequestor = new CompletionRequestor() {
		@Override
		public void accept(CompletionProposal proposal) {
			switch (proposal.getKind()) {
				case CompletionProposal.TYPE_REF:
					int flags = proposal.getFlags();
					if (!(Flags.isEnum(flags) || Flags.isAnnotation(flags))) {
						if((CorrectionEngine.this.filter & (CLASSES | INTERFACES)) != 0) {
							char[] completionName = proposal.getCompletion();
							CorrectionEngine.this.correctionRequestor.acceptClass(
								proposal.getDeclarationSignature(),
								Signature.getSignatureSimpleName(proposal.getSignature()),
								CharOperation.subarray(completionName, CorrectionEngine.this.prefixLength, completionName.length),
								proposal.getFlags(),
								CorrectionEngine.this.correctionStart,
								CorrectionEngine.this.correctionEnd);
						} else if((CorrectionEngine.this.filter & IMPORT) != 0) {
							char[] packageName = proposal.getDeclarationSignature();
							char[] className = Signature.getSignatureSimpleName(proposal.getSignature());
							char[] fullName = CharOperation.concat(packageName, className, '.');
							CorrectionEngine.this.correctionRequestor.acceptClass(
								packageName,
								className,
								CharOperation.subarray(fullName, CorrectionEngine.this.prefixLength, fullName.length),
								proposal.getFlags(),
								CorrectionEngine.this.correctionStart,
								CorrectionEngine.this.correctionEnd);
						}
					}
					break;
				case CompletionProposal.FIELD_REF:
					if((CorrectionEngine.this.filter & FIELD) != 0) {
						char[] declaringSignature = proposal.getDeclarationSignature();
						char[] signature = proposal.getSignature();
						CorrectionEngine.this.correctionRequestor.acceptField(
							Signature.getSignatureQualifier(declaringSignature),
							Signature.getSignatureSimpleName(declaringSignature),
							proposal.getName(),
							Signature.getSignatureQualifier(signature),
							Signature.getSignatureSimpleName(signature),
							proposal.getName(),
							proposal.getFlags(),
							CorrectionEngine.this.correctionStart,
							CorrectionEngine.this.correctionEnd);
					}
					break;
				case CompletionProposal.LOCAL_VARIABLE_REF:
					if((CorrectionEngine.this.filter & LOCAL) != 0) {
						char[] signature = proposal.getSignature();
						CorrectionEngine.this.correctionRequestor.acceptLocalVariable(
							proposal.getName(),
							Signature.getSignatureQualifier(signature),
							Signature.getSignatureSimpleName(signature),
							proposal.getFlags(),
							CorrectionEngine.this.correctionStart,
							CorrectionEngine.this.correctionEnd);
					}
					break;
				case CompletionProposal.METHOD_REF:
					if((CorrectionEngine.this.filter & METHOD) != 0) {
						char[] declaringSignature = proposal.getDeclarationSignature();
						char[] signature = proposal.getSignature();
						char[][] parameterTypeSignatures = Signature.getParameterTypes(signature);
						int length = parameterTypeSignatures.length;
						char[][] parameterPackageNames = new char[length][];
						char[][] parameterTypeNames = new char[length][];
						for (int i = 0; i < length; i++) {
							parameterPackageNames[i] = Signature.getSignatureQualifier(parameterTypeSignatures[i]);
							parameterTypeNames[i] = Signature.getSignatureSimpleName(parameterTypeSignatures[i]);
						}
						char[] returnTypeSignature = Signature.getReturnType(signature);
						CorrectionEngine.this.correctionRequestor.acceptMethod(
							Signature.getSignatureQualifier(declaringSignature),
							Signature.getSignatureSimpleName(declaringSignature),
							proposal.getName(),
							parameterPackageNames,
							parameterTypeNames,
							proposal.findParameterNames(null),
							Signature.getSignatureQualifier(returnTypeSignature),
							Signature.getSignatureSimpleName(returnTypeSignature),
							proposal.getName(),
							proposal.getFlags(),
							CorrectionEngine.this.correctionStart,
							CorrectionEngine.this.correctionEnd);
					}
					break;
				case CompletionProposal.PACKAGE_REF:
					if((CorrectionEngine.this.filter & (CLASSES | INTERFACES | IMPORT)) != 0) {
						char[] packageName = proposal.getDeclarationSignature();
						CorrectionEngine.this.correctionRequestor.acceptPackage(
							packageName,
							CharOperation.subarray(packageName, CorrectionEngine.this.prefixLength, packageName.length),
							CorrectionEngine.this.correctionStart,
							CorrectionEngine.this.correctionEnd);
					}
					break;
			}
		}
	};

	/**
	 * Return an array of strings which contains one entry per warning token
	 * accepted by the @SuppressWarnings annotation. This array is
	 * neither null nor empty, it contains at least the String all.
	 * It should not be modified by the caller (please take a copy if modifications
	 * are needed).

	 * Note: The tokens returned are not necessarily standardized across Java
	 * compilers. If you were to use one of these tokens in a @SuppressWarnings
	 * annotation in the Java source code, the effects (if any) may vary from
	 * compiler to compiler.
	 *
	 * @return an array of strings which contains one entry per warning token
	 * 			accepted by the @SuppressWarnings annotation.
	 * @since 3.2
	 */
	public static String[] getAllWarningTokens() {
		return CompilerOptions.warningTokens;
	}

	/**
	 * Helper method for decoding problem marker attributes. Returns an array of String arguments
	 * extracted from the problem marker "arguments" attribute, or null if the marker
	 * "arguments" attribute is missing or ill-formed.
	 *
	 * @param problemMarker
	 * 		the problem marker to decode arguments from.
	 * @return an array of String arguments, or null if unable to extract arguments
	 * @since 2.1
	 */
	public static String[] getProblemArguments(IMarker problemMarker){
		String argumentsString = problemMarker.getAttribute(IJavaModelMarker.ARGUMENTS, null);
		return Util.getProblemArgumentsFromMarker(argumentsString);
	}

	/**
	 * Returns a token which can be used to suppress a given warning using
	 * @SuppressWarnings annotation, for a given problem ID
	 * ({@link IProblem }). If a particular problem is not suppressable,
	 * null will be returned.
	 *

	 * Note: @SuppressWarnings can only suppress warnings,
	 * which means that if some problems got promoted to ERROR using custom compiler
	 * settings ({@link IJavaProject#setOption(String, String)}), the
	 * @SuppressWarnings annotation will be ineffective.
	 *

	 *

	 * Note: @SuppressWarnings can be argumented with
	 * "all" so as to suppress all possible warnings at once.
	 *

	 *

	 * Note: The tokens returned are not necessarily standardized across Java
	 * compilers. If you were to use one of these tokens in an @SuppressWarnings
	 * annotation in the Java source code, the effects (if any) may vary from
	 * compiler to compiler.
	 *

	 * @param problemID
	 *         the ID of a given warning to suppress
	 * @return a String which can be used in @SuppressWarnings annotation,
	 * or null if unable to suppress this warning.
	 * @since 3.1
	 */
	public static String getWarningToken(int problemID){
		int irritant = ProblemReporter.getIrritant(problemID);
		if (irritant != 0) {
			return CompilerOptions.warningTokenFromIrritant(irritant);
		}
		return null;
	}
}

{'repo_name': 'eclipse/eclipse.jdt.core', 'stars': '179', 'repo_language': 'Java', 'file_name': 'GeneratedFileManager.java', 'mime_type': 'text/x-java', 'hash': 1766010265367504416, 'source_dataset': 'data'}


/* Implementation of the SUM intrinsic
   Copyright (C) 2002-2019 Free Software Foundation, Inc.
   Contributed by Paul Brook <paul@nowt.org>

This file is part of the GNU Fortran 95 runtime library (libgfortran).

Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.

Libgfortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.

You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
<http://www.gnu.org/licenses/>.  */

#include "libgfortran.h"

#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4)

extern void sum_r4 (gfc_array_r4 * const restrict,
	gfc_array_r4 * const restrict, const index_type * const restrict);
export_proto(sum_r4);

void
sum_r4 (gfc_array_r4 * const restrict retarray,
	gfc_array_r4 * const restrict array,
	const index_type * const restrict pdim)
{
  index_type count[GFC_MAX_DIMENSIONS];
  index_type extent[GFC_MAX_DIMENSIONS];
  index_type sstride[GFC_MAX_DIMENSIONS];
  index_type dstride[GFC_MAX_DIMENSIONS];
  const GFC_REAL_4 * restrict base;
  GFC_REAL_4 * restrict dest;
  index_type rank;
  index_type n;
  index_type len;
  index_type delta;
  index_type dim;
  int continue_loop;

  /* Make dim zero based to avoid confusion.  */
  rank = GFC_DESCRIPTOR_RANK (array) - 1;
  dim = (*pdim) - 1;

  if (unlikely (dim < 0 || dim > rank))
    {
      runtime_error ("Dim argument incorrect in SUM intrinsic: "
 		     "is %ld, should be between 1 and %ld",
		     (long int) dim + 1, (long int) rank + 1);
    }

  len = GFC_DESCRIPTOR_EXTENT(array,dim);
  if (len < 0)
    len = 0;
  delta = GFC_DESCRIPTOR_STRIDE(array,dim);

  for (n = 0; n < dim; n++)
    {
      sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
      extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);

      if (extent[n] < 0)
	extent[n] = 0;
    }
  for (n = dim; n < rank; n++)
    {
      sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1);
      extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1);

      if (extent[n] < 0)
	extent[n] = 0;
    }

  if (retarray->base_addr == NULL)
    {
      size_t alloc_size, str;

      for (n = 0; n < rank; n++)
	{
	  if (n == 0)
	    str = 1;
	  else
	    str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];

	  GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);

	}

      retarray->offset = 0;
      retarray->dtype.rank = rank;

      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];

      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
      if (alloc_size == 0)
	{
	  /* Make sure we have a zero-sized array.  */
	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
	  return;

	}
    }
  else
    {
      if (rank != GFC_DESCRIPTOR_RANK (retarray))
	runtime_error ("rank of return array incorrect in"
		       " SUM intrinsic: is %ld, should be %ld",
		       (long int) (GFC_DESCRIPTOR_RANK (retarray)),
		       (long int) rank);

      if (unlikely (compile_options.bounds_check))
	bounds_ifunction_return ((array_t *) retarray, extent,
				 "return value", "SUM");
    }

  for (n = 0; n < rank; n++)
    {
      count[n] = 0;
      dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
      if (extent[n] <= 0)
	return;
    }

  base = array->base_addr;
  dest = retarray->base_addr;

  continue_loop = 1;
  while (continue_loop)
    {
      const GFC_REAL_4 * restrict src;
      GFC_REAL_4 result;
      src = base;
      {

  result = 0;
	if (len <= 0)
	  *dest = 0;
	else
	  {
#if ! defined HAVE_BACK_ARG
	    for (n = 0; n < len; n++, src += delta)
	      {
#endif

  result += *src;
	      }

	    *dest = result;
	  }
      }
      /* Advance to the next element.  */
      count[0]++;
      base += sstride[0];
      dest += dstride[0];
      n = 0;
      while (count[n] == extent[n])
	{
	  /* When we get to the end of a dimension, reset it and increment
	     the next dimension.  */
	  count[n] = 0;
	  /* We could precalculate these products, but this is a less
	     frequently used path so probably not worth it.  */
	  base -= sstride[n] * extent[n];
	  dest -= dstride[n] * extent[n];
	  n++;
	  if (n >= rank)
	    {
	      /* Break out of the loop.  */
	      continue_loop = 0;
	      break;
	    }
	  else
	    {
	      count[n]++;
	      base += sstride[n];
	      dest += dstride[n];
	    }
	}
    }
}

extern void msum_r4 (gfc_array_r4 * const restrict,
	gfc_array_r4 * const restrict, const index_type * const restrict,
	gfc_array_l1 * const restrict);
export_proto(msum_r4);

void
msum_r4 (gfc_array_r4 * const restrict retarray,
	gfc_array_r4 * const restrict array,
	const index_type * const restrict pdim,
	gfc_array_l1 * const restrict mask)
{
  index_type count[GFC_MAX_DIMENSIONS];
  index_type extent[GFC_MAX_DIMENSIONS];
  index_type sstride[GFC_MAX_DIMENSIONS];
  index_type dstride[GFC_MAX_DIMENSIONS];
  index_type mstride[GFC_MAX_DIMENSIONS];
  GFC_REAL_4 * restrict dest;
  const GFC_REAL_4 * restrict base;
  const GFC_LOGICAL_1 * restrict mbase;
  index_type rank;
  index_type dim;
  index_type n;
  index_type len;
  index_type delta;
  index_type mdelta;
  int mask_kind;

  if (mask == NULL)
    {
#ifdef HAVE_BACK_ARG
      sum_r4 (retarray, array, pdim, back);
#else
      sum_r4 (retarray, array, pdim);
#endif
      return;
    }

  dim = (*pdim) - 1;
  rank = GFC_DESCRIPTOR_RANK (array) - 1;

  if (unlikely (dim < 0 || dim > rank))
    {
      runtime_error ("Dim argument incorrect in SUM intrinsic: "
 		     "is %ld, should be between 1 and %ld",
		     (long int) dim + 1, (long int) rank + 1);
    }

  len = GFC_DESCRIPTOR_EXTENT(array,dim);
  if (len <= 0)
    return;

  mbase = mask->base_addr;

  mask_kind = GFC_DESCRIPTOR_SIZE (mask);

  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
#ifdef HAVE_GFC_LOGICAL_16
      || mask_kind == 16
#endif
      )
    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
  else
    runtime_error ("Funny sized logical array");

  delta = GFC_DESCRIPTOR_STRIDE(array,dim);
  mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim);

  for (n = 0; n < dim; n++)
    {
      sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
      mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
      extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);

      if (extent[n] < 0)
	extent[n] = 0;

    }
  for (n = dim; n < rank; n++)
    {
      sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1);
      mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1);
      extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1);

      if (extent[n] < 0)
	extent[n] = 0;
    }

  if (retarray->base_addr == NULL)
    {
      size_t alloc_size, str;

      for (n = 0; n < rank; n++)
	{
	  if (n == 0)
	    str = 1;
	  else
	    str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];

	  GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);

	}

      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];

      retarray->offset = 0;
      retarray->dtype.rank = rank;

      if (alloc_size == 0)
	{
	  /* Make sure we have a zero-sized array.  */
	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
	  return;
	}
      else
	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));

    }
  else
    {
      if (rank != GFC_DESCRIPTOR_RANK (retarray))
	runtime_error ("rank of return array incorrect in SUM intrinsic");

      if (unlikely (compile_options.bounds_check))
	{
	  bounds_ifunction_return ((array_t *) retarray, extent,
				   "return value", "SUM");
	  bounds_equal_extents ((array_t *) mask, (array_t *) array,
	  			"MASK argument", "SUM");
	}
    }

  for (n = 0; n < rank; n++)
    {
      count[n] = 0;
      dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
      if (extent[n] <= 0)
	return;
    }

  dest = retarray->base_addr;
  base = array->base_addr;

  while (base)
    {
      const GFC_REAL_4 * restrict src;
      const GFC_LOGICAL_1 * restrict msrc;
      GFC_REAL_4 result;
      src = base;
      msrc = mbase;
      {

  result = 0;
	for (n = 0; n < len; n++, src += delta, msrc += mdelta)
	  {

  if (*msrc)
    result += *src;
	  }
	*dest = result;
      }
      /* Advance to the next element.  */
      count[0]++;
      base += sstride[0];
      mbase += mstride[0];
      dest += dstride[0];
      n = 0;
      while (count[n] == extent[n])
	{
	  /* When we get to the end of a dimension, reset it and increment
	     the next dimension.  */
	  count[n] = 0;
	  /* We could precalculate these products, but this is a less
	     frequently used path so probably not worth it.  */
	  base -= sstride[n] * extent[n];
	  mbase -= mstride[n] * extent[n];
	  dest -= dstride[n] * extent[n];
	  n++;
	  if (n >= rank)
	    {
	      /* Break out of the loop.  */
	      base = NULL;
	      break;
	    }
	  else
	    {
	      count[n]++;
	      base += sstride[n];
	      mbase += mstride[n];
	      dest += dstride[n];
	    }
	}
    }
}

extern void ssum_r4 (gfc_array_r4 * const restrict,
	gfc_array_r4 * const restrict, const index_type * const restrict,
	GFC_LOGICAL_4 *);
export_proto(ssum_r4);

void
ssum_r4 (gfc_array_r4 * const restrict retarray,
	gfc_array_r4 * const restrict array,
	const index_type * const restrict pdim,
	GFC_LOGICAL_4 * mask)
{
  index_type count[GFC_MAX_DIMENSIONS];
  index_type extent[GFC_MAX_DIMENSIONS];
  index_type dstride[GFC_MAX_DIMENSIONS];
  GFC_REAL_4 * restrict dest;
  index_type rank;
  index_type n;
  index_type dim;

  if (mask == NULL || *mask)
    {
#ifdef HAVE_BACK_ARG
      sum_r4 (retarray, array, pdim, back);
#else
      sum_r4 (retarray, array, pdim);
#endif
      return;
    }
  /* Make dim zero based to avoid confusion.  */
  dim = (*pdim) - 1;
  rank = GFC_DESCRIPTOR_RANK (array) - 1;

  if (unlikely (dim < 0 || dim > rank))
    {
      runtime_error ("Dim argument incorrect in SUM intrinsic: "
 		     "is %ld, should be between 1 and %ld",
		     (long int) dim + 1, (long int) rank + 1);
    }

  for (n = 0; n < dim; n++)
    {
      extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);

      if (extent[n] <= 0)
	extent[n] = 0;
    }

  for (n = dim; n < rank; n++)
    {
      extent[n] =
	GFC_DESCRIPTOR_EXTENT(array,n + 1);

      if (extent[n] <= 0)
	extent[n] = 0;
    }

  if (retarray->base_addr == NULL)
    {
      size_t alloc_size, str;

      for (n = 0; n < rank; n++)
	{
	  if (n == 0)
	    str = 1;
	  else
	    str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];

	  GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);

	}

      retarray->offset = 0;
      retarray->dtype.rank = rank;

      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];

      if (alloc_size == 0)
	{
	  /* Make sure we have a zero-sized array.  */
	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
	  return;
	}
      else
	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
    }
  else
    {
      if (rank != GFC_DESCRIPTOR_RANK (retarray))
	runtime_error ("rank of return array incorrect in"
		       " SUM intrinsic: is %ld, should be %ld",
		       (long int) (GFC_DESCRIPTOR_RANK (retarray)),
		       (long int) rank);

      if (unlikely (compile_options.bounds_check))
	{
	  for (n=0; n < rank; n++)
	    {
	      index_type ret_extent;

	      ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n);
	      if (extent[n] != ret_extent)
		runtime_error ("Incorrect extent in return value of"
			       " SUM intrinsic in dimension %ld:"
			       " is %ld, should be %ld", (long int) n + 1,
			       (long int) ret_extent, (long int) extent[n]);
	    }
	}
    }

  for (n = 0; n < rank; n++)
    {
      count[n] = 0;
      dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
    }

  dest = retarray->base_addr;

  while(1)
    {
      *dest = 0;
      count[0]++;
      dest += dstride[0];
      n = 0;
      while (count[n] == extent[n])
	{
	  /* When we get to the end of a dimension, reset it and increment
	     the next dimension.  */
	  count[n] = 0;
	  /* We could precalculate these products, but this is a less
	     frequently used path so probably not worth it.  */
	  dest -= dstride[n] * extent[n];
	  n++;
	  if (n >= rank)
	    return;
	  else
	    {
	      count[n]++;
	      dest += dstride[n];
	    }
      	}
    }
}

#endif

{'repo_name': 'autc04/Retro68', 'stars': '257', 'repo_language': 'None', 'file_name': 'helpdoc.go', 'mime_type': 'text/plain', 'hash': -8285981914507119087, 'source_dataset': 'data'}


StartChar: youtube
Encoding: 63 63 16
Width: 800
VWidth: 0
HStem: 224 352<186.322 613.678>
VStem: 150 198<337.084 475.411>
LayerCount: 4
Back
SplineSet
348.380859375 335.14453125 m 5
 483.459960938 405.142578125 l 5
 348.358398438 475.630859375 l 5
 348.380859375 335.14453125 l 5
645.006835938 499.96875 m 6
 645.006835938 499.96875 650 459.506835938 650 419.044921875 c 6
 650 381.112304688 l 6
 650 340.651367188 645.006835938 300.190429688 645.006835938 300.190429688 c 5
 645.006835938 300.190429688 640.122070312 265.734375 625.12890625 250.560546875 c 4
 606.116210938 230.646484375 584.803710938 230.547851562 575.03125 229.381835938 c 4
 505.063476562 224.32421875 400 224.166015625 400 224.166015625 c 5
 400 224.166015625 270.001953125 225.352539062 230.001953125 229.189453125 c 4
 218.874023438 231.276367188 193.889648438 230.646484375 174.870117188 250.560546875 c 4
 159.87890625 265.734375 155 300.190429688 155 300.190429688 c 5
 155 300.190429688 150 340.651367188 150 381.112304688 c 6
 150 419.044921875 l 6
 150 459.506835938 155 499.96875 155 499.96875 c 5
 155 499.96875 159.87890625 534.423828125 174.870117188 549.596679688 c 4
 193.889648438 569.51171875 215.194335938 569.611328125 224.967773438 570.776367188 c 4
 294.938476562 575.833984375 399.890625 575.833984375 399.890625 575.833984375 c 5
 400.108398438 575.833984375 l 5
 400.108398438 575.833984375 505.063476562 575.833984375 575.03125 570.776367188 c 4
 584.803710938 569.611328125 606.116210938 569.51171875 625.12890625 549.596679688 c 4
 640.122070312 534.423828125 645.006835938 499.96875 645.006835938 499.96875 c 6
EndSplineSet
Fore
SplineSet
400 576 m 0
 544 576 601 574 624 551 c 0
 641 534 650 498.875 650 400 c 0
 650 301.125 641 266 624 249 c 0
 601 226 544 224 400 224 c 0
 256 224 199 226 176 249 c 0
 159 266 150 301.125 150 400 c 0
 150 498.875 159 534 176 551 c 0
 199 574 256 576 400 576 c 0
348 476 m 1
 348 335 l 1
 483 405 l 1
 348 476 l 1
EndSplineSet
Layer: 2
Layer: 3
EndChar

{'repo_name': 'larsenwork/web.svg.min', 'stars': '372', 'repo_language': 'HTML', 'file_name': 'codepen.html', 'mime_type': 'text/html', 'hash': -6915072242775467198, 'source_dataset': 'data'}


This operation cannot be performed.

无法执行此操作。

この操作は行なえません。

Dieser Vorgang kann nicht ausgeführt werden.

이 작업을 수행할 수 없습니다.

No puede realizarse esta operación.

{'repo_name': 'Implem/Implem.Pleasanter', 'stars': '393', 'repo_language': 'C#', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': 5248042257826216651, 'source_dataset': 'data'}


package ru_MD

import (
	"testing"
	"time"

	"github.com/go-playground/locales"
	"github.com/go-playground/locales/currency"
)

func TestLocale(t *testing.T) {

	trans := New()
	expected := "ru_MD"

	if trans.Locale() != expected {
		t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
	}
}

func TestPluralsRange(t *testing.T) {

	trans := New()

	tests := []struct {
		expected locales.PluralRule
	}{
	// {
	// 	expected: locales.PluralRuleOther,
	// },
	}

	rules := trans.PluralsRange()
	// expected := 1
	// if len(rules) != expected {
	// 	t.Errorf("Expected '%d' Got '%d'", expected, len(rules))
	// }

	for _, tt := range tests {

		r := locales.PluralRuleUnknown

		for i := 0; i < len(rules); i++ {
			if rules[i] == tt.expected {
				r = rules[i]
				break
			}
		}
		if r == locales.PluralRuleUnknown {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, r)
		}
	}
}

func TestPluralsOrdinal(t *testing.T) {

	trans := New()

	tests := []struct {
		expected locales.PluralRule
	}{
	// {
	// 	expected: locales.PluralRuleOne,
	// },
	// {
	// 	expected: locales.PluralRuleTwo,
	// },
	// {
	// 	expected: locales.PluralRuleFew,
	// },
	// {
	// 	expected: locales.PluralRuleOther,
	// },
	}

	rules := trans.PluralsOrdinal()
	// expected := 4
	// if len(rules) != expected {
	// 	t.Errorf("Expected '%d' Got '%d'", expected, len(rules))
	// }

	for _, tt := range tests {

		r := locales.PluralRuleUnknown

		for i := 0; i < len(rules); i++ {
			if rules[i] == tt.expected {
				r = rules[i]
				break
			}
		}
		if r == locales.PluralRuleUnknown {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, r)
		}
	}
}

func TestPluralsCardinal(t *testing.T) {

	trans := New()

	tests := []struct {
		expected locales.PluralRule
	}{
	// {
	// 	expected: locales.PluralRuleOne,
	// },
	// {
	// 	expected: locales.PluralRuleOther,
	// },
	}

	rules := trans.PluralsCardinal()
	// expected := 2
	// if len(rules) != expected {
	// 	t.Errorf("Expected '%d' Got '%d'", expected, len(rules))
	// }

	for _, tt := range tests {

		r := locales.PluralRuleUnknown

		for i := 0; i < len(rules); i++ {
			if rules[i] == tt.expected {
				r = rules[i]
				break
			}
		}
		if r == locales.PluralRuleUnknown {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, r)
		}
	}
}

func TestRangePlurals(t *testing.T) {

	trans := New()

	tests := []struct {
		num1     float64
		v1       uint64
		num2     float64
		v2       uint64
		expected locales.PluralRule
	}{
	// {
	// 	num1:     1,
	// 	v1:       1,
	// 	num2:     2,
	// 	v2:       2,
	// 	expected: locales.PluralRuleOther,
	// },
	}

	for _, tt := range tests {
		rule := trans.RangePluralRule(tt.num1, tt.v1, tt.num2, tt.v2)
		if rule != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, rule)
		}
	}
}

func TestOrdinalPlurals(t *testing.T) {

	trans := New()

	tests := []struct {
		num      float64
		v        uint64
		expected locales.PluralRule
	}{
	// {
	// 	num:      1,
	// 	v:        0,
	// 	expected: locales.PluralRuleOne,
	// },
	// {
	// 	num:      2,
	// 	v:        0,
	// 	expected: locales.PluralRuleTwo,
	// },
	// {
	// 	num:      3,
	// 	v:        0,
	// 	expected: locales.PluralRuleFew,
	// },
	// {
	// 	num:      4,
	// 	v:        0,
	// 	expected: locales.PluralRuleOther,
	// },
	}

	for _, tt := range tests {
		rule := trans.OrdinalPluralRule(tt.num, tt.v)
		if rule != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, rule)
		}
	}
}

func TestCardinalPlurals(t *testing.T) {

	trans := New()

	tests := []struct {
		num      float64
		v        uint64
		expected locales.PluralRule
	}{
	// {
	// 	num:      1,
	// 	v:        0,
	// 	expected: locales.PluralRuleOne,
	// },
	// {
	// 	num:      4,
	// 	v:        0,
	// 	expected: locales.PluralRuleOther,
	// },
	}

	for _, tt := range tests {
		rule := trans.CardinalPluralRule(tt.num, tt.v)
		if rule != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, rule)
		}
	}
}

func TestDaysAbbreviated(t *testing.T) {

	trans := New()
	days := trans.WeekdaysAbbreviated()

	for i, day := range days {
		s := trans.WeekdayAbbreviated(time.Weekday(i))
		if s != day {
			t.Errorf("Expected '%s' Got '%s'", day, s)
		}
	}

	tests := []struct {
		idx      int
		expected string
	}{
	// {
	// 	idx:      0,
	// 	expected: "Sun",
	// },
	// {
	// 	idx:      1,
	// 	expected: "Mon",
	// },
	// {
	// 	idx:      2,
	// 	expected: "Tue",
	// },
	// {
	// 	idx:      3,
	// 	expected: "Wed",
	// },
	// {
	// 	idx:      4,
	// 	expected: "Thu",
	// },
	// {
	// 	idx:      5,
	// 	expected: "Fri",
	// },
	// {
	// 	idx:      6,
	// 	expected: "Sat",
	// },
	}

	for _, tt := range tests {
		s := trans.WeekdayAbbreviated(time.Weekday(tt.idx))
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestDaysNarrow(t *testing.T) {

	trans := New()
	days := trans.WeekdaysNarrow()

	for i, day := range days {
		s := trans.WeekdayNarrow(time.Weekday(i))
		if s != day {
			t.Errorf("Expected '%s' Got '%s'", string(day), s)
		}
	}

	tests := []struct {
		idx      int
		expected string
	}{
	// {
	// 	idx:      0,
	// 	expected: "S",
	// },
	// {
	// 	idx:      1,
	// 	expected: "M",
	// },
	// {
	// 	idx:      2,
	// 	expected: "T",
	// },
	// {
	// 	idx:      3,
	// 	expected: "W",
	// },
	// {
	// 	idx:      4,
	// 	expected: "T",
	// },
	// {
	// 	idx:      5,
	// 	expected: "F",
	// },
	// {
	// 	idx:      6,
	// 	expected: "S",
	// },
	}

	for _, tt := range tests {
		s := trans.WeekdayNarrow(time.Weekday(tt.idx))
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestDaysShort(t *testing.T) {

	trans := New()
	days := trans.WeekdaysShort()

	for i, day := range days {
		s := trans.WeekdayShort(time.Weekday(i))
		if s != day {
			t.Errorf("Expected '%s' Got '%s'", day, s)
		}
	}

	tests := []struct {
		idx      int
		expected string
	}{
	// {
	// 	idx:      0,
	// 	expected: "Su",
	// },
	// {
	// 	idx:      1,
	// 	expected: "Mo",
	// },
	// {
	// 	idx:      2,
	// 	expected: "Tu",
	// },
	// {
	// 	idx:      3,
	// 	expected: "We",
	// },
	// {
	// 	idx:      4,
	// 	expected: "Th",
	// },
	// {
	// 	idx:      5,
	// 	expected: "Fr",
	// },
	// {
	// 	idx:      6,
	// 	expected: "Sa",
	// },
	}

	for _, tt := range tests {
		s := trans.WeekdayShort(time.Weekday(tt.idx))
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestDaysWide(t *testing.T) {

	trans := New()
	days := trans.WeekdaysWide()

	for i, day := range days {
		s := trans.WeekdayWide(time.Weekday(i))
		if s != day {
			t.Errorf("Expected '%s' Got '%s'", day, s)
		}
	}

	tests := []struct {
		idx      int
		expected string
	}{
	// {
	// 	idx:      0,
	// 	expected: "Sunday",
	// },
	// {
	// 	idx:      1,
	// 	expected: "Monday",
	// },
	// {
	// 	idx:      2,
	// 	expected: "Tuesday",
	// },
	// {
	// 	idx:      3,
	// 	expected: "Wednesday",
	// },
	// {
	// 	idx:      4,
	// 	expected: "Thursday",
	// },
	// {
	// 	idx:      5,
	// 	expected: "Friday",
	// },
	// {
	// 	idx:      6,
	// 	expected: "Saturday",
	// },
	}

	for _, tt := range tests {
		s := trans.WeekdayWide(time.Weekday(tt.idx))
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestMonthsAbbreviated(t *testing.T) {

	trans := New()
	months := trans.MonthsAbbreviated()

	for i, month := range months {
		s := trans.MonthAbbreviated(time.Month(i + 1))
		if s != month {
			t.Errorf("Expected '%s' Got '%s'", month, s)
		}
	}

	tests := []struct {
		idx      int
		expected string
	}{
	// {
	// 	idx:      1,
	// 	expected: "Jan",
	// },
	// {
	// 	idx:      2,
	// 	expected: "Feb",
	// },
	// {
	// 	idx:      3,
	// 	expected: "Mar",
	// },
	// {
	// 	idx:      4,
	// 	expected: "Apr",
	// },
	// {
	// 	idx:      5,
	// 	expected: "May",
	// },
	// {
	// 	idx:      6,
	// 	expected: "Jun",
	// },
	// {
	// 	idx:      7,
	// 	expected: "Jul",
	// },
	// {
	// 	idx:      8,
	// 	expected: "Aug",
	// },
	// {
	// 	idx:      9,
	// 	expected: "Sep",
	// },
	// {
	// 	idx:      10,
	// 	expected: "Oct",
	// },
	// {
	// 	idx:      11,
	// 	expected: "Nov",
	// },
	// {
	// 	idx:      12,
	// 	expected: "Dec",
	// },
	}

	for _, tt := range tests {
		s := trans.MonthAbbreviated(time.Month(tt.idx))
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestMonthsNarrow(t *testing.T) {

	trans := New()
	months := trans.MonthsNarrow()

	for i, month := range months {
		s := trans.MonthNarrow(time.Month(i + 1))
		if s != month {
			t.Errorf("Expected '%s' Got '%s'", month, s)
		}
	}

	tests := []struct {
		idx      int
		expected string
	}{
	// {
	// 	idx:      1,
	// 	expected: "J",
	// },
	// {
	// 	idx:      2,
	// 	expected: "F",
	// },
	// {
	// 	idx:      3,
	// 	expected: "M",
	// },
	// {
	// 	idx:      4,
	// 	expected: "A",
	// },
	// {
	// 	idx:      5,
	// 	expected: "M",
	// },
	// {
	// 	idx:      6,
	// 	expected: "J",
	// },
	// {
	// 	idx:      7,
	// 	expected: "J",
	// },
	// {
	// 	idx:      8,
	// 	expected: "A",
	// },
	// {
	// 	idx:      9,
	// 	expected: "S",
	// },
	// {
	// 	idx:      10,
	// 	expected: "O",
	// },
	// {
	// 	idx:      11,
	// 	expected: "N",
	// },
	// {
	// 	idx:      12,
	// 	expected: "D",
	// },
	}

	for _, tt := range tests {
		s := trans.MonthNarrow(time.Month(tt.idx))
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestMonthsWide(t *testing.T) {

	trans := New()
	months := trans.MonthsWide()

	for i, month := range months {
		s := trans.MonthWide(time.Month(i + 1))
		if s != month {
			t.Errorf("Expected '%s' Got '%s'", month, s)
		}
	}

	tests := []struct {
		idx      int
		expected string
	}{
	// {
	// 	idx:      1,
	// 	expected: "January",
	// },
	// {
	// 	idx:      2,
	// 	expected: "February",
	// },
	// {
	// 	idx:      3,
	// 	expected: "March",
	// },
	// {
	// 	idx:      4,
	// 	expected: "April",
	// },
	// {
	// 	idx:      5,
	// 	expected: "May",
	// },
	// {
	// 	idx:      6,
	// 	expected: "June",
	// },
	// {
	// 	idx:      7,
	// 	expected: "July",
	// },
	// {
	// 	idx:      8,
	// 	expected: "August",
	// },
	// {
	// 	idx:      9,
	// 	expected: "September",
	// },
	// {
	// 	idx:      10,
	// 	expected: "October",
	// },
	// {
	// 	idx:      11,
	// 	expected: "November",
	// },
	// {
	// 	idx:      12,
	// 	expected: "December",
	// },
	}

	for _, tt := range tests {
		s := string(trans.MonthWide(time.Month(tt.idx)))
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtTimeFull(t *testing.T) {

	// loc, err := time.LoadLocation("America/Toronto")
	// if err != nil {
	// 	t.Errorf("Expected '<nil>' Got '%s'", err)
	// }

	// fixed := time.FixedZone("OTHER", -4)

	tests := []struct {
		t        time.Time
		expected string
	}{
	// {
	// 	t:        time.Date(2016, 02, 03, 9, 5, 1, 0, loc),
	// 	expected: "9:05:01 am Eastern Standard Time",
	// },
	// {
	// 	t:        time.Date(2016, 02, 03, 20, 5, 1, 0, fixed),
	// 	expected: "8:05:01 pm OTHER",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtTimeFull(tt.t)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtTimeLong(t *testing.T) {

	// loc, err := time.LoadLocation("America/Toronto")
	// if err != nil {
	// 	t.Errorf("Expected '<nil>' Got '%s'", err)
	// }

	tests := []struct {
		t        time.Time
		expected string
	}{
	// {
	// 	t:        time.Date(2016, 02, 03, 9, 5, 1, 0, loc),
	// 	expected: "9:05:01 am EST",
	// },
	// {
	// 	t:        time.Date(2016, 02, 03, 20, 5, 1, 0, loc),
	// 	expected: "8:05:01 pm EST",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtTimeLong(tt.t)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtTimeMedium(t *testing.T) {

	tests := []struct {
		t        time.Time
		expected string
	}{
	// {
	// 	t:        time.Date(2016, 02, 03, 9, 5, 1, 0, time.UTC),
	// 	expected: "9:05:01 am",
	// },
	// {
	// 	t:        time.Date(2016, 02, 03, 20, 5, 1, 0, time.UTC),
	// 	expected: "8:05:01 pm",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtTimeMedium(tt.t)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtTimeShort(t *testing.T) {

	tests := []struct {
		t        time.Time
		expected string
	}{
	// {
	// 	t:        time.Date(2016, 02, 03, 9, 5, 1, 0, time.UTC),
	// 	expected: "9:05 am",
	// },
	// {
	// 	t:        time.Date(2016, 02, 03, 20, 5, 1, 0, time.UTC),
	// 	expected: "8:05 pm",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtTimeShort(tt.t)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtDateFull(t *testing.T) {

	tests := []struct {
		t        time.Time
		expected string
	}{
	// {
	// 	t:        time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC),
	// 	expected: "Wednesday, February 3, 2016",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtDateFull(tt.t)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtDateLong(t *testing.T) {

	tests := []struct {
		t        time.Time
		expected string
	}{
	// {
	// 	t:        time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC),
	// 	expected: "February 3, 2016",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtDateLong(tt.t)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtDateMedium(t *testing.T) {

	tests := []struct {
		t        time.Time
		expected string
	}{
	// {
	// 	t:        time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC),
	// 	expected: "Feb 3, 2016",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtDateMedium(tt.t)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtDateShort(t *testing.T) {

	tests := []struct {
		t        time.Time
		expected string
	}{
	// {
	// 	t:        time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC),
	// 	expected: "2/3/16",
	// },
	// {
	// 	t:        time.Date(-500, 02, 03, 9, 0, 1, 0, time.UTC),
	// 	expected: "2/3/500",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtDateShort(tt.t)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtNumber(t *testing.T) {

	tests := []struct {
		num      float64
		v        uint64
		expected string
	}{
	// {
	// 	num:      1123456.5643,
	// 	v:        2,
	// 	expected: "1,123,456.56",
	// },
	// {
	// 	num:      1123456.5643,
	// 	v:        1,
	// 	expected: "1,123,456.6",
	// },
	// {
	// 	num:      221123456.5643,
	// 	v:        3,
	// 	expected: "221,123,456.564",
	// },
	// {
	// 	num:      -221123456.5643,
	// 	v:        3,
	// 	expected: "-221,123,456.564",
	// },
	// {
	// 	num:      -221123456.5643,
	// 	v:        3,
	// 	expected: "-221,123,456.564",
	// },
	// {
	// 	num:      0,
	// 	v:        2,
	// 	expected: "0.00",
	// },
	// {
	// 	num:      -0,
	// 	v:        2,
	// 	expected: "0.00",
	// },
	// {
	// 	num:      -0,
	// 	v:        2,
	// 	expected: "0.00",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtNumber(tt.num, tt.v)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtCurrency(t *testing.T) {

	tests := []struct {
		num      float64
		v        uint64
		currency currency.Type
		expected string
	}{
	// {
	// 	num:      1123456.5643,
	// 	v:        2,
	// 	currency: currency.USD,
	// 	expected: "$1,123,456.56",
	// },
	// {
	// 	num:      1123456.5643,
	// 	v:        1,
	// 	currency: currency.USD,
	// 	expected: "$1,123,456.60",
	// },
	// {
	// 	num:      221123456.5643,
	// 	v:        3,
	// 	currency: currency.USD,
	// 	expected: "$221,123,456.564",
	// },
	// {
	// 	num:      -221123456.5643,
	// 	v:        3,
	// 	currency: currency.USD,
	// 	expected: "-$221,123,456.564",
	// },
	// {
	// 	num:      -221123456.5643,
	// 	v:        3,
	// 	currency: currency.CAD,
	// 	expected: "-CAD 221,123,456.564",
	// },
	// {
	// 	num:      0,
	// 	v:        2,
	// 	currency: currency.USD,
	// 	expected: "$0.00",
	// },
	// {
	// 	num:      -0,
	// 	v:        2,
	// 	currency: currency.USD,
	// 	expected: "$0.00",
	// },
	// {
	// 	num:      -0,
	// 	v:        2,
	// 	currency: currency.CAD,
	// 	expected: "CAD 0.00",
	// },
	// {
	// 	num:      1.23,
	// 	v:        0,
	// 	currency: currency.USD,
	// 	expected: "$1.00",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtCurrency(tt.num, tt.v, tt.currency)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtAccounting(t *testing.T) {

	tests := []struct {
		num      float64
		v        uint64
		currency currency.Type
		expected string
	}{
	// {
	// 	num:      1123456.5643,
	// 	v:        2,
	// 	currency: currency.USD,
	// 	expected: "$1,123,456.56",
	// },
	// {
	// 	num:      1123456.5643,
	// 	v:        1,
	// 	currency: currency.USD,
	// 	expected: "$1,123,456.60",
	// },
	// {
	// 	num:      221123456.5643,
	// 	v:        3,
	// 	currency: currency.USD,
	// 	expected: "$221,123,456.564",
	// },
	// {
	// 	num:      -221123456.5643,
	// 	v:        3,
	// 	currency: currency.USD,
	// 	expected: "($221,123,456.564)",
	// },
	// {
	// 	num:      -221123456.5643,
	// 	v:        3,
	// 	currency: currency.CAD,
	// 	expected: "(CAD 221,123,456.564)",
	// },
	// {
	// 	num:      -0,
	// 	v:        2,
	// 	currency: currency.USD,
	// 	expected: "$0.00",
	// },
	// {
	// 	num:      -0,
	// 	v:        2,
	// 	currency: currency.CAD,
	// 	expected: "CAD 0.00",
	// },
	// {
	// 	num:      1.23,
	// 	v:        0,
	// 	currency: currency.USD,
	// 	expected: "$1.00",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtAccounting(tt.num, tt.v, tt.currency)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

func TestFmtPercent(t *testing.T) {

	tests := []struct {
		num      float64
		v        uint64
		expected string
	}{
	// {
	// 	num:      15,
	// 	v:        0,
	// 	expected: "15%",
	// },
	// {
	// 	num:      15,
	// 	v:        2,
	// 	expected: "15.00%",
	// },
	// {
	// 	num:      434.45,
	// 	v:        0,
	// 	expected: "434%",
	// },
	// {
	// 	num:      34.4,
	// 	v:        2,
	// 	expected: "34.40%",
	// },
	// {
	// 	num:      -34,
	// 	v:        0,
	// 	expected: "-34%",
	// },
	}

	trans := New()

	for _, tt := range tests {
		s := trans.FmtPercent(tt.num, tt.v)
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}

{'repo_name': 'Tencent/bk-cmdb', 'stars': '3515', 'repo_language': 'Go', 'file_name': 'connection-must-order-ids.yml', 'mime_type': 'text/plain', 'hash': 1292693998448197357, 'source_dataset': 'data'}


#!/usr/bin/env PYTHONHASHSEED=1234 python3

# Copyright 2014-2019 Brett Slatkin, Pearson Education Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Reproduce book environment
import random
random.seed(1234)

import logging
from pprint import pprint
from sys import stdout as STDOUT

# Write all output to a temporary directory
import atexit
import gc
import io
import os
import tempfile

TEST_DIR = tempfile.TemporaryDirectory()
atexit.register(TEST_DIR.cleanup)

# Make sure Windows processes exit cleanly
OLD_CWD = os.getcwd()
atexit.register(lambda: os.chdir(OLD_CWD))
os.chdir(TEST_DIR.name)

def close_open_files():
    everything = gc.get_objects()
    for obj in everything:
        if isinstance(obj, io.IOBase):
            obj.close()

atexit.register(close_open_files)

# Example 1
class Counter:
    def __init__(self):
        self.count = 0

    def increment(self, offset):
        self.count += offset

# Example 2
def worker(sensor_index, how_many, counter):
    # I have a barrier in here so the workers synchronize
    # when they start counting, otherwise it's hard to get a race
    # because the overhead of starting a thread is high.
    BARRIER.wait()
    for _ in range(how_many):
        # Read from the sensor
        # Nothing actually happens here, but this is where
        # the blocking I/O would go.
        counter.increment(1)

# Example 3
from threading import Barrier
BARRIER = Barrier(5)
from threading import Thread

how_many = 10**5
counter = Counter()

threads = []
for i in range(5):
    thread = Thread(target=worker,
                    args=(i, how_many, counter))
    threads.append(thread)
    thread.start()

for thread in threads:
    thread.join()

expected = how_many * 5
found = counter.count
print(f'Counter should be {expected}, got {found}')

# Example 4
counter.count += 1

# Example 5
value = getattr(counter, 'count')
result = value + 1
setattr(counter, 'count', result)

# Example 6
# Running in Thread A
value_a = getattr(counter, 'count')
# Context switch to Thread B
value_b = getattr(counter, 'count')
result_b = value_b + 1
setattr(counter, 'count', result_b)
# Context switch back to Thread A
result_a = value_a + 1
setattr(counter, 'count', result_a)

# Example 7
from threading import Lock

class LockingCounter:
    def __init__(self):
        self.lock = Lock()
        self.count = 0

    def increment(self, offset):
        with self.lock:
            self.count += offset

# Example 8
BARRIER = Barrier(5)
counter = LockingCounter()

for i in range(5):
    thread = Thread(target=worker,
                    args=(i, how_many, counter))
    threads.append(thread)
    thread.start()

for thread in threads:
    thread.join()

expected = how_many * 5
found = counter.count
print(f'Counter should be {expected}, got {found}')

{'repo_name': 'bslatkin/effectivepython', 'stars': '1343', 'repo_language': 'Python', 'file_name': 'always_breakpoint.py', 'mime_type': 'text/plain', 'hash': -9056903105057639582, 'source_dataset': 'data'}


	db DEX_GOLBAT ; pokedex id

	db  75,  80,  70,  90,  75
	;   hp  atk  def  spd  spc

	db POISON, FLYING ; type
	db 90 ; catch rate
	db 171 ; base exp

	INCBIN "gfx/pokemon/front/golbat.pic", 0, 1 ; sprite dimensions
	dw GolbatPicFront, GolbatPicBack

	db LEECH_LIFE, SCREECH, BITE, NO_MOVE ; level 1 learnset
	db GROWTH_MEDIUM_FAST ; growth rate

	; tm/hm learnset
	tmhm RAZOR_WIND,   WHIRLWIND,    TOXIC,        TAKE_DOWN,    DOUBLE_EDGE,  \
	     HYPER_BEAM,   RAGE,         MEGA_DRAIN,   MIMIC,        DOUBLE_TEAM,  \
	     BIDE,         SWIFT,        REST,         SUBSTITUTE
	; end

	db 0 ; padding

{'repo_name': 'pret/pokered', 'stars': '2397', 'repo_language': 'Assembly', 'file_name': 'water_tilesets.asm', 'mime_type': 'text/plain', 'hash': 506734140160881350, 'source_dataset': 'data'}


		<!-- never cache patterns -->
		<meta http-equiv="cache-control" content="max-age=0" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
		<meta http-equiv="pragma" content="no-cache" />

		<link rel="stylesheet" href="../../styleguide/css/styleguide.css?{{ cacheBuster }}" media="all">
		<link rel="stylesheet" href="../../styleguide/css/styleguide-specific.css?{{ cacheBuster }}" media="all" />

{'repo_name': 'HBRGTech/daisy', 'stars': '116', 'repo_language': 'JavaScript', 'file_name': 'vhost.txt', 'mime_type': 'text/plain', 'hash': 833378066030201206, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="default_tab_display_option">both</string>

</resources>

{'repo_name': 'vanita5/twittnuker', 'stars': '118', 'repo_language': 'Kotlin', 'file_name': 'DebugModeUtils.java', 'mime_type': 'text/x-java', 'hash': 2230241820917734396, 'source_dataset': 'data'}


node-macaddress
===============

[![Build Status](https://travis-ci.org/scravy/node-macaddress.svg?branch=master)](https://travis-ci.org/scravy/node-macaddress)

Retrieve MAC addresses in Linux, OS X, and Windows.

A common misconception about MAC addresses is that every *host* had *one* MAC address,
while a host may have *multiple* MAC addresses – since *every network interface* may
have its own MAC address.

This library allows to discover the MAC address per network interface and chooses
an appropriate interface if all you're interested in is *one* MAC address identifying
the host system (see `API + Examples` below).

**Features:**

+ works on `Linux`, `Mac OS X`, `Windows`, and on most `UNIX` systems.
+ `node ≥ 0.12` and `io.js` report MAC addresses in `os.networkInterfaces()`
  this library utilizes this information when available.
+ also features a sane replacement for `os.networkInterfaces()`
  (see `API + Examples` below).
+ works with stoneage node versions ≥ v0.8 (...)
+ Promise support

Usage
-----

```
npm install --save macaddress
```

```JavaScript
var macaddress = require('macaddress');
```

API + Examples
--------------

    (async)  .one(iface, callback) → string
    (async)  .one(iface)           → Promise<string>
    (async)  .one(callback)        → string
    (async)  .all()                → Promise<{ iface: { type: address } }>
    (async)  .all(callback)        → { iface: { type: address } }
    (sync)   .networkInterfaces()  → { iface: { type: address } }

---

### `.one([iface], callback)`

Retrieves the MAC address of the given `iface`.

If `iface` is omitted, this function automatically chooses an
appropriate device (e.g. `eth0` in Linux, `en0` in OS X, etc.).

**Without `iface` parameter:**

```JavaScript
macaddress.one(function (err, mac) {
  console.log("Mac address for this host: %s", mac);
});
```

or using Promise

```JavaScript
macaddress.one().then(function (mac) {
  console.log("Mac address for this host: %s", mac);
});
```

```
→ Mac address for this host: ab:42:de:13:ef:37
```

**With `iface` parameter:**

```JavaScript
macaddress.one('awdl0', function (err, mac) {
  console.log("Mac address for awdl0: %s", mac);
});
```
or using Promise

```JavaScript
macaddress.one('awdl0').then(function (mac) {
  console.log("Mac address for awdl0: %s", mac);
});
```

```
→ Mac address for awdl0: ab:cd:ef:34:12:56
```

---

### `.all(callback)`

Retrieves the MAC addresses for all non-internal interfaces.

```JavaScript
macaddress.all(function (err, all) {
  console.log(JSON.stringify(all, null, 2));
});
```
or using Promise

```JavaScript
macaddress.all().then(function (all) {
  console.log(JSON.stringify(all, null, 2));
});
```

```JavaScript
{
  "en0": {
    "ipv6": "fe80::cae0:ebff:fe14:1da9",
    "ipv4": "192.168.178.20",
    "mac": "ab:42:de:13:ef:37"
  },
  "awdl0": {
    "ipv6": "fe80::58b9:daff:fea9:23a9",
    "mac": "ab:cd:ef:34:12:56"
  }
}
```

---

### `.networkInterfaces()`

A useful replacement of `os.networkInterfaces()`. Reports only non-internal interfaces.

```JavaScript
console.log(JSON.stringify(macaddress.networkInterfaces(), null, 2));
```

```JavaScript
{
  "en0": {
    "ipv6": "fe80::cae0:ebff:fe14:1dab",
    "ipv4": "192.168.178.22"
  },
  "awdl0": {
    "ipv6": "fe80::58b9:daff:fea9:23a9"
  }
}
```

{'repo_name': 'scravy/node-macaddress', 'stars': '109', 'repo_language': 'JavaScript', 'file_name': 'getmacaddress_linux.js', 'mime_type': 'text/plain', 'hash': -7696621055631719465, 'source_dataset': 'data'}


% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{\%>\%}
\alias{\%>\%}
\title{Pipe operator}
\usage{
lhs \%>\% rhs
}
\description{
Exported from the magrittr package.  To learn more, run \code{?magrittr::`\%>\%`}.
}
\examples{
mtcars \%>\%
  tabyl(carb, cyl) \%>\%
  adorn_totals()
}
\keyword{internal}

{'repo_name': 'sfirke/janitor', 'stars': '839', 'repo_language': 'R', 'file_name': 'email.yml', 'mime_type': 'text/plain', 'hash': 4383645064181072413, 'source_dataset': 'data'}


export function embedSWF (id: string, src: string) {
  const flash = [
    '<object type="application/x-shockwave-flash" ',
    `id="${id}" `,
    'name="${id}" ',
    'align="middle" ',
    'allowscriptaccess="always" ',
    'allowfullscreen="true" ',
    'allowfullscreeninteractive="true" ',
    'wmode="transparent" ',
    `data="${src}" `,
    'width="100%" ',
    'height="100%">',
    `<param name="src" value="${src}">`,
    '<param name="quality" value="high">',
    '<param name="bgcolor" value="#fff">',
    '<param name="allowscriptaccess" value="always">',
    '<param name="allowfullscreen" value="true">',
    '<param name="wmode" value="transparent">',
    '<param name="allowFullScreenInteractive" value="true">',
    '<param name="flashvars" value="">',
    '</object>'
  ].join('')
  let div = document.createElement('div')
  div.className = 'big-flash-cls' // 防止Chrome屏蔽小块的 Flash
  document.body.appendChild(div)
  div.innerHTML = flash
  return div
}

{'repo_name': 'spacemeowx2/DouyuHTML5Player', 'stars': '633', 'repo_language': 'TypeScript', 'file_name': 'settings.json', 'mime_type': 'text/plain', 'hash': 809801826243302252, 'source_dataset': 'data'}


{'repo_name': 'mekanism/Mekanism', 'stars': '577', 'repo_language': 'Java', 'file_name': 'gradle-wrapper.properties', 'mime_type': 'text/plain', 'hash': 6142756378052708477, 'source_dataset': 'data'}


var isLaziable = require('./_isLaziable'),
    setData = require('./_setData'),
    setWrapToString = require('./_setWrapToString');

/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
    WRAP_BIND_KEY_FLAG = 2,
    WRAP_CURRY_BOUND_FLAG = 4,
    WRAP_CURRY_FLAG = 8,
    WRAP_PARTIAL_FLAG = 32,
    WRAP_PARTIAL_RIGHT_FLAG = 64;

/**
 * Creates a function that wraps `func` to continue currying.
 *
 * @private
 * @param {Function} func The function to wrap.
 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
 * @param {Function} wrapFunc The function to create the `func` wrapper.
 * @param {*} placeholder The placeholder value.
 * @param {*} [thisArg] The `this` binding of `func`.
 * @param {Array} [partials] The arguments to prepend to those provided to
 *  the new function.
 * @param {Array} [holders] The `partials` placeholder indexes.
 * @param {Array} [argPos] The argument positions of the new function.
 * @param {number} [ary] The arity cap of `func`.
 * @param {number} [arity] The arity of `func`.
 * @returns {Function} Returns the new wrapped function.
 */
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  var isCurry = bitmask & WRAP_CURRY_FLAG,
      newHolders = isCurry ? holders : undefined,
      newHoldersRight = isCurry ? undefined : holders,
      newPartials = isCurry ? partials : undefined,
      newPartialsRight = isCurry ? undefined : partials;

  bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);

  if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
    bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  }
  var newData = [
    func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
    newHoldersRight, argPos, ary, arity
  ];

  var result = wrapFunc.apply(undefined, newData);
  if (isLaziable(func)) {
    setData(result, newData);
  }
  result.placeholder = placeholder;
  return setWrapToString(result, func, bitmask);
}

module.exports = createRecurry;

{'repo_name': 'habitlab/habitlab', 'stars': '259', 'repo_language': 'JavaScript', 'file_name': 'intervention-mastered-display.ls', 'mime_type': 'text/plain', 'hash': -8430457191331369412, 'source_dataset': 'data'}


{% extends "base.html" %}

{% block title %}UI自动化 测试平台 - general_test_batch{% endblock %}

{% block head %}
<meta name="viewport" content="width=device-width" />

    <link href="../static/bootstrap-3.3.7-dist/dist/css/bootstrap.css" rel="stylesheet" />

    <link href="../static/bootstrap-table-develop/dist/bootstrap-table.css" rel="stylesheet" />

    {% for jsfile_name in script_list %}

    {% endfor %}

{% endblock %}
{% block content %}

查看测试结果

        <form class="form-horizontal" id="test_case_detail" action="/edit_test_case" method="post">

		        用例ID

                             <input type="text" class="form-control readonly" id="id" name="id" readonly="readonly">

		        所属模块

                     <input type="text" class="form-control readonly" id="module" name="module" readonly="readonly">

		        名称

                     <input type="text" class="form-control readonly" id="name" name="name" readonly="readonly">

		        描述

                     <input type="text" class="form-control readonly" id="description" name="description" readonly="readonly">

		        步骤

                     <input type="text" class="form-control readonly" id="steps" name="steps" readonly="readonly">

        </form>

                <form id="formSearch1" class="form-horizontal">

查询条件

                        执行状态

                        <select class="form-control" onchange="selectOnchang(this)" id="selectStatus">
                            <option value="">-请选择-</option>
                            <option value="0">0-待执行</option>
                            <option value="1">1-执行成功</option>
                            <option value="2">2-执行失败</option>
                            <option value="3">3-无法执行</option>
                            </select>

                        名称

                            <input type="text" class="form-control" id="casename" size="20">

                        设备列表

                        <select class="form-control required"  multiple name="ipList" id="ipList">

                        </select>

                            <button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="return searchTestBatch2({{id}})">查询</button>
                             <button id="btn_reset" type="button" class="btn btn-default" onclick="return initPage({{id}})">刷新</button>
                            <button id="btn_edit" type="button" class="btn btn-default" onclick="window.location.href=('/edit_test_case?id='+{{id}})">编辑</button>
                            <button id="btn_run_test" type="button" class="btn btn-default" onclick="run_test_case({{id}})">重跑</button>
                            <button id="btn_runIp_test" type="button" class="btn btn-default" onclick="run_test_case_Ip({{id}})">指定设备重跑</button>

                </form>

                    {{ myechart|safe }}

{% endblock %}

{'repo_name': 'jerrylizilong/autotest_platform', 'stars': '316', 'repo_language': 'JavaScript', 'file_name': 'test_keyword_manage.py', 'mime_type': 'text/x-python', 'hash': -8897422697272434607, 'source_dataset': 'data'}


%%

%unicode 5.0
%public
%class UnicodeAge_5_0_age_2_0

%type int
%standalone

%include ../../resources/common-unicode-all-enumerated-property-defined-values-only-java

%%

<<EOF>> { printOutput(); return 1; }
\p{Age:2.0} { setCurCharPropertyValue("Age:2.0"); }
[^] { }

{'repo_name': 'jflex-de/jflex', 'stars': '328', 'repo_language': 'Java', 'file_name': 'BUILD.bazel', 'mime_type': 'text/plain', 'hash': 2477346574371672358, 'source_dataset': 'data'}


/* tslint:disable:no-string-literal */
import {
  IRule,
  ISchemaPage,
  ITransitionData,
  ITransitionPage,
} from '../../../src/defs';
import { Store } from '../../../src/modules/Store';
import { schemaPage } from '../../../src/schemas/page';

let match = {};
const store = new Store();

store.add('rule', {
  position: 1,
  value: {
    name: 'route',
    type: 'object',
  },
});

schemaPage.route = { name, params: {} };
const mockData: ITransitionData = {
  current: schemaPage,
  next: schemaPage,
  trigger: 'barba',
};

beforeEach(() => {
  match = {};
});

/**
 * Check rules
 *
 * Based on rule type: strings | object | function
 * 1. transition has no rule "property":
 *    - always returns true
 * 2. transition has rule "property":
 *     - "strings" should be present on both side (transition + view) and match
 *     - "function" should return true
 */

/**
 * Run "strings" check test
 */
function runStrings(
  transition: ITransitionPage,
  rule: IRule,
  data: ITransitionData,
  direction?: 'from' | 'to'
) {
  const fail = store['_check'](transition, rule, mockData, match, direction);

  expect(fail).toBeFalsy();
  expect(match).toMatchObject({});

  const ok = store['_check'](transition, rule, data, match, direction);

  expect(ok).toBeTruthy();
  expect(match).toMatchObject(transition);
}

/**
 * Run "object" check test
 */
function runObject(
  transition: ITransitionPage,
  rule: IRule,
  data: ITransitionData,
  direction?: 'from' | 'to'
) {
  const fail = store['_check'](transition, rule, mockData, match, direction);

  expect(fail).toBeFalsy();
  expect(match).toMatchObject({});

  const ok = store['_check'](transition, rule, data, match, direction);

  expect(ok).toBeTruthy();
  expect(match).toMatchObject(transition);
}

/**
 * Run "function" check test
 */
function runFunction(
  falsy: ITransitionPage,
  truthy: ITransitionPage,
  rule: IRule,
  direction?: 'from' | 'to'
) {
  const fail = store['_check'](falsy, rule, mockData, match, direction);

  expect(fail).toBeFalsy();
  expect(match).toMatchObject({});

  const ok = store['_check'](truthy, rule, mockData, match, direction);

  expect(ok).toBeTruthy();
  expect(match).toMatchObject(truthy);
}

// "strings" type

it('check valid for inexisting rule "strings"', () => {
  const [rule] = store['_rules'].filter(r => r.name === 'namespace');
  const expected = store['_check'](
    {},
    rule,
    ({ namespace: 'ns' } as unknown) as ITransitionData,
    match
  );

  expect(expected).toBeTruthy();
  expect(match).toMatchObject({});
});

it('check single "strings"', () => {
  const transition = { namespace: 'ns' };
  const [rule] = store['_rules'].filter(r => r.name === 'namespace');
  const data = { current: { namespace: 'ns' } };

  runStrings(transition, rule, (data as unknown) as ITransitionData);
});

it('check single "strings" with "from"', () => {
  const transition = { from: { namespace: 'ns' } };
  const [rule] = store['_rules'].filter(r => r.name === 'namespace');
  const data = { current: { namespace: 'ns' } };

  runStrings(transition, rule, (data as unknown) as ITransitionData, 'from');
});

it('check single "strings" with "to"', () => {
  const transition = { to: { namespace: 'ns' } };
  const [rule] = store['_rules'].filter(r => r.name === 'namespace');
  const data = { next: { namespace: 'ns' } };

  runStrings(transition, rule, (data as unknown) as ITransitionData, 'to');
});

it('check array "strings"', () => {
  const transition = { namespace: ['ns'] };
  const [rule] = store['_rules'].filter(r => r.name === 'namespace');
  const data = { current: { namespace: 'ns' } };

  runStrings(transition, rule, (data as unknown) as ITransitionData);
});

it('check array "strings" with "from"', () => {
  const transition = { from: { namespace: ['ns'] } };
  const [rule] = store['_rules'].filter(r => r.name === 'namespace');
  const data = { current: { namespace: 'ns' } };

  runStrings(transition, rule, (data as unknown) as ITransitionData, 'from');
});

it('check array "strings" with "to"', () => {
  const transition = { to: { namespace: ['ns'] } };
  const [rule] = store['_rules'].filter(r => r.name === 'namespace');
  const data = { next: { namespace: 'ns' } };

  runStrings(transition, rule, (data as unknown) as ITransitionData, 'to');
});

// "object" type
it('check valid for inexisting rule "object"', () => {
  const [rule] = store['_rules'].filter(r => r.name === 'route');
  const expected = store['_check'](
    {},
    rule,
    ({ route: 'r' } as unknown) as ITransitionData,
    match
  );

  expect(expected).toBeTruthy();
  expect(match).toMatchObject({});
});

it('check invalid for non matching rule "object"', () => {
  const transition = { route: 'r' };
  const [rule] = store['_rules'].filter(r => r.name === 'route');
  const data = { current: { route: null } as ISchemaPage };
  const expected = store['_check'](
    transition,
    rule,
    (data as unknown) as ITransitionData,
    match
  );

  expect(expected).toBeFalsy();
  expect(match).toMatchObject({});
});

it('check single "object"', () => {
  const transition = { route: 'r' };
  const [rule] = store['_rules'].filter(r => r.name === 'route');
  const data = { current: { route: { name: 'r' } } };

  runObject(transition, rule, (data as unknown) as ITransitionData);
});

it('check single "object" with "from"', () => {
  const transition = { from: { route: 'r' } };
  const [rule] = store['_rules'].filter(r => r.name === 'route');
  const data = { current: { route: { name: 'r' } } };

  runObject(transition, rule, (data as unknown) as ITransitionData, 'from');
});

it('check single "object" with "to"', () => {
  const transition = { to: { route: 'r' } };
  const [rule] = store['_rules'].filter(r => r.name === 'route');
  const data = { next: { route: { name: 'r' } } };

  runObject(transition, rule, (data as unknown) as ITransitionData, 'to');
});

it('check array "object"', () => {
  const transition = { route: ['r'] };
  const [rule] = store['_rules'].filter(r => r.name === 'route');
  const data = { current: { route: { name: 'r' } } };

  runObject(transition, rule, (data as unknown) as ITransitionData);
});

it('check array "object" with "from"', () => {
  const transition = { from: { route: ['r'] } };
  const [rule] = store['_rules'].filter(r => r.name === 'route');
  const data = { current: { route: { name: 'r' } } };

  runObject(transition, rule, (data as unknown) as ITransitionData, 'from');
});

it('check array "object" with "to"', () => {
  const transition = { to: { route: ['r'] } };
  const [rule] = store['_rules'].filter(r => r.name === 'route');
  const data = { next: { route: { name: 'r' } } };

  runObject(transition, rule, (data as unknown) as ITransitionData, 'to');
});

// "function" type

it('check valid for inexisting rule "function"', () => {
  const [rule] = store['_rules'].filter(r => r.name === 'custom');
  const expected = store['_check'](
    {},
    rule,
    ({} as unknown) as ITransitionData,
    match
  );

  expect(expected).toBeTruthy();
  expect(match).toMatchObject({});
});

it('check "function"', () => {
  const falsy = { custom: () => false };
  const truthy = { custom: () => true };
  const [rule] = store['_rules'].filter(r => r.name === 'custom');

  runFunction(falsy, truthy, rule);
});

it('check "function" with "from"', () => {
  const falsy = { from: { custom: () => false } };
  const truthy = { from: { custom: () => true } };
  const [rule] = store['_rules'].filter(r => r.name === 'custom');

  runFunction(falsy, truthy, rule, 'from');
});

it('check "function" with "to"', () => {
  const falsy = { to: { custom: () => false } };
  const truthy = { to: { custom: () => true } };
  const [rule] = store['_rules'].filter(r => r.name === 'custom');

  runFunction(falsy, truthy, rule, 'to');
});

{'repo_name': 'barbajs/barba', 'stars': '8271', 'repo_language': 'TypeScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 1892940152073472175, 'source_dataset': 'data'}


//  boost/filesystem/operations.hpp  ---------------------------------------------------//

//  Copyright Beman Dawes 2002-2009
//  Copyright Jan Langer 2002
//  Copyright Dietmar Kuehl 2001
//  Copyright Vladimir Prus 2002

//  Distributed under the Boost Software License, Version 1.0.
//  See http://www.boost.org/LICENSE_1_0.txt

//  Library home page: http://www.boost.org/libs/filesystem

//--------------------------------------------------------------------------------------//

#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP
#define BOOST_FILESYSTEM3_OPERATIONS_HPP

#include <boost/config.hpp>

# if defined( BOOST_NO_STD_WSTRING )
#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
# endif

#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/file_status.hpp>

#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
// These includes are left for backward compatibility and should be included directly by users, as needed
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/directory.hpp>
#endif

#include <boost/core/scoped_enum.hpp>
#include <boost/system/error_code.hpp>
#include <boost/cstdint.hpp>
#include <string>
#include <ctime>

#include <boost/config/abi_prefix.hpp> // must be the last #include

//--------------------------------------------------------------------------------------//

namespace boost {
namespace filesystem {

struct space_info
{
  // all values are byte counts
  boost::uintmax_t capacity;
  boost::uintmax_t free;      // <= capacity
  boost::uintmax_t available; // <= free
};

BOOST_SCOPED_ENUM_DECLARE_BEGIN(copy_option)
  {none=0, fail_if_exists = none, overwrite_if_exists}
BOOST_SCOPED_ENUM_DECLARE_END(copy_option)

//--------------------------------------------------------------------------------------//
//                             implementation details                                   //
//--------------------------------------------------------------------------------------//

namespace detail {

//  We cannot pass a BOOST_SCOPED_ENUM to a compled function because it will result
//  in an undefined reference if the library is compled with -std=c++0x but the use
//  is compiled in C++03 mode, or vice versa. See tickets 6124, 6779, 10038.
enum copy_option {none=0, fail_if_exists = none, overwrite_if_exists};

BOOST_FILESYSTEM_DECL
file_status status(const path&p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
file_status symlink_status(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
bool is_empty(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path initial_path(system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path canonical(const path& p, const path& base, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void copy(const path& from, const path& to, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void copy_directory(const path& from, const path& to, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void copy_file(const path& from, const path& to,  // See ticket #2925
                detail::copy_option option, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
bool create_directories(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
bool create_directory(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void create_directory_symlink(const path& to, const path& from,
                              system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void create_hard_link(const path& to, const path& from, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void create_symlink(const path& to, const path& from, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path current_path(system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void current_path(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
bool equivalent(const path& p1, const path& p2, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
boost::uintmax_t file_size(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
std::time_t last_write_time(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void last_write_time(const path& p, const std::time_t new_time,
                     system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void permissions(const path& p, perms prms, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path read_symlink(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path relative(const path& p, const path& base, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
bool remove(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
boost::uintmax_t remove_all(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void rename(const path& old_p, const path& new_p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
space_info space(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path system_complete(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path temp_directory_path(system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path unique_path(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path weakly_canonical(const path& p, system::error_code* ec = 0);

} // namespace detail

//--------------------------------------------------------------------------------------//
//                                                                                //
//                             status query functions                                   //
//                                                                                //
//--------------------------------------------------------------------------------------//

inline
file_status status(const path& p)    {return detail::status(p);}
inline
file_status status(const path& p, system::error_code& ec)
                                     {return detail::status(p, &ec);}
inline
file_status symlink_status(const path& p) {return detail::symlink_status(p);}
inline
file_status symlink_status(const path& p, system::error_code& ec)
                                     {return detail::symlink_status(p, &ec);}
inline
bool exists(const path& p)           {return exists(detail::status(p));}
inline
bool exists(const path& p, system::error_code& ec)
                                     {return exists(detail::status(p, &ec));}
inline
bool is_directory(const path& p)     {return is_directory(detail::status(p));}
inline
bool is_directory(const path& p, system::error_code& ec)
                                     {return is_directory(detail::status(p, &ec));}
inline
bool is_regular_file(const path& p)  {return is_regular_file(detail::status(p));}
inline
bool is_regular_file(const path& p, system::error_code& ec)
                                     {return is_regular_file(detail::status(p, &ec));}
inline
bool is_other(const path& p)         {return is_other(detail::status(p));}
inline
bool is_other(const path& p, system::error_code& ec)
                                     {return is_other(detail::status(p, &ec));}
inline
bool is_symlink(const path& p)       {return is_symlink(detail::symlink_status(p));}
inline
bool is_symlink(const path& p, system::error_code& ec)
                                     {return is_symlink(detail::symlink_status(p, &ec));}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline
bool is_regular(const path& p)       {return is_regular(detail::status(p));}
inline
bool is_regular(const path& p, system::error_code& ec)
                                     {return is_regular(detail::status(p, &ec));}
#endif

inline
bool is_empty(const path& p)         {return detail::is_empty(p);}
inline
bool is_empty(const path& p, system::error_code& ec)
                                     {return detail::is_empty(p, &ec);}

//--------------------------------------------------------------------------------------//
//                                                                                //
//                             operational functions                                    //
//                  in alphabetical order, unless otherwise noted                       //
//                                                                                //
//--------------------------------------------------------------------------------------//

//  forward declarations
path current_path();  // fwd declaration
path initial_path();

BOOST_FILESYSTEM_DECL
path absolute(const path& p, const path& base=current_path());
//  If base.is_absolute(), throws nothing. Thus no need for ec argument

inline
path canonical(const path& p, const path& base=current_path())
                                     {return detail::canonical(p, base);}
inline
path canonical(const path& p, system::error_code& ec)
                                     {return detail::canonical(p, current_path(), &ec);}
inline
path canonical(const path& p, const path& base, system::error_code& ec)
                                     {return detail::canonical(p, base, &ec);}

#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline
path complete(const path& p)
{
  return absolute(p, initial_path());
}

inline
path complete(const path& p, const path& base)
{
  return absolute(p, base);
}
#endif

inline
void copy(const path& from, const path& to) {detail::copy(from, to);}

inline
void copy(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::copy(from, to, &ec);}
inline
void copy_directory(const path& from, const path& to)
                                     {detail::copy_directory(from, to);}
inline
void copy_directory(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::copy_directory(from, to, &ec);}
inline
void copy_file(const path& from, const path& to,   // See ticket #2925
               BOOST_SCOPED_ENUM_NATIVE(copy_option) option)
{
  detail::copy_file(from, to, static_cast<detail::copy_option>(option));
}
inline
void copy_file(const path& from, const path& to)
{
  detail::copy_file(from, to, detail::fail_if_exists);
}
inline
void copy_file(const path& from, const path& to,   // See ticket #2925
               BOOST_SCOPED_ENUM_NATIVE(copy_option) option, system::error_code& ec) BOOST_NOEXCEPT
{
  detail::copy_file(from, to, static_cast<detail::copy_option>(option), &ec);
}
inline
void copy_file(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT
{
  detail::copy_file(from, to, detail::fail_if_exists, &ec);
}
inline
void copy_symlink(const path& existing_symlink,
                  const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);}

inline
void copy_symlink(const path& existing_symlink, const path& new_symlink,
                  system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::copy_symlink(existing_symlink, new_symlink, &ec);}
inline
bool create_directories(const path& p) {return detail::create_directories(p);}

inline
bool create_directories(const path& p, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::create_directories(p, &ec);}
inline
bool create_directory(const path& p) {return detail::create_directory(p);}

inline
bool create_directory(const path& p, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::create_directory(p, &ec);}
inline
void create_directory_symlink(const path& to, const path& from)
                                     {detail::create_directory_symlink(to, from);}
inline
void create_directory_symlink(const path& to, const path& from, system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::create_directory_symlink(to, from, &ec);}
inline
void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);}

inline
void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::create_hard_link(to, new_hard_link, &ec);}
inline
void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);}

inline
void create_symlink(const path& to, const path& new_symlink, system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::create_symlink(to, new_symlink, &ec);}
inline
path current_path()                  {return detail::current_path();}

inline
path current_path(system::error_code& ec) {return detail::current_path(&ec);}

inline
void current_path(const path& p)     {detail::current_path(p);}

inline
void current_path(const path& p, system::error_code& ec) BOOST_NOEXCEPT {detail::current_path(p, &ec);}

inline
bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);}

inline
bool equivalent(const path& p1, const path& p2, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::equivalent(p1, p2, &ec);}
inline
boost::uintmax_t file_size(const path& p) {return detail::file_size(p);}

inline
boost::uintmax_t file_size(const path& p, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::file_size(p, &ec);}
inline
boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);}

inline
boost::uintmax_t hard_link_count(const path& p, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::hard_link_count(p, &ec);}
inline
path initial_path()                  {return detail::initial_path();}

inline
path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}

template <class Path>
path initial_path() {return initial_path();}
template <class Path>
path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}

inline
std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}

inline
std::time_t last_write_time(const path& p, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::last_write_time(p, &ec);}
inline
void last_write_time(const path& p, const std::time_t new_time)
                                     {detail::last_write_time(p, new_time);}
inline
void last_write_time(const path& p, const std::time_t new_time,
                     system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::last_write_time(p, new_time, &ec);}
inline
void permissions(const path& p, perms prms)
                                     {detail::permissions(p, prms);}
inline
void permissions(const path& p, perms prms, system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::permissions(p, prms, &ec);}

inline
path read_symlink(const path& p)     {return detail::read_symlink(p);}

inline
path read_symlink(const path& p, system::error_code& ec)
                                     {return detail::read_symlink(p, &ec);}

inline
bool remove(const path& p)           {return detail::remove(p);}

inline
bool remove(const path& p, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::remove(p, &ec);}

inline
boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);}

inline
boost::uintmax_t remove_all(const path& p, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::remove_all(p, &ec);}
inline
void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);}

inline
void rename(const path& old_p, const path& new_p, system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::rename(old_p, new_p, &ec);}
inline  // name suggested by Scott McMurray
void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);}

inline
void resize_file(const path& p, uintmax_t size, system::error_code& ec) BOOST_NOEXCEPT
                                     {detail::resize_file(p, size, &ec);}
inline
path relative(const path& p, const path& base=current_path())
                                     {return detail::relative(p, base);}
inline
path relative(const path& p, system::error_code& ec)
                                     {return detail::relative(p, current_path(), &ec);}
inline
path relative(const path& p, const path& base, system::error_code& ec)
                                     {return detail::relative(p, base, &ec);}
inline
space_info space(const path& p)      {return detail::space(p);}

inline
space_info space(const path& p, system::error_code& ec) BOOST_NOEXCEPT
                                     {return detail::space(p, &ec);}

#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline bool symbolic_link_exists(const path& p)
                                     { return is_symlink(filesystem::symlink_status(p)); }
#endif

inline
path system_complete(const path& p)  {return detail::system_complete(p);}

inline
path system_complete(const path& p, system::error_code& ec)
                                     {return detail::system_complete(p, &ec);}
inline
path temp_directory_path()           {return detail::temp_directory_path();}

inline
path temp_directory_path(system::error_code& ec)
                                     {return detail::temp_directory_path(&ec);}
inline
path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
                                     {return detail::unique_path(p);}
inline
path unique_path(const path& p, system::error_code& ec)
                                     {return detail::unique_path(p, &ec);}
inline
path weakly_canonical(const path& p)   {return detail::weakly_canonical(p);}

inline
path weakly_canonical(const path& p, system::error_code& ec)
                                     {return detail::weakly_canonical(p, &ec);}

//  test helper  -----------------------------------------------------------------------//

//  Not part of the documented interface since false positives are possible;
//  there is no law that says that an OS that has large stat.st_size
//  actually supports large file sizes.

namespace detail {

BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();

} // namespace detail

} // namespace filesystem
} // namespace boost

#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP

{'repo_name': 'ycm-core/ycmd', 'stars': '1486', 'repo_language': 'C++', 'file_name': 'cmath', 'mime_type': 'text/x-c', 'hash': -8000219481107494691, 'source_dataset': 'data'}


<?php

/*
 * This file is part of the Assetic package, an OpenSky project.
 *
 * (c) 2010-2014 OpenSky Project Inc
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Assetic\Test\Factory\Worker;

use Assetic\Factory\Worker\CacheBustingWorker;

class CacheBustingWorkerTest extends \PHPUnit_Framework_TestCase
{
    private $worker;

    protected function setUp()
    {
        $this->worker = new CacheBustingWorker();
    }

    protected function tearDown()
    {
        $this->worker = null;
    }

    /**
     * @test
     */
    public function shouldApplyHash()
    {
        $asset = $this->getMockBuilder('Assetic\Asset\AssetInterface')->getMock();
        $factory = $this->getMockBuilder('Assetic\Factory\AssetFactory')
            ->disableOriginalConstructor()
            ->getMock();

        $asset->expects($this->any())
            ->method('getTargetPath')
            ->will($this->returnValue('css/main.css'));
        $factory->expects($this->any())
            ->method('getLastModified')
            ->will($this->returnValue(1234));
        $asset->expects($this->once())
            ->method('setTargetPath')
            ->with($this->logicalAnd(
                $this->stringStartsWith('css/main-'),
                $this->stringEndsWith('.css')
            ));

        $this->worker->process($asset, $factory);
    }

    /**
     * @test
     */
    public function shouldApplyConsistentHash()
    {
        $asset = $this->getMockBuilder('Assetic\Asset\AssetInterface')->getMock();
        $factory = $this->getMockBuilder('Assetic\Factory\AssetFactory')
            ->disableOriginalConstructor()
            ->getMock();
        $paths = array();

        $asset->expects($this->any())
            ->method('getTargetPath')
            ->will($this->returnValue('css/main.css'));
        $factory->expects($this->any())
            ->method('getLastModified')
            ->will($this->returnValue(1234));
        $asset->expects($this->exactly(2))
            ->method('setTargetPath')
            ->will($this->returnCallback(function ($path) use (&$paths) {
                $paths[] = $path;
            }));

        $this->worker->process($asset, $factory);
        $this->worker->process($asset, $factory);

        $this->assertCount(2, $paths);
        $this->assertCount(1, array_unique($paths));
    }

    /**
     * @test
     */
    public function shouldNotReapplyHash()
    {
        $asset = $this->getMockBuilder('Assetic\Asset\AssetInterface')->getMock();
        $factory = $this->getMockBuilder('Assetic\Factory\AssetFactory')
            ->disableOriginalConstructor()
            ->getMock();
        $path = null;

        $asset->expects($this->any())
            ->method('getTargetPath')
            ->will($this->returnCallback(function () use (&$path) {
                return $path ?: 'css/main.css';
            }));
        $factory->expects($this->any())
            ->method('getLastModified')
            ->will($this->returnValue(1234));
        $asset->expects($this->once())
            ->method('setTargetPath')
            ->will($this->returnCallback(function ($arg) use (&$path) {
                $path = $arg;
            }));

        $this->worker->process($asset, $factory);
        $this->worker->process($asset, $factory);
    }
}

{'repo_name': 'kriswallsmith/assetic', 'stars': '3804', 'repo_language': 'PHP', 'file_name': 'CssCompressorFilterTest.php', 'mime_type': 'text/x-php', 'hash': -6768276049561881723, 'source_dataset': 'data'}