text:
<?php namespace Illuminate\Contracts\Redis;

interface Database {

	/**
	 * Run a command against the Redis database.
	 *
	 * @param  string  $method
	 * @param  array   $parameters
	 * @return mixed
	 */
	public function command($method, array $parameters = array());

}

redpajama_set_name: RedPajamaGithub


text:
package com.noveogroup.clap.service.user;

import com.google.common.collect.Lists;
import com.noveogroup.clap.auth.PasswordsHashCalculator;
import com.noveogroup.clap.config.ConfigBean;
import com.noveogroup.clap.converter.UserConverter;
import com.noveogroup.clap.dao.UserDAO;
import com.noveogroup.clap.entity.user.UserEntity;
import com.noveogroup.clap.exception.ClapAuthenticationFailedException;
import com.noveogroup.clap.exception.ClapTokenExpirationException;
import com.noveogroup.clap.exception.ClapUserNotFoundException;
import com.noveogroup.clap.exception.WrapException;
import com.noveogroup.clap.model.auth.ApkAuthentication;
import com.noveogroup.clap.model.auth.Authentication;
import com.noveogroup.clap.model.user.Role;
import com.noveogroup.clap.model.user.User;
import com.noveogroup.clap.model.user.UserCreationModel;
import com.noveogroup.clap.model.user.UserWithPersistedAuth;
import com.noveogroup.clap.service.revision.RevisionService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.inject.Inject;
import javax.inject.Provider;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * @author Andrey Sokolov
 */
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class UserServiceImpl implements UserService {

    private static final Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);

    private UserConverter converter = new UserConverter();

    @EJB
    private UserDAO userDAO;

    @Inject
    private ConfigBean configBean;

    @Inject
    private Provider<RevisionService> revisionServiceProvider;

    @Override
    public UserWithPersistedAuth getUserWithToken() {
        final String currentUserLogin = getCurrentUserLogin();
        final UserEntity userEntity = userDAO.getUserByLogin(currentUserLogin);
        if (userEntity != null) {
            return converter.mapWithPersistedAuth(userEntity, configBean);
        } else {
            throw new ClapUserNotFoundException("requested login == " + currentUserLogin);
        }
    }

    @RequiresAuthentication
    @Override
    public User getUser() {
        return getUser(false);
    }

    @RequiresAuthentication
    @Override
    public User getUser(boolean autocreate) {
        return getUser(getCurrentUserLogin(), autocreate);
    }

    @RequiresAuthentication
    @Override
    public User getUser(final String login) {
        return getUser(login, false);
    }

    @RequiresAuthentication
    @Override
    public User getUser(final String login, final boolean autocreate) {
        final UserEntity userEntity = userDAO.getUserByLogin(login);
        if (userEntity != null) {
            final User user = converter.map(userEntity, configBean);
            return user;
        } else if (autocreate) {
            final UserCreationModel userCreationModel = new UserCreationModel();
            userCreationModel.setLogin(login);
            return createUser(userCreationModel);
        } else {
            return null;
        }
    }

    @RequiresAuthentication
    @WrapException
    @Override
    public User saveUser(final User user) {
        final UserEntity userEntity = getUserByLogin(user);
        userEntity.setFullName(user.getFullName());
        //TODO when we will have more info
        return persistFlushAndReturnConverted(userEntity);
    }

    @RequiresAuthentication
    @WrapException
    @Override
    public void resetUserPassword(final String newPassword) {
        resetUserPassword(getCurrentUserLogin(), newPassword);
    }

    @RequiresAuthentication
    @RequiresRoles("ADMIN")
    @Override
    public void resetUserPassword(String login, String newPassword) {
        final UserEntity userEntity = userDAO.getUserByLogin(login);
        userEntity.setHashedPassword(PasswordsHashCalculator.calculatePasswordHash(newPassword));
        updateToken(userEntity);
        userDAO.persist(userEntity);
        userDAO.flush();
    }

    @RequiresAuthentication
    @Override
    public List<User> getUsers() {
        final List<UserEntity> userEntities = userDAO.selectAll();
        final List<User> users = Lists.newArrayList();
        for (UserEntity userEntity : userEntities) {
            users.add(converter.map(userEntity, configBean));
        }
        return users;
    }

    @Override
    public String getToken(final Authentication authentication) {
        final String login = authentication.getLogin();
        final UserEntity userByLogin = userDAO.getUserByLogin(login);
        if (userByLogin != null) {
            final String password = authentication.getPassword();
            if (StringUtils.equals(userByLogin.getHashedPassword(),
                    PasswordsHashCalculator.calculatePasswordHash(password))) {
                checkTokenExpiration(userByLogin);
                userDAO.persist(userByLogin);
                return userByLogin.getToken();
            } else {
                throw new ClapAuthenticationFailedException("login or password incorrect");
            }
        } else {
            throw new ClapUserNotFoundException("user " + login + " not found");
        }
    }

    @Override
    public User getUserByToken(final String token) {
        final UserEntity userEntity = userDAO.getUserByToken(token);
        if (userEntity != null) {
            checkTokenExpiration(userEntity);
            final User user = converter.map(userEntity, configBean);
            return user;
        } else {
            throw new ClapTokenExpirationException("token " + token + " not found(expired or never exists)");
        }
    }

    private void checkTokenExpiration(final UserEntity userEntity) {
        final String token = userEntity.getToken();
        final Date now = new Date();
        if (now.after(userEntity.getTokenExpiration())) {
            updateToken(userEntity);
            throw new ClapTokenExpirationException("token " + token + " not found(expired or never exists)");
        }
    }

    @RequiresAuthentication
    @RequiresRoles("ADMIN")
    @WrapException
    @Override
    public User createUser(final UserCreationModel user) {
        user.setRole(Role.DEVELOPER);
        UserEntity userEntity = converter.map(user);
        final String password = user.getPassword();
        if (password != null) {
            userEntity.setHashedPassword(PasswordsHashCalculator.calculatePasswordHash(password));
        }
        updateToken(userEntity);
        userEntity = userDAO.persist(userEntity);
        userDAO.flush();
        return converter.map(userEntity, configBean);
    }

    private void updateToken(final UserEntity userEntity) {
        LOGGER.debug("token for " + userEntity.getLogin() + " updated");
        final String token = UUID.randomUUID().toString();
        userEntity.setToken(token);
        final long tokenExpirationTime = configBean.getTokenExpirationTime();
        final Date date = new Date();
        date.setTime(date.getTime() + tokenExpirationTime);
        userEntity.setTokenExpiration(date);
    }

    public String getCurrentUserLogin() {
        final Subject subject = SecurityUtils.getSubject();
        if (subject != null) {
            final String login = (String) subject.getPrincipals().getPrimaryPrincipal();
            return login;
        } else {
            throw new IllegalStateException("security utils not prepared");
        }
    }

    @RequiresPermissions("EDIT_PERMISSIONS")
    @RequiresAuthentication
    @WrapException
    @Override
    public User editPermissions(final User user) {
        final UserEntity userEntity = getUserByLogin(user);
        userEntity.setClapPermissions(user.getClapPermissions());
        return persistFlushAndReturnConverted(userEntity);
    }

    @RequiresPermissions("EDIT_ROLES")
    @RequiresAuthentication
    @WrapException
    @Override
    public User editRole(final User user) {
        final UserEntity userEntity = getUserByLogin(user);
        userEntity.setRole(user.getRole());
        return persistFlushAndReturnConverted(userEntity);
    }

    @Override
    public String getApkToken(final ApkAuthentication authentication) {
        final RevisionService service = revisionServiceProvider.get();
        if (service.checkRevisionVariantRandom(authentication.getVariantHash(), authentication.getRandom())) {
            final Authentication authentication1 = new Authentication();
            authentication1.setLogin("unnamed");
            authentication1.setPassword("unnamed_password");
            return getToken(authentication1);
        } else {
            throw new ClapAuthenticationFailedException("unknown random");
        }
    }

    private UserEntity getUserByLogin(final User user) {
        return userDAO.getUserByLogin(user.getLogin());
    }

    private User persistFlushAndReturnConverted(final UserEntity userEntity) {
        final UserEntity updatedUserEnity = userDAO.persist(userEntity);
        userDAO.flush();
        final User updatedUser = converter.map(updatedUserEnity, configBean);
        return updatedUser;
    }

    public void setConverter(final UserConverter converter) {
        this.converter = converter;
    }
}


text:
/*
 *  Guard: Automatically lock/unlock a mutex or crowdmonitor.
 *
 *  Written by:
 *   Author: Steve Parker
 *   Department of Computer Science
 *   University of Utah
 *   Date: June 1997
 *
 *  Copyright (C) 1997 SCI Group
 */

#include <Core/Thread/Guard.h>
#include <Core/Thread/CrowdMonitor.h>
#include <Core/Thread/Mutex.h>

namespace Manta {

Guard::Guard(Mutex* mutex)
    : mutex_(mutex), monitor_(0)
{
  mutex_->lock();
}

Guard::Guard(CrowdMonitor* crowd_monitor, Which action)
    : mutex_(0), monitor_(crowd_monitor), action_(action)
{
    if(action_ == Read)
        monitor_->readLock();
    else
        monitor_->writeLock();
}

Guard::~Guard()
{
    if (mutex_)
        mutex_->unlock();
    else if(action_==Read)
        monitor_->readUnlock();
    else
        monitor_->writeUnlock();
}

} // End namespace Manta


text:
Installing
==========

Most users will probably want to install the latest version hosted on PyPI:

.. code-block:: console

    pip install choix

Developers might want to install the latest version from GitHub:

.. code-block:: console

    git clone https://github.com/lucasmaystre/choix.git
    cd choix
    pip install -e .

The ``-e`` flag makes it possible to edit the code without needing to reinstall
the library afterwards.

Dependencies
------------

``choix`` depends on ``numpy``, ``scipy``, and partially on ``networkx`` (only
for network-related functions). Unit tests depend on ``pytest``.


text:
use std::collections::HashMap;
use std::default::Default;
use std::sync::Arc;
use vec_map::VecMap;

/// The Material structure contains information about a material. Material structures are
/// referenced by geometry nodes through `Arc<Material>` structures belonging to `GeometryNode`
/// structures.
pub struct Material {
    /// Whether the material is two-sided.
    pub two_sided: bool,
    /// An optional name.
    pub name: Option<Name>,
    /// Any number of colors.
    pub color: HashMap<String, Color>,
    /// Any number of parameters.
    pub param: ParamMap,
    /// Any number of textures.
    pub texture: HashMap<String, Texture>,
}

