text:
package org.apache.harmony.xml.dom;

import java.util.ArrayList;
import java.util.List;
import libcore.util.Objects;
import org.w3c.dom.DOMException;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/**
 * Provides a straightforward implementation of the corresponding W3C DOM
 * interface. The class is used internally only, thus only notable members that
 * are not in the original interface are documented (the W3C docs are quite
 * extensive).
 *
 *
Some of the fields may have package visibility, so other classes belonging
 * to the DOM implementation can easily access them while maintaining the DOM
 * tree structure.
 *
 *
This class represents a Node that has a parent Node as well as
 * (potentially) a number of children.
 *
 *
Some code was adapted from Apache Xerces.
 */
public abstract class InnerNodeImpl extends LeafNodeImpl {

    // Maintained by LeafNodeImpl and ElementImpl.
    List<LeafNodeImpl> children = new ArrayList<LeafNodeImpl>();

    protected InnerNodeImpl(DocumentImpl document) {
        super(document);
    }

    public Node appendChild(Node newChild) throws DOMException {
        return insertChildAt(newChild, children.size());
    }

    public NodeList getChildNodes() {
        NodeListImpl list = new NodeListImpl();

        for (NodeImpl node : children) {
            list.add(node);
        }

        return list;
    }

    public Node getFirstChild() {
        return (!children.isEmpty() ? children.get(0) : null);
    }

    public Node getLastChild() {
        return (!children.isEmpty() ? children.get(children.size() - 1) : null);
    }

    public Node getNextSibling() {
        if (parent == null || index + 1 >= parent.children.size()) {
            return null;
        }

        return parent.children.get(index + 1);
    }

    public boolean hasChildNodes() {
        return children.size() != 0;
    }

    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
        LeafNodeImpl refChildImpl = (LeafNodeImpl) refChild;

        if (refChildImpl == null) {
            return appendChild(newChild);
        }

        if (refChildImpl.document != document) {
            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null);
        }

        if (refChildImpl.parent != this) {
            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
        }

        return insertChildAt(newChild, refChildImpl.index);
    }

    /**
     * Inserts {@code newChild} at {@code index}. If it is already child of
     * another node, it is removed from there.
     */
    Node insertChildAt(Node newChild, int index) throws DOMException {
        if (newChild instanceof DocumentFragment) {
            NodeList toAdd = newChild.getChildNodes();
            for (int i = 0; i < toAdd.getLength(); i++) {
                insertChildAt(toAdd.item(i), index + i);
            }
            return newChild;
        }

        LeafNodeImpl toInsert = (LeafNodeImpl) newChild;
        if (toInsert.document != null && document != null && toInsert.document != document) {
            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null);
        }
        if (toInsert.isParentOf(this)) {
            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
        }

        if (toInsert.parent != null) {
            int oldIndex = toInsert.index;
            toInsert.parent.children.remove(oldIndex);
            toInsert.parent.refreshIndices(oldIndex);
        }

        children.add(index, toInsert);
        toInsert.parent = this;
        refreshIndices(index);

        return newChild;
    }

    public boolean isParentOf(Node node) {
        LeafNodeImpl nodeImpl = (LeafNodeImpl) node;

        while (nodeImpl != null) {
            if (nodeImpl == this) {
                return true;
            }

            nodeImpl = nodeImpl.parent;
        }

        return false;
    }

    /**
     * Normalize the text nodes within this subtree. Although named similarly,
     * this method is unrelated to Document.normalize.
     */
    @Override
    public final void normalize() {
        Node next;
        for (Node node = getFirstChild(); node != null; node = next) {
            next = node.getNextSibling();
            node.normalize();

            if (node.getNodeType() == Node.TEXT_NODE) {
                ((TextImpl) node).minimize();
            }
        }
    }

    private void refreshIndices(int fromIndex) {
        for (int i = fromIndex; i < children.size(); i++) {
            children.get(i).index = i;
        }
    }

    public Node removeChild(Node oldChild) throws DOMException {
        LeafNodeImpl oldChildImpl = (LeafNodeImpl) oldChild;

        if (oldChildImpl.document != document) {
            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null);
        }
        if (oldChildImpl.parent != this) {
            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
        }

        int index = oldChildImpl.index;
        children.remove(index);
        oldChildImpl.parent = null;
        refreshIndices(index);

        return oldChild;
    }

    /**
     * Removes {@code oldChild} and adds {@code newChild} in its place. This
     * is not atomic.
     */
    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
        int index = ((LeafNodeImpl) oldChild).index;
        removeChild(oldChild);
        insertChildAt(newChild, index);
        return oldChild;
    }

    public String getTextContent() throws DOMException {
        Node child = getFirstChild();
        if (child == null) {
            return "";
        }

        Node next = child.getNextSibling();
        if (next == null) {
            return hasTextContent(child) ? child.getTextContent() : "";
        }

        StringBuilder buf = new StringBuilder();
        getTextContent(buf);
        return buf.toString();
    }

    void getTextContent(StringBuilder buf) throws DOMException {
        Node child = getFirstChild();
        while (child != null) {
            if (hasTextContent(child)) {
                ((NodeImpl) child).getTextContent(buf);
            }
            child = child.getNextSibling();
        }
    }

    final boolean hasTextContent(Node child) {
        // TODO: skip text nodes with ignorable whitespace?
        return child.getNodeType() != Node.COMMENT_NODE
                && child.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE;
    }

    void getElementsByTagName(NodeListImpl out, String name) {
        for (NodeImpl node : children) {
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                ElementImpl element = (ElementImpl) node;
                if (matchesNameOrWildcard(name, element.getNodeName())) {
                    out.add(element);
                }
                element.getElementsByTagName(out, name);
            }
        }
    }

    void getElementsByTagNameNS(NodeListImpl out, String namespaceURI, String localName) {
        for (NodeImpl node : children) {
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                ElementImpl element = (ElementImpl) node;
                if (matchesNameOrWildcard(namespaceURI, element.getNamespaceURI())
                        && matchesNameOrWildcard(localName, element.getLocalName())) {
                    out.add(element);
                }
                element.getElementsByTagNameNS(out, namespaceURI, localName);
            }
        }
    }

    /**
     * Returns true if {@code pattern} equals either "*" or {@code s}. Pattern
     * may be {@code null}.
     */
    private static boolean matchesNameOrWildcard(String pattern, String s) {
        return "*".equals(pattern) || Objects.equal(pattern, s);
    }
}


text:
DWORD       g_dwStatus = SHOW_ALL; // Filter setting for messages from DirectXSetup
HINSTANCE   g_hInstance;              // Global instance handle
HWND        g_hDlg = NULL;     // Window handle to dialog proc
WCHAR g_strAppTitle[256];       // Application title
INT         g_iReply = -1;       // Global value for dialog return

//-----------------------------------------------------------------------------
// Name: ShowButton()
// Desc: Helper function to get and set the text of a button from the
//       resource strings.
//-----------------------------------------------------------------------------
VOID ShowButton( HWND hDlg, int Id, int strid )
{
    HWND btnHwd = GetDlgItem( hDlg, Id );
    WCHAR buf[20];

    LoadString( g_hInstance, strid, buf, 20 );
    SetWindowText( btnHwd, buf );
    ShowWindow( btnHwd, SW_NORMAL );
}

//-----------------------------------------------------------------------------
// Name: SetButtons()
// Desc: Initializes the text of the dialog buttons to mimmic MessageBox()
//-----------------------------------------------------------------------------
VOID SetButtons( HWND hDlg, DWORD wMsgType )
{
    LONG dwStyle;

    switch( wMsgType & 0x0000000F )
    {
        case MB_OKCANCEL:
            ShowButton( hDlg, IDBUT1, STR_OK );
            ShowButton( hDlg, IDBUT2, STR_CANCEL );
            ShowWindow( GetDlgItem( hDlg, IDBUT3 ), SW_HIDE );
            break;

        case MB_OK:
            ShowButton( hDlg, IDBUT3, STR_OK );
            break;

        case MB_RETRYCANCEL:
            ShowButton( hDlg, IDBUT1, STR_RETRY );
            ShowButton( hDlg, IDBUT2, STR_CANCEL );
            ShowWindow( GetDlgItem( hDlg, IDBUT3 ), SW_HIDE );
            break;

        case MB_ABORTRETRYIGNORE:
            ShowButton( hDlg, IDBUT1, STR_ABORT );
            ShowButton( hDlg, IDBUT3, STR_RETRY );
            ShowButton( hDlg, IDBUT2, STR_IGNORE );
            break;

        case MB_YESNOCANCEL:
            ShowButton( hDlg, IDBUT1, STR_YES );
            ShowButton( hDlg, IDBUT3, STR_NO );
            ShowButton( hDlg, IDBUT2, STR_CANCEL );
            break;

        case MB_YESNO:
            ShowButton( hDlg, IDBUT1, STR_YES );
            ShowButton( hDlg, IDBUT2, STR_NO );
            ShowWindow( GetDlgItem( hDlg, IDBUT3 ), SW_HIDE );
            break;

        default:
            ShowWindow( GetDlgItem( hDlg, IDBUT1 ), SW_HIDE );
            ShowWindow( GetDlgItem( hDlg, IDBUT2 ), SW_HIDE );
            ShowWindow( GetDlgItem( hDlg, IDBUT3 ), SW_HIDE );
            break;
    }

    if( !( wMsgType & MB_DEFBUTTON2 ) )
    {
        dwStyle = GetWindowLong( GetDlgItem( hDlg, IDBUT2 ), GWL_STYLE );
        SendMessage( GetDlgItem( hDlg, IDBUT2 ), BM_SETSTYLE, dwStyle & ~BS_DEFPUSHBUTTON, 0 );
    }
    else
    {
        dwStyle = GetWindowLong( GetDlgItem( hDlg, IDBUT2 ), GWL_STYLE );
        SendMessage( GetDlgItem( hDlg, IDBUT2 ), BM_SETSTYLE, dwStyle | BS_DEFPUSHBUTTON, 0 );
    }

    if( !( wMsgType & MB_DEFBUTTON3 ) )
    {
        dwStyle = GetWindowLong( GetDlgItem( hDlg, IDBUT3 ), GWL_STYLE );
        SendMessage( GetDlgItem( hDlg, IDBUT3 ), BM_SETSTYLE, dwStyle & ~BS_DEFPUSHBUTTON, 0 );
    }
    else
    {
        dwStyle = GetWindowLong( GetDlgItem( hDlg, IDBUT3 ), GWL_STYLE );
        SendMessage( GetDlgItem( hDlg, IDBUT3 ), BM_SETSTYLE, dwStyle | BS_DEFPUSHBUTTON, 0 );
    }

    if( !( wMsgType & MB_DEFBUTTON3 ) && !( wMsgType & MB_DEFBUTTON2 ) )
    {
        dwStyle = GetWindowLong( GetDlgItem( hDlg, IDBUT1 ), GWL_STYLE );
        SendMessage( GetDlgItem( hDlg, IDBUT1 ), BM_SETSTYLE, dwStyle | BS_DEFPUSHBUTTON, 0 );
    }
    else
    {
        dwStyle = GetWindowLong( GetDlgItem( hDlg, IDBUT1 ), GWL_STYLE );
        SendMessage( GetDlgItem( hDlg, IDBUT1 ), BM_SETSTYLE, dwStyle & ~BS_DEFPUSHBUTTON, 0 );
    }
}

