text:
class Utils
  def self.beekeeper_patched_init
    @shell_flags ||= shell_flags
  rescue LoadError => le
    puts 'Failed to detect and/or initialize shell'
    puts "\tUsually this means the shell is not supported"
    puts "\tError Message: #{le.message}"
    exit 1
  end

  def self.shell_flags
    shell = "shell_#{`echo $SHELL`.split(File::SEPARATOR)[-1].chomp}".to_sym
    shell_flags = { shell_bash: false, shell_zsh: false }
    fail "unsupported #{shell}" unless shell_flags.key?(shell)
    shell_flags[shell] = true
    shell_flags
  end
end

# call this when loading to ensure that everything else works as expected
Utils.beekeeper_patched_init


text:
class StackExists(Exception):
    pass

redpajama_set_name: RedPajamaGithub


text:
<?php declare(strict_types=1);

namespace Star\Component\DomainEvent\Ports\Symfony\DependencyInjection;

use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use RuntimeException;
use Star\Component\DomainEvent\Messaging\Command;
use Star\Component\DomainEvent\Messaging\CommandBus;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

final class CommandBusPassTest extends TestCase
{
    public function test_it_should_dispatch_command(): void
    {
        $builder = new ContainerBuilder();
        $builder->register(CommandController::class, CommandController::class)
            ->addArgument(new Reference('star.command_bus'))
            ->setPublic(true);
        $builder
            ->register('my_handler', DoStuffHandler::class)
            ->addTag('star.command_handler')
        ;
        $builder->addCompilerPass(new CommandBusPass());
        $builder->compile();

        /**
         * @var CommandController $controller
         */
        $controller = $builder->get(CommandController::class);

        $this->expectException(\RuntimeException::class);
        $this->expectExceptionMessage('Command: ' . DoStuff::class);

        $controller->doStuff();
    }

    public function test_it_should_throw_exception_when_handler_is_missing_handler_suffix(): void
    {
        $builder = new ContainerBuilder();
        $builder->register(CommandController::class, CommandController::class)
            ->addArgument(new Reference('star.command_bus'))
            ->setPublic(true);
        $builder
            ->register('my_handler', MalformedThatThrowsException::class)
            ->addTag('star.command_handler')
        ;
        $builder->addCompilerPass(new CommandBusPass());

        $this->expectException(\InvalidArgumentException::class);
        $this->expectExceptionMessage(
            'The handler "' . MalformedThatThrowsException::class . '" must have a "Handler" suffix.'
        );

        $builder->compile();
    }

    public function test_it_should_throw_exception_when_message_is_not_a_valid_class(): void
    {
        $builder = new ContainerBuilder();
        $builder->register(CommandController::class, CommandController::class)
            ->addArgument(new Reference('star.command_bus'))
            ->setPublic(true);
        $builder
            ->register('my_handler', 'stdClassHandler')
            ->addTag('star.command_handler', ['message' => 'bad-command'])
        ;
        $builder->addCompilerPass(new CommandBusPass());

        $this->expectException(InvalidArgumentException::class);
        $this->expectExceptionMessage(
            'The command "bad-command" must be a class implementing interface "' . Command::class
        );
        $builder->compile();
    }

    public function test_it_should_allow_to_define_custom_path(): void
    {
        $command = new class implements Command {};
        $builder = new ContainerBuilder();
        $builder->register(CommandController::class, CommandController::class)
            ->addArgument(new Reference('star.command_bus'))
            ->setPublic(true);
        $builder
            ->register('my_handler', DoStuffHandler::class)
            ->addTag('star.command_handler', ['message' => \get_class($command)])
        ;
        $builder->addCompilerPass(new CommandBusPass());
        $builder->compile();

        /**
         * @var CommandController $controller
         */
        $controller = $builder->get(CommandController::class);

        $this->expectException(RuntimeException::class);
        $this->expectExceptionMessage('Command: ' . \get_class($command));
        $controller->dispatch($command);
    }
}

final class CommandController
{
    /**
     * @var CommandBus
     */
    private $bus;

    public function __construct(CommandBus $bus)
    {
        $this->bus = $bus;
    }

    public function doStuff(): void
    {
        $this->bus->dispatchCommand(new DoStuff());
    }

    public function dispatch(Command $command): void
    {
        $this->bus->dispatchCommand($command);
    }

    public function invokeMalformedHandler(): void
    {
        $this->bus->dispatchCommand(new MalformedThatThrowsException());
    }
}

final class DoStuff implements Command
{}
final class DoStuffHandler
{
    public function __invoke($command): void
    {
        throw new \RuntimeException('Command: ' . \get_class($command));
    }
}
final class MalformedThatThrowsException implements Command
{
    public function __invoke(MalformedThatThrowsException $command): void
    {
    }
}


text:
Fields
======

Documents declare their attributes using fields set as class attributes. The
name of a field maps straight to the name of a field of the underlying
resource. See `Mapping Fields`_ for a way to use a different field name for the
document and the resource.

Example

.. code-block:: python

    class Message(Document):
        id = fields.NumberField()
        name = fields.StringField()

Field Options
-------------

``optional``
~~~~~~~~~~~~

.. py:attribute:: Field.optional

When set to ``True``, This field can be optional and will be ignored if not set
to a value. Default is ``False``.