/// A Color structure must contain an RGB or RGBA color value.
pub enum Color {
    /// An RGB color value.
    Rgb(f32, f32, f32),
    /// An RGBA color value.
    Rgba(f32, f32, f32, f32)
}

/// The Param structure contains just a float. While the OpenGEX specification defines a Param as a
/// key-value pair, this is better implemented through a HashMap. See ParamMap.
pub type Param = f32;

/// This is a map of different Param structures, for convenience.
pub type ParamMap = HashMap<String, Param>;
/// The Name structure holds the name of a node, morph target, material, or animation clip.
pub type Name = String;

/// The Texture structure holds information about a single texture map, and how it is accessed with
/// texture coordinates.
pub struct Texture {
    /// The index of the texture coordinate set associated with the texture.
    pub texcoord: u32,
    /// A substructure holding the file name of the texture.
    pub file_name: String,
    /// Any number of transformations that are applied to the texture coordinates of a mesh when
    /// they are used to fetch from the texture map.
    pub transformations: Vec<Transformation>,
    /// Any number of animation tracks that are applied to the texture coordinate transformations.
    pub animation: Vec<Animation>
}

/// Helper enum to contain all different kinds of Transformations.
pub enum Transformation {
    /// A Transform structure.
    Transform(Transform),
    /// A Translation structure.
    Translation(Translation),
    /// A Rotation structure.
    Rotation(Rotation),
    /// A Scale structure.
    Scale(Scale)
}

/// The Transform structure holds one or more 4 x 4 transformation matrices. In the cases that a
/// Transform structure is contained inside any type of node structure, a Texture structure, or a
/// Skin structure, it must contain a single matrix. In the case that a Transform structure is
/// contained inside a Skeleton structure, is must contain an array of matrices with one entry for
/// each bone referenced by the skeleton.
///
/// When contained inside a node structure, a Transform structure can be the target of a track
/// stored inside an Animation structure.
pub struct Transform([f32; 16]);

/// The Translation structure holds a translation transformation in one of several possible
/// variants.
///
/// There are different variants of this type of tranformation, one for each "kind".
///
/// When contained inside a node structure, a Translation structure can be the target of a track
/// stored inside an Animation structure.
pub enum Translation {
    /// The translation occurs along only the X axis.
    X(f32),
    /// The translation occurs along only the Y axis.
    Y(f32),
    /// The translation occurs along only the Z axis.
    Z(f32),
    /// The translation occurs along all three coordinate axes.
    Xyz(f32, f32, f32)
}

/// The Rotation structure represents a rotation along one of several axes.
///
/// There are different variants of this type of tranformation, one for each "kind".
///
/// When contained inside a node structure, a Rotation structure can be the target of a track
/// stored in an Animation structure.
pub enum Rotation {
    /// The rotation occurs about the X axis.
    X(f32),
    /// The rotation occurs about the Y axis.
    Y(f32),
    /// The rotation occurs about the Z axis.
    Z(f32),
    /// The rotation occurs about an arbitrary axis. The first entry of this structure is the angle
    /// of rotation. The remaining three entries are respectively the X, Y and Z components of the
    /// axis of rotation.
    Axis(f32, f32, f32, f32),
    /// The rotation is given by a quaternion. Please refer to the official OpenGEX documentation
    /// for more information.
    Quaternion(f32, f32, f32, f32)
}

/// The Scale structure represents a scale transformation in one of several possible variants.
///
/// There are different variants of this type of tranformation, one for each "kind".
///
/// When contained inside a node structure, a Scale structure can be the target of a strack stored
/// inside an Animation structure.
pub enum Scale {
    /// The scaling occurs along only the X axis.
    X(f32),
    /// The scaling occurs along only the Y axis.
    Y(f32),
    /// The scaling occurs along only the Z axis.
    Z(f32),
    /// The scaling occurs along all three coordinate axes.
    Xyz(f32, f32, f32)
}

/// The Animation structure contains animation data for a single node in a scene. Each animation
/// structure is directly contained inside a node structure or Texture structure. Each animation
/// structure contains the data needed to modify its sibling Transformation structures or sibling
/// MorphWeight structures over time.
///
/// More detailed information can be found in the official OpenGEX specification.
pub struct Animation {
    /// Specifies the animation clip index.
    pub clip: u32,
    /// Specifies when the animation begins. If the property is not specifies, the begin time for
    /// the animation is determined by the earliest time values present in the Track structures
    /// belonging to this Animation.
    pub begin: Option<f32>,
    /// Specifies when the animation ends. Like with the begin property, if the property is not
    /// specified, the end time for the animation is determined by the latest time values present
    /// in the Track structures belonging to this Animation.
    pub end: Option<f32>,
    /// One or more tracks that each hold animation keys for a single target.
    pub tracks: Vec<Track>,
}

/// The Track structure contains animation key data for a single Transformation or MorphWeight
/// structure.
pub struct Track {
    /// The target transformation or MorphWeight this track applies to.
    pub target: TrackTarget,
    /// The time curve associated with this track.
    pub time: Time,
    /// The value curve associated with this track.
    pub value: Value
}

/// Enum wrapping over all possible animation track targets.
pub enum TrackTarget {
    /// A Transformation structure. See enum to see possibilities.
    Transformation(Arc<Transformation>),
    /// A MorphWeight structure.
    MorphWeight(Arc<MorphWeight>)
}

/// The Time structure contains key time data in an animation track.
///
/// There are two different kinds of this structure; one for every curve kind.
///
/// The variants in this enum contain vectors. One vector item represents on key time.
pub enum Time {
    /// The times are interpolated linearly.
    Linear(Vec<f32>),
    /// The times are interpolated on a one-dimensional Bézier curve.
    ///
    /// The times in each tuple in the vector are the "value", "-control" and "+control" values of
    /// the Bézier curve respectively.
    Bézier(Vec<(f32, f32, f32)>)
}

/// The Value structure contains key value data in an animation track.
///
/// There are two different kinds of this structure; one for every curve kind.
///
/// The variants in this enum contain vectors. One vector item represents on key value.
pub enum Value {
    /// The values are not interpolated, but remain constant until the next key time.
    Constant(Vec<f32>),
    /// The values are interpolated linearly.
    Linear(Vec<f32>),
    /// The values are interpolated on a one-dimensional Bézier curve.
    ///
    /// The values in each tuple in the vector are the "value", "-control" and "+control" values of
    /// the Bézier curve respectively.
    Bézier(Vec<(f32, f32, f32)>),
    /// The values are interpolated on a tension-continuity-bias (TCB) spline.
    ///
    /// The values in each tuple in the vector are the "value", "tension", "bias" and "continuity"
    /// values of the TCB spline respecitvely. The data contained in these last three values are
    /// always scalar.
    Tcb(Vec<(f32, f32, f32, f32)>)
}

/// A MorphWeight structure holds a single morph weight for a GeometryNode structure, that
/// references a GeometryObject strucure containing vertex data for multiple morph targets.
///
/// A MorphWeight structure can be the target of a track stored inside an Animation structure.
pub struct MorphWeight {
    /// Specifies the morph target index to which this morph weight applies. If the GeometryObject
    /// structure contains no vertex data corresponding to this target index, then this structure
    /// should be ignored. Each MorphWeight structure belonging to any particular GeometryNode
    /// structure must have a unique target index among all morph weights belonging to that
    /// GeometryNode.
    pub target_index: u32,
    /// The weight this MorphWeight structure represents.
    pub weight: f32,
}

/// The Atten structure specifies an attenuation function for a light object.
pub struct Atten {
    /// The kind of attenuation.
    pub kind: AttenuationKind,
    /// The type of curve defining the attenuation.
    pub curve: AttenuationCurve,
    /// Any parameters associated with this Atten structure.
    ///
    /// For the meaning of the parameters, please refer to the official OpenGEX documentation.
    /// There can exist application-defined parameters.
    pub params: ParamMap
}

/// A helper enum representing different kinds of attenuation functions.
pub enum AttenuationKind {
    /// The input to the attenuation function is the radial distance from the LightObject the
    /// parent Atten structure is associated with.
    Distance,
    /// The input to the attenuation function is the angle formed between the negative z-axis and
    /// the direction to the point being illuminated in object space.
    ///
    /// The result of this function should be raised to the power value of a potential "power"
    /// paramter present in the parent Atten structure.
    Angle,
    /// The input ot the attenuation function is the cosine of the angle formed between the
    /// negative z-axis and the direction to the point being illuminated in objet space.
    ///
    /// The result of this function should be raised to the power value of a potential "power"
    /// paramter present in the parent Atten structure.
    CosAngle
}

/// A helper enum representing different kinds of curves for an attenuation function.
///
/// For exact formulas, please refer to the offical OpenGEX documentation.
pub enum AttenuationCurve {
    /// The attenuation is a linear function.
    Linear,
    /// The attenuation is given by a cubic-smooth-step function.
    Cubic,
    /// The attenuation is given by the inverse function.
    Inverse,
    /// The attenuation is given by the inverse square function.
    InverseSquare
}

/// Helper enum to represent all different types of Nodes.
pub enum Nodes {
    /// A `Node`.
    Node(Node),
    /// A `BoneNode`.
    BoneNode(BoneNode),
    /// A `GeometryNode`
    GeometryNode(GeometryNode),
    /// A `CameraNode`
    CameraNode(CameraNode),
    /// A `LightNode`
    LightNode(LightNode)
}

