using System.Collections.Generic;
using DeltaEngine.Commands;
using DeltaEngine.Core;
using DeltaEngine.Datatypes;
using DeltaEngine.Entities;
using DeltaEngine.Input;
using DeltaEngine.Input.Mocks;
using DeltaEngine.Platforms;
using DeltaEngine.Rendering2D.Fonts;
using DeltaEngine.Scenes.Controls;
using NUnit.Framework;

namespace DeltaEngine.Scenes.Tests.Controls
{
	public class ScrollbarTests : TestWithMocksOrVisually
	{
		[SetUp]
		public void SetUp()
		{
			center = Rectangle.FromCenter(0.5f, 0.5f, 0.5f, 0.1f);
			scrollbar = new Scrollbar(center);
			scrollbar.Add(new FontText(Font.Default, "", new Rectangle(0.5f, 0.7f, 0.2f, 0.1f)));
			scrollbar.Start<DisplayScrollbarValue>();
			InitializeMouse();
		}

		private static Rectangle center;
		private Scrollbar scrollbar;

		private class DisplayScrollbarValue : UpdateBehavior
		{
			public override void Update(IEnumerable<Entity> entities)
			{
				foreach (Scrollbar scrollbar in entities)
					scrollbar.Get<FontText>().Text = scrollbar.LeftValue + " - " + scrollbar.RightValue;
			}
		}

		private void InitializeMouse()
		{
			mouse = Resolve<Mouse>() as MockMouse;
			if (mouse == null)
				return; //ncrunch: no coverage
			mouse.SetNativePosition(Vector2D.Zero);
			AdvanceTimeAndUpdateEntities();
		}

		private MockMouse mouse;

		[Test, ApproveFirstFrameScreenshot]
		public void RenderScrollbarZeroToOneHundredWithPointerWidthTwenty()
		{
			scrollbar.ValueWidth = 20;
		}

		[Test]
		public void RenderScrollbarWithValueWidthEqualingValues()
		{
			scrollbar.MaxValue = 2;
			scrollbar.ValueWidth = 3;
		}

		[Test]
		public void RenderScrollbarWithOneMoreValueThanValueWidth()
		{
			scrollbar.MaxValue = 3;
			scrollbar.ValueWidth = 3;
		}

		[Test, CloseAfterFirstFrame]
		public void DefaultsToEnabled()
		{
			Assert.IsTrue(scrollbar.IsEnabled);
			Assert.AreEqual(Color.Gray, scrollbar.Color);
			Assert.AreEqual(Color.LightGray, scrollbar.Pointer.Color);
		}

		[Test, CloseAfterFirstFrame]
		public void DisablingScrollbarDisablesPointer()
		{
			scrollbar.IsEnabled = false;
			Assert.IsFalse(scrollbar.IsEnabled);
			Assert.IsFalse(scrollbar.Pointer.IsEnabled);
		}

		[Test]
		public void RenderDisabledScrollbar()
		{
			scrollbar.IsEnabled = false;
			AdvanceTimeAndUpdateEntities();
			Assert.AreEqual(Color.DarkGray, scrollbar.Color);
			Assert.AreEqual(Color.Gray, scrollbar.Pointer.Color);
		}

		[Test]
		public void RenderScrollbarZeroToOneThousandWithPointerWidthFiveHundred()
		{
			scrollbar.MaxValue = 1000;
			scrollbar.ValueWidth = 500;
		}

		[Test]
		public void RenderGrowingScrollbar()
		{
			scrollbar.Start<Grow>();
		}

		[Test, CloseAfterFirstFrame]
		public void DefaultValues()
		{
			Assert.AreEqual(0, scrollbar.MinValue);
			Assert.AreEqual(99, scrollbar.MaxValue);
			Assert.AreEqual(10, scrollbar.ValueWidth);
			Assert.AreEqual(90, scrollbar.LeftValue);
			Assert.AreEqual(95, scrollbar.CenterValue);
			Assert.AreEqual(99, scrollbar.RightValue);
		}

		[Test, CloseAfterFirstFrame]
		public void UpdateValues()
		{
			scrollbar.MinValue = 1;
			scrollbar.MaxValue = 10;
			scrollbar.ValueWidth = 2;
			scrollbar.CenterValue = 4;
			Assert.AreEqual(1, scrollbar.MinValue);
			Assert.AreEqual(10, scrollbar.MaxValue);
			Assert.AreEqual(4, scrollbar.CenterValue);
			Assert.AreEqual(2, scrollbar.ValueWidth);
		}

		[Test, CloseAfterFirstFrame]
		public void ValidatePointerSize()
		{
			if (mouse == null)
				return; //ncrunch: no coverage
			Assert.AreEqual(new Size(0.05f, 0.1f), scrollbar.Pointer.DrawArea.Size);
		}

		[Test, CloseAfterFirstFrame]
		public void ValidatePointerCenter()
		{
			if (mouse == null)
				return; //ncrunch: no coverage
			var position = new Vector2D(0.3f, 0.52f);
			DragMouse(position);
			Assert.AreEqual(new Vector2D(0.3f, 0.5f), scrollbar.Pointer.DrawArea.Center);
		}

		private void DragMouse(Vector2D position)
		{
			SetMouseState(State.Pressing, position + new Vector2D(0.1f, 0.1f));
			SetMouseState(State.Pressing, position);
		}

		private void SetMouseState(State state, Vector2D position)
		{
			if (mouse == null)
				return; //ncrunch: no coverage
			mouse.SetNativePosition(position);
			mouse.SetButtonState(MouseButton.Left, state);
			AdvanceTimeAndUpdateEntities();
		}

		[Test]
		public void RenderVerticalScrollbar()
		{
			scrollbar.MaxValue = 9;
			scrollbar.ValueWidth = 3;
			scrollbar.Rotation = 90;
		}

		[Test]
		public void Render45DegreeScrollbar()
		{
			scrollbar.Rotation = 45;
		}

		[Test]
		public void RenderSpinningScrollbar()
		{
			scrollbar.Start<Spin>();
		}

		[Test]
		public void RenderSpinningScrollbarAttachedToMouse()
		{
			scrollbar.Start<Spin>();
			new Command(
				point => scrollbar.DrawArea =  //ncrunch: no coverage
					Rectangle.FromCenter(point, scrollbar.DrawArea.Size)).Add(new MouseMovementTrigger());
		}

		[Test, CloseAfterFirstFrame]
		public void SaveAndLoad()
		{
			scrollbar.CenterValue = 20;
			var stream = BinaryDataExtensions.SaveToMemoryStream(scrollbar);
			var loadedScrollbar = (Scrollbar)stream.CreateFromMemoryStream();
			Assert.AreEqual(center, loadedScrollbar.DrawArea);
			Assert.AreEqual(20, loadedScrollbar.CenterValue);
			Assert.AreEqual(scrollbar.Get<Picture>().Material.DefaultColor,
				loadedScrollbar.Get<Picture>().Material.DefaultColor);
		}

		[Test]
		public void DrawLoadedScrollbar()
		{
			scrollbar.CenterValue = 50;
			var stream = BinaryDataExtensions.SaveToMemoryStream(scrollbar);
			scrollbar.IsActive = false;
			stream.CreateFromMemoryStream();
		}

		[Test]
		public void ChangingPointerChangesChild()
		{
			var pointer = new Picture(new Theme(), new Theme().ScrollbarPointer, Rectangle.Unused);
			scrollbar.Set(pointer);
			Assert.AreEqual(pointer, scrollbar.children[0].Entity2D);
		}
	}
}

