/**

 * See the file "license.terms" for information on usage and
 * redistribution of this file, and for a DISCLAIMER OF ALL
 * WARRANTIES.
 *

 *

 */

package edu.cmu.sphinx.tools.riddler.shared;

import edu.cmu.sphinx.tools.riddler.shared.MetadataWrapper;

import java.net.URI;
import java.rmi.RemoteException;
import java.util.*;
import javax.ejb.Remote;

/**
 * Interface for Riddler, the corpus creation and training tool for Sphinx.
 * @author Garrett Weinberg
 */
@Remote
public interface RiddlerRemote {

    /**
     * Kick off a model training operation, given a suitable (i.e. full) Corpus
     * @param corpusID Corpus from which the models should be trained
     * @return a URI pointing to an RSS feed that will contain the models matching this request
     */
    public URI trainModelsFromCorpus(String corpusID);

    /**
     * Kick off a model training operation that uses multiple Corpora
     * @param corpusIDs Corpora from which the models should be trained
     * @return a URI pointing to an RSS feed that will contain the models matching this request
     */
    public URI trainModelsFromCorpora(ArrayList<String> corpusIDs);

    /**
     * Get a valid identifier for a new Dictionary
     * @return the new Dictionary's identifier
     * @throws RemoteException if a Dictionary with the given metadata already exists @param metadata a map of metadata about the Dictionary
     */
    public String createDictionary(MetadataWrapper metadata) throws RemoteException;

    /**
     * Get a Dictionary matching the provided descriptor
     * @return the existing Dictionary's identifier
     * @throws RemoteException if no Dictionary matching the metadata exists @param metadata metadata for the Dictionary you're trying to retrieve
     */
    public String getDictionary(MetadataWrapper metadata) throws RemoteException;

    /**
     * Fetch the DictionaryDescriptor matching the provided ID
     * @param dictionaryID an existing Dictionary identifier
     * @return the metadata provided when the given Dictionary was created
     * @throws java.rmi.RemoteException if the provided ID is invalid
     */
    public MetadataWrapper getDictionaryMetadata(String dictionaryID) throws RemoteException;

    /**
     * Create a Pronunciation record (case insensitive).
     * @return the new Pronunciation's identifier
     * @throws RemoteException if the word contained in the given PronunciationDescriptor already
     * has an entry in the given dictionary @param dictionaryID Dictionary in which the entry should be created
     * @param word the word to be added to the specified dictionary
     * @param pronunciations main and any variant pronunciations of the word
     */
    public String addPronuncations(String dictionaryID, String word, ArrayList<String> pronunciations) throws RemoteException;

    /**
     * Check whether a Pronunciation record exists for the given word (case insensitive)
     * @param dictionaryID Dictionary in which the entry should be created
     * @param word word that should be queried
     * @return true if the word has at least one pronunciation
     */
    public boolean hasPronuncation(String dictionaryID, String word) throws RemoteException;

    /**
     * Get a valid identifier for a new Corpus
     * @return a new Corpus identifier
     * @param dictionaryID Dictionary with which this Corpus should be associated
     * @param metadata map of metadata about this corpus
     * @param collectDate date with which this corpus should be associated (e.g. date when data collection
     * began or ended)
     */
    public String createCorpus(String dictionaryID, MetadataWrapper metadata, Date collectDate);

    /**
     * Deeply create a new, empty Item record associated with the given Corpus.
     * Also creates corresponding Audio and Text records, each consisting of a single
     * RegionOfAudio and RegionOfText, respectively.
     * @param corpusId Corpus to which the Item should be added
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     */
    public String createItem(String corpusId);

    /**
     * Deeply create a new Item record with exactly one Audio record containing one RegionOfAudio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     */
    public String createItemWithShortAudio(String corpusId, int samplesPerSecond, int channelCount, short[] data);

    /**
     * Deeply create a new Item record with exactly one Audio record containing one RegionOfAudio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     */
    public String createItemWithByteAudio(String corpusId, int samplesPerSecond, int channelCount, byte[] data);

    /**
     * Deeply create a new Item record with exactly one Audio record containing one RegionOfAudio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     */
    public String createItemWithIntAudio(String corpusId, int samplesPerSecond, int channelCount, int[] data);

    /**
     * Deeply create a new Item record with exactly one Audio record containing one RegionOfAudio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     */
    public String createItemWithLongAudio(String corpusId, int samplesPerSecond, int channelCount, long[] data);

    /**
     * Deeply create a new Item record with exactly one Audio record containing one RegionOfAudio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     */
    public String createItemWithFloatAudio(String corpusId, int samplesPerSecond, int channelCount, float[] data);

    /**
     * Deeply create a new Item record with exactly one Text record containing one RegionOfText.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @throws RemoteException if the words list contains a word not found in the
     * provided Corpus' Dictionary
     * @param corpusId Corpus to which the Item should be added
     * @param words text with which the Item should be created; note that a List is used
     * because not all languages use spaces consistently as word delimiters
     */
    public String createItemWithText(String corpusId, ArrayList<String> words);

    /**
     * Deeply create a new Item record with one Audio record and one Text record.  The Audio
     * record contains one RegionOfAudio that points to the Text record's single RegionOfText.

     * This method should be used to indicate that the Text is a transcript of the Audio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @throws RemoteException if the words list contains a word not found in the
     * provided Corpus' Dictionary
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     * @param words transcript of the audio being sent
     */
    public String createItemWithShortAudioAndText(String corpusId, int samplesPerSecond, int channelCount, short[] data, ArrayList<String> words);

    /**
     * Deeply create a new Item record with one Audio record and one Text record.  The Audio
     * record contains one RegionOfAudio that points to the Text record's single RegionOfText.

     * This method should be used to indicate that the Text is a transcript of the Audio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @throws RemoteException if the words list contains a word not found in the
     * provided Corpus' Dictionary
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     * @param words transcript of the audio being sent
     */
    public String createItemWithByteAudioAndText(String corpusId,  int samplesPerSecond, int channelCount, byte[] data, ArrayList<String> words);

    /**
     * Deeply create a new Item record with one Audio record and one Text record.  The Audio
     * record contains one RegionOfAudio that points to the Text record's single RegionOfText.

     * This method should be used to indicate that the Text is a transcript of the Audio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @throws RemoteException if the words list contains a word not found in the
     * provided Corpus' Dictionary
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     * @param words transcript of the audio being sent
     */
    public String createItemWithIntAudioAndText(String corpusId,  int samplesPerSecond, int channelCount, int[] data, ArrayList<String> words);

    /**
     * Deeply create a new Item record with one Audio record and one Text record.  The Audio
     * record contains one RegionOfAudio that points to the Text record's single RegionOfText.

     * This method should be used to indicate that the Text is a transcript of the Audio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @throws RemoteException if the words list contains a word not found in the
     * provided Corpus' Dictionary
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     * @param words transcript of the audio being sent
     */
    public String createItemWithLongAudioAndText(String corpusId,  int samplesPerSecond, int channelCount, long[] data, ArrayList<String> words);

    /**
     * Deeply create a new Item record with one Audio record and one Text record.  The Audio
     * record contains one RegionOfAudio that points to the Text record's single RegionOfText.

     * This method should be used to indicate that the Text is a transcript of the Audio.
     * @return the ID of an Item with valid deep linkages to its newly-created component records
     * @throws RemoteException if the words list contains a word not found in the
     * provided Corpus' Dictionary
     * @param corpusId Corpus to which the Item should be added
     * @param samplesPerSecond samples per second
     * @param channelCount number of audio channels
     * @param data audio data itself
     * @param words transcript of the audio being sent
     */
    public String createItemWithFloatAudioAndText(String corpusId,  int samplesPerSecond, int channelCount, float[] data, ArrayList<String> words);

    /**
     * Add a RegionOfText to the given Item
     * @return a Text identifier representing the newly created record
     * @param itemID Item record to which the new RegionOfText should be added
     * @param startIndex index of the word at which this text region begins
     * @param endIndex index of the word at which this text region ends
     * @see RiddlerRemote#createItemWithText(String, java.util.ArrayList)
     */
    public String createTextRegion(String itemID, int startIndex, int endIndex);

    /**
     * Add a RegionOfAudio to the given Item
     * @return an Audio identifier representing the newly created record
     * @param itemID Item record to which the new RegionOfAudio should be added
     * @param beginTime time (in milliseconds) within the parent Audio record when this region begins
     * @param endTime time (in milliseconds) within the parent Audio record when this region ends
     */
    public String createAudioRegion(String itemID, int beginTime, int endTime);

    /**
     * Add a RegionOfAudio to the given Item, associating it with the given RegionOfText
     * @return an Audio identifier representing the newly created record
     * @param itemID Item to which the matched regions should be added
     * @param beginTime time (in milliseconds) within the parent Audio record when this region begins
     * @param endTime time (in milliseconds) within the parent Audio record when this region ends
     * @param startIndex index of the word at which this text region begins
     * @param endIndex index of the word at which this text region ends
     */
    public String createAudioRegionWithText(String itemID, int beginTime, int endTime, int startIndex, int endIndex);

    /**
     * Link a pre-existing audio region to a pre-existing text region
     * @param audioID ID of an Audio record
     * @param textID ID of a Text record
     * @throws RemoteException if either the audio or text ID's are invalid
     */
    public void associateAudioRegionWithText(String audioID, String textID);
}

{'repo_name': 'cjac/cmusphinx', 'stars': '109', 'repo_language': 'C', 'file_name': 'sphinxman_manual.html', 'mime_type': 'text/html', 'hash': 6134721010253501170, 'source_dataset': 'data'}


config BR2_PACKAGE_WSAPI
	bool "wsapi"
	select BR2_PACKAGE_COXPCALL if BR2_PACKAGE_LUA_5_1 # runtime
	select BR2_PACKAGE_LUAFILESYSTEM # runtime
	select BR2_PACKAGE_RINGS # runtime
	help
	  API that abstracts the web server from Lua web applications.

	  https://keplerproject.github.io/wsapi/

{'repo_name': 'buildroot/buildroot', 'stars': '1103', 'repo_language': 'Makefile', 'file_name': 'Config.in', 'mime_type': 'text/plain', 'hash': -4888067921738801261, 'source_dataset': 'data'}


fileFormatVersion: 2
guid: 25096163ea08801469d628d2389714bf
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:

