text:
"""Script to parse BSM event auditing files."""

import argparse
import logging
import sys

from dtformats import bsm
from dtformats import output_writers

def Main():
  """The main program function.

  Returns:
    bool: True if successful or False if not.
  """
  argument_parser = argparse.ArgumentParser(description=(
      'Extracts information from BSM event auditing files.'))

  argument_parser.add_argument(
      '-d', '--debug', dest='debug', action='store_true', default=False,
      help='enable debug output.')

  argument_parser.add_argument(
      'source', nargs='?', action='store', metavar='PATH',
      default=None, help='path of the BSM event auditing file.')

  options = argument_parser.parse_args()

  if not options.source:
    print('Source file missing.')
    print('')
    argument_parser.print_help()
    print('')
    return False

  logging.basicConfig(
      level=logging.INFO, format='[%(levelname)s] %(message)s')

  output_writer = output_writers.StdoutWriter()

  try:
    output_writer.Open()
  except IOError as exception:
    print(f'Unable to open output writer with error: {exception!s}')
    print('')
    return False

  log_file = bsm.BSMEventAuditingFile(
      debug=options.debug, output_writer=output_writer)

  log_file.Open(options.source)

  print('BSM event auditing information:')
  print('')

  log_file.Close()

  output_writer.Close()

  return True

if __name__ == '__main__':
  if not Main():
    sys.exit(1)
  else:
    sys.exit(0)


text:
//
//  KSSystemInfo.h
//
//  Created by Karl Stenerud on 2012-02-05.
//
//  Copyright (c) 2012 Karl Stenerud. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall remain in place
// in this source code.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#define KSSystemField_AppStartTime "app_start_time"
#define KSSystemField_AppUUID "app_uuid"
#define KSSystemField_BootTime "boot_time"
#define KSSystemField_BundleID "CFBundleIdentifier"
#define KSSystemField_BundleName "CFBundleName"
#define KSSystemField_BundleShortVersion "CFBundleShortVersionString"
#define KSSystemField_BundleVersion "CFBundleVersion"
#define KSSystemField_CPUArch "cpu_arch"
#define KSSystemField_DeviceAppHash "device_app_hash"
#define KSSystemField_Executable "CFBundleExecutable"
#define KSSystemField_ExecutablePath "CFBundleExecutablePath"
#define KSSystemField_Jailbroken "jailbroken"
#define KSSystemField_KernelVersion "kernel_version"
#define KSSystemField_Machine "machine"
#define KSSystemField_Memory "memory"
#define KSSystemField_Model "model"
#define KSSystemField_OSVersion "os_version"
#define KSSystemField_ParentProcessID "parent_process_id"
#define KSSystemField_ParentProcessName "parent_process_name"
#define KSSystemField_ProcessID "process_id"
#define KSSystemField_ProcessName "process_name"
#define KSSystemField_Size "size"
#define KSSystemField_SystemName "system_name"
#define KSSystemField_SystemVersion "system_version"
#define KSSystemField_TimeZone "time_zone"

/**
 * Provides system information useful for a crash report.
 */
@interface KSSystemInfo : NSObject

/** Get the system info.
 *
 * @return The system info.
 */
+ (NSDictionary*) systemInfo;

@end

redpajama_set_name: RedPajamaGithub


text:
using namespace irr;

// forward declaration of functions
std::set<int> KeyframeSet(irr::scene::IAnimatedMesh* anim_mesh);
int FindParentIndex(scene::ISkinnedMesh* mesh, const scene::ISkinnedMesh::SJoint* joint);
std::vector<int> BoneIndicesForSurface(scene::ISkinnedMesh* mesh, u32 surface);
std::vector<float> BoneWeightsForSurface(scene::ISkinnedMesh* mesh, u32 surface);

