text:
<?php

namespace MIW\RestBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\DependencyInjection\Container;

class RestRegistrationFormType extends AbstractType
{
    protected $routeName;
    private $class;

    /**
     * @param string $class The User class name
     */
    public function __construct(Container $container, $class)
    {
        $request = $container->get('request');
        $this->routeName = $request->get('_route');
        $this->class = $class;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if ($this->routeName != "miw_rest_user_newuser")
        {
            $builder
                ->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
                ->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
                ->add('plainPassword', 'repeated', array(
                    'type' => 'password',
                    'options' => array('translation_domain' => 'FOSUserBundle'),
                    'first_options' => array('label' => 'form.password'),
                    'second_options' => array('label' => 'form.password_confirmation'),
                    'invalid_message' => 'fos_user.password.mismatch',
                ))
            ;
        }
        else
        {
            $builder
                ->add('email', 'email')
                ->add('username', null)
                ->add('plainPassword', 'password')
            ;
        }
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        if ($this->routeName != "miw_rest_user_newuser")
        {
            $resolver->setDefaults(array(
                'data_class' => $this->class,
                'intention'  => 'registration',
            ));
        }
        else
        {
            $resolver->setDefaults(array(
                'data_class' => $this->class,
                'intention'  => 'registration',
                'csrf_protection' => false
            ));
        }
    }

    public function getName()
    {
        return 'fos_user_rest_registration';
    }
}

redpajama_set_name: RedPajamaGithub


text:
package hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class SpringbootApplication {

  public static void main(String[] args) {
    SpringApplication.run(SpringbootApplication.class, args);
  }

  @GetMapping("/")
  public String pass() {
    return "PASS";
  }
}


text:
import unittest
from kivy.event import EventDispatcher
from kivy.properties import BoundedNumericProperty

class PropertyWidget(EventDispatcher):
    foo = BoundedNumericProperty(1, min=-5, max=5)

class Issue599(unittest.TestCase):

    def test_minmax(self):
        wid = PropertyWidget()

        self.assertEqual(wid.property('foo').get_min(wid), -5)
        wid.property('foo').set_min(wid, 0)
        self.assertEqual(wid.property('foo').get_min(wid), 0)

        self.assertEqual(wid.property('foo').get_max(wid), 5)
        wid.property('foo').set_max(wid, 10)
        self.assertEqual(wid.property('foo').get_max(wid), 10)


text:
Lunchtime
=========

Lunchtime helps you decide where to eat with a group of co-workers. No longer
do you have to play chicken with deciding where to get lunch.

