text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Collections.Generic;

namespace AutoRest.Core.Utilities
{
    /// <summary>
    /// Provides scope for variable names.
    /// </summary>
    public class ScopeProvider : IScopeProvider
    {
        /// <summary>
        /// Placeholder for variable scope - this ensures that variables names are unique within the method
        /// </summary>
        private readonly HashSet<string> _variables = new HashSet<string>();

        /// <summary>
        /// Get a unique variable name in the current scope
        /// </summary>
        /// <param name="variableName">The variable name</param>
        /// <returns>A variable name unique in this method</returns>
        public string GetUniqueName(string variableName)
        {
            if (_variables.Add(variableName))
            {
                return variableName;
            }

            return GetAlternateVariableName(variableName, 1);
        }

        private string GetAlternateVariableName(string prefix, int suffix)
        {
            string name = prefix + suffix;
            if (_variables.Add(name))
            {
                return name;
            }

            return GetAlternateVariableName(prefix, ++suffix);
        }
    }
}


text:
//
//  RicBannerView.m
//  RicBannerView
//
//  Created by rice on 2016/12/13.
//  Copyright © 2016年 rice. All rights reserved.
//

#import "RicBannerView.h"
#import <SDWebImage/UIImageView+WebCache.h>

@interface RicPageControl : UIPageControl

@property (nonatomic, strong) UIColor *ricTintColor;
@property (nonatomic, strong) UIColor *ricNormalColor;

@end

@implementation RicPageControl

- (void)setCurrentPage:(NSInteger)currentPage{
    [super setCurrentPage:currentPage];
    [self updatePageIndicator];
}

- (void)updatePageIndicator
{
    for (int i = 0; i < [self.subviews count]; i++)
    {
        UIView* dot = [self.subviews objectAtIndex:i];
        dot.layer.cornerRadius = CGRectGetWidth(dot.frame)/2.0f;
        dot.layer.masksToBounds = YES;
        dot.layer.borderWidth = 0.6f;
        dot.layer.borderColor = (self.ricTintColor?:[UIColor lightGrayColor]).CGColor;
        if(i == self.currentPage){
            dot.backgroundColor = self.ricTintColor ?:[UIColor lightGrayColor];
        }else{
            dot.backgroundColor = self.ricNormalColor ?: [UIColor clearColor];
        }
    }
}

@end

@interface RicBannerPlayItemView : UICollectionViewCell

@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UIView *customerView;
@end

@implementation RicBannerPlayItemView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        self.backgroundColor = [UIColor whiteColor];
        self.imageView = [[UIImageView alloc] initWithFrame:self.bounds];
        [self.contentView addSubview:self.imageView];
    }
    return self;
}

- (void)setCustomerView:(UIView *)customerView{
    if(_customerView){
        [_customerView removeFromSuperview];
    }
    if(!customerView){
        self.imageView.hidden = NO;
    }else{
        self.imageView.hidden = YES;
        [self.contentView addSubview:customerView];
    }
    _customerView = customerView;
}

@end

@interface RicBannerView ()<UICollectionViewDelegate,UICollectionViewDataSource>

@property (nonatomic, strong) UICollectionView *bannerPlayView;
@property (nonatomic, strong) NSTimer *timer;
/// record the banner index of the indicator that being show
@property (nonatomic, assign) NSUInteger currentPlayIndex;
@property (nonatomic, strong) RicPageControl *pageControl;
@property (nonatomic, strong) NSArray <id<RicBannerItem>>*originItems;
@property (nonatomic, strong) NSString *reusedCustomId;
@end

@implementation RicBannerView

- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];

    if(self){
        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
        layout.minimumInteritemSpacing = 0;
        layout.minimumLineSpacing = 0;
        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        layout.itemSize = CGSizeMake(frame.size.width, frame.size.height);
        self.bannerPlayView = [[UICollectionView alloc] initWithFrame:self.bounds  collectionViewLayout:layout];
        self.bannerPlayView.delegate = self;
        self.bannerPlayView.dataSource = self;
        self.bannerPlayView.pagingEnabled = YES;
        self.bannerPlayView.showsVerticalScrollIndicator = false;
        self.bannerPlayView.showsHorizontalScrollIndicator = false;
        [self.bannerPlayView registerClass:[RicBannerPlayItemView class] forCellWithReuseIdentifier:@"RicBannerPlayItemView"];
        [self addSubview:self.bannerPlayView];
    }

    return self;
}

- (void)setBannerItems:(NSArray<id<RicBannerItem>> *)bannerItems{

    self.originItems = bannerItems;
    self.pageControl.numberOfPages = bannerItems.count;

    if(bannerItems.count > 1){
        NSMutableArray *fixedBannerItems = [bannerItems mutableCopy];

        id<RicBannerItem> firstItem = [fixedBannerItems firstObject];
        id<RicBannerItem> lastItem = [fixedBannerItems lastObject];
        [fixedBannerItems insertObject:lastItem atIndex:0];
        [fixedBannerItems addObject:firstItem];
        _bannerItems = fixedBannerItems;
        self.bannerPlayView.scrollEnabled = YES;
        [self.bannerPlayView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:0] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:NO];
    }else{
        _bannerItems = bannerItems;
        self.bannerPlayView.scrollEnabled = NO;
    }
}

- (UIPageControl *)pageIndicator{
    return self.pageControl;
}

- (RicPageControl *)pageControl{

    if(!_pageControl){
        _pageControl = [[RicPageControl alloc] initWithFrame:CGRectMake(10, CGRectGetHeight(self.frame)-25, CGRectGetWidth(self.frame)-20, 15)];
        _pageControl.hidesForSinglePage = YES;
        [self addSubview:_pageControl];
    }
    return _pageControl;
}

- (void)setTintIndicatorColor:(UIColor *)tintIndicatorColor{
    self.pageControl.ricTintColor = tintIndicatorColor;
}

- (void)setNormalIndicatorColor:(UIColor *)normalIndicatorColor{
    self.pageControl.ricNormalColor = normalIndicatorColor;
}

- (void)setShouldIndicator:(BOOL)shouldIndicator{
    self.pageControl.hidden = !shouldIndicator;
}

- (void)startPlay
{
    NSAssert(_bannerItems.count > 1, @"out of bannerlist range");

        self.bannerDisplayDuration = 3;
        self.currentPlayIndex = 0;
        self.timer = [NSTimer timerWithTimeInterval:self.bannerDisplayDuration target:self selector:@selector(displayNextBanner) userInfo:nil repeats:YES];
        self.timer.fireDate = [NSDate dateWithTimeIntervalSinceNow:self.bannerDisplayDuration];
        //
        [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
}

- (void)pausePaly{
    [NSObject cancelPreviousPerformRequestsWithTarget:self.timer];
    self.timer.fireDate = [NSDate distantFuture];
}
- (void)resumePlay{
    self.timer.fireDate = [NSDate dateWithTimeIntervalSinceNow:self.bannerDisplayDuration];
}
- (void)quitPlay{
    [NSObject cancelPreviousPerformRequestsWithTarget:self.timer];
    if(self.timer && self.timer.isValid){
        [self.timer invalidate];
    }
    self.timer = nil;
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
    [self pausePaly];
}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
    [self resumePlay];
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    if(((NSInteger)scrollView.contentOffset.x)%((NSInteger)scrollView.frame.size.width) == 0){
        [self figureOutCurrentBanner];
    }
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return self.bannerItems.count;
}

- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    RicBannerPlayItemView *bannerPlayItemView = (RicBannerPlayItemView *)[self.bannerPlayView dequeueReusableCellWithReuseIdentifier:@"RicBannerPlayItemView" forIndexPath:indexPath];
    id<RicBannerItem> bannerInfo = self.bannerItems[indexPath.item];

    UIView *customBannerView = nil;
    if (self.delegate != nil && [self.delegate conformsToProtocol:@protocol(RicBannerViewDelegate)] && [self.delegate respondsToSelector:@selector(customBannerViewForBanner:atIndex:bannerView:)]){

        customBannerView = [self.delegate customBannerViewForBanner:bannerInfo atIndex:[self.originItems indexOfObject:bannerInfo] bannerView:self];
    }

    bannerPlayItemView.customerView = customBannerView;
    if(!customBannerView){
        if(bannerInfo.bannerImageUrl.length > 0){
            [bannerPlayItemView.imageView sd_setImageWithURL:[NSURL URLWithString:bannerInfo.bannerImageUrl] placeholderImage:self.bannerPlaceholderImage];
        }
    }

    return bannerPlayItemView;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    [self pausePaly];
    if(self.delegate && [self.delegate conformsToProtocol:@protocol(RicBannerViewDelegate)]&& [self.delegate respondsToSelector:@selector(didClickBanner:atIndex:bannerView:)]){
        id<RicBannerItem>item = self.bannerItems[indexPath.item];
        [self.delegate didClickBanner:item atIndex:[self.originItems indexOfObject:item] bannerView:self];
    }
    [self resumePlay];
}

- (void)displayNextBanner
{
    [self showRightBanner];
}

- (void)showRightBanner{

    CGFloat bannerViewWidth = CGRectGetWidth(self.bannerPlayView.frame);
    NSInteger page = self.bannerPlayView.contentOffset.x/bannerViewWidth+1;

    [self.bannerPlayView setContentOffset:CGPointMake(page*bannerViewWidth, 0) animated:YES];

}

/**
     figure the current banner index.
 */
- (void)figureOutCurrentBanner{

    CGFloat bannerViewWidth = CGRectGetWidth(self.bannerPlayView.frame);
    NSInteger page = self.bannerPlayView.contentOffset.x/bannerViewWidth;

    if(page == self.bannerItems.count-1){
        self.currentPlayIndex = 0;
        [self.bannerPlayView setContentOffset:CGPointMake(bannerViewWidth, 0) animated:NO];
    }else if(page == 0){
        self.currentPlayIndex = self.bannerItems.count - 3;
        [self.bannerPlayView setContentOffset:CGPointMake((self.bannerItems.count - 2)*bannerViewWidth, 0) animated:NO];
    }else{
        self.currentPlayIndex = page-1;
    }
    [self updateIndicator];
}

