<commit_before><?php

namespace Aws;

use Aws\Api\Service;
use Aws\Api\Serializer\JsonRpcSerializer;
use Aws\Api\Serializer\QuerySerializer;
use Aws\Api\Serializer\RestJsonSerializer;
use Aws\Api\Parser\JsonRpcParser;
use Aws\Credentials\CredentialsInterface;
use Aws\Signature\SignatureV2;
use Aws\Signature\SignatureV4;
use Aws\Signature\SignatureInterface;
use Aws\Subscriber\Signature;
use GuzzleHttp\Client;
use GuzzleHttp\Command\AbstractClient;

/**
 * Default AWS client implementation
 */
class AwsClient extends AbstractClient implements AwsClientInterface
{
    const VERSION = '3.0.0-beta.1';

    /** @var CredentialsInterface AWS credentials */
    private $credentials;

    /** @var SignatureInterface Signature implementation of the service */
    private $signature;

    /** @var string */
    private $region;

    /** @var Service */
    private $api;

    /** @var string */
    private $endpoint;

    /**
     * The AwsClient constructor accepts the following constructor option:
     *
     * - api: (required) The Api object used to interact with a web service
     * - endpoint: (required) String representing the service endpoint
     * - credentials: (required) CredentialsInterface object used when signing.
     * - region: Region used to interact with the service
     * - client: Optional {@see GuzzleHttp\Client} used to send requests.
     * - signature: string representing the signature version to use (e.g., v4)
     *
     * @param array $config Configuration options
     * @throws \InvalidArgumentException if any required options are missing
     */
    public function __construct(array $config)
    {
        foreach (['api', 'endpoint', 'credentials'] as $required) {
            if (!isset($config[$required])) {
                throw new \InvalidArgumentException($required . ' is required');
            }
        }

        $this->api = $config['api'];
        $this->endpoint = $config['endpoint'];
        $this->credentials = $config['credentials'];
        $this->region = isset($config['region']) ? $config['region'] : null;
        $this->addSignature($config);

        // Remove settings from the config collection
        unset($config['api'], $config['credentials'], $config['signature'],
            $config['client']);

        parent::__construct($this->createClient($config), $config);

        $this->getHttpClient()->getEmitter()->attach(
            new Signature($this->credentials, $this->signature)
        );

        $this->addProtocol();
    }

    public function getCommand($name, array $args = [])
    {
        $command = null;
        if (isset($this->api['operations'][$name])) {
            $command = $this->api['operations'][$name];
        } else {
            $name = ucfirst($name);
            if (isset($this->api['operations'][$name])) {
                $command = $this->api['operations'][$name];
            }
        }

        if (!$command) {
            throw new \InvalidArgumentException("Operation not found: $name");
        }

        return new AwsCommand($name, $args, $this->api, clone $this->getEmitter());
    }

    public function __call($name, array $arguments)
    {
        if (substr($name, 0, 3) === 'get' && substr($name, -8) === 'Iterator') {
            // Allow magic method calls for iterators.
            // (e.g. $client->get<CommandName>Iterator($params))
            $commandOptions = isset($arguments[0]) ? $arguments[0] : null;
            $iteratorOptions = isset($arguments[1]) ? $arguments[1] : [];
            // @todo: Add iterators
        } elseif (substr($name, 0, 9) == 'waitUntil') {
            // Allow magic method calls for waiters.
            // (e.g. $client->waitUntil<WaiterName>($params))
            // @todo: Add waiters
        }

        return parent::__call($name, $arguments);
    }

    public function getCredentials()
    {
        return $this->credentials;
    }

    public function getSignature()
    {<commit_msg>Removing magic waiter and iterator methods<commit_after><?php

namespace Aws;

use Aws\Api\Service;
use Aws\Api\Serializer\JsonRpcSerializer;
use Aws\Api\Serializer\QuerySerializer;
use Aws\Api\Serializer\RestJsonSerializer;
use Aws\Api\Parser\JsonRpcParser;
use Aws\Credentials\CredentialsInterface;
use Aws\Signature\SignatureV2;
use Aws\Signature\SignatureV4;
use Aws\Signature\SignatureInterface;
use Aws\Subscriber\Signature;
use GuzzleHttp\Client;
use GuzzleHttp\Command\AbstractClient;

/**
 * Default AWS client implementation
 */
class AwsClient extends AbstractClient implements AwsClientInterface
{
    const VERSION = '3.0.0-beta.1';

    /** @var CredentialsInterface AWS credentials */
    private $credentials;

    /** @var SignatureInterface Signature implementation of the service */
    private $signature;

    /** @var string */
    private $region;

    /** @var Service */
    private $api;

    /** @var string */
    private $endpoint;

    /**
     * The AwsClient constructor accepts the following constructor option:
     *
     * - api: (required) The Api object used to interact with a web service
     * - endpoint: (required) String representing the service endpoint
     * - credentials: (required) CredentialsInterface object used when signing.
     * - region: Region used to interact with the service
     * - client: Optional {@see GuzzleHttp\Client} used to send requests.
     * - signature: string representing the signature version to use (e.g., v4)
     *
     * @param array $config Configuration options
     * @throws \InvalidArgumentException if any required options are missing
     */
    public function __construct(array $config)
    {
        foreach (['api', 'endpoint', 'credentials'] as $required) {
            if (!isset($config[$required])) {
                throw new \InvalidArgumentException($required . ' is required');
            }
        }

        $this->api = $config['api'];
        $this->endpoint = $config['endpoint'];
        $this->credentials = $config['credentials'];
        $this->region = isset($config['region']) ? $config['region'] : null;
        $this->addSignature($config);

        // Remove settings from the config collection
        unset($config['api'], $config['credentials'], $config['signature'],
            $config['client']);

        parent::__construct($this->createClient($config), $config);

        $this->getHttpClient()->getEmitter()->attach(
            new Signature($this->credentials, $this->signature)
        );

        $this->addProtocol();
    }

    public function getCommand($name, array $args = [])
    {
        $command = null;
        if (isset($this->api['operations'][$name])) {
            $command = $this->api['operations'][$name];
        } else {
            $name = ucfirst($name);
            if (isset($this->api['operations'][$name])) {
                $command = $this->api['operations'][$name];
            }
        }

        if (!$command) {
            throw new \InvalidArgumentException("Operation not found: $name");
        }

        return new AwsCommand($name, $args, $this->api, clone $this->getEmitter());
    }

    public function getCredentials()
    {
        return $this->credentials;
    }

    public function getSignature()
    {
{'fraction_non_alphanumeric': 0.13706563706563707, 'fraction_numerical': 0.0031715388858246, 'mean_word_length': 2.7118730808597746, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4466372', 'n_tokens_mistral': 1969, 'n_tokens_neox': 1926, 'n_words': 507}