extern "C" {

EXPORT mesh_t* CALL LoadMesh(const char* filename) {
  mesh_t* mesh = NULL;

  // create irrlicht device
  SIrrlichtCreationParameters params;
  params.DeviceType = EIDT_CONSOLE;
  params.DriverType = video::EDT_NULL;
  params.LoggingLevel = ELL_NONE;
  IrrlichtDevice* device = createDeviceEx(params);

  // load mesh
  scene::IAnimatedMesh* anim_mesh = device->getSceneManager()->getMesh(filename);
  if ( !anim_mesh ) return NULL;

  // recalculate normals
  device->getVideoDriver()->getMeshManipulator()->recalculateNormals(anim_mesh);

  // get different versions of the mesh (animated, static, with tangents)
  scene::ISkinnedMesh* skinned_mesh = ( anim_mesh->getMeshType() == scene::EAMT_SKINNED && anim_mesh->getFrameCount() > 1 ) ? static_cast<scene::ISkinnedMesh*>(anim_mesh) : 0;
  scene::IMesh* irr_mesh = anim_mesh->getMesh(0);
  scene::IMesh* tangent_mesh = device->getVideoDriver()->getMeshManipulator()->createMeshWithTangents(irr_mesh);

  // get keyframes set (used for vertex animation)
  std::set<int> keyframes = KeyframeSet(anim_mesh);

  // create mesh object
  mesh = new mesh_t;

  // num frames
  mesh->num_frames = (keyframes.size() > 0) ? anim_mesh->getFrameCount() : 0;

  // anim duration
  mesh->anim_speed = (keyframes.size() > 0) ? anim_mesh->getAnimationSpeed() : 0;

  // surfaces
  for ( size_t i = 0; i < irr_mesh->getMeshBufferCount(); ++i ) {
    scene::IMeshBuffer* mesh_buffer = irr_mesh->getMeshBuffer(i);
    const video::SMaterial& mat = mesh_buffer->getMaterial();

    surface_t surf;

    // material
    std::string base_tex = mat.getTexture(0) ? mat.getTexture(0)->getName().getPath().c_str() : "";
    std::string lightmap = mat.getTexture(1) ? mat.getTexture(1)->getName().getPath().c_str() : "";
    unsigned char r = mat.DiffuseColor.getRed();
    unsigned char g = mat.DiffuseColor.getGreen();
    unsigned char b = mat.DiffuseColor.getBlue();
    unsigned char a = mat.DiffuseColor.getAlpha();
    float shininess = mat.Shininess > 0 ? mat.Shininess : 0.001f;
    int culling = mat.BackfaceCulling;
    int depth_write = mat.ZWriteEnable;
    surf.material = material_t(0, base_tex, lightmap, r, g, b, a, shininess, DEFAULT_SPECULARPOWER, culling, depth_write);

    // indices
    for (size_t j = 0; j < mesh_buffer->getIndexCount(); ++j) {
      surf.indices.push_back(mesh_buffer->getIndices()[j]);
    }

    // vertices
    video::S3DVertex* vertices = static_cast<video::S3DVertex*>(mesh_buffer->getVertices());
    video::S3DVertex2TCoords* vertices2t = mesh_buffer->getVertexType() == video::EVT_2TCOORDS ? static_cast<video::S3DVertex2TCoords*>(mesh_buffer->getVertices()) : 0;
    video::S3DVertexTangents* verticesTangents = tangent_mesh->getMeshBuffer(i)->getVertexType() == video::EVT_TANGENTS ? static_cast<video::S3DVertexTangents*>(tangent_mesh->getMeshBuffer(i)->getVertices()) : 0;
    for ( size_t v = 0; v < mesh_buffer->getVertexCount(); ++v ) {
      float x = mesh_buffer->getPosition(v).X;
      float y = mesh_buffer->getPosition(v).Y;
      float z = mesh_buffer->getPosition(v).Z;
      float nx = mesh_buffer->getNormal(v).X;
      float ny = mesh_buffer->getNormal(v).Y;
      float nz = mesh_buffer->getNormal(v).Z;
      float u0 = mesh_buffer->getTCoords(v).X;
      float v0 = mesh_buffer->getTCoords(v).Y;
      float u1 = vertices2t ? vertices2t[v].TCoords2.X : u0;
      float v1 = vertices2t ? vertices2t[v].TCoords2.Y : v0;
      float tx = verticesTangents ? verticesTangents[v].Tangent.X : 0;
      float ty = verticesTangents ? verticesTangents[v].Tangent.Y : 0;
      float tz = verticesTangents ? verticesTangents[v].Tangent.Z : 0;
      surf.vertices.push_back(vertex_t(x, y, z, nx, ny, nz, u0, v0, u1, v1));
      surf.vertices.back().tx = tx;
      surf.vertices.back().ty = ty;
      surf.vertices.back().tz = tz;
      surf.vertices.back().color = vertices[v].Color.color;
    }

    // vertex animation frames
    if ( keyframes.size() > 0 ) {
      for ( std::set<int>::const_iterator it = keyframes.begin(); it != keyframes.end(); ++it ) {
        scene::IMeshBuffer* mesh_buffer = anim_mesh->getMesh(*it)->getMeshBuffer(i);
        vertexframe_t frame;
        frame.frame = *it;
        frame.positions.resize(mesh_buffer->getVertexCount(), vec3_t(0, 0, 0));
        frame.normals.resize(mesh_buffer->getVertexCount(), vec3_t(0, 0, 0));
        for ( size_t v = 0; v < mesh_buffer->getVertexCount(); ++v ) {
          frame.positions[v] = vec3_t(mesh_buffer->getPosition(v).X, mesh_buffer->getPosition(v).Y, mesh_buffer->getPosition(v).Z);
          frame.normals[v] = vec3_t(mesh_buffer->getNormal(v).X, mesh_buffer->getNormal(v).Y, mesh_buffer->getNormal(v).Z);
        }
        surf.vertex_frames.push_back(frame);
      }
    }

    // bone indices and weights
    if ( skinned_mesh ) {
      std::vector<int> indices = BoneIndicesForSurface(skinned_mesh, i);
      std::vector<float> weights = BoneWeightsForSurface(skinned_mesh, i);
      for ( size_t b = 0; b < indices.size(); b += 4 ) {
        surf.vertices[b/4].bones[0] = indices[b];
        surf.vertices[b/4].bones[1] = indices[b+1];
        surf.vertices[b/4].bones[2] = indices[b+2];
        surf.vertices[b/4].bones[3] = indices[b+3];
        surf.vertices[b/4].weights[0] = weights[b];
        surf.vertices[b/4].weights[1] = weights[b+1];
        surf.vertices[b/4].weights[2] = weights[b+2];
        surf.vertices[b/4].weights[3] = weights[b+3];
      }
    }

    // add surface
    mesh->surfaces.push_back(surf);
  }

  // bones
  if ( skinned_mesh ) {
    const core::array<scene::ISkinnedMesh::SJoint*>& joints = skinned_mesh->getAllJoints();
    for ( size_t b = 0; b < joints.size(); ++b ) {
      scene::ISkinnedMesh::SJoint* joint = joints[b];

      bone_t bone;

      // name and parent index
      bone.name = joint->Name.c_str();
      bone.parent_index = FindParentIndex(skinned_mesh, joint);

      // pose matrix
      core::matrix4 pose = joint->LocalMatrix;
      for ( size_t m = 0; m < 16; ++m ) {
        bone.transform[m] = pose[m];
      }

      // inverse pose matrix
      core::matrix4 inv_pose = joint->GlobalInversedMatrix;
      for ( size_t m = 0; m < 16; ++m ) {
        bone.inv_pose[m] = inv_pose[m];
      }

      // surfaces
      for ( size_t i = 0; i < joint->AttachedMeshes.size(); ++i ) {
        bone.surfaces.push_back(joint->AttachedMeshes[i]);
      }

      // convert non-skeletal meshes
      for ( size_t i = 0; i < joint->AttachedMeshes.size(); ++i ) {
        int surf_index = joint->AttachedMeshes[i];
        scene::IMeshBuffer* mesh_buffer = irr_mesh->getMeshBuffer(surf_index);

        // update vertices
        for ( size_t v = 0; v < mesh->surfaces[surf_index].vertices.size(); ++v ) {
          // move vertex from bone to model space
          core::vector3df model_pos(mesh->surfaces[surf_index].vertices[v].x, mesh->surfaces[surf_index].vertices[v].y, mesh->surfaces[surf_index].vertices[v].z);
          joint->GlobalMatrix.transformVect(model_pos);
          mesh->surfaces[surf_index].vertices[v].x = model_pos.X;
          mesh->surfaces[surf_index].vertices[v].y = model_pos.Y;
          mesh->surfaces[surf_index].vertices[v].z = model_pos.Z;

          // set vertex bone and weight
          mesh->surfaces[surf_index].vertices[v].bones[0] = b;
          mesh->surfaces[surf_index].vertices[v].weights[0] = 1;
        }
      }

      // position keys
      if ( joint->PositionKeys.size() > 0 ) {
        for ( size_t p = 0; p < joint->PositionKeys.size(); ++p ) {
          bone.positions.push_back(std::pair<int, vec3_t>(
            static_cast<int>(joint->PositionKeys[p].frame),
            vec3_t(joint->PositionKeys[p].position.X, joint->PositionKeys[p].position.Y, joint->PositionKeys[p].position.Z)
          ));
        }
      } else if ( joint->RotationKeys.size() > 0 || joint->ScaleKeys.size() > 0 ) {
        bone.positions.push_back(std::pair<int, vec3_t>(0, vec3_t(0, 0, 0)));
      }

      // rotation keys
      if ( joint->RotationKeys.size() > 0 ) {
        for ( size_t r = 0; r < joint->RotationKeys.size(); ++r ) {
          bone.rotations.push_back(std::pair<int, quat_t>(
            static_cast<int>(joint->RotationKeys[r].frame),
            quat_t(-joint->RotationKeys[r].rotation.W, joint->RotationKeys[r].rotation.X, joint->RotationKeys[r].rotation.Y, joint->RotationKeys[r].rotation.Z)
          ));
        }
      } else if ( joint->PositionKeys.size() > 0 || joint->ScaleKeys.size() > 0 ) {
        bone.rotations.push_back(std::pair<int, quat_t>(0, quat_t(1, 0, 0, 0)));
      }

      // scale keys
      if ( joint->ScaleKeys.size() > 0 ) {
        for ( size_t s = 0; s < joint->ScaleKeys.size(); ++s ) {
          bone.scales.push_back(std::pair<int, vec3_t>(
            static_cast<int>(joint->ScaleKeys[s].frame),
            vec3_t(joint->ScaleKeys[s].scale.X, joint->ScaleKeys[s].scale.Y, joint->ScaleKeys[s].scale.Z)
          ));
        }
      } else if ( joint->PositionKeys.size() > 0 || joint->RotationKeys.size() > 0 ) {
        bone.scales.push_back(std::pair<int, vec3_t>(0, vec3_t(1, 1, 1)));
      }

      mesh->bones.push_back(bone);
    }
  }

  // optimize mesh
  size_t s = 1;
  while ( s < mesh->surfaces.size() ) {
    // look for a previous surface with same material
    int same_mat_surf_index = -1;
    for ( size_t i = 0; i < s; ++i ) {
      if ( mesh->surfaces[s].material == mesh->surfaces[i].material && mesh->surfaces[s].vertices.size() + mesh->surfaces[i].vertices.size() <= 65535 ) {
        same_mat_surf_index = i;
        break;
      }
    }

    // if it has been found, merge both surfaces
    if ( same_mat_surf_index > -1 ) {
      size_t new_first = mesh->surfaces[same_mat_surf_index].vertices.size();

      // add vertices
      for ( size_t i = 0; i < mesh->surfaces[s].vertices.size(); ++i ) {
        mesh->surfaces[same_mat_surf_index].vertices.push_back(mesh->surfaces[s].vertices[i]);
      }

      // add indices
      for ( size_t i = 0; i < mesh->surfaces[s].indices.size(); ++i ) {
        mesh->surfaces[same_mat_surf_index].indices.push_back(new_first + mesh->surfaces[s].indices[i]);
      }

      // add vertex frames
      for ( size_t i = 0; i < mesh->surfaces[s].vertex_frames.size(); ++i ) {
        for ( size_t j = 0; j < mesh->surfaces[s].vertices.size(); ++j ) {
          mesh->surfaces[same_mat_surf_index].vertex_frames[i].positions.push_back(mesh->surfaces[s].vertex_frames[i].positions[j]);
          mesh->surfaces[same_mat_surf_index].vertex_frames[i].normals.push_back(mesh->surfaces[s].vertex_frames[i].normals[j]);
        }
      }

      // remove second surface
      mesh->surfaces.erase(mesh->surfaces.begin() + s);
    // otherwise, go to next surface
    } else {
      ++s;
    }
  }

  // drop irrlicht device
  device->drop();

  return mesh;
}

EXPORT void CALL DeleteMesh(mesh_t* mesh) {
  delete mesh;
}

} // extern "C"