``default``
~~~~~~~~~~~

.. py:attribute:: Field.default

Specify a default value for this field. If no value is set by the user, the
default value is used when interacting with the backend.

``scaffold``
~~~~~~~~~~~~

.. py:attribute:: Fields.scaffold

Control whether to scaffold this field. Defaults to ``True``.

``render``
~~~~~~~~~~

.. py:attribute:: Fields.render

If set to ``False`` the field gets ignored when the document gets rendered.
Defaults to ``True``.

``read_only``
~~~~~~~~~~~~~

.. py:attribute:: Field.read_only

If set to ``True``, the field value will not be saved, whatever it is set to.
The responsible backend manager will not have the value available. Defaults to
``False``.

``inline``
~~~~~~~~~~

Normally ``ForeignDocuments`` and ``CollectionFields`` render as a reference
with a resource URI link and a relation attribute. When you specify the
``inline`` field option, you can force the field to render as an inline
element.

Example

.. code-block:: python

    class Doc1(Document):
        id = fields.NumberField()
        name = fields.StringField()

        def uri(self):
            return "http://example.org/doc/%s" % self.id

    class Doc2(Document):
        id = fields.NumberField()
        doc_inline = fields.ForeignDocument(Doc1, inline=True)
        doc1 = fields.ForeignDocument(Doc1)

    d = Doc2()
    d.fetch()
    d.render()
    {
        "id": 1,
        "doc1": {
            "id": 1,
            "rel": "related",
            "href": "http://example.org/doc/1/"
            },
        "doc_inline": {
            "id": 2,
            "name": "doc_inline"
            }
    }

``validate``
~~~~~~~~~~~~

Specify whether to validate the field or not. Defaults to ``True``. If
disabled, validation is skipped for this field.

``validators``
~~~~~~~~~~~~~~

You can add a list of functions that will be called when validating the field.
For details on those functions see the section about `Validation`_.

Example

.. code-block:: python

    def validate_name(value):
        # Do something

    class Article(Document):
        id = fields.NumberField()
        name = fields.StringField(validators=[validate_name])

Field Types
-----------

``NumberField``
~~~~~~~~~~~~~~~

.. py:class:: NumberField(**options)

``StringField``
~~~~~~~~~~~~~~~

.. py:class:: StringField(**options)

``BooleanField``
~~~~~~~~~~~~~~~~

.. py:class:: BooleanField(**options)

``StaticField``
~~~~~~~~~~~~~~~

.. py:class:: StaticField(**options)

``ForeignDocument``
~~~~~~~~~~~~~~~~~~~

.. py:class:: ForeignDocument(**options)

``CollectionField``
~~~~~~~~~~~~~~~~~~~

.. py:class:: CollectionField(**options)


text:
<?php
	require_once 'support/config.php';

	$po_master_id = $_GET['id'];

	$con->myQuery("UPDATE po_master SET is_void='1' WHERE po_master_id='$po_master_id'");

	$con->myQuery("UPDATE po_details SET is_void='1' WHERE po_master_id='$po_master_id'");

	Alert("PO".$po_master_id." was succesfully voided.","success");
	redirect("purchases.php");

?>


text:
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- vim:set ts=4 sw=4 sts=4 noet: */
#ifndef FLINT_UUID_GENERATOR_H_
#define FLINT_UUID_GENERATOR_H_

#include <boost/uuid/uuid.hpp>

namespace flint {

/*
 * Generate Version 5 (SHA1) name-based UUID with the namespace obtained
 * from CellML namespace URL.
 */
boost::uuids::uuid GenerateUuidForCellml(const char *name);

}

#endif


text:
static SensorFactoryBase* ourSensorFactory = nil;

@implementation SensorFactorySingleton

+(id<ISensorFactory>) getSensorFactoryInstance {
    if (ourSensorFactory == nil) {
        ourSensorFactory = [[SensorFactory alloc] init];
    }
    return ourSensorFactory;
}

@end


text:
define(['./alasqlavanza', './alasqlnordnet'], function(alasqlavanza, alasqlnordnet) {

    function getNordnetCourtageSumSell(year) {
        return alasqlnordnet.getCourtageSumSell(year);
    }

    function getNordnetCourtageSumBuy(year) {
        return alasqlnordnet.getCourtageSumBuy(year);
    }

    function getAvanzaCourtageSumSell(year) {
        return alasqlavanza.getCourtageSumSell(year);
    }

    function getAvanzaCourtageSumBuy(year) {
        return alasqlavanza.getCourtageSumBuy(year);
    }

    function getCourtageYears() {
        var nordnetYearData = alasqlnordnet.getCourtageYears();
        var avanzaYearData = alasqlavanza.getCourtageYears();
        var result = avanzaYearData.concat(nordnetYearData);

        return alasql('SELECT DISTINCT Year FROM ?', [result]);
    }

    return {
        getNordnetCourtageSumSell: getNordnetCourtageSumSell,
        getNordnetCourtageSumBuy: getNordnetCourtageSumBuy,
        getAvanzaCourtageSumSell: getAvanzaCourtageSumSell,
        getAvanzaCourtageSumBuy: getAvanzaCourtageSumBuy,
        getCourtageYears: getCourtageYears
    };
});