//-----------------------------------------------------------------------------
// Name: DlgProc()
// Desc: Message proc for our modeless version of MessageBox()
//       This function sets g_wReply for GetReply()
//-----------------------------------------------------------------------------
DLGPROC DlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
    switch( msg )
    {
        case WM_INITDIALOG:
            SetButtons( hDlg, 0xffffffff );
            break;

        case WM_COMMAND:
            switch( LOWORD( wParam ) )
            {
                case IDBUT1:
                case IDBUT2:
                case IDBUT3:
                    // Let GetReply() know the user clicked on a button
                    g_iReply = LOWORD( wParam );
                    break;
            }
            break;
        case WM_ACTIVATE:
            if( LOWORD( wParam ) == WA_INACTIVE )
            {
                if( ( HWND )lParam == GetParent( hDlg ) )
                {
                    SetForegroundWindow( hDlg );
                }
            }
            break;
    }

    return 0;
}

//-----------------------------------------------------------------------------
// Name: SetStatusChecks()
// Desc: Helper function to set checkmarks by status menu items
//-----------------------------------------------------------------------------
VOID SetStatusChecks( HWND hWnd )
{
    CheckMenuItem( GetMenu( hWnd ), IDSHOWALL, MF_BYCOMMAND | MF_UNCHECKED );
    CheckMenuItem( GetMenu( hWnd ), IDSHOWUPGRADES, MF_BYCOMMAND | MF_UNCHECKED );
    CheckMenuItem( GetMenu( hWnd ), IDSHOWPROBLEMS, MF_BYCOMMAND | MF_UNCHECKED );
    CheckMenuItem( GetMenu( hWnd ), IDSHOWNOTHING, MF_BYCOMMAND | MF_UNCHECKED );

    switch( g_dwStatus )
    {
        case SHOW_ALL:
            CheckMenuItem( GetMenu( hWnd ), IDSHOWALL, MF_BYCOMMAND | MF_CHECKED );
            break;
        case SHOW_UPGRADES:
            CheckMenuItem( GetMenu( hWnd ), IDSHOWUPGRADES, MF_BYCOMMAND | MF_CHECKED );
            break;
        case SHOW_PROBLEMS:
            CheckMenuItem( GetMenu( hWnd ), IDSHOWPROBLEMS, MF_BYCOMMAND | MF_CHECKED );
            break;
        case SHOW_NONE:
            CheckMenuItem( GetMenu( hWnd ), IDSHOWNOTHING, MF_BYCOMMAND | MF_CHECKED );
            break;
    }
}

//-----------------------------------------------------------------------------
// Name: DirectXInstallWndProc()
// Desc: Processes windows messages
//-----------------------------------------------------------------------------
INT_PTR CALLBACK DirectXInstallWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    switch( msg )
    {
        case WM_COMMAND:
            // Process menu items
            switch( LOWORD( wParam ) )
            {
                case IDINSTALL:
                    DirectXInstall( hWnd );
                    break;
                case IDGETVERSION:
                    DirectXGetVersion( hWnd );
                    break;
                case IDEXIT:
                    DestroyWindow( hWnd );
                    break;
                case IDSHOWALL:
                    g_dwStatus = SHOW_ALL;
                    SetStatusChecks( hWnd );
                    break;
                case IDSHOWUPGRADES:
                    g_dwStatus = SHOW_UPGRADES;
                    SetStatusChecks( hWnd );
                    break;
                case IDSHOWPROBLEMS:
                    g_dwStatus = SHOW_PROBLEMS;
                    SetStatusChecks( hWnd );
                    break;
                case IDSHOWNOTHING:
                    g_dwStatus = SHOW_NONE;
                    SetStatusChecks( hWnd );
                    break;
            }
            return 0;

        case WM_DESTROY:
            PostQuitMessage( 0 );
            return 0;
    }

    return DefWindowProc( hWnd, msg, wParam, lParam );
}

//-----------------------------------------------------------------------------
// Name: DirectXInstallInit()
// Desc: Initializes window data and registers window class
//       Sets up a structure to register the window class.  Structure includes
//       such information as what function will process messages, what cursor
//       and icon to use, etc.
//-----------------------------------------------------------------------------
BOOL DirectXInstallInit( HINSTANCE hInstance )
{
    WNDCLASS wndClass;      // structure pointer
    ZeroMemory( &wndClass, sizeof( WNDCLASS ) );
    wndClass.style = CS_GLOBALCLASS;
    wndClass.lpfnWndProc = ( WNDPROC )DirectXInstallWndProc;
    wndClass.hInstance = hInstance;
    wndClass.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_MAIN_ICON ) );
    wndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
    wndClass.hbrBackground = ( HBRUSH )GetStockObject( WHITE_BRUSH );
    wndClass.lpszMenuName = L"MainMenu";
    wndClass.lpszClassName = L"DirectXInstall";

    // Returns result of registering the window
    return RegisterClass( &wndClass );
}

//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: Calls initialization function, processes message loop
//       This will initialize the window class if it is the first time this
//       application is run.  It then creates the window, and processes the
//       message loop until a PostQuitMessage is received.  It exits the
//       application by returning the value passed by the PostQuitMessage.
//-----------------------------------------------------------------------------
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                     LPWSTR strCmdLine, int nCmdShow )
{
    // Enable run-time memory check for debug builds.
#if defined(DEBUG) | defined(_DEBUG)
    _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif

    // Has application been initialized?
    if( NULL == hPrevInstance )
        if( 0 == DirectXInstallInit( hInstance ) )
            return 0;

    g_hInstance = hInstance;

    HWND hWnd = CreateWindow( L"DirectXInstall", L"DirectX Install",
                              WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
                              CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                              NULL, NULL, g_hInstance, NULL );
    if( NULL == hWnd )
        return 0;

    LoadString( g_hInstance, STR_TITLE, g_strAppTitle, 200 );
    ShowWindow( hWnd, SW_NORMAL );
    UpdateWindow( hWnd );     // Send a WM_PAINT message
    SetStatusChecks( hWnd );  // Check the default message menu item

    MSG msg;
    while( GetMessage( &msg, NULL, 0, 0 ) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }

    // Returns the value from PostQuitMessage
    return ( int )msg.wParam;
}

redpajama_set_name: RedPajamaGithub


text:
using System;
// ReSharper disable UnusedMember.Local
#pragma warning disable 67
#pragma warning disable 169

class PrivateClass
{
    public PrivateClass ()
    {
    }

// ReSharper disable UnusedParameter.Local
    internal PrivateClass(string @internal)
    {
    }

    PrivateClass(int @private)
    {
    }

    public PrivateClass(bool @public)
    {

    }
    // ReSharper restore UnusedParameter.Local
    string PrivateField;
    internal string InternalField;
    public string PublicField;
    string PrivateProperty { get; set; }
    internal string InternalProperty { get; set; }
    public string PublicProperty { get; set; }
    event EventHandler PrivateEvent;
    internal event EventHandler InternalEvent;
    public event EventHandler PublicEvent;
    void PrivateMethod()
    {
    }
    internal void InternalMethod()
    {
    }
    public void PublicMethod()
    {
    }
}


text:
FROM ubuntu:14.04
MAINTAINER Matt Selph <matt.selph@gmail.com> | github.com/mattselph

# install python, pip, Flask, and pymongo
RUN apt-get update && apt-get install -y python-all python-pip git
RUN pip install Flask pymongo


text:
{% extends "base.html" %}
{% load cookielaw_tags %}

{% block body %}
    {% if cookielaw.rejected %}
Cookies are bad.
{% endif %}
{% endblock %}


text: <!DOCTYPE html>


text:
var geoipData = require(__dirname + "/../lib/geoip");

describe("GeoipData", function(){
    it("should provide country for an IPv4", function(done){
        geoipData("8.8.8.8", function(err, data){
            data.should.have.property("country_code", "US");
            data.should.have.property("country_code3", "USA");
            data.should.have.property("country_name", "United States");
            data.should.have.property("continent_code", "NA");
            done();
        });
    });
    it("should provide city for an IPv4", function(done){
        geoipData("8.8.8.8", function(err, data){
            data.should.have.property("country_code3", "USA");
            data.should.have.property("country_name", "United States");
            data.should.have.property("continent_code", "NA");
            data.should.have.property("region", "CA");
            data.should.have.property("city", "Mountain View");
            data.should.have.property("postal_code", "94043");
            data.should.have.property("latitude", 37.4192008972168);
            data.should.have.property("longitude", -122.05740356445312);
            done();
        });
    });
    it("should provide country for an IPv6", function(done){
        geoipData("2002:7679:b9af:db9b:ab51:501a:db4e:2d", function(err, data){
            data.should.have.property("country_code", "CN");
            data.should.have.property("country_code3", "CHN");
            data.should.have.property("country_name", "China");
            data.should.have.property("continent_code", "AS");
            done();
        });
    });
    it("should provide city for an IPv6", function(done){
        geoipData("2002:7679:b9af:db9b:ab51:501a:db4e:2d", function(err, data){
            data.should.have.property("country_code3", "CHN");
            data.should.have.property("country_name", "China");
            data.should.have.property("continent_code", "AS");
            data.should.have.property("region", "32");
            data.should.have.property("city", "Chengdu");
            data.should.have.property("latitude", 30.66670036315918);
            data.should.have.property("longitude", 104.06670379638672);
            done();
        });
    });
    it("should return nothibg on local ip", function(done){
        geoipData("127.0.0.1", function(err, data){
            (data === null).should.be.ok;
            done();
        });
    });
    it("should return nothibg on local ip", function(done){
        geoipData("10.0.0.1", function(err, data){
            (data === null).should.be.ok;
            done();
        });
    });
});


text:
"""
This module contains convenience functions for retrieving solar system
ephemerides from jplephem.
"""

from urllib.parse import urlparse
import os.path

import numpy as np
import erfa

from .sky_coordinate import SkyCoord
from astropy.utils.data import download_file
from astropy.utils.decorators import classproperty, deprecated
from astropy.utils.state import ScienceState
from astropy.utils import indent
from astropy import units as u
from astropy.constants import c as speed_of_light
from .representation import CartesianRepresentation, CartesianDifferential
from .orbital_elements import calc_moon
from .builtin_frames import GCRS, ICRS, ITRS, TETE
from .builtin_frames.utils import get_jd12

__all__ = ["get_body", "get_moon", "get_body_barycentric",
           "get_body_barycentric_posvel", "solar_system_ephemeris"]

DEFAULT_JPL_EPHEMERIS = 'de430'

"""List of kernel pairs needed to calculate positions of a given object."""
BODY_NAME_TO_KERNEL_SPEC = {
    'sun': [(0, 10)],
    'mercury': [(0, 1), (1, 199)],
    'venus': [(0, 2), (2, 299)],
    'earth-moon-barycenter': [(0, 3)],
    'earth': [(0, 3), (3, 399)],
    'moon': [(0, 3), (3, 301)],
    'mars': [(0, 4)],
    'jupiter': [(0, 5)],
    'saturn': [(0, 6)],
    'uranus': [(0, 7)],
    'neptune': [(0, 8)],
    'pluto': [(0, 9)],
}