- (void)updateIndicator{
    self.pageControl.currentPage = self.currentPlayIndex;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end

redpajama_set_name: RedPajamaGithub


text:
```java
requestWindowFeature(Window.FEATURE_NO_TITLE)

window.setFlags(
    WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN
)

supportActionBar?.hide()

```


text:
* Description: Credit card sized computer with Zynq FPGA and 16-core Epiphany coprocessor
* Type:        SBC
* Tool:        Allegro
* Author:      Adapteva
* License:     Creative Commons Attribution 3.0 Unported licence
* Docs:        [http://parallella.org/docs/parallella_manual.pdf](http://parallella.org/docs/parallella_manual.pdf)
* Schematic:   [https://github.com/parallella/parallella-hw/tree/master/parallella](https://github.com/parallella/parallella-hw/tree/master/parallella)
* Layout:      [https://github.com/parallella/parallella-hw/tree/master/parallella](https://github.com/parallella/parallella-hw/tree/master/parallella)


text:
export class Category {
    constructor(category) {
        this.value = category
        this.children = this.loadJoke
    }

    loadJoke = () =>
        fetch(`https://api.chucknorris.io/jokes/random?category=${ this.value }`)
            .then(response => response.json())
            .then(joke => [new Joke(joke)])

    // Riotjs tags are lowercased by the compiler
    display = () => "chucknorriscategory"
}

export class Joke {
    constructor(joke) { Object.assign(this, joke) }
    // Riotjs tags are lowercased by the compiler
    display = () => "chucknorrisjoke"
}


text:
require 'spec_helper'

describe Rubocop::Cop::Style::SpaceAfterNot do
  subject(:cop) { described_class.new }

  it 'reports an offence for space after !' do
    inspect_source(cop, ['! something'])
    expect(cop.offences.size).to eq(1)
  end

  it 'accepts no space after !' do
    inspect_source(cop, ['!something'])
    expect(cop.offences).to be_empty
  end

  it 'auto-corrects by removing redundant space' do
    new_source = autocorrect_source(cop, '!  something')
    expect(new_source).to eq('!something')
  end
end


text:
namespace testing {
namespace gmock_function_mocker_test {

using testing::_;
using testing::A;
using testing::An;
using testing::AnyNumber;
using testing::Const;
using testing::DoDefault;
using testing::Eq;
using testing::Lt;
using testing::MockFunction;
using testing::Ref;
using testing::Return;
using testing::ReturnRef;
using testing::TypedEq;

template<typename T>
class TemplatedCopyable {
 public:
  TemplatedCopyable() {}

  template <typename U>
  TemplatedCopyable(const U& other) {}  // NOLINT
};

class FooInterface {
 public:
  virtual ~FooInterface() {}

  virtual void VoidReturning(int x) = 0;

  virtual int Nullary() = 0;
  virtual bool Unary(int x) = 0;
  virtual long Binary(short x, int y) = 0;  // NOLINT
  virtual int Decimal(bool b, char c, short d, int e, long f,  // NOLINT
                      float g, double h, unsigned i, char* j,
                      const std::string& k) = 0;

  virtual bool TakesNonConstReference(int& n) = 0;  // NOLINT
  virtual std::string TakesConstReference(const int& n) = 0;
  virtual bool TakesConst(const int x) = 0;

  virtual int OverloadedOnArgumentNumber() = 0;
  virtual int OverloadedOnArgumentNumber(int n) = 0;

  virtual int OverloadedOnArgumentType(int n) = 0;
  virtual char OverloadedOnArgumentType(char c) = 0;

  virtual int OverloadedOnConstness() = 0;
  virtual char OverloadedOnConstness() const = 0;

  virtual int TypeWithHole(int (*func)()) = 0;
  virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0;
  virtual int TypeWithTemplatedCopyCtor(const TemplatedCopyable<int>&) = 0;

#if GTEST_OS_WINDOWS
  STDMETHOD_(int, CTNullary)() = 0;
  STDMETHOD_(bool, CTUnary)(int x) = 0;
  STDMETHOD_(int, CTDecimal)
  (bool b, char c, short d, int e, long f,  // NOLINT
   float g, double h, unsigned i, char* j, const std::string& k) = 0;
  STDMETHOD_(char, CTConst)(int x) const = 0;
#endif  // GTEST_OS_WINDOWS
};

// Const qualifiers on arguments were once (incorrectly) considered
// significant in determining whether two virtual functions had the same
// signature. This was fixed in Visual Studio 2008. However, the compiler
// still emits a warning that alerts about this change in behavior.
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4373)
#endif
class MockFoo : public FooInterface {
 public:
  MockFoo() {}

  // Makes sure that a mock function parameter can be named.
  MOCK_METHOD(void, VoidReturning, (int n));  // NOLINT

  MOCK_METHOD(int, Nullary, ());  // NOLINT

  // Makes sure that a mock function parameter can be unnamed.
  MOCK_METHOD(bool, Unary, (int));          // NOLINT
  MOCK_METHOD(long, Binary, (short, int));  // NOLINT
  MOCK_METHOD(int, Decimal,
              (bool, char, short, int, long, float,  // NOLINT
               double, unsigned, char*, const std::string& str),
              (override));

  MOCK_METHOD(bool, TakesNonConstReference, (int&));  // NOLINT
  MOCK_METHOD(std::string, TakesConstReference, (const int&));
  MOCK_METHOD(bool, TakesConst, (const int));  // NOLINT

  // Tests that the function return type can contain unprotected comma.
  MOCK_METHOD((std::map<int, std::string>), ReturnTypeWithComma, (), ());
  MOCK_METHOD((std::map<int, std::string>), ReturnTypeWithComma, (int),
              (const));  // NOLINT

  MOCK_METHOD(int, OverloadedOnArgumentNumber, ());     // NOLINT
  MOCK_METHOD(int, OverloadedOnArgumentNumber, (int));  // NOLINT

  MOCK_METHOD(int, OverloadedOnArgumentType, (int));    // NOLINT
  MOCK_METHOD(char, OverloadedOnArgumentType, (char));  // NOLINT

  MOCK_METHOD(int, OverloadedOnConstness, (), (override));          // NOLINT
  MOCK_METHOD(char, OverloadedOnConstness, (), (override, const));  // NOLINT

  MOCK_METHOD(int, TypeWithHole, (int (*)()), ());  // NOLINT
  MOCK_METHOD(int, TypeWithComma, ((const std::map<int, std::string>&)));
  MOCK_METHOD(int, TypeWithTemplatedCopyCtor,
              (const TemplatedCopyable<int>&));  // NOLINT

#if GTEST_OS_WINDOWS
  MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE)));
  MOCK_METHOD(bool, CTUnary, (int), (Calltype(STDMETHODCALLTYPE)));
  MOCK_METHOD(int, CTDecimal,
              (bool b, char c, short d, int e, long f, float g, double h,
               unsigned i, char* j, const std::string& k),
              (Calltype(STDMETHODCALLTYPE)));
  MOCK_METHOD(char, CTConst, (int), (const, Calltype(STDMETHODCALLTYPE)));
  MOCK_METHOD((std::map<int, std::string>), CTReturnTypeWithComma, (),
              (Calltype(STDMETHODCALLTYPE)));
#endif  // GTEST_OS_WINDOWS

 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif

class MockMethodFunctionMockerTest : public testing::Test {
 protected:
  MockMethodFunctionMockerTest() : foo_(&mock_foo_) {}

  FooInterface* const foo_;
  MockFoo mock_foo_;
};

// Tests mocking a void-returning function.
TEST_F(MockMethodFunctionMockerTest, MocksVoidFunction) {
  EXPECT_CALL(mock_foo_, VoidReturning(Lt(100)));
  foo_->VoidReturning(0);
}

// Tests mocking a nullary function.
TEST_F(MockMethodFunctionMockerTest, MocksNullaryFunction) {
  EXPECT_CALL(mock_foo_, Nullary())
      .WillOnce(DoDefault())
      .WillOnce(Return(1));

  EXPECT_EQ(0, foo_->Nullary());
  EXPECT_EQ(1, foo_->Nullary());
}

// Tests mocking a unary function.
TEST_F(MockMethodFunctionMockerTest, MocksUnaryFunction) {
  EXPECT_CALL(mock_foo_, Unary(Eq(2)))
      .Times(2)
      .WillOnce(Return(true));

  EXPECT_TRUE(foo_->Unary(2));
  EXPECT_FALSE(foo_->Unary(2));
}

// Tests mocking a binary function.
TEST_F(MockMethodFunctionMockerTest, MocksBinaryFunction) {
  EXPECT_CALL(mock_foo_, Binary(2, _))
      .WillOnce(Return(3));

  EXPECT_EQ(3, foo_->Binary(2, 1));
}

// Tests mocking a decimal function.
TEST_F(MockMethodFunctionMockerTest, MocksDecimalFunction) {
  EXPECT_CALL(mock_foo_, Decimal(true, 'a', 0, 0, 1L, A<float>(),
                                 Lt(100), 5U, NULL, "hi"))
      .WillOnce(Return(5));

  EXPECT_EQ(5, foo_->Decimal(true, 'a', 0, 0, 1, 0, 0, 5, nullptr, "hi"));
}

// Tests mocking a function that takes a non-const reference.
TEST_F(MockMethodFunctionMockerTest,
       MocksFunctionWithNonConstReferenceArgument) {
  int a = 0;
  EXPECT_CALL(mock_foo_, TakesNonConstReference(Ref(a)))
      .WillOnce(Return(true));

  EXPECT_TRUE(foo_->TakesNonConstReference(a));
}

// Tests mocking a function that takes a const reference.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionWithConstReferenceArgument) {
  int a = 0;
  EXPECT_CALL(mock_foo_, TakesConstReference(Ref(a)))
      .WillOnce(Return("Hello"));

  EXPECT_EQ("Hello", foo_->TakesConstReference(a));
}

// Tests mocking a function that takes a const variable.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionWithConstArgument) {
  EXPECT_CALL(mock_foo_, TakesConst(Lt(10)))
      .WillOnce(DoDefault());

  EXPECT_FALSE(foo_->TakesConst(5));
}

// Tests mocking functions overloaded on the number of arguments.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionsOverloadedOnArgumentNumber) {
  EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber())
      .WillOnce(Return(1));
  EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber(_))
      .WillOnce(Return(2));

  EXPECT_EQ(2, foo_->OverloadedOnArgumentNumber(1));
  EXPECT_EQ(1, foo_->OverloadedOnArgumentNumber());
}

// Tests mocking functions overloaded on the types of argument.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionsOverloadedOnArgumentType) {
  EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(An<int>()))
      .WillOnce(Return(1));
  EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(TypedEq<char>('a')))
      .WillOnce(Return('b'));

  EXPECT_EQ(1, foo_->OverloadedOnArgumentType(0));
  EXPECT_EQ('b', foo_->OverloadedOnArgumentType('a'));
}

// Tests mocking functions overloaded on the const-ness of this object.
TEST_F(MockMethodFunctionMockerTest,
       MocksFunctionsOverloadedOnConstnessOfThis) {
  EXPECT_CALL(mock_foo_, OverloadedOnConstness());
  EXPECT_CALL(Const(mock_foo_), OverloadedOnConstness())
      .WillOnce(Return('a'));

  EXPECT_EQ(0, foo_->OverloadedOnConstness());
  EXPECT_EQ('a', Const(*foo_).OverloadedOnConstness());
}

TEST_F(MockMethodFunctionMockerTest, MocksReturnTypeWithComma) {
  const std::map<int, std::string> a_map;
  EXPECT_CALL(mock_foo_, ReturnTypeWithComma())
      .WillOnce(Return(a_map));
  EXPECT_CALL(mock_foo_, ReturnTypeWithComma(42))
      .WillOnce(Return(a_map));

  EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma());
  EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma(42));
}

TEST_F(MockMethodFunctionMockerTest, MocksTypeWithTemplatedCopyCtor) {
  EXPECT_CALL(mock_foo_, TypeWithTemplatedCopyCtor(_)).WillOnce(Return(true));
  EXPECT_TRUE(foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>()));
}

#if GTEST_OS_WINDOWS
// Tests mocking a nullary function with calltype.
TEST_F(MockMethodFunctionMockerTest, MocksNullaryFunctionWithCallType) {
  EXPECT_CALL(mock_foo_, CTNullary())
      .WillOnce(Return(-1))
      .WillOnce(Return(0));

  EXPECT_EQ(-1, foo_->CTNullary());
  EXPECT_EQ(0, foo_->CTNullary());
}

// Tests mocking a unary function with calltype.
TEST_F(MockMethodFunctionMockerTest, MocksUnaryFunctionWithCallType) {
  EXPECT_CALL(mock_foo_, CTUnary(Eq(2)))
      .Times(2)
      .WillOnce(Return(true))
      .WillOnce(Return(false));

  EXPECT_TRUE(foo_->CTUnary(2));
  EXPECT_FALSE(foo_->CTUnary(2));
}

