text:
package net.tomp2p.rpc;

import io.netty.channel.ChannelHandler;
import io.netty.util.concurrent.EventExecutorGroup;

import java.util.LinkedHashMap;
import java.util.Map;

import net.tomp2p.connection.ChannelClientConfiguration;
import net.tomp2p.connection.ChannelCreator;
import net.tomp2p.connection.ChannelServerConfiguration;
import net.tomp2p.connection.PipelineFilter;
import net.tomp2p.futures.BaseFutureAdapter;
import net.tomp2p.futures.FutureChannelCreator;
import net.tomp2p.futures.FutureDirect;
import net.tomp2p.futures.FuturePeerConnection;
import net.tomp2p.futures.FutureResponse;
import net.tomp2p.message.CountConnectionOutboundHandler;
import net.tomp2p.p2p.Peer;
import net.tomp2p.p2p.PeerBuilder;
import net.tomp2p.p2p.builder.SendDirectBuilder;
import net.tomp2p.peers.Number160;
import net.tomp2p.peers.PeerAddress;
import net.tomp2p.utils.Pair;
import net.tomp2p.utils.Utils;

import org.junit.Assert;
import org.junit.Test;

public class TestDirect {

    @Test
    public void testDirectMessage1() throws Exception {
        Peer sender = null;
        Peer recv1 = null;
        ChannelCreator cc = null;
        try {
            sender = new PeerBuilder(new Number160("0x50")).p2pId(55).ports(2424).start();
            recv1 = new PeerBuilder(new Number160("0x20")).p2pId(55).ports(8088).start();
            recv1.objectDataReply(new ObjectDataReply() {
                @Override
                public Object reply(PeerAddress sender, Object request) throws Exception {
                    return "yes";
                }
            });

            FutureChannelCreator fcc = sender.connectionBean().reservation().create(0, 2);
            fcc.awaitUninterruptibly();
            cc = fcc.channelCreator();

            SendDirectBuilder sendDirectBuilder = new SendDirectBuilder(sender, (PeerAddress) null);
            sendDirectBuilder.object("test");

            FutureResponse fd1 = sender.directDataRPC()
                    .send(recv1.peerAddress(), sendDirectBuilder, cc);
            FutureResponse fd2 = sender.directDataRPC()
                    .send(recv1.peerAddress(), sendDirectBuilder, cc);

            fd1.awaitUninterruptibly();
            fd2.awaitUninterruptibly();

            System.err.println(fd1.failedReason());
            Assert.assertEquals(true, fd1.isSuccess());
            Assert.assertEquals(true, fd2.isSuccess());

            Object ret = fd1.responseMessage().buffer(0).object();
            Assert.assertEquals("yes", ret);
        } finally {
            if (cc != null) {
                cc.shutdown().awaitListenersUninterruptibly();
            }
            if (sender != null) {
                sender.shutdown().await();
            }
            if (recv1 != null) {
                recv1.shutdown().await();
            }
        }
    }

    @Test
    public void testOrder() throws Exception {
        Peer sender = null;
        Peer recv1 = null;
        ChannelCreator cc = null;
        try {
            sender = new PeerBuilder(new Number160("0x9876")).p2pId(55).ports(2424).start();
            recv1 = new PeerBuilder(new Number160("0x1234")).p2pId(55).ports(8088).start();
            recv1.objectDataReply(new ObjectDataReply() {
                @Override
                public Object reply(PeerAddress sender, Object request) throws Exception {
                    Integer i = (Integer) request;
                    System.err.println("got " + i);
                    return i + 1;
                }
            });
            for (int i = 0; i < 500; i++) {

                FutureChannelCreator fcc = sender.connectionBean().reservation().create(0, 1);
                fcc.awaitUninterruptibly();
                cc = fcc.channelCreator();

                SendDirectBuilder sendDirectBuilder = new SendDirectBuilder(sender, (PeerAddress) null);
                sendDirectBuilder.object((Object) Integer.valueOf(i));

                FutureResponse futureData = sender.directDataRPC().send(recv1.peerAddress(),
                        sendDirectBuilder, cc);
                Utils.addReleaseListener(cc, futureData);
                futureData.addListener(new BaseFutureAdapter<FutureResponse>() {
                    @Override
                    public void operationComplete(FutureResponse future) throws Exception {
                        // the future object might be null if the future failed,
                        // e.g due to shutdown
                        System.err.println(future.responseMessage().buffer(0).object());
                    }
                });
            }
            System.err.println("done");
            Thread.sleep(2000);

        } finally {
            if (cc != null) {
                cc.shutdown().awaitListenersUninterruptibly();
            }
            if (sender != null) {
                sender.shutdown().await();
            }
            if (recv1 != null) {
                recv1.shutdown().await();
            }
        }
    }

    @Test
    public void testDirectReconnect() throws Exception {
        Peer sender = null;
        Peer recv1 = null;
        try {

        	final CountConnectionOutboundHandler ccohTCP = new CountConnectionOutboundHandler();
        	final CountConnectionOutboundHandler ccohUDP = new CountConnectionOutboundHandler();
        	PipelineFilter pf = new PipelineFilter() {
				@Override
				public Map<String, Pair<EventExecutorGroup, ChannelHandler>> filter(Map<String, Pair<EventExecutorGroup, ChannelHandler>> channelHandlers, boolean tcp,
				        boolean client) {

					Map<String, Pair<EventExecutorGroup, ChannelHandler>> retVal = new LinkedHashMap<String, Pair<EventExecutorGroup, ChannelHandler>>();
					retVal.put("counter", new Pair<EventExecutorGroup, ChannelHandler>(null, tcp? ccohTCP:ccohUDP));
					retVal.putAll(channelHandlers);
					return retVal;
				}
			};
			ChannelServerConfiguration csc = PeerBuilder.createDefaultChannelServerConfiguration();
			ChannelClientConfiguration ccc = PeerBuilder.createDefaultChannelClientConfiguration();
			csc.pipelineFilter(pf);
			ccc.pipelineFilter(pf);
            sender = new PeerBuilder(new Number160("0x50")).p2pId(55).enableMaintenance(false).ports(2424).channelClientConfiguration(ccc).channelServerConfiguration(csc).start();
            recv1 = new PeerBuilder(new Number160("0x20")).p2pId(55).enableMaintenance(false).ports(8088).channelClientConfiguration(ccc).channelServerConfiguration(csc).start();
            recv1.objectDataReply(new ObjectDataReply() {
                @Override
                public Object reply(PeerAddress sender, Object request) throws Exception {
                    return "yes";
                }
            });
            FuturePeerConnection peerConnection = sender.createPeerConnection(recv1.peerAddress());
            ccohTCP.reset();
            ccohUDP.reset();

            FutureDirect fd1 = sender.sendDirect(peerConnection).object("test")
                    .connectionTimeoutTCPMillis(2000).idleTCPMillis(10 * 1000).start();
            fd1.awaitUninterruptibly();
            fd1.awaitListenersUninterruptibly();
            Assert.assertEquals(true, fd1.isSuccess());
            Assert.assertEquals(1, ccohTCP.total());
            Assert.assertEquals(0, ccohUDP.total());
            Thread.sleep(2000);
            System.err.println("send second with the same connection");
            FutureDirect fd2 = sender.sendDirect(peerConnection).object("test").start();
            fd2.awaitUninterruptibly();
            Assert.assertEquals(1, ccohTCP.total());
            Assert.assertEquals(0, ccohUDP.total());
            Assert.assertEquals(true, fd2.isSuccess());
            peerConnection.close().await();
            System.err.println("done");
        } finally {
            if (sender != null) {
                sender.shutdown().await();
            }
            if (recv1 != null) {
                recv1.shutdown().await();
            }
        }
    }

    @Test
    public void testDirect2() throws Exception {
        Peer sender = null;
        Peer recv1 = null;
        try {

        	final CountConnectionOutboundHandler ccohTCP = new CountConnectionOutboundHandler();
        	final CountConnectionOutboundHandler ccohUDP = new CountConnectionOutboundHandler();
        	PipelineFilter pf = new PipelineFilter() {
				@Override
				public Map<String, Pair<EventExecutorGroup, ChannelHandler>> filter(Map<String, Pair<EventExecutorGroup, ChannelHandler>> channelHandlers, boolean tcp,
				        boolean client) {

					Map<String, Pair<EventExecutorGroup, ChannelHandler>> retVal = new LinkedHashMap<String, Pair<EventExecutorGroup, ChannelHandler>>();
					retVal.put("counter", new Pair<EventExecutorGroup, ChannelHandler>(null, tcp? ccohTCP:ccohUDP));
					retVal.putAll(channelHandlers);
					return retVal;
				}
			};
			ChannelServerConfiguration csc = PeerBuilder.createDefaultChannelServerConfiguration();
			ChannelClientConfiguration ccc = PeerBuilder.createDefaultChannelClientConfiguration();
			csc.pipelineFilter(pf);
			ccc.pipelineFilter(pf);
            sender = new PeerBuilder(new Number160("0x50")).p2pId(55).ports(2424).enableMaintenance(false)
                    .channelClientConfiguration(ccc).channelServerConfiguration(csc).start();
            recv1 = new PeerBuilder(new Number160("0x20")).p2pId(55).ports(8088).enableMaintenance(false)
            		.channelClientConfiguration(ccc).channelServerConfiguration(csc).start();
            recv1.objectDataReply(new ObjectDataReply() {
                @Override
                public Object reply(PeerAddress sender, Object request) throws Exception {
                    return "yes";
                }
            });
            FuturePeerConnection peerConnection = sender.createPeerConnection(recv1.peerAddress(), 8000);
            ccohTCP.reset();
            ccohUDP.reset();

            FutureDirect fd1 = sender.sendDirect(peerConnection).object("test")
                    .connectionTimeoutTCPMillis(2000).idleTCPMillis(5 * 1000).start();
            fd1.awaitUninterruptibly();
            Assert.assertTrue(fd1.isSuccess());

            Assert.assertEquals(1, ccohTCP.total());

            Thread.sleep(7000);
            System.out.println("request 2");
            FutureDirect fd2 = sender.sendDirect(peerConnection).object("test").start();
            fd2.awaitUninterruptibly();
            peerConnection.close().await();
            Assert.assertEquals(2, ccohTCP.total());
            System.out.println("done");
        } finally {
            if (sender != null) {
                sender.shutdown().await();
            }
            if (recv1 != null) {
                recv1.shutdown().await();
            }
        }
    }
}