{'repo_name': 'umutbebek/shadertoy-to-unity-URP', 'stars': '175', 'repo_language': 'GLSL', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': -5445585209808736155, 'source_dataset': 'data'}


/**
 * Module dependencies.
 */

var debug = require('debug')('koa-mount');
var compose = require('koa-compose');
var assert = require('assert');

/**
 * Expose `mount()`.
 */

module.exports = mount;

/**
 * Mount `app` with `prefix`, `app`
 * may be a Koa application or
 * middleware function.
 *
 * @param {String|Application|Function} prefix, app, or function
 * @param {Application|Function} [app or function]
 * @return {Function}
 * @api public
 */

function mount(prefix, app) {
  if ('string' != typeof prefix) {
    app = prefix;
    prefix = '/';
  }

  assert('/' == prefix[0], 'mount path must begin with "/"');

  // compose
  var downstream = app.middleware
    ? compose(app.middleware)
    : app;

  // don't need to do mounting here
  if ('/' == prefix) return downstream;

  var trailingSlash = '/' == prefix.slice(-1);

  var name = app.name || 'unnamed';
  debug('mount %s %s', prefix, name);

  return function *(upstream){
    var prev = this.path;
    var newPath = match(prev);
    debug('mount %s %s -> %s', prefix, name, newPath);
    if (!newPath) return yield* upstream;

    this.mountPath = prefix;
    this.path = newPath;
    debug('enter %s -> %s', prev, this.path);

    yield* downstream.call(this, function *(){
      this.path = prev;
      yield* upstream;
      this.path = newPath;
    }.call(this));

    debug('leave %s -> %s', prev, this.path);
    this.path = prev;
  }

  /**
   * Check if `prefix` satisfies a `path`.
   * Returns the new path.
   *
   * match('/images/', '/lkajsldkjf') => false
   * match('/images', '/images') => /
   * match('/images/', '/images') => false
   * match('/images/', '/images/asdf') => /asdf
   *
   * @param {String} prefix
   * @param {String} path
   * @return {String|Boolean}
   * @api private
   */

  function match(path) {
    // does not match prefix at all
    if (0 != path.indexOf(prefix)) return false;

    var newPath = path.replace(prefix, '') || '/';
    if (trailingSlash) return newPath;

    // `/mount` does not match `/mountlkjalskjdf`
    if ('/' != newPath[0]) return false;
    return newPath;
  }
}

{'repo_name': 'zhangmengxue/React-Code-Snippet', 'stars': '304', 'repo_language': 'None', 'file_name': 'prefix-source-map.jsm', 'mime_type': 'text/plain', 'hash': -594915647769331269, 'source_dataset': 'data'}


"""
"""

# Created on 2013.05.15
#
# Author: Giovanni Cannata
#
# Copyright 2014 - 2020 Giovanni Cannata
#
# This file is part of ldap3.
#
# ldap3 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ldap3 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with ldap3 in the COPYING and COPYING.LESSER files.
# If not, see <http://www.gnu.org/licenses/>.

#######################
# ldap ASN.1 Definition
# from RFC4511 - Appendix B
# extended with result codes from IANA ldap-parameters as of 2013.08.21
# extended with modify_increment from RFC4525

#########################################################
# Lightweight-Directory-Access-Protocol-V3 {1 3 6 1 1 18}
# -- Copyright (C) The Internet Society (2006).  This version of
# -- this ASN.1 module is part of RFC 4511; see the RFC itself
# -- for full legal notices.
# DEFINITIONS
# IMPLICIT TAGS
# EXTENSIBILITY IMPLIED

from pyasn1.type.univ import OctetString, Integer, Sequence, Choice, SequenceOf, Boolean, Null, Enumerated, SetOf
from pyasn1.type.namedtype import NamedTypes, NamedType, OptionalNamedType, DefaultedNamedType
from pyasn1.type.constraint import ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint
from pyasn1.type.namedval import NamedValues
from pyasn1.type.tag import tagClassApplication, tagFormatConstructed, Tag, tagClassContext, tagFormatSimple

# constants
# maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
LDAP_MAX_INT = 2147483647
MAXINT = Integer(LDAP_MAX_INT)

# constraints
rangeInt0ToMaxConstraint = ValueRangeConstraint(0, MAXINT)
rangeInt1To127Constraint = ValueRangeConstraint(1, 127)
size1ToMaxConstraint = ValueSizeConstraint(1, MAXINT)
responseValueConstraint = SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 32, 33, 34, 36, 48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 71, 80, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
                                                4096)

# custom constraints
numericOIDConstraint = None  # TODO
distinguishedNameConstraint = None  # TODO
nameComponentConstraint = None  # TODO
attributeDescriptionConstraint = None  # TODO
uriConstraint = None  # TODO
attributeSelectorConstraint = None  # TODO

class Integer0ToMax(Integer):
    subtypeSpec = Integer.subtypeSpec + rangeInt0ToMaxConstraint

class LDAPString(OctetString):
    # LDAPString ::= OCTET STRING -- UTF-8 encoded, -- [ISO10646] characters
    encoding = 'utf-8'

class MessageID(Integer0ToMax):
    # MessageID ::= INTEGER (0 ..  maxInt)
    pass

class LDAPOID(OctetString):
    # LDAPOID ::= OCTET STRING -- Constrained to <numericoid>
    #                             -- [RFC4512]

    # subtypeSpec = numericOIDConstraint
    pass

class LDAPDN(LDAPString):
    # LDAPDN ::= LDAPString -- Constrained to <distinguishedName>
    #                         -- [RFC4514]

    # subtypeSpec = distinguishedName
    pass

class RelativeLDAPDN(LDAPString):
    # RelativeLDAPDN ::= LDAPString -- Constrained to <name-component>
    #                         -- [RFC4514]

    # subtypeSpec = LDAPString.subtypeSpec + nameComponentConstraint
    pass

class AttributeDescription(LDAPString):
    # AttributeDescription ::= LDAPString -- Constrained to <attributedescription>
    #                         -- [RFC4512]

    # subtypeSpec = LDAPString.subtypeSpec + attributeDescriptionConstraint
    pass

class AttributeValue(OctetString):
    # AttributeValue ::= OCTET STRING
    encoding = 'utf-8'

class AssertionValue(OctetString):
    # AssertionValue ::= OCTET STRING
    encoding = 'utf-8'

class AttributeValueAssertion(Sequence):
    # AttributeValueAssertion ::= SEQUENCE {
    #     attributeDesc   AttributeDescription,
    #     assertionValue  AssertionValue }
    componentType = NamedTypes(NamedType('attributeDesc', AttributeDescription()),
                               NamedType('assertionValue', AssertionValue()))

class MatchingRuleId(LDAPString):
    # MatchingRuleId ::= LDAPString
    pass

class Vals(SetOf):
    # vals       SET OF value AttributeValue }
    componentType = AttributeValue()

class ValsAtLeast1(SetOf):
    # vals       SET OF value AttributeValue }
    componentType = AttributeValue()
    subtypeSpec = SetOf.subtypeSpec + size1ToMaxConstraint

class PartialAttribute(Sequence):
    # PartialAttribute ::= SEQUENCE {
    #     type       AttributeDescription,
    #     vals       SET OF value AttributeValue }
    componentType = NamedTypes(NamedType('type', AttributeDescription()),
                               NamedType('vals', Vals()))

class Attribute(Sequence):
    # Attribute ::= PartialAttribute(WITH COMPONENTS {
    #     ...,
    #     vals (SIZE(1..MAX))})
    componentType = NamedTypes(NamedType('type', AttributeDescription()),
                               # NamedType('vals', ValsAtLeast1()))
                               NamedType('vals', Vals()))  # changed from ValsAtLeast1() to allow empty member values in groups - this should not be as per rfc4511 4.1.7, but openldap accept it

class AttributeList(SequenceOf):
    # AttributeList ::= SEQUENCE OF attribute Attribute
    componentType = Attribute()

class Simple(OctetString):
    # simple                  [0] OCTET STRING,
    tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 0))
    encoding = 'utf-8'

class Credentials(OctetString):
    # credentials             OCTET STRING
    encoding = 'utf-8'

class SaslCredentials(Sequence):
    # SaslCredentials ::= SEQUENCE {
    #     mechanism               LDAPString,
    #     credentials             OCTET STRING OPTIONAL }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 3))
    componentType = NamedTypes(NamedType('mechanism', LDAPString()),
                               OptionalNamedType('credentials', Credentials()))

# not in RFC4511 but used by Microsoft to embed the NTLM protocol in the BindRequest (Sicily Protocol)
class SicilyPackageDiscovery(OctetString):
    # sicilyPackageDiscovery  [9] OCTET STRING,
    tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 9))
    encoding = 'utf-8'

# not in RFC4511 but used by Microsoft to embed the NTLM protocol in the BindRequest (Sicily Protocol)
class SicilyNegotiate(OctetString):
    # sicilyNegotiate  [10] OCTET STRING,
    tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 10))
    encoding = 'utf-8'

# not in RFC4511 but used by Microsoft to embed the NTLM protocol in the BindRequest (Sicily Protocol)
class SicilyResponse(OctetString):
    # sicilyResponse  [11] OCTET STRING,
    tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 11))
    encoding = 'utf-8'

class AuthenticationChoice(Choice):
    # AuthenticationChoice ::= CHOICE {
    #     simple                  [0] OCTET STRING,
    #                             -- 1 and 2 reserved
    #     sasl                    [3] SaslCredentials,
    # ... }

    # from https://msdn.microsoft.com/en-us/library/cc223498.aspx  # legacy NTLM authentication for Windows Active Directory
    # sicilyPackageDiscovery [9]    OCTET STRING
    # sicilyNegotiate        [10]   OCTET STRING
    # sicilyResponse         [11]   OCTET STRING  }

    componentType = NamedTypes(NamedType('simple', Simple()),
                               NamedType('sasl', SaslCredentials()),
                               NamedType('sicilyPackageDiscovery', SicilyPackageDiscovery()),
                               NamedType('sicilyNegotiate', SicilyNegotiate()),
                               NamedType('sicilyResponse', SicilyResponse()),
                               )

class Version(Integer):
    # version                 INTEGER (1 ..  127),
    subtypeSpec = Integer.subtypeSpec + rangeInt1To127Constraint