// Tests mocking a decimal function with calltype.
TEST_F(MockMethodFunctionMockerTest, MocksDecimalFunctionWithCallType) {
  EXPECT_CALL(mock_foo_, CTDecimal(true, 'a', 0, 0, 1L, A<float>(),
                                   Lt(100), 5U, NULL, "hi"))
      .WillOnce(Return(10));

  EXPECT_EQ(10, foo_->CTDecimal(true, 'a', 0, 0, 1, 0, 0, 5, NULL, "hi"));
}

// Tests mocking functions overloaded on the const-ness of this object.
TEST_F(MockMethodFunctionMockerTest, MocksFunctionsConstFunctionWithCallType) {
  EXPECT_CALL(Const(mock_foo_), CTConst(_))
      .WillOnce(Return('a'));

  EXPECT_EQ('a', Const(*foo_).CTConst(0));
}

TEST_F(MockMethodFunctionMockerTest, MocksReturnTypeWithCommaAndCallType) {
  const std::map<int, std::string> a_map;
  EXPECT_CALL(mock_foo_, CTReturnTypeWithComma())
      .WillOnce(Return(a_map));

  EXPECT_EQ(a_map, mock_foo_.CTReturnTypeWithComma());
}

#endif  // GTEST_OS_WINDOWS

class MockB {
 public:
  MockB() {}

  MOCK_METHOD(void, DoB, ());

 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB);
};

// Tests that functions with no EXPECT_CALL() rules can be called any
// number of times.
TEST(MockMethodExpectCallTest, UnmentionedFunctionCanBeCalledAnyNumberOfTimes) {
  {
    MockB b;
  }

  {
    MockB b;
    b.DoB();
  }

  {
    MockB b;
    b.DoB();
    b.DoB();
  }
}

// Tests mocking template interfaces.

template <typename T>
class StackInterface {
 public:
  virtual ~StackInterface() {}

  // Template parameter appears in function parameter.
  virtual void Push(const T& value) = 0;
  virtual void Pop() = 0;
  virtual int GetSize() const = 0;
  // Template parameter appears in function return type.
  virtual const T& GetTop() const = 0;
};

template <typename T>
class MockStack : public StackInterface<T> {
 public:
  MockStack() {}

  MOCK_METHOD(void, Push, (const T& elem), ());
  MOCK_METHOD(void, Pop, (), (final));
  MOCK_METHOD(int, GetSize, (), (const, override));
  MOCK_METHOD(const T&, GetTop, (), (const));

  // Tests that the function return type can contain unprotected comma.
  MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (), ());
  MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (int), (const));

 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStack);
};

// Tests that template mock works.
TEST(MockMethodTemplateMockTest, Works) {
  MockStack<int> mock;

  EXPECT_CALL(mock, GetSize())
      .WillOnce(Return(0))
      .WillOnce(Return(1))
      .WillOnce(Return(0));
  EXPECT_CALL(mock, Push(_));
  int n = 5;
  EXPECT_CALL(mock, GetTop())
      .WillOnce(ReturnRef(n));
  EXPECT_CALL(mock, Pop())
      .Times(AnyNumber());

  EXPECT_EQ(0, mock.GetSize());
  mock.Push(5);
  EXPECT_EQ(1, mock.GetSize());
  EXPECT_EQ(5, mock.GetTop());
  mock.Pop();
  EXPECT_EQ(0, mock.GetSize());
}

TEST(MockMethodTemplateMockTest, MethodWithCommaInReturnTypeWorks) {
  MockStack<int> mock;

  const std::map<int, int> a_map;
  EXPECT_CALL(mock, ReturnTypeWithComma())
      .WillOnce(Return(a_map));
  EXPECT_CALL(mock, ReturnTypeWithComma(1))
      .WillOnce(Return(a_map));

  EXPECT_EQ(a_map, mock.ReturnTypeWithComma());
  EXPECT_EQ(a_map, mock.ReturnTypeWithComma(1));
}

#if GTEST_OS_WINDOWS
// Tests mocking template interfaces with calltype.

template <typename T>
class StackInterfaceWithCallType {
 public:
  virtual ~StackInterfaceWithCallType() {}

  // Template parameter appears in function parameter.
  STDMETHOD_(void, Push)(const T& value) = 0;
  STDMETHOD_(void, Pop)() = 0;
  STDMETHOD_(int, GetSize)() const = 0;
  // Template parameter appears in function return type.
  STDMETHOD_(const T&, GetTop)() const = 0;
};

template <typename T>
class MockStackWithCallType : public StackInterfaceWithCallType<T> {
 public:
  MockStackWithCallType() {}

  MOCK_METHOD(void, Push, (const T& elem),
              (Calltype(STDMETHODCALLTYPE), override));
  MOCK_METHOD(void, Pop, (), (Calltype(STDMETHODCALLTYPE), override));
  MOCK_METHOD(int, GetSize, (), (Calltype(STDMETHODCALLTYPE), override, const));
  MOCK_METHOD(const T&, GetTop, (),
              (Calltype(STDMETHODCALLTYPE), override, const));

 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStackWithCallType);
};

// Tests that template mock with calltype works.
TEST(MockMethodTemplateMockTestWithCallType, Works) {
  MockStackWithCallType<int> mock;

  EXPECT_CALL(mock, GetSize())
      .WillOnce(Return(0))
      .WillOnce(Return(1))
      .WillOnce(Return(0));
  EXPECT_CALL(mock, Push(_));
  int n = 5;
  EXPECT_CALL(mock, GetTop())
      .WillOnce(ReturnRef(n));
  EXPECT_CALL(mock, Pop())
      .Times(AnyNumber());

  EXPECT_EQ(0, mock.GetSize());
  mock.Push(5);
  EXPECT_EQ(1, mock.GetSize());
  EXPECT_EQ(5, mock.GetTop());
  mock.Pop();
  EXPECT_EQ(0, mock.GetSize());
}
#endif  // GTEST_OS_WINDOWS

#define MY_MOCK_METHODS1_                       \
  MOCK_METHOD(void, Overloaded, ());            \
  MOCK_METHOD(int, Overloaded, (int), (const)); \
  MOCK_METHOD(bool, Overloaded, (bool f, int n))

class MockOverloadedOnArgNumber {
 public:
  MockOverloadedOnArgNumber() {}

  MY_MOCK_METHODS1_;

 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnArgNumber);
};

TEST(MockMethodOverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody) {
  MockOverloadedOnArgNumber mock;
  EXPECT_CALL(mock, Overloaded());
  EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
  EXPECT_CALL(mock, Overloaded(true, 1)).WillOnce(Return(true));

  mock.Overloaded();
  EXPECT_EQ(2, mock.Overloaded(1));
  EXPECT_TRUE(mock.Overloaded(true, 1));
}

#define MY_MOCK_METHODS2_ \
    MOCK_CONST_METHOD1(Overloaded, int(int n)); \
    MOCK_METHOD1(Overloaded, int(int n));

class MockOverloadedOnConstness {
 public:
  MockOverloadedOnConstness() {}

  MY_MOCK_METHODS2_;

 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnConstness);
};

TEST(MockMethodOverloadedMockMethodTest, CanOverloadOnConstnessInMacroBody) {
  MockOverloadedOnConstness mock;
  const MockOverloadedOnConstness* const_mock = &mock;
  EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
  EXPECT_CALL(*const_mock, Overloaded(1)).WillOnce(Return(3));

  EXPECT_EQ(2, mock.Overloaded(1));
  EXPECT_EQ(3, const_mock->Overloaded(1));
}

TEST(MockMethodMockFunctionTest, WorksForVoidNullary) {
  MockFunction<void()> foo;
  EXPECT_CALL(foo, Call());
  foo.Call();
}

TEST(MockMethodMockFunctionTest, WorksForNonVoidNullary) {
  MockFunction<int()> foo;
  EXPECT_CALL(foo, Call())
      .WillOnce(Return(1))
      .WillOnce(Return(2));
  EXPECT_EQ(1, foo.Call());
  EXPECT_EQ(2, foo.Call());
}

TEST(MockMethodMockFunctionTest, WorksForVoidUnary) {
  MockFunction<void(int)> foo;
  EXPECT_CALL(foo, Call(1));
  foo.Call(1);
}

TEST(MockMethodMockFunctionTest, WorksForNonVoidBinary) {
  MockFunction<int(bool, int)> foo;
  EXPECT_CALL(foo, Call(false, 42))
      .WillOnce(Return(1))
      .WillOnce(Return(2));
  EXPECT_CALL(foo, Call(true, Ge(100)))
      .WillOnce(Return(3));
  EXPECT_EQ(1, foo.Call(false, 42));
  EXPECT_EQ(2, foo.Call(false, 42));
  EXPECT_EQ(3, foo.Call(true, 120));
}

TEST(MockMethodMockFunctionTest, WorksFor10Arguments) {
  MockFunction<int(bool a0, char a1, int a2, int a3, int a4,
                   int a5, int a6, char a7, int a8, bool a9)> foo;
  EXPECT_CALL(foo, Call(_, 'a', _, _, _, _, _, _, _, _))
      .WillOnce(Return(1))
      .WillOnce(Return(2));
  EXPECT_EQ(1, foo.Call(false, 'a', 0, 0, 0, 0, 0, 'b', 0, true));
  EXPECT_EQ(2, foo.Call(true, 'a', 0, 0, 0, 0, 0, 'b', 1, false));
}

TEST(MockMethodMockFunctionTest, AsStdFunction) {
  MockFunction<int(int)> foo;
  auto call = [](const std::function<int(int)> &f, int i) {
    return f(i);
  };
  EXPECT_CALL(foo, Call(1)).WillOnce(Return(-1));
  EXPECT_CALL(foo, Call(2)).WillOnce(Return(-2));
  EXPECT_EQ(-1, call(foo.AsStdFunction(), 1));
  EXPECT_EQ(-2, call(foo.AsStdFunction(), 2));
}

TEST(MockMethodMockFunctionTest, AsStdFunctionReturnsReference) {
  MockFunction<int&()> foo;
  int value = 1;
  EXPECT_CALL(foo, Call()).WillOnce(ReturnRef(value));
  int& ref = foo.AsStdFunction()();
  EXPECT_EQ(1, ref);
  value = 2;
  EXPECT_EQ(2, ref);
}

TEST(MockMethodMockFunctionTest, AsStdFunctionWithReferenceParameter) {
  MockFunction<int(int &)> foo;
  auto call = [](const std::function<int(int& )> &f, int &i) {
    return f(i);
  };
  int i = 42;
  EXPECT_CALL(foo, Call(i)).WillOnce(Return(-1));
  EXPECT_EQ(-1, call(foo.AsStdFunction(), i));
}

struct MockMethodSizes0 {
  MOCK_METHOD(void, func, ());
};
struct MockMethodSizes1 {
  MOCK_METHOD(void, func, (int));
};
struct MockMethodSizes2 {
  MOCK_METHOD(void, func, (int, int));
};
struct MockMethodSizes3 {
  MOCK_METHOD(void, func, (int, int, int));
};
struct MockMethodSizes4 {
  MOCK_METHOD(void, func, (int, int, int, int));
};

TEST(MockMethodMockFunctionTest, MockMethodSizeOverhead) {
  EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes1));
  EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes2));
  EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes3));
  EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes4));
}

}  // namespace gmock_function_mocker_test
}  // namespace testing