{'repo_name': 'DeltaEngine/DeltaEngine', 'stars': '127', 'repo_language': 'C#', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': -1765186534138118294, 'source_dataset': 'data'}


// ---------------------------------------------------------------------
//
// Copyright (C) 2000 - 2018 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE.md at
// the top level directory of deal.II.
//
// ---------------------------------------------------------------------

// Same as create_mass_matrix_0[1234] but passing an additional constraint
// matrix and comparing results without constraints

#include <deal.II/base/function_lib.h>
#include <deal.II/base/quadrature_lib.h>

#include <deal.II/dofs/dof_tools.h>

#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/fe_system.h>
#include <deal.II/fe/mapping_q.h>

#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>

#include <deal.II/hp/dof_handler.h>
#include <deal.II/hp/fe_collection.h>
#include <deal.II/hp/mapping_collection.h>
#include <deal.II/hp/q_collection.h>

#include <deal.II/lac/affine_constraints.h>
#include <deal.II/lac/dynamic_sparsity_pattern.h>
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/lac/vector.h>

#include <deal.II/numerics/matrix_tools.h>
#include <deal.II/numerics/vector_tools.h>

#include "../tests.h"

template <int dim>
void
check()
{
  Triangulation<dim> tr;
  if (dim == 2)
    GridGenerator::hyper_ball(tr, Point<dim>(), 1);
  else
    GridGenerator::hyper_cube(tr, -1, 1);
  tr.refine_global(1);
  tr.begin_active()->set_refine_flag();
  tr.execute_coarsening_and_refinement();
  if (dim == 1)
    tr.refine_global(2);

  hp::FECollection<dim> element;
  element.push_back(FESystem<dim>(FE_Q<dim>(1), 1, FE_Q<dim>(2), 1));
  element.push_back(FESystem<dim>(FE_Q<dim>(2), 1, FE_Q<dim>(3), 1));
  element.push_back(FESystem<dim>(FE_Q<dim>(3), 1, FE_Q<dim>(4), 1));

  hp::DoFHandler<dim> dof(tr);

  for (typename hp::DoFHandler<dim>::active_cell_iterator cell =
         dof.begin_active();
       cell != dof.end();
       ++cell)
    cell->set_active_fe_index(Testing::rand() % element.size());

  dof.distribute_dofs(element);

  // use a more complicated mapping
  // of the domain and a quadrature
  // formula suited to the elements
  // we have here
  MappingQ<dim> mapping(3);
  QGauss<dim>   quadrature(6);

  AffineConstraints<double> constraints;
  DoFTools::make_hanging_node_constraints(dof, constraints);
  VectorTools::interpolate_boundary_values(
    dof, 0, Functions::ConstantFunction<dim>(1., 2), constraints);
  constraints.close();

  // create sparsity pattern. note
  // that different components should
  // not couple, so use pattern
  SparsityPattern sparsity;
  {
    Table<2, DoFTools::Coupling> mask(2, 2);
    mask(0, 0) = mask(1, 1) = DoFTools::always;
    mask(0, 1) = mask(1, 0) = DoFTools::none;
    DynamicSparsityPattern csp(dof.n_dofs(), dof.n_dofs());
    DoFTools::make_sparsity_pattern(dof, mask, csp, constraints);
    sparsity.copy_from(csp);
  }

  SparseMatrix<double> matrix, matrix_ref;
  matrix.reinit(sparsity);
  matrix_ref.reinit(sparsity);

  Functions::ExpFunction<dim> rhs_function;

  Vector<double> rhs(dof.n_dofs()), rhs_ref(dof.n_dofs());

  MatrixTools::create_mass_matrix(hp::MappingCollection<dim>(mapping),
                                  dof,
                                  hp::QCollection<dim>(quadrature),
                                  matrix_ref,
                                  rhs_function,
                                  rhs_ref);
  constraints.condense(matrix_ref, rhs_ref);

  const Function<dim> *const dummy = nullptr;
  MatrixTools::create_mass_matrix(hp::MappingCollection<dim>(mapping),
                                  dof,
                                  hp::QCollection<dim>(quadrature),
                                  matrix,
                                  rhs_function,
                                  rhs,
                                  dummy,
                                  constraints);

  // compute reference: need to cancel constrained entries as these will in
  // general get different values
  matrix.add(-1., matrix_ref);
  for (unsigned int i = 0; i < matrix.m(); ++i)
    if (constraints.is_constrained(i) == true)
      matrix.diag_element(i) = 0;
  deallog << "Matrix error Frobenius: " << matrix.frobenius_norm() << std::endl;

  rhs -= rhs_ref;
  deallog << "RHS vector error l2: " << rhs.l2_norm() << std::endl;
}

int
main()
{
  initlog();
  deallog << std::setprecision(3);

  deallog.push("1d");
  check<1>();
  deallog.pop();
  deallog.push("2d");
  check<2>();
  deallog.pop();
  deallog.push("3d");
  check<3>();
  deallog.pop();
}

{'repo_name': 'dealii/dealii', 'stars': '644', 'repo_language': 'C++', 'file_name': 'check_01_cpu_features.cmake', 'mime_type': 'text/x-c++', 'hash': -4577944944930380528, 'source_dataset': 'data'}


/* Cydia Substrate - Powerful Code Insertion Platform
 * Copyright (C) 2008-2011  Jay Freeman (saurik)
*/

/* GNU Lesser General Public License, Version 3 {{{ */
/*
 * Substrate is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * Substrate 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 Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Substrate.  If not, see <http://www.gnu.org/licenses/>.
**/
/* }}} */

#include "CydiaSubstrate.h"

// XXX: this is required by some code below
#ifdef __arm__
#include "ARM.hpp"
#elif defined(__i386__) || defined(__x86_64__)
#include "x86.hpp"
#endif

#include <objc/runtime.h>

#include <sys/mman.h>
#include <unistd.h>
#include <errno.h>

#include <stdio.h>
#include <string.h>

#include "Debug.hpp"
#include "Log.hpp"

extern "C" void *NSPushAutoreleasePool(unsigned);
extern "C" void NSPopAutoreleasePool(void *);

static Method MSFindMethod(Class _class, SEL sel) {
    for (; _class != nil; _class = class_getSuperclass(_class)) {
        unsigned int size;
        Method *methods(class_copyMethodList(_class, &size));
        if (methods == NULL)
            continue;

        for (unsigned int j(0); j != size; ++j) {
            Method method(methods[j]);
            if (!sel_isEqual(method_getName(methods[j]), sel))
                continue;

            free(methods);
            return method;
        }

        free(methods);
    }

    return nil;
}

static void MSHookMessageInternal(Class _class, SEL sel, IMP imp, IMP *result, const char *prefix) {
    if (MSDebug)
        MSLog(MSLogLevelNotice, "MSHookMessageInternal(%s, %s, %p, %p, \"%s\")",
            _class == nil ? "nil" : class_getName(_class),
            sel == NULL ? "NULL" : sel_getName(sel),
            imp, result, prefix
        );
    if (_class == nil) {
        MSLog(MSLogLevelWarning, "MS:Warning: nil class argument");
        return;
    } else if (sel == nil) {
        MSLog(MSLogLevelWarning, "MS:Warning: nil sel argument");
        return;
    } else if (imp == nil) {
        MSLog(MSLogLevelWarning, "MS:Warning: nil imp argument");
        return;
    }

    Method method(MSFindMethod(_class, sel));
    if (method == nil) {
        MSLog(MSLogLevelWarning, "MS:Warning: message not found [%s %s]", class_getName(_class), sel_getName(sel));
        return;
    }

    const char *type(method_getTypeEncoding(method));

    bool direct(false);

    unsigned count;
    Method *methods(class_copyMethodList(_class, &count));
    for (unsigned i(0); i != count; ++i)
        if (methods[i] == method) {
            direct = true;
            break;
        }
    free(methods);

    IMP old(NULL);

    if (!direct) {
#if defined(__arm__)
        size_t length(11 * sizeof(uint32_t));
#elif defined(__i386__)
        size_t length(20);
#elif defined(__x86_64__)
        size_t length(50);
#endif

        uint32_t *buffer(reinterpret_cast<uint32_t *>(mmap(
            NULL, length, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0
        )));

        if (buffer == MAP_FAILED)
            MSLog(MSLogLevelError, "MS:Error:mmap() = %d", errno);
        else if (false) fail:
            munmap(buffer, length);
        else {
            Class super(class_getSuperclass(_class));

#if defined(__arm__)
            buffer[ 0] = A$stmdb_sp$_$rs$((1 << A$r0) | (1 << A$r1) | (1 << A$r2) | (1 << A$r3) | (1 << A$lr));
            buffer[ 1] = A$ldr_rd_$rn_im$(A$r0, A$pc, ( 8 - 1 - 2) * 4);
            buffer[ 2] = A$ldr_rd_$rn_im$(A$r1, A$pc, ( 9 - 2 - 2) * 4);
            buffer[ 3] = A$ldr_rd_$rn_im$(A$lr, A$pc, (10 - 3 - 2) * 4);
            buffer[ 4] = A$blx_rm(A$lr);
            buffer[ 5] = A$str_rd_$rn_im$(A$r0, A$sp, -4);
            buffer[ 6] = A$ldmia_sp$_$rs$((1 << A$r0) | (1 << A$r1) | (1 << A$r2) | (1 << A$r3) | (1 << A$lr));
            buffer[ 7] = A$ldr_rd_$rn_im$(A$pc, A$sp, -4 - (5 * 4));
            buffer[ 8] = reinterpret_cast<uint32_t>(super);
            buffer[ 9] = reinterpret_cast<uint32_t>(sel);
            buffer[10] = reinterpret_cast<uint32_t>(&class_getMethodImplementation);
#elif defined(__i386__)
            uint8_t *current(reinterpret_cast<uint8_t *>(buffer));

            MSPushPointer(current, sel);
            MSPushPointer(current, super);
            MSWriteCall(current, &class_getMethodImplementation);
            MSWriteAdd(current, I$rsp, 8);
            MSWriteJump(current, I$rax);
#elif defined(__x86_64__)
            uint8_t *current(reinterpret_cast<uint8_t *>(buffer));

            MSWritePush(current, I$rdi);
            MSWritePush(current, I$rsi);
            MSWritePush(current, I$rdx);

            MSWritePush(current, I$rcx);
            MSWritePush(current, I$r8);
            MSWritePush(current, I$r9);

            MSWriteSet64(current, I$rdi, super);
            MSWriteSet64(current, I$rsi, sel);

            MSWriteSet64(current, I$rax, &class_getMethodImplementation);
            MSWriteCall(current, I$rax);

            MSWritePop(current, I$r9);
            MSWritePop(current, I$r8);
            MSWritePop(current, I$rcx);

            MSWritePop(current, I$rdx);
            MSWritePop(current, I$rsi);
            MSWritePop(current, I$rdi);

            MSWriteJump(current, I$rax);
#endif

            if (mprotect(buffer, length, PROT_READ | PROT_EXEC) == -1) {
                MSLog(MSLogLevelError, "MS:Error:mprotect():%d", errno);
                goto fail;
            }

            old = reinterpret_cast<IMP>(buffer);

            if (MSDebug) {
                char name[16];
                sprintf(name, "%p", old);
                MSLogHex(buffer, length, name);
                MSLog(MSLogLevelNotice, "jmp %p(%p, %p)", &class_getMethodImplementation, super, sel);
            }
        }
    }

    if (old == NULL)
        old = method_getImplementation(method);

    if (result != NULL)
        *result = old;

    if (prefix != NULL) {
        const char *name(sel_getName(sel));
        size_t namelen(strlen(name));
        size_t fixlen(strlen(prefix));

        char *newname(reinterpret_cast<char *>(alloca(fixlen + namelen + 1)));
        memcpy(newname, prefix, fixlen);
        memcpy(newname + fixlen, name, namelen + 1);

        if (!class_addMethod(_class, sel_registerName(newname), old, type))
            MSLog(MSLogLevelError, "MS:Error: failed to rename [%s %s]", class_getName(_class), name);
    }

    if (direct)
        method_setImplementation(method, imp);
    else
        class_addMethod(_class, sel, imp, type);
}

_extern void MSHookMessageEx(Class _class, SEL sel, IMP imp, IMP *result) {
    MSHookMessageInternal(_class, sel, imp, result, NULL);
}

#ifdef __arm__
_extern IMP MSHookMessage(Class _class, SEL sel, IMP imp, const char *prefix) {
    IMP result(NULL);
    MSHookMessageInternal(_class, sel, imp, &result, prefix);
    return result;
}
#endif

#ifdef __arm__
_extern void _Z13MSHookMessageP10objc_classP13objc_selectorPFP11objc_objectS4_S2_zEPKc(Class _class, SEL sel, IMP imp, const char *prefix) {
    MSHookMessageInternal(_class, sel, imp, NULL, prefix);
}
#endif

{'repo_name': 'r-plus/substrate', 'stars': '281', 'repo_language': 'C++', 'file_name': 'manual.txt', 'mime_type': 'text/plain', 'hash': 3141467074402149717, 'source_dataset': 'data'}


package ecs

//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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// TaskSet is a nested struct in ecs response
type TaskSet struct {
	Task []Task `json:"Task" xml:"Task"`
}

{'repo_name': 'kubernetes-sigs/etcdadm', 'stars': '331', 'repo_language': 'Go', 'file_name': 'reset.go', 'mime_type': 'text/plain', 'hash': -4068328125241126901, 'source_dataset': 'data'}


//
//  LNPopupBar.m
//  LNPopupController
//
//  Created by Leo Natan on 7/24/15.
//  Copyright © 2015 Leo Natan. All rights reserved.
//

#import "LNPopupBar+Private.h"
#import "LNPopupCustomBarViewController+Private.h"
#import "MarqueeLabel.h"
#import "_LNPopupBase64Utils.h"

@interface _LNPopupToolbar : UIToolbar @end
@implementation _LNPopupToolbar

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
	UIView* rv = [super hitTest:point withEvent:event];

	if(rv != nil && rv != self)
	{
		CGRect frameInBarCoords = [self convertRect:rv.bounds fromView:rv];
		CGRect instetFrame = CGRectInset(frameInBarCoords, 2, 0);

		return CGRectContainsPoint(instetFrame, point) ? rv : self;
	}

	return rv;
}

- (void)layoutSubviews
{
	[super layoutSubviews];

	//On iOS 11 reset the semantic content attribute to make sure it propagades to all subviews.
	if(@available(iOS 11, *))
	{
		[self setSemanticContentAttribute:self.semanticContentAttribute];
	}
}

- (void)_deepSetSemanticContentAttribute:(UISemanticContentAttribute)semanticContentAttribute toView:(UIView*)view startingFromView:(UIView*)staringView;
{
	if(view == staringView)
	{
		[super setSemanticContentAttribute:semanticContentAttribute];
	}
	else
	{
		[view setSemanticContentAttribute:semanticContentAttribute];
	}

	[view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
		[self _deepSetSemanticContentAttribute:semanticContentAttribute toView:obj startingFromView:staringView];
	}];
}

- (void)setSemanticContentAttribute:(UISemanticContentAttribute)semanticContentAttribute
{
	if(@available(iOS 11, *))
	{
		//On iOS 11, due to a bug in UIKit, the semantic content attribute must be propagaded recursively to all subviews, so that the system behaves correctly.
		[self _deepSetSemanticContentAttribute:semanticContentAttribute toView:self startingFromView:self];
	}
	else
	{
		[super setSemanticContentAttribute:semanticContentAttribute];
	}
}

@end

@protocol __MarqueeLabelType <NSObject>

- (void)resetLabel;
- (void)unpauseLabel;
- (void)pauseLabel;
- (void)restartLabel;
- (BOOL)isPaused;

@end

@interface __FakeMarqueeLabel : UILabel <__MarqueeLabelType> @end
@implementation __FakeMarqueeLabel

- (void)resetLabel {}
- (void)unpauseLabel {}
- (void)pauseLabel {}
- (void)restartLabel {}
- (BOOL)isPaused { return NO; }

@end

@interface MarqueeLabel () <__MarqueeLabelType> @end

const CGFloat LNPopupBarHeightCompact = 40.0;
const CGFloat LNPopupBarHeightProminent = 64.0;
const CGFloat LNPopupBarProminentImageWidth = 48.0;

const NSInteger LNBackgroundStyleInherit = -1;

@implementation LNPopupBar
{
	LNPopupBarStyle _resolvedStyle;

	UIVisualEffectView* _backgroundView;
	BOOL _delaysBarButtonItemLayout;
	UIView* _titlesView;
	UILabel<__MarqueeLabelType>* _titleLabel;
	UILabel<__MarqueeLabelType>* _subtitleLabel;
	BOOL _needsLabelsLayout;

	UIColor* _userTintColor;
	UIColor* _userBackgroundColor;

	UIBlurEffectStyle _actualBackgroundStyle;
	UIBlurEffect* _customBlurEffect;

	UIView* _shadowView;

    NSArray<__kindof NSLayoutConstraint *> * _progressViewVerticalConstraints;
}