text:
"""
Copyright (c) 2004-Present Pivotal Software, Inc.

This program and the accompanying materials are made available under
the terms of the 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.
"""

import os
import tinctest
from mpp.gpdb.tests.storage.pg_twophase.pg_twophase import PgtwoPhaseTestCase

class PgtwoPhase01ToN(PgtwoPhaseTestCase):
    '''
    Testing state of prepared transactions upon crash-recovery
    @gucs gp_create_table_random_default_distribution=off
    '''

    def __init__(self, methodName):
        super(PgtwoPhase01ToN,self).__init__(methodName)

    def test_execute_split_sqls_01_10(self):
        '''
        @data_provider data_types_provider
        '''
        skip_state = self.test_data[1][0]
        cluster_state = self.test_data[1][1]
        ddl_type = self.test_data[1][2]
        fault_type = self.test_data[1][3]
        crash_type = self.test_data[1][4]
        self.execute_split_sqls(skip_state, cluster_state, ddl_type, fault_type, crash_type)

@tinctest.dataProvider('data_types_provider')
def test_data_provider():
    data = {'01_skip_sync_create_commit_gpstop_i': ['skip','sync','create','commit','gpstop_i'],
            '05_noskip_sync_create_commit_gpstop_i': ['noskip','sync','create','commit','gpstop_i'],
            '17_skip_sync_drop_commit_gpstop_i': ['skip','sync','drop','commit','gpstop_i'],
            '21_noskip_sync_drop_commit_gpstop_i': ['noskip','sync','drop','commit','gpstop_i'],
            '33_skip_sync_create_abort_gpstop_i': ['skip','sync','create','abort','gpstop_i'],                                 '37_noskip_sync_create_abort_gpstop_i': ['noskip','sync','create','abort','gpstop_i'],
            '49_noskip_sync_create_end_prepare_two_phase_sleep_gpstop_i' : ['noskip','sync','create','end_prepare_two_phase_sleep', 'gpstop_i'],
    }
    return data

redpajama_set_name: RedPajamaGithub


text:
{-|

Description: Basic communication primitives for DDP.

This module includes the two basic communication primitives required
for a DDP client:

* Sending   (sendEJ)
* Recieving (getEJ)

These functions are included in a seperate module in order
to avoid recursive moldule import issues.

This module is intended for internal use.

-}

module Web.DDP.Deadpan.Comms (sendEJ, getEJ) where

-- Internal Imports:

import Data.EJson

-- External Imports:

import qualified Network.WebSockets as WS
import qualified Data.Aeson         as J

-- Off we go!

-- | Sends an EJsonValue to the server over the connection provided.
sendEJ :: WS.Connection -> EJsonValue -> IO ()
sendEJ c = WS.sendTextData c . J.encode . ejson2value

-- | Possibly gets an EJsonValue from the server over the connection provided
getEJ :: WS.Connection -> IO (Maybe EJsonValue)
getEJ = fmap (fmap value2EJson . J.decode) . WS.receiveData


text:
package com.facebook.buck.android.resources;

import com.google.common.collect.ImmutableList;

import java.nio.ByteBuffer;
import java.util.List;

class ChunkUtils {
  private ChunkUtils() {
  }

  /**
   * Finds all chunks in the buffer with the requested type. This is useful for tests to find chunks
   * of a certain type without needing to understand all the other encountered chunks.
   *
   * @return A list of offsets in the buffer to chunks of the requested type.
   */
  static List<Integer> findChunks(ByteBuffer data, int wantedType) {
    ByteBuffer buf = ResChunk.slice(data, 0);
    ImmutableList.Builder<Integer> offsetsBuilder = ImmutableList.builder();
    int offset = 0;
    while (offset < buf.limit()) {
      int type = buf.getShort(offset);
      if (type == wantedType) {
        offsetsBuilder.add(offset);
      }
      int headerSize = buf.getShort(offset + 2);
      int chunkSize = buf.getInt(offset + 4);
      // These chunks consist of lists of sub-chunks after their headers.
      if (type == ResChunk.CHUNK_RESOURCE_TABLE ||
          type == ResChunk.CHUNK_RES_TABLE_PACKAGE ||
          type == ResChunk.CHUNK_XML_TREE) {
        int subchunksStart = offset + headerSize;
        int subchunksLength = chunkSize - headerSize;
        for (int subOffset :
            findChunks(ResChunk.slice(buf, subchunksStart, subchunksLength), wantedType)) {
          offsetsBuilder.add(subchunksStart + subOffset);
        }
      }
      offset += chunkSize;
    }
    return offsetsBuilder.build();
  }
}


text:
'use strict';

function _int(val) {
  var ret = parseInt(val, 10);
  if (isNaN(ret)) {
    throw new Error(val + ' could not convert to int');
  }
  return ret;
}

function _float(val) {
  var ret = parseFloat(val);
  if (isNaN(ret)) {
    throw new Error(val + ' could not convert to float');
  }
  return ret;
}

module.exports = function typeHandler(dialect) {
  var handlers = {
    'int': _int,
    'float': _float
  };
  return {
    get: function(name) {
      return handlers[name];
    },
    set: function(name, handler) {
      handlers[name] = handler;
    }
  };
}


text:
@interface GPKGFeatureTileGenerator ()

@property (nonatomic, strong) GPKGFeatureTiles *featureTiles;

@end

@implementation GPKGFeatureTileGenerator

-(instancetype) initWithGeoPackage: (GPKGGeoPackage *) geoPackage andTableName: (NSString *) tableName andFeatureTiles: (GPKGFeatureTiles *) featureTiles andMinZoom: (int) minZoom andMaxZoom: (int) maxZoom andBoundingBox: (GPKGBoundingBox *) boundingBox andProjection: (PROJProjection *) projection{
    self = [self initWithGeoPackage:geoPackage andTableName:tableName andFeatureTiles:featureTiles andFeatureGeoPackage:geoPackage andMinZoom:minZoom andMaxZoom:maxZoom andBoundingBox:boundingBox andProjection:projection];
    return self;
}

-(instancetype) initWithGeoPackage: (GPKGGeoPackage *) geoPackage andTableName: (NSString *) tableName andFeatureTiles: (GPKGFeatureTiles *) featureTiles andFeatureGeoPackage: (GPKGGeoPackage *) featureGeoPackage andMinZoom: (int) minZoom andMaxZoom: (int) maxZoom andBoundingBox: (GPKGBoundingBox *) boundingBox andProjection: (PROJProjection *) projection{
    self = [super initWithGeoPackage:geoPackage andTableName:tableName andMinZoom:minZoom andMaxZoom:maxZoom andBoundingBox:[self boundingBoxWithGeoPackage:featureGeoPackage andFeatureTiles:featureTiles andBoundingBox:boundingBox andProjection:projection] andProjection:projection];
    if(self != nil){
        self.featureTiles = featureTiles;
        self.linkTables = YES;
    }
    return self;
}

-(instancetype) initWithGeoPackage: (GPKGGeoPackage *) geoPackage andTableName: (NSString *) tableName andFeatureTiles: (GPKGFeatureTiles *) featureTiles andMinZoom: (int) minZoom andMaxZoom: (int) maxZoom andProjection: (PROJProjection *) projection{
    self = [self initWithGeoPackage:geoPackage andTableName:tableName andFeatureTiles:featureTiles andMinZoom:minZoom andMaxZoom:maxZoom andBoundingBox:nil andProjection:projection];
    return self;
}

-(instancetype) initWithGeoPackage: (GPKGGeoPackage *) geoPackage andTableName: (NSString *) tableName andFeatureTiles: (GPKGFeatureTiles *) featureTiles andFeatureGeoPackage: (GPKGGeoPackage *) featureGeoPackage andMinZoom: (int) minZoom andMaxZoom: (int) maxZoom andProjection: (PROJProjection *) projection{
    self = [self initWithGeoPackage:geoPackage andTableName:tableName andFeatureTiles:featureTiles andFeatureGeoPackage:featureGeoPackage andMinZoom:minZoom andMaxZoom:maxZoom andBoundingBox:nil andProjection:projection];
    return self;
}

-(GPKGBoundingBox *) boundingBoxWithGeoPackage: (GPKGGeoPackage *) geoPackage andFeatureTiles: (GPKGFeatureTiles *) featureTiles andBoundingBox: (GPKGBoundingBox *) boundingBox andProjection: (PROJProjection *) projection{

    NSString *tableName = [featureTiles featureDao].tableName;
    BOOL manualQuery = boundingBox == nil;
    GPKGBoundingBox *featureBoundingBox = [geoPackage boundingBoxOfTable:tableName inProjection:projection andManual:manualQuery];
    if(featureBoundingBox != nil){
        if(boundingBox == nil){
            boundingBox = featureBoundingBox;
        }else{
            boundingBox = [boundingBox overlap:featureBoundingBox];
        }
    }

    if(boundingBox != nil){
        boundingBox = [featureTiles expandBoundingBox:boundingBox inProjection:projection];
    }

    return boundingBox;
}