class ResultCode(Enumerated):
    # resultCode         ENUMERATED {
    #     success                      (0),
    #     operationsError              (1),
    #     protocolError                (2),
    #     timeLimitExceeded            (3),
    #     sizeLimitExceeded            (4),
    #     compareFalse                 (5),
    #     compareTrue                  (6),
    #     authMethodNotSupported       (7),
    #     strongerAuthRequired         (8),
    #          -- 9 reserved --
    #     referral                     (10),
    #     adminLimitExceeded           (11),
    #     unavailableCriticalExtension (12),
    #     confidentialityRequired      (13),
    #     saslBindInProgress           (14),
    #     noSuchAttribute              (16),
    #     undefinedAttributeType       (17),
    #     inappropriateMatching        (18),
    #     constraintViolation          (19),
    #     attributeOrValueExists       (20),
    #     invalidAttributeSyntax       (21),
    #          -- 22-31 unused --
    #     noSuchObject                 (32),
    #     aliasProblem                 (33),
    #     invalidDNSyntax              (34),
    #          -- 35 reserved for undefined isLeaf --
    #     aliasDereferencingProblem    (36),
    #          -- 37-47 unused --
    #     inappropriateAuthentication  (48),
    #     invalidCredentials           (49),
    #     insufficientAccessRights     (50),
    #     busy                         (51),
    #     unavailable                  (52),
    #     unwillingToPerform           (53),
    #     loopDetect                   (54),
    #          -- 55-63 unused --
    #     namingViolation              (64),
    #     objectClassViolation         (65),
    #     notAllowedOnNonLeaf          (66),
    #     notAllowedOnRDN              (67),
    #     entryAlreadyExists           (68),
    #     objectClassModsProhibited    (69),
    #          -- 70 reserved for CLDAP --
    #     affectsMultipleDSAs          (71),
    #          -- 72-79 unused --
    #     other                        (80),
    #     ...  }
    #
    #     from IANA ldap-parameters:
    #     lcupResourcesExhausted        113        IESG                             [RFC3928]
    #     lcupSecurityViolation         114        IESG                             [RFC3928]
    #     lcupInvalidData               115        IESG                             [RFC3928]
    #     lcupUnsupportedScheme         116        IESG                             [RFC3928]
    #     lcupReloadRequired            117        IESG                             [RFC3928]
    #     canceled                      118        IESG                             [RFC3909]
    #     noSuchOperation               119        IESG                             [RFC3909]
    #     tooLate                       120        IESG                             [RFC3909]
    #     cannotCancel                  121        IESG                             [RFC3909]
    #     assertionFailed               122        IESG                             [RFC4528]
    #     authorizationDenied           123        WELTMAN                          [RFC4370]
    #     e-syncRefreshRequired         4096       [Kurt_Zeilenga] [Jong_Hyuk_Choi] [RFC4533]
    namedValues = NamedValues(('success', 0),
                              ('operationsError', 1),
                              ('protocolError', 2),
                              ('timeLimitExceeded', 3),
                              ('sizeLimitExceeded', 4),
                              ('compareFalse', 5),
                              ('compareTrue', 6),
                              ('authMethodNotSupported', 7),
                              ('strongerAuthRequired', 8),
                              ('referral', 10),
                              ('adminLimitExceeded', 11),
                              ('unavailableCriticalExtension', 12),
                              ('confidentialityRequired', 13),
                              ('saslBindInProgress', 14),
                              ('noSuchAttribute', 16),
                              ('undefinedAttributeType', 17),
                              ('inappropriateMatching', 18),
                              ('constraintViolation', 19),
                              ('attributeOrValueExists', 20),
                              ('invalidAttributeSyntax', 21),
                              ('noSuchObject', 32),
                              ('aliasProblem', 33),
                              ('invalidDNSyntax', 34),
                              ('aliasDereferencingProblem', 36),
                              ('inappropriateAuthentication', 48),
                              ('invalidCredentials', 49),
                              ('insufficientAccessRights', 50),
                              ('busy', 51),
                              ('unavailable', 52),
                              ('unwillingToPerform', 53),
                              ('loopDetected', 54),
                              ('namingViolation', 64),
                              ('objectClassViolation', 65),
                              ('notAllowedOnNonLeaf', 66),
                              ('notAllowedOnRDN', 67),
                              ('entryAlreadyExists', 68),
                              ('objectClassModsProhibited', 69),
                              ('affectMultipleDSAs', 71),
                              ('other', 80),
                              ('lcupResourcesExhausted', 113),
                              ('lcupSecurityViolation', 114),
                              ('lcupInvalidData', 115),
                              ('lcupUnsupportedScheme', 116),
                              ('lcupReloadRequired', 117),
                              ('canceled', 118),
                              ('noSuchOperation', 119),
                              ('tooLate', 120),
                              ('cannotCancel', 121),
                              ('assertionFailed', 122),
                              ('authorizationDenied', 123),
                              ('e-syncRefreshRequired', 4096))

    subTypeSpec = Enumerated.subtypeSpec + responseValueConstraint

class URI(LDAPString):
    # URI ::= LDAPString     -- limited to characters permitted in
    #                      -- URIs

    # subtypeSpec = LDAPString.subTypeSpec + uriConstrain
    pass

class Referral(SequenceOf):
    # Referral ::= SEQUENCE SIZE (1..MAX) OF uri URI
    tagSet = SequenceOf.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 3))
    componentType = URI()

class ServerSaslCreds(OctetString):
    # serverSaslCreds    [7] OCTET STRING OPTIONAL
    tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 7))
    encoding = 'utf-8'

class LDAPResult(Sequence):
    # LDAPResult ::= SEQUENCE {
    #     resultCode         ENUMERATED {
    #         success                      (0),
    #         operationsError              (1),
    #         protocolError                (2),
    #         timeLimitExceeded            (3),
    #         sizeLimitExceeded            (4),
    #         compareFalse                 (5),
    #         compareTrue                  (6),
    #         authMethodNotSupported       (7),
    #         strongerAuthRequired         (8),
    #              -- 9 reserved --
    #         referral                     (10),
    #         adminLimitExceeded           (11),
    #         unavailableCriticalExtension (12),
    #         confidentialityRequired      (13),
    #         saslBindInProgress           (14),
    #         noSuchAttribute              (16),
    #         undefinedAttributeType       (17),
    #         inappropriateMatching        (18),
    #         constraintViolation          (19),
    #         attributeOrValueExists       (20),
    #         invalidAttributeSyntax       (21),
    #              -- 22-31 unused --
    #         noSuchObject                 (32),
    #         aliasProblem                 (33),
    #         invalidDNSyntax              (34),
    #              -- 35 reserved for undefined isLeaf --
    #         aliasDereferencingProblem    (36),
    #              -- 37-47 unused --
    #         inappropriateAuthentication  (48),
    #         invalidCredentials           (49),
    #         insufficientAccessRights     (50),
    #         busy                         (51),
    #         unavailable                  (52),
    #         unwillingToPerform           (53),
    #         loopDetect                   (54),
    #              -- 55-63 unused --
    #         namingViolation              (64),
    #         objectClassViolation         (65),
    #         notAllowedOnNonLeaf          (66),
    #         notAllowedOnRDN              (67),
    #         entryAlreadyExists           (68),
    #         objectClassModsProhibited    (69),
    #              -- 70 reserved for CLDAP --
    #         affectsMultipleDSAs          (71),
    #              -- 72-79 unused --
    #         other                        (80),
    #         ...  },
    #     matchedDN          LDAPDN,
    #     diagnosticMessage  LDAPString,
    #     referral           [3] Referral OPTIONAL }
    componentType = NamedTypes(NamedType('resultCode', ResultCode()),
                               NamedType('matchedDN', LDAPDN()),
                               NamedType('diagnosticMessage', LDAPString()),
                               OptionalNamedType('referral', Referral()))

class Criticality(Boolean):
    # criticality             BOOLEAN DEFAULT FALSE
    defaultValue = False

class ControlValue(OctetString):
    # controlValue            OCTET STRING
    encoding = 'utf-8'

class Control(Sequence):
    # Control ::= SEQUENCE {
    #     controlType             LDAPOID,
    #     criticality             BOOLEAN DEFAULT FALSE,
    #     controlValue            OCTET STRING OPTIONAL }
    componentType = NamedTypes(NamedType('controlType', LDAPOID()),
                               DefaultedNamedType('criticality', Criticality()),
                               OptionalNamedType('controlValue', ControlValue()))

class Controls(SequenceOf):
    # Controls ::= SEQUENCE OF control Control
    tagSet = SequenceOf.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 0))
    componentType = Control()

class Scope(Enumerated):
    # scope           ENUMERATED {
    #     baseObject              (0),
    #     singleLevel             (1),
    #     wholeSubtree            (2),
    namedValues = NamedValues(('baseObject', 0),
                              ('singleLevel', 1),
                              ('wholeSubtree', 2))

class DerefAliases(Enumerated):
    # derefAliases    ENUMERATED {
    #     neverDerefAliases       (0),
    #     derefInSearching        (1),
    #     derefFindingBaseObj     (2),
    #     derefAlways             (3) },
    namedValues = NamedValues(('neverDerefAliases', 0),
                              ('derefInSearching', 1),
                              ('derefFindingBaseObj', 2),
                              ('derefAlways', 3))

class TypesOnly(Boolean):
    # typesOnly       BOOLEAN
    pass

class Selector(LDAPString):
    #     -- The LDAPString is constrained to
    #     -- <attributeSelector> in Section 4.5.1.8

    # subtypeSpec = LDAPString.subtypeSpec + attributeSelectorConstraint
    pass

class AttributeSelection(SequenceOf):
    # AttributeSelection ::= SEQUENCE OF selector LDAPString
    #     -- The LDAPString is constrained to
    #     -- <attributeSelector> in Section 4.5.1.8
    componentType = Selector()

class MatchingRule(MatchingRuleId):
    # matchingRule    [1] MatchingRuleId
    tagSet = MatchingRuleId.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 1))

class Type(AttributeDescription):
    # type            [2] AttributeDescription
    tagSet = AttributeDescription.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 2))

class MatchValue(AssertionValue):
    # matchValue      [3] AssertionValue,
    tagSet = AssertionValue.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 3))

class DnAttributes(Boolean):
    # dnAttributes    [4] BOOLEAN DEFAULT FALSE }
    tagSet = Boolean.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 4))
    defaultValue = Boolean(False)

class MatchingRuleAssertion(Sequence):
    # MatchingRuleAssertion ::= SEQUENCE {
    #     matchingRule    [1] MatchingRuleId OPTIONAL,
    #     type            [2] AttributeDescription OPTIONAL,
    #     matchValue      [3] AssertionValue,
    #     dnAttributes    [4] BOOLEAN DEFAULT FALSE }
    componentType = NamedTypes(OptionalNamedType('matchingRule', MatchingRule()),
                               OptionalNamedType('type', Type()),
                               NamedType('matchValue', MatchValue()),
                               DefaultedNamedType('dnAttributes', DnAttributes()))

class Initial(AssertionValue):
    # initial [0] AssertionValue,  -- can occur at most once
    tagSet = AssertionValue.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 0))

class Any(AssertionValue):
    # any [1] AssertionValue,
    tagSet = AssertionValue.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 1))

class Final(AssertionValue):
    # final [1] AssertionValue,  -- can occur at most once
    tagSet = AssertionValue.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 2))

class Substring(Choice):
    # substring CHOICE {
    #     initial [0] AssertionValue,  -- can occur at most once
    #     any     [1] AssertionValue,
    #     final   [2] AssertionValue } -- can occur at most once
    #     }
    componentType = NamedTypes(NamedType('initial', Initial()),
                               NamedType('any', Any()),
                               NamedType('final', Final()))

class Substrings(SequenceOf):
    # substrings     SEQUENCE SIZE (1..MAX) OF substring CHOICE {
    # ...
    # }
    subtypeSpec = SequenceOf.subtypeSpec + size1ToMaxConstraint
    componentType = Substring()