I'm building this app to teach myself [Rails](http://rubyonrails.org) and
[Ember](http://emberjs.com).


text:
using System;
using System.Collections.Generic;
using System.Linq;

namespace Microsoft.Bot.Connector
{
    /// <summary>
    /// The referenced conversation has been updated
    /// </summary>
    public interface IConversationUpdateActivity : IActivity
    {
        /// <summary>
        /// Members added to the conversation
        /// </summary>
        IList<ChannelAccount> MembersAdded { get; set; }

        /// <summary>
        /// Members removed from the conversation
        /// </summary>
        IList<ChannelAccount> MembersRemoved { get; set; }

        /// <summary>
        /// The conversation's updated topic name
        /// </summary>
        string TopicName { get; set; }

        /// <summary>
        /// True if prior history of the channel is disclosed
        /// </summary>
        bool? HistoryDisclosed { get; set; }
    }
}


text:
package com.raizlabs.dbflow.android.sqlcipher;

import com.raizlabs.android.dbflow.structure.database.DatabaseStatement;

import net.sqlcipher.database.SQLiteStatement;

/**
 * Description: Implements the methods necessary for {@link DatabaseStatement}. Delegates calls to
 * the contained {@link SQLiteStatement}.
 */
public class SQLCipherStatement implements DatabaseStatement {

    public static SQLCipherStatement from(SQLiteStatement statement) {
        return new SQLCipherStatement(statement);
    }

    private final SQLiteStatement statement;

    SQLCipherStatement(SQLiteStatement statement) {
        this.statement = statement;
    }

    public SQLiteStatement getStatement() {
        return statement;
    }

    @Override
    public long executeUpdateDelete() {
        return statement.executeUpdateDelete();
    }

    @Override
    public void execute() {
        statement.execute();
    }

    @Override
    public void close() {
        statement.close();
    }

    @Override
    public long simpleQueryForLong() {
        return statement.simpleQueryForLong();
    }

    @Override
    public String simpleQueryForString() {
        return statement.simpleQueryForString();
    }

    @Override
    public long executeInsert() {
        return statement.executeInsert();
    }

    @Override
    public void bindString(int index, String name) {
        statement.bindString(index, name);
    }

    @Override
    public void bindNull(int index) {
        statement.bindNull(index);
    }

    @Override
    public void bindLong(int index, long aLong) {
        statement.bindLong(index, aLong);
    }

    @Override
    public void bindDouble(int index, double aDouble) {
        statement.bindDouble(index, aDouble);
    }

    @Override
    public void bindBlob(int index, byte[] bytes) {
        statement.bindBlob(index, bytes);
    }
}


text:
module Rack
  class SmartphoneDetector
    class Railtie < ::Rails::Railtie
      initializer 'rack-smartphone_detector.configure_rails_initialization' do |app|
        app.config.middleware.insert_before('ActionDispatch::ParamsParser', 'Rack::SmartphoneDetector')
      end
    end
  end
end


text:
use regex::Regex;

/// We use captures as a way to extend tree-sitter's query mechanism.
/// Variable captures correspond to a weggli variable ($foo) and we enforce
/// equality of a single variable for all queries in a tree.
/// Check is used for weggli identifiers such as variable or function names.
/// Finally, Subquery contains the QueryTree that needs to be executed on
/// the captured AST node.
#[derive(Debug)]
pub enum Capture {
    Display,
    Variable(String, Option<(bool, Regex)>),
    Check(String),
    Number(i128),
    Subquery(Box<crate::query::QueryTree>),
}

pub fn add_capture(captures: &mut Vec<Capture>, capture: Capture) -> String {
    let idx = captures.len();
    captures.push(capture);
    idx.to_string()
}


text:
<?php
/*
 * Note: Using error_reporting=E_ALL & ~E_NOTICE to suppress "Trying to get property of non-object" notices.
 */
class StreamExploiter {
	public function stream_close (  ) {
		$doc = new DOMDocument;
		$doc->resolveExternals = true;
		$doc->substituteEntities = true;
		$dir = htmlspecialchars(dirname(getcwd()));
		$dir = str_replace('\\', '/', $dir); // fix for windows
		$doc->loadXML( <<<XML
<!DOCTYPE doc [
	<!ENTITY file SYSTEM "file:///$dir/bad">
]>
<doc>&file;</doc>
XML
		);
		print $doc->documentElement->firstChild->nodeValue;
	}

	public function stream_open (  $path ,  $mode ,  $options ,  &$opened_path ) {
		return true;
	}
}

var_dump(mkdir('test_bug_61367-read'));
var_dump(mkdir('test_bug_61367-read/base'));
var_dump(file_put_contents('test_bug_61367-read/bad', 'blah'));
var_dump(chdir('test_bug_61367-read/base'));

stream_wrapper_register( 'exploit', 'StreamExploiter' );
$s = fopen( 'exploit://', 'r' );

?>


text:
#ifndef RENEWABILITY_MANAGER_H
#define RENEWABILITY_MANAGER_H

#define ASCL_EXTERN extern

#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <ctype.h>
#include <mysql/mysql.h>
#include <libwebsockets.h>
#include <ascl.h>
#include <renewability.h>
#include <sys/types.h>
#include <dirent.h>
#include <pthread.h>
#include "nodes.h"

#define RENEWABILITY_DB_HOST                "mysql"
#define RENEWABILITY_DB_USER                "rn_user"
#define RENEWABILITY_DB_PASS                "rn_password"
#define RENEWABILITY_DB_NAME                "RN_development"

#define RN_MANAGER_KO                       -1
#define RN_REVISION_NUMBER_BUFFER_LEN       11
#define RN_REVISION_FORMAT                  "%08x"

#define RENEWABILITY_POLICIES_POLLING       1000   /* mseconds */

#define RN_DEBUG							0
#define RN_INFO								1
#define RN_ERROR							2

#define RENEWABILITY_MANAGER_LOG_FILE        "/opt/online_backends/renewability/renewability_manager.log"
#define RENEWABILITY_GENERATION_SCRIPT       "/opt/renewability/scripts/create_new_revision.sh"
#define RENEWABILITY_REVISION_PATH           "/opt/online_backends/%s/code_mobility/%s"

#ifndef RENEWABILITY_MANAGER_LOG_LEVEL
    #define RENEWABILITY_MANAGER_LOG_LEVEL 	RN_DEBUG
#endif

typedef struct renewability_policy {
    unsigned long revision_durarion;        /* Duration of revisions in s */
    bool timeout_mandatory;                 /* Is timeout mandatory? */
    char diversification_script[1024];      /* Path to diversification script */
} renewability_policy;

/* used to force exit when a signal is received */
static volatile int force_exit = 0;

void renewabilityLog(const char* fmt, int lvl, ...);

#endif /* RENEWABILITY_MANAGER_H */


text:
package blocks

import "fmt"
import "os"

type FileOutput struct {
	OutputBlockData
	file *os.File
}

func (b *FileOutput) Update() {
	b.file.Seek(0, 0) // also seeks to 0 when piping stdout or stderr
	for _, v := range b.in {
		fmt.Fprintln(b.file, v)
	}
}

func FileOutputConstructor(name string, words []string) Block {
	var file *os.File
	if words[0] == "stdout" {
		file = os.Stdout
	} else if words[0] == "stderr" {
		file = os.Stderr
	} else {
		file, _ = os.Create(words[0])
	}

	b := &FileOutput{file: file}
	return b
}

var FileOutputConstructorOk = AddConstructor("FileOutput", FileOutputConstructor)


text:
namespace Microsoft.Protocols.TestSuites.SharedAdapter
{
    using System;
    using Microsoft.Protocols.TestSuites.Common;
    using Microsoft.Protocols.TestTools;

    /// <summary>
    /// A class contains methods which capture common requirements.
    /// </summary>
    public sealed partial class MsfsshttpAdapterCapture
    {
        /// <summary>
        /// Capture requirements related with UserNameTypes.
        /// </summary>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateUserNameTypes(ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R793 and MS-FSSHTTP_R1826
            // The UserNameTypes is derived from NCName, so if the NCName type validation passes, then MS-FSSHTTP_R793 and MS-FSSHTTP_R1826 can be captured.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     793,
                     @"[In UserNameType] The UserNameType simple type specifies a representation of a user name value as specified in [RFC2822].");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1826
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     1826,
                     @"[In UserNameType][The schema of UserNameType is]
                     <xs:simpleType name=""UserNameType"">
                         <xs:restriction base=""xs:string"">
                         </xs:restriction>
                     </xs:simpleType> ");
        }

        /// <summary>
        /// Capture underlying transport protocol related requirements. They can be captured directly when the server returns a SOAP response successfully.
        /// </summary>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateTransport(ITestSite site)
        {
            if (Common.GetConfigurationPropertyValue("TransportType", site).Equals("HTTP", StringComparison.CurrentCultureIgnoreCase))
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1
                // Since all the messages are transported following Http configured in BasicHttpBinding_ICellStorages, so MS-FSSHTTP_R1 can be captured.
                site.CaptureRequirement(
                         "MS-FSSHTTP",
                         1,
                         @"[In Transport] Protocol servers MUST support SOAP over HTTP, as specified in [RFC2616] [,or HTTPS, as specified in [RFC2818]].");
            }

            if (Common.GetConfigurationPropertyValue("TransportType", site).Equals("HTTPS", StringComparison.CurrentCultureIgnoreCase))
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11000
                // Since all the messages are transported following Https configured in BasicHttpBinding_ICellStorages, so MS-FSSHTTP_R11000 can be captured.
                site.CaptureRequirement(
                         "MS-FSSHTTP",
                         11000,
                         @"[In Transport] Protocol servers MUST support [SOAP over HTTP, as specified in [RFC2616], or] HTTPS, as specified in [RFC2818].");
            }

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2
            // Since all the messages are SOAP1.1 message configured in BasicHttpBinding_ICellStorages, so MS-FSSHTTP_R2 can be captured.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     2,
                     @"[In Transport] Protocol messages MUST be formatted as specified in [SOAP1.1] section 4.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3
            // Since all the messages are SOAP1.1 message configured in BasicHttpBinding_ICellStorages, so MS-FSSHTTP_R3 can be captured.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     3,
                     @"[In Transport] Protocol server MUST use MTOM encoding as specified in [SOAP1.2-MTOM].");
        }

        /// <summary>
        /// Capture requirements related with RequestToken within Response element
        /// </summary>
        /// <param name="response">The Response information</param>
        /// <param name="expectedToken">The expected RequestToken</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateResponseToken(Response response, string expectedToken, ITestSite site)
        {
            if (expectedToken == null)
            {
                // When the expected token is null, then indicating there is no expected token value returned by server.
                return;
            }

            if (!string.IsNullOrEmpty(expectedToken))
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R65
                site.CaptureRequirementIfAreEqual<string>(
                         expectedToken,
                         response.RequestToken,
                         "MS-FSSHTTP",
                         65,
                         @"[In Request] The one-to-one mapping between the Response element and the Request element MUST be maintained by using RequestToken.");
            }

            // Directly capture requirement MS-FSSHTTPB_R70, if there are no parsing errors.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     70,
                     @"[In Request] Depending on the other types of errors[GenericErrorCodeTypes, CellRequestErrorCodeTypes, DependencyCheckRelatedErrorCodeTypes, LockAndCoauthRelatedErrorCodeTypes and NewEditorsTableCategoryErrorCodeTypes], the error code for that type MUST be returned by the protocol server.");

            if (!string.IsNullOrEmpty(expectedToken))
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R929
                site.CaptureRequirementIfAreEqual<string>(
                     expectedToken,
                     response.RequestToken,
                     "MS-FSSHTTP",
                     929,
                     @"[In Common Message Processing Rules and Events][The protocol server MUST follow the following common processing rules for all types of subrequests] The protocol server sends a Response element for each Request element.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R95
                site.CaptureRequirementIfAreEqual<string>(
                         expectedToken,
                         response.RequestToken,
                         "MS-FSSHTTP",
                         95,
                         @"[In Response] For each Request element that is part of a cell storage service request, there MUST be a corresponding Response element in a cell storage service response.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R105
                site.CaptureRequirementIfAreEqual<string>(
                         expectedToken,
                         response.RequestToken,
                         "MS-FSSHTTP",
                         105,
                         @"[In Response] RequestToken: A nonnegative integer that specifies the request token that uniquely identifies the Request element whose response is being generated.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R108
                site.CaptureRequirementIfAreEqual<string>(
                         expectedToken,
                         response.RequestToken,
                         "MS-FSSHTTP",
                         108,
                         @"[In Response] The one-to-one mapping between the Response element and the Request element MUST be maintained by using the request token.");
            }
        }

        /// <summary>
        /// Capture requirements related with SubRequestToken within SubResponse element
        /// </summary>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateSubResponseToken(ITestSite site)
        {
            // All there requirements can be directly captured when the code runs here successfully.
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R143
            // If the SubRequestToken values in Request element equals the values in Response element, then capture MS-FSSHTTP_R143.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     143,
                     @"[In SubResponse] Within a Response element for each SubRequest element that is in a Request element of a cell storage service request message, there MUST be a corresponding SubResponse element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R930
            // If the protocol server returns subResponse for each subRequest, then capture MS-FSSHTTP_R930.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     930,
                     @"[In Common Message Processing Rules and Events][The protocol server MUST follow the following common processing rules for all types of subrequests] and [The protocol server sends] a SubResponse element corresponding to each SubRequest element contained within a Request element.");
        }

        /// <summary>
        /// Capture requirements related with ResponseVersion element
        /// </summary>
        /// <param name="version">The ResponseVersion information</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateResponseVersion(ResponseVersion version, ITestSite site)
        {
            // Verify requirements related with its base type: VersionType
            ValidateVersionType(version as VersionType, site);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R123
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     123,
                     @"[In ResponseVersion][ResponseVersion element schema is:]
                      <xs:element name=""ResponseVersion"">
                       < xs:complexType >
                        < xs:complexContent >
                         < xs:extension base = ""tns:VersionType"" >
                          < xs:attribute name = ""ErrorCode"" type = ""tns:GenericErrorCodeTypes"" use = ""optional"" />
                          < xs:attribute name = ""ErrorMessage"" type = ""xs:string"" use = ""optional"" />
                           </ xs:extension >
                        </ xs:complexContent >
                       </ xs:complexType >
                      </ xs:element > ");

            if (version.ErrorCodeSpecified)
            {
                // Verify requirements related with GenericErrorCodeTypes
                ValidateGenericErrorCodeTypes(site);
            }
        }

        /// <summary>
        /// Capture requirements related with ResponseCollection
        /// </summary>
        /// <param name="responseCollection">The ResponseCollection information</param>
        /// <param name="requestToken">The expected RequestToken</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateResponseCollection(ResponseCollection responseCollection, string requestToken, ITestSite site)
        {
            // Verify MS-FSSHTTP_R19
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     19,
                     @"[In Response] [The Body element of each SOAP response message MUST contain] zero or more ResponseCollection elements.");

            if (responseCollection.WebUrl != null)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R121
                // If WebUrl is not null, WebUrl attribute is specified.
                site.Log.Add(
                    LogEntryKind.Debug,
                    "For requirement MS-FSSHTTP_R121, the WebUrl attribute should be specified, the actual WebUrl value is: {0}",
                    responseCollection.WebUrl != null ? responseCollection.WebUrl : "NULL");

                site.CaptureRequirementIfIsNotNull(
                         responseCollection.WebUrl,
                         "MS-FSSHTTP",
                         121,
                         @"[In ResponseCollection] The WebUrl attribute MUST be specified for each ResponseCollection element.");
            }
            // Verify MS-FSSHTTP_R116
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     116,
                     @"[In ResponseCollection][ResponseCollection schema is:]
                     <xs:element name=""ResponseCollection"">
                         < xs:complexType >
                           < xs:sequence minOccurs = ""1"" maxOccurs = ""unbounded"" >
                             < xs:element ref= ""tns:Response"" />
                           </ xs:sequence >
                           < xs:attribute name = ""WebUrl"" type = ""xs:string"" use = ""required"" />
                           < xs:attribute name = ""WebUrlIsEncoded"" type = ""tns:TRUEFALSE"" use = ""required"" />
                         </ xs:complexType >
                     </ xs:element > ");

            if (!string.IsNullOrEmpty(requestToken))
            {
                site.CaptureRequirementIfIsTrue(
                    responseCollection.Response != null && responseCollection.Response.Length > 0,
                    "MS-FSSHTTP",
                    114,
                    @"[In ResponseCollection] The ResponseCollection element MUST contain one or more Response elements.");
            }

            // Now here only supported one request.
            if (responseCollection.Response != null && responseCollection.Response.Length >= 1 && !string.IsNullOrEmpty(requestToken))
            {
                MsfsshttpAdapterCapture.ValidateResponseElement(responseCollection.Response[0], site);
                MsfsshttpAdapterCapture.ValidateResponseToken(responseCollection.Response[0], requestToken, site);
            }
        }

        /// <summary>
        /// Capture requirements related with Response message
        /// </summary>
        /// <param name="storageResponse">The storage response information</param>
        /// <param name="requestToken">The expected RequestToken</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateResponse(CellStorageResponse storageResponse, string requestToken, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R17
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     17,
                     @"[In Response] The protocol response schema is specified by the following:
                     <?xml version=""1.0"" encoding=""utf-8""?>
                     <xs:schema xmlns:tns=""http://schemas.microsoft.com/sharepoint/soap/"" attributeFormDefault=""unqualified"" elementFormDefault=""qualified""
                     targetNamespace=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:i=""http://www.w3.org/2004/08/xop/include"">
                     <xs:import namespace=""http://www.w3.org/2004/08/xop/include"" />

                     <xs:element name=""Envelope"">
                      <xs:complexType>
                       <xs:sequence>
                        <xs:element name=""Body"">
                         <xs:complexType>
                          <xs:sequence>
                           <xs:element ref=""tns:ResponseVersion"" minOccurs=""1"" maxOccurs=""1"" />
                           <xs:element ref=""tns:ResponseCollection"" minOccurs=""0"" maxOccurs=""1""/>
                          </xs:sequence>
                         </xs:complexType>
                        </xs:element>
                       </xs:sequence>
                      </xs:complexType>
                     </xs:element>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R18
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     18,
                     @"[In Response] The Body element of each SOAP response message MUST contain a ResponseVersion element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R19
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     19,
                     @"[In Response] [The Body element of each SOAP response message MUST contain] zero or more ResponseCollection elements.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1613
            bool isVerifiedR1613 = storageResponse.ResponseVersion != null;
            site.Log.Add(
               LogEntryKind.Debug,
               "For requirement MS-FSSHTTP_R1613, [In Messages] Response: The detail element of the protocol response contains a ResponseVersion element, the actual ResponseVersion elements is: {0}",
               storageResponse.ResponseVersion != null ? storageResponse.ResponseVersion.ToString() : "NULL");

            site.CaptureRequirementIfIsTrue(
                     isVerifiedR1613,
                     "MS-FSSHTTP",
                     1613,
                     @"[In Messages] Response: The detail element of the protocol response contains a ResponseVersion element and zero or one ResponseCollection elements.");

            // Verify requirements related with ResponseVersion
            ValidateResponseVersion(storageResponse.ResponseVersion, site);

            // Verify requirements related with ResponseCollection
            if (storageResponse.ResponseCollection != null)
            {
                ValidateResponseCollection(storageResponse.ResponseCollection, requestToken, site);
            }
        }

        /// <summary>
        /// Capture requirements related with SubResponseType
        /// </summary>
        /// <param name="subResponse">The SubResponseType information</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateSubResponseType(SubResponseType subResponse, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R281
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     281,
                     @"[In SubResponseType][SubResponseType schema is:]
                      <xs:complexType name=""SubResponseType"">
                         < xs:attribute name = ""SubRequestToken"" type = ""xs:nonNegativeInteger"" use = ""required"" />
                         < xs:attribute name = ""ServerCorrelationId"" type = ""tns:guid"" use = ""optional"" />
                         < xs:attribute name = ""ErrorCode"" type = ""tns:ErrorCodeTypes"" use = ""required"" />
                         < xs:attribute name = ""HResult"" type = ""xs:integer"" use = ""required"" />
                         < xs:attribute name = ""ErrorMessage"" type = ""xs:string"" use = ""optional"" />
                      </ xs:complexType > ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R284
            // If the SubRequestToken attribute isn't null, then capture MS-FSSHTTP_R284.
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R284, the SubRequestToken should be specified, the actual SubRequestToken value is: {0}",
                subResponse.SubRequestToken != null ? subResponse.SubRequestToken : "NULL");

            site.CaptureRequirementIfIsNotNull(
                     subResponse.SubRequestToken,
                     "MS-FSSHTTP",
                     284,
                     @"[In SubResponseType] The SubRequestToken attribute MUST be specified for a SubResponse element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R290
            // If the ErrorCode attribute is not null, capture R290.
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R290, the ErrorCode attribute should be specified, the actual ErrorCode value is: {0}",
                subResponse.ErrorCode != null ? subResponse.ErrorCode : "NULL");

            site.CaptureRequirementIfIsNotNull(
                     subResponse.ErrorCode,
                     "MS-FSSHTTP",
                     290,
                     @"[In SubResponseType] The ErrorCode attribute MUST be specified for a SubResponse element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1003
            site.CaptureRequirementIfIsNotNull(
                     subResponse.ErrorCode,
                     "MS-FSSHTTP",
                     1003,
                     @"[In Coauth Subrequest][The protocol server returns results based on the following conditions:]  Depending on the type of error, ErrorCode is returned as an attribute of the SubResponse element.");

            if (subResponse.ErrorCode != null)
            {
                ErrorCodeType errorCode;
                site.Assert.IsTrue(Enum.TryParse<ErrorCodeType>(subResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", subResponse.ErrorCode);

                // Verify requirements related with ErrorCodeTypes
                ValidateErrorCodeTypes(errorCode, site);
            }
        }

        /// <summary>
        /// Capture requirements related with ErrorCodeTypes.
        /// </summary>
        /// <param name="errorCode">The error code returned by the protocol server</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateErrorCodeTypes(ErrorCodeType errorCode, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R341
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     341,
                     @"[In ErrorCodeTypes][ErrorCodeTypes schema is:]
                      <xs:simpleType name=""ErrorCodeTypes"">
                       < xs:union memberTypes = ""tns:GenericErrorCodeTypes tns:CellRequestErrorCodeTypes tns:DependencyCheckRelatedErrorCodeTypes tns:LockAndCoauthRelatedErrorCodeTypes tns:NewEditorsTableCategoryErrorCodeTypes tns: VersioningRelatedErrorCodeTypes ""/>
                      </ xs:simpleType > ");

            switch (errorCode)
            {
                // Verify DependencyCheckRelatedErrorCodeTypes
                case ErrorCodeType.DependentRequestNotExecuted:
                case ErrorCodeType.DependentOnlyOnSuccessRequestFailed:
                case ErrorCodeType.DependentOnlyOnFailRequestSucceeded:
                case ErrorCodeType.DependentOnlyOnNotSupportedRequestGetSupported:
                case ErrorCodeType.InvalidRequestDependencyType:
                    {
                        ValidateDependencyCheckRelatedErrorCodeTypes(site);
                        break;
                    }

                // Verify LockAndCoauthRelatedErrorCodeTypes
                case ErrorCodeType.LockRequestFail:
                case ErrorCodeType.FileAlreadyLockedOnServer:
                case ErrorCodeType.FileNotLockedOnServer:
                case ErrorCodeType.FileNotLockedOnServerAsCoauthDisabled:
                case ErrorCodeType.LockNotConvertedAsCoauthDisabled:
                case ErrorCodeType.FileAlreadyCheckedOutOnServer:
                case ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser:
                case ErrorCodeType.CoauthRefblobConcurrencyViolation:
                case ErrorCodeType.MultipleClientsInCoauthSession:
                case ErrorCodeType.InvalidCoauthSession:
                case ErrorCodeType.NumberOfCoauthorsReachedMax:
                case ErrorCodeType.ExitCoauthSessionAsConvertToExclusiveFailed:
                    {
                        ValidateLockAndCoauthRelatedErrorCodeTypes(site);
                        break;
                    }

                // Verify GenericErrorCodeTypes
                case ErrorCodeType.Success:
                case ErrorCodeType.IncompatibleVersion:
                case ErrorCodeType.FileNotExistsOrCannotBeCreated:
                case ErrorCodeType.FileUnauthorizedAccess:
                case ErrorCodeType.InvalidSubRequest:
                case ErrorCodeType.SubRequestFail:
                case ErrorCodeType.BlockedFileType:
                case ErrorCodeType.DocumentCheckoutRequired:
                case ErrorCodeType.InvalidArgument:
                case ErrorCodeType.RequestNotSupported:
                case ErrorCodeType.InvalidWebUrl:
                case ErrorCodeType.WebServiceTurnedOff:
                case ErrorCodeType.ColdStoreConcurrencyViolation:
                case ErrorCodeType.Unknown:
                case ErrorCodeType.EditorClientIdNotFound:
                case ErrorCodeType.EditorMetadataQuotaReached:
                case ErrorCodeType.PathNotFound:
                case ErrorCodeType.EditorMetadataStringExceedsLengthLimit:
                case ErrorCodeType.InvalidUrl:
                case ErrorCodeType.ResourceIdDoesNotExist:
                case ErrorCodeType.ResourceIdDoesNotMatch:
                    {
                        ValidateGenericErrorCodeTypes(site);
                        break;
                    }

                // Verify CellRequestErrorCodeTypes
                case ErrorCodeType.CellRequestFail:
                case ErrorCodeType.IRMDocLibarysOnlySupportWebDAV:
                    {
                        ValidateCellRequestErrorCodeTypes(errorCode, site);
                        break;
                    }

                case ErrorCodeType.VersionNotFound:
                    break;

                default:
                    site.Assert.Fail(string.Format("Unknown ErrorCodeType: {0}", errorCode.ToString()));
                    break;
            }
        }

        /// <summary>
        /// Capture requirements related with DependencyCheckRelatedErrorCodeTypes
        /// </summary>
        /// <param name="site">ITestSite site</param>
        private static void ValidateDependencyCheckRelatedErrorCodeTypes(ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R319
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     319,
                     @"[In DependencyCheckRelatedErrorCodeTypes][DependencyCheckRelatedErrorCodeTypes schema is:]
                     <xs:simpleType name=""DependencyCheckRelatedErrorCodeTypes"">
                         <xs:restriction base=""xs:string"">
                           <xs:enumeration value=""DependentRequestNotExecuted""/>
                           <xs:enumeration value=""DependentOnlyOnSuccessRequestFailed""/>
                           <xs:enumeration value=""DependentOnlyOnFailRequestSucceeded""/>
                           <xs:enumeration value=""DependentOnlyOnNotSupportedRequestGetSupported""/>
                           <xs:enumeration value=""InvalidRequestDependencyType""/>
                         </xs:restriction>
                     </xs:simpleType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R320
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     320,
                     @"[In DependencyCheckRelatedErrorCodeTypes] The value of DependencyCheckRelatedErrorCodeTypes MUST be one of the following:

                     [DependentRequestNotExecuted, DependentOnlyOnSuccessRequestFailed, DependentOnlyOnFailRequestSucceeded, DependentOnlyOnNotSupportedRequestGetSupported, InvalidRequestDependencyType]");
        }

        /// <summary>
        /// Capture requirements related with LockAndCoauthRelatedErrorCodeTypes
        /// </summary>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateLockAndCoauthRelatedErrorCodeTypes(ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R375
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     375,
                     @"[In LockAndCoauthRelatedErrorCodeTypes][The LockCoauthRelatedErrorCodeTypes schema is:]
                     <xs:simpleType name=""LockAndCoauthRelatedErrorCodeTypes"">
                        <xs:restriction base=""xs:string"">
                           <xs:enumeration value=""LockRequestFail""/>
                           <xs:enumeration value=""FileAlreadyLockedOnServer""/>
                           <xs:enumeration value=""FileNotLockedOnServer""/>
                           <xs:enumeration value=""FileNotLockedOnServerAsCoauthDisabled""/>
                           <xs:enumeration value=""LockNotConvertedAsCoauthDisabled""/>
                           <xs:enumeration value=""FileAlreadyCheckedOutOnServer""/>
                           <xs:enumeration value=""ConvertToSchemaFailedFileCheckedOutByCurrentUser""/>
                           <xs:enumeration value=""CoauthRefblobConcurrencyViolation""/>
                           <xs:enumeration value=""MultipleClientsInCoauthSession""/>
                           <xs:enumeration value=""InvalidCoauthSession""/>
                           <xs:enumeration value=""NumberOfCoauthorsReachedMax""/>
                           <xs:enumeration value=""ExitCoauthSessionAsConvertToExclusiveFailed""/>
                        </xs:restriction>
                     </xs:simpleType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R376
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     376,
                     @"[In LockAndCoauthRelatedErrorCodeTypes] The value of LockAndCoauthRelatedErrorCodeTypes MUST be one of the following:

                     [LockRequestFail, FileAlreadyLockedOnServer, FileNotLockedOnServer, FileNotLockedOnServerAsCoauthDisabled, LockNotConvertedAsCoauthDisabled, FileAlreadyCheckedOutOnServer, ConvertToSchemaFailedFileCheckedOutByCurrentUser, CoauthRefblobConcurrencyViolation, MultipleClientsInCoauthSession, InvalidCoauthSession, NumberOfCoauthorsReachedMax, ExitCoauthSessionAsConvertToExclusiveFailed]");
        }

        /// <summary>
        /// Capture requirements related with VersionType
        /// </summary>
        /// <param name="version">The VersionType information</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateVersionType(VersionType version, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R295
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     295,
                     @"[In VersionType][VersionType schema is:]
                     <xs:complexType name=""VersionType"">
                        <xs:attribute name=""Version"" type=""tns:VersionNumberType"" use=""required"" />
                        <xs:attribute name=""MinorVersion"" type=""tns:MinorVersionNumberType"" use=""required"" />
                     </xs:complexType>");

            // Verify requirements related with VersionNumberType
            ValidateVersionNumberType(version.Version, site);

            // Verify requirements related with MinorVersionNumberType
            ValidateMinorVersionNumberType(version.MinorVersion, site);
        }

        /// <summary>
        /// Capture requirements related with VersionNumberType.
        /// </summary>
        /// <param name="versionNumber">A version number</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateVersionNumberType(ushort versionNumber, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R423
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     423,
                     @"[In VersionNumberType][VersionNumberType schema is:]
                     <xs:simpleType name=""VersionNumberType"">
                         <xs:restriction base=""xs:unsignedShort"">
                           <xs:minInclusive value=""2""/>
                     <xs:maxInclusive value=""2""/>
                         </xs:restriction>
                     </xs:simpleType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R424
            site.CaptureRequirementIfAreEqual<ushort>(
                     2,
                     versionNumber,
                     "MS-FSSHTTP",
                     424,
                     @"[In VersionNumberType] The value of VersionNumberType MUST be the value that is listed in the following: [2].");

            site.CaptureRequirementIfAreEqual<ushort>(
                     2,
                     versionNumber,
                     "MS-FSSHTTP",
                     425,
                     @"[In VersionNumberType] 2 [means] a version number of 2.");
        }

        /// <summary>
        /// Capture requirements related with MinorVersionNumberType.
        /// </summary>
        /// <param name="minorVersionNumber">The minor version number</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateMinorVersionNumberType(ushort minorVersionNumber, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R409
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     409,
                     @"[In MinorVersionNumberType][MinorVersionNumberType schema is:]
                     <xs:simpleType name=""MinorVersionNumberType"">
                         < xs:restriction base = ""xs:unsignedShort"" >
                            < xs:minInclusive value = ""0"" />
                     < xs:maxInclusive value = ""3"" />
                         </ xs:restriction >
                     </ xs:simpleType > ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R410
            bool isVerifiedR410 = minorVersionNumber == 0 || minorVersionNumber == 2 || minorVersionNumber == 3;
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R410, the MinorVersionNumberType value should be 0 or 2, the actual MinorVersionNumberType value is: {0}",
                minorVersionNumber.ToString());

            site.CaptureRequirementIfIsTrue(
                     isVerifiedR410,
                     "MS-FSSHTTP",
                     410,
                     @"[In MinorVersionNumberType] The value of MinorVersionNumberType MUST be the value [0, 2, 3] that is listed in the following table.");
        }

        /// <summary>
        /// Capture requirements related with GenericErrorCodeTypes.
        /// </summary>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateGenericErrorCodeTypes(ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R353
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     353,
                     @"[In GenericErrorCodeTypes][The GenericErrorodeTypes schema is:]
                      <xs:simpleType name=""GenericErrorCodeTypes"">
                          < xs:restriction base = ""xs:string"" >
                            < xs:enumeration value = ""Success"" />
                            < xs:enumeration value = ""IncompatibleVersion"" />
                            < xs:enumeration value = ""InvalidUrl"" />
                            < xs:enumeration value = ""FileNotExistsOrCannotBeCreated"" />
                            < xs:enumeration value = ""FileUnauthorizedAccess"" />
                            < xs:enumeration value = ""PathNotFound"" />
                            < xs:enumeration value = ""ResourceIdDoesNotExist"" />
                            < xs:enumeration value = ""ResourceIdDoesNotMatch"" />
                            < xs:enumeration value = ""InvalidSubRequest"" />
                            < xs:enumeration value = ""SubRequestFail"" />
                            < xs:enumeration value = ""BlockedFileType"" />
                            < xs:enumeration value = ""DocumentCheckoutRequired"" />
                            < xs:enumeration value = ""InvalidArgument"" />
                            < xs:enumeration value = ""RequestNotSupported"" />
                            < xs:enumeration value = ""InvalidWebUrl"" />
                            < xs:enumeration value = ""WebServiceTurnedOff"" />
                            < xs:enumeration value = ""ColdStoreConcurrencyViolation"" />
                            < xs:enumeration value = ""HighLevelExceptionThrown"" />
                            < xs:enumeration value = ""Unknown"" />
                          </ xs:restriction >
                      </ xs:simpleType > ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R354
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     354,
                     @"[In GenericErrorCodeTypes] The value of GenericErrorCodeTypes MUST be one of the following:
                     [Success, IncompatibleVersion, InvalidUrl, FileNotExistsOrCannotBeCreated, FileUnauthorizedAccess, PathNotFound, InvalidSubRequest, SubRequestFail, BlockedFileType, DocumentCheckoutRequired, InvalidArgument, RequestNotSupported, InvalidWebUrl, WebServiceTurnedOff, ColdStoreConcurrencyViolation, Unknown]");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3329
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     3329,
                     @"[In TRUEFALSE][The schema of TRUEFALSE is:]
                     <xs:simpleType name=""TRUEFALSE"">
                         <xs:restriction base=""xs:string"">
                           <xs:pattern value=""[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]""/>
                         </xs:restriction>
                       </xs:simpleType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3033
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     3033,
                     @"[In NewEditorsTableCategoryErrorCodeTypes][The schema of NewEditorsTableCategoryErrorCodeTypes is:]
                     <xs:simpleType name=""NewEditorsTableCategoryErrorCodeTypes"">
                         <xs:restriction base=""xs:string"">
                            <xs:enumeration value=""EditorMetadataQuotaReached""/>
                            <xs:enumeration value=""EditorMetadataStringExceedsLengthLimit""/>
                            <xs:enumeration value=""EditorClientIdNotFound""/>
                         </xs:restriction>
                     </xs:simpleType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3034
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     3034,
                     @"[In NewEditorsTableCategoryErrorCodeTypes] The value of NewEditorsTableCategoryErrorCodeTypes MUST be one of the values in the following table. [""EditorMetadataQuotaReached"", ""EditorMetadataStringExceedsLengthLimit"", ""EditorClientIdNotFound""]");
        }

        /// <summary>
        /// Capture requirements related with Response element.
        /// </summary>
        /// <param name="response">The Response information</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateResponseElement(Response response, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R97
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     97,
                     @"[In Response][Response element schema is:]
                       <xs:element name=""Response"">
                           < !--Allows for the numbers to be displayed between the SubResponse elements-- >
                           < xs:complexType mixed = ""true"" >
                               < xs:sequence minOccurs = ""1"" maxOccurs = ""unbounded"" >
                                   < xs:element name = ""SubResponse"" type = ""tns:SubResponseElementGenericType"" />
                               </ xs:sequence >
                               < xs:attribute name = ""Url"" type = ""xs:string"" use = ""required"" />
                               < xs:attribute name=""UrlIsEncoded"" type=""tns: TRUEFALSE"" use=""required"" />
                               < xs:attribute name = ""RequestToken"" type = ""xs:nonNegativeInteger"" use = ""optional"" />
                               < xs:attribute name = ""HealthScore"" type = ""xs:integer"" use = ""required"" />
                               < xs:attribute name = ""ErrorCode"" type = ""tns:GenericErrorCodeTypes"" use = ""optional"" />
                               < xs:attribute name = ""ErrorMessage"" type = ""xs:string"" use = ""optional"" />
                               < xs:attribute name = ""SuggestedFileName"" type = ""xs:string"" use = ""optional"" />
                               < xs:attribute name = ""ResourceID"" type = ""xs:string"" use = ""optional"" />
                               < xs:attribute name = ""IntervalOverride"" type = ""xs:nonNegativeInteger"" use = ""optional"" />
                           </ xs:complexType >
                       </ xs:element > ");

            if (response.Url != null)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R104
                site.Log.Add(
                    LogEntryKind.Debug,
                    "For requirement MS-FSSHTTP_R104, the Url attribute value should be specified, the actual Url value is: {0}",
                    response.Url != null ? response.Url : "NULL");

                site.CaptureRequirementIfIsNotNull(
                         response.Url,
                         "MS-FSSHTTP",
                         104,
                         @"[In Response] The Url attribute MUST be specified for each Response element.");
            }

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1482
            // The responseElement.SubResponse.Length specifies the number of SubResponse element in Response.
            bool isVerifiedR96 = response.SubResponse.Length >= 1;
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R1482, the Response element should contain one or more SubResponse elements, the actual SubResponse elements number is: {0}",
                response.SubResponse.Length.ToString());

            site.CaptureRequirementIfIsTrue(
                     isVerifiedR96,
                     "MS-FSSHTTP",
                     96,
                     @"[In Response] Each Response element MUST contain one or more SubResponse elements.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R107
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R263, the RequestToken should be specified, the actual RequestToken value is: {0}",
                response.RequestToken != null ? response.RequestToken : "NULL");

            site.CaptureRequirementIfIsNotNull(
                     response.RequestToken,
                     "MS-FSSHTTP",
                     107,
                     @"[In Response] The RequestToken MUST be specified for each Response element.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2076
            bool isVerifyR2076 = int.Parse(response.HealthScore) <= 10 && int.Parse(response.HealthScore) >= 0;
            site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R2076, the HealthScore value should be between 0 and 10, the actual HealthScore value is: {0}",
                response.HealthScore);

            site.CaptureRequirementIfIsTrue(
                     isVerifyR2076,
                     "MS-FSSHTTP",
                     2076,
                     @"[In Response] HealthScore: An integer which value is between 0 and 10.");

            // Verify requirements related with SubResponse element
            if (response.SubResponse != null)
            {
                foreach (SubResponseElementGenericType subResponse in response.SubResponse)
                {
                    ValidateSubResponseElement(subResponse, site);
                }
            }

            // Verify requirements related with GenericErrorCodeTypes
            if (response.ErrorCodeSpecified)
            {
                ValidateGenericErrorCodeTypes(site);
            }
        }

        /// <summary>
        /// Capture requirements related with SubResponse element
        /// </summary>
        /// <param name="subResponse">The SubResponse element</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateSubResponseElement(SubResponseElementGenericType subResponse, ITestSite site)
        {
            // Verify requirements related with SubResponseElementGenericType
            ValidateSubResponseElementGenericType(subResponse, site);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R151
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     151,
                     @"[In SubResponse][SubResponse element schema is:]
                     <xs:element name=""SubResponse"" type=""tns:SubResponseElementGenericType"" />");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R149
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     149,
                     @"[In SubResponse] Each SubResponse element MUST have zero or one SubResponseData elements.");
        }

        /// <summary>
        /// Capture requirements related with SubResponseElementGenericType
        /// </summary>
        /// <param name="subResponse">The SubResponse information</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateSubResponseElementGenericType(SubResponseElementGenericType subResponse, ITestSite site)
        {
            // Verify requirements related with its base type: SubResponseType
            ValidateSubResponseType(subResponse as SubResponseType, site);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R253
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     253,
                     @"[In SubResponseElementGenericType][SubResponseElementGenericType schema is:]
                      <xs:complexType name=""SubResponseElementGenericType"">
                       < xs:complexContent >
                        < xs:extension base = ""tns:SubResponseType"" >
                         < xs:sequence >
                          < xs:element name = ""SubResponseData"" minOccurs = ""0"" maxOccurs = ""1"" type = ""tns:SubResponseDataGenericType"" />
                          < xs:element name = ""SubResponseStreamInvalid"" minOccurs = ""0"" maxOccurs = ""1"" />
                          < xs:element ref= ""tns:GetVersionsResponse"" minOccurs = ""0"" maxOccurs = ""1"" />
                         </ xs:sequence >
                        </ xs:extension >
                       </ xs:complexContent >
                      </ xs:complexType > ");

            // Verify requirements related with SubResponseData
            if (subResponse.SubResponseData != null)
            {
                ValidateSubResponseData(subResponse.SubResponseData, site);
            }
        }

        /// <summary>
        /// Capture requirements related with SubResponseData element
        /// </summary>
        /// <param name="subResponseData">The SubResponseData element</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateSubResponseData(SubResponseDataGenericType subResponseData, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R155
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     155,
                     @"[In SubResponseData][SubResponseData element schema is:]
                     <xs:element name=""SubResponseData"" minOccurs=""0"" maxOccurs=""1"" type=""tns:SubResponseDataGenericType"" />");

            // Verify requirements related with SubResponseDataGenericType
            ValidateSubResponseDataGenericType(subResponseData, site);
        }

        /// <summary>
        /// Capture requirements related with SubResponseDataGenericType
        /// </summary>
        /// <param name="subResponseData">The SubResponseDataGenericType information</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateSubResponseDataGenericType(SubResponseDataGenericType subResponseData, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R230
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     230,
                     @"[In SubResponseDataGenericType][SubResponseDataGenericType schema is:]
                      <xs:complexType name=""SubResponseDataGenericType"" mixed=""true"">
                        < xs:all >
                          < xs:element ref= ""i:Include"" minOccurs = ""0"" maxOccurs = ""1"" />
                          < xs:element name = ""DocProps"" minOccurs = ""0"" maxOccurs = ""1"" type = ""tns:GetDocMetaInfoPropertySetType"" />
                          < xs:element name = ""FolderProps"" minOccurs = ""0"" maxOccurs = ""1"" type = ""tns:GetDocMetaInfoPropertySetType"" />
                          < xs:element name = ""UserTable"" type = ""tns:VersioningUserTableType"" />
                          < xs:element name = ""Versions"" type = ""tns:VersioningVersionListType"" />
                        </ xs:all >
                        < xs:attributeGroup ref= ""tns:SubResponseDataOptionalAttributes"" />
                      </ xs:complexType > ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R543
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     543,
                     @"[In CellSubResponseDataType][CellSubResponseDataType schema is:]
                     <xs:complexType name=""CellSubResponseDataType"" mixed=""true"">
                        <xs:all>
                          <xs:element ref=""i:Include"" minOccurs=""0"" maxOccurs=""1"" />
                        </xs:all>
                        <xs:attributeGroup ref=""tns:CellSubResponseDataOptionalAttributes"" />
                        <xs:attribute name=""LockType"" type=""tns:LockTypes"" use=""optional"" />
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R544
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     544,
                     @"[In CellSubResponseDataType] Include: A complex type, as specified in [XOP10] section 2.1.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R231
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     231,
                     @"[In SubResponseDataGenericType] Include: A complex type, as specified in  [XOP10] section 2.1.");

            // Verify requirements related with SubResponseDataOptionalAttributes
            ValidateSubResponseDataOptionalAttributes(subResponseData, site);
        }

        /// <summary>
        /// Capture requirements related with SubResponseDataOptionalAttributes type
        /// </summary>
        /// <param name="subResponseData">The SubResponseData information</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidateSubResponseDataOptionalAttributes(SubResponseDataGenericType subResponseData, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R458
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     458,
                     @"[In SubResponseDataOptionalAttributes] The definition of the SubResponseDataOptionalAttributes attribute group is as follows:
                     <xs:attributeGroup name=""SubResponseDataOptionalAttributes"">
                         <xs:attributeGroup ref=""tns:CellSubResponseDataOptionalAttributes""/>
                         <xs:attributeGroup ref=""tns:WhoAmISubResponseDataOptionalAttributes""/>
                         <xs:attribute name=""ServerTime"" type=""xs:positiveInteger"" use=""optional""/>
                         <xs:attribute name=""LockType"" type=""tns:LockTypes"" use=""optional"" />
                         <xs:attribute name=""CoauthStatus"" type=""tns:CoauthStatusType"" use=""optional""/>
                         <xs:attribute name=""TransitionID"" type=""tns:guid"" use=""optional""/>
                         <xs:attribute name=""ExclusiveLockReturnReason"" type=""tns:ExclusiveLockReturnReasonTypes"" use=""optional"" />
                         <xs:attribute name=""AmIAlone"" type=""tns:TRUEFALSE"" use=""optional""/>
                         <xs:attribute name=""LockID"" type=""tns:guid"" use=""optional""/>
                         <xs:attribute name=""LockedBy"" type=""xs:string"" use=""optional"" />
                     </xs:attributeGroup>");

            // Verify requirements related with CellSubResponseDataOptionalAttributes
            if (subResponseData.Etag != null
                || subResponseData.CreateTime != null
                || subResponseData.ModifiedBy != null
                || subResponseData.LastModifiedTime != null
                || subResponseData.CoalesceErrorMessage != null)
            {
                CellSubResponseDataType cellSubResponseData = new CellSubResponseDataType();
                cellSubResponseData.Etag = subResponseData.Etag;
                cellSubResponseData.CreateTime = subResponseData.CreateTime;
                cellSubResponseData.ModifiedBy = subResponseData.ModifiedBy;
                cellSubResponseData.LastModifiedTime = subResponseData.LastModifiedTime;
                cellSubResponseData.CoalesceErrorMessage = subResponseData.CoalesceErrorMessage;
                ValidateCellSubResponseDataOptionalAttributes(cellSubResponseData, site);
            }

            // Verify requirements related with WhoAmISubResponseDataOptionalAttributes
            if (subResponseData.UserName != null
                || subResponseData.UserEmailAddress != null
                || subResponseData.UserSIPAddress != null)
            {
                WhoAmISubResponseDataType whoamiSubResponseData = new WhoAmISubResponseDataType();
                whoamiSubResponseData.UserName = subResponseData.UserName;
                whoamiSubResponseData.UserEmailAddress = subResponseData.UserEmailAddress;
                whoamiSubResponseData.UserSIPAddress = subResponseData.UserSIPAddress;
                ValidateWhoAmISubResponseDataOptionalAttributes(whoamiSubResponseData, site);
            }

            if (subResponseData.ServerTime != null)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R463
                site.CaptureRequirement(
                         "MS-FSSHTTP",
                         463,
                         @"[In SubResponseDataOptionalAttributes] ServerTime: A positive integer that specifies the server time, which is expressed as a tick count.");
            }

            if (subResponseData.DocProps != null)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11050
                site.CaptureRequirement(
                         "MS-FSSHTTP",
                         11050,
                         @"[In SubResponseDataGenericType] DocProps: An element of type GetDocMetaInfoPropertySetType (section 2.3.1.28) that specifies metadata properties pertaining to the server file.");
            }

            if (subResponseData.FolderProps != null)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11051
                site.CaptureRequirement(
                         "MS-FSSHTTP",
                         11051,
                         @"[In SubResponseDataGenericType] FolderProps: An element of type GetDocMetaInfoPropertySetType (section 2.3.1.28) that specifies metadata properties pertaining to the parent directory of the server file.");
            }

            if (subResponseData.LockTypeSpecified)
            {
                // Verify LockTypes
                ValidateLockTypes(site);
            }

            if (subResponseData.CoauthStatusSpecified)
            {
                // Verify CoauthStatusType
                ValidateCoauthStatusType(site);
            }

            if (subResponseData.TransitionID != null)
            {
                // Verify GUID type
                ValidateGUID(site);
            }

            if (subResponseData.ExclusiveLockReturnReasonSpecified)
            {
                // Verify ExclusiveLockReturnReasonTypes
                ValidateExclusiveLockReturnReasonTypes(site);
            }
        }

        #region ValidateCoauthStatusType

        /// <summary>
        /// Capture the CoauthStatusType schema related requirements.
        /// </summary>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        private static void ValidateCoauthStatusType(ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R314
            // If LockType exists,its schema will have been validated before invoking the method CaptureJoinCoauthoringSessionRelatedRequirements.
            // So MS-FSSHTTP_R314 can be captured.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     314,
                     @"[In CoauthStatusType][CoauthStatusType schema is:]
                     <xs:simpleType name=""CoauthStatusType"">
                         <xs:restriction base=""xs:string"">
                           <!--None-->
                           <xs:enumeration value=""None""/>

                           <!--Alone-->
                           <xs:enumeration value=""Alone""/>

                           <!--Coauthoring-->
                           <xs:enumeration value=""Coauthoring""/>
                         </xs:restriction>
                     </xs:simpleType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R315
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     315,
                     @"[In CoauthStatusType] The value of CoauthStatusType MUST be one of the following: [None, Alone, Coauthoring]");
        }

        #endregion

        #region ValidateExclusiveLockReturnReasonTypes

        /// <summary>
        /// Capture the ExclusiveLockReturnReasonTypes schema related requirements.
        /// </summary>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        private static void ValidateExclusiveLockReturnReasonTypes(ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R347
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     347,
                     @"[In ExclusiveLockReturnReasonTypes][The schema of ExclusiveLockReturnReasonTypes is] <xs:simpleType name=""ExclusiveLockReturnReasonTypes"">
                        <xs:restriction base=""xs:string"">
                           <xs:enumeration value=""CoauthoringDisabled"" />
                           <xs:enumeration value=""CheckedOutByCurrentUser"" />
                           <xs:enumeration value=""CurrentUserHasExclusiveLock"" />
                        </xs:restriction>
                     </xs:simpleType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R348
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     348,
                     @"[In ExclusiveLockReturnReasonTypes] The value of ExclusiveLockReturnReasonTypes MUST be one of the following:
                     [CoauthoringDisabled, CheckedOutByCurrentUser, CurrentUserHasExclusiveLock]");
        }

        #endregion

        #region ValidateGUID

        /// <summary>
        /// Capture the GUID schema related requirements.
        /// </summary>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        private static void ValidateGUID(ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R373
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     373,
                     @"[In GUID][The GUID schema is:]
                     <xs:simpleType name=""guid"">
                        <xs:restriction base=""xs:string"">
                          <xs:pattern value=""[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"" />
                        </xs:restriction>
                     </xs:simpleType>");
        }

        #endregion

        #region ValidateLockTypes

        /// <summary>
        /// Capture the soap version related requirements. They can be captured directly when the server returns a SOAP response successfully.
        /// </summary>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        private static void ValidateLockTypes(ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R398
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     398,
                     @"[In LockTypes][The Locktypes schema is:]

                     <xs:simpleType name=""LockTypes"">
                     <xs:union>
                        <xs:simpleType>
                        <xs:restriction base=""xs:string"">
                           <xs:enumeration value=""None"" />
                           <xs:enumeration value=""SchemaLock"" />
                           <xs:enumeration value=""ExclusiveLock"" />
                        </xs:restriction>
                    </xs:simpleType>
                     <xs:simpleType>
                        <xs:restriction base=""xs: integer"">
                        < xs:enumeration value = ""0"" />
                        < xs:enumeration value = ""1"" />
                        < xs:enumeration value = ""2"" />
                        </ xs:restriction >
                    </xs:simpleType>
                    </xs:union>
                    </xs:simpleType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R399
            // There is only 3 values in the enumeration LockTypes:None, SchemaLock, ExclusiveLock.So if lockType can be a non-null value,
            // the value must be one of them.So MS-FSSHTTP_R399 can be captured as the following:
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     399,
                     @"[In LockTypes] The value of LockTypes MUST be one of the following:
                     [None, SchemaLock, ExclusiveLock].");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R467
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     467,
                     @"[In SubResponseDataOptionalAttributes] LockType: A LockTypes that specifies the type of lock granted in a coauthoring subresponse.");

            //  MS-FSSHTTP_R467 is verified,so MS-FSSHTTP_R2267 can be verified directly
            site.CaptureRequirement(
                     "MS-FSSHTTP",
                     2267,
                     @"[In LockStatusSubResponseDataType]LockType: A LockTypes that specifies the type of lock granted in a coauthoring subresponse. ");

        }

        #endregion
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.communication.callingserver.implementation.accesshelpers;