static inline __attribute__((always_inline)) LNPopupBarProgressViewStyle _LNPopupResolveProgressViewStyleFromProgressViewStyle(LNPopupBarProgressViewStyle style)
{
	LNPopupBarProgressViewStyle rv = style;
	if(rv == LNPopupBarProgressViewStyleDefault)
	{
		rv = [[NSProcessInfo processInfo] operatingSystemVersion].majorVersion > 9 ? LNPopupBarProgressViewStyleNone : LNPopupBarProgressViewStyleBottom;
	}
	return rv;
}

static inline __attribute__((always_inline)) UIBlurEffectStyle _LNBlurEffectStyleForSystemBarStyle(UIBarStyle systemBarStyle, LNPopupBarStyle barStyle)
{
	return systemBarStyle == UIBarStyleBlack ? UIBlurEffectStyleDark : barStyle == LNPopupBarStyleCompact ? UIBlurEffectStyleExtraLight : UIBlurEffectStyleLight;
}

@synthesize backgroundStyle = _userBackgroundStyle, barTintColor = _userBarTintColor;

- (void)setHidden:(BOOL)hidden
{
	[super setHidden:hidden];
}

- (void)setBarStyle:(LNPopupBarStyle)barStyle
{
	if(_customBarViewController == nil && barStyle == LNPopupBarStyleCustom)
	{
		barStyle = LNPopupBarStyleDefault;
	}

	if(_barStyle != barStyle)
	{
		_barStyle = barStyle;

		_resolvedStyle = _LNPopupResolveBarStyleFromBarStyle(_barStyle);

		[self _layoutBarButtonItems];
		_needsLabelsLayout = YES;
		[self setNeedsLayout];

		[self._barDelegate _popupBarStyleDidChange:self];
	}
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
	id block = ^ { self.highlightView.alpha = highlighted ? 1.0 : 0.0; };

	if(animated)
	{
		[UIView animateWithDuration:0.2 animations:block];
	}
	else
	{
		[UIView performWithoutAnimation:block];
	}
}

- (nonnull instancetype)initWithFrame:(CGRect)frame
{
	self = [super initWithFrame:frame];

	if(self)
	{
		self.preservesSuperviewLayoutMargins = YES;

		_inheritsVisualStyleFromDockingView = YES;

		_userBackgroundStyle = LNBackgroundStyleInherit;

		_translucent = YES;

		_backgroundView = [[UIVisualEffectView alloc] initWithEffect:nil];
		_backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
		_backgroundView.userInteractionEnabled = NO;
		[self addSubview:_backgroundView];

		_resolvedStyle = _LNPopupResolveBarStyleFromBarStyle(_barStyle);

		[self _innerSetBackgroundStyle:LNBackgroundStyleInherit];

		_toolbar = [[_LNPopupToolbar alloc] initWithFrame:self.bounds];
		[_toolbar setBackgroundImage:[UIImage alloc] forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
		_toolbar.autoresizingMask = UIViewAutoresizingNone;
		_toolbar.layer.masksToBounds = YES;

		[self addSubview:_toolbar];

		_titlesView = [[UIView alloc] initWithFrame:self.bounds];
		_titlesView.autoresizingMask = UIViewAutoresizingNone;
		_titlesView.accessibilityTraits = UIAccessibilityTraitButton;
		_titlesView.isAccessibilityElement = YES;

		_backgroundView.accessibilityTraits = UIAccessibilityTraitButton;
		_backgroundView.accessibilityIdentifier = @"PopupBarView";

		[self _setNeedsTitleLayout];
		[_toolbar addSubview:_titlesView];

		_progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
		_progressView.translatesAutoresizingMaskIntoConstraints = NO;
		_progressView.trackImage = [UIImage alloc];
		[_toolbar addSubview:_progressView];
		[self _updateProgressViewWithStyle:self.progressViewStyle];

		[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_progressView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_progressView)]];

		_needsLabelsLayout = YES;

		_imageView = [UIImageView new];
		_imageView.autoresizingMask = UIViewAutoresizingNone;
		_imageView.contentMode = UIViewContentModeScaleAspectFit;
		_imageView.accessibilityTraits = UIAccessibilityTraitImage;
		_imageView.isAccessibilityElement = YES;
		_imageView.layer.cornerRadius = 3;
		_imageView.layer.masksToBounds = YES;
        if (@available(iOS 11, *)) {
            // support smart invert and therefore do not invert image view colors
            _imageView.accessibilityIgnoresInvertColors = YES;
        }

		[_toolbar addSubview:_imageView];

		_shadowView = [UIView new];
		_shadowView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
		[_backgroundView.contentView addSubview:_shadowView];

		_highlightView = [[UIView alloc] initWithFrame:self.bounds];
		_highlightView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
		_highlightView.userInteractionEnabled = NO;
		[_highlightView setBackgroundColor:[[UIColor blackColor] colorWithAlphaComponent:0.1]];
		_highlightView.alpha = 0.0;
		[self addSubview:_highlightView];

		_marqueeScrollEnabled = [NSProcessInfo processInfo].operatingSystemVersion.majorVersion < 10;
		_coordinateMarqueeScroll = YES;

		self.semanticContentAttribute = UISemanticContentAttributeUnspecified;
		self.barItemsSemanticContentAttribute = UISemanticContentAttributePlayback;

		self.isAccessibilityElement = NO;
		self.clipsToBounds = YES;
	}

	return self;
}

- (void)_updateProgressViewWithStyle:(LNPopupBarProgressViewStyle)style
{
	style = _LNPopupResolveProgressViewStyleFromProgressViewStyle(style);

	[_progressView setHidden:style == LNPopupBarProgressViewStyleNone];

    if(style == LNPopupBarProgressViewStyleTop)
    {
        _progressViewVerticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_progressView(1.5)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_progressView)];
    }
    else
	{
        _progressViewVerticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[_progressView(1.5)]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_progressView)];
    }
    [self addConstraints:_progressViewVerticalConstraints];
}

- (void)layoutSubviews
{
	[super layoutSubviews];

	[_backgroundView setFrame:self.bounds];

	[self _layoutImageView];

	[UIView performWithoutAnimation:^{
		_toolbar.frame = CGRectMake(0, 0, self.bounds.size.width, _LNPopupBarHeightForBarStyle(_resolvedStyle, _customBarViewController));
		[_toolbar layoutIfNeeded];

		[self bringSubviewToFront:_highlightView];
		[self bringSubviewToFront:_toolbar];
		//	[_toolbar bringSubviewToFront:_imageView];
		//	[_toolbar bringSubviewToFront:_titlesView];
		[self bringSubviewToFront:_shadowView];

		_shadowView.frame = CGRectMake(0, 0, self.toolbar.bounds.size.width, 1 / self.window.screen.scale);

		[self _layoutTitles];
	}];
}

- (UIBlurEffectStyle)backgroundStyle
{
	return _userBackgroundStyle;
}

- (void)_innerSetBackgroundStyle:(UIBlurEffectStyle)backgroundStyle
{
	_userBackgroundStyle = backgroundStyle;

	_actualBackgroundStyle = _userBackgroundStyle == LNBackgroundStyleInherit ? _LNBlurEffectStyleForSystemBarStyle(_systemBarStyle, _resolvedStyle) : _userBackgroundStyle;

	_customBlurEffect = [UIBlurEffect effectWithStyle:_actualBackgroundStyle];

	[_backgroundView setValue:_customBlurEffect forKey:@"effect"];

	if(_userBackgroundStyle == LNBackgroundStyleInherit)
	{
		if(_actualBackgroundStyle == UIBlurEffectStyleDark)
		{
			_backgroundView.backgroundColor = [UIColor clearColor];
		}
		else if(_actualBackgroundStyle == UIBlurEffectStyleLight)
		{
			_backgroundView.backgroundColor = [UIColor colorWithWhite:230.0 / 255.0 alpha:_resolvedStyle == LNPopupBarStyleProminent ? 0.5 : 0.0];
		}
	}

	//Recalculate bar tint color
	[self _internalSetBarTintColor:_userBarTintColor];

	//Recalculate labels
	[self _setTitleLableFontsAccordingToBarStyleAndTint];
}

- (void)setBackgroundStyle:(UIBlurEffectStyle)backgroundStyle
{
	[self _innerSetBackgroundStyle:backgroundStyle];
}

- (UIColor *)tintColor
{
	return _userTintColor;
}

- (void)setTintColor:(UIColor *)tintColor
{
	_userTintColor = tintColor;

	[super setTintColor:_userTintColor ?: _systemTintColor];
}

- (UIColor*)barTintColor
{
	return _userBarTintColor;
}

- (void)_internalSetBarTintColor:(UIColor*)barTintColor
{
	_userBarTintColor = barTintColor;

	UIColor* colorToUse = [_userBarTintColor ?: _systemBarTintColor colorWithAlphaComponent:0.67];

	if(_translucent == NO)
	{
		colorToUse = colorToUse ? [colorToUse colorWithAlphaComponent:1.0] : (_actualBackgroundStyle == UIBlurEffectStyleLight || _actualBackgroundStyle == UIBlurEffectStyleExtraLight) ? [UIColor whiteColor] : [UIColor blackColor];
	}

	self.backgroundColor = colorToUse;
}

- (void)setBarTintColor:(UIColor *)barTintColor
{
	[self _internalSetBarTintColor:barTintColor];
}

- (UIColor *)backgroundColor
{
	return _userBackgroundColor;
}

- (void)_internalSetBackgroundColor:(UIColor *)backgroundColor
{
	_userBackgroundColor = backgroundColor;

	[super setBackgroundColor:_userBackgroundColor ?: _systemBackgroundColor];
}

- (void)setBackgroundColor:(UIColor *)backgroundColor
{
	[self _internalSetBackgroundColor:backgroundColor];
}

- (void)setTitleTextAttributes:(NSDictionary<NSString *,id> *)titleTextAttributes
{
	_titleTextAttributes = titleTextAttributes;
}

- (void)setSubtitleTextAttributes:(NSDictionary<NSString *,id> *)subtitleTextAttributes
{
	_subtitleTextAttributes = subtitleTextAttributes;
}

- (void)setSystemBackgroundColor:(UIColor *)systemBackgroundColor
{
	_systemBackgroundColor = systemBackgroundColor;

	[self _internalSetBackgroundColor:_userBackgroundColor];
}

- (void)setSystemBarStyle:(UIBarStyle)systemBarStyle
{
	_systemBarStyle = systemBarStyle;

	[self _innerSetBackgroundStyle:_userBackgroundStyle];
}

- (void)setProgressViewStyle:(LNPopupBarProgressViewStyle)progressViewStyle
{
	if(_progressViewStyle != progressViewStyle)
	{
		[self removeConstraints:_progressViewVerticalConstraints];
		[self _updateProgressViewWithStyle:progressViewStyle];
	}

	_progressViewStyle = progressViewStyle;
}

- (void)setSystemBarTintColor:(UIColor *)systemBarTintColor
{
	_systemBarTintColor = systemBarTintColor;

	[self _internalSetBarTintColor:_userBarTintColor];
}

- (void)setSystemTintColor:(UIColor *)systemTintColor
{
	_systemTintColor = systemTintColor;

	[self setTintColor:_userTintColor];
}

- (void)setSystemShadowColor:(UIColor *)systemShadowColor
{
	_systemShadowColor = systemShadowColor;

	_shadowView.backgroundColor = systemShadowColor;
}

- (void)setTranslucent:(BOOL)translucent
{
	_translucent = translucent;

	_backgroundView.hidden = _translucent == NO;

	[self _internalSetBarTintColor:_userBarTintColor];
}

- (void)setTitle:(NSString *)title
{
	_title = [title copy];

	if(_coordinateMarqueeScroll)
	{
		[self _setNeedsTitleLayout];
	}
	else
	{
		_titleLabel.text = _title;
	}
}

