text:
package bp.view.painter;

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;

import bp.model.graphic.ActivityEventComponent;
import bp.model.graphic.BPComponent;
import bp.model.graphic.BPImage;
import bp.model.graphic.EventComponent;
import bp.model.graphic.TaskComponent;
import bp.model.graphic.util.ElementHandlers;
import bp.view.BasicPainter;

public class BPElementPainter extends BasicPainter {

    private BPComponent component = (BPComponent) getElement();

    public BPElementPainter(final BPComponent component) {
        super(component);
    }

    public BPElementPainter() { }

    protected BPComponent getComponent() {
        return this.component;
    }

    public void setComponent(BPComponent component) {
		this.component = component;
	}

	@Override
    public void paint(final Graphics2D g) {
        final AffineTransform oldTransform = g.getTransform();

        g.translate(getComponent().getX(), getComponent().getY());

        g.setPaint(getComponent().getFgColor());
        g.setStroke(getComponent().getFgStroke());
        g.draw(getComponent().getShape());

        g.setPaint(getComponent().getBgColor());
        g.setStroke(getComponent().getBgStroke());
        g.fill(getComponent().getShape());

        g.setTransform(oldTransform);

        if (this.component instanceof BPImage) {
            final BPImage img = (BPImage) this.component;
            if (this.component instanceof TaskComponent) {
                if (img.getImage() != null) {
                    g.translate(
                            getComponent().getX() + getComponent().getWidth() - img.getImageWidth()
                            - img.getImageMargins(), getComponent().getY() + img.getImageMargins());

                    g.drawImage(img.getImage(), 0, 0, img.getImageWidth(), img.getImageHeight(), null);

                    g.setTransform(oldTransform);
                }
            } else if (this.component instanceof EventComponent || this.component instanceof ActivityEventComponent) {
                if (img.getImage() != null) {

                    g.translate(getComponent().getX() + getComponent().getWidth() / 2 - img.getImageWidth() / 2,
                            getComponent().getY() + getComponent().getHeight() / 2 - img.getImageHeight() / 2);

                    g.drawImage(img.getImage(), 0, 0, img.getImageWidth(), img.getImageHeight(), null);

                    g.setTransform(oldTransform);
                }
            }
        }
    }

    @Override
    public boolean isElementAt(final Point pos) {
        final Integer x = getComponent().getX();
        final Integer y = getComponent().getY();
        final Integer w = getComponent().getWidth();
        final Integer h = getComponent().getHeight();
        final Rectangle2D area = new Rectangle2D.Double(x, y, w, h);
        return area.contains(pos);
    }

    @Override
    public void paintHandlers(final Graphics2D g) {
        final ElementHandlers handlers = getComponent().getHandlers();
        if (handlers == null)
            return;

        final AffineTransform oldTransform = g.getTransform();

        g.translate(handlers.getX(), handlers.getY());

        g.setPaint(handlers.getLineColor());
        g.setStroke(handlers.getLineStroke());
        g.draw(handlers.getShape());

        g.setTransform(oldTransform);

        if (handlers.getNw() != null)
            paintHandler(g, handlers.getNw());
        if (handlers.getNe() != null)
            paintHandler(g, handlers.getNe());
        if (handlers.getSe() != null)
            paintHandler(g, handlers.getSe());
        if (handlers.getSw() != null)
            paintHandler(g, handlers.getSw());
        if (handlers.getN() != null)
            paintHandler(g, handlers.getN());
        if (handlers.getE() != null)
            paintHandler(g, handlers.getE());
        if (handlers.getS() != null)
            paintHandler(g, handlers.getS());
        if (handlers.getW() != null)
            paintHandler(g, handlers.getW());

    }
}

redpajama_set_name: RedPajamaGithub


text:
// /**
//  * Created by ikaur on 6/25/16.
//  */
// var accountSid = '';
// var authToken = '[AuthToken]';
//
// //require the Twilio module and create a REST client
// var client = require('twilio')(accountSid, authToken);
// function makeTwilioCall(patientName,contactName,cb){
//     client.calls.create({
//         to: "",
//         from: "+",
//         url: "http://ishneetkaur.com/testmsg11.php?patientName=" + URLEncoder.encode(patientName, "UTF-8") + "&contactName=" + URLEncoder.encode(contactName, "UTF-8"),
//         method: "GET",
//         fallbackMethod: "GET",
//         statusCallbackMethod: "GET",
//         record: "false"
//     }, function(err, call) {
//         console.log(call.sid);
//     });
//     cb(null,"SUCCESS");
// }
//
// exports.makeTwilioCall = makeTwilioCall;


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.apimanagement.models;

import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;

/** Resource collection API of TenantAccessGits. */
public interface TenantAccessGits {
    /**
     * Regenerate primary access key for GIT.
     *
     * @param resourceGroupName The name of the resource group.
     * @param serviceName The name of the API Management service.
     * @param accessName The identifier of the Access configuration.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    void regeneratePrimaryKey(String resourceGroupName, String serviceName, AccessIdName accessName);

    /**
     * Regenerate primary access key for GIT.
     *
     * @param resourceGroupName The name of the resource group.
     * @param serviceName The name of the API Management service.
     * @param accessName The identifier of the Access configuration.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response}.
     */
    Response<Void> regeneratePrimaryKeyWithResponse(
        String resourceGroupName, String serviceName, AccessIdName accessName, Context context);

    /**
     * Regenerate secondary access key for GIT.
     *
     * @param resourceGroupName The name of the resource group.
     * @param serviceName The name of the API Management service.
     * @param accessName The identifier of the Access configuration.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    void regenerateSecondaryKey(String resourceGroupName, String serviceName, AccessIdName accessName);

    /**
     * Regenerate secondary access key for GIT.
     *
     * @param resourceGroupName The name of the resource group.
     * @param serviceName The name of the API Management service.
     * @param accessName The identifier of the Access configuration.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response}.
     */
    Response<Void> regenerateSecondaryKeyWithResponse(
        String resourceGroupName, String serviceName, AccessIdName accessName, Context context);
}


text:
namespace System.Management.Automation.Language
{
    /// <summary>
    /// This type is introduced to provide a way to pass null into a .NET method that has a string parameter.
    /// </summary>
    public class NullString
    {
        #region private_members

        // Private member for instance.

        #endregion private_members

        #region public_property

        /// <summary>
        /// This overrides ToString() method and returns null.
        /// </summary>
        public override string ToString()
        {
            return null;
        }

        /// <summary>
        /// This returns the singleton instance of NullString.
        /// </summary>
        public static NullString Value { get; } = new NullString();

        #endregion public_property

        #region private Constructor

        /// <summary>
        /// This is a private constructor, meaning no outsiders have access.
        /// </summary>
        private NullString()
        {
        }

        #endregion private Constructor
    }
}


text:
ACCEPTED

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

#### Published in
Sida 2:136. 1965

#### Original name
null

### Remarks
null


text:
package main

import "github.com/bitrise-io/depman/cmd"

func main() {
	cmd.Execute()
}


text:
<?php

	require_once(TOOLKIT . '/class.datasource.php');

	Class datasourcepage_blocks extends Datasource{

		public $dsParamROOTELEMENT = 'page-blocks';
		public $dsParamORDER = 'asc';
		public $dsParamPAGINATERESULTS = 'no';
		public $dsParamLIMIT = '20';
		public $dsParamSTARTPAGE = '1';
		public $dsParamREDIRECTONEMPTY = 'no';
		public $dsParamSORT = 'system:id';
		public $dsParamHTMLENCODE = 'yes';
		public $dsParamASSOCIATEDENTRYCOUNTS = 'no';

		public $dsParamFILTERS = array(
				'id' => '{$ds-page-blocks}',
		);

		public $dsParamINCLUDEDELEMENTS = array(
				'blok',
				'yakor',
				'tip'
		);

		public function __construct(&$parent, $env=NULL, $process_params=true){
			parent::__construct($parent, $env, $process_params);
			$this->_dependencies = array('$ds-page-blocks');
		}

		public function about(){
			return array(
				'name' => 'page-blocks',
				'author' => array(
					'name' => 'Remark Remarkovich',
					'website' => 'http://www.mera.com',
					'email' => 'mail@remark72.ru'),
				'version' => 'Symphony 2.2.5',
				'release-date' => '2012-03-15T10:35:32+00:00'
			);
		}

		public function getSource(){
			return '12';
		}

		public function allowEditorToParse(){
			return true;
		}

		public function grab(&$param_pool=NULL){
			$result = new XMLElement($this->dsParamROOTELEMENT);

			try{
				include(TOOLKIT . '/data-sources/datasource.section.php');
			}
			catch(FrontendPageNotFoundException $e){
				// Work around. This ensures the 404 page is displayed and
				// is not picked up by the default catch() statement below
				FrontendPageNotFoundExceptionHandler::render($e);
			}
			catch(Exception $e){
				$result->appendChild(new XMLElement('error', $e->getMessage()));
				return $result;
			}

			if($this->_force_empty_result) $result = $this->emptyXMLSet();

			return $result;
		}

	}


text:
from pytest import raises
import mock

from retrypy import retry

class CallCounter(object):
    def __init__(self, calls=0, errors=0):
        self.calls = calls
        self.errors = errors

    def __eq__(self, other):
        return other.calls == self.calls and other.errors == self.errors

def get_dummy_func(raise_count=4, exception_type=Exception):
    """Return a function for testing

    The returned function will raise an exception ``raise_count`` times when
    it is retried.  After ``raise_count`` call it will return

    :param int raise_count: Number of times to raise (default=4)
    :param type exception_type: Type of exception to raise (default=Exception)
    :returns: A function to be used in tests
    :rtype: func
    """

    counter = CallCounter()

    def func(*args, **kwargs):
        counter.calls += 1
        if counter.errors < raise_count:
            counter.errors += 1
            raise exception_type(
                'Test Error {count}'.format(count=counter.errors)
            )
        return counter, args, kwargs
    return func