"""Indices to the plan94 routine for the given object."""
PLAN94_BODY_NAME_TO_PLANET_INDEX = {
    'mercury': 1,
    'venus': 2,
    'earth-moon-barycenter': 3,
    'mars': 4,
    'jupiter': 5,
    'saturn': 6,
    'uranus': 7,
    'neptune': 8,
}

_EPHEMERIS_NOTE = """
You can either give an explicit ephemeris or use a default, which is normally
a built-in ephemeris that does not require ephemeris files.  To change
the default to be the JPL ephemeris::

    >>> from astropy.coordinates import solar_system_ephemeris
    >>> solar_system_ephemeris.set('jpl')  # doctest: +SKIP

Use of any JPL ephemeris requires the jplephem package
(https://pypi.org/project/jplephem/).
If needed, the ephemeris file will be downloaded (and cached).

One can check which bodies are covered by a given ephemeris using::

    >>> solar_system_ephemeris.bodies
    ('earth', 'sun', 'moon', 'mercury', 'venus', 'earth-moon-barycenter', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune')
"""[1:-1]

class solar_system_ephemeris(ScienceState):
    """Default ephemerides for calculating positions of Solar-System bodies.

    This can be one of the following::

    - 'builtin': polynomial approximations to the orbital elements.
    - 'de430' or 'de432s': short-cuts for recent JPL dynamical models.
    - 'jpl': Alias for the default JPL ephemeris (currently, 'de430').
    - URL: (str) The url to a SPK ephemeris in SPICE binary (.bsp) format.
    - PATH: (str) File path to a SPK ephemeris in SPICE binary (.bsp) format.
    - `None`: Ensure an Exception is raised without an explicit ephemeris.

    The default is 'builtin', which uses the ``epv00`` and ``plan94``
    routines from the ``erfa`` implementation of the Standards Of Fundamental
    Astronomy library.

    Notes
    -----
    Any file required will be downloaded (and cached) when the state is set.
    The default Satellite Planet Kernel (SPK) file from NASA JPL (de430) is
    ~120MB, and covers years ~1550-2650 CE [1]_.  The smaller de432s file is
    ~10MB, and covers years 1950-2050 [2]_.  Older versions of the JPL
    ephemerides (such as the widely used de200) can be used via their URL [3]_.

    .. [1] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de430-de431.txt
    .. [2] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de432s.txt
    .. [3] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/a_old_versions/
    """
    _value = 'builtin'
    _kernel = None

    @classmethod
    def validate(cls, value):
        # make no changes if value is None
        if value is None:
            return cls._value
        # Set up Kernel; if the file is not in cache, this will download it.
        cls.get_kernel(value)
        return value

    @classmethod
    def get_kernel(cls, value):
        # ScienceState only ensures the `_value` attribute is up to date,
        # so we need to be sure any kernel returned is consistent.
        if cls._kernel is None or cls._kernel.origin != value:
            if cls._kernel is not None:
                cls._kernel.daf.file.close()
                cls._kernel = None
            kernel = _get_kernel(value)
            if kernel is not None:
                kernel.origin = value
            cls._kernel = kernel
        return cls._kernel

    @classproperty
    def kernel(cls):
        return cls.get_kernel(cls._value)

    @classproperty
    def bodies(cls):
        if cls._value is None:
            return None
        if cls._value.lower() == 'builtin':
            return (('earth', 'sun', 'moon') +
                    tuple(PLAN94_BODY_NAME_TO_PLANET_INDEX.keys()))
        else:
            return tuple(BODY_NAME_TO_KERNEL_SPEC.keys())

def _get_kernel(value):
    """
    Try importing jplephem, download/retrieve from cache the Satellite Planet
    Kernel corresponding to the given ephemeris.
    """
    if value is None or value.lower() == 'builtin':
        return None

    try:
        from jplephem.spk import SPK
    except ImportError:
        raise ImportError("Solar system JPL ephemeris calculations require "
                          "the jplephem package "
                          "(https://pypi.org/project/jplephem/)")

    if value.lower() == 'jpl':
        value = DEFAULT_JPL_EPHEMERIS

    if value.lower() in ('de430', 'de432s'):
        value = ('https://naif.jpl.nasa.gov/pub/naif/generic_kernels'
                 '/spk/planets/{:s}.bsp'.format(value.lower()))

    elif os.path.isfile(value):
        return SPK.open(value)

    else:
        try:
            urlparse(value)
        except Exception:
            raise ValueError('{} was not one of the standard strings and '
                             'could not be parsed as a file path or URL'.format(value))

    return SPK.open(download_file(value, cache=True))

def _get_body_barycentric_posvel(body, time, ephemeris=None,
                                 get_velocity=True):
    """Calculate the barycentric position (and velocity) of a solar system body.

    Parameters
    ----------
    body : str or other
        The solar system body for which to calculate positions.  Can also be a
        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL
        kernel.
    time : `~astropy.time.Time`
        Time of observation.
    ephemeris : str, optional
        Ephemeris to use.  By default, use the one set with
        ``astropy.coordinates.solar_system_ephemeris.set``
    get_velocity : bool, optional
        Whether or not to calculate the velocity as well as the position.

    Returns
    -------
    position : `~astropy.coordinates.CartesianRepresentation` or tuple
        Barycentric (ICRS) position or tuple of position and velocity.

    Notes
    -----
    No velocity can be calculated with the built-in ephemeris for the Moon.

    Whether or not velocities are calculated makes little difference for the
    built-in ephemerides, but for most JPL ephemeris files, the execution time
    roughly doubles.
    """

    if ephemeris is None:
        ephemeris = solar_system_ephemeris.get()
        if ephemeris is None:
            raise ValueError(_EPHEMERIS_NOTE)
        kernel = solar_system_ephemeris.kernel
    else:
        kernel = _get_kernel(ephemeris)

    jd1, jd2 = get_jd12(time, 'tdb')
    if kernel is None:
        body = body.lower()
        earth_pv_helio, earth_pv_bary = erfa.epv00(jd1, jd2)
        if body == 'earth':
            body_pv_bary = earth_pv_bary

        elif body == 'moon':
            if get_velocity:
                raise KeyError("the Moon's velocity cannot be calculated with "
                               "the '{}' ephemeris.".format(ephemeris))
            return calc_moon(time).cartesian

        else:
            sun_pv_bary = erfa.pvmpv(earth_pv_bary, earth_pv_helio)
            if body == 'sun':
                body_pv_bary = sun_pv_bary
            else:
                try:
                    body_index = PLAN94_BODY_NAME_TO_PLANET_INDEX[body]
                except KeyError:
                    raise KeyError("{}'s position and velocity cannot be "
                                   "calculated with the '{}' ephemeris."
                                   .format(body, ephemeris))
                body_pv_helio = erfa.plan94(jd1, jd2, body_index)
                body_pv_bary = erfa.pvppv(body_pv_helio, sun_pv_bary)

        body_pos_bary = CartesianRepresentation(
            body_pv_bary['p'], unit=u.au, xyz_axis=-1, copy=False)
        if get_velocity:
            body_vel_bary = CartesianRepresentation(
                body_pv_bary['v'], unit=u.au/u.day, xyz_axis=-1,
                copy=False)

    else:
        if isinstance(body, str):
            # Look up kernel chain for JPL ephemeris, based on name
            try:
                kernel_spec = BODY_NAME_TO_KERNEL_SPEC[body.lower()]
            except KeyError:
                raise KeyError("{}'s position cannot be calculated with "
                               "the {} ephemeris.".format(body, ephemeris))
        else:
            # otherwise, assume the user knows what their doing and intentionally
            # passed in a kernel chain
            kernel_spec = body

        # jplephem cannot handle multi-D arrays, so convert to 1D here.
        jd1_shape = getattr(jd1, 'shape', ())
        if len(jd1_shape) > 1:
            jd1, jd2 = jd1.ravel(), jd2.ravel()
        # Note that we use the new jd1.shape here to create a 1D result array.
        # It is reshaped below.
        body_posvel_bary = np.zeros((2 if get_velocity else 1, 3) +
                                    getattr(jd1, 'shape', ()))
        for pair in kernel_spec:
            spk = kernel[pair]
            if spk.data_type == 3:
                # Type 3 kernels contain both position and velocity.
                posvel = spk.compute(jd1, jd2)
                if get_velocity:
                    body_posvel_bary += posvel.reshape(body_posvel_bary.shape)
                else:
                    body_posvel_bary[0] += posvel[:4]
            else:
                # spk.generate first yields the position and then the
                # derivative. If no velocities are desired, body_posvel_bary
                # has only one element and thus the loop ends after a single
                # iteration, avoiding the velocity calculation.
                for body_p_or_v, p_or_v in zip(body_posvel_bary,
                                               spk.generate(jd1, jd2)):
                    body_p_or_v += p_or_v

        body_posvel_bary.shape = body_posvel_bary.shape[:2] + jd1_shape
        body_pos_bary = CartesianRepresentation(body_posvel_bary[0],
                                                unit=u.km, copy=False)
        if get_velocity:
            body_vel_bary = CartesianRepresentation(body_posvel_bary[1],
                                                    unit=u.km/u.day, copy=False)

    return (body_pos_bary, body_vel_bary) if get_velocity else body_pos_bary

def get_body_barycentric_posvel(body, time, ephemeris=None):
    """Calculate the barycentric position and velocity of a solar system body.

    Parameters
    ----------
    body : str or other
        The solar system body for which to calculate positions.  Can also be a
        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL
        kernel.
    time : `~astropy.time.Time`
        Time of observation.
    ephemeris : str, optional
        Ephemeris to use.  By default, use the one set with
        ``astropy.coordinates.solar_system_ephemeris.set``

    Returns
    -------
    position, velocity : tuple of `~astropy.coordinates.CartesianRepresentation`
        Tuple of barycentric (ICRS) position and velocity.

    See also
    --------
    get_body_barycentric : to calculate position only.
        This is faster by about a factor two for JPL kernels, but has no
        speed advantage for the built-in ephemeris.

    Notes
    -----
    The velocity cannot be calculated for the Moon.  To just get the position,
    use :func:`~astropy.coordinates.get_body_barycentric`.

    """
    return _get_body_barycentric_posvel(body, time, ephemeris)

get_body_barycentric_posvel.__doc__ += indent(_EPHEMERIS_NOTE)[4:]

def get_body_barycentric(body, time, ephemeris=None):
    """Calculate the barycentric position of a solar system body.

    Parameters
    ----------
    body : str or other
        The solar system body for which to calculate positions.  Can also be a
        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL
        kernel.
    time : `~astropy.time.Time`
        Time of observation.
    ephemeris : str, optional
        Ephemeris to use.  By default, use the one set with
        ``astropy.coordinates.solar_system_ephemeris.set``

    Returns
    -------
    position : `~astropy.coordinates.CartesianRepresentation`
        Barycentric (ICRS) position of the body in cartesian coordinates

    See also
    --------
    get_body_barycentric_posvel : to calculate both position and velocity.

    Notes
    -----
    """
    return _get_body_barycentric_posvel(body, time, ephemeris,
                                        get_velocity=False)