- (void)setSubtitle:(NSString *)subtitle
{
	_subtitle = [subtitle copy];

	if(_coordinateMarqueeScroll)
	{
		[self _setNeedsTitleLayout];
	}
	else
	{
		_subtitleLabel.text = _subtitle;
	}
}

- (void)setImage:(UIImage *)image
{
	_image = image;

	[self _layoutImageView];
}

- (void)setAccessibilityCenterHint:(NSString *)accessibilityCenterHint
{
	_accessibilityCenterHint = accessibilityCenterHint;

	[self _updateAccessibility];
}

- (void)setAccessibilityCenterLabel:(NSString *)accessibilityCenterLabel
{
	_accessibilityCenterLabel = accessibilityCenterLabel;

	[self _updateAccessibility];
}

- (void)setAccessibilityImageLabel:(NSString *)accessibilityImageLabel
{
	_accessibilityImageLabel = accessibilityImageLabel;

	_imageView.accessibilityLabel = accessibilityImageLabel;
}

- (void)setAccessibilityProgressLabel:(NSString *)accessibilityProgressLabel
{
	_accessibilityProgressLabel = accessibilityProgressLabel;

	_progressView.accessibilityLabel = accessibilityProgressLabel;
}

- (void)setAccessibilityProgressValue:(NSString *)accessibilityProgressValue
{
	_accessibilityProgressValue = accessibilityProgressValue;

	_progressView.accessibilityValue = accessibilityProgressValue;
}

- (void)setSemanticContentAttribute:(UISemanticContentAttribute)semanticContentAttribute
{
	[super setSemanticContentAttribute:semanticContentAttribute];
	_toolbar.semanticContentAttribute = semanticContentAttribute;

	[self setNeedsLayout];

	//On iOS 10 and below, there is a bug when setting a UIToolbar's semanticContentAttribute which may cause incorrect layout. So lets trigger
	if(NSProcessInfo.processInfo.operatingSystemVersion.majorVersion <= 10)
	{
		dispatch_async(dispatch_get_main_queue(), ^{
			[_toolbar setNeedsLayout];
			[_toolbar layoutIfNeeded];
		});
	}
}

- (void)setBarItemsSemanticContentAttribute:(UISemanticContentAttribute)barItemsSemanticContentAttribute
{
	_barItemsSemanticContentAttribute = barItemsSemanticContentAttribute;

	[self _layoutBarButtonItems];

	[self setNeedsLayout];
}

- (UILabel<__MarqueeLabelType>*)_newMarqueeLabel
{
	if(_marqueeScrollEnabled == NO)
	{
		__FakeMarqueeLabel* rv = [[__FakeMarqueeLabel alloc] initWithFrame:_titlesView.bounds];
		rv.minimumScaleFactor = 1.0;
		rv.lineBreakMode = NSLineBreakByTruncatingTail;
		return rv;
	}

	MarqueeLabel* rv = [[MarqueeLabel alloc] initWithFrame:_titlesView.bounds rate:20 andFadeLength:10];
	rv.leadingBuffer = 0.0;
	rv.trailingBuffer = 20.0;
	rv.animationDelay = 2.0;
	rv.marqueeType = MLContinuous;
	return rv;
}

- (UIView*)_viewForBarButtonItem:(UIBarButtonItem*)barButtonItem
{
	UIView* itemView = [barButtonItem valueForKey:@"view"];
	//_UITAMICAdaptorView
	if([itemView.superview isKindOfClass:NSClassFromString(_LNPopupDecodeBase64String(@"X1VJVEFNSUNBZGFwdG9yVmlldw=="))])
	{
		itemView = itemView.superview;
	}

//	itemView.backgroundColor = UIColor.greenColor;

	return itemView;
}

- (void)_getLeftmostView:(UIView* __strong *)leftmostView rightmostView:(UIView* __strong *)rightmostView fromBarButtonItems:(NSArray<UIBarButtonItem*>*)barButtonItems
{
	[barButtonItems enumerateObjectsUsingBlock:^(UIBarButtonItem * _Nonnull barButtonItem, NSUInteger idx, BOOL * _Nonnull stop) {
		UIView* itemView = [self _viewForBarButtonItem:barButtonItem];

		if(itemView == nil)
		{
			return;
		}

		*leftmostView = *leftmostView == nil ? itemView : itemView.frame.origin.x < (*leftmostView).frame.origin.x ? itemView : *leftmostView;
		*rightmostView = *rightmostView == nil ? itemView : itemView.frame.origin.x > (*rightmostView).frame.origin.x ? itemView : *rightmostView;
	}];
}

- (void)_updateTitleInsetsForCompactBar:(UIEdgeInsets*)titleInsets
{
	UIUserInterfaceLayoutDirection layoutDirection = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute];

	UIView* leftmostViewLeft;
	UIView* rightmostViewLeft;

	UIView* leftmostViewRight;
	UIView* rightmostViewRight;

	if(layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight)
	{
		[self _getLeftmostView:&leftmostViewLeft rightmostView:&rightmostViewLeft fromBarButtonItems:self.leftBarButtonItems];
		[self _getLeftmostView:&leftmostViewRight rightmostView:&rightmostViewRight fromBarButtonItems:self.rightBarButtonItems];
	}
	else
	{
		[self _getLeftmostView:&rightmostViewLeft rightmostView:&leftmostViewLeft fromBarButtonItems:self.leftBarButtonItems];
		[self _getLeftmostView:&rightmostViewRight rightmostView:&leftmostViewRight fromBarButtonItems:self.rightBarButtonItems];
	}

	if(@available(iOS 11, *))
	{
		[leftmostViewLeft.superview layoutIfNeeded];
		[rightmostViewLeft.superview layoutIfNeeded];
		[leftmostViewRight.superview layoutIfNeeded];
		[rightmostViewRight.superview layoutIfNeeded];
	}

	CGRect rightmostViewLeftFrame = CGRectZero;
	if(rightmostViewLeft != nil)
	{
		rightmostViewLeftFrame = [self convertRect:rightmostViewLeft.bounds fromView:rightmostViewLeft];
	}

	CGRect leftmostViewRightFrame = CGRectMake(self.bounds.size.width, 0, 0, 0);
	if(leftmostViewRight != nil)
	{
		leftmostViewRightFrame = [self convertRect:leftmostViewRight.bounds fromView:leftmostViewRight];
	}

	CGFloat widthLeft = 0;
	CGFloat widthRight = 0;

	if(layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight)
	{
		widthLeft = rightmostViewLeftFrame.origin.x + rightmostViewLeftFrame.size.width;
		widthRight = self.bounds.size.width - leftmostViewRightFrame.origin.x;
	}
	else
	{
		widthRight = leftmostViewRightFrame.origin.x + leftmostViewRightFrame.size.width;
		widthLeft = self.bounds.size.width - rightmostViewLeftFrame.origin.x;
	}

	if(NSProcessInfo.processInfo.operatingSystemVersion.majorVersion < 11)
	{
		widthLeft += 8;
		widthRight += 8;
	}

	widthLeft = MAX(widthLeft, self.layoutMargins.left);
	widthRight = MAX(widthRight, self.layoutMargins.right);

	//The added padding is for iOS 10 and below, or for certain conditions where iOS 11 won't put its own padding
	titleInsets->left = widthLeft;
	titleInsets->right = widthRight;
}

- (void)_updateTitleInsetsForProminentBar:(UIEdgeInsets*)titleInsets
{
	UIUserInterfaceLayoutDirection layoutDirection = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute];

	UIView* leftmostView;
	UIView* rightmostView;

	NSMutableArray* allItems = [NSMutableArray new];
	[allItems addObjectsFromArray:self.leftBarButtonItems];
	[allItems addObjectsFromArray:self.rightBarButtonItems];

	if(layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight)
	{
		[self _getLeftmostView:&leftmostView rightmostView:&rightmostView fromBarButtonItems:allItems];
	}
	else
	{
		[self _getLeftmostView:&rightmostView rightmostView:&leftmostView fromBarButtonItems:allItems];
	}

	if(@available(iOS 11, *))
	{
		[leftmostView.superview layoutIfNeeded];
		[rightmostView.superview layoutIfNeeded];
	}

	CGRect leftmostViewFrame = CGRectMake(self.bounds.size.width, 0, 0, 0);
	if(leftmostView != nil)
	{
		leftmostViewFrame = [self convertRect:leftmostView.bounds fromView:leftmostView];
	}

	CGFloat width;
	if(layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight)
	{
		width = self.bounds.size.width - leftmostViewFrame.origin.x;
	}
	else
	{
		width = leftmostViewFrame.origin.x + leftmostViewFrame.size.width;
	}

	width = MAX(width, self.layoutMargins.right);

	titleInsets->right += width;
}

- (void)_layoutTitles
{
	UIUserInterfaceLayoutDirection layoutDirection = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute];
	UIEdgeInsets titleInsets = UIEdgeInsetsZero;

	CGFloat imageLeading;

	if(layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight)
	{
		imageLeading = self.layoutMargins.left;
		if (@available(iOS 11.0, *)) {
			imageLeading = MAX(self.window.safeAreaInsets.left, imageLeading);
		}
	}
	else
	{
		imageLeading = self.layoutMargins.right;
		if (@available(iOS 11.0, *)) {
			imageLeading = MAX(self.window.safeAreaInsets.right, imageLeading);
		}
	}

	if(_resolvedStyle == LNPopupBarStyleProminent)
	{
		titleInsets.left = _imageView.hidden ? 0 : imageLeading + _imageView.frame.size.width + 17.5;

		[self _updateTitleInsetsForProminentBar:&titleInsets];
	}
	else
	{
		[self _updateTitleInsetsForCompactBar:&titleInsets];
	}

	titleInsets.left = MAX(titleInsets.left, self.layoutMargins.left);
	titleInsets.right = MAX(titleInsets.right, self.layoutMargins.right);

	CGRect frame = _titlesView.frame;
	frame.size.width = self.bounds.size.width - titleInsets.left - titleInsets.right;
	frame.size.height = self.bounds.size.height;
	frame.origin.x = layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight ? titleInsets.left : titleInsets.right;

	_titlesView.frame = frame;

	if(_needsLabelsLayout == YES)
	{
		if(_titleLabel == nil)
		{
			_titleLabel = [self _newMarqueeLabel];
			_titleLabel.font = _resolvedStyle == LNPopupBarStyleProminent ? [UIFont systemFontOfSize:18 weight:UIFontWeightRegular] : [UIFont systemFontOfSize:12];
			[_titlesView addSubview:_titleLabel];
		}

		BOOL reset = NO;

		if([_titleLabel.text isEqualToString:_title] == NO && _title != nil)
		{
			_titleLabel.attributedText = [[NSAttributedString alloc] initWithString:_title attributes:_titleTextAttributes];
			reset = YES;
		}

		if(_subtitleLabel == nil)
		{
			_subtitleLabel = [self _newMarqueeLabel];
			_subtitleLabel.font = _resolvedStyle == LNPopupBarStyleProminent ? [UIFont systemFontOfSize:14 weight:UIFontWeightRegular] : [UIFont systemFontOfSize:12];
			[_titlesView addSubview:_subtitleLabel];
		}

		if([_subtitleLabel.text isEqualToString:_subtitle] == NO && _subtitle != nil)
		{
			_subtitleLabel.attributedText = [[NSAttributedString alloc] initWithString:_subtitle attributes:_subtitleTextAttributes];
			reset = YES;
		}

		if(reset)
		{
			[_titleLabel resetLabel];
			[_subtitleLabel resetLabel];
		}
	}

	[self _setTitleLableFontsAccordingToBarStyleAndTint];

	CGRect titleLabelFrame = _titlesView.bounds;

	CGFloat barHeight = _LNPopupBarHeightForBarStyle(_resolvedStyle, _customBarViewController);
	titleLabelFrame.size.height = barHeight;
	if(_subtitle.length > 0)
	{
		CGRect subtitleLabelFrame = _titlesView.bounds;
		subtitleLabelFrame.size.height = barHeight;

		if(_resolvedStyle == LNPopupBarStyleProminent)
		{
			titleLabelFrame.origin.y -= _titleLabel.font.lineHeight / 2.1;
			subtitleLabelFrame.origin.y += _subtitleLabel.font.lineHeight / 1.5;
		}
		else
		{
			titleLabelFrame.origin.y -= _titleLabel.font.lineHeight / 2;
			subtitleLabelFrame.origin.y += _subtitleLabel.font.lineHeight / 2;
		}

		_subtitleLabel.frame = subtitleLabelFrame;
		_subtitleLabel.hidden = NO;

		if(_needsLabelsLayout == YES)
		{
			if([_subtitleLabel isPaused] && [_titleLabel isPaused] == NO)
			{
				[_subtitleLabel unpauseLabel];
			}
		}
	}
	else
	{
		if(_needsLabelsLayout == YES)
		{
			[_subtitleLabel resetLabel];
			[_subtitleLabel pauseLabel];
			_subtitleLabel.hidden = YES;
		}
	}

	[self _updateAccessibility];

	_titleLabel.frame = titleLabelFrame;

	_needsLabelsLayout = NO;
}