std::set<int> KeyframeSet(irr::scene::ISkinnedMesh* skinned_mesh) {
  // make sure that it has frames
  if ( skinned_mesh->getFrameCount() == 0 ) return std::set<int>();

  // create set and add all keyframes to it
  std::set<int> keyframe_set;
  for ( size_t j = 0; j < skinned_mesh->getAllJoints().size(); ++j ) {
    for ( size_t p = 0; p < skinned_mesh->getAllJoints()[j]->PositionKeys.size(); ++p ) {
      keyframe_set.insert(static_cast<int>(skinned_mesh->getAllJoints()[j]->PositionKeys[p].frame));
    }
    for ( size_t r = 0; r < skinned_mesh->getAllJoints()[j]->RotationKeys.size(); ++r ) {
      keyframe_set.insert(static_cast<int>(skinned_mesh->getAllJoints()[j]->RotationKeys[r].frame));
    }
    for ( size_t s = 0; s < skinned_mesh->getAllJoints()[j]->ScaleKeys.size(); ++s ) {
      keyframe_set.insert(static_cast<int>(skinned_mesh->getAllJoints()[j]->ScaleKeys[s].frame));
    }
  }

  // return set
  return keyframe_set;
}

std::set<int> KeyframeSet(irr::scene::IAnimatedMeshMD2* md2_mesh) {
  // make sure that it has frames
  if ( md2_mesh->getFrameCount() == 0 ) return std::set<int>();

  // create set and add all keyframes to it
  std::set<int> keyframe_set;
  for ( s32 a = 0; a < md2_mesh->getAnimationCount(); ++a ) {
    s32 first = 0;
    s32 last = 0;
    s32 fps = 0;
    md2_mesh->getFrameLoop(md2_mesh->getAnimationName(a), first, last, fps);

    s32 num_frames = (last - first + 1) / 4;
    float step = float(last - first) / (num_frames - 1);
    for ( s32 i = 0; i < num_frames; ++i ) {
      keyframe_set.insert(static_cast<int>(first + step * i));
    }
  }

  // return set
  return keyframe_set;
}

std::set<int> KeyframeSet(irr::scene::IAnimatedMesh* anim_mesh) {
  scene::ISkinnedMesh* skinned_mesh = ( anim_mesh->getMeshType() == scene::EAMT_SKINNED && anim_mesh->getFrameCount() > 1 )
    ? static_cast<scene::ISkinnedMesh*>(anim_mesh)
    : NULL;
  scene::IAnimatedMeshMD2* md2_mesh = ( anim_mesh->getMeshType() == scene::EAMT_MD2 && anim_mesh->getFrameCount() > 1 )
    ? static_cast<scene::IAnimatedMeshMD2*>(anim_mesh)
    : NULL;
  if (skinned_mesh) {
    return KeyframeSet(skinned_mesh);
  } else if (md2_mesh) {
    return KeyframeSet(md2_mesh);
  } else {
    return std::set<int>();
  }
}

std::vector<int> BoneIndicesForSurface(scene::ISkinnedMesh* mesh, u32 surface) {
  if ( !mesh ) return std::vector<int>();
  bool indicesFound = false;
  std::vector<int> indices(mesh->getMeshBuffer(surface)->getVertexCount() * 4, -1);
  for (u32 i = 0; i < mesh->getJointCount(); ++i) {
    for (u32 j = 0; j < mesh->getAllJoints()[i]->Weights.size(); ++j) {
      if (mesh->getAllJoints()[i]->Weights[j].buffer_id == surface) {
        indicesFound = true;
        u32 vertexId = mesh->getAllJoints()[i]->Weights[j].vertex_id;
        if ( indices[vertexId*4] == -1 ) indices[vertexId*4] = i;
        else if ( indices[vertexId*4 + 1] == -1 ) indices[vertexId*4 + 1] = i;
        else if ( indices[vertexId*4 + 2] == -1 ) indices[vertexId*4 + 2] = i;
        else if ( indices[vertexId*4 + 3] == -1 ) indices[vertexId*4 + 3] = i;
      }
    }
  }
  if ( indicesFound ) return indices;
  else return std::vector<int>();
}

std::vector<float> BoneWeightsForSurface(scene::ISkinnedMesh* mesh, u32 surface) {
  if ( !mesh ) return std::vector<float>();
  bool weightsFound = false;
  std::vector<float> weights(mesh->getMeshBuffer(surface)->getVertexCount() * 4, -1);
  for (u32 i = 0; i < mesh->getJointCount(); ++i) {
    for (u32 j = 0; j < mesh->getAllJoints()[i]->Weights.size(); ++j) {
      if (mesh->getAllJoints()[i]->Weights[j].buffer_id == surface) {
        weightsFound = true;
        u32 vertexId = mesh->getAllJoints()[i]->Weights[j].vertex_id;
        if ( weights[vertexId*4] == -1 ) weights[vertexId*4] = mesh->getAllJoints()[i]->Weights[j].strength;
        else if ( weights[vertexId*4 + 1] == -1 ) weights[vertexId*4 + 1] = mesh->getAllJoints()[i]->Weights[j].strength;
        else if ( weights[vertexId*4 + 2] == -1 ) weights[vertexId*4 + 2] = mesh->getAllJoints()[i]->Weights[j].strength;
        else if ( weights[vertexId*4 + 3] == -1 ) weights[vertexId*4 + 3] = mesh->getAllJoints()[i]->Weights[j].strength;
      }
    }
  }

  for ( size_t i = 0; i < weights.size(); ++i ) {
    if ( weights[i] == -1.0f ) weights[i] = 0.0f;
  }

  if ( weightsFound ) return weights;
  else return std::vector<float>();
}

int FindParentIndex(scene::ISkinnedMesh* mesh, const scene::ISkinnedMesh::SJoint* joint) {
  for ( size_t i = 0; i < mesh->getJointCount(); ++i ) {
    for (size_t j = 0; j < mesh->getAllJoints()[i]->Children.size(); ++j ) {
      if ( mesh->getAllJoints()[i]->Children[j]->Name == joint->Name ) {
        return static_cast<int>(i);
      }
    }
  }
  return -1;
}


text:
#include "lullaby/base/system.h"

#include "lullaby/base/entity_factory.h"

namespace lull {

System::System(Registry* registry) : registry_(registry) {}

void System::RegisterDef(TypeId system_type, HashValue type) {
  auto* entity_factory = registry_->Get<EntityFactory>();
  if (entity_factory) {
    entity_factory->RegisterDef(system_type, type);
  }
}

}  // namespace lull


text:
/**
 * Created with JetBrains WebStorm.
 * User: ryaneldridge
 * Date: 1/24/13
 * Time: 7:17 AM
 * To change this template use File | Settings | File Templates.
 */