class SubstringFilter(Sequence):
    #     SubstringFilter ::= SEQUENCE {
    #         type           AttributeDescription,
    #         substrings     SEQUENCE SIZE (1..MAX) OF substring CHOICE {
    #             initial [0] AssertionValue,  -- can occur at most once
    #             any     [1] AssertionValue,
    #             final   [2] AssertionValue } -- can occur at most once
    #             }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 4))
    componentType = NamedTypes(NamedType('type', AttributeDescription()),
                               NamedType('substrings', Substrings()))

class And(SetOf):
    # and             [0] SET SIZE (1..MAX) OF filter Filter
    tagSet = SetOf.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 0))
    subtypeSpec = SetOf.subtypeSpec + size1ToMaxConstraint

class Or(SetOf):
    # or              [1] SET SIZE (1..MAX) OF filter Filter
    tagSet = SetOf.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 1))
    subtypeSpec = SetOf.subtypeSpec + size1ToMaxConstraint

class Not(Choice):
    # not             [2] Filter
    pass  # defined after Filter definition to allow recursion

class EqualityMatch(AttributeValueAssertion):
    # equalityMatch   [3] AttributeValueAssertion
    tagSet = AttributeValueAssertion.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 3))

class GreaterOrEqual(AttributeValueAssertion):
    # greaterOrEqual  [5] AttributeValueAssertion
    tagSet = AttributeValueAssertion.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 5))

class LessOrEqual(AttributeValueAssertion):
    # lessOrEqual     [6] AttributeValueAssertion
    tagSet = AttributeValueAssertion.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 6))

class Present(AttributeDescription):
    # present         [7] AttributeDescription
    tagSet = AttributeDescription.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 7))

class ApproxMatch(AttributeValueAssertion):
    # approxMatch     [8] AttributeValueAssertion
    tagSet = AttributeValueAssertion.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 8))

class ExtensibleMatch(MatchingRuleAssertion):
    # extensibleMatch [9] MatchingRuleAssertion
    tagSet = MatchingRuleAssertion.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatConstructed, 9))

class Filter(Choice):
    # Filter ::= CHOICE {
    #     and             [0] SET SIZE (1..MAX) OF filter Filter,
    #     or              [1] SET SIZE (1..MAX) OF filter Filter,
    #     not             [2] Filter,
    #     equalityMatch   [3] AttributeValueAssertion,
    #     substrings      [4] SubstringFilter,
    #     greaterOrEqual  [5] AttributeValueAssertion,
    #     lessOrEqual     [6] AttributeValueAssertion,
    #     present         [7] AttributeDescription,
    #     approxMatch     [8] AttributeValueAssertion,
    #     extensibleMatch [9] MatchingRuleAssertion,
    #          ...  }
    componentType = NamedTypes(NamedType('and', And()),
                               NamedType('or', Or()),
                               NamedType('notFilter', Not()),
                               NamedType('equalityMatch', EqualityMatch()),
                               NamedType('substringFilter', SubstringFilter()),
                               NamedType('greaterOrEqual', GreaterOrEqual()),
                               NamedType('lessOrEqual', LessOrEqual()),
                               NamedType('present', Present()),
                               NamedType('approxMatch', ApproxMatch()),
                               NamedType('extensibleMatch', ExtensibleMatch()))

And.componentType = Filter()
Or.componentType = Filter()
Not.componentType = NamedTypes(NamedType('innerNotFilter', Filter()))
Not.tagSet = Filter.tagSet.tagExplicitly(Tag(tagClassContext, tagFormatConstructed, 2))  # as per RFC4511 page 23

class PartialAttributeList(SequenceOf):
    # PartialAttributeList ::= SEQUENCE OF
    #     partialAttribute PartialAttribute
    componentType = PartialAttribute()

class Operation(Enumerated):
    # operation       ENUMERATED {
    #     add     (0),
    #     delete  (1),
    #     replace (2),
    #     ...  }
    namedValues = NamedValues(('add', 0),
                              ('delete', 1),
                              ('replace', 2),
                              ('increment', 3))

class Change(Sequence):
    # change SEQUENCE {
    #     operation       ENUMERATED {
    #         add     (0),
    #         delete  (1),
    #         replace (2),
    #         ...  },
    #     modification    PartialAttribute } }
    componentType = NamedTypes(NamedType('operation', Operation()),
                               NamedType('modification', PartialAttribute()))

class Changes(SequenceOf):
    # changes         SEQUENCE OF change SEQUENCE
    componentType = Change()

class DeleteOldRDN(Boolean):
    # deleteoldrdn    BOOLEAN
    pass

class NewSuperior(LDAPDN):
    # newSuperior     [0] LDAPDN
    tagSet = LDAPDN.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 0))

class RequestName(LDAPOID):
    # requestName      [0] LDAPOID
    tagSet = LDAPOID.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 0))

class RequestValue(OctetString):
    # requestValue     [1] OCTET STRING
    tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 1))
    encoding = 'utf-8'

class ResponseName(LDAPOID):
    # responseName      [10] LDAPOID
    tagSet = LDAPOID.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 10))

class ResponseValue(OctetString):
    # responseValue     [11] OCTET STRING
    tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 11))
    encoding = 'utf-8'

class IntermediateResponseName(LDAPOID):
    # responseName      [0] LDAPOID
    tagSet = LDAPOID.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 0))

class IntermediateResponseValue(OctetString):
    # responseValue     [1] OCTET STRING
    tagSet = OctetString.tagSet.tagImplicitly(Tag(tagClassContext, tagFormatSimple, 1))
    encoding = 'utf-8'

# operations
class BindRequest(Sequence):
    # BindRequest ::= [APPLICATION 0] SEQUENCE {
    #     version                 INTEGER (1 ..  127),
    #     name                    LDAPDN,
    #     authentication          AuthenticationChoice }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 0))
    componentType = NamedTypes(NamedType('version', Version()),
                               NamedType('name', LDAPDN()),
                               NamedType('authentication', AuthenticationChoice()))

class BindResponse(Sequence):
    # BindResponse ::= [APPLICATION 1] SEQUENCE {
    #     COMPONENTS OF LDAPResult,
    #     serverSaslCreds    [7] OCTET STRING OPTIONAL }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 1))
    componentType = NamedTypes(NamedType('resultCode', ResultCode()),
                               NamedType('matchedDN', LDAPDN()),
                               NamedType('diagnosticMessage', LDAPString()),
                               OptionalNamedType('referral', Referral()),
                               OptionalNamedType('serverSaslCreds', ServerSaslCreds()))

class UnbindRequest(Null):
    # UnbindRequest ::= [APPLICATION 2] NULL
    tagSet = Null.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatSimple, 2))

class SearchRequest(Sequence):
    # SearchRequest ::= [APPLICATION 3] SEQUENCE {
    #     baseObject      LDAPDN,
    #     scope           ENUMERATED {
    #         baseObject              (0),
    #         singleLevel             (1),
    #         wholeSubtree            (2),
    #     ...  },
    #     derefAliases    ENUMERATED {
    #         neverDerefAliases       (0),
    #         derefInSearching        (1),
    #         derefFindingBaseObj     (2),
    #         derefAlways             (3) },
    #     sizeLimit       INTEGER (0 ..  maxInt),
    #     timeLimit       INTEGER (0 ..  maxInt),
    #     typesOnly       BOOLEAN,
    #     filter          Filter,
    #     attributes      AttributeSelection }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 3))
    componentType = NamedTypes(NamedType('baseObject', LDAPDN()),
                               NamedType('scope', Scope()),
                               NamedType('derefAliases', DerefAliases()),
                               NamedType('sizeLimit', Integer0ToMax()),
                               NamedType('timeLimit', Integer0ToMax()),
                               NamedType('typesOnly', TypesOnly()),
                               NamedType('filter', Filter()),
                               NamedType('attributes', AttributeSelection()))

class SearchResultReference(SequenceOf):
    # SearchResultReference ::= [APPLICATION 19] SEQUENCE
    #     SIZE (1..MAX) OF uri URI
    tagSet = SequenceOf.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 19))
    subtypeSpec = SequenceOf.subtypeSpec + size1ToMaxConstraint
    componentType = URI()

class SearchResultEntry(Sequence):
    # SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
    #     objectName      LDAPDN,
    #     attributes      PartialAttributeList }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 4))
    componentType = NamedTypes(NamedType('object', LDAPDN()),
                               NamedType('attributes', PartialAttributeList()))

class SearchResultDone(LDAPResult):
    # SearchResultDone ::= [APPLICATION 5] LDAPResult
    tagSet = LDAPResult.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 5))

class ModifyRequest(Sequence):
    # ModifyRequest ::= [APPLICATION 6] SEQUENCE {
    #     object          LDAPDN,
    #     changes         SEQUENCE OF change SEQUENCE {
    #         operation       ENUMERATED {
    #             add     (0),
    #             delete  (1),
    #             replace (2),
    #             ...  },
    #         modification    PartialAttribute } }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 6))
    componentType = NamedTypes(NamedType('object', LDAPDN()),
                               NamedType('changes', Changes()))

class ModifyResponse(LDAPResult):
    # ModifyResponse ::= [APPLICATION 7] LDAPResult
    tagSet = LDAPResult.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 7))

class AddRequest(Sequence):
    # AddRequest ::= [APPLICATION 8] SEQUENCE {
    #     entry           LDAPDN,
    #     attributes      AttributeList }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 8))
    componentType = NamedTypes(NamedType('entry', LDAPDN()),
                               NamedType('attributes', AttributeList()))

class AddResponse(LDAPResult):
    # AddResponse ::= [APPLICATION 9] LDAPResult
    tagSet = LDAPResult.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 9))

class DelRequest(LDAPDN):
    # DelRequest ::= [APPLICATION 10] LDAPDN
    tagSet = LDAPDN.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatSimple, 10))

class DelResponse(LDAPResult):
    # DelResponse ::= [APPLICATION 11] LDAPResult
    tagSet = LDAPResult.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 11))

class ModifyDNRequest(Sequence):
    # ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
    #     entry           LDAPDN,
    #     newrdn          RelativeLDAPDN,
    #     deleteoldrdn    BOOLEAN,
    #     newSuperior     [0] LDAPDN OPTIONAL }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 12))
    componentType = NamedTypes(NamedType('entry', LDAPDN()),
                               NamedType('newrdn', RelativeLDAPDN()),
                               NamedType('deleteoldrdn', DeleteOldRDN()),
                               OptionalNamedType('newSuperior', NewSuperior()))

class ModifyDNResponse(LDAPResult):
    # ModifyDNResponse ::= [APPLICATION 13] LDAPResult
    tagSet = LDAPResult.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 13))

class CompareRequest(Sequence):
    # CompareRequest ::= [APPLICATION 14] SEQUENCE {
    #     entry           LDAPDN,
    #     ava             AttributeValueAssertion }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 14))
    componentType = NamedTypes(NamedType('entry', LDAPDN()),
                               NamedType('ava', AttributeValueAssertion()))

class CompareResponse(LDAPResult):
    # CompareResponse ::= [APPLICATION 15] LDAPResult
    tagSet = LDAPResult.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 15))