import com.azure.communication.callingserver.implementation.models.CallConnectionPropertiesInternal;
import com.azure.communication.callingserver.models.CallConnectionProperties;

import java.net.URISyntaxException;

/**
 * Helper class to access private values of {@link CallConnectionProperties} across package boundaries.
 */
public final class CallConnectionPropertiesConstructorProxy {
    private static CallConnectionPropertiesConstructorAccessor accessor;

    private CallConnectionPropertiesConstructorProxy() { }

    /**
     * Type defining the methods to set the non-public properties of a {@link CallConnectionPropertiesConstructorAccessor}
     * instance.
     */
    public interface CallConnectionPropertiesConstructorAccessor {
        /**
         * Creates a new instance of {@link CallConnectionProperties} backed by an internal instance of
         * {@link CallConnectionProperties}.
         *
         * @param internalResponse The internal response.
         * @return A new instance of {@link CallConnectionProperties}.
         */
        CallConnectionProperties create(CallConnectionPropertiesInternal internalResponse) throws URISyntaxException;
    }

    /**
     * The method called from {@link CallConnectionProperties} to set it's accessor.
     *
     * @param accessor The accessor.
     */
    public static void setAccessor(final CallConnectionPropertiesConstructorAccessor accessor) {
        CallConnectionPropertiesConstructorProxy.accessor = accessor;
    }