-(GPKGBoundingBox *) boundingBoxAtZoom: (int) zoom{

    SFPGeometryTransform *projectionToWebMercator = [SFPGeometryTransform transformFromProjection:self.projection andToEpsg:PROJ_EPSG_WEB_MERCATOR];
    GPKGBoundingBox *webMercatorBoundingBox = [self.boundingBox transform:projectionToWebMercator];

    GPKGTileGrid *tileGrid = [GPKGTileBoundingBoxUtils tileGridWithWebMercatorBoundingBox:webMercatorBoundingBox andZoom:zoom];
    GPKGBoundingBox *tileBoundingBox = [GPKGTileBoundingBoxUtils webMercatorBoundingBoxWithX:tileGrid.minX andY:tileGrid.minY andZoom:zoom];

    GPKGBoundingBox *expandedBoundingBox = [self.featureTiles expandBoundingBox:webMercatorBoundingBox withTileBoundingBox:tileBoundingBox];

    GPKGBoundingBox *zoomBoundingBox = [expandedBoundingBox transform:[projectionToWebMercator inverseTransformation]];

    return zoomBoundingBox;
}

-(void) close{
    [self.featureTiles close];
    [super close];
}

-(void) preTileGeneration{

    // Link the feature and tile table if they are in the same GeoPackage
    NSString *featureTable = [self.featureTiles featureDao].tableName;
    NSString *tileTable = self.tableName;
    if (self.linkTables && [self.geoPackage isFeatureTable:featureTable] && [self.geoPackage isTileTable:tileTable]) {
        GPKGFeatureTileTableLinker *linker = [[GPKGFeatureTileTableLinker alloc] initWithGeoPackage:self.geoPackage];
        [linker linkWithFeatureTable:featureTable andTileTable:tileTable];
    }

}

-(NSData *) createTileWithZ: (int) z andX: (int) x andY: (int) y{

    NSData *tileData = [self.featureTiles drawTileDataWithX:x andY:y andZoom:z];

    return tileData;
}

@end


text:
namespace dawn {
namespace ast {
ASTVisitor::~ASTVisitor() = default;
ASTVisitorNonConst::~ASTVisitorNonConst() = default;
ASTVisitorForwarding::~ASTVisitorForwarding() = default;
ASTVisitorForwardingNonConst::~ASTVisitorForwardingNonConst() = default;
ASTVisitorDisabled::~ASTVisitorDisabled() = default;
ASTVisitorPostOrder::~ASTVisitorPostOrder() = default;

#define ASTVISITORFORWARDING_VISIT_IMPL(Type)                                                      \
  void ASTVisitorForwarding::visit(const std::shared_ptr<const Type>& node) {                      \
    for(const auto& s : node->getChildren())                                                       \
      s->accept(*this);                                                                            \
  }

ASTVISITORFORWARDING_VISIT_IMPL(BlockStmt)
ASTVISITORFORWARDING_VISIT_IMPL(LoopStmt)
ASTVISITORFORWARDING_VISIT_IMPL(StencilCallDeclStmt)
ASTVISITORFORWARDING_VISIT_IMPL(BoundaryConditionDeclStmt)
ASTVISITORFORWARDING_VISIT_IMPL(IfStmt)
ASTVISITORFORWARDING_VISIT_IMPL(UnaryOperator)
ASTVISITORFORWARDING_VISIT_IMPL(BinaryOperator)
ASTVISITORFORWARDING_VISIT_IMPL(AssignmentExpr)
ASTVISITORFORWARDING_VISIT_IMPL(TernaryOperator)
ASTVISITORFORWARDING_VISIT_IMPL(FunCallExpr)
ASTVISITORFORWARDING_VISIT_IMPL(StencilFunCallExpr)
ASTVISITORFORWARDING_VISIT_IMPL(StencilFunArgExpr)
ASTVISITORFORWARDING_VISIT_IMPL(VarAccessExpr)
ASTVISITORFORWARDING_VISIT_IMPL(FieldAccessExpr)
ASTVISITORFORWARDING_VISIT_IMPL(LiteralAccessExpr)
ASTVISITORFORWARDING_VISIT_IMPL(ReductionOverNeighborExpr)

#undef ASTVISITORFORWARDING_VISIT_IMPL

void ASTVisitorForwarding::visit(const std::shared_ptr<const ExprStmt>& node) {
  node->getExpr()->accept(*this);
}

void ASTVisitorForwarding::visit(const std::shared_ptr<const ReturnStmt>& node) {
  node->getExpr()->accept(*this);
}

void ASTVisitorForwarding::visit(const std::shared_ptr<const VarDeclStmt>& node) {
  for(const auto& expr : node->getInitList())
    expr->accept(*this);
}

void ASTVisitorForwarding::visit(const std::shared_ptr<const VerticalRegionDeclStmt>& stmt) {
  stmt->getVerticalRegion()->Ast->accept(*this);
}

#define ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(Type)                                              \
  void ASTVisitorForwardingNonConst::visit(const std::shared_ptr<Type>& node) {                     \
    for(auto& s : node->getChildren())                                                             \
      s->accept(*this);                                                                            \
  }

ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(BlockStmt)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(LoopStmt)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(StencilCallDeclStmt)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(BoundaryConditionDeclStmt)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(IfStmt)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(UnaryOperator)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(BinaryOperator)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(AssignmentExpr)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(TernaryOperator)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(FunCallExpr)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(StencilFunCallExpr)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(StencilFunArgExpr)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(VarAccessExpr)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(FieldAccessExpr)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(LiteralAccessExpr)
ASTVISITORFORWARDINGNONCONST_VISIT_IMPL(ReductionOverNeighborExpr)

#undef ASTVISITORFORWARDINGNONCONST_VISIT_IMPL

void ASTVisitorForwardingNonConst::visit(const std::shared_ptr<ExprStmt>& node) {
  node->getExpr()->accept(*this);
}

void ASTVisitorForwardingNonConst::visit(const std::shared_ptr<ReturnStmt>& node) {
  node->getExpr()->accept(*this);
}

void ASTVisitorForwardingNonConst::visit(const std::shared_ptr<VarDeclStmt>& node) {
  for(const auto& expr : node->getInitList())
    expr->accept(*this);
}

void ASTVisitorForwardingNonConst::visit(const std::shared_ptr<VerticalRegionDeclStmt>& stmt) {
  stmt->getVerticalRegion()->Ast->accept(*this);
}

#define ASTVISITORPOSTORDER_VISIT_IMPL(NodeType, Type)                                             \
  std::shared_ptr<NodeType> ASTVisitorPostOrder::visitAndReplace(                                  \
      std::shared_ptr<Type> const& node) {                                                         \
    if(!preVisitNode(node))                                                                        \
      return node;                                                                                \
    for(auto s : node->getChildren()) {                                                            \
      auto repl = s->acceptAndReplace(*this);                                                      \
      if(repl && repl != s) {                                                                      \
        node->replaceChildren(s, repl);                                                            \
      }                                                                                \
    }                                                                                \
    return postVisitNode(node);                                                                    \
  }                                                                                \
  bool ASTVisitorPostOrder::preVisitNode(std::shared_ptr<Type> const& node) { return true; }       \
  std::shared_ptr<NodeType> ASTVisitorPostOrder::postVisitNode(                                    \
      std::shared_ptr<Type> const& node) {                                                         \
    return node;                                                                                \
  }

ASTVISITORPOSTORDER_VISIT_IMPL(Stmt, BlockStmt)
ASTVISITORPOSTORDER_VISIT_IMPL(Stmt, LoopStmt)
ASTVISITORPOSTORDER_VISIT_IMPL(Stmt, StencilCallDeclStmt)
ASTVISITORPOSTORDER_VISIT_IMPL(Stmt, BoundaryConditionDeclStmt)
ASTVISITORPOSTORDER_VISIT_IMPL(Stmt, IfStmt)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, UnaryOperator)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, BinaryOperator)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, AssignmentExpr)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, TernaryOperator)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, FunCallExpr)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, StencilFunCallExpr)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, StencilFunArgExpr)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, VarAccessExpr)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, FieldAccessExpr)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, LiteralAccessExpr)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, NOPExpr)
ASTVISITORPOSTORDER_VISIT_IMPL(Expr, ReductionOverNeighborExpr)

#undef ASTVISITORPOSTORDER_VISIT_STMT_IMPL
#undef ASTVISITORPOSTORDER_VISIT_EXPR_IMPL

std::shared_ptr<Stmt> ASTVisitorPostOrder::visitAndReplace(std::shared_ptr<ExprStmt> const& node) {
  DAWN_ASSERT(node);
  if(!preVisitNode(node))
    return node;

  DAWN_ASSERT(node->getExpr());
  auto repl = node->getExpr()->acceptAndReplace(*this);
  DAWN_ASSERT(repl);

  if(repl && repl != node->getExpr()) {
    auto oo = node->getExpr();
    DAWN_ASSERT(oo && repl);
    node->replaceChildren(node->getExpr(), repl);
  }
  return postVisitNode(node);
}
bool ASTVisitorPostOrder::preVisitNode(std::shared_ptr<ExprStmt> const& node) { return true; }
std::shared_ptr<Stmt> ASTVisitorPostOrder::postVisitNode(std::shared_ptr<ExprStmt> const& node) {
  return node;
}