class AbandonRequest(MessageID):
    # AbandonRequest ::= [APPLICATION 16] MessageID
    tagSet = MessageID.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatSimple, 16))

class ExtendedRequest(Sequence):
    # ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
    #     requestName      [0] LDAPOID,
    #     requestValue     [1] OCTET STRING OPTIONAL }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 23))
    componentType = NamedTypes(NamedType('requestName', RequestName()),
                               OptionalNamedType('requestValue', RequestValue()))

class ExtendedResponse(Sequence):
    # ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
    #     COMPONENTS OF LDAPResult,
    #     responseName     [10] LDAPOID OPTIONAL,
    #     responseValue    [11] OCTET STRING OPTIONAL }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 24))
    componentType = NamedTypes(NamedType('resultCode', ResultCode()),
                               NamedType('matchedDN', LDAPDN()),
                               NamedType('diagnosticMessage', LDAPString()),
                               OptionalNamedType('referral', Referral()),
                               OptionalNamedType('responseName', ResponseName()),
                               OptionalNamedType('responseValue', ResponseValue()))

class IntermediateResponse(Sequence):
    # IntermediateResponse ::= [APPLICATION 25] SEQUENCE {
    #     responseName     [0] LDAPOID OPTIONAL,
    #     responseValue    [1] OCTET STRING OPTIONAL }
    tagSet = Sequence.tagSet.tagImplicitly(Tag(tagClassApplication, tagFormatConstructed, 25))
    componentType = NamedTypes(OptionalNamedType('responseName', IntermediateResponseName()),
                               OptionalNamedType('responseValue', IntermediateResponseValue()))

class ProtocolOp(Choice):
    # protocolOp      CHOICE {
    #     bindRequest           BindRequest,
    #     bindResponse          BindResponse,
    #     unbindRequest         UnbindRequest,
    #     searchRequest         SearchRequest,
    #     searchResEntry        SearchResultEntry,
    #     searchResDone         SearchResultDone,
    #     searchResRef          SearchResultReference,
    #     modifyRequest         ModifyRequest,
    #     modifyResponse        ModifyResponse,
    #     addRequest            AddRequest,
    #     addResponse           AddResponse,
    #     delRequest            DelRequest,
    #     delResponse           DelResponse,
    #     modDNRequest          ModifyDNRequest,
    #     modDNResponse         ModifyDNResponse,
    #     compareRequest        CompareRequest,
    #     compareResponse       CompareResponse,
    #     abandonRequest        AbandonRequest,
    #     extendedReq           ExtendedRequest,
    #     extendedResp          ExtendedResponse,
    #     ...,
    #     intermediateResponse  IntermediateResponse }
    componentType = NamedTypes(NamedType('bindRequest', BindRequest()),
                               NamedType('bindResponse', BindResponse()),
                               NamedType('unbindRequest', UnbindRequest()),
                               NamedType('searchRequest', SearchRequest()),
                               NamedType('searchResEntry', SearchResultEntry()),
                               NamedType('searchResDone', SearchResultDone()),
                               NamedType('searchResRef', SearchResultReference()),
                               NamedType('modifyRequest', ModifyRequest()),
                               NamedType('modifyResponse', ModifyResponse()),
                               NamedType('addRequest', AddRequest()),
                               NamedType('addResponse', AddResponse()),
                               NamedType('delRequest', DelRequest()),
                               NamedType('delResponse', DelResponse()),
                               NamedType('modDNRequest', ModifyDNRequest()),
                               NamedType('modDNResponse', ModifyDNResponse()),
                               NamedType('compareRequest', CompareRequest()),
                               NamedType('compareResponse', CompareResponse()),
                               NamedType('abandonRequest', AbandonRequest()),
                               NamedType('extendedReq', ExtendedRequest()),
                               NamedType('extendedResp', ExtendedResponse()),
                               NamedType('intermediateResponse', IntermediateResponse()))

class LDAPMessage(Sequence):
    # LDAPMessage ::= SEQUENCE {
    #     messageID       MessageID,
    #     protocolOp      CHOICE {
    #         bindRequest           BindRequest,
    #         bindResponse          BindResponse,
    #         unbindRequest         UnbindRequest,
    #         searchRequest         SearchRequest,
    #         searchResEntry        SearchResultEntry,
    #         searchResDone         SearchResultDone,
    #         searchResRef          SearchResultReference,
    #         modifyRequest         ModifyRequest,
    #         modifyResponse        ModifyResponse,
    #         addRequest            AddRequest,
    #         addResponse           AddResponse,
    #         delRequest            DelRequest,
    #         delResponse           DelResponse,
    #         modDNRequest          ModifyDNRequest,
    #         modDNResponse         ModifyDNResponse,
    #         compareRequest        CompareRequest,
    #         compareResponse       CompareResponse,
    #         abandonRequest        AbandonRequest,
    #         extendedReq           ExtendedRequest,
    #         extendedResp          ExtendedResponse,
    #         ...,
    #         intermediateResponse  IntermediateResponse },
    #     controls       [0] Controls OPTIONAL }
    componentType = NamedTypes(NamedType('messageID', MessageID()),
                               NamedType('protocolOp', ProtocolOp()),
                               OptionalNamedType('controls', Controls()))

{'repo_name': 'tp4a/teleport', 'stars': '630', 'repo_language': 'Python', 'file_name': 'modules.xml', 'mime_type': 'text/xml', 'hash': -8591838389567759614, 'source_dataset': 'data'}


/* Ole Agesen, 1994. */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

#define FALSE  0
#define TRUE   1

#define MAX_LINE_LEN 10000

FILE *inFile, *outFile;

int lineNo = 0;
int stack[1000], stackTop = 0;

void push(int e) {
  stack[stackTop] = e;
  stackTop++;
}

int pop() {
  if (0 == stackTop) {
    fprintf(stderr, "Empty stack, line %d.\n", lineNo);
    exit(-1);
  }
  stackTop--;
  return stack[stackTop];
}

int isLoneBar(char line[], int i) {
  char ch;
  if (0 != i) {
    ch = line[i-1];
    if (strchr("!@#$%^&*-+=~/?<>,;|`\\", ch)) /* Probably a binary operator. */
      return FALSE;
  }
  ch = line[i+1];
  if (ch) {
    if (strchr("!@#$%^&*-+=~/?<>,;|`\\", ch)) /* Probably a binary operator. */
      return FALSE;
  }
  return TRUE;
}

void escapeError(char ch) {
  fprintf(stderr, "Should not escape %c, line %d\n", ch, lineNo);
  exit(-1);
}

int isBlank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\t';
}

char outLine[MAX_LINE_LEN];
int  outIdx = 0;

void output1(char ch) {
  outLine[outIdx++] = ch;
}

void output(char *str) {
  while (*str) outLine[outIdx++] = *str++;
}

void back2() {
  return;    /* Currently not used. */
  if (0 != outIdx && outLine[outIdx-1] == ' ') outIdx--;
  if (0 != outIdx && outLine[outIdx-1] == ' ') outIdx--;
}

int checkFor(char *target, char *line, int i) {
  if (i != 0 && !isBlank(line[i-1]))             return FALSE;
  if (strncmp(target, line + i, strlen(target))) return FALSE;
  i = i + strlen(target);
  if (line[i] && !isBlank(line[i]) && line[i] != '\\') return FALSE;
  return TRUE;
}

void printOutput() {
  outLine[outIdx] = '\0';
  fputs(outLine, outFile);
}

void processFile(char *filename) {
   char inLine[MAX_LINE_LEN], bakFilename[1000];
   int  inSlotList = 0, inSingleQuotes = 0, inDoubleQuotes = 0;

   fprintf(stderr, "Converting privacy decl's in %s\n", filename);

   strcpy(bakFilename, filename);
   strcat(bakFilename, ".BAK");
   if (rename(filename, bakFilename)) {
     fprintf(stderr, "Could not rename file %s to %s: ",
             filename, bakFilename);
     perror(NULL);
     exit(-1);
   }

   inFile  = fopen(bakFilename, "r");
   if (!inFile) {
     fprintf(stderr, "Could not open file %s for reading: ", bakFilename);
     perror(NULL);
     exit(-1);
   }

   outFile = fopen(filename, "w");
   if (!outFile) {
     fprintf(stderr, "Could not open file %s for writing: ", filename);
     perror(NULL);
     exit(-1);
   }

   lineNo = 0;
   while(fgets(inLine, MAX_LINE_LEN, inFile)) {
     int len, esc = 0;  /* NB: It is correct to start each line non-escaped! */
     int i = 0;
     outIdx = 0;        /* Start new output line. */
     len = strlen(inLine);
     lineNo++;

     while (i < len) {
       int isPrinted = 0;
       switch (inLine[i]) {
         case '\'':  if (!inDoubleQuotes && !esc)
                       inSingleQuotes = !inSingleQuotes;
                     break;
         case '"':   if (!inSingleQuotes && !esc)
                       inDoubleQuotes = !inDoubleQuotes;
                     break;
         case '|':   if (!inSingleQuotes &&
                         !inDoubleQuotes && isLoneBar(inLine,i)) {
                       if (esc) escapeError(inLine[i]);
                       inSlotList = !inSlotList;
                     }
                     break;
         case '[':
         case '(':   if (!inSingleQuotes && !inDoubleQuotes) {
                       if (esc) escapeError(inLine[i]);
                       push(inSlotList);
                       inSlotList = FALSE;
                     }
                     break;
         case ']':
         case ')':   if (!inSingleQuotes && !inDoubleQuotes) {
                       if (esc) escapeError(inLine[i]);
                       inSlotList = pop();
                     }
                     break;
         case '_':   if (inSlotList && !inSingleQuotes && !inDoubleQuotes) {
                       if (esc) escapeError(inLine[i]);
                       if (checkFor("_", inLine, i)) {
                         back2();
                         output("\"_\"");
                         isPrinted = TRUE;
                       } else if(checkFor("_^", inLine, i)) {
                         back2();
                         output("\"_^\"");
                         isPrinted = TRUE;
                         i++;
                       }
                     }
                     break;
         case '^':   if (inSlotList && !inSingleQuotes && !inDoubleQuotes) {
                       if (esc) escapeError(inLine[i]);
                       if (checkFor("^", inLine, i)) {
                         back2();
                         output("\"^\"");
                         isPrinted = TRUE;
                       } else if(checkFor("^_", inLine, i)) {
                         back2();
                         output("\"^_\"");
                         isPrinted = TRUE;
                         i++;
                       }
                     }
                     break;
         default:    break;
       }
       if (inLine[i] == '\\')
         esc = !esc;
       else
         esc = 0;

       if (!isPrinted) output1(inLine[i]);
       i++;
     }
     printOutput();
   }

   fclose(inFile);
   fclose(outFile);

   if (inSingleQuotes)
     fprintf(stderr,
             "Warning: finished inside single-quotes - check result!\n");

   if (inDoubleQuotes)
     fprintf(stderr,
             "Warning: Finished inside double-quotes - check result!\n");

   if (stackTop)
     fprintf(stderr, "Warning: Finished with non-empty stack (size %d) "
                     "- check result!\n",
             stackTop);
}