exports.urls = {
    USER_NEW : "/users/new"
    , USER_CREATE : "/users/create"
    , USER_VIEW : "/users/view/:id"
    , USER_UPDATE : "/users/update/:id"
    , USER_DELETE : "/users/delete/:id"
    , USER_SEARCH : "/users/search"
    , USER_GET_AJAX : "/users/ajax"

    , LOGIN_GET : "/users/login"
    , LOGIN_POST : "/users/login"

    , ACCOUNT_VIEW : "/users/account/view"
    , ACCOUNT_ARTISAN_PROFILE_NEW : "/users/artisan/profile/new"
    , ACCOUNT_ARTISAN_PROFILE_SAVE : "/profiles/artisan"
    , ACCOUNT_MERCHANT_PROFILE_VIEW : "/users/merchant/profile/view"
    , ACCOUNT_ARTISAN_PROFILE_GET_AJAX : "/profiles/artisan/:artisanProfileId"

    , ACCOUNT_ARTISAN_PROFILE_PRODUCT_NEW : "/users/artisan/product/new"
    , PRODUCT_CREATE_ASYNC  : "/products/create/async"
    , PRODUCT_GET_AJAX : "/products/artisan/:artisanId"
    , PRODUCT_REMOVE_AJAX : "/products/remove/:productId"

    , SHOP_LIST : "/shops/list"
    , SHOP_NEW : "/shops/new"
    , SHOP_CREATE : "/shops/create"
    , SHOP_VIEW : "/shops/view/:id"
    , SHOP_UPDATE : "/shops/update/:id"
    , SHOP_SEARCH : "/shops/search"

    , LOGOUT : "/users/logout"
};


text:
package org.mb.settings.parsing;

import java.io.FileNotFoundException;
import java.io.Reader;

/**
 * Created by Dmitriy Dzhevaga on 27.06.2015.
 */
public interface Parser {
    Object parse(Reader inputFile) throws FileNotFoundException, ParsingException;
}


text:
#include <init.h>
#include <drivers/pinmux.h>
#include <soc.h>

static int board_pinmux_init(const struct device *dev)
{
	const struct device *muxa = DEVICE_DT_GET(DT_NODELABEL(pinmux_a));
	const struct device *muxb = DEVICE_DT_GET(DT_NODELABEL(pinmux_b));

	__ASSERT_NO_MSG(device_is_ready(muxa));
	__ASSERT_NO_MSG(device_is_ready(muxb));

	ARG_UNUSED(dev);

#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && CONFIG_UART_SAM0)
	/* SERCOM3 on RX=PA25, TX=PA24 */
	pinmux_pin_set(muxa, 24, PINMUX_FUNC_C);
	pinmux_pin_set(muxa, 25, PINMUX_FUNC_C);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && CONFIG_UART_SAM0)
	pinmux_pin_set(muxb,  8, PINMUX_FUNC_D);
	pinmux_pin_set(muxb,  9, PINMUX_FUNC_D);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif

#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0)
	/* SPI SERCOM0 on MISO=PA04, MOSI=PA06, SCK=PA07 */
	pinmux_pin_set(muxa,  4, PINMUX_FUNC_D);
	pinmux_pin_set(muxa,  6, PINMUX_FUNC_D);
	pinmux_pin_set(muxa,  7, PINMUX_FUNC_D);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) && CONFIG_SPI_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_spi) && CONFIG_SPI_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_spi) && CONFIG_SPI_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) && CONFIG_SPI_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_spi) && CONFIG_SPI_SAM0)
#warning Pin mapping may not be configured
#endif

#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_i2c) && CONFIG_I2C_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_i2c) && CONFIG_I2C_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_i2c) && CONFIG_I2C_SAM0)
	/* SERCOM2 on SDA=PA08, SCL=PA09 */
	pinmux_pin_set(muxa, 8, PINMUX_FUNC_D);
	pinmux_pin_set(muxa, 9, PINMUX_FUNC_D);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_i2c) && CONFIG_I2C_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_i2c) && CONFIG_I2C_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_i2c) && CONFIG_I2C_SAM0)
#warning Pin mapping may not be configured
#endif

	return 0;
}

SYS_INIT(board_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);


text:
const cheerio = require('cheerio'),
    q = require('q'),
    BaseClient = require('./baseClient'),
    TimeSlot = require('../models/TimeSlot');

module.exports = class MatchiClient extends BaseClient {
    constructor(url) {
        super(url);
    }

    scrape() {
        const defer = q.defer();
        super.requestUrl().then((html) => {
            var result = this._parse(cheerio.load(html));
            if (result && result.length > 0) {
                return defer.resolve(result);
            } else {
                return defer.reject();
            }
        }, (error) => {
            console.log('There was an error in Match Client' + error);
            return defer.reject();
        });

        return defer.promise;
    }

    _parse($) {
        try {
            let day = {};
            $('[class="slot free"]').filter(function () {
                var element = $(this);
                const titleArray = element.attr('title').split('<br>'),
                    court = titleArray[1],
                    time = titleArray[2],
                    startTime = time.split('-')[0].trim(),
                    endTime = time.split('-')[1].trim(),
                    key = startTime + '-' + endTime + '-' + court;

                if (titleArray[0].toLowerCase() === 'ledig' && !day.hasOwnProperty(key)) {
                    day[key] = {
                        timeSlot: new TimeSlot(Number(startTime.replace(':', '.')), Number(endTime.replace(':', '.'))),
                        courtNumber: Number(court.toLowerCase().replace('bana', '').trim())
                    };
                }
            });

            return Object.keys(day).map(key => day[key]);
        } catch (error) {
            console.log('There was an error scraping ' + this.url ? this.url : '');
            return;
        }
    }
};


text:
<?php
namespace Doctrine\Tests\ORM\Functional;

use Doctrine\Tests\Models\CMS\CmsUser;
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
use Doctrine\Tests\Models\CMS\CmsAddress;
use Doctrine\Tests\Models\CMS\CmsEmail;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;

/**
 * PostLoadEventTest
 *
 * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
 */
class PostLoadEventTest extends \Doctrine\Tests\OrmFunctionalTestCase
{
    /**
     * @var integer
     */
    private $userId;

    /**
     * {@inheritdoc}
     */
    protected function setUp()
    {
        $this->useModelSet('cms');

        parent::setUp();

        $this->loadFixture();
    }

    public function testLoadedEntityUsingFindShouldTriggerEvent()
    {
        $mockListener = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        // CmsUser and CmsAddres, because it's a ToOne inverse side on CmsUser
        $mockListener
            ->expects($this->exactly(2))
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager = $this->_em->getEventManager();

        $eventManager->addEventListener(array(Events::postLoad), $mockListener);

        $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
    }

    public function testLoadedEntityUsingQueryShouldTriggerEvent()
    {
        $mockListener = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        // CmsUser and CmsAddres, because it's a ToOne inverse side on CmsUser
        $mockListener
            ->expects($this->exactly(2))
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager = $this->_em->getEventManager();

        $eventManager->addEventListener(array(Events::postLoad), $mockListener);

        $query = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id');

        $query->setParameter('id', $this->userId);
        $query->getResult();
    }

    public function testLoadedAssociationToOneShouldTriggerEvent()
    {
        $mockListener = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        // CmsUser (root), CmsAddress (ToOne inverse side), CmsEmail (joined association)
        $mockListener
            ->expects($this->exactly(3))
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager = $this->_em->getEventManager();

        $eventManager->addEventListener(array(Events::postLoad), $mockListener);

        $query = $this->_em->createQuery('SELECT u, e FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.email e WHERE u.id = :id');

        $query->setParameter('id', $this->userId);
        $query->getResult();
    }

    public function testLoadedAssociationToManyShouldTriggerEvent()
    {
        $mockListener = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        // CmsUser (root), CmsAddress (ToOne inverse side), 2 CmsPhonenumber (joined association)
        $mockListener
            ->expects($this->exactly(4))
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager = $this->_em->getEventManager();

        $eventManager->addEventListener(array(Events::postLoad), $mockListener);

        $query = $this->_em->createQuery('SELECT u, p FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.phonenumbers p WHERE u.id = :id');

        $query->setParameter('id', $this->userId);
        $query->getResult();
    }