class TestCall(object):
    def test_func_with_no_args(self):
        result = retry.call(get_dummy_func(0))
        assert result == (CallCounter(1, 0), (), {})

    def test_retry_func_with_no_args(self):
        result = retry.call(get_dummy_func())
        assert result == (CallCounter(5, 4), (), {})

    def test_func_that_raises_too_many_time_raises(self):
        with raises(Exception) as e:
            retry.call(get_dummy_func(50))
        assert str(e.value) == 'Test Error 5'

    def test_func_that_passes_check_does_not_raise(self):
        result = retry.call(
            get_dummy_func(),
            check=lambda e, c: True,
        )
        assert result == (CallCounter(5, 4), (), {})

    def test_func_that_fails_check_raises(self):
        with raises(Exception) as e:
            retry.call(
                get_dummy_func(5),
                check=lambda e, c: c != 3
            )
        assert str(e.value) == 'Test Error 3'

    def test_func_that_raises_wrong_exception_type_should_raise(self):
        with raises(Exception) as e:
            retry.call(
                get_dummy_func(5),
                exceptions=[TypeError],
            )
        assert str(e.value) == 'Test Error 1'

    def test_func_with_positional_arg(self):
        assert retry.call(lambda x: x, args=['bar']) == 'bar'

    def test_retry_func_with_postional_arg(self):
        result = retry.call(get_dummy_func(), args=['foo'])
        assert result == (CallCounter(5, 4), ('foo',), {})

    def test_func_with_kwargs(self):
        result = retry.call(get_dummy_func(0), kwargs={'foo': 'bar'})
        assert result == (CallCounter(1), (), {'foo': 'bar'})

    def test_retry_func_with_kwarg(self):
        result = retry.call(get_dummy_func(), kwargs={'foo': 'bar'})
        assert result == (CallCounter(5, 4), (), {'foo': 'bar'})

    @mock.patch('retrypy.retry.sleep')
    def test_retry_with_wait_function(self, mock_sleep):
        retry.call(get_dummy_func(), wait=lambda n: n)
        mock_sleep.assert_called_with(4)

class TestDecorated(object):
    def test_func_with_no_args(self):
        func = get_dummy_func(0)

        @retry.decorate()
        def foo():
            return func()

        assert foo() == (CallCounter(1, 0), (), {})

    def test_func_with_positional_arg(self):
        func = get_dummy_func(0)

        @retry.decorate()
        def foo(arg):
            return func(arg)

        assert foo('arg') == (CallCounter(1, 0), ('arg',), {})

    def test_retry_func_with_positional_arg(self):
        func = get_dummy_func()

        @retry.decorate()
        def foo(arg):
            return func(arg)

        assert foo('arg') == (CallCounter(5, 4), ('arg',), {})

    def test_func_with_kwargs(self):
        func = get_dummy_func(0)

        @retry.decorate()
        def foo(**kwargs):
            return func(**kwargs)

        assert foo(foo='bar') == (CallCounter(1), (), {'foo': 'bar'})

    def test_retry_func_with_kwargs(self):
        func = get_dummy_func()

        @retry.decorate()
        def foo(**kwargs):
            return func(**kwargs)

        assert foo(foo='bar') == (CallCounter(5, 4), (), {'foo': 'bar'})

    def test_func_that_raises_too_many_time_raises(self):
        func = get_dummy_func(50)

        @retry.decorate()
        def foo():
            return func()

        with raises(Exception) as e:
            foo()
        assert str(e.value) == 'Test Error 5'

    def test_func_that_raises_wrong_exception_type_should_raise(self):
        func = get_dummy_func(50)

        @retry.decorate(TypeError)
        def foo():
            return func()

        with raises(Exception) as e:
            foo()
        assert str(e.value) == 'Test Error 1'

    def test_retry_func_with_no_args(self):
        func = get_dummy_func()

        @retry.decorate()
        def foo():
            return func()

        assert foo() == (CallCounter(5, 4), (), {})

    @mock.patch('retrypy.retry.sleep')
    def test_retry_with_wait_function(self, mock_sleep):
        func = get_dummy_func()

        @retry.decorate(wait=lambda n: n)
        def foo():
            return func()
        foo()
        mock_sleep.assert_called_with(4)

class TestWrap(object):
    def test_retry_func_with_no_args(self):
        func = retry.wrap(get_dummy_func())

        assert func() == (CallCounter(5, 4), (), {})

    def test_retry_func_with_args(self):
        func = retry.wrap(get_dummy_func())

        assert func('arg') == (CallCounter(5, 4), ('arg', ), {})

    def test_retry_func_with_kwargs(self):
        func = retry.wrap(get_dummy_func())

        assert func(foo='bar') == (CallCounter(5, 4), (), {'foo': 'bar'})

    @mock.patch('retrypy.retry.sleep')
    def test_retry_with_wait_function(self, mock_sleep):
        func = retry.wrap(get_dummy_func(), wait=lambda n: n)
        func()
        mock_sleep.assert_called_with(4)

    def test_func_that_raises_too_many_time_raises(self):
        func = retry.wrap(get_dummy_func(50))
        with raises(Exception) as e:
            func()
        assert str(e.value) == 'Test Error 5'


text:
<?php
/**
 * Entity "Strategy" for Doctrine ORM
 * @author PiskunovYV
 */
namespace Direct\WrapperBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="strategy")
 */
class Strategy {
	/**
	 * @ORM\Id
	 * @ORM\Column(type="integer")
	 * @ORM\GeneratedValue(strategy="AUTO")
	 */
	protected $id;

	/**
	 * @ORM\Column(columnDefinition="ENUM('HighestPosition', 'LowestCost', 'LowestCostPremium', 'WeeklyBudget', 'WeeklyPacketOfClicks', 'AverageClickPrice')")
	 */
	protected $StrategyName;

	/**
	 * @ORM\Column(type="float")
	 */
	protected $MaxPrice;

	/**
	 * @ORM\Column(type="float")
	 */
	protected $AveragePrice;

	/**
	 * @ORM\Column(type="float")
	 */
	protected $WeeklySumLimit;

	/**
	 * @ORM\Column(type="integer")
	 */
	protected $ClicksPerWeek;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set StrategyName
     *
     * @param \varchar $strategyName
     * @return Strategy
     */
    public function setStrategyName(\varchar $strategyName)
    {
        $this->StrategyName = $strategyName;

        return $this;
    }

    /**
     * Get StrategyName
     *
     * @return \varchar
     */
    public function getStrategyName()
    {
        return $this->StrategyName;
    }

    /**
     * Set MaxPrice
     *
     * @param float $maxPrice
     * @return Strategy
     */
    public function setMaxPrice($maxPrice)
    {
        $this->MaxPrice = $maxPrice;

        return $this;
    }

    /**
     * Get MaxPrice
     *
     * @return float
     */
    public function getMaxPrice()
    {
        return $this->MaxPrice;
    }

    /**
     * Set AveragePrice
     *
     * @param float $averagePrice
     * @return Strategy
     */
    public function setAveragePrice($averagePrice)
    {
        $this->AveragePrice = $averagePrice;

        return $this;
    }

    /**
     * Get AveragePrice
     *
     * @return float
     */
    public function getAveragePrice()
    {
        return $this->AveragePrice;
    }

    /**
     * Set WeeklySumLimit
     *
     * @param float $weeklySumLimit
     * @return Strategy
     */
    public function setWeeklySumLimit($weeklySumLimit)
    {
        $this->WeeklySumLimit = $weeklySumLimit;

        return $this;
    }

    /**
     * Get WeeklySumLimit
     *
     * @return float
     */
    public function getWeeklySumLimit()
    {
        return $this->WeeklySumLimit;
    }

    /**
     * Set ClicksPerWeek
     *
     * @param integer $clicksPerWeek
     * @return Strategy
     */
    public function setClicksPerWeek($clicksPerWeek)
    {
        $this->ClicksPerWeek = $clicksPerWeek;

        return $this;
    }

    /**
     * Get ClicksPerWeek
     *
     * @return integer
     */
    public function getClicksPerWeek()
    {
        return $this->ClicksPerWeek;
    }
}


text:
package net.sourceforge.gxl;

import java.util.Hashtable;
import java.util.Vector;
import java.util.Iterator;
import javax.swing.undo.StateEditable;
import javax.swing.undo.StateEdit;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/** Superclass of all GXL elements.
 *

 *	Provides the basic functionality of all the elements, that is

 *	(1) attribute modification,

 *	(2) insertion of new elements and

 *	(3) removal of elements.

 *	The only other kind of modification that exist is (4) modifying the value of
 *	a subclass of GXLAtomicValue and (5) the GXLAttr.setValue method.
 *	All other modifications are in reality
 *	just shorthand, and will all call one of these basic operations. In the same sense
 *	this class provides the only accessors needed as well, all the accessing methods
 *	in subclasses is just for convenience, simplifying some tasks.
 *
 *	@see GXLDocument
 *	@see GXLAtomicValue
 */
public abstract class GXLElement {
	// The GXL Document that this gxl element belongs to
	GXLDocument gxlDocument;
	// The parent of this element
	GXLElement parent;
	// The attributes of this element
	Hashtable attributes;
	// The gxl element children of this gxl element
	Vector children;
	// The name of this element
	String elementName;
	// The index of this element in the GXL.ELEMENTS array;
	int elementIndex;

	//
	// CONSTRUCTORS
	//

	/** Creates a new GXLElement. MUST be called from subclasses. */
	GXLElement(String elementName) {
		this(elementName, null);
	}