text:
from . import base
import imaplib
import re
import logging

logger = logging.getLogger('qtile')

class GmailChecker(base.ThreadedPollText):
    """
        A simple gmail checker.
    """
    orientations = base.ORIENTATION_HORIZONTAL
    defaults = [
        ("update_interval", 30, "Update time in seconds."),
        ("username", None, "username"),
        ("password", None, "password"),
        ("email_path", "INBOX", "email_path"),
        ("fmt", "inbox[%s],unseen[%s]", "fmt"),
        ("status_only_unseen", False, "Only show unseen messages"),
    ]

    def __init__(self, **config):
        base._TextBox.__init__(self, **config)
        self.add_defaults(GmailChecker.defaults)

    def poll(self):
        self.gmail = imaplib.IMAP4_SSL('imap.gmail.com')
        self.gmail.login(self.username, self.password)
        answer, raw_data = self.gmail.status(self.email_path,
                                             '(MESSAGES UNSEEN)')
        if answer == "OK":
            dec = raw_data[0].decode()
            messages = int(re.search('MESSAGES\s+(\d+)', dec).group(1))
            unseen = int(re.search('UNSEEN\s+(\d+)', dec).group(1))
            if(self.status_only_unseen):
                return self.fmt % unseen
            else:
                return self.fmt % (messages, unseen)
        else:
            logger.exception(
                'GmailChecker UNKNOWN error, answer: %s, raw_data: %s'
                % (str(answer), str(raw_data)))
            return "UNKNOWN ERROR"


text:
from typing import Optional, Dict, List, Tuple, TYPE_CHECKING, NamedTuple, Callable
from enum import Enum, auto

from .util import bfh, bh2u
from .bitcoin import redeem_script_to_address, dust_threshold, construct_witness
from . import ecc
from .lnutil import (make_commitment_output_to_remote_address, make_commitment_output_to_local_witness_script,
                     derive_privkey, derive_pubkey, derive_blinded_pubkey, derive_blinded_privkey,
                     make_htlc_tx_witness, make_htlc_tx_with_open_channel, UpdateAddHtlc,
                     LOCAL, REMOTE, make_htlc_output_witness_script,
                     get_ordered_channel_configs, privkey_to_pubkey, get_per_commitment_secret_from_seed,
                     RevocationStore, extract_ctn_from_tx_and_chan, UnableToDeriveSecret, SENT, RECEIVED,
                     map_htlcs_to_ctx_output_idxs, Direction)
from .transaction import (Transaction, TxOutput, PartialTransaction, PartialTxInput,
                          PartialTxOutput, TxOutpoint)
from .simple_config import SimpleConfig
from .logging import get_logger, Logger

if TYPE_CHECKING:
    from .lnchannel import Channel, AbstractChannel

_logger = get_logger(__name__)

class SweepInfo(NamedTuple):
    name: str
    csv_delay: int
    cltv_expiry: int
    gen_tx: Callable[[], Optional[Transaction]]

def create_sweeptxs_for_watchtower(chan: 'Channel', ctx: Transaction, per_commitment_secret: bytes,
                                   sweep_address: str) -> List[Transaction]:
    """Presign sweeping transactions using the just received revoked pcs.
    These will only be utilised if the remote breaches.
    Sweep 'to_local', and all the HTLCs (two cases: directly from ctx, or from HTLC tx).
    """
    # prep
    ctn = extract_ctn_from_tx_and_chan(ctx, chan)
    pcp = ecc.ECPrivkey(per_commitment_secret).get_public_key_bytes(compressed=True)
    this_conf, other_conf = get_ordered_channel_configs(chan=chan, for_us=False)
    other_revocation_privkey = derive_blinded_privkey(other_conf.revocation_basepoint.privkey,
                                                      per_commitment_secret)
    to_self_delay = other_conf.to_self_delay
    this_delayed_pubkey = derive_pubkey(this_conf.delayed_basepoint.pubkey, pcp)
    txs = []
    # to_local
    revocation_pubkey = ecc.ECPrivkey(other_revocation_privkey).get_public_key_bytes(compressed=True)
    witness_script = bh2u(make_commitment_output_to_local_witness_script(
        revocation_pubkey, to_self_delay, this_delayed_pubkey))
    to_local_address = redeem_script_to_address('p2wsh', witness_script)
    output_idxs = ctx.get_output_idxs_from_address(to_local_address)
    if output_idxs:
        output_idx = output_idxs.pop()
        sweep_tx = create_sweeptx_ctx_to_local(
            sweep_address=sweep_address,
            ctx=ctx,
            output_idx=output_idx,
            witness_script=bfh(witness_script),
            privkey=other_revocation_privkey,
            is_revocation=True,
            config=chan.lnworker.config)
        if sweep_tx:
            txs.append(sweep_tx)
    # HTLCs
    def create_sweeptx_for_htlc(*, htlc: 'UpdateAddHtlc', htlc_direction: Direction,
                                ctx_output_idx: int) -> Optional[Transaction]:
        htlc_tx_witness_script, htlc_tx = make_htlc_tx_with_open_channel(
            chan=chan,
            pcp=pcp,
            subject=REMOTE,
            ctn=ctn,
            htlc_direction=htlc_direction,
            commit=ctx,
            htlc=htlc,
            ctx_output_idx=ctx_output_idx)
        return create_sweeptx_that_spends_htlctx_that_spends_htlc_in_ctx(
            htlc_tx=htlc_tx,
            htlctx_witness_script=htlc_tx_witness_script,
            sweep_address=sweep_address,
            privkey=other_revocation_privkey,
            is_revocation=True,
            config=chan.lnworker.config)

    htlc_to_ctx_output_idx_map = map_htlcs_to_ctx_output_idxs(
        chan=chan,
        ctx=ctx,
        pcp=pcp,
        subject=REMOTE,
        ctn=ctn)
    for (direction, htlc), (ctx_output_idx, htlc_relative_idx) in htlc_to_ctx_output_idx_map.items():
        secondstage_sweep_tx = create_sweeptx_for_htlc(
            htlc=htlc,
            htlc_direction=direction,
            ctx_output_idx=ctx_output_idx)
        if secondstage_sweep_tx:
            txs.append(secondstage_sweep_tx)
    return txs

def create_sweeptx_for_their_revoked_ctx(
        chan: 'Channel',
        ctx: Transaction,
        per_commitment_secret: bytes,
        sweep_address: str) -> Optional[Callable[[], Optional[Transaction]]]:
    # prep
    pcp = ecc.ECPrivkey(per_commitment_secret).get_public_key_bytes(compressed=True)
    this_conf, other_conf = get_ordered_channel_configs(chan=chan, for_us=False)
    other_revocation_privkey = derive_blinded_privkey(other_conf.revocation_basepoint.privkey,
                                                      per_commitment_secret)
    to_self_delay = other_conf.to_self_delay
    this_delayed_pubkey = derive_pubkey(this_conf.delayed_basepoint.pubkey, pcp)
    txs = []
    # to_local
    revocation_pubkey = ecc.ECPrivkey(other_revocation_privkey).get_public_key_bytes(compressed=True)
    witness_script = bh2u(make_commitment_output_to_local_witness_script(
        revocation_pubkey, to_self_delay, this_delayed_pubkey))
    to_local_address = redeem_script_to_address('p2wsh', witness_script)
    output_idxs = ctx.get_output_idxs_from_address(to_local_address)
    if output_idxs:
        output_idx = output_idxs.pop()
        sweep_tx = lambda: create_sweeptx_ctx_to_local(
            sweep_address=sweep_address,
            ctx=ctx,
            output_idx=output_idx,
            witness_script=bfh(witness_script),
            privkey=other_revocation_privkey,
            is_revocation=True,
            config=chan.lnworker.config)
        return sweep_tx
    return None

def create_sweeptx_for_their_revoked_htlc(
        chan: 'Channel',
        ctx: Transaction,
        htlc_tx: Transaction,
        sweep_address: str) -> Optional[SweepInfo]:

    x = analyze_ctx(chan, ctx)
    if not x:
        return
    ctn, their_pcp, is_revocation, per_commitment_secret = x
    if not is_revocation:
        return
    # prep
    pcp = ecc.ECPrivkey(per_commitment_secret).get_public_key_bytes(compressed=True)
    this_conf, other_conf = get_ordered_channel_configs(chan=chan, for_us=False)
    other_revocation_privkey = derive_blinded_privkey(
        other_conf.revocation_basepoint.privkey,
        per_commitment_secret)
    to_self_delay = other_conf.to_self_delay
    this_delayed_pubkey = derive_pubkey(this_conf.delayed_basepoint.pubkey, pcp)
    # same witness script as to_local
    revocation_pubkey = ecc.ECPrivkey(other_revocation_privkey).get_public_key_bytes(compressed=True)
    witness_script = bh2u(make_commitment_output_to_local_witness_script(
        revocation_pubkey, to_self_delay, this_delayed_pubkey))
    htlc_address = redeem_script_to_address('p2wsh', witness_script)
    # check that htlc_tx is a htlc
    if htlc_tx.outputs()[0].address != htlc_address:
        return
    gen_tx = lambda: create_sweeptx_that_spends_htlctx_that_spends_htlc_in_ctx(
        sweep_address=sweep_address,
        htlc_tx=htlc_tx,
        htlctx_witness_script=bfh(witness_script),
        privkey=other_revocation_privkey,
        is_revocation=True,
        config=chan.lnworker.config)
    return SweepInfo(
        name='redeem_htlc2',
        csv_delay=0,
        cltv_expiry=0,
        gen_tx=gen_tx)