    /**
     * Creates a new instance of {@link CallConnectionProperties} backed by an internal instance of
     * {@link CallConnectionPropertiesInternal}.
     *
     * @param internalResponse The internal response.
     * @return A new instance of {@link CallConnectionProperties}.
     */
    public static CallConnectionProperties create(CallConnectionPropertiesInternal internalResponse) throws URISyntaxException {
        // This looks odd but is necessary, it is possible to engage the access helper before anywhere else in the
        // application accesses BlobDownloadHeaders which triggers the accessor to be configured. So, if the accessor
        // is null this effectively pokes the class to set up the accessor.
        if (accessor == null) {
            new CallConnectionProperties();
        }

        assert accessor != null;
        return accessor.create(internalResponse);
    }
}


text:
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.server.resourcemanager.MockNodes;
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent;

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent;
import org.apache.hadoop.yarn.util.ControlledClock;
import org.apache.hadoop.yarn.util.resource.Resources;
import org.junit.After;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class TestContinuousScheduling extends FairSchedulerTestBase {
  private ControlledClock mockClock;

  @Override
  public Configuration createConfiguration() {
    Configuration conf = super.createConfiguration();
    conf.setBoolean(
        FairSchedulerConfiguration.CONTINUOUS_SCHEDULING_ENABLED, true);
    conf.setInt(FairSchedulerConfiguration.LOCALITY_DELAY_NODE_MS, 100);
    conf.setInt(FairSchedulerConfiguration.LOCALITY_DELAY_RACK_MS, 100);
    return conf;
  }

  @Before
  public void setup() {
    mockClock = new ControlledClock();
    conf = createConfiguration();
    resourceManager = new MockRM(conf);
    resourceManager.start();

    scheduler = (FairScheduler) resourceManager.getResourceScheduler();
    scheduler.setClock(mockClock);

    assertTrue(scheduler.isContinuousSchedulingEnabled());
    assertEquals(
        FairSchedulerConfiguration.DEFAULT_CONTINUOUS_SCHEDULING_SLEEP_MS,
        scheduler.getContinuousSchedulingSleepMs());
    assertEquals(mockClock, scheduler.getClock());
  }

  @After
  public void teardown() {
    if (resourceManager != null) {
      resourceManager.stop();
      resourceManager = null;
    }
  }

  @Test (timeout = 60000)
  public void testSchedulingDelay() throws InterruptedException {
    // Add one node
    String host = "127.0.0.1";
    RMNode node1 = MockNodes.newNodeInfo(
        1, Resources.createResource(4096, 4), 1, host);
    NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
    scheduler.handle(nodeEvent1);
    NodeUpdateSchedulerEvent nodeUpdateEvent = new NodeUpdateSchedulerEvent(node1);
    scheduler.handle(nodeUpdateEvent);

    // Create one application and submit one each of node-local, rack-local
    // and ANY requests
    ApplicationAttemptId appAttemptId =
        createAppAttemptId(this.APP_ID++, this.ATTEMPT_ID++);
    createMockRMApp(appAttemptId);

    scheduler.addApplication(appAttemptId.getApplicationId(), "queue11", "user11", false);
    scheduler.addApplicationAttempt(appAttemptId, false, false);
    List<ResourceRequest> ask = new ArrayList<>();
    ask.add(createResourceRequest(1024, 1, ResourceRequest.ANY, 1, 1, true));
    scheduler.allocate(
        appAttemptId, ask, new ArrayList<ContainerId>(), null, null);
    FSAppAttempt app = scheduler.getSchedulerApp(appAttemptId);

    // Advance time and let continuous scheduling kick in
    mockClock.tickSec(1);
    while (1024 != app.getCurrentConsumption().getMemory()) {
      Thread.sleep(100);
    }
    assertEquals(1024, app.getCurrentConsumption().getMemory());
  }
}