	/** Creates a new GXLElement. MUST be called from subclasses. */
	GXLElement(String elementName, Element element) {
		this.elementName = elementName;
		elementIndex = GXL.indexOf(GXL.ELEMENTS, elementName);
		// Create the child vector
		children = new Vector();
		// Create the attribute map
		attributes = new Hashtable();
	}

	/** Creates the children out of the DOM structure, MUST be called by the non-abstract "outer" GXLElements.
	 *	This MUST be done lastly in their constructors, after they've been properly initialized. */
	void createChildren(Element element) {
		// Extra validation to make sure that the top element is named "gxl"
		if ((this instanceof GXLGXL) && !element.getNodeName().equals(GXL.GXL))
			throw new GXLValidationException(GXLValidationException.INVALID_ELEMENT_TYPE);

		// Get any attributes from the element
		NamedNodeMap elementAttributes = element.getAttributes();
		for (int i = 0; i < elementAttributes.getLength(); i++) {
			Attr a = (Attr) elementAttributes.item(i);
			if (a.getSpecified())
				setAttribute(a.getName(), a.getValue());
		}

		// Traverse the element children
		NodeList nodes = element.getChildNodes();
		for (int i = 0; i < nodes.getLength(); i++) {
			Node node = nodes.item(i);
			// If the child is an element, add it
			if (node instanceof Element) {
				String elementName = node.getNodeName();
				GXLElement gxlElement = null;
				// Create the appropriate type (gxl is omitted since it is read by GXLDocument
				if (elementName.equals(GXL.TYPE))
					gxlElement = new GXLType((Element) node);
				else if (elementName.equals(GXL.GRAPH))
					gxlElement = new GXLGraph((Element) node);
				else if (elementName.equals(GXL.NODE))
					gxlElement = new GXLNode((Element) node);
				else if (elementName.equals(GXL.EDGE))
					gxlElement = new GXLEdge((Element) node);
				else if (elementName.equals(GXL.REL))
					gxlElement = new GXLRel((Element) node);
				else if (elementName.equals(GXL.RELEND))
					gxlElement = new GXLRelend((Element) node);
				else if (elementName.equals(GXL.ATTR))
					gxlElement = new GXLAttr((Element) node);
				else if (elementName.equals(GXL.LOCATOR))
					gxlElement = new GXLLocator((Element) node);
				else if (elementName.equals(GXL.BOOL))
					gxlElement = new GXLBool((Element) node);
				else if (elementName.equals(GXL.INT))
					gxlElement = new GXLInt((Element) node);
				else if (elementName.equals(GXL.FLOAT))
					gxlElement = new GXLFloat((Element) node);
				else if (elementName.equals(GXL.STRING))
					gxlElement = new GXLString((Element) node);
				else if (elementName.equals(GXL.ENUM))
					gxlElement = new GXLEnum((Element) node);
				else if (elementName.equals(GXL.SEQ))
					gxlElement = new GXLSeq((Element) node);
				else if (elementName.equals(GXL.SET))
					gxlElement = new GXLSet((Element) node);
				else if (elementName.equals(GXL.BAG))
					gxlElement = new GXLBag((Element) node);
				else if (elementName.equals(GXL.TUP))
					gxlElement = new GXLTup((Element) node);
				else
					throw new GXLValidationException(GXLValidationException.INVALID_ELEMENT_TYPE);

				// Add the new element to our child list
				add(gxlElement);
			}
		}
	}

	//
	// PUBLIC METHODS
	//

	/** Returns the GXLDocument that this element is contained in,
	 *	or null if this element isn't contained in a GXLDocument
	 *	@return The GXLDocument that this element is contained in,
	 *	or null if this element isn't contained in a GXLDocument
	 */
	public GXLDocument getDocument() {
		return gxlDocument;
	}

	/** Returns the parent of this element, or null if this element doesn't have a parent.
	 *	@return The parent of this element, or null if this element doesn't have a parent.
	 */
	public GXLElement getParent() {
		return parent;
	}

	/** Returns the index of the specified child, or -1 if the specified element isn't a child of this element.
	 *	@param child The element to look for.
	 *	@return The index of the specified child, or -1 if the specified element isn't a child of this element.
	 */
	public int indexOf(GXLElement child) {
		return children.indexOf(child);
	}

	/** Adds the specified child to this element.
	 *	This method is a shorthand for insert(child, children.size())
	 *	@param child The element to add.
	 *	@throws GXLValidationException If this action would result in an invalid GXL document.
	 */
	public void add(GXLElement child) {
		insert(child, children.size());
	}

	/** Inserts the specified child into this element's child array at the specified index.
	 *	If the index is invalid due to implicit ordering of different child types, the index
	 *	will be automatically corrected to the closest valid value.
	 *	Note that an exception will be raised if child already has a parent. If this is the case,
	 *	remove it from it's old parent first.
	 *	@param child The child to insert.
	 *	@param index The index in this element's child array where the child should be inserted.
	 *	@throws GXLValidationException If this action would result in an invalid GXL document.
	 */
	public void insert(GXLElement child, int index) {
		// Validate this insertion (throws on error)
		GXLValidator.validateInsertion(gxlDocument, this, child);
		// All checks finished, make the insert
		GXLTreeModification mod = new GXLTreeModification(child, null, this, -1, index);
		mod.execute();
	}

	/** Returns the number of children this element has.
	 *	@return The number of children this element has.
	 */
	public int getChildCount() {
		return children.size();
	}

	/** Returns the specified child.
	 *	@param i The index of the child to return.
	 *	@return The specified child.
	 */
	public GXLElement getChildAt(int i) {
		return (GXLElement) children.elementAt(i);
	}

	/** Removes the specified child from this element's child vector.
	 *	@param child The child to remove.
	 *	@throws GXLValidationException If this action would result in an invalid GXL document.
	 */
	public void remove(GXLElement child) {
		// Don't do anything if this child is not a children of this element
		if (child.getParent() == this) {
			// Validate this removal (throws on error)
			GXLValidator.validateRemoval(gxlDocument, child);
			// All checks finished, make the removal
			GXLTreeModification mod = new GXLTreeModification(child, this, null, indexOf(child), -1);
			mod.execute();
		}
	}

	/** Returns the value of the specified attribute, or null if the attribute isn't set.
	 *	@param name The name of the attribute to return.
	 *	@return The value of the specified attribute, or null if the attribute isn't set.
	 */
	public String getAttribute(String name) {
		// First, see if the attribute is set
		String result = (String) attributes.get(name);
		// Second, see if there is a default
		if (result == null) {
			int index = GXL.indexOf(GXL.ATTRIBUTES, name);
			if (index >= 0)
				result = GXL.ATTRIBUTE_DEFAULTS[index];
		}
		return result;
	}

	/** Sets the specified attribute.
	 *	To remove an attribute, specify the value as null.
	 *	See the specific element class to see which attributes are valid.
	 *	@param name The name of the attribute to set.
	 *	@param value The new value of the attribute.
	 *	@throws GXLValidationException If this action would result in an invalid GXL document.
	 */
	public void setAttribute(String name, String value) {
		// if the attribute is of an enumerated type, swap value with the GXL.xxx counterpart
		// This will enable String == String comparison for equality (instead of String.equals(String))
		int attributeIndex = GXL.indexOf(GXL.ATTRIBUTES, name);
		if (attributeIndex != -1) {
			if (GXL.ATTRIBUTE_VALUES[attributeIndex] != null) {
				int valueIndex = GXL.indexOf(GXL.ATTRIBUTE_VALUES[attributeIndex], value);
				if (valueIndex != -1)
					value = GXL.ATTRIBUTE_VALUES[attributeIndex][valueIndex];
			}
		}
		// Validate this attribute change (throws on error)
		GXLValidator.validateAttributeModification(gxlDocument, this, name, value);
		// All checks finished, make the change
		GXLAttributeModification mod = new GXLAttributeModification(this, name, (String) attributes.get(name), value);
		mod.execute();
	}

	//
	// PACKAGE METHODS
	//

	/** Builds a new DOM document recursively. */
	void buildDOM(Document document, Element parent) {
		// Create our element
		Element element = document.createElement(getElementName());
		// Add any attributes
		Iterator it = attributes.keySet().iterator();
		while (it.hasNext()) {
			String key = (String) it.next();
			String value = (String) attributes.get(key);
			element.setAttribute(key, value);
		}
		// Append it to parent
		if (parent != null)
			parent.appendChild(element);
		else
			document.appendChild(element);
		// build children
		for (int i = 0; i < children.size(); i++)
			((GXLElement) children.elementAt(i)).buildDOM(document, element);
	}

	/** Returns the name of this element, ie "graph", "node" etc. */
	String getElementName() {
		return elementName;
	}

	/** Returns the index of this element in the GXL class arrays. */
	int getElementIndex() {
		return elementIndex;
	}
}


text:
/**
 *  \author Dave Coleman
 *  \desc   Multiple joint velocity controller for Baxter SDK
 */

#ifndef BAXTER_VELOCITY_CONTROLLER_H
#define BAXTER_VELOCITY_CONTROLLER_H

#include <ros/node_handle.h>

#include <urdf/model.h>
#include <control_toolbox/pid.h>
#include <boost/scoped_ptr.hpp>
#include <boost/thread/condition.hpp>
#include <hardware_interface/joint_command_interface.h>
#include <controller_interface/controller.h>
#include <realtime_tools/realtime_buffer.h>

#include <baxter_core_msgs/JointCommand.h>  // the input command

#include <effort_controllers/joint_velocity_controller.h>  // used for controlling individual joints

namespace baxter_sim_controllers
{
class BaxterVelocityController : public controller_interface::Controller<hardware_interface::EffortJointInterface>
{
public:
  BaxterVelocityController();
  ~BaxterVelocityController();