def create_sweeptxs_for_our_ctx(
        *, chan: 'AbstractChannel',
        ctx: Transaction,
        sweep_address: str) -> Optional[Dict[str, SweepInfo]]:
    """Handle the case where we force close unilaterally with our latest ctx.
    Construct sweep txns for 'to_local', and for all HTLCs (2 txns each).
    'to_local' can be swept even if this is a breach (by us),
    but HTLCs cannot (old HTLCs are no longer stored).
    """
    ctn = extract_ctn_from_tx_and_chan(ctx, chan)
    our_conf, their_conf = get_ordered_channel_configs(chan=chan, for_us=True)
    our_per_commitment_secret = get_per_commitment_secret_from_seed(
        our_conf.per_commitment_secret_seed, RevocationStore.START_INDEX - ctn)
    our_pcp = ecc.ECPrivkey(our_per_commitment_secret).get_public_key_bytes(compressed=True)
    our_delayed_bp_privkey = ecc.ECPrivkey(our_conf.delayed_basepoint.privkey)
    our_localdelayed_privkey = derive_privkey(our_delayed_bp_privkey.secret_scalar, our_pcp)
    our_localdelayed_privkey = ecc.ECPrivkey.from_secret_scalar(our_localdelayed_privkey)
    their_revocation_pubkey = derive_blinded_pubkey(their_conf.revocation_basepoint.pubkey, our_pcp)
    to_self_delay = their_conf.to_self_delay
    our_htlc_privkey = derive_privkey(secret=int.from_bytes(our_conf.htlc_basepoint.privkey, 'big'),
                                       per_commitment_point=our_pcp).to_bytes(32, 'big')
    our_localdelayed_pubkey = our_localdelayed_privkey.get_public_key_bytes(compressed=True)
    to_local_witness_script = bh2u(make_commitment_output_to_local_witness_script(
        their_revocation_pubkey, to_self_delay, our_localdelayed_pubkey))
    to_local_address = redeem_script_to_address('p2wsh', to_local_witness_script)
    # to remote address
    bpk = their_conf.payment_basepoint.pubkey
    their_payment_pubkey = bpk if chan.is_static_remotekey_enabled() else derive_pubkey(their_conf.payment_basepoint.pubkey, our_pcp)
    to_remote_address = make_commitment_output_to_remote_address(their_payment_pubkey)
    # test ctx
    _logger.debug(f'testing our ctx: {to_local_address} {to_remote_address}')
    if not ctx.get_output_idxs_from_address(to_local_address) \
       and not ctx.get_output_idxs_from_address(to_remote_address):
        return
    # we have to_local, to_remote.
    # other outputs are htlcs
    # if they are spent, we need to generate the script
    # so, second-stage htlc sweep should not be returned here
    txs = {}  # type: Dict[str, SweepInfo]
    # to_local
    output_idxs = ctx.get_output_idxs_from_address(to_local_address)
    if output_idxs:
        output_idx = output_idxs.pop()
        sweep_tx = lambda: create_sweeptx_ctx_to_local(
            sweep_address=sweep_address,
            ctx=ctx,
            output_idx=output_idx,
            witness_script=bfh(to_local_witness_script),
            privkey=our_localdelayed_privkey.get_secret_bytes(),
            is_revocation=False,
            to_self_delay=to_self_delay,
            config=chan.lnworker.config)
        prevout = ctx.txid() + ':%d'%output_idx
        txs[prevout] = SweepInfo(
            name='our_ctx_to_local',
            csv_delay=to_self_delay,
            cltv_expiry=0,
            gen_tx=sweep_tx)
    we_breached = ctn < chan.get_oldest_unrevoked_ctn(LOCAL)
    if we_breached:
        _logger.info("we breached.")
        # return only our_ctx_to_local, because we don't keep htlc_signatures for old states
        return txs

    # HTLCs
    def create_txns_for_htlc(
            *, htlc: 'UpdateAddHtlc', htlc_direction: Direction,
            ctx_output_idx: int, htlc_relative_idx: int):
        if htlc_direction == RECEIVED:
            preimage = chan.lnworker.get_preimage(htlc.payment_hash)
        else:
            preimage = None
        htlctx_witness_script, htlc_tx = create_htlctx_that_spends_from_our_ctx(
            chan=chan,
            our_pcp=our_pcp,
            ctx=ctx,
            htlc=htlc,
            local_htlc_privkey=our_htlc_privkey,
            preimage=preimage,
            htlc_direction=htlc_direction,
            ctx_output_idx=ctx_output_idx,
            htlc_relative_idx=htlc_relative_idx)
        sweep_tx = lambda: create_sweeptx_that_spends_htlctx_that_spends_htlc_in_ctx(
            to_self_delay=to_self_delay,
            htlc_tx=htlc_tx,
            htlctx_witness_script=htlctx_witness_script,
            sweep_address=sweep_address,
            privkey=our_localdelayed_privkey.get_secret_bytes(),
            is_revocation=False,
            config=chan.lnworker.config)
        # side effect
        txs[htlc_tx.inputs()[0].prevout.to_str()] = SweepInfo(
            name='first-stage-htlc',
            csv_delay=0,
            cltv_expiry=htlc_tx.locktime,
            gen_tx=lambda: htlc_tx)
        txs[htlc_tx.txid() + ':0'] = SweepInfo(
            name='second-stage-htlc',
            csv_delay=to_self_delay,
            cltv_expiry=0,
            gen_tx=sweep_tx)

    # offered HTLCs, in our ctx --> "timeout"
    # received HTLCs, in our ctx --> "success"
    htlc_to_ctx_output_idx_map = map_htlcs_to_ctx_output_idxs(
        chan=chan,
        ctx=ctx,
        pcp=our_pcp,
        subject=LOCAL,
        ctn=ctn)
    for (direction, htlc), (ctx_output_idx, htlc_relative_idx) in htlc_to_ctx_output_idx_map.items():
        create_txns_for_htlc(
            htlc=htlc,
            htlc_direction=direction,
            ctx_output_idx=ctx_output_idx,
            htlc_relative_idx=htlc_relative_idx)
    return txs

def analyze_ctx(chan: 'Channel', ctx: Transaction):
    # note: the remote sometimes has two valid non-revoked commitment transactions,
    # either of which could be broadcast
    our_conf, their_conf = get_ordered_channel_configs(chan=chan, for_us=True)
    ctn = extract_ctn_from_tx_and_chan(ctx, chan)
    per_commitment_secret = None
    oldest_unrevoked_remote_ctn = chan.get_oldest_unrevoked_ctn(REMOTE)
    if ctn == oldest_unrevoked_remote_ctn:
        their_pcp = their_conf.current_per_commitment_point
        is_revocation = False
    elif ctn == oldest_unrevoked_remote_ctn + 1:
        their_pcp = their_conf.next_per_commitment_point
        is_revocation = False
    elif ctn < oldest_unrevoked_remote_ctn:  # breach
        try:
            per_commitment_secret = chan.revocation_store.retrieve_secret(RevocationStore.START_INDEX - ctn)
        except UnableToDeriveSecret:
            return
        their_pcp = ecc.ECPrivkey(per_commitment_secret).get_public_key_bytes(compressed=True)
        is_revocation = True
        #_logger.info(f'tx for revoked: {list(txs.keys())}')
    elif chan.get_data_loss_protect_remote_pcp(ctn):
        their_pcp = chan.get_data_loss_protect_remote_pcp(ctn)
        is_revocation = False
    else:
        return
    return ctn, their_pcp, is_revocation, per_commitment_secret

def create_sweeptxs_for_their_ctx(
        *, chan: 'Channel',
        ctx: Transaction,
        sweep_address: str) -> Optional[Dict[str,SweepInfo]]:
    """Handle the case when the remote force-closes with their ctx.
    Sweep outputs that do not have a CSV delay ('to_remote' and first-stage HTLCs).
    Outputs with CSV delay ('to_local' and second-stage HTLCs) are redeemed by LNWatcher.
    """
    txs = {}  # type: Dict[str, SweepInfo]
    our_conf, their_conf = get_ordered_channel_configs(chan=chan, for_us=True)
    x = analyze_ctx(chan, ctx)
    if not x:
        return
    ctn, their_pcp, is_revocation, per_commitment_secret = x
    # to_local and to_remote addresses
    our_revocation_pubkey = derive_blinded_pubkey(our_conf.revocation_basepoint.pubkey, their_pcp)
    their_delayed_pubkey = derive_pubkey(their_conf.delayed_basepoint.pubkey, their_pcp)
    witness_script = bh2u(make_commitment_output_to_local_witness_script(
        our_revocation_pubkey, our_conf.to_self_delay, their_delayed_pubkey))
    to_local_address = redeem_script_to_address('p2wsh', witness_script)
    # to remote address
    bpk = our_conf.payment_basepoint.pubkey
    our_payment_pubkey = bpk if chan.is_static_remotekey_enabled() else derive_pubkey(bpk, their_pcp)
    to_remote_address = make_commitment_output_to_remote_address(our_payment_pubkey)
    # test if this is their ctx
    _logger.debug(f'testing their ctx: {to_local_address} {to_remote_address}')
    if not ctx.get_output_idxs_from_address(to_local_address) \
       and not ctx.get_output_idxs_from_address(to_remote_address):
        return
    if is_revocation:
        our_revocation_privkey = derive_blinded_privkey(our_conf.revocation_basepoint.privkey, per_commitment_secret)
        gen_tx = create_sweeptx_for_their_revoked_ctx(chan, ctx, per_commitment_secret, chan.sweep_address)
        if gen_tx:
            tx = gen_tx()
            txs[tx.inputs()[0].prevout.to_str()] = SweepInfo(
                name='to_local_for_revoked_ctx',
                csv_delay=0,
                cltv_expiry=0,
                gen_tx=gen_tx)
    # prep
    our_htlc_privkey = derive_privkey(secret=int.from_bytes(our_conf.htlc_basepoint.privkey, 'big'), per_commitment_point=their_pcp)
    our_htlc_privkey = ecc.ECPrivkey.from_secret_scalar(our_htlc_privkey)
    their_htlc_pubkey = derive_pubkey(their_conf.htlc_basepoint.pubkey, their_pcp)
    # to_local is handled by lnwatcher
    # to_remote
    if not chan.is_static_remotekey_enabled():
        our_payment_bp_privkey = ecc.ECPrivkey(our_conf.payment_basepoint.privkey)
        our_payment_privkey = derive_privkey(our_payment_bp_privkey.secret_scalar, their_pcp)
        our_payment_privkey = ecc.ECPrivkey.from_secret_scalar(our_payment_privkey)
        assert our_payment_pubkey == our_payment_privkey.get_public_key_bytes(compressed=True)
        output_idxs = ctx.get_output_idxs_from_address(to_remote_address)
        if output_idxs:
            output_idx = output_idxs.pop()
            prevout = ctx.txid() + ':%d'%output_idx
            sweep_tx = lambda: create_sweeptx_their_ctx_to_remote(
                sweep_address=sweep_address,
                ctx=ctx,
                output_idx=output_idx,
                our_payment_privkey=our_payment_privkey,
                config=chan.lnworker.config)
            txs[prevout] = SweepInfo(
                name='their_ctx_to_remote',
                csv_delay=0,
                cltv_expiry=0,
                gen_tx=sweep_tx)
    # HTLCs
    def create_sweeptx_for_htlc(
            htlc: 'UpdateAddHtlc', is_received_htlc: bool,
            ctx_output_idx: int) -> None:
        if not is_received_htlc and not is_revocation:
            preimage = chan.lnworker.get_preimage(htlc.payment_hash)
        else:
            preimage = None
        htlc_output_witness_script = make_htlc_output_witness_script(
            is_received_htlc=is_received_htlc,
            remote_revocation_pubkey=our_revocation_pubkey,
            remote_htlc_pubkey=our_htlc_privkey.get_public_key_bytes(compressed=True),
            local_htlc_pubkey=their_htlc_pubkey,
            payment_hash=htlc.payment_hash,
            cltv_expiry=htlc.cltv_expiry)

        cltv_expiry = htlc.cltv_expiry if is_received_htlc and not is_revocation else 0
        prevout = ctx.txid() + ':%d'%ctx_output_idx
        sweep_tx = lambda: create_sweeptx_their_ctx_htlc(
            ctx=ctx,
            witness_script=htlc_output_witness_script,
            sweep_address=sweep_address,
            preimage=preimage,
            output_idx=ctx_output_idx,
            privkey=our_revocation_privkey if is_revocation else our_htlc_privkey.get_secret_bytes(),
            is_revocation=is_revocation,
            cltv_expiry=cltv_expiry,
            config=chan.lnworker.config)
        txs[prevout] = SweepInfo(
            name=f'their_ctx_htlc_{ctx_output_idx}',
            csv_delay=0,
            cltv_expiry=cltv_expiry,
            gen_tx=sweep_tx)
    # received HTLCs, in their ctx --> "timeout"
    # offered HTLCs, in their ctx --> "success"
    htlc_to_ctx_output_idx_map = map_htlcs_to_ctx_output_idxs(
        chan=chan,
        ctx=ctx,
        pcp=their_pcp,
        subject=REMOTE,
        ctn=ctn)
    for (direction, htlc), (ctx_output_idx, htlc_relative_idx) in htlc_to_ctx_output_idx_map.items():
        create_sweeptx_for_htlc(
            htlc=htlc,
            is_received_htlc=direction == RECEIVED,
            ctx_output_idx=ctx_output_idx)
    return txs