/// Macro to do away with the redundancy of the different kinds of Node structures. The common Node
/// properties are placed at the start of the generated structure.
///
/// The common properties are:
/// * `name`: An optional name of the node.
/// * `transformations`: A vector of local transformations to be applied to the node.
/// * `animations`: A vector of animations that can be applied to the node.
/// * `children`: A vector of child nodes part of this node.
macro_rules! node {
    (
        $(#[$attr:meta])*
        pub struct $name:ident {
            $($(#[$doc:meta])* pub $prop:ident : $type_:ty),*
        }
    ) => (
        $(#[$attr])*
        pub struct $name {
            /// The optional name for this node. This property is generic to all types of nodes.
            pub name: Option<Name>,
            /// Any local transformations to be applied to this node. This property is generic to
            /// all types of nodes.
            pub transformations: Vec<Transformation>,
            /// Any animations for this node. This property is generic to all types of nodes.
            pub animations: Vec<Animation>,
            /// Any sub-nodes of this node. This property is generic to all types of nodes.
            pub children: Vec<Nodes>,
            $($(#[$doc])* pub $prop : $type_),*
        }
    )
}

node! {
    /// A Node structure represents a single generic node in a scene, with no associated object.
    pub struct Node {}
}

node! {
    /// A BoneNode structure represents a single bone in a scene. The collection of bone nodes
    /// forming a complete skeleton for a skinned mesh is referenced by a `BoneRefArray` structure
    /// contained inside a `Skeleton` structrue.
    pub struct BoneNode {}
}

node! {
    /// A GeometryNode structure represents a single geometry node in a scene. "]
    pub struct GeometryNode {
        /// Whether this geometry is visible. Overrides the visibility of the referenced
        /// `GeometryObject` structure.
        pub visibile: Option<bool>,
        /// Whether this geometry casts shadows. If unset, this `GeometryNode` inherits the
        /// visibility of the referenced `GeometryObject` structure.
        pub casts_shadows: Option<bool>,
        /// Whether the geomery is rendered with motion blur. If unset, this `GeometryNode`
        /// inherits the visibility of the referenced `GeometryObject` structure.
        pub motion_blur: Option<bool>,
        /// A reference to a `GeometryObject` structure containing all of the required mesh data
        /// and optional skinning data.
        pub geometry: Arc<GeometryObject>,
        /// A `HashMap` with references to materials associated with this geometry. Each material's
        /// index in the HashMap specifies to which part of a mesh the material is applied, by
        /// matching it with the `material` property of each `IndexArray` structure in the mesh.
        pub materials: VecMap<Arc<Material>>,
        /// If the `GeometryObject` referenced by this node contains vertex data for multiple morph
        /// targets, then the node may contain one or more `MorphWeight` structures that specify
        /// the blending weight for each target. Each `MorphWeight` structure may be the target of
        /// a Track structure in the animation belonging to the node.
        pub morph_weights: Vec<MorphWeight>
    }
}

node! {
    /// A `CameraNode` structure represents a single camera node in a scene.
    pub struct CameraNode {
        /// A reference to a `CameraObject` that contains the information neccesary to construct
        /// the properly configured camera.
        pub camera: Arc<CameraObject>
    }
}

node! {
    /// A `LightNode` structure represents a single camera node in a scene. "]
    pub struct LightNode {
        /// Whether this light is visible. Overrides the visibility of the referenced `LightObject`
        /// structure.
        pub visibile: Option<bool>,
        /// A reference to a `LightObject` that contains the information neccesary to construct the
        /// proper type of light.
        pub light: Arc<LightObject>
    }
}

/// The `GeometryObject` structure contains data for a geometry object. Multiple `GeometryNode`
/// structures may reference a single `GeometryObject`. This allows a scene to contain multiple
/// instances of the same geometry with different transforms and materials.
///
/// The `colors` and `textures` properties are for application-specfic use.
pub struct GeometryObject {
    /// Whether this geometry is visible. Can be overriden by any `GeometryNode` structure
    /// referencing this geometry.
    pub visible: bool,
    /// Whether this geometry casts shadows. Can be overriden by any `GeometryNode` structure
    /// referencing this geometry.
    pub casts_shadows: bool,
    /// Whether this geometry is rendered with motion blur. Can be overriden by any `GeometryNode`
    /// structure referencing this geometry.
    pub motion_blur: bool,
    /// A mesh for every level of detail. The map is indexed by the level of detail.
    pub meshes: VecMap<Mesh>,
    /// May contain a `Morph` structure for each morph target for which vertex data exists inside
    /// the `Mesh` structures in `meshes`. The key of the `HashMap` is their target index.
    pub morphs: VecMap<Morph>
}

/// A `CameraObject` structure contains data for a camera object.
pub struct CameraObject {
    /// A map of parameters associated with this camera.
    ///
    /// The OpenGEX specification defined three parameters: "fov", "near" and "far". Any other
    /// parameters are application-specific.
    pub params: ParamMap,
    /// A map of colors associated with this camera. The OpenGEX specification does not define any
    /// kinds of colors.
    pub colors: HashMap<String, Color>,
    /// A map of textures associated with this camera. The OpenGEX specification does not define
    /// any kinds of textures.
    pub textures: HashMap<String, Texture>
}

/// The LightObject struture contains data for a light object. Multiple LightNode structures may
/// reference a single LightObject. This allows a scene to contain multiple instances of the same
/// light, with different transformations.
pub struct LightObject {
    /// The type of light emitted by this LightObject.
    pub light_type: LightType,
    /// Whether this LightObject casts shadows. This can be overiden by the LightNode referencing
    /// this LightObject.
    pub casts_shadows: bool,
    /// The colors associated with this LightObject.
    ///
    /// The OpenGEX specification only references one type of color: "light". This is the main
    /// color of light emitted by the light souArce. This defaults to an RGB value of
    /// (1.0, 1.0, 1.0).
    ///
    /// There can be any other number of colors in this HashMap, for application-specific kinds.
    pub colors: HashMap<String, Color>,
    /// The parameters associated with this LightObject.
    ///
    /// The OpenGEX specification only references one type of parameter: "intensity". This is the
    /// intensity of the light emitted by the light souArce. This defaults to 0.
    ///
    /// There can be any other number of parameters in this HashMap, for application-specific
    /// kinds.
    pub params: ParamMap,
    /// The textures associated with this LightObject.
    ///
    /// The OpenGEX specification only references one type of texture: "projection". This is an
    /// optional texture projection of this LightObject. The texture map should be oriented so that
    /// the right direction is aligned to the object-space positive x-axis, and the up direction is
    /// aligned to the object-space positive y-axis.
    ///
    /// There can be any other number of textures in this HashMap, for application-specific kinds.
    pub textures: HashMap<String, Texture>,
    /// Any number of attenuation functions to be applied to the LightObject. The values produced
    /// by all of them are multiplied together to determine the intensity of the light reaching
    /// any particular point in space.
    pub attenuations: Atten
}

/// This is an helper-enum representing all different types of lights that a LightObject can emit.
pub enum LightType {
    /// The light souArce is to be treated as if it were infinitely far away so its rays are
    /// parallel. In object space, the rays point in the direction of the negative z-axis.
    Infinite,
    /// The lght souArce is a point light that radiates in all directions.
    Point,
    /// The light source is a spot light that radiates from a single points byt in a limited range
    /// of directions In object space, the primary direction is the negative z-axis.
    Spot
}

/// The `Morph` structure holds information about a morph target belonging to a `GeometryObject`
/// structure.
pub struct Morph {
    /// The base morph target index for a relative morph target.
    pub base_target_index: Option<u32>,
    /// An optional name for this structure.
    pub name: Option<Name>
}

/// A `Mesh` structure cotains data for a single geometric mesh. Each mesh typically contains
/// several arrays of per-vertex data, and one or more index arrays.
///
/// A mesh may contain vertex data for multiple morph targets. The morph target to which the vertex
/// array belongs is determined by the value op its `morph` property.
pub struct Mesh {
    /// Specifies the type of geometric primitive used by the mesh. This must be the same for each
    /// level of detail. See the helper-enum `GeometricPrimitive` for more details about the
    /// different kinds of primitives.
    pub primitive: GeometricPrimitive
    // TODO: Finish this
}

/// Helper enum for the `Mesh` structure, representing different geometric primitives supported by
/// OpenGEX.
///
/// In the documentation, `n` refers to the number of indices if an `IndexArray` structure is
/// present, and otherwise, the number of vertices in every `VertexArray` structure. Primitives are
/// indexed by the letter `i`, starting at zero.
pub enum GeometricPrimitive {
    /// The mesh is composed of a set of independent points. The number of points is `n`, and point
    ///  `i` is given by vertex `i`.
    Points,
    /// The mesh is composed of a set of independent lines. The number of lines equals `n/2`, and
    /// line `i` is composed of vertices `2i` and
    /// `2i+1`.
    Lines,
    /// The mesh is composed of one or more line strips. The number of lines equals `n-1`, and line
    ///  `i` is composed of vertices `i` and
    /// `i+1`.
    LineStrip,
    /// The mesh is composed of a set of independent triangles. The number of triangles equals
    /// `n/3`, and triangle `i` is composed of vertices `3i`, `3i+1` and `3i+1`.
    Triangles,
    /// The mesh is composed of one or more triangle strips.
    ///
    /// When `i` is even, the triangle is composed out of vertices `i`, `i+1` and `i+2`. When `i`
    /// is odd, the triangle is composed out of vertices `i`, `i+2` and `i+1`.
    TriangleStrip,
    /// The mesh is composed of a set of individual quads. The number of quads equals `n/4`, and
    /// quad `i` is composed of vertices `4i`, `4i+1`, `4i+2` and `4i+3`.
    Quads
}

impl Default for GeometricPrimitive {
    fn default() -> GeometricPrimitive {
        GeometricPrimitive::Triangles
    }
}


text:
layout: page
title: "Model Legislation for your City & State"
permalink: "model-legislation/"
---
{% include JB/setup %}

Sharing the best open government ideas and proven approaches is the goal of the Free Law Founders. Even better, we connect you and your elected officials to the Free Law Founder who wrote the legislation, executed the plan, and discovered what works (and what doesn't) so you don't have to.

These proven state and local policies to further digital democracy are yours to reuse, modify and improve -- just like open data and open source software.

## Case Study: Two Open Gov Laws that Passed in New York City

Here are two examples of bills passed in New York City that you might consider bringing to your location. Though the particulars may be adjusted, the principles behind the legislation and some of the actions taken to promote them and make them law may be similar. To learn more about these bills or our action plan for moving the open government legislation forward, please email bkallos@benkallos.com.

In addition, you can find some excellent recommendations from the Sunlight Foundation on creating open data legislation [here](http://sunlightfoundation.com/blog/2013/10/25/boilerplate-open-data-policy-and-why-its-a-problem/).

### Int. No. 363-A: CITY RECORD ONLINE
By Council Members Kallos, Chin, Constantinides, Cornegy, Gentile, Koo, Lancman, Rose, Vacca, Rodriguez, Mendez, Rosenthal, Koslowitz, Lander, Van Bramer, Barron and Mealy

[Click here to view and comment on the text using Madison.](https://mymadison.io/docs/city-record-online-act-2014)

*A Local Law to amend the New York city charter, in relation to publishing the city record online.*

**SUMMARY:**
The law will put all New York City law online in a searchable and shareable format, instead of being inaccessible on for-fee websites. Currently, legal publishing services sell certified versions of the law to online legal information vendors, which the public must pay to access. This law guarantees that the public has access to the complete, continuously updated City Charter and administrative code.

**BILL TEXT:**
Be it enacted by the Council as follows:
Section 1. Section 1066 of the New York city charter is amended by adding a new subdivision g to read as follows:

g. All information published in the City Record after the effective date of the local law that created this subdivision shall be available as soon as possible, but no later than 24 hours of publishing, at no charge on a website maintained by or on behalf of the city of New York as well as on a single web portal that is linked to nyc.gov or any successor website maintained by, or on behalf of, the city of New York created pursuant to section 23-502 of the administrative code. Such information shall be available in both a non-proprietary, machine-readable format and a human-readable format and shall be capable of being downloaded in bulk. Such information shall be searchable by, at minimum, date of publication, relevant agency, keyword, and category, such as public hearings, procurement notices, and changes in personnel.

§2. This local law shall take effect one year after its enactment, provided, however, that the department of citywide administrative services shall take such actions prior to such time as are necessary for timely implementation of this local law.

### Int. No. 149-A: LAW ONLINE
By Council Members Lander, Kallos, Chin, Cohen, Constantinides, Koo, Lancman, Rose, Van Bramer, Koslowitz, Vacca, Rosenthal, Rodriguez, Barron, Dromm and Mealy

 [Click here to view and comment on the text using Madison.](https://mymadison.io/docs/the-law-online-act-2014)

*A Local Law to amend the administrative code of the city of New York, in relation to the online publication of city laws.*

**SUMMARY:**
This law improves New York City's existing government publication, the City Record, and its website by mandating that all items currently in the paper copy of the City Record published by the Department of Citywide Administrative Services (DCAS) be included in the web version—with an open application program interface (API) to empower developers to create their own apps to track the city's contract bids and awards.

The bill affects:

Companies looking for information on NYC bids and awards;
Public watchdogs and journalists seeking to easily track awards; and
Citizens who have a right to full, complete and usable information.

**BILL TEXT:**

Be it enacted by the Council as follows:
Section 1. Chapter 1 of title 7 of the administrative code of the city of New York is amended by adding a new section 7-111 to read as follows:

§7-111. Online publication of city laws. The corporation counsel shall make available through the city's website a true and complete compilation of the charter, the administrative code, and the rules of the city of new york. Such compilation shall be in a searchable, machine-readable format or formats that are capable of being downloaded in bulk, and which are chosen for the purpose of making such compilations available to the greatest number of users and for the greatest number of applications. Such compilation shall be updated to reflect changes to such compilation no later than four weeks after such changes are made.

§ 2.  This local law shall take effect one year after its enactment.
Details and Press Coverage for Both

### Press Releases:
* [http://www.benkallos.com/press-release/government-upgrade-nyc-council-passes-legislation-put-law-online-and-expand-city-recor](http://www.benkallos.com/press-release/government-upgrade-nyc-council-passes-legislation-put-law-online-and-expand-city-recor)

* [http://www.benkallos.com/press-release/mayor-bill-de-blasio-signs-two-transparency-bills-law-announces-public-private-partner](http://www.benkallos.com/press-release/mayor-bill-de-blasio-signs-two-transparency-bills-law-announces-public-private-partner)

## Press Coverage:
* [http://www.gothamgazette.com/index.php/government/5211-de-blasio-embraces-civic-tech-bill-city-record-online](http://www.gothamgazette.com/index.php/government/5211-de-blasio-embraces-civic-tech-bill-city-record-online)

* [http://www.benkallos.com/press-clip/government-technology-nyc-improves-online-access-city-laws-procurement-notices-brian-heat](http://www.benkallos.com/press-clip/government-technology-nyc-improves-online-access-city-laws-procurement-notices-brian-heat)

* [http://m.govexec.com/state-local/2014/08/nyc-city-record-de-blasio-data/91076/](http://m.govexec.com/state-local/2014/08/nyc-city-record-de-blasio-data/91076/)

* [http://www.brooklyneagle.com/articles/2014/8/8/de-blasio-signs-bills-make-nyc-information-open-searchable-online](http://www.brooklyneagle.com/articles/2014/8/8/de-blasio-signs-bills-make-nyc-information-open-searchable-online)

* [http://benkallos.com/press-clip/statetech-new-york-city-releasing-more-15-years-worth-data-nicole-blake-johnson](http://benkallos.com/press-clip/statetech-new-york-city-releasing-more-15-years-worth-data-nicole-blake-johnson)

* [http://www.benkallos.com/press-clip/techpresident-new-york-city-and-silicon-valley-local-government-innovation-gets-outside-h](http://www.benkallos.com/press-clip/techpresident-new-york-city-and-silicon-valley-local-government-innovation-gets-outside-h)

* [http://www.benkallos.com/press-clip/epoch-times-council-committee-approves-bills-publish-city-laws-record-online-ivan-pentcho](http://www.benkallos.com/press-clip/epoch-times-council-committee-approves-bills-publish-city-laws-record-online-ivan-pentcho)

* [http://www.benkallos.com/press-clip/government-technology-nyc-council-members-want-better-access-city-laws-brian-heaton](http://www.benkallos.com/press-clip/government-technology-nyc-council-members-want-better-access-city-laws-brian-heaton)

## Case Study: Montgomery County (MD) Open Data Law

Below you will find a summary of the Open Data Law, authored by [Councilmember Hans Riemer](http://www.montgomerycountymd.gov/riemer/), that Montgomery County, Maryland passed in 2012. The law required the County Executive to develop an Open Data Operations Manual, which is also included below.

**OPEN DATA LAW SUMMARY:**
* require the County to make certain public data sets available on a single web portal
on the internet;
* require the County to develop a technical standards manual for publishing public data sets;
* require the County to develop an Open Data Implementation Plan;
* require the County to include on the single web portal, a website that includes certain information on requests submitted to the County under the Maryland Public Information Act and the County's response to that request;
* require the Chief Administrative Officer to report to the Council on the Executive Branch's responses to the Maryland Public Information Act; and
* generally amend County law regarding administration.

[Read the full legislative text](http://freelawfounders.org/Montgomery-County-Open-Data-Ordinance/)

**OPEN DATA OPERATIONS MANUAL SUMMARY:**
The Operations Manual is intended to be a comprehensive inventory of the public datasets maintained by the Montgomery County
Government as well as a commitment to make these datasets publicly available by the publication dates specified in this document. The Manual also sets forth the algorithm for prioritizing which datasets to publish when.

[Read the full Open Data Operations Manual](http://montgomerycountymd.gov/open/Resources/Files/OpenDataOperationsManual.pdf), pdf


text:
require 'rack'

describe Rack do
  describe 'version' do
    it 'defaults to a hard-coded api version' do
      Rack.version.should.equal("1.3")
    end
  end
  describe 'release' do
    it 'matches version in .gemspec' do
      gemspec_path = File.join(File.dirname(File.expand_path(__FILE__)), '../rack.gemspec')
      gemspec = Gem::Specification.load(gemspec_path)
      Rack.release.split('.').take(2).should.equal gemspec.version.to_s.split('.').take(2)
    end
  end
end


text:
import {Router} from 'express';
const router = new Router({mergeParams: true});
import passport from 'passport'
import User from '../models/user';

import hat from 'hat';

//========
//auth

router.post("/register", function(req, res) {
  var token = hat()
  var newUser = new User({username: req.body.username});
  User.register(newUser, req.body.password, function(err, user) {
    if (err) {
      return res.render("auth/register");
    }
    passport.authenticate("local", {session: false})(req, res, function() {
      var token = hat();
      User.findOneAndUpdate({
        username: req.body.username
      }, {
        token: token
      }, function(err) {
        if (err) {
          res.redirect("/");
        } else {
          res.json({success: true, token: token})
        }

      });
    });

  });
});

router.post("/login", passport.authenticate("local", {session: false}), function(req, res) {
  var token = hat();
  User.findOneAndUpdate({
    username: req.body.username
  }, {
    token: token
  }, function(err) {
    if (err) {
      res.redirect("/");
    } else {
      res.json({success: true, token: token})
    }

  });
});

router.get("/logout", function(req, res) {
  req.logout();
  res.redirect("/");
});
router.get("/asdf", function(req, res) {
  var signingKey = hat(); // Create a highly random byte array of 256 bytes
  console.log(signingKey)
  res.json({token: signingKey})
})

export default router;


text:
<?php

class BaseModel extends \Eloquent {

}


text:
MERCHANT_ID = None
SECRET = 'xidanapynubovoja'


text:
{% extends "base.html" %}
{% block title %}{{ article.title|striptags }}{% endblock %}
{% block content %}

			{% include 'sidebar.html' %}

{{ article.title }}

					{% import 'translations.html' as translations with context %}
					{{ translations.translations_for(article) }}

					{{ article.locale_date }}

					{% if article.author %}
					By

							{{ article.author }}

					{% endif %}

						{{ article.content }}

						{% if article.tags %}

							{% for tag in article.tags %}
							{{ tag|e }}
							{% endfor %}
						{% endif %}

				{% if DISQUS_SITENAME %}

Comments

				{% endif %}

{% endblock %}


text:
package mylord
package json

import argonaut._, Argonaut._
import com.github.nscala_time.time.Imports._

object Codec {

  implicit def DateTimeDecodeJson: DecodeJson[DateTime] =
    DecodeJson.optionDecoder(_.string.flatMap(_.toDateTimeOption), "org.joda.time.DateTime")

  implicit def DateTimeEncodeJson: EncodeJson[DateTime] =
    EncodeJson(a => jString(a.toString))
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="au.com.sydexplore"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <permission
        android:name="au.com.sydexplore.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
	 <!-- Required to show current location -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <!-- Required OpenGL ES 2.0. for Maps V2 -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/sydexplorelogo"
        android:label="@string/app_name"
        android:theme="@style/CustomActionBarTheme" >

        <meta-data
	     android:name="com.google.android.maps.v2.API_KEY"
	     android:value="AIzaSyAMKLMSHCbqvCraXY_xQgdLEo329DdX5Ko" />
		<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name=".ViewAttraction"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name=".ViewCategory"
            android:label="@string/app_name"
            android:parentActivityName="com.example.sydexplore.MainActivity" >
            <!-- Parent activity meta-data to support 4.0 and lower -->
        	<meta-data
            	android:name="android.support.PARENT_ACTIVITY"
            	android:value="com.example.sydexplore.MainActivity" />
        </activity>
        <activity
            android:name=".ViewCategoryList"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name=".ViewCategoryMap"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name=".SubmitReview"
            android:label="@string/app_name"
            android:parentActivityName="com.example.sydexplore.ViewAttractionInfo" >
        	<!-- Parent activity meta-data to support 4.0 and lower -->
        	<meta-data
            	android:name="android.support.PARENT_ACTIVITY"
            	android:value="com.example.sydexplore.ViewAttractionInfo" />
        </activity>
        <activity
            android:name=".SplashScreen"
            android:theme="@android:style/Theme.NoTitleBar"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ViewAttractionInfo"
            android:label="@string/app_name"
            android:parentActivityName="com.example.sydexplore.ViewCategory">
            <!-- Parent activity meta-data to support 4.0 and lower -->
        	<meta-data
            	android:name="android.support.PARENT_ACTIVITY"
            	android:value="com.example.sydexplore.ViewCategory" />
        </activity>
    </application>

</manifest>


text:
1. [Get It](#user-content-get-the-package)
2. [Configure It](#user-content-reviewedit-variable-values-and-files)
3. [Provision It](#user-content-only-install-what-you-want)

[TODO](#user-content-todo)

===

### get the package

download package with pre-installed tools:

````
python -c "import urllib; urllib.urlretrieve('https://github.com/meganlkm/osx-provisioner/archive/master.tar.gz', 'tmp.tar.gz')" && tar zxvf tmp.tar.gz && rm tmp.tar.gz
````

OR

Clone it:

````
git clone https://github.com/meganlkm/osx-provisioner.git
````

### Review/Edit variable values and files:

- ansible/roles/brew/defaults/*.yml
- ansible/roles/brew/vars/*.yml
- ansible/roles/brew-cask/defaults/main.yml
- ansible/roles/brew-cask/vars/main.yml
- ansible/roles/dotfiles/defaults/*.yml
- ansible/roles/dotfiles/files/*
- ansible/roles/mkdirs/defaults/*.yml
- ansible/roles/osx-defaults/files/osxdefaults.sh
- ansible/roles/python/defaults/*.yml
- ansible/roles/ssh/defaults/*.yml
- ansible/roles/sublime-text3/defaults/*.yml
- ansible/st3_configs/Package Control.sublime-settings

### Only install what you want

Remove or add things to the main playbook:

````
ansible/site.yml
````

Provision your system:

````
sh init.sh
````

## TODO

* rewrite...
* fix osxdefaults script execution
* split python role into python2 and python3

1. finish refactoring osx-defaults
2. port mkpy stuff to python package
3. gimp (http://www.gimp.org/source/howtos/gimp-git-build.html)
4. readmes for each role
5. move st3_configs to sublime-text3 role
6. install curl if it does not exist before installing rvm


text:
add_admin_user() {
  groupadd -g $gid $group &&
  useradd -g $group -u $uid $login &&
  mkdir /home/$login/.ssh &&
  chmod 700 /home/$login/.ssh &&
  echo $pubkey > /home/$login/.ssh/authorized_keys &&
  chmod 600 /home/$login/.ssh/authorized_keys &&
  chown -R $login:$group /home/$login/.ssh &&
  cat >> /etc/sudoers <<EOF

# $login configs
Defaults:$login !requiretty
Defaults:$login secure_path = /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
$login ALL=(ALL) NOPASSWD: ALL
EOF
}

modify_sshd_configs() {
  sed -i.orig -e '
s/^PasswordAuthentication yes/PasswordAuthentication no/
/^UsePAM yes/d
/^#PermitRootLogin yes/a\
PermitRootLogin no
/^X11Forwarding yes/d
' /etc/ssh/sshd_config &&
  /etc/init.d/sshd reload
}

install_common_rpms() {
  yum install -y \
    bind-utils \
    file \
    git \
    mailx \
    man \
    ntp \
    openssh-clients \
    patch \
    rsync \
    screen \
    sysstat \
    traceroute \
    vim-enhanced
}

setup_ntp() {
  ntpd -gq &&
  /etc/init.d/ntpd start &&
  chkconfig ntpd on
}

setup_hostname() {
  sed -i -e 's/^HOSTNAME=.*/HOSTNAME='$hostname'/' /etc/sysconfig/network
}

# main
set -x &&
add_admin_user &&
modify_sshd_configs &&
install_common_rpms &&
setup_ntp &&
setup_hostname &&
yum -y update &&
reboot


text:
package org.apache.maven.project;

import org.apache.maven.artifact.Artifact;

/**
 * This exception is thrown if an application attempts to attach
 * two of the same artifacts to a single project.
 *
 * @author pgier
 * @author jdcasey
 * TODO Make this a checked exception, and modify the API of MavenProjectHelper.
 * Currently, this modification would create compatibility problems for existing plugins.
 */
public class DuplicateArtifactAttachmentException
    extends RuntimeException
{

    private static final String DEFAULT_MESSAGE = "Duplicate artifact attachment detected.";

    private Artifact artifact;

    private final MavenProject project;

    public DuplicateArtifactAttachmentException( MavenProject project, Artifact artifact )
    {
        super( constructMessage( project, artifact ) );
        this.project = project;
        this.artifact = artifact;
    }

    private static String constructMessage( MavenProject project, Artifact artifact )
    {
        return DEFAULT_MESSAGE + " (project: " + project.getId() + "; illegal attachment: " + artifact.getId() + ")";
    }

    public MavenProject getProject()
    {
        return project;
    }

    public Artifact getArtifact()
    {
        return artifact;
    }
}


text:
@interface UIViewController (TNCUtils)

+ (UIViewController*) currentViewController;

@end


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lichen pertusus Schrank

### Remarks
null


text:
In your terminal

    npm install -g imgbase
    imgbase style.css > style.embd.css

In your HTML

```html
<!--[if lt IE 9]><link rel="stylesheet" href="style.css" /><![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><link rel="stylesheet" href="style.embd.css" /><!--<![endif]-->
```


text:
<!DOCTYPE html>

	<meta charset="utf-8">

	<title>Class LeanCloud\Uploader\QiniuUploader</title>

	<link rel="stylesheet" href="resources/style.css?c2f33731c1948fbed7c333554678bfa68d4817da">

		Overview

Namespaces

						LeanCloud

						Engine

						Operation

						Storage

						Uploader

Classes

QCloudUploader

QiniuUploader

S3Uploader

SimpleUploader

	<form id="search">
		<input type="hidden" name="cx" value="">
		<input type="hidden" name="ie" value="UTF-8">
		<input type="text" name="q" class="text" placeholder="Search">
	</form>

				Overview

				Namespace

Class

Class QiniuUploader

Qiniu file uploader

			LeanCloud\Uploader\SimpleUploader

LeanCloud\Uploader\QiniuUploader

		Namespace: LeanCloud\Uploader

				Link:
				http://developer.qiniu.com/code/v6/api/kodo-api/up/upload.html

			Located at LeanCloud/Uploader/QiniuUploader.php

Methods summary

			 public

		#
		getUploadUrl( )

Overrides

LeanCloud\Uploader\SimpleUploader::getUploadUrl()

			 public

		#
		crc32Data(  <var>$data</var> )

			 public

		#
		upload( string <var>$content</var>, string <var>$mimeType</var>, string <var>$key</var> )

Upload file to qiniu

Upload file to qiniu

Parameters

<var>$content</var>

File content

<var>$mimeType</var>

MIME type of file

<var>$key</var>

Generated file name

Methods inherited from LeanCloud\Uploader\SimpleUploader

			createUploader(),
			getAuthToken(),
			getFileFieldName(),
			initialize(),
			multipartEncode()

Properties inherited from LeanCloud\Uploader\SimpleUploader

			<var>$authToken</var>,
			<var>$uploadUrl</var>

		 API documentation generated by ApiGen


text:
set -e

BUILDSTACK=$1

if [[ "$BUILDSTACK" != "full" && "$BUILDSTACK" != "front" && "$BUILDSTACK" != "web" && \
      "$BUILDSTACK" != "api" && "$BUILDSTACK" != "perl" && "$BUILDSTACK" != "cron" ]]; then
    echo "Don't know how to install for '$BUILDSTACK'"
    exit 255
fi

# Install prerequisites
apk update
# Basics
APKS="tzdata make bash perl logrotate"

if [[ "$BUILDSTACK" == "full" || "$BUILDSTACK" == "front" ]]; then
    # Web server
    APKS="$APKS nginx"
fi
if [[ "$BUILDSTACK" != "perl" && "$BUILDSTACK" != "cron"  ]]; then
    # Web server
    APKS="$APKS openssl"
fi
if [[ "$BUILDSTACK" != "front" ]]; then
    # Perl modules
    APKS="$APKS perl-dbd-mysql perl-dbi perl-date-format perl-html-parser perl-json perl-libwww perl-lwp-protocol-https
        perl-net-ip perl-term-readkey perl-xml-simple perl-app-cpanminus perl-mojolicious perl-algorithm-diff
        perl-module-build perl-namespace-autoclean perl-moo perl-strictures perl-test-fatal perl-digest-hmac
        perl-type-tiny"
fi
if [[ "$BUILDSTACK" == "full" || "$BUILDSTACK" == "cron" ]]; then
    # Cron
    APKS="$APKS busybox-suid"
    # Mail
    APKS="$APKS ssmtp"
fi
if [[ "$BUILDSTACK" == "full" || "$BUILDSTACK" == "perl" || "$BUILDSTACK" == "cron" ]] ; then
    # Scan tools
    APKS="$APKS git nmap sudo"
fi
if [[ "$BUILDSTACK" == "full" ]] ; then
    # Database
    APKS="$APKS mariadb mariadb-client"
fi

# Install
apk add $APKS

if [[ "$BUILDSTACK" != "front" ]]; then
    apk add --virtual .build-dependancies wget linux-headers perl-dev perl-app-cpanminus gcc libc-dev
    # Perl modules
    cpanm Digest::SHA3
    cpanm Crypt::PBKDF2
    apk del .build-dependancies
fi

# Extract tarbal
cd /build/seccubus
tar -xzf build/Seccubus*.tar.gz
cd Seccubus-*

if [[ "$BUILDSTACK" != "front" ]]; then
    # Make sure perl is set to the correct path
    perl Makefile.PL
    make clean
    perl Makefile.PL 2>&1| tee makefile.log

    # Check if we have all perl dependancies
    if [[ $(grep "Warning: prerequisite" makefile.log| grep -v 'Perl::Critic' |wc -l) -gt 0 ]]; then
        echo '*** ERROR: Not all perl dependancies installed ***'
        cat makefile.log
        exit 255
    fi
fi

# create user
mkdir -p /opt/seccubus
addgroup seccubus
adduser -h /opt/seccubus -g "Seccubus system user" -s /bin/bash -S -D -G seccubus seccubus
addgroup seccubus wheel

chown -R seccubus:seccubus /opt/seccubus
chmod 755 /opt/seccubus

# Install the software
./install.pl --basedir /opt/seccubus /opt/seccubus/www --stage_dir /build/stage --createdirs --owner seccubus -v -v

# Create mountpoint for data directory
mkdir /opt/seccubus/data
chmod 755 /opt/seccubus/data
chown seccubus:seccubus /opt/seccubus/data
chmod 755 /opt/seccubus

mkdir /var/log/seccubus
chmod 755 /var/log/seccubus
chown seccubus:seccubus /var/log/seccubus

if [[ "$BUILDSTACK" == "front" ]]; then
    # Only keep the parts we need
    ls -d /opt/seccubus/*|grep -v "\/data"|grep -v "\/public"|xargs rm -rf
else
    if [[ "$BUILDSTACK" == "web" || "$BUILDSTACK" == "api" ]]; then
        rm -rf /opt/seccubus/bin/* /opt/seccubus/scanners/*
    fi
    if [[ "$BUILDSTACK" != "web" && "$BUILDSTACK" != "full" ]]; then
        rm -rf  /opt/seccubus/public
    fi
    if [[ "$BUILDSTACK" != "full" ]]; then
        rm -rf  /opt/seccubus/db/*
    fi
    rm -rf /opt/seccubus/docs
fi

if [[ "$BUILDSTACK" == "full" ]]; then
    # Setup database
    DB_DATA_PATH="/var/lib/mysql"
    DB_ROOT_PASS="dwofMVR8&E^#3owHA0!Y"
    DB_USER="mariadb_user"
    DB_PASS="dwofMVR8&E^#3owHA0!Y"
    MAX_ALLOWED_PACKET="200M"
    mysql_install_db --user=mysql --datadir=${DB_DATA_PATH}

    (cd /usr ; /usr/bin/mysqld_safe --datadir="/var/lib/mysql" --socket="/run/mysqld/mysqld.sock" --user=mysql  >/dev/null 2>&1 &)
    sleep 3
    #/etc/init.d/mariadb start
    /usr/bin/mysql <<EOF
        create database seccubus;
        grant all privileges on seccubus.* to seccubus@localhost identified by 'seccubus';
        flush privileges;
EOF
    /usr/bin/mysql seccubus < $(ls /opt/seccubus/db/structure*.mysql|tail -1)
    /usr/bin/mysql seccubus < $(ls /opt/seccubus/db/data*.mysql|tail -1)

    /usr/bin/mysql seccubus <<EOF1
        INSERT INTO workspaces VALUES (1,'Example');
        INSERT INTO scans VALUES
            (1,'ssllabs','SSLlabs','--hosts @HOSTS --from-cache','','www.seccubus.com',1),
            (2,'nmap','Nmap','-o \"\" --hosts @HOSTS','','www.seccubus.com',1),
            (3,'nikto','Nikto','-o \"\" --hosts @HOSTS','','www.seccubus.com',1),
            (4,'testssl.sh','testssl.sh','-o \"\" --hosts @HOSTS','','www.seccubus.com',1);
EOF1
fi

if [[ "$BUILDSTACK" != "front" ]]; then
    # Set up some default content
    SESSION_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
    echo $SESSION_KEY > /opt/seccubus/etc/SESSION_KEY
    cat <<EOF2 >/opt/seccubus/etc/config.xml
    <seccubus>
        <database>
            <engine>mysql</engine>
            <database>seccubus</database>
            <host>127.0.0.1</host>
            <port>3306</port>
            <user>seccubus</user>
            <password>seccubus</password>
        </database>
        <paths>
            <modules>/opt/seccubus/lib</modules>
            <scanners>/opt/seccubus/scanners</scanners>
            <bindir>/opt/seccubus/bin</bindir>
            <configdir>/opt/seccubus/etc</configdir>
            <dbdir>/opt/seccubus/db</dbdir>
        </paths>
        <smtp>
            <server></server>
            <from></from>
        </smtp>
        <tickets>
            <url_head></url_head>
            <url_tail></url_tail>
        </tickets>
        <auth>
            <http_auth_header></http_auth_header>
            <sessionkey>$SESSION_KEY</sessionkey>
        </auth>
        <http>
            <port>443</port>
            <cert>testdata/seccubus.crt</cert>
            <key>testdata/seccubus.key</key>
        </http>
    </seccubus>
EOF2

    # Setup default environment
    echo >/etc/profile.d/seccubus.sh 'export PATH="$PATH:/opt/seccubus/bin"'
    echo >>/etc/profile.d/seccubus.sh 'export PERL5LIB="/opt/seccubus:/opt/seccubus/lib"'
    chmod +x /etc/profile.d/seccubus.sh
    echo >/root/.bashrc 'export PATH="$PATH:/opt/seccubus/bin"'
    echo >>/root/.bashrc 'export PERL5LIB="/opt/seccubus:/opt/seccubus/lib"'

    # Clone bashrc
    cp ~/.bashrc ~seccubus/.bashrc
    chown seccubus:seccubus ~seccubus/.bashrc
fi

# Copy README files
cp README.md README-docker.md /

if [[ "$BUILDSTACK" == "full" ]]; then
    cd /opt/seccubus/
    perl -I . bin/seccubus_passwd -u admin -p 'GiveMeVulns!'
fi

if [[ "$BUILDSTACK" == "full" || "$BUILDSTACK" == "perl" || "$BUILDSTACK" == "cron" ]]; then
    # Install Nikto
    cd /opt
    git clone https://github.com/sullo/nikto.git
    echo 'export PATH="$PATH:/opt/nikto/program"' > /etc/profile.d/nikto.sh
    echo 'export PATH="$PATH:/opt/nikto/program"' >> /root/.bashrc
    chmod +x /etc/profile.d/nikto.sh

    # Install testssl.sh
    cd /opt
    git clone https://github.com/drwetter/testssl.sh.git
    echo 'export PATH="$PATH:/opt/testssl.sh"' > /etc/profile.d/testssl.sh.sh
    echo 'export PATH="$PATH:/opt/testssl.sh"' >> /root/.bashrc

    # Fix sudoers file
    echo > /etc/sudoers "%wheel ALL=(ALL) NOPASSWD: ALL"
fi

# Cleanup build stuff
set +e
rm -rf /build
rm -rf /var/cache/apk/*


text:
package org.apache.camel.component.timer;

import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;

import org.apache.camel.Endpoint;
import org.apache.camel.impl.UriEndpointComponent;

/**
 * Represents the component that manages {@link TimerEndpoint}.  It holds the
 * list of {@link TimerConsumer} objects that are started.
 *
 * @version
 */
public class TimerComponent extends UriEndpointComponent {
    private final Map<String, Timer> timers = new HashMap<String, Timer>();

    public TimerComponent() {
        super(TimerEndpoint.class);
    }

    public Timer getTimer(TimerEndpoint endpoint) {
        String key = endpoint.getTimerName();
        if (!endpoint.isDaemon()) {
            key = "nonDaemon:" + key;
        }

        Timer answer;
        synchronized (timers) {
            answer = timers.get(key);
            if (answer == null) {
                // the timer name is also the thread name, so lets resolve a name to be used
                String name = endpoint.getCamelContext().getExecutorServiceManager().resolveThreadName("timer://" + endpoint.getTimerName());
                answer = new Timer(name, endpoint.isDaemon());
                timers.put(key, answer);
            }
        }
        return answer;
    }

    @Override
    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
        TimerEndpoint answer = new TimerEndpoint(uri, this, remaining);

        // convert time from String to a java.util.Date using the supported patterns
        String time = getAndRemoveParameter(parameters, "time", String.class);
        String pattern = getAndRemoveParameter(parameters, "pattern", String.class);
        if (time != null) {
            SimpleDateFormat sdf;
            if (pattern != null) {
                sdf = new SimpleDateFormat(pattern);
            } else if (time.contains("T")) {
                sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
            } else {
                sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            }
            Date date = sdf.parse(time);
            answer.setTime(date);
        }

        setProperties(answer, parameters);
        return answer;
    }

    @Override
    protected void doStop() throws Exception {
        Collection<Timer> collection = timers.values();
        for (Timer timer : collection) {
            timer.cancel();
        }
        timers.clear();
    }
}


text:
import helper

if __name__ == "__main__":
    helper.greeting("hello")
    helper.greeting("Look at your boyfriend. Now look at me. Now back to your boyfriend- NOW BACK TO ME.")


text:
package gov.nih.nci.evs.api.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Stream;

import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import gov.nih.nci.evs.api.service.ElasticOperationsService;

/**
 * Represents a concept with a code from a terminology.
 *
 * <pre>
 * {
 *   "code" : "C3224",
 *   "name" : "Melanoma",
 *   "leaf" : false,
 *   "synonyms" :[ {
 *     "name" : "MELANOMA, MALIGNANT",
 *     "termType" : "PT",
 *     "source" : "CDISC",
 *     "type" : "FULL_SYN"
 *   }, ... ],
 *   "definitions": [ ...
 *     {
 *     "definition" : "A form of cancer that begins in melanocytes (cells that make the pigment melanin). It may begin in a mole (skin melanoma), but can also begin in other pigmented tissues, such as in the eye or in the intestines.",
 *     "source" : "NCI-GLOSS",
 *     "type": "ALT_DEFINITION"
 *   } ],
 *   "properties" : [
 *     { "type": "Neoplastic_Status", "value": "Malignant" },
 *     { "type": "UMLS_CUI", "value": "C0025202" }, ...
 *   ]
 * }
 * </pre>
 */
@Document(indexName = "default", type = ElasticOperationsService.CONCEPT_TYPE)
@JsonInclude(Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Concept extends ConceptMinimal {

  /** The highlight. */
  @Transient
  @JsonSerialize
  @JsonDeserialize
  private String highlight;

  /** The highlights. */
  @Transient
  @JsonSerialize
  @JsonDeserialize
  private java.util.Map<String, String> highlights;

  /** The normName. */
  @JsonProperty(access = Access.READ_ONLY)
  @Field(type = FieldType.Keyword)
  private String normName;

  /** The normName. */
  @Field(type = FieldType.Keyword)
  private String subsetLink;

  /** The concept status. */
  @JsonProperty(access = Access.READ_ONLY)
  @Field(type = FieldType.Keyword)
  private String conceptStatus;

  /** The source - only used by parent/child references for NCIM. */
  @Field(type = FieldType.Keyword)
  private String source;

  /** The leaf. */
  @Field(type = FieldType.Boolean)
  private Boolean leaf;

  /** The synonyms. */
  @Field(type = FieldType.Nested)
  private List<Synonym> synonyms;

  /** The definitions. */
  @Field(type = FieldType.Nested)
  private List<Definition> definitions;

  /** The properties. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "qualifiers"
  })
  private List<Property> properties;

  /** The qualifiers - only used by parent/child references for NCIM. */
  @Field(type = FieldType.Nested)
  private List<Qualifier> qualifiers;

  /** The children. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "definitions", "parents", "children", "maps", "associations", "inverseAssociations", "roles",
      "inverseRoles", "descendants", "paths", "qualifiers", "extensions", "disjointWith"
  })
  private List<Concept> children;

  /** The parents. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "definitions", "parents", "children", "maps", "associations", "inverseAssociations", "roles",
      "inverseRoles", "descendants", "paths", "qualifiers", "extensions", "disjointWith"
  })
  private List<Concept> parents;

  /** The descendants. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "definitions", "parents", "children", "maps", "associations", "inverseAssociations", "roles",
      "inverseRoles", "descendants", "paths", "qualifiers", "extensions", "disjointWith"
  })
  private List<Concept> descendants;

  /** The associations. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "qualifiers"
  })
  private List<Association> associations;

  /** The inverse associations. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "qualifiers"
  })
  private List<Association> inverseAssociations;

  /** The roles. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "qualifiers"
  })
  private List<Role> roles;

  /** The disjoint with. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "qualifiers"
  })
  private List<DisjointWith> disjointWith;

  /** The inverse roles. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "qualifiers"
  })
  private List<Role> inverseRoles;

  /** The maps. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "qualifiers"
  })
  private List<Map> maps;

  /** The paths to root. */
  @Field(type = FieldType.Nested, ignoreFields = {
      "paths"
  })
  private Paths paths;

  /** The paths to root. */
  @Field(type = FieldType.Nested)
  private Extensions extensions;

  /**
   * Instantiates an empty {@link Concept}.
   */
  public Concept() {
    // n/a
  }

  /**
   * Instantiates a {@link Concept} from the specified parameters.
   *
   * @param code the code
   */
  public Concept(final String code) {
    super(code);
  }

  /**
   * Instantiates a {@link Concept} from the specified parameters.
   *
   * @param terminology the terminology
   * @param code the code
   * @param name the name
   */
  public Concept(final String terminology, final String code, final String name) {
    super(terminology, code, name);
  }

  /**
   * Instantiates a {@link Concept} from the specified parameters.
   *
   * @param other the other
   */
  public Concept(final Concept other) {
    populateFrom(other);
  }

  /**
   * Instantiates a {@link Concept} from the specified parameters.
   *
   * @param other the other
   */
  public Concept(final ConceptMinimal other) {
    super.populateFrom(other);
  }

  /**
   * Instantiates a {@link Concept} from the specified parameters.
   *
   * @param other the other
   */
  public Concept(final HierarchyNode other) {
    super(other.getCode());
    setName(other.getLabel());
    setLevel(other.getLevel());
    if (other.getLeaf() != null && other.getLeaf()) {
      leaf = other.getLeaf();
    }
    for (final HierarchyNode child : other.getChildren()) {
      getChildren().add(new Concept(child));
    }
  }

  public void populateFrom(final Concept other) {
    populateFrom(other, false);
  }

  /**
   * Populate from.
   *
   * @param other the other
   * @param noChildren the no children - used for subsets retrieval
   */
  public void populateFrom(final Concept other, final boolean noChildren) {
    super.populateFrom(other);
    highlight = other.getHighlight();
    highlights = new HashMap<>(other.getHighlights());
    conceptStatus = other.getConceptStatus();
    leaf = other.getLeaf();
    normName = other.getNormName();
    subsetLink = other.getSubsetLink();
    conceptStatus = other.getConceptStatus();
    synonyms = new ArrayList<>(other.getSynonyms());
    definitions = new ArrayList<>(other.getDefinitions());
    properties = new ArrayList<>(other.getProperties());
    qualifiers = new ArrayList<>(other.getQualifiers());
    source = other.getSource();
    if (!noChildren) {
      children = new ArrayList<>(other.getChildren());
    }
    parents = new ArrayList<>(other.getParents());
    associations = new ArrayList<>(other.getAssociations());
    inverseAssociations = new ArrayList<>(other.getInverseAssociations());
    roles = new ArrayList<>(other.getRoles());
    inverseRoles = new ArrayList<>(other.getInverseRoles());
    disjointWith = new ArrayList<>(other.getDisjointWith());
    maps = new ArrayList<>(other.getMaps());
    if (other.getPaths() != null) {
      paths = other.getPaths();
    }
    extensions = other.getExtensions();
  }

  /**
   * Returns the highlight.
   *
   * @return the highlight
   */
  public String getHighlight() {
    return highlight;
  }

  /**
   * Sets the highlight.
   *
   * @param highlight the highlight
   */
  public void setHighlight(final String highlight) {
    this.highlight = highlight;
  }

  /**
   * Returns the highlights.
   *
   * @return the highlights
   */
  public java.util.Map<String, String> getHighlights() {
    if (highlights == null) {
      highlights = new HashMap<>();
    }
    return highlights;
  }

  /**
   * Sets the highlights.
   *
   * @param highlights the highlights
   */
  public void setHighlights(final java.util.Map<String, String> highlights) {
    this.highlights = highlights;
  }

  /**
   * Returns the normName.
   *
   * @return the normName
   */
  public String getNormName() {
    return normName;
  }

  /**
   * Sets the normName.
   *
   * @param normName the normName
   */
  public void setNormName(String normName) {
    this.normName = normName;
  }

  /**
   * Returns the subset link.
   *
   * @return the subsetLink
   */
  public String getSubsetLink() {
    return subsetLink;
  }

  /**
   * Sets the subset link.
   *
   * @param subsetLink the subsetLink to set
   */
  public void setSubsetLink(String subsetLink) {
    this.subsetLink = subsetLink;
  }

  /**
   * Returns the concept status.
   *
   * @return the conceptStatus
   */
  public String getConceptStatus() {
    return conceptStatus;
  }

  /**
   * Sets the concept status.
   *
   * @param conceptStatus the conceptStatus to set
   */
  public void setConceptStatus(String conceptStatus) {
    this.conceptStatus = conceptStatus;
  }

  /**
   * Returns the leaf.
   *
   * @return the leaf
   */
  public Boolean getLeaf() {
    return leaf;
  }

  /**
   * Sets the leaf.
   *
   * @param leaf the leaf
   */
  public void setLeaf(final Boolean leaf) {
    this.leaf = leaf;
  }

  /**
   * Returns the synonyms.
   *
   * @return the synonyms
   */
  public List<Synonym> getSynonyms() {
    if (synonyms == null) {
      synonyms = new ArrayList<>();
    }
    return synonyms;
  }

  /**
   * Sets the synonyms.
   *
   * @param synonyms the synonyms
   */
  public void setSynonyms(final List<Synonym> synonyms) {
    this.synonyms = synonyms;
  }

  /**
   * Returns the definitions.
   *
   * @return the definitions
   */
  public List<Definition> getDefinitions() {
    if (definitions == null) {
      definitions = new ArrayList<>();
    }
    return definitions;
  }

  /**
   * Sets the definitions.
   *
   * @param definitions the definitions
   */
  public void setDefinitions(final List<Definition> definitions) {
    this.definitions = definitions;
  }

  /**
   * Returns the properties.
   *
   * @return the properties
   */
  public List<Property> getProperties() {
    if (properties == null) {
      properties = new ArrayList<>();
    }
    return properties;
  }

  /**
   * Sets the properties.
   *
   * @param properties the properties
   */
  public void setProperties(final List<Property> properties) {
    this.properties = properties;
  }

  /**
   * Returns the qualifiers.
   *
   * @return the qualifiers
   */
  public List<Qualifier> getQualifiers() {
    if (qualifiers == null) {
      qualifiers = new ArrayList<>();
    }
    return qualifiers;
  }

  /**
   * Sets the qualifiers.
   *
   * @param qualifiers the qualifiers
   */
  public void setQualifiers(final List<Qualifier> qualifiers) {
    this.qualifiers = qualifiers;
  }

  /**
   * Returns the source.
   *
   * @return the source
   */
  public String getSource() {
    return source;
  }

  /**
   * Sets the source.
   *
   * @param source the source
   */
  public void setSource(final String source) {
    this.source = source;
  }

  /**
   * Returns the children.
   *
   * @return the children
   */
  public List<Concept> getChildren() {
    if (children == null) {
      children = new ArrayList<>();
    }
    return children;
  }

  /**
   * Sets the children.
   *
   * @param children the children
   */
  public void setChildren(final List<Concept> children) {
    this.children = children;
  }

  /**
   * Returns the parents.
   *
   * @return the parents
   */
  public List<Concept> getParents() {
    if (parents == null) {
      parents = new ArrayList<>();
    }
    return parents;
  }

  /**
   * Sets the parents.
   *
   * @param parents the parents
   */
  public void setParents(final List<Concept> parents) {
    this.parents = parents;
  }

  /**
   * Returns the descendants.
   *
   * @return the descendants
   */
  public List<Concept> getDescendants() {
    if (descendants == null) {
      descendants = new ArrayList<>();
    }
    return descendants;
  }

  /**
   * Sets the descendants.
   *
   * @param descendants the descendants
   */
  public void setDescendants(final List<Concept> descendants) {
    this.descendants = descendants;
  }

  /**
   * Returns the associations.
   *
   * @return the associations
   */
  public List<Association> getAssociations() {
    if (associations == null) {
      associations = new ArrayList<>();
    }
    return associations;
  }

  /**
   * Sets the associations.
   *
   * @param associations the associations
   */
  public void setAssociations(final List<Association> associations) {
    this.associations = associations;
  }

  /**
   * Returns the inverse associations.
   *
   * @return the inverse associations
   */
  public List<Association> getInverseAssociations() {
    if (inverseAssociations == null) {
      inverseAssociations = new ArrayList<>();
    }
    return inverseAssociations;
  }

  /**
   * Sets the inverse associations.
   *
   * @param inverseAssociations the inverse associations
   */
  public void setInverseAssociations(final List<Association> inverseAssociations) {
    this.inverseAssociations = inverseAssociations;
  }

  /**
   * Returns the roles.
   *
   * @return the roles
   */
  public List<Role> getRoles() {
    if (roles == null) {
      roles = new ArrayList<>();
    }
    return roles;
  }

  /**
   * Sets the roles.
   *
   * @param roles the roles
   */
  public void setRoles(final List<Role> roles) {
    this.roles = roles;
  }

  /**
   * Returns the inverse roles.
   *
   * @return the inverse roles
   */
  public List<Role> getInverseRoles() {
    if (inverseRoles == null) {
      inverseRoles = new ArrayList<>();
    }
    return inverseRoles;
  }

  /**
   * Sets the inverse roles.
   *
   * @param inverseRoles the inverse roles
   */
  public void setInverseRoles(final List<Role> inverseRoles) {
    this.inverseRoles = inverseRoles;
  }

  /**
   * Returns the disjoint with.
   *
   * @return the disjoint with
   */
  public List<DisjointWith> getDisjointWith() {
    if (disjointWith == null) {
      disjointWith = new ArrayList<>();
    }
    return disjointWith;
  }

  /**
   * Sets the disjoint with.
   *
   * @param disjointWith the disjoint with
   */
  public void setDisjointWith(final List<DisjointWith> disjointWith) {
    this.disjointWith = disjointWith;
  }

  /**
   * Returns the maps.
   *
   * @return the maps
   */
  public List<Map> getMaps() {
    if (maps == null) {
      maps = new ArrayList<>();
    }
    return maps;
  }

  /**
   * Sets the maps.
   *
   * @param maps the maps
   */
  public void setMaps(final List<Map> maps) {
    this.maps = maps;
  }

  /**
   * Returns the paths.
   *
   * @return the paths
   */
  public Paths getPaths() {
    return paths;
  }

  /**
   * Sets the paths.
   *
   * @param paths the paths to root
   */
  public void setPaths(Paths paths) {
    this.paths = paths;
  }

  /**
   * Returns the extensions.
   *
   * @return the extensions
   */
  public Extensions getExtensions() {
    return extensions;
  }

  /**
   * Sets the extensions.
   *
   * @param extensions the extensions
   */
  public void setExtensions(Extensions extensions) {
    this.extensions = extensions;
  }

  /**
   * Sort lists.
   */
  public void sortLists() {

    if (synonyms != null) {
      Collections.sort(synonyms);
    }
    if (definitions != null) {
      Collections.sort(definitions);
    }
    if (properties != null) {
      Collections.sort(properties);
    }
    if (qualifiers != null) {
      Collections.sort(qualifiers);
    }
    if (children != null) {
      Collections.sort(children);
    }
    if (parents != null) {
      Collections.sort(parents);
    }
    if (descendants != null) {
      Collections.sort(descendants);
    }
    if (associations != null) {
      Collections.sort(associations);
    }
    if (inverseAssociations != null) {
      Collections.sort(inverseAssociations);
    }
    if (roles != null) {
      Collections.sort(roles);
    }
    if (inverseRoles != null) {
      Collections.sort(inverseRoles);
    }
    if (disjointWith != null) {
      Collections.sort(disjointWith);
    }
    if (maps != null) {
      Collections.sort(maps);
    }
  }

  /**
   * stream children.
   *
   * @return the stream
   */
  public Stream<Concept> streamSelfAndChildren() {
    return Stream.concat(Stream.of(this),
        getChildren().stream().flatMap(Concept::streamSelfAndChildren));
  }

}


text:
<?php

namespace Oro\Bundle\UIBundle\Tests\Unit\Tools;

use Oro\Bundle\UIBundle\Tools\EntityLabelBuilder;

class EntityLabelBuilderTest extends \PHPUnit_Framework_TestCase
{
    public function testGetEntityLabelTranslationKey()
    {
        $this->assertEquals(
            'acme.product.entity_label',
            EntityLabelBuilder::getEntityLabelTranslationKey('Acme\Bundle\ProductBundle\Entity\Product')
        );
    }

    public function testGetEntityPluralLabelTranslationKey()
    {
        $this->assertEquals(
            'acme.product.entity_plural_label',
            EntityLabelBuilder::getEntityPluralLabelTranslationKey('Acme\Bundle\ProductBundle\Entity\Product')
        );
    }

    public function testGetFieldLabelTranslationKey()
    {
        $this->assertEquals(
            'acme.product.sell_price.label',
            EntityLabelBuilder::getFieldLabelTranslationKey('Acme\Bundle\ProductBundle\Entity\Product', 'sellPrice')
        );
    }

    /**
     * @dataProvider getTranslationKeyProvider
     */
    public function testGetTranslationKey($expected, $propertyName, $className, $fieldName)
    {
        $result = EntityLabelBuilder::getTranslationKey($propertyName, $className, $fieldName);
        $this->assertEquals($expected, $result);
    }

    public function getTranslationKeyProvider()
    {
        return [
            [
                'acme.test.product.entity_label',
                'label',
                'Acme\Bundle\TestBundle\Entity\Product',
                null
            ],
            [
                'acme.test.product.entity_plural_label',
                'plural_label',
                'Acme\Bundle\TestBundle\Entity\Product',
                null
            ],
            [
                'acme.product.entity_label',
                'label',
                'Acme\Bundle\ProductBundle\Entity\Product',
                null
            ],
            [
                'acme.product.entity_label',
                'label',
                'Acme\Bundle\ProductBundle\Document\Product',
                null
            ],
            [
                'acme.test.product.sell_price.label',
                'label',
                'Acme\Bundle\TestBundle\Entity\Product',
                'sellPrice'
            ],
            [
                'acme.test.product.sell_price.plural_label',
                'plural_label',
                'Acme\Bundle\TestBundle\Entity\Product',
                'sellPrice'
            ],
            [
                'acme.product.sell_price.label',
                'label',
                'Acme\Bundle\ProductBundle\Entity\Product',
                'sellPrice'
            ],
            [
                'acme.product.sell_price.label',
                'label',
                'Acme\Bundle\ProductBundle\Document\Product',
                'sellPrice'
            ],
            [
                'acme.entityproduct.sell_price.label',
                'label',
                'Acme\Bundle\EntityProductBundle\Document\EntityProduct',
                'sellPrice'
            ],
        ];
    }
}


text:
class AcGeLine3d;
class AcGeCircArc3d;
class AcGePlanarEnt;
class
GE_DLLEXPIMPORT
AcGeLinearEnt3d : public AcGeCurve3d
{
public:
    // Intersection with other geometric objects.
    //
    Adesk::Boolean intersectWith (const AcGeLinearEnt3d& line,
                                  AcGePoint3d& intPt,
                                  const AcGeTol& tol = AcGeContext::gTol) const;
    Adesk::Boolean intersectWith (const AcGePlanarEnt& plane, AcGePoint3d& intPnt,
                                  const AcGeTol& tol = AcGeContext::gTol) const;

    // Projection-intersection with other geometric objects.
    //
    Adesk::Boolean projIntersectWith(const AcGeLinearEnt3d& line,
                                  const AcGeVector3d& projDir,
                                  AcGePoint3d& pntOnThisLine,
                                  AcGePoint3d& pntOnOtherLine,
                                  const AcGeTol& tol = AcGeContext::gTol) const;

    // Find the overlap with other AcGeLinearEnt object
    //
    Adesk::Boolean overlap       (const AcGeLinearEnt3d& line,
                                  AcGeLinearEnt3d*& overlap,
                                  const AcGeTol& tol = AcGeContext::gTol) const;

    // Containment tests.
    //
    Adesk::Boolean isOn          (const AcGePoint3d& pnt,
                                  const AcGeTol& tol = AcGeContext::gTol) const;
    Adesk::Boolean isOn          (const AcGePoint3d& pnt, double& param,
                                  const AcGeTol& tol = AcGeContext::gTol) const;
    Adesk::Boolean isOn          (double param,
                                  const AcGeTol& tol = AcGeContext::gTol) const;
    Adesk::Boolean isOn          (const AcGePlane& plane,
                                  const AcGeTol& tol = AcGeContext::gTol) const;

    // Direction tests.
    //
    Adesk::Boolean isParallelTo  (const AcGeLinearEnt3d& line,
                                  const AcGeTol& tol = AcGeContext::gTol) const;
    Adesk::Boolean isParallelTo  (const AcGePlanarEnt& plane,
                                  const AcGeTol& tol = AcGeContext::gTol) const;
    Adesk::Boolean isPerpendicularTo(const AcGeLinearEnt3d& line,
                                  const AcGeTol& tol = AcGeContext::gTol) const;
    Adesk::Boolean isPerpendicularTo(const AcGePlanarEnt& plane,
                                  const AcGeTol& tol = AcGeContext::gTol) const;

    // Test if two lines are colinear.
    //
    Adesk::Boolean isColinearTo  (const AcGeLinearEnt3d& line,
                                  const AcGeTol& tol = AcGeContext::gTol) const;

    // Perpendicular through a given point
    //
    void          getPerpPlane   (const AcGePoint3d& pnt, AcGePlane& plane) const;

    // Definition of line.
    //
    AcGePoint3d    pointOnLine   () const;
    AcGeVector3d   direction     () const;
    void           getLine       (AcGeLine3d&) const;

    // Assignment operator.
    //
    AcGeLinearEnt3d& operator =  (const AcGeLinearEnt3d& line);

protected:
    AcGeLinearEnt3d ();
    AcGeLinearEnt3d (const AcGeLinearEnt3d&);
};

#pragma pack (pop)
#endif


text:
SYNONYM

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

#### Published in
Lloydia 4: 135 (1941)

#### Original name
Allomyces javanicus var. macrogynus R. Emers., 1941

### Remarks
null


text:
from pandas import concat

from .read_gmt import read_gmt

def read_gmts(gmt_file_paths, sets=None, drop_description=True, collapse=False):

    dfs = []

    for gmt_file_path in gmt_file_paths:

        dfs.append(read_gmt(gmt_file_path, drop_description=drop_description))

    df = concat(dfs, sort=True)

    if sets is not None:

        df = df.loc[(df.index & sets)].dropna(axis=1, how="all")

    if collapse:

        return df.unstack().dropna().sort_values().unique()

    else:

        return df