  bool init(hardware_interface::EffortJointInterface* robot, ros::NodeHandle& n);
  void starting(const ros::Time& time);
  void stopping(const ros::Time& time);
  void update(const ros::Time& time, const ros::Duration& period);
  void updateCommands();

private:
  ros::NodeHandle nh_;

  // Last commanded velocity
  realtime_tools::RealtimeBuffer<baxter_core_msgs::JointCommand> velocity_command_buffer_;

  size_t n_joints_;
  std::string topic_name;

  std::map<std::string, std::size_t> joint_to_index_map_;  // allows incoming messages to be quickly ordered

  bool verbose_;
  bool new_command_;  // true when an unproccessed new command is in the realtime buffer
  size_t update_counter_;

  // Command subscriber
  ros::Subscriber velocity_command_sub_;

  /**
   * @brief Callback from a recieved goal from the published topic message
   * @param msg trajectory goal
   */
  void commandCB(const baxter_core_msgs::JointCommandConstPtr& msg);

  // Create an effort-based joint velocity controller for every joint
  std::vector<boost::shared_ptr<effort_controllers::JointVelocityController> > velocity_controllers_;
};

}  // namespace

#endif


text:
export const JOIN_CHATROOM_START = 'JOIN_CHATROOM_START';
export const JOIN_CHATROOM_SUCCESS = 'JOIN_CHATROOM_SUCCESS';
export const JOIN_CHATROOM_ERROR = 'JOIN_CHATROOM_ERROR';

export const FETCH_CHATROOM_MESSAGES_START = 'FETCH_CHATROOM_MESSAGES_START';
export const FETCH_CHATROOM_MESSAGES_SUCCESS = 'FETCH_CHATROOM_MESSAGES_SUCCESS';
export const FETCH_CHATROOM_MESSAGES_ERROR = 'FETCH_CHATROOM_MESSAGES_ERROR';

export const FETCH_PARTIAL_CHATROOM_MESSAGES_START = 'FETCH_PARTIAL_CHATROOM_MESSAGES_START';
export const FETCH_PARTIAL_CHATROOM_MESSAGES_SUCCESS = 'FETCH_PARTIAL_CHATROOM_MESSAGES_SUCCESS';
export const FETCH_PARTIAL_CHATROOM_MESSAGES_ERROR = 'FETCH_PARTIAL_CHATROOM_MESSAGES_ERROR';

export const JOIN_CHATROOM = 'JOIN_CHATROOM';
export const LEAVE_CHATROOM = 'LEAVE_CHATROOM';

export const REFRESH_CHATROOM = 'REFRESH_CHATROOM';

export const UPDATE_USERS_COUNTER = 'UPDATE_USERS_COUNTER';

export const SEND_CHATROOM_MESSAGE = 'SEND_CHATROOM_MESSAGE';

export const RECEIVE_CHATROOM_MESSAGE = 'RECEIVE_CHATROOM_MESSAGE';


text:
.. index:: installation
.. _installation:

Installation
============
These installation instructions are specifically for an Ubuntu Linux system but should work with minor
changes on other Linux systems and with some changes on other operating systems (Windows, MacOS, etc..).
For other Linux systems you will need to replace any invocations of ``apt-get`` with your system's package
manager. For other operating systems you will need to work out the corresponding method of install.
The instructions install packages using ``apt-get`` where possible, otherwise they are installed in ``$HOME/local/``.

I have written these instructions to install pyseqan into a virtual Python environment using the virtualenv_ tool.
This has the benefits of isolating the pyseqan install from the rest of your system and can be done without
administrator privileges.

.. _virtualenv: http://www.virtualenv.org/en/latest/index.html

.. index:: prerequisites

Prerequisites
-------------
The following software should be downloaded and unpacked/installed somewhere on your system:

- GCC_: I have tested pyseqan with g++ versions 4.7.3 but other recent versions should work.
  Every release of
  g++ seems to give it a stricter interpretation of the C++ standard so
  perhaps it is not a good idea to try a version too much newer. Other modern
  compilers such as Microsoft C++ should work but I have not tried them. Please let me know
  if you try other compilers and run into any issues.

  Make sure you have gcc (with g++) installed::

    sudo apt-get install gcc build-essential

  If gcc is not already installed and you do not have administrator privileges you could install it locally from source.

- `Python 2.7`_: Other versions of python 2 will probably work such as 2.5 or 2.6. Install Python
  with virtualenv_::

    sudo apt-get install python-dev python-virtualenv

  Now create a virtual environment to install pyseqan into and activate it::

    mkdir -p $HOME/local
    virtualenv --system-site-packages $HOME/local/pyseqan-virtualenv
    . $HOME/local/pyseqan-virtualenv/bin/activate

- `Boost C++ libraries`_: I have tested pyseqan using version 1.54 of boost,
  although any recent version should work. You can install the boost libraries with::

    sudo apt-get install libboost-dev

  If you need a different version or want to install from source, first download them::

    mkdir -p $HOME/local/src
    cd $HOME/local/src
    wget \
      http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.bz2/download \
      -O boost_1_54_0.tar.bz2
    tar jxf boost_1_54_0.tar.bz2

  then install boost following the commands_ given at the Boost website and update your
  ``LD_LIBRARY_PATH`` environment variable so that the shared objects can be found
  at runtime::

    cd $HOME/local/src/boost_1_54_0
    ./bootstrap.sh --help
    ./bootstrap.sh --prefix=$HOME/local --with-libraries=python
    ./b2 --ignore-config install release
    export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH

- `SeqAn sequence analysis library`_: The SeqAn C++ library provides the suffix array implementation that
  pyseqan uses. I have used version 1.4.1 of SeqAn, although any recent version should work. You can
  install a version using apt-get::

    sudo apt-get install seqan-dev

  or install from source::

    cd $HOME/local/src
    wget http://packages.seqan.de/seqan-library/seqan-library-1.4.1.tar.bz2
    tar jxf seqan-library-1.4.1.tar.bz2

.. _GCC: http://gcc.gnu.org/
.. _Python 2.7: http://www.python.org/
.. _Boost C++ libraries: http://www.boost.org/
.. _commands: http://www.boost.org/doc/libs/1_49_0/more/getting_started/unix-variants.html#easy-build-and-install
.. _SeqAn sequence analysis library: http://www.seqan.de/

.. index:: download

Download pyseqan
----------------

If you have not already done so, download pyseqan and unpack it locally. You will need to replace
``*.*.*`` with the version of pyseqan you want to install (check at PyPI_)::

    cd $HOME/local/src
    wget http://pypi.python.org/packages/source/S/pyseqan/pyseqan-*.*.*.tar.gz
    tar zxf pyseqan-*.*.*.tar.gz
    cd $HOME/local/src/pyseqan-*.*.*

.. _PyPI: http://pypi.python.org/pypi/pyseqan/

.. index:: build environment

Configure, build, install
-------------------------

We are ready to configure pyseqan. pyseqan uses aksetup for installation, which means that
installation should be easy and quick. Try::

    python configure.py --help

to examine the possible options. By the way, if a configuration option says ``several ok``,
then you may specify several values, separated by commas. We need to tell pyseqan
where the boost and seqan C++ libraries are::

    python configure.py \
      --seqan-dir=$HOME/local/src/seqan-library-1.4.1/ \
      --boost-inc-dir=$HOME/local/include \
      --boost-lib-dir=$HOME/local/lib

Configuration is obtained from files in this order::

    /etc/aksetup-defaults.py
    $HOME/.aksetup-defaults.py
    $PACKAGEDIR/siteconf.py

Once you've run configure, you can copy options from your ``siteconf.py`` file to
one of these files, and you won't ever have to configure them again manually.
In fact, you may pass the options ``--update-user`` and ``--update-global`` to
configure, and it will automatically update these files for you. This is particularly
handy if you want to perform an unattended or automatic installation via pip_ or easy_install_.

Now install pyseqan::

    python setup.py install

This can take some time to compile. When it has finished, check that pyseqan has been successfully installed::

    python -c "import seqan"

This should run without problems.

.. _easy_install: http://packages.python.org/distribute/easy_install.html
.. _pip: http://pypi.python.org/pypi/pip


text:
<?php

/* TroiswaTestBundle:Default:accueil.html.twig */
class __TwigTemplate_2b604eb1b0c84af441f7fe28185a476cd379b44bfbb0366a8c5f6a4b6a927602 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("TroiswaTestBundle::layout.html.twig");

        $this->blocks = array(
            'content' => array($this, 'block_content'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "TroiswaTestBundle::layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_content($context, array $blocks = array())
    {
        // line 4
        echo "\t
coucou

\t";
        // line 5
        $context['_parent'] = (array) $context;
        $context['_seq'] = twig_ensure_traversable((isset($context["objets"]) ? $context["objets"] : $this->getContext($context, "objets")));
        foreach ($context['_seq'] as $context["_key"] => $context["obj"]) {
            // line 6
            echo "\t\t
id : ";
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["obj"]) ? $context["obj"] : $this->getContext($context, "obj")), "id"), "html", null, true);
            echo "

\t\t   nom : ";
            // line 7
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["obj"]) ? $context["obj"] : $this->getContext($context, "obj")), "nom"), "html", null, true);
            echo "

\t";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['obj'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
    }

    public function getTemplateName()
    {
        return "TroiswaTestBundle:Default:accueil.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  43 => 7,  38 => 6,  34 => 5,  31 => 4,  28 => 3,);
    }
}


text:
import os, commentjson

class Config(object):
    """Set config of other class"""

    @classmethod
    def readconfig(cls):
        with open(os.path.join(cls.path,"config.json")) as file:
            cls.configs = commentjson.load(file)

    @classmethod
    def setpath(cls, path):
        cls.path = path

    @classmethod
    def insertpath(cls, config):
        config['path'] = cls.path
        return config

    @classmethod
    def get_monitorconfig(cls):
        return cls.insertpath(cls.configs["monitor"])

    @classmethod
    def get_mailconfig(cls):
        return cls.insertpath(cls.configs["mail"])

    @classmethod
    def get_xlsxconfig(cls):
        return cls.insertpath(cls.configs["xlsx"])

    @classmethod
    def get_dataconfig(cls):
        return cls.insertpath(cls.configs["data"])