int main(int argc, char *argv[]) {
  int i = 1;
  if (argc == 1 || (argc > 1 && !strcmp("-h", argv[1]))) {
    fprintf(stderr, "%s is a program that will convert Self privacy decl's "
                    "to comments.\n", argv[0]);
    fprintf(stderr, "Usage: %s filename1 filename2 ...\n", argv[0]);
    fprintf(stderr, "The original files will be saved with extension .BAK\n");
    exit(0);
  }

  while (i < argc) {
    processFile(argv[i++]);
  }
}

{'repo_name': 'russellallen/self', 'stars': '509', 'repo_language': 'Self', 'file_name': 'Info.plist', 'mime_type': 'text/xml', 'hash': -5927022175562864285, 'source_dataset': 'data'}


<title>Test of dojox.gfx3d.scheduler</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Scheduler Test

There are two schedulers available in dojox.gfx3d, zOrder and BSP. zOrder is much simpler, and it performs quite well in most cases, it may fail in some rare cases, for example: two triangles share the same two vertice, and have the same Z value of the third vertex, in this case, they have the same z-order. They are rendered in arbitary order. In this case, BSP is the rescure.

Current render: default

<button id="bsp">BSP</button> <button id="zorder">zOrder</button>

That's all Folks!

{'repo_name': 'jrossi227/ApacheGUI', 'stars': '115', 'repo_language': 'HTML', 'file_name': 'context.xml', 'mime_type': 'text/xml', 'hash': 6202146020618097203, 'source_dataset': 'data'}


//
//     Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48).
//
//     class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//

#import <objc/NSObject.h>

@class NSString, WAAppItemData;

@interface WAPermissionLaunchCGIUserInfo : NSObject
{
    _Bool _isFromBackground;
    unsigned int _enterScene;
    WAAppItemData *_appItem;
    NSString *_sessionId;
}

@property(copy, nonatomic) NSString *sessionId; // @synthesize sessionId=_sessionId;
@property(nonatomic) _Bool isFromBackground; // @synthesize isFromBackground=_isFromBackground;
@property(nonatomic) unsigned int enterScene; // @synthesize enterScene=_enterScene;
@property(retain, nonatomic) WAAppItemData *appItem; // @synthesize appItem=_appItem;
- (void).cxx_destruct;

@end

{'repo_name': 'lefex/iWeChat', 'stars': '1481', 'repo_language': 'Objective-C', 'file_name': 'LaunchScreen.storyboard', 'mime_type': 'text/xml', 'hash': 7500371212696942537, 'source_dataset': 'data'}


namespace SampleLibrary.IOC
{
    public class SampleRecursiveTestComponent1
    {
        public SampleRecursiveTestComponent1(SampleRecursiveTestComponent2 other)
        {
        }
    }
}

{'repo_name': 'philiplaureano/LinFu', 'stars': '200', 'repo_language': 'C#', 'file_name': 'Microsoft.Practices.ServiceLocation.XML', 'mime_type': 'text/xml', 'hash': 1772177589324462777, 'source_dataset': 'data'}


'use strict';

describe('OnsBackButtonElement', () => {
  it('exists', () => {
    expect(window.ons.elements.BackButton).to.be.ok;
  });

  describe('class attribute', () => {
    it('should contain "back-button" class name automatically', () => {
      const element = new ons.elements.BackButton();
      element.setAttribute('class', 'foobar');
      expect(element.classList.contains('back-button')).to.be.ok;
      expect(element.classList.contains('foobar')).to.be.ok;
    });
  });

  it('provides \'modifier\' attribute', () => {
    const element = ons._util.createElement('<ons-back-button>label</ons-back-button>');

    element.setAttribute('modifier', 'hoge');
    expect(element.classList.contains('back-button--hoge')).to.be.true;

    element.setAttribute('modifier', 'foo bar');
    expect(element.classList.contains('back-button--foo')).to.be.true;
    expect(element.classList.contains('back-button--bar')).to.be.true;
    expect(element.classList.contains('back-button--hoge')).not.to.be.true;

    element.classList.add('back-button--piyo');
    element.setAttribute('modifier', 'fuga');
    expect(element.classList.contains('back-button--piyo')).to.be.true;
    expect(element.classList.contains('back-button--fuga')).to.be.true;
  });

  it('has two children', () => {
    const element = ons._util.createElement('<ons-back-button>label</ons-back-button>');
    document.body.appendChild(element);

    expect(element.children[0]).to.be.ok;
    expect(element.children[1]).to.be.ok;
    expect(element.children[2]).not.to.be.ok;
  });

  describe('#_onClick()', () => {
    let div, nav;

    beforeEach((done) => {
      div = ons._util.createElement(`
        <div>
          <template id="page1">
            <ons-page id="p1">page1 content</ons-page>
          </template>
          <template id="page2">
            <ons-page id="p2">
              <ons-back-button>content</ons-back-button>
            </ons-page>
          </template>
        </div>
      `);

      nav = new ons.elements.Navigator();
      nav._options = {cancelIfRunning: false};
      document.body.appendChild(div);
      document.body.appendChild(nav);
      nav.pushPage('page1').then(function(e) {
        done();
      });
    });

    afterEach(() => {
      div.remove();
      nav.remove();
      div = nav = null;
    });

    it('will pop a page', () => {
      const promise = new Promise((resolve) => {
        nav.addEventListener('postpop', () => {
          resolve();
        });

        nav.pushPage('page2').then(function(page) {
          const element = nav.querySelector('ons-back-button');
          nav.querySelector('ons-back-button')._onClick();
        });
      });

      return expect(promise).to.eventually.be.fulfilled;
    });
  });

  describe('#onClick', () => {
    it ('overrides the default click handler', () => {
      const backButton = ons._util.createElement('<ons-back-button></ons-back-button>');
      backButton.onClick = function () {};
      const spy = chai.spy.on(backButton, 'onClick');
      backButton._onClick();
      expect(spy).to.have.been.called.once;
    });
  });

  describe('#_compile()', () => {
    it('does not compile twice', () => {
      const div1 = document.createElement('div');
      const div2 = document.createElement('div');
      div1.innerHTML = '<ons-back-button>Back</ons-back-button>';
      div2.innerHTML = div1.innerHTML;
      expect(div1.isEqualNode(div2)).to.be.true;
    });
  });

  describe('autoStyling', () => {
    it('adds \'material\' modifiers and effects on Android', () => {
      ons.platform.select('android');
      const e = ons._util.createElement('<ons-back-button>label</ons-back-button>');
      expect(e.getAttribute('modifier')).to.equal('material');
      ons.platform.select('');
    });
  });
});