def create_htlctx_that_spends_from_our_ctx(
        chan: 'Channel', our_pcp: bytes,
        ctx: Transaction, htlc: 'UpdateAddHtlc',
        local_htlc_privkey: bytes, preimage: Optional[bytes],
        htlc_direction: Direction, htlc_relative_idx: int,
        ctx_output_idx: int) -> Tuple[bytes, Transaction]:
    assert (htlc_direction == RECEIVED) == bool(preimage), 'preimage is required iff htlc is received'
    preimage = preimage or b''
    ctn = extract_ctn_from_tx_and_chan(ctx, chan)
    witness_script, htlc_tx = make_htlc_tx_with_open_channel(
        chan=chan,
        pcp=our_pcp,
        subject=LOCAL,
        ctn=ctn,
        htlc_direction=htlc_direction,
        commit=ctx,
        htlc=htlc,
        ctx_output_idx=ctx_output_idx,
        name=f'our_ctx_{ctx_output_idx}_htlc_tx_{bh2u(htlc.payment_hash)}')
    remote_htlc_sig = chan.get_remote_htlc_sig_for_htlc(htlc_relative_idx=htlc_relative_idx)
    local_htlc_sig = bfh(htlc_tx.sign_txin(0, local_htlc_privkey))
    txin = htlc_tx.inputs()[0]
    witness_program = bfh(Transaction.get_preimage_script(txin))
    txin.witness = make_htlc_tx_witness(remote_htlc_sig, local_htlc_sig, preimage, witness_program)
    return witness_script, htlc_tx

def create_sweeptx_their_ctx_htlc(
        ctx: Transaction, witness_script: bytes, sweep_address: str,
        preimage: Optional[bytes], output_idx: int,
        privkey: bytes, is_revocation: bool,
        cltv_expiry: int, config: SimpleConfig) -> Optional[PartialTransaction]:
    assert type(cltv_expiry) is int
    preimage = preimage or b''  # preimage is required iff (not is_revocation and htlc is offered)
    val = ctx.outputs()[output_idx].value
    prevout = TxOutpoint(txid=bfh(ctx.txid()), out_idx=output_idx)
    txin = PartialTxInput(prevout=prevout)
    txin._trusted_value_sats = val
    txin.witness_script = witness_script
    txin.script_sig = b''
    sweep_inputs = [txin]
    tx_size_bytes = 200  # TODO (depends on offered/received and is_revocation)
    fee = config.estimate_fee(tx_size_bytes, allow_fallback_to_static_rates=True)
    outvalue = val - fee
    if outvalue <= dust_threshold(): return None
    sweep_outputs = [PartialTxOutput.from_address_and_value(sweep_address, outvalue)]
    tx = PartialTransaction.from_io(sweep_inputs, sweep_outputs, version=2, locktime=cltv_expiry)
    sig = bfh(tx.sign_txin(0, privkey))
    if not is_revocation:
        witness = construct_witness([sig, preimage, witness_script])
    else:
        revocation_pubkey = privkey_to_pubkey(privkey)
        witness = construct_witness([sig, revocation_pubkey, witness_script])
    tx.inputs()[0].witness = bfh(witness)
    assert tx.is_complete()
    return tx

def create_sweeptx_their_ctx_to_remote(
        sweep_address: str, ctx: Transaction, output_idx: int,
        our_payment_privkey: ecc.ECPrivkey,
        config: SimpleConfig) -> Optional[PartialTransaction]:
    our_payment_pubkey = our_payment_privkey.get_public_key_hex(compressed=True)
    val = ctx.outputs()[output_idx].value
    prevout = TxOutpoint(txid=bfh(ctx.txid()), out_idx=output_idx)
    txin = PartialTxInput(prevout=prevout)
    txin._trusted_value_sats = val
    txin.script_type = 'p2wpkh'
    txin.pubkeys = [bfh(our_payment_pubkey)]
    txin.num_sig = 1
    sweep_inputs = [txin]
    tx_size_bytes = 110  # approx size of p2wpkh->p2wpkh
    fee = config.estimate_fee(tx_size_bytes, allow_fallback_to_static_rates=True)
    outvalue = val - fee
    if outvalue <= dust_threshold(): return None
    sweep_outputs = [PartialTxOutput.from_address_and_value(sweep_address, outvalue)]
    sweep_tx = PartialTransaction.from_io(sweep_inputs, sweep_outputs)
    sweep_tx.set_rbf(True)
    sweep_tx.sign({our_payment_pubkey: (our_payment_privkey.get_secret_bytes(), True)})
    if not sweep_tx.is_complete():
        raise Exception('channel close sweep tx is not complete')
    return sweep_tx

def create_sweeptx_ctx_to_local(
        *, sweep_address: str, ctx: Transaction, output_idx: int, witness_script: bytes,
        privkey: bytes, is_revocation: bool, config: SimpleConfig,
        to_self_delay: int = None) -> Optional[PartialTransaction]:
    """Create a txn that sweeps the 'to_local' output of a commitment
    transaction into our wallet.

    privkey: either revocation_privkey or localdelayed_privkey
    is_revocation: tells us which ^
    """
    val = ctx.outputs()[output_idx].value
    prevout = TxOutpoint(txid=bfh(ctx.txid()), out_idx=output_idx)
    txin = PartialTxInput(prevout=prevout)
    txin._trusted_value_sats = val
    txin.script_sig = b''
    txin.witness_script = witness_script
    sweep_inputs = [txin]
    if not is_revocation:
        assert isinstance(to_self_delay, int)
        sweep_inputs[0].nsequence = to_self_delay
    tx_size_bytes = 121  # approx size of to_local -> p2wpkh
    fee = config.estimate_fee(tx_size_bytes, allow_fallback_to_static_rates=True)
    outvalue = val - fee
    if outvalue <= dust_threshold():
        return None
    sweep_outputs = [PartialTxOutput.from_address_and_value(sweep_address, outvalue)]
    sweep_tx = PartialTransaction.from_io(sweep_inputs, sweep_outputs, version=2)
    sig = sweep_tx.sign_txin(0, privkey)
    witness = construct_witness([sig, int(is_revocation), witness_script])
    sweep_tx.inputs()[0].witness = bfh(witness)
    return sweep_tx

def create_sweeptx_that_spends_htlctx_that_spends_htlc_in_ctx(
        *, htlc_tx: Transaction, htlctx_witness_script: bytes, sweep_address: str,
        privkey: bytes, is_revocation: bool, to_self_delay: int = None,
        config: SimpleConfig) -> Optional[PartialTransaction]:
    """Create a txn that sweeps the output of a second stage htlc tx
    (i.e. sweeps from an HTLC-Timeout or an HTLC-Success tx).
    """
    # note: this is the same as sweeping the to_local output of the ctx,
    #       as these are the same script (address-reuse).
    return create_sweeptx_ctx_to_local(
        sweep_address=sweep_address,
        ctx=htlc_tx,
        output_idx=0,
        witness_script=htlctx_witness_script,
        privkey=privkey,
        is_revocation=is_revocation,
        to_self_delay=to_self_delay,
        config=config,
    )


text:
'use strict';

var gulp = require('gulp');

/** Copy Factory
------------------------------------------------------------------------------*/
function copy(glob, output) {
  return function () {
    return gulp.src(glob)
      .pipe(gulp.dest(output));
  }
}

/** Exports
------------------------------------------------------------------------------*/
module.exports = copy;


text:
package hu.interconnect.hr.backend.api.service;

import java.util.List;

import hu.interconnect.hr.backend.api.dto.SzemelyitorzsResponseDTO;
import hu.interconnect.hr.backend.api.dto.TszekEsNevekDTO;

public interface PersonaldataQueryService {

	SzemelyitorzsResponseDTO getSzemelyitorzs(int tsz);

	List<Integer> getOsszesSzemelyitorzs();

	List<Integer> getOsszesAktivSzemelyitorzs();

	TszekEsNevekDTO getIdAndNameList(boolean all);

}


text:
package com.vk.api.sdk.objects.board;

import com.google.gson.annotations.SerializedName;

/**
 * Sort type
 */
public enum DefaultOrder {
    @SerializedName("1")
    DESC_UPDATED(1),

    @SerializedName("2")
    DESC_CREATED(2),

    @SerializedName("-1")
    ASC_UPDATED(-1),

    @SerializedName("-2")
    ASC_CREATED(-2);

    private final Integer value;

    DefaultOrder(Integer value) {
        this.value = value;
    }

    public Integer getValue() {
        return value;
    }
}