- (void)_updateAccessibility
{
	if(_accessibilityCenterLabel.length > 0)
	{
		_titlesView.accessibilityLabel = _accessibilityCenterLabel;
	}
	else
	{
		NSMutableString* accessibilityLabel = [NSMutableString new];
		if(_title.length > 0)
		{
			[accessibilityLabel appendString:_title];
			[accessibilityLabel appendString:@"\n"];
		}
		if(_subtitle.length > 0)
		{
			[accessibilityLabel appendString:_subtitle];
		}
		_titlesView.accessibilityLabel = accessibilityLabel;
	}

	if(_accessibilityCenterHint.length > 0)
	{
		_titlesView.accessibilityHint = _accessibilityCenterHint;
	}
	else
	{
		_titlesView.accessibilityHint = NSLocalizedString(@"Double tap to open.", @"");
	}
}

- (void)_setNeedsTitleLayout
{
	_needsLabelsLayout = YES;

	UIView* l1 = _titleLabel;
	UIView* l2 = _subtitleLabel;

	_titleLabel = nil;
	_subtitleLabel = nil;

	[l1 removeFromSuperview];
	[l2 removeFromSuperview];

	[self setNeedsLayout];
}

- (void)_layoutImageView
{
	BOOL previouslyHidden = _imageView.hidden;

	if(_resolvedStyle == LNPopupBarStyleCompact)
	{
		_imageView.hidden = YES;

		return;
	}

	_imageView.image = _image;
	_imageView.hidden = _image == nil;

	UIUserInterfaceLayoutDirection layoutDirection = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute];

	if(layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight)
	{
		CGFloat safeLeading = self.layoutMargins.left;
		if (@available(iOS 11.0, *)) {
			safeLeading = MAX(self.window.safeAreaInsets.left, safeLeading);
		}

		_imageView.center = CGPointMake(safeLeading + LNPopupBarProminentImageWidth / 2, LNPopupBarHeightProminent / 2);
	}
	else
	{
		CGFloat safeLeading = self.layoutMargins.right;
		if (@available(iOS 11.0, *)) {
			safeLeading = MAX(self.window.safeAreaInsets.right, safeLeading);
		}

		_imageView.center = CGPointMake(self.bounds.size.width - safeLeading - LNPopupBarProminentImageWidth / 2, LNPopupBarHeightProminent / 2);
	}

	_imageView.bounds = CGRectMake(0, 0, LNPopupBarProminentImageWidth, LNPopupBarProminentImageWidth);

	if(previouslyHidden != _imageView.hidden)
	{
		[self _setNeedsTitleLayout];
	}
}

- (void)_setTitleLableFontsAccordingToBarStyleAndTint
{
	if(_actualBackgroundStyle != UIBlurEffectStyleDark)
	{
		_titleLabel.textColor = _titleTextAttributes[NSForegroundColorAttributeName] ?: _resolvedStyle == LNPopupBarStyleProminent ? [UIColor colorWithWhite:(38.0 / 255.0) alpha:1.0] : [UIColor blackColor];
		_subtitleLabel.textColor = _subtitleTextAttributes[NSForegroundColorAttributeName] ?: _resolvedStyle == LNPopupBarStyleProminent ? [UIColor colorWithWhite:(38.0 / 255.0) alpha:1.0] : [UIColor darkGrayColor];
	}
	else
	{
		_titleLabel.textColor = _titleTextAttributes[NSForegroundColorAttributeName] ?: [UIColor whiteColor];
		_subtitleLabel.textColor = _subtitleTextAttributes[NSForegroundColorAttributeName] ?: [UIColor whiteColor];
	}
}

- (void)_setTitleViewMarqueesPaused:(BOOL)paused
{
	if(paused)
	{
		[_titleLabel restartLabel];
		[_titleLabel pauseLabel];
		[_subtitleLabel restartLabel];
		[_subtitleLabel pauseLabel];
	}
	else
	{
		[_titleLabel unpauseLabel];
		if(_subtitle.length > 0)
		{
			[_subtitleLabel unpauseLabel];

		}
	}
}

- (void)_delayBarButtonLayout
{
	_delaysBarButtonItemLayout = YES;
}

- (void)_layoutBarButtonItems
{
	if(self.leftBarButtonItems.count + self.rightBarButtonItems.count == 0)
	{
		return;
	}

	UIUserInterfaceLayoutDirection barItemsLayoutDirection = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:_barItemsSemanticContentAttribute];
	UIUserInterfaceLayoutDirection layoutDirection = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute];

	BOOL normalButtonsOrder = layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight || barItemsLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;

	NSEnumerationOptions enumerationOptions = normalButtonsOrder ? 0 : NSEnumerationReverse;

	LNPopupBarStyle resolvedStyle = _LNPopupResolveBarStyleFromBarStyle(_barStyle);

	NSMutableArray* items = [NSMutableArray new];

	UIBarButtonItem* flexibleSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL];
	flexibleSpacer.tag = 666;
	if(resolvedStyle == LNPopupBarStyleProminent || resolvedStyle == LNPopupBarStyleCustom)
	{
		[items addObject:flexibleSpacer];
	}

	[self.leftBarButtonItems enumerateObjectsWithOptions:enumerationOptions usingBlock:^(UIBarButtonItem * _Nonnull barButtonItem, NSUInteger idx, BOOL * _Nonnull stop) {
		[items addObject:barButtonItem];
	}];

	if(resolvedStyle == LNPopupBarStyleCompact)
	{
		[items addObject:flexibleSpacer];
	}

	[self.rightBarButtonItems enumerateObjectsWithOptions:enumerationOptions usingBlock:^(UIBarButtonItem * _Nonnull barButtonItem, NSUInteger idx, BOOL * _Nonnull stop) {
		[items addObject:barButtonItem];
	}];

	UIBarButtonItem* fixedSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:NULL];
	fixedSpacer.width = _resolvedStyle == LNPopupBarStyleProminent ? 2 : -2;
	[items addObject:fixedSpacer];

	[_toolbar setItems:items animated:YES];

	[self _setNeedsTitleLayout];

	_delaysBarButtonItemLayout = NO;
}