text:
from base import BaseExpert
import numpy as np

class TrueExpert(BaseExpert):
    """docstring for TrueExpert"""

    def __init__(self, oracle):
        super(TrueExpert, self).__init__(oracle)

    def label(self, data, y=None):
        if y is None:
            raise Exception("True labels are missing")
        else:
            return y

    def fit(self, X, y=None, vct=None):
        return self

class NoisyExpert(BaseExpert):

    def __init__(self, oracle, noise_p, seed=8273645):

        super(NoisyExpert, self).__init__(oracle)
        self.noise_p = noise_p
        self.rnd = np.random.RandomState(seed)

    def label(self, data, y=None):

        if len(y) == 1:
            coin = self.rnd.random_sample()

            if coin < self.noise_p:
                return 1 - y
            else:
                return y
        else:
            coin = self.rnd.random_sample(y.shape)
            new_target = y.copy()
            new_target[coin < self.noise_p] = 1 - new_target[coin < self.noise_p]
            return new_target

    def fit(self, X, y=None, vct=None):
        return self

class PredictingExpert(BaseExpert):
    """docstring for PredictingExpert"""

    def __init__(self, oracle):
        super(PredictingExpert, self).__init__(oracle)

    def label(self, data, y=None):
        return self.oracle.predict(data)

    def fit(self, data, y=None, vct=None):
        if y is not None:
            self.oracle.fit(data.bow, y)
        else:
            self.oracle.fit(data.bow, data.target)
        return self