text:
package solution;

import java.util.ArrayList;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by lakb2_000 on 2014/9/10.
 */
public class Combinations {

    public List<List<Integer>> combine(int n, int k) {
        List<List<Integer>> list = new ArrayList<List<Integer>>() ;
        Deque<List<Integer>> queue = new LinkedList<List<Integer>>() ;

        for(int i = 0 ; i < n ; i ++){
            List<Integer> l = new LinkedList<Integer>() ;
            l.add(i + 1);
            queue.add(l) ;
        }

        while(!queue.isEmpty()){
            List<Integer> ll = queue.pollFirst() ;
            if(ll.size() == k){
                list.add(ll);
            }else{
                for(int i = ll.get(ll.size() - 1) + 1 ; i <= n ; i ++){
                    List<Integer> next_list = new LinkedList<Integer>() ;
                    next_list.addAll(ll) ;
                    next_list.add(i) ;
                    queue.addLast(next_list);
                }
            }
        }

        return list ;
    }

}


text:
/**
 *
 */
package gov.nih.nci.calims2.business.workflow.taskclient;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import org.drools.task.Status;

import gov.nih.nci.calims2.business.workflow.l10n.TaskStatusBundle;
import gov.nih.nci.calims2.util.enumeration.I18nEnumeration;

/**
 * @author viseem
 *
 */
public enum TaskStatus implements I18nEnumeration {
  /** Completed taskStatus. */
  COMPLETED,
  /** Created taskStatus. */
  CREATED,
  /** Error taskStatus. */
  ERROR,
  /** Exited taskStatus. */
  EXITED,
  /** Failed taskStatus. */
  FAILED,
  /** In progress taskStatus. */
  INPROGRESS,
  /** Obsolete taskStatus. */
  OBSOLETE,
  /** Ready taskStatus. */
  READY,
  /** Reserved taskStatus. */
  RESERVED,
  /** Suspended taskStatus. */
  SUSPENDED;

  private static Map<Status, TaskStatus> conversionMap = loadConverstionMap();

  private static Map<Status, TaskStatus> loadConverstionMap() {
    Map<Status, TaskStatus> map = new HashMap<Status, TaskStatus>();
    map.put(Status.Completed, COMPLETED);
    map.put(Status.Created, CREATED);
    map.put(Status.Error, ERROR);
    map.put(Status.Exited, EXITED);
    map.put(Status.Failed, FAILED);
    map.put(Status.InProgress, INPROGRESS);
    map.put(Status.Obsolete, OBSOLETE);
    map.put(Status.Ready, READY);
    map.put(Status.Reserved, RESERVED);
    map.put(Status.Suspended, SUSPENDED);
    return map;
  }
  /**
   * Converts the Drools status to this TaskStatus.
   * @param status The status to convert
   * @return The converted status.
   */
 public static TaskStatus getTaskStatus(Status status) {
   return conversionMap.get(status);
 }

  /**
   * {@inheritDoc}
   */
  public String getLocalizedValue(Locale locale) {
    return I18nEnumerationHelper.getLocalizedValue(TaskStatusBundle.class, locale, this);
  }

  /**
   * {@inheritDoc}
   */
  public String getName() {
    return name();
  }
}


text:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Workorder;

class WorkOrderController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        $workorders = Workorder::all();
        return view('workorders.index',compact('workorders'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @return Response
     */
    public function store()
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  int  $id
     * @return Response
     */
    public function update($id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return Response
     */
    public function destroy($id)
    {
        //
    }
}


text:
<?php

namespace Kunstmaan\DashboardBundle\Command;

use Doctrine\ORM\EntityManagerInterface;
use Kunstmaan\DashboardBundle\Command\Helper\Analytics\ChartDataCommandHelper;
use Kunstmaan\DashboardBundle\Command\Helper\Analytics\GoalCommandHelper;
use Kunstmaan\DashboardBundle\Command\Helper\Analytics\MetricsCommandHelper;
use Kunstmaan\DashboardBundle\Command\Helper\Analytics\UsersCommandHelper;
use Kunstmaan\DashboardBundle\Entity\AnalyticsConfig;
use Kunstmaan\DashboardBundle\Entity\AnalyticsOverview;
use Kunstmaan\DashboardBundle\Entity\AnalyticsSegment;
use Kunstmaan\DashboardBundle\Helper\Google\Analytics\ConfigHelper;
use Kunstmaan\DashboardBundle\Helper\Google\Analytics\QueryHelper;
use Kunstmaan\DashboardBundle\Helper\Google\Analytics\ServiceHelper;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'kuma:dashboard:widget:googleanalytics:data:collect', description: 'Collect the Google Analytics dashboard widget data')]
final class GoogleAnalyticsDataCollectCommand extends Command
{
    /** @var EntityManagerInterface */
    private $em;

    /** @var OutputInterface */
    private $output;

    /** @var int */
    private $errors = 0;

    /** @var ServiceHelper */
    private $serviceHelper;
    /** @var ConfigHelper */
    private $configHelper;
    /** @var QueryHelper */
    private $queryHelper;

    public function __construct(EntityManagerInterface $em, ServiceHelper $serviceHelper, ConfigHelper $configHelper, QueryHelper $queryHelper)
    {
        parent::__construct();

        $this->em = $em;
        $this->serviceHelper = $serviceHelper;
        $this->configHelper = $configHelper;
        $this->queryHelper = $queryHelper;
    }

    protected function configure(): void
    {
        $this
            ->addOption('config', null, InputOption::VALUE_OPTIONAL, 'Specify to only update one config', false)
            ->addOption('segment', null, InputOption::VALUE_OPTIONAL, 'Specify to only update one segment', false)
            ->addOption('overview', null, InputOption::VALUE_OPTIONAL, 'Specify to only update one overview', false)
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->output = $output;

        // check if token is set
        if (!$this->configHelper->tokenIsSet()) {
            $this->output->writeln('You haven\'t configured a Google account yet');

            return 0;
        }

        // get params
        $configId = false;
        $segmentId = false;
        $overviewId = false;

        try {
            $configId = $input->getOption('config');
            $segmentId = $input->getOption('segment');
            $overviewId = $input->getOption('overview');
        } catch (\Exception $e) {
        }

        // get the overviews
        try {
            $overviews = [];

            if ($overviewId) {
                $overviews[] = $this->getSingleOverview($overviewId);
            } elseif ($segmentId) {
                $overviews = $this->getOverviewsOfSegment($segmentId);
            } elseif ($configId) {
                $overviews = $this->getOverviewsOfConfig($configId);
            } else {
                $overviews = $this->getAllOverviews();
            }

            // update the overviews
            $this->updateData($overviews);
            $result = '<fg=green>Google Analytics data updated with <fg=red>' . $this->errors . '</fg=red> error';
            $result .= $this->errors != 1 ? 's</fg=green>' : '</fg=green>';
            $this->output->writeln($result); // done

            return 0;
        } catch (\Exception $e) {
            $this->output->writeln($e->getMessage());

            return 1;
        }
    }

    /**
     * get a single overview
     *
     * @param int $overviewId
     */
    private function getSingleOverview($overviewId): AnalyticsOverview
    {
        // get specified overview
        $overviewRepository = $this->em->getRepository(AnalyticsOverview::class);
        $overview = $overviewRepository->find($overviewId);

        if (!$overview) {
            throw new \Exception('Unkown overview ID');
        }

        return $overview;
    }

    /**
     * get all overviews of a segment
     *
     * @param int $segmentId
     */
    private function getOverviewsOfSegment($segmentId): array
    {
        // get specified segment
        $segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
        $segment = $segmentRepository->find($segmentId);

        if (!$segment) {
            throw new \Exception('Unkown segment ID');
        }

        // init the segment
        $segmentRepository->initSegment($segment);

        // get the overviews
        return $segment->getOverviews();
    }

    /**
     * get all overviews of a config
     *
     * @param int $configId
     */
    private function getOverviewsOfConfig($configId): array
    {
        $configRepository = $this->em->getRepository(AnalyticsConfig::class);
        $segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
        $overviewRepository = $this->em->getRepository(AnalyticsOverview::class);
        // get specified config
        $config = $configRepository->find($configId);

        if (!$config) {
            throw new \Exception('Unkown config ID');
        }

        // create default overviews for this config if none exist yet
        if (!\count($config->getOverviews())) {
            $overviewRepository->addOverviews($config);
        }

        // init all the segments for this config
        $segments = $config->getSegments();
        foreach ($segments as $segment) {
            $segmentRepository->initSegment($segment);
        }

        // get the overviews
        return $config->getOverviews();
    }

    private function getAllOverviews(): array
    {
        $configRepository = $this->em->getRepository(AnalyticsConfig::class);
        $overviewRepository = $this->em->getRepository(AnalyticsOverview::class);
        $segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
        $configs = $configRepository->findAll();

        foreach ($configs as $config) {
            // add overviews if none exist yet
            if (\count($config->getOverviews()) == 0) {
                $overviewRepository->addOverviews($config);
            }

            // init all the segments for this config
            $segments = $config->getSegments();
            foreach ($segments as $segment) {
                $segmentRepository->initSegment($segment);
            }
        }

        // get all overviews
        return $overviewRepository->findAll();
    }

