text:
import proto  # type: ignore

from google.ads.googleads.v11.enums.types import conversion_tracking_status_enum
from google.ads.googleads.v11.enums.types import (
    customer_pay_per_conversion_eligibility_failure_reason,
)
from google.ads.googleads.v11.enums.types import customer_status

__protobuf__ = proto.module(
    package="google.ads.googleads.v11.resources",
    marshal="google.ads.googleads.v11",
    manifest={
        "Customer",
        "CallReportingSetting",
        "ConversionTrackingSetting",
        "RemarketingSetting",
    },
)

class Customer(proto.Message):
    r"""A customer.

    Attributes:
        resource_name (str):
            Immutable. The resource name of the customer. Customer
            resource names have the form:

            ``customers/{customer_id}``
        id (int):
            Output only. The ID of the customer.

            This field is a member of `oneof`_ ``_id``.
        descriptive_name (str):
            Optional, non-unique descriptive name of the
            customer.

            This field is a member of `oneof`_ ``_descriptive_name``.
        currency_code (str):
            Immutable. The currency in which the account
            operates. A subset of the currency codes from
            the ISO 4217 standard is supported.

            This field is a member of `oneof`_ ``_currency_code``.
        time_zone (str):
            Immutable. The local timezone ID of the
            customer.

            This field is a member of `oneof`_ ``_time_zone``.
        tracking_url_template (str):
            The URL template for constructing a tracking
            URL out of parameters.

            This field is a member of `oneof`_ ``_tracking_url_template``.
        final_url_suffix (str):
            The URL template for appending params to the
            final URL

            This field is a member of `oneof`_ ``_final_url_suffix``.
        auto_tagging_enabled (bool):
            Whether auto-tagging is enabled for the
            customer.

            This field is a member of `oneof`_ ``_auto_tagging_enabled``.
        has_partners_badge (bool):
            Output only. Whether the Customer has a
            Partners program badge. If the Customer is not
            associated with the Partners program, this will
            be false. For more information, see
            https://support.google.com/partners/answer/3125774.

            This field is a member of `oneof`_ ``_has_partners_badge``.
        manager (bool):
            Output only. Whether the customer is a
            manager.

            This field is a member of `oneof`_ ``_manager``.
        test_account (bool):
            Output only. Whether the customer is a test
            account.

            This field is a member of `oneof`_ ``_test_account``.
        call_reporting_setting (google.ads.googleads.v11.resources.types.CallReportingSetting):
            Call reporting setting for a customer. Only mutable in an
            ``update`` operation.
        conversion_tracking_setting (google.ads.googleads.v11.resources.types.ConversionTrackingSetting):
            Output only. Conversion tracking setting for
            a customer.
        remarketing_setting (google.ads.googleads.v11.resources.types.RemarketingSetting):
            Output only. Remarketing setting for a
            customer.
        pay_per_conversion_eligibility_failure_reasons (Sequence[google.ads.googleads.v11.enums.types.CustomerPayPerConversionEligibilityFailureReasonEnum.CustomerPayPerConversionEligibilityFailureReason]):
            Output only. Reasons why the customer is not
            eligible to use PaymentMode.CONVERSIONS. If the
            list is empty, the customer is eligible. This
            field is read-only.
        optimization_score (float):
            Output only. Optimization score of the
            customer.
            Optimization score is an estimate of how well a
            customer's campaigns are set to perform. It
            ranges from 0% (0.0) to 100% (1.0). This field
            is null for all manager customers, and for
            unscored non-manager customers.
            See "About optimization score" at
            https://support.google.com/google-ads/answer/9061546.
            This field is read-only.

            This field is a member of `oneof`_ ``_optimization_score``.
        optimization_score_weight (float):
            Output only. Optimization score weight of the customer.

            Optimization score weight can be used to compare/aggregate
            optimization scores across multiple non-manager customers.
            The aggregate optimization score of a manager is computed as
            the sum over all of their customers of
            ``Customer.optimization_score * Customer.optimization_score_weight``.
            This field is 0 for all manager customers, and for unscored
            non-manager customers.

            This field is read-only.
        status (google.ads.googleads.v11.enums.types.CustomerStatusEnum.CustomerStatus):
            Output only. The status of the customer.
    """

    resource_name = proto.Field(proto.STRING, number=1,)
    id = proto.Field(proto.INT64, number=19, optional=True,)
    descriptive_name = proto.Field(proto.STRING, number=20, optional=True,)
    currency_code = proto.Field(proto.STRING, number=21, optional=True,)
    time_zone = proto.Field(proto.STRING, number=22, optional=True,)
    tracking_url_template = proto.Field(proto.STRING, number=23, optional=True,)
    final_url_suffix = proto.Field(proto.STRING, number=24, optional=True,)
    auto_tagging_enabled = proto.Field(proto.BOOL, number=25, optional=True,)
    has_partners_badge = proto.Field(proto.BOOL, number=26, optional=True,)
    manager = proto.Field(proto.BOOL, number=27, optional=True,)
    test_account = proto.Field(proto.BOOL, number=28, optional=True,)
    call_reporting_setting = proto.Field(
        proto.MESSAGE, number=10, message="CallReportingSetting",
    )
    conversion_tracking_setting = proto.Field(
        proto.MESSAGE, number=14, message="ConversionTrackingSetting",
    )
    remarketing_setting = proto.Field(
        proto.MESSAGE, number=15, message="RemarketingSetting",
    )
    pay_per_conversion_eligibility_failure_reasons = proto.RepeatedField(
        proto.ENUM,
        number=16,
        enum=customer_pay_per_conversion_eligibility_failure_reason.CustomerPayPerConversionEligibilityFailureReasonEnum.CustomerPayPerConversionEligibilityFailureReason,
    )
    optimization_score = proto.Field(proto.DOUBLE, number=29, optional=True,)
    optimization_score_weight = proto.Field(proto.DOUBLE, number=30,)
    status = proto.Field(
        proto.ENUM,
        number=36,
        enum=customer_status.CustomerStatusEnum.CustomerStatus,
    )

class CallReportingSetting(proto.Message):
    r"""Call reporting setting for a customer. Only mutable in an ``update``
    operation.

    Attributes:
        call_reporting_enabled (bool):
            Enable reporting of phone call events by
            redirecting them through Google System.

            This field is a member of `oneof`_ ``_call_reporting_enabled``.
        call_conversion_reporting_enabled (bool):
            Whether to enable call conversion reporting.

            This field is a member of `oneof`_ ``_call_conversion_reporting_enabled``.
        call_conversion_action (str):
            Customer-level call conversion action to attribute a call
            conversion to. If not set a default conversion action is
            used. Only in effect when call_conversion_reporting_enabled
            is set to true.

            This field is a member of `oneof`_ ``_call_conversion_action``.
    """

    call_reporting_enabled = proto.Field(proto.BOOL, number=10, optional=True,)
    call_conversion_reporting_enabled = proto.Field(
        proto.BOOL, number=11, optional=True,
    )
    call_conversion_action = proto.Field(
        proto.STRING, number=12, optional=True,
    )

class ConversionTrackingSetting(proto.Message):
    r"""A collection of customer-wide settings related to Google Ads
    Conversion Tracking.

    Attributes:
        conversion_tracking_id (int):
            Output only. The conversion tracking id used for this
            account. This id doesn't indicate whether the customer uses
            conversion tracking (conversion_tracking_status does). This
            field is read-only.

            This field is a member of `oneof`_ ``_conversion_tracking_id``.
        cross_account_conversion_tracking_id (int):
            Output only. The conversion tracking id of the customer's
            manager. This is set when the customer is opted into cross
            account conversion tracking, and it overrides
            conversion_tracking_id. This field can only be managed
            through the Google Ads UI. This field is read-only.

            This field is a member of `oneof`_ ``_cross_account_conversion_tracking_id``.
        accepted_customer_data_terms (bool):
            Output only. Whether the customer has
            accepted customer data terms. If using
            cross-account conversion tracking, this value is
            inherited from the manager. This field is
            read-only. For more
            information, see
            https://support.google.com/adspolicy/answer/7475709.
        conversion_tracking_status (google.ads.googleads.v11.enums.types.ConversionTrackingStatusEnum.ConversionTrackingStatus):
            Output only. Conversion tracking status. It indicates
            whether the customer is using conversion tracking, and who
            is the conversion tracking owner of this customer. If this
            customer is using cross-account conversion tracking, the
            value returned will differ based on the
            ``login-customer-id`` of the request.
        enhanced_conversions_for_leads_enabled (bool):
            Output only. Whether the customer is opted-in
            for enhanced conversions for leads. If using
            cross-account conversion tracking, this value is
            inherited from the manager. This field is
            read-only.
        google_ads_conversion_customer (str):
            Output only. The resource name of the
            customer where conversions are created and
            managed. This field is read-only.
    """

    conversion_tracking_id = proto.Field(proto.INT64, number=3, optional=True,)
    cross_account_conversion_tracking_id = proto.Field(
        proto.INT64, number=4, optional=True,
    )
    accepted_customer_data_terms = proto.Field(proto.BOOL, number=5,)
    conversion_tracking_status = proto.Field(
        proto.ENUM,
        number=6,
        enum=conversion_tracking_status_enum.ConversionTrackingStatusEnum.ConversionTrackingStatus,
    )
    enhanced_conversions_for_leads_enabled = proto.Field(proto.BOOL, number=7,)
    google_ads_conversion_customer = proto.Field(proto.STRING, number=8,)

class RemarketingSetting(proto.Message):
    r"""Remarketing setting for a customer.

    Attributes:
        google_global_site_tag (str):
            Output only. The Google tag.

            This field is a member of `oneof`_ ``_google_global_site_tag``.
    """

    google_global_site_tag = proto.Field(proto.STRING, number=2, optional=True,)

__all__ = tuple(sorted(__protobuf__.manifest))