std::shared_ptr<Stmt>
ASTVisitorPostOrder::visitAndReplace(std::shared_ptr<ReturnStmt> const& node) {
  if(!preVisitNode(node))
    return node;
  auto repl = node->getExpr()->acceptAndReplace(*this);
  if(repl && repl != node->getExpr())
    node->replaceChildren(node->getExpr(), repl);
  return postVisitNode(node);
}
std::shared_ptr<Stmt> ASTVisitorPostOrder::postVisitNode(std::shared_ptr<ReturnStmt> const& node) {
  return node;
}
bool ASTVisitorPostOrder::preVisitNode(std::shared_ptr<ReturnStmt> const& node) { return true; }

std::shared_ptr<Stmt>
ASTVisitorPostOrder::visitAndReplace(std::shared_ptr<VarDeclStmt> const& node) {
  if(!preVisitNode(node))
    return node;
  for(auto expr : node->getInitList()) {
    auto repl = expr->acceptAndReplace(*this);
    if(repl && repl != expr)
      node->replaceChildren(expr, repl);
  }
  return postVisitNode(node);
}

std::shared_ptr<Stmt> ASTVisitorPostOrder::postVisitNode(std::shared_ptr<VarDeclStmt> const& node) {
  return node;
}
bool ASTVisitorPostOrder::preVisitNode(std::shared_ptr<VarDeclStmt> const& node) { return true; }

std::shared_ptr<Stmt>
ASTVisitorPostOrder::visitAndReplace(std::shared_ptr<VerticalRegionDeclStmt> const& stmt) {
  // TODO replace this as wel
  if(!preVisitNode(stmt))
    return stmt;
  auto repl = stmt->getVerticalRegion()->Ast->acceptAndReplace(*this);
  if(repl && repl != stmt->getVerticalRegion()->Ast)
    stmt->getVerticalRegion()->Ast = repl;
  return postVisitNode(stmt);
}

bool ASTVisitorPostOrder::preVisitNode(std::shared_ptr<VerticalRegionDeclStmt> const& stmt) {
  return true;
}

std::shared_ptr<Stmt>
ASTVisitorPostOrder::postVisitNode(std::shared_ptr<VerticalRegionDeclStmt> const& stmt) {
  return stmt;
}

#define ASTVISITORDISABLED_VISIT_IMPL(Type)                                                        \
  void ASTVisitorDisabled::visit(const std::shared_ptr<Type>& node) {                              \
    DAWN_ASSERT_MSG(0, "Type not allowed in this context");                                        \
  }

ASTVISITORDISABLED_VISIT_IMPL(BlockStmt)
ASTVISITORDISABLED_VISIT_IMPL(LoopStmt)
ASTVISITORDISABLED_VISIT_IMPL(StencilCallDeclStmt)
ASTVISITORDISABLED_VISIT_IMPL(BoundaryConditionDeclStmt)
ASTVISITORDISABLED_VISIT_IMPL(IfStmt)
ASTVISITORDISABLED_VISIT_IMPL(UnaryOperator)
ASTVISITORDISABLED_VISIT_IMPL(BinaryOperator)
ASTVISITORDISABLED_VISIT_IMPL(AssignmentExpr)
ASTVISITORDISABLED_VISIT_IMPL(TernaryOperator)
ASTVISITORDISABLED_VISIT_IMPL(FunCallExpr)
ASTVISITORDISABLED_VISIT_IMPL(StencilFunCallExpr)
ASTVISITORDISABLED_VISIT_IMPL(StencilFunArgExpr)
ASTVISITORDISABLED_VISIT_IMPL(VarAccessExpr)
ASTVISITORDISABLED_VISIT_IMPL(FieldAccessExpr)
ASTVISITORDISABLED_VISIT_IMPL(LiteralAccessExpr)
ASTVISITORDISABLED_VISIT_IMPL(ExprStmt)
ASTVISITORDISABLED_VISIT_IMPL(ReturnStmt)
ASTVISITORDISABLED_VISIT_IMPL(VarDeclStmt)
ASTVISITORDISABLED_VISIT_IMPL(VerticalRegionDeclStmt)
ASTVISITORDISABLED_VISIT_IMPL(ReductionOverNeighborExpr)

#undef ASTVISITORDISABLED_VISIT_IMPL
} // namespace ast
} // namespace dawn


text:
import os
import sys
from flask import Flask, render_template,url_for

app = Flask(__name__)

#@app.route('/')
#def source():
#    html = "hello world!"
#    return html

@app.route('/')
def welcome():
    img = url_for('static',filename = 'cute_ted.jpg')
    img2 = url_for('static',filename = 'imagevsMean.png')
    logo = url_for('static',filename = 'logos.jpg')
    return render_template('welcome.html',logo = logo,img = img,img2 = img2)
#@app.route('/index.html', methods=['GET', 'POST'])
#def lionel():
#    return render_template('index.html')

if __name__ == '__main__':
    app.run()


text:
Binary Tree Level Order Traversal II
====================================
https://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).