    /**
     * update the overviews
     */
    public function updateData($overviews): void
    {
        // helpers
        $metrics = new MetricsCommandHelper($this->configHelper, $this->queryHelper, $this->output, $this->em);
        $chartData = new ChartDataCommandHelper($this->configHelper, $this->queryHelper, $this->output, $this->em);
        $goals = new GoalCommandHelper($this->configHelper, $this->queryHelper, $this->output, $this->em);
        $visitors = new UsersCommandHelper($this->configHelper, $this->queryHelper, $this->output, $this->em);

        // get data per overview
        foreach ($overviews as $overview) {
            $this->configHelper->init($overview->getConfig()->getId());
            /* @var AnalyticsOverview $overview */
            $this->output->writeln('Fetching data for overview "<fg=green>' . $overview->getTitle() . '</fg=green>"');

            try {
                // metric data
                $metrics->getData($overview);
                if ($overview->getSessions()) { // if there are any visits
                    // day-specific data
                    $chartData->getData($overview);

                    // get goals
                    $goals->getData($overview);

                    // visitor types
                    $visitors->getData($overview);
                } else {
                    // reset overview
                    $this->reset($overview);
                    $this->output->writeln("\t" . 'No visitors');
                }
                // persist entity back to DB
                $this->output->writeln("\t" . 'Persisting..');
                $this->em->persist($overview);
                $this->em->flush();

                $this->em->getRepository(AnalyticsConfig::class)->setUpdated($overview->getConfig()->getId());
            } catch (\Google_ServiceException $e) {
                $error = explode(')', $e->getMessage());
                $error = $error[1];
                $this->output->writeln("\t" . '<fg=red>Invalid segment: </fg=red>' . $error);
                ++$this->errors;
            }
        }
    }

    /**
     * Reset the data for the overview
     */
    private function reset(AnalyticsOverview $overview): void
    {
        // reset overview
        $overview->setNewUsers(0);
        $overview->setReturningUsers(0);
    }
}


text:
package com.xinqihd.sns.gameserver.admin.user;

import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JSpinner;
import javax.swing.JTextPane;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.text.html.HTMLEditorKit;

import net.miginfocom.swing.MigLayout;

import org.jdesktop.swingx.JXComboBox;
import org.jdesktop.swingx.JXLabel;
import org.jdesktop.swingx.JXPanel;
import org.jdesktop.swingx.JXTextField;
import org.jdesktop.swingx.util.WindowUtils;

import com.xinqihd.sns.gameserver.admin.action.ActionName;
import com.xinqihd.sns.gameserver.admin.gui.WeaponAndItemPanel;
import com.xinqihd.sns.gameserver.admin.gui.ext.MyDialog;
import com.xinqihd.sns.gameserver.config.equip.ItemPojo;
import com.xinqihd.sns.gameserver.config.equip.WeaponColor;
import com.xinqihd.sns.gameserver.config.equip.WeaponPojo;
import com.xinqihd.sns.gameserver.db.mongo.EquipManager;
import com.xinqihd.sns.gameserver.entity.user.PropData;
import com.xinqihd.sns.gameserver.entity.user.PropDataValueType;
import com.xinqihd.sns.gameserver.script.function.EquipCalculator;
import com.xinqihd.sns.gameserver.util.DateUtil;
import com.xinqihd.sns.gameserver.util.StringUtil;

/**
 * 向玩家的背包中添加一项物品
 *
 * @author wangqi
 *
 */
public class AddItemToBagDialog extends MyDialog implements ListSelectionListener, ActionListener {

	private static final String SLOT_CMD = "slot";

	private WeaponAndItemPanel selectPanel = new WeaponAndItemPanel();
	private DefaultListModel listModel = null;
	private PropData propData = null;

	private JLabel idLbl = new JLabel("道具ID");
	private JLabel nameLbl = new JLabel("道具名称");
	private JLabel propIndateLbl = new JLabel("总有效战斗次数");
	private JLabel propUsedTimeLbl = new JLabel("道具已使用次数");
	private JLabel durationLbl = new JLabel("剩余有效期");
	private JLabel countLbl = new JLabel("道具数量");
	private JLabel levelLbl = new JLabel("道具等级");
	private JLabel attackLevLbl = new JLabel("攻击合成等级");
	private JLabel defendLevLbl = new JLabel("防御合成等级");
	private JLabel agilityLevLbl = new JLabel("敏捷合成等级");
	private JLabel luckLevLbl = new JLabel("幸运合成等级");
	private JLabel attackBaseLbl = new JLabel("攻击基础等级");
	private JLabel defendBaseLbl = new JLabel("防御基础等级");
	private JLabel agilityBaseLbl = new JLabel("敏捷基础等级");
	private JLabel luckBaseLbl = new JLabel("幸运基础等级");
	private JLabel bloodLevLbl = new JLabel("血量合成等级");
	private JLabel bloodPercentLbl = new JLabel("血量加成");
	private JLabel thewLevLbl = new JLabel("体力合成等级");
	private JLabel damageLevLbl = new JLabel("伤害合成等级");
	private JLabel valuetypeLbl = new JLabel("购买来源");
	private JLabel bandedLbl = new JLabel("是否绑定");

	private JLabel colorLbl = new JLabel("道具颜色");
	private JLabel qualityLbl = new JLabel("道具品质");
	private JLabel strengthLvlLbl = new JLabel("强化等级");

	private JXTextField idBtn = new JXTextField("道具ID");
	private JXTextField nameBtn = new JXTextField("道具名称");
	private JXTextField propIndateBtn = new JXTextField("总有效战斗次数");
	private JXTextField propUsedTimeBtn = new JXTextField("道具已使用次数");
	private JXTextField durationBtn = new JXTextField("剩余有效期");
	private JXTextField countBtn = new JXTextField("道具数量");
	private JXTextField levelBtn = new JXTextField("道具等级");
	private JXTextField attackLevBtn = new JXTextField("攻击等级");
	private JXTextField defendLevBtn = new JXTextField("防御等级");
	private JXTextField agilityLevBtn = new JXTextField("敏捷等级");
	private JXTextField luckLevBtn = new JXTextField("幸运等级");
	private JXTextField attackBaseBtn = new JXTextField("攻击基础等级");
	private JXTextField defendBaseBtn = new JXTextField("防御基础等级");
	private JXTextField agilityBaseBtn = new JXTextField("敏捷基础等级");
	private JXTextField luckBaseBtn = new JXTextField("幸运基础等级");
	private JXTextField bloodLevBtn = new JXTextField("血量合成等级");
	private JXTextField bloodPercentBtn = new JXTextField("血量加成");
	private JXTextField thewLevBtn = new JXTextField("体力合成等级");
	private JXTextField damageLevBtn = new JXTextField("伤害合成等级");
	private JXComboBox valuetypeBtn = new JXComboBox(PropDataValueType.values());
	private JCheckBox bandedBtn = new JCheckBox("是否绑定");
	private JXLabel addTimeStampLbl = new JXLabel("加入日期");
	private JXLabel bandedUserNameLbl = new JXLabel("绑定玩家名");
	private JXTextField addTimeStampFd = new JXTextField();
	private JXTextField bandedUserNameFd = new JXTextField();