get_body_barycentric.__doc__ += indent(_EPHEMERIS_NOTE)[4:]

def _get_apparent_body_position(body, time, ephemeris, obsgeoloc=None):
    """Calculate the apparent position of body ``body`` relative to Earth.

    This corrects for the light-travel time to the object.

    Parameters
    ----------
    body : str or other
        The solar system body for which to calculate positions.  Can also be a
        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL
        kernel.
    time : `~astropy.time.Time`
        Time of observation.
    ephemeris : str, optional
        Ephemeris to use.  By default, use the one set with
        ``~astropy.coordinates.solar_system_ephemeris.set``
    obsgeoloc : `~astropy.coordinates.CartesianRepresentation`, optional
        The GCRS position of the observer
    Returns
    -------
    cartesian_position : `~astropy.coordinates.CartesianRepresentation`
        Barycentric (ICRS) apparent position of the body in cartesian coordinates
    """
    if ephemeris is None:
        ephemeris = solar_system_ephemeris.get()
    # builtin ephemeris and moon is a special case, with no need to account for
    # light travel time, since this is already included in the Meeus algorithm
    # used.
    if ephemeris == 'builtin' and body.lower() == 'moon':
        return get_body_barycentric(body, time, ephemeris)

    # Calculate position given approximate light travel time.
    delta_light_travel_time = 20. * u.s
    emitted_time = time
    light_travel_time = 0. * u.s
    earth_loc = get_body_barycentric('earth', time, ephemeris)
    if obsgeoloc is not None:
        earth_loc += obsgeoloc
    while np.any(np.fabs(delta_light_travel_time) > 1.0e-8*u.s):
        body_loc = get_body_barycentric(body, emitted_time, ephemeris)
        earth_distance = (body_loc - earth_loc).norm()
        delta_light_travel_time = (light_travel_time -
                                   earth_distance/speed_of_light)
        light_travel_time = earth_distance/speed_of_light
        emitted_time = time - light_travel_time

    return get_body_barycentric(body, emitted_time, ephemeris)

_get_apparent_body_position.__doc__ += indent(_EPHEMERIS_NOTE)[4:]

def get_body(body, time, location=None, ephemeris=None):
    """
    Get a `~astropy.coordinates.SkyCoord` for a solar system body as observed
    from a location on Earth in the `~astropy.coordinates.GCRS` reference
    system.

    Parameters
    ----------
    body : str or other
        The solar system body for which to calculate positions.  Can also be a
        kernel specifier (list of 2-tuples) if the ``ephemeris`` is a JPL
        kernel.
    time : `~astropy.time.Time`
        Time of observation.
    location : `~astropy.coordinates.EarthLocation`, optional
        Location of observer on the Earth.  If not given, will be taken from
        ``time`` (if not present, a geocentric observer will be assumed).
    ephemeris : str, optional
        Ephemeris to use.  If not given, use the one set with
        ``astropy.coordinates.solar_system_ephemeris.set`` (which is
        set to 'builtin' by default).

    Returns
    -------
    skycoord : `~astropy.coordinates.SkyCoord`
        GCRS Coordinate for the body

    Notes
    -----
    The coordinate returned is the apparent position, which is the position of
    the body at time *t* minus the light travel time from the *body* to the
    observing *location*.
    """
    if location is None:
        location = time.location

    if location is not None:
        obsgeoloc, obsgeovel = location.get_gcrs_posvel(time)
    else:
        obsgeoloc, obsgeovel = None, None

    cartrep = _get_apparent_body_position(body, time, ephemeris, obsgeoloc)
    icrs = ICRS(cartrep)
    gcrs = icrs.transform_to(GCRS(obstime=time,
                                  obsgeoloc=obsgeoloc,
                                  obsgeovel=obsgeovel))

    return SkyCoord(gcrs)

get_body.__doc__ += indent(_EPHEMERIS_NOTE)[4:]

def get_moon(time, location=None, ephemeris=None):
    """
    Get a `~astropy.coordinates.SkyCoord` for the Earth's Moon as observed
    from a location on Earth in the `~astropy.coordinates.GCRS` reference
    system.

    Parameters
    ----------
    time : `~astropy.time.Time`
        Time of observation
    location : `~astropy.coordinates.EarthLocation`
        Location of observer on the Earth. If none is supplied, taken from
        ``time`` (if not present, a geocentric observer will be assumed).
    ephemeris : str, optional
        Ephemeris to use.  If not given, use the one set with
        ``astropy.coordinates.solar_system_ephemeris.set`` (which is
        set to 'builtin' by default).

    Returns
    -------
    skycoord : `~astropy.coordinates.SkyCoord`
        GCRS Coordinate for the Moon

    Notes
    -----
    """

    return get_body('moon', time, location=location, ephemeris=ephemeris)

get_moon.__doc__ += indent(_EPHEMERIS_NOTE)[4:]

deprecation_msg = """
The use of _apparent_position_in_true_coordinates is deprecated because
astropy now implements a True Equator True Equinox Frame (TETE), which
should be used instead.
"""

@deprecated('4.2', deprecation_msg)
def _apparent_position_in_true_coordinates(skycoord):
    """
    Convert Skycoord in GCRS frame into one in which RA and Dec
    are defined w.r.t to the true equinox and poles of the Earth
    """
    location = getattr(skycoord, 'location', None)
    if location is None:
        gcrs_rep = skycoord.obsgeoloc.with_differentials(
            {'s': CartesianDifferential.from_cartesian(skycoord.obsgeovel)})
        location = (GCRS(gcrs_rep, obstime=skycoord.obstime)
                    .transform_to(ITRS(obstime=skycoord.obstime))
                    .earth_location)
    tete_frame = TETE(obstime=skycoord.obstime, location=location)
    return skycoord.transform_to(tete_frame)


text:
package org.session.redis.codec;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.esotericsoftware.kryo.pool.KryoFactory;
import com.esotericsoftware.kryo.pool.KryoPool;
import com.esotericsoftware.kryo.serializers.FieldSerializer;
import org.apache.catalina.session.StandardSession;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

/**
 * KryoCodec provides kryo serialization framework.
 *
 * @author sam
 * @version 1.0
 *          {@see https://github.com/EsotericSoftware/kryo}
 * @since 1.0
 */
public class KryoCodec<K, V> implements Codec<K, V> {

  /**
   * pool of kryo instances.
   */
  private KryoPool pool;

  public KryoCodec() {
    KryoFactory factory = new KryoFactory() {
      public Kryo create() {
        Kryo kryo = new Kryo();
        FieldSerializer<StandardSession> standardSessionFieldSerializer = new FieldSerializer<>(kryo, StandardSession.class);
        standardSessionFieldSerializer.setCopyTransient(true);
        kryo.register(StandardSession.class, standardSessionFieldSerializer);
        // TODO: configure kryo instance, customize settings
        return kryo;
      }
    };

    pool = new KryoPool.Builder(factory).softReferences().build();
  }

  @Override
  public Encoder<K> getKeyEncoder() {
    return new Encoder<K>() {

      @Override
      public byte[] encode(K k) {
        Kryo kryo = null;
        try {
          kryo = pool.borrow();
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          Output output = new Output(baos);
          kryo.writeClassAndObject(output, k);
          output.close();
          return baos.toByteArray();
        } catch (Exception ex) {
          throw new RuntimeException("kryo serialization of key failed", ex);
        } finally {
          pool.release(kryo);
        }
      }

    };
  }

  @Override
  public Encoder<V> getValueEncoder() {
    return new Encoder<V>() {

      @Override
      public byte[] encode(V v) {
        Kryo kryo = null;
        try {
          kryo = pool.borrow();
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          Output output = new Output(baos);
          kryo.writeClassAndObject(output, v);
          output.close();
          return baos.toByteArray();
        } catch (Exception ex) {
          throw new RuntimeException("kryo serialization of value failed", ex);
        } finally {
          pool.release(kryo);
        }
      }

    };

  }

  @Override
  public Decoder<K> getKeyDecoder() {
    return new Decoder<K>() {

      @Override
      public K decode(byte[] bytes) {
        Kryo kryo = null;
        try {
          kryo = pool.borrow();
          ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
          Input output = new Input(bais);
          K k = (K) kryo.readClassAndObject(output);
          output.close();
          return k;
        } catch (Exception ex) {
          throw new RuntimeException("kryo de-serialization of key failed", ex);
        } finally {
          pool.release(kryo);
        }
      }

    };
  }

  @Override
  public Decoder<V> getValueDecoder() {
    return new Decoder<V>() {

      @Override
      public V decode(byte[] bytes) {
        Kryo kryo = null;
        try {
          kryo = pool.borrow();
          ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
          Input output = new Input(bais);
          V v = (V) kryo.readClassAndObject(output);
          output.close();
          return v;
        } catch (Exception ex) {
          throw new RuntimeException("kryo de-serialization of value failed", ex);
        } finally {
          pool.release(kryo);
        }
      }

    };
  }
}


text:
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using System.Drawing;
/// <summary>
/// Special button that shows a description when the mouse is over it
/// </summary>
/// <remarks>the button should be large enough to fit the whole description</remarks>
public class DescButton : Control
{
	//NM = Dont show
	//shared
		//NM
	private static uint Count = 0;
	//back
	private Font _BackFont;
	private string _BackText;
	private Color _BackColor;
	private Color _BackForeColor;
	//front
	private Font _FrontFont;
	private string _FrontText;
	private Color _FrontColor;
	private Color _FrontForeColor;
	//misc
	private int _BorderWidth;
	//objs:
	private Panel withEventsField__BackPanel;
	private Panel _BackPanel {
		get { return withEventsField__BackPanel; }
		set {
			if (withEventsField__BackPanel != null) {
				withEventsField__BackPanel.MouseDown -= MouseDown;
				withEventsField__BackPanel.MouseUp -= MouseUp;
				withEventsField__BackPanel.MouseLeave -= MouseLeave;
				withEventsField__BackPanel.Click -= OnClick;
			}
			withEventsField__BackPanel = value;
			if (withEventsField__BackPanel != null) {
				withEventsField__BackPanel.MouseDown += MouseDown;
				withEventsField__BackPanel.MouseUp += MouseUp;
				withEventsField__BackPanel.MouseLeave += MouseLeave;
				withEventsField__BackPanel.Click += OnClick;
			}
		}
		//NM
	}
	private Panel withEventsField__FrontPanel;
	private Panel _FrontPanel {
		get { return withEventsField__FrontPanel; }
		set {
			if (withEventsField__FrontPanel != null) {
				withEventsField__FrontPanel.MouseDown -= MouseDown;
				withEventsField__FrontPanel.MouseUp -= MouseUp;
				withEventsField__FrontPanel.MouseEnter -= MouseEnter;
				withEventsField__FrontPanel.Click -= OnClick;
			}
			withEventsField__FrontPanel = value;
			if (withEventsField__FrontPanel != null) {
				withEventsField__FrontPanel.MouseDown += MouseDown;
				withEventsField__FrontPanel.MouseUp += MouseUp;
				withEventsField__FrontPanel.MouseEnter += MouseEnter;
				withEventsField__FrontPanel.Click += OnClick;
			}
		}
		//NM
	}
	private Label withEventsField__BackLabel;
	private Label _BackLabel {
		get { return withEventsField__BackLabel; }
		set {
			if (withEventsField__BackLabel != null) {
				withEventsField__BackLabel.MouseDown -= MouseDown;
				withEventsField__BackLabel.MouseUp -= MouseUp;
				withEventsField__BackLabel.MouseLeave -= MouseLeave;
				withEventsField__BackLabel.Click -= OnClick;
			}
			withEventsField__BackLabel = value;
			if (withEventsField__BackLabel != null) {
				withEventsField__BackLabel.MouseDown += MouseDown;
				withEventsField__BackLabel.MouseUp += MouseUp;
				withEventsField__BackLabel.MouseLeave += MouseLeave;
				withEventsField__BackLabel.Click += OnClick;
			}
		}
		//NM
	}
	private Label withEventsField__FrontLabel;
	private Label _FrontLabel {
		get { return withEventsField__FrontLabel; }
		set {
			if (withEventsField__FrontLabel != null) {
				withEventsField__FrontLabel.MouseDown -= MouseDown;
				withEventsField__FrontLabel.MouseUp -= MouseUp;
				withEventsField__FrontLabel.MouseEnter -= MouseEnter;
				withEventsField__FrontLabel.Click -= OnClick;
			}
			withEventsField__FrontLabel = value;
			if (withEventsField__FrontLabel != null) {
				withEventsField__FrontLabel.MouseDown += MouseDown;
				withEventsField__FrontLabel.MouseUp += MouseUp;
				withEventsField__FrontLabel.MouseEnter += MouseEnter;
				withEventsField__FrontLabel.Click += OnClick;
			}
		}
		//NM
	}
	//general:
	private Timer withEventsField__timer;
	private Timer _timer {
		get { return withEventsField__timer; }
		set {
			if (withEventsField__timer != null) {
				withEventsField__timer.Tick -= TimerTick;
			}
			withEventsField__timer = value;
			if (withEventsField__timer != null) {
				withEventsField__timer.Tick += TimerTick;
			}
		}
		//NM
	}
	private bool _over;