For example:
Given binary tree {3,9,20,#,#,15,7},

        3
       / \
      9  20
        /  \
       15   7
return its bottom-up level order traversal as:

    [
      [15,7],
      [9,20],
      [3]
    ]


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Kew Bull. 8(1): 35 (1953)

#### Original name
Agaricus eugrammus Mont., 1837

### Remarks
null


text:
"""Script to set up a Debian Linux based system as a Lokole client."""
from argparse import ArgumentParser
from base64 import b64encode
from json import dumps
from json import loads
from logging import StreamHandler
from logging import getLogger
from multiprocessing import cpu_count
from os import chmod
from os import getenv
from os import stat
from os import urandom
from pathlib import Path
from shutil import chown
from socket import gethostname
from stat import S_IEXEC
from string import ascii_letters
from string import digits
from subprocess import PIPE  # nosec
from subprocess import run  # nosec
from sys import executable as current_python_binary
from sys import version_info
from tempfile import gettempdir
from time import sleep
from time import time
from urllib.error import HTTPError
from urllib.request import Request
from urllib.request import urlopen

LOG = getLogger(__name__)

TEMP_ROOT = Path(gettempdir()) / Path(__file__).name
TEMP_ROOT.mkdir(parents=True, exist_ok=True)

SIM_TYPES = ('hologram', 'Ethernet', 'LocalOnly', 'mkwvconf')

class Setup:
    groups = tuple()
    packages = tuple()

    def __init__(self, args, abort):
        self.args = args
        self.abort = abort

    @property
    def is_enabled(self):
        return True

    @property
    def user(self):
        base_user = getenv('USER')
        sudo_user = getenv('SUDO_USER')

        if sudo_user and base_user == 'root':
            return sudo_user
        elif base_user:
            return base_user
        else:
            return self.sh('whoami')

    @property
    def home(self):
        return Path('/') / 'home' / self.user

    def __call__(self):
        try:
            result = self.__is_complete()
        except FileNotFoundError:
            pass
        else:
            LOG.info('Skipping %s: already completed', self._step_name)
            return result

        if not self.is_enabled:
            LOG.info('Skipping %s: not enabled', self._step_name)
            return

        LOG.info('Running %s', self._step_name)

        self._grant_permissions()
        self._install_dependencies()
        result = self._run()
        self.__mark_complete(result)

        LOG.info('Done with %s', self._step_name)
        return result

    def _grant_permissions(self):
        for group in self.groups:
            self.sh('usermod -a -G "{group}" "{user}"'
                    .format(group=group, user=self.user))

    def _install_dependencies(self):
        if self.packages:
            self.sh('apt-get install -y {}'.format(' '.join(self.packages)),
                    retry_attempts=10, retry_interval=60)

    def _run(self):
        raise NotImplementedError

    @property
    def _step_name(self):
        return self.__class__.__name__

    @property
    def __guard_path(self):
        guard_name = '{}.done'.format(self._step_name)
        return self.abspath(TEMP_ROOT / guard_name)

    @property
    def __stdout_path(self):
        stdout_name = '{}.stdout'.format(self._step_name)
        return self.abspath(TEMP_ROOT / stdout_name)

    @property
    def __stderr_path(self):
        stderr_name = '{}.stderr'.format(self._step_name)
        return self.abspath(TEMP_ROOT / stderr_name)

    def __is_complete(self):
        return loads(Path(self.__guard_path).read_text(encoding='utf-8'))

    def __mark_complete(self, result):
        self.write_file(self.__guard_path, dumps(result))

    def assume_ownership(self, path):
        chown(path, self.user, self.user)

    def write_file(self, path, content, executable=False):
        if not isinstance(content, str):
            content = '\n'.join(content)

        with open(path, 'w') as fobj:
            fobj.write(content)

        self.assume_ownership(path)

        if executable:
            mode = stat(path).st_mode
            chmod(path, mode | S_IEXEC)

    def create_daemon(self, program_name, command, user=None, env=None):
        env = env or {}
        user = user or self.user
        extra_conf = []

        if self.args.log_directory == '-':
            stderr = '/dev/fd/2'
            stdout = '/dev/fd/1'
            extra_conf.extend((
                'stdout_logfile_maxbytes=0',
                'stderr_logfile_maxbytes=0',
            ))
        else:
            stderr = self.abspath(Path(self.args.log_directory) / '{}.stderr.log'.format(program_name))
            stdout = self.abspath(Path(self.args.log_directory) / '{}.stdout.log'.format(program_name))

        self.write_file('/etc/supervisor/conf.d/{}.conf'.format(program_name), (
            '[program:{}]'.format(program_name),
            'command={}'.format(command),
            'autostart=true',
            'autorestart=true',
            'startretries=3',
            'stopasgroup=true',
            'stderr_logfile={}'.format(stderr),
            'stdout_logfile={}'.format(stdout),
            'user={}'.format(user),
            'environment={}'.format(','.join('{}={}'.format(*kv) for kv in env.items())),
            *extra_conf,
        ))

    def abspath(self, file_path):
        file_path = Path(file_path).absolute()
        self._mkdir(file_path.parent)
        return str(file_path)

    def sh(self, command, user=None, accept_failure=False, retry_attempts=0, retry_interval=0):
        if user:
            command = "su '{user}' -c '{command}'".format(
                user=user,
                command=command)

        process = run(command, shell=True, stderr=PIPE, stdout=PIPE)  # nosec
        stdout = process.stdout.decode('utf-8').strip()
        stderr = process.stderr.decode('utf-8').strip()
        status = process.returncode

        with open(self.__stdout_path, 'a', encoding='utf-8') as fobj:
            fobj.write('===== {} =====\n{}\n{}\n\n'.format(command, status, stdout))

        with open(self.__stderr_path, 'a', encoding='utf-8') as fobj:
            fobj.write('===== {} =====\n{}\n{}\n\n'.format(command, status, stderr))

        if status == 0 or accept_failure:
            return stdout

        if retry_attempts > 0:
            sleep(retry_interval)
            return self.sh(command, user, accept_failure, retry_attempts - 1, retry_interval)

        raise Exception(stderr)

    def _mkdir(self, path):
        path.mkdir(parents=True, exist_ok=True)
        home_prefix = Path(self.home)
        is_in_home = path.parts[:3] == home_prefix.parts
        if is_in_home:
            home_parts = path.parts[3:]
            for part in home_parts:
                home_prefix /= part
                self.assume_ownership(str(home_prefix))

class SystemSetup(Setup):
    def _run(self):
        self._ensure_root()
        self._ensure_apt()
        self._set_locale()
        self._set_timezone()
        self._set_password()

    def _ensure_root(self):
        if getenv('USER') != 'root' and self.sh('whoami') != 'root':
            self.abort('Must run script via sudo')

    def _ensure_apt(self):
        self.sh('apt-get update', retry_attempts=10, retry_interval=30)

    def _set_locale(self):
        locale_command = (
            'export LANGUAGE="{0}"; '
            'export LC_ALL="{0}"; '
            'export LANG="{0}"; '
            'export LC_TYPE="{0}";'
        ).format(self.args.locale)

        self.sh('locale-gen "{}"'.format(self.args.locale))
        self.sh('update-locale')
        self.sh('eval "{}"'.format(locale_command))

        self.write_file('/etc/profile.d/set-locale.sh', locale_command,
                        executable=True)

    def _set_timezone(self):
        self.sh('timedatectl set-timezone "{}"'.format(self.args.timezone))

    def _set_password(self):
        if not self.args.password:
            return

        self.sh('echo "{user}:{password}" | chpasswd'.format(
                user=self.user,
                password=self.args.password))

    @property
    def is_enabled(self):
        return self.args.system_setup != 'no'

class WifiSetup(Setup):
    packages = (
        'hostapd',
        'dnsmasq',
    )

    ip_base = '10.0.0'

    def _run(self):
        if not self.ht_capab:
            self.abort('Unsupported device: {}'.format(self.device))

        self._configure_dns()
        self._configure_wifi()
        self._disable_system_power_management()

    def _configure_dns(self):
        hosts = [
            ('::1', 'localhost ip6-localhost ip6-loopback'),
            ('ff02::1', 'ip6-allnodes'),
            ('ff02::2', 'ip6-allrouters'),
            ('127.0.0.1', 'localhost'),
            ('127.0.0.1', self.device),
            ('127.0.1.1', self.device),
        ]

        for prefix in ['www.', '']:
            for tld in ['.com', '.org', '.ca', '.cd', '']:
                for host in ['lokole', 'opwen', 'ascoderu', 'email']:
                    hosts.append((self.ip, prefix + host + tld))

        self.write_file('/etc/hosts', ('{}\t{}'.format(ip, host) for (ip, host) in hosts))

        logfile = '/var/log/dnsmasq.log'

        self.write_file('/etc/dnsmasq.conf', (
            'log-facility={}'.format(logfile),
            'dhcp-range={0}.10,{0}.250,12h'.format(self.ip_base),
            'interface=wlan0',
            'no-resolv',
            'log-queries',
            'server=8.8.8.8',
        ))

    def _configure_wifi(self):
        hostapd_conf = '/etc/hostapd/hostapd.conf'

        self.write_file(hostapd_conf, (
            'interface=wlan0',
            'driver=nl80211',
            'hw_mode=g',
            'channel=6',
            'ieee80211n=1',
            'wmm_enabled=1',
            'ht_capab={}'.format(self.ht_capab),
            'macaddr_acl=0',
            'auth_algs=1',
            'wpa=2',
            'wpa_key_mgmt=WPA-PSK',
            'rsn_pairwise=CCMP',
            'ssid={}'.format(self.args.wifi_name),
            'wpa_passphrase={}'.format(self.args.wifi_password),
        ))

        self.write_file('/etc/default/hostapd', 'DAEMON_CONF={}'.format(hostapd_conf))

        self.write_file('/etc/network/interfaces', (
            'auto lo',
            'iface lo inet loopback',

            'auto eth0',
            'allow-hotplug eth0',
            'iface eth0 inet dhcp',

            'auto wlan0',
            'allow-hotplug wlan0',
            'iface wlan0 inet static',
            'post-up service hostapd restart',
            'post-up service dnsmasq restart',
            'address {}'.format(self.ip),
            'netmask 255.255.255.0',
            'wireless-power off',

            'auto ppp0',
            'iface ppp0 inet wvdial',
        ))

        self.sh('systemctl unmask hostapd.service')
        self.sh('systemctl start hostapd.service')

    def _disable_system_power_management(self):
        self.sh('systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target')

    @property
    def ip(self):
        return '{}.1'.format(self.ip_base)

    @property
    def device(self):
        return gethostname()

    @property
    def ht_capab(self):
        if self.device in ['OrangePI', 'orangepizero']:
            return '[HT40][DSS_CCK-40]'

        if self.device in ['raspberrypi']:
            return '[HT40][SHORT-GI-20][DSS_CCK-40]'

        return None

    @property
    def is_enabled(self):
        return self.args.wifi != 'no'

class ModemSetup(Setup):
    packages = (
        'usb-modeswitch',
        'usb-modeswitch-data',
        'mobile-broadband-provider-info',
        'ppp',
        'wvdial',
    )

    groups = (
        'dialout',
        'dip',
    )

    def _run(self):
        self._configure_wvdial()

        return {
            'OPWEN_SYNC_SCHEDULE': self.args.sync_schedule,
        }

    def _configure_wvdial(self):
        self.write_file('/etc/ppp/peers/wvdial', (
            'noauth',
            'name wvdial',
            'usepeerdns',
            'defaultroute',
            'replacedefaultroute',
        ))

    @property
    def is_enabled(self):
        if not super().is_enabled:
            return False

        if self.args.sim_type == 'LocalOnly':
            return False

        if not self.args.sync_schedule or not self.args.registration_credentials:
            self.abort('Sync schedule and registration credentials are required.')

        return True

class ClientSetup(Setup):
    def _run(self):
        request_auth = b64encode(self.args.registration_credentials.encode('ascii')).decode('ascii')

        create_request_payload = dumps({'domain': self.client_domain}).encode('utf-8')
        create_request = Request(self.client_url_create)
        create_request.add_header('Content-Type', 'application/json; charset=utf-8')
        create_request.add_header('Content-Length', str(len(create_request_payload)))
        create_request.add_header('Authorization', 'Basic {}'.format(request_auth))

        try:
            with urlopen(create_request, create_request_payload):  # nosec
                pass
        except HTTPError as ex:
            self.abort('Unable to register client {client_name}: [{status_code}] {message}'.format(
                client_name=self.args.client_name,
                status_code=ex.code,
                message=ex.read().decode('utf-8').strip()))

        while True:
            get_request = Request(self.client_url_details)
            get_request.add_header('Authorization', 'Basic {}'.format(request_auth))
            try:
                with urlopen(get_request) as response:  # nosec
                    response_body = response.read().decode('utf-8')
            except HTTPError as ex:
                if ex.code != 404:
                    self.abort('Unable to fetch client {client_name}: [{status_code}] {message}'.format(
                        client_name=self.args.client_name,
                        status_code=ex.code,
                        message=ex.read().decode('utf-8').strip()))
                sleep(2)
            else:
                client_info = loads(response_body)
                break

        return {
            'OPWEN_CLIENT_ID': client_info['client_id'],
            'OPWEN_REMOTE_ACCOUNT_NAME': client_info['storage_account'],
            'OPWEN_REMOTE_ACCOUNT_KEY': client_info['storage_key'],
            'OPWEN_REMOTE_RESOURCE_CONTAINER': client_info['resource_container'],
        }

    @property
    def client_domain(self):
        return '{}.{}'.format(self.args.client_name, self.args.client_domain)

    @property
    def client_url_create(self):
        return 'https://{}/api/email/register/'.format(self.args.server_host)

    @property
    def client_url_details(self):
        return 'https://{}/api/email/register/{}'.format(self.args.server_host, self.client_domain)

    @property
    def is_enabled(self):
        return self.args.sim_type != 'LocalOnly'

class WebappSetup(Setup):
    packages = (
        'bcrypt',
        'libffi-dev',
        'libssl-dev',
        'libjpeg-dev',
        'libopenjp2-7',
        'libtiff5',
        'nginx',
        'python3',
        'python3-dev',
        'python3-pip',
        'python3-venv',
        'supervisor',
    )

    def __init__(self, args, abort, app_config):
        super().__init__(args, abort)
        self.app_config = app_config

    def _run(self):
        self._create_virtualenv()
        self._install_client()
        self._compile_translations()
        self._setup_secrets()
        self._create_admin_user()
        self._install_nginx()
        self._setup_gunicorn()
        self._setup_celery()
        self._setup_cron()
        self._setup_restarter()
        self._reboot()

    def _create_virtualenv(self):
        self.sh('{python} -m venv "{venv_path}"'.format(
                 python=current_python_binary,
                 venv_path=self.venv_path),
                user=self.user)

        self._pip_install('pip', 'setuptools', 'wheel')

    def _install_client(self):
        if self.args.client_dist and Path(self.args.client_dist).is_file():
            package = self.args.client_dist
        elif self.args.client_version:
            package = 'opwen_email_client=={}'.format(self.args.client_version)
        else:
            package = 'opwen_email_client'

        self._pip_install(package)

    def _compile_translations(self):
        self.sh('"{pybabel}" compile -d "{translations}"'.format(
               pybabel='{}/bin/pybabel'.format(self.venv_path),
               translations=self.abspath(self.webapp_files_root / 'translations')),
              user=self.user)

    def _setup_secrets(self):
        extra_settings = {
            'OPWEN_APP_ROOT': self.args.app_root,
            'OPWEN_STATE_DIRECTORY': self.abspath(self.args.state_directory),
            'OPWEN_SESSION_KEY': generate_secret(32),
            'OPWEN_MAX_UPLOAD_SIZE_MB': self.args.max_upload_size,
            'OPWEN_SIM_TYPE': self.args.sim_type,
            'OPWEN_EMAIL_SERVER_HOSTNAME': self.args.server_host,
            'OPWEN_CLIENT_NAME': self.args.client_name,
            'OPWEN_ROOT_DOMAIN': self.args.client_domain,
            'OPWEN_RESTART_PATH': ','.join((
                '{}=HUP'.format(self.abspath(self.restarter_directory / self.args.server_name)),
                '{}='.format(self.abspath(self.restarter_directory / self.args.worker_name)),
                '{}='.format(self.abspath(self.restarter_directory / self.args.cron_name)),
            )),
        }

        self.write_file(self.settings_path, (
            '{}={}'.format(key, value)
            for settings in (extra_settings, self.app_config)
            for (key, value) in settings.items()))

    def _create_admin_user(self):
        if self.args.admin == 'no':
            return

        self.sh('OPWEN_SETTINGS="{settings}" '
                '"{manage}" createadmin --name="{name}" --password="{password}"'.format(
                 settings=self.settings_path,
                 manage='{}/bin/manage.py'.format(self.venv_path),
                 name=self.args.admin_name,
                 password=self.args.admin_password),
                user=self.user)

    def _install_nginx(self):
        self.write_file('/etc/nginx/sites-available/default', '''
            server {{
              listen {port};
              server_name localhost;

              location = {app_root}/favicon.ico {{
                alias {files_root}/static/favicon.ico;
              }}

              location ~ ^{app_root}/static/(.*)$ {{
                alias {files_root}/static/$1;
              }}

              location {app_root}/ {{
                include proxy_params;
                proxy_pass http://unix:{socket};
              }}
            }}'''.format(
            port=self.args.port,
            app_root=self.args.app_root,
            files_root=self.abspath(self.webapp_files_root),
            socket=self.socket_path))

        if self.args.log_directory == '-':
            access_log = 'stdout'
            error_log = 'stderr'
        else:
            access_log = self.abspath(Path(self.args.log_directory) / 'nginx_access.log')
            error_log = self.abspath(Path(self.args.log_directory) / 'nginx_error.log')

        self.write_file('/etc/nginx/nginx.conf', '''
            user www-data;
            worker_processes 4;
            pid /run/nginx.pid;

            events {{
              worker_connections 768;
            }}

            http {{
              sendfile on;
              tcp_nopush on;
              tcp_nodelay on;
              keepalive_timeout 65;
              types_hash_max_size 2048;
              include /etc/nginx/mime.types;
              default_type application/octet-stream;
              ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
              ssl_prefer_server_ciphers on;
              access_log {access_log};
              error_log {error_log};
              gzip on;
              gzip_disable "msie6";
              client_max_body_size {max_upload_size}M;
              include /etc/nginx/conf.d/*.conf;
              include /etc/nginx/sites-enabled/*;

              fastcgi_connect_timeout {timeout_seconds};
              fastcgi_send_timeout {timeout_seconds};
              fastcgi_read_timeout {timeout_seconds};
            }}'''.format(
            access_log=access_log,
            error_log=error_log,
            max_upload_size=self.args.max_upload_size,
            timeout_seconds=self.args.timeout))

        self.sh('systemctl stop nginx', accept_failure=True)
        self.sh('systemctl disable nginx', accept_failure=True)

        self.create_daemon(
            program_name=self.args.nginx_name,
            command='/usr/sbin/nginx -g "daemon off;"',
            user='root')

    def _setup_gunicorn(self):
        gunicorn_script = (
            '"{venv}/bin/gunicorn" '
            '--bind="unix:{socket}" '
            '--timeout={timeout} '
            '--workers={workers} '
            '--log-level={loglevel} '
            'opwen_email_client.webapp:app'.format(
                venv=self.venv_path,
                socket=self.socket_path,
                timeout=self.args.timeout,
                workers=self.args.num_gunicorn_workers,
                loglevel=self.args.log_level))

        self.create_daemon(
            program_name=self.args.server_name,
            command=gunicorn_script,
            env={'OPWEN_SETTINGS': self.settings_path})

    def _setup_celery(self):
        celery_command = (
            '"{venv}/bin/celery" '
            '--app=opwen_email_client.webapp.tasks '
            'worker '
            '--loglevel={loglevel} '
            '--concurrency={workers}'.format(
                venv=self.venv_path,
                loglevel=self.args.log_level,
                workers=self.args.num_celery_workers))

        self.create_daemon(
            program_name=self.args.worker_name,
            command=celery_command,
            env={'OPWEN_SETTINGS': self.settings_path})

    def _setup_cron(self):
        celery_command = (
            '"{venv}/bin/celery" '
            '--app=opwen_email_client.webapp.tasks '
            'beat '
            '--pidfile="{cronstate_pid}" '
            '--loglevel={loglevel} '.format(
                settings=self.settings_path,
                cronstate_pid=self.cronstate_pid,
                venv=self.venv_path,
                loglevel=self.args.log_level))

        self.create_daemon(
            program_name=self.args.cron_name,
            command=celery_command,
            env={'OPWEN_SETTINGS': self.settings_path})

    def _setup_restarter(self):
        restarter_command = (
            '"{venv}/bin/manage.py" '
            'restarter '
            '--directory="{directory}"'.format(
                venv=self.venv_path,
                directory=self.abspath(self.restarter_directory)))

        self.create_daemon(
            program_name=self.args.restarter_name,
            command=restarter_command,
            user='root')

    def _reboot(self):
        LOG.info('All done. Lokole client %s is ready to be used.', self.args.client_name)

        if self.args.reboot == 'yes':
            LOG.info('System is rebooting.')
            self.sh('shutdown --reboot now', user='root')

    def _pip_install(self, *packages):
        self.sh('"{pip}" install --no-cache-dir --upgrade {packages}'.format(
                 pip='{}/bin/pip'.format(self.venv_path),
                 packages=' '.join(packages)),
                retry_attempts=60,
                retry_interval=5,
                user=self.user)

    @property
    def webapp_files_root(self):
        return (Path(self.venv_path) /
                'lib' /
                'python{}.{}'.format(version_info.major, version_info.minor) /
                'site-packages' /
                'opwen_email_client' /
                'webapp')

    @property
    def socket_path(self):
        return self.abspath(Path(self.args.state_directory)
                            / '{}.sock'.format(self.args.server_name))

    @property
    def settings_path(self):
        return self.abspath(Path(self.args.state_directory)
                            / 'settings.env')

    @property
    def cronstate_pid(self):
        return self.abspath(Path(self.args.state_directory)
                            / '{}.pid'.format(self.args.cron_name))

    @property
    def restarter_directory(self):
        return Path(self.args.state_directory) / self.args.restarter_name

    @property
    def venv_path(self):
        return self.abspath(Path(self.args.venv_directory))

def generate_secret(length, chars=frozenset(ascii_letters + digits)):
    secret = ''  # nosec

    while len(secret) < length:
        for char in urandom(length).decode('ascii', errors='ignore'):
            if char in chars:
                secret += char

    return secret[:length]

def _dump_state(args):
    with Path(__file__).open('r', encoding='utf-8') as fobj:
        version = hash(fobj.read())

    state_path = TEMP_ROOT / 'state_{:.0f}.json'.format(time())

    with state_path.open('w', encoding='utf-8') as fobj:
        fobj.write(dumps({
            'version': version,
            'args': args.__dict__,
        }))

def main(args, abort):
    LOG.setLevel(args.script_log_level)
    LOG.addHandler(StreamHandler())

    _dump_state(args)

    app_config = {}

    system_setup = SystemSetup(args, abort)
    system_setup()

    wifi_setup = WifiSetup(args, abort)
    wifi_setup()

    modem_setup = ModemSetup(args, abort)
    app_config.update(modem_setup() or {})

    client_setup = ClientSetup(args, abort)
    app_config.update(client_setup() or {})

    webapp_setup = WebappSetup(args, abort, app_config)
    webapp_setup()

def cli():
    parser = ArgumentParser(description=__doc__)

    parser.add_argument('client_name', type=str.lower, help=(
        'The name that should be assigned to the Opwen device '
        'that is being configured by this script. Usually this '
        'will be a name that is descriptive for the location '
        'where the device will be deployed. The client name '
        'should be globally unique as it is used as the key for '
        'a bunch of things.'
    ))
    parser.add_argument('sim_type', choices=SIM_TYPES, help=(
        'The mobile network to which to connect to upload data.'
    ))
    parser.add_argument('sync_schedule', nargs='?', help=(
        'How often the Lokole should sync with the server. '
        'In cron syntax. '
        'Example: "34 * * * *" for once per hour at the 34th minute.'
    ))
    parser.add_argument('registration_credentials', nargs='?', help=(
        'Username and password (separated by a colon ":") for '
        'registering with the Lokole server.'
    ))
    parser.add_argument('--app_root', default=getenv('OPWEN_APP_ROOT', ''), help=(
        'The URL prefix at which the app will be accessible.'
    ))
    parser.add_argument('--admin', default=getenv('LOKOLE_ADMIN', 'yes'), help=(
        'If set to "no", skip creation of application admin user.'
    ))
    parser.add_argument('--admin_name', default=getenv('LOKOLE_ADMIN_NAME', 'admin'), help=(
        'If set, create an admin user with this account name.'
    ))
    parser.add_argument('--admin_password', default=getenv('LOKOLE_ADMIN_PASSWORD', 'lokole1Admin'), help=(
        'If set, create an admin user with this password.'
    ))
    parser.add_argument('--password', default=getenv('LOKOLE_PASSWORD', ''), help=(
        'If set to a non-empty string, updates the password of '
        'the current user to this value as part of the setup. '
        'Useful for fully automated setups of new devices that '
        'come with a default insecure password.'
    ))
    parser.add_argument('--system_setup', default=getenv('LOKOLE_SYSTEM_SETUP', 'yes'), help=(
        'If set to "no", skip system setup.'
    ))
    parser.add_argument('--reboot', default=getenv('LOKOLE_REBOOT', 'yes'), help=(
        'If set to "no", skip system reboot after setup.'
    ))
    parser.add_argument('--wifi', default=getenv('LOKOLE_WIFI', 'yes'), help=(
        'If set to "no", skip setup of WiFi access point and '
        'local DNS server configuration.'
    ))
    parser.add_argument('--wifi_name', default=getenv('LOKOLE_NETWORK_NAME', 'Lokole'), help=(
        'The name of the WiFi network to create for the Lokole email app.'
    ))
    parser.add_argument('--wifi_password', default=getenv('LOKOLE_NETWORK_PASSWORD', 'Ascoderu'), help=(
        'The password of the WiFi network to create for the Lokole email app.'
    ))
    parser.add_argument('--script_log_level', default=getenv('LOKOLE_SCRIPT_LOG_LEVEL', 'INFO'), help=(
        'The logging verbosity of this script.'
    ))
    parser.add_argument('--server_host', default=getenv('LOKOLE_SERVER_HOST', 'mailserver.lokole.ca'), help=(
        'The host of the email sync server to use.'
    ))
    parser.add_argument('--client_domain', default=getenv('LOKOLE_CLIENT_DOMAIN', 'lokole.ca'), help=(
        'The root domain for which to set up the Lokole email app.'
    ))
    parser.add_argument('--client_version', default=getenv('LOKOLE_CLIENT_VERSION', ''), help=(
        'The version of the Lokole email app to install.'
    ))
    parser.add_argument('--client_dist', default=getenv('LOKOLE_CLIENT_DIST', ''), help=(
        'The dist package of the Lokole email app to install.'
    ))
    parser.add_argument('--port', default=getenv('LOKOLE_PORT', '80'), help=(
        'The port on which to run the Lokole email app.'
    ))
    parser.add_argument('--state_directory', default=getenv('LOKOLE_STATE_DIRECTORY', 'lokole/state'), help=(
        'The location where to store the Lokole email app state.'
    ))
    parser.add_argument('--log_directory', default=getenv('LOKOLE_LOG_DIRECTORY', 'lokole/logs'), help=(
        'The location where to store the Lokole email app logs.'
    ))
    parser.add_argument('--venv_directory', default=getenv('LOKOLE_VENV_DIRECTORY', 'lokole/venv'), help=(
        'The location where to store the Lokole email app Python environment.'
    ))
    parser.add_argument('--server_name', default=getenv('LOKOLE_SERVER_NAME', 'lokole_gunicorn'), help=(
        'Name of the Lokole webapp server.'
    ))
    parser.add_argument('--nginx_name', default=getenv('LOKOLE_NGINX_NAME', 'lokole_nginx'), help=(
        'Name of the Nginx service.'
    ))
    parser.add_argument('--worker_name', default=getenv('LOKOLE_WORKER_NAME', 'lokole_celery_worker'), help=(
        'Name of the Lokole webapp worker.'
    ))
    parser.add_argument('--cron_name', default=getenv('LOKOLE_CRON_NAME', 'lokole_celery_beat'), help=(
        'Name of the Lokole cron worker.'
    ))
    parser.add_argument('--restarter_name', default=getenv('LOKOLE_RESTARTER_NAME', 'lokole_restarter'), help=(
        'Name of the Lokole restarter.'
    ))
    parser.add_argument('--log_level', default=getenv('LOKOLE_LOG_LEVEL', 'error'), help=(
        'The log level for the Lokole email app.'
    ))
    parser.add_argument('--timeout', type=int, default=300, help=(
        'Timeout for the Lokole email app. In seconds.'
    ))
    parser.add_argument('--max_upload_size', type=int, default=10, help=(
        'Maximum allowed size of uploads to the Lokole email app. In MB.'
    ))
    parser.add_argument('--num_celery_workers', type=int, default=2, help=(
        'Number of celery workers for the Lokole email app.'
    ))
    parser.add_argument('--num_gunicorn_workers', type=int, default=max(2, cpu_count() - 1), help=(
        'Number of gunicorn workers for the Lokole email app.'
    ))
    parser.add_argument('--locale', default=getenv('LOKOLE_LOCALE', 'en_GB.UTF-8'), help=(
        'Locale to set up on the system.'
    ))
    parser.add_argument('--timezone', default=getenv('LOKOLE_TIMEZONE', 'Etc/UTC'), help=(
        'Timezone to set up on the system.'
    ))

    main(parser.parse_args(), parser.error)

if __name__ == '__main__':
    cli()


text:
namespace gfx {
class Size;
}

namespace ui {

// Helper methods for async snapshots to convert a viz::CopyOutputResult into a
// ui::GrabWindowSnapshot callback.
class SnapshotAsync {
 public:
  SnapshotAsync() = delete;
  SnapshotAsync(const SnapshotAsync&) = delete;
  SnapshotAsync& operator=(const SnapshotAsync&) = delete;

  static void ScaleCopyOutputResult(
      GrabWindowSnapshotAsyncCallback callback,
      const gfx::Size& target_size,
      std::unique_ptr<viz::CopyOutputResult> result);

  static void RunCallbackWithCopyOutputResult(
      GrabWindowSnapshotAsyncCallback callback,
      std::unique_ptr<viz::CopyOutputResult> result);
};

}  // namespace ui

#endif  // UI_SNAPSHOT_SNAPSHOT_ASYNC_H_


text:
package io.fabric8.kubernetes.client.internal;

import io.fabric8.kubernetes.api.model.ReplicationController;
import io.fabric8.kubernetes.api.model.ReplicationControllerBuilder;
import io.fabric8.kubernetes.client.dsl.internal.PatchUtils;
import io.fabric8.kubernetes.client.dsl.internal.PatchUtils.Format;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class PatchUtilsTest {

  @Test
  void testOmitStatus() {
    ReplicationController rc = new ReplicationControllerBuilder().withNewStatus().withFullyLabeledReplicas(1).endStatus()
        .withNewMetadata().withName("x").endMetadata().build();
    assertEquals("---\n"
        + "apiVersion: \"v1\"\n"
        + "kind: \"ReplicationController\"\n"
        + "metadata:\n"
        + "  name: \"x\"\n"
        + "status:\n"
        + "  fullyLabeledReplicas: 1\n", PatchUtils.withoutRuntimeState(rc, Format.YAML, false));

    assertEquals("{\"apiVersion\":\"v1\",\"kind\":\"ReplicationController\",\"metadata\":{\"name\":\"x\"}}",
        PatchUtils.withoutRuntimeState(rc, Format.JSON, true));
  }

  @Test
  void testDiff() {
    ReplicationController rc1 = new ReplicationControllerBuilder().withNewStatus().withFullyLabeledReplicas(1).endStatus()
        .withNewMetadata().withName("x").endMetadata().build();

    ReplicationController rc2 = new ReplicationControllerBuilder(rc1).editMetadata().addToLabels("my", "label").endMetadata()
        .editStatus().withAvailableReplicas(2).endStatus().build();

    assertEquals(
        "[{\"op\":\"add\",\"path\":\"/metadata/labels\",\"value\":{\"my\":\"label\"}},{\"op\":\"add\",\"path\":\"/status/availableReplicas\",\"value\":2}]",
        PatchUtils.jsonDiff(rc1, rc2, false));
  }

}


text:
@implementation PYNodes

- (instancetype)init
{
    self = [super init];
    if (self) {
        _ignore = NO;
        _symbol = PYSymbolCircle;
        _category = @(0);
    }
    return self;
}

PYInitializerImpTemplate(PYNodes);

PYPropertyEqualImpTemplate(PYNodes, NSString *, name);
PYPropertyEqualImpTemplate(PYNodes, NSString *, label);
PYPropertyEqualImpTemplate(PYNodes, NSNumber *, value);
PYPropertyEqualImpTemplate(PYNodes, BOOL, ignore);
PYPropertyEqualImpTemplate(PYNodes, NSString *, symbol);
PYPropertyEqualImpTemplate(PYNodes, id, symboleSize);
PYPropertyEqualImpTemplate(PYNodes, NSNumber *, category);
PYPropertyEqualImpTemplate(PYNodes, PYItemStyle *, itemStyle);

@end


text:
FROM debian

RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \
    echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
    apt-get update && \
    echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
    apt-get install -y oracle-java8-installer oracle-java8-set-default && \
    apt-get clean && \
    rm -rf /var/cache/oracle-jdk8-installer && \
    rm -rf /var/lib/apt/lists/*

RUN groupadd -r docker && useradd -rmg docker docker
VOLUME /tmp
WORKDIR /home/docker
ADD target/*.jar application.jar
RUN touch application.jar
USER docker
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","application.jar"]


text:
import { moduleForModel, test } from 'ember-qunit';

moduleForModel('risk-assessment-prediction', 'Unit | Model | RiskAssessment_Prediction', {
  needs: [
    'model:meta',
    'model:narrative',
    'model:resource',
    'model:extension',
    'model:codeable-concept',
    'model:range',
    'model:period'
  ]
});

test('it exists', function(assert) {
  const model = this.subject();
  assert.ok(!!model);
});


text:
package org.apache.ignite.internal.processors.odbc.odbc;

import org.apache.ignite.internal.util.typedef.internal.S;

/**
 * ODBC query get params meta request.
 */
public class OdbcQueryGetParamsMetaRequest extends OdbcRequest {
    /** Schema. */
    private final String schema;

    /** Query. */
    private final String query;

    /**
     * @param schema Schema.
     * @param query SQL Query.
     */
    public OdbcQueryGetParamsMetaRequest(String schema, String query) {
        super(META_PARAMS);

        this.schema = schema;
        this.query = query;
    }

    /**
     * @return SQL Query.
     */
    public String query() {
        return query;
    }

    /**
     * @return Schema name.
     */
    public String schema() {
        return schema;
    }

    /** {@inheritDoc} */
    @Override public String toString() {
        return S.toString(OdbcQueryGetParamsMetaRequest.class, this);
    }
}


text:
class LoadSequance: public CommandGroup {
public:
	LoadSequance();
};

#endif


text:
package com.maxmouchet;

import java.util.HashMap;

public abstract class AEF {

    protected final HashMap<StateTransition, State> nextStates = new HashMap<>();
    protected State[] states = {};

    public void addTransition(State from, State to, Character character) {
        nextStates.put(new StateTransition(from, character), to);
    }

    public void addTransitions(State from, State to, Character[] characters) {
        for (Character character : characters) {
            addTransition(from, to, character);
        }
    }

    public void addSelfTransition(State state, Character character) {
        addTransition(state, state, character);
    }

    public boolean accepte(String input) {
        State state = states[0];

        int i = 0;
        char c;

        while (i != input.length()) {
            c = input.charAt(i++);

            StateTransition st = new StateTransition(state, c);

            if (nextStates.containsKey(st)) {
                state = nextStates.get(st);
                continue;
            } else {
                return false;
            }
        }

        return state.isExit;
    }
}


text:
/*
 * Instrumentation API definitions
 */

#ifndef _KBASE_INSTR_H_
#define _KBASE_INSTR_H_

#include <mali_kbase_hwaccess_instr.h>

/**
 * kbase_instr_hwcnt_enable() - Enable HW counters collection
 * @kctx:	Kbase context
 * @setup:	&struct kbase_uk_hwcnt_setup containing configuration
 *
 * Return: 0 on success
 */
int kbase_instr_hwcnt_enable(struct kbase_context *kctx,
					struct kbase_uk_hwcnt_setup *setup);

/**
 * kbase_instr_hwcnt_disable() - Disable HW counters collection
 * @kctx:	Kbase context
 *
 * Return: 0 on success
 */
int kbase_instr_hwcnt_disable(struct kbase_context *kctx);

/**
 * kbase_instr_hwcnt_dump() - Trigger dump of HW counters and wait for
 *                            completion
 * @kctx:	Kbase context
 *
 * Context: might sleep, waiting for dump to complete
 *
 * Return: 0 on success
 */
int kbase_instr_hwcnt_dump(struct kbase_context *kctx);

/**
 * kbase_instr_hwcnt_suspend() - GPU is suspending, stop HW counter collection
 * @kbdev:	Kbase device
 *
 * It's assumed that there's only one privileged context.
 *
 * Safe to do this without lock when doing an OS suspend, because it only
 * changes in response to user-space IOCTLs
 */
void kbase_instr_hwcnt_suspend(struct kbase_device *kbdev);

/**
 * kbase_instr_hwcnt_resume() - GPU is resuming, resume HW counter collection
 * @kbdev:	Kbase device
 */
void kbase_instr_hwcnt_resume(struct kbase_device *kbdev);

#endif /* _KBASE_INSTR_H_ */


text:
package co.nstant.in.cbor.model;

import java.math.BigInteger;
import java.util.Objects;

public abstract class Number extends DataItem {

    private final BigInteger value;

    protected Number(MajorType majorType, BigInteger value) {
        super(majorType);
        this.value = Objects.requireNonNull(value);
    }

    public BigInteger getValue() {
        return value;
    }

    @Override
    public boolean equals(Object object) {
        if (object instanceof Number) {
            Number other = (Number) object;
            return super.equals(object) && value.equals(other.value);
        }
        return false;
    }

    @Override
    public int hashCode() {
        return super.hashCode() ^ value.hashCode();
    }

    @Override
    public String toString() {
        return value.toString();
    }

}


text:
<?php

$filename = dirname(__FILE__)."/parse_ini_file.dat";
@unlink($filename); /* Make sure the file really does not exist! */

var_dump(parse_ini_file());
var_dump(parse_ini_file(1,1,1,1));
var_dump(parse_ini_file($filename));
var_dump(parse_ini_file($filename, true));

$ini = "
test =
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename));
$ini = "
test==
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename));