text:
package com.amazonaws.services.kafka.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *
 * @see AWS
 *      API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class BatchDisassociateScramSecretResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * The Amazon Resource Name (ARN) of the cluster.
     *

     */
    private String clusterArn;
    /**
     *

     * List of errors when disassociating secrets to cluster.
     *

     */
    private java.util.List<UnprocessedScramSecret> unprocessedScramSecrets;

    /**
     *

     * The Amazon Resource Name (ARN) of the cluster.
     *

     *
     * @param clusterArn
     *

     *        The Amazon Resource Name (ARN) of the cluster.
     *

     */

    public void setClusterArn(String clusterArn) {
        this.clusterArn = clusterArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the cluster.
     *

     *
     * @return

     *         The Amazon Resource Name (ARN) of the cluster.
     *

     */

    public String getClusterArn() {
        return this.clusterArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the cluster.
     *

     *
     * @param clusterArn
     *

     *        The Amazon Resource Name (ARN) of the cluster.
     *

     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BatchDisassociateScramSecretResult withClusterArn(String clusterArn) {
        setClusterArn(clusterArn);
        return this;
    }

    /**
     *

     * List of errors when disassociating secrets to cluster.
     *

     *
     * @return

     *         List of errors when disassociating secrets to cluster.
     *

     */

    public java.util.List<UnprocessedScramSecret> getUnprocessedScramSecrets() {
        return unprocessedScramSecrets;
    }

    /**
     *

     * List of errors when disassociating secrets to cluster.
     *

     *
     * @param unprocessedScramSecrets
     *

     *        List of errors when disassociating secrets to cluster.
     *

     */

    public void setUnprocessedScramSecrets(java.util.Collection<UnprocessedScramSecret> unprocessedScramSecrets) {
        if (unprocessedScramSecrets == null) {
            this.unprocessedScramSecrets = null;
            return;
        }

        this.unprocessedScramSecrets = new java.util.ArrayList<UnprocessedScramSecret>(unprocessedScramSecrets);
    }

    /**
     *

     * List of errors when disassociating secrets to cluster.
     *

     *
     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setUnprocessedScramSecrets(java.util.Collection)} or
     * {@link #withUnprocessedScramSecrets(java.util.Collection)} if you want to override the existing values.
     *

     *
     * @param unprocessedScramSecrets
     *

     *        List of errors when disassociating secrets to cluster.
     *

     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BatchDisassociateScramSecretResult withUnprocessedScramSecrets(UnprocessedScramSecret... unprocessedScramSecrets) {
        if (this.unprocessedScramSecrets == null) {
            setUnprocessedScramSecrets(new java.util.ArrayList<UnprocessedScramSecret>(unprocessedScramSecrets.length));
        }
        for (UnprocessedScramSecret ele : unprocessedScramSecrets) {
            this.unprocessedScramSecrets.add(ele);
        }
        return this;
    }

    /**
     *

     * List of errors when disassociating secrets to cluster.
     *

     *
     * @param unprocessedScramSecrets
     *

     *        List of errors when disassociating secrets to cluster.
     *

     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BatchDisassociateScramSecretResult withUnprocessedScramSecrets(java.util.Collection<UnprocessedScramSecret> unprocessedScramSecrets) {
        setUnprocessedScramSecrets(unprocessedScramSecrets);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getClusterArn() != null)
            sb.append("ClusterArn: ").append(getClusterArn()).append(",");
        if (getUnprocessedScramSecrets() != null)
            sb.append("UnprocessedScramSecrets: ").append(getUnprocessedScramSecrets());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof BatchDisassociateScramSecretResult == false)
            return false;
        BatchDisassociateScramSecretResult other = (BatchDisassociateScramSecretResult) obj;
        if (other.getClusterArn() == null ^ this.getClusterArn() == null)
            return false;
        if (other.getClusterArn() != null && other.getClusterArn().equals(this.getClusterArn()) == false)
            return false;
        if (other.getUnprocessedScramSecrets() == null ^ this.getUnprocessedScramSecrets() == null)
            return false;
        if (other.getUnprocessedScramSecrets() != null && other.getUnprocessedScramSecrets().equals(this.getUnprocessedScramSecrets()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getClusterArn() == null) ? 0 : getClusterArn().hashCode());
        hashCode = prime * hashCode + ((getUnprocessedScramSecrets() == null) ? 0 : getUnprocessedScramSecrets().hashCode());
        return hashCode;
    }

    @Override
    public BatchDisassociateScramSecretResult clone() {
        try {
            return (BatchDisassociateScramSecretResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
package model

import (
	"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud-sdk-go-v3/core/utils"

	"strings"
)

// Response Object
type BatchRemoveScalingInstancesResponse struct {
	HttpStatusCode int `json:"-"`
}

func (o BatchRemoveScalingInstancesResponse) String() string {
	data, err := utils.Marshal(o)
	if err != nil {
		return "BatchRemoveScalingInstancesResponse struct{}"
	}

	return strings.Join([]string{"BatchRemoveScalingInstancesResponse", string(data)}, " ")
}


text:
#include <stdio.h>
#include <signal.h>
#include "msgQLib.h"
#include "ipcKeyDbm.h"
#include "errLogLib.h"
#include "hostMsgChannels.h"

/*
*  record structure for process with msgQs that this process
*  may wish to talk to.
*/
typedef struct _outmsg {
			  MSG_Q_ID procMsgQ;
			  char *procName;
			  int msgSize;
			} IPC_PROC_RECORD;

/*
*  Initialized data base for all process that msgQs
*  that this process may wish to talk to.
*  the record define can be found in hostMsgChannels.h
*  and their order is important.
*/
static IPC_PROC_RECORD msgQs[MSG_Q_DBM_SIZE] = {
		EXP_RECORD,
		RECV_RECORD,
		SEND_RECORD,
		PROC_RECORD,
		ROBO_RECORD,
		AUTO_RECORD,
		IAUL_RECORD,
		SPUL_RECORD,
		NULL_RECORD,
		NULL_RECORD
           };

/**************************************************************
*
*  sendMsg - Send message via Message Q in dataBase.
*
* 1. Obtain process msgQ info from the IPC Key Database
* 2. Check that the request process exists & running
* 3. If messageQ has not been open then open a messageQ
*    based on the ipc key to process
* 4. Send Message
* 5. Send Signal to process indicating message sent.
*
* RETURNS:
* 0 , -1 on error.
*
*       Author Greg Brissey 8/31/94
*/
sendMsg(IPC_KEY_DBM_ID keyId, int process,char *message, int priority, int waitflg)
{
   IPC_KEY_DBM_DATA msgeEntry;
   MSG_Q_ID msgId;
   int len,stat;

   /* using process name get ipcKey entry */
   if (stat = ipcKeyGet(keyId, msgQs[process].procName, &msgeEntry) == -1)
   {
      errLogRet(ErrLogOp,debugInfo,
	"ipcSendMsg: '%s' is not contained in the IPC database\n",
	msgQs[process].procName);
      return(-1);
   }

   /* if process not present give error */
   if (msgeEntry.pidActive != 1)
   {
      errLogRet(ErrLogOp,debugInfo,
	"ipcSendMsg: '%s' is not running\n",msgQs[process].procName);
      return(-1);
   }

   /* if msgQ has not already been created, make one
   * the assumption here is that the ipc key will not change
   * over different executions of the process. This is true
   * at the present time.
   */
   if (msgQs[process].procMsgQ == NULL)
   {
      /* create message queue with returned key_t key */
      msgId = msgQCreate(msgeEntry.ipcKey, msgQs[process].msgSize);
      if (msgId == NULL)
      {
        errLogRet(ErrLogOp,debugInfo,"sendMsg: msgQCreate() failed.\n");
	return(-1);
      }
      msgQs[process].procMsgQ = msgId;
   }

   /* Put the message into the Queue */
   len = strlen(message);
   if (msgQSend(msgQs[process].procMsgQ, message, len, waitflg, priority) == -1)
   {
	return(-1);
   }
   /* send the async signal to process to inform it a message has been sent */
   if (kill(msgeEntry.pid,SIGUSR1) == -1)
   {
      errLogSysRet(ErrLogOp,debugInfo,
	"sendMsg: msgQ async Signal could not be sent to; '%s',pid: %d",
		msgQs[process].procName, msgeEntry.pid);
      return(-1);
   }
   return(0);
}
/**************************************************************
*
*  sendMsgByName - Send message via Message Q in dataBase.
*
* 1. Obtain process msgQ info from the IPC Key Database
* 2. Check that the request process exists & running
* 3. If messageQ has not been open then open a messageQ
*    based on the ipc key to process
* 4. Send Message
* 5. Send Signal to process indicating message sent.
*
* RETURNS:
* 0 , -1 on error.
*
*       Author Greg Brissey 8/31/94
*/
sendMsgByName(IPC_KEY_DBM_ID keyId, char *procname,char *message, int priority, int waitflg)
{
   IPC_KEY_DBM_DATA msgeEntry;
   MSG_Q_ID msgId;
   int len,stat,i,index;

   /* using process name get ipcKey entry */
   if (stat = ipcKeyGet(keyId, procname, &msgeEntry) == -1)
   {
      errLogRet(ErrLogOp,debugInfo,
	"sendMsgByName: '%s' is not contained in the IPC database\n",
	   procname);
      return(-1);
   }

   /* if process not present give error */
   if (msgeEntry.pidActive != 1)
   {
      errLogRet(ErrLogOp,debugInfo,
	"sendMsgByName: '%s' is not running\n",procname);
      return(-1);
   }

   /*
   * if msgQ has not already been created, make one
   * the assumption here is that the ipc key will not change
   * over different executions of the process. This is true
   * at the present time.
   */
   index = -1;
   for(i=0; i < MSG_Q_DBM_SIZE; i++)
   {
      if (strcmp(procname,msgQs[i].procName) == 0)
      {
	 index = i;
      }
   }
   if (index == -1)
   {
      errLogRet(ErrLogOp,debugInfo,
	"sendMsgByName: %s not found in  msgQs.\n",procname);
      return(-1);
   }

   if (msgQs[index].procMsgQ == NULL)
   {
      /* create message queue with returned key_t key */
      msgId = msgQCreate(msgeEntry.ipcKey, msgQs[index].msgSize);
      if (msgId == NULL)
      {
        errLogRet(ErrLogOp,debugInfo,"sendMsg: msgQCreate() failed.\n");
	return(-1);
      }
      msgQs[index].procMsgQ = msgId;
   }

   /* Put the message into the Queue */
   len = strlen(message);
   if (msgQSend(msgQs[index].procMsgQ, message, len, waitflg, priority) == -1)
   {
	return(-1);
   }
   /* send the async signal to process to inform it a message has been sent */
   if (kill(msgeEntry.pid,SIGUSR1) == -1)
   {
      errLogSysRet(ErrLogOp,debugInfo,
	"sendMsg: msgQ async Signal could not be sent to; '%s',pid: %d",
		msgQs[index].procName, msgeEntry.pid);
      return(-1);
   }
   return(0);
}


text:
// Generated by xsd compiler for android/java
// DO NOT CHANGE!
package com.ebay.trading.api;

import java.io.Serializable;
import com.leansoft.nano.annotation.*;
import java.util.List;

/**
 *
 * This type is deprecated as <b>GetProduct*</b> calls were deprecated.
 *
 *
 */
public class ProductSearchType implements Serializable {

    private static final long serialVersionUID = -1L;

	@Element(name = "ProductSearchID")
	@Order(value=0)
	public String productSearchID;

	@Element(name = "AttributeSetID")
	@Order(value=1)
	public int attributeSetID;

	@Element(name = "ProductFinderID")
	@Order(value=2)
	public Integer productFinderID;

	@Element(name = "ProductID")
	@Order(value=3)
	public String productID;

	@Element(name = "SortAttributeID")
	@Order(value=4)
	public Integer sortAttributeID;

	@Element(name = "MaxChildrenPerFamily")
	@Order(value=5)
	public Integer maxChildrenPerFamily;

	@Element(name = "SearchAttributes")
	@Order(value=6)
	public List<SearchAttributesType> searchAttributes;

	@Element(name = "Pagination")
	@Order(value=7)
	public PaginationType pagination;

	@Element(name = "AvailableItemsOnly")
	@Order(value=8)
	public Boolean availableItemsOnly;

	@Element(name = "QueryKeywords")
	@Order(value=9)
	public String queryKeywords;

	@Element(name = "CharacteristicSetIDs")
	@Order(value=10)
	public CharacteristicSetIDsType characteristicSetIDs;

	@Element(name = "ProductReferenceID")
	@Order(value=11)
	public String productReferenceID;

	@Element(name = "ExternalProductID")
	@Order(value=12)
	public ExternalProductIDType externalProductID;

	@AnyElement
	@Order(value=13)
	public List<Object> any;

}


text:
layout: singlepagelist
title: JEE Advanced 2015 Results
name: Advance 2015
paper : advance
year : 2015
roll_regex : /^([0-9]{7})$/
total_pages : 1
last_rank : 21156
---


text:
/* The Nivo Slider styles */
.nivoSlider {
	position:relative;
	width:100%;
	height:auto;
	overflow: hidden;
}
.nivoSlider img {
	position:absolute;
	top:0px;
	left:0px;
	max-width: none;
}
.nivo-main-image {
	display: block !important;
	position: relative !important;
	width: 100% !important;
}

/* If an image is wrapped in a link */
.nivoSlider a.nivo-imageLink {
	position:absolute;
	top:0px;
	left:0px;
	width:100%;
	height:100%;
	border:0;
	padding:0;
	margin:0;
	z-index:6;
	display:none;
	background:white;
	filter:alpha(opacity=0);
	opacity:0;
}
/* The slices and boxes in the Slider */
.nivo-slice {
	display:block;
	position:absolute;
	z-index:5;
	height:100%;
	top:0;
}
.nivo-box {
	display:block;
	position:absolute;
	z-index:5;
	overflow:hidden;
}
.nivo-box img { display:block; }

/* Caption styles */
.nivo-caption {
	position:absolute;
	left:0px;
	bottom:0px;
	background:#000;
	color:#fff;
	width:100%;
	z-index:8;
	padding: 5px 10px;
	opacity: 0.8;
	overflow: hidden;
	display: none;
	-moz-opacity: 0.8;
	filter:alpha(opacity=8);
	-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
	-moz-box-sizing: border-box;    /* Firefox, other Gecko */
	box-sizing: border-box;         /* Opera/IE 8+ */
}
.nivo-caption p {
	padding:5px;
	margin:0;
}
.nivo-caption a {
	display:inline-block !important;
}
.nivo-html-caption {
    display:none;
}
/* Direction nav styles (e.g. Next & Prev) */
.nivo-directionNav a {
	position:absolute;
	top:45%;
	z-index:9;
	cursor:pointer;
}
.nivo-prevNav {
	left:0px;
}
.nivo-nextNav {
	right:0px;
}
/* Control nav styles (e.g. 1,2,3...) */
.nivo-controlNav {
	text-align:center;
	padding: 15px 0;
}
.nivo-controlNav a {
	cursor:pointer;
}
.nivo-controlNav a.active {
	font-weight:bold;
}
.nivo-controlNav img {
	display:inline; /* Unhide the thumbnails */
	position:relative;
	margin: 5px;
	opacity: 0.7;
}
.nivo-controlNav .active img,
.nivo-controlNav img:hover {
	opacity: 1;
}


text:
using System;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Data;

namespace PackageExplorer
{
    public class NormalizeTextConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var stringValue = (string)value;
            if (string.IsNullOrEmpty(stringValue))
            {
                return stringValue;
            }

            // replace a series of whitepaces with a single whitespace
            // REVIEW: Should we avoid regex and just do this manually?
            return Regex.Replace(stringValue, @"[\f\t\v\x85\p{Z}]+", " ");
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}


text:
<!DOCTYPE html>

	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
	<link type="image/x-icon" href="favicon.ico" rel="icon">

	ExpressHttpTest

GET

POST


text:
package org.qi4j.sample.dcicargo.sample_a.communication.web.booking;

import java.util.Date;
import java.util.List;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.devutils.stateless.StatelessComponent;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.qi4j.sample.dcicargo.sample_a.communication.query.CommonQueries;
import org.qi4j.sample.dcicargo.sample_a.communication.query.dto.CargoDTO;
import org.qi4j.sample.dcicargo.sample_a.communication.web.tracking.HandlingHistoryPanel;
import org.qi4j.sample.dcicargo.sample_a.communication.web.tracking.NextHandlingEventPanel;
import org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.RouteSpecification;
import org.qi4j.sample.dcicargo.sample_a.data.shipping.delivery.Delivery;
import org.qi4j.sample.dcicargo.sample_a.data.shipping.delivery.RoutingStatus;
import org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary.Leg;
import org.qi4j.sample.dcicargo.sample_a.infrastructure.wicket.color.CorrectColor;
import org.qi4j.sample.dcicargo.sample_a.infrastructure.wicket.color.ErrorColor;
import org.qi4j.sample.dcicargo.sample_a.infrastructure.wicket.link.LinkPanel;
import org.qi4j.sample.dcicargo.sample_a.infrastructure.wicket.prevnext.PrevNext;

/**
 * Cargo details - an overview of all data available about a cargo.
 */
@StatelessComponent
public class CargoDetailsPage extends BookingBasePage
{
    public CargoDetailsPage( PageParameters parameters )
    {
        this( parameters.get( 0 ).toString() );
    }

    public CargoDetailsPage( String trackingId )
    {
        super( new PageParameters().set( 0, trackingId ) );

        IModel<CargoDTO> cargoModel = new CommonQueries().cargo( trackingId );
        CargoDTO cargo = cargoModel.getObject();
        Delivery delivery = cargo.delivery().get();
        RouteSpecification routeSpecification = cargo.routeSpecification().get();
        final RoutingStatus routingStatus = delivery.routingStatus().get();
        Boolean isMisrouted = routingStatus == RoutingStatus.MISROUTED;

        add( new PrevNext( "prevNext", CargoDetailsPage.class, trackingId ) );

        add( new Label( "trackingId", trackingId ) );
        add( new Label( "origin", cargo.origin().get().getString() ) );
        add( new Label( "destination", routeSpecification.destination()
            .get()
            .getString() ).add( new CorrectColor( isMisrouted ) ) );
        add( new Label( "deadline", Model.of( routeSpecification.arrivalDeadline().get() ) ) );
        add( new Label( "routingStatus", routingStatus.toString() ).add( new ErrorColor( isMisrouted ) ) );
        add( new LinkPanel( "changeDestination", ChangeDestinationPage.class, trackingId, "Change destination" ) );

        if( routingStatus == RoutingStatus.NOT_ROUTED )
        {
            add( new LinkPanel( "routingAction", RouteCargoPage.class, trackingId, "Route" ) );
            add( new Label( "delivery" ) );
            add( new Label( "itinerary" ) );
        }
        else if( routingStatus == RoutingStatus.ROUTED )
        {
            add( new LinkPanel( "routingAction", RouteCargoPage.class, trackingId, "Re-route" ) );
            add( new DeliveryFragment( delivery ) );
            add( new ItineraryFragment( cargoModel, routingStatus ) );
        }
        else if( routingStatus == RoutingStatus.MISROUTED )
        {
            add( new LinkPanel( "routingAction", RouteCargoPage.class, trackingId, "Re-route" ) );
            add( new DeliveryFragment( delivery ) );
            add( new ItineraryFragment( cargoModel, routingStatus ) );
        }
        else
        {
            throw new RuntimeException( "Unknown routing status." );
        }

        if( delivery.lastHandlingEvent().get() == null )
        {
            add( new Label( "handlingHistoryPanel" ) );
        }
        else
        {
            add( new HandlingHistoryPanel( "handlingHistoryPanel", cargoModel, trackingId ) );
        }

        add( new NextHandlingEventPanel( "nextHandlingEventPanel", cargoModel ) );
    }
//
//    @Override
//    public boolean isVersioned()
//    {
//        return false;
//    }

    private class ItineraryFragment extends Fragment
    {
        public ItineraryFragment( final IModel<CargoDTO> cargoModel, final RoutingStatus routingStatus )
        {
            super( "itinerary", "itineraryFragment", CargoDetailsPage.this );

            IModel<List<Leg>> legListModel = new LoadableDetachableModel<List<Leg>>()
            {
                @Override
                protected List<Leg> load()
                {
                    return cargoModel.getObject().itinerary().get().legs().get();
                }
            };

            add( new ListView<Leg>( "legs", legListModel )
            {
                @Override
                protected void populateItem( ListItem<Leg> item )
                {
                    Leg leg = item.getModelObject();

                    item.add( new Label( "loadLocation", leg.loadLocation().get().getCode() ) );
                    item.add( new Label( "loadTime", new Model<Date>( leg.loadTime().get() ) ) );
                    item.add( new Label( "voyage", leg.voyage().get().voyageNumber().get().number().get() ) );

                    Boolean isMisrouted = routingStatus == RoutingStatus.MISROUTED && item.getIndex() == ( getList().size() - 1 );
                    item.add( new Label( "unloadLocation", leg.unloadLocation().get().getCode() )
                                  .add( new ErrorColor( isMisrouted ) ) );

                    item.add( new Label( "unloadTime", new Model<Date>( leg.unloadTime().get() ) ) );
                }
            } );
        }
    }

    private class DeliveryFragment extends Fragment
    {
        public DeliveryFragment( Delivery delivery )
        {
            super( "delivery", "deliveryFragment", CargoDetailsPage.this );

            add( new Label( "transportStatus", delivery.transportStatus().get().toString() ) );

            if( delivery.isMisdirected().get() )
            {
                String msg = "Cargo is misdirected. \nPlease reroute cargo.";
                add( new MultiLineLabel( "deliveryStatus", msg ).add( new AttributeModifier( "class", "errorColor" ) ) );
            }
            else
            {
                add( new Label( "deliveryStatus", "On track" ) );
            }
        }
    }
}


text:
<?php

namespace Imagga\Imagga\Results;

class ColorExtractionResult
{

    private $_image;

    private $_backgroundColors;
    private $_foregroundColors;
    private $_dominantColors;

    private $_colorPercentageThreshold;
    private $_colorVariance;
    private $_objectPercentage;

    public static function fromJson($jsonString)
    {
        $jsonResult = json_decode($jsonString);
        $results = array();
        foreach ($jsonResult->results as $result) {
            $colorExtractionResult = new ColorExtractionResult();
            $colorExtractionResult->setImage($result->image);
            $colorExtractionResult->setBackgroundColors($result->info->background_colors);
            $colorExtractionResult->setObjectColors($result->info->foreground_colors);
            $colorExtractionResult->setDominantColors($result->info->image_colors);
            $colorExtractionResult->setColorVariance($result->info->color_variance);
            $colorExtractionResult->setColorPercentageThreshold($result->info->color_percent_threshold);
            $colorExtractionResult->setObjectPercentage($result->info->object_percentage);
            $results[] = $colorExtractionResult;
        }
        return $results;
    }

    /**
     * @return array of Color objects
     */
    public function getBackgroundColors()
    {
        return $this->_backgroundColors;
    }

    /**
     * @return array of Color objects
     */
    public function getObjectColors()
    {
        return $this->_foregroundColors;
    }

    /**
     * @return array of Color objects
     */
    public function getDominantColors()
    {
        return $this->_dominantColors;
    }

    /**
     * @return float
     */
    public function getObjectPercentage()
    {
        return $this->_objectPercentage;
    }

    /**
     * @param mixed $image
     */
    public function setImage($image)
    {
        $this->_image = $image;
    }

    /**
     * @param mixed $backgroundColors
     */
    public function setBackgroundColors($backgroundColors)
    {
        $this->_backgroundColors = array();
        foreach ($backgroundColors as $colorInfo)
        {
            $this->_backgroundColors[] = new Color($colorInfo);
        }
    }

    /**
     * @param mixed $foregroundColors
     */
    public function setObjectColors($foregroundColors)
    {
        $this->_foregroundColors = array();
        foreach ($foregroundColors as $colorInfo)
        {
            $this->_foregroundColors[] = new Color($colorInfo);
        }
    }

    /**
     * @param mixed $dominantColors
     */
    public function setDominantColors($dominantColors)
    {
        $this->_dominantColors = array();
        foreach ($dominantColors as $colorInfo)
        {
            $this->_dominantColors[] = new Color($colorInfo);
        }
    }

    /**
     * @param $colorPercentageThreshold
     */
    public function setColorPercentageThreshold($colorPercentageThreshold)
    {
        $this->_colorPercentageThreshold = floatval($colorPercentageThreshold);
    }

    /**
     * @param mixed $colorVariance
     */
    public function setColorVariance($colorVariance)
    {
        $this->_colorVariance = floatval($colorVariance);
    }

    /**
     * @return mixed
     */
    public function getColorVariance()
    {
        return $this->_colorVariance;
    }

    /**
     * @param mixed $objectPercentage
     */
    public function setObjectPercentage($objectPercentage)
    {
        $this->_objectPercentage = floatval($objectPercentage);
    }

    /**
     * @return mixed
     */
    public function getColorPercentageThreshold()
    {
        return $this->_colorPercentageThreshold;
    }

    /**
     * @return mixed
     */
    public function getImage()
    {
        return $this->_image;
    }

}


text:
require File.dirname(__FILE__) + '/spec_helper'

describe 'Interface installed on win32 systems' do
  it 'should be able to load the libraries' do
    # Admittably this is not an especially good test for the library loading
    # under Windows. It only makes sure that there are no execution errors. This
    # has to be tested in a proper Windows environment to tell whether library
    # loading actually works.
    RUBY_PLATFORM = 'i386-mswin32'
    lambda do
      Gecode.load_bindings_lib
    end.should_not raise_error
  end
end