	private int _velocity;
	public DescButton() : base()
	{
		updateVelocity();
		Count += 1;
		this.Name = "DescButton" + Count;
		_BackColor = Color.Black;
		_BackText = "Description" + Count;
		_BackFont = this.Font;
		_BackForeColor = Color.White;
		_FrontText = "DescButton" + Count;
		_FrontFont = this.Font;
		_FrontForeColor = this.ForeColor;
		_FrontColor = this.BackColor;
		_over = false;
		_timer = new Timer { Interval = 1 };
		_BorderWidth = 1;
		Size tSize = TextRenderer.MeasureText(_FrontText, _FrontFont);
		_BackPanel = new Panel {
			Size = this.Size,
			BackColor = _BackColor,
			Location = new Point(0, 0)
		};
		_BackLabel = new Label {
			Font = _BackFont,
			AutoSize = false,
			ForeColor = _BackForeColor,
			TextAlign = ContentAlignment.MiddleCenter,
			Size = new Size(_BackPanel.Width - _BorderWidth * 2, _BackPanel.Height - tSize.Height),
			Location = new Point(_BorderWidth, tSize.Height + 1),
			Text = _BackText
		};
		_BackPanel.Controls.Add(_BackLabel);
		_FrontPanel = new Panel {
			Size = new Size(this.Size.Width - _BorderWidth * 2, this.Size.Height - _BorderWidth * 2),
			BackColor = _FrontColor,
			Location = new Point(1, 1)
		};
		_FrontLabel = new Label {
			Font = _FrontFont,
			AutoSize = true,
			ForeColor = _FrontForeColor,
			Location = new Point((_FrontPanel.Width - tSize.Width) / 2, (_FrontPanel.Height - tSize.Height) / 2)
		};
		_FrontPanel.Controls.Add(_FrontLabel);
		this.Controls.AddRange({
			_FrontPanel,
			_BackPanel
		});
	}

	protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
	{
		base.OnPaint(e);
		Size tSize = TextRenderer.MeasureText(_FrontText, _FrontFont);
		//BACK
		_BackPanel.Size = this.Size;
		_BackPanel.BackColor = _BackColor;
		_BackLabel.Font = _BackFont;
		_BackLabel.Text = _BackText;
		_BackLabel.ForeColor = _BackForeColor;
		//FRONT
		_FrontPanel.Size = new Size(_BackPanel.Size.Width - _BorderWidth * 2, _BackPanel.Size.Height - _BorderWidth * 2);
		_FrontPanel.Location = new Point(_BorderWidth, _BorderWidth);
		_FrontPanel.BackColor = this.BackColor;
		_FrontLabel.Font = _FrontFont;
		_FrontLabel.Text = _FrontText;
		_FrontLabel.ForeColor = this.ForeColor;
		_FrontLabel.Location = new Point((_FrontPanel.Width - tSize.Width) / 2, (_FrontPanel.Height - tSize.Height) / 2);

		_BackLabel.Location = new Point(_BorderWidth, tSize.Height + 1);
		_BackLabel.Size = new Size(_BackPanel.Width - _BorderWidth * 2, _BackPanel.Height - tSize.Height - _BorderWidth);
	}

	public new void MouseDown(object sender, EventArgs e)
	{
		_BackPanel.BackColor = Color.FromArgb(255, Convert.ToInt32(_BackColor.R / 2), Convert.ToInt32(_BackColor.G / 2), Convert.ToInt32(_BackColor.B / 2));
		_FrontLabel.ForeColor = Color.FromArgb(255, Convert.ToInt32(_FrontForeColor.R / 2), Convert.ToInt32(_FrontForeColor.G / 2), Convert.ToInt32(_FrontForeColor.B / 2));
		base.OnMouseDown(e);
	}

	public new void MouseUp(object sender, EventArgs e)
	{
		_BackPanel.BackColor = _BackColor;
		_FrontLabel.ForeColor = _FrontForeColor;
		base.OnMouseUp(e);
	}

	public new void MouseEnter(object sender, EventArgs e)
	{
		_over = true;
		_timer.Start();
	}

	public new void MouseLeave(object sender, EventArgs e)
	{
		_over = false;
		_timer.Start();
	}

	public new void OnClick(object sender, EventArgs e)
	{
		base.OnClick(e);
	}

	protected override void OnResize(System.EventArgs e)
	{
		updateVelocity();
		base.OnResize(e);
	}

	private void TimerTick(Timer sender, EventArgs e)
	{
		if (_over) {
			if (_FrontLabel.Top > 0) {
				_FrontPanel.Height -= _velocity;
				_FrontLabel.Top -= Convert.ToInt32(_velocity / 2);
			} else {
				_FrontLabel.Top = 0;
				_FrontPanel.Height = _FrontLabel.Height + 1;
				sender.Stop();
			}
		} else {
			if (_FrontPanel.Height < _BackPanel.Height) {
				_FrontPanel.Height += _velocity;
				_FrontLabel.Top += Convert.ToInt32(_velocity / 2);
			} else {
				_FrontPanel.Height = _BackPanel.Height - _BorderWidth * 2;
				_FrontLabel.Top = (_FrontPanel.Height - _FrontLabel.Height) / 2;
				sender.Stop();
			}
		}
	}

	private void updateVelocity()
	{
		this._velocity = Convert.ToInt32(this.Height / 20);
	}

	public int BorderWidth {
		get { return _BorderWidth; }
		set {
			if (value > 0) {
				if (value != _BorderWidth) {
					_BorderWidth = value;
					this.Invalidate();
				}
			} else {
				_BorderWidth = 1;
			}
		}
	}
	//All properties that starts with:
	// BACK = are properties that modify the back part of the control (the description text, color, forecolor)
	// FRONT = are properties that modify the front part of the control (title text, color, forecolor)
	public Color BackGColor {
		get { return _BackColor; }
		set {
			_BackColor = value;
			_BackPanel.BackColor = _BackColor;
		}
	}

	public string BackText {
		get { return _BackText; }
		set {
			_BackText = value;
			_BackLabel.Text = _BackText;
		}
	}

	public Font BackFont {
		get { return _BackFont; }
		set {
			_BackFont = value;
			_BackLabel.Font = value;
		}
	}

	public Color BackForeColor {
		get { return _BackForeColor; }
		set {
			_BackForeColor = value;
			_BackLabel.ForeColor = value;
		}
	}

	public Color FrontColor {
		get { return _FrontColor; }
		set {
			_FrontColor = value;
			this.BackColor = value;
			_FrontPanel.BackColor = value;
		}
	}

	public string FrontText {
		get { return _FrontText; }
		set {
			_FrontText = value;
			this.Text = value;
			_FrontLabel.Text = _FrontText;
			CenterLabel(_FrontLabel);
		}
	}

	public Font FrontFont {
		get { return _FrontFont; }
		set {
			_FrontFont = value;
			_FrontLabel.Font = _FrontFont;
			CenterLabel(_FrontLabel);
		}
	}

	public Color FrontForeColor {
		get { return _FrontForeColor; }
		set {
			_FrontForeColor = value;
			this.ForeColor = value;
			_FrontLabel.ForeColor = value;
		}
	}

	private void CenterLabel(Label lbl)
	{
		Size tSize = TextRenderer.MeasureText(lbl.Text, lbl.Font);
		lbl.Location = new Point((lbl.Parent.Width - tSize.Width) / 2, (lbl.Parent.Height - tSize.Height) / 2);
	}

	protected override void Dispose(bool disposing)
	{
		base.Dispose(disposing);
	}
}

//=======================================================
//Service provided by Telerik (www.telerik.com)
//Conversion powered by NRefactory.
//Twitter: @telerik
//Facebook: facebook.com/telerik
//=======================================================


text:
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../bower_components/marked-element/marked-element.html">
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/paper-styles/color.html">
<link rel="import" href="../../bower_components/paper-tooltip/paper-tooltip.html">

<dom-module id="tve-status-indicator">

<template>
<style include="iron-flex"></style>

<style>
:host {
    display: inline;
}

.correct {
    color: var(--paper-green-500);
}

.incorrect {
    color: var(--paper-red-500);
}

.warning {
    color: var(--paper-amber-500);

}
</style>

<span hidden$="{{!_showCorrect(status)}}">
    <iron-icon class="correct" id="correct" icon="check-circle"></iron-icon>
    <paper-tooltip for="correct">Korrekt</paper-tooltip>
</span>
<span hidden$="{{!_showIncorrect(status)}}">
    <iron-icon class="incorrect" id="incorrect" icon="remove-circle"></iron-icon>
    <paper-tooltip for="incorrect">Svaret er forkert</paper-tooltip>
</span>
<span hidden$="{{!_showWarning(status)}}">
    <iron-icon class="warning" id="warning" icon="warning"></iron-icon>
    <paper-tooltip for="warning">Dette felt mangler information</paper-tooltip>
</span>

</template>

<script>
Polymer({
    is: 'tve-status-indicator',
    properties: {
        status: {
            type: String,
            value: ""
        }
    },
    _showCorrect: function(status) {
        return status === "correct";
    },
    _showIncorrect: function(status) {
        return status === "incorrect";
    },
    _showWarning: function(status) {
        return status === "warning";
    }
});
</script>
</dom-module>