	//private JXTextField colorBtn = new JXTextField("道具颜色");
	private JComboBox colorBtn = new JComboBox(WeaponColor.values());
	private JXTextField qualityBtn = new JXTextField("道具品质");
	private JComboBox strengthLvField = new JComboBox(new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15});

	private JTextPane enhanceField = new JTextPane();
	private JXLabel slotLbl = new JXLabel("插槽数");
	private JSpinner slotField = new JSpinner();
	private JButton slotButton = new JButton("修改插槽");

	private JButton okButton = new JButton("确定");
	private JButton cancelButton = new JButton("取消");

	public AddItemToBagDialog() {
		init();
	}

	public void init() {
		this.setSize(800, 600);
		Point c = WindowUtils.getPointForCentering(this);
		this.setLocation(c);

		selectPanel.addListSelectionListener(this);
		selectPanel.getList().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

		enhanceField.setEditorKit(new HTMLEditorKit());
		enhanceField.setEditable(false);
		enhanceField.setCaretPosition(0);

		JXPanel panel = new JXPanel();
		this.idBtn.setEnabled(false);
		this.nameBtn.setEnabled(false);
		this.durationBtn.setEnabled(false);

		panel.setLayout(new MigLayout("wrap 4, ins panel"));
		panel.add(idLbl, "sg label, push");
		panel.add(idBtn, "sg field, push");
		panel.add(nameLbl, "sg label, push");
		panel.add(nameBtn, "sg field, push");
		panel.add(propIndateLbl, "sg label, push");
		panel.add(propIndateBtn, "sg field, push");
		panel.add(propUsedTimeLbl, "sg label, push");
		panel.add(propUsedTimeBtn, "sg field, push");
		panel.add(durationLbl, "sg label, push");
		panel.add(durationBtn, "sg field, push");
		panel.add(countLbl, "sg label, push");
		panel.add(countBtn, "sg field, push");
		panel.add(levelLbl, "sg label, push");
		panel.add(levelBtn, "sg field, push");
		panel.add(attackLevLbl, "sg label, push");
		panel.add(attackLevBtn, "sg field, push");
		panel.add(defendLevLbl, "sg label, push");
		panel.add(defendLevBtn, "sg field, push");
		panel.add(agilityLevLbl, "sg label, push");
		panel.add(agilityLevBtn, "sg field, push");
		panel.add(luckLevLbl, "sg label, push");
		panel.add(luckLevBtn, "sg field, push");

		panel.add(attackBaseLbl, "sg label, push");
		panel.add(attackBaseBtn, "sg field, push");
		panel.add(defendBaseLbl, "sg label, push");
		panel.add(defendBaseBtn, "sg field, push");
		panel.add(agilityBaseLbl, "sg label, push");
		panel.add(agilityBaseBtn, "sg field, push");
		panel.add(luckBaseLbl, "sg label, push");
		panel.add(luckBaseBtn, "sg field, push");

		panel.add(bloodLevLbl, "sg label, push");
		panel.add(bloodLevBtn, "sg field, push");
		panel.add(bloodPercentLbl, "sg label, push");
		panel.add(bloodPercentBtn, "sg field, push");
		panel.add(thewLevLbl, "sg label, push");
		panel.add(thewLevBtn, "sg field, push");
		panel.add(damageLevLbl, "sg label, push");
		panel.add(damageLevBtn, "sg field, push");
		panel.add(valuetypeLbl, "sg label, push");
		panel.add(valuetypeBtn, "sg field, push");
		panel.add(bandedLbl, "sg label, push");
		panel.add(bandedBtn, "sg field, push");
		panel.add(colorLbl, "sg label, push");
		panel.add(colorBtn, "sg field, push");
		panel.add(qualityLbl, "sg label, push");
		panel.add(qualityBtn, "sg field, push");
		panel.add(strengthLvlLbl, "sg label, push");
		panel.add(strengthLvField, "sg field, push");
		panel.add(addTimeStampLbl, "sg label, push");
		panel.add(addTimeStampFd, "sg field, push");
		panel.add(bandedUserNameLbl, "sg label, push");
		panel.add(bandedUserNameFd, "sg field, push");
		panel.add(bandedLbl, "sg label, push");
		panel.add(bandedBtn, "sg field, push");
		panel.add(enhanceField, "newline, spanx 2, grow");
		panel.add(slotLbl, "spanx, split 3");
		panel.add(slotField, "sg field");
		panel.add(slotButton, "");

		this.slotButton.setActionCommand(SLOT_CMD);
		this.slotButton.addActionListener(this);

		this.okButton.setActionCommand(ActionName.OK.name());
		this.okButton.addActionListener(this);
		this.cancelButton.setActionCommand(ActionName.CANCEL.name());
		this.cancelButton.addActionListener(this);
		JXPanel btnPanel = new JXPanel();
		btnPanel.add(okButton);
		btnPanel.add(cancelButton);

		this.setLayout(new MigLayout(""));
		this.add(panel, "dock center, width 60%");
		this.add(selectPanel, "dock east, width 40%, height 100%");
		this.add(btnPanel, "dock south, width 60%");

		this.setModal(true);

		updateStatus();
	}

	public void updateStatus() {
		if ( this.propData != null ) {
			this.idBtn.setText(propData.getItemId());
			this.nameBtn.setText(propData.getName());
			this.propIndateBtn.setText(String.valueOf(propData.getPropIndate()));
			this.propUsedTimeBtn.setText(String.valueOf(propData.getPropUsedTime()));
			this.durationBtn.setText(String.valueOf(propData.getDuration()));
			this.countBtn.setText(String.valueOf(propData.getCount()));
			this.levelBtn.setText(String.valueOf(propData.getLevel()));
			this.attackLevBtn.setText(String.valueOf(propData.getAttackLev()));
			this.defendLevBtn.setText(String.valueOf(propData.getDefendLev()));
			this.agilityLevBtn.setText(String.valueOf(propData.getAgilityLev()));
			this.luckLevBtn.setText(String.valueOf(propData.getLuckLev()));
			this.attackBaseBtn.setText(String.valueOf(propData.getBaseAttack()));
			this.defendBaseBtn.setText(String.valueOf(propData.getBaseDefend()));
			this.agilityBaseBtn.setText(String.valueOf(propData.getBaseAgility()));
			this.luckBaseBtn.setText(String.valueOf(propData.getBaseLuck()));
			this.bloodLevBtn.setText(String.valueOf(propData.getBloodLev()));
			this.bloodPercentBtn.setText(String.valueOf(propData.getBloodPercent()));
			this.thewLevBtn.setText(String.valueOf(propData.getThewLev()));
			this.damageLevBtn.setText(String.valueOf(propData.getDamageLev()));
			this.valuetypeBtn.setSelectedItem(propData.getValuetype());
			this.bandedBtn.setSelected( propData.isBanded() );
			this.colorBtn.setSelectedItem(propData.getWeaponColor());
			this.qualityBtn.setText("N/A");
			this.strengthLvField.setSelectedItem(propData.getLevel());
			this.enhanceField.setText(propData.getEnhanceMap().toString());
			this.bandedBtn.setSelected(propData.isBanded());
			this.bandedUserNameFd.setText(propData.getBandUserName());
			this.addTimeStampFd.setText(DateUtil.formatDateTime(new Date(propData.getAddTimestamp())));
			this.slotField.setValue(propData.getTotalSlot());
			this.strengthLvField.setSelectedItem(propData.getMaxLevel());
			this.repaint();
		}
	}

	/* (non-Javadoc)
	 * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
	 */
	@Override
	public void valueChanged(ListSelectionEvent e) {
		if ( !e.getValueIsAdjusting() ) {
			JList list = (JList)e.getSource();
			if ( this.selectPanel.isWeaponSelected() ) {
				WeaponPojo pojo = (WeaponPojo)list.getSelectedValue();
				if ( pojo != null ) {
					if ( this.propData != null ) {
						this.propData = pojo.toPropData(30, this.propData.getWeaponColor());
					} else {
						this.propData = pojo.toPropData(30, WeaponColor.WHITE);
					}
					updateStatus();
				}
			} else {
				ItemPojo pojo = (ItemPojo)list.getSelectedValue();
				if ( pojo != null ) {
					this.propData = pojo.toPropData();
					updateStatus();
				}
			}
			System.out.println(this.propData);
		}
	}

	/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		if ( ActionName.OK.name().equals(e.getActionCommand()) ) {
			int pew = propData.getPew();
			propData.setPropIndate(Integer.parseInt(this.propIndateBtn.getText()));
			propData.setCount(Integer.parseInt(this.countBtn.getText()));
			propData.setAttackLev(Integer.parseInt(this.attackLevBtn.getText()));
			propData.setDefendLev(Integer.parseInt(this.defendLevBtn.getText()));
			propData.setAgilityLev(Integer.parseInt(this.agilityLevBtn.getText()));
			propData.setLuckLev(Integer.parseInt(this.luckLevBtn.getText()));
			propData.setBaseAttack(Integer.parseInt(this.attackBaseBtn.getText()));
			propData.setBaseDefend(Integer.parseInt(this.defendBaseBtn.getText()));
			propData.setBaseAgility(Integer.parseInt(this.agilityBaseBtn.getText()));
			propData.setBaseLuck(Integer.parseInt(this.luckBaseBtn.getText()));
			propData.setBloodLev(Integer.parseInt(this.bloodLevBtn.getText()));
			propData.setBloodPercent(Integer.parseInt(this.bloodPercentBtn.getText()));
			propData.setThewLev(Integer.parseInt(this.thewLevBtn.getText()));
			propData.setDamageLev(Integer.parseInt(this.damageLevBtn.getText()));
			propData.setBanded(this.bandedBtn.isSelected());
			propData.setBandUserName(this.bandedUserNameFd.getText());
			WeaponColor weaponColor = WeaponColor.values()[colorBtn.getSelectedIndex()];
			if ( weaponColor != propData.getWeaponColor() ) {
				propData.setWeaponColor(weaponColor);
				propData = EquipManager.getInstance().getWeaponById(propData.getItemId()).
						toPropData(propData.getPropIndate(), weaponColor);
			}
			Integer levelObj = (Integer)this.strengthLvField.getSelectedItem();
			int maxLevel = 0;
			if ( levelObj != null ) {
				maxLevel = levelObj.intValue();
			}
			propData.setMaxLevel(maxLevel);
			int level = StringUtil.toInt(this.levelBtn.getText(), 5);
			if ( level != propData.getLevel() ) {
				EquipCalculator.weaponUpLevel(this.propData, level);
			}
			propData.setPropUsedTime(Integer.parseInt(this.propUsedTimeBtn.getText()));
			propData.setPew(pew);
			this.dispose();
		} else if ( ActionName.CANCEL.name().equals(e.getActionCommand()) ) {
			this.propData = null;
			this.dispose();
		} else if ( SLOT_CMD.equals(e.getActionCommand()) ) {
			ManagePropDataSlotDialog dialog = new ManagePropDataSlotDialog(propData, (Integer)this.slotField.getValue());
			dialog.setVisible(true);
			//this.propData = dialog.getPropData();
		}
	}

	public PropData getPropData() {
		return this.propData;
	}

	public void setPropData(PropData propData) {
		this.propData = propData;
		this.updateStatus();
	}
}


text:
import _plotly_utils.basevalidators

class DvalueValidator(_plotly_utils.basevalidators.NumberValidator):
    def __init__(
        self, plotly_name="dvalue", parent_name="layout.xaxis.rangebreak", **kwargs
    ):
        super(DvalueValidator, self).__init__(
            plotly_name=plotly_name,
            parent_name=parent_name,
            edit_type=kwargs.pop("edit_type", "calc"),
            min=kwargs.pop("min", 0),
            **kwargs,
        )


text:
{% extends "profiles/base.html" %}

{% load i18n %}

{% block head_title %}{% blocktrans %}Edit Profile{% endblocktrans %}{% endblock %}

{% block body %}

    <h1>{% trans "Edit Profile" %}</h1>

    {% include "profiles/profile_form.html" %}

{% endblock %}


text:
package restmapper

import (
	"k8s.io/apimachinery/pkg/api/meta"
	"k8s.io/apimachinery/pkg/runtime/schema"
	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
	"k8s.io/client-go/discovery"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/restmapper"
)

type DynamicRESTMapper struct {
	client   discovery.DiscoveryInterface
	delegate meta.RESTMapper
}