- (void)_updateViewsAfterCustomBarViewControllerUpdate
{
	BOOL hide = _customBarViewController != nil;
	_toolbar.hidden = hide;
	_titlesView.hidden = hide;
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
{
	if([keyPath isEqualToString:@"preferredContentSize"] == YES && object == _customBarViewController)
	{
		[self._barDelegate _popupBarStyleDidChange:self];
	}
}

- (void)setCustomBarViewController:(LNPopupCustomBarViewController*)customBarViewController
{
	if(_customBarViewController != customBarViewController)
	{
		if (customBarViewController.containingPopupBar)
		{
			//Cleanly move the custom bar view controller from the previos popup bar.
			customBarViewController.containingPopupBar.customBarViewController = nil;
		}

		_customBarViewController.containingPopupBar = nil;
		[_customBarViewController.view removeFromSuperview];
		[_customBarViewController removeObserver:self forKeyPath:@"preferredContentSize"];

		_customBarViewController = customBarViewController;
		_customBarViewController.containingPopupBar = self;
		[_customBarViewController addObserver:self forKeyPath:@"preferredContentSize" options:NSKeyValueObservingOptionNew context:NULL];

		_customBarViewController.view.translatesAutoresizingMaskIntoConstraints = NO;
		[self addSubview:_customBarViewController.view];
		[NSLayoutConstraint activateConstraints:@[[self.topAnchor constraintEqualToAnchor:_customBarViewController.view.topAnchor],
												  [self.leftAnchor constraintEqualToAnchor:_customBarViewController.view.leftAnchor],
												  [self.rightAnchor constraintEqualToAnchor:_customBarViewController.view.rightAnchor],
												  [self.bottomAnchor constraintEqualToAnchor:_customBarViewController.view.bottomAnchor]]];

		[self _updateViewsAfterCustomBarViewControllerUpdate];

		[self setBarStyle:LNPopupBarStyleCustom];
	}
}

- (void)setLeftBarButtonItems:(NSArray *)leftBarButtonItems
{
	_leftBarButtonItems = [leftBarButtonItems copy];

	if(_delaysBarButtonItemLayout == NO)
	{
		[self _layoutBarButtonItems];
	}
}

- (void)setRightBarButtonItems:(NSArray *)rightBarButtonItems
{
	_rightBarButtonItems = [rightBarButtonItems copy];

	if(_delaysBarButtonItemLayout == NO)
	{
		[self _layoutBarButtonItems];
	}
}

- (void)setMarqueeScrollEnabled:(BOOL)marqueeScrollEnabled
{
	_marqueeScrollEnabled = marqueeScrollEnabled;

	[self _setNeedsTitleLayout];
}

- (void)_removeAnimationFromBarItems
{
	[_toolbar.items enumerateObjectsUsingBlock:^(UIBarButtonItem* barButtonItem, NSUInteger idx, BOOL* stop)
	 {
		 UIView* itemView = [barButtonItem valueForKey:@"view"];
		 [itemView.layer removeAllAnimations];
	 }];
}

- (void)dealloc
{
	[_customBarViewController removeObserver:self forKeyPath:@"preferredContentSize"];
}

@end

{'repo_name': 'yarodevuci/Muzonchik', 'stars': '167', 'repo_language': 'Swift', 'file_name': 'Main.storyboard', 'mime_type': 'text/xml', 'hash': -1491015576930259536, 'source_dataset': 'data'}


package com.awsmithson.tcx2nikeplus.nike;

import com.google.common.base.Preconditions;
import org.w3c.dom.Document;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class NikeActivityData {
	private final @Nonnull Document runXML;
	private final @Nullable Document gpxXML;

	public NikeActivityData(@Nonnull Document runXML, @Nullable Document gpxXML) {
		this.runXML = Preconditions.checkNotNull(runXML, "runXML argument is null.");
		this.gpxXML = gpxXML;
	}

	public @Nonnull Document getRunXML() {
		return runXML;
	}

	public @Nullable Document getGpxXML() {
		return gpxXML;
	}
}

{'repo_name': 'angusws/tcx2nikeplus', 'stars': '108', 'repo_language': 'Java', 'file_name': 'GarminDataTypeSlowTest.java', 'mime_type': 'text/x-java', 'hash': 4203837730734874148, 'source_dataset': 'data'}


// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package norm_test

import (
	"bytes"
	"fmt"
	"unicode/utf8"

	"golang.org/x/text/unicode/norm"
)

// EqualSimple uses a norm.Iter to compare two non-normalized
// strings for equivalence.
func EqualSimple(a, b string) bool {
	var ia, ib norm.Iter
	ia.InitString(norm.NFKD, a)
	ib.InitString(norm.NFKD, b)
	for !ia.Done() && !ib.Done() {
		if !bytes.Equal(ia.Next(), ib.Next()) {
			return false
		}
	}
	return ia.Done() && ib.Done()
}

// FindPrefix finds the longest common prefix of ASCII characters
// of a and b.
func FindPrefix(a, b string) int {
	i := 0
	for ; i < len(a) && i < len(b) && a[i] < utf8.RuneSelf && a[i] == b[i]; i++ {
	}
	return i
}

// EqualOpt is like EqualSimple, but optimizes the special
// case for ASCII characters.
func EqualOpt(a, b string) bool {
	n := FindPrefix(a, b)
	a, b = a[n:], b[n:]
	var ia, ib norm.Iter
	ia.InitString(norm.NFKD, a)
	ib.InitString(norm.NFKD, b)
	for !ia.Done() && !ib.Done() {
		if !bytes.Equal(ia.Next(), ib.Next()) {
			return false
		}
		if n := int64(FindPrefix(a[ia.Pos():], b[ib.Pos():])); n != 0 {
			ia.Seek(n, 1)
			ib.Seek(n, 1)
		}
	}
	return ia.Done() && ib.Done()
}

var compareTests = []struct{ a, b string }{
	{"aaa", "aaa"},
	{"aaa", "aab"},
	{"a\u0300a", "\u00E0a"},
	{"a\u0300\u0320b", "a\u0320\u0300b"},
	{"\u1E0A\u0323", "\x44\u0323\u0307"},
	// A character that decomposes into multiple segments
	// spans several iterations.
	{"\u3304", "\u30A4\u30CB\u30F3\u30AF\u3099"},
}

func ExampleIter() {
	for i, t := range compareTests {
		r0 := EqualSimple(t.a, t.b)
		r1 := EqualOpt(t.a, t.b)
		fmt.Printf("%d: %v %v\n", i, r0, r1)
	}
	// Output:
	// 0: true true
	// 1: false false
	// 2: true true
	// 3: true true
	// 4: true true
	// 5: true true
}

{'repo_name': 'blablacar/dgr', 'stars': '248', 'repo_language': 'Go', 'file_name': 'build', 'mime_type': 'text/plain', 'hash': -2591244343974459967, 'source_dataset': 'data'}


/*
 * Copyright (c) 2010-2020 Mark Allen, Norbert Bartels.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package com.restfb.types.ads;

import java.util.List;

import com.restfb.Facebook;

import lombok.Getter;
import lombok.Setter;

/**
 * Represents the AdReportRun
 * type
 */
public class AdReportRun extends BaseAdsObject {

  @Getter
  @Setter
  @Facebook("account_id")
  private String accountId;

  @Getter
  @Setter
  @Facebook("async_percent_completion")
  private Long asyncPercentCompletion;

  @Getter
  @Setter
  @Facebook("async_status")
  private String asyncStatus;

  @Getter
  @Setter
  @Facebook("date_start")
  private String dateStart;

  @Getter
  @Setter
  @Facebook("date_stop")
  private String dateStop;

  @Getter
  @Setter
  @Facebook
  private List<String> emails;

  @Getter
  @Setter
  @Facebook("friendly_name")
  private String friendlyName;

  @Getter
  @Setter
  @Facebook("is_bookmarked")
  private Boolean isBookmarked;

  @Getter
  @Setter
  @Facebook("is_running")
  private Boolean isRunning;

  @Getter
  @Setter
  @Facebook("schedule_id")
  private String scheduleId;

  @Getter
  @Setter
  @Facebook("time_completed")
  private Long timeCompleted;

  @Getter
  @Setter
  @Facebook("time_ref")
  private Long timeRef;

}

{'repo_name': 'restfb/restfb', 'stars': '645', 'repo_language': 'Java', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 7623744626081453568, 'source_dataset': 'data'}


# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")

licenses(["notice"])  # Apache 2

api_proto_package(
    deps = [
        "//envoy/api/v2/core:pkg",
        "//envoy/api/v2/route:pkg",
        "//envoy/type/matcher:pkg",
        "@com_github_cncf_udpa//udpa/annotations:pkg",
        "@com_google_googleapis//google/api/expr/v1alpha1:syntax_proto",
    ],
)

{'repo_name': 'envoyproxy/envoy-wasm', 'stars': '167', 'repo_language': 'C++', 'file_name': 'statusor.h', 'mime_type': 'text/x-c++', 'hash': -5271390844525357963, 'source_dataset': 'data'}


/*
 *  /MathJax/jax/output/HTML-CSS/fonts/TeX/Main/Regular/SpacingModLetters.js
 *
 *  Copyright (c) 2009-2015 The MathJax Consortium
 *
 *  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.
 */

MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.MathJax_Main,{730:[715,-542,500,147,352]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/Main/Regular/SpacingModLetters.js");

{'repo_name': 'jianzhongli/MathView', 'stars': '925', 'repo_language': 'Java', 'file_name': 'ApplicationTest.java', 'mime_type': 'text/html', 'hash': -846831621589759014, 'source_dataset': 'data'}


#!/bin/bash

SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)"
HEKETI_DIR="$(cd "$SCRIPT_DIR" && cd ../../.. && pwd)"
HEKETI_SERVER="./heketi-server"

cd "$SCRIPT_DIR" || exit 1

(cd "$HEKETI_DIR" && make) || exit 1

cp "$HEKETI_DIR/heketi" "$HEKETI_SERVER"

export PYTHONPATH="$PYTHONPATH:$HEKETI_DIR/client/api/python"

if [[ "$HEKETI_TEST_UPGRADE_VENV" != "no" ]]; then
    if ! command -v virtualenv &>/dev/null; then
        echo "WARNING: virtualenv not installed... skipping test" >&2
        exit 0
    fi

    rm -rf .env
    virtualenv .env
    . .env/bin/activate
    pip install -r "$HEKETI_DIR/client/api/python/requirements.txt"
fi
echo '----> Running test_upgrade.py'
exec python test_upgrade.py -v "$@"

{'repo_name': 'heketi/heketi', 'stars': '1019', 'repo_language': 'Go', 'file_name': 'profiling.go', 'mime_type': 'text/plain', 'hash': -5018919919157059874, 'source_dataset': 'data'}


// Test the functionDisplayName of SavedFrame instances.

function uno() { return dos(); }
const dos = () => tres.quattro();
const tres = {
  quattro: () => saveStack()
};

const frame = uno();

assertEq(frame.functionDisplayName, "tres.quattro");
assertEq(frame.parent.functionDisplayName, "dos");
assertEq(frame.parent.parent.functionDisplayName, "uno");
assertEq(frame.parent.parent.parent.functionDisplayName, null);

assertEq(frame.parent.parent.parent.parent, null);

{'repo_name': 'jxcore/jxcore', 'stars': '2265', 'repo_language': 'JavaScript', 'file_name': 'testencce.bat', 'mime_type': 'text/x-msdos-batch', 'hash': -4314958968349578862, 'source_dataset': 'data'}


" Vim syntax file
" Language: atto

if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

" keywords
syn keyword attoKeyword     fn nextgroup=attoFnName skipwhite
syn keyword attoKeyword     is
syn keyword attoCond        if
syn keyword attoBoolean		true false
syn keyword attoBuiltIn     __head __tail __fuse __pair
syn keyword attoBuiltIn     __litr __str __words __input __print
syn keyword attoBuiltIn     __eq __add __neg __mul __div __rem
syn keyword attoBuiltIn     __less __lesseq

" matches
syn match attoNumber        "\<\d\>" display
syn match attoNumber        "\<[1-9]\d\+\>" display
syn match attoFnName        "\%([^[:cntrl:][:space:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
syn match attoComment       "#\s\".*\""
syn match attoStringCont    "/\\\n\s*/" display contained

" regions
syn region  attoString start=+"+ end=+"+ contains=attoStringCont

" links
hi def link attoKeyword     Keyword
hi def link attoComment     Comment
hi def link attoFnName      Function
hi def link attoCond        Conditional
hi def link attoBoolean     Boolean
hi def link attoBuiltIn     Special
hi def link attoString      String
hi def link attoNumber      Number

let b:current_syntax = "atto"

{'repo_name': 'zesterer/atto', 'stars': '101', 'repo_language': 'Rust', 'file_name': 'atto.vim', 'mime_type': 'text/plain', 'hash': 695495464829656109, 'source_dataset': 'data'}


# -*- coding: utf-8 -*-
'''
Tencent is pleased to support the open source community by making FAutoTest available.
Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://opensource.org/licenses/BSD-3-Clause
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.

'''
import atexit
import sys

class VMShutDownHandler(object):
    """
    虚拟机正常关闭时的回调接口，一般做一些环境清理工作
    """

    def __init__(self):
        self._shutDownCallbacks = []

    def registerToVM(self):
        atexit.register(self._handleVMShutDown)

    def _handleVMShutDown(self):
        for func, args, kwargs in self._shutDownCallbacks:
            func(*args, **kwargs)

    def registerVMShutDownCallback(self, func, *args, **kwargs):
        self._shutDownCallbacks.append((func, args, kwargs))

class UncaughtExceptionHandler(object):
    """
    虚拟机发生异常退出时的回调接口，一般做一些环境清理工作
    """

    _callbacks = []

    @staticmethod
    def init():
        sys.excepthook = UncaughtExceptionHandler._handleUncaughtException

    @staticmethod
    def _handleUncaughtException(exctype, value, tb):
        for func in UncaughtExceptionHandler._callbacks:
            func(exctype, value, tb)
        raise Exception(exctype)

    @staticmethod
    def registerUncaughtExceptionCallback(func):
        UncaughtExceptionHandler._callbacks.append(func)

    @staticmethod
    def removeHook():
        sys.excepthook = None

if __name__ == "__main__":
    pass

{'repo_name': 'Tencent/FAutoTest', 'stars': '822', 'repo_language': 'Python', 'file_name': '__init__.py', 'mime_type': 'text/troff', 'hash': -2442884255381933174, 'source_dataset': 'data'}


browse_categories:
- Database
code: https://github.com/signalfx/collectd/blob/master/src/curl_json.c
description: Monitor Riak using this plugin by Tapjoy for the SignalFx collectd agent.
display_name: Riak
featured: true
logo_large: /images/repos/collectd-riak/img/integrations_riak%402x.png
logo_small: /images/repos/collectd-riak/img/integrations_riak.png
project_url: https://github.com/signalfx/integrations/tree/master/collectd-riak
useLegacyBuild: true

{'repo_name': 'signalfx/integrations', 'stars': '139', 'repo_language': 'Python', 'file_name': 'meta.yaml', 'mime_type': 'text/plain', 'hash': 8459117349674196071, 'source_dataset': 'data'}


CC = $(CROSS_COMPILE)gcc
BUILD_FLAGS = -DKTEST
CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
LDFLAGS += -lrt -lpthread

# these are all "safe" tests that don't modify
# system time or require escalated privledges
TEST_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \
	     inconsistency-check raw_skew threadtest rtctest

TEST_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex adjtick change_skew \
		      skew_consistency clocksource-switch leap-a-day \
		      leapcrash set-tai set-2038

bins = $(TEST_PROGS) $(TEST_PROGS_EXTENDED)

all: ${bins}

include ../lib.mk

# these tests require escalated privledges
# and may modify the system time or trigger
# other behavior like suspend
run_destructive_tests: run_tests
	./alarmtimer-suspend
	./valid-adjtimex
	./adjtick
	./change_skew
	./skew_consistency
	./clocksource-switch
	./leap-a-day -s -i 10
	./leapcrash
	./set-tai
	./set-2038

clean:
	rm -f ${bins}

{'repo_name': 'libos-nuse/net-next-nuse', 'stars': '238', 'repo_language': 'C', 'file_name': 'nf_tables_netdev.c', 'mime_type': 'text/x-c', 'hash': 31818707188468907, 'source_dataset': 'data'}


//  Copyright 2010 John Maddock

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

#ifndef BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP
#define BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP

#include <boost/type_traits/add_reference.hpp>

namespace boost{

template <class T> struct add_lvalue_reference
{
   typedef typename boost::add_reference<T>::type type;
};

#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <class T> struct add_lvalue_reference<T&&>
{
   typedef T& type;
};
#endif

#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)

   template <class T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;

#endif

}

#endif  // BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP

{'repo_name': 'alibaba/CicadaPlayer', 'stars': '198', 'repo_language': 'C++', 'file_name': 'seekTest.sh', 'mime_type': 'text/x-shellscript', 'hash': 1275683239232992672, 'source_dataset': 'data'}


/*=========================================================================*\
* Internet domain functions
* LuaSocket toolkit
\*=========================================================================*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "lua.h"
#include "lauxlib.h"
#include "compat.h"

#include "inet.h"

/*=========================================================================*\
* Internal function prototypes.
\*=========================================================================*/
static int inet_global_toip(lua_State *L);
static int inet_global_getaddrinfo(lua_State *L);
static int inet_global_tohostname(lua_State *L);
static int inet_global_getnameinfo(lua_State *L);
static void inet_pushresolved(lua_State *L, struct hostent *hp);
static int inet_global_gethostname(lua_State *L);

/* DNS functions */
static luaL_Reg func[] = {
    { "toip", inet_global_toip},
    { "getaddrinfo", inet_global_getaddrinfo},
    { "tohostname", inet_global_tohostname},
    { "getnameinfo", inet_global_getnameinfo},
    { "gethostname", inet_global_gethostname},
    { NULL, NULL}
};

/*=========================================================================*\
* Exported functions
\*=========================================================================*/
/*-------------------------------------------------------------------------*\
* Initializes module
\*-------------------------------------------------------------------------*/
int inet_open(lua_State *L)
{
    lua_pushstring(L, "dns");
    lua_newtable(L);
    luaL_setfuncs(L, func, 0);
    lua_settable(L, -3);
    return 0;
}

/*=========================================================================*\
* Global Lua functions
\*=========================================================================*/
/*-------------------------------------------------------------------------*\
* Returns all information provided by the resolver given a host name
* or ip address
\*-------------------------------------------------------------------------*/
static int inet_gethost(const char *address, struct hostent **hp) {
    struct in_addr addr;
    if (inet_aton(address, &addr))
        return socket_gethostbyaddr((char *) &addr, sizeof(addr), hp);
    else
        return socket_gethostbyname(address, hp);
}

/*-------------------------------------------------------------------------*\
* Returns all information provided by the resolver given a host name
* or ip address
\*-------------------------------------------------------------------------*/
static int inet_global_tohostname(lua_State *L) {
    const char *address = luaL_checkstring(L, 1);
    struct hostent *hp = NULL;
    int err = inet_gethost(address, &hp);
    if (err != IO_DONE) {
        lua_pushnil(L);
        lua_pushstring(L, socket_hoststrerror(err));
        return 2;
    }
    lua_pushstring(L, hp->h_name);
    inet_pushresolved(L, hp);
    return 2;
}

static int inet_global_getnameinfo(lua_State *L) {
    char hbuf[NI_MAXHOST];
    char sbuf[NI_MAXSERV];
    int i, ret;
    struct addrinfo hints;
    struct addrinfo *resolved, *iter;
    const char *host = luaL_optstring(L, 1, NULL);
    const char *serv = luaL_optstring(L, 2, NULL);

    if (!(host || serv))
        luaL_error(L, "host and serv cannot be both nil");

    memset(&hints, 0, sizeof(hints));
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_family = AF_UNSPEC;

    ret = getaddrinfo(host, serv, &hints, &resolved);
    if (ret != 0) {
        lua_pushnil(L);
        lua_pushstring(L, socket_gaistrerror(ret));
        return 2;
    }

    lua_newtable(L);
    for (i = 1, iter = resolved; iter; i++, iter = iter->ai_next) {
        getnameinfo(iter->ai_addr, (socklen_t) iter->ai_addrlen,
            hbuf, host? (socklen_t) sizeof(hbuf): 0,
            sbuf, serv? (socklen_t) sizeof(sbuf): 0, 0);
        if (host) {
            lua_pushnumber(L, i);
            lua_pushstring(L, hbuf);
            lua_settable(L, -3);
        }
    }
    freeaddrinfo(resolved);

    if (serv) {
        lua_pushstring(L, sbuf);
        return 2;
    } else {
        return 1;
    }
}

/*-------------------------------------------------------------------------*\
* Returns all information provided by the resolver given a host name
* or ip address
\*-------------------------------------------------------------------------*/
static int inet_global_toip(lua_State *L)
{
    const char *address = luaL_checkstring(L, 1);
    struct hostent *hp = NULL;
    int err = inet_gethost(address, &hp);
    if (err != IO_DONE) {
        lua_pushnil(L);
        lua_pushstring(L, socket_hoststrerror(err));
        return 2;
    }
    lua_pushstring(L, inet_ntoa(*((struct in_addr *) hp->h_addr)));
    inet_pushresolved(L, hp);
    return 2;
}

int inet_optfamily(lua_State* L, int narg, const char* def)
{
    static const char* optname[] = { "unspec", "inet", "inet6", NULL };
    static int optvalue[] = { AF_UNSPEC, AF_INET, AF_INET6, 0 };

    return optvalue[luaL_checkoption(L, narg, def, optname)];
}

int inet_optsocktype(lua_State* L, int narg, const char* def)
{
    static const char* optname[] = { "stream", "dgram", NULL };
    static int optvalue[] = { SOCK_STREAM, SOCK_DGRAM, 0 };

    return optvalue[luaL_checkoption(L, narg, def, optname)];
}

static int inet_global_getaddrinfo(lua_State *L)
{
    const char *hostname = luaL_checkstring(L, 1);
    struct addrinfo *iterator = NULL, *resolved = NULL;
    struct addrinfo hints;
    int i = 1, ret = 0;
    memset(&hints, 0, sizeof(hints));
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_family = AF_UNSPEC;
    ret = getaddrinfo(hostname, NULL, &hints, &resolved);
    if (ret != 0) {
        lua_pushnil(L);
        lua_pushstring(L, socket_gaistrerror(ret));
        return 2;
    }
    lua_newtable(L);
    for (iterator = resolved; iterator; iterator = iterator->ai_next) {
        char hbuf[NI_MAXHOST];
        ret = getnameinfo(iterator->ai_addr, (socklen_t) iterator->ai_addrlen,
            hbuf, (socklen_t) sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
        if (ret){
          freeaddrinfo(resolved);
          lua_pushnil(L);
          lua_pushstring(L, socket_gaistrerror(ret));
          return 2;
        }
        lua_pushnumber(L, i);
        lua_newtable(L);
        switch (iterator->ai_family) {
            case AF_INET:
                lua_pushliteral(L, "family");
                lua_pushliteral(L, "inet");
                lua_settable(L, -3);
                break;
            case AF_INET6:
                lua_pushliteral(L, "family");
                lua_pushliteral(L, "inet6");
                lua_settable(L, -3);
                break;
            case AF_UNSPEC:
                lua_pushliteral(L, "family");
                lua_pushliteral(L, "unspec");
                lua_settable(L, -3);
                break;
            default:
                lua_pushliteral(L, "family");
                lua_pushliteral(L, "unknown");
                lua_settable(L, -3);
                break;
        }
        lua_pushliteral(L, "addr");
        lua_pushstring(L, hbuf);
        lua_settable(L, -3);
        lua_settable(L, -3);
        i++;
    }
    freeaddrinfo(resolved);
    return 1;
}

/*-------------------------------------------------------------------------*\
* Gets the host name
\*-------------------------------------------------------------------------*/
static int inet_global_gethostname(lua_State *L)
{
    char name[257];
    name[256] = '\0';
    if (gethostname(name, 256) < 0) {
        lua_pushnil(L);
        lua_pushstring(L, socket_strerror(errno));
        return 2;
    } else {
        lua_pushstring(L, name);
        return 1;
    }
}

/*=========================================================================*\
* Lua methods
\*=========================================================================*/
/*-------------------------------------------------------------------------*\
* Retrieves socket peer name
\*-------------------------------------------------------------------------*/
int inet_meth_getpeername(lua_State *L, p_socket ps, int family)
{
    int err;
    struct sockaddr_storage peer;
    socklen_t peer_len = sizeof(peer);
    char name[INET6_ADDRSTRLEN];
    char port[6]; /* 65535 = 5 bytes + 0 to terminate it */
    if (getpeername(*ps, (SA *) &peer, &peer_len) < 0) {
        lua_pushnil(L);
        lua_pushstring(L, socket_strerror(errno));
        return 2;
    }
	err = getnameinfo((struct sockaddr *) &peer, peer_len,
        name, INET6_ADDRSTRLEN,
        port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV);
    if (err) {
        lua_pushnil(L);
        lua_pushstring(L, gai_strerror(err));
        return 2;
    }
    lua_pushstring(L, name);
    lua_pushinteger(L, (int) strtol(port, (char **) NULL, 10));
    switch (family) {
        case AF_INET: lua_pushliteral(L, "inet"); break;
        case AF_INET6: lua_pushliteral(L, "inet6"); break;
        case AF_UNSPEC: lua_pushliteral(L, "unspec"); break;
        default: lua_pushliteral(L, "unknown"); break;
    }
    return 3;
}

/*-------------------------------------------------------------------------*\
* Retrieves socket local name
\*-------------------------------------------------------------------------*/
int inet_meth_getsockname(lua_State *L, p_socket ps, int family)
{
    int err;
    struct sockaddr_storage peer;
    socklen_t peer_len = sizeof(peer);
    char name[INET6_ADDRSTRLEN];
    char port[6]; /* 65535 = 5 bytes + 0 to terminate it */
    if (getsockname(*ps, (SA *) &peer, &peer_len) < 0) {
        lua_pushnil(L);
        lua_pushstring(L, socket_strerror(errno));
        return 2;
    }
	err=getnameinfo((struct sockaddr *)&peer, peer_len,
		name, INET6_ADDRSTRLEN, port, 6, NI_NUMERICHOST | NI_NUMERICSERV);
    if (err) {
        lua_pushnil(L);
        lua_pushstring(L, gai_strerror(err));
        return 2;
    }
    lua_pushstring(L, name);
    lua_pushstring(L, port);
    switch (family) {
        case AF_INET: lua_pushliteral(L, "inet"); break;
        case AF_INET6: lua_pushliteral(L, "inet6"); break;
        case AF_UNSPEC: lua_pushliteral(L, "unspec"); break;
        default: lua_pushliteral(L, "unknown"); break;
    }
    return 3;
}

/*=========================================================================*\
* Internal functions
\*=========================================================================*/
/*-------------------------------------------------------------------------*\
* Passes all resolver information to Lua as a table
\*-------------------------------------------------------------------------*/
static void inet_pushresolved(lua_State *L, struct hostent *hp)
{
    char **alias;
    struct in_addr **addr;
    int i, resolved;
    lua_newtable(L); resolved = lua_gettop(L);
    lua_pushstring(L, "name");
    lua_pushstring(L, hp->h_name);
    lua_settable(L, resolved);
    lua_pushstring(L, "ip");
    lua_pushstring(L, "alias");
    i = 1;
    alias = hp->h_aliases;
    lua_newtable(L);
    if (alias) {
        while (*alias) {
            lua_pushnumber(L, i);
            lua_pushstring(L, *alias);
            lua_settable(L, -3);
            i++; alias++;
        }
    }
    lua_settable(L, resolved);
    i = 1;
    lua_newtable(L);
    addr = (struct in_addr **) hp->h_addr_list;
    if (addr) {
        while (*addr) {
            lua_pushnumber(L, i);
            lua_pushstring(L, inet_ntoa(**addr));
            lua_settable(L, -3);
            i++; addr++;
        }
    }
    lua_settable(L, resolved);
}

/*-------------------------------------------------------------------------*\
* Tries to create a new inet socket
\*-------------------------------------------------------------------------*/
const char *inet_trycreate(p_socket ps, int family, int type, int protocol) {
    const char *err = socket_strerror(socket_create(ps, family, type, protocol));
    if (err == NULL && family == AF_INET6) {
        int yes = 1;
        setsockopt(*ps, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&yes, sizeof(yes));
    }
    return err;
}

/*-------------------------------------------------------------------------*\
* "Disconnects" a DGRAM socket
\*-------------------------------------------------------------------------*/
const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm)
{
    switch (family) {
        case AF_INET: {
            struct sockaddr_in sin;
            memset((char *) &sin, 0, sizeof(sin));
            sin.sin_family = AF_UNSPEC;
            sin.sin_addr.s_addr = INADDR_ANY;
            return socket_strerror(socket_connect(ps, (SA *) &sin,
                sizeof(sin), tm));
        }
        case AF_INET6: {
            struct sockaddr_in6 sin6;
            struct in6_addr addrany = IN6ADDR_ANY_INIT;
            memset((char *) &sin6, 0, sizeof(sin6));
            sin6.sin6_family = AF_UNSPEC;
            sin6.sin6_addr = addrany;
            return socket_strerror(socket_connect(ps, (SA *) &sin6,
                sizeof(sin6), tm));
        }
    }
    return NULL;
}

/*-------------------------------------------------------------------------*\
* Tries to connect to remote address (address, port)
\*-------------------------------------------------------------------------*/
const char *inet_tryconnect(p_socket ps, int *family, const char *address,
        const char *serv, p_timeout tm, struct addrinfo *connecthints)
{
    struct addrinfo *iterator = NULL, *resolved = NULL;
    const char *err = NULL;
    int current_family = *family;
    /* try resolving */
    err = socket_gaistrerror(getaddrinfo(address, serv,
                connecthints, &resolved));
    if (err != NULL) {
        if (resolved) freeaddrinfo(resolved);
        return err;
    }
    for (iterator = resolved; iterator; iterator = iterator->ai_next) {
        timeout_markstart(tm);
        /* create new socket if necessary. if there was no
         * bind, we need to create one for every new family
         * that shows up while iterating. if there was a
         * bind, all families will be the same and we will
         * not enter this branch. */
        if (current_family != iterator->ai_family || *ps == SOCKET_INVALID) {
            socket_destroy(ps);
            err = inet_trycreate(ps, iterator->ai_family,
                iterator->ai_socktype, iterator->ai_protocol);
            if (err) continue;
            current_family = iterator->ai_family;
            /* set non-blocking before connect */
            socket_setnonblocking(ps);
        }
        /* try connecting to remote address */
        err = socket_strerror(socket_connect(ps, (SA *) iterator->ai_addr,
            (socklen_t) iterator->ai_addrlen, tm));
        /* if success or timeout is zero, break out of loop */
        if (err == NULL || timeout_iszero(tm)) {
            *family = current_family;
            break;
        }
    }
    freeaddrinfo(resolved);
    /* here, if err is set, we failed */
    return err;
}

/*-------------------------------------------------------------------------*\
* Tries to accept a socket
\*-------------------------------------------------------------------------*/
const char *inet_tryaccept(p_socket server, int family, p_socket client,
    p_timeout tm) {
	socklen_t len;
	t_sockaddr_storage addr;
    switch (family) {
        case AF_INET6: len = sizeof(struct sockaddr_in6); break;
        case AF_INET: len = sizeof(struct sockaddr_in); break;
        default: len = sizeof(addr); break;
    }
	return socket_strerror(socket_accept(server, client, (SA *) &addr,
        &len, tm));
}

/*-------------------------------------------------------------------------*\
* Tries to bind socket to (address, port)
\*-------------------------------------------------------------------------*/
const char *inet_trybind(p_socket ps, int *family, const char *address,
    const char *serv, struct addrinfo *bindhints) {
    struct addrinfo *iterator = NULL, *resolved = NULL;
    const char *err = NULL;
    int current_family = *family;
    /* translate luasocket special values to C */
    if (strcmp(address, "*") == 0) address = NULL;
    if (!serv) serv = "0";
    /* try resolving */
    err = socket_gaistrerror(getaddrinfo(address, serv, bindhints, &resolved));
    if (err) {
        if (resolved) freeaddrinfo(resolved);
        return err;
    }
    /* iterate over resolved addresses until one is good */
    for (iterator = resolved; iterator; iterator = iterator->ai_next) {
        if (current_family != iterator->ai_family || *ps == SOCKET_INVALID) {
            socket_destroy(ps);
            err = inet_trycreate(ps, iterator->ai_family,
                        iterator->ai_socktype, iterator->ai_protocol);
            if (err) continue;
            current_family = iterator->ai_family;
        }
        /* try binding to local address */
        err = socket_strerror(socket_bind(ps, (SA *) iterator->ai_addr,
            (socklen_t) iterator->ai_addrlen));
        /* keep trying unless bind succeeded */
        if (err == NULL) {
            *family = current_family;
            /* set to non-blocking after bind */
            socket_setnonblocking(ps);
            break;
        }
    }
    /* cleanup and return error */
    freeaddrinfo(resolved);
    /* here, if err is set, we failed */
    return err;
}

/*-------------------------------------------------------------------------*\
* Some systems do not provide these so that we provide our own.
\*-------------------------------------------------------------------------*/
#ifdef LUASOCKET_INET_ATON
int inet_aton(const char *cp, struct in_addr *inp)
{
    unsigned int a = 0, b = 0, c = 0, d = 0;
    int n = 0, r;
    unsigned long int addr = 0;
    r = sscanf(cp, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n);
    if (r == 0 || n == 0) return 0;
    cp += n;
    if (*cp) return 0;
    if (a > 255 || b > 255 || c > 255 || d > 255) return 0;
    if (inp) {
        addr += a; addr <<= 8;
        addr += b; addr <<= 8;
        addr += c; addr <<= 8;
        addr += d;
        inp->s_addr = htonl(addr);
    }
    return 1;
}
#endif

#ifdef LUASOCKET_INET_PTON
int inet_pton(int af, const char *src, void *dst)
{
    struct addrinfo hints, *res;
    int ret = 1;
    memset(&hints, 0, sizeof(struct addrinfo));
    hints.ai_family = af;
    hints.ai_flags = AI_NUMERICHOST;
    if (getaddrinfo(src, NULL, &hints, &res) != 0) return -1;
    if (af == AF_INET) {
        struct sockaddr_in *in = (struct sockaddr_in *) res->ai_addr;
        memcpy(dst, &in->sin_addr, sizeof(in->sin_addr));
    } else if (af == AF_INET6) {
        struct sockaddr_in6 *in = (struct sockaddr_in6 *) res->ai_addr;
        memcpy(dst, &in->sin6_addr, sizeof(in->sin6_addr));
    } else {
        ret = -1;
    }
    freeaddrinfo(res);
    return ret;
}

#endif

{'repo_name': 'OpenMPT/openmpt', 'stars': '184', 'repo_language': 'C', 'file_name': 'PluginBridge-win10.manifest', 'mime_type': 'text/xml', 'hash': 5489776009541991917, 'source_dataset': 'data'}


using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Essensoft.AspNetCore.Payment.Alipay.Domain
{
    /// <summary>
    /// StuffStockInOrder Data Structure.
    /// </summary>
    public class StuffStockInOrder : AlipayObject
    {
        /// <summary>
        /// 口碑物料平台商品入库ERP号
        /// </summary>
        [JsonPropertyName("erp_order")]
        public string ErpOrder { get; set; }

        /// <summary>
        /// ERP订单类型
        /// </summary>
        [JsonPropertyName("erp_order_type")]
        public string ErpOrderType { get; set; }

        /// <summary>
        /// 扩展字段
        /// </summary>
        [JsonPropertyName("ext_info")]
        public string ExtInfo { get; set; }

        /// <summary>
        /// 入库单明细
        /// </summary>
        [JsonPropertyName("order_items")]
        public List<StuffStockInOrderItem> OrderItems { get; set; }

        /// <summary>
        /// 预计收货时间(YYYY-MM-DD HH:mm:ss)
        /// </summary>
        [JsonPropertyName("scheduled_receipt_date")]
        public string ScheduledReceiptDate { get; set; }

        /// <summary>
        /// 仓库编码
        /// </summary>
        [JsonPropertyName("warehouse_code")]
        public string WarehouseCode { get; set; }
    }
}

{'repo_name': 'essensoft/payment', 'stars': '774', 'repo_language': 'C#', 'file_name': 'site.js', 'mime_type': 'text/plain', 'hash': 2186987872797115244, 'source_dataset': 'data'}


//
//  YUGLCrossZoomTransitionFilter.m
//  YUGLViewControllerTransitionDemo
//
//  Created by YuAo on 10/8/14.
//  Copyright (c) 2014 YuAo. All rights reserved.
//

#import "YUGLCrossZoomTransitionFilter.h"

NSString *const YUGLCrossZoomTransitionFilterFragmentShaderString = SHADER_STRING
(
 precision highp float;

 varying highp vec2 textureCoordinate;
 varying highp vec2 textureCoordinate2;

 uniform sampler2D inputImageTexture;
 uniform sampler2D inputImageTexture2;

 uniform float progress;

 uniform float strength;

 const float PI = 3.141592653589793;

 float Linear_ease(in float begin, in float change, in float duration, in float time) {
     return change * time / duration + begin;
 }

 float Exponential_easeInOut(in float begin, in float change, in float duration, in float time) {
     if (time == 0.0)
         return begin;
     else if (time == duration)
         return begin + change;
     time = time / (duration / 2.0);
     if (time < 1.0)
         return change / 2.0 * pow(2.0, 10.0 * (time - 1.0)) + begin;
     return change / 2.0 * (-pow(2.0, -10.0 * (time - 1.0)) + 2.0) + begin;
 }

 float Sinusoidal_easeInOut(in float begin, in float change, in float duration, in float time) {
     return -change / 2.0 * (cos(PI * time / duration) - 1.0) + begin;
 }

/* random number between 0 and 1 */
 float random(in vec3 scale, in float seed) {
     /* use the fragment position for randomness */
     return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
 }

 vec3 crossFade(in vec2 uv, in float dissolve) {
     return mix(texture2D(inputImageTexture, uv).rgb, texture2D(inputImageTexture2, uv).rgb, dissolve);
 }

 void main() {

     // Linear interpolate center across center half of the image
     vec2 center = vec2(Linear_ease(0.25, 0.5, 1.0, progress), 0.5);
     float dissolve = Exponential_easeInOut(0.0, 1.0, 1.0, progress);

     // Mirrored sinusoidal loop. 0->strength then strength->0
     float strength = Sinusoidal_easeInOut(0.0, strength, 0.5, progress);

     vec3 color = vec3(0.0);
     float total = 0.0;
     vec2 toCenter = center - textureCoordinate;

     /* randomize the lookup values to hide the fixed number of samples */
     float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);

     for (float t = 0.0; t <= 10.0; t++) {
         float percent = (t + offset) / 10.0;
         float weight = 4.0 * (percent - percent * percent);
         color += crossFade(textureCoordinate + toCenter * percent * strength, dissolve) * weight;
         total += weight;
     }
     gl_FragColor = vec4(color / total, 1.0);
 }
);