class SentenceExpert(PredictingExpert):
    """docstring for SentenceExpert"""

    def __init__(self, oracle, tokenizer=None):
        super(SentenceExpert, self).__init__(oracle)
        self.tokenizer = tokenizer

    def convert_to_sentence(self, X, y, vct, limit=None):
        sent_train = []
        labels = []
        tokenizer = vct.build_tokenizer()
        ## Convert the documents into sentences: train
        for t, sentences in zip(y, self.tokenizer.tokenize_sents(X)):
            if limit is None:
                sents = [s for s in sentences if len(tokenizer(s)) > 1]
            elif limit > 0:
                sents = [s for s in sentences if len(s.strip()) > limit]
            elif limit == 0:
                sents = [s for s in sentences]
            sent_train.extend(sents)  # at the sentences separately as individual documents
            labels.extend([t] * len(sents))  # Give the label of the document to all its sentences

        return sent_train, labels  # , dump

    def fit(self, X_text, y=None, vct=None):
        sx, sy = self.convert_to_sentence(X_text, y, vct)
        sx = vct.transform(sx)
        self.oracle.fit(sx, sy)
        return self

class ReluctantSentenceExpert(SentenceExpert):

    def __init__(self, oracle, reluctant_threshold, tokenizer=None, seed=43212):
        super(ReluctantSentenceExpert, self).__init__(oracle, tokenizer=tokenizer)
        self.reluctant_threhold = reluctant_threshold
        self.rnd = np.random.RandomState(seed)

    def label(self, data, y=None):
        prediction = np.array([None] * data.shape[0], dtype=object)
        proba = self.oracle.predict_proba(data)
        pred = self.oracle.predict(data)
        unc = proba.min(axis=1)
        prediction[unc < self.reluctant_threhold] = pred[unc < self.reluctant_threhold]

        return prediction