    public function testLoadedProxyEntityShouldTriggerEvent()
    {
        $eventManager = $this->_em->getEventManager();

        // Should not be invoked during getReference call
        $mockListener = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        $mockListener
            ->expects($this->never())
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager->addEventListener(array(Events::postLoad), $mockListener);

        $userProxy = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);

        // Now deactivate original listener and attach new one
        $eventManager->removeEventListener(array(Events::postLoad), $mockListener);

        $mockListener2 = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        $mockListener2
            ->expects($this->exactly(2))
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager->addEventListener(array(Events::postLoad), $mockListener2);

        $userProxy->getName();
    }

    public function testLoadedProxyPartialShouldTriggerEvent()
    {
        $eventManager = $this->_em->getEventManager();

        // Should not be invoked during getReference call
        $mockListener = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        // CmsUser (partially loaded), CmsAddress (inverse ToOne), 2 CmsPhonenumber
        $mockListener
            ->expects($this->exactly(4))
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager->addEventListener(array(Events::postLoad), $mockListener);

        $query = $this->_em->createQuery('SELECT PARTIAL u.{id, name}, p FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.phonenumbers p WHERE u.id = :id');

        $query->setParameter('id', $this->userId);
        $query->getResult();
    }

    public function testLoadedProxyAssociationToOneShouldTriggerEvent()
    {
        $user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);

        $mockListener = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        // CmsEmail (proxy)
        $mockListener
            ->expects($this->exactly(1))
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager = $this->_em->getEventManager();

        $eventManager->addEventListener(array(Events::postLoad), $mockListener);

        $emailProxy = $user->getEmail();

        $emailProxy->getEmail();
    }

    public function testLoadedProxyAssociationToManyShouldTriggerEvent()
    {
        $user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);

        $mockListener = $this->getMock('Doctrine\Tests\ORM\Functional\PostLoadListener');

        // 2 CmsPhonenumber (proxy)
        $mockListener
            ->expects($this->exactly(2))
            ->method('postLoad')
            ->will($this->returnValue(true));

        $eventManager = $this->_em->getEventManager();

        $eventManager->addEventListener(array(Events::postLoad), $mockListener);

        $phonenumbersCol = $user->getPhonenumbers();

        $phonenumbersCol->first();
    }

    private function loadFixture()
    {
        $user = new CmsUser;
        $user->name = 'Roman';
        $user->username = 'romanb';
        $user->status = 'developer';

        $address = new CmsAddress;
        $address->country = 'Germany';
        $address->city = 'Berlin';
        $address->zip = '12345';

        $user->setAddress($address);

        $email = new CmsEmail;
        $email->setEmail('roman@domain.com');

        $user->setEmail($email);

        $ph1 = new CmsPhonenumber;
        $ph1->phonenumber = "0301234";

        $ph2 = new CmsPhonenumber;
        $ph2->phonenumber = "987654321";

        $user->addPhonenumber($ph1);
        $user->addPhonenumber($ph2);

        $this->_em->persist($user);
        $this->_em->flush();

        $this->userId = $user->getId();

        $this->_em->clear();
    }
}

class PostLoadListener
{
    public function postLoad(LifecycleEventArgs $event)
    {
        // Expected to be mocked out
        echo 'Should never be called!';
    }
}


