text
stringlengths 2
100k
| meta
dict |
---|---|
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es5",
"module": "es6",
"sourceMap": false,
"declaration": true,
"stripInternal": true,
"lib": [ "es2015" ],
"outDir": "../lib/esm",
"incremental": true,
"tsBuildInfoFile":"../lib/esm/compile.tsbuildInfo",
"rootDir": "."
},
"include": [
"."
],
"exclude": [
"test"
]
} | {
"pile_set_name": "Github"
} |
ALTER TABLE `creature_template`
DROP KEY `entry` ,
ADD PRIMARY KEY (`entry`) ;
| {
"pile_set_name": "Github"
} |
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include <set>
#include <string>
#include "peripherals/PeripheralTypes.h"
class TiXmlDocument;
class CSetting;
namespace PERIPHERALS
{
class CGUIDialogPeripheralSettings;
typedef enum
{
STATE_SWITCH_TOGGLE,
STATE_ACTIVATE_SOURCE,
STATE_STANDBY
} CecStateChange;
class CPeripheral
{
friend class CGUIDialogPeripheralSettings;
public:
CPeripheral(const PeripheralScanResult& scanResult);
virtual ~CPeripheral(void);
bool operator ==(const CPeripheral &right) const;
bool operator !=(const CPeripheral &right) const;
bool operator ==(const PeripheralScanResult& right) const;
bool operator !=(const PeripheralScanResult& right) const;
const std::string &FileLocation(void) const { return m_strFileLocation; }
const std::string &Location(void) const { return m_strLocation; }
int VendorId(void) const { return m_iVendorId; }
const char *VendorIdAsString(void) const { return m_strVendorId.c_str(); }
int ProductId(void) const { return m_iProductId; }
const char *ProductIdAsString(void) const { return m_strProductId.c_str(); }
const PeripheralType Type(void) const { return m_type; }
const PeripheralBusType GetBusType(void) const { return m_busType; };
const std::string &DeviceName(void) const { return m_strDeviceName; }
bool IsHidden(void) const { return m_bHidden; }
void SetHidden(bool bSetTo = true) { m_bHidden = bSetTo; }
const std::string &GetVersionInfo(void) const { return m_strVersionInfo; }
/*!
* @brief Check whether this device has the given feature.
* @param feature The feature to check for.
* @return True when the device has the feature, false otherwise.
*/
bool HasFeature(const PeripheralFeature feature) const;
/*!
* @brief Get all features that are supported by this device.
* @param features The features.
*/
void GetFeatures(std::vector<PeripheralFeature> &features) const;
/*!
* @brief Initialises the peripheral.
* @return True when the peripheral has been initialised succesfully, false otherwise.
*/
bool Initialise(void);
/*!
* @brief Initialise one of the features of this peripheral.
* @param feature The feature to initialise.
* @return True when the feature has been initialised succesfully, false otherwise.
*/
virtual bool InitialiseFeature(const PeripheralFeature feature) { return true; }
/*!
* @brief Called when a setting changed.
* @param strChangedSetting The changed setting.
*/
virtual void OnSettingChanged(const std::string &strChangedSetting) {};
/*!
* @brief Called when this device is removed, before calling the destructor.
*/
virtual void OnDeviceRemoved(void) {}
/*!
* @brief Get all subdevices if this device is multifunctional.
* @param subDevices The subdevices.
*/
virtual void GetSubdevices(std::vector<CPeripheral *> &subDevices) const;
/*!
* @return True when this device is multifunctional, false otherwise.
*/
virtual bool IsMultiFunctional(void) const;
/*!
* @brief Add a setting to this peripheral. This will overwrite a previous setting with the same key.
* @param strKey The key of the setting.
* @param setting The setting.
*/
virtual void AddSetting(const std::string &strKey, const CSetting *setting, int order);
/*!
* @brief Check whether a setting is known with the given key.
* @param strKey The key to search.
* @return True when found, false otherwise.
*/
virtual bool HasSetting(const std::string &strKey) const;
/*!
* @return True when this device has any settings, false otherwise.
*/
virtual bool HasSettings(void) const;
/*!
* @return True when this device has any configurable settings, false otherwise.
*/
virtual bool HasConfigurableSettings(void) const;
/*!
* @brief Get the value of a setting.
* @param strKey The key to search.
* @return The value or an empty string if it wasn't found.
*/
virtual const std::string GetSettingString(const std::string &strKey) const;
virtual bool SetSetting(const std::string &strKey, const std::string &strValue);
virtual void SetSettingVisible(const std::string &strKey, bool bSetTo);
virtual bool IsSettingVisible(const std::string &strKey) const;
virtual int GetSettingInt(const std::string &strKey) const;
virtual bool SetSetting(const std::string &strKey, int iValue);
virtual bool GetSettingBool(const std::string &strKey) const;
virtual bool SetSetting(const std::string &strKey, bool bValue);
virtual float GetSettingFloat(const std::string &strKey) const;
virtual bool SetSetting(const std::string &strKey, float fValue);
virtual void PersistSettings(bool bExiting = false);
virtual void LoadPersistedSettings(void);
virtual void ResetDefaultSettings(void);
virtual std::vector<CSetting *> GetSettings(void) const;
virtual bool ErrorOccured(void) const { return m_bError; }
protected:
virtual void ClearSettings(void);
PeripheralType m_type;
PeripheralBusType m_busType;
PeripheralBusType m_mappedBusType;
std::string m_strLocation;
std::string m_strDeviceName;
std::string m_strSettingsFile;
std::string m_strFileLocation;
int m_iVendorId;
std::string m_strVendorId;
int m_iProductId;
std::string m_strProductId;
std::string m_strVersionInfo;
bool m_bInitialised;
bool m_bHidden;
bool m_bError;
std::vector<PeripheralFeature> m_features;
std::vector<CPeripheral *> m_subDevices;
std::map<std::string, PeripheralDeviceSetting> m_settings;
std::set<std::string> m_changedSettings;
};
}
| {
"pile_set_name": "Github"
} |
/**
* Privacy policy controller.
*/
angular.module('starter').controller('PrivacyPolicyController', function ($scope, $stateParams, Application) {
angular.extend($scope, {
value_id: $stateParams.value_id,
page_title: Application.privacyPolicy.title,
privacy_policy: Application.privacyPolicy.text,
privacy_policy_gdpr: Application.privacyPolicy.gdpr,
card_design: false,
gdpr: {
isEnabled: Application.gdpr.isEnabled
}
});
});
| {
"pile_set_name": "Github"
} |
/*
* FreeRTOS Kernel V10.0.1
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
/******************************************************************************
* NOTE 1: This project provides two demo applications. A simple blinky style
* project, and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
* in main.c. This file implements the comprehensive test and demo version.
*
* NOTE 2: This file only contains the source code that is specific to the
* full demo. Generic functions, such FreeRTOS hook functions, and functions
* required to configure the hardware, are defined in main.c.
*
******************************************************************************
*
* main_full() creates all the demo application tasks and software timers, then
* starts the scheduler. The web documentation provides more details of the
* standard demo application tasks, which provide no particular functionality,
* but do provide a good example of how to use the FreeRTOS API.
*
* "Reg test" tasks - These fill both the core and floating point registers with
* known values, then check that each register maintains its expected value for
* the lifetime of the task. Each task uses a different set of values. The reg
* test tasks execute with a very low priority, so get preempted very
* frequently. A register containing an unexpected value is indicative of an
* error in the context switching mechanism.
*
* "Check" task - The check task period is initially set to three seconds. The
* task checks that all the standard demo tasks, and the register check tasks,
* are not only still executing, but are executing without reporting any errors.
* If the check task discovers that a task has either stalled, or reported an
* error, then it changes its own execution period from the initial three
* seconds, to just 200ms. The check task also toggles an LED each time it is
* called. This provides a visual indication of the system status: If the LED
* toggles every three seconds, then no issues have been discovered. If the LED
* toggles every 200ms, then an issue has been discovered with at least one
* task.
*/
/* Standard includes. */
#include <stdio.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
/* Standard demo application includes. */
#include "flop.h"
#include "semtest.h"
#include "dynamic.h"
#include "BlockQ.h"
#include "blocktim.h"
#include "countsem.h"
#include "GenQTest.h"
#include "recmutex.h"
#include "death.h"
#include "partest.h"
#include "TimerDemo.h"
#include "QueueOverwrite.h"
#include "IntQueue.h"
#include "EventGroupsDemo.h"
#include "IntSemTest.h"
#include "QueueSet.h"
#include "TaskNotify.h"
/* Priorities for the demo application tasks. */
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL )
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainCDC_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2UL )
#define mainCOM_TEST_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
/* The initial priority used by the UART command console task. */
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
/* A block time of zero simply means "don't block". */
#define mainDONT_BLOCK ( 0UL )
/* The period of the check task, in ms, provided no errors have been reported by
any of the standard demo tasks. ms are converted to the equivalent in ticks
using the pdMS_TO_TICKS() macro constant. */
#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL )
/* The period of the check task, in ms, if an error has been reported in one of
the standard demo tasks. ms are converted to the equivalent in ticks using the
pdMS_TO_TICKS() macro. */
#define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 200UL )
/* Parameters that are passed into the register check tasks solely for the
purpose of ensuring parameters are passed into tasks correctly. */
#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )
#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )
/* The base period used by the timer test tasks. */
#define mainTIMER_TEST_PERIOD ( 50 )
/* The LED is used to show the demo status. (not connected on Rev A hardware) */
#define mainTOGGLE_LED() HAL_GPIO_TogglePin( GPIOF, GPIO_PIN_10 )
/*-----------------------------------------------------------*/
/*
* Called by main() to run the full demo (as opposed to the blinky demo) when
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
*/
void main_full( void );
/*
* The check task, as described at the top of this file.
*/
static void prvCheckTask( void *pvParameters );
/*
* Register check tasks, and the tasks used to write over and check the contents
* of the FPU registers, as described at the top of this file. The nature of
* these files necessitates that they are written in an assembly file, but the
* entry points are kept in the C file for the convenience of checking the task
* parameter.
*/
static void prvRegTestTaskEntry1( void *pvParameters );
extern void vRegTest1Implementation( void );
static void prvRegTestTaskEntry2( void *pvParameters );
extern void vRegTest2Implementation( void );
/*
* Register commands that can be used with FreeRTOS+CLI. The commands are
* defined in CLI-Commands.c and File-Related-CLI-Command.c respectively.
*/
extern void vRegisterSampleCLICommands( void );
/*
* The task that manages the FreeRTOS+CLI input and output.
*/
extern void vUSBCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );
/*-----------------------------------------------------------*/
/* The following two variables are used to communicate the status of the
register check tasks to the check task. If the variables keep incrementing,
then the register check tasks have not discovered any errors. If a variable
stops incrementing, then an error has been found. */
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
/*-----------------------------------------------------------*/
void main_full( void )
{
/* Start all the other standard demo/test tasks. They have no particular
functionality, but do demonstrate how to use the FreeRTOS API and test the
kernel port. */
vStartInterruptQueueTasks();
vStartDynamicPriorityTasks();
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartCountingSemaphoreTasks();
vStartGenericQueueTasks( tskIDLE_PRIORITY );
vStartRecursiveMutexTasks();
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartMathTasks( mainFLOP_TASK_PRIORITY );
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
vStartEventGroupTasks();
vStartInterruptSemaphoreTasks();
vStartQueueSetTasks();
vStartTaskNotifyTask();
/* Create the register check tasks, as described at the top of this file */
xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
/* Create the task that performs the 'check' functionality, as described at
the top of this file. */
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* The set of tasks created by the following function call have to be
created last as they keep account of the number of tasks they expect to see
running. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
/* Start the scheduler. */
vTaskStartScheduler();
/* If all is well, the scheduler will now be running, and the following
line will never be reached. If the following line does execute, then
there was insufficient FreeRTOS heap memory available for the Idle and/or
timer tasks to be created. See the memory management section on the
FreeRTOS web site for more details on the FreeRTOS heap
http://www.freertos.org/a00111.html. */
for( ;; );
}
/*-----------------------------------------------------------*/
static void prvCheckTask( void *pvParameters )
{
TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;
TickType_t xLastExecutionTime;
static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
unsigned long ulErrorFound = pdFALSE;
/* Just to stop compiler warnings. */
( void ) pvParameters;
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
works correctly. */
xLastExecutionTime = xTaskGetTickCount();
/* Cycle for ever, delaying then checking all the other tasks are still
operating without error. The onboard LED is toggled on each iteration.
If an error is detected then the delay period is decreased from
mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the
effect of increasing the rate at which the onboard LED toggles, and in so
doing gives visual feedback of the system status. */
for( ;; )
{
/* Delay until it is time to execute again. */
vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
/* Check all the demo tasks (other than the flash tasks) to ensure
that they are all still running, and that none have detected an error. */
if( xAreIntQueueTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 0UL;
}
if( xAreMathsTaskStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 1UL;
}
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 2UL;
}
if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 3UL;
}
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 4UL;
}
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 5UL;
}
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 6UL;
}
if( xIsCreateTaskStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 7UL;
}
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 8UL;
}
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS )
{
ulErrorFound = 1UL << 9UL;
}
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 10UL;
}
if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 11UL;
}
if( xAreEventGroupTasksStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 12UL;
}
if( xAreInterruptSemaphoreTasksStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 13UL;
}
if( xAreQueueSetTasksStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 14UL;
}
if( xAreTaskNotificationTasksStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 15UL;
}
/* Check that the register test 1 task is still running. */
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
{
ulErrorFound = 1UL << 16UL;
}
ulLastRegTest1Value = ulRegTest1LoopCounter;
/* Check that the register test 2 task is still running. */
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
{
ulErrorFound = 1UL << 17UL;
}
ulLastRegTest2Value = ulRegTest2LoopCounter;
/* Toggle the check LED to give an indication of the system status. If
the LED toggles every mainNO_ERROR_CHECK_TASK_PERIOD milliseconds then
everything is ok. A faster toggle indicates an error. */
mainTOGGLE_LED();
if( ulErrorFound != pdFALSE )
{
/* An error has been detected in one of the tasks - flash the LED
at a higher frequency to give visible feedback that something has
gone wrong. */
xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;
}
}
}
/*-----------------------------------------------------------*/
static void prvRegTestTaskEntry1( void *pvParameters )
{
/* Although the regtest task is written in assembler, its entry point is
written in C for convenience of checking the task parameter is being passed
in correctly. */
if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )
{
/* Start the part of the test that is written in assembler. */
vRegTest1Implementation();
}
/* The following line will only execute if the task parameter is found to
be incorrect. The check task will detect that the regtest loop counter is
not being incremented and flag an error. */
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
static void prvRegTestTaskEntry2( void *pvParameters )
{
/* Although the regtest task is written in assembler, its entry point is
written in C for convenience of checking the task parameter is being passed
in correctly. */
if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )
{
/* Start the part of the test that is written in assembler. */
vRegTest2Implementation();
}
/* The following line will only execute if the task parameter is found to
be incorrect. The check task will detect that the regtest loop counter is
not being incremented and flag an error. */
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
| {
"pile_set_name": "Github"
} |
/**
* \file pk.h
*
* \brief Public Key abstraction layer
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#ifndef MBEDTLS_PK_H
#define MBEDTLS_PK_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "mbedtls/md.h"
#if defined(MBEDTLS_RSA_C)
#include "mbedtls/rsa.h"
#endif
#if defined(MBEDTLS_ECP_C)
#include "mbedtls/ecp.h"
#endif
#if defined(MBEDTLS_ECDSA_C)
#include "mbedtls/ecdsa.h"
#endif
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
#endif
#define MBEDTLS_ERR_PK_ALLOC_FAILED -0x3F80 /**< Memory allocation failed. */
#define MBEDTLS_ERR_PK_TYPE_MISMATCH -0x3F00 /**< Type mismatch, eg attempt to encrypt with an ECDSA key */
#define MBEDTLS_ERR_PK_BAD_INPUT_DATA -0x3E80 /**< Bad input parameters to function. */
#define MBEDTLS_ERR_PK_FILE_IO_ERROR -0x3E00 /**< Read/write of file failed. */
#define MBEDTLS_ERR_PK_KEY_INVALID_VERSION -0x3D80 /**< Unsupported key version */
#define MBEDTLS_ERR_PK_KEY_INVALID_FORMAT -0x3D00 /**< Invalid key tag or value. */
#define MBEDTLS_ERR_PK_UNKNOWN_PK_ALG -0x3C80 /**< Key algorithm is unsupported (only RSA and EC are supported). */
#define MBEDTLS_ERR_PK_PASSWORD_REQUIRED -0x3C00 /**< Private key password can't be empty. */
#define MBEDTLS_ERR_PK_PASSWORD_MISMATCH -0x3B80 /**< Given private key password does not allow for correct decryption. */
#define MBEDTLS_ERR_PK_INVALID_PUBKEY -0x3B00 /**< The pubkey tag or value is invalid (only RSA and EC are supported). */
#define MBEDTLS_ERR_PK_INVALID_ALG -0x3A80 /**< The algorithm tag or value is invalid. */
#define MBEDTLS_ERR_PK_UNKNOWN_NAMED_CURVE -0x3A00 /**< Elliptic curve is unsupported (only NIST curves are supported). */
#define MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE -0x3980 /**< Unavailable feature, e.g. RSA disabled for RSA key. */
#define MBEDTLS_ERR_PK_SIG_LEN_MISMATCH -0x3900 /**< The buffer contains a valid signature followed by more data. */
/* MBEDTLS_ERR_PK_HW_ACCEL_FAILED is deprecated and should not be used. */
#define MBEDTLS_ERR_PK_HW_ACCEL_FAILED -0x3880 /**< PK hardware accelerator failed. */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Public key types
*/
typedef enum {
MBEDTLS_PK_NONE=0,
MBEDTLS_PK_RSA,
MBEDTLS_PK_ECKEY,
MBEDTLS_PK_ECKEY_DH,
MBEDTLS_PK_ECDSA,
MBEDTLS_PK_RSA_ALT,
MBEDTLS_PK_RSASSA_PSS,
} mbedtls_pk_type_t;
/**
* \brief Options for RSASSA-PSS signature verification.
* See \c mbedtls_rsa_rsassa_pss_verify_ext()
*/
typedef struct mbedtls_pk_rsassa_pss_options
{
mbedtls_md_type_t mgf1_hash_id;
int expected_salt_len;
} mbedtls_pk_rsassa_pss_options;
/**
* \brief Types for interfacing with the debug module
*/
typedef enum
{
MBEDTLS_PK_DEBUG_NONE = 0,
MBEDTLS_PK_DEBUG_MPI,
MBEDTLS_PK_DEBUG_ECP,
} mbedtls_pk_debug_type;
/**
* \brief Item to send to the debug module
*/
typedef struct mbedtls_pk_debug_item
{
mbedtls_pk_debug_type type;
const char *name;
void *value;
} mbedtls_pk_debug_item;
/** Maximum number of item send for debugging, plus 1 */
#define MBEDTLS_PK_DEBUG_MAX_ITEMS 3
/**
* \brief Public key information and operations
*/
typedef struct mbedtls_pk_info_t mbedtls_pk_info_t;
/**
* \brief Public key container
*/
typedef struct mbedtls_pk_context
{
const mbedtls_pk_info_t * pk_info; /**< Public key information */
void * pk_ctx; /**< Underlying public key context */
} mbedtls_pk_context;
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
/**
* \brief Context for resuming operations
*/
typedef struct
{
const mbedtls_pk_info_t * pk_info; /**< Public key information */
void * rs_ctx; /**< Underlying restart context */
} mbedtls_pk_restart_ctx;
#else /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
/* Now we can declare functions that take a pointer to that */
typedef void mbedtls_pk_restart_ctx;
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
#if defined(MBEDTLS_RSA_C)
/**
* Quick access to an RSA context inside a PK context.
*
* \warning You must make sure the PK context actually holds an RSA context
* before using this function!
*/
static inline mbedtls_rsa_context *mbedtls_pk_rsa( const mbedtls_pk_context pk )
{
return( (mbedtls_rsa_context *) (pk).pk_ctx );
}
#endif /* MBEDTLS_RSA_C */
#if defined(MBEDTLS_ECP_C)
/**
* Quick access to an EC context inside a PK context.
*
* \warning You must make sure the PK context actually holds an EC context
* before using this function!
*/
static inline mbedtls_ecp_keypair *mbedtls_pk_ec( const mbedtls_pk_context pk )
{
return( (mbedtls_ecp_keypair *) (pk).pk_ctx );
}
#endif /* MBEDTLS_ECP_C */
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/**
* \brief Types for RSA-alt abstraction
*/
typedef int (*mbedtls_pk_rsa_alt_decrypt_func)( void *ctx, int mode, size_t *olen,
const unsigned char *input, unsigned char *output,
size_t output_max_len );
typedef int (*mbedtls_pk_rsa_alt_sign_func)( void *ctx,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
int mode, mbedtls_md_type_t md_alg, unsigned int hashlen,
const unsigned char *hash, unsigned char *sig );
typedef size_t (*mbedtls_pk_rsa_alt_key_len_func)( void *ctx );
#endif /* MBEDTLS_PK_RSA_ALT_SUPPORT */
/**
* \brief Return information associated with the given PK type
*
* \param pk_type PK type to search for.
*
* \return The PK info associated with the type or NULL if not found.
*/
const mbedtls_pk_info_t *mbedtls_pk_info_from_type( mbedtls_pk_type_t pk_type );
/**
* \brief Initialize a #mbedtls_pk_context (as NONE).
*
* \param ctx The context to initialize.
* This must not be \c NULL.
*/
void mbedtls_pk_init( mbedtls_pk_context *ctx );
/**
* \brief Free the components of a #mbedtls_pk_context.
*
* \param ctx The context to clear. It must have been initialized.
* If this is \c NULL, this function does nothing.
*/
void mbedtls_pk_free( mbedtls_pk_context *ctx );
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
/**
* \brief Initialize a restart context
*
* \param ctx The context to initialize.
* This must not be \c NULL.
*/
void mbedtls_pk_restart_init( mbedtls_pk_restart_ctx *ctx );
/**
* \brief Free the components of a restart context
*
* \param ctx The context to clear. It must have been initialized.
* If this is \c NULL, this function does nothing.
*/
void mbedtls_pk_restart_free( mbedtls_pk_restart_ctx *ctx );
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
/**
* \brief Initialize a PK context with the information given
* and allocates the type-specific PK subcontext.
*
* \param ctx Context to initialize. It must not have been set
* up yet (type #MBEDTLS_PK_NONE).
* \param info Information to use
*
* \return 0 on success,
* MBEDTLS_ERR_PK_BAD_INPUT_DATA on invalid input,
* MBEDTLS_ERR_PK_ALLOC_FAILED on allocation failure.
*
* \note For contexts holding an RSA-alt key, use
* \c mbedtls_pk_setup_rsa_alt() instead.
*/
int mbedtls_pk_setup( mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info );
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/**
* \brief Initialize an RSA-alt context
*
* \param ctx Context to initialize. It must not have been set
* up yet (type #MBEDTLS_PK_NONE).
* \param key RSA key pointer
* \param decrypt_func Decryption function
* \param sign_func Signing function
* \param key_len_func Function returning key length in bytes
*
* \return 0 on success, or MBEDTLS_ERR_PK_BAD_INPUT_DATA if the
* context wasn't already initialized as RSA_ALT.
*
* \note This function replaces \c mbedtls_pk_setup() for RSA-alt.
*/
int mbedtls_pk_setup_rsa_alt( mbedtls_pk_context *ctx, void * key,
mbedtls_pk_rsa_alt_decrypt_func decrypt_func,
mbedtls_pk_rsa_alt_sign_func sign_func,
mbedtls_pk_rsa_alt_key_len_func key_len_func );
#endif /* MBEDTLS_PK_RSA_ALT_SUPPORT */
/**
* \brief Get the size in bits of the underlying key
*
* \param ctx The context to query. It must have been initialized.
*
* \return Key size in bits, or 0 on error
*/
size_t mbedtls_pk_get_bitlen( const mbedtls_pk_context *ctx );
/**
* \brief Get the length in bytes of the underlying key
*
* \param ctx The context to query. It must have been initialized.
*
* \return Key length in bytes, or 0 on error
*/
static inline size_t mbedtls_pk_get_len( const mbedtls_pk_context *ctx )
{
return( ( mbedtls_pk_get_bitlen( ctx ) + 7 ) / 8 );
}
/**
* \brief Tell if a context can do the operation given by type
*
* \param ctx The context to query. It must have been initialized.
* \param type The desired type.
*
* \return 1 if the context can do operations on the given type.
* \return 0 if the context cannot do the operations on the given
* type. This is always the case for a context that has
* been initialized but not set up, or that has been
* cleared with mbedtls_pk_free().
*/
int mbedtls_pk_can_do( const mbedtls_pk_context *ctx, mbedtls_pk_type_t type );
/**
* \brief Verify signature (including padding if relevant).
*
* \param ctx The PK context to use. It must have been set up.
* \param md_alg Hash algorithm used (see notes)
* \param hash Hash of the message to sign
* \param hash_len Hash length or 0 (see notes)
* \param sig Signature to verify
* \param sig_len Signature length
*
* \return 0 on success (signature is valid),
* #MBEDTLS_ERR_PK_SIG_LEN_MISMATCH if there is a valid
* signature in sig but its length is less than \p siglen,
* or a specific error code.
*
* \note For RSA keys, the default padding type is PKCS#1 v1.5.
* Use \c mbedtls_pk_verify_ext( MBEDTLS_PK_RSASSA_PSS, ... )
* to verify RSASSA_PSS signatures.
*
* \note If hash_len is 0, then the length associated with md_alg
* is used instead, or an error returned if it is invalid.
*
* \note md_alg may be MBEDTLS_MD_NONE, only if hash_len != 0
*/
int mbedtls_pk_verify( mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len,
const unsigned char *sig, size_t sig_len );
/**
* \brief Restartable version of \c mbedtls_pk_verify()
*
* \note Performs the same job as \c mbedtls_pk_verify(), but can
* return early and restart according to the limit set with
* \c mbedtls_ecp_set_max_ops() to reduce blocking for ECC
* operations. For RSA, same as \c mbedtls_pk_verify().
*
* \param ctx The PK context to use. It must have been set up.
* \param md_alg Hash algorithm used (see notes)
* \param hash Hash of the message to sign
* \param hash_len Hash length or 0 (see notes)
* \param sig Signature to verify
* \param sig_len Signature length
* \param rs_ctx Restart context (NULL to disable restart)
*
* \return See \c mbedtls_pk_verify(), or
* \return #MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of
* operations was reached: see \c mbedtls_ecp_set_max_ops().
*/
int mbedtls_pk_verify_restartable( mbedtls_pk_context *ctx,
mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len,
const unsigned char *sig, size_t sig_len,
mbedtls_pk_restart_ctx *rs_ctx );
/**
* \brief Verify signature, with options.
* (Includes verification of the padding depending on type.)
*
* \param type Signature type (inc. possible padding type) to verify
* \param options Pointer to type-specific options, or NULL
* \param ctx The PK context to use. It must have been set up.
* \param md_alg Hash algorithm used (see notes)
* \param hash Hash of the message to sign
* \param hash_len Hash length or 0 (see notes)
* \param sig Signature to verify
* \param sig_len Signature length
*
* \return 0 on success (signature is valid),
* #MBEDTLS_ERR_PK_TYPE_MISMATCH if the PK context can't be
* used for this type of signatures,
* #MBEDTLS_ERR_PK_SIG_LEN_MISMATCH if there is a valid
* signature in sig but its length is less than \p siglen,
* or a specific error code.
*
* \note If hash_len is 0, then the length associated with md_alg
* is used instead, or an error returned if it is invalid.
*
* \note md_alg may be MBEDTLS_MD_NONE, only if hash_len != 0
*
* \note If type is MBEDTLS_PK_RSASSA_PSS, then options must point
* to a mbedtls_pk_rsassa_pss_options structure,
* otherwise it must be NULL.
*/
int mbedtls_pk_verify_ext( mbedtls_pk_type_t type, const void *options,
mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len,
const unsigned char *sig, size_t sig_len );
/**
* \brief Make signature, including padding if relevant.
*
* \param ctx The PK context to use. It must have been set up
* with a private key.
* \param md_alg Hash algorithm used (see notes)
* \param hash Hash of the message to sign
* \param hash_len Hash length or 0 (see notes)
* \param sig Place to write the signature
* \param sig_len Number of bytes written
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \return 0 on success, or a specific error code.
*
* \note For RSA keys, the default padding type is PKCS#1 v1.5.
* There is no interface in the PK module to make RSASSA-PSS
* signatures yet.
*
* \note If hash_len is 0, then the length associated with md_alg
* is used instead, or an error returned if it is invalid.
*
* \note For RSA, md_alg may be MBEDTLS_MD_NONE if hash_len != 0.
* For ECDSA, md_alg may never be MBEDTLS_MD_NONE.
*
* \note In order to ensure enough space for the signature, the
* \p sig buffer size must be of at least
* `max(MBEDTLS_ECDSA_MAX_LEN, MBEDTLS_MPI_MAX_SIZE)` bytes.
*/
int mbedtls_pk_sign( mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t *sig_len,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
/**
* \brief Restartable version of \c mbedtls_pk_sign()
*
* \note Performs the same job as \c mbedtls_pk_sign(), but can
* return early and restart according to the limit set with
* \c mbedtls_ecp_set_max_ops() to reduce blocking for ECC
* operations. For RSA, same as \c mbedtls_pk_sign().
*
* \note In order to ensure enough space for the signature, the
* \p sig buffer size must be of at least
* `max(MBEDTLS_ECDSA_MAX_LEN, MBEDTLS_MPI_MAX_SIZE)` bytes.
*
* \param ctx The PK context to use. It must have been set up
* with a private key.
* \param md_alg Hash algorithm used (see notes)
* \param hash Hash of the message to sign
* \param hash_len Hash length or 0 (see notes)
* \param sig Place to write the signature
* \param sig_len Number of bytes written
* \param f_rng RNG function
* \param p_rng RNG parameter
* \param rs_ctx Restart context (NULL to disable restart)
*
* \return See \c mbedtls_pk_sign(), or
* \return #MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of
* operations was reached: see \c mbedtls_ecp_set_max_ops().
*/
int mbedtls_pk_sign_restartable( mbedtls_pk_context *ctx,
mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t *sig_len,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
mbedtls_pk_restart_ctx *rs_ctx );
/**
* \brief Decrypt message (including padding if relevant).
*
* \param ctx The PK context to use. It must have been set up
* with a private key.
* \param input Input to decrypt
* \param ilen Input size
* \param output Decrypted output
* \param olen Decrypted message length
* \param osize Size of the output buffer
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \note For RSA keys, the default padding type is PKCS#1 v1.5.
*
* \return 0 on success, or a specific error code.
*/
int mbedtls_pk_decrypt( mbedtls_pk_context *ctx,
const unsigned char *input, size_t ilen,
unsigned char *output, size_t *olen, size_t osize,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
/**
* \brief Encrypt message (including padding if relevant).
*
* \param ctx The PK context to use. It must have been set up.
* \param input Message to encrypt
* \param ilen Message size
* \param output Encrypted output
* \param olen Encrypted output length
* \param osize Size of the output buffer
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \note For RSA keys, the default padding type is PKCS#1 v1.5.
*
* \return 0 on success, or a specific error code.
*/
int mbedtls_pk_encrypt( mbedtls_pk_context *ctx,
const unsigned char *input, size_t ilen,
unsigned char *output, size_t *olen, size_t osize,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
/**
* \brief Check if a public-private pair of keys matches.
*
* \param pub Context holding a public key.
* \param prv Context holding a private (and public) key.
*
* \return 0 on success or MBEDTLS_ERR_PK_BAD_INPUT_DATA
*/
int mbedtls_pk_check_pair( const mbedtls_pk_context *pub, const mbedtls_pk_context *prv );
/**
* \brief Export debug information
*
* \param ctx The PK context to use. It must have been initialized.
* \param items Place to write debug items
*
* \return 0 on success or MBEDTLS_ERR_PK_BAD_INPUT_DATA
*/
int mbedtls_pk_debug( const mbedtls_pk_context *ctx, mbedtls_pk_debug_item *items );
/**
* \brief Access the type name
*
* \param ctx The PK context to use. It must have been initialized.
*
* \return Type name on success, or "invalid PK"
*/
const char * mbedtls_pk_get_name( const mbedtls_pk_context *ctx );
/**
* \brief Get the key type
*
* \param ctx The PK context to use. It must have been initialized.
*
* \return Type on success.
* \return #MBEDTLS_PK_NONE for a context that has not been set up.
*/
mbedtls_pk_type_t mbedtls_pk_get_type( const mbedtls_pk_context *ctx );
#if defined(MBEDTLS_PK_PARSE_C)
/** \ingroup pk_module */
/**
* \brief Parse a private key in PEM or DER format
*
* \param ctx The PK context to fill. It must have been initialized
* but not set up.
* \param key Input buffer to parse.
* The buffer must contain the input exactly, with no
* extra trailing material. For PEM, the buffer must
* contain a null-terminated string.
* \param keylen Size of \b key in bytes.
* For PEM data, this includes the terminating null byte,
* so \p keylen must be equal to `strlen(key) + 1`.
* \param pwd Optional password for decryption.
* Pass \c NULL if expecting a non-encrypted key.
* Pass a string of \p pwdlen bytes if expecting an encrypted
* key; a non-encrypted key will also be accepted.
* The empty password is not supported.
* \param pwdlen Size of the password in bytes.
* Ignored if \p pwd is \c NULL.
*
* \note On entry, ctx must be empty, either freshly initialised
* with mbedtls_pk_init() or reset with mbedtls_pk_free(). If you need a
* specific key type, check the result with mbedtls_pk_can_do().
*
* \note The key is also checked for correctness.
*
* \return 0 if successful, or a specific PK or PEM error code
*/
int mbedtls_pk_parse_key( mbedtls_pk_context *ctx,
const unsigned char *key, size_t keylen,
const unsigned char *pwd, size_t pwdlen );
/** \ingroup pk_module */
/**
* \brief Parse a public key in PEM or DER format
*
* \param ctx The PK context to fill. It must have been initialized
* but not set up.
* \param key Input buffer to parse.
* The buffer must contain the input exactly, with no
* extra trailing material. For PEM, the buffer must
* contain a null-terminated string.
* \param keylen Size of \b key in bytes.
* For PEM data, this includes the terminating null byte,
* so \p keylen must be equal to `strlen(key) + 1`.
*
* \note On entry, ctx must be empty, either freshly initialised
* with mbedtls_pk_init() or reset with mbedtls_pk_free(). If you need a
* specific key type, check the result with mbedtls_pk_can_do().
*
* \note The key is also checked for correctness.
*
* \return 0 if successful, or a specific PK or PEM error code
*/
int mbedtls_pk_parse_public_key( mbedtls_pk_context *ctx,
const unsigned char *key, size_t keylen );
#if defined(MBEDTLS_FS_IO)
/** \ingroup pk_module */
/**
* \brief Load and parse a private key
*
* \param ctx The PK context to fill. It must have been initialized
* but not set up.
* \param path filename to read the private key from
* \param password Optional password to decrypt the file.
* Pass \c NULL if expecting a non-encrypted key.
* Pass a null-terminated string if expecting an encrypted
* key; a non-encrypted key will also be accepted.
* The empty password is not supported.
*
* \note On entry, ctx must be empty, either freshly initialised
* with mbedtls_pk_init() or reset with mbedtls_pk_free(). If you need a
* specific key type, check the result with mbedtls_pk_can_do().
*
* \note The key is also checked for correctness.
*
* \return 0 if successful, or a specific PK or PEM error code
*/
int mbedtls_pk_parse_keyfile( mbedtls_pk_context *ctx,
const char *path, const char *password );
/** \ingroup pk_module */
/**
* \brief Load and parse a public key
*
* \param ctx The PK context to fill. It must have been initialized
* but not set up.
* \param path filename to read the public key from
*
* \note On entry, ctx must be empty, either freshly initialised
* with mbedtls_pk_init() or reset with mbedtls_pk_free(). If
* you need a specific key type, check the result with
* mbedtls_pk_can_do().
*
* \note The key is also checked for correctness.
*
* \return 0 if successful, or a specific PK or PEM error code
*/
int mbedtls_pk_parse_public_keyfile( mbedtls_pk_context *ctx, const char *path );
#endif /* MBEDTLS_FS_IO */
#endif /* MBEDTLS_PK_PARSE_C */
#if defined(MBEDTLS_PK_WRITE_C)
/**
* \brief Write a private key to a PKCS#1 or SEC1 DER structure
* Note: data is written at the end of the buffer! Use the
* return value to determine where you should start
* using the buffer
*
* \param ctx PK context which must contain a valid private key.
* \param buf buffer to write to
* \param size size of the buffer
*
* \return length of data written if successful, or a specific
* error code
*/
int mbedtls_pk_write_key_der( mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
/**
* \brief Write a public key to a SubjectPublicKeyInfo DER structure
* Note: data is written at the end of the buffer! Use the
* return value to determine where you should start
* using the buffer
*
* \param ctx PK context which must contain a valid public or private key.
* \param buf buffer to write to
* \param size size of the buffer
*
* \return length of data written if successful, or a specific
* error code
*/
int mbedtls_pk_write_pubkey_der( mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
#if defined(MBEDTLS_PEM_WRITE_C)
/**
* \brief Write a public key to a PEM string
*
* \param ctx PK context which must contain a valid public or private key.
* \param buf Buffer to write to. The output includes a
* terminating null byte.
* \param size Size of the buffer in bytes.
*
* \return 0 if successful, or a specific error code
*/
int mbedtls_pk_write_pubkey_pem( mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
/**
* \brief Write a private key to a PKCS#1 or SEC1 PEM string
*
* \param ctx PK context which must contain a valid private key.
* \param buf Buffer to write to. The output includes a
* terminating null byte.
* \param size Size of the buffer in bytes.
*
* \return 0 if successful, or a specific error code
*/
int mbedtls_pk_write_key_pem( mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
#endif /* MBEDTLS_PEM_WRITE_C */
#endif /* MBEDTLS_PK_WRITE_C */
/*
* WARNING: Low-level functions. You probably do not want to use these unless
* you are certain you do ;)
*/
#if defined(MBEDTLS_PK_PARSE_C)
/**
* \brief Parse a SubjectPublicKeyInfo DER structure
*
* \param p the position in the ASN.1 data
* \param end end of the buffer
* \param pk The PK context to fill. It must have been initialized
* but not set up.
*
* \return 0 if successful, or a specific PK error code
*/
int mbedtls_pk_parse_subpubkey( unsigned char **p, const unsigned char *end,
mbedtls_pk_context *pk );
#endif /* MBEDTLS_PK_PARSE_C */
#if defined(MBEDTLS_PK_WRITE_C)
/**
* \brief Write a subjectPublicKey to ASN.1 data
* Note: function works backwards in data buffer
*
* \param p reference to current position pointer
* \param start start of the buffer (for bounds-checking)
* \param key PK context which must contain a valid public or private key.
*
* \return the length written or a negative error code
*/
int mbedtls_pk_write_pubkey( unsigned char **p, unsigned char *start,
const mbedtls_pk_context *key );
#endif /* MBEDTLS_PK_WRITE_C */
/*
* Internal module functions. You probably do not want to use these unless you
* know you do.
*/
#if defined(MBEDTLS_FS_IO)
int mbedtls_pk_load_file( const char *path, unsigned char **buf, size_t *n );
#endif
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_PK_H */
| {
"pile_set_name": "Github"
} |
# :nodoc:
module PG
struct Numeric
include Comparable(Float64)
include Comparable(Int32)
def self.build(*args)
new(*args)
end
def <=>(v : Float64)
to_f <=> v
end
def <=>(v : Int32)
to_f <=> v
end
end
end
| {
"pile_set_name": "Github"
} |
0.0004352427581767983618992876244154638377 {omega[1]}
0.0012548576180906004206129180809578538280 {omega[2]}
0.0029046595378673015925571838967769733308 {omega[3]}
0.0064645586114702151104412458735432034374 {omega[4]}
0.0138392720069440783444312203197268384969 {omega[5]}
0.0284704841665357742747430444194001175617 {omega[6]}
0.0565119417861124794805877374209712726838 {omega[7]}
0.1087244476673139367912316981257259129734 {omega[8]}
0.2035678909477675178652271090196101965830 {omega[9]}
0.3723216049428287995005839444706552399111 {omega[10]}
0.6682119500204294828692337671061096671110 {omega[11]}
1.1865913419286377433877963105679498312384 {omega[12]}
2.1318813562162843423634928097243346201140 {omega[13]}
4.2253409304934068796422153013736533466727 {omega[14]}
0.0001656550983736506384406475398318389636 {alpha[1]}
0.0009719040519362571361550429919085730690 {alpha[2]}
0.0029465717920729978218602967228109679176 {alpha[3]}
0.0074093762335677205316918764437666977685 {alpha[4]}
0.0171307513468537186462675638715102977017 {alpha[5]}
0.0374775400711816419706658501387330773014 {alpha[6]}
0.0784921372444625901570558305919700359254 {alpha[7]}
0.1584754097352566251801593219528108136274 {alpha[8]}
0.3100135420433681162971292777363885306841 {alpha[9]}
0.5900153839041758170916827930252424039281 {alpha[10]}
1.0966083910583347686045277424859989423567 {alpha[11]}
1.9996081150871290993799658797236418195098 {alpha[12]}
3.6084591233871420245474942456453959493956 {alpha[13]}
6.6171039433964087585204882913103574537672 {alpha[14]}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<!-- 2006-09-19 Michael Case: As per Sunanda Banerjee's request, this file
should be kept around for background studies.
-->
<DDDefinition xmlns="http://www.cern.ch/cms/DDL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cern.ch/cms/DDL ../../../DetectorDescription/Schema/DDLSchema.xsd">
<ConstantsSection label="cavern.xml" eval="true">
<Constant name="SideWallRmin" value="13.3*m"/>
<Constant name="dzwall" value="([cms:HallZ]-[cms:CMSZ2])/2"/>
<Constant name="zposwall" value="([cms:HallZ]+[cms:CMSZ2])/2"/>
<Constant name="sidewallwidth" value="0.5*(8.8*m+2.16*m)"/>
</ConstantsSection>
<SolidSection label="cavern.xml">
<Tubs name="CMSShaft" rMin="0*fm" rMax="[cavernData:ShaftR]" dz="[cavernData:ShaftDZ]" startPhi="0*deg" deltaPhi="360*deg"/>
<Tubs name="CMSShaftAir" rMin="0*fm" rMax="[cavernData:ShaftAirR]" dz="[cavernData:ShaftDZ]" startPhi="0*deg" deltaPhi="360*deg"/>
<Box name="OSFL" dx="[cavernData:FloorDX]" dy="[cavernData:FloorDY]" dz="[cms:HallZ]"/>
<Box name="OSFLsub" dx="[cavernData:FloorDX]" dy="1000*cm" dz="[cms:HallZ]+0.1*mm"/>
<EllipticalTube name="CMSWall" xSemiAxis="[cavernData:CMSWallEDX]" ySemiAxis="[cavernData:CMSWallEDY]" zHeight="[cms:HallZ]"/>
<EllipticalTube name="CMSWallAir" xSemiAxis="[cavernData:CMSWallIDX]" ySemiAxis="[cavernData:CMSWallIDY]" zHeight="[cavernData:CMSWallIDZ]"/>
<Box name="RackAV" dx="125*cm" dy="500*cm" dz="1080*cm"/>
<Box name="HFRise" dx="240*cm" dy="55*cm" dz="145*cm"/>
<Trapezoid name="YBFeetAir2" dz="[cavernData:YBFeetDZ]+5*cm" alp1="0*deg" bl1="0.1*mm" tl1="[cavernData:YBFeetAir2DX]+0.1*mm" h1="[cavernData:YBFeetAir2DY]+0.1*mm" alp2="0*deg" bl2="0.1*mm" tl2="[cavernData:YBFeetAir2DX]+0.1*mm" h2="[cavernData:YBFeetAir2DY]+0.1*mm" phi="0*deg" theta="0*deg"/>
<Trapezoid name="YBFeetAir3" dz="[cavernData:YBFeetDZ]+5*cm" alp1="0*deg" bl1="[cavernData:YBFeetAir3DX]+0.1*mm" tl1="0.1*mm" h1="[cavernData:YBFeetAir3DY]+0.1*mm" alp2="0*deg" bl2="[cavernData:YBFeetAir3DX]+0.1*mm" tl2="0.1*mm" h2="[cavernData:YBFeetAir3DY]+0.1*mm" phi="0*deg" theta="0*deg"/>
<Box name="YBFeetAir4" dx="[cavernData:YBFeetAir3DX]+0.1*mm" dy="[cavernData:YBFeetAir4DY]+0.1*mm" dz="[cavernData:YBFeetDZ]+5*cm"/>
<Box name="YBFeet" dx="[cavernData:YBFeetDX]" dy="[cavernData:YBFeetDY]" dz="[cavernData:YBFeetDZ]"/>
<Box name="YBFeetI" dx="100*cm" dy="[cavernData:YBFeetDZ]" dz="20*cm"/>
<UnionSolid name="CMSWallv0">
<rSolid name="cavern:CMSWall"/>
<rSolid name="cavern:CMSShaft"/>
<rRotation name="cavernData:Shaft"/>
<Translation x="0.*fm" y="[cavernData:ShaftPosZ]" z="[cavernData:ShaftPosY]"/>
</UnionSolid>
<SubtractionSolid name="Wallv1">
<rSolid name="cavern:CMSWallv0"/>
<rSolid name="cms:CMSE"/>
<Translation x="0.*fm" y="0*fm" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="Wall">
<rSolid name="Wallv1"/>
<rSolid name="cavern:OSFLsub"/>
<Translation x="0.*fm" y="-880*cm-1000*cm" z="0.*fm"/>
</SubtractionSolid>
<UnionSolid name="CMSWallAirv0">
<rSolid name="cavern:CMSWallAir"/>
<rSolid name="cavern:CMSShaftAir"/>
<rRotation name="cavernData:Shaft"/>
<Translation x="0.*fm" y="[cavernData:ShaftPosZ]" z="[cavernData:ShaftPosY]"/>
</UnionSolid>
<SubtractionSolid name="WallAirv1">
<rSolid name="cavern:CMSWallAirv0"/>
<rSolid name="cms:CMSE"/>
<Translation x="0.*fm" y="0*fm" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="WallAir">
<rSolid name="WallAirv1"/>
<rSolid name="cavern:OSFLsub"/>
<Translation x="0.*fm" y="-880*cm-1000*cm" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="YBFeetLeftv2">
<rSolid name="YBFeet"/>
<rSolid name="YBFeetAir2"/>
<Translation x="[cavernData:YBFeetDX]" y="[cavernData:YBFeetDY]-[cavernData:YBFeetAir2DY]" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="YBFeetLeftv3">
<rSolid name="YBFeetLeftv2"/>
<rSolid name="YBFeetAir3"/>
<Translation x="-[cavernData:YBFeetDX]" y="[cavernData:YBFeetDY]-2*[cavernData:YBFeetAir1DY]-[cavernData:YBFeetAir3DY]" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="YBFeetLeft">
<rSolid name="YBFeetLeftv3"/>
<rSolid name="YBFeetAir4"/>
<Translation x="-[cavernData:YBFeetDX]" y="-[cavernData:YBFeetDY]+[cavernData:YBFeetAir4DY]" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="YBFeetRightv2">
<rSolid name="YBFeet"/>
<rSolid name="YBFeetAir2"/>
<Translation x="-[cavernData:YBFeetDX]" y="[cavernData:YBFeetDY]-[cavernData:YBFeetAir2DY]" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="YBFeetRightv3">
<rSolid name="YBFeetRightv2"/>
<rSolid name="YBFeetAir3"/>
<Translation x="[cavernData:YBFeetDX]" y="[cavernData:YBFeetDY]-2*[cavernData:YBFeetAir1DY]-[cavernData:YBFeetAir3DY]" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="YBFeetRight">
<rSolid name="YBFeetRightv3"/>
<rSolid name="YBFeetAir4"/>
<Translation x="[cavernData:YBFeetDX]" y="-[cavernData:YBFeetDY]+[cavernData:YBFeetAir4DY]" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="YBFeetLeftO">
<rSolid name="YBFeetLeft"/>
<rSolid name="muonBase:MUON"/>
<Translation x="-[cavernData:YBFeetPosX]" y="-[cavernData:YBFeetPosY]" z="0.*fm"/>
</SubtractionSolid>
<SubtractionSolid name="YBFeetRightO">
<rSolid name="YBFeetRight"/>
<rSolid name="muonBase:MUON"/>
<Translation x="[cavernData:YBFeetPosX]" y="-[cavernData:YBFeetPosY]" z="0.*fm"/>
</SubtractionSolid>
</SolidSection>
<LogicalPartSection label="cavern.xml">
<LogicalPart name="Wall" category="unspecified">
<rSolid name="Wall"/>
<rMaterial name="materials:Stand.Concrete"/>
</LogicalPart>
<LogicalPart name="WallAir" category="unspecified">
<rSolid name="WallAir"/>
<rMaterial name="materials:Air"/>
</LogicalPart>
<LogicalPart name="YBFeetLeftO" category="unspecified">
<rSolid name="YBFeetLeftO"/>
<rMaterial name="materials:Iron"/>
</LogicalPart>
<LogicalPart name="YBFeetRightO" category="unspecified">
<rSolid name="YBFeetRightO"/>
<rMaterial name="materials:Iron"/>
</LogicalPart>
<LogicalPart name="YBFeetI" category="unspecified">
<rSolid name="YBFeetI"/>
<rMaterial name="materials:Iron"/>
</LogicalPart>
<LogicalPart name="OSFL" category="unspecified">
<rSolid name="OSFL"/>
<rMaterial name="materials:Stand.Concrete"/>
</LogicalPart>
<LogicalPart name="RackAV" category="unspecified">
<rSolid name="RackAV"/>
<rMaterial name="materials:StainlessSteel"/>
</LogicalPart>
<LogicalPart name="HFRise" category="unspecified">
<rSolid name="HFRise"/>
<rMaterial name="materials:Iron"/>
</LogicalPart>
</LogicalPartSection>
<PosPartSection label="cavern.xml">
<PosPart copyNumber="1">
<rParent name="cms:CMSE"/>
<rChild name="cavern:Wall"/>
<rRotation name="rotations:000D"/>
<Translation x="0*fm" y="0*fm" z="0*fm"/>
</PosPart>
<PosPart copyNumber="1">
<rParent name="cavern:Wall"/>
<rChild name="cavern:WallAir"/>
<rRotation name="rotations:000D"/>
<Translation x="0*fm" y="0*fm" z="0*fm"/>
</PosPart>
<!-- *********YB Feet Inner*********** -->
<PosPart copyNumber="1">
<rParent name="muonBase:MBWheel_2N"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1852"/>
</PosPart>
<PosPart copyNumber="2">
<rParent name="muonBase:MBWheel_1N"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1852"/>
</PosPart>
<PosPart copyNumber="3">
<rParent name="muonBase:MBWheel_0"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1852"/>
</PosPart>
<PosPart copyNumber="4">
<rParent name="muonBase:MBWheel_1P"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1852"/>
</PosPart>
<PosPart copyNumber="5">
<rParent name="muonBase:MBWheel_2P"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1852"/>
</PosPart>
<PosPart copyNumber="6">
<rParent name="muonBase:MBWheel_2N"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="-365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1832"/>
</PosPart>
<PosPart copyNumber="7">
<rParent name="muonBase:MBWheel_1N"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="-365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1832"/>
</PosPart>
<PosPart copyNumber="8">
<rParent name="muonBase:MBWheel_0"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="-365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1832"/>
</PosPart>
<PosPart copyNumber="9">
<rParent name="muonBase:MBWheel_1P"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="-365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1832"/>
</PosPart>
<PosPart copyNumber="10">
<rParent name="muonBase:MBWheel_2P"/>
<rChild name="cavern:YBFeetI"/>
<Translation x="-365*cm" y="-670*cm" z="0*fm"/>
<rRotation name="rotations:RM1832"/>
</PosPart>
<!-- *********YB Feet Outer*********** -->
<PosPart copyNumber="1">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetLeftO"/>
<rRotation name="rotations:000D"/>
<Translation x="[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="-5.342*m"/>
</PosPart>
<PosPart copyNumber="2">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetLeftO"/>
<rRotation name="rotations:000D"/>
<Translation x="[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="-2.686*m"/>
</PosPart>
<PosPart copyNumber="3">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetLeftO"/>
<rRotation name="rotations:000D"/>
<Translation x="[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="0*fm"/>
</PosPart>
<PosPart copyNumber="4">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetLeftO"/>
<rRotation name="rotations:000D"/>
<Translation x="[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="2.686*m"/>
</PosPart>
<PosPart copyNumber="5">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetLeftO"/>
<rRotation name="rotations:000D"/>
<Translation x="[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="5.342*m"/>
</PosPart>
<PosPart copyNumber="1">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetRightO"/>
<rRotation name="rotations:000D"/>
<Translation x="-[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="-5.342*m"/>
</PosPart>
<PosPart copyNumber="2">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetRightO"/>
<rRotation name="rotations:000D"/>
<Translation x="-[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="-2.686*m"/>
</PosPart>
<PosPart copyNumber="3">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetRightO"/>
<rRotation name="rotations:000D"/>
<Translation x="-[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="0*fm"/>
</PosPart>
<PosPart copyNumber="4">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetRightO"/>
<rRotation name="rotations:000D"/>
<Translation x="-[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="2.686*m"/>
</PosPart>
<PosPart copyNumber="5">
<rParent name="cms:CMSE"/>
<rChild name="cavern:YBFeetRightO"/>
<rRotation name="rotations:000D"/>
<Translation x="-[cavernData:YBFeetPosX]" y="[cavernData:YBFeetPosY]" z="5.342*m"/>
</PosPart>
<!-- *********Electronic Racks*********** -->
<PosPart copyNumber="1">
<rParent name="WallAir"/>
<rChild name="cavern:RackAV"/>
<rRotation name="rotations:000D"/>
<Translation x="925*cm+2*cm" y="0*fm" z="0*fm"/>
</PosPart>
<PosPart copyNumber="2">
<rParent name="WallAir"/>
<rChild name="cavern:RackAV"/>
<rRotation name="rotations:000D"/>
<Translation x="-925*cm-2*cm" y="0*fm" z="0*fm"/>
</PosPart>
<!-- *********HF Risers*********** -->
<PosPart copyNumber="1">
<rParent name="WallAir"/>
<rChild name="cavern:HFRise"/>
<rRotation name="rotations:000D"/>
<Translation x="0*cm" y="-325*cm" z="1245*cm"/>
</PosPart>
<PosPart copyNumber="2">
<rParent name="WallAir"/>
<rChild name="cavern:HFRise"/>
<rRotation name="rotations:000D"/>
<Translation x="0*cm" y="-485*cm" z="1245*cm"/>
</PosPart>
<PosPart copyNumber="3">
<rParent name="WallAir"/>
<rChild name="cavern:HFRise"/>
<rRotation name="rotations:000D"/>
<Translation x="0*cm" y="-645*cm" z="1245*cm"/>
</PosPart>
<PosPart copyNumber="4">
<rParent name="WallAir"/>
<rChild name="cavern:HFRise"/>
<rRotation name="rotations:000D"/>
<Translation x="0*cm" y="-805*cm" z="1245*cm"/>
</PosPart>
<PosPart copyNumber="5">
<rParent name="WallAir"/>
<rChild name="cavern:HFRise"/>
<rRotation name="rotations:000D"/>
<Translation x="0*cm" y="-325*cm" z="-1245*cm"/>
</PosPart>
<PosPart copyNumber="6">
<rParent name="WallAir"/>
<rChild name="cavern:HFRise"/>
<rRotation name="rotations:000D"/>
<Translation x="0*cm" y="-485*cm" z="-1245*cm"/>
</PosPart>
<PosPart copyNumber="7">
<rParent name="WallAir"/>
<rChild name="cavern:HFRise"/>
<rRotation name="rotations:000D"/>
<Translation x="0*cm" y="-645*cm" z="-1245*cm"/>
</PosPart>
<PosPart copyNumber="8">
<rParent name="WallAir"/>
<rChild name="cavern:HFRise"/>
<rRotation name="rotations:000D"/>
<Translation x="0*cm" y="-805*cm" z="-1245*cm"/>
</PosPart>
<!-- ********* Cavern Walls *********** -->
<PosPart copyNumber="1">
<rParent name="cms:CMSE"/>
<rChild name="cavern:OSFL"/>
<rRotation name="rotations:000D"/>
<Translation x="0*fm" y="-1240*cm" z="0*fm"/>
</PosPart>
</PosPartSection>
</DDDefinition>
| {
"pile_set_name": "Github"
} |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runes_test
import (
"fmt"
"unicode"
"golang.org/x/text/runes"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/norm"
"golang.org/x/text/width"
)
func ExampleRemove() {
t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC)
s, _, _ := transform.String(t, "résumé")
fmt.Println(s)
// Output:
// resume
}
func ExampleMap() {
replaceHyphens := runes.Map(func(r rune) rune {
if unicode.Is(unicode.Hyphen, r) {
return '|'
}
return r
})
s, _, _ := transform.String(replaceHyphens, "a-b‐c⸗d﹣e")
fmt.Println(s)
// Output:
// a|b|c|d|e
}
func ExampleIn() {
// Convert Latin characters to their canonical form, while keeping other
// width distinctions.
t := runes.If(runes.In(unicode.Latin), width.Fold, nil)
s, _, _ := transform.String(t, "アルアノリウ tech / アルアノリウ tech")
fmt.Println(s)
// Output:
// アルアノリウ tech / アルアノリウ tech
}
func ExampleIf() {
// Widen everything but ASCII.
isASCII := func(r rune) bool { return r <= unicode.MaxASCII }
t := runes.If(runes.Predicate(isASCII), nil, width.Widen)
s, _, _ := transform.String(t, "アルアノリウ tech / 中國 / 5₩")
fmt.Println(s)
// Output:
// アルアノリウ tech / 中國 / 5₩
}
| {
"pile_set_name": "Github"
} |
click==6.6
dask==0.10.1
decorator==4.0.10
dlib==18.17.100
Flask==0.11.1
Flask-SocketIO==2.5
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
networkx==1.11
numpy==1.11.1
Pillow==3.3.0
python-engineio==0.9.2
python-socketio==1.4.2
scikit-image==0.12.3
scipy==0.17.1
six==1.10.0
toolz==0.8.0
Werkzeug==0.11.10
| {
"pile_set_name": "Github"
} |
# $OpenBSD: Makefile,v 1.5 2020/05/25 04:30:12 bentley Exp $
COMMENT = faithfully remade Amiga fonts
GH_ACCOUNT = rewtnull
GH_PROJECT = amigafonts
GH_TAGNAME = 1.02
REVISION = 0
CATEGORIES = fonts
HOMEPAGE = https://www.trueschool.se/html/fonts.html
MAINTAINER = Frederic Cambus <[email protected]>
# GPL-FE
PERMIT_PACKAGE = Yes
NO_BUILD = Yes
NO_TEST = Yes
PKG_ARCH = *
FONTDIR = ${PREFIX}/share/fonts/amigafonts
DOCDIR = ${PREFIX}/share/doc/amigafonts
do-patch:
cd ${WRKDIST}/ttf && for i in `ls *.ttf`; do \
mv $$i `echo $$i | sed -e 's/_v1.0//;s/_/-/'`; done
do-install:
${INSTALL_DATA_DIR} ${FONTDIR} ${DOCDIR}
${INSTALL_DATA} ${WRKDIST}/ttf/*.ttf ${FONTDIR}
${INSTALL_DATA} ${WRKDIST}/README ${DOCDIR}
.include <bsd.port.mk>
| {
"pile_set_name": "Github"
} |
/*====================================================================*
*
* Copyright (c) 2013 Qualcomm Atheros, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted (subject to the limitations
* in the disclaimer below) provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* * Neither the name of Qualcomm Atheros nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
* COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*--------------------------------------------------------------------*/
/*====================================================================*
*
* signed pibpeek2 (void const * memory);
*
* pib.h
*
* print Panther/Lynx PIB identity information on stdout;
*
*
* Contributor(s):
* Charles Maier
*
*--------------------------------------------------------------------*/
#ifndef PIBPEEK2_SOURCE
#define PIBPEEK2_SOURCE
#include <stdio.h>
#include <memory.h>
#include "../tools/memory.h"
#include "../tools/number.h"
#include "../key/HPAVKey.h"
#include "../key/keys.h"
#include "../pib/pib.h"
static char const * CCoMode2 [] =
{
"Auto",
"Never",
"Always",
"User",
"Covert",
"Unknown"
};
static char const * MDURole2 [] =
{
"Slave",
"Master"
};
signed pibpeek2 (void const * memory)
{
extern const struct key keys [KEYS];
extern char const * CCoMode2 [];
extern char const * MDURole2 [];
struct PIB3_0 * PIB = (struct PIB3_0 *)(memory);
char buffer [HPAVKEY_SHA_LEN * 3];
size_t key;
printf ("\tPIB %d-%d %d bytes\n", PIB->VersionHeader.FWVersion, PIB->VersionHeader.PIBVersion, LE16TOH (PIB->VersionHeader.PIBLength));
printf ("\tMAC %s\n", hexstring (buffer, sizeof (buffer), PIB->LocalDeviceConfig.MAC, sizeof (PIB->LocalDeviceConfig.MAC)));
printf ("\tDAK %s", hexstring (buffer, sizeof (buffer), PIB->LocalDeviceConfig.DAK, sizeof (PIB->LocalDeviceConfig.DAK)));
for (key = 0; key < KEYS; key++)
{
if (!memcmp (keys [key].DAK, PIB->LocalDeviceConfig.DAK, HPAVKEY_DAK_LEN))
{
printf (" (%s)", keys [key].phrase);
break;
}
}
printf ("\n");
printf ("\tNMK %s", hexstring (buffer, sizeof (buffer), PIB->LocalDeviceConfig.NMK, sizeof (PIB->LocalDeviceConfig.NMK)));
for (key = 0; key < KEYS; key++)
{
if (!memcmp (keys [key].NMK, PIB->LocalDeviceConfig.NMK, HPAVKEY_NMK_LEN))
{
printf (" (%s)", keys [key].phrase);
break;
}
}
printf ("\n");
printf ("\tNID %s\n", hexstring (buffer, sizeof (buffer), PIB->LocalDeviceConfig.PreferredNID, sizeof (PIB->LocalDeviceConfig.PreferredNID)));
printf ("\tSecurity level %u\n", (PIB->LocalDeviceConfig.PreferredNID[HPAVKEY_NID_LEN-1] >> 4) & 3);
printf ("\tNET %s\n", PIB->LocalDeviceConfig.NET);
printf ("\tMFG %s\n", PIB->LocalDeviceConfig.MFG);
printf ("\tUSR %s\n", PIB->LocalDeviceConfig.USR);
printf ("\tCCo %s\n", CCoMode2 [PIB->LocalDeviceConfig.CCoSelection > SIZEOF (CCoMode2)-1?SIZEOF (CCoMode2)-1:PIB->LocalDeviceConfig.CCoSelection]);
printf ("\tMDU %s\n", PIB->LocalDeviceConfig.MDUConfiguration? MDURole2 [PIB->LocalDeviceConfig.MDURole & 1]: "N/A");
return (0);
}
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_task_start_highlight"
android:state_activated="true"/>
<item android:drawable="@drawable/ic_task_start"/>
</selector> | {
"pile_set_name": "Github"
} |
# Day 12 - Intro to Continuous Integration in Azure Pipelines
In [Day 10](https://github.com/starkfell/100DaysOfIaC/blob/master/articles/day.10.cicd.iac.bldg.blocks.md#automation-controls), we discussed some CI/CD concepts, and today we're getting into the details, digging deeper into continuous integration (CI). We'll break down the information introduced in today's installment in the days to come. In time, all questions will be answered.
We're going to show you an example of a CI build pipeline that performs the following actions (pictured in Figure 1):
[Step 1: Create Build Pipeline & Select Git repo](#step-1-create-build-pipeline-and-select-git-repo) <br />
[Step 2: Azure Resource Group Deployment](#step-2-azure-resource-group-deployment) <br />
[Step 3: Delete Resource Group if it is empty](#step-3-delete-resource-group-if-it-is-empty) <br />
[Step 4: Publish build artifacts *](#step-4-publish-build-artifacts) <br />
[Step 5: Deploy to Test](#step-5-deploy-to-test) <br />
[Next Steps](#next-steps) <br />
\* At this stage, we have an ARM template ready to deploy to a Test environment.

**Figure 1**. Elements of our build pipeline in Azure Pipelines
We can leave the **Run on agent** task, shown in Figure 1, with its default values, as we need a Windows build agent for ARM deployment.
We'll create the build pipeline using the classic editor, rather than YAML, because it is a more complete and user-friendly experience than YAML today. There is a time and place for using the YAML pipeline authoring experience, which we will discuss later in the series.
## Step 1: Create Build Pipeline and Select Git repo
To launch the classic editor, click on Azure Pipelines, Builds, and at the bottom of the Builds screen click "**Use the classic editor to create a pipeline without YAML**".
When we create the Build Pipeline, we will select the "**Continuous Integration**" option. This will trigger build and publish an artifact (our updated ARM template) every time we perform a check-in to our Git repo (in Azure Repos).This enables the 'build on commit' strategy for CI we discussed in Day 10.

**Figure 2**. Select the Git repo that will trigger CI process.
## Step 2: Azure Resource Group Deployment
This is a native task in Azure DevOps designed to deploy an ARM template to a new or existing resource group we specify, in the Azure subscription we choose. However, as you can see in Figure 3 we have specified "**Deployment mode: Validation only**", which means a resource group will be created and the ARM template syntax will be validated, but not actually deployed.
**A note on ARM template validation**. It's important to note that this simple approach confirms your ARM template is syntactically correct, but does not verify it is actually deployable in your Azure subscription. For example, you might have an Azure policy with specific naming or tagging requirements that blocks deployment. We will cover other custom, more in-depth validation methods in a future installment.

**Figure 3**. Azure Resource Group Deployment task settings in Azure Pipelines
## Step 3: Delete Resource Group if it is empty
The template validation step creates an Azure resource group in the validation process that is ultimately empty. "Delete Resource Group" is a custom task developed by a community author (Marco Mansi) and is available for download from the Visual Studio Marketplace [HERE](https://marketplace.visualstudio.com/items?itemName=marcomansi.MarcoMansi-Xpirit-Vsts-DeleteResourceGroupIfEmpty). This task reliably verifies the resource group is empty before deleting it.

**Figure 4**. Delete Resource Group if Empty task settings in Azure Pipelines
## Step 4: Publish build artifacts
Once the template has been validated, the next step is to produce our build artifact (the ARM template, in this case). We do this with the **Publish Build Artifacts** task, as shown in Figure 5.

**Figure 5**. Publish build artifacts task settings in Azure Pipelines
## Step 5: Deploy to Test
With the deployment artifact published and the build successful, the [quality gate](https://github.com/starkfell/100DaysOfIaC/blob/master/articles/day.10.cicd.iac.bldg.blocks.md#automation-controls) is met, and deployment to our Test environment is triggered. Whatever ARM template we attempted to deploy should now be deployed in our target test environment.
## Next Steps
Next week, we'll talk through the beginning of this process, working with Git, and then provide the first of a few functional ARM templates to deploy in your environment so you can see the CI process through from end-to-end!
| {
"pile_set_name": "Github"
} |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package poly1305 implements Poly1305 one-time message authentication code as
// specified in https://cr.yp.to/mac/poly1305-20050329.pdf.
//
// Poly1305 is a fast, one-time authentication function. It is infeasible for an
// attacker to generate an authenticator for a message without the key. However, a
// key must only be used for a single message. Authenticating two different
// messages with the same key allows an attacker to forge authenticators for other
// messages with the same key.
//
// Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was
// used with a fixed key in order to generate one-time keys from an nonce.
// However, in this package AES isn't used and the one-time key is specified
// directly.
package poly1305 // import "golang.org/x/crypto/poly1305"
import "crypto/subtle"
// TagSize is the size, in bytes, of a poly1305 authenticator.
const TagSize = 16
// Sum generates an authenticator for msg using a one-time key and puts the
// 16-byte result into out. Authenticating two different messages with the same
// key allows an attacker to forge messages at will.
func Sum(out *[16]byte, m []byte, key *[32]byte) {
h := New(key)
h.Write(m)
h.Sum(out[:0])
}
// Verify returns true if mac is a valid authenticator for m with the given key.
func Verify(mac *[16]byte, m []byte, key *[32]byte) bool {
var tmp [16]byte
Sum(&tmp, m, key)
return subtle.ConstantTimeCompare(tmp[:], mac[:]) == 1
}
// New returns a new MAC computing an authentication
// tag of all data written to it with the given key.
// This allows writing the message progressively instead
// of passing it as a single slice. Common users should use
// the Sum function instead.
//
// The key must be unique for each message, as authenticating
// two different messages with the same key allows an attacker
// to forge messages at will.
func New(key *[32]byte) *MAC {
m := &MAC{}
initialize(key, &m.macState)
return m
}
// MAC is an io.Writer computing an authentication tag
// of the data written to it.
//
// MAC cannot be used like common hash.Hash implementations,
// because using a poly1305 key twice breaks its security.
// Therefore writing data to a running MAC after calling
// Sum or Verify causes it to panic.
type MAC struct {
mac // platform-dependent implementation
finalized bool
}
// Size returns the number of bytes Sum will return.
func (h *MAC) Size() int { return TagSize }
// Write adds more data to the running message authentication code.
// It never returns an error.
//
// It must not be called after the first call of Sum or Verify.
func (h *MAC) Write(p []byte) (n int, err error) {
if h.finalized {
panic("poly1305: write to MAC after Sum or Verify")
}
return h.mac.Write(p)
}
// Sum computes the authenticator of all data written to the
// message authentication code.
func (h *MAC) Sum(b []byte) []byte {
var mac [TagSize]byte
h.mac.Sum(&mac)
h.finalized = true
return append(b, mac[:]...)
}
// Verify returns whether the authenticator of all data written to
// the message authentication code matches the expected value.
func (h *MAC) Verify(expected []byte) bool {
var mac [TagSize]byte
h.mac.Sum(&mac)
h.finalized = true
return subtle.ConstantTimeCompare(expected, mac[:]) == 1
}
| {
"pile_set_name": "Github"
} |
define("dojox/editor/plugins/nls/CollapsibleToolbar", { root:
//begin v1.x content
({
"collapse": "Collapse Editor Toolbar",
"expand": "Expand Editor Toolbar"
})
//end v1.x content
,
"zh": true,
"zh-tw": true,
"tr": true,
"th": true,
"sv": true,
"sl": true,
"sk": true,
"ru": true,
"ro": true,
"pt": true,
"pt-pt": true,
"pl": true,
"nl": true,
"nb": true,
"ko": true,
"kk": true,
"ja": true,
"it": true,
"hu": true,
"hr": true,
"he": true,
"fr": true,
"fi": true,
"es": true,
"el": true,
"de": true,
"da": true,
"cs": true,
"ca": true,
"ar": true
});
| {
"pile_set_name": "Github"
} |
using System;
namespace AutoTest.Core.Configuration
{
public interface IHandleDelayedConfiguration
{
void AddRunFailedTestsFirstPreProcessor();
}
}
| {
"pile_set_name": "Github"
} |
:10FC000001C0F2C0112484B790E890936100109273
:10FC10006100882369F0982F9A70923049F081FF33
:10FC200002C097EF94BF282E80E001D10C94000011
:10FC300085E08093810082E08093300188E18093A9
:10FC4000310183E08093340186E0809332018EE0BD
:10FC5000EED0279A84E02FE13FEF91E030938500CA
:10FC60002093840096BBB09BFECF1F9AA89540912D
:10FC7000300147FD02C0815089F7CDD0813479F43D
:10FC8000CAD0C82FDAD0C23829F480E0BDD080E1D4
:10FC9000BBD0F3CF83E0C138C9F788E0F7CF823417
:10FCA00019F484E1D2D0F3CF853411F485E0FACF92
:10FCB000853581F4B0D0E82EAED0F82E87FF07C08E
:10FCC0008BB781608BBFEE0CFF1CB7D0E0CF8BB73A
:10FCD0008E7FF8CF863579F49ED08D3451F49BD049
:10FCE000CBB799D0C170880F8C2B8BBF81E0ADD082
:10FCF000CCCF83E0FCCF843609F046C08CD0C82F2F
:10FD0000D0E0DC2FCC2787D0C82B85D0D82E5E0141
:10FD10008EEFB81A00E012E04801EFEF8E1A9E0A4B
:10FD20007AD0F801808384018A149B04A9F785D0D6
:10FD3000F5E410E000E0DF1609F150E040E063E098
:10FD4000C70152D08701C12C92E0D92EF601419112
:10FD500051916F0161E0C80147D00E5F1F4F22979C
:10FD6000A9F750E040E065E0C7013ED090CF608148
:10FD7000C8018E0D9F1D78D00F5F1F4FF801FE5FE9
:10FD8000C017D107A1F783CF843701F544D0C82F1E
:10FD9000D0E0DC2FCC273FD0C82B3DD0D82E4DD083
:10FDA0008701F5E4DF120BC0CE0DDF1DC80154D072
:10FDB0002BD00F5F1F4FC017D107C1F768CFF801D5
:10FDC00087918F0121D02197D1F761CF853731F409
:10FDD00034D08EE119D086E917D05FCF813509F094
:10FDE00074CF88E024D071CFFC010A0167BFE89589
:10FDF000112407B600FCFDCF667029F0452B19F4DD
:10FE000081E187BFE89508959091300195FFFCCF7F
:10FE10008093360108958091300187FFFCCF809157
:10FE2000300184FD01C0A895809136010895E0E677
:10FE3000F0E098E1908380830895EDDF803219F03F
:10FE400088E0F5DFFFCF84E1DFCFCF93C82FE3DF7A
:10FE5000C150E9F7CF91F1CFF999FECF92BD81BDA5
:10FE6000F89A992780B50895262FF999FECF1FBAE1
:10FE700092BD81BD20BD0FB6F894FA9AF99A0FBED3
:04FE8000019608954A
:02FFFE000008F9
:040000030000FC00FD
:00000001FF
| {
"pile_set_name": "Github"
} |
/*
* /MathJax/jax/input/MathML/entities/z.js
*
* Copyright (c) 2009-2018 The MathJax Consortium
*
* 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.
*/
(function(a){MathJax.Hub.Insert(a.Parse.Entity,{ZHcy:"\u0416",Zacute:"\u0179",Zcaron:"\u017D",Zcy:"\u0417",Zdot:"\u017B",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zacute:"\u017A",zcaron:"\u017E",zcy:"\u0437",zdot:"\u017C",zeetrf:"\u2128",zhcy:"\u0436",zwj:"\u200D",zwnj:"\u200C"});MathJax.Ajax.loadComplete(a.entityDir+"/z.js")})(MathJax.InputJax.MathML);
| {
"pile_set_name": "Github"
} |
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// +k8s:deepcopy-gen=package,register
// Package api is the internal version of the API.
// +groupName=wardle.k8s.io
package wardle
| {
"pile_set_name": "Github"
} |
//
// PAL DOS compress format (YJ_1) library
//
// Author: Lou Yihua <[email protected]>
//
// Copyright 2006 - 2007 Lou Yihua
//
// This file is part of PAL library.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// Ported to C from C++ and modified for compatibility with Big-Endian
// by Wei Mingzhi <[email protected]>.
// TODO: fix YJ_2 for big-endian
/**
* @module yj_1
*/
import utils from './utils';
//var TreeNode = function(){
// /*
// unsigned char value;
// unsigned char leaf;
// unsigned short level;
// unsigned int weight;
//
// struct TreeNode *parent;
// struct TreeNode *left;
// struct TreeNode *right;
// */
// /*
// this.value = 0;
// this.leaf = false;
// this.level = 0;
// this.weight = 0;
//
// this.parent = this.left = this.right = null;
// */
//};
//TreeNode.SIZE = (1 + 1 + 2 + 4 + 4 + 4 + 4);
var TreeNode = defineStruct(
['value|UCHAR',
'leaf|UCHAR',
'level|USHORT',
'weight|UINT',
'parent|UINT',
'left|UINT',
'RIGHT|UINT'].join('\n')
);
var TreeNodeList = function() {
/*
this.node = null;
this.next = null;
*/
};
//var YJ_1_FILEHEADER = function(buf){
// /*
// unsigned int Signature; // 'YJ_1'
// unsigned int UncompressedLength; // size before compression
// unsigned int CompressedLength; // size after compression
// unsigned short BlockCount; // number of blocks
// unsigned char Unknown;
// unsigned char HuffmanTreeLength; // length of huffman tree
// */
// if (buf){
// this.buffer = buf;
// this.reader = new BinaryReader(buf);
// debugger;
// //this.Signature = read4Bytes(buf, 0); // 'YJ_1'
// this.Signature = readString(buf, 0, 4);
// this.UncompressedLength = this.reader.getUint32(4); // size before compression
// this.CompressedLength = this.reader.getUint32(8); // size after compression
// this.BlockCount = this.reader.getUint16(12); // number of blocks
// this.Unknown = this.reader.getUint8(14);
// this.HuffmanTreeLength = this.reader.getUint8(15); // length of huffman tree
// }else{
// /*
// this.Signature = '';
// this.UncompressedLength = 0;
// this.CompressedLength = 0;
// this.BlockCount = 0;
// this.Unknown = 0;
// this.HuffmanTreeLength = 0;
// */
// }
//};
//var YJ_1_BLOCKHEADER = function(buf){
// /*
// unsigned short UncompressedLength; // maximum 0x4000
// unsigned short CompressedLength; // including the header
// unsigned short LZSSRepeatTable[4];
// unsigned char LZSSOffsetCodeLengthTable[4];
// unsigned char LZSSRepeatCodeLengthTable[3];
// unsigned char CodeCountCodeLengthTable[3];
// unsigned char CodeCountTable[2];
// */
// if (buf){
// this.buffer = buf;
// this.reader = new BinaryReader(buf);
// this.UncompressedLength = this.reader.getUint16(0); // maximum 0x4000
// this.CompressedLength = this.reader.getUint16(2); // including the header
// var offset = buf.byteOffset;
// this.LZSSRepeatTable = new Uint16Array(buf.buffer, offset + 4, 4);
// this.LZSSOffsetCodeLengthTable = new Uint8Array(buf.buffer, offset + 12, 4);
// this.LZSSRepeatCodeLengthTable = new Uint8Array(buf.buffer, offset + 16, 3);
// this.CodeCountCodeLengthTable = new Uint8Array(buf.buffer, offset + 19, 3);
// this.CodeCountTable = new Uint8Array(buf.buffer, offset + 22, 2);
// }else{
// /*
// this.UncompressedLength = 0;
// this.CompressedLength = 0;
// */
// this.LZSSRepeatTable = new Uint16Array(4);
// this.LZSSOffsetCodeLengthTable = new Uint8Array(4);
// this.LZSSRepeatCodeLengthTable = new Uint8Array(3);
// this.CodeCountCodeLengthTable = new Uint8Array(3);
// this.CodeCountTable = new Uint8Array(2);
// }
//};
var YJ_1_FILEHEADER = defineStruct(
/*
unsigned int Signature; // 'YJ_1' 0x315f4a59
unsigned int UncompressedLength; // size before compression
unsigned int CompressedLength; // size after compression
unsigned short BlockCount; // number of blocks
unsigned char Unknown;
unsigned char HuffmanTreeLength; // length of huffman tree
*/
['Signature|UINT',
'UncompressedLength|UINT',
'CompressedLength|UINT',
'BlockCount|USHORT',
'Unknown|UCHAR',
'HuffmanTreeLength|UCHAR'].join('\n')
);
var YJ_1_BLOCKHEADER = defineStruct(
['UncompressedLength|USHORT',
'CompressedLength|USHORT',
'LZSSRepeatTable|USHORT*4',
'LZSSOffsetCodeLengthTable|UCHAR*4',
'LZSSRepeatCodeLengthTable|UCHAR*3',
'CodeCountCodeLengthTable|UCHAR*3',
'CodeCountTable|UCHAR*2'].join('\n')
);
/**
* get_bits
* @param {Object} param
* @param {int} count
* @return {int}
*/
var get_bits = function(param, count) {
// WARNING 重构了,因为多返回值
var src = param.src;
//var temp = (new Uint16Array(src.buffer, src.byteOffset)).subarray(param.bitptr >> 4);
var temp = src.subarray((param.bitptr >> 4) << 1);
var bptr = param.bitptr & 0xf;
var mask;
var ret;
param.bitptr += count;
if (count > 16 - bptr) {
count = count + bptr - 16;
mask = 0xffff >> bptr;
//return ((temp[0] & mask) << count) | (temp[1] >> (16 - count));
return (((temp[0] | (temp[1] << 8)) & mask) << count) | ((temp[2] | (temp[3] << 8)) >> (16 - count));
} else {
//return ((temp[0] << bptr) & 0xffff) >> (16 - count);
return ((((temp[0] | (temp[1] << 8)) << bptr) & 0xffff) >> (16 - count));
}
};
/**
* get_loop
* @param {Object} param
* @param {YJ_1_BLOCKHEADER} header
* @return {int}
*/
var get_loop = function(param, header) {
// WARNING 重构了,因为多返回值
if (get_bits(param, 1)) {
return header.CodeCountTable[0];
} else {
var temp = get_bits(param, 2);
if (temp) {
return get_bits(param, header.CodeCountCodeLengthTable[temp - 1]);
} else {
return header.CodeCountTable[1];
}
}
};
/**
* get_count
* @param {Object} param
* @param {YJ_1_BLOCKHEADER} header
* @return {int}
*/
var get_count = function(param, header) {
// WARNING 重构了,因为多返回值
var temp = get_bits(param, 2);
if (temp) {
if (get_bits(param, 1)){
return get_bits(param, header.LZSSRepeatCodeLengthTable[temp - 1]);
} else {
return header.LZSSRepeatTable[temp];
}
} else {
return header.LZSSRepeatTable[0];
}
};
var yj_1 = {};
/**
* 解压缩一段YJ_1压缩的字节
* @param {Uint8Array} Source
* @return {Uint8Array} Destination
*/
yj_1.decompress = function(Source) {
utils.startTiming('Decompress:' + Source.length);
var hdr = new YJ_1_FILEHEADER(Source);
var src = Source,
Destination = new Uint8Array(hdr.UncompressedLength),
dest = Destination,
i,
root, node;
if (hdr.Signature != 0x315f4a59)
//if (hdr.Signature != 'YJ_1')
return false;
//if (SWAP32(hdr.UncompressedLength) > DestSize)
// return -1;
var param = {};
do {
var tree_len = hdr.HuffmanTreeLength * 2;
var flag = src.subarray(16 + tree_len);
param = {
src: flag,
bitptr: 0
};
//if ((node = root = (TreeNode *)malloc(sizeof(TreeNode) * (tree_len + 1))) == NULL)
// return -1;
root = utils.initArray(TreeNode, tree_len + 1);
root[0].leaf = 0;
root[0].value = 0;
root[0].left = 1; // WARNING 这里把指针改成索引了!!!
root[0].right = 2;
for (i = 1; i <= tree_len; i++) {
root[i].leaf = !get_bits(param, 1);
root[i].value = src[15 + i];
if (root[i].leaf) {
root[i].left = root[i].right = -1;
} else {
root[i].left = (root[i].value << 1) + 1;
root[i].right = root[i].left + 1;
}
}
src = src.subarray(16 + tree_len + (((tree_len & 0xf) ? (tree_len >> 4) + 1 : (tree_len >> 4)) << 1));
} while (0);
for (i = 0; i < hdr.BlockCount; i++) {
var header = new YJ_1_BLOCKHEADER(src);
src = src.subarray(4);
if (!header.CompressedLength) {
var hul = SWAP16(header.UncompressedLength);
while (hul--) {
dest[0] = src[0];
dest = dest.subarray(1);
src = src.subarray(1);
}
continue;
}
src = src.subarray(20);
param = {
src: src,
bitptr: 0
};
for (; ; ) {
var loop;
loop = get_loop(param, header);
if (loop === 0) {
break;
}
while (loop--) {
node = 0;
for(; !root[node].leaf; ) {
if (get_bits(param, 1)) {
node = root[node].right;
} else {
node = root[node].left;
}
}
dest[0] = root[node].value;
dest = dest.subarray(1);
}
loop = get_loop(param, header);
if (loop === 0) {
break;
}
while (loop--) {
var pos, count;
count = get_count(param, header);
pos = get_bits(param, 2);
pos = get_bits(param, header.LZSSOffsetCodeLengthTable[pos]);
while (count--) {
//*dest = *(dest - pos);
//dest++;
// 还负索引,真恶心- -"
//dest[0] = dest.buffer[dest.byteOffset - pos];
dest[0] = Destination[dest.byteOffset - pos];
dest = dest.subarray(1);
}
}
}
src = param.src = header.uint8Array.subarray(header.CompressedLength);
}
utils.endTiming('Decompress:' + Source.length);
return Destination;
};
export default yj_1;
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2017 Google LLC
*
* 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.
*/
package app.tivi.home.popular
import android.os.Bundle
import android.view.ActionMode
import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.core.net.toUri
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import app.tivi.SharedElementHelper
import app.tivi.common.entrygrid.databinding.FragmentEntryGridBinding
import app.tivi.common.layouts.PosterGridItemBindingModel_
import app.tivi.data.resultentities.PopularEntryWithShow
import app.tivi.extensions.toActivityNavigatorExtras
import app.tivi.util.EntryGridEpoxyController
import app.tivi.util.EntryGridFragment
import com.airbnb.epoxy.EpoxyModel
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class PopularShowsFragment : EntryGridFragment<PopularEntryWithShow, PopularShowsViewModel>() {
override val viewModel: PopularShowsViewModel by viewModels()
override fun onViewCreated(binding: FragmentEntryGridBinding, savedInstanceState: Bundle?) {
super.onViewCreated(binding, savedInstanceState)
binding.gridToolbar.apply {
setTitle(R.string.discover_popular_title)
}
}
internal fun onItemClicked(item: PopularEntryWithShow) {
val sharedElements = SharedElementHelper()
requireBinding().gridRecyclerview.findViewHolderForItemId(item.generateStableId()).let {
sharedElements.addSharedElement(it.itemView, "poster")
}
findNavController().navigate(
"app.tivi://show/${item.show.id}".toUri(),
null,
sharedElements.toActivityNavigatorExtras(requireActivity())
)
}
override fun createController(): EntryGridEpoxyController<PopularEntryWithShow> {
return object : EntryGridEpoxyController<PopularEntryWithShow>() {
override fun buildItemModel(item: PopularEntryWithShow): EpoxyModel<*> {
return PosterGridItemBindingModel_()
.id(item.generateStableId())
.posterImage(item.poster)
.tiviShow(item.show)
.transitionName(item.show.homepage)
.selected(item.show.id in state.selectedShowIds)
.clickListener(
View.OnClickListener {
if (viewModel.onItemClick(item.show)) {
return@OnClickListener
}
onItemClicked(item)
}
)
.longClickListener(
View.OnLongClickListener {
viewModel.onItemLongClick(item.show)
}
)
}
}
}
override fun startSelectionActionMode(): ActionMode? {
return requireActivity().startActionMode(
object : ActionMode.Callback {
override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_follow -> viewModel.followSelectedShows()
}
return true
}
override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean {
mode.menuInflater.inflate(R.menu.action_mode_entry, menu)
return true
}
override fun onPrepareActionMode(mode: ActionMode, menu: Menu) = true
override fun onDestroyActionMode(mode: ActionMode) {
viewModel.clearSelection()
}
}
)
}
}
| {
"pile_set_name": "Github"
} |
var convert = require('./convert'),
func = convert('conformsTo', require('../conformsTo'));
func.placeholder = require('./placeholder');
module.exports = func;
| {
"pile_set_name": "Github"
} |
<html lang="en">
<head>
<title>XGATE-Directives - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="XGATE_002dDependent.html#XGATE_002dDependent" title="XGATE-Dependent">
<link rel="prev" href="XGATE_002dSyntax.html#XGATE_002dSyntax" title="XGATE-Syntax">
<link rel="next" href="XGATE_002dFloat.html#XGATE_002dFloat" title="XGATE-Float">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="XGATE-Directives"></a>
<a name="XGATE_002dDirectives"></a>
<p>
Next: <a rel="next" accesskey="n" href="XGATE_002dFloat.html#XGATE_002dFloat">XGATE-Float</a>,
Previous: <a rel="previous" accesskey="p" href="XGATE_002dSyntax.html#XGATE_002dSyntax">XGATE-Syntax</a>,
Up: <a rel="up" accesskey="u" href="XGATE_002dDependent.html#XGATE_002dDependent">XGATE-Dependent</a>
<hr>
</div>
<h4 class="subsection">9.50.3 Assembler Directives</h4>
<p><a name="index-assembler-directives_002c-XGATE-2342"></a><a name="index-XGATE-assembler-directives-2343"></a>
The XGATE version of <code>as</code> have the following
specific assembler directives:
</body></html>
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2014,2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.smarthome.binding.digitalstrom.internal.lib.manager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Circuit;
import org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device;
import org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID;
/**
* The {@link StructureManager} builds the internal model of the digitalSTROM-System.
*
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public interface StructureManager {
/**
* Generates the zone- and group-names.
*
* @param connectionManager must not be null
* @return true, if it's generated, otherwise false
*/
boolean generateZoneGroupNames(ConnectionManager connectionManager);
/**
* Returns the name of a zone or null, if the given zoneID dose not exists.<br>
* Note: Zone-names have to be generated over {@link #generateZoneGroupNames(ConnectionManager)}.
*
* @param zoneID of the zone
* @return zone-name
*/
String getZoneName(int zoneID);
/**
* Returns the id of a given zone-name or -1, if the given zone-name dose not exists.<br>
* Note: Zone-names have to be generated over {@link #generateZoneGroupNames(ConnectionManager)}.
*
* @param zoneName of the zone
* @return zoneID
*/
int getZoneId(String zoneName);
/**
* Returns the name of the given groupID from the given zoneID or null, if the zoneID or groupID dose not exists.
* <br>
* Note: Zone-group-names have to be generated over {@link #generateZoneGroupNames(ConnectionManager)}.
*
* @param zoneID of the group
* @param groupID of the group
* @return group-name
*/
String getZoneGroupName(int zoneID, short groupID);
/**
* Returns the groupID of the given group-name from the given zone name or -1, if the zone-name or group name dose
* not exists.<br>
* Note: Zone-group-names have to be generated over {@link #generateZoneGroupNames(ConnectionManager)}.
*
* @param zoneName of the group
* @param groupName of the group
* @return group-id
*/
short getZoneGroupId(String zoneName, String groupName);
/**
* Returns a new {@link Map} of all {@link Device}'s with the {@link DSID} as key and the {@link Device} as value.
* If no devices are found, an empty {@link Map} will be returned.
*
* @return device-map (cannot be null)
*/
Map<DSID, Device> getDeviceMap();
/**
* Returns a reference to the {@link Map} of all {@link Device}'s with the {@link DSID} as key and the
* {@link Device} as value. If no devices are found, an empty {@link Map} will be returned.
*
* @return reference device-map
*/
Map<DSID, Device> getDeviceHashMapReference();
/**
* Returns the reference of the structure as {@link Map}[zoneID, {@link HashMap}[groupID,
* {@link List}[{@link Device}]]].
*
* @return structure reference
*/
Map<Integer, HashMap<Short, List<Device>>> getStructureReference();
/**
* Returns the Map of all groups as format HashMap[Short, List[Device]].
*
* @param zoneID of the zone
* @return groups
*/
HashMap<Short, List<Device>> getGroupsFromZoneX(int zoneID);
/**
* Returns the reference {@link List} of the {@link Device}'s of an zone-group.
*
* @param zoneID of the zone
* @param groupID of the group
* @return reference device-list
*/
List<Device> getReferenceDeviceListFromZoneXGroupX(int zoneID, short groupID);
/**
* Returns the {@link Device} of the given dSID as {@link String} or null if no {@link Device} exists.
*
* @param dSID of the device
* @return device
*/
Device getDeviceByDSID(String dSID);
/**
* Returns the {@link Device} of the given dSID as {@link DSID} or null if no {@link Device} exists.
*
* @param dSID of the device
* @return device
*/
Device getDeviceByDSID(DSID dSID);
/**
* Returns the {@link Device} of the given dSUID or null if no {@link Device} exists.
*
* @param dSUID of the device
* @return the {@link Device} with the given dSUID
*/
Device getDeviceByDSUID(String dSUID);
/**
* Updates a {@link Device} of the structure.
*
* @param oldZone ID
* @param oldGroups ID's
* @param device new {@link Device}
*/
void updateDevice(int oldZone, List<Short> oldGroups, Device device);
/**
* Updates a {@link Device} of the structure.
*
* @param device to update
*/
void updateDevice(Device device);
/**
* Deletes a {@link Device} from the structure.
*
* @param device to delete
*/
void deleteDevice(Device device);
/**
* Adds a {@link Device} to the structure.
*
* @param device to add
*/
void addDeviceToStructure(Device device);
/**
* Returns a {@link Set} of all zoneID's
*
* @return zoneID's
*/
Set<Integer> getZoneIDs();
/**
* Returns true, if a zone with the given zoneID exists, otherwise false.
*
* @param zoneID to check
* @return true = zoneID exists | false = zoneID not exists
*/
boolean checkZoneID(int zoneID);
/**
* Returns true, if a zone-group with the given zoneID and groupID exists, otherwise false.
*
* @param zoneID to check
* @param groupID to check
* @return true = zoneID or groupID exists | false = zoneID or groupID not exists
*/
boolean checkZoneGroupID(int zoneID, short groupID);
/**
* Adds the given {@link List} of {@link Circuit}'s to this {@link StructureManager}.
*
* @param referenceCircuitList to add
*/
void addCircuitList(List<Circuit> referenceCircuitList);
/**
* Adds the given {@link Circuit} to this {@link StructureManager}.
*
* @param circuit to add
* @return the old {@link Circuit}, if the given {@link Circuit} was already added.
*/
Circuit addCircuit(Circuit circuit);
/**
* Returns the {@link Circuit} with the given {@link DSID}.
*
* @param dSID of the {@link Circuit} to get
* @return the {@link Circuit} with the given {@link DSID}
*/
Circuit getCircuitByDSID(DSID dSID);
/**
* Returns the {@link Circuit} with the given dSID as {@link String}.
*
* @param dSID of the {@link Circuit} to get
* @return the {@link Circuit} with the given dSID
*/
Circuit getCircuitByDSID(String dSID);
/**
* Returns the {@link Circuit} with the given dSUID as {@link String}.
*
* @param dSUID of the {@link Circuit} to get
* @return the {@link Circuit} with the given dSUID
*/
Circuit getCircuitByDSUID(String dSUID);
/**
* Updates the configuration of an added {@link Circuit} through a new {@link Circuit} object.
*
* @param newCircuit to update
* @return {@link Circuit} with the old configuration
*/
Circuit updateCircuitConfig(Circuit newCircuit);
/**
* Deletes the {@link Circuit} with the given {@link DSID}.
*
* @param dSID of the {@link Circuit} to remove
* @return the removed {@link Circuit}
*/
Circuit deleteCircuit(DSID dSID);
/**
* Deletes the {@link Circuit} with the given dSUID.
*
* @param dSUID of the {@link Circuit} to remove
* @return the removed {@link Circuit}
*/
Circuit deleteCircuit(String dSUID);
/**
* Returns a {@link Map} of all {@link Circuit}'s which are added to this {@link StructureManager}.
*
* @return {@link Map} of all added {@link Circuit}'s
*/
Map<DSID, Circuit> getCircuitMap();
}
| {
"pile_set_name": "Github"
} |
syntax = "proto3";
package envoy.extensions.filters.http.decompressor.v3;
import "envoy/config/core/v3/base.proto";
import "envoy/config/core/v3/extension.proto";
import "google/protobuf/any.proto";
import "google/protobuf/wrappers.proto";
import "udpa/annotations/migrate.proto";
import "udpa/annotations/status.proto";
import "udpa/annotations/versioning.proto";
import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.filters.http.decompressor.v3";
option java_outer_classname = "DecompressorProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;
// [#protodoc-title: Decompressor]
// [#extension: envoy.filters.http.decompressor]
message Decompressor {
// Common configuration for filter behavior on both the request and response direction.
message CommonDirectionConfig {
// Runtime flag that controls whether the filter is enabled for decompression or not. If set to false, the
// filter will operate as a pass-through filter. If the message is unspecified, the filter will be enabled.
config.core.v3.RuntimeFeatureFlag enabled = 1;
}
// Configuration for filter behavior on the request direction.
message RequestDirectionConfig {
CommonDirectionConfig common_config = 1;
// If set to true, and response decompression is enabled, the filter modifies the Accept-Encoding
// request header by appending the decompressor_library's encoding. Defaults to true.
google.protobuf.BoolValue advertise_accept_encoding = 2;
}
// Configuration for filter behavior on the response direction.
message ResponseDirectionConfig {
CommonDirectionConfig common_config = 1;
}
// A decompressor library to use for both request and response decompression. Currently only
// :ref:`envoy.compression.gzip.compressor<envoy_api_msg_extensions.compression.gzip.decompressor.v3.Gzip>`
// is included in Envoy.
config.core.v3.TypedExtensionConfig decompressor_library = 1
[(validate.rules).message = {required: true}];
// Configuration for request decompression. Decompression is enabled by default if left empty.
RequestDirectionConfig request_direction_config = 2;
// Configuration for response decompression. Decompression is enabled by default if left empty.
ResponseDirectionConfig response_direction_config = 3;
}
| {
"pile_set_name": "Github"
} |
module Liquid
# Include allows templates to relate with other templates
#
# Simply include another template:
#
# {% include 'product' %}
#
# Include a template with a local variable:
#
# {% include 'product' with products[0] %}
#
# Include a template for a collection:
#
# {% include 'product' for products %}
#
class Include < Tag
Syntax = /(#{QuotedFragment}+)(\s+(?:with|for)\s+(#{QuotedFragment}+))?/o
def initialize(tag_name, markup, options)
super
if markup =~ Syntax
template_name = $1
variable_name = $3
@variable_name_expr = variable_name ? Expression.parse(variable_name) : nil
@template_name_expr = Expression.parse(template_name)
@attributes = {}
markup.scan(TagAttributes) do |key, value|
@attributes[key] = Expression.parse(value)
end
else
raise SyntaxError.new(options[:locale].t("errors.syntax.include".freeze))
end
end
def parse(_tokens)
end
def render(context)
template_name = context.evaluate(@template_name_expr)
raise ArgumentError.new(options[:locale].t("errors.argument.include")) unless template_name
partial = load_cached_partial(template_name, context)
context_variable_name = template_name.split('/'.freeze).last
variable = if @variable_name_expr
context.evaluate(@variable_name_expr)
else
context.find_variable(template_name)
end
old_template_name = context.template_name
old_partial = context.partial
begin
context.template_name = template_name
context.partial = true
context.stack do
@attributes.each do |key, value|
context[key] = context.evaluate(value)
end
if variable.is_a?(Array)
variable.collect do |var|
context[context_variable_name] = var
partial.render(context)
end
else
context[context_variable_name] = variable
partial.render(context)
end
end
ensure
context.template_name = old_template_name
context.partial = old_partial
end
end
private
alias_method :parse_context, :options
private :parse_context
def load_cached_partial(template_name, context)
cached_partials = context.registers[:cached_partials] || {}
if cached = cached_partials[template_name]
return cached
end
source = read_template_from_file_system(context)
begin
parse_context.partial = true
partial = Liquid::Template.parse(source, parse_context)
ensure
parse_context.partial = false
end
cached_partials[template_name] = partial
context.registers[:cached_partials] = cached_partials
partial
end
def read_template_from_file_system(context)
file_system = context.registers[:file_system] || Liquid::Template.file_system
file_system.read_template_file(context.evaluate(@template_name_expr))
end
end
Template.register_tag('include'.freeze, Include)
end
| {
"pile_set_name": "Github"
} |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
/// <summary>
/// Specifies that a tag helper property should be set with the current
/// <see cref="Rendering.ViewContext"/> when creating the tag helper. The property must have a
/// public set method.
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class ViewContextAttribute : Attribute
{
}
}
| {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
"""
Management of Windows system information
========================================
.. versionadded:: 2014.1.0
This state is used to manage system information such as the computer name and
description.
.. code-block:: yaml
ERIK-WORKSTATION:
system.computer_name: []
This is Erik's computer, don't touch!:
system.computer_desc: []
"""
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import logging
# Import Salt libs
import salt.utils.functools
import salt.utils.platform
from salt.ext import six
log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = "system"
def __virtual__():
"""
Make sure this Windows and that the win_system module is available
"""
if not salt.utils.platform.is_windows():
return False, "win_system: Only available on Windows"
if "system.get_computer_desc" not in __salt__:
return False, "win_system: win_system execution module not available"
return __virtualname__
def computer_desc(name):
"""
Manage the computer's description field
name
The desired computer description
"""
# Just in case someone decides to enter a numeric description
name = six.text_type(name)
ret = {
"name": name,
"changes": {},
"result": True,
"comment": "Computer description already set to '{0}'".format(name),
}
before_desc = __salt__["system.get_computer_desc"]()
if before_desc == name:
return ret
if __opts__["test"]:
ret["result"] = None
ret["comment"] = "Computer description will be changed to '{0}'".format(name)
return ret
result = __salt__["system.set_computer_desc"](name)
if result["Computer Description"] == name:
ret["comment"] = "Computer description successfully changed to '{0}'".format(
name
)
ret["changes"] = {"old": before_desc, "new": name}
else:
ret["result"] = False
ret["comment"] = "Unable to set computer description to " "'{0}'".format(name)
return ret
computer_description = salt.utils.functools.alias_function(
computer_desc, "computer_description"
)
def computer_name(name):
"""
Manage the computer's name
name
The desired computer name
"""
# Just in case someone decides to enter a numeric description
name = six.text_type(name)
ret = {
"name": name,
"changes": {},
"result": True,
"comment": "Computer name already set to '{0}'".format(name),
}
before_name = __salt__["system.get_computer_name"]()
pending_name = __salt__["system.get_pending_computer_name"]()
if before_name == name and pending_name is None:
return ret
elif pending_name == name.upper():
ret["comment"] = (
"The current computer name is '{0}', but will be "
"changed to '{1}' on the next reboot".format(before_name, name)
)
return ret
if __opts__["test"]:
ret["result"] = None
ret["comment"] = "Computer name will be changed to '{0}'".format(name)
return ret
result = __salt__["system.set_computer_name"](name)
if result is not False:
after_name = result["Computer Name"]["Current"]
after_pending = result["Computer Name"].get("Pending")
if (after_pending is not None and after_pending == name) or (
after_pending is None and after_name == name
):
ret["comment"] = "Computer name successfully set to '{0}'".format(name)
if after_pending is not None:
ret["comment"] += " (reboot required for change to take effect)"
ret["changes"] = {"old": before_name, "new": name}
else:
ret["result"] = False
ret["comment"] = "Unable to set computer name to '{0}'".format(name)
return ret
def hostname(name):
"""
.. versionadded:: 2016.3.0
Manage the hostname of the computer
name
The hostname to set
"""
ret = {"name": name, "changes": {}, "result": True, "comment": ""}
current_hostname = __salt__["system.get_hostname"]()
if current_hostname.upper() == name.upper():
ret["comment"] = "Hostname is already set to '{0}'".format(name)
return ret
out = __salt__["system.set_hostname"](name)
if out:
ret["comment"] = (
"The current hostname is '{0}', "
"but will be changed to '{1}' on the next reboot".format(
current_hostname, name
)
)
ret["changes"] = {"hostname": name}
else:
ret["result"] = False
ret["comment"] = "Unable to set hostname"
return ret
def workgroup(name):
"""
.. versionadded:: 3001
Manage the workgroup of the computer
Args:
name (str): The workgroup to set
Example:
.. code-block:: yaml
set workgroup:
system.workgroup:
- name: local
"""
ret = {"name": name.upper(), "result": False, "changes": {}, "comment": ""}
# Grab the current domain/workgroup
out = __salt__["system.get_domain_workgroup"]()
current_workgroup = (
out["Domain"]
if "Domain" in out
else out["Workgroup"]
if "Workgroup" in out
else ""
)
# Notify the user if the requested workgroup is the same
if current_workgroup.upper() == name.upper():
ret["result"] = True
ret["comment"] = "Workgroup is already set to '{0}'".format(name.upper())
return ret
# If being run in test-mode, inform the user what is supposed to happen
if __opts__["test"]:
ret["result"] = None
ret["changes"] = {}
ret["comment"] = "Computer will be joined to workgroup '{0}'".format(name)
return ret
# Set our new workgroup, and then immediately ask the machine what it
# is again to validate the change
res = __salt__["system.set_domain_workgroup"](name.upper())
out = __salt__["system.get_domain_workgroup"]()
new_workgroup = (
out["Domain"]
if "Domain" in out
else out["Workgroup"]
if "Workgroup" in out
else ""
)
# Return our results based on the changes
ret = {}
if res and current_workgroup.upper() == new_workgroup.upper():
ret["result"] = True
ret["comment"] = "The new workgroup '{0}' is the same as '{1}'".format(
current_workgroup.upper(), new_workgroup.upper()
)
elif res:
ret["result"] = True
ret["comment"] = "The workgroup has been changed from '{0}' to '{1}'".format(
current_workgroup.upper(), new_workgroup.upper()
)
ret["changes"] = {
"old": current_workgroup.upper(),
"new": new_workgroup.upper(),
}
else:
ret["result"] = False
ret["comment"] = "Unable to join the requested workgroup '{0}'".format(
new_workgroup.upper()
)
return ret
def join_domain(
name,
username=None,
password=None,
account_ou=None,
account_exists=False,
restart=False,
):
"""
Checks if a computer is joined to the Domain. If the computer is not in the
Domain, it will be joined.
Args:
name (str):
The name of the Domain.
username (str):
Username of an account which is authorized to join computers to the
specified domain. Need to be either fully qualified like
[email protected] or simply user.
password (str):
Password of the account to add the computer to the Domain.
account_ou (str):
The DN of the OU below which the account for this computer should be
created when joining the domain,
e.g. ou=computers,ou=departm_432,dc=my-company,dc=com.
account_exists (bool):
Needs to be set to ``True`` to allow re-using an existing computer
account.
restart (bool):
Needs to be set to ``True`` to restart the computer after a
successful join.
Example:
.. code-block:: yaml
join_to_domain:
system.join_domain:
- name: mydomain.local.com
- username: [email protected]
- password: mysecretpassword
- restart: True
"""
ret = {
"name": name,
"changes": {},
"result": True,
"comment": "Computer already added to '{0}'".format(name),
}
current_domain_dic = __salt__["system.get_domain_workgroup"]()
if "Domain" in current_domain_dic:
current_domain = current_domain_dic["Domain"]
elif "Workgroup" in current_domain_dic:
current_domain = "Workgroup"
else:
current_domain = None
if name.lower() == current_domain.lower():
ret["comment"] = "Computer already added to '{0}'".format(name)
return ret
if __opts__["test"]:
ret["result"] = None
ret["comment"] = "Computer will be added to '{0}'".format(name)
return ret
result = __salt__["system.join_domain"](
domain=name,
username=username,
password=password,
account_ou=account_ou,
account_exists=account_exists,
restart=restart,
)
if result is not False:
ret["comment"] = "Computer added to '{0}'".format(name)
if restart:
ret["comment"] += "\nSystem will restart"
else:
ret["comment"] += "\nSystem needs to be restarted"
ret["changes"] = {"old": current_domain, "new": name}
else:
ret["comment"] = "Computer failed to join '{0}'".format(name)
ret["result"] = False
return ret
def reboot(
name,
message=None,
timeout=5,
force_close=True,
in_seconds=False,
only_on_pending_reboot=True,
):
"""
Reboot the computer
:param str message:
An optional message to display to users. It will also be used as a
comment in the event log entry.
The default value is None.
:param int timeout:
The number of minutes or seconds before a reboot will occur. Whether
this number represents minutes or seconds depends on the value of
``in_seconds``.
The default value is 5.
:param bool in_seconds:
If this is True, the value of ``timeout`` will be treated as a number
of seconds. If this is False, the value of ``timeout`` will be treated
as a number of minutes.
The default value is False.
:param bool force_close:
If this is True, running applications will be forced to close without
warning. If this is False, running applications will not get the
opportunity to prompt users about unsaved data.
The default value is True.
:param bool only_on_pending_reboot:
If this is True, the reboot will only occur if the system reports a
pending reboot. If this is False, the reboot will always occur.
The default value is True.
"""
return shutdown(
name,
message=message,
timeout=timeout,
force_close=force_close,
reboot=True,
in_seconds=in_seconds,
only_on_pending_reboot=only_on_pending_reboot,
)
def shutdown(
name,
message=None,
timeout=5,
force_close=True,
reboot=False,
in_seconds=False,
only_on_pending_reboot=False,
):
"""
Shutdown the computer
:param str message:
An optional message to display to users. It will also be used as a
comment in the event log entry.
The default value is None.
:param int timeout:
The number of minutes or seconds before a shutdown will occur. Whether
this number represents minutes or seconds depends on the value of
``in_seconds``.
The default value is 5.
:param bool in_seconds:
If this is True, the value of ``timeout`` will be treated as a number
of seconds. If this is False, the value of ``timeout`` will be treated
as a number of minutes.
The default value is False.
:param bool force_close:
If this is True, running applications will be forced to close without
warning. If this is False, running applications will not get the
opportunity to prompt users about unsaved data.
The default value is True.
:param bool reboot:
If this is True, the computer will restart immediately after shutting
down. If False the system flushes all caches to disk and safely powers
down the system.
The default value is False.
:param bool only_on_pending_reboot:
If this is True, the shutdown will only occur if the system reports a
pending reboot. If this is False, the shutdown will always occur.
The default value is False.
"""
ret = {"name": name, "changes": {}, "result": True, "comment": ""}
if reboot:
action = "reboot"
else:
action = "shutdown"
if only_on_pending_reboot and not __salt__["system.get_pending_reboot"]():
if __opts__["test"]:
ret["comment"] = (
"System {0} will be skipped because " "no reboot is pending"
).format(action)
else:
ret["comment"] = (
"System {0} has been skipped because " "no reboot was pending"
).format(action)
return ret
if __opts__["test"]:
ret["result"] = None
ret["comment"] = "Will attempt to schedule a {0}".format(action)
return ret
ret["result"] = __salt__["system.shutdown"](
message=message,
timeout=timeout,
force_close=force_close,
reboot=reboot,
in_seconds=in_seconds,
only_on_pending_reboot=False,
)
if ret["result"]:
ret["changes"] = {
"old": "No reboot or shutdown was scheduled",
"new": "A {0} has been scheduled".format(action),
}
ret["comment"] = "Request to {0} was successful".format(action)
else:
ret["comment"] = "Request to {0} failed".format(action)
return ret
| {
"pile_set_name": "Github"
} |
/**
* Copyright © 2002 Instituto Superior Técnico
*
* This file is part of FenixEdu Academic.
*
* FenixEdu Academic is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FenixEdu Academic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FenixEdu Academic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.fenixedu.academic.ui.struts.action.publico.candidacies.secondCycle;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.fenixedu.academic.domain.Degree;
import org.fenixedu.academic.domain.Installation;
import org.fenixedu.academic.domain.PublicCandidacyHashCode;
import org.fenixedu.academic.domain.candidacyProcess.CandidacyProcess;
import org.fenixedu.academic.domain.candidacyProcess.DegreeOfficePublicCandidacyHashCode;
import org.fenixedu.academic.domain.candidacyProcess.secondCycle.SecondCycleCandidacyProcess;
import org.fenixedu.academic.domain.candidacyProcess.secondCycle.SecondCycleIndividualCandidacyProcess;
import org.fenixedu.academic.domain.candidacyProcess.secondCycle.SecondCycleIndividualCandidacyProcessBean;
import org.fenixedu.academic.domain.exceptions.DomainException;
import org.fenixedu.academic.dto.candidacy.PrecedentDegreeInformationBean;
import org.fenixedu.academic.dto.person.PersonBean;
import org.fenixedu.academic.service.services.exceptions.FenixServiceException;
import org.fenixedu.academic.ui.struts.action.publico.PublicApplication.PublicCandidaciesApp;
import org.fenixedu.academic.ui.struts.action.publico.candidacies.RefactoredIndividualCandidacyProcessPublicDA;
import org.fenixedu.bennu.struts.annotations.Forward;
import org.fenixedu.bennu.struts.annotations.Forwards;
import org.fenixedu.bennu.struts.annotations.Mapping;
import org.fenixedu.bennu.struts.portal.StrutsFunctionality;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@StrutsFunctionality(app = PublicCandidaciesApp.class, path = "second-cycle",
titleKey = "title.application.name.secondCycle.short")
@Mapping(path = "/candidacies/caseHandlingSecondCycleCandidacyIndividualProcess", module = "publico")
@Forwards({
@Forward(name = "begin-candidacy-process-intro", path = "/publico/candidacy/secondCycle/main.jsp"),
@Forward(name = "begin-candidacy-process-intro-en", path = "/publico/candidacy/secondCycle/main_en.jsp"),
@Forward(name = "open-candidacy-process-closed", path = "/publico/candidacy/candidacyProcessClosed.jsp"),
@Forward(name = "show-pre-creation-candidacy-form", path = "/publico/candidacy/preCreationCandidacyForm.jsp"),
@Forward(name = "show-email-message-sent", path = "/publico/candidacy/showEmailSent.jsp"),
@Forward(name = "show-application-submission-conditions", path = "/publico/candidacy/applicationSubmissionConditions.jsp"),
@Forward(name = "open-candidacy-processes-not-found", path = "/publico/candidacy/individualCandidacyNotFound.jsp"),
@Forward(name = "show-candidacy-creation-page", path = "/publico/candidacy/secondCycle/createCandidacyPartOne.jsp"),
@Forward(name = "candidacy-continue-creation", path = "/publico/candidacy/secondCycle/createCandidacyPartTwo.jsp"),
@Forward(name = "inform-submited-candidacy", path = "/publico/candidacy/candidacySubmited.jsp"),
@Forward(name = "show-candidacy-details", path = "/publico/candidacy/secondCycle/viewCandidacy.jsp"),
@Forward(name = "edit-candidacy", path = "/publico/candidacy/secondCycle/editCandidacy.jsp"),
@Forward(name = "edit-candidacy-habilitations", path = "/publico/candidacy/secondCycle/editCandidacyHabilitations.jsp"),
@Forward(name = "edit-candidacy-documents", path = "/publico/candidacy/secondCycle/editCandidacyDocuments.jsp"),
@Forward(name = "show-recover-access-link-form", path = "/publico/candidacy/secondCycle/recoverAccess.jsp"),
@Forward(name = "show-recovery-email-sent", path = "/publico/candidacy/secondCycle/recoveryEmailSent.jsp"),
@Forward(name = "upload-photo", path = "/publico/candidacy/secondCycle/uploadPhoto.jsp") })
public class SecondCycleIndividualCandidacyProcessRefactoredDA extends RefactoredIndividualCandidacyProcessPublicDA {
private static final Logger logger = LoggerFactory.getLogger(SecondCycleIndividualCandidacyProcessRefactoredDA.class);
@Override
protected Class<? extends CandidacyProcess> getParentProcessType() {
return SecondCycleCandidacyProcess.class;
}
@Override
protected void setStartInformation(ActionForm form, HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
}
@Override
protected Class getProcessType() {
return SecondCycleIndividualCandidacyProcess.class;
}
@Override
protected String getCandidacyNameKey() {
return "title.application.name.secondCycle";
}
@Override
public ActionForward viewCandidacy(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
SecondCycleIndividualCandidacyProcess individualCandidacyProcess =
(SecondCycleIndividualCandidacyProcess) request.getAttribute("individualCandidacyProcess");
SecondCycleIndividualCandidacyProcessBean bean =
new SecondCycleIndividualCandidacyProcessBean(individualCandidacyProcess);
bean.setPersonBean(new PersonBean(individualCandidacyProcess.getPersonalDetails()));
request.setAttribute("individualCandidacyProcessBean", bean);
request.setAttribute("hasSelectedDegrees", !individualCandidacyProcess.getSelectedDegrees().isEmpty());
request.setAttribute("isApplicationSubmissionPeriodValid",
redefineApplicationSubmissionPeriodValid(individualCandidacyProcess));
return mapping.findForward("show-candidacy-details");
}
public ActionForward prepareCandidacyCreation(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
if (actionForwardError != null) {
return actionForwardError;
}
CandidacyProcess candidacyProcess = getCurrentOpenParentProcess();
String hash = request.getParameter("hash");
DegreeOfficePublicCandidacyHashCode candidacyHashCode =
(DegreeOfficePublicCandidacyHashCode) PublicCandidacyHashCode.getPublicCandidacyCodeByHash(hash);
if (candidacyHashCode == null) {
return mapping.findForward("open-candidacy-processes-not-found");
}
if (candidacyHashCode.getIndividualCandidacyProcess() != null
&& candidacyHashCode.getIndividualCandidacyProcess().getCandidacyProcess() == candidacyProcess) {
request.setAttribute("individualCandidacyProcess", candidacyHashCode.getIndividualCandidacyProcess());
return viewCandidacy(mapping, form, request, response);
} else if (candidacyHashCode.getIndividualCandidacyProcess() != null
&& candidacyHashCode.getIndividualCandidacyProcess().getCandidacyProcess() != candidacyProcess) {
return mapping.findForward("open-candidacy-processes-not-found");
}
SecondCycleIndividualCandidacyProcessBean bean = new SecondCycleIndividualCandidacyProcessBean();
bean.setPrecedentDegreeInformation(new PrecedentDegreeInformationBean());
bean.setPersonBean(new PersonBean());
bean.setCandidacyProcess(candidacyProcess);
bean.setPublicCandidacyHashCode(candidacyHashCode);
request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
bean.getPersonBean().setEmail(candidacyHashCode.getEmail());
return mapping.findForward("show-candidacy-creation-page");
}
private ActionForward forwardTo(ActionMapping mapping, HttpServletRequest request) {
if (getFromRequest(request, "userAction").equals("createCandidacy")) {
return mapping.findForward("candidacy-continue-creation");
} else if (getFromRequest(request, "userAction").equals("editCandidacyQualifications")) {
return mapping.findForward("edit-candidacy-habilitations");
}
return null;
}
@Override
public ActionForward addConcludedHabilitationsEntry(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
SecondCycleIndividualCandidacyProcessBean bean =
(SecondCycleIndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
bean.addConcludedFormationBean();
request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
invalidateDocumentFileRelatedViewStates();
return forwardTo(mapping, request);
}
@Override
public ActionForward removeConcludedHabilitationsEntry(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
SecondCycleIndividualCandidacyProcessBean bean =
(SecondCycleIndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
Integer index = getIntegerFromRequest(request, "removeIndex");
bean.removeFormationConcludedBean(index);
request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
invalidateDocumentFileRelatedViewStates();
return forwardTo(mapping, request);
}
public ActionForward submitCandidacy(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws IOException, FenixServiceException {
try {
ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
if (actionForwardError != null) {
return actionForwardError;
}
SecondCycleIndividualCandidacyProcessBean bean =
(SecondCycleIndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
bean.setInternalPersonCandidacy(Boolean.TRUE);
boolean isValid = hasInvalidViewState();
if (!isValid) {
invalidateDocumentFileRelatedViewStates();
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("candidacy-continue-creation");
}
List<Degree> degreeList = new ArrayList<Degree>(bean.getSelectedDegreeList());
if (candidacyIndividualProcessExistsForThisEmail(bean.getPersonBean().getEmail(), degreeList)) {
addActionMessage("error", request, "error.candidacy.hash.code.already.bounded");
invalidateDocumentFileRelatedViewStates();
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("candidacy-continue-creation");
}
if (!bean.getHonorAgreement()) {
addActionMessage("error", request, "error.must.agree.on.declaration.of.honor");
invalidateDocumentFileRelatedViewStates();
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("candidacy-continue-creation");
}
if (bean.getSelectedDegreeList().isEmpty()) {
addActionMessage("error", request, "error.must.select.at.least.one.degree");
invalidateDocumentFileRelatedViewStates();
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("candidacy-continue-creation");
}
SecondCycleIndividualCandidacyProcess process = (SecondCycleIndividualCandidacyProcess) createNewPublicProcess(bean);
request.setAttribute("process", process);
request.setAttribute("mappingPath", mapping.getPath());
request.setAttribute("individualCandidacyProcess", process);
request.setAttribute("endSubmissionDate", getFormattedApplicationSubmissionEndDate());
return mapping.findForward("inform-submited-candidacy");
} catch (DomainException e) {
addActionMessage("error", request, e.getMessage(), e.getArgs());
logger.error(e.getMessage(), e);
getIndividualCandidacyProcessBean().getPersonBean().setPerson(null);
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("candidacy-continue-creation");
}
}
public ActionForward editCandidacyProcess(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws FenixServiceException {
SecondCycleIndividualCandidacyProcessBean bean =
(SecondCycleIndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
try {
ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
if (actionForwardError != null) {
return actionForwardError;
}
if (!isApplicationSubmissionPeriodValid()) {
return beginCandidacyProcessIntro(mapping, form, request, response);
}
executeActivity(bean.getIndividualCandidacyProcess(), "EditPublicCandidacyPersonalInformation",
getIndividualCandidacyProcessBean());
} catch (final DomainException e) {
addActionMessage(request, e.getMessage(), e.getArgs());
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("edit-candidacy");
}
request.setAttribute("individualCandidacyProcess", bean.getIndividualCandidacyProcess());
return backToViewCandidacyInternal(mapping, form, request, response);
}
public ActionForward editCandidacyQualifications(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws FenixServiceException {
ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
if (actionForwardError != null) {
return actionForwardError;
}
SecondCycleIndividualCandidacyProcessBean bean =
(SecondCycleIndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
try {
boolean isValid = hasInvalidViewState();
if (!isValid) {
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("edit-candidacy-habilitations");
}
if (bean.getSelectedDegreeList().isEmpty()) {
addActionMessage(request, "error.must.select.at.least.one.degree");
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("edit-candidacy-habilitations");
}
executeActivity(bean.getIndividualCandidacyProcess(), "EditPublicCandidacyHabilitations",
getIndividualCandidacyProcessBean());
} catch (final DomainException e) {
addActionMessage(request, e.getMessage(), e.getArgs());
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("edit-candidacy-habilitations");
}
request.setAttribute("individualCandidacyProcess", bean.getIndividualCandidacyProcess());
return backToViewCandidacyInternal(mapping, form, request, response);
}
public ActionForward addSelectedDegreesEntry(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
SecondCycleIndividualCandidacyProcessBean bean =
(SecondCycleIndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
if (bean.getSelectedDegree() != null && !bean.getSelectedDegreeList().contains(bean.getSelectedDegree())) {
bean.addSelectedDegree(bean.getSelectedDegree());
}
request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
invalidateDocumentFileRelatedViewStates();
return forwardTo(mapping, request);
}
public ActionForward removeSelectedDegreesEntry(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
SecondCycleIndividualCandidacyProcessBean bean =
(SecondCycleIndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
Degree selectedDegree = getDomainObject(request, "removeIndex");
bean.removeSelectedDegree(selectedDegree);
request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
invalidateDocumentFileRelatedViewStates();
return forwardTo(mapping, request);
}
protected boolean redefineApplicationSubmissionPeriodValid(
final SecondCycleIndividualCandidacyProcess individualCandidacyProcess) {
CandidacyProcess process = getCurrentOpenParentProcess();
if (process == null) {
return false;
}
DateTime now = new DateTime();
return now.isAfter(process.getCandidacyStart()) && now.isBefore(process.getCandidacyEnd());
}
@Override
protected String getCandidacyInformationLinkDefaultLanguage() {
String message = getStringFromDefaultBundle("link.candidacy.information.default.secondCycle");
return MessageFormat.format(message, Installation.getInstance().getInstituitionURL());
}
@Override
protected String getCandidacyInformationLinkEnglish() {
String message = getStringFromDefaultBundle("link.candidacy.information.english.secondCycle");
return MessageFormat.format(message, Installation.getInstance().getInstituitionURL());
}
@Override
protected void setParentProcess(HttpServletRequest request) {
super.setParentProcess(request);
if (request.getAttribute("parentProcess") == null) {
request.setAttribute("parentProcess", getCurrentOpenParentProcess());
}
}
}
| {
"pile_set_name": "Github"
} |
import { KebabOption } from '@console/internal/components/utils';
import { truncateMiddle } from '@console/internal/components/utils/truncate-middle';
import { K8sResourceKind, K8sKind } from '@console/internal/module/k8s';
import { ServiceModel as KnativeServiceModel } from '@console/knative-plugin';
import { RESOURCE_NAME_TRUNCATE_LENGTH } from '../const';
import { editApplicationModal } from '../components/modals';
export const ModifyApplication = (kind: K8sKind, obj: K8sResourceKind): KebabOption => {
return {
label: 'Edit Application Grouping',
callback: () =>
editApplicationModal({
resourceKind: kind,
resource: obj,
blocking: true,
initialApplication: '',
}),
accessReview: {
group: kind.apiGroup,
resource: kind.plural,
name: obj.metadata.name,
namespace: obj.metadata.namespace,
verb: 'patch',
},
};
};
export const EditApplication = (model: K8sKind, obj: K8sResourceKind): KebabOption => {
const annotation = obj?.metadata?.annotations?.['openshift.io/generated-by'];
return {
label: `Edit ${truncateMiddle(obj.metadata.name, { length: RESOURCE_NAME_TRUNCATE_LENGTH })}`,
hidden: obj.kind !== KnativeServiceModel.kind && annotation !== 'OpenShiftWebConsole',
href: `/edit/ns/${obj.metadata.namespace}?name=${obj.metadata.name}&kind=${obj.kind ||
model.kind}`,
accessReview: {
group: model.apiGroup,
resource: model.plural,
name: obj.metadata.name,
namespace: obj.metadata.namespace,
verb: 'update',
},
};
};
| {
"pile_set_name": "Github"
} |
% Comments
%
% Comments go here %
@RELATION golf
@ATTRIBUTE outlook {sunny,overcast, rain}
@ATTRIBUTE temperature NUMERIC
@ATTRIBUTE humidity NUMERIC
@ATTRIBUTE windy {false, true}
@ATTRIBUTE class {dont_play, play}
@DATA
sunny, 65, ?, false, dont_play, {2}
sunny, 80, 90, true, dont_play
overcast, 83, 78, false, play ,{3}
rain, 70, 96, false, play
rain, 68, 80, false, play
rain, 65, 70, true, play
| {
"pile_set_name": "Github"
} |
# TODO Dry this out with 32-bit code.
.POSIX:
IN_EXT ?= .asm
INC_EXT ?= .inc
OUT_EXT ?= .out
TMP_EXT ?= .o
RUN ?= hello_world
OUTS := $(patsubst %$(IN_EXT),%$(OUT_EXT),$(wildcard *$(IN_EXT)))
INCS := $(wildcard *$(INC_EXT))
.PRECIOUS: %$(TMP_EXT)
.PHONY: all clean run
all: $(OUTS)
%$(OUT_EXT): %$(TMP_EXT)
ld -o '$@' '$<'
%$(TMP_EXT): %$(IN_EXT) $(INCS)
nasm -w+all -f elf64 -o '$@' '$<'
clean:
rm -f *$(TMP_EXT) *$(OUT_EXT)
run: all
./$(RUN)$(OUT_EXT)
test: all
for f in *$(OUT_EXT); do echo $$f; ./$$f; done
| {
"pile_set_name": "Github"
} |
export interface ToastOptions {
message?: string;
cssClass?: string;
duration?: number;
showCloseButton?: boolean;
closeButtonText?: string;
dismissOnPageChange?: boolean;
position?: string;
}
| {
"pile_set_name": "Github"
} |
#import "AudioplayerPlugin.h"
#if __has_include(<audioplayer/audioplayer-Swift.h>)
#import <audioplayer/audioplayer-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "audioplayer-Swift.h"
#endif
@implementation AudioplayerPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
[SwiftAudioplayerPlugin registerWithRegistrar:registrar];
}
@end
| {
"pile_set_name": "Github"
} |
#!/bin/sh
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# A Bourne shell script for running the NIST DSA Validation System
#
# Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
# variables appropriately so that the fipstest command and the NSPR and NSS
# shared libraries/DLLs are on the search path. Then run this script in the
# directory where the REQUEST (.req) files reside. The script generates the
# RESPONSE (.rsp) files in the same directory.
BASEDIR=${1-.}
TESTDIR=${BASEDIR}/DSA2
COMMAND=${2-run}
REQDIR=${TESTDIR}/req
RSPDIR=${TESTDIR}/resp
#
# several of the DSA tests do use known answer tests to verify the result.
# in those cases, feed generated tests back into the fipstest tool and
# see if we can verify those value. NOTE: th PQGVer and SigVer tests verify
# the dsa pqgver and dsa sigver functions, so we know they can detect errors
# in those PQGGen and SigGen. Only the KeyPair verify is potentially circular.
#
if [ ${COMMAND} = "verify" ]; then
result=0
# verify generated keys
name=KeyPair
echo ">>>>> $name"
fipstest dsa keyver ${RSPDIR}/$name.rsp | grep ^Result.=.F
test 1 = $?
last_result=$?
result=`expr $result + $last_result`
# verify generated pqg values
name=PQGGen
echo ">>>>> $name"
fipstest dsa pqgver ${RSPDIR}/$name.rsp | grep ^Result.=.F
test 1 = $?
last_result=$?
result=`expr $result + $last_result`
# verify PQGVer with known answer
sh ./validate1.sh ${TESTDIR} PQGVer1863.req ' ' '-e /^Result.=.F/s;.(.*);; -e /^Result.=.P/s;.(.*);;'
last_result=$?
result=`expr $result + $last_result`
# verify signatures
name=SigGen
echo ">>>>> $name"
fipstest dsa sigver ${RSPDIR}/$name.rsp | grep ^Result.=.F
test 1 = $?
last_result=$?
result=`expr $result + $last_result`
# verify SigVer with known answer
sh ./validate1.sh ${TESTDIR} SigVer.req ' ' '-e /^X.=/d -e /^Result.=.F/s;.(.*);;'
last_result=$?
result=`expr $result + $last_result`
exit $result
fi
test -d "${RSPDIR}" || mkdir "${RSPDIR}"
request=KeyPair.req
response=`echo $request | sed -e "s/req/rsp/"`
echo $request $response
fipstest dsa keypair ${REQDIR}/$request > ${RSPDIR}/$response
request=PQGGen.req
response=`echo $request | sed -e "s/req/rsp/"`
echo $request $response
fipstest dsa pqggen ${REQDIR}/$request > ${RSPDIR}/$response
request=PQGVer1863.req
response=`echo $request | sed -e "s/req/rsp/"`
echo $request $response
fipstest dsa pqgver ${REQDIR}/$request > ${RSPDIR}/$response
request=SigGen.req
response=`echo $request | sed -e "s/req/rsp/"`
echo $request $response
fipstest dsa siggen ${REQDIR}/$request > ${RSPDIR}/$response
request=SigVer.req
response=`echo $request | sed -e "s/req/rsp/"`
echo $request $response
fipstest dsa sigver ${REQDIR}/$request > ${RSPDIR}/$response
exit 0
| {
"pile_set_name": "Github"
} |
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* 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.
*/
#ifndef SYM_FILEUTILS_H
#define SYM_FILEUTILS_H
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <zip.h>
#include <utime.h>
#include "common/Log.h"
#include "util/StringUtils.h"
#include "util/List.h"
#include "file/FileEntry.h"
#ifdef SYM_WIN32
#include <Windows.h>
#endif
int SymFileUtils_mkdir(char* dirName);
int SymFileUtils_getFileSize(char *filename);
time_t SymFileUtils_getFileLastModified(char *filename);
unsigned short SymFileUtils_exists(char *filename);
SymList* SymFileUtils_listFiles(char* dirName); // list of SymFileEntry
SymList* SymFileUtils_listFilesRecursive(char* dirName); // list of SymFileEntry
unsigned short SymFileUtils_isRegularFile(char *pathname);
unsigned short SymFileUtils_isDir(char *pathname);
SymStringArray* SymFileUtils_readLines(char *pathname);
char* SymFileUtils_readFile(char *pathname);
long SymFileUtils_sizeOfDirectory(char *pathname);
int SymFileUtils_deleteDir(char *dirName);
int SymFileUtils_setFileModificationTime(char *filename, time_t modificationTime);
int SymFileUtils_unzip(char* archive, char* destintation);
#endif
| {
"pile_set_name": "Github"
} |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Cake.Common.Build;
using Cake.Common.Build.AppVeyor;
using Cake.Common.Build.AzurePipelines;
using Cake.Common.Build.Bamboo;
using Cake.Common.Build.BitbucketPipelines;
using Cake.Common.Build.Bitrise;
using Cake.Common.Build.ContinuaCI;
using Cake.Common.Build.GitHubActions;
using Cake.Common.Build.GitLabCI;
using Cake.Common.Build.GoCD;
using Cake.Common.Build.Jenkins;
using Cake.Common.Build.MyGet;
using Cake.Common.Build.TeamCity;
using Cake.Common.Build.TFBuild;
using Cake.Common.Build.TravisCI;
using Cake.Common.Tests.Fixtures.Build;
using NSubstitute;
using Xunit;
namespace Cake.Common.Tests.Unit.Build
{
public sealed class BuildSystemTests
{
public sealed class TheConstructor
{
[Fact]
public void Should_Throw_If_AppVeyor_Is_Null()
{
// Given
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(null, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "appVeyorProvider");
}
[Fact]
public void Should_Throw_If_TeamCity_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, null, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "teamCityProvider");
}
[Fact]
public void Should_Throw_If_MyGet_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, null, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "myGetProvider");
}
[Fact]
public void Should_Throw_If_Bamboo_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, null, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "bambooProvider");
}
[Fact]
public void Should_Throw_If_ContinuaCI_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, null, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "continuaCIProvider");
}
[Fact]
public void Should_Throw_If_Jenkins_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, null, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "jenkinsProvider");
}
[Fact]
public void Should_Throw_If_Bitrise_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, null, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "bitriseProvider");
}
[Fact]
public void Should_Throw_If_TravisCI_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, null, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "travisCIProvider");
}
[Fact]
public void Should_Throw_If_BitbucketPipelines_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, null, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "bitbucketPipelinesProvider");
}
[Fact]
public void Should_Throw_If_GoCD_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, null, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "goCDProvider");
}
[Fact]
public void Should_Throw_If_GitLabCI_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, null, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "gitLabCIProvider");
}
[Fact]
public void Should_Throw_If_TFBuild_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, null, gitHubActionsProvider, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "tfBuildProvider");
}
[Fact]
public void Should_Throw_If_AzurePipelines_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, null));
// Then
AssertEx.IsArgumentNullException(result, "azurePipelinesProvider");
}
[Fact]
public void Should_Throw_If_GitHubActions_Is_Null()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
// When
var result = Record.Exception(() => new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, null, azurePipelinesProvider));
// Then
AssertEx.IsArgumentNullException(result, "gitHubActionsProvider");
}
}
public sealed class TheIsRunningOnAppVeyorProperty
{
[Fact]
public void Should_Return_True_If_Running_On_AppVeyor()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var appVeyorEnvironment = new AppVeyorInfoFixture().CreateEnvironmentInfo();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
appVeyorProvider.IsRunningOnAppVeyor.Returns(true);
appVeyorProvider.Environment.Returns(appVeyorEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnAppVeyor);
}
}
public sealed class TheIsRunningOnTeamCityProperty
{
[Fact]
public void Should_Return_True_If_Running_On_TeamCity()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var teamCityEnvironment = new TeamCityInfoFixture().CreateEnvironmentInfo();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
teamCityProvider.IsRunningOnTeamCity.Returns(true);
teamCityProvider.Environment.Returns(teamCityEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnTeamCity);
}
}
public sealed class TheIsRunningOnMyGetProperty
{
[Fact]
public void Should_Return_True_If_Running_On_MyGet()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
myGetProvider.IsRunningOnMyGet.Returns(true);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnMyGet);
}
}
public sealed class TheIsRunningOnBambooProperty
{
[Fact]
public void Should_Return_True_If_Running_On_Bamboo()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
bambooProvider.IsRunningOnBamboo.Returns(true);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnBamboo);
}
}
public sealed class TheIsRunningOnContinuaCIProperty
{
[Fact]
public void Should_Return_True_If_Running_On_ContinuaCI()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
continuaCIProvider.IsRunningOnContinuaCI.Returns(true);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnContinuaCI);
}
}
public sealed class TheIsRunningOnJenkinsProperty
{
[Fact]
public void Should_Return_True_If_Running_On_Jenkins()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var jenkinsEnvironment = new JenkinsInfoFixture().CreateEnvironmentInfo();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
jenkinsProvider.IsRunningOnJenkins.Returns(true);
jenkinsProvider.Environment.Returns(jenkinsEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnJenkins);
}
}
public sealed class TheIsRunningOnBitriseProperty
{
[Fact]
public void Should_Return_True_If_Running_On_Bitrise()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var bitriseEnvironment = new BitriseInfoFixture().CreateEnvironmentInfo();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
bitriseProvider.IsRunningOnBitrise.Returns(true);
bitriseProvider.Environment.Returns(bitriseEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnBitrise);
}
}
public sealed class TheIsRunningOnTravisCIProperty
{
[Fact]
public void Should_Return_True_If_Running_On_TravisCI()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var travisCIEnvironment = new TravisCIInfoFixture().CreateEnvironmentInfo();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
travisCIProvider.IsRunningOnTravisCI.Returns(true);
travisCIProvider.Environment.Returns(travisCIEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnTravisCI);
}
}
public sealed class TheIsRunningOnBitbucketPipelinesProperty
{
[Fact]
public void Should_Return_True_If_Running_On_BitbucketPipelines()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var bitbucketPipelinesEnvironment = new BitbucketPipelinesInfoFixture().CreateEnvironmentInfo();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
bitbucketPipelinesProvider.IsRunningOnBitbucketPipelines.Returns(true);
bitbucketPipelinesProvider.Environment.Returns(bitbucketPipelinesEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnBitbucketPipelines);
}
}
public sealed class TheIsRunningOnGoCDProperty
{
[Fact]
public void Should_Return_True_If_Running_On_GoCD()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
goCDProvider.IsRunningOnGoCD.Returns(true);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnGoCD);
}
}
public sealed class TheIsRunningOnGitLabCIProperty
{
[Fact]
public void Should_Return_True_If_Running_On_GitLabCI()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var gitLabCIEnvironment = new GitLabCIInfoFixture().CreateEnvironmentInfo();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
gitLabCIProvider.IsRunningOnGitLabCI.Returns(true);
gitLabCIProvider.Environment.Returns(gitLabCIEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnGitLabCI);
}
}
public sealed class TheIsRunningOnAzurePipelinesProperty
{
[Fact]
public void Should_Return_True_If_Running_On_AzurePipelines()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var tfBuildEnvironment = new TFBuildInfoFixture().CreateEnvironmentInfo();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
var azurePipelinesEnvironment = new AzurePipelinesInfoFixture().CreateEnvironmentInfo();
azurePipelinesProvider.IsRunningOnAzurePipelines.Returns(true);
azurePipelinesProvider.Environment.Returns(azurePipelinesEnvironment);
tfBuildProvider.IsRunningOnAzurePipelines.Returns(true);
tfBuildProvider.Environment.Returns(tfBuildEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnAzurePipelines);
}
}
public sealed class TheIsRunningOnAzurePipelinesHostedProperty
{
[Fact]
public void Should_Return_True_If_Running_On_AzurePipelinesHosted()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var tfBuildEnvironment = new TFBuildInfoFixture().CreateEnvironmentInfo();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
var azurePipelinesEnvironment = new AzurePipelinesInfoFixture().CreateEnvironmentInfo();
azurePipelinesProvider.IsRunningOnAzurePipelinesHosted.Returns(true);
azurePipelinesProvider.Environment.Returns(azurePipelinesEnvironment);
tfBuildProvider.IsRunningOnAzurePipelinesHosted.Returns(true);
tfBuildProvider.Environment.Returns(tfBuildEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnAzurePipelinesHosted);
}
}
public sealed class TheIsRunningOnGitHubActionsProperty
{
[Fact]
public void Should_Return_True_If_Running_On_GitHubActions()
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var gitHubActionsEnvironment = new GitHubActionsInfoFixture().CreateEnvironmentInfo();
gitHubActionsProvider.IsRunningOnGitHubActions.Returns(true);
gitHubActionsProvider.Environment.Returns(gitHubActionsEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.True(buildSystem.IsRunningOnGitHubActions);
}
}
public sealed class TheProviderProperty
{
[Theory]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, false, false, BuildProvider.Local)]
[InlineData(true, false, false, false, false, false, false, false, false, false, false, false, false, false, BuildProvider.AppVeyor)]
[InlineData(false, true, false, false, false, false, false, false, false, false, false, false, false, false, BuildProvider.TeamCity)]
[InlineData(false, false, true, false, false, false, false, false, false, false, false, false, false, false, BuildProvider.MyGet)]
[InlineData(false, false, false, true, false, false, false, false, false, false, false, false, false, false, BuildProvider.Bamboo)]
[InlineData(false, false, false, false, true, false, false, false, false, false, false, false, false, false, BuildProvider.ContinuaCI)]
[InlineData(false, false, false, false, false, true, false, false, false, false, false, false, false, false, BuildProvider.Jenkins)]
[InlineData(false, false, false, false, false, false, true, false, false, false, false, false, false, false, BuildProvider.Bitrise)]
[InlineData(false, false, false, false, false, false, false, true, false, false, false, false, false, false, BuildProvider.TravisCI)]
[InlineData(false, false, false, false, false, false, false, false, true, false, false, false, false, false, BuildProvider.BitbucketPipelines)]
[InlineData(false, false, false, false, false, false, false, false, false, true, false, false, false, false, BuildProvider.GoCD)]
[InlineData(false, false, false, false, false, false, false, false, false, false, true, false, false, false, BuildProvider.GitLabCI)]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, true, false, false, BuildProvider.AzurePipelines)]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, true, false, BuildProvider.AzurePipelinesHosted)]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, false, true, BuildProvider.GitHubActions)]
public void Should_Return_Provider_If_Running_On_Provider(bool appVeyor, bool teamCity, bool myGet, bool bamboo, bool continuaCI, bool jenkins, bool bitrise, bool travisCI, bool bitbucketPipelines, bool goCD, bool gitLabCI, bool azurePipelines, bool azurePipelinesHosted, bool gitHubActions, BuildProvider provider)
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var appVeyorEnvironment = new AppVeyorInfoFixture().CreateEnvironmentInfo();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var teamCityEnvironment = new TeamCityInfoFixture().CreateEnvironmentInfo();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var jenkinsEnvironment = new JenkinsInfoFixture().CreateEnvironmentInfo();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var bitriseEnvironment = new BitriseInfoFixture().CreateEnvironmentInfo();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var travisCIEnvironment = new TravisCIInfoFixture().CreateEnvironmentInfo();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var bitbucketPipelinesEnvironment = new BitbucketPipelinesInfoFixture().CreateEnvironmentInfo();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var gitLabCIEnvironment = new GitLabCIInfoFixture().CreateEnvironmentInfo();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var tfBuildEnvironment = new TFBuildInfoFixture().CreateEnvironmentInfo();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var gitHubActionsEnvironment = new GitHubActionsInfoFixture().CreateEnvironmentInfo();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
var azurePipelinesEnvironment = new AzurePipelinesInfoFixture().CreateEnvironmentInfo();
appVeyorProvider.IsRunningOnAppVeyor.Returns(appVeyor);
appVeyorProvider.Environment.Returns(appVeyorEnvironment);
teamCityProvider.IsRunningOnTeamCity.Returns(teamCity);
teamCityProvider.Environment.Returns(teamCityEnvironment);
myGetProvider.IsRunningOnMyGet.Returns(myGet);
bambooProvider.IsRunningOnBamboo.Returns(bamboo);
continuaCIProvider.IsRunningOnContinuaCI.Returns(continuaCI);
jenkinsProvider.IsRunningOnJenkins.Returns(jenkins);
jenkinsProvider.Environment.Returns(jenkinsEnvironment);
bitriseProvider.IsRunningOnBitrise.Returns(bitrise);
bitriseProvider.Environment.Returns(bitriseEnvironment);
travisCIProvider.IsRunningOnTravisCI.Returns(travisCI);
travisCIProvider.Environment.Returns(travisCIEnvironment);
bitbucketPipelinesProvider.IsRunningOnBitbucketPipelines.Returns(bitbucketPipelines);
bitbucketPipelinesProvider.Environment.Returns(bitbucketPipelinesEnvironment);
goCDProvider.IsRunningOnGoCD.Returns(goCD);
gitLabCIProvider.IsRunningOnGitLabCI.Returns(gitLabCI);
gitLabCIProvider.Environment.Returns(gitLabCIEnvironment);
tfBuildProvider.IsRunningOnAzurePipelines.Returns(azurePipelines);
tfBuildProvider.IsRunningOnAzurePipelinesHosted.Returns(azurePipelinesHosted);
tfBuildProvider.Environment.Returns(tfBuildEnvironment);
gitHubActionsProvider.IsRunningOnGitHubActions.Returns(gitHubActions);
gitHubActionsProvider.Environment.Returns(gitHubActionsEnvironment);
azurePipelinesProvider.IsRunningOnAzurePipelines.Returns(azurePipelines);
azurePipelinesProvider.IsRunningOnAzurePipelinesHosted.Returns(azurePipelinesHosted);
azurePipelinesProvider.Environment.Returns(azurePipelinesEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.Equal(provider, buildSystem.Provider);
}
}
public sealed class TheIsLocalBuildProperty
{
[Theory]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, false, false, true)]
[InlineData(true, false, false, false, false, false, false, false, false, false, false, false, false, false, false)]
[InlineData(false, true, false, false, false, false, false, false, false, false, false, false, false, false, false)]
[InlineData(false, false, true, false, false, false, false, false, false, false, false, false, false, false, false)]
[InlineData(false, false, false, true, false, false, false, false, false, false, false, false, false, false, false)]
[InlineData(false, false, false, false, true, false, false, false, false, false, false, false, false, false, false)]
[InlineData(false, false, false, false, false, true, false, false, false, false, false, false, false, false, false)]
[InlineData(false, false, false, false, false, false, true, false, false, false, false, false, false, false, false)]
[InlineData(false, false, false, false, false, false, false, true, false, false, false, false, false, false, false)]
[InlineData(false, false, false, false, false, false, false, false, true, false, false, false, false, false, false)]
[InlineData(false, false, false, false, false, false, false, false, false, true, false, false, false, false, false)]
[InlineData(false, false, false, false, false, false, false, false, false, false, true, false, false, false, false)]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, true, false, false, false)]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, true, false, false)]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, false, true, false)]
public void Should_Return_Whether_Or_Not_Running_On_Provider(bool appVeyor, bool teamCity, bool myGet, bool bamboo, bool continuaCI, bool jenkins, bool bitrise, bool travisCI, bool bitbucketPipelines, bool goCD, bool gitLabCI, bool azurePipelines, bool azurePipelinesHosted, bool gitHubActions, bool isLocalBuild)
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var appVeyorEnvironment = new AppVeyorInfoFixture().CreateEnvironmentInfo();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var teamCityEnvironment = new TeamCityInfoFixture().CreateEnvironmentInfo();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var jenkinsEnvironment = new JenkinsInfoFixture().CreateEnvironmentInfo();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var bitriseEnvironment = new BitriseInfoFixture().CreateEnvironmentInfo();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var travisCIEnvironment = new TravisCIInfoFixture().CreateEnvironmentInfo();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var bitbucketPipelinesEnvironment = new BitbucketPipelinesInfoFixture().CreateEnvironmentInfo();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var gitLabCIEnvironment = new GitLabCIInfoFixture().CreateEnvironmentInfo();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var tfBuildEnvironment = new TFBuildInfoFixture().CreateEnvironmentInfo();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var gitHubActionsEnvironment = new GitHubActionsInfoFixture().CreateEnvironmentInfo();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
var azurePipelinesEnvironment = new AzurePipelinesInfoFixture().CreateEnvironmentInfo();
appVeyorProvider.IsRunningOnAppVeyor.Returns(appVeyor);
appVeyorProvider.Environment.Returns(appVeyorEnvironment);
teamCityProvider.IsRunningOnTeamCity.Returns(teamCity);
teamCityProvider.Environment.Returns(teamCityEnvironment);
myGetProvider.IsRunningOnMyGet.Returns(myGet);
bambooProvider.IsRunningOnBamboo.Returns(bamboo);
continuaCIProvider.IsRunningOnContinuaCI.Returns(continuaCI);
jenkinsProvider.IsRunningOnJenkins.Returns(jenkins);
jenkinsProvider.Environment.Returns(jenkinsEnvironment);
bitriseProvider.IsRunningOnBitrise.Returns(bitrise);
bitriseProvider.Environment.Returns(bitriseEnvironment);
travisCIProvider.IsRunningOnTravisCI.Returns(travisCI);
travisCIProvider.Environment.Returns(travisCIEnvironment);
bitbucketPipelinesProvider.IsRunningOnBitbucketPipelines.Returns(bitbucketPipelines);
bitbucketPipelinesProvider.Environment.Returns(bitbucketPipelinesEnvironment);
goCDProvider.IsRunningOnGoCD.Returns(goCD);
gitLabCIProvider.IsRunningOnGitLabCI.Returns(gitLabCI);
gitLabCIProvider.Environment.Returns(gitLabCIEnvironment);
tfBuildProvider.IsRunningOnAzurePipelines.Returns(azurePipelines);
tfBuildProvider.IsRunningOnAzurePipelinesHosted.Returns(azurePipelinesHosted);
tfBuildProvider.Environment.Returns(tfBuildEnvironment);
gitHubActionsProvider.IsRunningOnGitHubActions.Returns(gitHubActions);
gitHubActionsProvider.Environment.Returns(gitHubActionsEnvironment);
azurePipelinesProvider.IsRunningOnAzurePipelines.Returns(azurePipelines);
azurePipelinesProvider.IsRunningOnAzurePipelinesHosted.Returns(azurePipelinesHosted);
azurePipelinesProvider.Environment.Returns(azurePipelinesEnvironment);
// When
System.Console.WriteLine(jenkinsProvider);
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.Equal(isLocalBuild, buildSystem.IsLocalBuild);
}
}
public sealed class TheIsPullRequestProperty
{
[Theory]
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false)] // none
[InlineData(true, false, false, false, false, false, false, false, false, false, false, false, false, false, true)] // appveyor
[InlineData(false, true, false, false, false, false, false, false, false, false, false, false, false, false, true)] // teamcity
[InlineData(false, false, true, false, false, false, false, false, false, false, false, false, false, false, false)] // myget
[InlineData(false, false, false, true, false, false, false, false, false, false, false, false, false, false, false)] // bamboo
[InlineData(false, false, false, false, true, false, false, false, false, false, false, false, false, false, false)] // continua
[InlineData(false, false, false, false, false, true, false, false, false, false, false, false, false, false, true)] // jenkins
[InlineData(false, false, false, false, false, false, true, false, false, false, false, false, false, false, true)] // bitrise
[InlineData(false, false, false, false, false, false, false, true, false, false, false, false, false, false, true)] // travis
[InlineData(false, false, false, false, false, false, false, false, true, false, false, false, false, false, true)] // bitbucket
[InlineData(false, false, false, false, false, false, false, false, false, true, false, false, false, false, false)] // gocd
[InlineData(false, false, false, false, false, false, false, false, false, false, true, false, false, false, true)] // gitlab
[InlineData(false, false, false, false, false, false, false, false, false, false, false, true, false, false, true)] // az pipelines
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, true, false, true)] // az pipelines hosted
[InlineData(false, false, false, false, false, false, false, false, false, false, false, false, false, true, true)] // gh actions
public void Should_Return_True_If_Running_On_Supported_Provider(bool appVeyor, bool teamCity, bool myGet, bool bamboo, bool continuaCI, bool jenkins, bool bitrise, bool travisCI, bool bitbucketPipelines, bool goCD, bool gitLabCI, bool azurePipelines, bool azurePipelinesHosted, bool gitHubActions, bool isPullRequest)
{
// Given
var appVeyorProvider = Substitute.For<IAppVeyorProvider>();
var appVeyorEnvironment = new AppVeyorInfoFixture().CreateEnvironmentInfo();
var teamCityProvider = Substitute.For<ITeamCityProvider>();
var teamCityEnvironment = new TeamCityInfoFixture().CreateEnvironmentInfo();
var myGetProvider = Substitute.For<IMyGetProvider>();
var bambooProvider = Substitute.For<IBambooProvider>();
var continuaCIProvider = Substitute.For<IContinuaCIProvider>();
var jenkinsProvider = Substitute.For<IJenkinsProvider>();
var jenkinsEnvironment = new JenkinsInfoFixture().CreateEnvironmentInfo();
var bitriseProvider = Substitute.For<IBitriseProvider>();
var bitriseEnvironment = new BitriseInfoFixture().CreateEnvironmentInfo();
var travisCIProvider = Substitute.For<ITravisCIProvider>();
var travisCIEnvironment = new TravisCIInfoFixture().CreateEnvironmentInfo();
var bitbucketPipelinesProvider = Substitute.For<IBitbucketPipelinesProvider>();
var bitbucketPipelinesEnvironment = new BitbucketPipelinesInfoFixture().CreateEnvironmentInfo();
var goCDProvider = Substitute.For<IGoCDProvider>();
var gitLabCIProvider = Substitute.For<IGitLabCIProvider>();
var gitLabCIEnvironment = new GitLabCIInfoFixture().CreateEnvironmentInfo();
var tfBuildProvider = Substitute.For<ITFBuildProvider>();
var tfBuildEnvironment = new TFBuildInfoFixture().CreateEnvironmentInfo();
var gitHubActionsProvider = Substitute.For<IGitHubActionsProvider>();
var gitHubActionsEnvironment = new GitHubActionsInfoFixture().CreateEnvironmentInfo();
var azurePipelinesProvider = Substitute.For<IAzurePipelinesProvider>();
var azurePipelinesEnvironment = new AzurePipelinesInfoFixture().CreateEnvironmentInfo();
appVeyorProvider.IsRunningOnAppVeyor.Returns(appVeyor);
appVeyorProvider.Environment.Returns(appVeyorEnvironment);
teamCityProvider.IsRunningOnTeamCity.Returns(teamCity);
teamCityProvider.Environment.Returns(teamCityEnvironment);
myGetProvider.IsRunningOnMyGet.Returns(myGet);
bambooProvider.IsRunningOnBamboo.Returns(bamboo);
continuaCIProvider.IsRunningOnContinuaCI.Returns(continuaCI);
jenkinsProvider.IsRunningOnJenkins.Returns(jenkins);
jenkinsProvider.Environment.Returns(jenkinsEnvironment);
bitriseProvider.IsRunningOnBitrise.Returns(bitrise);
bitriseProvider.Environment.Returns(bitriseEnvironment);
travisCIProvider.IsRunningOnTravisCI.Returns(travisCI);
travisCIProvider.Environment.Returns(travisCIEnvironment);
bitbucketPipelinesProvider.IsRunningOnBitbucketPipelines.Returns(bitbucketPipelines);
bitbucketPipelinesProvider.Environment.Returns(bitbucketPipelinesEnvironment);
goCDProvider.IsRunningOnGoCD.Returns(goCD);
gitLabCIProvider.IsRunningOnGitLabCI.Returns(gitLabCI);
gitLabCIProvider.Environment.Returns(gitLabCIEnvironment);
tfBuildProvider.IsRunningOnAzurePipelines.Returns(azurePipelines);
tfBuildProvider.IsRunningOnAzurePipelinesHosted.Returns(azurePipelinesHosted);
tfBuildProvider.Environment.Returns(tfBuildEnvironment);
gitHubActionsProvider.IsRunningOnGitHubActions.Returns(gitHubActions);
gitHubActionsProvider.Environment.Returns(gitHubActionsEnvironment);
azurePipelinesProvider.IsRunningOnAzurePipelines.Returns(azurePipelines);
azurePipelinesProvider.IsRunningOnAzurePipelinesHosted.Returns(azurePipelinesHosted);
azurePipelinesProvider.Environment.Returns(azurePipelinesEnvironment);
// When
var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider, travisCIProvider, bitbucketPipelinesProvider, goCDProvider, gitLabCIProvider, tfBuildProvider, gitHubActionsProvider, azurePipelinesProvider);
// Then
Assert.Equal(isPullRequest, buildSystem.IsPullRequest);
}
}
}
} | {
"pile_set_name": "Github"
} |
#ifndef SERIAL_H
#define SERIAL_H
#include <QSerialPort>
#include <QString>
#include "command.h"
class Serial
{
public:
static Serial *Instance();
void closeSerialPort();
bool openSerialPort(QString name);
void sendMessage(QString message);
void sendCommand(Command &command);
private:
Serial();
static Serial *instance;
QString currentSerialPortName;
QSerialPort *serialPort;
bool isSending;
bool shouldListen;
void stopReading();
};
#endif // SERIAL_H
| {
"pile_set_name": "Github"
} |
Simple block on one line:
<div>foo</div>
And nested without indentation:
<div>
<div>
<div>
foo
</div>
<div style=">"/>
</div>
<div>bar</div>
</div>
| {
"pile_set_name": "Github"
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Resizable - Textarea</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.8.3.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.mouse.js"></script>
<script src="../../ui/jquery.ui.resizable.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-resizable-se {
bottom: 17px;
}
</style>
<script>
$(function() {
$( "#resizable" ).resizable({
handles: "se"
});
});
</script>
</head>
<body>
<textarea id="resizable" rows="5" cols="20"></textarea>
<div class="demo-description">
<p>Display only an outline of the element while resizing by setting the <code>helper</code> option to a CSS class.</p>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
package com.github.mustfun.mybatis.plugin.dom.model;
import com.intellij.util.xml.Attribute;
import com.intellij.util.xml.DomElement;
import com.intellij.util.xml.GenericAttributeValue;
import org.jetbrains.annotations.NotNull;
/**
* @author yanglin
* @updater itar
*/
public interface Package extends DomElement {
@NotNull
@Attribute("name")
public GenericAttributeValue<String> getName();
}
| {
"pile_set_name": "Github"
} |
#[doc = "Reader of register INTENCLR"]
pub type R = crate::R<u8, super::INTENCLR>;
#[doc = "Writer for register INTENCLR"]
pub type W = crate::W<u8, super::INTENCLR>;
#[doc = "Register INTENCLR `reset()`'s with value 0"]
impl crate::ResetValue for super::INTENCLR {
type Type = u8;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `RESRDY`"]
pub type RESRDY_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `RESRDY`"]
pub struct RESRDY_W<'a> {
w: &'a mut W,
}
impl<'a> RESRDY_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | ((value as u8) & 0x01);
self.w
}
}
#[doc = "Reader of field `OVERRUN`"]
pub type OVERRUN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `OVERRUN`"]
pub struct OVERRUN_W<'a> {
w: &'a mut W,
}
impl<'a> OVERRUN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u8) & 0x01) << 1);
self.w
}
}
#[doc = "Reader of field `WINMON`"]
pub type WINMON_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `WINMON`"]
pub struct WINMON_W<'a> {
w: &'a mut W,
}
impl<'a> WINMON_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u8) & 0x01) << 2);
self.w
}
}
impl R {
#[doc = "Bit 0 - Result Ready Interrupt Disable"]
#[inline(always)]
pub fn resrdy(&self) -> RESRDY_R {
RESRDY_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Overrun Interrupt Disable"]
#[inline(always)]
pub fn overrun(&self) -> OVERRUN_R {
OVERRUN_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Window Monitor Interrupt Disable"]
#[inline(always)]
pub fn winmon(&self) -> WINMON_R {
WINMON_R::new(((self.bits >> 2) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Result Ready Interrupt Disable"]
#[inline(always)]
pub fn resrdy(&mut self) -> RESRDY_W {
RESRDY_W { w: self }
}
#[doc = "Bit 1 - Overrun Interrupt Disable"]
#[inline(always)]
pub fn overrun(&mut self) -> OVERRUN_W {
OVERRUN_W { w: self }
}
#[doc = "Bit 2 - Window Monitor Interrupt Disable"]
#[inline(always)]
pub fn winmon(&mut self) -> WINMON_W {
WINMON_W { w: self }
}
}
| {
"pile_set_name": "Github"
} |
done
| {
"pile_set_name": "Github"
} |
<?php
declare(strict_types=1);
namespace CyrildeWit\EloquentViewable;
use CyrildeWit\EloquentViewable\Contracts\View as ViewContract;
use CyrildeWit\EloquentViewable\Support\Period;
use Illuminate\Container\Container;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
class View extends Model implements ViewContract
{
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
/**
* Get the table associated with the model.
*
* @return string
*/
public function getTable()
{
return Container::getInstance()
->make('config')
->get('eloquent-viewable.models.view.table_name', parent::getTable());
}
/**
* Get the current connection name for the model.
*
* @return string
*/
public function getConnectionName()
{
return Container::getInstance()
->make('config')
->get('eloquent-viewable.models.view.connection', parent::getConnectionName());
}
/**
* Get the viewable model to which this View belongs.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
*/
public function viewable(): MorphTo
{
return $this->morphTo();
}
/**
* Scope a query to only include views within the period.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \CyrildeWit\EloquentViewable\Support\Period $period
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeWithinPeriod(Builder $query, Period $period)
{
$startDateTime = $period->getStartDateTime();
$endDateTime = $period->getEndDateTime();
if ($startDateTime !== null && $endDateTime === null) {
$query->where('viewed_at', '>=', $startDateTime);
} elseif ($startDateTime === null && $endDateTime !== null) {
$query->where('viewed_at', '<=', $endDateTime);
} elseif ($startDateTime !== null && $endDateTime !== null) {
$query->whereBetween('viewed_at', [$startDateTime, $endDateTime]);
}
return $query;
}
/**
* Scope a query to only include views withing the collection.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string|null $collection
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCollection(Builder $query, string $collection = null)
{
return $query->where('collection', $collection);
}
}
| {
"pile_set_name": "Github"
} |
[
{
"BriefDescription": "Instructions Per Cycle (per logical thread)",
"MetricExpr": "INST_RETIRED.ANY / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "TopDownL1",
"MetricName": "IPC"
},
{
"BriefDescription": "Uops Per Instruction",
"MetricExpr": "UOPS_RETIRED.RETIRE_SLOTS / INST_RETIRED.ANY",
"MetricGroup": "Pipeline",
"MetricName": "UPI"
},
{
"BriefDescription": "Rough Estimation of fraction of fetched lines bytes that were likely consumed by program instructions",
"MetricExpr": "min( 1 , UOPS_ISSUED.ANY / ( (UOPS_RETIRED.RETIRE_SLOTS / INST_RETIRED.ANY) * 32 * ( ICACHE.HIT + ICACHE.MISSES ) / 4) )",
"MetricGroup": "Frontend",
"MetricName": "IFetch_Line_Utilization"
},
{
"BriefDescription": "Fraction of Uops delivered by the DSB (aka Decoded Icache; or Uop Cache)",
"MetricExpr": "IDQ.DSB_UOPS / ( IDQ.DSB_UOPS + LSD.UOPS + IDQ.MITE_UOPS + IDQ.MS_UOPS )",
"MetricGroup": "DSB; Frontend_Bandwidth",
"MetricName": "DSB_Coverage"
},
{
"BriefDescription": "Cycles Per Instruction (threaded)",
"MetricExpr": "1 / (INST_RETIRED.ANY / cycles)",
"MetricGroup": "Pipeline;Summary",
"MetricName": "CPI"
},
{
"BriefDescription": "Per-thread actual clocks when the logical processor is active. This is called 'Clockticks' in VTune.",
"MetricExpr": "CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "CLKS"
},
{
"BriefDescription": "Total issue-pipeline slots",
"MetricExpr": "4*(( CPU_CLK_UNHALTED.THREAD_ANY / 2 ) if #SMT_on else cycles)",
"MetricGroup": "TopDownL1",
"MetricName": "SLOTS"
},
{
"BriefDescription": "Total number of retired Instructions",
"MetricExpr": "INST_RETIRED.ANY",
"MetricGroup": "Summary",
"MetricName": "Instructions"
},
{
"BriefDescription": "Instructions Per Cycle (per physical core)",
"MetricExpr": "INST_RETIRED.ANY / (( CPU_CLK_UNHALTED.THREAD_ANY / 2 ) if #SMT_on else cycles)",
"MetricGroup": "SMT",
"MetricName": "CoreIPC"
},
{
"BriefDescription": "Instruction-Level-Parallelism (average number of uops executed when there is at least 1 uop executed)",
"MetricExpr": "UOPS_DISPATCHED.THREAD / (( cpu@UOPS_DISPATCHED.CORE\\,cmask\\=1@ / 2) if #SMT_on else cpu@UOPS_DISPATCHED.CORE\\,cmask\\=1@)",
"MetricGroup": "Pipeline;Ports_Utilization",
"MetricName": "ILP"
},
{
"BriefDescription": "Core actual clocks when any thread is active on the physical core",
"MetricExpr": "( CPU_CLK_UNHALTED.THREAD_ANY / 2 ) if #SMT_on else CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "SMT",
"MetricName": "CORE_CLKS"
},
{
"BriefDescription": "Average CPU Utilization",
"MetricExpr": "CPU_CLK_UNHALTED.REF_TSC / msr@tsc@",
"MetricGroup": "Summary",
"MetricName": "CPU_Utilization"
},
{
"BriefDescription": "Giga Floating Point Operations Per Second",
"MetricExpr": "(( 1*( FP_COMP_OPS_EXE.SSE_SCALAR_SINGLE + FP_COMP_OPS_EXE.SSE_SCALAR_DOUBLE ) + 2* FP_COMP_OPS_EXE.SSE_PACKED_DOUBLE + 4*( FP_COMP_OPS_EXE.SSE_PACKED_SINGLE + SIMD_FP_256.PACKED_DOUBLE ) + 8* SIMD_FP_256.PACKED_SINGLE )) / 1000000000 / duration_time",
"MetricGroup": "FLOPS;Summary",
"MetricName": "GFLOPs"
},
{
"BriefDescription": "Average Frequency Utilization relative nominal frequency",
"MetricExpr": "CPU_CLK_UNHALTED.THREAD / CPU_CLK_UNHALTED.REF_TSC",
"MetricGroup": "Power",
"MetricName": "Turbo_Utilization"
},
{
"BriefDescription": "Fraction of cycles where both hardware threads were active",
"MetricExpr": "1 - CPU_CLK_THREAD_UNHALTED.ONE_THREAD_ACTIVE / ( CPU_CLK_THREAD_UNHALTED.REF_XCLK_ANY / 2 ) if #SMT_on else 0",
"MetricGroup": "SMT;Summary",
"MetricName": "SMT_2T_Utilization"
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
"MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:u / CPU_CLK_UNHALTED.REF_TSC",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
{
"BriefDescription": "C3 residency percent per core",
"MetricExpr": "(cstate_core@c3\\-residency@ / msr@tsc@) * 100",
"MetricGroup": "Power",
"MetricName": "C3_Core_Residency"
},
{
"BriefDescription": "C6 residency percent per core",
"MetricExpr": "(cstate_core@c6\\-residency@ / msr@tsc@) * 100",
"MetricGroup": "Power",
"MetricName": "C6_Core_Residency"
},
{
"BriefDescription": "C7 residency percent per core",
"MetricExpr": "(cstate_core@c7\\-residency@ / msr@tsc@) * 100",
"MetricGroup": "Power",
"MetricName": "C7_Core_Residency"
},
{
"BriefDescription": "C2 residency percent per package",
"MetricExpr": "(cstate_pkg@c2\\-residency@ / msr@tsc@) * 100",
"MetricGroup": "Power",
"MetricName": "C2_Pkg_Residency"
},
{
"BriefDescription": "C3 residency percent per package",
"MetricExpr": "(cstate_pkg@c3\\-residency@ / msr@tsc@) * 100",
"MetricGroup": "Power",
"MetricName": "C3_Pkg_Residency"
},
{
"BriefDescription": "C6 residency percent per package",
"MetricExpr": "(cstate_pkg@c6\\-residency@ / msr@tsc@) * 100",
"MetricGroup": "Power",
"MetricName": "C6_Pkg_Residency"
},
{
"BriefDescription": "C7 residency percent per package",
"MetricExpr": "(cstate_pkg@c7\\-residency@ / msr@tsc@) * 100",
"MetricGroup": "Power",
"MetricName": "C7_Pkg_Residency"
}
]
| {
"pile_set_name": "Github"
} |
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/apply_fwd.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename F, typename T1 = na, typename T2 = na, typename T3 = na
, typename T4 = na, typename T5 = na
>
struct apply;
template<
typename F
>
struct apply0;
template<
typename F, typename T1
>
struct apply1;
template<
typename F, typename T1, typename T2
>
struct apply2;
template<
typename F, typename T1, typename T2, typename T3
>
struct apply3;
template<
typename F, typename T1, typename T2, typename T3, typename T4
>
struct apply4;
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct apply5;
}}
| {
"pile_set_name": "Github"
} |
package test
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"testing"
"github.com/davecgh/go-spew/spew"
fuzz "github.com/google/gofuzz"
jsoniter "github.com/json-iterator/go"
)
func Test_Roundtrip(t *testing.T) {
fz := fuzz.New().MaxDepth(10).NilChance(0.3)
for i := 0; i < 100; i++ {
var before typeForTest
fz.Fuzz(&before)
jbStd, err := json.Marshal(before)
if err != nil {
t.Fatalf("failed to marshal with stdlib: %v", err)
}
if len(strings.TrimSpace(string(jbStd))) == 0 {
t.Fatal("stdlib marshal produced empty result and no error")
}
jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before)
if err != nil {
t.Fatalf("failed to marshal with jsoniter: %v", err)
}
if len(strings.TrimSpace(string(jbIter))) == 0 {
t.Fatal("jsoniter marshal produced empty result and no error")
}
if string(jbStd) != string(jbIter) {
t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s",
indent(jbStd, " "), indent(jbIter, " "), dump(before))
}
var afterStd typeForTest
err = json.Unmarshal(jbIter, &afterStd)
if err != nil {
t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s",
err, indent(jbIter, " "))
}
var afterIter typeForTest
err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter)
if err != nil {
t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s",
err, indent(jbIter, " "))
}
if fingerprint(afterStd) != fingerprint(afterIter) {
t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s",
dump(afterStd), dump(afterIter), indent(jbIter, " "))
}
}
}
const indentStr = "> "
func fingerprint(obj interface{}) string {
c := spew.ConfigState{
SortKeys: true,
SpewKeys: true,
}
return c.Sprintf("%v", obj)
}
func dump(obj interface{}) string {
cfg := spew.ConfigState{
Indent: indentStr,
}
return cfg.Sdump(obj)
}
func indent(src []byte, prefix string) string {
var buf bytes.Buffer
err := json.Indent(&buf, src, prefix, indentStr)
if err != nil {
return fmt.Sprintf("!!! %v", err)
}
return buf.String()
}
func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) {
t.ReportAllocs()
t.ResetTimer()
var obj typeForTest
fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3)
fz.Fuzz(&obj)
for i := 0; i < t.N; i++ {
jb, err := fn(obj)
if err != nil {
t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err)
}
_ = jb
}
}
func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) {
t.ReportAllocs()
t.ResetTimer()
var before typeForTest
fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3)
fz.Fuzz(&before)
jb, err := json.Marshal(before)
if err != nil {
t.Fatalf("failed to marshal: %v", err)
}
for i := 0; i < t.N; i++ {
var after typeForTest
err = fn(jb, &after)
if err != nil {
t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err)
}
}
}
func BenchmarkStandardMarshal(t *testing.B) {
benchmarkMarshal(t, "stdlib", json.Marshal)
}
func BenchmarkStandardUnmarshal(t *testing.B) {
benchmarkUnmarshal(t, "stdlib", json.Unmarshal)
}
func BenchmarkJSONIterMarshalFastest(t *testing.B) {
benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal)
}
func BenchmarkJSONIterUnmarshalFastest(t *testing.B) {
benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal)
}
func BenchmarkJSONIterMarshalDefault(t *testing.B) {
benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal)
}
func BenchmarkJSONIterUnmarshalDefault(t *testing.B) {
benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal)
}
func BenchmarkJSONIterMarshalCompatible(t *testing.B) {
benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal)
}
func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) {
benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal)
}
| {
"pile_set_name": "Github"
} |
module.exports = {
'clone': require('./lang/clone'),
'cloneDeep': require('./lang/cloneDeep'),
'eq': require('./lang/eq'),
'gt': require('./lang/gt'),
'gte': require('./lang/gte'),
'isArguments': require('./lang/isArguments'),
'isArray': require('./lang/isArray'),
'isBoolean': require('./lang/isBoolean'),
'isDate': require('./lang/isDate'),
'isElement': require('./lang/isElement'),
'isEmpty': require('./lang/isEmpty'),
'isEqual': require('./lang/isEqual'),
'isError': require('./lang/isError'),
'isFinite': require('./lang/isFinite'),
'isFunction': require('./lang/isFunction'),
'isMatch': require('./lang/isMatch'),
'isNaN': require('./lang/isNaN'),
'isNative': require('./lang/isNative'),
'isNull': require('./lang/isNull'),
'isNumber': require('./lang/isNumber'),
'isObject': require('./lang/isObject'),
'isPlainObject': require('./lang/isPlainObject'),
'isRegExp': require('./lang/isRegExp'),
'isString': require('./lang/isString'),
'isTypedArray': require('./lang/isTypedArray'),
'isUndefined': require('./lang/isUndefined'),
'lt': require('./lang/lt'),
'lte': require('./lang/lte'),
'toArray': require('./lang/toArray'),
'toPlainObject': require('./lang/toPlainObject')
};
| {
"pile_set_name": "Github"
} |
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
MIT: https://opensource.org/licenses/MIT
See the LICENSE file in the project's top-level directory for details.
Authors:
* Christian Hagendorn (chris_schmidt)
************************************************************************ */
qx.Class.define("qx.test.ui.form.ComboBox",
{
extend : qx.test.ui.LayoutTestCase,
include : qx.dev.unit.MMock,
members :
{
testWithSetValueWithArbitraryValue: function() {
var combobox = this.__createComboBox("arbitrary value");
this.getRoot().add(combobox);
this.flush();
this.assertIdentical("arbitrary value", combobox.getValue(),
"Wrong result from getValue()");
combobox.open();
this.flush();
this.assertIdentical(0, combobox.getChildrenContainer().getSelection().length,
"The pop-up list has an item selected!");
this.getRoot().removeAll();
combobox.dispose();
this.flush();
},
testWithSetValueWith: function() {
var combobox = this.__createComboBox("Item 0");
this.getRoot().add(combobox);
this.flush();
this.assertIdentical("Item 0", combobox.getValue(),
"Wrong result from getValue()");
combobox.open();
this.flush();
var list = combobox.getChildrenContainer();
var item = list.findItem("Item 0");
this.assertIdentical(item, list.getSelection()[0],
"The wrong item selected in pop-up list!");
// check if the combobox is case sensitive, [BUG #3024]
combobox.setValue("item 2");
this.assertEquals("item 2", combobox.getValue());
this.assertEquals(0, list.getSelection().length);
this.getRoot().removeAll();
combobox.dispose();
this.flush();
},
testWithoutSetValue: function() {
var combobox = this.__createComboBox();
this.getRoot().add(combobox);
this.flush();
this.assertIdentical(null, combobox.getValue(),
"Wrong result from getValue()");
combobox.open();
this.flush();
this.assertIdentical(0, combobox.getChildrenContainer().getSelection().length,
"The pop-up list has an item selected!");
this.getRoot().removeAll();
combobox.dispose();
this.flush();
},
testFocusTextOnClose: function() {
var combobox = this.__createComboBox();
this.getRoot().add(combobox);
this.flush();
// Open list popup
combobox.open();
this.flush();
// Select item
var list = combobox.getChildControl("list");
var item = list.findItem("Item 0");
list.setSelection([item]);
this.flush();
// Asssert focus on close
this.spy(combobox, "tabFocus");
combobox.close();
this.assertCalled(combobox.tabFocus);
this.getRoot().removeAll();
combobox.dispose();
},
testNotFocusTextOnCloseWhenInvisibleBefore: function() {
var combobox = this.__createComboBox();
this.getRoot().add(combobox);
this.flush();
// Enter value
combobox.setValue("Item 0");
this.flush();
// Assert not focus on close
this.spy(combobox, "tabFocus");
combobox.close();
this.assertNotCalled(combobox.tabFocus);
this.getRoot().removeAll();
combobox.dispose();
},
__createComboBox : function(initValue)
{
var comboBox = new qx.ui.form.ComboBox();
if (initValue) {
comboBox.setValue(initValue);
}
for (var i = 0; i < 10; i++) {
comboBox.add(new qx.ui.form.ListItem("Item " + i));
}
return comboBox;
}
}
}); | {
"pile_set_name": "Github"
} |
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* NSA Security-Enhanced Linux (SELinux) security module
*
* This file contains the SELinux security data structures for kernel objects.
*
* Author(s): Stephen Smalley, <[email protected]>
* Chris Vance, <[email protected]>
* Wayne Salamon, <[email protected]>
* James Morris <[email protected]>
*
* Copyright (C) 2001,2002 Networks Associates Technology, Inc.
* Copyright (C) 2003 Red Hat, Inc., James Morris <[email protected]>
* Copyright (C) 2016 Mellanox Technologies
*/
#ifndef _SELINUX_OBJSEC_H_
#define _SELINUX_OBJSEC_H_
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/binfmts.h>
#include <linux/in.h>
#include <linux/spinlock.h>
#include <linux/lsm_hooks.h>
#include <linux/msg.h>
#include <net/net_namespace.h>
#include "flask.h"
#include "avc.h"
struct task_security_struct {
u32 osid; /* SID prior to last execve */
u32 sid; /* current SID */
u32 exec_sid; /* exec SID */
u32 create_sid; /* fscreate SID */
u32 keycreate_sid; /* keycreate SID */
u32 sockcreate_sid; /* fscreate SID */
} __randomize_layout;
enum label_initialized {
LABEL_INVALID, /* invalid or not initialized */
LABEL_INITIALIZED, /* initialized */
LABEL_PENDING
};
struct inode_security_struct {
struct inode *inode; /* back pointer to inode object */
struct list_head list; /* list of inode_security_struct */
u32 task_sid; /* SID of creating task */
u32 sid; /* SID of this object */
u16 sclass; /* security class of this object */
unsigned char initialized; /* initialization flag */
spinlock_t lock;
};
struct file_security_struct {
u32 sid; /* SID of open file description */
u32 fown_sid; /* SID of file owner (for SIGIO) */
u32 isid; /* SID of inode at the time of file open */
u32 pseqno; /* Policy seqno at the time of file open */
};
struct superblock_security_struct {
struct super_block *sb; /* back pointer to sb object */
u32 sid; /* SID of file system superblock */
u32 def_sid; /* default SID for labeling */
u32 mntpoint_sid; /* SECURITY_FS_USE_MNTPOINT context for files */
unsigned short behavior; /* labeling behavior */
unsigned short flags; /* which mount options were specified */
struct mutex lock;
struct list_head isec_head;
spinlock_t isec_lock;
};
struct msg_security_struct {
u32 sid; /* SID of message */
};
struct ipc_security_struct {
u16 sclass; /* security class of this object */
u32 sid; /* SID of IPC resource */
};
struct netif_security_struct {
struct net *ns; /* network namespace */
int ifindex; /* device index */
u32 sid; /* SID for this interface */
};
struct netnode_security_struct {
union {
__be32 ipv4; /* IPv4 node address */
struct in6_addr ipv6; /* IPv6 node address */
} addr;
u32 sid; /* SID for this node */
u16 family; /* address family */
};
struct netport_security_struct {
u32 sid; /* SID for this node */
u16 port; /* port number */
u8 protocol; /* transport protocol */
};
struct sk_security_struct {
#ifdef CONFIG_NETLABEL
enum { /* NetLabel state */
NLBL_UNSET = 0,
NLBL_REQUIRE,
NLBL_LABELED,
NLBL_REQSKB,
NLBL_CONNLABELED,
} nlbl_state;
struct netlbl_lsm_secattr *nlbl_secattr; /* NetLabel sec attributes */
#endif
u32 sid; /* SID of this object */
u32 peer_sid; /* SID of peer */
u16 sclass; /* sock security class */
enum { /* SCTP association state */
SCTP_ASSOC_UNSET = 0,
SCTP_ASSOC_SET,
} sctp_assoc_state;
};
struct tun_security_struct {
u32 sid; /* SID for the tun device sockets */
};
struct key_security_struct {
u32 sid; /* SID of key */
};
struct ib_security_struct {
u32 sid; /* SID of the queue pair or MAD agent */
};
struct pkey_security_struct {
u64 subnet_prefix; /* Port subnet prefix */
u16 pkey; /* PKey number */
u32 sid; /* SID of pkey */
};
struct bpf_security_struct {
u32 sid; /* SID of bpf obj creator */
};
struct perf_event_security_struct {
u32 sid; /* SID of perf_event obj creator */
};
extern struct lsm_blob_sizes selinux_blob_sizes;
static inline struct task_security_struct *selinux_cred(const struct cred *cred)
{
return cred->security + selinux_blob_sizes.lbs_cred;
}
static inline struct file_security_struct *selinux_file(const struct file *file)
{
return file->f_security + selinux_blob_sizes.lbs_file;
}
static inline struct inode_security_struct *selinux_inode(
const struct inode *inode)
{
if (unlikely(!inode->i_security))
return NULL;
return inode->i_security + selinux_blob_sizes.lbs_inode;
}
static inline struct msg_security_struct *selinux_msg_msg(
const struct msg_msg *msg_msg)
{
return msg_msg->security + selinux_blob_sizes.lbs_msg_msg;
}
static inline struct ipc_security_struct *selinux_ipc(
const struct kern_ipc_perm *ipc)
{
return ipc->security + selinux_blob_sizes.lbs_ipc;
}
/*
* get the subjective security ID of the current task
*/
static inline u32 current_sid(void)
{
const struct task_security_struct *tsec = selinux_cred(current_cred());
return tsec->sid;
}
#endif /* _SELINUX_OBJSEC_H_ */
| {
"pile_set_name": "Github"
} |
const data: any = {
info: {},
cells: [],
segments: {},
};
const cells = data.cells;
const segments = data.segments;
const info = data.info;
export default {
cells,
segments,
info,
};
export { data, cells, segments, info };
| {
"pile_set_name": "Github"
} |
---
layout: base
title: 'Statistics of X in UD_Norwegian-Bokmaal'
udver: '2'
---
## Treebank Statistics: UD_Norwegian-Bokmaal: POS Tags: `X`
There are 438 `X` lemmas (2%), 438 `X` types (1%) and 726 `X` tokens (0%).
Out of 17 observed tags, the rank of `X` is: 6 in number of lemmas, 6 in number of types and 15 in number of tokens.
The 10 most frequent `X` lemmas: <em>the, of, and, in, to, you, a, is, for, i</em>
The 10 most frequent `X` types: <em>the, of, and, in, to, you, a, is, for, i</em>
The 10 most frequent ambiguous lemmas: <em>the</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 31, <tt><a href="no_bokmaal-pos-DET.html">DET</a></tt> 4), <em>of</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 25, <tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 1), <em>and</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 20, <tt><a href="no_bokmaal-pos-CCONJ.html">CCONJ</a></tt> 1, <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 1), <em>in</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 16, <tt><a href="no_bokmaal-pos-ADJ.html">ADJ</a></tt> 2), <em>to</em> (<tt><a href="no_bokmaal-pos-NUM.html">NUM</a></tt> 356, <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 11), <em>you</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 9, <tt><a href="no_bokmaal-pos-PRON.html">PRON</a></tt> 1), <em>a</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 8, <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 7, <tt><a href="no_bokmaal-pos-INTJ.html">INTJ</a></tt> 1), <em>is</em> (<tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 13, <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 7, <tt><a href="no_bokmaal-pos-VERB.html">VERB</a></tt> 1), <em>for</em> (<tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 2701, <tt><a href="no_bokmaal-pos-SCONJ.html">SCONJ</a></tt> 1009, <tt><a href="no_bokmaal-pos-ADV.html">ADV</a></tt> 148, <tt><a href="no_bokmaal-pos-CCONJ.html">CCONJ</a></tt> 99, <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 7), <em>i</em> (<tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 8439, <tt><a href="no_bokmaal-pos-SCONJ.html">SCONJ</a></tt> 192, <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 3, <tt><a href="no_bokmaal-pos-PROPN.html">PROPN</a></tt> 1)
The 10 most frequent ambiguous types: <em>the</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 31, <tt><a href="no_bokmaal-pos-DET.html">DET</a></tt> 4), <em>of</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 25, <tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 1), <em>and</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 20, <tt><a href="no_bokmaal-pos-CCONJ.html">CCONJ</a></tt> 1, <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 1), <em>in</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 16, <tt><a href="no_bokmaal-pos-ADJ.html">ADJ</a></tt> 2), <em>to</em> (<tt><a href="no_bokmaal-pos-NUM.html">NUM</a></tt> 331, <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 11), <em>you</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 9, <tt><a href="no_bokmaal-pos-PRON.html">PRON</a></tt> 1), <em>a</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 8, <tt><a href="no_bokmaal-pos-ADJ.html">ADJ</a></tt> 5, <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 2, <tt><a href="no_bokmaal-pos-INTJ.html">INTJ</a></tt> 1), <em>is</em> (<tt><a href="no_bokmaal-pos-X.html">X</a></tt> 7, <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 4, <tt><a href="no_bokmaal-pos-VERB.html">VERB</a></tt> 1), <em>for</em> (<tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 2558, <tt><a href="no_bokmaal-pos-SCONJ.html">SCONJ</a></tt> 985, <tt><a href="no_bokmaal-pos-ADV.html">ADV</a></tt> 143, <tt><a href="no_bokmaal-pos-CCONJ.html">CCONJ</a></tt> 44, <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 7), <em>i</em> (<tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 7662, <tt><a href="no_bokmaal-pos-SCONJ.html">SCONJ</a></tt> 191, <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 3)
* <em>the</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 31: <em>Willie Nelson med « On <b>the</b> road again » ?</em>
* <tt><a href="no_bokmaal-pos-DET.html">DET</a></tt> 4: <em>Men et sted å begynne debatten er « follow <b>the</b> money » .</em>
* <em>of</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 25: <em>- President Annan <b>of</b> the world , erklærte Jean til klampetrapp .</em>
* <tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 1: <em>Sist jeg sjekka var Tupperware homeparties noe veldig amerikansk og veldig kjedelig som utdaterte husmødre holdt på med når de innimellom ikke hadde syklubb ( speaking <b>of</b> ; syklubb er vel også noe vi plutselig driver med i fullt alvor , eller ? ) .</em>
* <em>and</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 20: <em>What lies beyond , <b>and</b> what lay before ?</em>
* <tt><a href="no_bokmaal-pos-CCONJ.html">CCONJ</a></tt> 1: <em>En geriljakrig handler om « hearts <b>and</b> minds » og om presise nålestikk mot geriljaens våpen .</em>
* <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 1: <em>Med et utvidet « Gjærbägst <b>and</b> the Homöcidal Sirupsnipps » -konsept og et trailerlass med plast ble stua raskt forvandlet til et improvisert øvingslokale med høy jallafaktor og lyden skrudd opp til 11 .</em>
* <em>in</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 16: <em>Is anything certain <b>in</b> life ? »</em>
* <tt><a href="no_bokmaal-pos-ADJ.html">ADJ</a></tt> 2: <em>Strikket et skjørt med hønsestrikk - det var <b>in</b> blant de radikale på 70-tallet - med border med kvinnesaksmerket , hjerter og menn og kvinner som danset .</em>
* <em>to</em>
* <tt><a href="no_bokmaal-pos-NUM.html">NUM</a></tt> 331: <em>NATO har fått <b>to</b> nye medlemsland</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 11: <em>« With malice towards none , with charity <b>to</b> all . »</em>
* <em>you</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 9: <em>See <b>you</b> soon , lads , vinket han .</em>
* <tt><a href="no_bokmaal-pos-PRON.html">PRON</a></tt> 1: <em>Altså , jeg er helt frisk , og det er ikke noe som skulle tilsi en snarlig bortgang , men <b>you</b> never know .</em>
* <em>a</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 8: <em>« It seemed like <b>a</b> great idea at the time . »</em>
* <tt><a href="no_bokmaal-pos-ADJ.html">ADJ</a></tt> 5: <em>Den gir følgelig hjemmel for bestemmelser bl <b>a</b> om fredning , jakt , fangst og fiske , turisme og ymse næringsvirksomhet .</em>
* <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 2: <em>5 Saltvannsfiskeloven ( lov 3 juni 1983 nr 40 om saltvannsfiske m.v. ) gjelder i fiskerisonen ved Jan Mayen ( jf lovens § 1 første ledd bokstav <b>a</b> ) .</em>
* <tt><a href="no_bokmaal-pos-INTJ.html">INTJ</a></tt> 1: <em>Og da var det sånn « <b>a</b> , hvordan står det til med tingene ellers i livet , har du noen utestående regninger og sånn ? »</em>
* <em>is</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 7: <em>« My gay brother <b>is</b> an outcast » , uttalte broren John .</em>
* <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> 4: <em>Han bestikker jentene med <b>is</b> så han får snakke om sine favorittemaer , baking og kunst .</em>
* <tt><a href="no_bokmaal-pos-VERB.html">VERB</a></tt> 1: <em>- Men der moten søker balanse , virker det som om det er « more <b>is</b> more » som gjelder for danserne .</em>
* <em>for</em>
* <tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 2558: <em>Og <b>for</b> at også jeg å komme med en bekjennelse :</em>
* <tt><a href="no_bokmaal-pos-SCONJ.html">SCONJ</a></tt> 985: <em>Man bryter anstendighet <b>for</b> å si seg enig i det alle er enige om .</em>
* <tt><a href="no_bokmaal-pos-ADV.html">ADV</a></tt> 143: <em>Men kjente at kroppen var <b>for</b> tung .</em>
* <tt><a href="no_bokmaal-pos-CCONJ.html">CCONJ</a></tt> 44: <em>Fardal ville sitte her , ikke i sofaen , <b>for</b> her er hun mer på alerten .</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 7: <em>Bånn gass i nye « Need <b>for</b> Speed »</em>
* <em>i</em>
* <tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> 7662: <em>Det blir et spark som straff , <b>i</b> moralens navn og på vegne av oss alle .</em>
* <tt><a href="no_bokmaal-pos-SCONJ.html">SCONJ</a></tt> 191: <em>Med løven <b>i</b> handa .</em>
* <tt><a href="no_bokmaal-pos-X.html">X</a></tt> 3: <em>- Åh , no blir eg varm <b>i</b> håvve !</em>
## Morphology
The form / lemma ratio of `X` is 1.000000 (the average of all parts of speech is 1.381919).
The 1st highest number of forms (1) was observed with the lemma “32”: <em>32</em>.
The 2nd highest number of forms (1) was observed with the lemma “34”: <em>34</em>.
The 3rd highest number of forms (1) was observed with the lemma “Annan”: <em>Annan</em>.
`X` does not occur with any features.
## Relations
`X` nodes are attached to their parents using 12 different relations: <tt><a href="no_bokmaal-dep-flat-foreign.html">flat:foreign</a></tt> (478; 66% instances), <tt><a href="no_bokmaal-dep-flat-name.html">flat:name</a></tt> (152; 21% instances), <tt><a href="no_bokmaal-dep-root.html">root</a></tt> (51; 7% instances), <tt><a href="no_bokmaal-dep-compound.html">compound</a></tt> (9; 1% instances), <tt><a href="no_bokmaal-dep-obj.html">obj</a></tt> (9; 1% instances), <tt><a href="no_bokmaal-dep-nmod.html">nmod</a></tt> (6; 1% instances), <tt><a href="no_bokmaal-dep-obl.html">obl</a></tt> (6; 1% instances), <tt><a href="no_bokmaal-dep-appos.html">appos</a></tt> (5; 1% instances), <tt><a href="no_bokmaal-dep-xcomp.html">xcomp</a></tt> (5; 1% instances), <tt><a href="no_bokmaal-dep-conj.html">conj</a></tt> (2; 0% instances), <tt><a href="no_bokmaal-dep-nsubj.html">nsubj</a></tt> (2; 0% instances), <tt><a href="no_bokmaal-dep-acl.html">acl</a></tt> (1; 0% instances)
Parents of `X` nodes belong to 9 different parts of speech: <tt><a href="no_bokmaal-pos-X.html">X</a></tt> (478; 66% instances), <tt><a href="no_bokmaal-pos-PROPN.html">PROPN</a></tt> (156; 21% instances), (51; 7% instances), <tt><a href="no_bokmaal-pos-VERB.html">VERB</a></tt> (20; 3% instances), <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> (17; 2% instances), <tt><a href="no_bokmaal-pos-ADJ.html">ADJ</a></tt> (1; 0% instances), <tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> (1; 0% instances), <tt><a href="no_bokmaal-pos-DET.html">DET</a></tt> (1; 0% instances), <tt><a href="no_bokmaal-pos-PRON.html">PRON</a></tt> (1; 0% instances)
592 (82%) `X` nodes are leaves.
53 (7%) `X` nodes have one child.
7 (1%) `X` nodes have two children.
74 (10%) `X` nodes have three or more children.
The highest child degree of a `X` node is 41.
Children of `X` nodes are attached using 12 different relations: <tt><a href="no_bokmaal-dep-flat-foreign.html">flat:foreign</a></tt> (481; 65% instances), <tt><a href="no_bokmaal-dep-punct.html">punct</a></tt> (218; 30% instances), <tt><a href="no_bokmaal-dep-case.html">case</a></tt> (10; 1% instances), <tt><a href="no_bokmaal-dep-parataxis.html">parataxis</a></tt> (10; 1% instances), <tt><a href="no_bokmaal-dep-advmod.html">advmod</a></tt> (3; 0% instances), <tt><a href="no_bokmaal-dep-appos.html">appos</a></tt> (3; 0% instances), <tt><a href="no_bokmaal-dep-conj.html">conj</a></tt> (3; 0% instances), <tt><a href="no_bokmaal-dep-nmod.html">nmod</a></tt> (3; 0% instances), <tt><a href="no_bokmaal-dep-mark.html">mark</a></tt> (2; 0% instances), <tt><a href="no_bokmaal-dep-acl-relcl.html">acl:relcl</a></tt> (1; 0% instances), <tt><a href="no_bokmaal-dep-amod.html">amod</a></tt> (1; 0% instances), <tt><a href="no_bokmaal-dep-obl.html">obl</a></tt> (1; 0% instances)
Children of `X` nodes belong to 9 different parts of speech: <tt><a href="no_bokmaal-pos-X.html">X</a></tt> (478; 65% instances), <tt><a href="no_bokmaal-pos-PUNCT.html">PUNCT</a></tt> (218; 30% instances), <tt><a href="no_bokmaal-pos-VERB.html">VERB</a></tt> (12; 2% instances), <tt><a href="no_bokmaal-pos-ADP.html">ADP</a></tt> (10; 1% instances), <tt><a href="no_bokmaal-pos-NOUN.html">NOUN</a></tt> (7; 1% instances), <tt><a href="no_bokmaal-pos-PROPN.html">PROPN</a></tt> (5; 1% instances), <tt><a href="no_bokmaal-pos-ADV.html">ADV</a></tt> (3; 0% instances), <tt><a href="no_bokmaal-pos-SCONJ.html">SCONJ</a></tt> (2; 0% instances), <tt><a href="no_bokmaal-pos-ADJ.html">ADJ</a></tt> (1; 0% instances)
| {
"pile_set_name": "Github"
} |
/**
* Wire
* Copyright (C) 2018 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.waz.zclient.pages.startup;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.waz.zclient.R;
import com.waz.zclient.pages.BaseFragment;
import com.waz.zclient.ui.views.ZetaButton;
import com.waz.zclient.utils.ViewUtils;
public class UpdateFragment extends BaseFragment<UpdateFragment.Container> {
public static final String TAG = UpdateFragment.class.getName();
public static UpdateFragment newInstance() {
return new UpdateFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_update, container, false);
ZetaButton zetaButton = ViewUtils.getView(view, R.id.zb__update__download);
zetaButton.setAccentColor(getResources().getColor(R.color.forced_update__button__background, getContext().getTheme()));
zetaButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
launchDownloadLink();
}
});
return view;
}
public interface Container {
}
private void launchDownloadLink() {
final String appPackageName = getActivity().getPackageName();
try {
Intent launchIntent = getActivity().getPackageManager().getLaunchIntentForPackage("com.android.vending");
ComponentName comp = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity");
launchIntent.setComponent(comp);
launchIntent.setData(Uri.parse("market://details?id=" + appPackageName));
startActivity(launchIntent);
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
}
}
}
| {
"pile_set_name": "Github"
} |
#
# Author:: Bryan McLellan <[email protected]>
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# 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.
#
require "spec_helper"
describe Ohai::System, "ssh_host_key plugin" do
before do
@plugin = get_plugin("ssh_host_key")
@plugin[:keys] = Mash.new
allow(File).to receive(:exist?).with("/etc/ssh/sshd_config").and_return(true)
allow(File).to receive(:open).with("/etc/ssh/sshd_config").and_yield(sshd_config_file)
allow(File).to receive(:exist?).and_return(true)
allow(File).to receive(:exist?).with("/etc/ssh/ssh_host_dsa_key.pub").and_return(true)
allow(File).to receive(:exist?).with("/etc/ssh/ssh_host_rsa_key.pub").and_return(true)
allow(File).to receive(:exist?).with("/etc/ssh/ssh_host_ecdsa_key.pub").and_return(true)
allow(File).to receive(:exist?).with("/etc/ssh/ssh_host_ed25519_key.pub").and_return(true)
# Ensure we can still use IO.read
io_read = IO.method(:read)
allow(IO).to receive(:read) { |file| io_read.call(file) }
# Return fake public key files so we don't have to go digging for them in unit tests
@dsa_key = "ssh-dss AAAAB3NzaC1kc3MAAACBAMHlT02xN8kietxPfhcb98xHueTzKCOTz6dZlP/dmKILHrQOAExuSEeNiA2uvmhHNVQvs/cBsRiDxgSKux3ie2q8+MB6vHCiSpSkoPjrL75iT57YDilCB4/sytt6IJpj+H42wRDWTX0/QRybMHUvmnmEL0cwZXykSvrIum0BKB6hAAAAFQDsi6WUCClhtZIiTY9uh8eAre+SbQAAAIEAgNnuw0uEuqtcVif+AYd/bCZvL9FPqg7DrmTkamNEcVinhUGwsPGJTLJf+o5ens1X4RzQoi1R6Y6zCTL2FN/hZgINJNO0z9BN402wWrZmQd+Vb1U5DyDtveuvipqyQS+fm9neRwdLuv36Fc9f9nkZ7YHpkGPJp+yJpG4OoeREhwgAAACBAIf9kKLf2XiXnlByzlJ2Naa55d/hp2E059VKCRsBS++xFKYKvSqjnDQBFiMtAUhb8EdTyBGyalqOgqogDQVtwHfTZWZwqHAhry9aM06y92Eu/xSey4tWjKeknOsnRe640KC4zmKDBRTrjjkuAdrKPN9k3jl+OCc669JHlIfo6kqf oppa"
@rsa_key = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuhcVXV+nNapkyUC5p4TH1ymRxUjtMBKqYWmwyI29gVFnUNeHkKFHWon0KFeGJP2Rm8BfTiZa9ER9e8pRr4Nd+z1C1o0kVoxEEfB9tpSdTlpk1GG83D94l57fij8THRVIwuCEosViUlg1gDgC4SpxbqfdBkUN2qyf6JDOh7t2QpYh7berpDEWeBpb7BKdLEDT57uw7ijKzSNyaXqq8KkB9I+UFrRwpuos4W7ilX+PQ+mWLi2ZZJfTYZMxxVS+qJwiDtNxGCRwTOQZG03kI7eLBZG+igupr0uD4o6qeftPOr0kxgjoPU4nEKvYiGq8Rqd2vYrhiaJHLk9QB6xStQvS3Q== oppa"
@ecdsa_key = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBx8VgvxmHxs/sIn/ATh0iUcuz1I2Xc0e1ejXCGHBMZ98IE3FBt1ezlqCpNMcHVV2skQQ8vyLbKxzweyZuNSDU8= oppa"
@ed25519_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFYGnIM5K5JaRxbMCqz8cPMmLp57ZoJQvA5Tlj18EO6H djb"
allow(IO).to receive(:read).with("/etc/ssh/ssh_host_dsa_key.pub").and_return(@dsa_key)
allow(IO).to receive(:read).with("/etc/ssh/ssh_host_rsa_key.pub").and_return(@rsa_key)
allow(IO).to receive(:read).with("/etc/ssh/ssh_host_ecdsa_key.pub").and_return(@ecdsa_key)
allow(IO).to receive(:read).with("/etc/ssh/ssh_host_ed25519_key.pub").and_return(@ed25519_key)
end
shared_examples "loads keys" do
it "reads the key and sets the dsa attribute correctly" do
@plugin.run
expect(@plugin[:keys][:ssh][:host_dsa_public]).to eql(@dsa_key.split[1])
expect(@plugin[:keys][:ssh][:host_dsa_type]).to be_nil
end
it "reads the key and sets the rsa attribute correctly" do
@plugin.run
expect(@plugin[:keys][:ssh][:host_rsa_public]).to eql(@rsa_key.split[1])
expect(@plugin[:keys][:ssh][:host_rsa_type]).to be_nil
end
it "reads the key and sets the ecdsa attribute correctly" do
@plugin.run
expect(@plugin[:keys][:ssh][:host_ecdsa_public]).to eql(@ecdsa_key.split[1])
expect(@plugin[:keys][:ssh][:host_ecdsa_type]).to eql(@ecdsa_key.split[0])
end
it "reads the key and sets the ed25519 attribute correctly" do
@plugin.run
expect(@plugin[:keys][:ssh][:host_ed25519_public]).to eql(@ed25519_key.split[1])
expect(@plugin[:keys][:ssh][:host_ed25519_type]).to be_nil
end
end
context "when an sshd_config exists" do
let :sshd_config_file do
<<~EOS
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
EOS
end
it_behaves_like "loads keys"
end
context "when an sshd_config exists with commented entries" do
let :sshd_config_file do
<<~EOS
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
EOS
end
it_behaves_like "loads keys"
end
context "when an sshd_config can not be found" do
let :sshd_config_file do
nil
end
before do
allow(File).to receive(:exist?).with("/etc/ssh/sshd_config").and_return(false)
allow(File).to receive(:exist?).with("/etc/sshd_config").and_return(false)
end
it_behaves_like "loads keys"
end
end
| {
"pile_set_name": "Github"
} |
-----BEGIN CERTIFICATE-----
MIICATCCAWoCCQDidF+uNJR6czANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB
VTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0
cyBQdHkgTHRkMB4XDTEyMDUwMTIyNTUxN1oXDTEzMDUwMTIyNTUxN1owRTELMAkG
A1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0
IFdpZGdpdHMgUHR5IEx0ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtpjl
nodhz31kLEJoeLSkRmrv8l7exkGtO0REtIbirj9BBy64ZXVBE7khKGO2cnM8U7yj
w7Ntfh+IvCjZVA3d2XqHS3Pjrt4HmU/cGCONE8+NEXoqdzLUDPOix1qDDRBvXs81
KAV2qh6CYHZbdqixhDerjvJcD4Nsd7kExEZfHuECAwEAATANBgkqhkiG9w0BAQUF
AAOBgQCyOqs7+qpMrYCgL6OamDeCVojLoEp036PsnaYWf2NPmsVXdpYW40Foyyjp
iv5otkxO5rxtGPv7o2J1eMBpCuSkydvoz3Ey/QwGqbBwEXQ4xYCgra336gqW2KQt
+LnDCkE8f5oBhCIisExc2i8PDvsRsY70g/2gs983ImJjVR8sDw==
-----END CERTIFICATE-----
| {
"pile_set_name": "Github"
} |
<?php
header("Content-Type: application/json; charset=utf-8");
echo $resMilestone;
die;
?> | {
"pile_set_name": "Github"
} |
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
import fn from '../../isSameDay/index'
import convertToFP from '../_lib/convertToFP/index'
var isSameDay = convertToFP(fn, 2)
export default isSameDay
| {
"pile_set_name": "Github"
} |
import { log } from "../../../lib";
import { Assignment, r, cacheableData } from "../../models";
import { assignmentRequiredOrAdminRole } from "../errors";
export const releaseContacts = async (
_,
{ assignmentId, releaseConversations },
{ user }
) => {
/* This releases contacts for an assignment, needsMessage by-default, and all if releaseConversations=true */
const assignment = await r
.knex("assignment")
.where("id", assignmentId)
.first();
if (!assignment) {
return null;
}
const campaign = await cacheableData.campaign.load(assignment.campaign_id);
await assignmentRequiredOrAdminRole(
user,
campaign.organization_id,
assignmentId,
null,
assignment
);
let releaseQuery = r.knex("campaign_contact").where({
assignment_id: assignmentId,
campaign_id: assignment.campaign_id
});
if (!releaseConversations) {
releaseQuery = releaseQuery.where("message_status", "needsMessage");
} else {
assignment.allcontactscount = 0;
assignment.hascontacts = 0;
}
const updateCount = await releaseQuery.update("assignment_id", null);
if (updateCount) {
await cacheableData.campaign.incrCount(
assignment.campaign_id,
"assignedCount",
-updateCount
);
}
return {
...assignment,
contacts: [],
unmessagedcount: 0,
hasunmessaged: 0,
// hacky way to refresh apollo-client cache
maybeunrepliedcount: 0,
maybeallcontactscount: 0
};
};
| {
"pile_set_name": "Github"
} |
json.constituency constituency.name
if constituency.sitting_mp?
json.mp do
json.name constituency.mp_name
json.url constituency.mp_url
end
end
json.petitions petitions do |petition|
json.action petition.action
json.url petition_url(petition)
json.state petition.state
json.constituency_signature_count petition.constituency_signature_count
json.total_signature_count petition.signature_count
end
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>VSTS DemoGenerator: TemplatesGeneratorTool.ViewModel.QueryResponse.Child Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">VSTS DemoGenerator
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_templates_generator_tool.html">TemplatesGeneratorTool</a></li><li class="navelem"><a class="el" href="namespace_templates_generator_tool_1_1_view_model.html">ViewModel</a></li><li class="navelem"><a class="el" href="class_templates_generator_tool_1_1_view_model_1_1_query_response.html">QueryResponse</a></li><li class="navelem"><a class="el" href="class_templates_generator_tool_1_1_view_model_1_1_query_response_1_1_child.html">Child</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-attribs">Public Attributes</a> |
<a href="#properties">Properties</a> |
<a href="class_templates_generator_tool_1_1_view_model_1_1_query_response_1_1_child-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">TemplatesGeneratorTool.ViewModel.QueryResponse.Child Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:aee41d77c3d1806b2e48f3add0e603582"><td class="memItemLeft" align="right" valign="top"><a id="aee41d77c3d1806b2e48f3add0e603582"></a>
bool </td><td class="memItemRight" valign="bottom"><b>isFolder</b> = false</td></tr>
<tr class="separator:aee41d77c3d1806b2e48f3add0e603582"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a626352a01c278f914389c2c6cd11fe8a"><td class="memItemLeft" align="right" valign="top"><a id="a626352a01c278f914389c2c6cd11fe8a"></a>
bool </td><td class="memItemRight" valign="bottom"><b>hasChildren</b> = false</td></tr>
<tr class="separator:a626352a01c278f914389c2c6cd11fe8a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5fed7d29046d2ae590e419302c987145"><td class="memItemLeft" align="right" valign="top"><a id="a5fed7d29046d2ae590e419302c987145"></a>
string </td><td class="memItemRight" valign="bottom"><b>wiql</b> = ""</td></tr>
<tr class="separator:a5fed7d29046d2ae590e419302c987145"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a>
Properties</h2></td></tr>
<tr class="memitem:adb65202ae8873a8a98349c9a24db0946"><td class="memItemLeft" align="right" valign="top"><a id="adb65202ae8873a8a98349c9a24db0946"></a>
string </td><td class="memItemRight" valign="bottom"><b>id</b><code> [get, set]</code></td></tr>
<tr class="separator:adb65202ae8873a8a98349c9a24db0946"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a25dd3c0f09ca57f66c2bf96da5bf4b94"><td class="memItemLeft" align="right" valign="top"><a id="a25dd3c0f09ca57f66c2bf96da5bf4b94"></a>
string </td><td class="memItemRight" valign="bottom"><b>name</b><code> [get, set]</code></td></tr>
<tr class="separator:a25dd3c0f09ca57f66c2bf96da5bf4b94"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a00450b2f3e91fe01cc16e35351f383db"><td class="memItemLeft" align="right" valign="top"><a id="a00450b2f3e91fe01cc16e35351f383db"></a>
string </td><td class="memItemRight" valign="bottom"><b>path</b><code> [get, set]</code></td></tr>
<tr class="separator:a00450b2f3e91fe01cc16e35351f383db"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a71a2f1bfa2ca4fbb1db8d80ea926fa51"><td class="memItemLeft" align="right" valign="top"><a id="a71a2f1bfa2ca4fbb1db8d80ea926fa51"></a>
bool </td><td class="memItemRight" valign="bottom"><b>isPublic</b><code> [get, set]</code></td></tr>
<tr class="separator:a71a2f1bfa2ca4fbb1db8d80ea926fa51"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af79dc7f21b430e2071f946525a1145b4"><td class="memItemLeft" align="right" valign="top"><a id="af79dc7f21b430e2071f946525a1145b4"></a>
<a class="el" href="class_templates_generator_tool_1_1_view_model_1_1_query_response_1_1_links.html">Links</a> </td><td class="memItemRight" valign="bottom"><b>_links</b><code> [get, set]</code></td></tr>
<tr class="separator:af79dc7f21b430e2071f946525a1145b4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa6cba0bafbacd97e0f45a4b0b2e8b717"><td class="memItemLeft" align="right" valign="top"><a id="aa6cba0bafbacd97e0f45a4b0b2e8b717"></a>
string </td><td class="memItemRight" valign="bottom"><b>url</b><code> [get, set]</code></td></tr>
<tr class="separator:aa6cba0bafbacd97e0f45a4b0b2e8b717"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aaf85db08ff26dd26421f13b312c426e9"><td class="memItemLeft" align="right" valign="top"><a id="aaf85db08ff26dd26421f13b312c426e9"></a>
IList< <a class="el" href="class_templates_generator_tool_1_1_view_model_1_1_query_response_1_1_child.html">Child</a> > </td><td class="memItemRight" valign="bottom"><b>children</b><code> [get, set]</code></td></tr>
<tr class="separator:aaf85db08ff26dd26421f13b312c426e9"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>D:/Canarys/Projects/DemoGeneratorOauth/ExportWorkitemsTool/ViewModel/QueryResponse.cs</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
| {
"pile_set_name": "Github"
} |
var convert = require('./convert'),
func = convert('differenceBy', require('../differenceBy'));
func.placeholder = require('./placeholder');
module.exports = func;
| {
"pile_set_name": "Github"
} |
set(classes
vtkClientServerCompositePass
vtkClientServerSynchronizedRenderers
vtkCompositedSynchronizedRenderers
vtkCompositer
vtkCompositeRenderManager
vtkCompositeRGBAPass
vtkCompositeZPass
vtkCompressCompositer
vtkImageRenderManager
vtkParallelRenderManager
vtkPHardwareSelector
vtkSynchronizedRenderers
vtkSynchronizedRenderWindows
vtkTreeCompositer)
set(shader_files
vtkCompositeZPassShader_fs.glsl
vtkCompositeZPassFS.glsl)
set(sources)
set(private_headers)
foreach (shader_file IN LISTS shader_files)
vtk_encode_string(
INPUT "${shader_file}"
EXPORT_SYMBOL "VTKRENDERINGPARALLEL_EXPORT"
EXPORT_HEADER "vtkRenderingParallelModule.h"
HEADER_OUTPUT header
SOURCE_OUTPUT source)
list(APPEND sources ${source})
list(APPEND private_headers ${header})
endforeach ()
vtk_module_add_module(VTK::RenderingParallel
CLASSES ${classes}
SOURCES ${sources}
PRIVATE_HEADERS ${private_headers})
vtk_module_definitions(VTK::RenderingParallel
PRIVATE
VTK_OPENGL2)
| {
"pile_set_name": "Github"
} |
gcr.io/google_containers/hyperkube-s390x:v1.18.7-rc.0
| {
"pile_set_name": "Github"
} |
import { StacheElement, type } from "//unpkg.com/can@6/core.mjs";
const proxyUrl = "https://can-cors.herokuapp.com/";
const token = "?key=piRYHjJ5D2Am39C9MxduHgRZc&format=json";
const apiRoot = "http://www.ctabustracker.com/bustime/api/v2/";
const getRoutesEnpoint = apiRoot + "getroutes" + token;
const getVehiclesEndpoint = apiRoot + "getvehicles" + token;
class BusTracker extends StacheElement {
static view = `
<div class="top">
<div class="header">
<h1>{{this.title}}</h1>
{{# if(this.routesPromise.isPending) }}<p>Loading routes…</p>{{/ if }}
{{# if(this.vehiclesPromise.isPending) }}<p>Loading vehicles…</p>{{/ if }}
</div>
<ul class="routes-list">
{{# for(route of this.routesPromise.value) }}
<li on:click="this.pickRoute(route)" {{# eq(route, this.route) }}class="active"{{/ eq }}>
<span class="route-number">{{ route.rt }}</span>
<span class="route-name">{{ route.rtnm }}</span>
<span class="check">✔</span>
</li>
{{/ for }}
</ul>
</div>
<div class="bottom">
{{# if(this.route) }}
<div class="route-selected">
<small>Route {{ this.route.rt }}:</small> {{ this.route.rtnm }}
{{# if(this.vehiclesPromise.isRejected) }}
<div class="error-message">No vehicles available for this route</div>
{{/ if }}
</div>
{{/ if }}
<div class="gmap">Bus count: {{ this.vehiclesPromise.value.length }}</div>
</div>
`;
static props = {
title: {
default: "Chicago CTA Bus Tracker"
},
routesPromise: {
get default() {
return fetch(proxyUrl + getRoutesEnpoint)
.then(response => response.json())
.then(data => data["bustime-response"].routes);
}
},
route: type.Any,
vehiclesPromise: type.Any
};
pickRoute(route) {
this.route = route;
this.vehiclesPromise = fetch(
proxyUrl + getVehiclesEndpoint + "&rt=" + route.rt
)
.then(response => response.json())
.then(data => {
if (data["bustime-response"].error) {
return Promise.reject(data["bustime-response"].error[0]);
} else {
return data["bustime-response"].vehicle;
}
});
}
}
customElements.define("bus-tracker", BusTracker);
| {
"pile_set_name": "Github"
} |
<?php
/*
* Copyright 2014 Google Inc.
*
* 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.
*/
class Google_Service_Compute_LicenseResourceRequirements extends Google_Model
{
public $minGuestCpuCount;
public $minMemoryMb;
public function setMinGuestCpuCount($minGuestCpuCount)
{
$this->minGuestCpuCount = $minGuestCpuCount;
}
public function getMinGuestCpuCount()
{
return $this->minGuestCpuCount;
}
public function setMinMemoryMb($minMemoryMb)
{
$this->minMemoryMb = $minMemoryMb;
}
public function getMinMemoryMb()
{
return $this->minMemoryMb;
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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.
*/
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2008.12.08 at 05:45:20 PM CST
//
package org.keycloak.dom.saml.v2.ac;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import java.math.BigInteger;
/**
* <p>
* Java class for ActivationLimitUsagesType complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ActivationLimitUsagesType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="number" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ActivationLimitUsagesType")
public class ActivationLimitUsagesType {
@XmlAttribute(required = true)
protected BigInteger number;
/**
* Gets the value of the number property.
*
* @return possible object is {@link BigInteger }
*/
public BigInteger getNumber() {
return number;
}
/**
* Sets the value of the number property.
*
* @param value allowed object is {@link BigInteger }
*/
public void setNumber(BigInteger value) {
this.number = value;
}
}
| {
"pile_set_name": "Github"
} |
/*
* Datapath implementation for ST-Ericsson CW1200 mac80211 drivers
*
* Copyright (c) 2010, ST-Ericsson
* Author: Dmitry Tarnyagin <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <net/mac80211.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include "cw1200.h"
#include "wsm.h"
#include "bh.h"
#include "sta.h"
#include "debug.h"
#define CW1200_INVALID_RATE_ID (0xFF)
static int cw1200_handle_action_rx(struct cw1200_common *priv,
struct sk_buff *skb);
static const struct ieee80211_rate *
cw1200_get_tx_rate(const struct cw1200_common *priv,
const struct ieee80211_tx_rate *rate);
/* ******************************************************************** */
/* TX queue lock / unlock */
static inline void cw1200_tx_queues_lock(struct cw1200_common *priv)
{
int i;
for (i = 0; i < 4; ++i)
cw1200_queue_lock(&priv->tx_queue[i]);
}
static inline void cw1200_tx_queues_unlock(struct cw1200_common *priv)
{
int i;
for (i = 0; i < 4; ++i)
cw1200_queue_unlock(&priv->tx_queue[i]);
}
/* ******************************************************************** */
/* TX policy cache implementation */
static void tx_policy_dump(struct tx_policy *policy)
{
pr_debug("[TX policy] %.1X%.1X%.1X%.1X%.1X%.1X%.1X%.1X %.1X%.1X%.1X%.1X%.1X%.1X%.1X%.1X %.1X%.1X%.1X%.1X%.1X%.1X%.1X%.1X: %d\n",
policy->raw[0] & 0x0F, policy->raw[0] >> 4,
policy->raw[1] & 0x0F, policy->raw[1] >> 4,
policy->raw[2] & 0x0F, policy->raw[2] >> 4,
policy->raw[3] & 0x0F, policy->raw[3] >> 4,
policy->raw[4] & 0x0F, policy->raw[4] >> 4,
policy->raw[5] & 0x0F, policy->raw[5] >> 4,
policy->raw[6] & 0x0F, policy->raw[6] >> 4,
policy->raw[7] & 0x0F, policy->raw[7] >> 4,
policy->raw[8] & 0x0F, policy->raw[8] >> 4,
policy->raw[9] & 0x0F, policy->raw[9] >> 4,
policy->raw[10] & 0x0F, policy->raw[10] >> 4,
policy->raw[11] & 0x0F, policy->raw[11] >> 4,
policy->defined);
}
static void tx_policy_build(const struct cw1200_common *priv,
/* [out] */ struct tx_policy *policy,
struct ieee80211_tx_rate *rates, size_t count)
{
int i, j;
unsigned limit = priv->short_frame_max_tx_count;
unsigned total = 0;
BUG_ON(rates[0].idx < 0);
memset(policy, 0, sizeof(*policy));
/* Sort rates in descending order. */
for (i = 1; i < count; ++i) {
if (rates[i].idx < 0) {
count = i;
break;
}
if (rates[i].idx > rates[i - 1].idx) {
struct ieee80211_tx_rate tmp = rates[i - 1];
rates[i - 1] = rates[i];
rates[i] = tmp;
}
}
/* Eliminate duplicates. */
total = rates[0].count;
for (i = 0, j = 1; j < count; ++j) {
if (rates[j].idx == rates[i].idx) {
rates[i].count += rates[j].count;
} else if (rates[j].idx > rates[i].idx) {
break;
} else {
++i;
if (i != j)
rates[i] = rates[j];
}
total += rates[j].count;
}
count = i + 1;
/* Re-fill policy trying to keep every requested rate and with
* respect to the global max tx retransmission count.
*/
if (limit < count)
limit = count;
if (total > limit) {
for (i = 0; i < count; ++i) {
int left = count - i - 1;
if (rates[i].count > limit - left)
rates[i].count = limit - left;
limit -= rates[i].count;
}
}
/* HACK!!! Device has problems (at least) switching from
* 54Mbps CTS to 1Mbps. This switch takes enormous amount
* of time (100-200 ms), leading to valuable throughput drop.
* As a workaround, additional g-rates are injected to the
* policy.
*/
if (count == 2 && !(rates[0].flags & IEEE80211_TX_RC_MCS) &&
rates[0].idx > 4 && rates[0].count > 2 &&
rates[1].idx < 2) {
int mid_rate = (rates[0].idx + 4) >> 1;
/* Decrease number of retries for the initial rate */
rates[0].count -= 2;
if (mid_rate != 4) {
/* Keep fallback rate at 1Mbps. */
rates[3] = rates[1];
/* Inject 1 transmission on lowest g-rate */
rates[2].idx = 4;
rates[2].count = 1;
rates[2].flags = rates[1].flags;
/* Inject 1 transmission on mid-rate */
rates[1].idx = mid_rate;
rates[1].count = 1;
/* Fallback to 1 Mbps is a really bad thing,
* so let's try to increase probability of
* successful transmission on the lowest g rate
* even more
*/
if (rates[0].count >= 3) {
--rates[0].count;
++rates[2].count;
}
/* Adjust amount of rates defined */
count += 2;
} else {
/* Keep fallback rate at 1Mbps. */
rates[2] = rates[1];
/* Inject 2 transmissions on lowest g-rate */
rates[1].idx = 4;
rates[1].count = 2;
/* Adjust amount of rates defined */
count += 1;
}
}
policy->defined = cw1200_get_tx_rate(priv, &rates[0])->hw_value + 1;
for (i = 0; i < count; ++i) {
register unsigned rateid, off, shift, retries;
rateid = cw1200_get_tx_rate(priv, &rates[i])->hw_value;
off = rateid >> 3; /* eq. rateid / 8 */
shift = (rateid & 0x07) << 2; /* eq. (rateid % 8) * 4 */
retries = rates[i].count;
if (retries > 0x0F) {
rates[i].count = 0x0f;
retries = 0x0F;
}
policy->tbl[off] |= __cpu_to_le32(retries << shift);
policy->retry_count += retries;
}
pr_debug("[TX policy] Policy (%zu): %d:%d, %d:%d, %d:%d, %d:%d\n",
count,
rates[0].idx, rates[0].count,
rates[1].idx, rates[1].count,
rates[2].idx, rates[2].count,
rates[3].idx, rates[3].count);
}
static inline bool tx_policy_is_equal(const struct tx_policy *wanted,
const struct tx_policy *cached)
{
size_t count = wanted->defined >> 1;
if (wanted->defined > cached->defined)
return false;
if (count) {
if (memcmp(wanted->raw, cached->raw, count))
return false;
}
if (wanted->defined & 1) {
if ((wanted->raw[count] & 0x0F) != (cached->raw[count] & 0x0F))
return false;
}
return true;
}
static int tx_policy_find(struct tx_policy_cache *cache,
const struct tx_policy *wanted)
{
/* O(n) complexity. Not so good, but there's only 8 entries in
* the cache.
* Also lru helps to reduce search time.
*/
struct tx_policy_cache_entry *it;
/* First search for policy in "used" list */
list_for_each_entry(it, &cache->used, link) {
if (tx_policy_is_equal(wanted, &it->policy))
return it - cache->cache;
}
/* Then - in "free list" */
list_for_each_entry(it, &cache->free, link) {
if (tx_policy_is_equal(wanted, &it->policy))
return it - cache->cache;
}
return -1;
}
static inline void tx_policy_use(struct tx_policy_cache *cache,
struct tx_policy_cache_entry *entry)
{
++entry->policy.usage_count;
list_move(&entry->link, &cache->used);
}
static inline int tx_policy_release(struct tx_policy_cache *cache,
struct tx_policy_cache_entry *entry)
{
int ret = --entry->policy.usage_count;
if (!ret)
list_move(&entry->link, &cache->free);
return ret;
}
void tx_policy_clean(struct cw1200_common *priv)
{
int idx, locked;
struct tx_policy_cache *cache = &priv->tx_policy_cache;
struct tx_policy_cache_entry *entry;
cw1200_tx_queues_lock(priv);
spin_lock_bh(&cache->lock);
locked = list_empty(&cache->free);
for (idx = 0; idx < TX_POLICY_CACHE_SIZE; idx++) {
entry = &cache->cache[idx];
/* Policy usage count should be 0 at this time as all queues
should be empty
*/
if (WARN_ON(entry->policy.usage_count)) {
entry->policy.usage_count = 0;
list_move(&entry->link, &cache->free);
}
memset(&entry->policy, 0, sizeof(entry->policy));
}
if (locked)
cw1200_tx_queues_unlock(priv);
cw1200_tx_queues_unlock(priv);
spin_unlock_bh(&cache->lock);
}
/* ******************************************************************** */
/* External TX policy cache API */
void tx_policy_init(struct cw1200_common *priv)
{
struct tx_policy_cache *cache = &priv->tx_policy_cache;
int i;
memset(cache, 0, sizeof(*cache));
spin_lock_init(&cache->lock);
INIT_LIST_HEAD(&cache->used);
INIT_LIST_HEAD(&cache->free);
for (i = 0; i < TX_POLICY_CACHE_SIZE; ++i)
list_add(&cache->cache[i].link, &cache->free);
}
static int tx_policy_get(struct cw1200_common *priv,
struct ieee80211_tx_rate *rates,
size_t count, bool *renew)
{
int idx;
struct tx_policy_cache *cache = &priv->tx_policy_cache;
struct tx_policy wanted;
tx_policy_build(priv, &wanted, rates, count);
spin_lock_bh(&cache->lock);
if (WARN_ON_ONCE(list_empty(&cache->free))) {
spin_unlock_bh(&cache->lock);
return CW1200_INVALID_RATE_ID;
}
idx = tx_policy_find(cache, &wanted);
if (idx >= 0) {
pr_debug("[TX policy] Used TX policy: %d\n", idx);
*renew = false;
} else {
struct tx_policy_cache_entry *entry;
*renew = true;
/* If policy is not found create a new one
* using the oldest entry in "free" list
*/
entry = list_entry(cache->free.prev,
struct tx_policy_cache_entry, link);
entry->policy = wanted;
idx = entry - cache->cache;
pr_debug("[TX policy] New TX policy: %d\n", idx);
tx_policy_dump(&entry->policy);
}
tx_policy_use(cache, &cache->cache[idx]);
if (list_empty(&cache->free)) {
/* Lock TX queues. */
cw1200_tx_queues_lock(priv);
}
spin_unlock_bh(&cache->lock);
return idx;
}
static void tx_policy_put(struct cw1200_common *priv, int idx)
{
int usage, locked;
struct tx_policy_cache *cache = &priv->tx_policy_cache;
spin_lock_bh(&cache->lock);
locked = list_empty(&cache->free);
usage = tx_policy_release(cache, &cache->cache[idx]);
if (locked && !usage) {
/* Unlock TX queues. */
cw1200_tx_queues_unlock(priv);
}
spin_unlock_bh(&cache->lock);
}
static int tx_policy_upload(struct cw1200_common *priv)
{
struct tx_policy_cache *cache = &priv->tx_policy_cache;
int i;
struct wsm_set_tx_rate_retry_policy arg = {
.num = 0,
};
spin_lock_bh(&cache->lock);
/* Upload only modified entries. */
for (i = 0; i < TX_POLICY_CACHE_SIZE; ++i) {
struct tx_policy *src = &cache->cache[i].policy;
if (src->retry_count && !src->uploaded) {
struct wsm_tx_rate_retry_policy *dst =
&arg.tbl[arg.num];
dst->index = i;
dst->short_retries = priv->short_frame_max_tx_count;
dst->long_retries = priv->long_frame_max_tx_count;
dst->flags = WSM_TX_RATE_POLICY_FLAG_TERMINATE_WHEN_FINISHED |
WSM_TX_RATE_POLICY_FLAG_COUNT_INITIAL_TRANSMIT;
memcpy(dst->rate_count_indices, src->tbl,
sizeof(dst->rate_count_indices));
src->uploaded = 1;
++arg.num;
}
}
spin_unlock_bh(&cache->lock);
cw1200_debug_tx_cache_miss(priv);
pr_debug("[TX policy] Upload %d policies\n", arg.num);
return wsm_set_tx_rate_retry_policy(priv, &arg);
}
void tx_policy_upload_work(struct work_struct *work)
{
struct cw1200_common *priv =
container_of(work, struct cw1200_common, tx_policy_upload_work);
pr_debug("[TX] TX policy upload.\n");
tx_policy_upload(priv);
wsm_unlock_tx(priv);
cw1200_tx_queues_unlock(priv);
}
/* ******************************************************************** */
/* cw1200 TX implementation */
struct cw1200_txinfo {
struct sk_buff *skb;
unsigned queue;
struct ieee80211_tx_info *tx_info;
const struct ieee80211_rate *rate;
struct ieee80211_hdr *hdr;
size_t hdrlen;
const u8 *da;
struct cw1200_sta_priv *sta_priv;
struct ieee80211_sta *sta;
struct cw1200_txpriv txpriv;
};
u32 cw1200_rate_mask_to_wsm(struct cw1200_common *priv, u32 rates)
{
u32 ret = 0;
int i;
for (i = 0; i < 32; ++i) {
if (rates & BIT(i))
ret |= BIT(priv->rates[i].hw_value);
}
return ret;
}
static const struct ieee80211_rate *
cw1200_get_tx_rate(const struct cw1200_common *priv,
const struct ieee80211_tx_rate *rate)
{
if (rate->idx < 0)
return NULL;
if (rate->flags & IEEE80211_TX_RC_MCS)
return &priv->mcs_rates[rate->idx];
return &priv->hw->wiphy->bands[priv->channel->band]->
bitrates[rate->idx];
}
static int
cw1200_tx_h_calc_link_ids(struct cw1200_common *priv,
struct cw1200_txinfo *t)
{
if (t->sta && t->sta_priv->link_id)
t->txpriv.raw_link_id =
t->txpriv.link_id =
t->sta_priv->link_id;
else if (priv->mode != NL80211_IFTYPE_AP)
t->txpriv.raw_link_id =
t->txpriv.link_id = 0;
else if (is_multicast_ether_addr(t->da)) {
if (priv->enable_beacon) {
t->txpriv.raw_link_id = 0;
t->txpriv.link_id = CW1200_LINK_ID_AFTER_DTIM;
} else {
t->txpriv.raw_link_id = 0;
t->txpriv.link_id = 0;
}
} else {
t->txpriv.link_id = cw1200_find_link_id(priv, t->da);
if (!t->txpriv.link_id)
t->txpriv.link_id = cw1200_alloc_link_id(priv, t->da);
if (!t->txpriv.link_id) {
wiphy_err(priv->hw->wiphy,
"No more link IDs available.\n");
return -ENOENT;
}
t->txpriv.raw_link_id = t->txpriv.link_id;
}
if (t->txpriv.raw_link_id)
priv->link_id_db[t->txpriv.raw_link_id - 1].timestamp =
jiffies;
if (t->sta && (t->sta->uapsd_queues & BIT(t->queue)))
t->txpriv.link_id = CW1200_LINK_ID_UAPSD;
return 0;
}
static void
cw1200_tx_h_pm(struct cw1200_common *priv,
struct cw1200_txinfo *t)
{
if (ieee80211_is_auth(t->hdr->frame_control)) {
u32 mask = ~BIT(t->txpriv.raw_link_id);
spin_lock_bh(&priv->ps_state_lock);
priv->sta_asleep_mask &= mask;
priv->pspoll_mask &= mask;
spin_unlock_bh(&priv->ps_state_lock);
}
}
static void
cw1200_tx_h_calc_tid(struct cw1200_common *priv,
struct cw1200_txinfo *t)
{
if (ieee80211_is_data_qos(t->hdr->frame_control)) {
u8 *qos = ieee80211_get_qos_ctl(t->hdr);
t->txpriv.tid = qos[0] & IEEE80211_QOS_CTL_TID_MASK;
} else if (ieee80211_is_data(t->hdr->frame_control)) {
t->txpriv.tid = 0;
}
}
static int
cw1200_tx_h_crypt(struct cw1200_common *priv,
struct cw1200_txinfo *t)
{
if (!t->tx_info->control.hw_key ||
!ieee80211_has_protected(t->hdr->frame_control))
return 0;
t->hdrlen += t->tx_info->control.hw_key->iv_len;
skb_put(t->skb, t->tx_info->control.hw_key->icv_len);
if (t->tx_info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP)
skb_put(t->skb, 8); /* MIC space */
return 0;
}
static int
cw1200_tx_h_align(struct cw1200_common *priv,
struct cw1200_txinfo *t,
u8 *flags)
{
size_t offset = (size_t)t->skb->data & 3;
if (!offset)
return 0;
if (offset & 1) {
wiphy_err(priv->hw->wiphy,
"Bug: attempt to transmit a frame with wrong alignment: %zu\n",
offset);
return -EINVAL;
}
if (skb_headroom(t->skb) < offset) {
wiphy_err(priv->hw->wiphy,
"Bug: no space allocated for DMA alignment. headroom: %d\n",
skb_headroom(t->skb));
return -ENOMEM;
}
skb_push(t->skb, offset);
t->hdrlen += offset;
t->txpriv.offset += offset;
*flags |= WSM_TX_2BYTES_SHIFT;
cw1200_debug_tx_align(priv);
return 0;
}
static int
cw1200_tx_h_action(struct cw1200_common *priv,
struct cw1200_txinfo *t)
{
struct ieee80211_mgmt *mgmt =
(struct ieee80211_mgmt *)t->hdr;
if (ieee80211_is_action(t->hdr->frame_control) &&
mgmt->u.action.category == WLAN_CATEGORY_BACK)
return 1;
else
return 0;
}
/* Add WSM header */
static struct wsm_tx *
cw1200_tx_h_wsm(struct cw1200_common *priv,
struct cw1200_txinfo *t)
{
struct wsm_tx *wsm;
if (skb_headroom(t->skb) < sizeof(struct wsm_tx)) {
wiphy_err(priv->hw->wiphy,
"Bug: no space allocated for WSM header. headroom: %d\n",
skb_headroom(t->skb));
return NULL;
}
wsm = skb_push(t->skb, sizeof(struct wsm_tx));
t->txpriv.offset += sizeof(struct wsm_tx);
memset(wsm, 0, sizeof(*wsm));
wsm->hdr.len = __cpu_to_le16(t->skb->len);
wsm->hdr.id = __cpu_to_le16(0x0004);
wsm->queue_id = wsm_queue_id_to_wsm(t->queue);
return wsm;
}
/* BT Coex specific handling */
static void
cw1200_tx_h_bt(struct cw1200_common *priv,
struct cw1200_txinfo *t,
struct wsm_tx *wsm)
{
u8 priority = 0;
if (!priv->bt_present)
return;
if (ieee80211_is_nullfunc(t->hdr->frame_control)) {
priority = WSM_EPTA_PRIORITY_MGT;
} else if (ieee80211_is_data(t->hdr->frame_control)) {
/* Skip LLC SNAP header (+6) */
u8 *payload = &t->skb->data[t->hdrlen];
__be16 *ethertype = (__be16 *)&payload[6];
if (be16_to_cpu(*ethertype) == ETH_P_PAE)
priority = WSM_EPTA_PRIORITY_EAPOL;
} else if (ieee80211_is_assoc_req(t->hdr->frame_control) ||
ieee80211_is_reassoc_req(t->hdr->frame_control)) {
struct ieee80211_mgmt *mgt_frame =
(struct ieee80211_mgmt *)t->hdr;
if (le16_to_cpu(mgt_frame->u.assoc_req.listen_interval) <
priv->listen_interval) {
pr_debug("Modified Listen Interval to %d from %d\n",
priv->listen_interval,
mgt_frame->u.assoc_req.listen_interval);
/* Replace listen interval derieved from
* the one read from SDD
*/
mgt_frame->u.assoc_req.listen_interval = cpu_to_le16(priv->listen_interval);
}
}
if (!priority) {
if (ieee80211_is_action(t->hdr->frame_control))
priority = WSM_EPTA_PRIORITY_ACTION;
else if (ieee80211_is_mgmt(t->hdr->frame_control))
priority = WSM_EPTA_PRIORITY_MGT;
else if ((wsm->queue_id == WSM_QUEUE_VOICE))
priority = WSM_EPTA_PRIORITY_VOICE;
else if ((wsm->queue_id == WSM_QUEUE_VIDEO))
priority = WSM_EPTA_PRIORITY_VIDEO;
else
priority = WSM_EPTA_PRIORITY_DATA;
}
pr_debug("[TX] EPTA priority %d.\n", priority);
wsm->flags |= priority << 1;
}
static int
cw1200_tx_h_rate_policy(struct cw1200_common *priv,
struct cw1200_txinfo *t,
struct wsm_tx *wsm)
{
bool tx_policy_renew = false;
t->txpriv.rate_id = tx_policy_get(priv,
t->tx_info->control.rates, IEEE80211_TX_MAX_RATES,
&tx_policy_renew);
if (t->txpriv.rate_id == CW1200_INVALID_RATE_ID)
return -EFAULT;
wsm->flags |= t->txpriv.rate_id << 4;
t->rate = cw1200_get_tx_rate(priv,
&t->tx_info->control.rates[0]),
wsm->max_tx_rate = t->rate->hw_value;
if (t->rate->flags & IEEE80211_TX_RC_MCS) {
if (cw1200_ht_greenfield(&priv->ht_info))
wsm->ht_tx_parameters |=
__cpu_to_le32(WSM_HT_TX_GREENFIELD);
else
wsm->ht_tx_parameters |=
__cpu_to_le32(WSM_HT_TX_MIXED);
}
if (tx_policy_renew) {
pr_debug("[TX] TX policy renew.\n");
/* It's not so optimal to stop TX queues every now and then.
* Better to reimplement task scheduling with
* a counter. TODO.
*/
wsm_lock_tx_async(priv);
cw1200_tx_queues_lock(priv);
if (queue_work(priv->workqueue,
&priv->tx_policy_upload_work) <= 0) {
cw1200_tx_queues_unlock(priv);
wsm_unlock_tx(priv);
}
}
return 0;
}
static bool
cw1200_tx_h_pm_state(struct cw1200_common *priv,
struct cw1200_txinfo *t)
{
int was_buffered = 1;
if (t->txpriv.link_id == CW1200_LINK_ID_AFTER_DTIM &&
!priv->buffered_multicasts) {
priv->buffered_multicasts = true;
if (priv->sta_asleep_mask)
queue_work(priv->workqueue,
&priv->multicast_start_work);
}
if (t->txpriv.raw_link_id && t->txpriv.tid < CW1200_MAX_TID)
was_buffered = priv->link_id_db[t->txpriv.raw_link_id - 1].buffered[t->txpriv.tid]++;
return !was_buffered;
}
/* ******************************************************************** */
void cw1200_tx(struct ieee80211_hw *dev,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct cw1200_common *priv = dev->priv;
struct cw1200_txinfo t = {
.skb = skb,
.queue = skb_get_queue_mapping(skb),
.tx_info = IEEE80211_SKB_CB(skb),
.hdr = (struct ieee80211_hdr *)skb->data,
.txpriv.tid = CW1200_MAX_TID,
.txpriv.rate_id = CW1200_INVALID_RATE_ID,
};
struct ieee80211_sta *sta;
struct wsm_tx *wsm;
bool tid_update = 0;
u8 flags = 0;
int ret;
if (priv->bh_error)
goto drop;
t.hdrlen = ieee80211_hdrlen(t.hdr->frame_control);
t.da = ieee80211_get_DA(t.hdr);
if (control) {
t.sta = control->sta;
t.sta_priv = (struct cw1200_sta_priv *)&t.sta->drv_priv;
}
if (WARN_ON(t.queue >= 4))
goto drop;
ret = cw1200_tx_h_calc_link_ids(priv, &t);
if (ret)
goto drop;
pr_debug("[TX] TX %d bytes (queue: %d, link_id: %d (%d)).\n",
skb->len, t.queue, t.txpriv.link_id,
t.txpriv.raw_link_id);
cw1200_tx_h_pm(priv, &t);
cw1200_tx_h_calc_tid(priv, &t);
ret = cw1200_tx_h_crypt(priv, &t);
if (ret)
goto drop;
ret = cw1200_tx_h_align(priv, &t, &flags);
if (ret)
goto drop;
ret = cw1200_tx_h_action(priv, &t);
if (ret)
goto drop;
wsm = cw1200_tx_h_wsm(priv, &t);
if (!wsm) {
ret = -ENOMEM;
goto drop;
}
wsm->flags |= flags;
cw1200_tx_h_bt(priv, &t, wsm);
ret = cw1200_tx_h_rate_policy(priv, &t, wsm);
if (ret)
goto drop;
rcu_read_lock();
sta = rcu_dereference(t.sta);
spin_lock_bh(&priv->ps_state_lock);
{
tid_update = cw1200_tx_h_pm_state(priv, &t);
BUG_ON(cw1200_queue_put(&priv->tx_queue[t.queue],
t.skb, &t.txpriv));
}
spin_unlock_bh(&priv->ps_state_lock);
if (tid_update && sta)
ieee80211_sta_set_buffered(sta, t.txpriv.tid, true);
rcu_read_unlock();
cw1200_bh_wakeup(priv);
return;
drop:
cw1200_skb_dtor(priv, skb, &t.txpriv);
return;
}
/* ******************************************************************** */
static int cw1200_handle_action_rx(struct cw1200_common *priv,
struct sk_buff *skb)
{
struct ieee80211_mgmt *mgmt = (void *)skb->data;
/* Filter block ACK negotiation: fully controlled by firmware */
if (mgmt->u.action.category == WLAN_CATEGORY_BACK)
return 1;
return 0;
}
static int cw1200_handle_pspoll(struct cw1200_common *priv,
struct sk_buff *skb)
{
struct ieee80211_sta *sta;
struct ieee80211_pspoll *pspoll = (struct ieee80211_pspoll *)skb->data;
int link_id = 0;
u32 pspoll_mask = 0;
int drop = 1;
int i;
if (priv->join_status != CW1200_JOIN_STATUS_AP)
goto done;
if (memcmp(priv->vif->addr, pspoll->bssid, ETH_ALEN))
goto done;
rcu_read_lock();
sta = ieee80211_find_sta(priv->vif, pspoll->ta);
if (sta) {
struct cw1200_sta_priv *sta_priv;
sta_priv = (struct cw1200_sta_priv *)&sta->drv_priv;
link_id = sta_priv->link_id;
pspoll_mask = BIT(sta_priv->link_id);
}
rcu_read_unlock();
if (!link_id)
goto done;
priv->pspoll_mask |= pspoll_mask;
drop = 0;
/* Do not report pspols if data for given link id is queued already. */
for (i = 0; i < 4; ++i) {
if (cw1200_queue_get_num_queued(&priv->tx_queue[i],
pspoll_mask)) {
cw1200_bh_wakeup(priv);
drop = 1;
break;
}
}
pr_debug("[RX] PSPOLL: %s\n", drop ? "local" : "fwd");
done:
return drop;
}
/* ******************************************************************** */
void cw1200_tx_confirm_cb(struct cw1200_common *priv,
int link_id,
struct wsm_tx_confirm *arg)
{
u8 queue_id = cw1200_queue_get_queue_id(arg->packet_id);
struct cw1200_queue *queue = &priv->tx_queue[queue_id];
struct sk_buff *skb;
const struct cw1200_txpriv *txpriv;
pr_debug("[TX] TX confirm: %d, %d.\n",
arg->status, arg->ack_failures);
if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) {
/* STA is stopped. */
return;
}
if (WARN_ON(queue_id >= 4))
return;
if (arg->status)
pr_debug("TX failed: %d.\n", arg->status);
if ((arg->status == WSM_REQUEUE) &&
(arg->flags & WSM_TX_STATUS_REQUEUE)) {
/* "Requeue" means "implicit suspend" */
struct wsm_suspend_resume suspend = {
.link_id = link_id,
.stop = 1,
.multicast = !link_id,
};
cw1200_suspend_resume(priv, &suspend);
wiphy_warn(priv->hw->wiphy, "Requeue for link_id %d (try %d). STAs asleep: 0x%.8X\n",
link_id,
cw1200_queue_get_generation(arg->packet_id) + 1,
priv->sta_asleep_mask);
cw1200_queue_requeue(queue, arg->packet_id);
spin_lock_bh(&priv->ps_state_lock);
if (!link_id) {
priv->buffered_multicasts = true;
if (priv->sta_asleep_mask) {
queue_work(priv->workqueue,
&priv->multicast_start_work);
}
}
spin_unlock_bh(&priv->ps_state_lock);
} else if (!cw1200_queue_get_skb(queue, arg->packet_id,
&skb, &txpriv)) {
struct ieee80211_tx_info *tx = IEEE80211_SKB_CB(skb);
int tx_count = arg->ack_failures;
u8 ht_flags = 0;
int i;
if (cw1200_ht_greenfield(&priv->ht_info))
ht_flags |= IEEE80211_TX_RC_GREEN_FIELD;
spin_lock(&priv->bss_loss_lock);
if (priv->bss_loss_state &&
arg->packet_id == priv->bss_loss_confirm_id) {
if (arg->status) {
/* Recovery failed */
__cw1200_cqm_bssloss_sm(priv, 0, 0, 1);
} else {
/* Recovery succeeded */
__cw1200_cqm_bssloss_sm(priv, 0, 1, 0);
}
}
spin_unlock(&priv->bss_loss_lock);
if (!arg->status) {
tx->flags |= IEEE80211_TX_STAT_ACK;
++tx_count;
cw1200_debug_txed(priv);
if (arg->flags & WSM_TX_STATUS_AGGREGATION) {
/* Do not report aggregation to mac80211:
* it confuses minstrel a lot.
*/
/* tx->flags |= IEEE80211_TX_STAT_AMPDU; */
cw1200_debug_txed_agg(priv);
}
} else {
if (tx_count)
++tx_count;
}
for (i = 0; i < IEEE80211_TX_MAX_RATES; ++i) {
if (tx->status.rates[i].count >= tx_count) {
tx->status.rates[i].count = tx_count;
break;
}
tx_count -= tx->status.rates[i].count;
if (tx->status.rates[i].flags & IEEE80211_TX_RC_MCS)
tx->status.rates[i].flags |= ht_flags;
}
for (++i; i < IEEE80211_TX_MAX_RATES; ++i) {
tx->status.rates[i].count = 0;
tx->status.rates[i].idx = -1;
}
/* Pull off any crypto trailers that we added on */
if (tx->control.hw_key) {
skb_trim(skb, skb->len - tx->control.hw_key->icv_len);
if (tx->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP)
skb_trim(skb, skb->len - 8); /* MIC space */
}
cw1200_queue_remove(queue, arg->packet_id);
}
/* XXX TODO: Only wake if there are pending transmits.. */
cw1200_bh_wakeup(priv);
}
static void cw1200_notify_buffered_tx(struct cw1200_common *priv,
struct sk_buff *skb, int link_id, int tid)
{
struct ieee80211_sta *sta;
struct ieee80211_hdr *hdr;
u8 *buffered;
u8 still_buffered = 0;
if (link_id && tid < CW1200_MAX_TID) {
buffered = priv->link_id_db
[link_id - 1].buffered;
spin_lock_bh(&priv->ps_state_lock);
if (!WARN_ON(!buffered[tid]))
still_buffered = --buffered[tid];
spin_unlock_bh(&priv->ps_state_lock);
if (!still_buffered && tid < CW1200_MAX_TID) {
hdr = (struct ieee80211_hdr *)skb->data;
rcu_read_lock();
sta = ieee80211_find_sta(priv->vif, hdr->addr1);
if (sta)
ieee80211_sta_set_buffered(sta, tid, false);
rcu_read_unlock();
}
}
}
void cw1200_skb_dtor(struct cw1200_common *priv,
struct sk_buff *skb,
const struct cw1200_txpriv *txpriv)
{
skb_pull(skb, txpriv->offset);
if (txpriv->rate_id != CW1200_INVALID_RATE_ID) {
cw1200_notify_buffered_tx(priv, skb,
txpriv->raw_link_id, txpriv->tid);
tx_policy_put(priv, txpriv->rate_id);
}
ieee80211_tx_status(priv->hw, skb);
}
void cw1200_rx_cb(struct cw1200_common *priv,
struct wsm_rx *arg,
int link_id,
struct sk_buff **skb_p)
{
struct sk_buff *skb = *skb_p;
struct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb);
struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data;
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
struct cw1200_link_entry *entry = NULL;
unsigned long grace_period;
bool early_data = false;
bool p2p = priv->vif && priv->vif->p2p;
size_t hdrlen;
hdr->flag = 0;
if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) {
/* STA is stopped. */
goto drop;
}
if (link_id && link_id <= CW1200_MAX_STA_IN_AP_MODE) {
entry = &priv->link_id_db[link_id - 1];
if (entry->status == CW1200_LINK_SOFT &&
ieee80211_is_data(frame->frame_control))
early_data = true;
entry->timestamp = jiffies;
} else if (p2p &&
ieee80211_is_action(frame->frame_control) &&
(mgmt->u.action.category == WLAN_CATEGORY_PUBLIC)) {
pr_debug("[RX] Going to MAP&RESET link ID\n");
WARN_ON(work_pending(&priv->linkid_reset_work));
memcpy(&priv->action_frame_sa[0],
ieee80211_get_SA(frame), ETH_ALEN);
priv->action_linkid = 0;
schedule_work(&priv->linkid_reset_work);
}
if (link_id && p2p &&
ieee80211_is_action(frame->frame_control) &&
(mgmt->u.action.category == WLAN_CATEGORY_PUBLIC)) {
/* Link ID already exists for the ACTION frame.
* Reset and Remap
*/
WARN_ON(work_pending(&priv->linkid_reset_work));
memcpy(&priv->action_frame_sa[0],
ieee80211_get_SA(frame), ETH_ALEN);
priv->action_linkid = link_id;
schedule_work(&priv->linkid_reset_work);
}
if (arg->status) {
if (arg->status == WSM_STATUS_MICFAILURE) {
pr_debug("[RX] MIC failure.\n");
hdr->flag |= RX_FLAG_MMIC_ERROR;
} else if (arg->status == WSM_STATUS_NO_KEY_FOUND) {
pr_debug("[RX] No key found.\n");
goto drop;
} else {
pr_debug("[RX] Receive failure: %d.\n",
arg->status);
goto drop;
}
}
if (skb->len < sizeof(struct ieee80211_pspoll)) {
wiphy_warn(priv->hw->wiphy, "Mailformed SDU rx'ed. Size is lesser than IEEE header.\n");
goto drop;
}
if (ieee80211_is_pspoll(frame->frame_control))
if (cw1200_handle_pspoll(priv, skb))
goto drop;
hdr->band = ((arg->channel_number & 0xff00) ||
(arg->channel_number > 14)) ?
NL80211_BAND_5GHZ : NL80211_BAND_2GHZ;
hdr->freq = ieee80211_channel_to_frequency(
arg->channel_number,
hdr->band);
if (arg->rx_rate >= 14) {
hdr->encoding = RX_ENC_HT;
hdr->rate_idx = arg->rx_rate - 14;
} else if (arg->rx_rate >= 4) {
hdr->rate_idx = arg->rx_rate - 2;
} else {
hdr->rate_idx = arg->rx_rate;
}
hdr->signal = (s8)arg->rcpi_rssi;
hdr->antenna = 0;
hdrlen = ieee80211_hdrlen(frame->frame_control);
if (WSM_RX_STATUS_ENCRYPTION(arg->flags)) {
size_t iv_len = 0, icv_len = 0;
hdr->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED;
/* Oops... There is no fast way to ask mac80211 about
* IV/ICV lengths. Even defineas are not exposed.
*/
switch (WSM_RX_STATUS_ENCRYPTION(arg->flags)) {
case WSM_RX_STATUS_WEP:
iv_len = 4 /* WEP_IV_LEN */;
icv_len = 4 /* WEP_ICV_LEN */;
break;
case WSM_RX_STATUS_TKIP:
iv_len = 8 /* TKIP_IV_LEN */;
icv_len = 4 /* TKIP_ICV_LEN */
+ 8 /*MICHAEL_MIC_LEN*/;
hdr->flag |= RX_FLAG_MMIC_STRIPPED;
break;
case WSM_RX_STATUS_AES:
iv_len = 8 /* CCMP_HDR_LEN */;
icv_len = 8 /* CCMP_MIC_LEN */;
break;
case WSM_RX_STATUS_WAPI:
iv_len = 18 /* WAPI_HDR_LEN */;
icv_len = 16 /* WAPI_MIC_LEN */;
break;
default:
pr_warn("Unknown encryption type %d\n",
WSM_RX_STATUS_ENCRYPTION(arg->flags));
goto drop;
}
/* Firmware strips ICV in case of MIC failure. */
if (arg->status == WSM_STATUS_MICFAILURE)
icv_len = 0;
if (skb->len < hdrlen + iv_len + icv_len) {
wiphy_warn(priv->hw->wiphy, "Malformed SDU rx'ed. Size is lesser than crypto headers.\n");
goto drop;
}
/* Remove IV, ICV and MIC */
skb_trim(skb, skb->len - icv_len);
memmove(skb->data + iv_len, skb->data, hdrlen);
skb_pull(skb, iv_len);
}
/* Remove TSF from the end of frame */
if (arg->flags & WSM_RX_STATUS_TSF_INCLUDED) {
memcpy(&hdr->mactime, skb->data + skb->len - 8, 8);
hdr->mactime = le64_to_cpu(hdr->mactime);
if (skb->len >= 8)
skb_trim(skb, skb->len - 8);
} else {
hdr->mactime = 0;
}
cw1200_debug_rxed(priv);
if (arg->flags & WSM_RX_STATUS_AGGREGATE)
cw1200_debug_rxed_agg(priv);
if (ieee80211_is_action(frame->frame_control) &&
(arg->flags & WSM_RX_STATUS_ADDRESS1)) {
if (cw1200_handle_action_rx(priv, skb))
return;
} else if (ieee80211_is_beacon(frame->frame_control) &&
!arg->status && priv->vif &&
ether_addr_equal(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid)) {
const u8 *tim_ie;
u8 *ies = ((struct ieee80211_mgmt *)
(skb->data))->u.beacon.variable;
size_t ies_len = skb->len - (ies - (u8 *)(skb->data));
tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies, ies_len);
if (tim_ie) {
struct ieee80211_tim_ie *tim =
(struct ieee80211_tim_ie *)&tim_ie[2];
if (priv->join_dtim_period != tim->dtim_period) {
priv->join_dtim_period = tim->dtim_period;
queue_work(priv->workqueue,
&priv->set_beacon_wakeup_period_work);
}
}
/* Disable beacon filter once we're associated... */
if (priv->disable_beacon_filter &&
(priv->vif->bss_conf.assoc ||
priv->vif->bss_conf.ibss_joined)) {
priv->disable_beacon_filter = false;
queue_work(priv->workqueue,
&priv->update_filtering_work);
}
}
/* Stay awake after frame is received to give
* userspace chance to react and acquire appropriate
* wakelock.
*/
if (ieee80211_is_auth(frame->frame_control))
grace_period = 5 * HZ;
else if (ieee80211_is_deauth(frame->frame_control))
grace_period = 5 * HZ;
else
grace_period = 1 * HZ;
cw1200_pm_stay_awake(&priv->pm_state, grace_period);
if (early_data) {
spin_lock_bh(&priv->ps_state_lock);
/* Double-check status with lock held */
if (entry->status == CW1200_LINK_SOFT)
skb_queue_tail(&entry->rx_queue, skb);
else
ieee80211_rx_irqsafe(priv->hw, skb);
spin_unlock_bh(&priv->ps_state_lock);
} else {
ieee80211_rx_irqsafe(priv->hw, skb);
}
*skb_p = NULL;
return;
drop:
/* TODO: update failure counters */
return;
}
/* ******************************************************************** */
/* Security */
int cw1200_alloc_key(struct cw1200_common *priv)
{
int idx;
idx = ffs(~priv->key_map) - 1;
if (idx < 0 || idx > WSM_KEY_MAX_INDEX)
return -1;
priv->key_map |= BIT(idx);
priv->keys[idx].index = idx;
return idx;
}
void cw1200_free_key(struct cw1200_common *priv, int idx)
{
BUG_ON(!(priv->key_map & BIT(idx)));
memset(&priv->keys[idx], 0, sizeof(priv->keys[idx]));
priv->key_map &= ~BIT(idx);
}
void cw1200_free_keys(struct cw1200_common *priv)
{
memset(&priv->keys, 0, sizeof(priv->keys));
priv->key_map = 0;
}
int cw1200_upload_keys(struct cw1200_common *priv)
{
int idx, ret = 0;
for (idx = 0; idx <= WSM_KEY_MAX_INDEX; ++idx)
if (priv->key_map & BIT(idx)) {
ret = wsm_add_key(priv, &priv->keys[idx]);
if (ret < 0)
break;
}
return ret;
}
/* Workaround for WFD test case 6.1.10 */
void cw1200_link_id_reset(struct work_struct *work)
{
struct cw1200_common *priv =
container_of(work, struct cw1200_common, linkid_reset_work);
int temp_linkid;
if (!priv->action_linkid) {
/* In GO mode we can receive ACTION frames without a linkID */
temp_linkid = cw1200_alloc_link_id(priv,
&priv->action_frame_sa[0]);
WARN_ON(!temp_linkid);
if (temp_linkid) {
/* Make sure we execute the WQ */
flush_workqueue(priv->workqueue);
/* Release the link ID */
spin_lock_bh(&priv->ps_state_lock);
priv->link_id_db[temp_linkid - 1].prev_status =
priv->link_id_db[temp_linkid - 1].status;
priv->link_id_db[temp_linkid - 1].status =
CW1200_LINK_RESET;
spin_unlock_bh(&priv->ps_state_lock);
wsm_lock_tx_async(priv);
if (queue_work(priv->workqueue,
&priv->link_id_work) <= 0)
wsm_unlock_tx(priv);
}
} else {
spin_lock_bh(&priv->ps_state_lock);
priv->link_id_db[priv->action_linkid - 1].prev_status =
priv->link_id_db[priv->action_linkid - 1].status;
priv->link_id_db[priv->action_linkid - 1].status =
CW1200_LINK_RESET_REMAP;
spin_unlock_bh(&priv->ps_state_lock);
wsm_lock_tx_async(priv);
if (queue_work(priv->workqueue, &priv->link_id_work) <= 0)
wsm_unlock_tx(priv);
flush_workqueue(priv->workqueue);
}
}
int cw1200_find_link_id(struct cw1200_common *priv, const u8 *mac)
{
int i, ret = 0;
spin_lock_bh(&priv->ps_state_lock);
for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) {
if (!memcmp(mac, priv->link_id_db[i].mac, ETH_ALEN) &&
priv->link_id_db[i].status) {
priv->link_id_db[i].timestamp = jiffies;
ret = i + 1;
break;
}
}
spin_unlock_bh(&priv->ps_state_lock);
return ret;
}
int cw1200_alloc_link_id(struct cw1200_common *priv, const u8 *mac)
{
int i, ret = 0;
unsigned long max_inactivity = 0;
unsigned long now = jiffies;
spin_lock_bh(&priv->ps_state_lock);
for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) {
if (!priv->link_id_db[i].status) {
ret = i + 1;
break;
} else if (priv->link_id_db[i].status != CW1200_LINK_HARD &&
!priv->tx_queue_stats.link_map_cache[i + 1]) {
unsigned long inactivity =
now - priv->link_id_db[i].timestamp;
if (inactivity < max_inactivity)
continue;
max_inactivity = inactivity;
ret = i + 1;
}
}
if (ret) {
struct cw1200_link_entry *entry = &priv->link_id_db[ret - 1];
pr_debug("[AP] STA added, link_id: %d\n", ret);
entry->status = CW1200_LINK_RESERVE;
memcpy(&entry->mac, mac, ETH_ALEN);
memset(&entry->buffered, 0, CW1200_MAX_TID);
skb_queue_head_init(&entry->rx_queue);
wsm_lock_tx_async(priv);
if (queue_work(priv->workqueue, &priv->link_id_work) <= 0)
wsm_unlock_tx(priv);
} else {
wiphy_info(priv->hw->wiphy,
"[AP] Early: no more link IDs available.\n");
}
spin_unlock_bh(&priv->ps_state_lock);
return ret;
}
void cw1200_link_id_work(struct work_struct *work)
{
struct cw1200_common *priv =
container_of(work, struct cw1200_common, link_id_work);
wsm_flush_tx(priv);
cw1200_link_id_gc_work(&priv->link_id_gc_work.work);
wsm_unlock_tx(priv);
}
void cw1200_link_id_gc_work(struct work_struct *work)
{
struct cw1200_common *priv =
container_of(work, struct cw1200_common, link_id_gc_work.work);
struct wsm_reset reset = {
.reset_statistics = false,
};
struct wsm_map_link map_link = {
.link_id = 0,
};
unsigned long now = jiffies;
unsigned long next_gc = -1;
long ttl;
bool need_reset;
u32 mask;
int i;
if (priv->join_status != CW1200_JOIN_STATUS_AP)
return;
wsm_lock_tx(priv);
spin_lock_bh(&priv->ps_state_lock);
for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) {
need_reset = false;
mask = BIT(i + 1);
if (priv->link_id_db[i].status == CW1200_LINK_RESERVE ||
(priv->link_id_db[i].status == CW1200_LINK_HARD &&
!(priv->link_id_map & mask))) {
if (priv->link_id_map & mask) {
priv->sta_asleep_mask &= ~mask;
priv->pspoll_mask &= ~mask;
need_reset = true;
}
priv->link_id_map |= mask;
if (priv->link_id_db[i].status != CW1200_LINK_HARD)
priv->link_id_db[i].status = CW1200_LINK_SOFT;
memcpy(map_link.mac_addr, priv->link_id_db[i].mac,
ETH_ALEN);
spin_unlock_bh(&priv->ps_state_lock);
if (need_reset) {
reset.link_id = i + 1;
wsm_reset(priv, &reset);
}
map_link.link_id = i + 1;
wsm_map_link(priv, &map_link);
next_gc = min(next_gc, CW1200_LINK_ID_GC_TIMEOUT);
spin_lock_bh(&priv->ps_state_lock);
} else if (priv->link_id_db[i].status == CW1200_LINK_SOFT) {
ttl = priv->link_id_db[i].timestamp - now +
CW1200_LINK_ID_GC_TIMEOUT;
if (ttl <= 0) {
need_reset = true;
priv->link_id_db[i].status = CW1200_LINK_OFF;
priv->link_id_map &= ~mask;
priv->sta_asleep_mask &= ~mask;
priv->pspoll_mask &= ~mask;
eth_zero_addr(map_link.mac_addr);
spin_unlock_bh(&priv->ps_state_lock);
reset.link_id = i + 1;
wsm_reset(priv, &reset);
spin_lock_bh(&priv->ps_state_lock);
} else {
next_gc = min_t(unsigned long, next_gc, ttl);
}
} else if (priv->link_id_db[i].status == CW1200_LINK_RESET ||
priv->link_id_db[i].status ==
CW1200_LINK_RESET_REMAP) {
int status = priv->link_id_db[i].status;
priv->link_id_db[i].status =
priv->link_id_db[i].prev_status;
priv->link_id_db[i].timestamp = now;
reset.link_id = i + 1;
spin_unlock_bh(&priv->ps_state_lock);
wsm_reset(priv, &reset);
if (status == CW1200_LINK_RESET_REMAP) {
memcpy(map_link.mac_addr,
priv->link_id_db[i].mac,
ETH_ALEN);
map_link.link_id = i + 1;
wsm_map_link(priv, &map_link);
next_gc = min(next_gc,
CW1200_LINK_ID_GC_TIMEOUT);
}
spin_lock_bh(&priv->ps_state_lock);
}
if (need_reset) {
skb_queue_purge(&priv->link_id_db[i].rx_queue);
pr_debug("[AP] STA removed, link_id: %d\n",
reset.link_id);
}
}
spin_unlock_bh(&priv->ps_state_lock);
if (next_gc != -1)
queue_delayed_work(priv->workqueue,
&priv->link_id_gc_work, next_gc);
wsm_unlock_tx(priv);
}
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[红双喜]@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
import React, { Component } from 'react'
import { graphql } from "gatsby"
import { Helmet } from "react-helmet"
import Docs from '../components/docs'
import '../stylesheets/style.scss'
import '../stylesheets/prism-dracula.css'
export default class DocTemplate extends Component {
render() {
const docsData = this.props.data.markdownRemark
return (
<React.Fragment>
<Helmet
title={docsData.frontmatter.title}
meta={[
{ name: 'description', content: docsData.frontmatter.title },
]}
>
<html lang="en" />
</Helmet>
<Docs docs={docsData} />
</React.Fragment>
)
}
}
export const pageQuery = graphql`
query {
markdownRemark(fileAbsolutePath: {ne: "docs/index.md"}) {
html
htmlAst
frontmatter {
language_tabs
title
footer
search
attachments {
publicURL
}
}
}
}
`
| {
"pile_set_name": "Github"
} |
Title: Adobe Reader 7.0.9
Date: 2007-01-10 22:43
Author: toy
Category: Apps
Slug: adobe-reader-709
无需多说,这是阅读 PDF 文档的最佳工具。Adobe Reader 7.0.9
主要是修正了一个安全问题。根据相关描述,该 bug
允许远端的攻击者注入任意的 JavaScript
到浏览器会话中。为了你的电脑安全,升级是必要的。
Download link:
[Adobe Reader
7.0.9](http://www.adobe.com/products/acrobat/readstep2_allversions_nojs2.html?option=full&platform=LINUX_.tar.gz&language=English)
| {
"pile_set_name": "Github"
} |
<?php
/*
* Copyright 2014 Google Inc.
*
* 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.
*/
class Google_Service_NetworkManagement_Policy extends Google_Collection
{
protected $collection_key = 'bindings';
protected $auditConfigsType = 'Google_Service_NetworkManagement_AuditConfig';
protected $auditConfigsDataType = 'array';
protected $bindingsType = 'Google_Service_NetworkManagement_Binding';
protected $bindingsDataType = 'array';
public $etag;
public $version;
/**
* @param Google_Service_NetworkManagement_AuditConfig
*/
public function setAuditConfigs($auditConfigs)
{
$this->auditConfigs = $auditConfigs;
}
/**
* @return Google_Service_NetworkManagement_AuditConfig
*/
public function getAuditConfigs()
{
return $this->auditConfigs;
}
/**
* @param Google_Service_NetworkManagement_Binding
*/
public function setBindings($bindings)
{
$this->bindings = $bindings;
}
/**
* @return Google_Service_NetworkManagement_Binding
*/
public function getBindings()
{
return $this->bindings;
}
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setVersion($version)
{
$this->version = $version;
}
public function getVersion()
{
return $this->version;
}
}
| {
"pile_set_name": "Github"
} |
//===--- DeprecatedHeadersCheck.cpp - clang-tidy---------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "DeprecatedHeadersCheck.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
#include <vector>
namespace clang {
namespace tidy {
namespace modernize {
namespace {
class IncludeModernizePPCallbacks : public PPCallbacks {
public:
explicit IncludeModernizePPCallbacks(ClangTidyCheck &Check,
LangOptions LangOpts);
void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
const Module *Imported,
SrcMgr::CharacteristicKind FileType) override;
private:
ClangTidyCheck &Check;
LangOptions LangOpts;
llvm::StringMap<std::string> CStyledHeaderToCxx;
llvm::StringSet<> DeleteHeaders;
};
} // namespace
void DeprecatedHeadersCheck::registerPPCallbacks(CompilerInstance &Compiler) {
if (this->getLangOpts().CPlusPlus) {
Compiler.getPreprocessor().addPPCallbacks(
::llvm::make_unique<IncludeModernizePPCallbacks>(*this,
this->getLangOpts()));
}
}
IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(ClangTidyCheck &Check,
LangOptions LangOpts)
: Check(Check), LangOpts(LangOpts) {
for (const auto &KeyValue :
std::vector<std::pair<llvm::StringRef, std::string>>(
{{"assert.h", "cassert"},
{"complex.h", "complex"},
{"ctype.h", "cctype"},
{"errno.h", "cerrno"},
{"float.h", "cfloat"},
{"limits.h", "climits"},
{"locale.h", "clocale"},
{"math.h", "cmath"},
{"setjmp.h", "csetjmp"},
{"signal.h", "csignal"},
{"stdarg.h", "cstdarg"},
{"stddef.h", "cstddef"},
{"stdio.h", "cstdio"},
{"stdlib.h", "cstdlib"},
{"string.h", "cstring"},
{"time.h", "ctime"},
{"wchar.h", "cwchar"},
{"wctype.h", "cwctype"}})) {
CStyledHeaderToCxx.insert(KeyValue);
}
// Add C++ 11 headers.
if (LangOpts.CPlusPlus11) {
for (const auto &KeyValue :
std::vector<std::pair<llvm::StringRef, std::string>>(
{{"fenv.h", "cfenv"},
{"stdint.h", "cstdint"},
{"inttypes.h", "cinttypes"},
{"tgmath.h", "ctgmath"},
{"uchar.h", "cuchar"}})) {
CStyledHeaderToCxx.insert(KeyValue);
}
}
for (const auto &Key :
std::vector<std::string>({"stdalign.h", "stdbool.h", "iso646.h"})) {
DeleteHeaders.insert(Key);
}
}
void IncludeModernizePPCallbacks::InclusionDirective(
SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName,
bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath, const Module *Imported,
SrcMgr::CharacteristicKind FileType) {
// FIXME: Take care of library symbols from the global namespace.
//
// Reasonable options for the check:
//
// 1. Insert std prefix for every such symbol occurrence.
// 2. Insert `using namespace std;` to the beginning of TU.
// 3. Do nothing and let the user deal with the migration himself.
if (CStyledHeaderToCxx.count(FileName) != 0) {
std::string Replacement =
(llvm::Twine("<") + CStyledHeaderToCxx[FileName] + ">").str();
Check.diag(FilenameRange.getBegin(), "inclusion of deprecated C++ header "
"'%0'; consider using '%1' instead")
<< FileName << CStyledHeaderToCxx[FileName]
<< FixItHint::CreateReplacement(FilenameRange.getAsRange(),
Replacement);
} else if (DeleteHeaders.count(FileName) != 0) {
Check.diag(FilenameRange.getBegin(),
"including '%0' has no effect in C++; consider removing it")
<< FileName << FixItHint::CreateRemoval(
SourceRange(HashLoc, FilenameRange.getEnd()));
}
}
} // namespace modernize
} // namespace tidy
} // namespace clang
| {
"pile_set_name": "Github"
} |
//===-- X86TargetObjectFile.cpp - X86 Object Info -------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "X86TargetObjectFile.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/Operator.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCValue.h"
using namespace llvm;
using namespace dwarf;
const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
// On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
// is an indirect pc-relative reference.
if ((Encoding & DW_EH_PE_indirect) && (Encoding & DW_EH_PE_pcrel)) {
const MCSymbol *Sym = TM.getSymbol(GV);
const MCExpr *Res =
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
const MCExpr *Four = MCConstantExpr::create(4, getContext());
return MCBinaryExpr::createAdd(Res, Four, getContext());
}
return TargetLoweringObjectFileMachO::getTTypeGlobalReference(
GV, Encoding, TM, MMI, Streamer);
}
MCSymbol *X86_64MachoTargetObjectFile::getCFIPersonalitySymbol(
const GlobalValue *GV, const TargetMachine &TM,
MachineModuleInfo *MMI) const {
return TM.getSymbol(GV);
}
const MCExpr *X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel(
const GlobalValue *GV, const MCSymbol *Sym, const MCValue &MV,
int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const {
// On Darwin/X86-64, we need to use foo@GOTPCREL+4 to access the got entry
// from a data section. In case there's an additional offset, then use
// foo@GOTPCREL+4+<offset>.
unsigned FinalOff = Offset+MV.getConstant()+4;
const MCExpr *Res =
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
const MCExpr *Off = MCConstantExpr::create(FinalOff, getContext());
return MCBinaryExpr::createAdd(Res, Off, getContext());
}
const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(
const MCSymbol *Sym) const {
return MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
}
void
X86FreeBSDTargetObjectFile::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
InitializeELF(TM.Options.UseInitArray);
}
void
X86FuchsiaTargetObjectFile::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
InitializeELF(TM.Options.UseInitArray);
}
void
X86LinuxNaClTargetObjectFile::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
InitializeELF(TM.Options.UseInitArray);
}
void X86SolarisTargetObjectFile::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
InitializeELF(TM.Options.UseInitArray);
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>7b22bb32-c867-45a7-ac53-5bda820db91c</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>Emgu.CV.Cuda</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bgsegm\*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Filters\*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Imgproc\*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Optflow\*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Features2d\*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Stereo\*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Objdetect\*.cs" />
<!-- Excluding the CUDA codec module, it is only compatible with cuda 6.5 and older -->
<Compile Include="$(MSBuildThisFileDirectory)Codec\*.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Legacy\*.cs" />
</ItemGroup>
</Project>
| {
"pile_set_name": "Github"
} |
#include <iostream>
#include <signal.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/prctl.h>
#include <unistd.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <string.h>
#include <pwd.h>
#include <pthread.h>
static const char * allowprocess[]={
"com.sec.android.app.keyguard",
"com.android.settings",
"com.sec.android.widgetapp.alarmwidget",
"com.sec.android.widgetapp.activeapplicationwidget",
"com.sec.android.provider.badge",
"com.sec.factory",
"org.simalliance.openmobileapi.service",
"android.process.acore",
"com.android.systemui",
"org.yrssf",
"com.sec.android.app.launcher",
"com.android.systemui",
"org.simalliance",
NULL
};
bool strhead(const char * s1,const char * s2){
const char * sp=s1;
const char * p2=s2;
while(*sp){
if((*sp)!=(*p2))return 0;
sp++;
p2++;
}
return 1;
}
void searchproc(){
DIR * dir;
const char ** ac;
struct dirent * ptr;
int i,pid,fd,num;
char path[PATH_MAX];
char pname[PATH_MAX];
char * pt;
dir=opendir("/proc");
while((ptr=readdir(dir))!=NULL){
pid=atoi(ptr->d_name);
if(pid<=1)continue;
sprintf(path,"/proc/%d/comm",pid);
fd=open(path,O_RDONLY);
read(fd,pname,PATH_MAX);
close(fd);
for(i=0;i<PATH_MAX;i++){
if(pname[i]=='\0')break;
if(pname[i]=='\n'){
pname[i]='\0';
break;
}
}
pt=pname;
num=0;
while(*pt){
if(*pt=='.')num++;
pt++;
}
if(num >= 2){
ac=allowprocess;
while(*ac){
if(strhead(*ac,pname))goto allowed;
ac++;
}
kill(pid,9);
}
allowed:
continue;
//std::cout<<pid<<":"<<pname<<std::endl;
}
closedir(dir);
}
void * killproc(void*){
while(1){
searchproc();
sleep(1);
}
}
void * crackDNS(void*){
while(1){
FILE * fd=fopen("/etc/hosts","w");
if(!fd){
sleep(20);
continue;
}
fprintf(fd,"127.0.0.1 localhost\n");
fprintf(fd,"::1 localhost ip6-localhost ip6-loopback\n");
fprintf(fd,"127.0.0.1 baidu.com\n");
fprintf(fd,"127.0.0.1 www.baidu.com\n");
fprintf(fd,"127.0.0.1 sougo.com\n");
fprintf(fd,"127.0.0.1 www.sougo.com\n");
fprintf(fd,"127.0.0.1 www.who.int\n");
fprintf(fd,"127.0.0.1 qq.com\n");
fprintf(fd,"127.0.0.1 www.renren.com\n");
fprintf(fd,"127.0.0.1 renren.com\n");
fprintf(fd,"127.0.0.1 www.samsung.com\n");
fclose(fd);
sleep(20);
}
}
const char pkconffilename[]="/data/system/packages.xml";
bool file_same(const char * fileName1,const char * fileName2){
FILE *f1,*f2;
char ch1,ch2;
if(((f1=fopen(fileName1,"r"))==0) || ((f2=fopen(fileName2,"r"))==0)){
return 0;
}
do{
ch1=fgetc(f1);
ch2=fgetc(f2);
if(ch1!=ch2){
return 0;
}
}while(ch1!=EOF || ch2!=EOF);
return 1;
}
void * lockpackageconf(void*){
int from,to;
char buf[1024]={0};
int res;
if(access("data/packages.xml",F_OK)!=0){
from= open(pkconffilename ,O_RDWR|O_CREAT|O_TRUNC,0666);
if(from==-1) return NULL;
to = open("data/packages.xml",O_RDWR|O_CREAT|O_TRUNC,0666);
if(to ==-1) return NULL;
while((res =read(from,buf,1024))>0){
write(to,buf,res);
}
close(from);
close(to);
}
while(1){
if(file_same("data/packages.xml",pkconffilename)){
sleep(2);
continue;
}
from = open("data/packages.xml",O_RDWR); if(from==-1){sleep(2);continue;}
to = open(pkconffilename ,O_RDWR); if(to ==-1){sleep(2);continue;}
while((res =read(from,buf,1024))>0){
write(to,buf,res);
}
close(to);
close(from);
sleep(2);
}
}
int main(){
system("rm -f /system/app/com.android.packageinstaller*");
//睿易通的看过来!
//设置敢卸载,蓝牙敢卸载,敢不敢把上面这个卸载掉?
//反正我敢
system("rm -f /system/app/com.android.bluetooth*");
//卸载蓝牙
system("rm -f /system/app/com.sec.android.fotaclient*");
//system("rm -f /system/app/com.android.settings*");
system("rm -f /system/app/com.sec.android.emergencymode.service*");
system("find /system/app "
"! -name AdvancedDisplay.apk "
"! -name ApplicationsProvider.apk "
"! -name BackupRestoreConfirmation.apk "
"! -name BasicDreams.apk "
"! -name Bluetooth.apk "
"! -name BluetoothExt.apk "
"! -name Calculator.apk "
"! -name Calendar.apk "
"! -name CalendarProvider.apk "
"! -name CellBroadcastReceiver.apk "
"! -name CertInstaller.apk "
"! -name ContactsProvider.apk "
"! -name DefaultContainerService.apk "
"! -name DeskClock.apk "
"! -name Development.apk "
"! -name DrmProvider.apk "
"! -name FusedLocation.apk "
"! -name Galaxy4.apk "
"! -name Gallery2.apk "
"! -name HoloSpiralWallpaper.apk "
"! -name HTMLViewer.apk "
"! -name InputDevices.apk "
"! -name KeyChain.apk "
"! -name LiveWallpapers.apk "
"! -name LiveWallpapersPicker.apk "
"! -name MagicSmokeWallpapers.apk "
"! -name MediaProvider.apk "
"! -name yrssf.apk "
"! -name NoiseField.apk "
"! -name OneTimeInitializer.apk "
"! -name PackageInstaller.apk "
"! -name PhaseBeam.apk "
"! -name PhotoTable.apk "
"! -name PicoTts.apk "
"! -name PinyinIME.apk "
"! -name Provision.apk "
"! -name SamsungServiceMode.apk "
"! -name Settings.apk "
"! -name SettingsProvider.apk "
"! -name SharedStorageBackup.apk "
"! -name Shell.apk "
"! -name SystemUI.apk "
"! -name TelephonyProvider.apk "
"! -name ThemeChooser.apk "
"! -name ThemeManager.apk "
"! -name UserDictionaryProvider.apk "
"! -name VisualizationWallpapers.apk "
"! -name VpnDialogs.apk "
"! -name WAPPushManager.apk "
"! -name webaudiores.apk "
" -maxdepth 1 -type f -exec rm -f {}"
);//不知道睿易从哪里弄来的这个
system("iptables -t nat -F");
system("iptables -t nat -X");
system("iptables -t mangle -F");
system("iptables -t mangle -X");
system("iptables -P INPUT ACCEPT");
system("iptables -P FORWARD ACCEPT");
system("iptables -P OUTPUT ACCEPT");
system("iptables -A OUTPUT -p tcp --sport 1216 -j ACCEPT");
system("iptables -A OUTPUT -p tcp --sport 1215 -j ACCEPT");
system("iptables -A OUTPUT -p tcp --dport 1216 -j ACCEPT");
system("iptables -A OUTPUT -p tcp --dport 1215 -j ACCEPT");
system("iptables -A OUTPUT -p udp --sport 1216 -j ACCEPT");
system("iptables -A OUTPUT -p udp --sport 1215 -j ACCEPT");
system("iptables -A OUTPUT -p udp --dport 1216 -j ACCEPT");
system("iptables -A OUTPUT -p udp --sport 1215 -j ACCEPT");
system("iptables -A OUTPUT -p udp --dport 123 -j ACCEPT");
system("iptables -A OUTPUT -p udp --sport 123 -j ACCEPT");
system("iptables -A OUTPUT -p udp --dport 53 -j ACCEPT");
system("iptables -A OUTPUT -p udp --sport 53 -j ACCEPT");
system("iptables -A OUTPUT -p icmp -j ACCEPT");
system("iptables -P INPUT ACCEPT");
system("iptables -P OUTPUT DROP");
system("chmod 000 /cache/recovery/command");
//让恢复出厂设置作废
signal(15,[](int){
return;
});
pthread_t newthread;
if(pthread_create(&newthread,NULL,killproc,NULL)!=0)
perror("pthread_create");
if(pthread_create(&newthread,NULL,lockpackageconf,NULL)!=0)
perror("pthread_create");
crackDNS(NULL);
} | {
"pile_set_name": "Github"
} |
# Terraria
## Minimum RAM warning
You may want to assign a minimum of 768 mb of RAM to a server as it will use around 650 mb to generate the world on the first start.
## Required Server Ports
tModloader, like Terraria, only requires a single port to run. The default is 7777
| Port | default |
|---------|---------|
| Game | 7777 |
#### Plugins may require ports to be added to the server.
| {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import main
| {
"pile_set_name": "Github"
} |
# ==============================================================================
# Copyright (c) 2016-2020 Proton Technologies AG (Switzerland)
# Email: [email protected]
#
# The MIT License (MIT)
#
# 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.
# ==============================================================================
client
dev tun
proto tcp
remote 103.212.227.126 443
remote 103.212.227.126 5995
remote 103.212.227.126 8443
remote-random
resolv-retry infinite
nobind
cipher AES-256-CBC
auth SHA512
compress
verb 3
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
reneg-sec 0
remote-cert-tls server
auth-user-pass /config/openvpn-credentials.txt
pull
fast-io
<ca>
-----BEGIN CERTIFICATE-----
MIIFozCCA4ugAwIBAgIBATANBgkqhkiG9w0BAQ0FADBAMQswCQYDVQQGEwJDSDEV
MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYDVQQDExFQcm90b25WUE4gUm9vdCBD
QTAeFw0xNzAyMTUxNDM4MDBaFw0yNzAyMTUxNDM4MDBaMEAxCzAJBgNVBAYTAkNI
MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxGjAYBgNVBAMTEVByb3RvblZQTiBSb290
IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAt+BsSsZg7+AuqTq7
vDbPzfygtl9f8fLJqO4amsyOXlI7pquL5IsEZhpWyJIIvYybqS4s1/T7BbvHPLVE
wlrq8A5DBIXcfuXrBbKoYkmpICGc2u1KYVGOZ9A+PH9z4Tr6OXFfXRnsbZToie8t
2Xjv/dZDdUDAqeW89I/mXg3k5x08m2nfGCQDm4gCanN1r5MT7ge56z0MkY3FFGCO
qRwspIEUzu1ZqGSTkG1eQiOYIrdOF5cc7n2APyvBIcfvp/W3cpTOEmEBJ7/14RnX
nHo0fcx61Inx/6ZxzKkW8BMdGGQF3tF6u2M0FjVN0lLH9S0ul1TgoOS56yEJ34hr
JSRTqHuar3t/xdCbKFZjyXFZFNsXVvgJu34CNLrHHTGJj9jiUfFnxWQYMo9UNUd4
a3PPG1HnbG7LAjlvj5JlJ5aqO5gshdnqb9uIQeR2CdzcCJgklwRGCyDT1pm7eoiv
WV19YBd81vKulLzgPavu3kRRe83yl29It2hwQ9FMs5w6ZV/X6ciTKo3etkX9nBD9
ZzJPsGQsBUy7CzO1jK4W01+u3ItmQS+1s4xtcFxdFY8o/q1zoqBlxpe5MQIWN6Qa
lryiET74gMHE/S5WrPlsq/gehxsdgc6GDUXG4dk8vn6OUMa6wb5wRO3VXGEc67IY
m4mDFTYiPvLaFOxtndlUWuCruKcCAwEAAaOBpzCBpDAMBgNVHRMEBTADAQH/MB0G
A1UdDgQWBBSDkIaYhLVZTwyLNTetNB2qV0gkVDBoBgNVHSMEYTBfgBSDkIaYhLVZ
TwyLNTetNB2qV0gkVKFEpEIwQDELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFByb3Rv
blZQTiBBRzEaMBgGA1UEAxMRUHJvdG9uVlBOIFJvb3QgQ0GCAQEwCwYDVR0PBAQD
AgEGMA0GCSqGSIb3DQEBDQUAA4ICAQCYr7LpvnfZXBCxVIVc2ea1fjxQ6vkTj0zM
htFs3qfeXpMRf+g1NAh4vv1UIwLsczilMt87SjpJ25pZPyS3O+/VlI9ceZMvtGXd
MGfXhTDp//zRoL1cbzSHee9tQlmEm1tKFxB0wfWd/inGRjZxpJCTQh8oc7CTziHZ
ufS+Jkfpc4Rasr31fl7mHhJahF1j/ka/OOWmFbiHBNjzmNWPQInJm+0ygFqij5qs
51OEvubR8yh5Mdq4TNuWhFuTxpqoJ87VKaSOx/Aefca44Etwcj4gHb7LThidw/ky
zysZiWjyrbfX/31RX7QanKiMk2RDtgZaWi/lMfsl5O+6E2lJ1vo4xv9pW8225B5X
eAeXHCfjV/vrrCFqeCprNF6a3Tn/LX6VNy3jbeC+167QagBOaoDA01XPOx7Odhsb
Gd7cJ5VkgyycZgLnT9zrChgwjx59JQosFEG1DsaAgHfpEl/N3YPJh68N7fwN41Cj
zsk39v6iZdfuet/sP7oiP5/gLmA/CIPNhdIYxaojbLjFPkftVjVPn49RqwqzJJPR
N8BOyb94yhQ7KO4F3IcLT/y/dsWitY0ZH4lCnAVV/v2YjWAWS3OWyC8BFx/Jmc3W
DK/yPwECUcPgHIeXiRjHnJt0Zcm23O2Q3RphpU+1SO3XixsXpOVOYP6rJIXW9bMZ
A1gTTlpi7A==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIFszCCA5ugAwIBAgIBBjANBgkqhkiG9w0BAQ0FADBAMQswCQYDVQQGEwJDSDEV
MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYDVQQDExFQcm90b25WUE4gUm9vdCBD
QTAeFw0xNzAyMTUxNTE3MDBaFw0yNzAyMTUxNDM4MDBaMEoxCzAJBgNVBAYTAkNI
MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxJDAiBgNVBAMTG1Byb3RvblZQTiBJbnRl
cm1lZGlhdGUgQ0EgMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANv3
uwQMFjYOx74taxadhczLbjCTuT73jMz09EqFNv7O7UesXfYJ6kQgYV9YyE86znP4
xbsswNUZYh+XdZUpOoP6Zu3tR/iiYiuzi6jVYrJ66G89nPqS2mm5dn8Fbb8CRWkJ
ygm8AdlYkDwYNldhDUrERlQdCRDGsYYg/98dded+5pXnSG8Y/+iuLM6/YYhkUVQe
Cfq1L6XguSwu8CuvJjIjjE1PptUHa3Hc3tGziVydltKynxWlqb1dJqinGKiBZvYn
oiV4motpFYwhc3Wd09JLPzeobhD2IAZ2evSatikMWDingEv1EJXpI+V/E2AK3xHK
Skhw+YZx99tNxCiOu3U5BFAreZR3j2YnZzX1nEv9p02IGaWzzYJPNED0zSO2w07u
thSmKcxA39VTvs91lptbcV7VTxoJY0SErHIeVS3Scrnr7WvoOTuu3M3SCRqe6oI9
oJZMOdfNsceBdvG+qlpOFICoBjO53W4BK8KahzTd/PWlBRiVJ3UVv8xXwUDA+o98
34DXVAobaAHXQtM9jNobqT98FXhZktjOQEA2UORL581ZPxfKeHLRcgWJ5dmPsDBG
y/L6/qW/yrm6DUDAdN5+q41+gSNEjNBjLBJQFUmDk3l6Qxiu0uEDQ98oFvGHk5US
2Kbj0OAq1RpiDjHci/536yua9rTC+cxekTM2asdXAgMBAAGjga0wgaowEgYDVR0T
AQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUJbaTWcIB4t5ETvvhUy5/yQqqGjMwaAYD
VR0jBGEwX4AUg5CGmIS1WU8MizU3rTQdqldIJFShRKRCMEAxCzAJBgNVBAYTAkNI
MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxGjAYBgNVBAMTEVByb3RvblZQTiBSb290
IENBggEBMAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQ0FAAOCAgEAAgZ/BIVl+DcK
OTVJJBy+RZ1E8os11gFaMKy12lAT1XEXDqLAnitvVyQgG5lPZKFQ2wzUR/TCrYKT
SUZWdYaJIXkRWAU0aCDZ2I81T0OMpg9aS7xdxgHCGWOwwes8GhjtvQad9GJ8mUZH
GyzfMaGG6fAZrgHnlOb4OIoqhBWYla6D2bpvbKgGkMo5NLAaX/7+U0HcxjjSS9vm
/3XHTZU4q77pn+lhPWncajnVyMtm1mIZxMioyckR4+scyZse0mYJS6xli/7crH7j
qScX7c5sWcaN4J63a3+x3uGvzOXjCyoDl9IaeqnxQpi8yc0nsWxIyDalR3uRQ9tJ
7l/eRxJZ/1Pzz2LRHSQZuqN2ZReWVNTqJ42af8cWWH0fDOEt2468GLeSm08Hvyz0
lRjn7Tf5hxOJSw4/3oGihvzuTdquJMOi62kThbp7DS3mMaZsfbmDoU3oNDv91bvL
57z8wm7yRcGEoMsUNnrOZ4SU8dG/souvJM1BDStMLprFEgUbHEY5MjSR4/PLR6j9
3NZgocfnfk80nBvNtgWVHxW019nuT93WL0/5L5g4UVm0Ay1V6pNkGZCmgNUBaRY4
2JLzyY8p48OKapR5GnedLTJXJVbdd9GUNzIzm4iVITDH3p/u1g69dITCNXTO9EO5
sGEYLNPbV49XBnVAm1tUWuoByZAjoWs=
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
# 2048 bit OpenVPN static key
-----BEGIN OpenVPN Static key V1-----
6acef03f62675b4b1bbd03e53b187727
423cea742242106cb2916a8a4c829756
3d22c7e5cef430b1103c6f66eb1fc5b3
75a672f158e2e2e936c3faa48b035a6d
e17beaac23b5f03b10b868d53d03521d
8ba115059da777a60cbfd7b2c9c57472
78a15b8f6e68a3ef7fd583ec9f398c8b
d4735dab40cbd1e3c62a822e97489186
c30a0b48c7c38ea32ceb056d3fa5a710
e10ccc7a0ddb363b08c3d2777a3395e1
0c0b6080f56309192ab5aacd4b45f55d
a61fc77af39bd81a19218a79762c3386
2df55785075f37d8c71dc8a42097ee43
344739a0dd48d03025b0450cf1fb5e8c
aeb893d9a96d1f15519bb3c4dcb40ee3
16672ea16c012664f8a9f11255518deb
-----END OpenVPN Static key V1-----
</tls-auth>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/header_base_func"/>
<com.zhuangfei.timetable.TimetableView
android:id="@+id/id_timetableView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_white">
</com.zhuangfei.timetable.TimetableView>
</LinearLayout>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_NOTIFIER_H_
#define API_NOTIFIER_H_
#include <list>
#include "api/media_stream_interface.h"
#include "rtc_base/checks.h"
namespace webrtc {
// Implements a template version of a notifier.
// TODO(deadbeef): This is an implementation detail; move out of api/.
template <class T>
class Notifier : public T {
public:
Notifier() {}
virtual void RegisterObserver(ObserverInterface* observer) {
RTC_DCHECK(observer != nullptr);
observers_.push_back(observer);
}
virtual void UnregisterObserver(ObserverInterface* observer) {
for (std::list<ObserverInterface*>::iterator it = observers_.begin();
it != observers_.end(); it++) {
if (*it == observer) {
observers_.erase(it);
break;
}
}
}
void FireOnChanged() {
// Copy the list of observers to avoid a crash if the observer object
// unregisters as a result of the OnChanged() call. If the same list is used
// UnregisterObserver will affect the list make the iterator invalid.
std::list<ObserverInterface*> observers = observers_;
for (std::list<ObserverInterface*>::iterator it = observers.begin();
it != observers.end(); ++it) {
(*it)->OnChanged();
}
}
protected:
std::list<ObserverInterface*> observers_;
};
} // namespace webrtc
#endif // API_NOTIFIER_H_
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <SAObjects/SADomainCommand.h>
@class NSString, NSURL;
@interface SANoteUpdate : SADomainCommand
{
}
+ (id)updateWithDictionary:(id)arg1 context:(id)arg2;
+ (id)update;
- (_Bool)requiresResponse;
@property(copy, nonatomic) NSURL *identifier;
@property(copy, nonatomic) NSString *contentsToAppend;
- (id)encodedClassName;
- (id)groupIdentifier;
@end
| {
"pile_set_name": "Github"
} |
#include "create_custom_edges_and_vertices_k3_graph.h"
#include "find_first_custom_edge_with_my_edge.h"
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE(test_find_first_custom_edge_with_my_edge)
{
const auto g = create_custom_edges_and_vertices_k3_graph();
const auto ed = find_first_custom_edge_with_my_edge(
my_custom_edge("AB", "first", 0.0, 0.0), g);
BOOST_CHECK(boost::source(ed, g) != boost::target(ed, g));
}
| {
"pile_set_name": "Github"
} |
# Annotation rendering
Annotation rendering can be customized using GLSL shader code.
## Shader language
The shader code must conform to the OpenGL ES Shading Language (GLSL) version 3.0, specified at <https://www.khronos.org/registry/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf>.
You may find the WebGL reference card helpful: <https://www.khronos.org/files/webgl20-reference-guide.pdf>.
## UI Controls
[UI control directives](../sliceview/image_layer_rendering.md#ui-controls) are supported as for image layers.
## API
### Accessing annotation properties
To retrieve a property named `myProperty`, use the syntax `prop_myProperty()`.
### Common API
```glsl
const bool PROJECTION_VIEW;
```
Set to `true` when rendering a 3-d projection view, set to `false` when rendering a cross section view.
```glsl
discard;
```
Discards the annotation from rendering (the annotation won't be shown). Use the syntax `discard;`, not `discard();`.
```glsl
void setColor(vec4 color) {
setPointMarkerColor(color);
setLineColor(color);
setEndpointMarkerColor(color);
setBoundingBoxBorderColor(color);
setEllipsoidFillColor(vec4(color.rgb, color.a * (PROJECTION_VIEW ? 1.0 : 0.5)));
}
void setColor(vec3 color) {
setColor(vec4(color, 1.0));
}
```
Sets the point marker fill color, the line color, the line endpoint marker fill color, the bounding
box border color, and the ellipsoid fill color.
```glsl
vec3 defaultColor();
```
Returns the color set through the "Annotations" tab in the UI, or the `"annotationColor"` member of the layer JSON state. If not accessed in the shader, the corresponding color selector will not be shown in the UI. This behaves similarly to a custom color UI control.
### Type-specific API
The same shader code applies to all annotation types, but API functions specific to a particular
annotation type have no effect when rendering other annotation types.
#### Point annotations
Point annotations are rendered as circles.
```glsl
void setPointMarkerSize(float diameterInScreenPixels);
```
Sets the diameter of the circle in screen pixels (defaults to 5 pixels).
```glsl
void setPointMarkerBorderWidth(float widthInScreenPixels);
```
Sets the border width in screen pixels (defaults to 1 pixel).
```glsl
void setPointMarkerColor(vec4 rgba);
void setPointMarkerColor(vec3 rgb);
```
Sets the fill color (defaults to transparent). May also be set by calling the generic `setColor` function.
```glsl
void setPointMarkerBorderColor(vec4 rgba);
void setPointMarkerBorderColor(vec3 rgb);
```
Sets the border color (defaults to black with alpha 1).
#### Line annotations
Line annotations are rendered as line segments with circles marking the endpoints.
```glsl
void setLineColor(vec4 rgba);
void setLineColor(vec3 rgb);
```
Sets a constant line color (defaults to transparent). May also be set by calling the generic `setColor` function.
```glsl
void setLineColor(vec4 startColor, vec4 endColor);
void setLineColor(vec3 startColor, vec3 endColor);
```
Sets a linear color gradient for the line.
```glsl
void setLineWidth(float widthInScreenPixels);
```
Sets the line width (defaults to 1).
```glsl
void setEndpointMarkerColor(vec4 rgba);
void setEndpointMarkerColor(vec3 rgb);
```
Sets the same fill color for both endpoint markers (defaults to transparent). May also be set by calling the generic `setColor` function.
```glsl
void setEndpointMarkerColor(vec4 startColor, vec4 endColor);
void setEndpointMarkerColor(vec3 startColor, vec3 endColor);
```
Sets separate fill colors for the endpoint markers.
```glsl
void setEndpointMarkerBorderColor(vec4 rgba);
void setEndpointMarkerBorderColor(vec3 rgb);
```
Sets the same border color for both endpoint markers (defaults to black with alpha 1).
```glsl
void setEndpointMarkerColor(vec4 startColor, vec4 endColor);
void setEndpointMarkerColor(vec3 startColor, vec3 endColor);
```
Sets separate border colors for the endpoint markers.
```glsl
void setEndpointMarkerSize(float diameter);
```
Sets the same diameter (in screen pixels) for both endpoint markers (defaults to 5 pixels).
```glsl
void setEndpointMarkerSize(float startDiameter, float endDiameter);
```
Sets separate diameters for the endpoint markers.
```glsl
void setEndpointMarkerBorderWidth(float width);
```
Sets the same border width (in screen pixels) for both endpoint markers (defaults to 1 pixel).
```glsl
void setEndpointMarkerBorderWidth(float startWidth, float endWidth);
```
Sets separate border widths for the endpoint markers.
#### Bounding box annotations
```glsl
void setBoundingBoxBorderColor(vec4 rgba);
void setBoundingBoxBorderColor(vec3 rgb);
```
Sets the border color (defaults to transparent). May also be set by calling the generic `setColor` function.
```glsl
void setBoundingBoxBorderWidth(float widthInScreenPixels);
```
Sets the border width in screen pixels. Defaults to 1 pixel.
```glsl
void setBoundingBoxFillColor(vec4 rgba);
void setBoundingBoxFillColor(vec3 rgb);
```
Sets the fill color (defaults to transparent). Currently, this only applies to cross-section views.
#### Ellipsoid annotations
```glsl
void setEllipsoidFillColor(vec4 rgba);
void setEllipsoidFillColor(vec3 rgb);
```
Sets the ellipsoid fill color. May also be set by calling the generic `setColor` function.
| {
"pile_set_name": "Github"
} |
//
// FastttCameraBenchmark.m
// FastttCamera
//
// Created by Laura Skelton on 2/9/15.
// Copyright (c) 2015 IFTTT. All rights reserved.
//
#import "FastttCameraBenchmark.h"
#import <FastttCamera/FastttFilterCamera.h>
#import <Masonry/Masonry.h>
NSInteger const kIFTTTFastttBenchmarkTestIterations = 20;
@interface FastttCameraBenchmark () <FastttCameraDelegate>
@property (nonatomic, strong) FastttFilterCamera *fastCamera;
@property (nonatomic, strong) UIButton *runTestButton;
@property (nonatomic, strong) UILabel *averageTimeLabel;
@property (nonatomic, assign) NSInteger counter;
@property (nonatomic, assign) NSInteger cropCounter;
@property (nonatomic, assign) NSInteger scaleCounter;
@property (nonatomic, assign) NSInteger renderCounter;
@property (nonatomic, assign) NSInteger normalizeCounter;
@property (nonatomic, assign) NSTimeInterval startTime;
@property (nonatomic, assign) NSTimeInterval totalCropPhotoTime;
@property (nonatomic, assign) NSTimeInterval totalScalePhotoTime;
@property (nonatomic, assign) NSTimeInterval totalTimeToRender;
@property (nonatomic, assign) NSTimeInterval totalTimeToNormalize;
@property (nonatomic, strong) UIImageView *previewImageView;
@end
@implementation FastttCameraBenchmark
- (instancetype)init
{
if ((self = [super init])) {
self.title = @"FastttCamera Test";
self.tabBarItem.image = [UIImage imageNamed:@"LightningFast"];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_fastCamera = [FastttFilterCamera cameraWithFilterImage:[UIImage imageNamed:@"YellowRetro"]];
self.fastCamera.delegate = self;
[self fastttAddChildViewController:self.fastCamera];
[self.fastCamera.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
[self.fastCamera setCameraFlashMode:FastttCameraFlashModeOff];
[self.fastCamera setCameraDevice:FastttCameraDeviceRear];
_previewImageView = [UIImageView new];
self.previewImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.view addSubview:self.previewImageView];
[self.previewImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
_runTestButton = [UIButton new];
[self.runTestButton addTarget:self
action:@selector(runBenchmarkTest)
forControlEvents:UIControlEventTouchUpInside];
[self.runTestButton setTitle:@"Run Test"
forState:UIControlStateNormal];
[self.view addSubview:self.runTestButton];
[self.runTestButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.bottom.equalTo(self.view).offset(-20.f);
}];
_averageTimeLabel = [UILabel new];
self.averageTimeLabel.textColor = [UIColor whiteColor];
self.averageTimeLabel.text = @"Average Time: ";
[self.view addSubview:self.averageTimeLabel];
[self.averageTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(20.f);
make.right.equalTo(self.view).offset(-20.f);
}];
}
- (void)runBenchmarkTest
{
NSLog(@"Will run test");
self.averageTimeLabel.text = @"Running...";
self.counter = 0;
self.cropCounter = 0;
self.scaleCounter = 0;
self.renderCounter = 0;
self.normalizeCounter = 0;
self.totalCropPhotoTime = 0.f;
self.totalScalePhotoTime = 0.f;
self.totalTimeToRender = 0.f;
self.totalTimeToNormalize = 0.f;
[self startBenchmarkTestIteration];
}
- (void)startBenchmarkTestIteration
{
[NSThread sleepForTimeInterval:0.1f];
self.counter += 1;
self.startTime = CACurrentMediaTime();
[self.fastCamera takePicture];
}
- (void)cropPhotoBenchmarkTestIteration
{
self.cropCounter += 1;
self.totalCropPhotoTime += CACurrentMediaTime() - self.startTime;
}
- (void)renderPhotoBenchmarkTestIteration
{
self.renderCounter += 1;
self.totalTimeToRender += CACurrentMediaTime() - self.startTime;
}
- (void)scalePhotoBenchmarkTestIteration
{
self.scaleCounter += 1;
self.totalScalePhotoTime += CACurrentMediaTime() - self.startTime;
}
- (void)normalizePhotoBenchmarkTestIteration
{
self.normalizeCounter += 1;
self.totalTimeToNormalize += CACurrentMediaTime() - self.startTime;
}
- (void)endBenchmarkTestIteration
{
NSLog(@"run %@", @(self.counter));
if (self.counter < kIFTTTFastttBenchmarkTestIterations) {
[self startBenchmarkTestIteration];
} else {
[self finishBenchmarkTest];
}
}
- (void)finishBenchmarkTest
{
CGFloat averageCropPhotoTime = (CGFloat)(self.totalCropPhotoTime / self.cropCounter);
NSLog(@"Average Run Time for FastttCamera Crop Photo: %@", @(averageCropPhotoTime));
CGFloat averageRenderPhotoTime = (CGFloat)(self.totalTimeToRender / self.renderCounter);
NSLog(@"Average Run Time for FastttCamera Render Photo: %@", @(averageRenderPhotoTime));
CGFloat averageScalePhotoTime = (CGFloat)(self.totalScalePhotoTime / self.scaleCounter);
NSLog(@"Average Run Time for FastttCamera Scale Photo: %@", @(averageScalePhotoTime));
CGFloat averageNormalizePhotoTime = (CGFloat)(self.totalTimeToNormalize / self.normalizeCounter);
NSLog(@"Average Run Time for FastttCamera Normalize Photo: %@", @(averageNormalizePhotoTime));
self.averageTimeLabel.text = [NSString stringWithFormat: @"Average Time: %@", @(averageNormalizePhotoTime)];
}
#pragma mark - IFTTTFastttCameraDelegate
- (void)cameraController:(id <FastttCameraInterface>)cameraController didFinishCapturingImage:(FastttCapturedImage *)capturedImage
{
[self cropPhotoBenchmarkTestIteration];
self.previewImageView.image = capturedImage.rotatedPreviewImage;
// forces the image view to render now so we can see the delay
[self.previewImageView setNeedsDisplay];
[CATransaction flush];
[self renderPhotoBenchmarkTestIteration];
capturedImage.rotatedPreviewImage = nil;
}
- (void)cameraController:(id <FastttCameraInterface>)cameraController didFinishScalingCapturedImage:(FastttCapturedImage *)capturedImage
{
[self scalePhotoBenchmarkTestIteration];
}
- (void)cameraController:(id <FastttCameraInterface>)cameraController didFinishNormalizingCapturedImage:(FastttCapturedImage *)capturedImage
{
[self normalizePhotoBenchmarkTestIteration];
[self endBenchmarkTestIteration];
}
@end
| {
"pile_set_name": "Github"
} |
var detail = '../detail/detail'
Page({
data: {
list: [],
maxtime: '',
loadingHidden: false
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
this.requestData('newlist');
},
/*
* 滚动到底部时加载下一页
*/
bindscrolltolower: function () {
console.log('到底部')
this.requestData('list');
},
/**
* 加载数据
*/
requestData: function (a) {
var that = this;
wx.request({
url: 'http://api.budejie.com/api/api_open.php',
data: {
a: a,
c: 'data',
// 上一页的maxtime作为加载下一页的条件,
maxtime: this.data.maxtime,
type: '31',
},
method: 'GET',
success: function (res) {
console.log(res)
console.log('上一页', that.datalist)
that.setData({
// 拼接数组
list: that.data.list.concat(res.data.list),
loadingHidden: true,
maxtime: res.data.info.maxtime
})
}
})
},
playVoice: function (e) {
console.log(e);
wx.playBackgroundAudio({
dataUrl: e.currentTarget.dataset.voiceuri
})
},
onReady: function () {
// 页面渲染完成
},
onShow: function () {
// 页面显示
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
// 页面关闭
}
}) | {
"pile_set_name": "Github"
} |
//
// _RX.m
// RxCocoa
//
// Created by Krunoslav Zaher on 7/12/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
#import "include/_RX.h"
| {
"pile_set_name": "Github"
} |
/*
* common.h
* written by Holmes Futrell
* use however you want
*/
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 480
extern int randomInt(int min, int max);
extern float randomFloat(float min, float max);
extern void fatalError(const char *string);
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Jul 6 2018 12:02:43).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import "_TtC6Sketch19ResultTableCellView.h"
@class NSButton, NSImageView, NSTextField, _TtC6Sketch13AssistantIcon;
@interface _TtC6Sketch19HeaderTableCellView : _TtC6Sketch19ResultTableCellView
{
// Error parsing type: , name: headerText
// Error parsing type: , name: actionButton
// Error parsing type: , name: assistantImage
// Error parsing type: , name: icon
// Error parsing type: , name: headerRowModel
}
- (void).cxx_destruct;
- (id)initWithCoder:(id)arg1;
- (id)initWithFrame:(struct CGRect)arg1;
- (void)help;
- (void)enable;
- (void)ignore;
- (void)toggleIgnore;
- (void)prepareForReuse;
@property(nonatomic, retain) NSImageView *icon; // @synthesize icon;
@property(nonatomic, retain) _TtC6Sketch13AssistantIcon *assistantImage; // @synthesize assistantImage;
@property(nonatomic, retain) NSButton *actionButton; // @synthesize actionButton;
@property(nonatomic, retain) NSTextField *headerText; // @synthesize headerText;
@end
| {
"pile_set_name": "Github"
} |
GL_ARB_matrix_palette
http://oss.sgi.com/projects/ogl-sample/registry/ARB/matrix_palette.txt
GL_ARB_matrix_palette
GL_MATRIX_PALETTE_ARB 0x8840
GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841
GL_MAX_PALETTE_MATRICES_ARB 0x8842
GL_CURRENT_PALETTE_MATRIX_ARB 0x8843
GL_MATRIX_INDEX_ARRAY_ARB 0x8844
GL_CURRENT_MATRIX_INDEX_ARB 0x8845
GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846
GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847
GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848
GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849
void glCurrentPaletteMatrixARB (GLint index)
void glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, void *pointer)
void glMatrixIndexubvARB (GLint size, GLubyte *indices)
void glMatrixIndexusvARB (GLint size, GLushort *indices)
void glMatrixIndexuivARB (GLint size, GLuint *indices)
| {
"pile_set_name": "Github"
} |
Paranoid is a collection of modules started out as modules which perform
things (debatably) in a safer and taint-safe manner. Since then it's also
grown to include functionality that fit into the same framework and
conventions of the original modules, including keeping the debug hooks
for command-line debugging.
WWW: https://metacpan.org/release/Paranoid
| {
"pile_set_name": "Github"
} |
set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
@SET_MSVC_CXX_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@)
set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@)
set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
set(CMAKE_CXX_LINKER_PREFERENCE 30)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@")
set(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@")
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
if(CMAKE_CXX_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_CXX_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
endif()
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
endif()
@CMAKE_CXX_SYSROOT_FLAG_CODE@
@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
@SET_CMAKE_CMCLDEPS_EXECUTABLE@
@SET_CMAKE_CL_SHOWINCLUDE_PREFIX@
| {
"pile_set_name": "Github"
} |
/* ***********************************************************
* This file was automatically generated on 2016-02-10. *
* *
* C/C++ Bindings Version 2.1.10 *
* *
* If you have a bugfix for this file and want to commit it, *
* please fix the bug in the generator. You can find a link *
* to the generators git repository on tinkerforge.com *
*************************************************************/
#ifndef BRICKLET_HUMIDITY_H
#define BRICKLET_HUMIDITY_H
#include "ip_connection.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup BrickletHumidity Humidity Bricklet
*/
/**
* \ingroup BrickletHumidity
*
* Measures relative humidity
*/
typedef Device Humidity;
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_GET_HUMIDITY 1
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_GET_ANALOG_VALUE 2
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD 3
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD 4
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD 5
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD 6
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD 7
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD 8
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD 9
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD 10
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_SET_DEBOUNCE_PERIOD 11
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_GET_DEBOUNCE_PERIOD 12
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_FUNCTION_GET_IDENTITY 255
/**
* \ingroup BrickletHumidity
*
* Signature: \code void callback(uint16_t humidity, void *user_data) \endcode
*
* This callback is triggered periodically with the period that is set by
* {@link humidity_set_humidity_callback_period}. The parameter is the humidity of the
* sensor.
*
* {@link HUMIDITY_CALLBACK_HUMIDITY} is only triggered if the humidity has changed since the
* last triggering.
*/
#define HUMIDITY_CALLBACK_HUMIDITY 13
/**
* \ingroup BrickletHumidity
*
* Signature: \code void callback(uint16_t value, void *user_data) \endcode
*
* This callback is triggered periodically with the period that is set by
* {@link humidity_set_analog_value_callback_period}. The parameter is the analog value of the
* sensor.
*
* {@link HUMIDITY_CALLBACK_ANALOG_VALUE} is only triggered if the humidity has changed since the
* last triggering.
*/
#define HUMIDITY_CALLBACK_ANALOG_VALUE 14
/**
* \ingroup BrickletHumidity
*
* Signature: \code void callback(uint16_t humidity, void *user_data) \endcode
*
* This callback is triggered when the threshold as set by
* {@link humidity_set_humidity_callback_threshold} is reached.
* The parameter is the humidity of the sensor.
*
* If the threshold keeps being reached, the callback is triggered periodically
* with the period as set by {@link humidity_set_debounce_period}.
*/
#define HUMIDITY_CALLBACK_HUMIDITY_REACHED 15
/**
* \ingroup BrickletHumidity
*
* Signature: \code void callback(uint16_t value, void *user_data) \endcode
*
* This callback is triggered when the threshold as set by
* {@link humidity_set_analog_value_callback_threshold} is reached.
* The parameter is the analog value of the sensor.
*
* If the threshold keeps being reached, the callback is triggered periodically
* with the period as set by {@link humidity_set_debounce_period}.
*/
#define HUMIDITY_CALLBACK_ANALOG_VALUE_REACHED 16
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_THRESHOLD_OPTION_OFF 'x'
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_THRESHOLD_OPTION_OUTSIDE 'o'
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_THRESHOLD_OPTION_INSIDE 'i'
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_THRESHOLD_OPTION_SMALLER '<'
/**
* \ingroup BrickletHumidity
*/
#define HUMIDITY_THRESHOLD_OPTION_GREATER '>'
/**
* \ingroup BrickletHumidity
*
* This constant is used to identify a Humidity Bricklet.
*
* The {@link humidity_get_identity} function and the
* {@link IPCON_CALLBACK_ENUMERATE} callback of the IP Connection have a
* \c device_identifier parameter to specify the Brick's or Bricklet's type.
*/
#define HUMIDITY_DEVICE_IDENTIFIER 27
/**
* \ingroup BrickletHumidity
*
* This constant represents the display name of a Humidity Bricklet.
*/
#define HUMIDITY_DEVICE_DISPLAY_NAME "Humidity Bricklet"
/**
* \ingroup BrickletHumidity
*
* Creates the device object \c humidity with the unique device ID \c uid and adds
* it to the IPConnection \c ipcon.
*/
void humidity_create(Humidity *humidity, const char *uid, IPConnection *ipcon);
/**
* \ingroup BrickletHumidity
*
* Removes the device object \c humidity from its IPConnection and destroys it.
* The device object cannot be used anymore afterwards.
*/
void humidity_destroy(Humidity *humidity);
/**
* \ingroup BrickletHumidity
*
* Returns the response expected flag for the function specified by the
* \c function_id parameter. It is *true* if the function is expected to
* send a response, *false* otherwise.
*
* For getter functions this is enabled by default and cannot be disabled,
* because those functions will always send a response. For callback
* configuration functions it is enabled by default too, but can be disabled
* via the humidity_set_response_expected function. For setter functions it is
* disabled by default and can be enabled.
*
* Enabling the response expected flag for a setter function allows to
* detect timeouts and other error conditions calls of this setter as well.
* The device will then send a response for this purpose. If this flag is
* disabled for a setter function then no response is send and errors are
* silently ignored, because they cannot be detected.
*/
int humidity_get_response_expected(Humidity *humidity, uint8_t function_id, bool *ret_response_expected);
/**
* \ingroup BrickletHumidity
*
* Changes the response expected flag of the function specified by the
* \c function_id parameter. This flag can only be changed for setter
* (default value: *false*) and callback configuration functions
* (default value: *true*). For getter functions it is always enabled and
* callbacks it is always disabled.
*
* Enabling the response expected flag for a setter function allows to detect
* timeouts and other error conditions calls of this setter as well. The device
* will then send a response for this purpose. If this flag is disabled for a
* setter function then no response is send and errors are silently ignored,
* because they cannot be detected.
*/
int humidity_set_response_expected(Humidity *humidity, uint8_t function_id, bool response_expected);
/**
* \ingroup BrickletHumidity
*
* Changes the response expected flag for all setter and callback configuration
* functions of this device at once.
*/
int humidity_set_response_expected_all(Humidity *humidity, bool response_expected);
/**
* \ingroup BrickletHumidity
*
* Registers a callback with ID \c id to the function \c callback. The
* \c user_data will be given as a parameter of the callback.
*/
void humidity_register_callback(Humidity *humidity, uint8_t id, void *callback, void *user_data);
/**
* \ingroup BrickletHumidity
*
* Returns the API version (major, minor, release) of the bindings for this
* device.
*/
int humidity_get_api_version(Humidity *humidity, uint8_t ret_api_version[3]);
/**
* \ingroup BrickletHumidity
*
* Returns the humidity of the sensor. The value
* has a range of 0 to 1000 and is given in %RH/10 (Relative Humidity),
* i.e. a value of 421 means that a humidity of 42.1 %RH is measured.
*
* If you want to get the humidity periodically, it is recommended to use the
* callback {@link HUMIDITY_CALLBACK_HUMIDITY} and set the period with
* {@link humidity_set_humidity_callback_period}.
*/
int humidity_get_humidity(Humidity *humidity, uint16_t *ret_humidity);
/**
* \ingroup BrickletHumidity
*
* Returns the value as read by a 12-bit analog-to-digital converter.
* The value is between 0 and 4095.
*
* \note
* The value returned by {@link humidity_get_humidity} is averaged over several samples
* to yield less noise, while {@link humidity_get_analog_value} gives back raw
* unfiltered analog values. The returned humidity value is calibrated for
* room temperatures, if you use the sensor in extreme cold or extreme
* warm environments, you might want to calculate the humidity from
* the analog value yourself. See the `HIH 5030 datasheet
* <https://github.com/Tinkerforge/humidity-bricklet/raw/master/datasheets/hih-5030.pdf>`__.
*
* If you want the analog value periodically, it is recommended to use the
* callback {@link HUMIDITY_CALLBACK_ANALOG_VALUE} and set the period with
* {@link humidity_set_analog_value_callback_period}.
*/
int humidity_get_analog_value(Humidity *humidity, uint16_t *ret_value);
/**
* \ingroup BrickletHumidity
*
* Sets the period in ms with which the {@link HUMIDITY_CALLBACK_HUMIDITY} callback is triggered
* periodically. A value of 0 turns the callback off.
*
* {@link HUMIDITY_CALLBACK_HUMIDITY} is only triggered if the humidity has changed since the
* last triggering.
*
* The default value is 0.
*/
int humidity_set_humidity_callback_period(Humidity *humidity, uint32_t period);
/**
* \ingroup BrickletHumidity
*
* Returns the period as set by {@link humidity_set_humidity_callback_period}.
*/
int humidity_get_humidity_callback_period(Humidity *humidity, uint32_t *ret_period);
/**
* \ingroup BrickletHumidity
*
* Sets the period in ms with which the {@link HUMIDITY_CALLBACK_ANALOG_VALUE} callback is triggered
* periodically. A value of 0 turns the callback off.
*
* {@link HUMIDITY_CALLBACK_ANALOG_VALUE} is only triggered if the analog value has changed since the
* last triggering.
*
* The default value is 0.
*/
int humidity_set_analog_value_callback_period(Humidity *humidity, uint32_t period);
/**
* \ingroup BrickletHumidity
*
* Returns the period as set by {@link humidity_set_analog_value_callback_period}.
*/
int humidity_get_analog_value_callback_period(Humidity *humidity, uint32_t *ret_period);
/**
* \ingroup BrickletHumidity
*
* Sets the thresholds for the {@link HUMIDITY_CALLBACK_HUMIDITY_REACHED} callback.
*
* The following options are possible:
*
* \verbatim
* "Option", "Description"
*
* "'x'", "Callback is turned off"
* "'o'", "Callback is triggered when the humidity is *outside* the min and max values"
* "'i'", "Callback is triggered when the humidity is *inside* the min and max values"
* "'<'", "Callback is triggered when the humidity is smaller than the min value (max is ignored)"
* "'>'", "Callback is triggered when the humidity is greater than the min value (max is ignored)"
* \endverbatim
*
* The default value is ('x', 0, 0).
*/
int humidity_set_humidity_callback_threshold(Humidity *humidity, char option, uint16_t min, uint16_t max);
/**
* \ingroup BrickletHumidity
*
* Returns the threshold as set by {@link humidity_set_humidity_callback_threshold}.
*/
int humidity_get_humidity_callback_threshold(Humidity *humidity, char *ret_option, uint16_t *ret_min, uint16_t *ret_max);
/**
* \ingroup BrickletHumidity
*
* Sets the thresholds for the {@link HUMIDITY_CALLBACK_ANALOG_VALUE_REACHED} callback.
*
* The following options are possible:
*
* \verbatim
* "Option", "Description"
*
* "'x'", "Callback is turned off"
* "'o'", "Callback is triggered when the analog value is *outside* the min and max values"
* "'i'", "Callback is triggered when the analog value is *inside* the min and max values"
* "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
* "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
* \endverbatim
*
* The default value is ('x', 0, 0).
*/
int humidity_set_analog_value_callback_threshold(Humidity *humidity, char option, uint16_t min, uint16_t max);
/**
* \ingroup BrickletHumidity
*
* Returns the threshold as set by {@link humidity_set_analog_value_callback_threshold}.
*/
int humidity_get_analog_value_callback_threshold(Humidity *humidity, char *ret_option, uint16_t *ret_min, uint16_t *ret_max);
/**
* \ingroup BrickletHumidity
*
* Sets the period in ms with which the threshold callbacks
*
* * {@link HUMIDITY_CALLBACK_HUMIDITY_REACHED},
* * {@link HUMIDITY_CALLBACK_ANALOG_VALUE_REACHED}
*
* are triggered, if the thresholds
*
* * {@link humidity_set_humidity_callback_threshold},
* * {@link humidity_set_analog_value_callback_threshold}
*
* keep being reached.
*
* The default value is 100.
*/
int humidity_set_debounce_period(Humidity *humidity, uint32_t debounce);
/**
* \ingroup BrickletHumidity
*
* Returns the debounce period as set by {@link humidity_set_debounce_period}.
*/
int humidity_get_debounce_period(Humidity *humidity, uint32_t *ret_debounce);
/**
* \ingroup BrickletHumidity
*
* Returns the UID, the UID where the Bricklet is connected to,
* the position, the hardware and firmware version as well as the
* device identifier.
*
* The position can be 'a', 'b', 'c' or 'd'.
*
* The device identifier numbers can be found :ref:`here <device_identifier>`.
* |device_identifier_constant|
*/
int humidity_get_identity(Humidity *humidity, char ret_uid[8], char ret_connected_uid[8], char *ret_position, uint8_t ret_hardware_version[3], uint8_t ret_firmware_version[3], uint16_t *ret_device_identifier);
#ifdef __cplusplus
}
#endif
#endif
| {
"pile_set_name": "Github"
} |
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.nyrds.pixeldungeon.effects;
import android.graphics.RectF;
import android.opengl.GLES20;
import com.watabou.glwrap.Texture;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.Image;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.ui.Component;
import com.watabou.pixeldungeon.Assets;
import com.watabou.utils.ColorMath;
import com.watabou.utils.Random;
import javax.microedition.khronos.opengles.GL10;
public class NewFireball extends Component {
private static final RectF BLIGHT = new RectF( 0, 0, 0.25f, 1 );
private static final RectF FLIGHT = new RectF( 0.25f, 0, 0.5f, 1 );
private static final RectF FLAME1 = new RectF( 0.50f, 0, 0.75f, 1 );
private static final RectF FLAME2 = new RectF( 0.75f, 0, 1.00f, 1 );
private static final int COLOR = 0xFF0000;
private Image bLight;
private Image fLight;
private Emitter emitter;
private Group sparks;
@Override
protected void createChildren() {
sparks = new Group();
add( sparks );
bLight = new Image( Assets.FIREBALL );
bLight.frame( BLIGHT );
bLight.origin.set( bLight.width / 2 );
bLight.angularSpeed = -120;
add( bLight );
emitter = new Emitter();
emitter.pour( new Emitter.Factory() {
@Override
public void emit(Emitter emitter, int index, float x, float y) {
Flame p = (Flame)emitter.recycle( Flame.class );
p.reset();
p.x = x - p.width / 2;
p.y = y - p.height / 2;
}
}, 0.1f );
add( emitter );
fLight = new Image( Assets.FIREBALL );
fLight.frame( FLIGHT );
fLight.origin.set( fLight.width / 2 );
fLight.angularSpeed = 360;
add( fLight );
bLight.texture.filter( Texture.LINEAR, Texture.LINEAR );
}
@Override
protected void layout() {
bLight.x = x - bLight.width / 2;
bLight.y = y - bLight.height / 2;
emitter.pos(
x - bLight.width / 4,
y - bLight.height / 4,
bLight.width / 2,
bLight.height / 2 );
fLight.x = x - fLight.width / 2;
fLight.y = y - fLight.height / 2;
}
@Override
public void update() {
super.update();
if (Random.Float() < Game.elapsed) {
PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
spark.reset( x, y, ColorMath.random( 0x000000, COLOR ), 2, Random.Float( 0.5f, 1.0f ) );
spark.speed.set(
Random.Float( -70, +40 ),
Random.Float( -60, +70 ) );
spark.acc.set( 0, +80 );
sparks.add( spark );
}
}
@Override
public void draw() {
GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE );
super.draw();
GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA );
}
public static class Flame extends Image {
private static float LIFESPAN = 1f;
private static float SPEED = -20f;
private static float ACC = -20f;
private float timeLeft;
public Flame() {
super( Assets.FIREBALL );
frame( Random.Int( 2 ) == 0 ? FLAME1 : FLAME2 );
origin.set( width / 2, height / 2 );
acc.set( 0, ACC );
}
public void reset() {
revive();
timeLeft = LIFESPAN;
speed.set( 0, SPEED );
}
@Override
public void update() {
super.update();
if ((timeLeft -= Game.elapsed) <= 0) {
kill();
} else {
float p = timeLeft / LIFESPAN;
scale.set( p );
alpha( p > 0.8f ? (1 - p) * 5f : p * 1.25f );
}
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* This file is part of KubeSphere Console.
* Copyright (C) 2019 The KubeSphere Console Authors.
*
* KubeSphere Console is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* KubeSphere Console is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with KubeSphere Console. If not, see <https://www.gnu.org/licenses/>.
*/
import React from 'react'
import { mount } from 'enzyme'
import Dragger from './index'
jest.useFakeTimers()
it('renders correctly', () => {
const wrapper = mount(
<Dragger
style={{ height: '800px', width: '800px' }}
initialScale={0.5}
class="container"
contentClassName="content"
>
<div />
</Dragger>
)
return Promise.resolve(wrapper)
.then(() => wrapper.update())
.then(() => {
const content = wrapper.find('.main_content').first()
expect(wrapper.find('.container')).toExist()
expect(content).toExist()
expect(
getComputedStyle(content.getDOMNode()).getPropertyValue(`transform`)
).toEqual(expect.stringContaining('scale(0.5)'))
})
})
it('scale correctly', () => {
const wrapper = mount(
<Dragger initialScale={0.5} class="container" contentClassName="content">
<div />
</Dragger>
)
return Promise.resolve(wrapper)
.then(() => wrapper.update())
.then(() => {
wrapper
.find('.qicon-substract')
.first()
.simulate('click')
const content = wrapper.find('.main_content').first()
expect(content).toExist()
expect(
getComputedStyle(content.getDOMNode()).getPropertyValue(`transform`)
).toEqual(expect.stringContaining('scale(0.3)'))
})
})
it('mouseWheel change correctly', () => {
const wrapper = mount(
<Dragger initialScale={0.5} class="container" contentClassName="content">
<div style={{ height: '200px', width: '200px' }} />
</Dragger>
)
return Promise.resolve(wrapper)
.then(() => wrapper.update())
.then(() => {
const content = wrapper.find('.main_content').first()
const container = wrapper.find('.container').first()
expect(content).toExist()
expect(container).toExist()
wrapper.instance().handleWheel({
clientX: 0,
clientY: 0,
deltaY: 4,
preventDefault: () => {},
stopPropagation: () => {},
})
expect(
getComputedStyle(content.getDOMNode()).getPropertyValue(`transform`)
).toEqual(expect.stringContaining('scale(0.46)'))
})
})
it('move correctly', () => {
const wrapper = mount(
<Dragger initialScale={0.5} class="container" contentClassName="content">
<div style={{ height: '200px', width: '200px' }} />
</Dragger>
)
return Promise.resolve(wrapper)
.then(() => wrapper.update())
.then(() => {
const content = wrapper.find('.main_content').first()
const container = wrapper.find('.container').first()
expect(content).toExist()
expect(container).toExist()
container.simulate('mouseDown', { button: 0, clientX: 0, clientY: 0 })
container.simulate('mouseMove', { clientX: 0, clientY: 0 })
container.simulate('mouseMove', { clientX: 10, clientY: 10 })
container.simulate('mouseUp', { clientX: 10, clientY: 10 })
expect(
getComputedStyle(content.getDOMNode()).getPropertyValue(`transform`)
).toEqual(expect.stringContaining('translate3d(10px, 10px, 0)'))
})
})
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 39376078437d29b4597517770a2fba1d
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 2
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 1
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes Authors.
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "k8s.io/api/storage/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
scheme "k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
// VolumeAttachmentsGetter has a method to return a VolumeAttachmentInterface.
// A group's client should implement this interface.
type VolumeAttachmentsGetter interface {
VolumeAttachments() VolumeAttachmentInterface
}
// VolumeAttachmentInterface has methods to work with VolumeAttachment resources.
type VolumeAttachmentInterface interface {
Create(ctx context.Context, volumeAttachment *v1alpha1.VolumeAttachment, opts v1.CreateOptions) (*v1alpha1.VolumeAttachment, error)
Update(ctx context.Context, volumeAttachment *v1alpha1.VolumeAttachment, opts v1.UpdateOptions) (*v1alpha1.VolumeAttachment, error)
UpdateStatus(ctx context.Context, volumeAttachment *v1alpha1.VolumeAttachment, opts v1.UpdateOptions) (*v1alpha1.VolumeAttachment, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VolumeAttachment, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VolumeAttachmentList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VolumeAttachment, err error)
VolumeAttachmentExpansion
}
// volumeAttachments implements VolumeAttachmentInterface
type volumeAttachments struct {
client rest.Interface
}
// newVolumeAttachments returns a VolumeAttachments
func newVolumeAttachments(c *StorageV1alpha1Client) *volumeAttachments {
return &volumeAttachments{
client: c.RESTClient(),
}
}
// Get takes name of the volumeAttachment, and returns the corresponding volumeAttachment object, and an error if there is any.
func (c *volumeAttachments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VolumeAttachment, err error) {
result = &v1alpha1.VolumeAttachment{}
err = c.client.Get().
Resource("volumeattachments").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of VolumeAttachments that match those selectors.
func (c *volumeAttachments) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VolumeAttachmentList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.VolumeAttachmentList{}
err = c.client.Get().
Resource("volumeattachments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested volumeAttachments.
func (c *volumeAttachments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("volumeattachments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a volumeAttachment and creates it. Returns the server's representation of the volumeAttachment, and an error, if there is any.
func (c *volumeAttachments) Create(ctx context.Context, volumeAttachment *v1alpha1.VolumeAttachment, opts v1.CreateOptions) (result *v1alpha1.VolumeAttachment, err error) {
result = &v1alpha1.VolumeAttachment{}
err = c.client.Post().
Resource("volumeattachments").
VersionedParams(&opts, scheme.ParameterCodec).
Body(volumeAttachment).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a volumeAttachment and updates it. Returns the server's representation of the volumeAttachment, and an error, if there is any.
func (c *volumeAttachments) Update(ctx context.Context, volumeAttachment *v1alpha1.VolumeAttachment, opts v1.UpdateOptions) (result *v1alpha1.VolumeAttachment, err error) {
result = &v1alpha1.VolumeAttachment{}
err = c.client.Put().
Resource("volumeattachments").
Name(volumeAttachment.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(volumeAttachment).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *volumeAttachments) UpdateStatus(ctx context.Context, volumeAttachment *v1alpha1.VolumeAttachment, opts v1.UpdateOptions) (result *v1alpha1.VolumeAttachment, err error) {
result = &v1alpha1.VolumeAttachment{}
err = c.client.Put().
Resource("volumeattachments").
Name(volumeAttachment.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(volumeAttachment).
Do(ctx).
Into(result)
return
}
// Delete takes name of the volumeAttachment and deletes it. Returns an error if one occurs.
func (c *volumeAttachments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("volumeattachments").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *volumeAttachments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("volumeattachments").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched volumeAttachment.
func (c *volumeAttachments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VolumeAttachment, err error) {
result = &v1alpha1.VolumeAttachment{}
err = c.client.Patch(pt).
Resource("volumeattachments").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
| {
"pile_set_name": "Github"
} |
import FWCore.ParameterSet.Config as cms
XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
geomXMLFiles = cms.vstring(
'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml',
'Geometry/CMSCommonData/data/rotations.xml',
'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml',
'Geometry/CMSCommonData/data/cmsMother.xml',
'Geometry/CMSCommonData/data/eta3/etaMax.xml',
'Geometry/CMSCommonData/data/cmsCalo.xml',
'Geometry/CMSCommonData/data/cmsMuon.xml',
'Geometry/CMSCommonData/data/mgnt.xml',
'Geometry/CMSCommonData/data/beampipe/2026/v3/beampipe.xml',
'Geometry/CMSCommonData/data/cmsBeam/2026/v1/cmsBeam.xml',
'Geometry/CMSCommonData/data/muonMB.xml',
'Geometry/CMSCommonData/data/muonMagnet.xml',
'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml',
'Geometry/CMSCommonData/data/cms/2026/v5/cms.xml',
'Geometry/CMSCommonData/data/caloBase/2026/v4/caloBase.xml',
'Geometry/CMSCommonData/data/muonBase/2026/v5/muonBase.xml',
'Geometry/EcalCommonData/data/eregalgo/2026/v2/eregalgo.xml',
'Geometry/EcalCommonData/data/ectkcable/2026/v1/ectkcable.xml',
'Geometry/EcalCommonData/data/ectkcablemat/2026/v1/ectkcablemat.xml',
'Geometry/EcalCommonData/data/ebalgo.xml',
'Geometry/EcalCommonData/data/ebcon.xml',
'Geometry/EcalCommonData/data/ebrot.xml',
'Geometry/HcalCommonData/data/hcalrotations.xml',
'Geometry/HcalCommonData/data/hcal/v2/hcalalgo.xml',
'Geometry/HcalCommonData/data/hcalbarrelalgo.xml',
'Geometry/HcalCommonData/data/hcalcablealgo/v2/hcalcablealgo.xml',
'Geometry/HcalCommonData/data/hcalouteralgo.xml',
'Geometry/HcalCommonData/data/hcalforwardalgo.xml',
'Geometry/HcalCommonData/data/hcalSimNumbering/NoHE/hcalSimNumbering.xml',
'Geometry/HcalCommonData/data/hcalRecNumbering/NoHE/hcalRecNumbering.xml',
'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml',
'Geometry/HGCalCommonData/data/hgcalMaterial/v1/hgcalMaterial.xml',
'Geometry/HGCalCommonData/data/hgcal/v13/hgcal.xml',
'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml',
'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml',
'Geometry/HGCalCommonData/data/hgcalEE/v12/hgcalEE.xml',
'Geometry/HGCalCommonData/data/hgcalHEsil/v12/hgcalHEsil.xml',
'Geometry/HGCalCommonData/data/hgcalHEmix/v12/hgcalHEmix.xml',
'Geometry/HGCalCommonData/data/hgcalCons/v13/hgcalCons.xml',
'Geometry/HGCalCommonData/data/hgcalConsData/v13/hgcalConsData.xml',
'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml',
'Geometry/ForwardCommonData/data/brmrotations.xml',
'Geometry/ForwardCommonData/data/brm/2026/v1/brm.xml',
'Geometry/MuonCommonData/data/mbCommon/2021/v1/mbCommon.xml',
'Geometry/MuonCommonData/data/mb1/2015/v2/mb1.xml',
'Geometry/MuonCommonData/data/mb2/2015/v2/mb2.xml',
'Geometry/MuonCommonData/data/mb3/2015/v2/mb3.xml',
'Geometry/MuonCommonData/data/mb4/2015/v2/mb4.xml',
'Geometry/MuonCommonData/data/mb4Shield/2021/v1/mb4Shield.xml',
'Geometry/MuonCommonData/data/muonYoke/2026/v1/muonYoke.xml',
'Geometry/MuonCommonData/data/csc/2021/v2/csc.xml',
'Geometry/MuonCommonData/data/mf/2026/v6/mf.xml',
'Geometry/MuonCommonData/data/rpcf/2026/v3/rpcf.xml',
'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml',
'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml',
'Geometry/MuonCommonData/data/gem21/TDR_Dev/gem21.xml',
'Geometry/MuonCommonData/data/mfshield/2026/v4/mfshield.xml',
'Geometry/MuonCommonData/data/me0/TDR_Dev/v3/me0.xml',
'Geometry/MuonCommonData/data/muonNumbering/TDR_DeV/v1/muonNumbering.xml',
'Geometry/EcalSimData/data/PhaseII/ecalsens.xml',
'Geometry/HcalCommonData/data/hcalsens/NoHE/hcalsenspmf.xml',
'Geometry/HcalSimData/data/hf.xml',
'Geometry/HcalSimData/data/hfpmt.xml',
'Geometry/HcalSimData/data/hffibrebundle.xml',
'Geometry/HcalSimData/data/CaloUtil.xml',
'Geometry/HGCalSimData/data/hgcsensv9.xml',
'Geometry/MuonSimData/data/PhaseII/ME0EtaPart/muonSens.xml',
'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml',
'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml',
'Geometry/CSCGeometryBuilder/data/cscSpecs.xml',
'Geometry/RPCGeometryBuilder/data/2026/v1/RPCSpecs.xml',
'Geometry/GEMGeometryBuilder/data/v7/GEMSpecsFilter.xml',
'Geometry/GEMGeometryBuilder/data/v7/GEMSpecs.xml',
'Geometry/HcalSimData/data/HcalProdCuts.xml',
'Geometry/EcalSimData/data/EcalProdCuts.xml',
'Geometry/HGCalSimData/data/hgcProdCutsv9.xml',
'Geometry/CMSCommonData/data/FieldParameters.xml',
'Geometry/MuonSimData/data/PhaseII/muonProdCuts.xml',
),
rootNodeName = cms.string('cms:OCMS')
)
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=constant.VM_MEMORY_UNSHARED_PMAP.html">
</head>
<body>
<p>Redirecting to <a href="constant.VM_MEMORY_UNSHARED_PMAP.html">constant.VM_MEMORY_UNSHARED_PMAP.html</a>...</p>
<script>location.replace("constant.VM_MEMORY_UNSHARED_PMAP.html" + location.search + location.hash);</script>
</body>
</html> | {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.