text:
import { Query, Mutation, Schema, schemaFactory, Subscription } from 'graphql-schema-decorator';
import UserQuery from './user.query';
import UserMutation from './user.mutation';
import UserSubscription from './user.subscription';

@Schema()
class RootSchema {
	@Query()
	UserQuery: UserQuery;

	@Mutation()
	UserMutation: UserMutation;

	@Subscription()
	UserSubscription: UserSubscription;
}

const schema = schemaFactory(RootSchema);

export default schema;


text:
package roadtodoird.com.uploader.Models;

import android.net.Uri;

import java.io.Serializable;

/**
 * Created by misterj on 19/1/16.
 */
public class FIleInfo implements Serializable {
    private String fileName;
    private Integer fileSize;
    private String mimeType;
    private Uri fileURI;
    private Long serverFileID;

    public FIleInfo(String name, Integer size, String mimeType) {
        this.fileName = name;
        this.fileSize = size;
        this.mimeType = mimeType;
    }

    public void setFileLocalPath(Uri uri) {
        this.fileURI = uri;
    }

    public void setServerFileID(Long id) {
        this.serverFileID = id;
    }

    public String getFileName() {
        return this.fileName;
    }

    public Integer getFileSize() {
        return this.fileSize;
    }

    public String getMimeType() {
        return this.mimeType;
    }

    public Uri getFileURI() {
        return this.fileURI;
    }

    public Long getServerFileID() {
        return this.serverFileID;
    }

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

}


text:
Quick Start
===========
The easiest way to get started quickly with DeepForge is using docker-compose. First, install `docker <https://docs.docker.com/engine/installation/>`_ and `docker-compose <https://docs.docker.com/compose/install/>`_.

Next, download the docker-compose file for DeepForge:

.. code-block:: bash

    wget https://raw.githubusercontent.com/deepforge-dev/deepforge/master/docker-compose.yml

Then start DeepForge using docker-compose:

.. code-block:: bash

    docker-compose up

and now DeepForge can be used by opening a browser to `http://localhost:8888 <http://localhost:8888>`_!

For detailed instructions about deployment installations, check out our `deployment installation instructions <getting_started/configuration.rst>`_


text:
<!DOCTYPE html>

  <title>{% block title %}{% endblock %}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <link rel="stylesheet" href="{{ asset_url('server.css') }}">

  <link rel="icon" type="image/png" sizes="32x32" href="/static/images/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="96x96" href="/static/images/favicon-96x96.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/static/images/favicon-16x16.png">

      {% if not hide_page_header %}

{{ self.title() }}

      {% endif %}

    {% block content %}{% endblock %}

{% block scripts %}{% endblock %}

{% include '_includes/signed_out_tail.html' %}