class ReluctantDocumentExpert(PredictingExpert):

    def __init__(self, oracle, reluctant_threshold, seed=43212):
        super(ReluctantDocumentExpert, self).__init__(oracle)
        self.reluctant_threhold = reluctant_threshold
        self.rnd = np.random.RandomState(seed)

    def fit(self, X_text, y=None, vct=None):
        sx = vct.transform(X_text)
        self.oracle.fit(sx, y)
        return self

    def label(self, data, y=None):
        prediction = np.array([None] * data.shape[0], dtype=object)
        proba = self.oracle.predict_proba(data)
        pred = self.oracle.predict(data)
        unc = proba.min(axis=1)
        prediction[unc < self.reluctant_threhold] = pred[unc < self.reluctant_threhold]

        return prediction

class PerfectReluctantDocumentExpert(PredictingExpert):

    def __init__(self, oracle, reluctant_threshold, tokenizer=None, seed=43212):
        super(PerfectReluctantDocumentExpert, self).__init__(oracle)
        self.reluctant_threhold = reluctant_threshold
        self.rnd = np.random.RandomState(seed)

    def fit(self, X_text, y=None, vct=None):
        sx = vct.transform(X_text)
        self.oracle.fit(sx, y)
        return self

    def label(self, query, y=None):
        data = query
        if isinstance(query, dict):
            data = query.bow
        prediction = np.array([None] * data.shape[0], dtype=object)
        proba = self.oracle.predict_proba(data)
        unc = 1. - proba.max(axis=1)
        prediction[unc < self.reluctant_threhold] = y[unc < self.reluctant_threhold]

        return prediction

class TrueReluctantExpert(TrueExpert):

    def __init__(self, oracle, reluctant_p,  seed=43212):
        super(TrueReluctantExpert, self).__init__(oracle)
        self.rnd = np.random.RandomState(seed)
        self.reluctant_p = reluctant_p

    def label(self, data, y=None):

        prediction = np.array(y, dtype=object)  # copy the true labels

        coin = self.rnd.random_sample(len(y))  # flip a coin for neutral probability

        prediction[coin < self.reluctant_p] = None  ## if coin is < p then is neutral

        return prediction


text: export const removeCasomira = (casomira) => ({ type: 'CASOMIRY_REMOVE_CASOMIRA', casomira });


text:
using System;
using System.Collections.Generic;

namespace Xamarin.Forms.Platform
{

	public static class PlatformExtensions
	{

		#region Exposing Hidden Methods and Properties

		public static IReadOnlyList<T> TemplatedItems<T> (this ItemsView<T> itemsView)
            where T : BindableObject
		{
			if (itemsView == null)
				throw new ArgumentNullException ("itemsView");
			return itemsView.TemplatedItems;
		}

		public static void HandleEval (this WebView webView, Action<string> OnEval)
		{
			webView.EvalRequested += (sender, e) => OnEval (e.Data);
		}

		public static void NotifyRowTapped (this ListView view, int index)
		{
			if (view == null)
				throw new ArgumentNullException ("view");
			view.NotifyRowTapped (index);
		}

		public static void Apply (this Style style, BindableObject bindable)
		{
			if (style == null)
				throw new ArgumentNullException ("style");
			style.Apply (bindable);
		}

		public static void OnSearchButtonPressed (this SearchBar searchBar)
		{
			if (searchBar == null)
				throw new ArgumentNullException ("searchBar");
			searchBar.OnSearchButtonPressed ();
		}

		//public static void Load(this WebViewSource source, WebViewSourceLoadHandler loadHandler) {
		//    source.Load(loadHandler);
		//}

		#endregion Exposing Hidden Methods and Properties
	}
}


text:
START_ATF_NAMESPACE
    #pragma pack(push, 1)
    struct  $_TypeDescriptor$_extraBytes_147
    {
        const void *pVFTable;
        void *spare;
        char name[147];
    };
    #pragma pack(pop)