$ini = "
test=test=
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename));

$ini = "
test= \"new
line\"
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename));

define("TEST_CONST", "test const value");
$ini = "
test=TEST_CONST
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename));

$ini = "
[section]
test=hello
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));

$ini = "
[section]
test=hello
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, false));

$ini = "
section.test=hello
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));

$ini = "
[section]
section.test=hello
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));

$ini = "
[section]
1=2
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));

$ini = "
1=2
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));
$ini = "
test=test2
test=test3
test=test4
";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));

/* From bug #44574 */
$ini = "[section1]\nname = value";
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));

/* #44842, labels starting with underscore */
$ini = <<<'INI'
foo=bar1
_foo=bar2
foo_=bar3
INI;
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));

/* #44575, comments starting with '#' */
$ini = <<<'INI'
foo=bar1
; comment
_foo=bar2
; comment
foo_=bar3
INI;
file_put_contents($filename, $ini);
var_dump(parse_ini_file($filename, true));

@unlink($filename);
echo "Done\n";
?>


text:
package com.amazonaws.services.frauddetector.model.transform;

import java.util.List;
import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.frauddetector.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * CreateBatchPredictionJobRequestMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class CreateBatchPredictionJobRequestMarshaller {

    private static final MarshallingInfo<String> JOBID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("jobId").build();
    private static final MarshallingInfo<String> INPUTPATH_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("inputPath").build();
    private static final MarshallingInfo<String> OUTPUTPATH_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("outputPath").build();
    private static final MarshallingInfo<String> EVENTTYPENAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("eventTypeName").build();
    private static final MarshallingInfo<String> DETECTORNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("detectorName").build();
    private static final MarshallingInfo<String> DETECTORVERSION_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("detectorVersion").build();
    private static final MarshallingInfo<String> IAMROLEARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("iamRoleArn").build();
    private static final MarshallingInfo<List> TAGS_BINDING = MarshallingInfo.builder(MarshallingType.LIST).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("tags").build();

    private static final CreateBatchPredictionJobRequestMarshaller instance = new CreateBatchPredictionJobRequestMarshaller();

    public static CreateBatchPredictionJobRequestMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(CreateBatchPredictionJobRequest createBatchPredictionJobRequest, ProtocolMarshaller protocolMarshaller) {

        if (createBatchPredictionJobRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(createBatchPredictionJobRequest.getJobId(), JOBID_BINDING);
            protocolMarshaller.marshall(createBatchPredictionJobRequest.getInputPath(), INPUTPATH_BINDING);
            protocolMarshaller.marshall(createBatchPredictionJobRequest.getOutputPath(), OUTPUTPATH_BINDING);
            protocolMarshaller.marshall(createBatchPredictionJobRequest.getEventTypeName(), EVENTTYPENAME_BINDING);
            protocolMarshaller.marshall(createBatchPredictionJobRequest.getDetectorName(), DETECTORNAME_BINDING);
            protocolMarshaller.marshall(createBatchPredictionJobRequest.getDetectorVersion(), DETECTORVERSION_BINDING);
            protocolMarshaller.marshall(createBatchPredictionJobRequest.getIamRoleArn(), IAMROLEARN_BINDING);
            protocolMarshaller.marshall(createBatchPredictionJobRequest.getTags(), TAGS_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}