text:
{-# LANGUAGE TupleSections, MultiParamTypeClasses  #-}
module Language.PiEtaEpsilon.Parser.Term where
import Language.PiEtaEpsilon.Parser.Classes
import Language.PiEtaEpsilon.Token
import Language.PiEtaEpsilon.Syntax
import Text.Parsec
import Text.Parsec.Expr
import Control.Monad.Reader
import Prelude hiding (negate, Left, Right)
import Language.PiEtaEpsilon.BNFMeta.Value hiding (Value)
import qualified Language.PiEtaEpsilon.BNFMeta.Term as M
import Data.Functor.Fixedpoint
import qualified Language.LBNF.Grammar as G
import Language.Haskell.TH.Quote
import Control.Monad

parseTerm = M.pTerm . M.myLexer

instance To M.Term Term where
    to (M.TBase          x) = Base     (to x)
    to (M.TId             ) = Id -- I could also make a To Ident String instance
    to (M.TCompose     x y) = (to x) ::: (to y)
    to (M.TPlus        x y) = (to x) :+: (to y)
    to (M.TTimes       x y) = (to x) :*: (to y)

instance To M.Iso Iso where
    to (M.IEliminate x) = Eliminate (to x)
    to (M.IIntroduce x) = Introduce (to x)

instance To M.BaseIso IsoBase where
    to M.BIdentityS        = IdentityS
    to M.BIdentityP        = IdentityP
    to M.BCommutativeS     = CommutativeS
    to M.BCommutativeP     = CommutativeP
    to M.BAssociativeS     = AssociativeS
    to M.BAssociativeP     = AssociativeP
    to M.BSplitS           = SplitS
    to M.BSplitP           = SplitP
    to M.BDistributiveZero = DistributiveZero
    to M.BDistributivePlus = DistributivePlus

{-
pIsoBase =  pIdentityS
        <|> pIdentityP
        <|> pCommutativeS
        <|> pCommutativeP
        <|> pAssociativeS
        <|> pAssociativeP
        <|> pSplitS
        <|> pSplitP

pIdentityS    = return IdentityS    << string "<=+=>"
pIdentityP    = return IdentityP    << string "<=*=>"
pCommutativeS = return CommutativeS << string "x+x"
pCommutativeP = return CommutativeP << string "x*x"
pAssociativeS = return AssociativeS << string "|+|+|"
pAssociativeP = return AssociativeP << string "|*|*|"
pSplitS       = return SplitS       << string ">+-"
pSplitP       = return SplitP       << string ">*-"

pIso =  pEliminate
    <|> pIntroduce

pEliminate = (return . Eliminate) =<< pIsoBase << spaces << string "#"
pIntroduce = (return . Introduce) =<< pIsoBase << spaces << string "'"

pTerm =  pIsoBase
	 <|> pId
	 <|> pCompose
	 <|> pPlus
	 <|> pTimes

pIsoBase = (return . Base) =<< pIso << spaces << string "<"
pId      = return Id << string "<=>"
binaryTerm term token = do
    l <- expr
    spaces
    string token
    spaces
    r <- expr
    return $ term l r

pCompose = binaryTerm Compose "."
pPlus    = binaryTerm Plus    "+"
pTimes   = binaryTerm Plus    "*"

expr = parens pTerm <|> pTerm
-}


text:
import types
import socket
import xmlrpclib
import httplib
import urllib
import re
from cStringIO import StringIO
import traceback
import sys

from supervisor.medusa.http_server import get_header
from supervisor.medusa.xmlrpc_handler import xmlrpc_handler
from supervisor.medusa import producers

from supervisor.http import NOT_DONE_YET

class Faults:
    UNKNOWN_METHOD = 1
    INCORRECT_PARAMETERS = 2
    BAD_ARGUMENTS = 3
    SIGNATURE_UNSUPPORTED = 4
    SHUTDOWN_STATE = 6
    BAD_NAME = 10
    NO_FILE = 20
    NOT_EXECUTABLE = 21
    FAILED = 30
    ABNORMAL_TERMINATION = 40
    SPAWN_ERROR = 50
    ALREADY_STARTED = 60
    NOT_RUNNING = 70
    SUCCESS = 80
    ALREADY_ADDED = 90
    STILL_RUNNING = 91
    CANT_REREAD = 92

def getFaultDescription(code):
    for faultname in Faults.__dict__:
        if getattr(Faults, faultname) == code:
            return faultname
    return 'UNKNOWN'

class RPCError(Exception):
    def __init__(self, code, extra=None):
        self.code = code
        self.text = getFaultDescription(code)
        if extra is not None:
            self.text = '%s: %s' % (self.text, extra)

class DeferredXMLRPCResponse:
    """ A medusa producer that implements a deferred callback; requires
    a subclass of asynchat.async_chat that handles NOT_DONE_YET sentinel """
    CONNECTION = re.compile ('Connection: (.*)', re.IGNORECASE)

    def __init__(self, request, callback):
        self.callback = callback
        self.request = request
        self.finished = False
        self.delay = float(callback.delay)

    def more(self):
        if self.finished:
            return ''
        try:
            try:
                value = self.callback()
                if value is NOT_DONE_YET:
                    return NOT_DONE_YET
            except RPCError, err:
                value = xmlrpclib.Fault(err.code, err.text)

            body = xmlrpc_marshal(value)

            self.finished = True

            return self.getresponse(body)

        except:
            # report unexpected exception back to server
            traceback.print_exc()
            self.finished = True
            self.request.error(500)

    def getresponse(self, body):
        self.request['Content-Type'] = 'text/xml'
        self.request['Content-Length'] = len(body)
        self.request.push(body)
        connection = get_header(self.CONNECTION, self.request.header)

        close_it = 0
        wrap_in_chunking = 0

        if self.request.version == '1.0':
            if connection == 'keep-alive':
                if not self.request.has_key ('Content-Length'):
                    close_it = 1
                else:
                    self.request['Connection'] = 'Keep-Alive'
            else:
                close_it = 1
        elif self.request.version == '1.1':
            if connection == 'close':
                close_it = 1
            elif not self.request.has_key ('Content-Length'):
                if self.request.has_key ('Transfer-Encoding'):
                    if not self.request['Transfer-Encoding'] == 'chunked':
                        close_it = 1
                elif self.request.use_chunked:
                    self.request['Transfer-Encoding'] = 'chunked'
                    wrap_in_chunking = 1
                else:
                    close_it = 1
        elif self.request.version is None:
            close_it = 1

        outgoing_header = producers.simple_producer (
            self.request.build_reply_header())

        if close_it:
            self.request['Connection'] = 'close'

        if wrap_in_chunking:
            outgoing_producer = producers.chunked_producer (
                    producers.composite_producer (self.request.outgoing)
                    )
            # prepend the header
            outgoing_producer = producers.composite_producer(
                [outgoing_header, outgoing_producer]
                )
        else:
            # prepend the header
            self.request.outgoing.insert(0, outgoing_header)
            outgoing_producer = producers.composite_producer (
                self.request.outgoing)

        # apply a few final transformations to the output
        self.request.channel.push_with_producer (
                # globbing gives us large packets
                producers.globbing_producer (
                        # hooking lets us log the number of bytes sent
                        producers.hooked_producer (
                                outgoing_producer,
                                self.request.log
                                )
                        )
                )

        self.request.channel.current_request = None

        if close_it:
            self.request.channel.close_when_done()

def xmlrpc_marshal(value):
    ismethodresponse = not isinstance(value, xmlrpclib.Fault)
    if ismethodresponse:
        if not isinstance(value, tuple):
            value = (value,)
        body = xmlrpclib.dumps(value,  methodresponse=ismethodresponse)
    else:
        body = xmlrpclib.dumps(value)
    return body

class SystemNamespaceRPCInterface:
    def __init__(self, namespaces):
        self.namespaces = {}
        for name, inst in namespaces:
            self.namespaces[name] = inst
        self.namespaces['system'] = self

    def _listMethods(self):
        methods = {}
        for ns_name in self.namespaces:
            namespace = self.namespaces[ns_name]
            for method_name in namespace.__class__.__dict__:
                # introspect; any methods that don't start with underscore
                # are published
                func = getattr(namespace, method_name)
                meth = getattr(func, 'im_func', None)
                if meth is not None:
                    if not method_name.startswith('_'):
                        sig = '%s.%s' % (ns_name, method_name)
                        methods[sig] = str(func.__doc__)
        return methods

    def listMethods(self):
        """ Return an array listing the available method names

        @return array result  An array of method names available (strings).
        """
        methods = self._listMethods()
        keys = methods.keys()
        keys.sort()
        return keys

    def methodHelp(self, name):
        """ Return a string showing the method's documentation

        @param string name   The name of the method.
        @return string result The documentation for the method name.
        """
        methods = self._listMethods()
        for methodname in methods.keys():
            if methodname == name:
                return methods[methodname]
        raise RPCError(Faults.SIGNATURE_UNSUPPORTED)

    def methodSignature(self, name):
        """ Return an array describing the method signature in the
        form [rtype, ptype, ptype...] where rtype is the return data type
        of the method, and ptypes are the parameter data types that the
        method accepts in method argument order.

        @param string name  The name of the method.
        @return array result  The result.
        """
        methods = self._listMethods()
        L = []
        for method in methods:
            if method == name:
                rtype = None
                ptypes = []
                parsed = gettags(methods[method])
                for thing in parsed:
                    if thing[1] == 'return': # tag name
                        rtype = thing[2] # datatype
                    elif thing[1] == 'param': # tag name
                        ptypes.append(thing[2]) # datatype
                if rtype is None:
                    raise RPCError(Faults.SIGNATURE_UNSUPPORTED)
                return [rtype] + ptypes
        raise RPCError(Faults.SIGNATURE_UNSUPPORTED)

    def multicall(self, calls):
        """Process an array of calls, and return an array of
        results. Calls should be structs of the form {'methodName':
        string, 'params': array}. Each result will either be a
        single-item array containg the result value, or a struct of
        the form {'faultCode': int, 'faultString': string}. This is
        useful when you need to make lots of small calls without lots
        of round trips.

        @param array calls  An array of call requests
        @return array result  An array of results
        """
        producers = []

        for call in calls:
            try:
                name = call['methodName']
                params = call.get('params', [])
                if name == 'system.multicall':
                    # Recursive system.multicall forbidden
                    raise RPCError(Faults.INCORRECT_PARAMETERS)
                root = AttrDict(self.namespaces)
                value = traverse(root, name, params)
            except RPCError, inst:
                value = {'faultCode': inst.code,
                         'faultString': inst.text}
            except:
                errmsg = "%s:%s" % (sys.exc_type, sys.exc_value)
                value = {'faultCode': 1, 'faultString': errmsg}
            producers.append(value)

        results = []

        def multiproduce():
            """ Run through all the producers in order """
            if not producers:
                return []

            callback = producers.pop(0)

            if isinstance(callback, types.FunctionType):
                try:
                    value = callback()
                except RPCError, inst:
                    value = {'faultCode':inst.code, 'faultString':inst.text}

                if value is NOT_DONE_YET:
                    # push it back in the front of the queue because we
                    # need to finish the calls in requested order
                    producers.insert(0, callback)
                    return NOT_DONE_YET
            else:
                value = callback

            results.append(value)

            if producers:
                # only finish when all producers are finished
                return NOT_DONE_YET

            return results

        multiproduce.delay = .05
        return multiproduce

class AttrDict(dict):
    # hack to make a dict's getattr equivalent to its getitem
    def __getattr__(self, name):
        return self[name]

class RootRPCInterface:
    def __init__(self, subinterfaces):
        for name, rpcinterface in subinterfaces:
            setattr(self, name, rpcinterface)

class supervisor_xmlrpc_handler(xmlrpc_handler):
    path = '/RPC2'
    IDENT = 'Supervisor XML-RPC Handler'
    def __init__(self, supervisord, subinterfaces):
        self.rpcinterface = RootRPCInterface(subinterfaces)
        self.supervisord = supervisord
        if loads:
            self.loads = loads
        else:
            self.supervisord.options.logger.warn(
                'cElementTree not installed, using slower XML parser for '
                'XML-RPC'
                )
            self.loads = xmlrpclib.loads

    def match(self, request):
        return request.uri.startswith(self.path)

    def continue_request (self, data, request):
        logger = self.supervisord.options.logger

        try:

            params, method = self.loads(data)

            # no <methodName> in the request or name is an empty string
            if not method:
                logger.trace('XML-RPC request received with no method name')
                request.error(400)
                return

            # we allow xml-rpc clients that do not send empty <params>
            # when there are no parameters for the method call
            if params is None:
                params = ()

            try:
                logger.trace('XML-RPC method called: %s()' % method)
                value = self.call(method, params)
                # application-specific: instead of we never want to
                # marshal None (even though we could by saying allow_none=True
                # in dumps within xmlrpc_marshall), this is meant as
                # a debugging fixture, see issue 223.
                assert value is not None, (
                    'return value from method %r with params %r is None' %
                    (method, params)
                    )
                logger.trace('XML-RPC method %s() returned successfully' %
                             method)
            except RPCError, err:
                # turn RPCError reported by method into a Fault instance
                value = xmlrpclib.Fault(err.code, err.text)
                logger.trace('XML-RPC method %s() returned fault: [%d] %s' % (
                    method,
                    err.code, err.text))

            if isinstance(value, types.FunctionType):
                # returning a function from an RPC method implies that
                # this needs to be a deferred response (it needs to block).
                pushproducer = request.channel.push_with_producer
                pushproducer(DeferredXMLRPCResponse(request, value))

            else:
                # if we get anything but a function, it implies that this
                # response doesn't need to be deferred, we can service it
                # right away.
                body = xmlrpc_marshal(value)
                request['Content-Type'] = 'text/xml'
                request['Content-Length'] = len(body)
                request.push(body)
                request.done()

        except:
            io = StringIO()
            traceback.print_exc(file=io)
            val = io.getvalue()
            logger.critical(val)
            # internal error, report as HTTP server error
            request.error(500)

    def call(self, method, params):
        return traverse(self.rpcinterface, method, params)

def traverse(ob, method, params):
    path = method.split('.')
    for name in path:
        if name.startswith('_'):
            # security (don't allow things that start with an underscore to
            # be called remotely)
            raise RPCError(Faults.UNKNOWN_METHOD)
        ob = getattr(ob, name, None)
        if ob is None:
            raise RPCError(Faults.UNKNOWN_METHOD)

    try:
        return ob(*params)
    except TypeError:
        raise RPCError(Faults.INCORRECT_PARAMETERS)

class SupervisorTransport(xmlrpclib.Transport):
    """
    Provides a Transport for xmlrpclib that uses
    httplib.HTTPConnection in order to support persistent
    connections.  Also support basic auth and UNIX domain socket
    servers.
    """
    connection = None

    _use_datetime = 0 # python 2.5 fwd compatibility
    def __init__(self, username=None, password=None, serverurl=None):
        self.username = username
        self.password = password
        self.verbose = False
        self.serverurl = serverurl
        if serverurl.startswith('http://'):
            type, uri = urllib.splittype(serverurl)
            host, path = urllib.splithost(uri)
            host, port = urllib.splitport(host)
            if port is None:
                port = 80
            else:
                port = int(port)
            def get_connection(host=host, port=port):
                return httplib.HTTPConnection(host, port)
            self._get_connection = get_connection
        elif serverurl.startswith('unix://'):
            def get_connection(serverurl=serverurl):
                # we use 'localhost' here because domain names must be
                # < 64 chars (or we'd use the serverurl filename)
                conn = UnixStreamHTTPConnection('localhost')
                conn.socketfile = serverurl[7:]
                return conn
            self._get_connection = get_connection
        else:
            raise ValueError('Unknown protocol for serverurl %s' % serverurl)

    def request(self, host, handler, request_body, verbose=0):
        if not self.connection:
            self.connection = self._get_connection()
            self.headers = {
                "User-Agent" : self.user_agent,
                "Content-Type" : "text/xml",
                "Accept": "text/xml"
                }

            # basic auth
            if self.username is not None and self.password is not None:
                unencoded = "%s:%s" % (self.username, self.password)
                encoded = unencoded.encode('base64')
                encoded = encoded.replace('\012', '')
                self.headers["Authorization"] = "Basic %s" % encoded

        self.headers["Content-Length"] = str(len(request_body))

        self.connection.request('POST', handler, request_body, self.headers)

        r = self.connection.getresponse()

        if r.status != 200:
            self.connection.close()
            self.connection = None
            raise xmlrpclib.ProtocolError(host + handler,
                                          r.status,
                                          r.reason,
                                          '' )
        data = r.read()
        p, u = self.getparser()
        p.feed(data)
        p.close()
        return u.close()

class UnixStreamHTTPConnection(httplib.HTTPConnection):
    def connect(self):
        self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        # we abuse the host parameter as the socketname
        self.sock.connect(self.socketfile)

def gettags(comment):
    """ Parse documentation strings into JavaDoc-like tokens """

    tags = []

    tag = None
    datatype = None
    name = None
    tag_lineno = lineno = 0
    tag_text = []

    for line in comment.split('\n'):
        line = line.strip()
        if line.startswith("@"):
            tags.append((tag_lineno, tag, datatype, name, '\n'.join(tag_text)))
            parts = line.split(None, 3)
            if len(parts) == 1:
                datatype = ''
                name = ''
                tag_text = []
            elif len(parts) == 2:
                datatype = parts[1]
                name = ''
                tag_text = []
            elif len(parts) == 3:
                datatype = parts[1]
                name = parts[2]
                tag_text = []
            elif len(parts) == 4:
                datatype = parts[1]
                name = parts[2]
                tag_text = [parts[3].lstrip()]
            tag = parts[0][1:]
            tag_lineno = lineno
        else:
            if line:
                tag_text.append(line)
        lineno = lineno + 1

    tags.append((tag_lineno, tag, datatype, name, '\n'.join(tag_text)))

    return tags

try:
    # Python 2.6 contains a version of cElementTree inside it.
    from xml.etree.ElementTree import iterparse
except ImportError:
    try:
        # Failing that, try cElementTree instead.
        from cElementTree import iterparse
    except ImportError:
        iterparse = None

if iterparse is not None:
    import datetime, time
    from base64 import decodestring

    def make_datetime(text):
        return datetime.datetime(
            *time.strptime(text, "%Y%m%dT%H:%M:%S")[:6]
        )

    unmarshallers = {
        "int": lambda x: int(x.text),
        "i4": lambda x: int(x.text),
        "boolean": lambda x: x.text == "1",
        "string": lambda x: x.text or "",
        "double": lambda x: float(x.text),
        "dateTime.iso8601": lambda x: make_datetime(x.text),
        "array": lambda x: [v.text for v in x],
        "data": lambda x: x[0].text,
        "struct": lambda x: dict([(k.text or "", v.text) for k, v in x]),
        "base64": lambda x: decodestring(x.text or ""),
        "value": lambda x: x[0].text,
        "param": lambda x: x[0].text,
    }

    def loads(data):
        params = method = None
        for action, elem in iterparse(StringIO(data)):
            unmarshal = unmarshallers.get(elem.tag)
            if unmarshal:
                data = unmarshal(elem)
                elem.clear()
                elem.text = data
            elif elem.tag == "methodName":
                method = elem.text
            elif elem.tag == "params":
                params = tuple([v.text for v in elem])
        return params, method
else:
    loads = None


text:
BASEDIR = $(shell pwd)
PROJECT=scaler-attempt
BUCKET = $(PROJECT)-bucket
PORT_API=8080

env:
	gcloud config set project $(PROJECT)

bucket:
	gsutil mb gs://$(BUCKET)

clean.bucket:
	gsutil rm -rf gs://$(BUCKET)
	gsutil rb gs://$(BUCKET)

clean.files:
	-gsutil rm -rf gs://$(BUCKET)/uploads/*
	-gsutil rm -rf gs://$(BUCKET)/processed/*

test.files: clean.files
	gsutil cp function/ColtReto.png gs://$(BUCKET)/uploads/ColtReto.png

test.duplicate:
	gsutil cp function/ColtReto.png gs://$(BUCKET)/uploads/ColtReto.png

cleanapi:
	-docker stop scaler-goapi
	-docker rm scaler-goapi

api: cleanapi
	cd app && docker build -t scaler-goapi .
	docker run --name scaler-goapi --expose $(PORT_API) \
	-p $(PORT_API):$(PORT_API)  -e PORT=$(PORT_API) -e BUCKET=$(BUCKET) \
	-e GOOGLE_APPLICATION_CREDENTIALS=creds/creds.json -d scaler-goapi
	docker logs scaler-goapi


text:
- 1/2 cup diced strawberries
- 3 egg yolks
- 3 tablespoons white sugar
- 1/4 cup dry marsala wine
- zest of 1 orange

## Instructions

1. Place strawberries in a bowl with 1-2 teaspoons of sugar. Stir occasionally until syrup forms, about 30 minutes.
2. Combine eggs, sugar, and wine in a large metal mixing bowl.
3. Place bowl over low heat and whisk continuously until thick, about 10 minutes.
4. Remove from heat and whisk in orange zest.
5. Portion strawberries into the bottoms of 2 dessert cups. Spoon zabaione on top.


text:
//*******************************{begin:header}******************************//
//                 spssio - http://code.google.com/p/spssio/                 //
//***************************************************************************//
//
//      Java classes for reading and writing
//      SPSS/PSPP Portable and System files
//
//      Copyright (C) 2013 Jani Hautamaki <jani.hautamaki@hotmail.com>
//
//      Licensed under the terms of GNU General Public License v3.
//
//      You should have received a copy of the GNU General Public License v3
//      along with this program as the file LICENSE.txt; if not, please see
//      http://www.gnu.org/licenses/gpl-3.0.html
//
//********************************{end:header}*******************************//

package fi.uta.fsd.metka.spssio.util;

/**
 * Sequentially writable and readable byte array.
 *
 * The data matrix of a Portable file in compact format. The data of a portable
 * file cannot be converted into a {@code Vector} of {@code Double} and
 * {@code String} objects. This is because the overhead of Java for any
 * {@code Object} is very high in terms of both the space (vtable)
 * and time (gc).

 *
 * For instance, a portable file of 20 MBs would need much more than 1024 MBs
 * of memory before Java would be able to convert it into {@code Double}s
 * and {code String}s. 20 MBs shouldn't be that much of trouble nowaways,
 * when computers have, like, at least 2048 MBs of RAM memory by default.
 * But that's Java for you.

 *
 */
public class SequentialByteArray
{
    // CONSTANTS
    //===========

    /**
     * Number of bytes in an array element. For int[] array this needs
     * to be 4, and foor long[] array this needs to be 8.
     */
    private static final int BYTES_IN_ELEMENT               = 4;

    // MEMBER VARIABLES
    //==================

    /** The data array */
    private int[] data;

    /** Size in bytes */
    private int size;

    // Reading/Writing at byte-level
    //===============================

    /** Current array element number */
    private int offset;

    /** Current total byte offset. */
    private int cbyte;

    /** Current byte number within the array element */
    private int bytenum;

    /** Current array element value */
    private int elem;

    // CONSTRUCTORS
    //==============

    /**
     * Creates an uninitialized {@code SequentialByteArray}.
     * The byte array needs to be allocated with {@link #allocate(int)}
     * prior to any use.
     */
    public SequentialByteArray() {
        data = null;
        size = 0;

        offset = 0;
        cbyte = 0;
        bytenum = 0;
        elem = 0;
    } // ctor

    // OTHER METHODS
    //===============

    /**
     * Allocates memory for the given number of bytes.
     * The allocation loses any previously allocated data.
     *
     * @param size_bytes The amount of memory to allocate in bytes
     */
    public void allocate(int size_bytes) {
        size = size_bytes;
        int elems = (size + BYTES_IN_ELEMENT - 1) / BYTES_IN_ELEMENT;
        data = new int[elems];

        // Reset head position
        offset = 0;
        cbyte = 0;
        bytenum = 0;
        elem = 0;
    } // allocate

    /**
     * Writes the specified byte into the array.
     * The internal head is moved forward. The first byte of
     * the element is written to the most signicant end.
     * This enables easier sequential read, which is desirable
     * since it is expected that the data is written once, and
     * read multiple times.
     *
     * @param c The byte to write.
     *          Only the least-significant 8 bits are written.
     *
     */
    public final void write(int c) {
        if (cbyte == size) {
            throw new ArrayIndexOutOfBoundsException(String.format("%d", cbyte));
        }

        // Append the input byte to the data element.
        elem |= (c & 0xff) << (bytenum << 3);

        bytenum++;
        cbyte++;
        if (bytenum == BYTES_IN_ELEMENT) {
            // Write the data
            data[offset] = elem;
            // Increase offset
            offset++;
            // Reset current element
            elem = 0;
            // Reset bytenum
            bytenum = 0;
        }
    } // write()

    /**
     * Flushes the current element to the array
     */
    public void flush() {
        // Flushing is required only if there are written bytes in
        // the current data element.
        if (bytenum != 0) {
            data[offset] = elem;
        }
    }

    /**
     * Seeks to read/write head to the specified byte offset.
     * @param tobyte The byte offset to seek to.
     */
    public void seek(int tobyte) {

        // Record the total byte offset
        cbyte = tobyte;
        // Calculate offset
        offset = tobyte / BYTES_IN_ELEMENT;
        // Pick the corresponding data element, and move head
        elem = data[offset];
        // Set in-element offset
        bytenum = tobyte % BYTES_IN_ELEMENT;
        // The element has to be shifted properly.
        // Using unsigned shift right:
        elem = elem >>> (bytenum << 3);
    } // seek()

    /**
     * Reads a byte currently under the read/write head.
     * The read/write head is moved forward by one byte.
     *
     * @return
     *      The byte read, or -1 if end-of-data.
     */
    public final int read() {

        if (cbyte == size) {
            return -1;
        }

        // Otherwise, the byte under the head at "cbyte" can be read.

        if (bytenum == BYTES_IN_ELEMENT) {
            // Read next byte
            offset++;
            elem = data[offset];
            bytenum = 0;
        }

        int rval = 0;
        rval = elem & 0xff;

        // increase byte position
        elem = elem >>> 8; // unsigned SHR
        bytenum++;
        cbyte++;

        return rval;
    } // read()

    /**
     * Get the size of the array in bytes.
     * @return The array size in bytes.
     */
    public int size() {
        return size;
    }

    /**
     * Get the reading/writing head position (in bytes).
     * @return The current byte offset
     */
    public int pos() {
        return cbyte;
    }

    // for testing
    public static void main(String[] args) {
        SequentialByteArray matrix = new SequentialByteArray();
        int len = 12;
        matrix.allocate(len);

        for (int i = 0; i < len; i++) {
            matrix.write(i*3);
        }
        matrix.flush();

        int pos = 5;
        matrix.seek(pos);
        for (int i = pos; i < len+6; i++) {
            int c = matrix.read();
            System.out.printf("data[%d] = %d\n", i, c);
        }
    }

} // PORDataMatrix


text:
from django.views.decorators.csrf import csrf_exempt
from django.http import JsonResponse

import numpy as np
import urllib
import cv2

# define the path to the face detector
FACE_DETECTOR_PATH = "cascades/haarcascade_frontalface_default.xml"

@csrf_exempt
def detect(request):
    # initialize the data dictionary to be returned by the request
    data = {"success": False}
    # check to see if this is a post request
    if request.method == "POST":
        # check to see if an image was uploaded
        if request.FILES.get("image", None) is not None:
            # grab the uploaded image
            image = _grab_image(stream=request.FILES["image"])

        # otherwise, assume that a URL was passed in
        else:
            # grab the URL from the request
            url = request.POST.get("url", None)

            # if the URL is None, then return an error
            if url is None:
                data["error"] = "No URL provided."
                return JsonResponse(data)

            # load the image and convert
            image = _grab_image(url=url)

        # convert the image to grayscale, load the face cascade detector,
        # and detect faces in the image
        image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        detector = cv2.CascadeClassifier(FACE_DETECTOR_PATH)
        rects = detector.detectMultiScale(image, scaleFactor=1.1, minNeighbors=5,
                                          minSize=(30, 30), flags=cv2.cv.CV_HAAR_SCALE_IMAGE)

        # construct a list of bounding boxes from the detection
        rects = [(int(x), int(y), int(x + w), int(y + h)) for (x, y, w, h) in rects]

        # update the data dictionary with the faces detected
        data.update({"num_faces": len(rects), "faces": rects, "success": image is not None})

    # return a JSON response
    return JsonResponse(data)

def _grab_image(path=None, stream=None, url=None):
    data = {'success': False}
    # if the path is not None, then load the image from disk
    if path is not None:
        image = cv2.imread(path)

    # otherwise, the image does not reside on disk
    else:
        # if the URL is not None, then download the image
        if url is not None:
            resp = urllib.urlopen(url)
            data = resp.read()

        # if the stream is not None, then the image has been uploaded
        elif stream is not None:
            data = stream.read()

        # convert the image to a NumPy array and then read it into
        # OpenCV format
        image = np.asarray(bytearray(data), dtype="uint8")
        image = cv2.imdecode(image, cv2.IMREAD_COLOR)

    # return the image
    return image


text:
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
using System.Web;
using System.Web.Configuration;
using System.Web.Optimization;

namespace AzureLens
{
    public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/Libraries/jquery-{version}.js",
                        "~/Scripts/Libraries/jquery.multilevelpushmenu.js"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/Libraries/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/Libraries/bootstrap.js",
                      "~/Scripts/Libraries/respond.js"));

            bundles.Add(new ScriptBundle("~/bundles/velocity").Include(
                      "~/Scripts/Libraries/velocity.min.js",
                      "~/Scripts/Libraries/velocity.ui.js"));

            bundles.Add(new StyleBundle("~/Content/cssbundle").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css",
                      "~/fonts/font-awesome.css",
                      "~/Content/basecss/jquery.multilevelpushmenu.css",
                      "~/Content/basecss/main.css",
                      "~/Content/basecss/spectrum.css"));

            //bundles.Add(new ScriptBundle("~/bundles/app").Include(
            //    "~/Scripts/Libraries/adal.js",
            //    "~/Scripts/azureLensApp/app.js",
            //    "~/Scripts/azureLensApp/app3DView.js",
            //    "~/Scripts/azureLensApp/fileLoader.js"));

            bundles.Add(new ScriptBundle("~/bundles/signalr").Include(
                "~/Scripts/jquery.signalR-2.2.0.js"));

        }
    }
}
//*********************************************************
//
//AzureLens.Net, https://github.com/MicrosoftDX/AzureLens
//
//Copyright (c) Microsoft Corporation
//All rights reserved.
//
// MIT License:
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// ""Software""), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//*********************************************************