text:
package com.github.games647.lagmonitor.util;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class JavaVersionTest {

    @Test
    public void detectDeveloperVersion() {
        assertNotNull(JavaVersion.detect());
    }

    @Test
    public void parseJava8() {
        JavaVersion version = new JavaVersion("1.8.0_161");
        assertEquals(8, version.getMajor());
        assertEquals(8, version.getMinor());
        assertEquals(1, version.getSecurity());
        assertTrue(version.isOutdated());
    }

    @Test
    public void parseJava9() {
        JavaVersion version = new JavaVersion("9.0.4");
        assertEquals(9, version.getMajor());
        assertEquals(0, version.getMinor());
        assertEquals(4, version.getSecurity());
        assertTrue(version.isOutdated());
    }

    @Test
    public void parseJava9EarlyAccess() {
        JavaVersion version = new JavaVersion("9-ea");
        assertEquals(9, version.getMajor());
        assertEquals(0, version.getMinor());
        assertEquals(0, version.getSecurity());
        assertTrue(version.isPreRelease());
        assertTrue(version.isOutdated());
    }

    @Test
    public void parseJava9WithVendorSuffix() {
        JavaVersion version = new JavaVersion("9-Ubuntu");
        assertEquals(9, version.getMajor());
        assertEquals(0, version.getMinor());
        assertEquals(0, version.getSecurity());
        assertTrue(version.isOutdated());
    }

    @Test
    public void parseJava14() {
        JavaVersion version = new JavaVersion("14.0.1");
        assertEquals(14, version.getMajor());
        assertEquals(0, version.getMinor());
        assertEquals(1, version.getSecurity());
        assertFalse(version.isOutdated());
    }

    @Test
    public void parseJava10Internal() {
        JavaVersion version = new JavaVersion("10-internal");
        assertEquals(10, version.getMajor());
        assertEquals(0, version.getMinor());
        assertEquals(0, version.getSecurity());
        assertTrue(version.isPreRelease());
        assertTrue(version.isOutdated());
    }

    @Test
    public void comparePreRelease() {
        JavaVersion lower = new JavaVersion("10-internal");
        JavaVersion higher = new JavaVersion("10");
        assertEquals(-1, lower.compareTo(higher));
    }

    @Test
    public void compareMinor() {
        JavaVersion lower = new JavaVersion("9.0.3");
        JavaVersion higher = new JavaVersion("9.0.4");
        assertEquals(1, higher.compareTo(lower));
    }

    @Test
    public void compareMajor() {
        JavaVersion lower = new JavaVersion("1.8.0_161");
        JavaVersion higher = new JavaVersion("10");
        assertEquals(1, higher.compareTo(lower));
    }

    @Test
    public void compareEqual() {
        JavaVersion lower = new JavaVersion("10-Ubuntu");
        JavaVersion higher = new JavaVersion("10");
        assertEquals(0, lower.compareTo(higher));
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace rest_training.Data
{
    public class Customer
    {
        public string Name { get; set; }
        public string Address { get; set; }

        public List<string> Contacts { get; set; } = new List<string>();
    }

}


text:
module.exports = {
	plugins: [
		require('postcss-import'),
		require('postcss-url'),
		require('postcss-cssnext'),
		require('postcss-browser-reporter'),
		require('postcss-reporter')
	]
};


text:
import Component from 'vue-class-component';

import toast from '../../../mixins/toast';

import mdButton from '../../../components/button';

@Component({
    components: {
        mdButton
    },
    mixins: [
        toast
    ],
    template: require('./toasts.html')
})
export default class Toasts {
    private toast: any;

    makeAToast(msg) {
        this.toast(msg, 4000, '', () => {
            alert('Your toast was dismissed');
        })
    }
}


text:
Drupal
======

Drupal docker image without a DB included in the image. This image is designed to be used with drupalwxt/mysql or similar stand-alone DB image in order to create a multi-container cluster.

On docker run, browse to Port 80 on the container to complete initial setup.
Example usage:

`$ docker run --rm --name DRUPAL --link DB:DB drupalwxt/drupalwxt:latest`

...where `DB:DB` matches the name and alias of your DB instance. Use the values from your linked DB image to complete GUI setup.


text:
from migrate import ForeignKeyConstraint
from sqlalchemy import Boolean, Column, DateTime
from sqlalchemy import MetaData, Integer, String, Table, ForeignKey

from cinder.i18n import _LE
from cinder.openstack.common import log as logging

LOG = logging.getLogger(__name__)

def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # New table
    quota_classes = Table('quota_classes', meta,
                          Column('created_at', DateTime(timezone=False)),
                          Column('updated_at', DateTime(timezone=False)),
                          Column('deleted_at', DateTime(timezone=False)),
                          Column('deleted', Boolean(create_constraint=True,
                                                    name=None)),
                          Column('id', Integer(), primary_key=True),
                          Column('class_name',
                                 String(length=255),
                                 index=True),
                          Column('resource',
                                 String(length=255)),
                          Column('hard_limit', Integer(), nullable=True),
                          mysql_engine='InnoDB',
                          mysql_charset='utf8',
                          )

    try:
        quota_classes.create()
    except Exception:
        LOG.error(_LE("Table |%s| not created!"), repr(quota_classes))
        raise

    quota_usages = Table('quota_usages', meta,
                         Column('created_at', DateTime(timezone=False)),
                         Column('updated_at', DateTime(timezone=False)),
                         Column('deleted_at', DateTime(timezone=False)),
                         Column('deleted', Boolean(create_constraint=True,
                                                   name=None)),
                         Column('id', Integer(), primary_key=True),
                         Column('project_id',
                                String(length=255),
                                index=True),
                         Column('resource',
                                String(length=255)),
                         Column('in_use', Integer(), nullable=False),
                         Column('reserved', Integer(), nullable=False),
                         Column('until_refresh', Integer(), nullable=True),
                         mysql_engine='InnoDB',
                         mysql_charset='utf8',
                         )

    try:
        quota_usages.create()
    except Exception:
        LOG.error(_LE("Table |%s| not created!"), repr(quota_usages))
        raise

    reservations = Table('reservations', meta,
                         Column('created_at', DateTime(timezone=False)),
                         Column('updated_at', DateTime(timezone=False)),
                         Column('deleted_at', DateTime(timezone=False)),
                         Column('deleted', Boolean(create_constraint=True,
                                                   name=None)),
                         Column('id', Integer(), primary_key=True),
                         Column('uuid',
                                String(length=36),
                                nullable=False),
                         Column('usage_id',
                                Integer(),
                                ForeignKey('quota_usages.id'),
                                nullable=False),
                         Column('project_id',
                                String(length=255),
                                index=True),
                         Column('resource',
                                String(length=255)),
                         Column('delta', Integer(), nullable=False),
                         Column('expire', DateTime(timezone=False)),
                         mysql_engine='InnoDB',
                         mysql_charset='utf8',
                         )

    try:
        reservations.create()
    except Exception:
        LOG.error(_LE("Table |%s| not created!"), repr(reservations))
        raise

def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    fk_name = None

    if migrate_engine.name == 'mysql':
        fk_name = 'reservations_ibfk_1'
    elif migrate_engine.name == 'postgresql':
        fk_name = 'reservations_usage_id_fkey'

    # NOTE: MySQL and PostgreSQL Cannot drop the quota_usages table
    # until the foreign key is removed.  We remove the foreign key first,
    # and then we drop the table.
    table = Table('reservations', meta, autoload=True)
    ref_table = Table('reservations', meta, autoload=True)
    params = {'columns': [table.c['usage_id']],
              'refcolumns': [ref_table.c['id']],
              'name': fk_name}

    if fk_name:
        try:
            fkey = ForeignKeyConstraint(**params)
            fkey.drop()
        except Exception:
            msg = _LE("Dropping foreign key %s failed.")
            LOG.error(msg, fk_name)

    quota_classes = Table('quota_classes', meta, autoload=True)
    try:
        quota_classes.drop()
    except Exception:
        LOG.error(_LE("quota_classes table not dropped"))
        raise

    quota_usages = Table('quota_usages', meta, autoload=True)
    try:
        quota_usages.drop()
    except Exception:
        LOG.error(_LE("quota_usages table not dropped"))
        raise

    reservations = Table('reservations', meta, autoload=True)
    try:
        reservations.drop()
    except Exception:
        LOG.error(_LE("reservations table not dropped"))
        raise


text:
<?php

namespace gossi\trixionary\model\Base;

use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use gossi\trixionary\model\SkillPart as ChildSkillPart;
use gossi\trixionary\model\SkillPartQuery as ChildSkillPartQuery;
use gossi\trixionary\model\Map\SkillPartTableMap;

/**
 * Base class that represents a query for the 'kk_trixionary_skill_part' table.
 *
 *
 *
 * @method     ChildSkillPartQuery orderByPartId($order = Criteria::ASC) Order by the part_id column
 * @method     ChildSkillPartQuery orderByCompositeId($order = Criteria::ASC) Order by the composite_id column
 *
 * @method     ChildSkillPartQuery groupByPartId() Group by the part_id column
 * @method     ChildSkillPartQuery groupByCompositeId() Group by the composite_id column
 *
 * @method     ChildSkillPartQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method     ChildSkillPartQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method     ChildSkillPartQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method     ChildSkillPartQuery leftJoinSkillRelatedByPartId($relationAlias = null) Adds a LEFT JOIN clause to the query using the SkillRelatedByPartId relation
 * @method     ChildSkillPartQuery rightJoinSkillRelatedByPartId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SkillRelatedByPartId relation
 * @method     ChildSkillPartQuery innerJoinSkillRelatedByPartId($relationAlias = null) Adds a INNER JOIN clause to the query using the SkillRelatedByPartId relation
 *
 * @method     ChildSkillPartQuery leftJoinSkillRelatedByCompositeId($relationAlias = null) Adds a LEFT JOIN clause to the query using the SkillRelatedByCompositeId relation
 * @method     ChildSkillPartQuery rightJoinSkillRelatedByCompositeId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SkillRelatedByCompositeId relation
 * @method     ChildSkillPartQuery innerJoinSkillRelatedByCompositeId($relationAlias = null) Adds a INNER JOIN clause to the query using the SkillRelatedByCompositeId relation
 *
 * @method     \gossi\trixionary\model\SkillQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria
 *
 * @method     ChildSkillPart findOne(ConnectionInterface $con = null) Return the first ChildSkillPart matching the query
 * @method     ChildSkillPart findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSkillPart matching the query, or a new ChildSkillPart object populated from the query conditions when no match is found
 *
 * @method     ChildSkillPart findOneByPartId(int $part_id) Return the first ChildSkillPart filtered by the part_id column
 * @method     ChildSkillPart findOneByCompositeId(int $composite_id) Return the first ChildSkillPart filtered by the composite_id column *

 * @method     ChildSkillPart requirePk($key, ConnectionInterface $con = null) Return the ChildSkillPart by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
 * @method     ChildSkillPart requireOne(ConnectionInterface $con = null) Return the first ChildSkillPart matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
 *
 * @method     ChildSkillPart requireOneByPartId(int $part_id) Return the first ChildSkillPart filtered by the part_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
 * @method     ChildSkillPart requireOneByCompositeId(int $composite_id) Return the first ChildSkillPart filtered by the composite_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
 *
 * @method     ChildSkillPart[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildSkillPart objects based on current ModelCriteria
 * @method     ChildSkillPart[]|ObjectCollection findByPartId(int $part_id) Return ChildSkillPart objects filtered by the part_id column
 * @method     ChildSkillPart[]|ObjectCollection findByCompositeId(int $composite_id) Return ChildSkillPart objects filtered by the composite_id column
 * @method     ChildSkillPart[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit
 *
 */
abstract class SkillPartQuery extends ModelCriteria
{
    protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';

    /**
     * Initializes internal state of \gossi\trixionary\model\Base\SkillPartQuery object.
     *
     * @param     string $dbName The database name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'keeko', $modelName = '\\gossi\\trixionary\\model\\SkillPart', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new ChildSkillPartQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param     Criteria $criteria Optional Criteria to build the query from
     *
     * @return ChildSkillPartQuery
     */
    public static function create($modelAlias = null, Criteria $criteria = null)
    {
        if ($criteria instanceof ChildSkillPartQuery) {
            return $criteria;
        }
        $query = new ChildSkillPartQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     *
     * $obj = $c->findPk(array(12, 34), $con);
     *
     *
     * @param array[$part_id, $composite_id] $key Primary key to use for the query
     * @param ConnectionInterface $con an optional connection object
     *
     * @return ChildSkillPart|array|mixed the result, formatted by the current formatter
     */
    public function findPk($key, ConnectionInterface $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = SkillPartTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
            // the object is already in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getServiceContainer()->getReadConnection(SkillPartTableMap::DATABASE_NAME);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     ConnectionInterface $con A connection object
     *
     * @throws \Propel\Runtime\Exception\PropelException
     *
     * @return ChildSkillPart A model object, or null if the key is not found
     */
    protected function findPkSimple($key, ConnectionInterface $con)
    {
        $sql = 'SELECT `part_id`, `composite_id` FROM `kk_trixionary_skill_part` WHERE `part_id` = :p0 AND `composite_id` = :p1';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
            $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
            /** @var ChildSkillPart $obj */
            $obj = new ChildSkillPart();
            $obj->hydrate($row);
            SkillPartTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     ConnectionInterface $con A connection object
     *
     * @return ChildSkillPart|array|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, ConnectionInterface $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $dataFetcher = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
    }

    /**
     * Find objects by primary key
     *
     * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
     *
     * @param     array $keys Primary keys to use for the query
     * @param     ConnectionInterface $con an optional connection object
     *
     * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, ConnectionInterface $con = null)
    {
        if (null === $con) {
            $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $dataFetcher = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return $this|ChildSkillPartQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {
        $this->addUsingAlias(SkillPartTableMap::COL_PART_ID, $key[0], Criteria::EQUAL);
        $this->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $key[1], Criteria::EQUAL);

        return $this;
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return $this|ChildSkillPartQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {
        if (empty($keys)) {
            return $this->add(null, '1<>1', Criteria::CUSTOM);
        }
        foreach ($keys as $key) {
            $cton0 = $this->getNewCriterion(SkillPartTableMap::COL_PART_ID, $key[0], Criteria::EQUAL);
            $cton1 = $this->getNewCriterion(SkillPartTableMap::COL_COMPOSITE_ID, $key[1], Criteria::EQUAL);
            $cton0->addAnd($cton1);
            $this->addOr($cton0);
        }

        return $this;
    }

    /**
     * Filter the query on the part_id column
     *
     * Example usage:
     *
     * $query->filterByPartId(1234); // WHERE part_id = 1234
     * $query->filterByPartId(array(12, 34)); // WHERE part_id IN (12, 34)
     * $query->filterByPartId(array('min' => 12)); // WHERE part_id > 12
     *
     *
     * @see       filterBySkillRelatedByPartId()
     *
     * @param     mixed $partId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return $this|ChildSkillPartQuery The current query, for fluid interface
     */
    public function filterByPartId($partId = null, $comparison = null)
    {
        if (is_array($partId)) {
            $useMinMax = false;
            if (isset($partId['min'])) {
                $this->addUsingAlias(SkillPartTableMap::COL_PART_ID, $partId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($partId['max'])) {
                $this->addUsingAlias(SkillPartTableMap::COL_PART_ID, $partId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(SkillPartTableMap::COL_PART_ID, $partId, $comparison);
    }

    /**
     * Filter the query on the composite_id column
     *
     * Example usage:
     *
     * $query->filterByCompositeId(1234); // WHERE composite_id = 1234
     * $query->filterByCompositeId(array(12, 34)); // WHERE composite_id IN (12, 34)
     * $query->filterByCompositeId(array('min' => 12)); // WHERE composite_id > 12
     *
     *
     * @see       filterBySkillRelatedByCompositeId()
     *
     * @param     mixed $compositeId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return $this|ChildSkillPartQuery The current query, for fluid interface
     */
    public function filterByCompositeId($compositeId = null, $comparison = null)
    {
        if (is_array($compositeId)) {
            $useMinMax = false;
            if (isset($compositeId['min'])) {
                $this->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $compositeId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($compositeId['max'])) {
                $this->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $compositeId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $compositeId, $comparison);
    }

    /**
     * Filter the query by a related \gossi\trixionary\model\Skill object
     *
     * @param \gossi\trixionary\model\Skill|ObjectCollection $skill The related object(s) to use as filter
     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @throws \Propel\Runtime\Exception\PropelException
     *
     * @return ChildSkillPartQuery The current query, for fluid interface
     */
    public function filterBySkillRelatedByPartId($skill, $comparison = null)
    {
        if ($skill instanceof \gossi\trixionary\model\Skill) {
            return $this
                ->addUsingAlias(SkillPartTableMap::COL_PART_ID, $skill->getId(), $comparison);
        } elseif ($skill instanceof ObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(SkillPartTableMap::COL_PART_ID, $skill->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterBySkillRelatedByPartId() only accepts arguments of type \gossi\trixionary\model\Skill or Collection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the SkillRelatedByPartId relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return $this|ChildSkillPartQuery The current query, for fluid interface
     */
    public function joinSkillRelatedByPartId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('SkillRelatedByPartId');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'SkillRelatedByPartId');
        }

        return $this;
    }

    /**
     * Use the SkillRelatedByPartId relation Skill object
     *
     * @see useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return \gossi\trixionary\model\SkillQuery A secondary query class using the current class as primary query
     */
    public function useSkillRelatedByPartIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinSkillRelatedByPartId($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'SkillRelatedByPartId', '\gossi\trixionary\model\SkillQuery');
    }

    /**
     * Filter the query by a related \gossi\trixionary\model\Skill object
     *
     * @param \gossi\trixionary\model\Skill|ObjectCollection $skill The related object(s) to use as filter
     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @throws \Propel\Runtime\Exception\PropelException
     *
     * @return ChildSkillPartQuery The current query, for fluid interface
     */
    public function filterBySkillRelatedByCompositeId($skill, $comparison = null)
    {
        if ($skill instanceof \gossi\trixionary\model\Skill) {
            return $this
                ->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $skill->getId(), $comparison);
        } elseif ($skill instanceof ObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $skill->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterBySkillRelatedByCompositeId() only accepts arguments of type \gossi\trixionary\model\Skill or Collection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the SkillRelatedByCompositeId relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return $this|ChildSkillPartQuery The current query, for fluid interface
     */
    public function joinSkillRelatedByCompositeId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('SkillRelatedByCompositeId');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'SkillRelatedByCompositeId');
        }

        return $this;
    }

    /**
     * Use the SkillRelatedByCompositeId relation Skill object
     *
     * @see useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return \gossi\trixionary\model\SkillQuery A secondary query class using the current class as primary query
     */
    public function useSkillRelatedByCompositeIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinSkillRelatedByCompositeId($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'SkillRelatedByCompositeId', '\gossi\trixionary\model\SkillQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   ChildSkillPart $skillPart Object to remove from the list of results
     *
     * @return $this|ChildSkillPartQuery The current query, for fluid interface
     */
    public function prune($skillPart = null)
    {
        if ($skillPart) {
            $this->addCond('pruneCond0', $this->getAliasedColName(SkillPartTableMap::COL_PART_ID), $skillPart->getPartId(), Criteria::NOT_EQUAL);
            $this->addCond('pruneCond1', $this->getAliasedColName(SkillPartTableMap::COL_COMPOSITE_ID), $skillPart->getCompositeId(), Criteria::NOT_EQUAL);
            $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
        }

        return $this;
    }

    /**
     * Deletes all rows from the kk_trixionary_skill_part table.
     *
     * @param ConnectionInterface $con the connection to use
     * @return int The number of affected rows (if supported by underlying database driver).
     */
    public function doDeleteAll(ConnectionInterface $con = null)
    {
        if (null === $con) {
            $con = Propel::getServiceContainer()->getWriteConnection(SkillPartTableMap::DATABASE_NAME);
        }

        // use transaction because $criteria could contain info
        // for more than one table or we could emulating ON DELETE CASCADE, etc.
        return $con->transaction(function () use ($con) {
            $affectedRows = 0; // initialize var to track total num of affected rows
            $affectedRows += parent::doDeleteAll($con);
            // Because this db requires some delete cascade/set null emulation, we have to
            // clear the cached instance *after* the emulation has happened (since
            // instances get re-added by the select statement contained therein).
            SkillPartTableMap::clearInstancePool();
            SkillPartTableMap::clearRelatedInstancePool();

            return $affectedRows;
        });
    }

    /**
     * Performs a DELETE on the database based on the current ModelCriteria
     *
     * @param ConnectionInterface $con the connection to use
     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
     *                         if supported by native driver or if emulated using Propel.
     * @throws PropelException Any exceptions caught during processing will be
     *                         rethrown wrapped into a PropelException.
     */
    public function delete(ConnectionInterface $con = null)
    {
        if (null === $con) {
            $con = Propel::getServiceContainer()->getWriteConnection(SkillPartTableMap::DATABASE_NAME);
        }

        $criteria = $this;

        // Set the correct dbName
        $criteria->setDbName(SkillPartTableMap::DATABASE_NAME);

        // use transaction because $criteria could contain info
        // for more than one table or we could emulating ON DELETE CASCADE, etc.
        return $con->transaction(function () use ($con, $criteria) {
            $affectedRows = 0; // initialize var to track total num of affected rows

            SkillPartTableMap::removeInstanceFromPool($criteria);

            $affectedRows += ModelCriteria::delete($con);
            SkillPartTableMap::clearRelatedInstancePool();

            return $affectedRows;
        });
    }

} // SkillPartQuery


text:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$ui = UserInfo::getByID($u->uID);
?>

<script type="text/javascript">
var thisbID=parseInt(<?php echo empty($_REQUEST['bID']) ? 0 : intval($_REQUEST['bID'])?>);
var thisbtID=parseInt(<?php echo $bt->getBlockTypeID()?>);
</script>

<?php $this->inc('form_setup_html.php'); ?>


text:
package org.apache.beam.sdk.io.snowflake.test;

import com.google.api.gax.paging.Page;
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;
import java.util.zip.GZIPInputStream;
import javax.sql.DataSource;
import org.apache.beam.sdk.io.common.IOTestPipelineOptions;
import org.apache.beam.sdk.io.common.TestRow;
import org.apache.beam.sdk.io.snowflake.SnowflakeIO;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.values.KV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({
  "rawtypes", // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class TestUtils {

  private static final Logger LOG = LoggerFactory.getLogger(TestUtils.class);

  private static final String VALID_PRIVATE_KEY_FILE_NAME = "valid_test_rsa_key.p8";
  private static final String INVALID_PRIVATE_KEY_FILE_NAME = "invalid_test_rsa_key.p8";
  private static final String PRIVATE_KEY_PASSPHRASE = "snowflake";

  public interface SnowflakeIOITPipelineOptions
      extends IOTestPipelineOptions, TestSnowflakePipelineOptions {}

  public static ResultSet runConnectionWithStatement(DataSource dataSource, String query)
      throws SQLException {

    Connection connection = dataSource.getConnection();
    return runStatement(query, connection);
  }

  public static ResultSet runStatement(String query, Connection connection) throws SQLException {
    PreparedStatement statement = connection.prepareStatement(query);
    try {
      return statement.executeQuery();
    } finally {
      statement.close();
      connection.close();
    }
  }

  public static void removeTempDir(String dir) {
    Path path = Paths.get(dir);
    try (Stream<Path> stream = Files.walk(path)) {
      stream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
    } catch (IOException e) {
      LOG.info("Not able to remove files");
    }
  }

  public static boolean areListsEqual(List<?> expected, List<?> actual) {
    return expected.size() == actual.size()
        && expected.containsAll(actual)
        && actual.containsAll(expected);
  }

  public static String toSnowflakeRow(String[] strings) {
    int iMax = strings.length - 1;
    StringBuilder b = new StringBuilder();
    for (int i = 0; ; i++) {
      if (strings[i] != null) {
        b.append(String.format("'%s'", strings[i]));
      }
      if (i == iMax) {
        return b.toString();
      }
      b.append(",");
    }
  }

  public static SnowflakeIO.UserDataMapper<Long> getCsvMapper() {
    return (SnowflakeIO.UserDataMapper<Long>) recordLine -> new String[] {recordLine.toString()};
  }

  public static SnowflakeIO.UserDataMapper<KV<String, Long>> getLongCsvMapperKV() {
    return (SnowflakeIO.UserDataMapper<KV<String, Long>>)
        recordLine -> new Long[] {recordLine.getValue()};
  }

  public static SnowflakeIO.UserDataMapper<Long> getLongCsvMapper() {
    return (SnowflakeIO.UserDataMapper<Long>) recordLine -> new Long[] {recordLine};
  }

  public static SnowflakeIO.CsvMapper<TestRow> getTestRowCsvMapper() {
    return (SnowflakeIO.CsvMapper<TestRow>)
        parts -> TestRow.create(Integer.valueOf(parts[0]), parts[1]);
  }

  public static SnowflakeIO.UserDataMapper<TestRow> getTestRowDataMapper() {
    return (SnowflakeIO.UserDataMapper<TestRow>)
        (TestRow element) -> new Object[] {element.id(), element.name()};
  }

  public static SnowflakeIO.UserDataMapper<String[]> getLStringCsvMapper() {
    return (SnowflakeIO.UserDataMapper<String[]>) recordLine -> recordLine;
  }

  public static SnowflakeIO.UserDataMapper<String> getStringCsvMapper() {
    return (SnowflakeIO.UserDataMapper<String>) recordLine -> new String[] {recordLine};
  }

  public static class ParseToKv extends DoFn<Long, KV<String, Long>> {
    @ProcessElement
    public void processElement(ProcessContext c) {
      KV stringIntKV = KV.of(c.element().toString(), c.element().longValue());
      c.output(stringIntKV);
    }
  }

  public static List<String> readGZIPFile(String file) {
    List<String> lines = new ArrayList<>();
    try {
      GZIPInputStream gzip = new GZIPInputStream(new FileInputStream(file));
      BufferedReader br = new BufferedReader(new InputStreamReader(gzip, StandardCharsets.UTF_8));

      String line;
      while ((line = br.readLine()) != null) {
        lines.add(line);
      }
    } catch (IOException e) {
      throw new RuntimeException("Failed to read file", e);
    }

    return lines;
  }

  public static String getInvalidPrivateKeyPath(Class c) {
    return getPrivateKeyPath(c, INVALID_PRIVATE_KEY_FILE_NAME);
  }

  public static String getValidPrivateKeyPath(Class c) {
    return getPrivateKeyPath(c, VALID_PRIVATE_KEY_FILE_NAME);
  }

  public static String getRawValidPrivateKey(Class c) throws IOException {
    byte[] keyBytes = Files.readAllBytes(Paths.get(getValidPrivateKeyPath(c)));
    return new String(keyBytes, StandardCharsets.UTF_8);
  }

  public static String getPrivateKeyPassphrase() {
    return PRIVATE_KEY_PASSPHRASE;
  }

  private static String getPrivateKeyPath(Class c, String path) {
    ClassLoader classLoader = c.getClassLoader();
    File file = new File(classLoader.getResource(path).getFile());
    return file.getAbsolutePath();
  }

  public static void clearStagingBucket(String stagingBucketName, String directory) {
    Storage storage = StorageOptions.getDefaultInstance().getService();
    Page<Blob> blobs;
    if (directory != null) {
      blobs = storage.list(stagingBucketName, Storage.BlobListOption.prefix(directory));
    } else {
      blobs = storage.list(stagingBucketName);
    }

    for (Blob blob : blobs.iterateAll()) {
      storage.delete(blob.getBlobId());
    }
  }
}


text: Adesahi tsuo ɔ, a bɔ mɛ nɛ nɔ fɛɛ nɔ e ye e he, nɛ nɔ tsuaa nɔsɔ ngɛ odehe si himi kɛ he blɔhi a blɔ fa mi. A bɔ mɛ kɛ nɔ́ se kɔmi kɛ he nule juɛmi, nɛ e hia kaa nɔ fɛɛ nɔ nɛ e na nyɛmi suɔmi kɛ ha nɔ tsuaa nɔ.