text:
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName("Dialog")
        Dialog.resize(597, 591)
        self.gridLayout = QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.configGroupBox = QGroupBox(Dialog)
        self.configGroupBox.setObjectName("configGroupBox")
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.configGroupBox.sizePolicy().hasHeightForWidth())
        self.configGroupBox.setSizePolicy(sizePolicy)
        self.formLayout = QFormLayout(self.configGroupBox)
        self.formLayout.setObjectName("formLayout")
        self.formLayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        self.label0 = QLabel(self.configGroupBox)
        self.label0.setObjectName("label0")

        self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label0)

        self.lineEdit_id = QLineEdit(self.configGroupBox)
        self.lineEdit_id.setObjectName("lineEdit_id")

        self.formLayout.setWidget(0, QFormLayout.FieldRole, self.lineEdit_id)

        self.label1 = QLabel(self.configGroupBox)
        self.label1.setObjectName("label1")

        self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label1)

        self.comboBox_regmode = QComboBox(self.configGroupBox)
        self.comboBox_regmode.setObjectName("comboBox_regmode")

        self.formLayout.setWidget(1, QFormLayout.FieldRole, self.comboBox_regmode)

        self.label = QLabel(self.configGroupBox)
        self.label.setObjectName("label")

        self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label)

        self.spinBox_pcsToFit = QSpinBox(self.configGroupBox)
        self.spinBox_pcsToFit.setObjectName("spinBox_pcsToFit")
        self.spinBox_pcsToFit.setMinimum(1)
        self.spinBox_pcsToFit.setMaximum(99)

        self.formLayout.setWidget(2, QFormLayout.FieldRole, self.spinBox_pcsToFit)

        self.label_2 = QLabel(self.configGroupBox)
        self.label_2.setObjectName("label_2")

        self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_2)

        self.doubleSpinBox_mWeight = QDoubleSpinBox(self.configGroupBox)
        self.doubleSpinBox_mWeight.setObjectName("doubleSpinBox_mWeight")
        self.doubleSpinBox_mWeight.setSingleStep(0.100000000000000)

        self.formLayout.setWidget(3, QFormLayout.FieldRole, self.doubleSpinBox_mWeight)

        self.label_3 = QLabel(self.configGroupBox)
        self.label_3.setObjectName("label_3")

        self.formLayout.setWidget(4, QFormLayout.LabelRole, self.label_3)

        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.tableWidgetLandmarks = QTableWidget(self.configGroupBox)
        if (self.tableWidgetLandmarks.columnCount() < 2):
            self.tableWidgetLandmarks.setColumnCount(2)
        __qtablewidgetitem = QTableWidgetItem()
        self.tableWidgetLandmarks.setHorizontalHeaderItem(0, __qtablewidgetitem)
        __qtablewidgetitem1 = QTableWidgetItem()
        self.tableWidgetLandmarks.setHorizontalHeaderItem(1, __qtablewidgetitem1)
        self.tableWidgetLandmarks.setObjectName("tableWidgetLandmarks")
        sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(self.tableWidgetLandmarks.sizePolicy().hasHeightForWidth())
        self.tableWidgetLandmarks.setSizePolicy(sizePolicy1)
        self.tableWidgetLandmarks.setMaximumSize(QSize(16777215, 16777215))
        self.tableWidgetLandmarks.horizontalHeader().setMinimumSectionSize(200)
        self.tableWidgetLandmarks.horizontalHeader().setDefaultSectionSize(200)

        self.verticalLayout.addWidget(self.tableWidgetLandmarks)

        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.pushButton_addLandmark = QPushButton(self.configGroupBox)
        self.pushButton_addLandmark.setObjectName("pushButton_addLandmark")

        self.horizontalLayout_2.addWidget(self.pushButton_addLandmark)

        self.pushButton_removeLandmark = QPushButton(self.configGroupBox)
        self.pushButton_removeLandmark.setObjectName("pushButton_removeLandmark")

        self.horizontalLayout_2.addWidget(self.pushButton_removeLandmark)

        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.formLayout.setLayout(4, QFormLayout.FieldRole, self.verticalLayout)

        self.label_12 = QLabel(self.configGroupBox)
        self.label_12.setObjectName("label_12")

        self.formLayout.setWidget(5, QFormLayout.LabelRole, self.label_12)

        self.doubleSpinBox_markerRadius = QDoubleSpinBox(self.configGroupBox)
        self.doubleSpinBox_markerRadius.setObjectName("doubleSpinBox_markerRadius")

        self.formLayout.setWidget(5, QFormLayout.FieldRole, self.doubleSpinBox_markerRadius)

        self.label_13 = QLabel(self.configGroupBox)
        self.label_13.setObjectName("label_13")

        self.formLayout.setWidget(6, QFormLayout.LabelRole, self.label_13)

        self.doubleSpinBox_skinPad = QDoubleSpinBox(self.configGroupBox)
        self.doubleSpinBox_skinPad.setObjectName("doubleSpinBox_skinPad")

        self.formLayout.setWidget(6, QFormLayout.FieldRole, self.doubleSpinBox_skinPad)

        self.label_10 = QLabel(self.configGroupBox)
        self.label_10.setObjectName("label_10")

        self.formLayout.setWidget(7, QFormLayout.LabelRole, self.label_10)

        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.checkBox_kneedof = QCheckBox(self.configGroupBox)
        self.checkBox_kneedof.setObjectName("checkBox_kneedof")

        self.horizontalLayout.addWidget(self.checkBox_kneedof)

        self.checkBox_kneecorr = QCheckBox(self.configGroupBox)
        self.checkBox_kneecorr.setObjectName("checkBox_kneecorr")

        self.horizontalLayout.addWidget(self.checkBox_kneecorr)

        self.formLayout.setLayout(7, QFormLayout.FieldRole, self.horizontalLayout)

        self.label_11 = QLabel(self.configGroupBox)
        self.label_11.setObjectName("label_11")

        self.formLayout.setWidget(8, QFormLayout.LabelRole, self.label_11)

        self.checkBox_GUI = QCheckBox(self.configGroupBox)
        self.checkBox_GUI.setObjectName("checkBox_GUI")

        self.formLayout.setWidget(8, QFormLayout.FieldRole, self.checkBox_GUI)

        self.gridLayout.addWidget(self.configGroupBox, 0, 0, 1, 1)

        self.buttonBox = QDialogButtonBox(Dialog)
        self.buttonBox.setObjectName("buttonBox")
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)

        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)

        QWidget.setTabOrder(self.lineEdit_id, self.comboBox_regmode)
        QWidget.setTabOrder(self.comboBox_regmode, self.spinBox_pcsToFit)
        QWidget.setTabOrder(self.spinBox_pcsToFit, self.doubleSpinBox_mWeight)
        QWidget.setTabOrder(self.doubleSpinBox_mWeight, self.tableWidgetLandmarks)
        QWidget.setTabOrder(self.tableWidgetLandmarks, self.pushButton_addLandmark)
        QWidget.setTabOrder(self.pushButton_addLandmark, self.pushButton_removeLandmark)
        QWidget.setTabOrder(self.pushButton_removeLandmark, self.doubleSpinBox_markerRadius)
        QWidget.setTabOrder(self.doubleSpinBox_markerRadius, self.doubleSpinBox_skinPad)
        QWidget.setTabOrder(self.doubleSpinBox_skinPad, self.checkBox_kneedof)
        QWidget.setTabOrder(self.checkBox_kneedof, self.checkBox_kneecorr)
        QWidget.setTabOrder(self.checkBox_kneecorr, self.checkBox_GUI)
        QWidget.setTabOrder(self.checkBox_GUI, self.buttonBox)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)

        QMetaObject.connectSlotsByName(Dialog)
    # setupUi

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QCoreApplication.translate("Dialog", "Configure 2-Sided Lower Limb Registration Step", None))
        self.configGroupBox.setTitle("")
        self.label0.setText(QCoreApplication.translate("Dialog", "identifier:  ", None))
        self.label1.setText(QCoreApplication.translate("Dialog", "Registration Mode:", None))
        self.label.setText(QCoreApplication.translate("Dialog", "PCs to Fit:", None))
        self.label_2.setText(QCoreApplication.translate("Dialog", "Mahalanobis Weight:", None))
        self.label_3.setText(QCoreApplication.translate("Dialog", "Landmarks:", None))
        ___qtablewidgetitem = self.tableWidgetLandmarks.horizontalHeaderItem(0)
        ___qtablewidgetitem.setText(QCoreApplication.translate("Dialog", "Model Landmarks", None));
        ___qtablewidgetitem1 = self.tableWidgetLandmarks.horizontalHeaderItem(1)
        ___qtablewidgetitem1.setText(QCoreApplication.translate("Dialog", "Target Landmarks", None));
        self.pushButton_addLandmark.setText(QCoreApplication.translate("Dialog", "Add Landmark", None))
        self.pushButton_removeLandmark.setText(QCoreApplication.translate("Dialog", "Remove Landmark", None))
        self.label_12.setText(QCoreApplication.translate("Dialog", "Marker Radius:", None))
        self.label_13.setText(QCoreApplication.translate("Dialog", "Skin Padding:", None))
        self.label_10.setText(QCoreApplication.translate("Dialog", "Knee Options:", None))
        self.checkBox_kneedof.setText(QCoreApplication.translate("Dialog", "Abd. DOF", None))
        self.checkBox_kneecorr.setText(QCoreApplication.translate("Dialog", "Abd. Correction", None))
        self.label_11.setText(QCoreApplication.translate("Dialog", "GUI:", None))
        self.checkBox_GUI.setText("")
    # retranslateUi

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft Corporation. All rights reserved.

using System.ComponentModel.DataAnnotations;

namespace TriviaBot.Runtime
{
    /// <summary>
    /// This list of categories comes from the list of supported categories on https://opentdb.com/
    /// </summary>
    public enum TriviaCategory
    {
        None = -1,

        [Display(Name = "Any")]
        Any = 0,

        [Display(Name = "General Knowledge")]
        GeneralKnowledge = 9,

        [Display(Name = "Entertainment: Books")]
        EntertainmentBooks,

        [Display(Name = "Entertainment: Film")]
        EntertainmentFilm,

        [Display(Name = "Entertainment: Music")]
        EntertainmentMusic,

        [Display(Name = "Entertainment: Musicals & Theatres")]
        EntertainmentMusicalsTheatre,

        [Display(Name = "Entertainment: Television")]
        EntertainmentTelevision,

        [Display(Name = "Entertainment: Video Games")]
        EntertainmentVideoGames,

        [Display(Name = "Entertainment: Board Games")]
        EntertainmentBoardGames,

        [Display(Name = "Science & Nature")]
        ScienceNature,

        [Display(Name = "Science: Computers")]
        ScienceComputers,

        [Display(Name = "Science: Mathematics")]
        ScienceMathematics,

        [Display(Name = "Mythology")]
        Mythology,

        [Display(Name = "Sports")]
        Sports,

        [Display(Name = "Geography")]
        Geography,

        [Display(Name = "History")]
        History,

        [Display(Name = "Politics")]
        Politics,

        [Display(Name = "Art")]
        Art,

        [Display(Name = "Celebrities")]
        Celebrities,

        [Display(Name = "Animals")]
        Animals,

        [Display(Name = "Vehicles")]
        Vehicles,

        [Display(Name = "Entertainment: Comics")]
        EntertainmentComics,

        [Display(Name = "Science: Gadgets")]
        ScienceGadgets,

        [Display(Name = "Entertainment: Japanese Anime & Manga")]
        EntertainmentJapaneseAnimeManga,
    }
}


text:
package org.kie.server.controller.service;

import java.util.ServiceLoader;

import org.kie.server.controller.api.service.PersistingServerTemplateStorageService;
import org.kie.server.controller.rest.RestSpecManagementServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class StandaloneSpecManagementServiceImpl extends RestSpecManagementServiceImpl {
    private static Logger logger = LoggerFactory.getLogger(StandaloneSpecManagementServiceImpl.class);

    public StandaloneSpecManagementServiceImpl() {
        super();
        ServiceLoader<PersistingServerTemplateStorageService> templateStorageServices =
        		ServiceLoader.load(PersistingServerTemplateStorageService.class);
        if (templateStorageServices != null && templateStorageServices.iterator().hasNext()) {
            PersistingServerTemplateStorageService storageService = templateStorageServices.iterator().next();
            this.setTemplateStorage(storageService.getTemplateStorage());
            logger.debug("Setting template storage for SpecManagementService to {}",
            		storageService.getTemplateStorage().toString());
        } else {
            logger.warn("No server template storage defined. Default storage: InMemoryKieServerTemplateStorage will be used");
        }
    }
}


text:
Imports System.Windows.Forms
Imports System.Text
Imports System.Data
Imports System.Data.SqlClient