{'repo_name': 'OnsenUI/OnsenUI', 'stars': '8027', 'repo_language': 'JavaScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -8252888494924534314, 'source_dataset': 'data'}


// Copyright 2016 Attic Labs, Inc. All rights reserved.
// Licensed under the Apache License, version 2.0:
// http://www.apache.org/licenses/LICENSE-2.0

package chunks

import (
	"sync"

	"github.com/attic-labs/noms/go/hash"
)

type ReadRequest interface {
	Hashes() hash.HashSet
	Outstanding() OutstandingRequest
}

func NewGetRequest(r hash.Hash, ch chan<- *Chunk) GetRequest {
	return GetRequest{hash.HashSet{r: struct{}{}}, ch}
}

type GetRequest struct {
	hashes hash.HashSet
	ch     chan<- *Chunk
}

func NewGetManyRequest(hashes hash.HashSet, wg *sync.WaitGroup, ch chan<- *Chunk) GetManyRequest {
	return GetManyRequest{hashes, wg, ch}
}

type GetManyRequest struct {
	hashes hash.HashSet
	wg     *sync.WaitGroup
	ch     chan<- *Chunk
}

func NewAbsentRequest(r hash.Hash, ch chan<- bool) AbsentRequest {
	return AbsentRequest{hash.HashSet{r: struct{}{}}, ch}
}

type AbsentRequest struct {
	hashes hash.HashSet
	ch     chan<- bool
}

func NewAbsentManyRequest(hashes hash.HashSet, wg *sync.WaitGroup, ch chan<- hash.Hash) AbsentManyRequest {
	return AbsentManyRequest{hashes, wg, ch}
}

type AbsentManyRequest struct {
	hashes hash.HashSet
	wg     *sync.WaitGroup
	ch     chan<- hash.Hash
}

func (g GetRequest) Hashes() hash.HashSet {
	return g.hashes
}

func (g GetRequest) Outstanding() OutstandingRequest {
	return OutstandingGet(g.ch)
}

func (g GetManyRequest) Hashes() hash.HashSet {
	return g.hashes
}

func (g GetManyRequest) Outstanding() OutstandingRequest {
	return OutstandingGetMany{g.wg, g.ch}
}

func (h AbsentRequest) Hashes() hash.HashSet {
	return h.hashes
}

func (h AbsentRequest) Outstanding() OutstandingRequest {
	return OutstandingAbsent(h.ch)
}

func (h AbsentManyRequest) Hashes() hash.HashSet {
	return h.hashes
}

func (h AbsentManyRequest) Outstanding() OutstandingRequest {
	return OutstandingAbsentMany{h.wg, h.ch}
}

type OutstandingRequest interface {
	Satisfy(h hash.Hash, c *Chunk)
	Fail()
}

type OutstandingGet chan<- *Chunk
type OutstandingGetMany struct {
	wg *sync.WaitGroup
	ch chan<- *Chunk
}
type OutstandingAbsent chan<- bool
type OutstandingAbsentMany struct {
	wg *sync.WaitGroup
	ch chan<- hash.Hash
}

func (r OutstandingGet) Satisfy(h hash.Hash, c *Chunk) {
	r <- c
}

func (r OutstandingGet) Fail() {
	r <- &EmptyChunk
}

func (ogm OutstandingGetMany) Satisfy(h hash.Hash, c *Chunk) {
	ogm.ch <- c
	ogm.wg.Done()
}

func (ogm OutstandingGetMany) Fail() {
	ogm.wg.Done()
}

func (oh OutstandingAbsent) Satisfy(h hash.Hash, c *Chunk) {
	oh <- false
}

func (oh OutstandingAbsent) Fail() {
	oh <- true
}

func (ohm OutstandingAbsentMany) Satisfy(h hash.Hash, c *Chunk) {
	ohm.ch <- h
	ohm.wg.Done()
}

func (ohm OutstandingAbsentMany) Fail() {
	ohm.wg.Done()
}

// ReadBatch represents a set of queued Get/Has requests, each of which are blocking on a receive channel for a response.
type ReadBatch map[hash.Hash][]OutstandingRequest

// Close ensures that callers to Get() and Has() are failed correctly if the corresponding chunk wasn't in the response from the server (i.e. it wasn't found).
func (rb *ReadBatch) Close() error {
	for _, reqs := range *rb {
		for _, req := range reqs {
			req.Fail()
		}
	}
	return nil
}

{'repo_name': 'attic-labs/noms', 'stars': '7231', 'repo_language': 'Go', 'file_name': 'types.js', 'mime_type': 'text/plain', 'hash': -7926342176993643864, 'source_dataset': 'data'}


/* -*- Mode: js; js-indent-level: 2; -*- */
/*
 * Copyright 2011 Mozilla Foundation and contributors
 * Licensed under the New BSD license. See LICENSE or:
 * http://opensource.org/licenses/BSD-3-Clause
 */
function runSourceMapTests(modName, do_throw) {
  let mod = require(modName);
  let assert = require('test/source-map/assert');
  let util = require('test/source-map/util');

  assert.init(do_throw);

  for (let k in mod) {
    if (/^test/.test(k)) {
      mod[k](assert, util);
    }
  }

}
this.runSourceMapTests = runSourceMapTests;

{'repo_name': 'zhangmengxue/React-Code-Snippet', 'stars': '304', 'repo_language': 'None', 'file_name': 'prefix-source-map.jsm', 'mime_type': 'text/plain', 'hash': 1698414332812499323, 'source_dataset': 'data'}


/*
 *  Copyright (c) 2012 The WebRTC@AnyRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_VIDEO_CAPTURE_MF_H_
#define WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_VIDEO_CAPTURE_MF_H_

#include "webrtc/modules/video_capture/video_capture_impl.h"

namespace webrtc {
namespace videocapturemodule {

// VideoCapture implementation that uses the Media Foundation API on Windows.
// This will replace the DirectShow based implementation on Vista and higher.
// TODO(tommi): Finish implementing and switch out the DS in the factory method
// for supported platforms.
class VideoCaptureMF : public VideoCaptureImpl {
 public:
  explicit VideoCaptureMF(const int32_t id);

  int32_t Init(const int32_t id, const char* device_id);

  // Overrides from VideoCaptureImpl.
  virtual int32_t StartCapture(const VideoCaptureCapability& capability);
  virtual int32_t StopCapture();
  virtual bool CaptureStarted();
  virtual int32_t CaptureSettings(
      VideoCaptureCapability& settings);  // NOLINT

 protected:
  virtual ~VideoCaptureMF();
};

}  // namespace videocapturemodule
}  // namespace webrtc

#endif  // WEBRTC_MODULES_VIDEO_CAPTURE_WINDOWS_VIDEO_CAPTURE_MF_H_

{'repo_name': 'anyRTC/anyRTC-RTMP-OpenSource', 'stars': '3540', 'repo_language': 'C++', 'file_name': 'config.h', 'mime_type': 'text/plain', 'hash': -2498087356298717192, 'source_dataset': 'data'}


__all__ = []

import pkgutil
import inspect

for loader, name, is_pkg in pkgutil.walk_packages(__path__):
    module = loader.find_module(name).load_module(name)

    for name, value in inspect.getmembers(module):
        if name.startswith('__'):
            continue

        globals()[name] = value
        __all__.append(name)

{'repo_name': 'matthew-sochor-zz/transfer', 'stars': '117', 'repo_language': 'Python', 'file_name': 'inception_v3.py', 'mime_type': 'text/x-python', 'hash': 6853036639844234735, 'source_dataset': 'data'}


/*
Generated by Yara-Rules
On 10-07-2020
*/
include "./exploit_kits/EK_Angler.yar"
include "./exploit_kits/EK_Blackhole.yar"
include "./exploit_kits/EK_BleedingLife.yar"
include "./exploit_kits/EK_Crimepack.yar"
include "./exploit_kits/EK_Eleonore.yar"
include "./exploit_kits/EK_Fragus.yar"
include "./exploit_kits/EK_Phoenix.yar"
include "./exploit_kits/EK_Sakura.yar"
include "./exploit_kits/EK_ZeroAcces.yar"
include "./exploit_kits/EK_Zerox88.yar"
include "./exploit_kits/EK_Zeus.yar"

{'repo_name': 'Yara-Rules/rules', 'stars': '2205', 'repo_language': 'YARA', 'file_name': 'HotelAlfa.yara', 'mime_type': 'text/plain', 'hash': 522039280411959537, 'source_dataset': 'data'}


/*
    Copyright 2005-2007 Adobe Systems Incorporated

    Use, modification and distribution are subject to the Boost Software License,
    Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    http://www.boost.org/LICENSE_1_0.txt).

    See http://stlab.adobe.com/gil for most recent version including documentation.
*/

/*************************************************************************************************/

#ifndef GIL_COLOR_BASE_HPP
#define GIL_COLOR_BASE_HPP

////////////////////////////////////////////////////////////////////////////////////////
/// \file
/// \brief pixel class and related utilities
/// \author Lubomir Bourdev and Hailin Jin \n
///         Adobe Systems Incorporated
/// \date   2005-2007 \n Last updated on May 6, 2007
///
////////////////////////////////////////////////////////////////////////////////////////

#include <cassert>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>

#include "gil_config.hpp"
#include "utilities.hpp"
#include "gil_concept.hpp"

namespace boost { namespace gil {

// Forward-declare
template <typename P> P* memunit_advanced(const P* p, std::ptrdiff_t diff);

// Forward-declare semantic_at_c
template <int K, typename ColorBase>
typename disable_if<is_const<ColorBase>,typename kth_semantic_element_reference_type<ColorBase,K>::type>::type semantic_at_c(ColorBase& p);
template <int K, typename ColorBase>
typename kth_semantic_element_const_reference_type<ColorBase,K>::type semantic_at_c(const ColorBase& p);

// Forward declare element_reference_type
template <typename ColorBase> struct element_reference_type;
template <typename ColorBase> struct element_const_reference_type;
template <typename ColorBase, int K> struct kth_element_type;
template <typename ColorBase, int K> struct kth_element_type<const ColorBase,K> : public kth_element_type<ColorBase,K> {};
template <typename ColorBase, int K> struct kth_element_reference_type;
template <typename ColorBase, int K> struct kth_element_reference_type<const ColorBase,K> : public kth_element_reference_type<ColorBase,K> {};
template <typename ColorBase, int K> struct kth_element_const_reference_type;
template <typename ColorBase, int K> struct kth_element_const_reference_type<const ColorBase,K> : public kth_element_const_reference_type<ColorBase,K> {};

namespace detail {

template <typename DstLayout, typename SrcLayout, int K>
struct mapping_transform
    : public mpl::at<typename SrcLayout::channel_mapping_t,
                     typename detail::type_to_index<typename DstLayout::channel_mapping_t,mpl::integral_c<int,K> >::type
                           >::type {};

/// \defgroup ColorBaseModelHomogeneous detail::homogeneous_color_base
/// \ingroup ColorBaseModel
/// \brief A homogeneous color base holding one color element. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept
/// If the element type models Regular, this class models HomogeneousColorBaseValueConcept.

/// \brief A homogeneous color base holding one color element. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept
/// \ingroup ColorBaseModelHomogeneous
template <typename Element, typename Layout>
struct homogeneous_color_base<Element,Layout,1> {
private:
    Element _v0;
public:
    typedef Layout layout_t;
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<0>)       { return _v0; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; }

    homogeneous_color_base() {}
    homogeneous_color_base(Element v) : _v0(v) {}

    // grayscale pixel values are convertible to channel type
    operator Element () const { return _v0; }

    template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,1>& c) : _v0(at_c<0>(c)) {}
};

/// \brief A homogeneous color base holding two color elements. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept
/// \ingroup ColorBaseModelHomogeneous
template <typename Element, typename Layout>
struct homogeneous_color_base<Element,Layout,2> {
private:
    Element _v0, _v1;
public:
    typedef Layout layout_t;
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<0>)       { return _v0; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<1>)       { return _v1; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) const { return _v1; }

    homogeneous_color_base() {}
    explicit homogeneous_color_base(Element v) : _v0(v), _v1(v) {}
    homogeneous_color_base(Element v0, Element v1) : _v0(v0), _v1(v1) {}

    template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,2>& c) :
        _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)),
        _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)) {}

    // Support for l-value reference proxy copy construction
    template <typename E2, typename L2> homogeneous_color_base(      homogeneous_color_base<E2,L2,2>& c) :
        _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)),
        _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)) {}

    // Support for planar_pixel_iterator construction and dereferencing
    template <typename P> homogeneous_color_base(P* p,bool) :
        _v0(&semantic_at_c<0>(*p)),
        _v1(&semantic_at_c<1>(*p)) {}
    template <typename Ref> Ref deref() const {
        return Ref(*semantic_at_c<0>(*this),
                   *semantic_at_c<1>(*this)); }

    // Support for planar_pixel_reference offset constructor
    template <typename Ptr> homogeneous_color_base(const Ptr& ptr, std::ptrdiff_t diff)
        : _v0(*memunit_advanced(semantic_at_c<0>(ptr),diff)),
          _v1(*memunit_advanced(semantic_at_c<1>(ptr),diff)) {}

    // Support for planar_pixel_reference operator[]
    Element at_c_dynamic(std::size_t i) const {
        if (i==0) return _v0;
        return _v1;
    }
};

/// \brief A homogeneous color base holding three color elements. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept
/// \ingroup ColorBaseModelHomogeneous
template <typename Element, typename Layout>
struct homogeneous_color_base<Element,Layout,3> {
private:
    Element _v0, _v1, _v2;
public:
    typedef Layout layout_t;
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<0>)       { return _v0; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<1>)       { return _v1; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) const { return _v1; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<2>)       { return _v2; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) const { return _v2; }

    homogeneous_color_base() {}
    explicit homogeneous_color_base(Element v) : _v0(v), _v1(v), _v2(v) {}
    homogeneous_color_base(Element v0, Element v1, Element v2) : _v0(v0), _v1(v1), _v2(v2) {}

    template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,3>& c) :
        _v0(gil::at_c<mapping_transform<Layout,L2,0>::value>(c)),
        _v1(gil::at_c<mapping_transform<Layout,L2,1>::value>(c)),
        _v2(gil::at_c<mapping_transform<Layout,L2,2>::value>(c)) {}

    // Support for l-value reference proxy copy construction
    template <typename E2, typename L2> homogeneous_color_base(      homogeneous_color_base<E2,L2,3>& c) :
        _v0(gil::at_c<mapping_transform<Layout,L2,0>::value>(c)),
        _v1(gil::at_c<mapping_transform<Layout,L2,1>::value>(c)),
        _v2(gil::at_c<mapping_transform<Layout,L2,2>::value>(c)) {}

    // Support for planar_pixel_iterator construction and dereferencing
    template <typename P> homogeneous_color_base(P* p,bool) :
        _v0(&semantic_at_c<0>(*p)),
        _v1(&semantic_at_c<1>(*p)),
        _v2(&semantic_at_c<2>(*p)) {}
    template <typename Ref> Ref deref() const {
        return Ref(*semantic_at_c<0>(*this),
                   *semantic_at_c<1>(*this),
                   *semantic_at_c<2>(*this)); }

    // Support for planar_pixel_reference offset constructor
    template <typename Ptr> homogeneous_color_base(const Ptr& ptr, std::ptrdiff_t diff)
        : _v0(*memunit_advanced(semantic_at_c<0>(ptr),diff)),
          _v1(*memunit_advanced(semantic_at_c<1>(ptr),diff)),
          _v2(*memunit_advanced(semantic_at_c<2>(ptr),diff)) {}

    // Support for planar_pixel_reference operator[]
    Element at_c_dynamic(std::size_t i) const {
        switch (i) {
            case 0: return _v0;
            case 1: return _v1;
        }
        return _v2;
    }
};