END_ATF_NAMESPACE


text:
// Task 1. class_123 in C#

// Refactor the following examples to produce code with well-named C# identifiers.

// class class_123
// {
//   const int max_count=6;
//   class InClass_class_123
//   {
//     void Метод_нА_class_InClass_class_123(bool promenliva)
//     {
//       string promenlivaKatoString=promenliva.ToString();
//       Console.WriteLine(promenlivaKatoString);
//       }
//   }
//   public static void Метод_За_Вход()
//   {
//     class_123.InClass_class_123 инстанция =
//       new class_123.InClass_class_123();
//       инстанция.Метод_нА_class_InClass_class_123(true);
//   }
// }

namespace NamingIdentyfiers
{
    using System;

    public class OfficeEquipment
    {
       private const int MaxCount = 6;

       public static void Main()
       {
           var createdPrinter = new OfficeEquipment.Printer();
           createdPrinter.Print(true);
       }

       public class Printer
       {
           public void Print(bool command)
           {
               string resultAsString = command.ToString();
               Console.WriteLine(resultAsString);
           }
       }
    }
}


text:
using System;
using NPOI.Util;

namespace NPOI.HPSF
{
    public class Array
    {
         internal class ArrayDimension
    {
        public const int SIZE = 8;

        private int _indexOffset;
        internal long _size;

        public ArrayDimension( byte[] data, int offset )
        {
            _size = LittleEndian.GetUInt( data, offset );
            _indexOffset = LittleEndian.GetInt( data, offset
                    + LittleEndian.INT_SIZE );
        }
    }

    internal class ArrayHeader
    {
        private ArrayDimension[] _dimensions;
        internal int _type;

        public ArrayHeader( byte[] data, int startOffset )
        {
            int offset = startOffset;

            _type = LittleEndian.GetInt( data, offset );
            offset += LittleEndian.INT_SIZE;

            long numDimensionsUnsigned = LittleEndian.GetUInt( data, offset );
            offset += LittleEndian.INT_SIZE;

            if ( !( 1 <= numDimensionsUnsigned && numDimensionsUnsigned <= 31 ) )
                throw new IllegalPropertySetDataException(
                        "Array dimension number " + numDimensionsUnsigned
                                + " is not in [1; 31] range" );
            int numDimensions = (int) numDimensionsUnsigned;

            _dimensions = new ArrayDimension[numDimensions];
            for ( int i = 0; i < numDimensions; i++ )
            {
                _dimensions[i] = new ArrayDimension( data, offset );
                offset += ArrayDimension.SIZE;
            }
        }

        public long NumberOfScalarValues
        {
            get
            {
                long result = 1;
                foreach (ArrayDimension dimension in _dimensions)
                    result *= dimension._size;
                return result;
            }
        }

        public int Size
        {
            get
            {
                return LittleEndian.INT_SIZE*2 + _dimensions.Length
                       *ArrayDimension.SIZE;
            }
        }

        public int Type
        {
            get { return _type; }
        }
    }

    private ArrayHeader _header;
    private TypedPropertyValue[] _values;

    public Array()
    {
    }

    public Array( byte[] data, int offset )
    {
        Read(data, offset);
    }

    public int Read( byte[] data, int startOffset )
    {
        int offset = startOffset;

        _header = new ArrayHeader( data, offset );
        offset += _header.Size;

        long numberOfScalarsLong = _header.NumberOfScalarValues;
        if ( numberOfScalarsLong > int.MaxValue )
            throw new InvalidOperationException(
                    "Sorry, but POI can't store array of properties with size of "
                            + numberOfScalarsLong + " in memory" );
        int numberOfScalars = (int) numberOfScalarsLong;

        _values = new TypedPropertyValue[numberOfScalars];
        int type = _header._type;
        if ( type == Variant.VT_VARIANT )
        {
            for ( int i = 0; i < numberOfScalars; i++ )
            {
                TypedPropertyValue typedPropertyValue = new TypedPropertyValue();
                offset += typedPropertyValue.Read( data, offset );
            }
        }
        else
        {
            for ( int i = 0; i < numberOfScalars; i++ )
            {
                TypedPropertyValue typedPropertyValue = new TypedPropertyValue(
                        type, null );
                offset += typedPropertyValue.ReadValuePadded( data, offset );
            }
        }

        return offset - startOffset;
    }
    }
}


text:
An image that includes pre populated ivy repos for the base Play framework.

It uses an activator image to create a new plain and default Play application.

Then updates the play versions and builds the application and downloads the required libraries.
It then removes the actual application but preservers the ivy repositories.


text:
Dott is a simple shell script I wrote to manage [my dotfiles][]. It handles the
updating and symlinking into `$HOME` of all my dotfiles, kept in a Git
repository.

## Installation

To install dott, simply put the `dott` file somewhere in your `$PATH` and make it
executable. One way to do so would be:

    % curl https://raw.githubusercontent.com/avdgaag/dott/master/dott > /usr/local/bin/dott
    % chmod +x /usr/local/bin/dott

You can test if everything works alright by running `dott --version`. You should
see something along these lines:

    % dott --version
    0.1.0

## Usage

Here is the help contents displayed when you run `dott --help`:

    Usage: dott [subcommand] [options]

    Available subcommands:

      clone          Install dotfiles from a Git repository into ~/.dotfiles
      update         Fetch new commits from the remote repository and optionally
                     update subtree-merged remote repositories.
      link           Symlink all the files in the dotfiles directory into the
                     home directory.
      unlink         Remove symlinks to files in the dotfiles directory from
                     the home directory.

    Options for update:

      -s, --subtrees Also fetch new commits for merged subtrees and squash them
                     into the local repository. This reads subtree directories
                     and repositories from ~/.dotfiles/.gitsubtrees.

    Options for link:

      -f, --force    Overwrite files even if they already exist.
      -p, --pretend  Display results but don't actually change anything

    Options for unlink:

      -p, --pretend  Display results but don't actually change anything

    Generic options:

      -v, --version  Show version information
      -h, --help     Show this message

A normal workflow would be to first install your personal dotfiles from a Git
repository in your local home directory:

    % dott clone git@github.com:avdgaag/dotfiles.git

This will clone the repository into `~/.dotfiles`.

Then, symlink all the files from `~/.dotfiles/home` into `$HOME`:

    % dott link

To overwrite any existing files, use the `--force` flag:

    % dott link --force

To clean up again, remove all your symlinks using `unlink`:

    % dott unlink

To update your `~/.dotfiles` directory from its remote repository,
use `dott update`:

    % dott update

My personal dotfiles repo has a list of other repositories merged into it using
a Git subtree merge. Dott can update these repositories automatically by adding
the `--subtrees` flag to `dott update`:

    % dott update --subtrees

## Credits and links

**Author**: Arjan van der Gaag <arjan@arjanvandergaag.nl>
**Date**: August 2014
**Website**: http://avdgaag.github.io/dott
**Issues** https://github.com/avdgaag/dott/issues
**Source** https://github.com/avdgaag/dott
**Changelog** See CHANGELOG.md

## License

Dott is released under the MIT license (see LICENSE).

[my dotfiles]: https://github.com/avdgaag/dotfiles


text:
namespace attachment_store_pb {
class RecordMetadata;
}  // namespace attachment_store_pb

namespace base {
class SequencedTaskRunner;
}  // namespace base

namespace leveldb {
class DB;
}  // namespace leveldb

namespace syncer {

// On-disk implementation of AttachmentStore. Stores attachments in leveldb
// database in |path| directory.
class SYNC_EXPORT OnDiskAttachmentStore : public AttachmentStoreBackend,
                                          public base::NonThreadSafe {
 public:
  // Constructs attachment store.
  OnDiskAttachmentStore(
      const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner,
      const base::FilePath& path);
  ~OnDiskAttachmentStore() override;

  // AttachmentStoreBackend implementation.
  void Init(const AttachmentStore::InitCallback& callback) override;
  void Read(const AttachmentIdList& ids,
            const AttachmentStore::ReadCallback& callback) override;
  void Write(const AttachmentList& attachments,
             const AttachmentStore::WriteCallback& callback) override;
  void Drop(const AttachmentIdList& ids,
            const AttachmentStore::DropCallback& callback) override;
  void ReadMetadata(
      const AttachmentIdList& ids,
      const AttachmentStore::ReadMetadataCallback& callback) override;
  void ReadAllMetadata(
      const AttachmentStore::ReadMetadataCallback& callback) override;

 private:
  friend class OnDiskAttachmentStoreSpecificTest;

  // Opens leveldb database at |path|, creating it if needed. In the future
  // upgrade code will be invoked from OpenOrCreate as well. If open fails
  // result is UNSPECIFIED_ERROR.
  AttachmentStore::Result OpenOrCreate(const base::FilePath& path);
  // Reads single attachment from store. Returns nullptr in case of errors.
  scoped_ptr<Attachment> ReadSingleAttachment(
      const AttachmentId& attachment_id);
  // Writes single attachment to store. Returns false in case of errors.
  bool WriteSingleAttachment(const Attachment& attachment);
  // Reads single store_pb::RecordMetadata from levelDB into the provided
  // buffer. Returns false in case of an error.
  bool ReadSingleRecordMetadata(
      const AttachmentId& attachment_id,
      attachment_store_pb::RecordMetadata* record_metadata);

  static std::string MakeDataKeyFromAttachmentId(
      const AttachmentId& attachment_id);
  static std::string MakeMetadataKeyFromAttachmentId(
      const AttachmentId& attachment_id);
  static AttachmentMetadata MakeAttachmentMetadata(
      const AttachmentId& attachment_id,
      const attachment_store_pb::RecordMetadata& record_metadata);

  const base::FilePath path_;
  scoped_ptr<leveldb::DB> db_;

  DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore);
};

}  // namespace syncer

#endif  // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_