Public Class frmFoundation

    Public WithEvents cms As New ContextMenuStrip
    Public _GridRowIndex As Long = 0

    Private Sub frmFoundation_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        mGRCData = New GRCSec.GridcoinData

        Dim sVoting As String = msGenericDictionary("POLLS")
        Log(sVoting)
        mGRCData = New GRCSec.GridcoinData

        If Len(sVoting) = 0 Then Exit Sub

        'List the active Foundation Expenses
        Dim sHeading As String = "#;Title;Expiration;Share Type;Question;Answers;Total Participants;Total Shares;Best Answer;Type;Amount"
        dgv.Rows.Clear()
        dgv.Columns.Clear()
        dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect
        dgv.EditingPanel.Visible = False
        dgv.AllowUserToAddRows = False
        dgv.ReadOnly = True

        Dim vHeading() As String = Split(sHeading, ";")

        PopulateHeadings(vHeading, dgv, True)
        '4-22-2016

        Dim iRow As Long = 0
        Dim vPolls() As String = Split(sVoting, "<POLL>")

        Try

            For y As Integer = 0 To UBound(vPolls)
                vPolls(y) = Replace(vPolls(y), "_", " ")
                Dim sTitle As String = ExtractXML(vPolls(y), "<TITLE>", "</TITLE>")
                Dim sExpiration As String = ExtractXML(vPolls(y), "<EXPIRATION>")
                Dim sShareType As String = ExtractXML(vPolls(y), "<SHARETYPE>")
                Dim sQuestion As String = ExtractXML(vPolls(y), "<QUESTION>")
                Dim sAnswers As String = ExtractXML(vPolls(y), "<ANSWERS>")
                Dim sId As String = GetFoundationGuid(sTitle)
                If Len(sId) > 0 Then
                    Dim lDateDiff As Long = DateDiff(DateInterval.Day, Now, GlobalCDate(sExpiration))
                    If Len(sTitle) > 0 And lDateDiff > -7 Then
                        'Array of answers
                        Dim sArrayOfAnswers As String = ExtractXML(vPolls(y), "<ARRAYANSWERS>")
                        Dim vAnswers() As String = Split(sArrayOfAnswers, "<RESERVED>")
                        For subY As Integer = 0 To vAnswers.Length - 1
                            Dim sAnswerName As String = ExtractXML(vAnswers(subY), "<ANSWERNAME>")
                            Dim sParticipants As String = ExtractXML(vAnswers(subY), "<PARTICIPANTS>")
                            Dim sShares As String = ExtractXML(vAnswers(subY), "<SHARES>")

                        Next
                        Dim sTotalParticipants As String = ExtractXML(vPolls(y), "<TOTALPARTICIPANTS>")
                        Dim sTotalShares As String = ExtractXML(vPolls(y), "<TOTALSHARES>")
                        Dim sBestAnswer As String = ExtractXML(vPolls(y), "<BESTANSWER>")
                        dgv.Rows.Add()
                        dgv.Rows(iRow).Cells(0).Value = iRow + 1
                        dgv.Rows(iRow).Cells(1).Value = sTitle
                        '                        If Len(sTitle) > 65 Then dgv.Rows(iRow).Cells(1).Value += "..."
                        dgv.Rows(iRow).Cells(2).Value = sExpiration
                        If lDateDiff < 0 Then dgv.Rows(iRow).Cells(2).Style.BackColor = Drawing.Color.Red
                        dgv.Rows(iRow).Cells(3).Value = sShareType
                        dgv.Rows(iRow).Cells(4).Value = sQuestion
                        If Len(sAnswers) > 71 Then sAnswers = Mid(sAnswers, 1, 71) + "..."
                        dgv.Rows(iRow).Cells(5).Value = sAnswers
                        dgv.Rows(iRow).Cells(6).Value = sTotalParticipants
                        dgv.Rows(iRow).Cells(7).Value = sTotalShares
                        dgv.Rows(iRow).Cells(8).Value = sBestAnswer
                        'Retrieve the Campaign from GFS
                        Dim oExpense As SqlDataReader = mGRCData.GetBusinessObject("Expense", sId, "ExpenseId")
                        If Not oExpense Is Nothing Then
                            If oExpense.HasRows Then
                                dgv.Rows(iRow).Cells(9).Value = oExpense("Type")
                                dgv.Rows(iRow).Cells(10).Value = oExpense("Amount")
                            End If

                        End If

                        iRow += 1
                    End If
                End If

            Next
            dgv.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.None
            dgv.Columns(1).Width = 350

        Catch ex As Exception
            Log(ex.Message)

        End Try

    End Sub

    Private Sub dgv_CellContentDoubleClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellContentDoubleClick
        _GridRowIndex = e.RowIndex
        If _GridRowIndex < 0 Then Exit Sub
        Dim sTitle As String = dgv.Rows(_GridRowIndex).Cells(1).Value
        If Len(sTitle) > 0 Then
            Dim frmChart As New frmChartVotes
            frmChart.Show()
            frmChart.ChartPoll(sTitle)
        End If
    End Sub
    Private Sub dgv_CellMouseClick(sender As Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgv.CellMouseClick
        If e.Button = Windows.Forms.MouseButtons.Left Then
            If dgv.ContextMenuStrip Is Nothing Then Exit Sub
            dgv.ContextMenuStrip.Visible = False
        End If
        _GridRowIndex = e.RowIndex
        If _GridRowIndex < 0 Then Exit Sub

        Dim sTitle As String = dgv.Rows(_GridRowIndex).Cells(1).Value

        If e.Button = Windows.Forms.MouseButtons.Right Then
            If Len(sTitle) > 1 Then
                Dim _EventList As String = "Chart|Vote|View"

                cms.Items.Clear()
                Dim vEventList() As String
                vEventList = Split(_EventList, "|")
                dgv.Rows(e.RowIndex).Selected = True
                For x As Integer = 0 To UBound(vEventList)
                    cms.Items.Add(vEventList(x))
                    AddHandler cms.Items(x).Click, AddressOf ContextMenuSelected
                Next
                dgv.ContextMenuStrip = cms
                dgv.ContextMenuStrip.Show(Cursor.Position)
            End If

        End If
    End Sub
    Private Sub ContextMenuSelected(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim tsmi As ToolStripMenuItem = sender
        If _GridRowIndex = -1 Then
            'User is clicking on the header
            dgv.ContextMenuStrip.Hide()
            Exit Sub
        End If
        Dim sTitle As String = dgv.Rows(_GridRowIndex).Cells(1).Value
        Dim sExpiration As String = dgv.Rows(_GridRowIndex).Cells(2).Value
        Dim lDateDiff As Long = DateDiff(DateInterval.Day, Now, GlobalCDate(sExpiration))

        If tsmi.Text = "Chart" Then
            'Drill into the vote, and chart the vote:
            If Len(sTitle) > 0 Then
                Dim frmChart As New frmChartVotes
                frmChart.Show()
                frmChart.ChartPoll(sTitle)
            End If

        ElseIf tsmi.Text = "Vote" Then
            If lDateDiff < 0 Then MsgBox("You may not vote on an expired poll.", MsgBoxStyle.Critical, "Gridcoin Voting System") : Exit Sub

            Dim frmVote As New frmPlaceVote
            frmVote.Show()
            frmVote.PlaceVote(sTitle)
        ElseIf tsmi.Text = "View" Then
            If Len(sTitle) > 0 Then
                Log(sTitle)
                Dim frmE As New frmAddExpense
                frmE.Mode = "View"
                Dim sGuid As String = ""
                Try
                    sGuid = GetFoundationGuid(sTitle)
                Catch ex As Exception
                    Log("guid " + ex.Message)
                End Try
                frmE.myGuid = sGuid
                frmE.Show()
            End If
        End If

    End Sub

    Private Sub dgv_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellContentClick

    End Sub

    Private Sub SubmitExpenseToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SubmitExpenseToolStripMenuItem.Click
        Dim fExp As New frmAddExpense
        fExp.Mode = "Add"
        fExp.Show()

    End Sub

    Private Sub LogOffToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles LogOffToolStripMenuItem.Click
        mGRCData.LogOff(GetSessionGuid)

    End Sub

    Private Sub ChangePasswordToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ChangePasswordToolStripMenuItem.Click
        Dim frmP As New frmChangePassword
        frmP.Show()
    End Sub

    Private Sub LogOnToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles LogOnToolStripMenuItem1.Click
        Dim frmLogon As New frmLogin
        frmLogon.Show()
    End Sub
End Class


text:
MultipleSelect = function(select, options) {

	/*
		Turns a <select multiple="multiple"> element into a better looking UI.
		Inspired by the one found here: http://loudev.com/, the aim is to produce a lighter version with less mark-up and ID/class usage.
		No styling is applied.
	*/

	/*
		- Let's assume that the options will have a value and that at the end, the use wants to look at the select to get all those that have been selected
		- The UI should not be touched
		- No optimisations are in place... yet!
		- Extra requirements:
			- The ability to allow mark-up in the UI items:
				- Mark-up in the option tag - Nasty!
				- Mark-up in the option's data - Sounds heavy
				- An object which maps the value to the mark-up? Could just work
			- Allow the order to be changed:
				- Drag 'n' drop
				- Up and down arrows
		- Possible changes:
			- Maintain the order as the items pass back and forth as the options order is followed at the moment
		- Possible optimisations:
			- Group creation of HTML and add to the DOM in one hit
			- Use native JS in place of jQuery
			- Don't call refresh() every time itemClicked() is called, instead, move items manually
		- Add events for:
			- On selected
			- On unselected
	*/

	select = $(select);
	options = options || {
		selectableClass: "selectable",
		selectedClass: "selected",
		itemHoverClass: "hover",
		markUpMap: {}
	};

	if (select.length !== 1) throw "No select element was supplied to MultipleSelect()";

	var self = this;
	var selectableClass = options.selectableClass;
	var selectedClass = options.selectedClass;
	var itemHoverClass = options.itemHoverClass;
	var markUpMap = options.markUpMap;

	// Hide the select
	select.hide();

	// Create two panes
	var selectableItems = $("

");
	var selectedItems = $("

");

	// Place the lists after the select
	select.after(selectedItems).after(selectableItems);

	selectableItems.on("click", "li", function(e) {
		itemClicked(this);
	});

	selectedItems.on("click", "li", function(e) {
		itemClicked(this);
	});

	selectableItems.on("mouseover", "li", function(e) {
		$(this).addClass(itemHoverClass);
	}).on("mouseout", "li", function(e) {
		$(this).removeClass(itemHoverClass);
	});

	selectedItems.on("mouseover", "li", function(e) {
		$(this).addClass(itemHoverClass);
	}).on("mouseout", "li", function(e) {
		$(this).removeClass(itemHoverClass);
	});

	self.refresh = function() {

		// Update the UI based on the current state of the select

		// Clear the UI
		$("ul", selectableItems).html("");
		$("ul", selectedItems).html("");

		// For each option, create an item and place in the correct list
		$("option", select).each(function(i, option) {

			if (option.selected) {
				addSelected(createItem(option));
			} else {
				addSelectable(createItem(option));
			}

		});

	};

	self.addOption = function(value, text, selected) {

		if (selected === undefined) selected = false;

		// Ignore if it already exists in the select
		if ($("option[value='" + value + "']", select).length === 0) {
			var option = "<option value='" + value + "'" + (selected ? " selected='selected'" : "") + ">" + text + "</option>";
			select.append(option);
		}

	};

	function itemClicked(item) {
		var $item = $(item);
		var value = $item.data("value");
		$("option[value='" + value + "']", select).get(0).selected = $item.closest("div").hasClass(selectableClass);
		self.refresh();
	}

	function createItem(option) {
		return $("
" + (markUpMap[option.value] || option.text) + "
").data("value", option.value);
	}

	function addSelectable(item) {
		$("ul", selectableItems).append(item);
	}

	function addSelected(item) {
		$("ul", selectedItems).append(item);
	}

	// Initialise
	self.refresh();

}


text:
ACCEPTED

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

#### Published in
S. L. Endlicher et al. , Enum. pl. 41. 1837

#### Original name
Glycine comptoniana Andrews

### Remarks
null


text:
require 'test_helper'

class XmlTest < ActiveSupport::TestCase
  # Replace this with your real tests.
  test "the truth" do
    assert true
  end
end

# == Schema Information
#
# Table name: xmls
#
#  id           :integer(4)      not null, primary key
#  finance_name :string(255)
#  ledger_name  :string(255)
#  created_at   :datetime
#  updated_at   :datetime
#


text:
<?xml version="1.0" encoding="utf-8"?>
<!--

-->

<merge
    xmlns:latin="http://schemas.android.com/apk/res/com.udmurtlyk.extrainputmethod.latin"
>
    <Row
        latin:keyWidth="10%p"
    >
        <Key
            latin:keyStyle="toSymbolKeyStyle"
            latin:keyWidth="15%p" />
        <include
            latin:keyboardLayout="@xml/key_comma" />
        <include
            latin:keyXPos="25%p"
            latin:keyboardLayout="@xml/key_space_5kw" />
        <include
            latin:keyboardLayout="@xml/key_period" />
        <Key
            latin:keyStyle="enterKeyStyle"
            latin:keyWidth="fillRight" />
    </Row>
</merge>


text:
package externaldata

import (
	"testing"

	"github.com/open-policy-agent/frameworks/constraint/pkg/apis/externaldata/v1alpha1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
	validCABundle   = "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUIwekNDQVgyZ0F3SUJBZ0lKQUkvTTdCWWp3Qit1TUEwR0NTcUdTSWIzRFFFQkJRVUFNRVV4Q3pBSkJnTlYKQkFZVEFrRlZNUk13RVFZRFZRUUlEQXBUYjIxbExWTjBZWFJsTVNFd0h3WURWUVFLREJoSmJuUmxjbTVsZENCWAphV1JuYVhSeklGQjBlU0JNZEdRd0hoY05NVEl3T1RFeU1qRTFNakF5V2hjTk1UVXdPVEV5TWpFMU1qQXlXakJGCk1Rc3dDUVlEVlFRR0V3SkJWVEVUTUJFR0ExVUVDQXdLVTI5dFpTMVRkR0YwWlRFaE1COEdBMVVFQ2d3WVNXNTAKWlhKdVpYUWdWMmxrWjJsMGN5QlFkSGtnVEhSa01Gd3dEUVlKS29aSWh2Y05BUUVCQlFBRFN3QXdTQUpCQU5MSgpoUEhoSVRxUWJQa2xHM2liQ1Z4d0dNUmZwL3Y0WHFoZmRRSGRjVmZIYXA2TlE1V29rLzR4SUErdWkzNS9NbU5hCnJ0TnVDK0JkWjF0TXVWQ1BGWmNDQXdFQUFhTlFNRTR3SFFZRFZSME9CQllFRkp2S3M4UmZKYVhUSDA4VytTR3YKelF5S24wSDhNQjhHQTFVZEl3UVlNQmFBRkp2S3M4UmZKYVhUSDA4VytTR3Z6UXlLbjBIOE1Bd0dBMVVkRXdRRgpNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUZCUUFEUVFCSmxmZkpIeWJqREd4Uk1xYVJtRGhYMCs2djAyVFVLWnNXCnI1UXVWYnBRaEg2dSswVWdjVzBqcDlRd3B4b1BUTFRXR1hFV0JCQnVyeEZ3aUNCaGtRK1YKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo="
	badBase64String = "!"
	badCABundle     = "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCmhlbGxvCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"
)

type cacheTestCase struct {
	Name          string
	Provider      *v1alpha1.Provider
	ErrorExpected bool
}

func createProvider(name string, url string, timeout int, caBundle string, insecureTLSSkipVerify bool) *v1alpha1.Provider {
	return &v1alpha1.Provider{
		ObjectMeta: metav1.ObjectMeta{
			Name: name,
		},
		Spec: v1alpha1.ProviderSpec{
			URL:                   url,
			Timeout:               timeout,
			CABundle:              caBundle,
			InsecureTLSSkipVerify: insecureTLSSkipVerify,
		},
	}
}

func TestUpsert(t *testing.T) {
	tc := []cacheTestCase{
		{
			Name:          "valid http provider",
			Provider:      createProvider("test", "http://test", 1, "", true),
			ErrorExpected: false,
		},
		{
			Name:          "http provider with caBundle and insecureTLSSkipVerify",
			Provider:      createProvider("test", "http://test", 1, validCABundle, true),
			ErrorExpected: false,
		},
		{
			Name:          "http provider with bad caBundle and insecureTLSSkipVerify",
			Provider:      createProvider("test", "http://test", 1, badCABundle, true),
			ErrorExpected: true,
		},
		{
			Name:          "http provider without insecure tls skip verify",
			Provider:      createProvider("test", "http://test", 1, "", false),
			ErrorExpected: true,
		},
		{
			Name:          "valid https provider",
			Provider:      createProvider("test", "https://test", 1, validCABundle, false),
			ErrorExpected: false,
		},
		{
			Name:          "https provider with no caBundle",
			Provider:      createProvider("test", "https://test", 1, "", false),
			ErrorExpected: true,
		},
		{
			Name:          "https provider with bad base64 caBundle",
			Provider:      createProvider("test", "https://test", 1, badBase64String, false),
			ErrorExpected: true,
		},
		{
			Name:          "https provider with bad caBundle",
			Provider:      createProvider("test", "https://test", 1, badCABundle, false),
			ErrorExpected: true,
		},
		{
			Name:          "empty name",
			Provider:      createProvider("", "http://test", 1, "", true),
			ErrorExpected: true,
		},
		{
			Name:          "empty url",
			Provider:      createProvider("test", "", 1, "", true),
			ErrorExpected: true,
		},
		{
			Name:          "url with invalid scheme",
			Provider:      createProvider("test", "gopher://test", 1, "", true),
			ErrorExpected: true,
		},
		{
			Name:          "invalid url",
			Provider:      createProvider("test", " http://foo.com", 1, "", true),
			ErrorExpected: true,
		},
		{
			Name:          "invalid timeout",
			Provider:      createProvider("test", "http://test", -1, "", true),
			ErrorExpected: true,
		},
		{
			Name:          "empty provider",
			Provider:      &v1alpha1.Provider{},
			ErrorExpected: true,
		},
	}
	for _, tt := range tc {
		cache := NewCache()
		t.Run(tt.Name, func(t *testing.T) {
			err := cache.Upsert(tt.Provider)

			if (err == nil) && tt.ErrorExpected {
				t.Fatalf("err = nil; want non-nil")
			}
			if (err != nil) && !tt.ErrorExpected {
				t.Fatalf("err = \"%s\"; want nil", err)
			}
		})
	}
}

func TestGet(t *testing.T) {
	tc := []cacheTestCase{
		{
			Name:          "valid provider",
			Provider:      createProvider("test", "http://test", 1, "", true),
			ErrorExpected: false,
		},
		{
			Name:          "invalid provider",
			Provider:      createProvider("", "http://test", 1, "", true),
			ErrorExpected: true,
		},
	}
	for _, tt := range tc {
		cache := NewCache()
		t.Run(tt.Name, func(t *testing.T) {
			_ = cache.Upsert(tt.Provider)
			_, err := cache.Get(tt.Provider.Name)

			if (err == nil) && tt.ErrorExpected {
				t.Fatalf("err = nil; want non-nil")
			}
			if (err != nil) && !tt.ErrorExpected {
				t.Fatalf("err = \"%s\"; want nil", err)
			}
		})
	}
}

func TestRemove(t *testing.T) {
	tc := []cacheTestCase{
		{
			Name:          "valid provider",
			Provider:      createProvider("test", "http://test", 1, "", true),
			ErrorExpected: false,
		},
	}
	for _, tt := range tc {
		cache := NewCache()
		t.Run(tt.Name, func(t *testing.T) {
			_ = cache.Upsert(tt.Provider)
			cache.Remove(tt.Provider.Name)

			if (cache != nil) && tt.ErrorExpected {
				t.Fatalf("cache = \"%v\"; want nil", cache)
			}
		})
	}
}


text:
export * from './bar/bar.service';
export * from './foo/foo.component';
export * from './lib.module';


text:
class MailchimpExportsController < ApplicationController
  def index
    @mailchimp_exports = MailchimpExport.all
  end
end


text:
<!DOCTYPE html>
<link rel="author" title="dgrogan@chromium.org" href="mailto:dgrogan@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto" />
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html" />
<meta name="assert" content="Child in nested column flexbox's grows to its parent's flex height, not its parent's specified height.">
<link href="support/flexbox.css" rel="stylesheet">

Test passes if there is a filled green square.


text:
@implementation ZoomPlugin

-(void) pluginInitialize {

    [[ZoomSDK sharedSDK] setZoomDomain:zoomSDKDomain];
    ZoomSDKAuthService *authService = [[ZoomSDK sharedSDK] getAuthService];

    if (authService)
    {
        authService.delegate = self;

        authService.clientKey = zoomSDKAppKey;
        authService.clientSecret = zoomSDKAppSecret;

        [authService sdkAuth];
    }

}

- (void) joinMeeting :(CDVInvokedUrlCommand*)command {
    //store the command argument because it is referenced in
    //other events to send back result
    self.command = command;

    NSString* meetingNumber = [command.arguments objectAtIndex:0];
    NSString* userDisplayName = [command.arguments objectAtIndex:1];

    //zoom sdk requires a window with navigation controller
    self.zoomWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    self.zoomWindow.backgroundColor = [UIColor clearColor];

    UINavigationController *navController = [[UINavigationController alloc] init];
    [navController setNavigationBarHidden:YES];

    self.zoomWindow.rootViewController = navController;
    self.zoomWindow.windowLevel = UIWindowLevelStatusBar;
    self.zoomWindow.hidden = NO;

    [navController setNavigationBarHidden:YES];
    [[ZoomSDK sharedSDK] setZoomRootController:navController];

    ZoomSDKMeetingService *ms = [[ZoomSDK sharedSDK] getMeetingService];

    if (ms)
    {
        ms.delegate = self;

        ZoomSDKMeetError ret = [ms joinMeeting:meetingNumber displayName:userDisplayName];

        NSLog(@"onJoinaMeeting ret:%d", ret);
    }
    else{
        //return error
        // Check command.arguments here.
        [self.commandDelegate runInBackground:^{
            NSString* payload = @"Unable to instantiate Zoom meeting service";
            CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:payload];
            // The sendPluginResult method is thread-safe.
            [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
        }];
    }
}

//simple look up for meeting error codes
- (NSString*)returnErrorDescription:(ZoomSDKMeetError)zoomError {
    NSString *result = nil;

    switch(zoomError) {
        case ZoomSDKMeetError_IncorrectMeetingNumber:
            result = @"Incorrect meeting no";
            break;
        case ZoomSDKMeetError_InvalidArguments:
            result = @"Invalid arguments";
            break;
        case ZoomSDKMeetError_MeetingClientIncompatible:
            result = @"Incompatible client";
            break;
        case ZoomSDKMeetError_MeetingNotExist:
            result = @"Meeting does not exist";
            break;
        case ZoomSDKMeetError_MeetingLocked:
            result = @"Meeting locked";
            break;
        case ZoomSDKMeetError_MeetingOver:
            result = @"Meeting over";
            break;
        case ZoomSDKMeetError_MeetingTimeout:
            result = @"Connection timed out";
            break;
        case ZoomSDKMeetError_NetworkUnavailable:
            result = @"Network not available";
            break;
        case ZoomSDKMeetError_MeetingRestricted:
            result = @"Meeting restricted";
            break;
        case ZoomSDKMeetError_MeetingJBHRestricted:
            result = @"Meeting restricted";
            break;
        default:
            result = @"Unknown error";
    }

    return result;
}

//simple look up for auth error codes

- (NSString*)returnAuthErrorDescription:(ZoomSDKAuthError)authError {
    NSString *result = nil;

    switch(authError) {
        case ZoomSDKAuthError_AccountNotEnableSDK:
            result = @"Account not enabled for mobile SDK";
            break;
        case ZoomSDKAuthError_AccountNotSupport:
            result = @"Account not supported";
            break;
        case ZoomSDKAuthError_KeyOrSecretEmpty:
            result = @"Empty auth key or auth secret";
            break;
        case ZoomSDKAuthError_KeyOrSecretWrong:
            result = @"Incorrect auth key or auth secret";
            break;
        default:
            result = @"Unknown error";
    }

    return result;
}

#pragma mark - Meeting Service Delegate

- (void)onMeetingReturn:(ZoomSDKMeetError)error internalError:(NSInteger)internalError
{
    //NSLog(@"========= onMeetingReturn =================:%d, internalError:%d", error, internalError);
    if (error != ZoomSDKMeetError_Success)
    {
        //remove the window
        self.zoomWindow=nil;

        [self.commandDelegate runInBackground:^{
            NSString* payload = [self returnErrorDescription: error];
                CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:payload];
            // The sendPluginResult method is thread-safe.
            [self.commandDelegate sendPluginResult:pluginResult callbackId:self.command.callbackId];
        }];
    }
}

- (void)onMeetingStateChange:(ZoomSDKMeetingState)state
{

    //NSLog(@"++++++++++++++ onMeetingStateChange +++++++++++++++++++:%d", state);
    //there does not seem to be any associated constant with state = 0
    if (state ==0){
        //remove the window
        self.zoomWindow=nil;
    }
}

#pragma mark - Auth Delegate

- (void)onZoomSDKAuthReturn:(ZoomSDKAuthError)returnValue
{
    //NSLog(@"onZoomSDKAuthReturn %d", returnValue);

    if (returnValue !=ZoomSDKAuthError_Success){
        //remove the window
        self.zoomWindow=nil;

        [self.commandDelegate runInBackground:^{
            NSString* payload = [self returnAuthErrorDescription: returnValue];
            CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:payload];
            // The sendPluginResult method is thread-safe.
            [self.commandDelegate sendPluginResult:pluginResult callbackId:self.command.callbackId];
        }];
    }

}

@end


text:
import numpy as np

from .VariableUnitTest import VariableUnitTest
from gwlfe.Input.LandUse.Urb import UrbAreaTotal

class TestUrbAreaTotal(VariableUnitTest):

    def test_UrbAreaTotal(self):
        z = self.z
        np.testing.assert_array_almost_equal(
            UrbAreaTotal.UrbAreaTotal_f(z.NRur, z.NUrb, z.Area),
            UrbAreaTotal.UrbAreaTotal(z.NRur, z.NUrb, z.Area), decimal=7)


text:
@class CContact, NSArray, NSDictionary;

@protocol ContactSelectViewDelegate <MMUIViewControllerDelegate>
- (void)onSelectContact:(CContact *)arg1;

@optional
- (void)onSelectBrandContact;
- (void)onSelectRadarCreateRoom;
- (void)onSelectHistoryGroup;
- (void)onContactSelectSearchSections:(NSArray *)arg1 sectionTitles:(NSDictionary *)arg2 sectionResults:(NSDictionary *)arg3;
- (_Bool)onFilterContactCandidate:(CContact *)arg1;
- (_Bool)onShouldSelectContact:(CContact *)arg1;
@end


text:
// File name: FakeClock.cs
//
// Author(s): Alessio Parma <alessio.parma@gmail.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2014-2018 Alessio Parma <alessio.parma@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
// associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using Microsoft.Extensions.Internal;
using System;

namespace PommaLabs.KVLite.Extensibility
{
    /// <summary>
    ///   Fake clock implementation which can be used for unit testing.
    /// </summary>
    public sealed class FakeClock : ISystemClock
    {
        /// <summary>
        ///   Creates a fake clock with given initial UTC time.
        /// </summary>
        /// <param name="initialUtcNow">Initial UTC time.</param>
        public FakeClock(DateTimeOffset initialUtcNow)
        {
            UtcNow = initialUtcNow;
        }

        /// <summary>
        ///   Retrieves the current system time in UTC.
        /// </summary>
        public DateTimeOffset UtcNow { get; private set; }

        /// <summary>
        ///   Advances the clock by the given time span.
        /// </summary>
        /// <param name="timeSpan">The time span.</param>
        /// <returns>Advanced clock.</returns>
        public DateTimeOffset Advance(TimeSpan timeSpan) => (UtcNow = UtcNow.Add(timeSpan));
    }
}


text:
extern "C"
{
#include "dependencies/lua/lauxlib.h"
#include "dependencies/lua/lua.h"
#include "dependencies/lua/lualib.h"
}

#include "framework/data.h"
#include "framework/image.h"
#include "framework/sound.h"
#include "library/colour.h"
#include "library/strings.h"
#include "library/vec.h"
#include "library/voxel.h"
#include "library/xorshift.h"

namespace OpenApoc
{

// functions for getting objects from the lua stack

void getFromLua(lua_State *L, int argNum, bool &v);
template <typename Int>
typename std::enable_if<std::is_integral<Int>::value, void>::type getFromLua(lua_State *L,
                                                                             int argNum, Int &v)
{
	v = static_cast<Int>(luaL_checkinteger(L, argNum));
}
void getFromLua(lua_State *L, int argNum, float &v);
void getFromLua(lua_State *L, int argNum, double &v);
void getFromLua(lua_State *L, int argNum, UString &v);
void getFromLua(lua_State *L, int argNum, std::string &v);
template <typename T> void getFromLua(lua_State *L, int argNum, Vec3<T> &v)
{
	luaL_checktype(L, argNum, LUA_TTABLE);
	lua_getfield(L, argNum, "x");
	lua_getfield(L, argNum, "y");
	lua_getfield(L, argNum, "z");
	getFromLua(L, -3, v.x);
	getFromLua(L, -2, v.y);
	getFromLua(L, -1, v.z);
	lua_pop(L, 3);
}
template <typename T> void getFromLua(lua_State *L, int argNum, Vec2<T> &v)
{
	luaL_checktype(L, argNum, LUA_TTABLE);
	lua_getfield(L, argNum, "x");
	lua_getfield(L, argNum, "y");
	getFromLua(L, -2, v.x);
	getFromLua(L, -1, v.y);
	lua_pop(L, 2);
}
void getFromLua(lua_State *L, int argNum, sp<Image> &v);
void getFromLua(lua_State *L, int argNum, sp<Sample> &v);
template <typename T>
typename std::enable_if<std::is_enum<T>::value>::type getFromLua(lua_State *L, int argNum, T &v)
{
	typename std::underlying_type<T>::type integer;
	getFromLua(L, argNum, integer);
	v = static_cast<T>(integer);
}
// trying to get a value from the stack into a const reference (invalid)
template <typename T> void getFromLua(lua_State *L, int argNum, const T &v [[maybe_unused]])
{
	if (argNum < 0)
		argNum = lua_gettop(L) + argNum + 1;
	luaL_error(L, "this member (#%d) cannot be set directly", argNum);
	LogError("Invalid Lua function");
}

// functions for pushing objects to the lua stack
void pushToLua(lua_State *L, const UString &v);
void pushToLua(lua_State *L, const char *v);
void pushToLua(lua_State *L, const std::string &v);
void pushToLua(lua_State *L, bool v);
void pushToLua(lua_State *L, int v);
void pushToLua(lua_State *L, uint64_t v);
void pushToLua(lua_State *L, unsigned int v);
void pushToLua(lua_State *L, float v);
void pushToLua(lua_State *L, double v);

void pushToLua(lua_State *L, sp<Image> &v);
void pushToLua(lua_State *L, sp<LazyImage> &v);
void pushToLua(lua_State *L, sp<VoxelSlice> &v);
void pushToLua(lua_State *L, sp<Sample> &v);
void pushToLua(lua_State *L, sp<VoxelMap> &v);
void pushToLua(lua_State *L, Colour &v);
void pushToLua(lua_State *L, Xorshift128Plus<uint32_t> &t);

void pushToLua(lua_State *L, const sp<Image> &v);
void pushToLua(lua_State *L, const sp<LazyImage> &v);
void pushToLua(lua_State *L, const sp<VoxelSlice> &v);
void pushToLua(lua_State *L, const sp<Sample> &v);
void pushToLua(lua_State *L, const sp<VoxelMap> &v);
void pushToLua(lua_State *L, const Colour &v);
void pushToLua(lua_State *L, const Xorshift128Plus<uint32_t> &t);

template <typename T> void pushToLua(lua_State *L, Vec3<T> &v)
{
	lua_createtable(L, 0, 3);
	pushToLua(L, v.x);
	lua_setfield(L, -2, "x");
	pushToLua(L, v.y);
	lua_setfield(L, -2, "y");
	pushToLua(L, v.z);
	lua_setfield(L, -2, "z");
}
template <typename T> void pushToLua(lua_State *L, const Vec3<T> &v)
{
	lua_createtable(L, 0, 3);
	pushToLua(L, v.x);
	lua_setfield(L, -2, "x");
	pushToLua(L, v.y);
	lua_setfield(L, -2, "y");
	pushToLua(L, v.z);
	lua_setfield(L, -2, "z");
}

template <typename T> void pushToLua(lua_State *L, Vec2<T> &v)
{
	lua_createtable(L, 0, 2);
	pushToLua(L, v.x);
	lua_setfield(L, -2, "x");
	pushToLua(L, v.y);
	lua_setfield(L, -2, "y");
}
template <typename T> void pushToLua(lua_State *L, const Vec2<T> &v)
{
	lua_createtable(L, 0, 2);
	pushToLua(L, v.x);
	lua_setfield(L, -2, "x");
	pushToLua(L, v.y);
	lua_setfield(L, -2, "y");
}
template <typename T> void pushToLua(lua_State *L, Rect<T> &v)
{
	lua_createtable(L, 0, 2);
	pushToLua(L, v.p0);
	lua_setfield(L, -2, "p0");
	pushToLua(L, v.p1);
	lua_setfield(L, -2, "p1");
}
template <typename T> void pushToLua(lua_State *L, const Rect<T> &v)
{
	lua_createtable(L, 0, 2);
	pushToLua(L, v.p0);
	lua_setfield(L, -2, "p0");
	pushToLua(L, v.p1);
	lua_setfield(L, -2, "p1");
}

template <typename T> void pushToLua(lua_State *L, sp<T> &v)
{
	if (v)
		pushToLua(L, *v.get());
	else
		lua_pushnil(L);
}
template <typename T> void pushToLua(lua_State *L, const sp<T> &v)
{
	if (v)
		pushToLua(L, *v.get());
	else
		lua_pushnil(L);
}
template <typename T> void pushToLua(lua_State *L, up<T> &v)
{
	if (v)
		pushToLua(L, *v.get());
	else
		lua_pushnil(L);
}
template <typename T> void pushToLua(lua_State *L, const up<T> &v)
{
	if (v)
		pushToLua(L, *v.get());
	else
		lua_pushnil(L);
}

template <typename T, typename U> void pushToLua(lua_State *L, std::pair<T, U> &v)
{
	lua_createtable(L, 0, 2);
	pushToLua(L, v.first);
	lua_setfield(L, -2, "first");
	pushToLua(L, v.second);
	lua_setfield(L, -2, "second");
}
template <typename T, typename U> void pushToLua(lua_State *L, const std::pair<T, U> &v)
{
	lua_createtable(L, 0, 2);
	pushToLua(L, v.first);
	lua_setfield(L, -2, "first");
	pushToLua(L, v.second);
	lua_setfield(L, -2, "second");
}

// pushing containers to lua
template <typename C>
using LuaIteratorState = std::pair<typename C::iterator, typename C::iterator>;
template <typename C> int advanceIpairsIterator(lua_State *L);
template <typename C> int generateIpairsIterator(lua_State *L);
template <typename C> int destroyIPairsIterator(lua_State *L);
template <typename C> int advancePairsIterator(lua_State *L);
template <typename C> int generatePairsIterator(lua_State *L);
template <typename C> int destroyPairsIterator(lua_State *L);
template <typename C> int containerIndexInteger(lua_State *L);
template <typename C> int containerIndexMap(lua_State *L);

template <typename T> void pushToLua(lua_State *L, std::list<T> &v);
template <typename T> void pushToLua(lua_State *L, const std::list<T> &v);
template <typename T> void pushToLua(lua_State *L, std::vector<T> &v);
template <typename T> void pushToLua(lua_State *L, const std::vector<T> &v);

template <typename K, typename V> void pushToLua(lua_State *L, std::map<K, V> &v);
template <typename K, typename V> void pushToLua(lua_State *L, const std::map<K, V> &v);

template <typename T> void pushToLua(lua_State *L, std::set<T> &v);
template <typename T> void pushToLua(lua_State *L, const std::set<T> &v);

template <typename C> int containerLength(lua_State *L)
{
	C **v = (C **)lua_touserdata(L, -1);
	lua_pop(L, 1);
	lua_pushinteger(L, (*v)->size());
	return 1;
}

template <typename T> void pushToLua(lua_State *L, std::list<T> &v)
{
	std::list<T> **udata = (std::list<T> **)lua_newuserdata(L, sizeof(&v));
	*udata = &v;
	lua_createtable(L, 0, 2);
	lua_pushcfunction(L, generateIpairsIterator<std::list<T>>);
	lua_setfield(L, -2, "__ipairs");
	lua_pushcfunction(L, containerLength<std::list<T>>);
	lua_setfield(L, -2, "__len");
	lua_setmetatable(L, -2);
}
template <typename T> void pushToLua(lua_State *L, const std::list<T> &v)
{
	lua_createtable(L, v.size(), 0);
	int i = 0;
	for (const auto &item : v)
	{
		pushToLua(L, item);
		lua_seti(L, -2, i + 1);
		++i;
	}
}

template <typename T> void pushToLua(lua_State *L, std::vector<T> &v)
{
	std::vector<T> **udata = (std::vector<T> **)lua_newuserdata(L, sizeof(&v));
	*udata = &v;
	lua_createtable(L, 0, 3);
	lua_pushcfunction(L, generateIpairsIterator<std::vector<T>>);
	lua_setfield(L, -2, "__ipairs");
	lua_pushcfunction(L, containerLength<std::vector<T>>);
	lua_setfield(L, -2, "__len");
	lua_pushcfunction(L, containerIndexInteger<std::vector<T>>);
	lua_setfield(L, -2, "__index");
	lua_setmetatable(L, -2);
}
template <typename T> void pushToLua(lua_State *L, const std::vector<T> &v)
{
	lua_createtable(L, v.size(), 0);
	for (size_t i = 0; i < v.size(); ++i)
	{
		pushToLua(L, v[i]);
		lua_seti(L, -2, i + 1);
	}
}

template <typename K, typename V> void pushToLua(lua_State *L, std::map<K, V> &v)
{
	std::map<K, V> **udata = (std::map<K, V> **)lua_newuserdata(L, sizeof(&v));
	*udata = &v;
	lua_createtable(L, 0, 2);
	lua_pushcfunction(L, (generatePairsIterator<std::map<K, V>>));
	lua_setfield(L, -2, "__pairs");
	lua_pushcfunction(L, (containerLength<std::map<K, V>>));
	lua_setfield(L, -2, "__len");
	lua_pushcfunction(L, (containerIndexMap<std::map<K, V>>));
	lua_setfield(L, -2, "__index");
	lua_setmetatable(L, -2);
}
template <typename K, typename V> void pushToLua(lua_State *L, const std::map<K, V> &v)
{
	lua_createtable(L, 0, 0);
	for (const auto &p : v)
	{
		pushToLua(L, p.first);
		pushToLua(L, p.second);
		lua_settable(L, -3);
	}
}

template <typename T> void pushToLua(lua_State *L, std::set<T> &v)
{
	std::set<T> **udata = (std::set<T> **)lua_newuserdata(L, sizeof(&v));
	*udata = &v;
	lua_createtable(L, 0, 2);
	lua_pushcfunction(L, generateIpairsIterator<std::set<T>>);
	lua_setfield(L, -2, "__pairs");
	lua_pushcfunction(L, (containerLength<std::set<T>>));
	lua_setfield(L, -2, "__len");
	lua_setmetatable(L, -2);
}
template <typename T> void pushToLua(lua_State *L, const std::set<T> &v)
{
	lua_createtable(L, v.size(), 0);
	int i = 0;
	for (const auto &item : v)
	{
		pushToLua(L, item);
		lua_seti(L, -2, i + 1);
		++i;
	}
}

template <typename C> int advanceIpairsIterator(lua_State *L)
{
	LuaIteratorState<C> *it = (LuaIteratorState<C> *)lua_touserdata(L, 1);
	int i = luaL_checkinteger(L, 2);
	lua_settop(L, 0);
	if (it->first != it->second)
	{
		pushToLua(L, i + 1);
		pushToLua(L, *(it->first));
		++it->first;
		return 2;
	}
	return 0;
}
template <typename C> int generateIpairsIterator(lua_State *L)
{
	C **v = (C **)lua_touserdata(L, 1);
	lua_pop(L, 1);
	lua_pushcfunction(L, advanceIpairsIterator<C>);
	LuaIteratorState<C> *it =
	    (LuaIteratorState<C> *)lua_newuserdata(L, sizeof(LuaIteratorState<C>));
	new (it) LuaIteratorState<C>((*v)->begin(), (*v)->end());
	lua_createtable(L, 0, 1);

	lua_pushcfunction(L, (destroyIPairsIterator<C>));
	lua_setfield(L, -2, "__gc");
	lua_setmetatable(L, -2);
	lua_pushinteger(L, 0);
	return 2;
}

template <typename C> int destroyIPairsIterator(lua_State *L)
{
	LuaIteratorState<C> *v = reinterpret_cast<LuaIteratorState<C> *>(lua_touserdata(L, 1));
	luaL_argcheck(L, v != nullptr, 1, "Invalid argument to iterator GC function");
	v->~LuaIteratorState<C>();
	return 0;
}

template <typename C> int advancePairsIterator(lua_State *L)
{
	LuaIteratorState<C> *it = (LuaIteratorState<C> *)lua_touserdata(L, 1);
	lua_settop(L, 0);
	if (it->first != it->second)
	{
		pushToLua(L, it->first->first);
		pushToLua(L, it->first->second);
		++it->first;
		return 2;
	}
	return 0;
}
template <typename C> int generatePairsIterator(lua_State *L)
{
	C **v = (C **)lua_touserdata(L, 1);
	lua_settop(L, 0);
	lua_pushcfunction(L, advancePairsIterator<C>);
	LuaIteratorState<C> *it =
	    (LuaIteratorState<C> *)lua_newuserdata(L, sizeof(LuaIteratorState<C>));
	new (it) LuaIteratorState<C>((*v)->begin(), (*v)->end());

	lua_createtable(L, 0, 1);

	lua_pushcfunction(L, (destroyPairsIterator<C>));
	lua_setfield(L, -2, "__gc");
	lua_setmetatable(L, -2);

	return 2;
}

template <typename C> int destroyPairsIterator(lua_State *L)
{
	LuaIteratorState<C> *v = reinterpret_cast<LuaIteratorState<C> *>(lua_touserdata(L, 1));
	luaL_argcheck(L, v != nullptr, 1, "Invalid argument to iterator GC function");
	v->~LuaIteratorState<C>();
	return 0;
}

template <typename C> int containerIndexInteger(lua_State *L)
{
	C **v = (C **)lua_touserdata(L, 1);
	int i = luaL_checkinteger(L, 2);
	lua_settop(L, 0);
	--i; // lua indices start at 1
	if (i >= 0 && i < (*v)->size())
	{
		pushToLua(L, (*v)->operator[](i));
	}
	else
	{
		lua_pushnil(L);
	}
	return 1;
}
template <typename C> int containerIndexMap(lua_State *L)
{
	C **v = (C **)lua_touserdata(L, 1);
	typename C::key_type k;
	getFromLua(L, 2, k);
	lua_settop(L, 0);
	auto it = (*v)->find(k);
	if (it != (*v)->end())
	{
		pushToLua(L, it->second);
	}
	else
	{
		lua_pushnil(L);
	}
	return 1;
}

// mapping between method name to a pointer-to-function
template <typename T>
lua_CFunction getLuaObjectConstMethods(const std::string &key [[maybe_unused]])
{
	LogError("Unimplemented Lua function");
	return nullptr;
}

template <typename T> lua_CFunction getLuaObjectMethods(const std::string &key)
{
	// if no non-const method is found, look in the const methods
	return getLuaObjectConstMethods<T>(key);
}

// actual overloads for each class
template <> lua_CFunction getLuaObjectMethods<Xorshift128Plus<uint32_t>>(const std::string &key);
template <>
lua_CFunction getLuaObjectConstMethods<Xorshift128Plus<uint32_t>>(const std::string &key);

void pushLuaDebugTraceback(lua_State *L);

// prints with lua prefix and pops the error object at the top of the stack
void handleLuaError(lua_State *L, LogLevel level = LogLevel::Warning);

// push a table with framework functions into the stack
void pushLuaFramework(lua_State *L);

} // namespace OpenApoc


text:
import os
import logging
import shlex

import pylons
from paste.script import command
from paste.deploy import appconfig
from paste.deploy.converters import asbool
from paste.registry import Registry

import activitystream
import ming
from allura.config.environment import load_environment
from allura.lib.decorators import task
from allura.lib import helpers as h

log = None

@task
def run_command(command, args):
    """Run paster command asynchronously"""
    mod, cls = command.rsplit('.', 1)
    mod = __import__(mod, fromlist=[str(cls)])
    command = getattr(mod, cls)
    command = command(command.__name__)
    arg_list = shlex.split(args or '')
    try:
        command.parser.parse_args(arg_list)
    except SystemExit:
        raise Exception("Error parsing args: '%s'" % args)
    return command.run(arg_list)

class EmptyClass(object):
    pass

class Command(command.Command):
    min_args = 1
    max_args = 1
    usage = '[<ini file>]'
    group_name = 'Allura'

    class __metaclass__(type):

        @property
        def __doc__(cls):
            return cls.parser.format_help()

    @classmethod
    def post(cls, *args, **kw):
        cmd = '%s.%s' % (cls.__module__, cls.__name__)
        return run_command.post(cmd, *args, **kw)

    @ming.utils.LazyProperty
    def registry(self):
        return Registry()

    @ming.utils.LazyProperty
    def globals(self):
        import allura.lib.app_globals
        return allura.lib.app_globals.Globals()

    @ming.utils.LazyProperty
    def config(self):
        import tg
        return tg.config

    def basic_setup(self):
        global log, M
        if self.args[0]:
            # Probably being called from the command line - load the config
            # file
            self.config = conf = appconfig('config:%s' %
                                           self.args[0], relative_to=os.getcwd())
            # ... logging does not understand section#subsection syntax
            logging_config = self.args[0].split('#')[0]
            logging.config.fileConfig(
                logging_config, disable_existing_loggers=False)
            log = logging.getLogger('allura.command')
            log.info('Initialize command with config %r', self.args[0])
            load_environment(conf.global_conf, conf.local_conf)
            self.setup_globals()
            from allura import model
            M = model
            ming.configure(**conf)
            if asbool(conf.get('activitystream.recording.enabled', False)):
                activitystream.configure(**h.convert_bools(conf, prefix='activitystream.'))
            pylons.tmpl_context.user = M.User.anonymous()
        else:
            # Probably being called from another script (websetup, perhaps?)
            log = logging.getLogger('allura.command')
            conf = pylons.config
        self.tools = pylons.app_globals.entry_points['tool'].values()
        for ep in h.iter_entry_points('allura.command_init'):
            log.info('Running command_init for %s', ep.name)
            ep.load()(conf)
        log.info('Loaded tools')

    def setup_globals(self):
        import allura.lib.app_globals
        self.registry.prepare()
        self.registry.register(pylons.tmpl_context, EmptyClass())
        self.registry.register(pylons.app_globals, self.globals)
        self.registry.register(
            allura.credentials, allura.lib.security.Credentials())

    def teardown_globals(self):
        self.registry.cleanup()


text:
#region License
//
// Author: Nate Kohari <nkohari@gmail.com>
// Copyright (c) 2007-2008, Enkari, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
#region Using Directives
using System;
using Ninject.Core.Interception;
#endregion

namespace Ninject.Core
{
	/// <summary>
	/// Intercepts a method call on an activated instance.
	/// </summary>
	public interface IInterceptor
	{
		/*----------------------------------------------------------------------------------------*/
		/// <summary>
		/// Intercepts the specified invocation.
		/// </summary>
		/// <param name="invocation">The invocation to intercept.</param>
		void Intercept(IInvocation invocation);
		/*----------------------------------------------------------------------------------------*/
	}
}


text:
var Mongoose = require('mongoose');
Mongoose.Promise = require('q').Promise;
var path = require('path');
var local = path.resolve(__dirname);
var fs = require('fs');
var assert = require('assert');
var mongoose = Mongoose.createConnection("mongodb://localhost/data");

var canDescription  = new Mongoose.Schema({
    CAN_Id: {
        type:Number,
        unique:true,
        index:true
    },
    PDO_Description:String,
    map:[{
        _id:false,
        key:String,
        description:String,
        length:Number, //if datatype is array, refers to number of array elements
        offset:Number,
        dataType:{
            type:String,
            match:/flag|state|decimal|string|array/
        },
        array:{
            subLength:Number,
            subDataType:{
                type:String,
                match:/flag|state|decimal|string/
            }
        }
        }]
});
var model = mongoose.model('Descriptor', canDescription);
(function load() {
    fs.readFile(`${local}/defaults.conf`, function(err, data) {
        var defaults = JSON.parse(data);
        console.log(defaults);
        Object.keys(defaults).forEach(function(key) {
            model.count({"CAN_Id": defaults[key].CAN_Id}, function(err, countr){
                if(countr == 0) {
                    if(defaults[key]){
                        model.create(defaults[key], function(err) {
                            if(err) console.error(err);
                        });
                    }
                }
            })
        });
    });
}());
module.exports.model = model;
module.exports.reset = function(cb) {
    fs.readFile(`${local}/defaults.conf`, function(err, data) {
        if(err) {
            console.error("error reading file");
            cb(err);
            return;
        }
        var defaults = JSON.parse(data);
        let error = null;
        model.remove({}, function(err) {
            if(err) {
                cb(err);
                return;
            }
            Object.keys(defaults).forEach(function(key) {
                let CAN = new model(defaults[key]);
                CAN.save(function(err) {
                    if(err) {
                        console.error("error saving doc");
                        error = err;
                        return;
                    }
                });
            });
            cb(error); // done
        });
    });
};


text:
Factory     *f;
Database    *db;

int main(int argc, char *argv[])
{
    int ret;
    MainWindow * w;
    QApplication a(argc, argv);
    a.setOrganizationName("spinler.cz");
    a.setApplicationName("Pisoar");

    f   = new Factory();
    db  = new Database();

    w = new MainWindow;
    w->show();
    ret = a.exec();
    delete w;

    delete db;
    delete f;

    return ret;
}


text:
/*!
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
(function () {
    angular.module('piwikApp').controller('ManageSuperUserController', ManageSuperUserController);

    ManageSuperUserController.$inject = ['piwikApi', '$timeout'];

    function ManageSuperUserController(piwikApi, $timeout) {

        var self = this;
        this.isLoading = false;

        function updateSuperUserAccess(login, hasSuperUserAccess)
        {
            self.isLoading = true;

            $timeout(function () {
                piwik.helper.lazyScrollTo('.loadingManageSuperUser', 40);
            });

            piwikApi.post({
                module: 'API',
                method: 'UsersManager.setSuperUserAccess'
            }, {userLogin: login, hasSuperUserAccess: hasSuperUserAccess}).then(function () {

                self.isLoading = false;

                var UI = require('piwik/UI');
                var notification = new UI.Notification();
                notification.show(_pk_translate('General_Done'), {
                    placeat: '#superUserAccessUpdated',
                    context: 'success',
                    noclear: true,
                    type: 'toast',
                    style: {display: 'inline-block', marginTop: '10px', marginBottom: '30px'},
                    id: 'usersManagerSuperUserAccessUpdated'
                });
                notification.scrollToNotification();
                piwikHelper.redirect();

            }, function () {
                self.isLoading = false;
            });
        }

        this.removeSuperUserAccess = function (login) {
            var message = 'UsersManager_ConfirmProhibitOtherUsersSuperUserAccess';
            if (login == piwik.userLogin) {
                message = 'UsersManager_ConfirmProhibitMySuperUserAccess';
            }

            message = _pk_translate(message, [login]);

            $('#superUserAccessConfirm h2').text(message);

            piwikHelper.modalConfirm('#superUserAccessConfirm', {yes: function () {
                updateSuperUserAccess(login, 0);
            }});
        };

        this.giveSuperUserAccess = function (login) {

            var message = _pk_translate('UsersManager_ConfirmGrantSuperUserAccess', [login]);

            $('#superUserAccessConfirm h2').text(message);

            piwikHelper.modalConfirm('#superUserAccessConfirm', {yes: function () {
                updateSuperUserAccess(login, 1);
            }});
        };
    }
})();


text:
namespace apps {

struct AppLaunchParams;

// AppPublisher parent class (in the App Service sense) for all app publishers.
// See components/services/app_service/README.md.
//
// TODO(crbug.com/1253250): Add other mojom publisher functions.
class AppPublisher {
 public:
  explicit AppPublisher(AppServiceProxy* proxy);
  AppPublisher(const AppPublisher&) = delete;
  AppPublisher& operator=(const AppPublisher&) = delete;
  ~AppPublisher();

  // Returns an app object from the provided parameters
  static std::unique_ptr<App> MakeApp(AppType app_type,
                                      const std::string& app_id,
                                      Readiness readiness,
                                      const std::string& name);

  // Registers this AppPublisher to AppServiceProxy, allowing it to receive App
  // Service API calls. This function must be called after the object's
  // creation, and can't be called in the constructor function to avoid
  // receiving API calls before being fully constructed and ready. This should
  // be called immediately before the first call to AppPublisher::Publish that
  // sends the initial list of apps to the App Service.
  void RegisterPublisher(AppType app_type);

  // Requests an icon for an app identified by |app_id|. The icon is identified
  // by |icon_key| and parameterised by |icon_type| and |size_hint_in_dp|. If
  // |allow_placeholder_icon| is true, a default placeholder icon can be
  // returned if no other icon is available. Calls |callback| with the result.
  //
  // Publishers implementing this method should:
  //  - provide an icon as closely sized to |size_hint_in_dp| as possible
  //  - load from the specific resource ID if |icon_key.resource_id| is set
  //  - may optionally use |icon_key|'s timeline property as a "version number"
  //    for an icon. Alternatively, this may be ignored if there will only ever
  //    be one version of an icon at any time.
  //  - optionally return a placeholder default icon if |allow_placeholder_icon|
  //    is true and when no icon is available for the app (or an icon for the
  //    app cannot be efficiently provided). Otherwise, a null icon should be
  //    returned.
  virtual void LoadIcon(const std::string& app_id,
                        const IconKey& icon_key,
                        apps::IconType icon_type,
                        int32_t size_hint_in_dip,
                        bool allow_placeholder_icon,
                        LoadIconCallback callback) = 0;

  // Launches an app with |params|.
  //
  // Publishers implementing this method should:
  // - Launch the app represent by the |params.app_id|.
  // - Launch the app with all the params that is applicable to the platform.
  // - Return launch_result if applicable.
  virtual void LaunchAppWithParams(AppLaunchParams&& params,
                                   LaunchCallback callback) = 0;

 protected:
  // Publish one `app` to AppServiceProxy. Should be called whenever the app
  // represented by `app` undergoes some state change to inform AppServiceProxy
  // of the change. Ensure that RegisterPublisher() has been called before the
  // first call to this method.
  void Publish(std::unique_ptr<App> app);

  // Publish multiple `apps` to AppServiceProxy. Should be called whenever the
  // app represented by `app` undergoes some state change to inform
  // AppServiceProxy of the change. Ensure that RegisterPublisher() has been
  // called before the first call to this method.
  void Publish(std::vector<std::unique_ptr<App>> apps);

  AppServiceProxy* proxy() { return proxy_; }

 private:
  raw_ptr<AppServiceProxy> proxy_ = nullptr;
};

}  // namespace apps

#endif  // CHROME_BROWSER_APPS_APP_SERVICE_PUBLISHERS_APP_PUBLISHER_H_


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

#pragma once

#include "../../../common/sys/platform.h"
#include "../../../common/sys/ref.h"
#include "../../../common/sys/filename.h"
#include "../../../common/math/color.h"

#include <vector>
#include <string>

namespace embree
{
  /* virtual interface to image */
  class Image : public RefCount {
  public:
    Image (size_t width, size_t height, const std::string& name) : width(width), height(height), name(name) {}
    virtual ~Image() {}
    virtual Color4 get(size_t x, size_t y) const = 0;
    virtual void   set(size_t x, size_t y, const Color4& c) = 0;
    void set(size_t x, size_t y, const Color& c) { set(x,y,Color4(c.r,c.g,c.b,1.0f)); }
    void convertToRGBA8(unsigned char *dest)
    {
      for (size_t y=0;y<height;y++)
	for (size_t x=0;x<width;x++)
	  {
	    size_t offset = 4 * (y * width + x);
	    Color4 c = get(x,y);
	    dest[offset+0] = (unsigned char)(c.r * 255.0f);
	    dest[offset+1] = (unsigned char)(c.g * 255.0f);
	    dest[offset+2] = (unsigned char)(c.b * 255.0f);
	    dest[offset+3] = (unsigned char)(c.a * 255.0f);
	  }
    }
  public:
    size_t width,height;
    std::string name;
  };

  /* main image class templated over element type */
  template<typename T>
    class ImageT : public Image {
  public:

    /*! create empty image */
    ImageT (size_t width = 0, size_t height = 0, const std::string& name = "")
      : Image(width,height,name)
    {
      data = (T*) malloc(width*height*sizeof(T));
      memset(data,0,width*height*sizeof(T));
    }

    /*! create image of constant color */
    ImageT (size_t width, size_t height, const T& color, const std::string& name = "")
      : Image(width,height,name)
    {
      data = (T*) malloc(width*height*sizeof(T));
      for (size_t i=0; i<width*height; i++) data[i] = color;
    }

    /*! initialize image from color data */
    ImageT (size_t width, size_t height, T* color, const bool copy = true, const std::string& name = "")
      : Image(width,height,name)
    {
      if (copy) {
        data = (T*) malloc(width*height*sizeof(T));
        for (size_t i=0; i<width*height; i++) data[i] = color[i];
      }
      else {
        data = color;
      }
    }

    /*! image destruction */
    virtual ~ImageT() {
      if (data) free(data); data = nullptr;
    }

    /*! returns pixel color */
    __forceinline Color4 get(size_t x, size_t y) const {
      return Color4(data[y*width+x]);
    }

    /*! sets pixel */
    __forceinline void set(size_t x, size_t y, const Color4& c) {
      c.set(data[y*width+x]);
    }

    /*! returns data pointer of image */
    __forceinline void* ptr() {
      return (void*)data;
    }

    /*! returns and forgets about data pointer of image */
    __forceinline void* steal_ptr() {
      T* ptr = data;
      data = nullptr;
      return (void*)ptr;
    }

  protected:
    T* data;
  };

  /*! Shortcuts for common image types. */
  typedef ImageT<Col3uc> Image3uc;
  typedef ImageT<Col3f> Image3f;
  typedef ImageT<Col4uc> Image4uc;
  typedef ImageT<Col4f> Image4f;

  /*! Generate a JPEG encoded image from a RGB8 buffer in memory. */
  void encodeRGB8_to_JPEG(unsigned char *image, size_t width, size_t height, unsigned char **encoded, size_t *capacity);

  /*! Loads image from EXR file. */
  Ref<Image> loadExr(const FileName& fileName);

  /*! Loads image from file. Format is auto detected. */
  Ref<Image> loadImage(const FileName& filename, bool cache = false);

  /*! Loads image from JPEG file. */
  Ref<Image> loadJPEG(const FileName& fileName);

  /*! Loads image using ImageMagick. */
  Ref<Image> loadMagick(const FileName& fileName);

  /*! Loads image from PFM file. */
  Ref<Image> loadPFM(const FileName& fileName);

  /*! Loads image from PNG file. */
  Ref<Image> loadPNG(const FileName& fileName);

  /*! Loads image from PPM file. */
  Ref<Image> loadPPM(const FileName& fileName);

  /*! Loads image from TIFF file. */
//Ref<Image> loadTIFF(const FileName& fileName);

  /*! Store image to EXR file. */
  void storeExr(const Ref<Image>& img, const FileName& fileName);

  /*! Store image to file. Format is auto detected. */
  void storeImage(const Ref<Image>& image, const FileName& filename);

  /*! Store image to JPEG file. */
  void storeJPEG(const Ref<Image>& img, const FileName& fileName);

  /*! Store image to file using ImageMagick. */
  void storeMagick(const Ref<Image>& img, const FileName& fileName);

  /*! Store image to PFM file. */
  void storePFM(const Ref<Image>& img, const FileName& fileName);

  /*! Store image to PNG file. */
//void storePNG(const Ref<Image>& img, const FileName& fileName);

  /*! Store image to PPM file. */
  void storePPM(const Ref<Image>& img, const FileName& fileName);

  /*! Store image to TGA file. */
  void storeTga(const Ref<Image>& img, const FileName& fileName);

  /*! Store image to TIFF file. */
//void storeTIFF(const Ref<Image>& img, const FileName& fileName);

}


text:
using System;

namespace UnityEngine.XR.iOS
{
	[Flags]
    public enum ARHitTestResultType : long
	{
		/** Result type from intersecting the nearest feature point. */
		ARHitTestResultTypeFeaturePoint     = (1 << 0),

		/** A real-world planar surface detected by the search (without a corresponding anchor), whose orientation is perpendicular to gravity. */
		ARHitTestResultTypeEstimatedHorizontalPlane  = (1 << 1),

		/** A real-world planar surface detected by the search, whose orientation is parallel to gravity. */
		ARHitTestResultTypeEstimatedVerticalPlane    = (1 << 2),

		/** Result type from intersecting with an existing plane anchor. */
        ARHitTestResultTypeExistingPlane    = (1 << 3),

        /** Result type from intersecting with an existing plane anchor, taking into account the plane's extent. */
        ARHitTestResultTypeExistingPlaneUsingExtent  = ( 1 << 4),

		/** A plane anchor already in the scene (detected with the planeDetection option), respecting the plane's estimated size and shape. **/
		ARHitTestResultTypeExistingPlaneUsingGeometry = (1 << 5)

	}
}


text:
import requests

from st2actions.runners.pythonrunner import Action

class KillWorkflow(Action):
    EXEC_BASE_URL = None

    def run(self, execution_id, kill_msg='Killed'):
        payload = {'state': 'ERROR', 'state_info': kill_msg}
        resp = requests.put(self._get_exec_url(execution_id), data=payload)
        return resp.json()

    def _get_exec_url(self, execution_id):
        if not KillWorkflow.EXEC_BASE_URL:
            host = self.config['host']
            api_version = self.config['api_version']
            url = host + api_version + '/executions/'
            KillWorkflow.EXEC_BASE_URL = url

        return KillWorkflow.EXEC_BASE_URL + execution_id


text:
YetAnother Config — простой менеджер конфигурационных файлов.

## Установка

Рекомендуемая установка через [composer](http://getcomposer.org):
```JSON
{
    "require": {
        "yetanother/config": "dev-master"
    }
}
```

## Одиночный конфигурационный файл
```php
// path/to/config.php

return array(
    'parameter1' => 'value1',
    'parameter2' => 'value2'
);
```
```php
use YetAnother\Config\Config;

$config = new Config('path/to/config.php');
echo $config['parameter1']; // value1
```

## Директория с конфигурационными файлами
```
config
┕database.php
┕routing.php
┕security.php
```
```php
use YetAnother\Config\Config;

$config = new Config('path/to/config');
echo $config['database']['host'];
```

## Использование переменных вместо массива
```php
// path/to/config.php

$parameter1 = 'value1';
$parameter2 = 'value2';
```
```php
use YetAnother\Config\Config;

$config = new Config('path/to/config.php');
echo $config['parameter1'];
```

## Включение других конфигурационных файлов
```
config
┕config.php
┕database.php
┕routing.php
┕security.php
```
```php
// config.php

$database = include(__DIR__.'/database.php');
$routing = include(__DIR__.'/routing.php');
$security = include(__DIR__.'/security.php');
// или
$database = $this->import('database');
$routing = $this->import('routing');
$security = $this->import('security');
// или
$database = $this->import(__DIR__.'/database.php');
$routing = $this->import(__DIR__.'/routing.php');
$security = $this->import(__DIR__.'/security.php');
```
```php
use YetAnother\Config\Config;

$config = new Config('config/config.php');
echo $config['database']['host'];
```


text:
//
//  ICGBaseAnimation.h
//  ICGTransitionAnimation
//
//  Created by HuongDo on 5/12/14.
//  Copyright (c) 2014 ichigo. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ICGBaseAnimation : UIPercentDrivenInteractiveTransition <UIViewControllerAnimatedTransitioning>

/**
 The animation duration.
 */
@property (assign, nonatomic) NSTimeInterval animationDuration;

/**
 Direction of the transition.
 */
@property (assign, nonatomic) NSInteger type;

/**
 Whether the animation should be reverse.
 */
@property (assign, nonatomic) BOOL reverse;

/**
 Whether the transition is modal.
 */
@property (assign, nonatomic) BOOL modalTransition;

/**
 Whether the interaction is in progress.
 */
@property (assign, nonatomic) BOOL interactionInProgress;

/**
 The view controller from which the transition starts.
 */
@property (strong, nonatomic) UIViewController *fromViewController;

/**
 The view controller at which the transition ends.
 */
@property (strong, nonatomic) UIViewController *toViewController;

/**
 The gesture that is added for the interaction.
 Make sure this is removed when no longer necessary.
 */
@property (strong, nonatomic) UIGestureRecognizer *gesture;

/** Helper method for animating transition
 @param transitionContext The context object containing information about the transition.
 @param fromView The view to be hidden
 @param toView The view to be displayed
 */
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext fromView:(UIView*)fromView toView:(UIView*)toView;

/** Helper method for enabling interactive transition
 */
- (void)setInteractionEnabled;
@end


text:
import * as pc from '../../../../';

class GlbExample {
    static CATEGORY = 'Loaders';
    static NAME = 'GLB';

    example(canvas: HTMLCanvasElement): void {

        // The example demonstrates loading of glb file, which contains meshes,
        // lights and cameras, and switches between the cameras every 2 seconds.

        // Create the app and start the update loop
        const app = new pc.Application(canvas, {});

        // the array will store loaded cameras
        let camerasComponents: Array<pc.CameraComponent> = null;

        // Load a glb file as a container
        const url = "/static/assets/models/geometry-camera-light.glb";
        app.assets.loadFromUrl(url, "container", function (err, asset) {
            app.start();

            // create an instance using render component
            const entity = asset.resource.instantiateRenderEntity();
            app.root.addChild(entity);

            // find all cameras - by default they are disabled
            // set their aspect ratio to automatic to work with any window size
            camerasComponents = entity.findComponents("camera");
            camerasComponents.forEach((component) => {
                component.aspectRatioMode = pc.ASPECT_AUTO;
            });

            // enable all lights from the glb
            const lightComponents: Array<pc.LightComponent> = entity.findComponents("light");
            lightComponents.forEach((component) => {
                component.enabled = true;
            });

            let time = 0;
            let activeCamera = 0;
            app.on("update", function (dt) {
                time -= dt;

                // change the camera every few seconds
                if (time <= 0) {
                    time = 2;

                    // disable current camera
                    camerasComponents[activeCamera].enabled = false;

                    // activate next camera
                    activeCamera = (activeCamera + 1) % camerasComponents.length;
                    camerasComponents[activeCamera].enabled = true;
                }
            });
        });
    }
}

export default GlbExample;


text:
package cwl

import (
	"fmt"
	//"github.com/mitchellh/mapstructure"
	"reflect"
	"strconv"
)

//type String struct {
//	CWLType_Impl `yaml:",inline" json:",inline" bson:",inline" mapstructure:",squash"`
//	//Class        CWLType_Type `yaml:"class,omitempty" json:"class,omitempty" bson:"class,omitempty"`
//	Value string `yaml:"value,omitempty" json:"value,omitempty" bson:"value,omitempty"`
//}

type Number string

func (s *Number) GetClass() string      { return string(CWLString) } // for CWLObject
func (s *Number) GetType() CWLType_Type { return CWLString }
func (s *Number) String() string        { return string(*s) }

func (s *Number) GetID() string  { return "" }
func (s *Number) SetID(i string) {}

func (s *Number) IsCWLMinimal() {}

func NewNumberFromstring(value string) (s *Number) {

	var s_nptr Number
	s_nptr = Number(value)

	s = &s_nptr

	return

}

func NewNumber(id string, value string) (s *Number) {

	_ = id

	return NewNumberFromstring(value)

}

func NewNumberFromInterface(id string, native interface{}) (s *Number, err error) {

	_ = id

	switch native.(type) {
	case string:
		real_string, ok := native.(string)
		if !ok {
			err = fmt.Errorf("(NewStringFromInterface) Cannot create string")
			return
		}
		s = NewNumberFromstring(real_string)
	case float64:
		real_float64, _ := native.(float64)

		real_string := strconv.FormatFloat(real_float64, 'f', 6, 64)
		s = NewNumberFromstring(real_string)

	default:
		err = fmt.Errorf("(NewNumberFromInterface) type %s unknown", reflect.TypeOf(native))

	}
	return
}


text:
import { DependenciesMeta, PatchFile } from '@pnpm/types'

export { PatchFile }

export interface Lockfile {
  importers: Record<string, ProjectSnapshot>
  lockfileVersion: number
  time?: Record<string, string>
  packages?: PackageSnapshots
  neverBuiltDependencies?: string[]
  onlyBuiltDependencies?: string[]
  overrides?: Record<string, string>
  packageExtensionsChecksum?: string
  patchedDependencies?: Record<string, PatchFile>
}

export interface ProjectSnapshot {
  specifiers: ResolvedDependencies
  dependencies?: ResolvedDependencies
  optionalDependencies?: ResolvedDependencies
  devDependencies?: ResolvedDependencies
  dependenciesMeta?: DependenciesMeta
  publishDirectory?: string
}

export interface PackageSnapshots {
  [packagePath: string]: PackageSnapshot
}

/**
 * tarball hosted remotely
 */
export interface TarballResolution {
  type?: undefined
  tarball: string
  integrity?: string
  // needed in some cases to get the auth token
  // sometimes the tarball URL is under a different path
  // and the auth token is specified for the registry only
  registry?: string
}

/**
 * directory on a file system
 */
export interface DirectoryResolution {
  type: 'directory'
  directory: string
}

/**
 * Git repository
 */
export interface GitRepositoryResolution {
  type: 'git'
  repo: string
  commit: string
}

export type Resolution =
  TarballResolution |
  GitRepositoryResolution |
  DirectoryResolution

export type LockfileResolution = Resolution | {
  integrity: string
}

export interface PackageSnapshot {
  id?: string
  dev?: true | false
  optional?: true
  requiresBuild?: true
  patched?: true
  prepare?: true
  hasBin?: true
  // name and version are only needed
  // for packages that are hosted not in the npm registry
  name?: string
  version?: string
  resolution: LockfileResolution
  dependencies?: ResolvedDependencies
  optionalDependencies?: ResolvedDependencies
  peerDependencies?: {
    [name: string]: string
  }
  peerDependenciesMeta?: {
    [name: string]: {
      optional: true
    }
  }
  transitivePeerDependencies?: string[]
  bundledDependencies?: string[]
  engines?: {
    node: string
  }
  os?: string[]
  cpu?: string[]
  libc?: string[]
  deprecated?: string
}

export interface Dependencies {
  [name: string]: string
}

export type PackageBin = string | { [name: string]: string }

/** @example
 * {
 *   "foo": "registry.npmjs.org/foo/1.0.1"
 * }
 */
export type ResolvedDependencies = Record<string, string>