// NewDynamicRESTMapper returns a RESTMapper that dynamically discovers resource
// types at runtime. This is in contrast to controller-manager's default RESTMapper, which
// only checks resource types at startup, and so can't handle the case of first creating a
// CRD and then creating an instance of that CRD.
func NewDynamicRESTMapper(cfg *rest.Config) (meta.RESTMapper, error) {
	client, err := discovery.NewDiscoveryClientForConfig(cfg)
	if err != nil {
		return nil, err
	}

	drm := &DynamicRESTMapper{client: client}
	if err := drm.reload(); err != nil {
		return nil, err
	}
	return drm, nil
}

func (drm *DynamicRESTMapper) reload() error {
	gr, err := restmapper.GetAPIGroupResources(drm.client)
	if err != nil {
		return err
	}
	drm.delegate = restmapper.NewDiscoveryRESTMapper(gr)
	return nil
}

// reloadOnError checks if an error indicates that the delegated RESTMapper needs to be
// reloaded, and if so, reloads it and returns true.
func (drm *DynamicRESTMapper) reloadOnError(err error) bool {
	if _, matches := err.(*meta.NoKindMatchError); !matches {
		return false
	}
	err = drm.reload()
	if err != nil {
		utilruntime.HandleError(err)
	}
	return err == nil
}

func (drm *DynamicRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
	gvk, err := drm.delegate.KindFor(resource)
	if drm.reloadOnError(err) {
		gvk, err = drm.delegate.KindFor(resource)
	}
	return gvk, err
}

func (drm *DynamicRESTMapper) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error) {
	gvks, err := drm.delegate.KindsFor(resource)
	if drm.reloadOnError(err) {
		gvks, err = drm.delegate.KindsFor(resource)
	}
	return gvks, err
}

func (drm *DynamicRESTMapper) ResourceFor(input schema.GroupVersionResource) (schema.GroupVersionResource, error) {
	gvr, err := drm.delegate.ResourceFor(input)
	if drm.reloadOnError(err) {
		gvr, err = drm.delegate.ResourceFor(input)
	}
	return gvr, err
}

func (drm *DynamicRESTMapper) ResourcesFor(input schema.GroupVersionResource) ([]schema.GroupVersionResource, error) {
	gvrs, err := drm.delegate.ResourcesFor(input)
	if drm.reloadOnError(err) {
		gvrs, err = drm.delegate.ResourcesFor(input)
	}
	return gvrs, err
}

func (drm *DynamicRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error) {
	m, err := drm.delegate.RESTMapping(gk, versions...)
	if drm.reloadOnError(err) {
		m, err = drm.delegate.RESTMapping(gk, versions...)
	}
	return m, err
}

func (drm *DynamicRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error) {
	ms, err := drm.delegate.RESTMappings(gk, versions...)
	if drm.reloadOnError(err) {
		ms, err = drm.delegate.RESTMappings(gk, versions...)
	}
	return ms, err
}

func (drm *DynamicRESTMapper) ResourceSingularizer(resource string) (singular string, err error) {
	s, err := drm.delegate.ResourceSingularizer(resource)
	if drm.reloadOnError(err) {
		s, err = drm.delegate.ResourceSingularizer(resource)
	}
	return s, err
}


text:
package org.b3log.solo.model;

/**
 * This class defines all archive date model relevant keys.
 *
 * @author Liang Ding
 * @version 1.0.0.5, Jan 28, 2019
 */
public final class ArchiveDate {

    /**
     * Archive date.
     */
    public static final String ARCHIVE_DATE = "archiveDate";

    /**
     * Archive dates.
     */
    public static final String ARCHIVE_DATES = "archiveDates";

    /**
     * Archive time.
     */
    public static final String ARCHIVE_TIME = "archiveTime";

    //// Transient ////
    /**
     * Key of archive date article count.
     */
    public static final String ARCHIVE_DATE_T_PUBLISHED_ARTICLE_COUNT = "archiveDatePublishedArticleCount";

    /**
     * Archive date year.
     */
    public static final String ARCHIVE_DATE_YEAR = "archiveDateYear";

    /**
     * Archive date month.
     */
    public static final String ARCHIVE_DATE_MONTH = "archiveDateMonth";

    /**
     * Private constructor.
     */
    private ArchiveDate() {
    }
}


text:
Practice project for grokking redux more deeply

To run, `npm start` and visit `http://localhost:7777/webpack-dev-server/increment` or `http://localhost:7777/webpack-dev-server/hello`

To generate static html files, first you need to have installed http-server globally with `npm install -g http-server`, and then you can run `npm run build && http-server dist -p 9999` and visit `http://localhost:9999/increment.html` or `http://localhost:9999/hello.html`


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.securitydevops.fluent;

import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.securitydevops.fluent.models.AzureDevOpsConnectorInner;

/** An instance of this class provides access to all the operations defined in AzureDevOpsConnectorsClient. */
public interface AzureDevOpsConnectorsClient {
    /**
     * The listByResourceGroup operation.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedIterable<AzureDevOpsConnectorInner> listByResourceGroup(String resourceGroupName);

    /**
     * The listByResourceGroup operation.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedIterable<AzureDevOpsConnectorInner> listByResourceGroup(String resourceGroupName, Context context);

    /**
     * Returns a monitored AzureDevOps Connector resource for a given ID.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<AzureDevOpsConnectorInner> getByResourceGroupWithResponse(
        String resourceGroupName, String azureDevOpsConnectorName, Context context);

    /**
     * Returns a monitored AzureDevOps Connector resource for a given ID.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    AzureDevOpsConnectorInner getByResourceGroup(String resourceGroupName, String azureDevOpsConnectorName);

    /**
     * Creates or updates an Azure DevOps Connector.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param azureDevOpsConnector Connector resource payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<AzureDevOpsConnectorInner>, AzureDevOpsConnectorInner> beginCreateOrUpdate(
        String resourceGroupName, String azureDevOpsConnectorName, AzureDevOpsConnectorInner azureDevOpsConnector);

    /**
     * Creates or updates an Azure DevOps Connector.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param azureDevOpsConnector Connector resource payload.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<AzureDevOpsConnectorInner>, AzureDevOpsConnectorInner> beginCreateOrUpdate(
        String resourceGroupName,
        String azureDevOpsConnectorName,
        AzureDevOpsConnectorInner azureDevOpsConnector,
        Context context);

    /**
     * Creates or updates an Azure DevOps Connector.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param azureDevOpsConnector Connector resource payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    AzureDevOpsConnectorInner createOrUpdate(
        String resourceGroupName, String azureDevOpsConnectorName, AzureDevOpsConnectorInner azureDevOpsConnector);

    /**
     * Creates or updates an Azure DevOps Connector.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param azureDevOpsConnector Connector resource payload.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    AzureDevOpsConnectorInner createOrUpdate(
        String resourceGroupName,
        String azureDevOpsConnectorName,
        AzureDevOpsConnectorInner azureDevOpsConnector,
        Context context);

    /**
     * Update monitored AzureDevOps Connector details.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<AzureDevOpsConnectorInner>, AzureDevOpsConnectorInner> beginUpdate(
        String resourceGroupName, String azureDevOpsConnectorName);

    /**
     * Update monitored AzureDevOps Connector details.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param azureDevOpsConnector Connector resource payload.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<AzureDevOpsConnectorInner>, AzureDevOpsConnectorInner> beginUpdate(
        String resourceGroupName,
        String azureDevOpsConnectorName,
        AzureDevOpsConnectorInner azureDevOpsConnector,
        Context context);

    /**
     * Update monitored AzureDevOps Connector details.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    AzureDevOpsConnectorInner update(String resourceGroupName, String azureDevOpsConnectorName);

    /**
     * Update monitored AzureDevOps Connector details.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param azureDevOpsConnector Connector resource payload.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    AzureDevOpsConnectorInner update(
        String resourceGroupName,
        String azureDevOpsConnectorName,
        AzureDevOpsConnectorInner azureDevOpsConnector,
        Context context);

    /**
     * Delete monitored AzureDevOps Connector details.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String azureDevOpsConnectorName);

    /**
     * Delete monitored AzureDevOps Connector details.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<Void>, Void> beginDelete(
        String resourceGroupName, String azureDevOpsConnectorName, Context context);

    /**
     * Delete monitored AzureDevOps Connector details.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    void delete(String resourceGroupName, String azureDevOpsConnectorName);

    /**
     * Delete monitored AzureDevOps Connector details.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param azureDevOpsConnectorName Name of the AzureDevOps Connector.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    void delete(String resourceGroupName, String azureDevOpsConnectorName, Context context);

    /**
     * Returns a list of monitored AzureDevOps Connectors.
     *
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedIterable<AzureDevOpsConnectorInner> list();

    /**
     * Returns a list of monitored AzureDevOps Connectors.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedIterable<AzureDevOpsConnectorInner> list(Context context);
}


text:
class InitProductSynonimsForProducts < ActiveRecord::Migration
  def up
    Spree::Product.find_each do |product|
      product.add_synonim
    end
  end

  def down
    Spree::ProductSynonim.destroy_all
  end
end


text:
<?php

namespace Symfony\Component\Templating;

/**
 * Interface to be implemented by all templates.
 *
 * @author Victor Berchet <victor@suumit.com>
 */
interface TemplateReferenceInterface
{
    /**
     * Gets the template parameters.
     *
     * @return array An array of parameters
     */
    function all();

    /**
     * Sets a template parameter.
     *
     * @param string $name   The parameter name
     * @param string $value  The parameter value
     *
     * @return TemplateReferenceInterface The TemplateReferenceInterface instance
     *
     * @throws  \InvalidArgumentException if the parameter is not defined
     */
    function set($name, $value);

    /**
     * Gets a template parameter.
     *
     * @param string $name The parameter name
     *
     * @return string The parameter value
     *
     * @throws  \InvalidArgumentException if the parameter is not defined
     */
    function get($name);

    /**
     * Returns the template signature
     *
     * @return string A UID for the template
     */
    function getSignature();

}