/// \brief A homogeneous color base holding four color elements. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept
/// \ingroup ColorBaseModelHomogeneous
template <typename Element, typename Layout>
struct homogeneous_color_base<Element,Layout,4> {
private:
    Element _v0, _v1, _v2, _v3;
public:
    typedef Layout layout_t;
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<0>)       { return _v0; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<1>)       { return _v1; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) const { return _v1; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<2>)       { return _v2; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) const { return _v2; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<3>)       { return _v3; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<3>) const { return _v3; }
    homogeneous_color_base() {}
    explicit homogeneous_color_base(Element v) : _v0(v), _v1(v), _v2(v), _v3(v) {}
    homogeneous_color_base(Element v0, Element v1, Element v2, Element v3) : _v0(v0), _v1(v1), _v2(v2), _v3(v3) {}

    template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,4>& c) :
        _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)),
        _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)),
        _v2(at_c<mapping_transform<Layout,L2,2>::value>(c)),
        _v3(at_c<mapping_transform<Layout,L2,3>::value>(c)) {}

    // Support for l-value reference proxy copy construction
    template <typename E2, typename L2> homogeneous_color_base(      homogeneous_color_base<E2,L2,4>& c) :
        _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)),
        _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)),
        _v2(at_c<mapping_transform<Layout,L2,2>::value>(c)),
        _v3(at_c<mapping_transform<Layout,L2,3>::value>(c)) {}

    // Support for planar_pixel_iterator construction and dereferencing
    template <typename P> homogeneous_color_base(P* p,bool) :
        _v0(&semantic_at_c<0>(*p)),
        _v1(&semantic_at_c<1>(*p)),
        _v2(&semantic_at_c<2>(*p)),
        _v3(&semantic_at_c<3>(*p)) {}

    template <typename Ref> Ref deref() const {
        return Ref(*semantic_at_c<0>(*this),
                   *semantic_at_c<1>(*this),
                   *semantic_at_c<2>(*this),
                   *semantic_at_c<3>(*this)); }

    // Support for planar_pixel_reference offset constructor
    template <typename Ptr> homogeneous_color_base(const Ptr& ptr, std::ptrdiff_t diff)
        : _v0(*memunit_advanced(semantic_at_c<0>(ptr),diff)),
          _v1(*memunit_advanced(semantic_at_c<1>(ptr),diff)),
          _v2(*memunit_advanced(semantic_at_c<2>(ptr),diff)),
          _v3(*memunit_advanced(semantic_at_c<3>(ptr),diff)) {}

    // Support for planar_pixel_reference operator[]
    Element at_c_dynamic(std::size_t i) const {
        switch (i) {
            case 0: return _v0;
            case 1: return _v1;
            case 2: return _v2;
        }
        return _v3;
    }
};

/// \brief A homogeneous color base holding five color elements. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept
/// \ingroup ColorBaseModelHomogeneous
template <typename Element, typename Layout>
struct homogeneous_color_base<Element,Layout,5> {
private:
    Element _v0, _v1, _v2, _v3, _v4;
public:
    typedef Layout layout_t;
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<0>)       { return _v0; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<1>)       { return _v1; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) const { return _v1; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<2>)       { return _v2; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) const { return _v2; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<3>)       { return _v3; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<3>) const { return _v3; }
    typename element_reference_type<homogeneous_color_base>::type       at(mpl::int_<4>)       { return _v4; }
    typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<4>) const { return _v4; }
    homogeneous_color_base() {}
    explicit homogeneous_color_base(Element v) : _v0(v), _v1(v), _v2(v), _v3(v), _v4(v) {}
    homogeneous_color_base(Element v0, Element v1, Element v2, Element v3, Element v4) : _v0(v0), _v1(v1), _v2(v2), _v3(v3), _v4(v4) {}

    template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,5>& c) :
        _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)),
        _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)),
        _v2(at_c<mapping_transform<Layout,L2,2>::value>(c)),
        _v3(at_c<mapping_transform<Layout,L2,3>::value>(c)),
        _v4(at_c<mapping_transform<Layout,L2,4>::value>(c)) {}

    // Support for l-value reference proxy copy construction
    template <typename E2, typename L2> homogeneous_color_base(      homogeneous_color_base<E2,L2,5>& c) :
        _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)),
        _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)),
        _v2(at_c<mapping_transform<Layout,L2,2>::value>(c)),
        _v3(at_c<mapping_transform<Layout,L2,3>::value>(c)),
        _v4(at_c<mapping_transform<Layout,L2,4>::value>(c)) {}

    // Support for planar_pixel_iterator construction and dereferencing
    template <typename P> homogeneous_color_base(P* p,bool) :
        _v0(&semantic_at_c<0>(*p)),
        _v1(&semantic_at_c<1>(*p)),
        _v2(&semantic_at_c<2>(*p)),
        _v3(&semantic_at_c<3>(*p)),
        _v4(&semantic_at_c<4>(*p)) {}

    template <typename Ref> Ref deref() const {
        return Ref(*semantic_at_c<0>(*this),
                   *semantic_at_c<1>(*this),
                   *semantic_at_c<2>(*this),
                   *semantic_at_c<3>(*this),
                   *semantic_at_c<4>(*this)); }

    // Support for planar_pixel_reference offset constructor
    template <typename Ptr> homogeneous_color_base(const Ptr& ptr, std::ptrdiff_t diff)
        : _v0(*memunit_advanced(semantic_at_c<0>(ptr),diff)),
          _v1(*memunit_advanced(semantic_at_c<1>(ptr),diff)),
          _v2(*memunit_advanced(semantic_at_c<2>(ptr),diff)),
          _v3(*memunit_advanced(semantic_at_c<3>(ptr),diff)),
          _v4(*memunit_advanced(semantic_at_c<4>(ptr),diff)) {}

    // Support for planar_pixel_reference operator[]
    Element at_c_dynamic(std::size_t i) const {
        switch (i) {
            case 0: return _v0;
            case 1: return _v1;
            case 2: return _v2;
            case 3: return _v3;
        }
        return _v4;
    }
};

// The following way of casting adjacent channels (the contents of color_base) into an array appears to be unsafe
// -- there is no guarantee that the compiler won't add any padding between adjacent channels.
// Note, however, that GIL _must_ be compiled with compiler settings ensuring there is no padding in the color base structs.
// This is because the color base structs must model the interleaved organization in memory. In other words, the client may
// have existing RGB image in the form "RGBRGBRGB..." and we must be able to represent it with an array of RGB color bases (i.e. RGB pixels)
// with no padding. We have tested with char/int/float/double channels on gcc and VC and have so far discovered no problem.
// We have even tried using strange channels consisting of short + char (3 bytes). With the default 4-byte alignment on VC, the size
// of this channel is padded to 4 bytes, so an RGB pixel of it will be 4x3=12 bytes. The code below will still work properly.
// However, the client must nevertheless ensure that proper compiler settings are used for their compiler and their channel types.

template <typename Element, typename Layout, int K>
typename element_reference_type<homogeneous_color_base<Element,Layout,K> >::type
dynamic_at_c(homogeneous_color_base<Element,Layout,K>& cb, std::size_t i) {
    assert(i<K);
    return (gil_reinterpret_cast<Element*>(&cb))[i];
}

template <typename Element, typename Layout, int K>
typename element_const_reference_type<homogeneous_color_base<Element,Layout,K> >::type
dynamic_at_c(const homogeneous_color_base<Element,Layout,K>& cb, std::size_t i) {
    assert(i<K);
    return (gil_reinterpret_cast_c<const Element*>(&cb))[i];
}

template <typename Element, typename Layout, int K>
typename element_reference_type<homogeneous_color_base<Element&,Layout,K> >::type
dynamic_at_c(const homogeneous_color_base<Element&,Layout,K>& cb, std::size_t i) {
    assert(i<K);
    return cb.at_c_dynamic(i);
}

template <typename Element, typename Layout, int K>
typename element_const_reference_type<homogeneous_color_base<const Element&,Layout,K> >::type
dynamic_at_c(const homogeneous_color_base<const Element&,Layout,K>& cb, std::size_t i) {
    assert(i<K);
    return cb.at_c_dynamic(i);
}

} // namespace detail

template <typename Element, typename Layout, int K1, int K>
struct kth_element_type<detail::homogeneous_color_base<Element,Layout,K1>, K> {
    typedef Element type;
};

template <typename Element, typename Layout, int K1, int K>
struct kth_element_reference_type<detail::homogeneous_color_base<Element,Layout,K1>, K> : public add_reference<Element> {};

template <typename Element, typename Layout, int K1, int K>
struct kth_element_const_reference_type<detail::homogeneous_color_base<Element,Layout,K1>, K> : public add_reference<typename add_const<Element>::type> {};

/// \brief Provides mutable access to the K-th element, in physical order
/// \ingroup ColorBaseModelHomogeneous
template <int K, typename E, typename L, int N> inline
typename add_reference<E>::type
at_c(      detail::homogeneous_color_base<E,L,N>& p) { return p.at(mpl::int_<K>()); }

/// \brief Provides constant access to the K-th element, in physical order
/// \ingroup ColorBaseModelHomogeneous
template <int K, typename E, typename L, int N> inline
typename add_reference<typename add_const<E>::type>::type
at_c(const detail::homogeneous_color_base<E,L,N>& p) { return p.at(mpl::int_<K>()); }

namespace detail {
    struct swap_fn {
        template <typename T> void operator()(T& x, T& y) const {
            using std::swap;
            swap(x,y);
        }
    };
}
template <typename E, typename L, int N> inline
void swap(detail::homogeneous_color_base<E,L,N>& x, detail::homogeneous_color_base<E,L,N>& y) {
    static_for_each(x,y,detail::swap_fn());
}

} }  // namespace boost::gil

#endif

{'repo_name': 'steniowagner/bon-appetit-app', 'stars': '262', 'repo_language': 'JavaScript', 'file_name': 'settings.json', 'mime_type': 'text/plain', 'hash': 1294950643442481956, 'source_dataset': 'data'}