text:
package com.microsoft.azure.management.datafactory.v2018_06_01;

import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.datafactory.v2018_06_01.implementation.DataFactoryManager;
import com.microsoft.azure.management.datafactory.v2018_06_01.implementation.CreateRunResponseInner;

/**
 * Type representing CreateRunResponse.
 */
public interface CreateRunResponse extends HasInner<CreateRunResponseInner>, HasManager<DataFactoryManager> {
    /**
     * @return the runId value.
     */
    String runId();

}


text:
<?php

use UliCMS\Constants\CommentStatus;

class CommentStatusTest extends \PHPUnit\Framework\TestCase
{
    public function testDefault()
    {
        $this->assertEquals("pending", CommentStatus::DEFAULT_STATUS);
    }

    public function testPending()
    {
        $this->assertEquals("pending", CommentStatus::PENDING);
    }

    public function testPublished()
    {
        $this->assertEquals("published", CommentStatus::PUBLISHED);
    }

    public function testSpam()
    {
        $this->assertEquals("spam", CommentStatus::SPAM);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

	<title>Login</title>

Login

	<?php echo validation_errors(); ?>

	<?php if (isset($error)): ?>

<?php echo $error; ?>

	<?php endif ?>

	<?php echo form_open('auth/login'); ?>
		<?php echo form_label('Username', 'username'); ?>
		<?php echo form_input(array(
			'name' => 'username',
			'id' => 'username',
			'value' => set_value('username')
		)); ?>
		<?php echo form_label('Password', 'password'); ?>
		<?php echo form_password(array(
			'name' => 'password',
			'id' => 'password'
		)); ?>
		<?php echo form_submit('login', 'Login'); ?>
	<?php echo form_close(); ?>


text:
#include "Shortcuts.h"

std::map<QString, ShortcutInfo> get_default_shortcuts();

ApplicationShortcuts::ApplicationShortcuts(){
	this->default_shortcuts = ::get_default_shortcuts();
	this->reset_settings();
}

void ApplicationShortcuts::restore_settings(const Shortcuts &shortcuts){
	this->current_shortcuts.clear();
	for (auto &s : shortcuts.shortcuts){
		auto ss = std::make_shared<ShortcutSetting>();
		auto key = s.first;
		ss->command = key;
		this->current_shortcuts[key] = ss;

		for (auto &s2 : s.second)
			ss->sequences.emplace_back(QKeySequence(s2));
	}
}

void ApplicationShortcuts::reset_settings(){
	auto &map = this->current_shortcuts;
	map.clear();
	for (auto &p : this->default_shortcuts) {
		auto key = p.second.internal_name;
		std::shared_ptr<ShortcutSetting> ss(new ShortcutSetting);
		ss->command = key;
		map[key] = ss;
		for (size_t i = 0; i < p.second.sequences_count; i++)
			ss->sequences.push_back(p.second.default_sequences_seq[i]);
	}
}

std::shared_ptr<Shortcuts> ApplicationShortcuts::save_settings() const{
	auto ret = std::make_shared<Shortcuts>();
	for (auto &s : this->current_shortcuts){
		auto key = s.first;
		auto &shortcuts = ret->shortcuts[key];
		for (auto &seq : s.second->sequences)
			shortcuts.push_back(seq.toString());
	}
	return ret;
}

const ShortcutInfo *ApplicationShortcuts::get_shortcut_info(const QString &command) const{
	auto it = this->default_shortcuts.find(command);
	if (it == this->default_shortcuts.end())
		return nullptr;
	return &it->second;
}

QString ApplicationShortcuts::get_display_name(const QString &command) const{
	auto si = this->get_shortcut_info(command);
	if (!si)
		return QString();
	return si->display_name;
}

const ShortcutSetting *ApplicationShortcuts::get_shortcut_setting(const QString &command) const{
	auto it = this->current_shortcuts.find(command);
	if (it == this->current_shortcuts.end())
		return nullptr;
	return it->second.get();
}

std::vector<ShortcutTriple> ApplicationShortcuts::get_default_shortcuts() const{
	std::vector<ShortcutTriple> ret;
	for (auto &p : this->default_shortcuts){
		if (!p.second.sequences_count)
			continue;
		ShortcutTriple pushee;
		pushee.command = p.second.internal_name;
		pushee.display_name = p.second.display_name;
		for (size_t i = 0; i < p.second.sequences_count; i++){
			pushee.sequence = p.second.default_sequences_seq[i];
			ret.push_back(pushee);
		}
	}
	return ret;
}

std::vector<ShortcutTriple> ApplicationShortcuts::get_current_shortcuts() const{
	std::vector<ShortcutTriple> ret;
	for (auto &p : this->current_shortcuts){
		if (!p.second->sequences.size())
			continue;
		ShortcutTriple pushee;
		pushee.command = p.second->command;
		pushee.display_name = this->get_display_name(pushee.command);
		for (auto &s : p.second->sequences){
			pushee.sequence = s;
			ret.push_back(pushee);
		}
	}
	return ret;
}

void ApplicationShortcuts::update(const std::vector<ShortcutTriple> &new_shortcuts){
	this->current_shortcuts.clear();
	for (auto &shortcut : new_shortcuts){
		auto it = this->current_shortcuts.find(shortcut.command);
		std::shared_ptr<ShortcutSetting> setting;
		if (it == this->current_shortcuts.end()){
			setting.reset(new ShortcutSetting);
			setting->command = shortcut.command;
			this->current_shortcuts[shortcut.command] = setting;
		}else
			setting = it->second;
		setting->sequences.push_back(shortcut.sequence);
	}
}


text:
namespace std {
using ::uint8_t;
using ::int32_t;
}
#endif

namespace gemmlowp {

namespace eight_bit_int_gemm {

// Concurrency / reentrancy notice
// ===============================
//
// This eight_bit_int_gemm has global singleton persistent state.
// A global lock ensures serialization of calls, so this library
// is fully reentrant but only one calling thread gets to actually run
// at a time, while other calling threads would wait. So it is safe
// albeit potentially slow to call the functions exposed here on
// multiple threads concurrently.
//
// Users who prefer a state-less, singleton-less interface,
// should use the main gemmlowp interface (public/gemmlowp.h) instead.

// The main entry point to compute a Gemm. This is the standard
// EightBitIntGemm interface.
void EightBitIntGemm(bool transpose_a, bool transpose_b, bool transpose_c,
                     int m, int n, int k, const std::uint8_t *a,
                     std::int32_t a_offset, int lda, const std::uint8_t *b,
                     std::int32_t b_offset, int ldb, std::uint8_t *c,
                     std::int32_t c_offset, std::int32_t c_mult_int,
                     std::int32_t c_shift, int ldc);

// Frees any persistent resources
// (threads, thread pools, allocators, buffers, ...)
// that gemmlowp might hold. This is called automatically
// on thread exit, but one may also call it earlier, at any time.
void FreePersistentResources();

// Allows specifying the number of hardware threads, as a hint as to
// how many worker threads to use for sufficiently large Gemm's.
// We will never use more threads than that, but may use fewer,
// for instance on Gemm's that are too small to benefit from all
// available threads. The value 0 lets the implementation query
// the system to determine the number of hardware threads.
// Default value: 0.
void SetMaxNumThreads(int n);

}  // namespace eight_bit_int_gemm

}  // namespace gemmlowp

#endif  // GEMMLOWP_EIGHT_BIT_INT_GEMM_EIGHT_BIT_INT_GEMM_H_


text:
package jflex;

/**
 * An interval of characters with basic operations.
 *
 * @author Gerwin Klein
 * @version JFlex 1.6.1
 */
public final class Interval {

  /* start and end of the interval */
  public int start, end;

  /**
   * Constuct a new interval from start to end.
   *
   * @param start  first character the interval should contain
   * @param end    last  character the interval should contain
   */
  public Interval(int start, int end) {
    this.start = start;
    this.end = end;
  }

  /**
   * Copy constructor
   */
  public Interval(Interval other) {
    this.start = other.start;
    this.end   = other.end;
  }

  /**
   * Return true iff point is contained in this interval.
   *
   * @param point  the character to check
   */
  public boolean contains(int point) {
    return start <= point && end >= point;
  }

  /**
   * Return true iff this interval completely contains the
   * other one.
   *
   * @param other    the other interval
   */
  public boolean contains(Interval other) {
    return this.start <= other.start && this.end >= other.end;
  }

  /**
   * Return true if o is an interval
   * with the same borders.
   *
   * @param o  the object to check equality with
   */
  public boolean equals(Object o) {
    if ( o == this ) return true;
    if ( !(o instanceof Interval) ) return false;

    Interval other = (Interval) o;
    return other.start == this.start && other.end == this.end;
  }

  /**
   * Set a new last character
   *
   * @param end  the new last character of this interval
   */
  public void setEnd(int end) {
    this.end = end;
  }

  /**
   * Set a new first character
   *
   * @param start the new first character of this interval
   */
  public void setStart(int start) {
    this.start = start;
  }

  /**
   * Check whether a character is printable.
   *
   * @param c the character to check
   */
  private static boolean isPrintable(int c) {
    // fixme: should make unicode test here
    return c > 31 && c < 127;
  }

  /**
   * Get a String representation of this interval.
   *
   * @return a string "[start-end]" or
   *         "[start]" (if there is only one character in
   *         the interval) where start and
   *         end are either a number (the character code)
   *         or something of the from 'a'.
   */
  public String toString() {
    StringBuilder result = new StringBuilder("[");

    if ( isPrintable(start) )
      result.append("'").append((char)start).append("'");
    else
      result.append(start);

    if (start != end) {
      result.append("-");

      if ( isPrintable(end) )
        result.append("'").append((char)end).append("'");
      else
        result.append(end);
    }

    result.append("]");
    return result.toString();
  }

  /**
   * Make a copy of this interval.
   *
   * @return the copy
   */
  public Interval copy() {
    return new Interval(start,end);
  }
}


text:
package main

import (
	"flag"
	"fmt"
	"net"
	"os"
	"path/filepath"
	"time"
)

var (
	network = flag.String("network", "tcp", "specify network")
	timeout = flag.Duration("timeout", 5*time.Second, "specify a timeout duration")
)

func usage() {
	fmt.Fprintf(os.Stderr, "Usage: %s [options] hostname service/port ...\n", filepath.Base(os.Args[0]))
	flag.PrintDefaults()
}

func main() {
	flag.Usage = usage
	flag.Parse()

	if flag.NArg() < 2 {
		usage()
		os.Exit(1)
	}

	hostname := flag.Arg(0)
	failed := 0
	for _, service := range flag.Args()[1:] {
		port, err := net.LookupPort(*network, service)
		if err != nil {
			fmt.Printf("unknown service: %s\n", service)
			failed++
			continue
		}
		fmt.Printf("connecting to %s on port %d... ", hostname, port)

		address := net.JoinHostPort(hostname, service)
		conn, err := net.DialTimeout(*network, address, *timeout)
		if err != nil {
			failed++
			fmt.Printf("failed: %v\n", err)
			continue
		}
		fmt.Printf("ok\n")
		conn.Close()
	}
	os.Exit(failed)
}


text:
<meta charset="UTF-8">
<title>ICommand.equals - kommandant-core</title>
<link rel="stylesheet" href="..\..\..\style.css">

kommandant-core / com.github.kvnxiao.kommandant.command / ICommand / equals

equals

open fun equals(other: Any?): Boolean (source)

Equals comparator takes into account the props and subCommands set.


text:
{% macro comments_embeded(comments) %}
    {% for comment in comments %}
        {{ make_comment(comment) }}
    {% endfor %}
{% endmacro %}

{% macro make_comment(comment) %}

                {{ comment.name }}
                {{ comment.date|relativeTime }}

{{ comment.text }}

{% endmacro %}


text:
Function Send-EmailRepairMessage
{
    [CmdletBinding()]
    Param(
		[hashtable]$PoShMonConfiguration,
		[object[]]$RepairOutputValues,
		[hashtable]$NotificationSink
    )

	$subject = New-HtmlRepairSubject -PoShMonConfiguration $PoShMonConfiguration -RepairOutputValues $RepairOutputValues
	$body = New-HtmlRepairBody -PoShMonConfiguration $PoShMonConfiguration -RepairOutputValues $RepairOutputValues

	Send-PoShMonEmailMessage -PoShMonConfiguration $PoShMonConfiguration -NotificationSink $NotificationSink `
							 -Subject $Subject -Body $Body -Critical $false
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <Button
            android:layout_alignParentBottom="true"
            android:id="@+id/remove_btn"
            binding = "{Click @- RemoveItem}"
            android:text="Remove item"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            tools:ignore="MissingPrefix" />

    <LinearLayout
            android:layout_above="@id/remove_btn"
            android:id="@+id/rv_container"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true">

        <android.support.v7.widget.RecyclerView
                android:id="@+id/paginated_rv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/open_main_activity_button"
                itemTemplate="@layout/activity_paginated_rv_item"
                binding="{ItemsSource @= DataItems};
            { PageDescriptor @= LoadNextPage }; { NextPage =@ LoadNextPage }; " />

        <android.support.v7.widget.RecyclerView
                android:background="#FF00FF00"
                android:id="@+id/paginated_rv2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/open_main_activity_button"
                itemTemplate="@layout/activity_paginated_rv_item"
                binding="{ItemsSource @+ DataItems2};
            { RemoveItems !@ RemoveItems};
            { PageDescriptor @= LoadNextPage2 }; { NextPage =@ LoadNextPage2 }; " />

    </LinearLayout>

</RelativeLayout>


text:
/*global define*/
define(function(require, exports, module) {
    var FN_REGEX = /function\s+([a-zA-Z0-9_\-\$]+)\s*\(/g;
    var PROP_FN_REGEX = /([a-zA-Z0-9_\-\$]+)\s*[:=]\s*function\s*\(/g;
    var indexToLine = require("./util.js").indexToLine;

    return function(options, content, callback) {
        var match;
        var tags = [];
        // Regular old functions
        while(match = FN_REGEX.exec(content)) {
            //console.log(match);
            tags.push({symbol: match[1], locator: indexToLine(content, match.index)});
        }
        // Property functions
        while(match = PROP_FN_REGEX.exec(content)) {
            //console.log(match);
            tags.push({symbol: match[1], locator: indexToLine(content, match.index)});
        }
        callback(null, tags);
    };
});


text:
<?php
namespace wokav\Vinterface;

/**
 *关注组件接口定义
 */
interface FollowInterface
{
    //查找用户的关注列表信息
    public static function findFollow($id);
   //返回是否关注,已关注返回被关注用户信息,未关注返回null
    public static  function isFollow($id);

}


text:
#include "general.h"

UtilityParticleSet::UtilityParticleSet(
	int poolSize, float effectDuration, string objectName,
	string effectName, string alternateEffectName )
{
	SceneManager* mSceneMgr = mLump.mSceneMgr;
	ParticleSystem* pSys;

	for (int i = 0; i < poolSize; i ++)
	{

		if ( alternateEffectName != "" && i % 2 == 1 )
		{
			pSys = mSceneMgr->createParticleSystem(
				objectName + StringConverter::toString( i ), alternateEffectName);
		}
		else
		{
			pSys = mSceneMgr->createParticleSystem(
				objectName + StringConverter::toString( i ), effectName);
		}

		// Starts disabled
		// pSys->getEmitter( 0 )->setEnabled( true );

		Ogre::SceneNode *particleNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
		particleNode->attachObject( pSys );

		// Starts not visible
		particleNode->setVisible( false );

		mPSPool.push_back( new ParticleInfo( particleNode, -1) );
	}

	mEffectDuration = effectDuration;
	mCurrentPS = mPSPool.begin();
}

// ---------------------------------------------------------------------------------

UtilityParticleSet::~UtilityParticleSet(void)
{
	mPSPool.clear();
}

// ---------------------------------------------------------------------------------

SceneNode* UtilityParticleSet::startNextPS( Vector3 position )
{
	particlesList_it current = mCurrentPS ++;
	if ( mCurrentPS == mPSPool.end() )
		mCurrentPS = mPSPool.begin();

	ParticleInfo* pInfo = ( *current );

	// If is not already visible, increase the counter
	if ( pInfo->getExpirationTime() < 0 )
		mActivePSNumber ++;

	ParticleSystem* pSys = (ParticleSystem*) pInfo->getPSNode()->getAttachedObject( 0 );

	// Reset the particle system (if is still running)
	pSys->getEmitter( 0 )->setEnabled( false );
	pSys->getEmitter( 0 )->setEnabled( true );

	// Set the expiration time to current time + effect duration
	pInfo->setExpirationTime( mLump.getTotalElapsedTime() + mEffectDuration );

	pInfo->getPSNode()->setVisible( true );
	pInfo->getPSNode()->setPosition( position );

	return pInfo->getPSNode();
}

// ---------------------------------------------------------------------------------

void UtilityParticleSet::checkForExpiredPS()
{
	// Do nothing if there aren't running psystems
	if ( mActivePSNumber == 0 )
		return;

	for (particlesList_it psNode = mPSPool.begin();
			psNode != mPSPool.end(); ++psNode)
	{
		ParticleInfo* pInfo = ( *psNode );

		// If the ps is expired then disable it
		if ( pInfo->getExpirationTime() > 0 && mLump.getTotalElapsedTime() > pInfo->getExpirationTime() )
		{
			ParticleSystem* pSys = (ParticleSystem*) pInfo->getPSNode()->getAttachedObject( 0 );

			// Stop the particles emission
			pSys->getEmitter( 0 )->setEnabled( false );
			pInfo->setExpirationTime( -1 );

			// Hide the psystem
			pInfo->getPSNode()->setVisible( false );

			mActivePSNumber--;
		}
	}
}

// ---------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------

UtilityParticleSet::ParticleInfo::ParticleInfo(SceneNode* psNode, float expirationTime)
{
	mPSNode = psNode;
	mExpirationTime = expirationTime;
}

// ---------------------------------------------------------------------------------

UtilityParticleSet::ParticleInfo::~ParticleInfo()
{

}

// ---------------------------------------------------------------------------------


text:
from integration.ggrc import TestCase
from freezegun import freeze_time
from datetime import datetime
from mock import patch

from ggrc.notifications import common
from ggrc.models import Notification
from integration.ggrc_workflows.generator import WorkflowsGenerator
from integration.ggrc.api_helper import Api
from integration.ggrc.generator import ObjectGenerator
from integration.ggrc.models import factories

class TestCycleStartFailed(TestCase):

  """ This class contains simple one time workflow tests that are not
  in the gsheet test grid
  """

  def setUp(self):
    TestCase.setUp(self)
    self.api = Api()
    self.wf_generator = WorkflowsGenerator()
    self.object_generator = ObjectGenerator()
    Notification.query.delete()

    self.random_objects = self.object_generator.generate_random_objects(2)
    _, self.user = self.object_generator.generate_person(
        user_role="Administrator")
    self.create_test_cases()

    def init_decorator(init):
      def new_init(self, *args, **kwargs):
        init(self, *args, **kwargs)
        if hasattr(self, "created_at"):
          self.created_at = datetime.now()
      return new_init

    Notification.__init__ = init_decorator(Notification.__init__)

  @patch("ggrc.notifications.common.send_email")
  def test_start_failed(self, mock_mail):

    wf_owner = "user@example.com"

    with freeze_time("2015-02-01 13:39:20"):
      _, wf = self.wf_generator.generate_workflow(self.quarterly_wf)
      response, wf = self.wf_generator.activate_workflow(wf)
      print wf.next_cycle_start_date

      self.assert200(response)

    with freeze_time("2015-01-01 13:39:20"):
      _, notif_data = common.get_daily_notifications()
      self.assertNotIn(wf_owner, notif_data)

    with freeze_time("2015-01-29 13:39:20"):
      _, notif_data = common.get_daily_notifications()
      self.assertIn(wf_owner, notif_data)
      self.assertIn("cycle_starts_in", notif_data[wf_owner])

    with freeze_time("2015-03-05 13:39:20"):
      _, notif_data = common.get_daily_notifications()
      self.assertIn(wf_owner, notif_data)
      self.assertNotIn("cycle_started", notif_data[wf_owner])
      self.assertIn(wf_owner, notif_data)
      self.assertIn("cycle_start_failed", notif_data[wf_owner])

      common.send_daily_digest_notifications()

      _, notif_data = common.get_daily_notifications()
      self.assertNotIn(wf_owner, notif_data)

  # TODO: investigate why next_cycle_start date remains the same after
  # start_recurring_cycles

  # @patch("ggrc.notifications.common.send_email")
  # def test_start_failed_send_notifications(self, mock_mail):

  #   wf_owner = "user@example.com"

  #   with freeze_time("2015-02-01 13:39:20"):
  #     _, wf = self.wf_generator.generate_workflow(self.quarterly_wf)
  #     response, wf = self.wf_generator.activate_workflow(wf)
  #     print wf.next_cycle_start_date

  #     self.assert200(response)

  #   with freeze_time("2015-01-01 13:39:20"):
  #     _, notif_data = common.get_daily_notifications()
  #     self.assertNotIn(wf_owner, notif_data)

  #   with freeze_time("2015-01-29 13:39:20"):
  #     _, notif_data = common.get_daily_notifications()
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertIn("cycle_starts_in", notif_data[wf_owner])

  #   with freeze_time("2015-02-05 13:39:20"):
  #     _, notif_data = common.get_daily_notifications()
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertNotIn("cycle_started", notif_data[wf_owner])
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertIn("cycle_start_failed", notif_data[wf_owner])

  #     start_recurring_cycles()
  #     _, notif_data = common.get_daily_notifications()
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertIn("cycle_started", notif_data[wf_owner])
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertNotIn("cycle_start_failed", notif_data[wf_owner])

  #     common.send_daily_digest_notifications()

  #     _, notif_data = common.get_daily_notifications()
  #     self.assertNotIn(wf_owner, notif_data)

  # @patch("ggrc.notifications.common.send_email")
  # def test_start_failed_send_notifications_monthly(self, mock_mail):

  #   wf_owner = "user@example.com"

  #   with freeze_time("2015-05-12 13:39:20"):
  #     _, wf = self.wf_generator.generate_workflow(self.monthly)
  #     response, wf = self.wf_generator.activate_workflow(wf)

  #   with freeze_time("2015-05-14 13:39:20"):
  #     _, wf = self.wf_generator.generate_workflow(self.monthly)
  #     response, wf = self.wf_generator.activate_workflow(wf)

  #     self.assert200(response)

  #     _, notif_data = common.get_daily_notifications()
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertNotIn("cycle_started", notif_data[wf_owner])
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertIn("cycle_start_failed", notif_data[wf_owner])

  #     start_recurring_cycles()
  #     _, notif_data = common.get_daily_notifications()
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertIn("cycle_started", notif_data[wf_owner])
  #     self.assertIn(wf_owner, notif_data)
  #     self.assertNotIn("cycle_start_failed", notif_data[wf_owner])

  #     common.send_daily_digest_notifications()

  #     _, notif_data = common.get_daily_notifications()
  #     self.assertNotIn(wf_owner, notif_data)

  def create_test_cases(self):
    def person_dict(person_id):
      return {
          "href": "/api/people/%d" % person_id,
          "id": person_id,
          "type": "Person"
      }

    self.quarterly_wf = {
        "title": "quarterly wf forced notifications",
        "notify_on_change": True,
        "description": "",
        "owners": [person_dict(self.user.id)],
        "frequency": "quarterly",
        "task_groups": [{
            "title": "tg_1",
            "contact": person_dict(self.user.id),
            "task_group_tasks": [{
                "contact": person_dict(self.user.id),
                "description": factories.random_str(100),
                "relative_start_day": 5,
                "relative_start_month": 2,
                "relative_end_day": 25,
                "relative_end_month": 2,
            },
            ],
        },
        ]
    }
    self.monthly = {
        "title": "monthly",
        "notify_on_change": True,
        "description": "",
        "owners": [person_dict(self.user.id)],
        "frequency": "monthly",
        "task_groups": [{
            "title": "tg_1",
            "contact": person_dict(self.user.id),
            "task_group_tasks": [{
                "contact": person_dict(self.user.id),
                "description": factories.random_str(100),
                "relative_start_day": 14,
                "relative_end_day": 25,
            },
            ],
        },
        ]
    }


text:
package org.apache.hadoop.hive.ql.plan;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.ql.io.AcidUtils;
import org.apache.hadoop.hive.ql.plan.Explain.Level;

/**
 * LoadTableDesc.
 *
 */
public class LoadTableDesc extends org.apache.hadoop.hive.ql.plan.LoadDesc
    implements Serializable {
  private static final long serialVersionUID = 1L;
  private boolean replace;
  private DynamicPartitionCtx dpCtx;
  private ListBucketingCtx lbCtx;
  private boolean inheritTableSpecs = true; //For partitions, flag controlling whether the current
                                            //table specs are to be used
  // Need to remember whether this is an acid compliant operation, and if so whether it is an
  // insert, update, or delete.
  private AcidUtils.Operation writeType;

  // TODO: the below seems like they should just be combined into partitionDesc
  private org.apache.hadoop.hive.ql.plan.TableDesc table;
  private Map<String, String> partitionSpec; // NOTE: this partitionSpec has to be ordered map

  public LoadTableDesc(final LoadTableDesc o) {
    super(o.getSourcePath());

    this.replace = o.replace;
    this.dpCtx = o.dpCtx;
    this.lbCtx = o.lbCtx;
    this.inheritTableSpecs = o.inheritTableSpecs;
    this.writeType = o.writeType;
    this.table = o.table;
    this.partitionSpec = o.partitionSpec;
  }

  public LoadTableDesc(final Path sourcePath,
      final org.apache.hadoop.hive.ql.plan.TableDesc table,
      final Map<String, String> partitionSpec,
      final boolean replace,
      final AcidUtils.Operation writeType) {
    super(sourcePath);
    init(table, partitionSpec, replace, writeType);
  }

  /**
   * For use with non-ACID compliant operations, such as LOAD
   * @param sourcePath
   * @param table
   * @param partitionSpec
   * @param replace
   */
  public LoadTableDesc(final Path sourcePath,
                       final TableDesc table,
                       final Map<String, String> partitionSpec,
                       final boolean replace) {
    this(sourcePath, table, partitionSpec, replace, AcidUtils.Operation.NOT_ACID);
  }

  public LoadTableDesc(final Path sourcePath,
      final org.apache.hadoop.hive.ql.plan.TableDesc table,
      final Map<String, String> partitionSpec,
      final AcidUtils.Operation writeType) {
    this(sourcePath, table, partitionSpec, true, writeType);
  }

  /**
   * For DDL operations that are not ACID compliant.
   * @param sourcePath
   * @param table
   * @param partitionSpec
   */
  public LoadTableDesc(final Path sourcePath,
                       final org.apache.hadoop.hive.ql.plan.TableDesc table,
                       final Map<String, String> partitionSpec) {
    this(sourcePath, table, partitionSpec, true, AcidUtils.Operation.NOT_ACID);
  }

  public LoadTableDesc(final Path sourcePath,
      final org.apache.hadoop.hive.ql.plan.TableDesc table,
      final DynamicPartitionCtx dpCtx,
      final AcidUtils.Operation writeType) {
    super(sourcePath);
    this.dpCtx = dpCtx;
    if (dpCtx != null && dpCtx.getPartSpec() != null && partitionSpec == null) {
      init(table, dpCtx.getPartSpec(), true, writeType);
    } else {
      init(table, new LinkedHashMap<String, String>(), true, writeType);
    }
  }

  private void init(
      final org.apache.hadoop.hive.ql.plan.TableDesc table,
      final Map<String, String> partitionSpec,
      final boolean replace,
      AcidUtils.Operation writeType) {
    this.table = table;
    this.partitionSpec = partitionSpec;
    this.replace = replace;
    this.writeType = writeType;
  }

  @Explain(displayName = "table", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
  public TableDesc getTable() {
    return table;
  }

  public void setTable(final org.apache.hadoop.hive.ql.plan.TableDesc table) {
    this.table = table;
  }

  @Explain(displayName = "partition")
  public Map<String, String> getPartitionSpec() {
    return partitionSpec;
  }

  public void setPartitionSpec(final Map<String, String> partitionSpec) {
    this.partitionSpec = partitionSpec;
  }

  @Explain(displayName = "replace")
  public boolean getReplace() {
    return replace;
  }

  public void setReplace(boolean replace) {
    this.replace = replace;
  }

  public DynamicPartitionCtx getDPCtx() {
    return dpCtx;
  }

  public void setDPCtx(final DynamicPartitionCtx dpCtx) {
    this.dpCtx = dpCtx;
  }

  public boolean getInheritTableSpecs() {
    return inheritTableSpecs;
  }

  public void setInheritTableSpecs(boolean inheritTableSpecs) {
    this.inheritTableSpecs = inheritTableSpecs;
  }

  /**
   * @return the lbCtx
   */
  public ListBucketingCtx getLbCtx() {
    return lbCtx;
  }

  /**
   * @param lbCtx the lbCtx to set
   */
  public void setLbCtx(ListBucketingCtx lbCtx) {
    this.lbCtx = lbCtx;
  }

  public AcidUtils.Operation getWriteType() {
    return writeType;
  }
}


text:
package water.persist;

import java.io.*;
import java.net.URI;
import java.nio.channels.FileChannel;
import java.util.ArrayList;

import water.*;
import water.exceptions.H2ONotFoundArgumentException;
import water.fvec.NFSFileVec;
import water.util.FileIntegrityChecker;
import water.util.Log;

// Persistence backend for network file system.
// Just for loading or storing files.
//
// @author cliffc
public final class PersistNFS extends Persist {

  static final String KEY_PREFIX = "nfs:" + File.separator;
  static final int KEY_PREFIX_LENGTH = KEY_PREFIX.length();

  // file implementation -------------------------------------------------------

  /**
   * Key from file
   */
  public static Key decodeFile(File f) {
    return Key.make(KEY_PREFIX + f.toString());
  }

  // Returns the file for given key.
  private static File getFileForKey(Key k) {
    final int off = k._kb[0] == Key.CHK ? water.fvec.Vec.KEY_PREFIX_LEN : 0;
    assert new String(k._kb, off, KEY_PREFIX_LENGTH).equals(KEY_PREFIX) : "Not an NFS key: " + k;
    String s = new String(k._kb, KEY_PREFIX_LENGTH + off, k._kb.length - (KEY_PREFIX_LENGTH + off));
    return new File(s);
  }

  public void cleanUp() { }

  /**
   * InputStream from a NFS-based Key
   */
  public static InputStream openStream(Key k) throws IOException {
    return new FileInputStream(getFileForKey(k));
  }

  @Override
  public byte[] load(Value v) throws IOException {
    assert v.isPersisted();
    // Convert a file chunk into a long-offset from the base file.
    Key k = v._key;
    long skip = k.isChunkKey() ? water.fvec.NFSFileVec.chunkOffset(k) : 0;
    try {
      FileInputStream s = null;
      try {
        s = new FileInputStream(getFileForKey(k));
        FileChannel fc = s.getChannel();
        fc.position(skip);
        AutoBuffer ab = new AutoBuffer(fc, true, Value.NFS);
        byte[] b = ab.getA1(v._max);
        ab.close();
        return b;
      } finally {
        if (s != null) s.close();
      }
    } catch ( IOException e ) { // Broken disk / short-file???
      Log.debug("[h2o] Problem ignored: "+e.toString());
      return null;
    }
  }

  @Override
  public void store(Value v) {
    // Only the home node does persistence on NFS
    if (!v._key.home()) return;
    // A perhaps useless cutout: the upper layers should test this first.
    if (v.isPersisted()) return;
    try {
      File f = getFileForKey(v._key);
      if (!f.mkdirs()) throw new IOException("Unable to create directory " + f);
      try (FileOutputStream s = new FileOutputStream(f)) {
        byte[] m = v.memOrLoad();
        assert (m == null || m.length == v._max); // Assert not saving partial files
        if (m != null) new AutoBuffer(s.getChannel(), false, Value.NFS).putA1(m, m.length).close();
      }
    } catch (IOException e) {
      Log.err(e);
    }
  }

  @Override
  public void delete(Value v) {
    throw H2O.fail();
  }

  @Override
  public Key uriToKey(URI uri) {
    return NFSFileVec.make(uri.getScheme() == null ? new File(uri.toString()) : new File(uri))._key;
  }

  @Override
  public ArrayList<String> calcTypeaheadMatches(String filter, int limit) {
    File base = null;
    String filterPrefix = "";
    if (limit == 0) limit--;
    if (!filter.isEmpty()) {
      File file = new File(filter);
      if (file.isDirectory()) {
        base = file;
      } else {
        base = file.getParentFile();
        filterPrefix = file.getName().toLowerCase();
      }
    }
    if (base == null) base = new File(".");

    ArrayList<String> array = new ArrayList<>();
    File[] files = base.listFiles();
    if (files != null) {
      for (File file : files) {
        if (file.isHidden()) continue;
        if (file.getName().toLowerCase().startsWith(filterPrefix))
          array.add(file.getPath());
        if (array.size() == limit) break;    // When limit == -1, check all files/directories in directory for matches
      }
    }
    return array;
  }

  @Override
  public void importFiles(String path, String pattern, ArrayList<String> files, ArrayList<String> keys, ArrayList<String> fails, ArrayList<String> dels) {
    File f = new File(path);
    if( !f.exists() ) throw new H2ONotFoundArgumentException("File " + path + " does not exist");
    FileIntegrityChecker.check(f).syncDirectory(files,keys,fails,dels);
  }
}


text:
package vim25

import (
	"context"
	"encoding/json"
	"fmt"
	"net/http"
	"path"
	"strings"

	"github.com/vmware/govmomi/vim25/methods"
	"github.com/vmware/govmomi/vim25/soap"
	"github.com/vmware/govmomi/vim25/types"
	"github.com/vmware/govmomi/vim25/xml"
)

const (
	Namespace = "vim25"
	Version   = "7.0"
	Path      = "/sdk"
)

var (
	ServiceInstance = types.ManagedObjectReference{
		Type:  "ServiceInstance",
		Value: "ServiceInstance",
	}
)

// Client is a tiny wrapper around the vim25/soap Client that stores session
// specific state (i.e. state that only needs to be retrieved once after the
// client has been created). This means the client can be reused after
// serialization without performing additional requests for initialization.
type Client struct {
	*soap.Client

	ServiceContent types.ServiceContent

	// RoundTripper is a separate field such that the client's implementation of
	// the RoundTripper interface can be wrapped by separate implementations for
	// extra functionality (for example, reauthentication on session timeout).
	RoundTripper soap.RoundTripper
}

// NewClient creates and returns a new client with the ServiceContent field
// filled in.
func NewClient(ctx context.Context, rt soap.RoundTripper) (*Client, error) {
	c := Client{
		RoundTripper: rt,
	}

	// Set client if it happens to be a soap.Client
	if sc, ok := rt.(*soap.Client); ok {
		c.Client = sc

		if c.Namespace == "" {
			c.Namespace = "urn:" + Namespace
		} else if !strings.Contains(c.Namespace, ":") {
			c.Namespace = "urn:" + c.Namespace // ensure valid URI format
		}
		if c.Version == "" {
			c.Version = Version
		}
	}

	var err error
	c.ServiceContent, err = methods.GetServiceContent(ctx, rt)
	if err != nil {
		return nil, err
	}

	return &c, nil
}

// UseServiceVersion sets soap.Client.Version to the current version of the service endpoint via /sdk/vimServiceVersions.xml
func (c *Client) UseServiceVersion(kind ...string) error {
	ns := "vim"
	if len(kind) != 0 {
		ns = kind[0]
	}

	u := c.URL()
	u.Path = path.Join(Path, ns+"ServiceVersions.xml")

	res, err := c.Get(u.String())
	if err != nil {
		return err
	}

	if res.StatusCode != http.StatusOK {
		return fmt.Errorf("http.Get(%s): %s", u.Path, err)
	}

	v := struct {
		Namespace *string `xml:"namespace>name"`
		Version   *string `xml:"namespace>version"`
	}{
		&c.Namespace,
		&c.Version,
	}

	err = xml.NewDecoder(res.Body).Decode(&v)
	_ = res.Body.Close()
	if err != nil {
		return fmt.Errorf("xml.Decode(%s): %s", u.Path, err)
	}

	return nil
}

// RoundTrip dispatches to the RoundTripper field.
func (c *Client) RoundTrip(ctx context.Context, req, res soap.HasFault) error {
	return c.RoundTripper.RoundTrip(ctx, req, res)
}

type marshaledClient struct {
	SoapClient     *soap.Client
	ServiceContent types.ServiceContent
}

func (c *Client) MarshalJSON() ([]byte, error) {
	m := marshaledClient{
		SoapClient:     c.Client,
		ServiceContent: c.ServiceContent,
	}

	return json.Marshal(m)
}

func (c *Client) UnmarshalJSON(b []byte) error {
	var m marshaledClient

	err := json.Unmarshal(b, &m)
	if err != nil {
		return err
	}

	*c = Client{
		Client:         m.SoapClient,
		ServiceContent: m.ServiceContent,
		RoundTripper:   m.SoapClient,
	}

	return nil
}

// Valid returns whether or not the client is valid and ready for use.
// This should be called after unmarshalling the client.
func (c *Client) Valid() bool {
	if c == nil {
		return false
	}

	if c.Client == nil {
		return false
	}

	// Use arbitrary pointer field in the service content.
	// Doesn't matter which one, as long as it is populated by default.
	if c.ServiceContent.SessionManager == nil {
		return false
	}

	return true
}

// Path returns vim25.Path (see cache.Client)
func (c *Client) Path() string {
	return Path
}

// IsVC returns true if we are connected to a vCenter
func (c *Client) IsVC() bool {
	return c.ServiceContent.About.ApiType == "VirtualCenter"
}


text:
extern mod newtype_struct_xc;

pub fn main() {
    let _ = newtype_struct_xc::Au(2);
}


text:
<?php

namespace PHPExiftool\Driver\Tag\XMPCrs;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class GreenHue extends AbstractTag
{

    protected $Id = 'GreenHue';

    protected $Name = 'GreenHue';

    protected $FullName = 'XMP::crs';

    protected $GroupName = 'XMP-crs';

    protected $g0 = 'XMP';

    protected $g1 = 'XMP-crs';

    protected $g2 = 'Image';

    protected $Type = 'integer';

    protected $Writable = true;

    protected $Description = 'Green Hue';
}


text:
package org.asteriskjava.manager.event;

/**
 * A PeerStatusEvent is triggered when a SIP or IAX client attempts to registrer at this asterisk
 * server.

 * This event is implemented in channels/chan_iax2.c and
 * channels/chan_sip.c
 *
 * @author srt
 * @version $Id$
 */
public class PeerStatusEvent extends ManagerEvent {
    /**
     * Serializable version identifier.
     */
    private static final long serialVersionUID = 1L;

    public static final String STATUS_REGISTERED = "Registered";
    public static final String STATUS_UNREGISTERED = "Unregistered";
    public static final String STATUS_REACHABLE = "Reachable";
    public static final String STATUS_LAGGED = "Lagged";
    public static final String STATUS_UNREACHABLE = "Unreachable";
    public static final String STATUS_REJECTED = "Rejected";

    private String channelType;
    private String peer;
    private String peerStatus;
    private String cause;
    private Integer time;
    private String address;
    private Integer port;

    /**
     * @param source
     */
    public PeerStatusEvent(Object source) {
        super(source);
    }

    /**
     * Returns the type of channel that registers, that is "IAX2" for an IAX2
     * channel or "SIP" for a SIP channel.

     * Available since Asterisk 1.6.
     *
     * @return the type of channel that registers.
     * @since 1.0.0
     */
    public String getChannelType() {
        return channelType;
    }

    /**
     * Sets the type of channel that registers.
     *
     * @param channelType the type of channel that registers
     * @since 1.0.0
     */
    public void setChannelType(String channelType) {
        this.channelType = channelType;
    }

    /**
     * Returns the name of the peer that registered.

     * The peer name includes the channel type prefix. So if you receive a PeerStatusEvent for a
     * SIP peer defined as "john" in sip.conf this method returns "SIP/john".
     *

     * Peer names for IAX clients start with "IAX2/", peer names for SIP clients start with "SIP/".
     *
     * @return the peer's name including the channel type.
     */
    public String getPeer() {
        return peer;
    }

    /**
     * Sets the name of the peer that registered.
     */
    public void setPeer(String peer) {
        this.peer = peer;
    }

    /**
     * Returns the registration state.

     * This may be one of
     *

     *
Registered

     *
Unregistered

     *
Reachable

     *
Lagged

     *
Unreachable

     *
Rejected (IAX only)

     *

     */
    public String getPeerStatus() {
        return peerStatus;
    }

    /**
     * Sets the registration state.
     */
    public void setPeerStatus(String peerStatus) {
        this.peerStatus = peerStatus;
    }

    /**
     * Returns the cause of a rejection or unregistration.

     * For IAX peers this is set only if the status equals "Rejected".

     * For SIP peers this is set if the status equals "Unregistered" and the peer was unregistered
     * due to an expiration. In that case the cause is set to "Expired".
     *
     * @return the cause of a rejection or unregistration.
     */
    public String getCause() {
        return cause;
    }

    /**
     * Sets the cause of the rejection or unregistration.
     */
    public void setCause(String cause) {
        this.cause = cause;
    }

    /**
     * Returns the ping time of the client if status equals "Reachable" or "Lagged"; if the status
     * equals "Unreachable" it returns how long the last response took (in ms) for IAX peers or -1
     * for SIP peers.
     */
    public Integer getTime() {
        return time;
    }

    public void setTime(Integer time) {
        this.time = time;
    }

    /**
     * Returns the IP address of the peer that registered. Only available for SIP channels.

     * Available since Asterisk 1.6.
     *
     * @return the IP address of the peer that registered or null if not available.
     * @since 1.0.0
     */
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * Returns the port of the peer that registered. Only available for SIP channels.

     * Available since Asterisk 1.6.
     *
     * @return the port of the peer that registered or null if not available.
     * @since 1.0.0
     */
    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }
}


text:
package bamboo.util;

import java.util.List;

public class Pager<T> {
    public final long pageSize = 100;
    public final long currentPage;
    public final long lastPage;
    public final long offset;
    public final long totalItems;
    public final List<T> items;

    public Pager(long page, long totalItems, PaginationQuery<T> query) {
        this.currentPage = page;
        offset = (currentPage - 1) * pageSize;
        this.totalItems = totalItems;
        lastPage = totalItems / pageSize + 1;
        items = query.paginate(pageSize, offset);
    }

    public interface PaginationQuery<T> {
        List<T> paginate(long limit, long offset);
    }
}


text:
namespace ConsoleTwitter.Wrappers
{
    using System;

    public class ConsoleWrapper : IConsole
    {
        public string ConsoleRead()
        {
            return Console.ReadLine();
        }

        public void ConsoleWrite(string output)
        {
            Console.WriteLine(output);
        }
    }
}


text:
@class GameContext;

@interface RoundtimeNotifier : NSObject

@property (nonatomic, strong) RACSubject *notification;

- (instancetype)initWith:(GameContext *)context;
- (void)set:(NSInteger)value;

@end


text:
class AddCaseRuleOrder < ActiveRecord::Migration[4.2]
  def change
    remove_column :case_rules, :content, :text
    remove_column :case_rules, :is_guilty, :boolean
    add_column :case_rules, :rule_order, :integer
  end
end


text:
from flask import Flask, render_template, request
import codecs, unicodedata
import subprocess
import logging
from logging.handlers import RotatingFileHandler
app = Flask(__name__)

beers_file = open("beer_ids_names.txt", "r")#, encoding="utf-8")
beers_list = beers_file.read().replace("\"", "")
beers_list = beers_list.splitlines()
beers_list = [i.split(",") for i in beers_list]
beers_list = [[i[0], str(", ".join(i[1:])).decode("utf8")] for i in beers_list]

def get_result(text):
    p = subprocess.Popen('./predict_style.R' + " '" + text + "'", shell = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd = "../../analysis")
    top_beers = []
    for line in p.stdout.readlines()[3:]:
        app.logger.debug(line)
        top_beers.append(line.split()[1].replace("_", " "))
    return top_beers

def get_words(beer):
    p = subprocess.Popen('./get_words.R' + " '" + beer + "'", shell = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd = "../../analysis")
    words = []
    for line in p.stdout.readlines():
        words.append(line.replace("[1]", "").replace('"', "").strip())
    return ', '.join(words)

@app.route('/')
def index():
    return render_template("index.html")

@app.route('/text-to-beer', methods=["POST", "GET"])
def text_to_beer():
    if request.method == "POST":
        beers = get_result(request.form["beer-text"])
        return render_template("text_to_beer_results.html", search=request.form["beer-text"], results= beers) # "Sierra Nevada Pale Ale")
    else:
        return render_template("text_to_beer_form.html")

@app.route('/beer_to_text', methods=["POST", "GET"])
def beer_to_text():
    if request.method == "POST":
        beer_id = request.form['beer-select']
        beer_name = [beer for beer in beers_list if beer[0] == beer_id][0][1]
        result_str = get_words(beer_id)
        return render_template("beer_to_text_results.html",
                               search=beer_name,
                               results=result_str)
    else:
        return render_template("beer_to_text_form.html", beers=beers_list)

if __name__ == '__main__':
    handler = RotatingFileHandler('foo.log', maxBytes=10000, backupCount=1)
    handler.setLevel(logging.DEBUG)
    app.logger.addHandler(handler)
    app.run(debug=True)


text:
namespace Furrovine { namespace Graphics {

	enum class FillMode {
		Point = 1,
		Wireframe,
		Solid,
	};

}}


text:
using System.ComponentModel;

namespace Configgy.Coercion
{
    /// <summary>
    /// A general purpose value coercer that operates using the <see cref="TypeConverter"/> instances from <see cref="TypeDescriptor"/>.
    /// </summary>
    public class GeneralCoercerAttribute : ValueCoercerAttributeBase
    {
        /// <inheritdoc cref="IValueCoercer.Coerce{T}"/>
        public override bool Coerce<T>(IConfigProperty property, string value, out T result)
        {
            var type = typeof(T);

            // If the value is null...
            if (value == null)
            {
                // Set the result to the default
                result = default;

                // If the type is nullable return true, if not then the default value is not correct
                return IsNullable<T>();
            }

            var converter = TypeDescriptor.GetConverter(type);

            // If the converter can't convert this type of thing then don't try
            if (!converter.CanConvertFrom(typeof(string)))
            {
                result = default;
                return false;
            }

            // Convert the value
            result = (T)converter.ConvertFromString(value);
            return true;
        }
    }
}


text:
define(
  'tinymce.core.keyboard.BoundaryLocation',
  [
    'ephox.katamari.api.Adt',
    'ephox.katamari.api.Fun',
    'ephox.katamari.api.Option',
    'ephox.katamari.api.Options',
    'tinymce.core.caret.CaretContainer',
    'tinymce.core.caret.CaretPosition',
    'tinymce.core.caret.CaretUtils',
    'tinymce.core.dom.NodeType',
    'tinymce.core.keyboard.InlineUtils',
    'tinymce.core.util.LazyEvaluator'
  ],
  function (Adt, Fun, Option, Options, CaretContainer, CaretPosition, CaretUtils, NodeType, InlineUtils, LazyEvaluator) {
    var Location = Adt.generate([
      { before: [ 'element' ] },
      { start: [ 'element' ] },
      { end: [ 'element' ] },
      { after: [ 'element' ] }
    ]);

    var rescope = function (rootNode, node) {
      var parentBlock = CaretUtils.getParentBlock(node, rootNode);
      return parentBlock ? parentBlock : rootNode;
    };

    var before = function (rootNode, pos) {
      var nPos = InlineUtils.normalizeForwards(pos);
      var scope = rescope(rootNode, nPos.container());
      return InlineUtils.findRootInline(scope, nPos).fold(
        function () {
          return InlineUtils.findCaretPosition(scope, true, nPos)
            .bind(Fun.curry(InlineUtils.findRootInline, scope))
            .map(function (inline) {
              return Location.before(inline);
            });
        },
        Option.none
      );
    };

    var start = function (rootNode, pos) {
      var nPos = InlineUtils.normalizeBackwards(pos);
      return InlineUtils.findRootInline(rootNode, nPos).bind(function (inline) {
        var prevPos = InlineUtils.findCaretPosition(inline, false, nPos);
        return prevPos.isNone() ? Option.some(Location.start(inline)) : Option.none();
      });
    };

    var end = function (rootNode, pos) {
      var nPos = InlineUtils.normalizeForwards(pos);
      return InlineUtils.findRootInline(rootNode, nPos).bind(function (inline) {
        var nextPos = InlineUtils.findCaretPosition(inline, true, nPos);
        return nextPos.isNone() ? Option.some(Location.end(inline)) : Option.none();
      });
    };

    var after = function (rootNode, pos) {
      var nPos = InlineUtils.normalizeBackwards(pos);
      var scope = rescope(rootNode, nPos.container());
      return InlineUtils.findRootInline(scope, nPos).fold(
        function () {
          return InlineUtils.findCaretPosition(scope, false, nPos)
            .bind(Fun.curry(InlineUtils.findRootInline, scope))
            .map(function (inline) {
              return Location.after(inline);
            });
        },
        Option.none
      );
    };

    var isValidLocation = function (location) {
      return InlineUtils.isRtl(getElement(location)) === false;
    };

    var readLocation = function (rootNode, pos) {
      var location = LazyEvaluator.evaluateUntil([
        before,
        start,
        end,
        after
      ], [rootNode, pos]);

      return location.filter(isValidLocation);
    };

    var getElement = function (location) {
      return location.fold(
        Fun.identity, // Before
        Fun.identity, // Start
        Fun.identity, // End
        Fun.identity  // After
      );
    };

    var getName = function (location) {
      return location.fold(
        Fun.constant('before'), // Before
        Fun.constant('start'),  // Start
        Fun.constant('end'),    // End
        Fun.constant('after')   // After
      );
    };

    var outside = function (location) {
      return location.fold(
        Location.before, // Before
        Location.before, // Start
        Location.after,  // End
        Location.after   // After
      );
    };

    var inside = function (location) {
      return location.fold(
        Location.start, // Before
        Location.start, // Start
        Location.end,   // End
        Location.end    // After
      );
    };

    var isEq = function (location1, location2) {
      return getName(location1) === getName(location2) && getElement(location1) === getElement(location2);
    };

    var betweenInlines = function (forward, rootNode, from, to, location) {
      return Options.liftN([
        InlineUtils.findRootInline(rootNode, from),
        InlineUtils.findRootInline(rootNode, to)
      ], function (fromInline, toInline) {
        if (fromInline !== toInline && InlineUtils.hasSameParentBlock(rootNode, fromInline, toInline)) {
          // Force after since some browsers normalize and lean left into the closest inline
          return Location.after(forward ? fromInline : toInline);
        } else {
          return location;
        }
      }).getOr(location);
    };

    var skipNoMovement = function (fromLocation, toLocation) {
      return fromLocation.fold(
        Fun.constant(true),
        function (fromLocation) {
          return !isEq(fromLocation, toLocation);
        }
      );
    };

    var findLocationTraverse = function (forward, rootNode, fromLocation, pos) {
      var from = InlineUtils.normalizePosition(forward, pos);
      var to = InlineUtils.findCaretPosition(rootNode, forward, from).map(Fun.curry(InlineUtils.normalizePosition, forward));

      var location = to.fold(
        function () {
          return fromLocation.map(outside);
        },
        function (to) {
          return readLocation(rootNode, to)
            .map(Fun.curry(betweenInlines, forward, rootNode, from, to))
            .filter(Fun.curry(skipNoMovement, fromLocation));
        }
      );

      return location.filter(isValidLocation);
    };

    var findLocationSimple = function (forward, location) {
      if (forward) {
        return location.fold(
          Fun.compose(Option.some, Location.start), // Before -> Start
          Option.none,
          Fun.compose(Option.some, Location.after), // End -> After
          Option.none
        );
      } else {
        return location.fold(
          Option.none,
          Fun.compose(Option.some, Location.before), // Before <- Start
          Option.none,
          Fun.compose(Option.some, Location.end) // End <- After
        );
      }
    };

    var findLocation = function (forward, rootNode, pos) {
      var from = InlineUtils.normalizePosition(forward, pos);
      var fromLocation = readLocation(rootNode, from);

      return readLocation(rootNode, from).bind(Fun.curry(findLocationSimple, forward)).orThunk(function () {
        return findLocationTraverse(forward, rootNode, fromLocation, pos);
      });
    };

    return {
      readLocation: readLocation,
      prevLocation: Fun.curry(findLocation, false),
      nextLocation: Fun.curry(findLocation, true),
      getElement: getElement,
      outside: outside,
      inside: inside
    };
  }
);


text:
var crypto = require('crypto');

/**
 *
 */

exports.hash = function hash(str) {
    return crypto.createHash('sha1').update(str).digest('hex');
};


text:
/**
 */
package org.mobadsl.semantic.model.moba;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.eclipse.emf.common.util.Enumerator;

/**
 *
 * A representation of the literals of the enumeration 'REST Operations',
 * and utility methods for working with them.
 *
 * @see org.mobadsl.semantic.model.moba.MobaPackage#getMobaRESTMethods()
 * @model
 * @generated
 */
public enum MobaRESTMethods implements Enumerator {
	/**
	 * The 'GET' literal object.
	 *
	 *
	 * @see #GET_VALUE
	 * @generated
	 * @ordered
	 */
	GET(0, "GET", "GET"),

	/**
	 * The 'PUT' literal object.
	 *
	 *
	 * @see #PUT_VALUE
	 * @generated
	 * @ordered
	 */
	PUT(1, "PUT", "PUT"),

	/**
	 * The 'DELETE' literal object.
	 *
	 *
	 * @see #DELETE_VALUE
	 * @generated
	 * @ordered
	 */
	DELETE(2, "DELETE", "DELETE"),

	/**
	 * The 'POST' literal object.
	 *
	 *
	 * @see #POST_VALUE
	 * @generated
	 * @ordered
	 */
	POST(3, "POST", "POST");

	/**
	 * The 'GET' literal value.
	 *
	 *

	 * If the meaning of 'GET' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #GET
	 * @model
	 * @generated
	 * @ordered
	 */
	public static final int GET_VALUE = 0;

	/**
	 * The 'PUT' literal value.
	 *
	 *

	 * If the meaning of 'PUT' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #PUT
	 * @model
	 * @generated
	 * @ordered
	 */
	public static final int PUT_VALUE = 1;

	/**
	 * The 'DELETE' literal value.
	 *
	 *

	 * If the meaning of 'DELETE' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #DELETE
	 * @model
	 * @generated
	 * @ordered
	 */
	public static final int DELETE_VALUE = 2;

	/**
	 * The 'POST' literal value.
	 *
	 *

	 * If the meaning of 'POST' literal object isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @see #POST
	 * @model
	 * @generated
	 * @ordered
	 */
	public static final int POST_VALUE = 3;

	/**
	 * An array of all the 'REST Methods' enumerators.
	 *
	 *
	 * @generated
	 */
	private static final MobaRESTMethods[] VALUES_ARRAY =
		new MobaRESTMethods[] {
			GET,
			PUT,
			DELETE,
			POST,
		};

	/**
	 * A public read-only list of all the 'REST Methods' enumerators.
	 *
	 *
	 * @generated
	 */
	public static final List<MobaRESTMethods> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));

	/**
	 * Returns the 'REST Methods' literal with the specified literal value.
	 *
	 *
	 * @param literal the literal.
	 * @return the matching enumerator or null.
	 * @generated
	 */
	public static MobaRESTMethods get(String literal) {
		for (int i = 0; i < VALUES_ARRAY.length; ++i) {
			MobaRESTMethods result = VALUES_ARRAY[i];
			if (result.toString().equals(literal)) {
				return result;
			}
		}
		return null;
	}

	/**
	 * Returns the 'REST Methods' literal with the specified name.
	 *
	 *
	 * @param name the name.
	 * @return the matching enumerator or null.
	 * @generated
	 */
	public static MobaRESTMethods getByName(String name) {
		for (int i = 0; i < VALUES_ARRAY.length; ++i) {
			MobaRESTMethods result = VALUES_ARRAY[i];
			if (result.getName().equals(name)) {
				return result;
			}
		}
		return null;
	}

	/**
	 * Returns the 'REST Methods' literal with the specified integer value.
	 *
	 *
	 * @param value the integer value.
	 * @return the matching enumerator or null.
	 * @generated
	 */
	public static MobaRESTMethods get(int value) {
		switch (value) {
			case GET_VALUE: return GET;
			case PUT_VALUE: return PUT;
			case DELETE_VALUE: return DELETE;
			case POST_VALUE: return POST;
		}
		return null;
	}

	/**
	 *
	 *
	 * @generated
	 */
	private final int value;

	/**
	 *
	 *
	 * @generated
	 */
	private final String name;

	/**
	 *
	 *
	 * @generated
	 */
	private final String literal;

	/**
	 * Only this class can construct instances.
	 *
	 *
	 * @generated
	 */
	private MobaRESTMethods(int value, String name, String literal) {
		this.value = value;
		this.name = name;
		this.literal = literal;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public int getValue() {
	  return value;
	}

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

	/**
	 *
	 *
	 * @generated
	 */
	public String getLiteral() {
	  return literal;
	}

	/**
	 * Returns the literal value of the enumerator, which is its string representation.
	 *
	 *
	 * @generated
	 */
	@Override
	public String toString() {
		return literal;
	}

} //MobaRESTOperations


text:
@interface PBViewController ()

@end

@implementation PBViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor colorWithRed:0.97f green:0.97f blue:0.97f alpha:1.00f]];

    [self.navigationItem setRightBarButtonItem:[PBFlatBarButtonItems addBarButtonItemWithTarget:nil selector:nil]];
    [self.navigationItem setLeftBarButtonItem:[PBFlatBarButtonItems moreBarButtonItemWithTarget:self selector:@selector(showLeftMenu:)]];

    [_textField setDelegate:self];

    [_back setType:PBFlatIconBack];
    [_forward setType:PBFlatIconForward];
    [_menu setType:PBFlatIconMenu];
    [_search setType:PBFlatIconSearch];

}

-(void)showLeftMenu:(UIBarButtonItem *)sender {
    [self performSegueWithIdentifier:@"leftMenu" sender:sender];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}

@end


text:
#include "src/actions/transformations/upper_case.h"

#include <algorithm>
#include <string>

#include "modsecurity/transaction.h"
#include "src/actions/transformations/transformation.h"
#include "modsecurity/actions/action.h"

namespace modsecurity {
namespace actions {
namespace transformations {

UpperCase::UpperCase(const std::string &a)
    : Transformation(a) {
}

std::string UpperCase::evaluate(const std::string &val,
    Transaction *transaction) {
    std::string value(val);
    std::locale loc;

    for (std::string::size_type i=0; i < value.length(); ++i) {
        value[i] = std::toupper(value[i], loc);
    }

    return value;
}

}  // namespace transformations
}  // namespace actions
}  // namespace modsecurity


text:
import numpy as np

from ._max_clustering_cython import _max_clustering_cython

def max_clustering(im_response, im_fgnd_mask, r=10):
    """Local max clustering pixel aggregation for nuclear segmentation.
    Takes as input a constrained log or other filtered nuclear image, a binary
    nuclear mask, and a clustering radius. For each pixel in the nuclear mask,
    the local max is identified. A hierarchy of local maxima is defined, and
    the root nodes used to define the label image.

    Parameters
    ----------
    im_response : array_like
        A filtered-smoothed image where the maxima correspond to nuclear
        center. Typically obtained by constrained-LoG filtering on a
        hematoxylin intensity image obtained from ColorDeconvolution.
    im_fgnd_mask : array_like
        A binary mask of type boolean where nuclei pixels have value
        'True', and non-nuclear pixels have value 'False'.
    r : float
        A scalar defining the clustering radius. Default value = 10.

    Returns
    -------
    im_label : array_like
        im_label image where positive values correspond to foreground pixels that
        share mutual sinks.
    seeds : array_like
        An N x 2 array defining the (x,y) coordinates of nuclei seeds.
    max_response : array_like
        An N x 1 array containing the maximum response value corresponding to
        'seeds'.

    See Also
    --------
    histomicstk.filters.shape.clog

    References
    ----------
    .. [#] XW. Wu et al "The local maximum clustering method and its
       application in microarray gene expression data analysis,"
       EURASIP J. Appl. Signal Processing, volume 2004, no.1, pp.53-63,
       2004.
    .. [#] Y. Al-Kofahi et al "Improved Automatic Detection and Segmentation
       of Cell Nuclei in Histopathology Images" in IEEE Transactions on
       Biomedical Engineering,vol.57,no.4,pp.847-52, 2010.

    """
    import skimage.measure

    # find local maxima of all foreground pixels
    mval, mind = _max_clustering_cython(
        im_response, im_fgnd_mask.astype(np.int32), r
    )

    # identify connected regions of local maxima and define their seeds
    im_label = skimage.measure.label(im_fgnd_mask & (im_response == mval))

    if not np.any(im_label):
        return im_label, None, None

    # compute normalized response
    min_resp = im_response.min()
    max_resp = im_response.max()
    resp_range = max_resp - min_resp

    if resp_range == 0:
        return np.zeros_like(im_label), None, None

    im_response_nmzd = (im_response - min_resp) / resp_range

    # compute object properties
    obj_props = skimage.measure.regionprops(im_label, im_response_nmzd)

    obj_props = [prop for prop in obj_props if np.isfinite(prop.weighted_centroid).all()]

    num_labels = len(obj_props)

    if num_labels == 0:
        return im_label, None, None

    # extract object seeds
    seeds = np.array(
        [obj_props[i].weighted_centroid for i in range(num_labels)])
    seeds = np.round(seeds).astype(np.int)

    # fix seeds outside the object region - happens for non-convex objects
    for i in range(num_labels):

        sy = seeds[i, 0]
        sx = seeds[i, 1]

        if im_label[sy, sx] == obj_props[i].label:
            continue

        # find object point with closest manhattan distance to center of mass
        pts = obj_props[i].coords

        ydist = np.abs(pts[:, 0] - sy)
        xdist = np.abs(pts[:, 1] - sx)

        seeds[i, :] = pts[np.argmin(xdist + ydist), :]

        assert im_label[seeds[i, 0], seeds[i, 1]] == obj_props[i].label

    # get seed responses
    max_response = im_response[seeds[:, 0], seeds[:, 1]]

    # set label of each foreground pixel to the label of its nearest peak
    im_label_flat = im_label.ravel()

    pind = np.flatnonzero(im_fgnd_mask)

    mind_flat = mind.ravel()

    im_label_flat[pind] = im_label_flat[mind_flat[pind]]

    # return
    return im_label, seeds, max_response


text:
//
//  CLViewController.m
//  avFoundation_Speech
//
//  Created by tidemedia on 2017/8/15.
//  Copyright © 2017年 charly. All rights reserved.
//

#import "CLViewController.h"
#import "CLAvSpeechUtils.h"

#define DefaultCellHeight 44
#define kAvSpeechCellIdentifier @"avSpeechCellIdentifier"

@interface CLViewController () <UITableViewDelegate, UITableViewDataSource, AVSpeechSynthesizerDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIButton *playBtn;

/// 预置朗读数据
@property (copy, nonatomic) NSArray *avSpeechResources;
/// 当前选中资源索引
@property (assign, nonatomic) NSUInteger sourceIndex;
/// 当前朗读内容
@property (copy, nonatomic) NSString *sourceString;

@end

@implementation CLViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [CLAvSpeechUtils avSpeechUtilSharedInstance].speechSynthsizer.delegate = self;

    _avSpeechResources = @[
                           @"白日依山尽, 黄河入海流, 欲穷千里目, 更上一层楼",
                           @"窗前明月光, 疑是地上霜, 举头望明月, 低头思故乡",
                           @"小荷才露尖尖角, 早有蜻蜓立上头"
                           ];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)playAction:(id)sender {
    AVSpeechSynthesizer *avSpeechSynthesizer = [[CLAvSpeechUtils avSpeechUtilSharedInstance] speechSynthsizer];

    if (avSpeechSynthesizer.isPaused) {
        /// 如果在暂停, 则继续
        [[CLAvSpeechUtils avSpeechUtilSharedInstance] continue];
    } else if (avSpeechSynthesizer.isSpeaking) {
        /// 如果在播放, 则暂停
        [[CLAvSpeechUtils avSpeechUtilSharedInstance] pause];
    }else {
        /// 如果在结束, 则开始
        [[CLAvSpeechUtils avSpeechUtilSharedInstance] playSpeechString:_sourceString];
    }
}

- (IBAction)stopAction:(id)sender {
    [[CLAvSpeechUtils avSpeechUtilSharedInstance] stop];
}

#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [_tableView deselectRowAtIndexPath:indexPath animated:YES];

    if (indexPath.row != _sourceIndex) {
        _sourceIndex   = indexPath.row;
        _sourceString  = _avSpeechResources[indexPath.row];
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return DefaultCellHeight;
}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _avSpeechResources.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kAvSpeechCellIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kAvSpeechCellIdentifier];
        cell.textLabel.font = [UIFont systemFontOfSize:16];
    }
    cell.textLabel.text = _avSpeechResources[indexPath.row];
    return cell;
}

#pragma mark - AVSpeechSynthesizerDelegate
- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didStartSpeechUtterance:(AVSpeechUtterance *)utterance
{
    [_playBtn setSelected:YES];
}
- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didFinishSpeechUtterance:(AVSpeechUtterance *)utterance
{
    [_playBtn setSelected:NO];
}
- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didPauseSpeechUtterance:(AVSpeechUtterance *)utterance
{
    [_playBtn setSelected:NO];
}
- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didContinueSpeechUtterance:(AVSpeechUtterance *)utterance
{
    [_playBtn setSelected:YES];
}
- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didCancelSpeechUtterance:(AVSpeechUtterance *)utterance
{
    [_playBtn setSelected:NO];
}

- (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer willSpeakRangeOfSpeechString:(NSRange)characterRange utterance:(AVSpeechUtterance *)utterance
{
    /// 这里可以提供朗读内容清晰标注功能
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
import json

import click
from tabulate import tabulate

@click.command('keys', short_help='List API keys')
@click.pass_obj
def cli(obj):
    """List API keys."""
    client = obj['client']

    if obj['output'] == 'json':
        r = client.http.get('/keys')
        click.echo(json.dumps(r['keys'], sort_keys=True, indent=4, ensure_ascii=False))
    else:
        timezone = obj['timezone']
        headers = {
            'id': 'ID', 'key': 'API KEY', 'user': 'USER', 'scopes': 'SCOPES', 'text': 'TEXT',
            'expireTime': 'EXPIRES', 'count': 'COUNT', 'lastUsedTime': 'LAST USED', 'customer': 'CUSTOMER'
        }
        click.echo(tabulate([k.tabular(timezone) for k in client.get_keys()], headers=headers, tablefmt=obj['output']))


text:
import { observable, action } from 'mobx';

export class RouterStore {
  @observable location = null;

  history = null;

  constructor() {
    this.push = this.push.bind(this);
    this.replace = this.replace.bind(this);
    this.go = this.go.bind(this);
    this.goBack = this.goBack.bind(this);
    this.goForward = this.goForward.bind(this);
  }

  @action
  _updateLocation(newState) {
    this.location = newState;
  }

  /*
   * History methods
   */
  push = (location, state) => {
    this.history.push(location, state);
  }
  replace = (location, state) => {
    this.history.replace(location, state);
  }
  go = (n) => {
    this.history.go(n);
  }
  goBack = () => {
    this.history.goBack();
  }
  goForward = () => {
    this.history.goForward();
  }
};


text:
<?php if ( ! defined('OC_ADMIN')) exit('Direct access is not allowed.');

    function addHelp() {
        echo '
' . __('With Osclass you can create static pages on which information can be stored, such as "About Us" or "Info" pages. From here you can create, edit or delete your site\'s static pages.') . '
';
    }
    osc_add_hook('help_box','addHelp');

    function customPageHeader() { ?>

<?php _e('Pages'); ?>

            <a href="<?php echo osc_admin_base_url(true); ?>?page=pages&action=add" class="btn btn-green ico ico-32 ico-add-white float-right"><?php _e('Create page'); ?>

<?php
    }
    osc_add_hook('admin_page_header','customPageHeader');

    function customPageTitle($string) {
        return sprintf(__('Pages » %s'), $string);
    }
    osc_add_filter('admin_title', 'customPageTitle');

    //customize Head
    function customHead() { ?>

        <?php
    }
    osc_add_hook('admin_header','customHead', 10);

    $aData      = __get('aData');
    $aRawRows   = __get('aRawRows');
    $sort       = Params::getParam('sort');
    $direction  = Params::getParam('direction');

    $columns    = $aData['aColumns'];
    $rows       = $aData['aRows'];

    osc_current_admin_theme_path( 'parts/header.php' );
?>

<?php _e('Manage pages'); ?> <a href="<?php echo osc_admin_base_url(true); ?>?page=pages&action=add" class="btn btn-mini"><?php _e('Add new'); ?>

    <form class="" id="datatablesForm" action="<?php echo osc_admin_base_url(true); ?>" method="post">
        <input type="hidden" name="page" value="pages" />

                <?php osc_print_bulk_actions('bulk_actions', 'action', __get('bulk_options'), 'select-box-extra'); ?>
                <input type="submit" id="bulk_apply" class="btn" value="<?php echo osc_esc_html( __('Apply') ); ?>" />

                        <?php foreach($columns as $k => $v) {
                            echo ''.$v.'	';
                        }; ?>

                <?php if( count($rows) > 0 ) { ?>
                    <?php foreach($rows as $key => $row) { ?>

                            <?php foreach($row as $k => $v) { ?>
                                <td class="col-<?php echo $k; ?>"><?php echo $v; ?>
                            <?php }; ?>

                    <?php }; ?>
                <?php } else { ?>

<?php _e('No data available in table'); ?>

                <?php } ?>

    </form>

<?php
    function showingResults(){
        $aData = __get('aData');
        echo '

'.osc_pagination_showing((Params::getParam('iPage')-1)*$aData['iDisplayLength']+1, ((Params::getParam('iPage')-1)*$aData['iDisplayLength'])+count($aData['aRows']), $aData['iTotalDisplayRecords'], $aData['iTotalRecords']).'

';
    }
    osc_add_hook('before_show_pagination_admin','showingResults');
    osc_show_pagination_admin($aData);
?>
<form id="dialog-page-delete" method="get" action="<?php echo osc_admin_base_url(true); ?>" class="has-form-actions hide" title="<?php echo osc_esc_html(__('Delete page')); ?>">
    <input type="hidden" name="page" value="pages" />
    <input type="hidden" name="action" value="delete" />
    <input type="hidden" name="id" value="" />

            <?php _e('Are you sure you want to delete this page?'); ?>

            <?php _e('Cancel'); ?>
            <input id="page-delete-submit" type="submit" value="<?php echo osc_esc_html( __('Delete') ); ?>" class="btn btn-red" />

</form>
<div id="dialog-bulk-actions" title="<?php _e('Bulk actions'); ?>" class="has-form-actions hide">

                <?php _e('Cancel'); ?>
                <?php echo osc_esc_html( __('Delete') ); ?>

<?php osc_current_admin_theme_path( 'parts/footer.php' ); ?>