@interface YUGLCrossZoomTransitionFilter ()
@property (nonatomic) GLint progressUniform;
@property (nonatomic) GLint strengthUniform;
@end

@implementation YUGLCrossZoomTransitionFilter

- (id)init;
{
    if (!(self = [super initWithFragmentShaderFromString:YUGLCrossZoomTransitionFilterFragmentShaderString]))
    {
        return nil;
    }

    self.progressUniform = [filterProgram uniformIndex:@"progress"];
    self.strengthUniform = [filterProgram uniformIndex:@"strength"];

    self.progress = 0;
    self.strength = 0.3;

    return self;
}

- (void)setProgress:(CGFloat)progress {
    _progress = progress;
    [self setFloat:progress forUniform:self.progressUniform program:filterProgram];
}

- (void)setStrength:(CGFloat)strength {
    _strength = strength;
    [self setFloat:strength forUniform:self.strengthUniform program:filterProgram];
}

@end

{'repo_name': 'YuAo/YUGLTransition', 'stars': '201', 'repo_language': 'Objective-C', 'file_name': 'InfoPlist.strings', 'mime_type': 'text/plain', 'hash': 5483450392226046599, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="16dp"
        android:foreground="?attr/selectableItemBackground"
        app:cardBackgroundColor="@android:color/white"
        app:cardCornerRadius="8dp"
        app:cardPreventCornerOverlap="false"
        app:cardUseCompatPadding="true">

        <com.meis.widget.MeiScrollParallaxView
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:scaleType="centerCrop"
            android:src="@mipmap/ic_mei_ripple"
            app:parallaxRate="0.8"/>

    </android.support.v7.widget.CardView>

</LinearLayout>

{'repo_name': 'HpWens/MeiWidgetView', 'stars': '1802', 'repo_language': 'Java', 'file_name': 'InterceptViewPager.java', 'mime_type': 'text/x-java', 'hash': 8631946733782685434, 'source_dataset': 'data'}