text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class pc extends CI_Controller {

	function __construct()
    {
        parent::__construct();
        $this->load->model('pc_model');
        $this->load->library('form_validation');
    }

	public function index()
	{
		$start = $this->uri->segment(3, 0);
		$start1 = $this->uri->segment(3, 0);
		$start2 = $this->uri->segment(3, 0);
		$start3 = $this->uri->segment(3, 0);
		$start4 = $this->uri->segment(3, 0);
		$start5 = $this->uri->segment(3, 0);
		$all = $this->db->query('SELECT * from barang ORDER BY created_at Desc')->result();
		$cpu = $this->db->query('SELECT * from barang where kategori_barang = "CPU" ORDER BY created_at Desc')->result();
		$monitor = $this->db->query('SELECT * from barang where kategori_barang = "MONITOR" ORDER BY created_at Desc')->result();
		$keyboard = $this->db->query('SELECT * from barang where kategori_barang = "KEYBOARD" ORDER BY created_at Desc')->result();
		$mouse = $this->db->query('SELECT * from barang where kategori_barang = "MOUSE" ORDER BY created_at Desc')->result();
		$laptop = $this->db->query('SELECT * from barang where kategori_barang = "LAPTOP" ORDER BY created_at Desc')->result();
		$pc = $this->db->query('SELECT * from pc
								inner join barang on pc.id_cpu = barang.id_barang
								inner join barang as monitor on pc.id_monitor = barang.id_barang
								inner join barang as keyboard on pc.id_keyboard = barang.id_barang
								inner join barang as mouse on pc.id_mouse = barang.id_barang')->result();

		$data = array(
			'start' => $start,
			'start1' => $start1,
			'start2' => $start2,
			'start3' => $start3,
			'start4' => $start4,
			'start5' => $start5,
			'all' => $all,
			'cpu' => $cpu,
			'monitor' => $monitor,
			'keyboard' => $keyboard,
			'mouse' => $mouse,
			'laptop' => $laptop,
			'pc' => $pc,
			);

		$this->load->view('header/header');
		$this->load->view('pc/list', $data);
		$this->load->view('footer/footer');
	}

	public function create_action()
    {
        $this->_rules();

        if ($this->form_validation->run() == FALSE) {
            $this->create();
        } else {
            $data = array(
		'nama_pc' => $this->input->post('nama_pc',TRUE),
		'os_pc' => $this->input->post('os_pc',TRUE),
		'id_cpu' => $this->input->post('id_cpu',TRUE),
        'id_monitor' => $this->input->post('id_monitor',TRUE),
        'id_keyboard' => $this->input->post('id_keyboard',TRUE),
		'id_mouse' => $this->input->post('id_mouse',TRUE),
		'ket_pc' => $this->input->post('ket_pc',TRUE),
	    );

            $this->pc_model->insert($data);
            $this->session->set_flashdata('message', 'Create Record Success');
            redirect(site_url('pc'));
        }
    }

    public function detail($id)
	{
		$detail = $this->db->query('SELECT * from barang where id_barang ='.$id)->row();

		$data = array(
			'detail' => $detail,
			);

		$this->load->view('header/header');
		$this->load->view('barang/detail', $data);
		$this->load->view('footer/footer');
	}

    public function delete($id)
    {
        $row = $this->barang_model->get_by_id($id);

        if ($row) {
            $this->barang_model->delete($id);
            $this->session->set_flashdata('message', 'Delete Record Success');
            redirect(site_url('barang/index'));
        } else {
            $this->session->set_flashdata('message', 'Record Not Found');
            redirect(site_url('barang/index'));
        }
    }

    public function _rules()
    {
	// $this->form_validation->set_rules('headline', ' ', 'trim');
	// $this->form_validation->set_rules('judul', ' ', 'trim|required');
	// $this->form_validation->set_rules('isi_artikel', ' ', 'trim|required');
 //    $this->form_validation->set_rules('sumber', ' ', 'trim');
 //    $this->form_validation->set_rules('penulis', ' ', 'trim');
	// $this->form_validation->set_rules('idkategori', ' ', 'trim|required|numeric');
	// $this->form_validation->set_rules('idpengguna', ' ', 'trim|numeric');
	// $this->form_validation->set_rules('create_at', ' ', '');
	// $this->form_validation->set_rules('update_at', ' ', 'trim');

	$this->form_validation->set_rules('id_pc', 'id_pc', 'trim');
	$this->form_validation->set_error_delimiters('', '');
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace MusicPlayer.Helpers
{
    /// <summary>
    /// A rest client for communication in the json format.
    /// </summary>
    internal class RestClient : IDisposable
    {
        /// <summary>
        /// The client.
        /// </summary>
        private HttpClient _client;

        /// <summary>
        /// The optional query string.
        /// </summary>
        private string _querystring;

        /// <summary>
        /// Initializes a new instance of the <see cref="RestClient" /> class.
        /// </summary>
        /// <param name="baseUrl">The base url of the web service.</param>
        /// <param name="queryString">The query string that will be apended on every request.</param>
        public RestClient(string baseUrl, string queryString = null)
        {
            _client = new HttpClient();
            _client.BaseAddress = new Uri(baseUrl.EndsWith("/") ? baseUrl : baseUrl + "/");
            _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            _querystring = queryString;
        }

        /// <summary>
        /// Perfroms a GET request.
        /// </summary>
        /// <typeparam name="T">The expected return type.</typeparam>
        /// <param name="endpoint">The endpoint url.</param>
        /// <param name="queryString">The query string for the get request.</param>
        /// <returns>The result.</returns>
        protected async Task<T> Get<T>(string endpoint, string queryString = null)
        {
            string response =  await _client.GetStringAsync(endpoint + GetQueryString(queryString));
            return JsonConvert.DeserializeObject<T>(response);
        }

        /// <summary>
        /// Creates the querystring.
        /// </summary>
        /// <param name="additionalQuerystring">The additional query string.</param>
        /// <returns>The complete query string.</returns>
        private string GetQueryString(string additionalQuerystring = null)
        {
            string result = string.Empty;
            if (!string.IsNullOrWhiteSpace(_querystring) || !string.IsNullOrWhiteSpace(additionalQuerystring))
            {
                result += "?";
            }

            if (!string.IsNullOrWhiteSpace(_querystring))
            {
                result += _querystring.Replace("?", string.Empty);
            }

            if (!string.IsNullOrWhiteSpace(additionalQuerystring))
            {
                result += result.EndsWith("&") || result.EndsWith("?") ? string.Empty : "&";
                result += additionalQuerystring.Replace("?", string.Empty);
            }

            return result;
        }

        /// <summary>
        /// Dispose of the client.
        /// </summary>
        public void Dispose()
        {
            _client.Dispose();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.api.ads.admanager.jaxws.v202202;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
 *             Creates new {@link ForecastAdjustment} objects.
 *
 *
 *
Java class for createForecastAdjustments element declaration.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <element name="createForecastAdjustments">
 *   <complexType>
 *     <complexContent>
 *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *         <sequence>
 *           <element name="forecastAdjustments" type="{https://www.google.com/apis/ads/publisher/v202202}ForecastAdjustment" maxOccurs="unbounded" minOccurs="0"/>
 *         </sequence>
 *       </restriction>
 *     </complexContent>
 *   </complexType>
 * </element>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "forecastAdjustments"
})
@XmlRootElement(name = "createForecastAdjustments")
public class AdjustmentServiceInterfacecreateForecastAdjustments {

    protected List<ForecastAdjustment> forecastAdjustments;

    /**
     * Gets the value of the forecastAdjustments property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the forecastAdjustments property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getForecastAdjustments().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link ForecastAdjustment }
     *
     *
     */
    public List<ForecastAdjustment> getForecastAdjustments() {
        if (forecastAdjustments == null) {
            forecastAdjustments = new ArrayList<ForecastAdjustment>();
        }
        return this.forecastAdjustments;
    }

}


text:
package com.sonelli.juicessh.performancemonitor.controllers;

import android.content.Context;
import android.os.Handler;
import android.util.Log;

import com.sonelli.juicessh.performancemonitor.R;
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException;
import com.sonelli.juicessh.pluginlibrary.listeners.OnSessionExecuteListener;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FreeRamController extends BaseController {

    public static final String TAG = "FreeRamController";

    public FreeRamController(Context context) {
        super(context);
    }

    @Override
    public BaseController start() {
        super.start();

        // Compile the regex patterns outside of the menu_main loop (cpu heavy)
        final Pattern buffersPattern = Pattern.compile("^Buffers:\\s*([0-9]+)");
        final Pattern freePattern = Pattern.compile("^MemFree:\\s*([0-9]+)");
        final Pattern cachedPattern = Pattern.compile("^Cached:\\s*([0-9]+)");

        final Handler handler = new Handler();
        handler.post(new Runnable() {
            @Override
            public void run() {

                try {

                    getPluginClient().executeCommandOnSession(getSessionId(), getSessionKey(), "cat /proc/meminfo", new OnSessionExecuteListener() {

                        private int buffers = -1;
                        private int free = -1;
                        private int cached = -1;

                        @Override
                        public void onCompleted(int exitCode) {
                            switch(exitCode){
                                case 127:
                                    setText(getString(R.string.error));
                                    Log.d(TAG, "Tried to run a command but the command was not found on the server");
                                    break;
                            }
                        }
                        @Override
                        public void onOutputLine(String line) {

                            Matcher buffersMatcher = buffersPattern.matcher(line);
                            Matcher freeMatcher = freePattern.matcher(line);
                            Matcher cachedMatcher = cachedPattern.matcher(line);

                            if(buffersMatcher.find()){
                                buffers = Integer.valueOf(buffersMatcher.group(1));
                                if(buffers > -1 && free > -1 && cached > -1){
                                    long kb = free + buffers + cached;
                                    if(kb > 1048576){
                                        setText(kb / 1024 / 1024 + "GB");
                                    } else if (kb > 1024){
                                        setText(kb / 1024 + "MB");
                                    } else {
                                        setText(kb + "KB");
                                    }
                                }
                            }

                            if(freeMatcher.find()){
                                free = Integer.valueOf(freeMatcher.group(1));
                                if(buffers > -1 && free > -1 && cached > -1){
                                    long kb = free + buffers + cached;
                                    if(kb > 1048576){
                                        setText(kb / 1024 / 1024 + "GB");
                                    } else if (kb > 1024){
                                        setText(kb / 1024 + "MB");
                                    } else {
                                        setText(kb + "KB");
                                    }
                                }
                            }

                            if(cachedMatcher.find()){
                                cached = Integer.valueOf(cachedMatcher.group(1));
                                if(buffers > -1 && free > -1 && cached > -1){
                                    long kb = free + buffers + cached;
                                    if(kb > 1048576){
                                        setText(kb / 1024 / 1024 + "GB");
                                    } else if (kb > 1024){
                                        setText(kb / 1024 + "MB");
                                    } else {
                                        setText(kb + "KB");
                                    }
                                }
                            }

                        }

                        @Override
                        public void onError(int error, String reason) {
                            toast(reason);
                        }

                    });
                } catch (ServiceNotConnectedException e){
                    Log.d(TAG, "Tried to execute a command but could not connect to JuiceSSH plugin service");
                }

                if(isRunning()){
                    handler.postDelayed(this, INTERVAL_SECONDS * 1000L);
                }
            }
        });

        return this;

    }

}


text:
package repo

import (
	"net/http"
	"time"

	api "github.com/gogs/go-gogs-client"

	"gogs.io/gogs/internal/context"
	"gogs.io/gogs/internal/db"
)

func ListIssueComments(c *context.APIContext) {
	var since time.Time
	if len(c.Query("since")) > 0 {
		var err error
		since, err = time.Parse(time.RFC3339, c.Query("since"))
		if err != nil {
			c.ErrorStatus(http.StatusUnprocessableEntity, err)
			return
		}
	}

	// comments,err:=db.GetCommentsByIssueIDSince(, since)
	issue, err := db.GetRawIssueByIndex(c.Repo.Repository.ID, c.ParamsInt64(":index"))
	if err != nil {
		c.Error(err, "get raw issue by index")
		return
	}

	comments, err := db.GetCommentsByIssueIDSince(issue.ID, since.Unix())
	if err != nil {
		c.Error(err, "get comments by issue ID")
		return
	}

	apiComments := make([]*api.Comment, len(comments))
	for i := range comments {
		apiComments[i] = comments[i].APIFormat()
	}
	c.JSONSuccess(&apiComments)
}

func ListRepoIssueComments(c *context.APIContext) {
	var since time.Time
	if len(c.Query("since")) > 0 {
		var err error
		since, err = time.Parse(time.RFC3339, c.Query("since"))
		if err != nil {
			c.ErrorStatus(http.StatusUnprocessableEntity, err)
			return
		}
	}

	comments, err := db.GetCommentsByRepoIDSince(c.Repo.Repository.ID, since.Unix())
	if err != nil {
		c.Error(err, "get comments by repository ID")
		return
	}

	apiComments := make([]*api.Comment, len(comments))
	for i := range comments {
		apiComments[i] = comments[i].APIFormat()
	}
	c.JSONSuccess(&apiComments)
}

func CreateIssueComment(c *context.APIContext, form api.CreateIssueCommentOption) {
	issue, err := db.GetIssueByIndex(c.Repo.Repository.ID, c.ParamsInt64(":index"))
	if err != nil {
		c.Error(err, "get issue by index")
		return
	}

	comment, err := db.CreateIssueComment(c.User, c.Repo.Repository, issue, form.Body, nil)
	if err != nil {
		c.Error(err, "create issue comment")
		return
	}

	c.JSON(http.StatusCreated, comment.APIFormat())
}

func EditIssueComment(c *context.APIContext, form api.EditIssueCommentOption) {
	comment, err := db.GetCommentByID(c.ParamsInt64(":id"))
	if err != nil {
		c.NotFoundOrError(err, "get comment by ID")
		return
	}

	if c.User.ID != comment.PosterID && !c.Repo.IsAdmin() {
		c.Status(http.StatusForbidden)
		return
	} else if comment.Type != db.COMMENT_TYPE_COMMENT {
		c.NoContent()
		return
	}

	oldContent := comment.Content
	comment.Content = form.Body
	if err := db.UpdateComment(c.User, comment, oldContent); err != nil {
		c.Error(err, "update comment")
		return
	}
	c.JSONSuccess(comment.APIFormat())
}

func DeleteIssueComment(c *context.APIContext) {
	comment, err := db.GetCommentByID(c.ParamsInt64(":id"))
	if err != nil {
		c.NotFoundOrError(err, "get comment by ID")
		return
	}

	if c.User.ID != comment.PosterID && !c.Repo.IsAdmin() {
		c.Status(http.StatusForbidden)
		return
	} else if comment.Type != db.COMMENT_TYPE_COMMENT {
		c.NoContent()
		return
	}

	if err = db.DeleteCommentByID(c.User, comment.ID); err != nil {
		c.Error(err, "delete comment by ID")
		return
	}
	c.NoContent()
}


text:
package helpers

import (
	"bytes"
	"io"
)

func ReaderToString(reader io.Reader) string {
	buf := new(bytes.Buffer)
	buf.ReadFrom(reader)
	return buf.String()
}

func ReaderToBytes(reader io.Reader) []byte {
	buf := new(bytes.Buffer)
	buf.ReadFrom(reader)
	return buf.Bytes()
}

func FirstNonEmpty(elems chan error, size int) error {
	for i := 0; i < size; i++ {
		if elem := <-elems; elem != nil {
			return elem
		}
	}
	return nil
}


text:
<?php

class C_Dynamic_Stylesheet_Controller extends C_MVC_Controller
{
	static	$_instances				= array();
	var		$_known_templates		= array();
	var		$_app					= NULL;

	function define($context=FALSE)
	{
		parent::define($context);
		$this->add_mixin('Mixin_Dynamic_Stylesheet_Instance_Methods');
		$this->add_mixin('Mixin_Dynamic_Stylesheet_Actions');
		$this->implement('I_Dynamic_Stylesheet');
	}

	function initialize()
	{
		parent::initialize();
		$this->_app = C_NextGen_Global_Settings::get_instance()->dynamic_stylesheet_slug;
	}

	static function &get_instance($context=FALSE)
	{
		if (!isset(self::$_instances[$context])) {
			$klass = get_class();
			self::$_instances[$context] = new $klass($context);
		}
		return self::$_instances[$context];
	}
}

/**
 * Provides instance methods for the dynamic stylesheet utility
 */
class Mixin_Dynamic_Stylesheet_Instance_Methods extends Mixin
{
	/**
	 * Registers a template with the dynamic stylesheet utility. A template
	 * must be registered before it can be loaded
	 * @param string $name
	 * @param string $template
	 */
	function register($name, $template)
	{
		$this->object->_known_templates[$name] = $template;
	}

	/**
	 * Finds a registered template by name
	 * @param string $name
	 * @return int
	 */
	function get_css_template_index($name)
	{
		return array_search($name, array_keys($this->object->_known_templates));
	}

	function get_css_template($index)
	{
		$keys = array_keys($this->object->_known_templates);
		return $this->object->_known_templates[$keys[$index]];
	}

	/**
	 * Loads a template, along with the dynamic variables to be interpolated
	 * @param string $name
	 * @param array $vars
	 */
	function enqueue($name, $data=array())
	{
		if (($index = $this->object->get_css_template_index($name)) !== FALSE)
        {
            if (is_subclass_of($data, 'C_DataMapper_Model'))
                $data = $data->get_entity();
			$data = $this->object->encode($data);
            wp_enqueue_style(
                'dyncss-' . $index . '@dynamic',
                $this->object->get_router()->get_url("/{$this->object->_app}", FALSE) . "/{$index}/{$data}"
            );
		}
	}

    /**
     * Encodes $data
     *
     * base64 encoding uses '==' to denote the end of the sequence, but keep it out of the url
     * @param $data
     * @return string
     */
    function encode($data)
	{
		$data = json_encode($data);
		$data = base64_encode($data);
		$data = str_replace('/', '\\', $data);
        $data = rtrim($data, '=');
		return $data;
	}

    /**
     * Decodes $data
     *
     * @param $data
     * @return array|mixed
     */
    function decode($data)
	{
		$data = str_replace('\\', '/', $data);
		$data = base64_decode($data . '==');
		$data = json_decode($data);
		return $data;
	}
}

/**
 * Provides controller actions for the dynamic stylesheet
 */
class Mixin_Dynamic_Stylesheet_Actions extends Mixin
{
	function index_action()
	{
		$this->set_content_type('css');
		if (($data = $this->param('data')) !== FALSE && ($index = $this->param('index')) !== FALSE) {
			$data = $this->object->decode($data);
			$this->render_view($this->object->get_css_template($index), $data);
		}
	}
}


text:
module TextualMixins::TextualGroupTags
  def textual_group_tags
    TextualTags.new(_("Smart Management"), %i[tags])
  end
end


text:
mod relay_client_component;

use relay_client_component::transform_fixture;
use fixture_tests::test_fixture;

#[test]
fn fragment_on_all_non_node_union_invalid() {
    let input = include_str!("relay_client_component/fixtures/fragment-on-all-non-node-union.invalid.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-on-all-non-node-union.invalid.expected");
    test_fixture(transform_fixture, "fragment-on-all-non-node-union.invalid.graphql", "relay_client_component/fixtures/fragment-on-all-non-node-union.invalid.expected", input, expected);
}

#[test]
fn fragment_on_fake_node_type_invalid() {
    let input = include_str!("relay_client_component/fixtures/fragment-on-fake-node-type.invalid.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-on-fake-node-type.invalid.expected");
    test_fixture(transform_fixture, "fragment-on-fake-node-type.invalid.graphql", "relay_client_component/fixtures/fragment-on-fake-node-type.invalid.expected", input, expected);
}

#[test]
fn fragment_on_non_node_type_invalid() {
    let input = include_str!("relay_client_component/fixtures/fragment-on-non-node-type.invalid.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-on-non-node-type.invalid.expected");
    test_fixture(transform_fixture, "fragment-on-non-node-type.invalid.graphql", "relay_client_component/fixtures/fragment-on-non-node-type.invalid.expected", input, expected);
}

#[test]
fn fragment_on_some_non_node_union_invalid() {
    let input = include_str!("relay_client_component/fixtures/fragment-on-some-non-node-union.invalid.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-on-some-non-node-union.invalid.expected");
    test_fixture(transform_fixture, "fragment-on-some-non-node-union.invalid.graphql", "relay_client_component/fixtures/fragment-on-some-non-node-union.invalid.expected", input, expected);
}

#[test]
fn fragment_with_arguments_invalid() {
    let input = include_str!("relay_client_component/fixtures/fragment-with-arguments.invalid.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-with-arguments.invalid.expected");
    test_fixture(transform_fixture, "fragment-with-arguments.invalid.graphql", "relay_client_component/fixtures/fragment-with-arguments.invalid.expected", input, expected);
}

#[test]
fn fragment_with_incompatible_directives_invalid() {
    let input = include_str!("relay_client_component/fixtures/fragment-with-incompatible-directives.invalid.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-with-incompatible-directives.invalid.expected");
    test_fixture(transform_fixture, "fragment-with-incompatible-directives.invalid.graphql", "relay_client_component/fixtures/fragment-with-incompatible-directives.invalid.expected", input, expected);
}

#[test]
fn fragment_with_relay_client_component() {
    let input = include_str!("relay_client_component/fixtures/fragment-with-relay-client-component.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-with-relay-client-component.expected");
    test_fixture(transform_fixture, "fragment-with-relay-client-component.graphql", "relay_client_component/fixtures/fragment-with-relay-client-component.expected", input, expected);
}

#[test]
fn fragment_with_relay_client_component_on_query() {
    let input = include_str!("relay_client_component/fixtures/fragment-with-relay-client-component-on-query.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-with-relay-client-component-on-query.expected");
    test_fixture(transform_fixture, "fragment-with-relay-client-component-on-query.graphql", "relay_client_component/fixtures/fragment-with-relay-client-component-on-query.expected", input, expected);
}

#[test]
fn fragment_with_relay_client_component_on_viewer() {
    let input = include_str!("relay_client_component/fixtures/fragment-with-relay-client-component-on-viewer.graphql");
    let expected = include_str!("relay_client_component/fixtures/fragment-with-relay-client-component-on-viewer.expected");
    test_fixture(transform_fixture, "fragment-with-relay-client-component-on-viewer.graphql", "relay_client_component/fixtures/fragment-with-relay-client-component-on-viewer.expected", input, expected);
}

#[test]
fn query_with_relay_client_component() {
    let input = include_str!("relay_client_component/fixtures/query-with-relay-client-component.graphql");
    let expected = include_str!("relay_client_component/fixtures/query-with-relay-client-component.expected");
    test_fixture(transform_fixture, "query-with-relay-client-component.graphql", "relay_client_component/fixtures/query-with-relay-client-component.expected", input, expected);
}


text:
<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: search_group.php 30187 2012-05-16 03:24:35Z chenmengshu $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
define('NOROBOT', TRUE);

require_once libfile('function/home');
require_once libfile('function/post');

if(!$_G['setting']['search']['group']['status']) {
	showmessage('search_group_closed');
}

if($_G['adminid'] != 1 && !($_G['group']['allowsearch'] & 16)) {
	showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}

$_G['setting']['search']['group']['searchctrl'] = intval($_G['setting']['search']['group']['searchctrl']);

$srchmod = 5;

$cachelife_time = 300;		// Life span for cache of searching in specified range of time
$cachelife_text = 3600;		// Life span for cache of text searching

$srchtype = empty($_GET['srchtype']) ? '' : trim($_GET['srchtype']);
$searchid = isset($_GET['searchid']) ? intval($_GET['searchid']) : 0;

$srchtxt = $_GET['srchtxt'];
$srchfid = intval($_GET['srchfid']);
$viewgroup = intval($_GET['viewgroup']);
$keyword = isset($srchtxt) ? dhtmlspecialchars(trim($srchtxt)) : '';

if(!submitcheck('searchsubmit', 1)) {

	include template('search/group');

} else {

	$orderby = in_array($_GET['orderby'], array('dateline', 'replies', 'views')) ? $_GET['orderby'] : 'lastpost';
	$ascdesc = isset($_GET['ascdesc']) && $_GET['ascdesc'] == 'asc' ? 'asc' : 'desc';

	if(!empty($searchid)) {

		require_once libfile('function/group');

		$page = max(1, intval($_GET['page']));
		$start_limit = ($page - 1) * $_G['tpp'];

		$index = C::t('common_searchindex')->fetch_by_searchid_srchmod($searchid, $srchmod);
		if(!$index) {
			showmessage('search_id_invalid');
		}

		$keyword = dhtmlspecialchars($index['keywords']);
		$keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : '';

		$index['keywords'] = rawurlencode($index['keywords']);
		$index['ids'] = dunserialize($index['ids']);
		$searchstring = explode('|', $index['searchstring']);
		$srchfid = $searchstring[2];
		$threadlist = $grouplist = $posttables = array();
		if($index['ids']['thread'] && ($searchstring[2] || empty($viewgroup))) {
			require_once libfile('function/misc');
			$threads = C::t('forum_thread')->fetch_all_by_tid_fid_displayorder(explode(',', $index['ids']['thread']), null, 0, $orderby, $start_limit, $_G['tpp'], '>=', $ascdesc);
			foreach($threads as $value) {
				$fids[$value['fid']] = $value['fid'];
			}
			$forums = C::t('forum_forum')->fetch_all_name_by_fid($fids);
			foreach($threads as $thread) {
				$thread['forumname'] = $forums[$thread['fid']]['name'];
				$thread['subject'] = bat_highlight($thread['subject'], $keyword);
				$thread['realtid'] = $thread['tid'];
				$threadlist[$thread['tid']] = procthread($thread);
				$posttables[$thread['posttableid']][] = $thread['tid'];
			}
			if($threadlist) {
				foreach($posttables as $tableid => $tids) {
					foreach(C::t('forum_post')->fetch_all_by_tid($tableid, $tids, true, '', 0, 0, 1) as $post) {
						$threadlist[$post['tid']]['message'] = bat_highlight(messagecutstr($post['message'], 200), $keyword);
					}
				}
			}
		}
		$groupnum = !empty($index['ids']['group']) ? count(explode(',', $index['ids']['group'])) - 1 : 0;
		if($index['ids']['group'] && ($viewgroup || empty($searchstring[2]))) {
			if(empty($viewgroup)) {
				$index['ids']['group'] = implode(',', array_slice(explode(',', $index['ids']['group']), 0, 9));
			}
			if($viewgroup) {
				$query = C::t('forum_forum')->fetch_all_info_by_fids(explode(',', $index['ids']['group']), 3, $_G['tpp'], 0, 0, 0, 0, 'sub', $start_limit);
			} else {
				$query = C::t('forum_forum')->fetch_all_info_by_fids(explode(',', $index['ids']['group']), 3, 0, 0, 0, 0, 0, 'sub');
			}

			foreach($query as $group) {
				$group['icon'] = get_groupimg($group['icon'], 'icon');
				$group['name'] = bat_highlight($group['name'], $keyword);
				$group['description'] = bat_highlight($group['description'], $keyword);
				$group['dateline'] = dgmdate($group['dateline'], 'u');
				$grouplist[] = $group;
			}
		}
		if(empty($viewgroup)) {
			$multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=group&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes".($viewgroup ? '&viewgroup=1' : ''));
		} else {
			$multipage = multi($groupnum, $_G['tpp'], $page, "search.php?mod=group&searchid=$searchid&orderby=$orderby&ascdesc=$ascdesc&searchsubmit=yes".($viewgroup ? '&viewgroup=1' : ''));
		}

		$url_forward = 'search.php?mod=group&'.$_SERVER['QUERY_STRING'];

		include template('search/group');

	} else {

		$srchuname = isset($_GET['srchuname']) ? trim($_GET['srchuname']) : '';

		$searchstring = 'group|title|'.$srchfid.'|'.addslashes($srchtxt);
		$searchindex = array('id' => 0, 'dateline' => '0');

		foreach(C::t('common_searchindex')->fetch_all_search($_G['setting']['search']['group']['searchctrl'], $_G['clientip'], $_G['uid'], $_G['timestamp'], $searchstring, $srchmod) as $index) {
			if($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) {
				$searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']);
				break;
			} elseif($_G['adminid'] != '1' && $index['flood']) {
				showmessage('search_ctrl', 'search.php?mod=group', array('searchctrl' => $_G['setting']['search']['group']['searchctrl']));
			}
		}

		if($searchindex['id']) {

			$searchid = $searchindex['id'];

		} else {

			!($_G['group']['exempt'] & 2) && checklowerlimit('search');

			if(!$srchtxt && !$srchuid && !$srchuname) {
				dheader('Location: search.php?mod=group');
			}

			if($_G['adminid'] != '1' && $_G['setting']['search']['group']['maxspm']) {
				if(C::t('common_searchindex')->count_by_dateline($_G['timestamp'], $srchmod) >= $_G['setting']['search']['group']['maxspm']) {
					showmessage('search_toomany', 'search.php?mod=group', array('maxspm' => $_G['setting']['search']['group']['maxspm']));
				}
			}

			$num = $ids = $tnum = $tids = 0;
			$_G['setting']['search']['group']['maxsearchresults'] = $_G['setting']['search']['group']['maxsearchresults'] ? intval($_G['setting']['search']['group']['maxsearchresults']) : 500;
			list($srchtxt, $srchtxtsql) = searchkey($keyword, "subject LIKE '%{text}%'", true);

			$threads = C::t('forum_thread')->fetch_all_by_tid_fid(0, $srchfid, 1, '', $keyword, $_G['setting']['search']['group']['maxsearchresults']);
			foreach($threads as $value) {
				$fids[$value['fid']] = $value['fid'];
			}
			$forums = C::t('forum_forum')->fetch_all_by_fid($fids);
			foreach($threads as $thread) {
				if($forums[$value['fid']]['status'] == 3) {
					$tids .= ','.$thread['tid'];
					$tnum++;
				}
			}

			if(!$srchfid) {
				$srchtxtsql = str_replace('subject LIKE', 'name LIKE', $srchtxtsql);
				$query = C::t('forum_forum')->fetch_all_fid_for_group(0, $_G['setting']['search']['group']['maxsearchresults'], 1, $srchtxtsql);
				foreach($query as $group) {
					$ids .= ','.$group['fid'];
					$num++;
				}
			}
			$allids = array('thread' => $tids, 'group' => $ids);
			$keywords = str_replace('%', '+', $srchtxt);
			$expiration = TIMESTAMP + $cachelife_text;

			$searchid = C::t('common_searchindex')->insert(array(
				'srchmod' => $srchmod,
				'keywords' => $keywords,
				'searchstring' => $searchstring,
				'useip' => $_G['clientip'],
				'uid' => $_G['uid'],
				'dateline' => $_G['timestamp'],
				'expiration' => $expiration,
				'num' => $tnum,
				'ids' => serialize($allids)
			), true);

			!($_G['group']['exempt'] & 2) && updatecreditbyaction('search');
		}

		dheader("location: search.php?mod=group&searchid=$searchid&searchsubmit=yes&kw=".urlencode($keyword));

	}

}

?>


text:
package com.vaadin.tests.containers;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Layout;
import com.vaadin.v7.data.Container;
import com.vaadin.v7.data.Item;
import com.vaadin.v7.data.Property;
import com.vaadin.v7.data.util.ContainerHierarchicalWrapper;
import com.vaadin.v7.data.util.IndexedContainer;
import com.vaadin.v7.ui.Table;
import com.vaadin.v7.ui.Tree;

public class HierarchicalWrapperOrdering extends TestBase {

    private static final long serialVersionUID = 1L;

    IndexedContainer indexedContainer = new IndexedContainer();

    Container.Hierarchical hier = new ContainerHierarchicalWrapper(
            indexedContainer);

    Tree tree1;

    private static void sort(IndexedContainer container) {
        Object[] properties = new Object[1];
        properties[0] = "name";

        boolean[] ascending = new boolean[1];
        ascending[0] = true;

        container.sort(properties, ascending);
    }

    private static void populateContainer(Container.Hierarchical container) {
        container.addContainerProperty("name", String.class, null);

        addItem(container, "Games", null);
        addItem(container, "Call of Duty", "Games");
        addItem(container, "Might and Magic", "Games");
        addItem(container, "Fallout", "Games");
        addItem(container, "Red Alert", "Games");

        addItem(container, "Cars", null);
        addItem(container, "Toyota", "Cars");
        addItem(container, "Volvo", "Cars");
        addItem(container, "Audi", "Cars");
        addItem(container, "Ford", "Cars");

        addItem(container, "Natural languages", null);
        addItem(container, "Swedish", "Natural languages");
        addItem(container, "English", "Natural languages");
        addItem(container, "Finnish", "Natural languages");

        addItem(container, "Programming languages", null);
        addItem(container, "C++", "Programming languages");
        addItem(container, "PHP", "Programming languages");
        addItem(container, "Java", "Programming languages");
        addItem(container, "Python", "Programming languages");

    }

    public static void addItem(Container.Hierarchical container, String string,
            String parent) {
        Item item = container.addItem(string);
        item.getItemProperty("name").setValue(string);

        if (parent != null) {
            container.setParent(string, parent);
        }

    }

    @Override
    protected void setup() {
        Layout l = getLayout();

        populateContainer(hier);

        // sort(indexedContainer);

        tree1 = new Tree("Tree with wrapped IndexedContainer");
        tree1.setContainerDataSource(hier);
        tree1.setItemCaptionPropertyId("name");
        for (Object id : hier.rootItemIds()) {
            tree1.expandItemsRecursively(id);
        }
        l.addComponent(tree1);

        // This contains a bug, changes not reflected back to client
        Button modify = new Button("Modify and sort (has a bug)",
                event -> {
                    // Get first item
                    Object itemId = indexedContainer.getIdByIndex(0);
                    Item item = indexedContainer.getItem(itemId);
                    Property<String> property = item.getItemProperty("name");
                    // Prepend with Z so item should get sorted later
                    property.setValue("Z " + property.getValue());
                    // this does not work alone, requires extraneous
                    // setContainerDataSource for server-side changes to be
                    // reflected back to client-side
                    sort(indexedContainer);
                });
        l.addComponent(modify);

        Table t = new Table("Table with indexed container", indexedContainer);

        l.addComponent(t);
    }

    @Override
    protected String getDescription() {
        return "Items should be in same order as in wrapped container after sorting.";
    }

    @Override
    protected Integer getTicketNumber() {
        return 3688;
    }

}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** |  | [optional]
**description_short** | [**list[I18nFieldInput]**](#I18nFieldInput) |  | [optional]
**description** | [**list[I18nFieldInput]**](#I18nFieldInput) |  | [optional]
**meta_title** | [**list[I18nFieldInput]**](#I18nFieldInput) |  | [optional]
**meta_description** | [**list[I18nFieldInput]**](#I18nFieldInput) |  | [optional]
**meta_keywords** | [**list[I18nFieldInput]**](#I18nFieldInput) |  | [optional]
**link_rewrite** | [**list[I18nFieldInput]**](#I18nFieldInput) |  | [optional]
**active** | **bool** |  | [optional]

[[Back to Model list]](#documentation-for-models) [[Back to API list]](#documentation-for-api-endpoints)


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

namespace sw704e17.Database.Request
{
    public class HandshakeResponse : Response
    {
        public int Ssn { get; set; }

        public HandshakeResponse(string type, int ack, int ssn) : base(type, ack)
        {
            Ssn = ssn;
        }
    }
}


text:
<html>
<head>
<title>Powered by CourseBuilder</title>
</head>
<body>
<script language="JavaScript">
document.location.href="../player/Player.html?xmlid=../content/000000004699/000000004699&width=1000&height=480";
</script>
</body>
</html>


text:
import _extends from "@babel/runtime/helpers/extends";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import React from 'react';
import PropTypes from 'prop-types';
import warning from 'warning';
import FormGroup from '../FormGroup';
import { useForkRef } from '../utils/reactHelpers';
import RadioGroupContext from './RadioGroupContext';
var RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
  var actions = props.actions,
      children = props.children,
      name = props.name,
      valueProp = props.value,
      onChange = props.onChange,
      other = _objectWithoutProperties(props, ["actions", "children", "name", "value", "onChange"]);

  var rootRef = React.useRef(null);

  var _React$useRef = React.useRef(props.value != null),
      isControlled = _React$useRef.current;

  var _React$useState = React.useState(function () {
    if (!isControlled) {
      return props.defaultValue;
    }

    return null;
  }),
      _React$useState2 = _slicedToArray(_React$useState, 2),
      valueState = _React$useState2[0],
      setValue = _React$useState2[1];

  React.useImperativeHandle(actions, function () {
    return {
      focus: function focus() {
        var input = rootRef.current.querySelector('input:not(:disabled):checked');

        if (!input) {
          input = rootRef.current.querySelector('input:not(:disabled)');
        }

        if (input) {
          input.focus();
        }
      }
    };
  }, []);
  React.useEffect(function () {
    process.env.NODE_ENV !== "production" ? warning(isControlled === (valueProp != null), ["Material-UI: A component is changing ".concat(isControlled ? 'a ' : 'an un', "controlled RadioGroup to be ").concat(isControlled ? 'un' : '', "controlled."), 'Input elements should not switch from uncontrolled to controlled (or vice versa).', 'Decide between using a controlled or uncontrolled RadioGroup ' + 'element for the lifetime of the component.', 'More info: https://fb.me/react-controlled-components'].join('\n')) : void 0;
  }, [valueProp, isControlled]);
  var value = isControlled ? valueProp : valueState;

  var handleChange = function handleChange(event) {
    if (!isControlled) {
      setValue(event.target.value);
    }

    if (onChange) {
      onChange(event, event.target.value);
    }
  };

  var context = {
    name: name,
    onChange: handleChange,
    value: value
  };
  var handleRef = useForkRef(ref, rootRef);
  return React.createElement(FormGroup, _extends({
    role: "radiogroup",
    ref: handleRef
  }, other), React.createElement(RadioGroupContext.Provider, {
    value: context
  }, children));
});
process.env.NODE_ENV !== "production" ? RadioGroup.propTypes = {
  /**
   * @ignore
   */
  actions: PropTypes.shape({
    current: PropTypes.object
  }),

  /**
   * The content of the component.
   */
  children: PropTypes.node,

  /**
   * The default `input` element value, useful when not controlling the component.
   */
  defaultValue: PropTypes.any,

  /**
   * The name used to reference the value of the control.
   */
  name: PropTypes.string,

  /**
   * @ignore
   */
  onBlur: PropTypes.func,

  /**
   * Callback fired when a radio button is selected.
   *
   * @param {object} event The event source of the callback.
   * You can pull out the new value by accessing `event.target.value`.
   * @param {string} value The `value` of the selected radio button
   */
  onChange: PropTypes.func,

  /**
   * @ignore
   */
  onKeyDown: PropTypes.func,

  /**
   * Value of the selected radio button.
   */
  value: PropTypes.string
} : void 0;
export default RadioGroup;


text:
import React, { useState } from 'react';

import { format } from 'date-fns';
import { DateRange, DayPicker } from 'react-day-picker';

export default function App() {
  const [range, setRange] = useState<DateRange | undefined>();

  let footer =
Please pick the first day.
;
  if (range?.from) {
    if (!range.to) {
      footer =
{format(range.from, 'PPP')}
;
    } else if (range.to) {
      footer = (

          {format(range.from, 'PPP')}–{format(range.to, 'PPP')}

      );
    }
  }

  return (
    <DayPicker
      defaultMonth={new Date(2022, 8)}
      mode="range"
      min={3}
      max={6}
      selected={range}
      onSelect={setRange}
      footer={footer}
    />
  );
}


text:
#pragma once

#include <stdint.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "esp_err.h"
#include "esp_intr_alloc.h"
#include "esp_heap_caps.h"
#include "esp_pm.h"
#include "soc/soc_caps.h"
#include "hal/mcpwm_hal.h"
#include "hal/mcpwm_types.h"
#include "driver/mcpwm_types.h"

#ifdef __cplusplus
extern "C" {
#endif

#if CONFIG_MCPWM_ISR_IRAM_SAFE || CONFIG_MCPWM_CTRL_FUNC_IN_IRAM
#define MCPWM_MEM_ALLOC_CAPS      (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
#else
#define MCPWM_MEM_ALLOC_CAPS      MALLOC_CAP_DEFAULT
#endif

#if CONFIG_MCPWM_ISR_IRAM_SAFE
#define MCPWM_INTR_ALLOC_FLAG     (ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_IRAM)
#else
#define MCPWM_INTR_ALLOC_FLAG     (ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED)
#endif

#define MCPWM_PERIPH_CLOCK_PRE_SCALE (2)
#define MCPWM_PM_LOCK_NAME_LEN_MAX 16

typedef struct mcpwm_group_t mcpwm_group_t;
typedef struct mcpwm_timer_t mcpwm_timer_t;
typedef struct mcpwm_cap_timer_t mcpwm_cap_timer_t;
typedef struct mcpwm_oper_t mcpwm_oper_t;
typedef struct mcpwm_cmpr_t mcpwm_cmpr_t;
typedef struct mcpwm_gen_t mcpwm_gen_t;
typedef struct mcpwm_fault_t mcpwm_fault_t;
typedef struct mcpwm_gpio_fault_t mcpwm_gpio_fault_t;
typedef struct mcpwm_soft_fault_t mcpwm_soft_fault_t;
typedef struct mcpwm_sync_t mcpwm_sync_t;
typedef struct mcpwm_gpio_sync_src_t mcpwm_gpio_sync_src_t;
typedef struct mcpwm_timer_sync_src_t mcpwm_timer_sync_src_t;
typedef struct mcpwm_soft_sync_src_t mcpwm_soft_sync_src_t;
typedef struct mcpwm_cap_channel_t mcpwm_cap_channel_t;

struct mcpwm_group_t {
    int group_id;            // group ID, index from 0
    mcpwm_hal_context_t hal; // HAL instance is at group level
    portMUX_TYPE spinlock;   // group level spinlock
    uint32_t resolution_hz;  // MCPWM group clock resolution
    esp_pm_lock_handle_t pm_lock; // power management lock
    soc_module_clk_t clk_src; // peripheral source clock
    mcpwm_cap_timer_t *cap_timer; // mcpwm capture timers
    mcpwm_timer_t *timers[SOC_MCPWM_TIMERS_PER_GROUP]; // mcpwm timer array
    mcpwm_oper_t *operators[SOC_MCPWM_OPERATORS_PER_GROUP]; // mcpwm operator array
    mcpwm_gpio_fault_t *gpio_faults[SOC_MCPWM_GPIO_FAULTS_PER_GROUP]; // mcpwm fault detectors array
    mcpwm_gpio_sync_src_t *gpio_sync_srcs[SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP];  // mcpwm gpio sync array
#if CONFIG_PM_ENABLE
    char pm_lock_name[MCPWM_PM_LOCK_NAME_LEN_MAX]; // pm lock name
#endif
};

typedef enum {
    MCPWM_TIMER_FSM_INIT,
    MCPWM_TIMER_FSM_ENABLE,
} mcpwm_timer_fsm_t;

struct mcpwm_timer_t {
    int timer_id;           // timer ID, index from 0
    mcpwm_group_t *group;   // which group the timer belongs to
    mcpwm_timer_fsm_t fsm;  // driver FSM
    portMUX_TYPE spinlock;  // spin lock
    intr_handle_t intr;     // interrupt handle
    uint32_t resolution_hz; // resolution of the timer
    uint32_t peak_ticks;    // peak ticks that the timer could reach to
    mcpwm_timer_sync_src_t *sync_src;      // timer sync_src
    mcpwm_timer_count_mode_t count_mode; // count mode
    mcpwm_timer_event_cb_t on_full;      // callback function when MCPWM timer counts to peak value
    mcpwm_timer_event_cb_t on_empty;     // callback function when MCPWM timer counts to zero
    mcpwm_timer_event_cb_t on_stop;      // callback function when MCPWM timer stops
    void *user_data;                     // user data which would be passed to the timer callbacks
};

struct mcpwm_oper_t {
    int oper_id;           // operator ID, index from 0
    mcpwm_group_t *group;  // which group the timer belongs to
    mcpwm_timer_t *timer;  // which timer is connected to this operator
    portMUX_TYPE spinlock; // spin lock
    intr_handle_t intr;    // interrupt handle
    mcpwm_gen_t *generators[SOC_MCPWM_GENERATORS_PER_OPERATOR];    // mcpwm generator array
    mcpwm_cmpr_t *comparators[SOC_MCPWM_COMPARATORS_PER_OPERATOR]; // mcpwm comparator array
    mcpwm_soft_fault_t *soft_fault;                                // mcpwm software fault
    mcpwm_operator_brake_mode_t brake_mode_on_soft_fault;          // brake mode on software triggered fault
    mcpwm_operator_brake_mode_t brake_mode_on_gpio_fault[SOC_MCPWM_GPIO_FAULTS_PER_GROUP]; // brake mode on GPIO triggered faults
    uint32_t deadtime_resolution_hz;     // resolution of deadtime submodule
    mcpwm_brake_event_cb_t on_brake_cbc; // callback function which would be invoked when mcpwm operator goes into trip zone
    mcpwm_brake_event_cb_t on_brake_ost; // callback function which would be invoked when mcpwm operator goes into trip zone
    void *user_data;                     // user data which would be passed to the trip zone callback
};

struct mcpwm_cmpr_t {
    int cmpr_id;                       // comparator ID, index from 0
    mcpwm_oper_t *oper;                // which operator that the comparator resides in
    intr_handle_t intr;                // interrupt handle
    portMUX_TYPE spinlock;             // spin lock
    uint32_t compare_ticks;            // compare value of this comparator
    mcpwm_compare_event_cb_t on_reach; // ISR callback function  which would be invoked on timer counter reaches compare value
    void *user_data;                   // user data which would be passed to the comparator callbacks
};

struct mcpwm_gen_t {
    int gen_id;             // generator ID, index from 0
    mcpwm_oper_t *oper;     // which operator that the generator resides in
    int gen_gpio_num;       // GPIO number used by the generator
    portMUX_TYPE spinlock;  // spin lock
};

typedef enum {
    MCPWM_FAULT_TYPE_GPIO, // external GPIO fault
    MCPWM_FAULT_TYPE_SOFT, // software fault
} mcpwm_fault_type_t;

struct mcpwm_fault_t {
    mcpwm_group_t *group;    // which group the fault belongs to
    mcpwm_fault_type_t type; // fault type
    esp_err_t (*del)(mcpwm_fault_t *fault);
};

struct mcpwm_gpio_fault_t {
    mcpwm_fault_t base;  // base class
    int fault_id;        // fault detector ID, index from 0
    int gpio_num;        // GPIO number of fault detector
    intr_handle_t intr;  // interrupt handle
    mcpwm_fault_event_cb_t on_fault_enter; // ISR callback function that would be invoked when fault signal got triggered
    mcpwm_fault_event_cb_t on_fault_exit;  // ISR callback function that would be invoked when fault signal got clear
    void *user_data;      // user data which would be passed to the isr_cb
};

struct mcpwm_soft_fault_t {
    mcpwm_fault_t base;     // base class
    mcpwm_oper_t *oper;     // the operator where the soft fault allocated from
};

typedef enum {
    MCPWM_SYNC_TYPE_TIMER, // sync event generated by MCPWM timer count event
    MCPWM_SYNC_TYPE_GPIO,  // sync event generated by GPIO
    MCPWM_SYNC_TYPE_SOFT,  // sync event generated by software
} mcpwm_sync_src_type_t;

struct mcpwm_sync_t {
    mcpwm_group_t *group;      // which group the sync_src belongs to
    mcpwm_sync_src_type_t type; // sync_src type
    esp_err_t (*del)(mcpwm_sync_t *sync_src);
};

struct mcpwm_gpio_sync_src_t {
    mcpwm_sync_t base; // base class
    int sync_id;       // sync signal ID
    int gpio_num; // GPIO number
};

struct mcpwm_timer_sync_src_t {
    mcpwm_sync_t base;    // base class
    mcpwm_timer_t *timer; // timer handle, where this sync_src allocated from
};

typedef enum {
    MCPWM_SOFT_SYNC_FROM_NONE,  // the software sync event generator has not been assigned
    MCPWM_SOFT_SYNC_FROM_TIMER, // the software sync event is generated by MCPWM timer
    MCPWM_SOFT_SYNC_FROM_CAP,   // the software sync event is generated by MCPWM capture timer
} mcpwm_soft_sync_source_t;

struct mcpwm_soft_sync_src_t {
    mcpwm_sync_t base;                       // base class
    mcpwm_soft_sync_source_t soft_sync_from; // where the software sync event is generated by
    union {
        mcpwm_timer_t *timer;                // soft sync is generated by which MCPWM timer
        mcpwm_cap_timer_t *cap_timer;        // soft sync is generated by which MCPWM capture timer
    };
};

typedef enum {
    MCPWM_CAP_TIMER_FSM_INIT,
    MCPWM_CAP_TIMER_FSM_ENABLE,
} mcpwm_cap_timer_fsm_t;

typedef enum {
    MCPWM_CAP_CHAN_FSM_INIT,
    MCPWM_CAP_CHAN_FSM_ENABLE,
} mcpwm_cap_channel_fsm_t;

struct mcpwm_cap_timer_t {
    mcpwm_group_t *group;   // which group the capture timer belongs to
    portMUX_TYPE spinlock;  // spin lock, to prevent concurrently accessing capture timer level resources, including registers
    uint32_t resolution_hz; // resolution of capture timer
    mcpwm_cap_timer_fsm_t fsm;    // driver FSM
    esp_pm_lock_handle_t pm_lock; // power management lock
    mcpwm_cap_channel_t *cap_channels[SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER]; // capture channel array
};

struct mcpwm_cap_channel_t {
    int cap_chan_id;                  // capture channel ID, index from 0
    mcpwm_cap_timer_t *cap_timer;     // which capture timer that the channel resides in
    uint32_t prescale;                // prescale of capture signal
    int gpio_num;                     // GPIO number used by the channel
    mcpwm_cap_channel_fsm_t fsm;      // driver FSM
    intr_handle_t intr;               // Interrupt handle
    mcpwm_capture_event_cb_t on_cap;  // Callback function which would be invoked in capture interrupt routine
    void *user_data;                  // user data which would be passed to the capture callback
};

mcpwm_group_t *mcpwm_acquire_group_handle(int group_id);
void mcpwm_release_group_handle(mcpwm_group_t *group);
esp_err_t mcpwm_select_periph_clock(mcpwm_group_t *group, soc_module_clk_t clk_src);

#ifdef __cplusplus
}
#endif


text:
package com.intellij.execution.testframework.sm.runner.states;

import com.intellij.execution.testframework.sm.SMTestsRunnerBundle;

/**
 * @author Roman Chernyatchik
 *
 * Describes properties of tests/suites states
 */
public interface TestStateInfo {
  /**
   * @return If test/test suite is running
   */
  boolean isInProgress();

  /**
   * Some magic definition from AbstractTestProxy class.
   * If state is defect something wrong is with it and should be shown
   * properly in UI.
   * @return
   */
  boolean isDefect();

  /**
   * @return True if test/suite has been already launched
   */
  boolean wasLaunched();

  /**
   * Describes final states, e.g such states will not be
   * changed after finished event.
   * @return True if is final
   */
  boolean isFinal();

  /**
   * @return Was terminated by user
   */
  boolean wasTerminated();

  /**
   * It's some magic parameter than describe state type.
   * @return
   */
  Magnitude getMagnitude();

  //WARN: It is Hack, see PoolOfTestStates, API is necessary
  enum Magnitude {
    SKIPPED_INDEX(0, 1, SMTestsRunnerBundle.message("sm.test.runner.magnitude.skipped.failed.title")),
    COMPLETE_INDEX(1, 3, SMTestsRunnerBundle.message("sm.test.runner.magnitude.completed.failed.title")),
    NOT_RUN_INDEX(2, 0, SMTestsRunnerBundle.message("sm.test.runner.magnitude.not.run.failed.title")),
    RUNNING_INDEX(3, 7, SMTestsRunnerBundle.message("sm.test.runner.magnitude.running.failed.title")),
    TERMINATED_INDEX(4, 6, SMTestsRunnerBundle.message("sm.test.runner.magnitude.terminated.failed.title")),
    IGNORED_INDEX(5, 2, SMTestsRunnerBundle.message("sm.test.runner.magnitude.ignored.failed.title")),
    FAILED_INDEX(6, 4, SMTestsRunnerBundle.message("sm.test.runner.magnitude.assertion.failed.title")),
    ERROR_INDEX(8, 5, SMTestsRunnerBundle.message("sm.test.runner.magnitude.testerror.title")),
    PASSED_INDEX(COMPLETE_INDEX.getValue(), COMPLETE_INDEX.getSortWeitht(), SMTestsRunnerBundle.message("sm.test.runner.magnitude.passed.title"));

    private final int myValue;
    private final int mySortWeitht;
    private final String myTitle;

    /**
     * @param value Some magic parameter from legal
     * @param sortWeitht Weight for sort comparator
     * @param title Title
     */
    Magnitude(final int value, final int sortWeitht, final String title) {
      myValue = value;
      myTitle = title;
      mySortWeitht = sortWeitht;
    }

    public int getValue() {
      return myValue;
    }

    public String getTitle() {
      return myTitle;
    }

    public int getSortWeitht() {
      return mySortWeitht;
    }
  }
}


text:
package com.dremio.exec.store.parquet;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.junit.Ignore;
import org.junit.Test;

import com.dremio.BaseTestQuery;
import com.dremio.common.exceptions.UserException;
import com.dremio.common.exceptions.UserRemoteException;

public class TestParquetGroupScan extends BaseTestQuery {

  private void prepareTables(final String tableName, boolean refreshMetadata) throws Exception {
    // first create some parquet subfolders
    testNoResult("CREATE TABLE dfs_test.\"%s\"      AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 1", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/501\"  AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 2", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/502\"  AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 4", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/503\"  AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 8", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/504\"  AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 16", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/505\"  AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 32", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/60\"   AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 64", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/602\"  AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 128", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/6031\" AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 256", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/6032\" AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 512", tableName);
    testNoResult("CREATE TABLE dfs_test.\"%s/6033\" AS SELECT employee_id FROM cp.\"employee.json\" LIMIT 1024", tableName);

    // we need an empty subfolder `4376/20160401`
    // to do this we first create a table inside that subfolder
    testNoResult("CREATE TABLE dfs_test.\"%s/6041/a\" AS SELECT * FROM cp.\"employee.json\" LIMIT 1", tableName);
    // then we delete the table, leaving the parent subfolder empty
    testNoResult("DROP TABLE   dfs_test.\"%s/6041/a\"", tableName);

    if (refreshMetadata) {
      // build the metadata cache file
      testNoResult("REFRESH TABLE METADATA dfs_test.\"%s\"", tableName);
    }
  }

  @Test
  @Ignore("DX-2487")
  public void testFix4376() throws Exception {
    prepareTables("4376_1", true);

    testBuilder()
      .sqlQuery("SELECT COUNT(*) AS \"count\" FROM dfs_test.\"4376_1/60*\"")
      .ordered()
      .baselineColumns("count").baselineValues(1984L)
      .go();
  }

  @Test
  @Ignore("empty table")
  public void testWildCardEmptyWithCache() throws Exception {
    prepareTables("4376_2", true);

    try {
      runSQL("SELECT COUNT(*) AS \"count\" FROM dfs_test.\"4376_2/604*\"");
      fail("Query should've failed!");
    } catch (UserRemoteException uex) {
      final String expectedMsg = "The table you tried to query is empty";
      assertTrue(String.format("Error message should contain \"%s\" but was instead \"%s\"", expectedMsg,
        uex.getMessage()), uex.getMessage().contains(expectedMsg));
    }
  }

  @Test
  public void testWildCardEmptyNoCache() throws Exception {
    prepareTables("4376_3", false);

    try {
      runSQL("SELECT COUNT(*) AS \"count\" FROM dfs_test.\"4376_3/604*\"");
      fail("Query should've failed!");
    } catch (UserRemoteException uex) {
      final String expectedMsg = "Object '4376_3/604*' not found within 'dfs_test'";
      assertTrue(String.format("Error message should contain \"%s\" but was instead \"%s\"", expectedMsg,
        uex.getMessage()), uex.getMessage().contains(expectedMsg));
    }
  }

  @Test
  @Ignore("empty table")
  public void testSelectEmptyWithCache() throws Exception {
    prepareTables("4376_4", true);

    try {
      runSQL("SELECT COUNT(*) AS \"count\" FROM dfs_test.\"4376_4/6041\"");
      fail("Query should've failed!");
    } catch (UserRemoteException uex) {
      final String expectedMsg = "The table you tried to query is empty";
      assertTrue(String.format("Error message should contain \"%s\" but was instead \"%s\"", expectedMsg,
        uex.getMessage()), uex.getMessage().contains(expectedMsg));
    }
  }

  @Test
  public void testSelectEmptyNoCache() throws Exception {
    prepareTables("4376_5", false);
    try {
      runSQL("SELECT COUNT(*) AS \"count\" FROM dfs_test.\"4376_5/6041\"");
      fail("Query should've failed!");
    } catch (UserRemoteException uex) {
      final String expectedMsg = "VALIDATION ERROR: Object 'dfs_test' not found";
      assertTrue(String.format("Error message should contain \"%s\" but was instead \"%s\"", expectedMsg,
        uex.getMessage()), uex.getMessage().contains(expectedMsg));
    }
  }

  @Test
  public void partitionColumnNotPresentInAllFiles() throws Exception {
    // Test data
    // dx-11829/1_0_0.parquet - contains "dt", "field"
    // dx-11829/1_0_1.parquet - contains       "field"

    final String query = "SELECT * FROM dfs.\"[WORKING_PATH]/src/test/resources/parquet/dx-11829\"";

    // run the query once to for schema learning purposes. As one of the files doesn't contain column "dt", schema
    // sampling could pick up that file and make the original table schema only "field", "dir0"
    try {
      test(query);
    } catch (UserException ex) {
      // ignore as the expected error is schema change error
    }

    testBuilder()
        .sqlQuery(query)
        .unOrdered()
        .baselineColumns("dt", "field", "dir0")
        .baselineValues(null, "f", "dt")
        .baselineValues("value", "f", "dt")
        .go();
  }
}


text:
<?php

namespace Chrisbjr\SmsBlaster\Sdk\Interfaces;

use Chrisbjr\SmsBlaster\Sdk\Sms;
use Exception;

interface SmsInterface
{

    /**
     * This is called when the SMS being sent is invalid. Use this
     * method to invalidate the SMS. Attempting to send this SMS
     * again is futile.
     *
     * @param Exception $exception
     * @return mixed
     */
    public function onInvalid(Exception $exception);

    /**
     * This method is called when a server exception is encountered.
     * This means that the SMS should be marked as pending and sending
     * should be retried.
     *
     * @param Exception $exception
     * @return mixed
     */
    public function onError(Exception $exception);

    /**
     * Called when everything goes well.
     *
     * @param Sms $sms
     * @return mixed
     */
    public function onSuccess(Sms $sms);

}


text:
<!doctype html>
<html lang="en">
  <head>
    <title>My First Admin</title>
    <style type="text/css">
    {{{css}}}
    </style>
  </head>
  <body ng-app="myApp">
    <div ui-view></div>
    <script type="text/javascript">
    {{{js}}}

    {{#login.enabled}}
    var username = window.localStorage.getItem('{{projectname}}_admin_login');
    if (!username) {
        window.location.href = "./login.html";
    }
    function logout() {
        window.localStorage.removeItem('posters_galore_login');
        window.location.href = "./login.html";
    }
    {{/login.enabled}}

    var myApp = angular.module('myApp', ['ng-admin']);
    myApp.config(['NgAdminConfigurationProvider', function(NgAdminConfigurationProvider) {
        var nga = NgAdminConfigurationProvider;

        {{{jsconfig}}}

        nga.configure(admin);
    }]);
    </script>
  </body>
</html>


text:
import { AboutRoute } from './aboutRoute';
export { AboutRoute as About };


text:
module SwaggerYard
  # For now just a simple wrapper class for a Memcache client.
  class Cache

    attr_reader :prefix, :store

    def initialize(store, prefix)
      @store = store
      @prefix = prefix
    end

    # Read from the Cache.
    def [](resource_name)
      case
        when store.respond_to?(:read)
          store.read key_for(resource_name)
        when store.respond_to?(:[])
          store[key_for(resource_name)]
        when store.respond_to?(:get)
          store.get key_for(resource_name)
      end
    end

    # Write to the Cache.
    def []=(resource_name, value)
      case
        when store.respond_to?(:write)
          store.write key_for(resource_name), value
        when store.respond_to?(:[]=)
          store[key_for(resource_name)] = value
        when store.respond_to?(:set)
          store.set key_for(resource_name), value
      end
    end

    def fetch(resource_name)
      value = self[resource_name]
      if value.nil? && block_given?
        value = yield
        self[resource_name] = yield
      end
      value
    end

    # Cache key for a given entry.
    def key_for(resource_name)
      [prefix, resource_name].join
    end
  end
end


text:
<form action="/pip17/reset" method="post" class="form">

Delete saved answers

  <input type="submit" value="delete answers" />
</form>


text:
ACCEPTED

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

#### Published in
Trans. & Proc. Roy. Soc. S. Australia 79(3-4): 327 (1952)

#### Original name
Hypocrea hunua Dingley, 1952

### Remarks
null


text:
Pattern: Invalid package name

Issue: -

## Description

Package names should be all lowercase, with underscores to separate words,
`just_like_this`. Use only basic Latin letters and Arabic digits: [a-z0-9_].
Also, make sure the name is a valid Dart identifier -- that it doesn't start
with digits and isn't a reserved word.

## Further Reading

* [Linter for Dart - package_names](https://dart-lang.github.io/linter/lints/package_names.html)
* [Pubspec format description](https://www.dartlang.org/tools/pub/pubspec.html)


text:
@interface MoreImgViewCell : UITableViewCell

@property (weak, nonatomic) IBOutlet UILabel *titltLabel;

@property (weak, nonatomic) IBOutlet UILabel *replyCountLabel;

@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UIImageView *iconView2;
@property (weak, nonatomic) IBOutlet UIImageView *iconView3;

@end


text:
int main(int argc, char* argv[]) {
    using namespace boost::dll;

    boost::dll::fs::path shared_library_path = b2_workarounds::first_lib_from_argv(argc, argv);
    BOOST_TEST(shared_library_path.string().find("test_library") != std::string::npos);
    BOOST_TEST(b2_workarounds::is_shared_library(shared_library_path));
    boost::dll::fs::path bad_path = shared_library_path / "directory_that_does_not_exist";

    try {
        shared_library lib(bad_path);
        BOOST_TEST(false);
    } catch (const boost::dll::fs::system_error& e) {
        std::cout << e.what() << '\n';
    }

    try {
        shared_library lib;
        lib.get<int>("variable_or_function_that_does_not_exist");
        BOOST_TEST(false);
    } catch (const boost::dll::fs::system_error& e) {
        std::cout << e.what() << '\n';
    }

    try {
        shared_library lib("");
        BOOST_TEST(false);
    } catch (const boost::dll::fs::system_error& e) {
        std::cout << e.what() << '\n';
    }

    try {
        shared_library lib("\0\0");
        BOOST_TEST(false);
    } catch (const boost::dll::fs::system_error& e) {
        std::cout << e.what() << '\n';
    }

    try {
        shared_library lib;
        lib.location();
        BOOST_TEST(false);
    } catch (const boost::dll::fs::system_error& e) {
        std::cout << e.what() << '\n';
    }

    try {
        shared_library lib;
        lib.load("\0\0", load_mode::rtld_global);
        BOOST_TEST(false);
    } catch (const boost::dll::fs::system_error& e) {
        std::cout << e.what() << '\n';
    }

    shared_library sl(shared_library_path);
    try {
        sl.get<int>("variable_or_function_that_does_not_exist");
        BOOST_TEST(false);
    } catch (const boost::dll::fs::system_error& e) {
        std::cout << e.what() << '\n';
    }

    try {
        library_info lib("\0");
        BOOST_TEST(false);
    } catch (const std::exception& e) {
        std::cout << e.what() << '\n';
    }

    try {
        std::string not_a_binary(argv[1]);
        not_a_binary += "/not_a_binary";
        std::ofstream ofs(not_a_binary.c_str());
        ofs << "This is not a binary file, so library_info must report 'Unsupported binary format'";
        ofs.close();
        library_info lib(not_a_binary);
        BOOST_TEST(false);
    } catch (const std::exception& e) {
        std::cout << e.what() << '\n';
    }
    return boost::report_errors();
}


text:
<?php

/**
 * BaseaBlogCategoryUser
 *
 * This class has been auto-generated by the Doctrine ORM Framework
 *
 * @property integer $blog_category_id
 * @property integer $user_id
 * @property aBlogCategory $BlogCategory
 * @property sfGuardUser $User
 *
 * @method integer           getBlogCategoryId()   Returns the current record's "blog_category_id" value
 * @method integer           getUserId()           Returns the current record's "user_id" value
 * @method aBlogCategory     getBlogCategory()     Returns the current record's "BlogCategory" value
 * @method sfGuardUser       getUser()             Returns the current record's "User" value
 * @method aBlogCategoryUser setBlogCategoryId()   Sets the current record's "blog_category_id" value
 * @method aBlogCategoryUser setUserId()           Sets the current record's "user_id" value
 * @method aBlogCategoryUser setBlogCategory()     Sets the current record's "BlogCategory" value
 * @method aBlogCategoryUser setUser()             Sets the current record's "User" value
 *
 * @package    symfony
 * @subpackage model
 * @author     Your name here
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class BaseaBlogCategoryUser extends sfDoctrineRecord
{
    public function setTableDefinition()
    {
        $this->setTableName('a_blog_category_user');
        $this->hasColumn('blog_category_id', 'integer', 4, array(
             'type' => 'integer',
             'primary' => true,
             'length' => 4,
             ));
        $this->hasColumn('user_id', 'integer', 4, array(
             'type' => 'integer',
             'primary' => true,
             'length' => 4,
             ));

        $this->option('type', 'INNODB');
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasOne('aBlogCategory as BlogCategory', array(
             'local' => 'blog_category_id',
             'foreign' => 'id',
             'onDelete' => 'CASCADE'));

        $this->hasOne('sfGuardUser as User', array(
             'local' => 'user_id',
             'foreign' => 'id',
             'onDelete' => 'CASCADE'));
    }
}


text:
<?php

namespace Sunlight\Util;

/**
 * Regexp helper
 */
abstract class Regexp
{
    /**
     * Replace substrings using a regular expression
     *
     * Advantages over preg_replace() and preg_replace_callback():
     *
     *      - supports initial offset
     *      - tracks offset and passes it to the callback
     *
     * Structure of the matches array passed to the callback:
     *
     *      array(
     *          0 => array('complete match', offset),
     *          1 => array('matching group 1', offset),
     *          ...
     *      )
     *
     * @param string   $pattern  regexp pattern to search for
     * @param string   $subject  string to search in
     * @param callback $callback replacement callback(array matches, int offset): string
     * @param int      $limit    maximum number of replacements, -1 = unlimited
     * @param int      $offset   initial matching offset
     * @param int|null &$count   variable to store the number of replacements into
     * @return string|bool false on failure
     */
    static function replace(string $pattern, string $subject, callable $callback, int $limit = -1, int $offset = 0, ?int &$count = null)
    {
        $count = 0;
        $matches = null;
        $output = '';

        // add initial offset part to the output
        if ($offset > 0) {
            $output .= substr($subject, 0, $offset);
        }

        // match the subject
        while (
            ($limit === -1 || $count < $limit)
            && ($result = preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, $offset)) !== 0
        ) {
            // evaluate the result
            if ($result === false) {
                return false;
            }
            if ($result !== 1) {
                break;
            }

            // increment match counter
            ++$count;

            // append data between matches to the output
            if ($matches[0][1] > $offset) {
                $output .= substr($subject, $offset, $matches[0][1] - $offset);
            }

            // invoke the callback
            $output .= $callback($matches, $matches[0][1]);

            // calculate new offset
            $offset = $matches[0][1] + strlen($matches[0][0]);
        }

        // handle no matches
        if ($offset === 0) {
            return $subject;
        }

        // append rest of the subject
        if ($offset < strlen($subject)) {
            $output .= substr($subject, $offset);
        }

        return $output;
    }
}


text:
chrome.browserAction.onClicked.addListener(function(activeTab){
	var newURL = "https://asamaru7.github.io/SpriteImageGenerator/";
	chrome.tabs.create({ url: newURL });
});


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Navbar, Nav, NavItem, MenuItem, Pagination, FormControl, Button, NavDropdown, DropdownButton } from 'react-bootstrap';
import styles from '../../../../main.css';
import { setCurrentPage, fetchDistricts, setCityId, setCityName } from '../../DistrictActions';
import { getCurrentPage, getDistricts, getCities, getCityName } from '../../DistrictReducer';

class DistrictNavBar extends Component {
  constructor(props) {
    super(props);
    this.state = {
    }
  }
  hanldePage = (eventKey) => {
    this.props.dispatch(setCurrentPage(eventKey - 1));
    if (this.props.cityId !== ' ') {
      this.props.dispatch(fetchDistricts(this.props.cityId, eventKey - 1));
    }
  };
  chooseCity = (city) => {
    this.props.dispatch(setCityName(city.name));
    this.props.dispatch(setCityId(city._id));
    this.props.dispatch(fetchDistricts(city._id, this.props.currentPage - 1))
  };
  render() {
    return (
      <Navbar className={styles.cointain}>
        <Nav>
          <NavItem componentClass="span" className={styles.navPageItem}>
            <Pagination
              bsSize="small"
              first
              last
              boundaryLinks
              activePage={this.props.currentPage}
              items={ (this.props.districts.length === 0) ? 1 : Math.ceil(this.props.districts.length / 10)}
              maxButtons={5}
              onSelect={this.hanldePage}
              bsClass={`pagination pagination-sm ${styles.pageInfo}`}
            />
          </NavItem>
        </Nav>
        <Nav>
          <DropdownButton title={this.props.cityName} id="basic-nav-dropdown" className={styles.navPageItem}>
            {
              this.props.cities.map((city, index) => (
                <MenuItem key={index} onClick={() => this.chooseCity(city)}>{city.name}</MenuItem>
              ))
            }
          </DropdownButton>
        </Nav>
        <Nav pullRight>
          <NavItem>
            <Button bsStyle="success" onClick={this.props.onCreateDistrict}>Tạo mới</Button>
          </NavItem>
        </Nav>
      </Navbar>
    );
  }
}

// Retrieve data from store as props
function mapStateToProps(state) {
  return {
    currentPage: getCurrentPage(state),
    districts: getDistricts(state),
    cities: getCities(state),
    cityName: getCityName(state),
  };
}

DistrictNavBar.propTypes = {
  dispatch: PropTypes.func.isRequired,
  onCreateDistrict: PropTypes.func.isRequired,
  currentPage: PropTypes.number.isRequired,
  districts: PropTypes.array.isRequired,
  cities: PropTypes.array.isRequired,
  cityName: PropTypes.string.isRequired,
};

DistrictNavBar.contextTypes = {
  router: PropTypes.object,
};

export default connect(mapStateToProps)(DistrictNavBar);


text:
#include "val/include/bsa_acs_val.h"
#include "val/include/val_interface.h"

#include "val/include/bsa_acs_pcie.h"
#include "val/include/bsa_acs_pe.h"

#define TEST_NUM   (ACS_PCIE_TEST_NUM_BASE + 36)
#define TEST_RULE  "PCI_IN_17"
#define TEST_DESC  "Check ARI forwarding enable rule      "

static
void
payload(void)
{

  uint32_t bdf;
  uint32_t pe_index;
  uint32_t tbl_index;
  uint32_t dp_type;
  uint32_t cap_base;
  uint32_t seg_num;
  uint32_t dev_num;
  uint32_t dev_bdf;
  uint32_t sec_bus;
  uint32_t sub_bus;
  uint32_t test_fails;
  uint32_t test_skip = 1;
  uint32_t reg_value;
  uint32_t status;

  pcie_device_bdf_table *bdf_tbl_ptr;

  pe_index = val_pe_get_index_mpid(val_pe_get_mpid());
  bdf_tbl_ptr = val_pcie_bdf_table_ptr();

  test_fails = 0;

  /* Check for all the function present in bdf table */
  for (tbl_index = 0; tbl_index < bdf_tbl_ptr->num_entries; tbl_index++)
  {
      bdf = bdf_tbl_ptr->device[tbl_index].bdf;
      dp_type = val_pcie_device_port_type(bdf);

      /* Check entry is Downstream port or RP */
      if ((dp_type == DP) || (dp_type == iEP_RP) || (dp_type == RP))
      {
          /* Read the secondary and subordinate bus number */
          val_pcie_read_cfg(bdf, TYPE1_PBN, &reg_value);
          sec_bus = ((reg_value >> SECBN_SHIFT) & SECBN_MASK);
          sub_bus = ((reg_value >> SUBBN_SHIFT) & SUBBN_MASK);
          status = val_pcie_data_link_layer_status(bdf);

          /* Skip the port, if switch is present below it or no device present*/
          if ((sec_bus != sub_bus) || (status == PCIE_DLL_LINK_STATUS_NOT_ACTIVE))
              continue;

          if (status == PCIE_DLL_LINK_ACTIVE_NOT_SUPPORTED)
          {
              seg_num = PCIE_EXTRACT_BDF_SEG(bdf);
              dev_bdf = PCIE_CREATE_BDF(seg_num, sec_bus, 0, 0);
              status = val_pcie_read_cfg(dev_bdf, TYPE01_VIDR, &reg_value);
              if (status || (reg_value == PCIE_UNKNOWN_RESPONSE))
                  continue;
          }

          /* Disable the ARI forwarding enable bit */
          if (val_pcie_find_capability(bdf, PCIE_CAP, CID_PCIECS, &cap_base) != PCIE_SUCCESS) {
              val_print(ACS_PRINT_INFO, "PCIe Express Capability not present ", 0);
              continue;
          }

          val_pcie_read_cfg(bdf, cap_base + DCTL2R_OFFSET, &reg_value);
          reg_value &= DCTL2R_AFE_NORMAL;
          val_pcie_write_cfg(bdf, cap_base + DCTL2R_OFFSET, reg_value);

          /* If test runs for atleast an endpoint */
          test_skip = 0;

          seg_num = PCIE_EXTRACT_BDF_SEG(bdf);
          dev_bdf = PCIE_CREATE_BDF(seg_num, sec_bus, 0, 0);
          status = val_pcie_read_cfg(dev_bdf, TYPE01_VIDR, &reg_value);
          if (status || (reg_value == PCIE_UNKNOWN_RESPONSE))
          {
              test_fails++;
              val_print(ACS_PRINT_ERR, "\n    Dev 0x%x found under", dev_bdf);
              val_print(ACS_PRINT_ERR, " RP bdf 0x%x", bdf);
          }

          /* Configuration Requests specifying Device Numbers (1-31) must be terminated by the
           * Downstream Port or the Root Port with an Unsupported Request Completion Status
           */
          for (dev_num = 1; dev_num < PCIE_MAX_DEV; dev_num++)
          {

              /* Create bdf for Dev 1 to 31 below the RP */
              dev_bdf = PCIE_CREATE_BDF(seg_num, sec_bus, dev_num, 0);
              val_pcie_read_cfg(dev_bdf, TYPE01_VIDR, &reg_value);
              if (reg_value != PCIE_UNKNOWN_RESPONSE)
              {
                  test_fails++;
                  val_print(ACS_PRINT_ERR, "\n    Dev 0x%x found under", dev_bdf);
                  val_print(ACS_PRINT_ERR, " RP bdf 0x%x", bdf);
              }
          }
      }
  }

  if (test_skip == 1)
      val_set_status(pe_index, RESULT_SKIP(TEST_NUM, 1));
  else if (test_fails)
      val_set_status(pe_index, RESULT_FAIL(TEST_NUM, test_fails));
  else
      val_set_status(pe_index, RESULT_PASS(TEST_NUM, 1));
}

uint32_t
os_p036_entry(uint32_t num_pe)
{

  uint32_t status = ACS_STATUS_FAIL;

  num_pe = 1;  //This test is run on single processor

  status = val_initialize_test(TEST_NUM, TEST_DESC, num_pe);
  if (status != ACS_STATUS_SKIP)
      val_run_test_payload(TEST_NUM, num_pe, payload, 0);

  /* get the result from all PE and check for failure */
  status = val_check_for_error(TEST_NUM, num_pe, TEST_RULE);

  val_report_status(0, BSA_ACS_END(TEST_NUM), NULL);

  return status;
}


text:
class ConfigController {
	constructor($http, $stateParams, $interval, myConfig, AppService) {
		"ngInject";
		this.name = 'device';
		this.$http = $http;
		this.service = AppService;
		this.$stateParams = $stateParams;
		this.apiendpoint = myConfig.ApiEndpoint;
		this.urlDownloadConfig = this.apiendpoint + "/org/"+$stateParams.orgid+"/download/" + $stateParams.projectid;

		let _this = this;
		this.service.getOrgDetail($stateParams.orgid).then(data => this.orgDetail = data);
		this.service.getProjectDetail($stateParams.orgid, $stateParams.projectid).then(data => {
			this.projectDetail = data
			this.repository = data.repository;
			this.port = data.port;
			this.getEnv($stateParams.orgid, $stateParams.projectid);
		});

		this.getEnv = function(oid, pid) {
			this.listEnv(oid, pid).then(data => this.envList = data);
		}

	    //JavaScript called at HTML
	    $(document).ready(function(){
	    	$('[data-toggle="popover"]').popover();
	    });

	    $(document).on('click', function (e) {
	    	$('[data-toggle="popover"],[data-original-title]').each(function () {
	    		if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
	    			(($(this).popover('hide').data('bs.popover')||{}).inState||{}).click = false
	    		}
	    	});
	    });
	}

	listEnv(orgId, projectId) {
		return this.$http.get(this.apiendpoint + "/org/"+orgId+"/project/"+projectId+"/env")
		.then(response => response.data);
	}

	addEnv(key, value) {
		let _this = this;
		var config = {
			headers: {'Content-Type': 'application/x-www-form-urlencoded'}
		}
		var data = {projectId: parseInt(_this.$stateParams.projectid), key: this.keyenv , value: this.valenv};
		this.$http.post(this.apiendpoint + "/org/"+_this.$stateParams.orgid+"/project/"+_this.$stateParams.projectid+"/env?apikey="+_this.projectDetail.apiKey, data, config)
		.then(function (response) {
			if (response.status == 201) {
				_this.getEnv(_this.$stateParams.orgid, _this.$stateParams.projectid);

				$("input[name='keyenv']").val('');
				$("input[name='valenv']").val('');
			}
		});
	}

	deleteEnv(id, name) {
		let _this = this;
		var config = {
			headers: {'Content-Type': 'application/x-www-form-urlencoded'}
		}

		var r = confirm("Are you sure you want to delete " + name + "?");
		if (r == true) {
			var data = {id: parseInt(id)};
			this.$http.post(this.apiendpoint + "/deleteenv/"+ _this.$stateParams.projectid+"?apikey="+_this.projectDetail.apiKey, data, config)
			.then(function (response) {
				if (response.status == 200) {
					_this.getEnv(_this.$stateParams.orgid, _this.$stateParams.projectid);
				}
			});
		}
	}

	editEnv(id, name, value) {
		this.eid = id;
		this.ename = name;
		this.evalue = value;

		$("#editEnvModal").modal("show");
	}

	editEnvSave() {
		let _this = this;
		var config = {
			headers: {'Content-Type': 'application/x-www-form-urlencoded'}
		}
		var data = {id: parseInt(this.eid), value: this.evalue};
		this.$http.post(this.apiendpoint + "/updateenv/"+_this.$stateParams.projectid+"?apikey="+_this.projectDetail.apiKey, data, config)
		.then(function (response) {
			if (response.status == 200) {
				_this.getEnv(_this.$stateParams.orgid, _this.$stateParams.projectid);

				$("#editEnvModal").modal("hide");
			}
		});
	}

	shortString(str, number) {
		return str ? str.substring(0, number) : '';
	};

	updateProjectApp() {
		let _this = this;
		var config = {
			headers: {'Content-Type': 'application/x-www-form-urlencoded'}
		}

		var data = {Id: parseInt(_this.$stateParams.projectid),orgId: parseInt(_this.$stateParams.orgid),repository: this.repository, port: this.port};
		this.$http.post(this.apiendpoint + "/org/"+_this.$stateParams.orgid+"/updateprojectapp", data, config)
		.then(function (response) {
			if (response.status == 200) {
	    		//Calling update for all devices running on this project.
	    		console.log("Ok");
	    		$("#saveSuccess").css("display","block");
	    	} else {
	    		$("#saveFail").css("display","block");
	    	}
	    });
	}
}

export default ConfigController;


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
            http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">

    <display-name>dubbo-server</display-name>
    <welcome-file-list>
        <welcome-file>index</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>
            org.springframework.web.util.Log4jConfigListener
        </listener-class>
    </listener>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring.xml</param-value>
    </context-param>
    <context-param>
        <param-name> log4jConfigLocation</param-name>
        <param-value>classpath:log4j.properties</param-value>
    </context-param>
    <context-param>
        <param-name>log4jRefreshInterval</param-name>
        <param-value>6000</param-value>
    </context-param>

</web-app>


text:
<?php

namespace Symfony\Bundle\FrameworkBundle\Command;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Routing\RouterInterface;

/**
 * A console command for retrieving information about routes
 *
 * @author Fabien Potencier <fabien@symfony.com>
 * @author Tobias Schultze <http://tobion.de>
 */
class RouterDebugCommand extends ContainerAwareCommand
{
    /**
     * {@inheritdoc}
     */
    public function isEnabled()
    {
        if (!$this->getContainer()->has('router')) {
            return false;
        }
        $router = $this->getContainer()->get('router');
        if (!$router instanceof RouterInterface) {
            return false;
        }

        return parent::isEnabled();
    }

    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('router:debug')
            ->setDefinition(array(
                new InputArgument('name', InputArgument::OPTIONAL, 'A route name'),
            ))
            ->setDescription('Displays current routes for an application')
            ->setHelp(<<<EOF
The <info>%command.name%</info> displays the configured routes:

  <info>php %command.full_name%</info>
EOF
            )
        ;
    }

    /**
     * {@inheritdoc}
     *
     * @throws \InvalidArgumentException When route does not exist
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $name = $input->getArgument('name');

        if ($name) {
            $this->outputRoute($output, $name);
        } else {
            $this->outputRoutes($output);
        }
    }

    protected function outputRoutes(OutputInterface $output, $routes = null)
    {
        if (null === $routes) {
            $routes = $this->getContainer()->get('router')->getRouteCollection()->all();
        }

        $output->writeln($this->getHelper('formatter')->formatSection('router', 'Current routes'));

        $maxName = strlen('name');
        $maxMethod = strlen('method');
        $maxScheme = strlen('scheme');
        $maxHost = strlen('host');

        foreach ($routes as $name => $route) {
            $method = $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY';
            $scheme = $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY';
            $host = '' !== $route->getHost() ? $route->getHost() : 'ANY';
            $maxName = max($maxName, strlen($name));
            $maxMethod = max($maxMethod, strlen($method));
            $maxScheme = max($maxScheme, strlen($scheme));
            $maxHost = max($maxHost, strlen($host));
        }

        $format  = '%-'.$maxName.'s %-'.$maxMethod.'s %-'.$maxScheme.'s %-'.$maxHost.'s %s';
        $formatHeader  = '%-'.($maxName + 19).'s %-'.($maxMethod + 19).'s %-'.($maxScheme + 19).'s %-'.($maxHost + 19).'s %s';
        $output->writeln(sprintf($formatHeader, '<comment>Name</comment>', '<comment>Method</comment>',  '<comment>Scheme</comment>', '<comment>Host</comment>', '<comment>Path</comment>'));

        foreach ($routes as $name => $route) {
            $method = $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY';
            $scheme = $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY';
            $host = '' !== $route->getHost() ? $route->getHost() : 'ANY';
            $output->writeln(sprintf($format, $name, $method, $scheme, $host, $route->getPath()), OutputInterface::OUTPUT_RAW);
        }
    }

    /**
     * @throws \InvalidArgumentException When route does not exist
     */
    protected function outputRoute(OutputInterface $output, $name)
    {
        $route = $this->getContainer()->get('router')->getRouteCollection()->get($name);
        if (!$route) {
            throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
        }

        $output->writeln($this->getHelper('formatter')->formatSection('router', sprintf('Route "%s"', $name)));

        $method = $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY';
        $scheme = $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY';
        $host = '' !== $route->getHost() ? $route->getHost() : 'ANY';

        $output->write('<comment>Name</comment>         ');
        $output->writeln($name, OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Path</comment>         ');
        $output->writeln($route->getPath(), OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Host</comment>         ');
        $output->writeln($host, OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Scheme</comment>       ');
        $output->writeln($scheme, OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Method</comment>       ');
        $output->writeln($method, OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Class</comment>        ');
        $output->writeln(get_class($route), OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Defaults</comment>     ');
        $output->writeln($this->formatConfigs($route->getDefaults()), OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Requirements</comment> ');
        // we do not want to show the schemes and methods again that are also in the requirements for BC
        $requirements = $route->getRequirements();
        unset($requirements['_scheme'], $requirements['_method']);
        $output->writeln($this->formatConfigs($requirements) ?: 'NO CUSTOM', OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Options</comment>      ');
        $output->writeln($this->formatConfigs($route->getOptions()), OutputInterface::OUTPUT_RAW);

        $output->write('<comment>Path-Regex</comment>   ');
        $output->writeln($route->compile()->getRegex(), OutputInterface::OUTPUT_RAW);

        if (null !== $route->compile()->getHostRegex()) {
            $output->write('<comment>Host-Regex</comment>   ');
            $output->writeln($route->compile()->getHostRegex(), OutputInterface::OUTPUT_RAW);
        }
    }

    protected function formatValue($value)
    {
        if (is_object($value)) {
            return sprintf('object(%s)', get_class($value));
        }

        if (is_string($value)) {
            return $value;
        }

        return preg_replace("/\n\s*/s", '', var_export($value, true));
    }

    private function formatConfigs(array $array)
    {
        $string = '';
        ksort($array);
        foreach ($array as $name => $value) {
            $string .= ($string ? "\n".str_repeat(' ', 13) : '').$name.': '.$this->formatValue($value);
        }

        return $string;
    }
}


text:
package pkcs11

import (
	"fmt"
	"github.com/pkg/errors"
	pkcs11uri "github.com/stefanberger/go-pkcs11uri"
	"gopkg.in/yaml.v2"
)

// Pkcs11KeyFile describes the format of the pkcs11 (private) key file.
// It also carries pkcs11 module related environment variables that are transferred to the
// Pkcs11URI object and activated when the pkcs11 module is used.
type Pkcs11KeyFile struct {
	Pkcs11 struct {
		Uri string `yaml:"uri"`
	} `yaml:"pkcs11"`
	Module struct {
		Env map[string]string `yaml:"env,omitempty"`
	} `yaml:"module"`
}

// Pkcs11KeyFileObject is a representation of the Pkcs11KeyFile with the pkcs11 URI as an object
type Pkcs11KeyFileObject struct {
	Uri *pkcs11uri.Pkcs11URI
}

// ParsePkcs11Uri parses a pkcs11 URI
func ParsePkcs11Uri(uri string) (*pkcs11uri.Pkcs11URI, error) {
	p11uri := pkcs11uri.New()
	err := p11uri.Parse(uri)
	if err != nil {
		return nil, errors.Wrapf(err, "Could not parse Pkcs11URI from file")
	}
	return p11uri, err
}

// ParsePkcs11KeyFile parses a pkcs11 key file holding a pkcs11 URI describing a private key.
// The file has the following yaml format:
// pkcs11:
//  - uri : <pkcs11 uri>
// An error is returned if the pkcs11 URI is malformed
func ParsePkcs11KeyFile(yamlstr []byte) (*Pkcs11KeyFileObject, error) {
	p11keyfile := Pkcs11KeyFile{}

	err := yaml.Unmarshal([]byte(yamlstr), &p11keyfile)
	if err != nil {
		return nil, errors.Wrapf(err, "Could not unmarshal pkcs11 keyfile")
	}

	p11uri, err := ParsePkcs11Uri(p11keyfile.Pkcs11.Uri)
	if err != nil {
		return nil, err
	}
	p11uri.SetEnvMap(p11keyfile.Module.Env)

	return &Pkcs11KeyFileObject{Uri: p11uri}, err
}

// IsPkcs11PrivateKey checks whether the given YAML represents a Pkcs11 private key
func IsPkcs11PrivateKey(yamlstr []byte) bool {
	_, err := ParsePkcs11KeyFile(yamlstr)
	return err == nil
}

// IsPkcs11PublicKey checks whether the given YAML represents a Pkcs11 public key
func IsPkcs11PublicKey(yamlstr []byte) bool {
	_, err := ParsePkcs11KeyFile(yamlstr)
	return err == nil
}

// Pkcs11Config describes the layout of a pkcs11 config file
// The file has the following yaml format:
// module-directories:
// - /usr/lib64/pkcs11/
// allowd-module-paths
// - /usr/lib64/pkcs11/libsofthsm2.so
type Pkcs11Config struct {
	ModuleDirectories  []string `yaml:"module-directories"`
	AllowedModulePaths []string `yaml:"allowed-module-paths"`
}

// GetDefaultModuleDirectories returns module directories covering
// a variety of Linux distros
func GetDefaultModuleDirectories() []string {
	dirs := []string{
		"/usr/lib64/pkcs11/", // Fedora,RHEL,openSUSE
		"/usr/lib/pkcs11/",   // Fedora,ArchLinux
		"/usr/local/lib/pkcs11/",
		"/usr/lib/softhsm/", // Debian,Ubuntu
	}

	// Debian directory: /usr/lib/(x86_64|aarch64|arm|powerpc64le|s390x)-linux-gnu/
	hosttype, ostype, q := getHostAndOsType()
	if len(hosttype) > 0 {
		dir := fmt.Sprintf("/usr/lib/%s-%s-%s/", hosttype, ostype, q)
		dirs = append(dirs, dir)
	}
	return dirs
}

// GetDefaultModuleDirectoresFormatted returns the default module directories formatted for YAML
func GetDefaultModuleDirectoriesYaml(indent string) string {
	res := ""

	for _, dir := range GetDefaultModuleDirectories() {
		res += indent + "- " + dir + "\n"
	}
	return res
}

// ParsePkcs11ConfigFile parses a pkcs11 config file hat influences the module search behavior
// as well as the set of modules that users are allowed to use
func ParsePkcs11ConfigFile(yamlstr []byte) (*Pkcs11Config, error) {
	p11conf := Pkcs11Config{}

	err := yaml.Unmarshal([]byte(yamlstr), &p11conf)
	if err != nil {
		return &p11conf, errors.Wrapf(err, "Could not parse Pkcs11Config")
	}
	return &p11conf, nil
}


text:
<?php

namespace Drupal\user\Plugin\views\argument_default;

use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;

/**
 * Default argument plugin to extract the current user
 *
 * This plugin actually has no options so it does not need to do a great deal.
 *
 * @ViewsArgumentDefault(
 *   id = "current_user",
 *   title = @Translation("User ID from logged in user")
 * )
 */
class CurrentUser extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {

  /**
   * {@inheritdoc}
   */
  public function getArgument() {
    return \Drupal::currentUser()->id();
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return Cache::PERMANENT;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return ['user'];
  }

}


text:
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import olympia.amo.models

class Migration(migrations.Migration):

    dependencies = [
        ('activity', '0007_auto_20210114_1347'),
    ]

    operations = [
        migrations.CreateModel(
            name='IPLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('ip_address', models.CharField(max_length=45)),
                ('activity_log', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='activity.ActivityLog')),
            ],
            options={
                'db_table': 'log_activity_ip',
                'ordering': ('-created',),
            },
            bases=(olympia.amo.models.SaveUpdateMixin, models.Model),
        ),
    ]