text stringlengths 2 1.04M | meta dict |
|---|---|
require 'simplecov'
module SimpleCov::Configuration
def clean_filters
@filters = []
end
end
SimpleCov.configure do
clean_filters
load_adapter 'test_frameworks'
end
ENV["COVERAGE"] && SimpleCov.start do
add_filter "/.rvm/"
end
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'active_record_model_and_rspec_enhanced_templates'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
end
| {
"content_hash": "8dcea0972285c4d9c80d576f52a4ef27",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 69,
"avg_line_length": 22.06896551724138,
"alnum_prop": 0.7078125,
"repo_name": "dima4p/active_record_model_and_rspec_enhanced_templates",
"id": "3ed0ecf7b3b957d3338044670585cd24bb9e0693",
"size": "640",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/spec_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "8219"
}
],
"symlink_target": ""
} |
<?php
namespace Ding\Bean;
/**
* Bean property definition.
*
* PHP Version 5
*
* @category Ding
* @package Bean
* @author Marcelo Gornstein <marcelog@gmail.com>
* @license http://marcelog.github.com/ Apache License 2.0
* @link http://marcelog.github.com/
*/
class BeanPropertyDefinition
{
/**
* This constant represents a property that is an integer, string, or any
* other native type.
* @var integer
*/
const PROPERTY_SIMPLE = 0;
/**
* This constant represents a property that is another bean.
* @var integer
*/
const PROPERTY_BEAN = 1;
/**
* This constant represents a property that is an array.
* @var integer
*/
const PROPERTY_ARRAY = 2;
/**
* This constant represents a property that is php code to be evaluated.
* @var integer
*/
const PROPERTY_CODE = 3;
/**
* Property name
* @var string
*/
private $_name;
/**
* Property value (in the case of a bean property, this is the bean name).
* @var string
*/
private $_value;
/**
* Property type (see this class constants)
* @var string
*/
private $_type;
/**
* Returns true if this property is a reference to another bean.
*
* @return boolean
*/
public function isBean()
{
return $this->_type == self::PROPERTY_BEAN;
}
/**
* Returns true if this property is php code.
*
* @return boolean
*/
public function isCode()
{
return $this->_type == self::PROPERTY_CODE;
}
/**
* Returns true if this property is an array.
*
* @return boolean
*/
public function isArray()
{
return $this->_type == self::PROPERTY_ARRAY;
}
/**
* Returns property value (or bean name in the case of a bean property).
*
* @return string
*/
public function getValue()
{
return $this->_value;
}
/**
* Returns property name
*
* @return string
*/
public function getName()
{
return $this->_name;
}
/**
* Constructor.
*
* @param string $name Target property name.
* @param integer $type Target property type (See this class constants).
* @param string $value Target property value.
*
* @return void
*/
public function __construct($name, $type, $value)
{
$this->_name = $name;
$this->_type = $type;
$this->_value = $value;
}
}
| {
"content_hash": "3ac6f0f428cb7f02dadf973be3b0f6fa",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 78,
"avg_line_length": 20.19047619047619,
"alnum_prop": 0.5507075471698113,
"repo_name": "iaejean/Ding",
"id": "09a84ae41ab8c8b696533af85e013bba052c90c5",
"size": "3413",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/mg/Ding/Bean/BeanPropertyDefinition.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "126"
},
{
"name": "PHP",
"bytes": "724425"
},
{
"name": "Smarty",
"bytes": "31"
},
{
"name": "XSLT",
"bytes": "28360"
}
],
"symlink_target": ""
} |
package org.qsardb.conversion.table;
import java.util.*;
public class Erratum {
private Map<String, String> errors = new LinkedHashMap<String, String>();
private Map<String, String> warnings = new LinkedHashMap<String, String>();
public String filter(String from){
String to = this.errors.get(from);
if(to == null){
to = this.warnings.get(from);
}
return to;
}
public Map<String, String> errors(){
return this.errors;
}
public Erratum error(String from, String to){
if(to != null){
this.errors.put(from, to);
}
return this;
}
public Map<String, String> warnings(){
return this.warnings;
}
public Erratum warning(String from, String to){
if(to != null){
this.warnings.put(from, to);
}
return this;
}
} | {
"content_hash": "620572f2ab9adf633f47b8539d300369",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 76,
"avg_line_length": 16.19148936170213,
"alnum_prop": 0.6662286465177398,
"repo_name": "qsardb/qsardb-common",
"id": "c5c7777249c8b2dea56d6a142a89b6dc9d429179",
"size": "809",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "conversion/table/src/main/java/org/qsardb/conversion/table/Erratum.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "185266"
}
],
"symlink_target": ""
} |
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "supervisor/background_callback.h"
#include "supervisor/port.h"
#include "supervisor/serial.h"
#include "supervisor/usb.h"
#include "supervisor/shared/workflow.h"
#include "shared/runtime/interrupt_char.h"
#include "shared/readline/readline.h"
#if CIRCUITPY_STATUS_BAR
#include "supervisor/shared/status_bar.h"
#endif
#if CIRCUITPY_STORAGE
#include "shared-module/storage/__init__.h"
#endif
#if CIRCUITPY_USB_CDC
#include "shared-module/usb_cdc/__init__.h"
#endif
#if CIRCUITPY_USB_HID
#include "shared-module/usb_hid/__init__.h"
#endif
#if CIRCUITPY_USB_MIDI
#include "shared-module/usb_midi/__init__.h"
#endif
#include "tusb.h"
#if CIRCUITPY_USB_VENDOR
#include "usb_vendor_descriptors.h"
// The WebUSB support being conditionally added to this file is based on the
// tinyusb demo examples/device/webusb_serial.
static bool web_serial_connected = false;
#define URL "www.tinyusb.org/examples/webusb-serial"
const tusb_desc_webusb_url_t desc_webusb_url =
{
.bLength = 3 + sizeof(URL) - 1,
.bDescriptorType = 3, // WEBUSB URL type
.bScheme = 1, // 0: http, 1: https
.url = URL
};
#endif
bool usb_enabled(void) {
return tusb_inited();
}
MP_WEAK void post_usb_init(void) {
}
void usb_init(void) {
init_usb_hardware();
tusb_init();
post_usb_init();
#if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_CDC
// Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() usb_callback will be invoked when Ctrl+C is received
// This usb_callback always got invoked regardless of mp_interrupt_char value since we only set it once here
// Don't watch for ctrl-C if there is no REPL.
if (usb_cdc_console_enabled()) {
// Console will always be itf 0.
tud_cdc_set_wanted_char(CHAR_CTRL_C);
}
#endif
}
// Set up USB defaults before any USB changes are made in boot.py
void usb_set_defaults(void) {
#if CIRCUITPY_STORAGE && CIRCUITPY_USB_MSC
storage_usb_set_defaults();
#endif
#if CIRCUITPY_USB_CDC
usb_cdc_set_defaults();
#endif
#if CIRCUITPY_USB_HID
usb_hid_set_defaults();
#endif
#if CIRCUITPY_USB_MIDI
usb_midi_set_defaults();
#endif
};
#if CIRCUITPY_USB_IDENTIFICATION
supervisor_allocation *usb_identification_allocation;
#endif
// Some dynamic USB data must be saved after boot.py. How much is needed?
size_t usb_boot_py_data_size(void) {
size_t size = sizeof(usb_identification_t);
#if CIRCUITPY_USB_HID
size += usb_hid_report_descriptor_length();
#endif
return size;
}
// Fill in the data to save.
void usb_get_boot_py_data(uint8_t *temp_storage, size_t temp_storage_size) {
#if CIRCUITPY_USB_IDENTIFICATION
if (usb_identification_allocation) {
memcpy(temp_storage, usb_identification_allocation->ptr, sizeof(usb_identification_t));
free_memory(usb_identification_allocation);
}
#else
if (false) {
}
#endif
else {
usb_identification_t defaults;
// This compiles to less code than using a struct initializer.
defaults.vid = USB_VID;
defaults.pid = USB_PID;
strcpy(defaults.manufacturer_name, USB_MANUFACTURER);
strcpy(defaults.product_name, USB_PRODUCT);
memcpy(temp_storage, &defaults, sizeof(defaults));
}
temp_storage += sizeof(usb_identification_t);
temp_storage_size -= sizeof(usb_identification_t);
#if CIRCUITPY_USB_HID
usb_hid_build_report_descriptor(temp_storage, temp_storage_size);
#endif
}
// After VM is gone, save data into non-heap storage (storage_allocations).
void usb_return_boot_py_data(uint8_t *temp_storage, size_t temp_storage_size) {
usb_identification_t identification;
memcpy(&identification, temp_storage, sizeof(usb_identification_t));
temp_storage += sizeof(usb_identification_t);
temp_storage_size -= sizeof(usb_identification_t);
#if CIRCUITPY_USB_HID
usb_hid_save_report_descriptor(temp_storage, temp_storage_size);
#endif
// Now we can also build the rest of the descriptors and place them in storage_allocations.
usb_build_descriptors(&identification);
}
// Call this when ready to run code.py or a REPL, and a VM has been started.
void usb_setup_with_vm(void) {
#if CIRCUITPY_USB_HID
usb_hid_setup_devices();
#endif
#if CIRCUITPY_USB_MIDI
usb_midi_setup_ports();
#endif
}
void usb_disconnect(void) {
tud_disconnect();
}
void usb_background(void) {
if (usb_enabled()) {
#if CFG_TUSB_OS == OPT_OS_NONE
tud_task();
#if CIRCUITPY_USB_HOST
tuh_task();
#endif
#endif
// No need to flush if there's no REPL.
#if CIRCUITPY_USB_CDC
if (usb_cdc_console_enabled()) {
// Console will always be itf 0.
tud_cdc_write_flush();
}
#endif
}
}
static background_callback_t usb_callback;
static void usb_background_do(void *unused) {
usb_background();
}
void usb_background_schedule(void) {
background_callback_add(&usb_callback, usb_background_do, NULL);
}
void usb_irq_handler(int instance) {
if (instance == CIRCUITPY_USB_DEVICE_INSTANCE) {
tud_int_handler(instance);
} else if (instance == CIRCUITPY_USB_HOST_INSTANCE) {
#if CIRCUITPY_USB_HOST
tuh_int_handler(instance);
#endif
}
usb_background_schedule();
}
// --------------------------------------------------------------------+
// tinyusb callbacks
// --------------------------------------------------------------------+
// Invoked when device is mounted
void tud_mount_cb(void) {
#if CIRCUITPY_USB_MSC
usb_msc_mount();
#endif
}
// Invoked when device is unmounted
void tud_umount_cb(void) {
#if CIRCUITPY_USB_MSC
usb_msc_umount();
#endif
}
// Invoked when usb bus is suspended
// remote_wakeup_en : if host allows us to perform remote wakeup
// USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus
void tud_suspend_cb(bool remote_wakeup_en) {
}
// Invoked when usb bus is resumed
void tud_resume_cb(void) {
}
// Invoked when cdc when line state changed e.g connected/disconnected
// Use to reset to DFU when disconnect with 1200 bps
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
(void)itf; // interface ID, not used
// DTR = false is counted as disconnected
if (!dtr) {
cdc_line_coding_t coding;
// Use whichever CDC is itf 0.
tud_cdc_get_line_coding(&coding);
if (coding.bit_rate == 1200) {
reset_to_bootloader();
}
} else {
#if CIRCUITPY_STATUS_BAR
// We are connected, let's request a title bar update.
supervisor_status_bar_request_update(true);
#endif
}
}
#if CIRCUITPY_USB_VENDOR
// --------------------------------------------------------------------+
// WebUSB use vendor class
// --------------------------------------------------------------------+
bool tud_vendor_connected(void) {
return web_serial_connected;
}
// Invoked when a control transfer occurred on an interface of this class
// Driver response accordingly to the request and the transfer stage (setup/data/ack)
// return false to stall control endpoint (e.g unsupported request)
bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const *request) {
// nothing to with DATA & ACK stage
if (stage != CONTROL_STAGE_SETUP) {
return true;
}
switch (request->bRequest)
{
case VENDOR_REQUEST_WEBUSB:
// match vendor request in BOS descriptor
// Get landing page url
return tud_control_xfer(rhport, request, (void *)&desc_webusb_url, desc_webusb_url.bLength);
case VENDOR_REQUEST_MICROSOFT:
if (request->wIndex == 7) {
// Get Microsoft OS 2.0 compatible descriptor
// let's just hope the target architecture always has the same endianness
uint16_t total_len;
memcpy(&total_len, vendor_ms_os_20_descriptor() + 8, 2);
return tud_control_xfer(rhport, request, (void *)vendor_ms_os_20_descriptor(), total_len);
} else {
return false;
}
case 0x22:
// Webserial simulate the CDC_REQUEST_SET_CONTROL_LINE_STATE (0x22) to
// connect and disconnect.
web_serial_connected = (request->wValue != 0);
// response with status OK
return tud_control_status(rhport, request);
default:
// stall unknown request
return false;
}
return true;
}
#endif // CIRCUITPY_USB_VENDOR
#if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_CDC
/**
* Callback invoked when received an "wanted" char.
* @param itf Interface index (for multiple cdc interfaces)
* @param wanted_char The wanted char (set previously)
*/
// Only called when console is enabled.
void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
// Workaround for using shared/runtime/interrupt_char.c
// Compare mp_interrupt_char with wanted_char and ignore if not matched
if (mp_interrupt_char == wanted_char) {
tud_cdc_n_read_flush(itf); // flush read fifo
mp_sched_keyboard_interrupt();
}
}
void tud_cdc_send_break_cb(uint8_t itf, uint16_t duration_ms) {
if (usb_cdc_console_enabled() && mp_interrupt_char != -1 && itf == 0 && duration_ms > 0) {
mp_sched_keyboard_interrupt();
}
}
#endif
| {
"content_hash": "070eaf185580541669ce4209d52ff2b9",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 112,
"avg_line_length": 28.00581395348837,
"alnum_prop": 0.633589370977787,
"repo_name": "adafruit/circuitpython",
"id": "fa85cddb83fa0f0631f8630adf1f277ff548a1c8",
"size": "10874",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "supervisor/shared/usb/usb.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "10241"
},
{
"name": "C",
"bytes": "18450191"
},
{
"name": "C++",
"bytes": "476"
},
{
"name": "CMake",
"bytes": "18203"
},
{
"name": "CSS",
"bytes": "316"
},
{
"name": "HTML",
"bytes": "10126"
},
{
"name": "JavaScript",
"bytes": "13854"
},
{
"name": "Jinja",
"bytes": "11034"
},
{
"name": "Makefile",
"bytes": "330832"
},
{
"name": "Python",
"bytes": "1423935"
},
{
"name": "Shell",
"bytes": "18681"
}
],
"symlink_target": ""
} |
<?php
/* TwigBundle:Exception:exception.js.twig */
class __TwigTemplate_a0a13b48f1478a0e98fd9f1135d75dd6695d35364e7b80da200a1bf3deeedf35 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "/*
";
// line 2
$this->env->loadTemplate("TwigBundle:Exception:exception.txt.twig")->display(array_merge($context, array("exception" => (isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")))));
// line 3
echo "*/
";
}
public function getTemplateName()
{
return "TwigBundle:Exception:exception.js.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 24 => 3, 22 => 2, 19 => 1,);
}
}
| {
"content_hash": "be608b91cf1e42de01ac92aa502f6a99",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 229,
"avg_line_length": 24.571428571428573,
"alnum_prop": 0.5939922480620154,
"repo_name": "csu6/Symfony",
"id": "44c6dcb791477b512821a1cd0f4d9e54d6f569b4",
"size": "1032",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/cache/de_/twig/a0/a1/3b48f1478a0e98fd9f1135d75dd6695d35364e7b80da200a1bf3deeedf35.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "15716"
},
{
"name": "PHP",
"bytes": "84326"
}
],
"symlink_target": ""
} |
$:.unshift(File.expand_path("../../../samples", __FILE__))
require 'aws_iot_device'
require 'config_shadow'
filter_callback = Proc.new do |message|
puts "Executing the specific callback for topic: #{message.topic}\n##########################################\n"
end
my_shadow_client = setting_shadow
my_shadow_client.connect do |client|
puts "##### Starting test_shadow_client_get ######"
client.get_shadow(4, filter_callback)
puts "##### Starting test_shadow_client_get ######"
client.get_shadow(4) do
puts "CALLED FROM BLOCK"
end
puts "##### Starting test_shadow_client_get ######"
client.get_shadow(4, filter_callback)
sleep 5
end
| {
"content_hash": "291c16c83638b3cd6d6e615902cb29f7",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 114,
"avg_line_length": 26.64,
"alnum_prop": 0.6231231231231231,
"repo_name": "RubyDevInc/aws-iot-device-sdk-ruby",
"id": "c45fd761e4607424a7b6e65b6c6055b5c71d75c7",
"size": "666",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/shadow_client_samples/samples_shadow_client_block.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "42202"
},
{
"name": "Shell",
"bytes": "115"
}
],
"symlink_target": ""
} |
const BlockRange BlockRange1[] =
{
// the 1st block is reserved for the flash header
// so we don't take it into account for the map
{ BlockRange_BLOCKTYPE_CODE , 0 , 109 }, // 0x01000800 nanoCLR
{ BlockRange_BLOCKTYPE_DEPLOYMENT , 110, 510 }, // 0x01037000 deployment
};
const BlockRegionInfo BlockRegions[] =
{
{
(0), // no attributes for this region
0x01000800, // start address for block region
511, // total number of blocks in this region
0x800, // total number of bytes per block
ARRAYSIZE_CONST_EXPR(BlockRange1),
BlockRange1,
}
};
const DeviceBlockInfo Device_BlockInfo =
{
(MediaAttribute_SupportsXIP),
2, // UINT32 BytesPerSector
ARRAYSIZE_CONST_EXPR(BlockRegions), // UINT32 NumRegions;
(BlockRegionInfo*)BlockRegions, // const BlockRegionInfo* pRegions;
};
MEMORY_MAPPED_NOR_BLOCK_CONFIG Device_BlockStorageConfig =
{
{ // BLOCK_CONFIG
{
0, // GPIO_PIN Pin;
false, // BOOL ActiveState;
},
(DeviceBlockInfo*)&Device_BlockInfo, // BlockDeviceinfo
},
{ // CPU_MEMORY_CONFIG
0, // UINT8 CPU_MEMORY_CONFIG::ChipSelect;
true, // UINT8 CPU_MEMORY_CONFIG::ReadOnly;
0, // UINT32 CPU_MEMORY_CONFIG::WaitStates;
0, // UINT32 CPU_MEMORY_CONFIG::ReleaseCounts;
16, // UINT32 CPU_MEMORY_CONFIG::BitWidth;
0x08000000, // UINT32 CPU_MEMORY_CONFIG::BaseAddress;
0x00200000, // UINT32 CPU_MEMORY_CONFIG::SizeInBytes;
0, // UINT8 CPU_MEMORY_CONFIG::XREADYEnable
0, // UINT8 CPU_MEMORY_CONFIG::ByteSignalsForRead
0, // UINT8 CPU_MEMORY_CONFIG::ExternalBufferEnable
},
0, // UINT32 ChipProtection;
0, // UINT32 ManufacturerCode;
0, // UINT32 DeviceCode;
};
BlockStorageDevice Device_BlockStorage;
| {
"content_hash": "6210edaaecf71fb7afb4f19e4ad416fc",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 91,
"avg_line_length": 41.62068965517241,
"alnum_prop": 0.4908864954432477,
"repo_name": "nanoframework/nf-interpreter",
"id": "a553771f36bb0dbd7fd44338ceec00a847652d39",
"size": "2616",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "targets/TI_SimpleLink/TI_CC3220SF_LAUNCHXL/common/Device_BlockStorage.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "53250"
},
{
"name": "Batchfile",
"bytes": "3951"
},
{
"name": "C",
"bytes": "10956982"
},
{
"name": "C#",
"bytes": "7307"
},
{
"name": "C++",
"bytes": "4901068"
},
{
"name": "CMake",
"bytes": "634934"
},
{
"name": "PowerShell",
"bytes": "201566"
},
{
"name": "Shell",
"bytes": "2976"
}
],
"symlink_target": ""
} |
ps3
===
Completed Problem Set 3 of CS4414, Fall 2013. Many improvements could be done; shouldn't be used for anything real.
| {
"content_hash": "bf899f3fbccf099d8871d70531700ed0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 115,
"avg_line_length": 31.25,
"alnum_prop": 0.76,
"repo_name": "wbthomason/cs4414-ps3",
"id": "3d8b84b53a6cbec6e3c9858218cd31a4ab50a279",
"size": "125",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "1575"
},
{
"name": "Rust",
"bytes": "24291"
}
],
"symlink_target": ""
} |
(function (domGlobals) {
'use strict';
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
var clone = function () {
return Cell(get());
};
return {
get: get,
set: set,
clone: clone
};
};
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var compose = function (fa, fb) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return fa(fb.apply(null, args));
};
};
var constant = function (value) {
return function () {
return value;
};
};
var never = constant(false);
var always = constant(true);
var never$1 = never;
var always$1 = always;
var none = function () {
return NONE;
};
var NONE = function () {
var eq = function (o) {
return o.isNone();
};
var call = function (thunk) {
return thunk();
};
var id = function (n) {
return n;
};
var noop = function () {
};
var nul = function () {
return null;
};
var undef = function () {
return undefined;
};
var me = {
fold: function (n, s) {
return n();
},
is: never$1,
isSome: never$1,
isNone: always$1,
getOr: id,
getOrThunk: call,
getOrDie: function (msg) {
throw new Error(msg || 'error: getOrDie called on none.');
},
getOrNull: nul,
getOrUndefined: undef,
or: id,
orThunk: call,
map: none,
ap: none,
each: noop,
bind: none,
flatten: none,
exists: never$1,
forall: always$1,
filter: none,
equals: eq,
equals_: eq,
toArray: function () {
return [];
},
toString: constant('none()')
};
if (Object.freeze) {
Object.freeze(me);
}
return me;
}();
var some = function (a) {
var constant_a = function () {
return a;
};
var self = function () {
return me;
};
var map = function (f) {
return some(f(a));
};
var bind = function (f) {
return f(a);
};
var me = {
fold: function (n, s) {
return s(a);
},
is: function (v) {
return a === v;
},
isSome: always$1,
isNone: never$1,
getOr: constant_a,
getOrThunk: constant_a,
getOrDie: constant_a,
getOrNull: constant_a,
getOrUndefined: constant_a,
or: self,
orThunk: self,
map: map,
ap: function (optfab) {
return optfab.fold(none, function (fab) {
return some(fab(a));
});
},
each: function (f) {
f(a);
},
bind: bind,
flatten: constant_a,
exists: bind,
forall: bind,
filter: function (f) {
return f(a) ? me : NONE;
},
equals: function (o) {
return o.is(a);
},
equals_: function (o, elementEq) {
return o.fold(never$1, function (b) {
return elementEq(a, b);
});
},
toArray: function () {
return [a];
},
toString: function () {
return 'some(' + a + ')';
}
};
return me;
};
var from = function (value) {
return value === null || value === undefined ? NONE : some(value);
};
var Option = {
some: some,
none: none,
from: from
};
var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')();
var path = function (parts, scope) {
var o = scope !== undefined && scope !== null ? scope : Global;
for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i) {
o = o[parts[i]];
}
return o;
};
var resolve = function (p, scope) {
var parts = p.split('.');
return path(parts, scope);
};
var unsafe = function (name, scope) {
return resolve(name, scope);
};
var getOrDie = function (name, scope) {
var actual = unsafe(name, scope);
if (actual === undefined || actual === null) {
throw new Error(name + ' not available on this browser');
}
return actual;
};
var Global$1 = { getOrDie: getOrDie };
function SandBlob (parts, properties) {
var f = Global$1.getOrDie('Blob');
return new f(parts, properties);
}
function FileReader () {
var f = Global$1.getOrDie('FileReader');
return new f();
}
function Uint8Array (arr) {
var f = Global$1.getOrDie('Uint8Array');
return new f(arr);
}
var requestAnimationFrame = function (callback) {
var f = Global$1.getOrDie('requestAnimationFrame');
f(callback);
};
var atob = function (base64) {
var f = Global$1.getOrDie('atob');
return f(base64);
};
var Window = {
atob: atob,
requestAnimationFrame: requestAnimationFrame
};
function create(width, height) {
return resize(domGlobals.document.createElement('canvas'), width, height);
}
function clone(canvas) {
var tCanvas = create(canvas.width, canvas.height);
var ctx = get2dContext(tCanvas);
ctx.drawImage(canvas, 0, 0);
return tCanvas;
}
function get2dContext(canvas) {
return canvas.getContext('2d');
}
function resize(canvas, width, height) {
canvas.width = width;
canvas.height = height;
return canvas;
}
function getWidth(image) {
return image.naturalWidth || image.width;
}
function getHeight(image) {
return image.naturalHeight || image.height;
}
var promise = function () {
var Promise = function (fn) {
if (typeof this !== 'object') {
throw new TypeError('Promises must be constructed via new');
}
if (typeof fn !== 'function') {
throw new TypeError('not a function');
}
this._state = null;
this._value = null;
this._deferreds = [];
doResolve(fn, bind(resolve, this), bind(reject, this));
};
var asap = Promise.immediateFn || typeof window.setImmediate === 'function' && window.setImmediate || function (fn) {
domGlobals.setTimeout(fn, 1);
};
function bind(fn, thisArg) {
return function () {
return fn.apply(thisArg, arguments);
};
}
var isArray = Array.isArray || function (value) {
return Object.prototype.toString.call(value) === '[object Array]';
};
function handle(deferred) {
var me = this;
if (this._state === null) {
this._deferreds.push(deferred);
return;
}
asap(function () {
var cb = me._state ? deferred.onFulfilled : deferred.onRejected;
if (cb === null) {
(me._state ? deferred.resolve : deferred.reject)(me._value);
return;
}
var ret;
try {
ret = cb(me._value);
} catch (e) {
deferred.reject(e);
return;
}
deferred.resolve(ret);
});
}
function resolve(newValue) {
try {
if (newValue === this) {
throw new TypeError('A promise cannot be resolved with itself.');
}
if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
var then = newValue.then;
if (typeof then === 'function') {
doResolve(bind(then, newValue), bind(resolve, this), bind(reject, this));
return;
}
}
this._state = true;
this._value = newValue;
finale.call(this);
} catch (e) {
reject.call(this, e);
}
}
function reject(newValue) {
this._state = false;
this._value = newValue;
finale.call(this);
}
function finale() {
for (var _i = 0, _a = this._deferreds; _i < _a.length; _i++) {
var deferred = _a[_i];
handle.call(this, deferred);
}
this._deferreds = [];
}
function Handler(onFulfilled, onRejected, resolve, reject) {
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
this.onRejected = typeof onRejected === 'function' ? onRejected : null;
this.resolve = resolve;
this.reject = reject;
}
function doResolve(fn, onFulfilled, onRejected) {
var done = false;
try {
fn(function (value) {
if (done) {
return;
}
done = true;
onFulfilled(value);
}, function (reason) {
if (done) {
return;
}
done = true;
onRejected(reason);
});
} catch (ex) {
if (done) {
return;
}
done = true;
onRejected(ex);
}
}
Promise.prototype.catch = function (onRejected) {
return this.then(null, onRejected);
};
Promise.prototype.then = function (onFulfilled, onRejected) {
var me = this;
return new Promise(function (resolve, reject) {
handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject));
});
};
Promise.all = function () {
var values = [];
for (var _i = 0; _i < arguments.length; _i++) {
values[_i] = arguments[_i];
}
var args = Array.prototype.slice.call(values.length === 1 && isArray(values[0]) ? values[0] : values);
return new Promise(function (resolve, reject) {
if (args.length === 0) {
return resolve([]);
}
var remaining = args.length;
function res(i, val) {
try {
if (val && (typeof val === 'object' || typeof val === 'function')) {
var then = val.then;
if (typeof then === 'function') {
then.call(val, function (val) {
res(i, val);
}, reject);
return;
}
}
args[i] = val;
if (--remaining === 0) {
resolve(args);
}
} catch (ex) {
reject(ex);
}
}
for (var i = 0; i < args.length; i++) {
res(i, args[i]);
}
});
};
Promise.resolve = function (value) {
if (value && typeof value === 'object' && value.constructor === Promise) {
return value;
}
return new Promise(function (resolve) {
resolve(value);
});
};
Promise.reject = function (reason) {
return new Promise(function (resolve, reject) {
reject(reason);
});
};
Promise.race = function (values) {
return new Promise(function (resolve, reject) {
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
var value = values_1[_i];
value.then(resolve, reject);
}
});
};
return Promise;
};
var Promise = window.Promise ? window.Promise : promise();
function imageToBlob(image) {
var src = image.src;
if (src.indexOf('data:') === 0) {
return dataUriToBlob(src);
}
return anyUriToBlob(src);
}
function blobToImage(blob) {
return new Promise(function (resolve, reject) {
var blobUrl = domGlobals.URL.createObjectURL(blob);
var image = new domGlobals.Image();
var removeListeners = function () {
image.removeEventListener('load', loaded);
image.removeEventListener('error', error);
};
function loaded() {
removeListeners();
resolve(image);
}
function error() {
removeListeners();
reject('Unable to load data of type ' + blob.type + ': ' + blobUrl);
}
image.addEventListener('load', loaded);
image.addEventListener('error', error);
image.src = blobUrl;
if (image.complete) {
loaded();
}
});
}
function anyUriToBlob(url) {
return new Promise(function (resolve, reject) {
var xhr = new domGlobals.XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onload = function () {
if (this.status === 200) {
resolve(this.response);
}
};
xhr.onerror = function () {
var _this = this;
var corsError = function () {
var obj = new Error('No access to download image');
obj.code = 18;
obj.name = 'SecurityError';
return obj;
};
var genericError = function () {
return new Error('Error ' + _this.status + ' downloading image');
};
reject(this.status === 0 ? corsError() : genericError());
};
xhr.send();
});
}
function dataUriToBlobSync(uri) {
var data = uri.split(',');
var matches = /data:([^;]+)/.exec(data[0]);
if (!matches) {
return Option.none();
}
var mimetype = matches[1];
var base64 = data[1];
var sliceSize = 1024;
var byteCharacters = Window.atob(base64);
var bytesLength = byteCharacters.length;
var slicesCount = Math.ceil(bytesLength / sliceSize);
var byteArrays = new Array(slicesCount);
for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
var begin = sliceIndex * sliceSize;
var end = Math.min(begin + sliceSize, bytesLength);
var bytes = new Array(end - begin);
for (var offset = begin, i = 0; offset < end; ++i, ++offset) {
bytes[i] = byteCharacters[offset].charCodeAt(0);
}
byteArrays[sliceIndex] = Uint8Array(bytes);
}
return Option.some(SandBlob(byteArrays, { type: mimetype }));
}
function dataUriToBlob(uri) {
return new Promise(function (resolve, reject) {
dataUriToBlobSync(uri).fold(function () {
reject('uri is not base64: ' + uri);
}, resolve);
});
}
function canvasToBlob(canvas, type, quality) {
type = type || 'image/png';
if (domGlobals.HTMLCanvasElement.prototype.toBlob) {
return new Promise(function (resolve, reject) {
canvas.toBlob(function (blob) {
if (blob) {
resolve(blob);
} else {
reject();
}
}, type, quality);
});
} else {
return dataUriToBlob(canvas.toDataURL(type, quality));
}
}
function canvasToDataURL(canvas, type, quality) {
type = type || 'image/png';
return canvas.toDataURL(type, quality);
}
function blobToCanvas(blob) {
return blobToImage(blob).then(function (image) {
revokeImageUrl(image);
var canvas = create(getWidth(image), getHeight(image));
var context = get2dContext(canvas);
context.drawImage(image, 0, 0);
return canvas;
});
}
function blobToDataUri(blob) {
return new Promise(function (resolve) {
var reader = FileReader();
reader.onloadend = function () {
resolve(reader.result);
};
reader.readAsDataURL(blob);
});
}
function revokeImageUrl(image) {
domGlobals.URL.revokeObjectURL(image.src);
}
var blobToImage$1 = function (blob) {
return blobToImage(blob);
};
var imageToBlob$1 = function (image) {
return imageToBlob(image);
};
function create$1(getCanvas, blob, uri) {
var initialType = blob.type;
var getType = constant(initialType);
function toBlob() {
return Promise.resolve(blob);
}
function toDataURL() {
return uri;
}
function toBase64() {
return uri.split(',')[1];
}
function toAdjustedBlob(type, quality) {
return getCanvas.then(function (canvas) {
return canvasToBlob(canvas, type, quality);
});
}
function toAdjustedDataURL(type, quality) {
return getCanvas.then(function (canvas) {
return canvasToDataURL(canvas, type, quality);
});
}
function toAdjustedBase64(type, quality) {
return toAdjustedDataURL(type, quality).then(function (dataurl) {
return dataurl.split(',')[1];
});
}
function toCanvas() {
return getCanvas.then(clone);
}
return {
getType: getType,
toBlob: toBlob,
toDataURL: toDataURL,
toBase64: toBase64,
toAdjustedBlob: toAdjustedBlob,
toAdjustedDataURL: toAdjustedDataURL,
toAdjustedBase64: toAdjustedBase64,
toCanvas: toCanvas
};
}
function fromBlob(blob) {
return blobToDataUri(blob).then(function (uri) {
return create$1(blobToCanvas(blob), blob, uri);
});
}
function fromCanvas(canvas, type) {
return canvasToBlob(canvas, type).then(function (blob) {
return create$1(Promise.resolve(canvas), blob, canvas.toDataURL());
});
}
function rotate(ir, angle) {
return ir.toCanvas().then(function (canvas) {
return applyRotate(canvas, ir.getType(), angle);
});
}
function applyRotate(image, type, angle) {
var canvas = create(image.width, image.height);
var context = get2dContext(canvas);
var translateX = 0;
var translateY = 0;
angle = angle < 0 ? 360 + angle : angle;
if (angle === 90 || angle === 270) {
resize(canvas, canvas.height, canvas.width);
}
if (angle === 90 || angle === 180) {
translateX = canvas.width;
}
if (angle === 270 || angle === 180) {
translateY = canvas.height;
}
context.translate(translateX, translateY);
context.rotate(angle * Math.PI / 180);
context.drawImage(image, 0, 0);
return fromCanvas(canvas, type);
}
function flip(ir, axis) {
return ir.toCanvas().then(function (canvas) {
return applyFlip(canvas, ir.getType(), axis);
});
}
function applyFlip(image, type, axis) {
var canvas = create(image.width, image.height);
var context = get2dContext(canvas);
if (axis === 'v') {
context.scale(1, -1);
context.drawImage(image, 0, -canvas.height);
} else {
context.scale(-1, 1);
context.drawImage(image, -canvas.width, 0);
}
return fromCanvas(canvas, type);
}
var flip$1 = function (ir, axis) {
return flip(ir, axis);
};
var rotate$1 = function (ir, angle) {
return rotate(ir, angle);
};
var blobToImageResult = function (blob) {
return fromBlob(blob);
};
var url = function () {
return Global$1.getOrDie('URL');
};
var createObjectURL = function (blob) {
return url().createObjectURL(blob);
};
var revokeObjectURL = function (u) {
url().revokeObjectURL(u);
};
var URL = {
createObjectURL: createObjectURL,
revokeObjectURL: revokeObjectURL
};
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Promise');
var global$4 = tinymce.util.Tools.resolve('tinymce.util.URI');
var getToolbarItems = function (editor) {
return editor.getParam('imagetools_toolbar', 'rotateleft rotateright flipv fliph editimage imageoptions');
};
var getProxyUrl = function (editor) {
return editor.getParam('imagetools_proxy');
};
var getCorsHosts = function (editor) {
return editor.getParam('imagetools_cors_hosts', [], 'string[]');
};
var getCredentialsHosts = function (editor) {
return editor.getParam('imagetools_credentials_hosts', [], 'string[]');
};
var getFetchImage = function (editor) {
return Option.from(editor.getParam('imagetools_fetch_image', null, 'function'));
};
var getApiKey = function (editor) {
return editor.getParam('api_key', editor.getParam('imagetools_api_key', '', 'string'), 'string');
};
var getUploadTimeout = function (editor) {
return editor.getParam('images_upload_timeout', 30000, 'number');
};
var shouldReuseFilename = function (editor) {
return editor.getParam('images_reuse_filename', false, 'boolean');
};
function getImageSize(img) {
var width, height;
function isPxValue(value) {
return /^[0-9\.]+px$/.test(value);
}
width = img.style.width;
height = img.style.height;
if (width || height) {
if (isPxValue(width) && isPxValue(height)) {
return {
w: parseInt(width, 10),
h: parseInt(height, 10)
};
}
return null;
}
width = img.width;
height = img.height;
if (width && height) {
return {
w: parseInt(width, 10),
h: parseInt(height, 10)
};
}
return null;
}
function setImageSize(img, size) {
var width, height;
if (size) {
width = img.style.width;
height = img.style.height;
if (width || height) {
img.style.width = size.w + 'px';
img.style.height = size.h + 'px';
img.removeAttribute('data-mce-style');
}
width = img.width;
height = img.height;
if (width || height) {
img.setAttribute('width', size.w);
img.setAttribute('height', size.h);
}
}
}
function getNaturalImageSize(img) {
return {
w: img.naturalWidth,
h: img.naturalHeight
};
}
var ImageSize = {
getImageSize: getImageSize,
setImageSize: setImageSize,
getNaturalImageSize: getNaturalImageSize
};
var typeOf = function (x) {
if (x === null) {
return 'null';
}
var t = typeof x;
if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
return 'array';
}
if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
return 'string';
}
return t;
};
var isType = function (type) {
return function (value) {
return typeOf(value) === type;
};
};
var isFunction = isType('function');
var slice = Array.prototype.slice;
var find = function (xs, pred) {
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
if (pred(x, i, xs)) {
return Option.some(x);
}
}
return Option.none();
};
var from$1 = isFunction(Array.from) ? Array.from : function (x) {
return slice.call(x);
};
function XMLHttpRequest () {
var f = Global$1.getOrDie('XMLHttpRequest');
return new f();
}
var isValue = function (obj) {
return obj !== null && obj !== undefined;
};
var traverse = function (json, path) {
var value;
value = path.reduce(function (result, key) {
return isValue(result) ? result[key] : undefined;
}, json);
return isValue(value) ? value : null;
};
var requestUrlAsBlob = function (url, headers, withCredentials) {
return new global$3(function (resolve) {
var xhr;
xhr = XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
resolve({
status: xhr.status,
blob: this.response
});
}
};
xhr.open('GET', url, true);
xhr.withCredentials = withCredentials;
global$1.each(headers, function (value, key) {
xhr.setRequestHeader(key, value);
});
xhr.responseType = 'blob';
xhr.send();
});
};
var readBlob = function (blob) {
return new global$3(function (resolve) {
var fr = FileReader();
fr.onload = function (e) {
var data = e.target;
resolve(data.result);
};
fr.readAsText(blob);
});
};
var parseJson = function (text) {
var json;
try {
json = JSON.parse(text);
} catch (ex) {
}
return json;
};
var Utils = {
traverse: traverse,
readBlob: readBlob,
requestUrlAsBlob: requestUrlAsBlob,
parseJson: parseJson
};
var friendlyHttpErrors = [
{
code: 404,
message: 'Could not find Image Proxy'
},
{
code: 403,
message: 'Rejected request'
},
{
code: 0,
message: 'Incorrect Image Proxy URL'
}
];
var friendlyServiceErrors = [
{
type: 'key_missing',
message: 'The request did not include an api key.'
},
{
type: 'key_not_found',
message: 'The provided api key could not be found.'
},
{
type: 'domain_not_trusted',
message: 'The api key is not valid for the request origins.'
}
];
var isServiceErrorCode = function (code) {
return code === 400 || code === 403 || code === 500;
};
var getHttpErrorMsg = function (status) {
var message = find(friendlyHttpErrors, function (error) {
return status === error.code;
}).fold(constant('Unknown ImageProxy error'), function (error) {
return error.message;
});
return 'ImageProxy HTTP error: ' + message;
};
var handleHttpError = function (status) {
var message = getHttpErrorMsg(status);
return global$3.reject(message);
};
var getServiceErrorMsg = function (type) {
return find(friendlyServiceErrors, function (error) {
return error.type === type;
}).fold(constant('Unknown service error'), function (error) {
return error.message;
});
};
var getServiceError = function (text) {
var serviceError = Utils.parseJson(text);
var errorType = Utils.traverse(serviceError, [
'error',
'type'
]);
var errorMsg = errorType ? getServiceErrorMsg(errorType) : 'Invalid JSON in service error message';
return 'ImageProxy Service error: ' + errorMsg;
};
var handleServiceError = function (status, blob) {
return Utils.readBlob(blob).then(function (text) {
var serviceError = getServiceError(text);
return global$3.reject(serviceError);
});
};
var handleServiceErrorResponse = function (status, blob) {
return isServiceErrorCode(status) ? handleServiceError(status, blob) : handleHttpError(status);
};
var Errors = {
handleServiceErrorResponse: handleServiceErrorResponse,
handleHttpError: handleHttpError,
getHttpErrorMsg: getHttpErrorMsg,
getServiceErrorMsg: getServiceErrorMsg
};
var appendApiKey = function (url, apiKey) {
var separator = url.indexOf('?') === -1 ? '?' : '&';
if (/[?&]apiKey=/.test(url) || !apiKey) {
return url;
} else {
return url + separator + 'apiKey=' + encodeURIComponent(apiKey);
}
};
var requestServiceBlob = function (url, apiKey) {
var headers = {
'Content-Type': 'application/json;charset=UTF-8',
'tiny-api-key': apiKey
};
return Utils.requestUrlAsBlob(appendApiKey(url, apiKey), headers, false).then(function (result) {
return result.status < 200 || result.status >= 300 ? Errors.handleServiceErrorResponse(result.status, result.blob) : global$3.resolve(result.blob);
});
};
function requestBlob(url, withCredentials) {
return Utils.requestUrlAsBlob(url, {}, withCredentials).then(function (result) {
return result.status < 200 || result.status >= 300 ? Errors.handleHttpError(result.status) : global$3.resolve(result.blob);
});
}
var getUrl = function (url, apiKey, withCredentials) {
return apiKey ? requestServiceBlob(url, apiKey) : requestBlob(url, withCredentials);
};
var node = function () {
var f = Global$1.getOrDie('Node');
return f;
};
var compareDocumentPosition = function (a, b, match) {
return (a.compareDocumentPosition(b) & match) !== 0;
};
var documentPositionPreceding = function (a, b) {
return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
};
var documentPositionContainedBy = function (a, b) {
return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
};
var Node = {
documentPositionPreceding: documentPositionPreceding,
documentPositionContainedBy: documentPositionContainedBy
};
var cached = function (f) {
var called = false;
var r;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!called) {
called = true;
r = f.apply(null, args);
}
return r;
};
};
var firstMatch = function (regexes, s) {
for (var i = 0; i < regexes.length; i++) {
var x = regexes[i];
if (x.test(s)) {
return x;
}
}
return undefined;
};
var find$1 = function (regexes, agent) {
var r = firstMatch(regexes, agent);
if (!r) {
return {
major: 0,
minor: 0
};
}
var group = function (i) {
return Number(agent.replace(r, '$' + i));
};
return nu(group(1), group(2));
};
var detect = function (versionRegexes, agent) {
var cleanedAgent = String(agent).toLowerCase();
if (versionRegexes.length === 0) {
return unknown();
}
return find$1(versionRegexes, cleanedAgent);
};
var unknown = function () {
return nu(0, 0);
};
var nu = function (major, minor) {
return {
major: major,
minor: minor
};
};
var Version = {
nu: nu,
detect: detect,
unknown: unknown
};
var edge = 'Edge';
var chrome = 'Chrome';
var ie = 'IE';
var opera = 'Opera';
var firefox = 'Firefox';
var safari = 'Safari';
var isBrowser = function (name, current) {
return function () {
return current === name;
};
};
var unknown$1 = function () {
return nu$1({
current: undefined,
version: Version.unknown()
});
};
var nu$1 = function (info) {
var current = info.current;
var version = info.version;
return {
current: current,
version: version,
isEdge: isBrowser(edge, current),
isChrome: isBrowser(chrome, current),
isIE: isBrowser(ie, current),
isOpera: isBrowser(opera, current),
isFirefox: isBrowser(firefox, current),
isSafari: isBrowser(safari, current)
};
};
var Browser = {
unknown: unknown$1,
nu: nu$1,
edge: constant(edge),
chrome: constant(chrome),
ie: constant(ie),
opera: constant(opera),
firefox: constant(firefox),
safari: constant(safari)
};
var windows = 'Windows';
var ios = 'iOS';
var android = 'Android';
var linux = 'Linux';
var osx = 'OSX';
var solaris = 'Solaris';
var freebsd = 'FreeBSD';
var isOS = function (name, current) {
return function () {
return current === name;
};
};
var unknown$2 = function () {
return nu$2({
current: undefined,
version: Version.unknown()
});
};
var nu$2 = function (info) {
var current = info.current;
var version = info.version;
return {
current: current,
version: version,
isWindows: isOS(windows, current),
isiOS: isOS(ios, current),
isAndroid: isOS(android, current),
isOSX: isOS(osx, current),
isLinux: isOS(linux, current),
isSolaris: isOS(solaris, current),
isFreeBSD: isOS(freebsd, current)
};
};
var OperatingSystem = {
unknown: unknown$2,
nu: nu$2,
windows: constant(windows),
ios: constant(ios),
android: constant(android),
linux: constant(linux),
osx: constant(osx),
solaris: constant(solaris),
freebsd: constant(freebsd)
};
var DeviceType = function (os, browser, userAgent) {
var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
var isiPhone = os.isiOS() && !isiPad;
var isAndroid3 = os.isAndroid() && os.version.major === 3;
var isAndroid4 = os.isAndroid() && os.version.major === 4;
var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
var isTouch = os.isiOS() || os.isAndroid();
var isPhone = isTouch && !isTablet;
var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
return {
isiPad: constant(isiPad),
isiPhone: constant(isiPhone),
isTablet: constant(isTablet),
isPhone: constant(isPhone),
isTouch: constant(isTouch),
isAndroid: os.isAndroid,
isiOS: os.isiOS,
isWebView: constant(iOSwebview)
};
};
var detect$1 = function (candidates, userAgent) {
var agent = String(userAgent).toLowerCase();
return find(candidates, function (candidate) {
return candidate.search(agent);
});
};
var detectBrowser = function (browsers, userAgent) {
return detect$1(browsers, userAgent).map(function (browser) {
var version = Version.detect(browser.versionRegexes, userAgent);
return {
current: browser.name,
version: version
};
});
};
var detectOs = function (oses, userAgent) {
return detect$1(oses, userAgent).map(function (os) {
var version = Version.detect(os.versionRegexes, userAgent);
return {
current: os.name,
version: version
};
});
};
var UaString = {
detectBrowser: detectBrowser,
detectOs: detectOs
};
var contains = function (str, substr) {
return str.indexOf(substr) !== -1;
};
var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
var checkContains = function (target) {
return function (uastring) {
return contains(uastring, target);
};
};
var browsers = [
{
name: 'Edge',
versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
search: function (uastring) {
return contains(uastring, 'edge/') && contains(uastring, 'chrome') && contains(uastring, 'safari') && contains(uastring, 'applewebkit');
}
},
{
name: 'Chrome',
versionRegexes: [
/.*?chrome\/([0-9]+)\.([0-9]+).*/,
normalVersionRegex
],
search: function (uastring) {
return contains(uastring, 'chrome') && !contains(uastring, 'chromeframe');
}
},
{
name: 'IE',
versionRegexes: [
/.*?msie\ ?([0-9]+)\.([0-9]+).*/,
/.*?rv:([0-9]+)\.([0-9]+).*/
],
search: function (uastring) {
return contains(uastring, 'msie') || contains(uastring, 'trident');
}
},
{
name: 'Opera',
versionRegexes: [
normalVersionRegex,
/.*?opera\/([0-9]+)\.([0-9]+).*/
],
search: checkContains('opera')
},
{
name: 'Firefox',
versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
search: checkContains('firefox')
},
{
name: 'Safari',
versionRegexes: [
normalVersionRegex,
/.*?cpu os ([0-9]+)_([0-9]+).*/
],
search: function (uastring) {
return (contains(uastring, 'safari') || contains(uastring, 'mobile/')) && contains(uastring, 'applewebkit');
}
}
];
var oses = [
{
name: 'Windows',
search: checkContains('win'),
versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
},
{
name: 'iOS',
search: function (uastring) {
return contains(uastring, 'iphone') || contains(uastring, 'ipad');
},
versionRegexes: [
/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
/.*cpu os ([0-9]+)_([0-9]+).*/,
/.*cpu iphone os ([0-9]+)_([0-9]+).*/
]
},
{
name: 'Android',
search: checkContains('android'),
versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
},
{
name: 'OSX',
search: checkContains('os x'),
versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
},
{
name: 'Linux',
search: checkContains('linux'),
versionRegexes: []
},
{
name: 'Solaris',
search: checkContains('sunos'),
versionRegexes: []
},
{
name: 'FreeBSD',
search: checkContains('freebsd'),
versionRegexes: []
}
];
var PlatformInfo = {
browsers: constant(browsers),
oses: constant(oses)
};
var detect$2 = function (userAgent) {
var browsers = PlatformInfo.browsers();
var oses = PlatformInfo.oses();
var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu);
var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
var deviceType = DeviceType(os, browser, userAgent);
return {
browser: browser,
os: os,
deviceType: deviceType
};
};
var PlatformDetection = { detect: detect$2 };
var detect$3 = cached(function () {
var userAgent = domGlobals.navigator.userAgent;
return PlatformDetection.detect(userAgent);
});
var PlatformDetection$1 = { detect: detect$3 };
var fromHtml = function (html, scope) {
var doc = scope || domGlobals.document;
var div = doc.createElement('div');
div.innerHTML = html;
if (!div.hasChildNodes() || div.childNodes.length > 1) {
domGlobals.console.error('HTML does not have a single root node', html);
throw new Error('HTML must have a single root node');
}
return fromDom(div.childNodes[0]);
};
var fromTag = function (tag, scope) {
var doc = scope || domGlobals.document;
var node = doc.createElement(tag);
return fromDom(node);
};
var fromText = function (text, scope) {
var doc = scope || domGlobals.document;
var node = doc.createTextNode(text);
return fromDom(node);
};
var fromDom = function (node) {
if (node === null || node === undefined) {
throw new Error('Node cannot be null or undefined');
}
return { dom: constant(node) };
};
var fromPoint = function (docElm, x, y) {
var doc = docElm.dom();
return Option.from(doc.elementFromPoint(x, y)).map(fromDom);
};
var Element = {
fromHtml: fromHtml,
fromTag: fromTag,
fromText: fromText,
fromDom: fromDom,
fromPoint: fromPoint
};
var ATTRIBUTE = domGlobals.Node.ATTRIBUTE_NODE;
var CDATA_SECTION = domGlobals.Node.CDATA_SECTION_NODE;
var COMMENT = domGlobals.Node.COMMENT_NODE;
var DOCUMENT = domGlobals.Node.DOCUMENT_NODE;
var DOCUMENT_TYPE = domGlobals.Node.DOCUMENT_TYPE_NODE;
var DOCUMENT_FRAGMENT = domGlobals.Node.DOCUMENT_FRAGMENT_NODE;
var ELEMENT = domGlobals.Node.ELEMENT_NODE;
var TEXT = domGlobals.Node.TEXT_NODE;
var PROCESSING_INSTRUCTION = domGlobals.Node.PROCESSING_INSTRUCTION_NODE;
var ENTITY_REFERENCE = domGlobals.Node.ENTITY_REFERENCE_NODE;
var ENTITY = domGlobals.Node.ENTITY_NODE;
var NOTATION = domGlobals.Node.NOTATION_NODE;
var ELEMENT$1 = ELEMENT;
var is = function (element, selector) {
var elem = element.dom();
if (elem.nodeType !== ELEMENT$1) {
return false;
} else if (elem.matches !== undefined) {
return elem.matches(selector);
} else if (elem.msMatchesSelector !== undefined) {
return elem.msMatchesSelector(selector);
} else if (elem.webkitMatchesSelector !== undefined) {
return elem.webkitMatchesSelector(selector);
} else if (elem.mozMatchesSelector !== undefined) {
return elem.mozMatchesSelector(selector);
} else {
throw new Error('Browser lacks native selectors');
}
};
var regularContains = function (e1, e2) {
var d1 = e1.dom();
var d2 = e2.dom();
return d1 === d2 ? false : d1.contains(d2);
};
var ieContains = function (e1, e2) {
return Node.documentPositionContainedBy(e1.dom(), e2.dom());
};
var browser = PlatformDetection$1.detect().browser;
var contains$1 = browser.isIE() ? ieContains : regularContains;
var child = function (scope, predicate) {
var result = find(scope.dom().childNodes, compose(predicate, Element.fromDom));
return result.map(Element.fromDom);
};
var child$1 = function (scope, selector) {
return child(scope, function (e) {
return is(e, selector);
});
};
var count = 0;
var getFigureImg = function (elem) {
return child$1(Element.fromDom(elem), 'img');
};
var isFigure = function (editor, elem) {
return editor.dom.is(elem, 'figure');
};
var getEditableImage = function (editor, elem) {
var isImage = function (imgNode) {
return editor.dom.is(imgNode, 'img:not([data-mce-object],[data-mce-placeholder])');
};
var isEditable = function (imgNode) {
return isImage(imgNode) && (isLocalImage(editor, imgNode) || isCorsImage(editor, imgNode) || editor.settings.imagetools_proxy);
};
if (isFigure(editor, elem)) {
var imgOpt = getFigureImg(elem);
return imgOpt.map(function (img) {
return isEditable(img.dom()) ? Option.some(img.dom()) : Option.none();
});
}
return isEditable(elem) ? Option.some(elem) : Option.none();
};
var displayError = function (editor, error) {
editor.notificationManager.open({
text: error,
type: 'error'
});
};
var getSelectedImage = function (editor) {
var elem = editor.selection.getNode();
if (isFigure(editor, elem)) {
return getFigureImg(elem);
} else {
return Option.some(Element.fromDom(elem));
}
};
var extractFilename = function (editor, url) {
var m = url.match(/\/([^\/\?]+)?\.(?:jpeg|jpg|png|gif)(?:\?|$)/i);
if (m) {
return editor.dom.encode(m[1]);
}
return null;
};
var createId = function () {
return 'imagetools' + count++;
};
var isLocalImage = function (editor, img) {
var url = img.src;
return url.indexOf('data:') === 0 || url.indexOf('blob:') === 0 || new global$4(url).host === editor.documentBaseURI.host;
};
var isCorsImage = function (editor, img) {
return global$1.inArray(getCorsHosts(editor), new global$4(img.src).host) !== -1;
};
var isCorsWithCredentialsImage = function (editor, img) {
return global$1.inArray(getCredentialsHosts(editor), new global$4(img.src).host) !== -1;
};
var defaultFetchImage = function (editor, img) {
var src = img.src, apiKey;
if (isCorsImage(editor, img)) {
return getUrl(img.src, null, isCorsWithCredentialsImage(editor, img));
}
if (!isLocalImage(editor, img)) {
src = getProxyUrl(editor);
src += (src.indexOf('?') === -1 ? '?' : '&') + 'url=' + encodeURIComponent(img.src);
apiKey = getApiKey(editor);
return getUrl(src, apiKey, false);
}
return imageToBlob$1(img);
};
var imageToBlob$2 = function (editor, img) {
return getFetchImage(editor).fold(function () {
return defaultFetchImage(editor, img);
}, function (customFetchImage) {
return customFetchImage(img);
});
};
var findBlob = function (editor, img) {
var blobInfo;
blobInfo = editor.editorUpload.blobCache.getByUri(img.src);
if (blobInfo) {
return global$3.resolve(blobInfo.blob());
}
return imageToBlob$2(editor, img);
};
var startTimedUpload = function (editor, imageUploadTimerState) {
var imageUploadTimer = global$2.setEditorTimeout(editor, function () {
editor.editorUpload.uploadImagesAuto();
}, getUploadTimeout(editor));
imageUploadTimerState.set(imageUploadTimer);
};
var cancelTimedUpload = function (imageUploadTimerState) {
global$2.clearTimeout(imageUploadTimerState.get());
};
var updateSelectedImage = function (editor, ir, uploadImmediately, imageUploadTimerState, selectedImage, size) {
return ir.toBlob().then(function (blob) {
var uri, name, blobCache, blobInfo;
blobCache = editor.editorUpload.blobCache;
uri = selectedImage.src;
if (shouldReuseFilename(editor)) {
blobInfo = blobCache.getByUri(uri);
if (blobInfo) {
uri = blobInfo.uri();
name = blobInfo.name();
} else {
name = extractFilename(editor, uri);
}
}
blobInfo = blobCache.create({
id: createId(),
blob: blob,
base64: ir.toBase64(),
uri: uri,
name: name
});
blobCache.add(blobInfo);
editor.undoManager.transact(function () {
function imageLoadedHandler() {
editor.$(selectedImage).off('load', imageLoadedHandler);
editor.nodeChanged();
if (uploadImmediately) {
editor.editorUpload.uploadImagesAuto();
} else {
cancelTimedUpload(imageUploadTimerState);
startTimedUpload(editor, imageUploadTimerState);
}
}
editor.$(selectedImage).on('load', imageLoadedHandler);
if (size) {
editor.$(selectedImage).attr({
width: size.w,
height: size.h
});
}
editor.$(selectedImage).attr({ src: blobInfo.blobUri() }).removeAttr('data-mce-src');
});
return blobInfo;
});
};
var selectedImageOperation = function (editor, imageUploadTimerState, fn, size) {
return function () {
var imgOpt = getSelectedImage(editor);
return imgOpt.fold(function () {
displayError(editor, 'Could not find selected image');
}, function (img) {
return editor._scanForImages().then(function () {
return findBlob(editor, img.dom());
}).then(blobToImageResult).then(fn).then(function (imageResult) {
return updateSelectedImage(editor, imageResult, false, imageUploadTimerState, img.dom(), size);
}, function (error) {
displayError(editor, error);
});
});
};
};
var rotate$2 = function (editor, imageUploadTimerState, angle) {
return function () {
var imgOpt = getSelectedImage(editor);
var flippedSize = imgOpt.fold(function () {
return null;
}, function (img) {
var size = ImageSize.getImageSize(img.dom());
return size ? {
w: size.h,
h: size.w
} : null;
});
return selectedImageOperation(editor, imageUploadTimerState, function (imageResult) {
return rotate$1(imageResult, angle);
}, flippedSize)();
};
};
var flip$2 = function (editor, imageUploadTimerState, axis) {
return function () {
return selectedImageOperation(editor, imageUploadTimerState, function (imageResult) {
return flip$1(imageResult, axis);
})();
};
};
var handleDialogBlob = function (editor, imageUploadTimerState, img, originalSize, blob) {
return new global$3(function (resolve) {
blobToImage$1(blob).then(function (newImage) {
var newSize = ImageSize.getNaturalImageSize(newImage);
if (originalSize.w !== newSize.w || originalSize.h !== newSize.h) {
if (ImageSize.getImageSize(img)) {
ImageSize.setImageSize(img, newSize);
}
}
URL.revokeObjectURL(newImage.src);
return blob;
}).then(blobToImageResult).then(function (imageResult) {
return updateSelectedImage(editor, imageResult, true, imageUploadTimerState, img);
}, function () {
});
});
};
var Actions = {
rotate: rotate$2,
flip: flip$2,
getEditableImage: getEditableImage,
cancelTimedUpload: cancelTimedUpload,
findBlob: findBlob,
getSelectedImage: getSelectedImage,
handleDialogBlob: handleDialogBlob
};
var saveState = constant('save-state');
var disable = constant('disable');
var enable = constant('enable');
var createState = function (blob) {
return {
blob: blob,
url: URL.createObjectURL(blob)
};
};
var makeOpen = function (editor, imageUploadTimerState) {
return function () {
var getLoadedSpec = function (currentState) {
return {
title: 'Edit Image',
size: 'large',
body: {
type: 'panel',
items: [{
type: 'imagetools',
name: 'imagetools',
label: 'Edit Image',
currentState: currentState
}]
},
buttons: [
{
type: 'cancel',
name: 'cancel',
text: 'Cancel'
},
{
type: 'submit',
name: 'save',
text: 'Save',
primary: true,
disabled: true
}
],
onSubmit: function (api) {
var blob = api.getData().imagetools.blob;
originalImgOpt.each(function (originalImg) {
originalSizeOpt.each(function (originalSize) {
Actions.handleDialogBlob(editor, imageUploadTimerState, originalImg.dom(), originalSize, blob);
});
});
api.close();
},
onCancel: function () {
},
onAction: function (api, details) {
switch (details.name) {
case saveState():
if (details.value) {
api.enable('save');
} else {
api.disable('save');
}
break;
case disable():
api.disable('save');
api.disable('cancel');
break;
case enable():
api.enable('cancel');
break;
}
}
};
};
var originalImgOpt = Actions.getSelectedImage(editor);
var originalSizeOpt = originalImgOpt.map(function (origImg) {
return ImageSize.getNaturalImageSize(origImg.dom());
});
var imgOpt = Actions.getSelectedImage(editor);
imgOpt.each(function (img) {
Actions.getEditableImage(editor, img.dom()).each(function (_) {
Actions.findBlob(editor, img.dom()).then(function (blob) {
var state = createState(blob);
editor.windowManager.open(getLoadedSpec(state));
});
});
});
};
};
var Dialog = { makeOpen: makeOpen };
var register = function (editor, imageUploadTimerState) {
global$1.each({
mceImageRotateLeft: Actions.rotate(editor, imageUploadTimerState, -90),
mceImageRotateRight: Actions.rotate(editor, imageUploadTimerState, 90),
mceImageFlipVertical: Actions.flip(editor, imageUploadTimerState, 'v'),
mceImageFlipHorizontal: Actions.flip(editor, imageUploadTimerState, 'h'),
mceEditImage: Dialog.makeOpen(editor, imageUploadTimerState)
}, function (fn, cmd) {
editor.addCommand(cmd, fn);
});
};
var Commands = { register: register };
var setup = function (editor, imageUploadTimerState, lastSelectedImageState) {
editor.on('NodeChange', function (e) {
var lastSelectedImage = lastSelectedImageState.get();
if (lastSelectedImage && lastSelectedImage.src !== e.element.src) {
Actions.cancelTimedUpload(imageUploadTimerState);
editor.editorUpload.uploadImagesAuto();
lastSelectedImageState.set(null);
}
Actions.getEditableImage(editor, e.element).each(lastSelectedImageState.set);
});
};
var UploadSelectedImage = { setup: setup };
var register$1 = function (editor) {
var cmd = function (command) {
return function () {
return editor.execCommand(command);
};
};
editor.ui.registry.addButton('rotateleft', {
tooltip: 'Rotate counterclockwise',
icon: 'rotate-left',
onAction: cmd('mceImageRotateLeft')
});
editor.ui.registry.addButton('rotateright', {
tooltip: 'Rotate clockwise',
icon: 'rotate-right',
onAction: cmd('mceImageRotateRight')
});
editor.ui.registry.addButton('flipv', {
tooltip: 'Flip vertically',
icon: 'flip-vertically',
onAction: cmd('mceImageFlipVertical')
});
editor.ui.registry.addButton('fliph', {
tooltip: 'Flip horizontally',
icon: 'flip-horizontally',
onAction: cmd('mceImageFlipHorizontal')
});
editor.ui.registry.addButton('editimage', {
tooltip: 'Edit image',
icon: 'edit-image',
onAction: cmd('mceEditImage'),
onSetup: function (buttonApi) {
var setDisabled = function () {
var elementOpt = Actions.getSelectedImage(editor);
elementOpt.each(function (element) {
var disabled = Actions.getEditableImage(editor, element.dom()).isNone();
buttonApi.setDisabled(disabled);
});
};
editor.on('NodeChange', setDisabled);
return function () {
editor.off('NodeChange', setDisabled);
};
}
});
editor.ui.registry.addButton('imageoptions', {
tooltip: 'Image options',
icon: 'image-options',
onAction: cmd('mceImage')
});
editor.ui.registry.addContextMenu('imagetools', {
update: function (element) {
return Actions.getEditableImage(editor, element).fold(function () {
return [];
}, function (_) {
return [{
text: 'Edit image',
icon: 'edit-image',
onAction: cmd('mceEditImage')
}];
});
}
});
};
var Buttons = { register: register$1 };
var register$2 = function (editor) {
editor.ui.registry.addContextToolbar('imagetools', {
items: getToolbarItems(editor),
predicate: function (elem) {
return Actions.getEditableImage(editor, elem).isSome();
},
position: 'node',
scope: 'node'
});
};
var ContextToolbar = { register: register$2 };
function Plugin () {
global.add('imagetools', function (editor) {
var imageUploadTimerState = Cell(0);
var lastSelectedImageState = Cell(null);
Commands.register(editor, imageUploadTimerState);
Buttons.register(editor);
ContextToolbar.register(editor);
UploadSelectedImage.setup(editor, imageUploadTimerState, lastSelectedImageState);
});
}
Plugin();
}(window));
| {
"content_hash": "5e5545e598d4264288f932626c4ecc33",
"timestamp": "",
"source": "github",
"line_count": 1813,
"max_line_length": 155,
"avg_line_length": 31.217319360176504,
"alnum_prop": 0.5444104811209075,
"repo_name": "extend1994/cdnjs",
"id": "3bef323f157869858a54c45f760c737943cc36dd",
"size": "56881",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "ajax/libs/tinymce/5.0.12/plugins/imagetools/plugin.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?php
namespace Sabre\VObject;
use Sabre\Xml;
class Writer
{
/**
* Serializes a vCard or iCalendar object.
*
* @param Component $component
*
* @return string
*/
public static function write(Component $component)
{
return $component->serialize();
}
/**
* Serializes a jCal or jCard object.
*
* @param Component $component
* @param int $options
*
* @return string
*/
public static function writeJson(Component $component, $options = 0)
{
return json_encode($component, $options);
}
/**
* Serializes a xCal or xCard object.
*
* @param Component $component
*
* @return string
*/
public static function writeXml(Component $component)
{
$writer = new Xml\Writer();
$writer->openMemory();
$writer->setIndent(true);
$writer->startDocument('1.0', 'utf-8');
if ($component instanceof Component\VCalendar) {
$writer->startElement('icalendar');
$writer->writeAttribute('xmlns', Parser\XML::XCAL_NAMESPACE);
} else {
$writer->startElement('vcards');
$writer->writeAttribute('xmlns', Parser\XML::XCARD_NAMESPACE);
}
$component->xmlSerialize($writer);
$writer->endElement();
return $writer->outputMemory();
}
}
| {
"content_hash": "7d64616555a16f11daa3239d12b3646c",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 74,
"avg_line_length": 21.875,
"alnum_prop": 0.5635714285714286,
"repo_name": "linagora/sabre-vobject",
"id": "c70a6ae4d4fbd2d6ae7abb905fbc2e1e3bc9e086",
"size": "1709",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "lib/Writer.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "1068596"
}
],
"symlink_target": ""
} |
from django.test import SimpleTestCase
from corehq.apps.users.admin import CustomUserAdmin
class CustomUserAdminTest(SimpleTestCase):
def test_fieldsets(self):
"""
Test that the value of CustomUserAdmin.fieldsets,
dynamically calculated by removing fields from UserAdmin,
matches hard-coded value.
This will alert us of any changes to Django's own UserAdmin that affect this,
and allow us to make any changes necessitated by that.
This is probably over-careful, but might help us quickly avoid a surprise.
"""
self.assertEqual(CustomUserAdmin.fieldsets, (
(None, {'fields': ('username', 'password')}),
('Personal info', {'fields': ('first_name', 'last_name', 'email')}),
('Permissions', {'fields': ('is_active', 'groups', 'user_permissions')}),
('Important dates', {'fields': ('last_login', 'date_joined')}),
))
| {
"content_hash": "43237152143e14f111cd56187fea5b10",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 85,
"avg_line_length": 39.583333333333336,
"alnum_prop": 0.6378947368421053,
"repo_name": "dimagi/commcare-hq",
"id": "28063745a3868710d069fb87016a43a71318e315",
"size": "950",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "corehq/apps/users/tests/test_admin.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "82928"
},
{
"name": "Dockerfile",
"bytes": "2341"
},
{
"name": "HTML",
"bytes": "2589268"
},
{
"name": "JavaScript",
"bytes": "5889543"
},
{
"name": "Jinja",
"bytes": "3693"
},
{
"name": "Less",
"bytes": "176180"
},
{
"name": "Makefile",
"bytes": "1622"
},
{
"name": "PHP",
"bytes": "2232"
},
{
"name": "PLpgSQL",
"bytes": "66704"
},
{
"name": "Python",
"bytes": "21779773"
},
{
"name": "Roff",
"bytes": "150"
},
{
"name": "Shell",
"bytes": "67473"
}
],
"symlink_target": ""
} |
What happens when you press the power button
TBD
## TODO
- [ ] run level
| {
"content_hash": "ef47227064a7e70a9c6ba50590645dc1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 44,
"avg_line_length": 10.857142857142858,
"alnum_prop": 0.6842105263157895,
"repo_name": "at15/sre-handbook",
"id": "9480ec535df59e4f66b9bb557ff63acc20adc318",
"size": "91",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "questions/what-happens-when-you/system-boot.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
Rails.application.routes.draw do
mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
root 'breathe#index', as: 'root'
post '/city_data' => 'cities#city_data'
get '/cached_city_data' => 'cities#cached_city_data'
get '/city_data_back' => 'cities#city_data_back'
get '/favorite_city' => 'cities#favorite_city'
get '/display_favorite_cities' => 'cities#display_favorite_cities'
get 'auth/:provider/callback', to: "sessions#create"
get 'authentication_test/:name' => "sessions#create", as: 'auth_test'
get 'auth/failure', to: redirect('/')
get 'signout', to: 'sessions#destroy', as: 'signout'
resources :sessions, only: [:create, :destroy]
get 'authcheck' => "sessions#checklogged"
post '/markers' => 'markers#create'
get '/markers' => 'markers#show'
delete '/markers' => 'markers#delete'
put '/markers' => 'markers#edit'
resources :cities, :clients
get '/email_confirm/:id/:num' => 'email_confirm#confirming', as: 'email_confirm'
get '/delete_email/:id/:num' => 'email_confirm#delete_email', as: 'delete_email'
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
| {
"content_hash": "c757bd89ce2db493674606d3fd003b90",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 84,
"avg_line_length": 28.891304347826086,
"alnum_prop": 0.6482317531978932,
"repo_name": "simonmaude/breathe-cal",
"id": "b6bddbe0e07848a5d2021a72cb683857678735a3",
"size": "2658",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/routes.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "73502"
},
{
"name": "CoffeeScript",
"bytes": "1055"
},
{
"name": "Gherkin",
"bytes": "38611"
},
{
"name": "HTML",
"bytes": "188434"
},
{
"name": "JavaScript",
"bytes": "71684"
},
{
"name": "Ruby",
"bytes": "131513"
}
],
"symlink_target": ""
} |
@extends('shop::base')
@section('aimeos_body')
Privacy policy page
@stop
| {
"content_hash": "ae1bf29c8075379a7e1dfaa27f6ca9f8",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 23,
"avg_line_length": 15,
"alnum_prop": 0.7066666666666667,
"repo_name": "Yvler/aimeos-laravel",
"id": "a044886e11bc7a54d64d00703bd0a285dcfabdbd",
"size": "75",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/views/page/privacy.blade.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "191098"
},
{
"name": "JavaScript",
"bytes": "23553"
},
{
"name": "PHP",
"bytes": "65911"
}
],
"symlink_target": ""
} |
@class DLCImagePickerController;
@protocol DLCImagePickerDelegate <NSObject>
@optional
- (void)imagePickerController:(DLCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info;
- (void)imagePickerControllerDidCancel:(DLCImagePickerController *)picker;
@end
@interface DLCImagePickerController : UIViewController <UINavigationControllerDelegate,UIImagePickerControllerDelegate>
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *filterViewBottomConstraint;
@property (nonatomic, weak) IBOutlet GPUImageView *imageView;
@property (nonatomic, weak) id <DLCImagePickerDelegate> delegate;
@property (nonatomic, weak) IBOutlet UIButton *photoCaptureButton;
@property (nonatomic, weak) IBOutlet UIButton *cancelButton;
@property (nonatomic, weak) IBOutlet UIButton *cameraToggleButton;
@property (nonatomic, weak) IBOutlet UIButton *blurToggleButton;
@property (nonatomic, weak) IBOutlet UIButton *filtersToggleButton;
@property (nonatomic, weak) IBOutlet UIButton *libraryToggleButton;
@property (nonatomic, weak) IBOutlet UIButton *flashToggleButton;
@property (nonatomic, weak) IBOutlet UIButton *retakeButton;
@property (nonatomic, weak) IBOutlet UIScrollView *filterScrollView;
@property (nonatomic, weak) IBOutlet UIImageView *filtersBackgroundImageView;
@property (nonatomic, weak) IBOutlet UIView *photoBar;
@property (nonatomic, weak) IBOutlet UIView *topBar;
@property (nonatomic, strong) DLCBlurOverlayView *blurOverlayView;
@property (nonatomic, strong) UIImageView *focusView;
@property (nonatomic, assign) CGFloat outputJPEGQuality;
@property (nonatomic, assign) CGSize requestedImageSize;
@end
| {
"content_hash": "4ec33c47d93b326d87e48e12010ac542",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 120,
"avg_line_length": 48.3235294117647,
"alnum_prop": 0.8265368228849665,
"repo_name": "wilferrel/AGACameraAndPictureFilter",
"id": "f8dfd25e30f75cc8d4e42bab3ee415c4dc779b78",
"size": "1904",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Classes/DLCImagePickerController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "39133"
},
{
"name": "Ruby",
"bytes": "1257"
}
],
"symlink_target": ""
} |
0.12.15 (Mar 2018)
==================
Bokeh Version ``0.12.15`` is an incremental update that adds a few
important features and fixes several bugs. Some of the highlights
include:
* Addressed several WebGL bugs :bokeh-issue:`6867`, :bokeh-issue:`7087`, :bokeh-issue:`7211`, :bokeh-issue:`7681`
* Switched to Chrome headless for CI image tests, will support better WebGL testing :bokeh-issue:`6594`
* Updated data source selections to be proper Bokeh models :bokeh-issue:`6845`
* Fixed memory leaks with certain kinds of Bokeh server usage :bokeh-issue:`7468`
* Added new glyphs for hexagon markers and hex tiles, and a new `hexbin` method :bokeh-issue:`7638`, :bokeh-issue:`4786`
* Completed BokehJS port to TypeScript :bokeh-issue:`6481`
Many other small bugfixes and docs additions. For full details see the
:bokeh-tree:`CHANGELOG`.
Additionally, we are pleased to announce `Bokeh joins NumFOCUS Sponsored Projects`_.
.. _Bokeh joins NumFOCUS Sponsored Projects: https://www.numfocus.org/blog/bokeh-joins-sponsored-projects/).
Migration Guide
---------------
NOTE: the 0.12.x series is the last planned release series before a version
1.0 release. For more information see the `project roadmap`_.
DataTable
~~~~~~~~~
The mis-named property ``DataTable.row_header`` has been deprecated. This
property confusingly controlled the presence of an index column in a
DataTable. Now, use the ``index_position`` property to specify where
an index column should be located in the table (use ``None`` to suppress
the index column).
Additionally, new properties ``index_header`` and ``index_width`` are
now available to further customize the index column appearance.
Selections
~~~~~~~~~~
The handling of selections has needed attention in Bokeh for some time.
This release adds a new Bokeh model :class:`~bokeh.models.selections.Selection`
to represent selections on data sources. Having a proper Bokeh model makes
selections simpler to use and to synchronize in apps than the previous
"bare dict" that represented selections.
The new :class:`~bokeh.models.selections.Selection` model is found in
the same location on data sources, i.e. ``source.selected``. It has the
following properties:
.. code-block:: python
.indices # which scatter typer indices have been hit
# previously selected["1d"].indices
.line_indices # which point(s) on a line have been hit
# previously selected["0d"].indices
.multiline_indices # which points on which line of a MultiLine
# previously selected["2d"].indices
In the near future, a property ``image_indices`` will be added to support
hit testing of image glyphs.
All code should update to use these new properties. For now *read only*
access to things like ``selected['1d'].indicies`` will continue to function
as before for compatibility. However, programmtically *setting* selections
must now go through the mode properties, i.e. ``.indices``, ``.line_indices``,
etc.
Grid Bounds
~~~~~~~~~~~
Grids now automatically defer to any existing axis bounds when their
own bounds are set to `"auto"`. Previously grids used always used the full
range bounds. This change makes it simpler to have axes and grids both
use a consistent set of bounds.
Minor Ticks
~~~~~~~~~~~
Minor ticks are no longer displayed outside explicitly set axis bounds.
Previously minor ticks would display one extra "major tick" distance outside
explicit range bounds.
NO_DATA_RENDERERS
~~~~~~~~~~~~~~~~~
This validation warning resulted in false or irrelevant warnings in many
reasonable configurations, and has been removed.
Document and ServerContext callbacks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All `Document` and `ServerContext` methods that add callbacks can now add
the same callback multiple times.
Methods that remove callbacks now receive the value returned from a previous
method call that added the callback. Example:
.. code-block:: python
# Was
doc.add_next_tick_callback(my_cb)
doc.remove_next_tick_callback(my_cb)
# Now
cb_id = doc.add_next_tick_callback(my_cb)
doc.remove_next_tick_callback(cb_id)
Sphinx Version
~~~~~~~~~~~~~~
The `bokeh.sphinxext` Sphinx extension has been updated to work with currnt
versions. Sphinx >= 1.6 is now required to use the extension.
.. _project roadmap: https://bokehplots.com/pages/roadmap.html
| {
"content_hash": "d1bc588651b4734d9fdc874ee2277a73",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 120,
"avg_line_length": 35.80487804878049,
"alnum_prop": 0.7286557674841053,
"repo_name": "Karel-van-de-Plassche/bokeh",
"id": "f0fb4ae07aa4f1b4941a710a238b0ef6ea98c28c",
"size": "4404",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sphinx/source/docs/releases/0.12.15.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1442"
},
{
"name": "CSS",
"bytes": "102094"
},
{
"name": "CoffeeScript",
"bytes": "462899"
},
{
"name": "HTML",
"bytes": "46193"
},
{
"name": "JavaScript",
"bytes": "24563"
},
{
"name": "Makefile",
"bytes": "1150"
},
{
"name": "Python",
"bytes": "2705342"
},
{
"name": "Shell",
"bytes": "8995"
},
{
"name": "TypeScript",
"bytes": "1468291"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML>
<html lang="de">
<head>
<!-- Generated by javadoc (18) -->
<title>Source code</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="source: package: com.restfb.types.webhook, class: FeedReactionValue">
<meta name="generator" content="javadoc/SourceToHTMLConverter">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body class="source-page">
<main role="main">
<div class="source-container">
<pre><span class="source-line-no">001</span><span id="line-1">// Generated by delombok at Tue Sep 27 22:25:18 CEST 2022</span>
<span class="source-line-no">002</span><span id="line-2"></span>
<span class="source-line-no">023</span><span id="line-23">package com.restfb.types.webhook;</span>
<span class="source-line-no">024</span><span id="line-24"></span>
<span class="source-line-no">025</span><span id="line-25">import com.restfb.Facebook;</span>
<span class="source-line-no">026</span><span id="line-26">import com.restfb.types.webhook.base.AbstractFeedPostValue;</span>
<span class="source-line-no">027</span><span id="line-27"></span>
<span class="source-line-no">028</span><span id="line-28">/**</span>
<span class="source-line-no">029</span><span id="line-29"> * Change value describing a reaction to a post/comment/reply.</span>
<span class="source-line-no">030</span><span id="line-30"> */</span>
<span class="source-line-no">031</span><span id="line-31">public class FeedReactionValue extends AbstractFeedPostValue {</span>
<span class="source-line-no">032</span><span id="line-32"> @Facebook("parent_id")</span>
<span class="source-line-no">033</span><span id="line-33"> private String parentId;</span>
<span class="source-line-no">034</span><span id="line-34"> @Facebook("reaction_type")</span>
<span class="source-line-no">035</span><span id="line-35"> private String reactionType;</span>
<span class="source-line-no">036</span><span id="line-36"> @Facebook("comment_id")</span>
<span class="source-line-no">037</span><span id="line-37"> private String commentId;</span>
<span class="source-line-no">038</span><span id="line-38"></span>
<span class="source-line-no">039</span><span id="line-39"> /**</span>
<span class="source-line-no">040</span><span id="line-40"> * returns <code>true</code> if the reaction was made on a Post</span>
<span class="source-line-no">041</span><span id="line-41"> * </span>
<span class="source-line-no">042</span><span id="line-42"> * @return <code>true</code> if the reaction was made on a Post</span>
<span class="source-line-no">043</span><span id="line-43"> */</span>
<span class="source-line-no">044</span><span id="line-44"> public boolean isPostReaction() {</span>
<span class="source-line-no">045</span><span id="line-45"> return commentId == null;</span>
<span class="source-line-no">046</span><span id="line-46"> }</span>
<span class="source-line-no">047</span><span id="line-47"></span>
<span class="source-line-no">048</span><span id="line-48"> /**</span>
<span class="source-line-no">049</span><span id="line-49"> * returns <code>true</code> if the reaction was made on a Comment, <code>false</code> if the reaction was made on a</span>
<span class="source-line-no">050</span><span id="line-50"> * post</span>
<span class="source-line-no">051</span><span id="line-51"> * </span>
<span class="source-line-no">052</span><span id="line-52"> * @return <code>true</code> if the reaction was made on a Comment</span>
<span class="source-line-no">053</span><span id="line-53"> */</span>
<span class="source-line-no">054</span><span id="line-54"> public boolean isCommentReaction() {</span>
<span class="source-line-no">055</span><span id="line-55"> return commentId != null;</span>
<span class="source-line-no">056</span><span id="line-56"> }</span>
<span class="source-line-no">057</span><span id="line-57"></span>
<span class="source-line-no">058</span><span id="line-58"> /**</span>
<span class="source-line-no">059</span><span id="line-59"> * returns <code>true</code> if the reaction was made on a Reply (comment of a comment),</span>
<span class="source-line-no">060</span><span id="line-60"> * </span>
<span class="source-line-no">061</span><span id="line-61"> * @return <code>true</code> if the reaction was made on a Reply</span>
<span class="source-line-no">062</span><span id="line-62"> */</span>
<span class="source-line-no">063</span><span id="line-63"> public boolean isReplyReaction() {</span>
<span class="source-line-no">064</span><span id="line-64"> return commentId != null && !getPostId().equals(parentId);</span>
<span class="source-line-no">065</span><span id="line-65"> }</span>
<span class="source-line-no">066</span><span id="line-66"></span>
<span class="source-line-no">067</span><span id="line-67"> @java.lang.SuppressWarnings("all")</span>
<span class="source-line-no">068</span><span id="line-68"> public String getParentId() {</span>
<span class="source-line-no">069</span><span id="line-69"> return this.parentId;</span>
<span class="source-line-no">070</span><span id="line-70"> }</span>
<span class="source-line-no">071</span><span id="line-71"></span>
<span class="source-line-no">072</span><span id="line-72"> @java.lang.SuppressWarnings("all")</span>
<span class="source-line-no">073</span><span id="line-73"> public void setParentId(final String parentId) {</span>
<span class="source-line-no">074</span><span id="line-74"> this.parentId = parentId;</span>
<span class="source-line-no">075</span><span id="line-75"> }</span>
<span class="source-line-no">076</span><span id="line-76"></span>
<span class="source-line-no">077</span><span id="line-77"> @java.lang.SuppressWarnings("all")</span>
<span class="source-line-no">078</span><span id="line-78"> public String getReactionType() {</span>
<span class="source-line-no">079</span><span id="line-79"> return this.reactionType;</span>
<span class="source-line-no">080</span><span id="line-80"> }</span>
<span class="source-line-no">081</span><span id="line-81"></span>
<span class="source-line-no">082</span><span id="line-82"> @java.lang.SuppressWarnings("all")</span>
<span class="source-line-no">083</span><span id="line-83"> public void setReactionType(final String reactionType) {</span>
<span class="source-line-no">084</span><span id="line-84"> this.reactionType = reactionType;</span>
<span class="source-line-no">085</span><span id="line-85"> }</span>
<span class="source-line-no">086</span><span id="line-86"></span>
<span class="source-line-no">087</span><span id="line-87"> @java.lang.SuppressWarnings("all")</span>
<span class="source-line-no">088</span><span id="line-88"> public String getCommentId() {</span>
<span class="source-line-no">089</span><span id="line-89"> return this.commentId;</span>
<span class="source-line-no">090</span><span id="line-90"> }</span>
<span class="source-line-no">091</span><span id="line-91"></span>
<span class="source-line-no">092</span><span id="line-92"> @java.lang.SuppressWarnings("all")</span>
<span class="source-line-no">093</span><span id="line-93"> public void setCommentId(final String commentId) {</span>
<span class="source-line-no">094</span><span id="line-94"> this.commentId = commentId;</span>
<span class="source-line-no">095</span><span id="line-95"> }</span>
<span class="source-line-no">096</span><span id="line-96">}</span>
</pre>
</div>
</main>
</body>
</html>
| {
"content_hash": "b606b5f0a9bb381b011f4bfa757b2955",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 207,
"avg_line_length": 49.506493506493506,
"alnum_prop": 0.6766789087093389,
"repo_name": "restfb/restfb.github.io",
"id": "4e385b7f8b5ea60af6e4ed237dee801512cf41f7",
"size": "10054",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "javadoc/src-html/com/restfb/types/webhook/FeedReactionValue.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5482"
},
{
"name": "HTML",
"bytes": "25044"
},
{
"name": "JavaScript",
"bytes": "16395"
},
{
"name": "SCSS",
"bytes": "14167"
}
],
"symlink_target": ""
} |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questions', '0053_related_name'),
('tasks', '0031_related_name'),
]
operations = [
migrations.AddField(
model_name='task',
name='catalogs',
field=models.ManyToManyField(blank=True, help_text='The catalogs this task can be used with. An empty list implies that this task can be used with every catalog.', to='questions.Catalog', verbose_name='Catalogs'),
),
]
| {
"content_hash": "9e4acbb35a2a3645b0699fd2e902c7ad",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 225,
"avg_line_length": 32.11764705882353,
"alnum_prop": 0.6282051282051282,
"repo_name": "rdmorganiser/rdmo",
"id": "e72ba4213277b239a27eaf8a199d3b79b5e7a002",
"size": "596",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "rdmo/tasks/migrations/0032_task_catalogs.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "426256"
},
{
"name": "JavaScript",
"bytes": "110821"
},
{
"name": "Python",
"bytes": "1265092"
},
{
"name": "SCSS",
"bytes": "20373"
}
],
"symlink_target": ""
} |
/**
* @file
**/
#pragma once
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "modules/planning/common/obstacle.h"
namespace apollo {
namespace planning {
class PredictionQuerier {
public:
PredictionQuerier(const std::vector<const Obstacle*>& obstacles,
const std::shared_ptr<std::vector<common::PathPoint>>&
ptr_reference_line);
virtual ~PredictionQuerier() = default;
std::vector<const Obstacle*> GetObstacles() const;
double ProjectVelocityAlongReferenceLine(const std::string& obstacle_id,
const double s,
const double t) const;
private:
std::unordered_map<std::string, const Obstacle*> id_obstacle_map_;
std::vector<const Obstacle*> obstacles_;
std::shared_ptr<std::vector<common::PathPoint>> ptr_reference_line_;
};
} // namespace planning
} // namespace apollo
| {
"content_hash": "8079bcb851dd0cad7bfb7dc30781fb87",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 74,
"avg_line_length": 23.11904761904762,
"alnum_prop": 0.631307929969104,
"repo_name": "jinghaomiao/apollo",
"id": "6bdd9d9bd4fa785c9b5dd1b070a3e78094f06f9a",
"size": "1743",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "modules/planning/lattice/behavior/prediction_querier.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "1922"
},
{
"name": "Batchfile",
"bytes": "791"
},
{
"name": "C",
"bytes": "17934"
},
{
"name": "C++",
"bytes": "17875261"
},
{
"name": "CMake",
"bytes": "3600"
},
{
"name": "CSS",
"bytes": "44631"
},
{
"name": "Cuda",
"bytes": "97324"
},
{
"name": "Dockerfile",
"bytes": "12364"
},
{
"name": "GLSL",
"bytes": "7000"
},
{
"name": "HTML",
"bytes": "21068"
},
{
"name": "JavaScript",
"bytes": "404879"
},
{
"name": "Makefile",
"bytes": "6626"
},
{
"name": "Python",
"bytes": "1999484"
},
{
"name": "Shell",
"bytes": "304772"
},
{
"name": "Smarty",
"bytes": "33150"
}
],
"symlink_target": ""
} |
/*
* 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 io.trino.connector.system;
import com.google.common.collect.ImmutableSet;
import io.trino.spi.connector.ConnectorSession;
import io.trino.spi.connector.SchemaTableName;
import io.trino.spi.connector.SystemTable;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static java.util.function.Function.identity;
public class StaticSystemTablesProvider
implements SystemTablesProvider
{
private final Set<SystemTable> systemTables;
private final Map<SchemaTableName, SystemTable> systemTablesMap;
public StaticSystemTablesProvider(Set<SystemTable> systemTables)
{
this.systemTables = ImmutableSet.copyOf(systemTables);
this.systemTablesMap = systemTables.stream()
.collect(toImmutableMap(
table -> table.getTableMetadata().getTable(),
identity()));
}
@Override
public Set<SystemTable> listSystemTables(ConnectorSession session)
{
return systemTables;
}
@Override
public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTableName tableName)
{
return Optional.ofNullable(systemTablesMap.get(tableName));
}
}
| {
"content_hash": "bd0bdea63150093b21229d1cb6b187c8",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 100,
"avg_line_length": 34.25925925925926,
"alnum_prop": 0.7335135135135135,
"repo_name": "smartnews/presto",
"id": "79068b83e17522472ef51e7677a6ff88282ccab2",
"size": "1850",
"binary": false,
"copies": "7",
"ref": "refs/heads/smartnews",
"path": "core/trino-main/src/main/java/io/trino/connector/system/StaticSystemTablesProvider.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "50268"
},
{
"name": "CSS",
"bytes": "13515"
},
{
"name": "Dockerfile",
"bytes": "1967"
},
{
"name": "Groovy",
"bytes": "1702"
},
{
"name": "HTML",
"bytes": "30842"
},
{
"name": "Java",
"bytes": "61596519"
},
{
"name": "JavaScript",
"bytes": "232261"
},
{
"name": "PLSQL",
"bytes": "85"
},
{
"name": "Python",
"bytes": "5266"
},
{
"name": "Scala",
"bytes": "10145"
},
{
"name": "Shell",
"bytes": "51516"
},
{
"name": "Smarty",
"bytes": "1938"
}
],
"symlink_target": ""
} |
function displayMWError() {
kony.ui.Alert("Middleware Error ", null, "error", null, null);
};
function displaySessionError() {
kony.ui.Alert("Session Expired .. Please re-login", null, "error", null, null);
};
function displayError(code, msg) {
// Commented for SWA: kony.ui.Alert("Error Code: "..code .." Message: " ..msg,null,"error",null,null);
kony.ui.Alert(code + "- " + msg, null, "error", null, null);
};
var mergeHeaders = function(httpHeaders, globalHeaders) {
for (var attrName in globalHeaders) {
httpHeaders[attrName] = globalHeaders[attrName];
}
return httpHeaders;
};
function appmiddlewareinvoker(inputParam, isBlocking, indicator, datasetID) {
var url = appConfig.url;
var sessionIdKey = "cacheid";
inputParam.appID = appConfig.appId;
inputParam.appver = appConfig.appVersion;
inputParam["channel"] = "rc";
inputParam["platform"] = kony.os.deviceInfo().name;
if (indicator) {
inputParam["indicator"] = indicator;
};
if (datasetID) {
inputParam["datasetID"] = datasetID;
};
inputParam[sessionIdKey] = sessionID;
if (globalhttpheaders) {
if (inputParam["httpheaders"]) {
inputParam.httpheaders = mergeHeaders(inputParam.httpheaders, globalhttpheaders);
} else {
inputParam["httpheaders"] = globalhttpheaders;
};
};
var resulttable = _invokeServiceSyncForMF_(url, inputParam, isBlocking);
if (resulttable) {
if (resulttable[sessionIdKey]) {
sessionID = resulttable[sessionIdKey];
};
};
return resulttable;
};
function appmiddlewaresecureinvoker(inputParam, isBlocking, indicator, datasetID) {
var url = appConfig.secureurl;
var sessionIdKey = "cacheid";
inputParam.appID = appConfig.appId;
inputParam.appver = appConfig.appVersion;
inputParam["channel"] = "rc";
inputParam["platform"] = kony.os.deviceInfo().name;
if (indicator) {
inputParam["indicator"] = indicator;
};
if (datasetID) {
inputParam["datasetID"] = datasetID;
};
inputParam[sessionIdKey] = sessionID;
if (globalhttpheaders) {
if (inputParam["httpheaders"]) {
inputParam.httpheaders = mergeHeaders(inputParam.httpheaders, globalhttpheaders);
} else {
inputParam["httpheaders"] = globalhttpheaders;
};
};
var resulttable = _invokeServiceSyncForMF_(url, inputParam, isBlocking);
if (resulttable) {
if (resulttable[sessionIdKey]) {
sessionID = resulttable[sessionIdKey];
};
};
return resulttable;
};
function appmiddlewareinvokerasync(inputParam, callBack) {
var url = appConfig.url;
var sessionIdKey = "cacheid";
inputParam.appID = appConfig.appId;
inputParam.appver = appConfig.appVersion;
inputParam["channel"] = "rc";
inputParam["platform"] = kony.os.deviceInfo().name;
inputParam[sessionIdKey] = sessionID;
if (globalhttpheaders) {
if (inputParam["httpheaders"]) {
inputParam.httpheaders = mergeHeaders(inputParam.httpheaders, globalhttpheaders);
} else {
inputParam.httpheaders = globalhttpheaders;
};
};
var connHandle = _invokeServiceAsyncForMF_(url, inputParam, callBack);
return connHandle;
};
function appmiddlewaresecureinvokerasync(inputParam, callBack) {
var url = appConfig.secureurl;
var sessionIdKey = "cacheid";
inputParam.appID = appConfig.appId;
inputParam.appver = appConfig.appVersion;
inputParam["channel"] = "rc";
inputParam["platform"] = kony.os.deviceInfo().name;
inputParam[sessionIdKey] = sessionID;
if (globalhttpheaders) {
if (inputParam["httpheaders"]) {
inputParam.httpheaders = mergeHeaders(inputParam.httpheaders, globalhttpheaders);
} else {
inputParam["httpheaders"] = globalhttpheaders;
};
};
var connHandle = _invokeServiceAsyncForMF_(url, inputParam, callBack);
return connHandle;
};
function mfgetidentityservice(idProviderName) {
var currentInstance = kony.sdk.getCurrentInstance();
if (!currentInstance) {
throw new Exception("INIT_FAILURE", "Please call init before getting identity provider");
}
return currentInstance.getIdentityService(idProviderName);
};
function mfintegrationsecureinvokerasync(inputParam, serviceID, operationID, callBack) {
var url = appConfig.secureurl;
var sessionIdKey = "cacheid";
inputParam.appID = appConfig.appId;
inputParam.appver = appConfig.appVersion;
inputParam["channel"] = "rc";
inputParam["platform"] = kony.os.deviceInfo().name;
inputParam[sessionIdKey] = sessionID;
if (globalhttpheaders) {
if (inputParam["httpheaders"]) {
inputParam.httpheaders = mergeHeaders(inputParam.httpheaders, globalhttpheaders);
} else {
inputParam["httpheaders"] = mergeHeaders({}, globalhttpheaders);
};
};
kony.print("Async : Invoking service through mobileFabric with url : " + url + " service id : " + serviceID + " operationid : " + operationID + "\n input params" + JSON.stringify(inputParam));
if (kony.mbaas) {
kony.mbaas.invokeMbaasServiceFromKonyStudio(url, inputParam, serviceID, operationID, callBack);
} else {
alert("Unable to find the mobileFabric SDK for KonyStudio. Please download the SDK from the Kony Cloud Console and add as module to the Kony Project.");
}
};
function mfintegrationsecureinvokersync(inputParam, serviceID, operationID) {
var url = appConfig.secureurl;
var sessionIdKey = "cacheid";
var resulttable;
inputParam.appID = appConfig.appId;
inputParam.appver = appConfig.appVersion;
inputParam["channel"] = "rc";
inputParam["platform"] = kony.os.deviceInfo().name;
inputParam[sessionIdKey] = sessionID;
if (globalhttpheaders) {
if (inputParam["httpheaders"]) {
inputParam.httpheaders = mergeHeaders(inputParam.httpheaders, globalhttpheaders);
} else {
inputParam["httpheaders"] = mergeHeaders({}, globalhttpheaders);
};
};
kony.print("Invoking service through mobileFabric with url : " + url + " service id : " + serviceID + " operationid : " + operationID + "\n input params" + JSON.stringify(inputParam));
if (kony.mbaas) {
resulttable = kony.mbaas.invokeMbaasServiceFromKonyStudioSync(url, inputParam, serviceID, operationID);
kony.print("Result table for service id : " + serviceID + " operationid : " + operationID + " : " + JSON.stringify(resulttable));
} else {
alert("Unable to find the mobileFabric SDK for KonyStudio. Please download the SDK from the Kony Cloud Console and add as module to the Kony Project.");
}
return resulttable;
};
_invokeServiceAsyncForMF_ = function(url, inputParam, callBack) {
var operationID = inputParam["serviceID"];
if (!operationID) {
resulttable = kony.net.invokeServiceAsync(url, inputParam, callBack);
} else {
var _mfServicesMap_ = {};
kony.print("Getting serviceID for : " + operationID);
var serviceID = _mfServicesMap_[operationID] && _mfServicesMap_[operationID]["servicename"];
kony.print("Got serviceID for : " + operationID + " : " + serviceID);
kony.print("Async : Invoking service through mobileFabric with url : " + url + " service id : " + serviceID + " operationid : " + operationID + "\n input params" + JSON.stringify(inputParam));
if (serviceID && operationID) {
var url = appConfig.secureurl;
if (kony.mbaas) {
kony.mbaas.invokeMbaasServiceFromKonyStudio(url, inputParam, serviceID, operationID, callBack);
} else {
alert("Unable to find the mobileFabric SDK for KonyStudio. Please download the SDK from the Kony Cloud Console and add as module to the Kony Project.");
}
} else {
resulttable = kony.net.invokeServiceAsync(url, inputParam, callBack);
}
}
};
_invokeServiceSyncForMF_ = function(url, inputParam, isBlocking) {
var resulttable;
var operationID = inputParam["serviceID"];
if (!operationID) {
resulttable = kony.net.invokeService(url, inputParam, isBlocking);
} else {
var _mfServicesMap_ = {};
kony.print("Getting serviceID for : " + operationID);
var serviceID = _mfServicesMap_[operationID] && _mfServicesMap_[operationID]["servicename"];
kony.print("Got serviceID for : " + operationID + " : " + serviceID);
kony.print("Invoking service through mobileFabric with url : " + url + " service id : " + serviceID + " operationid : " + operationID + "\n input params" + JSON.stringify(inputParam));
if (serviceID && operationID) {
var url = appConfig.secureurl;
if (kony.mbaas) {
resulttable = kony.mbaas.invokeMbaasServiceFromKonyStudioSync(url, inputParam, serviceID, operationID);
kony.print("Result table for service id : " + serviceID + " operationid : " + operationID + " : " + JSON.stringify(resulttable));
} else {
alert("Unable to find the mobileFabric SDK for KonyStudio. Please download the SDK from the Kony Cloud Console and add as module to the Kony Project.");
}
} else {
resulttable = kony.net.invokeService(url, inputParam, isBlocking);
}
}
return resulttable;
};
/*
Sample invocation code
var inputparam = {};
inputparam.options = {
"access": "online",
"CRUD_TYPE": "get",//get/create..
"odataurl": "$filter=UserId eq xxx",
"data" : {a:1,b:2}//in case of create/update
};
*/
function mfobjectsecureinvokerasync(inputParam, serviceID, objectID, callBack) {
var options = {
"access": inputParam.options.access
};
var serviceObj = kony.sdk.getCurrentInstance().getObjectService(serviceID, options);
var CRUD_TYPE = inputParam.options.CRUD_TYPE;
switch (CRUD_TYPE) {
case 'get':
var dataObject = new kony.sdk.dto.DataObject(objectID);
var headers = inputParam.httpheaders || {};
if (inputParam.options && inputParam.options.odataurl) dataObject.setOdataUrl(inputParam.options.odataurl.toString());
options = {
"dataObject": dataObject,
"headers": headers
};
serviceObj.fetch(options, callBack, callBack);
break;
case 'create':
var dataObject = new kony.sdk.dto.DataObject(objectID);
var headers = inputParam.httpheaders || {};
var data = inputParam.options && inputParam.options.data || {};
var key;
for (key in data) {
dataObject.addField(key, data[key]);
}
options = {
"dataObject": dataObject,
"headers": headers
};
serviceObj.create(options, callBack, callBack);
break;
case 'update':
var dataObject = new kony.sdk.dto.DataObject(objectID);
var headers = inputParam.httpheaders || {};
var data = inputParam.options && inputParam.options.data || {};
var key;
for (key in data) {
dataObject.addField(key, data[key]);
}
options = {
"dataObject": dataObject,
"headers": headers
};
serviceObj.update(options, callBack, callBack);
break;
case 'partialupdate':
var dataObject = new kony.sdk.dto.DataObject(objectID);
var headers = inputParam.httpheaders || {};
var data = inputParam.options && inputParam.options.data || {};
var key;
for (key in data) {
dataObject.addField(key, data[key]);
}
options = {
"dataObject": dataObject,
"headers": headers
};
serviceObj.partialUpdate(options, callBack, callBack);
break;
case 'delete':
var dataObject = new kony.sdk.dto.DataObject(objectID);
var headers = inputParam.httpheaders || {};
var data = inputParam.options && inputParam.options.data || {};
var key;
for (key in data) {
dataObject.addField(key, data[key]);
}
options = {
"dataObject": dataObject,
"headers": headers
};
serviceObj.deleteRecord(options, callBack, callBack);
break;
default:
}
};
function appmenuseq() {
frmHome.show();
};
function callAppMenu() {
var appMenu = [
["appmenuitemid1", "Item 1", "option1.png", appmenuseq, {}],
["appmenuitemid2", "Item 2", "option2.png", appmenuseq, {}],
["appmenuitemid3", "Item 3", "option3.png", appmenuseq, {}],
["appmenuitemid4", "Item 4", "option4.png", appmenuseq, {}]
];
kony.application.createAppMenu("sampAppMenu", appMenu, "", "");
kony.application.setCurrentAppMenu("sampAppMenu");
};
function makeCall(eventobject) {
kony.phone.dial(eventobject.text);
};
function initializeGlobalVariables() {}; | {
"content_hash": "db2e329320280698f0995ecbfb30efb4",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 200,
"avg_line_length": 40.91437308868502,
"alnum_prop": 0.6240376709769041,
"repo_name": "kony/OAuthSample",
"id": "3c66333e5e7df7db5daeb6a040a09d5cf967e639",
"size": "13379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "visualizer code/KonySampleOAuth/jssrc/android/generated/application.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "258"
},
{
"name": "CSS",
"bytes": "3719"
},
{
"name": "HTML",
"bytes": "2481"
},
{
"name": "Java",
"bytes": "2971"
},
{
"name": "JavaScript",
"bytes": "2699868"
},
{
"name": "Shell",
"bytes": "195"
}
],
"symlink_target": ""
} |
using System;
using Gtk;
using OpenTK;
using OpenTK.Input;
using Sharp;
using Sharp.Editor.Views;
using System.IO;
using System.Security.Cryptography;
using System.Collections.Generic;
using Antmicro.Migrant;
using System.Text;
//gwen to sharp.ui
public partial class MainWindow : Gtk.Window
{
public static Vector2 lastPos;
public static bool GLinit = false;
public static MainEditorView mainEditorView = new MainEditorView();
public static View focusedView;
public MainWindow() : base(Gtk.WindowType.Toplevel)
{
Build();
GLib.Idle.Add(new GLib.IdleHandler(OnIdleProcessMain));
}
static int oriX, oriY;
protected bool OnIdleProcessMain()
{
if (!GLinit)
return false;
var state = Keyboard.GetState();
foreach (var view in View.views)
if (view.panel != null && view.panel.IsVisible)
view.OnKeyPressEvent(ref state);
GdkWindow?.GetOrigin(out oriX, out oriY);
Sharp.InputHandler.ProcessMouse(oriX, oriY);
Sharp.InputHandler.ProcessKeyboard();
//foreach (var view in View.views)
//if (view.canvas.IsVisible)
if (MainEditorView.canvas.NeedsRedraw)
{
MainEditorView.canvas.NeedsRedraw = false;
MainEditorView.canvas.Redraw();
QueueDraw();
}
Sharp.Selection.IsSelectionDirty();
return true;
}
protected void OnDeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();
a.RetVal = true;
}
protected void OnGlwidget1RenderFrame(object sender, EventArgs e)
{
OnIdleProcessMain();
OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.ScissorTest);
mainEditorView.Render();
foreach (var view in View.views)
if (view.panel != null && view.panel.IsVisible)
view.Render();
}
protected override bool OnConfigureEvent(Gdk.EventConfigure evnt)
{
if (!GLinit)
return false;
foreach (var view in View.views)
view.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
QueueDraw();
return base.OnConfigureEvent(evnt);
}
protected override void OnSizeAllocated(Gdk.Rectangle allocation)
{
base.OnSizeAllocated(allocation);
if (!GLinit)
return;
foreach (var view in View.views)
view.OnResize(allocation.Width, allocation.Height);
QueueDraw();
}
protected override void OnGetPreferredHeightForWidth(int width, out int minimum_height, out int natural_height)
{
base.OnGetPreferredHeightForWidth(width, out minimum_height, out natural_height);
OnSizeRequested(width, natural_height);
}
void OnSizeRequested(/*ref Requisition requisition*/int width, int height)
{
//base.OnSizeRequested(ref requisition);
if (!GLinit)
return;
foreach (var view in View.views)
view.OnResize(glwidget1.Allocation.Width + width, glwidget1.Allocation.Height + height);
OnGlwidget1RenderFrame(null, null);
QueueDraw();
}
//public ref int testRef(ref int param) { return ref param; }
protected void OnGlwidget1Initialized(object sender, EventArgs e)
{
Console.WriteLine("init");
//if (GLinit)
//return;
GLinit = true;
MainEditorView.editorBackendRenderer = new SharpSL.BackendRenderers.OpenGL.EditorOpenGLRenderer();
SceneView.backendRenderer = new SharpSL.BackendRenderers.OpenGL.OpenGLRenderer();
mainEditorView.Initialize();
mainEditorView.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
Sharp.InputHandler.input.Initialize(MainEditorView.canvas);
var assets = new AssetsView();
Sharp.InputHandler.OnMouseDown += (args) =>
{
Console.WriteLine("click: " + focusedView);
if (focusedView == null)
foreach (var view in View.views)
{
if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
{
view.OnMouseDown(args);
break;
}
}
else
focusedView.OnMouseDown(args);
};
Sharp.InputHandler.OnMouseUp += (args) =>
{
if (focusedView == null)
foreach (var view in View.views)
{
if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
{
view.OnMouseUp(args);
break;
}
}
else
focusedView.OnMouseUp(args);
};
Sharp.InputHandler.OnMouseMove += (args) =>
{
if (focusedView == null)
foreach (var view in View.views)
{
if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
{
view.OnMouseMove(args);
break;
}
}
else
focusedView.OnMouseMove(args);
};
var scene = new SceneView();
var structure = new SceneStructureView();
var inspector = new InspectorView();
var tab = new Gwen.Control.TabControl(mainEditorView.splitter);
mainEditorView.splitter.OnSplitMoved += (o, args) =>
{
scene.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
//assets.OnResize(glwidget1.Allocation.Width,glwidget1.Allocation.Height);
};
var btn = tab.AddPage("scene");
var page = btn.Page;
page.Margin = new Gwen.Margin(3, 3, 3, 3);
scene.panel = btn.Page; //make GLControl for gwen
var tab1 = new Gwen.Control.TabControl(mainEditorView.splitter);
btn = tab1.AddPage("Assets");
page = btn.Page;
page.Margin = new Gwen.Margin(3, 3, 3, 3);
page.HoverEnter += (item, args) => { Console.WriteLine("hover"); };
assets.panel = page;
var tab2 = new Gwen.Control.TabControl(mainEditorView.splitter);
btn = tab2.AddPage("Structure");
page = btn.Page;
page.Margin = new Gwen.Margin(3, 3, 3, 3);
structure.panel = btn.Page;
var tab3 = new Gwen.Control.TabControl(mainEditorView.splitter);
btn = tab3.AddPage("Inspector");
page = btn.Page;
page.Margin = new Gwen.Margin(3, 3, 3, 3);
inspector.panel = btn.Page;
scene.Initialize();
structure.Initialize();
inspector.Initialize();
assets.Initialize();
inspector.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
scene.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
structure.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
assets.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
mainEditorView.splitter.SetPanel(1, tab);
mainEditorView.splitter.SetPanel(0, tab1);
mainEditorView.splitter.SetPanel(2, tab2);
mainEditorView.splitter.SetPanel(3, tab3);
foreach (var view in View.views)
view.OnContextCreated(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
QueueResize();
}
protected void OnGlwidget1ShuttingDown(object sender, EventArgs e)
{
throw new NotImplementedException();
}
[GLib.ConnectBefore]
protected void OnGlwidget1KeyPressEvent(object o, Gtk.KeyPressEventArgs args)
{
//Console.WriteLine(args.Event.Key.ToString ());
}
}
| {
"content_hash": "4a8f3ff0bcf20d8f7fe2650f64d5aa22",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 112,
"avg_line_length": 28.123404255319148,
"alnum_prop": 0.7212891511575125,
"repo_name": "BreyerW/Sharp.Engine",
"id": "92739bd0d69c3b81f4103ed279ffdf504dfd4df2",
"size": "6611",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sharp/MainWindow.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "853058"
},
{
"name": "C++",
"bytes": "1465"
},
{
"name": "GLSL",
"bytes": "3591"
},
{
"name": "Logos",
"bytes": "1865891"
}
],
"symlink_target": ""
} |
import tensorflow as tf
import tensorflow_transform as tft
from tensorflow.keras.callbacks import TensorBoard
from tensorflow_hub import KerasLayer
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
from tfx_bsl.tfxio import dataset_options
from config import (
HUB_URL,
HUB_DIM,
N_NEURONS,
N_CLASSES,
LABEL_KEY,
TRAIN_BATCH_SIZE,
EVAL_BATCH_SIZE,
MODEL_NAME,
transformed_name
)
def _get_serve_tf_examples_fn(model, tf_transform_output):
model.tft_layer = tf_transform_output.transform_features_layer()
@tf.function
def serve_tf_examples_fn(serialized_tf_examples):
"""Returns the output to be used in the serving signature."""
feature_spec = tf_transform_output.raw_feature_spec()
feature_spec.pop(LABEL_KEY)
parsed_features = tf.io.parse_example(serialized_tf_examples, feature_spec)
transformed_features = model.tft_layer(parsed_features)
return model(transformed_features)
return serve_tf_examples_fn
def _input_fn(file_pattern, data_accessor, tf_transform_output, batch_size=200):
return data_accessor.tf_dataset_factory(
file_pattern,
dataset_options.TensorFlowDatasetOptions(
batch_size=batch_size,
label_key=transformed_name(LABEL_KEY)),
tf_transform_output.transformed_metadata.schema
)
def _load_hub_module_layer():
hub_module = KerasLayer(
HUB_URL, output_shape=[HUB_DIM],
input_shape=[], dtype=tf.string, trainable=True)
return hub_module
def _build_keras_model():
hub_module = _load_hub_module_layer()
model = Sequential([
hub_module,
Dense(N_NEURONS, activation='relu'),
Dense(N_CLASSES, activation='softmax')
])
model.compile(
optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=[tf.keras.metrics.SparseCategoricalAccuracy()]
)
return model
def run_fn(fn_args):
tf_transform_output = tft.TFTransformOutput(fn_args.transform_output)
train_dataset = _input_fn(fn_args.train_files, fn_args.data_accessor,
tf_transform_output, TRAIN_BATCH_SIZE)
eval_dataset = _input_fn(fn_args.eval_files, fn_args.data_accessor,
tf_transform_output, EVAL_BATCH_SIZE)
mirrored_strategy = tf.distribute.MirroredStrategy()
with mirrored_strategy.scope():
model = _build_keras_model()
tensorboard_callback = tf.keras.callbacks.TensorBoard(
log_dir=fn_args.model_run_dir, update_freq='batch')
model.fit(
train_dataset,
steps_per_epoch=fn_args.train_steps,
validation_data=eval_dataset,
validation_steps=fn_args.eval_steps,
callbacks=[tensorboard_callback])
signatures = {
'serving_default':
_get_serve_tf_examples_fn(model,
tf_transform_output).get_concrete_function(
tf.TensorSpec(
shape=[None],
dtype=tf.string,
name='examples')),
}
model.save(fn_args.serving_model_dir, save_format='tf', signatures=signatures)
| {
"content_hash": "df293312802fb2925bad0ec351da6f37",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 83,
"avg_line_length": 31.676190476190477,
"alnum_prop": 0.6268791340950091,
"repo_name": "GoogleCloudPlatform/mlops-on-gcp",
"id": "74d8daaaf435ce624ea1437b2700536f65ac59cb",
"size": "3326",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "immersion/guided_projects/guided_project_3_nlp_starter/model.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "15195"
},
{
"name": "HCL",
"bytes": "8348"
},
{
"name": "JavaScript",
"bytes": "1143"
},
{
"name": "Jupyter Notebook",
"bytes": "6737030"
},
{
"name": "Mustache",
"bytes": "1946"
},
{
"name": "Python",
"bytes": "1235643"
},
{
"name": "Shell",
"bytes": "30775"
}
],
"symlink_target": ""
} |
/* global require, module */
var mergeTrees = require('broccoli-merge-trees');
var pickFiles = require('broccoli-static-compiler');
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({
fingerprint: {
enabled: false
}
});
app.import('bower_components/fuse.js/src/fuse.js');
var manifestFile = pickFiles('app', {
srcDir: '/',
files: ['manifest.json'],
destDir: '/'
});
// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
module.exports = mergeTrees([app.toTree(), manifestFile]);
| {
"content_hash": "18c9a7b0abdb43e20ed77bca97d9426e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 64,
"avg_line_length": 30.470588235294116,
"alnum_prop": 0.7200772200772201,
"repo_name": "netguru/review-chrome-extension",
"id": "623c11915fcb73dc08da610d51e601150c6812e1",
"size": "1036",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Brocfile.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1213"
},
{
"name": "HTML",
"bytes": "1678"
},
{
"name": "Handlebars",
"bytes": "1411"
},
{
"name": "JavaScript",
"bytes": "8689"
}
],
"symlink_target": ""
} |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vIBM 2.2.3-11/28/2011 06:21 AM(foreman)-
// 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: 2013.04.04 at 11:02:42 PM EDT
//
package com.ibm.jbatch.jsl.model;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.ibm.jbatch.container.jsl.ExecutionElement;
import com.ibm.jbatch.container.jsl.TransitionElement;
/**
* <p>Java class for Flow complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Flow">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <choice maxOccurs="unbounded" minOccurs="0">
* <element name="decision" type="{http://xmlns.jcp.org/xml/ns/javaee}Decision"/>
* <element name="flow" type="{http://xmlns.jcp.org/xml/ns/javaee}Flow"/>
* <element name="split" type="{http://xmlns.jcp.org/xml/ns/javaee}Split"/>
* <element name="step" type="{http://xmlns.jcp.org/xml/ns/javaee}Step"/>
* </choice>
* <group ref="{http://xmlns.jcp.org/xml/ns/javaee}TransitionElements" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}ID" />
* <attribute name="next" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Flow", propOrder = {
"executionElements",
"transitionElements"
})
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
/**
* Modified post-XJC-gen by custom JSR352 RI build logic
* since we can't seem to get JAXB's XJC to generate
* elements implementing a common interface.
*
* This custom logic adds the interface implementation :
* implements com.ibm.jbatch.container.jsl.ExecutionElement
*/
public class Flow implements com.ibm.jbatch.container.jsl.ExecutionElement {
@XmlElements({
@XmlElement(name = "decision", type = Decision.class),
@XmlElement(name = "step", type = Step.class),
@XmlElement(name = "flow", type = Flow.class),
@XmlElement(name = "split", type = Split.class)
})
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
protected List<ExecutionElement> executionElements;
@XmlElements({
@XmlElement(name = "fail", type = Fail.class),
@XmlElement(name = "end", type = End.class),
@XmlElement(name = "stop", type = Stop.class),
@XmlElement(name = "next", type = Next.class)
})
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
protected List<TransitionElement> transitionElements;
@XmlAttribute(name = "id", required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
protected String id;
@XmlAttribute(name = "next")
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
protected String nextFromAttribute;
/**
* Gets the value of the executionElements property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the executionElements property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getExecutionElements().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Decision }
* {@link Step }
* {@link Flow }
* {@link Split }
*
*
*/
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public List<ExecutionElement> getExecutionElements() {
if (executionElements == null) {
executionElements = new ArrayList<ExecutionElement>();
}
return this.executionElements;
}
/**
* Gets the value of the transitionElements property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the transitionElements property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getTransitionElements().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Fail }
* {@link End }
* {@link Stop }
* {@link Next }
*
*
*/
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public List<TransitionElement> getTransitionElements() {
if (transitionElements == null) {
transitionElements = new ArrayList<TransitionElement>();
}
return this.transitionElements;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the nextFromAttribute property.
*
* @return
* possible object is
* {@link String }
*
*/
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public String getNextFromAttribute() {
return nextFromAttribute;
}
/**
* Sets the value of the nextFromAttribute property.
*
* @param value
* allowed object is
* {@link String }
*
*/
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2013-04-04T11:02:42-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public void setNextFromAttribute(String value) {
this.nextFromAttribute = value;
}
/*
* Appended by build tooling.
*/
public String toString() {
StringBuffer buf = new StringBuffer(100);
buf.append("Flow: id=" + id);
buf.append("\nExecution elements: \n");
if (executionElements == null) {
buf.append("<none>");
} else {
int i = 0;
for ( com.ibm.jbatch.container.jsl.ExecutionElement e : executionElements) {
buf.append("element[" + i + "]:" + e + "\n");
i++;
}
}
buf.append("\nnextFromAttribute =" + nextFromAttribute);
buf.append("\nTransition elements: \n");
if (transitionElements == null) {
buf.append("<none>");
} else {
int j = 0;
for ( com.ibm.jbatch.container.jsl.TransitionElement e : transitionElements) {
buf.append("transition element[" + j + "]:" + e + "\n");
j++;
}
}
buf.append("\n");
return buf.toString();
}
} | {
"content_hash": "966af05281a1ff0b749343039e2bae2b",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 153,
"avg_line_length": 37.477551020408164,
"alnum_prop": 0.6162056196906992,
"repo_name": "papegaaij/jsr-352",
"id": "b43777bba5faad6cacc0adea103bb1901f12e932",
"size": "9182",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "JSR352.JobXML.Model/jaxbgen/com/ibm/jbatch/jsl/model/Flow.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1938555"
},
{
"name": "Perl",
"bytes": "6130"
},
{
"name": "Ruby",
"bytes": "722"
},
{
"name": "Shell",
"bytes": "641"
},
{
"name": "Standard ML",
"bytes": "53525"
}
],
"symlink_target": ""
} |
[](https://travis-ci.org/T-Wong/asf) [](https://supermarket.chef.io/cookbooks/asf)
Installs and configures [ArchiSteamFarm](https://github.com/JustArchi/ArchiSteamFarm) on a server system.
## Requirements
### Platforms
* CentOS 7+
* Debian 8+
* Fedora 26+
* openSUSE 42.2+
* RHEL 7+
* Ubuntu 14.04+
## attributes
### Source Information
* `node[asf']['source']` - Root URL to where to download ArchiSteamFarm. By default, this points to the official GitHub releases page at https://github.com/JustArchi/ArchiSteamFarm/releases.
* `node['asf']['version']` - Version of ArchiSteamFarm to initially download. By default, this is `2.2.0.5`. This value might change on the system if you have chosen to auto update in your ASF global configuration file.
* `node['asf']['checksum']` - The SHA256 checksum of the `ASF.exe` for the version that you want to install.
### Install and configuration Paths
* `node['asf']['install']['path']` - Path to where to install ArchiSteamFarm. By default, this cookbook will install ArchiSteamFarm to `/opt/asf`.
* `node['asf']['config']['path']` - Path to where to store the global and bot configuration files. By default, this cookbook will place these into `/opt/asf/config`.
### Global and bot configuration
* `node['asf']['global']` - Root level key for the global ArchiSteamFarm configuration values. Look at `attributes/default.rb` for information on what values are set by default and refer to [ArchiSteamFarm's official Wiki](https://github.com/JustArchi/ArchiSteamFarm/wiki/Configuration#global-config) on information on what each setting does.
* `node['asf']['bots']`-: Root level key for all of the bot accounts that will be configured. By default, no bot account will be setup. It is necessary to set these attributes either in an environment or a wrapper/role cookbook. For information on what each value does, refer to [ArchiSteamFarm's official Wiki](https://github.com/JustArchi/ArchiSteamFarm/wiki/Configuration#bot-config). Refer to the following example attribute on how to configure a bot account called `bot_name`. It is very important that you include all of the values in the example as not setting a value will result in a broken configuration file.
```ruby
node.default['asf']['bots'] = {
'bot_name' => {
'AcceptConfirmationsPeriod' => 0,
'AcceptGifts' => false,
'CardDropsRestricted' => true,
'CustomGamePlayedWhileFarming' => 'null',
'CustomGamePlayedWhileIdle' => 'null',
'DismissInventoryNotifications' => true,
'DistributeKeys' => false,
'Enabled' => false,
'FarmingOrder' => 0,
'FarmOffline' => false,
'ForwardKeysToOtherBots' => false,
'GamesPlayedWhileIdle' => [],
'HandleOfflineMessages' => false,
'IsBotAccount' => false,
'LootableTypes' => [1, 3, 5],
'PasswordFormat' => 0,
'Paused' => false,
'RedeemingPreferences' => 0,
'SendOnFarmingFinished' => false,
'SendTradePeriod' => 0,
'ShutdownOnFarmingFinished' => false,
'SteamApiKey' => 'null',
'SteamLogin' => 'null',
'SteamMasterClanID' => 0,
'SteamMasterID' => 0,
'SteamParentalPIN' => 0,
'SteamPassword' => 'null',
'SteamTradeToken' => 'null',
'TradingPreferences' => 1,
},
}
```
## Recipes
### default
The default recipe will install Mono on a target machine, install ArchiSteamFarm, place configuration files, setup a service, and then start ArchiSteamFarm.
### mono
This recipe installs Mono on a target machine. This has only been tested on the platforms outlined above in Platforms.
### service
Installs ArchiSteamFarm, loads all of configuration specified in the `global` and `bots` attributes. A service is also created for this and automatically started.
## Usage
Place a dependency on the asf cookbook in your cookbook's `metadata.rb`
```ruby
depends 'asf', '~> 1.0.0'
```
then, in a recipe:
```ruby
include_recipe 'asf::default'
```
If you would like to modify the default global configuration file or add your bots, set/override the values in `node['asf']['global']` and `node['asf']['bots']` as advised under the attributes section.
## License & Authors
- Author:: Tyler Wong ([ty-w@live.com](mailto:ty-w@live.com))
```text
Copyright 2017, Tyler Wong
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.
```
| {
"content_hash": "6138155150ccd96c526a7b9770474c0e",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 619,
"avg_line_length": 45.54205607476636,
"alnum_prop": 0.723373691770983,
"repo_name": "T-Wong/asf",
"id": "0e302b07d5f13275920d0f56cbcf7bdd8cd70f69",
"size": "4890",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "4637"
},
{
"name": "Ruby",
"bytes": "14260"
}
],
"symlink_target": ""
} |
/*
* UAVCAN data structure definition for libuavcan.
*
* Autogenerated, do not edit.
*
* Source file: /Users/bendyer/Projects/ARM/workspace/libuavcan/dsdl/uavcan/protocol/dynamic_node_id/server/30.AppendEntries.uavcan
*/
#ifndef UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_SERVER_APPENDENTRIES_HPP_INCLUDED
#define UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_SERVER_APPENDENTRIES_HPP_INCLUDED
#include <uavcan/build_config.hpp>
#include <uavcan/node/global_data_type_registry.hpp>
#include <uavcan/marshal/types.hpp>
#include <uavcan/protocol/dynamic_node_id/server/Entry.hpp>
/******************************* Source text **********************************
#
# THIS DEFINITION IS SUBJECT TO CHANGE.
#
# This type is a part of the Raft consensus algorithm.
# Please refer to the specification for details.
#
#
# Given min election timeout and cluster size, the maximum recommended request interval can be derived as follows:
#
# max recommended request interval = (min election timeout) / 2 requests / (cluster size - 1)
#
# The equation assumes that the Leader requests one Follower at a time, so that there's at most one pending call
# at any moment. Such behavior is optimal as it creates uniform bus load, but it is actually implementation-specific.
# Obviously, request interval can be lower than that if needed, but higher values are not recommended as they may
# cause Followers to initiate premature elections in case of intensive frame losses or delays.
#
# Real timeout is randomized in the range (MIN, MAX], according to the Raft paper.
#
uint16 DEFAULT_MIN_ELECTION_TIMEOUT_MS = 2000
uint16 DEFAULT_MAX_ELECTION_TIMEOUT_MS = 4000
#
# Refer to the Raft paper for explanation.
#
uint32 term
uint32 prev_log_term
uint8 prev_log_index
uint8 leader_commit
#
# Worst-case replication time per Follower can be computed as:
#
# worst replication time = (127 log entries) * (2 trips of next_index) * (request interval per Follower)
#
Entry[<=1] entries
---
#
# Refer to the Raft paper for explanation.
#
uint32 term
bool success
******************************************************************************/
/********************* DSDL signature source definition ***********************
uavcan.protocol.dynamic_node_id.server.AppendEntries
saturated uint32 term
saturated uint32 prev_log_term
saturated uint8 prev_log_index
saturated uint8 leader_commit
uavcan.protocol.dynamic_node_id.server.Entry[<=1] entries
---
saturated uint32 term
saturated bool success
******************************************************************************/
#undef term
#undef prev_log_term
#undef prev_log_index
#undef leader_commit
#undef entries
#undef DEFAULT_MIN_ELECTION_TIMEOUT_MS
#undef DEFAULT_MAX_ELECTION_TIMEOUT_MS
#undef term
#undef success
namespace uavcan
{
namespace protocol
{
namespace dynamic_node_id
{
namespace server
{
struct UAVCAN_EXPORT AppendEntries_
{
template <int _tmpl>
struct Request_
{
typedef const Request_<_tmpl>& ParameterType;
typedef Request_<_tmpl>& ReferenceType;
struct ConstantTypes
{
typedef ::uavcan::IntegerSpec< 16, ::uavcan::SignednessUnsigned, ::uavcan::CastModeSaturate > DEFAULT_MIN_ELECTION_TIMEOUT_MS;
typedef ::uavcan::IntegerSpec< 16, ::uavcan::SignednessUnsigned, ::uavcan::CastModeSaturate > DEFAULT_MAX_ELECTION_TIMEOUT_MS;
};
struct FieldTypes
{
typedef ::uavcan::IntegerSpec< 32, ::uavcan::SignednessUnsigned, ::uavcan::CastModeSaturate > term;
typedef ::uavcan::IntegerSpec< 32, ::uavcan::SignednessUnsigned, ::uavcan::CastModeSaturate > prev_log_term;
typedef ::uavcan::IntegerSpec< 8, ::uavcan::SignednessUnsigned, ::uavcan::CastModeSaturate > prev_log_index;
typedef ::uavcan::IntegerSpec< 8, ::uavcan::SignednessUnsigned, ::uavcan::CastModeSaturate > leader_commit;
typedef ::uavcan::Array< ::uavcan::protocol::dynamic_node_id::server::Entry, ::uavcan::ArrayModeDynamic, 1 > entries;
};
enum
{
MinBitLen
= FieldTypes::term::MinBitLen
+ FieldTypes::prev_log_term::MinBitLen
+ FieldTypes::prev_log_index::MinBitLen
+ FieldTypes::leader_commit::MinBitLen
+ FieldTypes::entries::MinBitLen
};
enum
{
MaxBitLen
= FieldTypes::term::MaxBitLen
+ FieldTypes::prev_log_term::MaxBitLen
+ FieldTypes::prev_log_index::MaxBitLen
+ FieldTypes::leader_commit::MaxBitLen
+ FieldTypes::entries::MaxBitLen
};
// Constants
static const typename ::uavcan::StorageType< typename ConstantTypes::DEFAULT_MIN_ELECTION_TIMEOUT_MS >::Type DEFAULT_MIN_ELECTION_TIMEOUT_MS; // 2000
static const typename ::uavcan::StorageType< typename ConstantTypes::DEFAULT_MAX_ELECTION_TIMEOUT_MS >::Type DEFAULT_MAX_ELECTION_TIMEOUT_MS; // 4000
// Fields
typename ::uavcan::StorageType< typename FieldTypes::term >::Type term;
typename ::uavcan::StorageType< typename FieldTypes::prev_log_term >::Type prev_log_term;
typename ::uavcan::StorageType< typename FieldTypes::prev_log_index >::Type prev_log_index;
typename ::uavcan::StorageType< typename FieldTypes::leader_commit >::Type leader_commit;
typename ::uavcan::StorageType< typename FieldTypes::entries >::Type entries;
Request_()
: term()
, prev_log_term()
, prev_log_index()
, leader_commit()
, entries()
{
::uavcan::StaticAssert<_tmpl == 0>::check(); // Usage check
#if UAVCAN_DEBUG
/*
* Cross-checking MaxBitLen provided by the DSDL compiler.
* This check shall never be performed in user code because MaxBitLen value
* actually depends on the nested types, thus it is not invariant.
*/
::uavcan::StaticAssert<249 == MaxBitLen>::check();
#endif
}
bool operator==(ParameterType rhs) const;
bool operator!=(ParameterType rhs) const { return !operator==(rhs); }
/**
* This comparison is based on @ref uavcan::areClose(), which ensures proper comparison of
* floating point fields at any depth.
*/
bool isClose(ParameterType rhs) const;
static int encode(ParameterType self, ::uavcan::ScalarCodec& codec,
::uavcan::TailArrayOptimizationMode tao_mode = ::uavcan::TailArrayOptEnabled);
static int decode(ReferenceType self, ::uavcan::ScalarCodec& codec,
::uavcan::TailArrayOptimizationMode tao_mode = ::uavcan::TailArrayOptEnabled);
};
template <int _tmpl>
struct Response_
{
typedef const Response_<_tmpl>& ParameterType;
typedef Response_<_tmpl>& ReferenceType;
struct ConstantTypes
{
};
struct FieldTypes
{
typedef ::uavcan::IntegerSpec< 32, ::uavcan::SignednessUnsigned, ::uavcan::CastModeSaturate > term;
typedef ::uavcan::IntegerSpec< 1, ::uavcan::SignednessUnsigned, ::uavcan::CastModeSaturate > success;
};
enum
{
MinBitLen
= FieldTypes::term::MinBitLen
+ FieldTypes::success::MinBitLen
};
enum
{
MaxBitLen
= FieldTypes::term::MaxBitLen
+ FieldTypes::success::MaxBitLen
};
// Constants
// Fields
typename ::uavcan::StorageType< typename FieldTypes::term >::Type term;
typename ::uavcan::StorageType< typename FieldTypes::success >::Type success;
Response_()
: term()
, success()
{
::uavcan::StaticAssert<_tmpl == 0>::check(); // Usage check
#if UAVCAN_DEBUG
/*
* Cross-checking MaxBitLen provided by the DSDL compiler.
* This check shall never be performed in user code because MaxBitLen value
* actually depends on the nested types, thus it is not invariant.
*/
::uavcan::StaticAssert<33 == MaxBitLen>::check();
#endif
}
bool operator==(ParameterType rhs) const;
bool operator!=(ParameterType rhs) const { return !operator==(rhs); }
/**
* This comparison is based on @ref uavcan::areClose(), which ensures proper comparison of
* floating point fields at any depth.
*/
bool isClose(ParameterType rhs) const;
static int encode(ParameterType self, ::uavcan::ScalarCodec& codec,
::uavcan::TailArrayOptimizationMode tao_mode = ::uavcan::TailArrayOptEnabled);
static int decode(ReferenceType self, ::uavcan::ScalarCodec& codec,
::uavcan::TailArrayOptimizationMode tao_mode = ::uavcan::TailArrayOptEnabled);
};
typedef Request_<0> Request;
typedef Response_<0> Response;
/*
* Static type info
*/
enum { DataTypeKind = ::uavcan::DataTypeKindService };
enum { DefaultDataTypeID = 30 };
static const char* getDataTypeFullName()
{
return "uavcan.protocol.dynamic_node_id.server.AppendEntries";
}
static void extendDataTypeSignature(::uavcan::DataTypeSignature& signature)
{
signature.extend(getDataTypeSignature());
}
static ::uavcan::DataTypeSignature getDataTypeSignature();
private:
AppendEntries_(); // Don't create objects of this type. Use Request/Response instead.
};
/*
* Out of line struct method definitions
*/
template <int _tmpl>
bool AppendEntries_::Request_<_tmpl>::operator==(ParameterType rhs) const
{
return
term == rhs.term &&
prev_log_term == rhs.prev_log_term &&
prev_log_index == rhs.prev_log_index &&
leader_commit == rhs.leader_commit &&
entries == rhs.entries;
}
template <int _tmpl>
bool AppendEntries_::Request_<_tmpl>::isClose(ParameterType rhs) const
{
return
::uavcan::areClose(term, rhs.term) &&
::uavcan::areClose(prev_log_term, rhs.prev_log_term) &&
::uavcan::areClose(prev_log_index, rhs.prev_log_index) &&
::uavcan::areClose(leader_commit, rhs.leader_commit) &&
::uavcan::areClose(entries, rhs.entries);
}
template <int _tmpl>
int AppendEntries_::Request_<_tmpl>::encode(ParameterType self, ::uavcan::ScalarCodec& codec,
::uavcan::TailArrayOptimizationMode tao_mode)
{
(void)self;
(void)codec;
(void)tao_mode;
int res = 1;
res = FieldTypes::term::encode(self.term, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::prev_log_term::encode(self.prev_log_term, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::prev_log_index::encode(self.prev_log_index, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::leader_commit::encode(self.leader_commit, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::entries::encode(self.entries, codec, tao_mode);
return res;
}
template <int _tmpl>
int AppendEntries_::Request_<_tmpl>::decode(ReferenceType self, ::uavcan::ScalarCodec& codec,
::uavcan::TailArrayOptimizationMode tao_mode)
{
(void)self;
(void)codec;
(void)tao_mode;
int res = 1;
res = FieldTypes::term::decode(self.term, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::prev_log_term::decode(self.prev_log_term, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::prev_log_index::decode(self.prev_log_index, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::leader_commit::decode(self.leader_commit, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::entries::decode(self.entries, codec, tao_mode);
return res;
}
template <int _tmpl>
bool AppendEntries_::Response_<_tmpl>::operator==(ParameterType rhs) const
{
return
term == rhs.term &&
success == rhs.success;
}
template <int _tmpl>
bool AppendEntries_::Response_<_tmpl>::isClose(ParameterType rhs) const
{
return
::uavcan::areClose(term, rhs.term) &&
::uavcan::areClose(success, rhs.success);
}
template <int _tmpl>
int AppendEntries_::Response_<_tmpl>::encode(ParameterType self, ::uavcan::ScalarCodec& codec,
::uavcan::TailArrayOptimizationMode tao_mode)
{
(void)self;
(void)codec;
(void)tao_mode;
int res = 1;
res = FieldTypes::term::encode(self.term, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::success::encode(self.success, codec, tao_mode);
return res;
}
template <int _tmpl>
int AppendEntries_::Response_<_tmpl>::decode(ReferenceType self, ::uavcan::ScalarCodec& codec,
::uavcan::TailArrayOptimizationMode tao_mode)
{
(void)self;
(void)codec;
(void)tao_mode;
int res = 1;
res = FieldTypes::term::decode(self.term, codec, ::uavcan::TailArrayOptDisabled);
if (res <= 0)
{
return res;
}
res = FieldTypes::success::decode(self.success, codec, tao_mode);
return res;
}
/*
* Out of line type method definitions
*/
inline ::uavcan::DataTypeSignature AppendEntries_::getDataTypeSignature()
{
::uavcan::DataTypeSignature signature(0x102B89200D0E54D2ULL);
Request::FieldTypes::term::extendDataTypeSignature(signature);
Request::FieldTypes::prev_log_term::extendDataTypeSignature(signature);
Request::FieldTypes::prev_log_index::extendDataTypeSignature(signature);
Request::FieldTypes::leader_commit::extendDataTypeSignature(signature);
Request::FieldTypes::entries::extendDataTypeSignature(signature);
Response::FieldTypes::term::extendDataTypeSignature(signature);
Response::FieldTypes::success::extendDataTypeSignature(signature);
return signature;
}
/*
* Out of line constant definitions
*/
template <int _tmpl>
const typename ::uavcan::StorageType< typename AppendEntries_::Request_<_tmpl>::ConstantTypes::DEFAULT_MIN_ELECTION_TIMEOUT_MS >::Type
AppendEntries_::Request_<_tmpl>::DEFAULT_MIN_ELECTION_TIMEOUT_MS = 2000U; // 2000
template <int _tmpl>
const typename ::uavcan::StorageType< typename AppendEntries_::Request_<_tmpl>::ConstantTypes::DEFAULT_MAX_ELECTION_TIMEOUT_MS >::Type
AppendEntries_::Request_<_tmpl>::DEFAULT_MAX_ELECTION_TIMEOUT_MS = 4000U; // 4000
/*
* Final typedef
*/
typedef AppendEntries_ AppendEntries;
namespace
{
const ::uavcan::DefaultDataTypeRegistrator< ::uavcan::protocol::dynamic_node_id::server::AppendEntries > _uavcan_gdtr_registrator_AppendEntries;
}
} // Namespace server
} // Namespace dynamic_node_id
} // Namespace protocol
} // Namespace uavcan
/*
* YAML streamer specialization
*/
namespace uavcan
{
template <>
class UAVCAN_EXPORT YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request >
{
public:
template <typename Stream>
static void stream(Stream& s, ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request::ParameterType obj, const int level);
};
template <typename Stream>
void YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request >::stream(Stream& s, ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request::ParameterType obj, const int level)
{
(void)s;
(void)obj;
(void)level;
if (level > 0)
{
s << '\n';
for (int pos = 0; pos < level; pos++)
{
s << " ";
}
}
s << "term: ";
YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request::FieldTypes::term >::stream(s, obj.term, level + 1);
s << '\n';
for (int pos = 0; pos < level; pos++)
{
s << " ";
}
s << "prev_log_term: ";
YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request::FieldTypes::prev_log_term >::stream(s, obj.prev_log_term, level + 1);
s << '\n';
for (int pos = 0; pos < level; pos++)
{
s << " ";
}
s << "prev_log_index: ";
YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request::FieldTypes::prev_log_index >::stream(s, obj.prev_log_index, level + 1);
s << '\n';
for (int pos = 0; pos < level; pos++)
{
s << " ";
}
s << "leader_commit: ";
YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request::FieldTypes::leader_commit >::stream(s, obj.leader_commit, level + 1);
s << '\n';
for (int pos = 0; pos < level; pos++)
{
s << " ";
}
s << "entries: ";
YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request::FieldTypes::entries >::stream(s, obj.entries, level + 1);
}
template <>
class UAVCAN_EXPORT YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Response >
{
public:
template <typename Stream>
static void stream(Stream& s, ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Response::ParameterType obj, const int level);
};
template <typename Stream>
void YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Response >::stream(Stream& s, ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Response::ParameterType obj, const int level)
{
(void)s;
(void)obj;
(void)level;
if (level > 0)
{
s << '\n';
for (int pos = 0; pos < level; pos++)
{
s << " ";
}
}
s << "term: ";
YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Response::FieldTypes::term >::stream(s, obj.term, level + 1);
s << '\n';
for (int pos = 0; pos < level; pos++)
{
s << " ";
}
s << "success: ";
YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Response::FieldTypes::success >::stream(s, obj.success, level + 1);
}
}
namespace uavcan
{
namespace protocol
{
namespace dynamic_node_id
{
namespace server
{
template <typename Stream>
inline Stream& operator<<(Stream& s, ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request::ParameterType obj)
{
::uavcan::YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Request >::stream(s, obj, 0);
return s;
}
template <typename Stream>
inline Stream& operator<<(Stream& s, ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Response::ParameterType obj)
{
::uavcan::YamlStreamer< ::uavcan::protocol::dynamic_node_id::server::AppendEntries::Response >::stream(s, obj, 0);
return s;
}
} // Namespace server
} // Namespace dynamic_node_id
} // Namespace protocol
} // Namespace uavcan
#endif // UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_SERVER_APPENDENTRIES_HPP_INCLUDED | {
"content_hash": "abd77b02a91287e78edae84a0b3c1a6e",
"timestamp": "",
"source": "github",
"line_count": 591,
"max_line_length": 214,
"avg_line_length": 32.46869712351946,
"alnum_prop": 0.638073896503205,
"repo_name": "PX4-Works/vectorcontrol",
"id": "630fe0f8fe0e6f10bba4fc53c5d5d8fec089d2a8",
"size": "19189",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "libuavcan/include/dsdlc_generated/uavcan/protocol/dynamic_node_id/server/AppendEntries.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "28424"
},
{
"name": "C",
"bytes": "3113231"
},
{
"name": "C++",
"bytes": "1939446"
},
{
"name": "Makefile",
"bytes": "10740"
}
],
"symlink_target": ""
} |
export interface CoverageSummaryData {
lines: Totals;
statements: Totals;
branches: Totals;
functions: Totals;
}
export class CoverageSummary {
constructor(data: CoverageSummary | CoverageSummaryData);
merge(obj: CoverageSummary): CoverageSummary;
toJSON(): CoverageSummaryData;
isEmpty(): boolean;
data: CoverageSummaryData;
lines: Totals;
statements: Totals;
branches: Totals;
functions: Totals;
}
export interface CoverageMapData {
[key: string]: FileCoverage;
}
export class CoverageMap {
constructor(data: CoverageMapData | CoverageMap);
addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void;
files(): string[];
fileCoverageFor(filename: string): FileCoverage;
filter(callback: (key: string) => boolean): void;
getCoverageSummary(): CoverageSummary;
merge(data: CoverageMapData | CoverageMap): void;
toJSON(): CoverageMapData;
data: CoverageMapData;
}
export interface Location {
line: number;
column: number;
}
export interface Range {
start: Location;
end: Location;
}
export interface BranchMapping {
loc: Range;
type: string;
locations: Range[];
line: number;
}
export interface FunctionMapping {
name: string;
decl: Range;
loc: Range;
line: number;
}
export interface FileCoverageData {
path: string;
statementMap: { [key: string]: Range };
fnMap: { [key: string]: FunctionMapping };
branchMap: { [key: string]: BranchMapping };
s: { [key: string]: number };
f: { [key: string]: number };
b: { [key: string]: number[] };
}
export interface Totals {
total: number;
covered: number;
skipped: number;
pct: number;
}
export interface Coverage {
covered: number;
total: number;
coverage: number;
}
export class FileCoverage implements FileCoverageData {
constructor(data: string | FileCoverage | FileCoverageData);
merge(other: FileCoverageData): void;
getBranchCoverageByLine(): { [line: number]: Coverage };
getLineCoverage(): { [line: number]: number };
getUncoveredLines(): number[];
resetHits(): void;
computeBranchTotals(): Totals;
computeSimpleTotals(): Totals;
toSummary(): CoverageSummary;
toJSON(): object;
data: FileCoverageData;
path: string;
statementMap: { [key: string]: Range };
fnMap: { [key: string]: FunctionMapping };
branchMap: { [key: string]: BranchMapping };
s: { [key: string]: number };
f: { [key: string]: number };
b: { [key: string]: number[] };
}
export const classes: {
FileCoverage: FileCoverage;
};
export function createCoverageMap(data?: CoverageMap | CoverageMapData): CoverageMap;
export function createCoverageSummary(obj?: CoverageSummary | CoverageSummaryData): CoverageSummary;
export function createFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): FileCoverage;
| {
"content_hash": "0aa0d9ce64f93fe0cc9e30a7c2a6c7d4",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 105,
"avg_line_length": 24.91891891891892,
"alnum_prop": 0.7245119305856833,
"repo_name": "pcclarke/civ-techs",
"id": "fc8a8dedeb96f6b489d51d0263c7bfcf5a3590b5",
"size": "3118",
"binary": false,
"copies": "20",
"ref": "refs/heads/gh-pages",
"path": "node_modules/@types/istanbul-lib-coverage/index.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2127"
},
{
"name": "JavaScript",
"bytes": "5292"
}
],
"symlink_target": ""
} |
/**
* SaveAsFilePluginMenuAction.java
* Created on 15.12.2005
* (c) 2005 by "Wolschon Softwaredesign und Beratung".
*
* Permission is granted to use, modify, publish and sub-license this code
* as specified in the contract. If nothing else is specified these rights
* are given non-exclusively with no restrictions solely to the contractor(s).
* If no specified otherwise I reserve the right to use, modify, publish and
* sub-license this code to other parties myself.
*
* Otherwise, this code is made available under GPLv3 or later.
*
* -----------------------------------------------------------
* major Changes:
* 15.12.2005 - initial version
* ...
*
*/
package biz.wolschon.finance.jgnucash.actions;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.java.plugin.registry.Extension;
import biz.wolschon.finance.jgnucash.JGnucash;
import biz.wolschon.finance.jgnucash.plugin.DataSourcePlugin;
/**
* The action-listeners we use for the File->Save as -Menu.
*/
public final class SaveAsFilePluginMenuAction implements ActionListener {
/**
* Our logger for debug- and error-output.
*/
static final Log LOGGER = LogFactory.getLog(SaveAsFilePluginMenuAction.class);
/**
* Our JGnucash.java.
* @see OpenFilePluginMenuAction
*/
private final JGnucash myJGnucashEditor;
/**
* @param aPlugin The import-plugin.
* @param aPluginName The name of the plugin
* @param aGnucash TODO
*/
public SaveAsFilePluginMenuAction(final JGnucash aGnucash, final Extension aPlugin, final String aPluginName) {
super();
myJGnucashEditor = aGnucash;
ext = aPlugin;
pluginName = aPluginName;
}
/**
* The import-plugin.
*/
private final Extension ext;
/**
* The name of the plugin.
*/
private final String pluginName;
@Override
public void actionPerformed(final ActionEvent e) {
try {
// Activate plug-in that declares extension.
myJGnucashEditor.getPluginManager().activatePlugin(ext.getDeclaringPluginDescriptor().getId());
// Get plug-in class loader.
ClassLoader classLoader = myJGnucashEditor.getPluginManager().getPluginClassLoader(
ext.getDeclaringPluginDescriptor());
// Load Tool class.
Class toolCls = classLoader.loadClass(
ext.getParameter("class").valueAsString());
// Create Tool instance.
Object o = toolCls.newInstance();
if (!(o instanceof DataSourcePlugin)) {
LOGGER.error("Plugin '" + pluginName + "' does not implement DataSourcePlugin-interface.");
JOptionPane.showMessageDialog(myJGnucashEditor, "Error",
"Plugin '" + pluginName + "' does not implement DataSourcePlugin-interface.",
JOptionPane.ERROR_MESSAGE);
return;
}
DataSourcePlugin importer = (DataSourcePlugin) o;
try {
myJGnucashEditor.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//workaround because of a deadlock in log4j-consoleAppender in the JPf-classloader
Logger.getLogger("org.java.plugin.standard.StandardPluginClassLoader").removeAllAppenders();
Logger.getLogger("org.java.plugin.standard.StandardPluginClassLoader").setLevel(Level.FATAL);
importer.writeTo(myJGnucashEditor.getWritableModel());
} catch (Exception e1) {
LOGGER.error("Write via Plugin '" + pluginName + "' failed.", e1);
JOptionPane.showMessageDialog(myJGnucashEditor, "Error",
"Write via Plugin '" + pluginName + "' failed.\n"
+ "[" + e1.getClass().getName() + "]: " + e1.getMessage(),
JOptionPane.ERROR_MESSAGE);
} finally {
myJGnucashEditor.setCursor(Cursor.getDefaultCursor());
}
} catch (Exception e1) {
LOGGER.error("Could not activate requested Writer-plugin '" + pluginName + "'.", e1);
JOptionPane.showMessageDialog(myJGnucashEditor, "Error",
"Could not activate requested Writer-plugin '" + pluginName + "'.\n"
+ "[" + e1.getClass().getName() + "]: " + e1.getMessage(),
JOptionPane.ERROR_MESSAGE);
}
}
}
| {
"content_hash": "fc0c79c986fe8a7c5f908a3e125858ed",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 115,
"avg_line_length": 40.05084745762712,
"alnum_prop": 0.6244181125687686,
"repo_name": "nhrdl/javacash",
"id": "d70924f7d096a56619f02507779780c450c9f4db",
"size": "4726",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jGnucashLib/plugins/biz.wolschon.finance.jgnucash.editor.main/src/main/java/biz/wolschon/finance/jgnucash/actions/SaveAsFilePluginMenuAction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3339"
},
{
"name": "Java",
"bytes": "5295818"
},
{
"name": "JavaScript",
"bytes": "1432"
},
{
"name": "Shell",
"bytes": "416"
}
],
"symlink_target": ""
} |
import { KubernetesObject } from 'kpt-functions';
import * as apisMetaV1 from './io.k8s.apimachinery.pkg.apis.meta.v1';
// TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.
export class TokenReview implements KubernetesObject {
// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources
public apiVersion: string;
// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
public kind: string;
public metadata: apisMetaV1.ObjectMeta;
// Spec holds information about the request being evaluated
public spec: TokenReviewSpec;
// Status is filled in by the server and indicates whether the request can be authenticated.
public status?: TokenReviewStatus;
constructor(desc: TokenReview.Interface) {
this.apiVersion = TokenReview.apiVersion;
this.kind = TokenReview.kind;
this.metadata = desc.metadata;
this.spec = desc.spec;
this.status = desc.status;
}
}
export function isTokenReview(o: any): o is TokenReview {
return (
o && o.apiVersion === TokenReview.apiVersion && o.kind === TokenReview.kind
);
}
export namespace TokenReview {
export const apiVersion = 'authentication.k8s.io/v1beta1';
export const group = 'authentication.k8s.io';
export const version = 'v1beta1';
export const kind = 'TokenReview';
// TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.
export interface Interface {
metadata: apisMetaV1.ObjectMeta;
// Spec holds information about the request being evaluated
spec: TokenReviewSpec;
// Status is filled in by the server and indicates whether the request can be authenticated.
status?: TokenReviewStatus;
}
}
// TokenReviewSpec is a description of the token authentication request.
export class TokenReviewSpec {
// Audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.
public audiences?: string[];
// Token is the opaque bearer token.
public token?: string;
}
// TokenReviewStatus is the result of the token authentication request.
export class TokenReviewStatus {
// Audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is "true", the token is valid against the audience of the Kubernetes API server.
public audiences?: string[];
// Authenticated indicates that the token was associated with a known user.
public authenticated?: boolean;
// Error indicates that the token couldn't be checked
public error?: string;
// User is the UserInfo associated with the provided token.
public user?: UserInfo;
}
// UserInfo holds the information about the user needed to implement the user.Info interface.
export class UserInfo {
// Any additional information provided by the authenticator.
public extra?: { [key: string]: string[] };
// The names of groups this user is a part of.
public groups?: string[];
// A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.
public uid?: string;
// The name that uniquely identifies this user among all active users.
public username?: string;
}
| {
"content_hash": "cc94328fafbe70dc4eab5725ca1ffcbb",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 620,
"avg_line_length": 49.63333333333333,
"alnum_prop": 0.7700917841952093,
"repo_name": "GoogleContainerTools/kpt-functions-catalog",
"id": "ec78aebccf218376efc81ec9eb05c2c6da63082d",
"size": "4467",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "functions/ts/kubeval/src/gen/io.k8s.api.authentication.v1beta1.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "7827"
},
{
"name": "Go",
"bytes": "582179"
},
{
"name": "HCL",
"bytes": "12215"
},
{
"name": "HTML",
"bytes": "13912"
},
{
"name": "Makefile",
"bytes": "21302"
},
{
"name": "Python",
"bytes": "14642"
},
{
"name": "Shell",
"bytes": "23220"
},
{
"name": "TypeScript",
"bytes": "3992351"
}
],
"symlink_target": ""
} |
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.parse.ui;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.parse.ui";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = -1;
public static final String VERSION_NAME = "";
}
| {
"content_hash": "b2238306b069570528d06d9bb987e221",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 33,
"alnum_prop": 0.7249417249417249,
"repo_name": "HiiYL/MMU-Board-Android",
"id": "10848d05a425a74c57978cdebe123c49cab25dcd",
"size": "429",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "ParseLoginUI/build/generated/source/buildConfig/debug/com/parse/ui/BuildConfig.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "288776"
}
],
"symlink_target": ""
} |
package ckite.kvstore
import java.nio.ByteBuffer
import ckite.statemachine.StateMachine
import ckite.util.Serializer
import scala.collection.mutable.Map
class KVStore extends StateMachine {
private var map = Map[String, String]()
private var lastIndex: Long = 0
def applyWrite = {
case (index, Put(key: String, value: String)) => {
map.put(key, value)
lastIndex = index
value
}
}
def applyRead = {
case Get(key) => map.get(key)
}
def getLastAppliedIndex: Long = lastIndex
def restoreSnapshot(byteBuffer: ByteBuffer) = {
map = Serializer.deserialize[Map[String, String]](byteBuffer.array())
}
def takeSnapshot(): ByteBuffer = ByteBuffer.wrap(Serializer.serialize(map))
} | {
"content_hash": "8e75a7440b056f7dcec268ec4e2ec4ed",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 77,
"avg_line_length": 20.97142857142857,
"alnum_prop": 0.6989100817438693,
"repo_name": "pablosmedina/kvstore",
"id": "a4ce7b76d3431738a4677d1d1f54a42d15e3a143",
"size": "734",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/ckite/kvstore/KVStore.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Scala",
"bytes": "5530"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
return [
'meta' => [
'title' => 'Static method call statement of a class belonging to the global namespace which has been imported with a '
.'use statement in a namespace',
// Default values. If not specified will be the one used
'prefix' => 'Humbug',
'whitelist' => [],
'exclude-namespaces' => [],
'expose-global-constants' => true,
'expose-global-classes' => false,
'expose-global-functions' => true,
'exclude-constants' => [],
'exclude-classes' => [],
'exclude-functions' => [],
'registered-classes' => [],
'registered-functions' => [],
],
'Static method call statement of a class' => <<<'PHP'
<?php
namespace {
class Foo {}
}
namespace A {
use Foo;
Foo::main();
}
----
<?php
namespace Humbug;
class Foo
{
}
namespace Humbug\A;
use Humbug\Foo;
Foo::main();
PHP
,
'FQ static method call statement of a class' => <<<'PHP'
<?php
namespace {
class Foo {}
}
namespace A {
use Foo;
\Foo::main();
}
----
<?php
namespace Humbug;
class Foo
{
}
namespace Humbug\A;
use Humbug\Foo;
\Humbug\Foo::main();
PHP
,
'Static method call statement of a class which has been whitelisted and belongs to the global namespace' => <<<'PHP'
<?php
namespace A;
use Closure;
Closure::bind();
----
<?php
namespace Humbug\A;
use Closure;
Closure::bind();
PHP
,
'FQ static method call statement of a class which has been whitelisted and belongs to the global namespace' => <<<'PHP'
<?php
namespace A;
use Closure;
\Closure::bind();
----
<?php
namespace Humbug\A;
use Closure;
\Closure::bind();
PHP
,
];
| {
"content_hash": "882a8a26b5e7b09cde7b0efb26e38593",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 126,
"avg_line_length": 14.703389830508474,
"alnum_prop": 0.5838616714697407,
"repo_name": "webmozart/php-scoper",
"id": "b51a3ea8ee59914fa383933a24d7428cf5981a27",
"size": "2050",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "specs/static-method/namespace-single-part-with-single-level-use-statement.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "21938"
}
],
"symlink_target": ""
} |
package edu.princeton.safe.internal.io;
import java.io.BufferedReader;
import java.io.IOException;
import com.carrotsearch.hppc.ObjectIntHashMap;
import edu.princeton.safe.internal.Util;
import edu.princeton.safe.io.NetworkConsumer;
import edu.princeton.safe.io.NetworkParser;
public class TabDelimitedNetworkParser implements NetworkParser {
private String nodePath;
private String edgePath;
private boolean isDirected;
public TabDelimitedNetworkParser(String nodePath,
String edgePath,
boolean isDirected)
throws IOException {
this.nodePath = nodePath;
this.edgePath = edgePath;
this.isDirected = isDirected;
}
@Override
public void parse(NetworkConsumer consumer) throws IOException {
// Create look up for node label -> node index
ObjectIntHashMap<String> nodeIdsToIndexes = new ObjectIntHashMap<>();
int[] index = { 0 };
consumer.startNodes();
try (BufferedReader reader = Util.getReader(nodePath)) {
reader.lines()
.forEach(line -> {
String[] parts = line.split("\t");
String label = parts[0];
String id = parts[1];
double x = Util.parseDouble(parts[2]);
double y = Util.parseDouble(parts[3]);
consumer.node(index[0], label, id, x, y);
nodeIdsToIndexes.put(label, index[0]);
index[0]++;
});
} finally {
consumer.finishNodes();
}
consumer.startEdges();
try (BufferedReader reader = Util.getReader(edgePath)) {
reader.lines()
.forEach(line -> {
String[] parts = line.split("\t");
int fromIndex = nodeIdsToIndexes.get(parts[0]);
int toIndex = nodeIdsToIndexes.get(parts[1]);
double weight = 1;
consumer.edge(fromIndex, toIndex, weight);
});
} finally {
consumer.finishEdges();
}
}
@Override
public boolean isDirected() {
return isDirected;
}
}
| {
"content_hash": "7515b338b60d4e8f08f348fcf7965b1b",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 77,
"avg_line_length": 32.166666666666664,
"alnum_prop": 0.5418825561312608,
"repo_name": "jrrmzz/safe",
"id": "22c16027f8884869e2e4c96ffb7c62f2bd4d7fef",
"size": "2316",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "core/src/main/java/edu/princeton/safe/internal/io/TabDelimitedNetworkParser.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "51362"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Docums Mycol. 20(no. 79): 61 (1990)
#### Original name
Melanoleuca polioleuca f. langei Boekhout, 1988
### Remarks
null | {
"content_hash": "3a14515bb38ba6caf9fd589ac02bda9b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 47,
"avg_line_length": 16,
"alnum_prop": 0.7115384615384616,
"repo_name": "mdoering/backbone",
"id": "056df00e5308e2d7751f866d6def7dc7063a3465",
"size": "271",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Agaricales/Tricholomataceae/Melanoleuca/Melanoleuca langei/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
require_once(realpath(dirname(__FILE__).'/../../../..').'/functional/helper/dmFunctionalTestHelper.php');
$helper = new dmFunctionalTestHelper();
$helper->boot('admin');
$browser = $helper->getBrowser();
$helper->logout();
$browser->info('Posts list')
->get('/content?skip_browser_detection=1')
->checks(array(
'module_action' => 'dmAdmin/moduleType',
'code' => 401
))
->has('input.submit');
$helper->login();
$browser->info('Posts list')
->get('/content/blog/dm-test-posts/index')
->checks(array(
'module_action' => 'dmTestPost/index'
))
->has('h1', 'Dm test posts')
->has('#breadCrumb')
->has('#dm_module_search_input')
->has('.sf_admin_list_td_title a.link')
->has('.dm_pagination_status', '1 - 10 of 20');
$browser->info('Loremize 20 posts')
->click('.dm_loremize a:contains(20)')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'loremize')
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', 'Dm test posts')
->checkElement('.dm_pagination_status', '1 - 10 of 20')
->checkElement('.flashs.infos', 'Successfully loremized')
->end();
$browser->info('Sort by created_at')
->click('.sf_admin_list_th_created_at a')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isParameter('sort', 'created_at')
->isParameter('sort_type', 'asc')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.sf_admin_list_th_created_at a.s16_sort_asc', 'Created at')
->end()
->click('.sf_admin_list_th_created_at a')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isParameter('sort', 'created_at')
->isParameter('sort_type', 'desc')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.sf_admin_list_th_created_at a.s16_sort_desc', 'Created at')
->end();
$browser->info('Sort by title ( i18n field )')
->click('.sf_admin_list_th_title a')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isParameter('sort', 'title')
->isParameter('sort_type', 'asc')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.sf_admin_list_th_title a.s16_sort_asc', 'Title')
->end()
->click('.sf_admin_list_th_title a')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isParameter('sort', 'title')
->isParameter('sort_type', 'desc')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.sf_admin_list_th_title a.s16_sort_desc', 'Title')
->end();
$browser->info('Sort by categ ( foreign + i18n field )')
->click('.sf_admin_list_th_categ_id a')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isParameter('sort', 'categ_id')
->isParameter('sort_type', 'asc')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.sf_admin_list_th_categ_id a.s16_sort_asc', 'Categ')
->end()
->click('.sf_admin_list_th_categ_id a')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isParameter('sort', 'categ_id')
->isParameter('sort_type', 'desc')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.sf_admin_list_th_categ_id a.s16_sort_desc', 'Categ')
->end();
$browser->info('Sort interface')
->click('.sf_admin_action a.dm_sort')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'sortTable')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', 'Sort table')
->checkElement('ol.objects li.object:first label', dmDb::query('DmTestPost p')->whereIsActive(true, 'DmTestPost')->orderBy('p.position ASC')->fetchOne()->title)
->end()
->click('input[type="submit"]')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'sortTable')
->isMethod('post')
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'sortTable')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', 'Sort table')
->checkElement('.flashs.infos', 'The items have been sorted successfully')
->end()
->click('« Back to list')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', 'Dm test posts')
->end();
$browser->info('Test batch actions')
->info('Delete')
->select('ids[]')
->click('input[name="batchDelete"]')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'batch')
->isMethod('post')
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.dm_pagination_status', '1 - 10 of 19')
->checkElement('.flashs.infos', 'The selected items have been deleted successfully.')
->end()
->info('Activate')
->select('ids[]')
->click('input[name="batchActivate"]')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'batch')
->isMethod('post')
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.sf_admin_list_td_is_active:first .s16_tick')
->checkElement('.flashs.infos', 'The selected items have been modified successfully')
->end()
->info('Deactivate')
->select('ids[]')
->click('input[name="batchDeactivate"]')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'batch')
->isMethod('post')
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.sf_admin_list_td_is_active:first .s16_cross')
->checkElement('.flashs.infos', 'The selected items have been modified successfully')
->end();
$browser->info('Create new post')
->click('a.sf_admin_action_new')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'new')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', 'New')
->end()
->info('Submit empty')
->click('Save')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'create')
->isMethod('post')
->end()
->with('response')->begin()
->isStatusCode(200)
->end()
->with('form')->begin()
->hasErrors(2)
->isError('title', 'required')
->isError('date', 'required')
->end()
->info('Submit with bad user_id, categ_id and date')
->click('Save', array('dm_test_post_admin_form' => array(
'title' => dmString::random(),
'user_id' => 9999,
'categ_id' => 9999,
'date' => 'bad date'
)))
->with('form')->begin()
->hasErrors(3)
->isError('user_id', 'invalid')
->isError('categ_id', 'invalid')
->isError('date', 'invalid')
->end()
->info('Submit valid')
->click('Save', array('dm_test_post_admin_form' => array(
'title' => $postTitle = dmString::random(16),
'user_id' => dmDb::table('DmUser')->findOne()->id,
'categ_id' => dmDb::table('DmTestCateg')->findOne()->id,
'date' => '01/13/2010',
'excerpt' => 'resume 1'
)))
->with('form')->begin()
->hasErrors(0)
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'edit')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', $postTitle)
->checkElement('#dm_test_post_admin_form_excerpt', 'resume 1')
->end()
->info('Update post')
->click('Save', array('dm_test_post_admin_form' => array(
'title' => $postTitle,
'user_id' => dmDb::table('DmUser')->findOne()->id,
'categ_id' => dmDb::table('DmTestCateg')->findOne()->id,
'date' => '01/13/2012',
'excerpt' => 'resume 2'
)))
->with('form')->begin()
->hasErrors(0)
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'edit')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', $postTitle)
->checkElement('#dm_test_post_admin_form_excerpt', 'resume 2')
->end();
$browser->info('Post history')
->click('History')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'history')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', 'Revision history')
->end()
->info('Revert to version 1')
->click('Revert to revision 1')
->with('request')->begin()
->isParameter('module', 'dmAdminGenerator')
->isParameter('action', 'revert')
->isParameter('model', 'DmTestPost')
->isParameter('version', 1)
->isMethod('get')
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'history')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', 'Revision history')
->end()
->info('Return to edit page')
->click('#breadCrumb a:last')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'edit')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', $postTitle)
->checkElement('#dm_test_post_admin_form_excerpt', 'resume 1')
->end()
->info('Return to list page')
->click('Back to list')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('h1', 'Dm test posts')
->checkElement('.dm_pagination_status', '1 - 10 of 20')
->end();
$browser->info('Search in posts')
->click('.dm_module_search input[type="submit"]', array('search' => $postTitle))
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isParameter('search', $postTitle)
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.dm_cancel_search')
->checkElement('.dm_pagination_status', '1 - 1 of 1')
//->checkElement('.sf_admin_list_td_title:first a', $postTitle)
//->checkElement('.sf_admin_list_td_title:last a', $postTitle)
->end()
->info('Cancel search')
->click('.dm_cancel_search')
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isParameter('search', null)
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.dm_pagination_status', '1 - 10 of 20')
->end();
$browser->info('Delete post')
->click('.sf_admin_list_td_title:first a')
->click('Delete', array(), array('method' => 'post'))
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'delete')
->isMethod('post')
->end()
->with('response')->begin()
->isRedirected()
->end()
->followRedirect()
->with('request')->begin()
->isParameter('module', 'dmTestPost')
->isParameter('action', 'index')
->isMethod('get')
->end()
->with('response')->begin()
->isStatusCode(200)
->checkElement('.dm_pagination_status', '1 - 10 of 19')
->end(); | {
"content_hash": "2b79fc8c7d02d7b6ed63da906582f122",
"timestamp": "",
"source": "github",
"line_count": 430,
"max_line_length": 160,
"avg_line_length": 27.337209302325583,
"alnum_prop": 0.6490854955338154,
"repo_name": "PolibudaInfo/diem",
"id": "1b43c9916812a39f069ba0b6c604fef3d4756470",
"size": "11756",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "dmCorePlugin/test/project/test/functional/admin/dmContentTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "218417"
},
{
"name": "HTML",
"bytes": "226344"
},
{
"name": "JavaScript",
"bytes": "462509"
},
{
"name": "PHP",
"bytes": "2538983"
},
{
"name": "Shell",
"bytes": "4582"
}
],
"symlink_target": ""
} |
Following command lines switches in Chrome browser are also Supported in
Electron, you can use [app.commandLine.appendSwitch][append-switch] to append
them in your app's main script before the [ready][ready] event of [app][app]
module is emitted:
```javascript
var app = require('app');
app.commandLine.appendSwitch('remote-debugging-port', '8315');
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1');
app.on('ready', function() {
});
```
## --disable-http-cache
Disables the disk cache for HTTP requests.
## --remote-debugging-port=`port`
Enables remote debug over HTTP on the specified `port`.
## --proxy-server=`address:port`
Uses a specified proxy server, overrides system settings. This switch only
affects HTTP and HTTPS requests.
## --no-proxy-server
Don't use a proxy server, always make direct connections. Overrides any other
proxy server flags that are passed.
## --host-rules=`rules`
Comma-separated list of `rules` that control how hostnames are mapped.
For example:
* `MAP * 127.0.0.1` Forces all hostnames to be mapped to 127.0.0.1
* `MAP *.google.com proxy` Forces all google.com subdomains to be resolved to
"proxy".
* `MAP test.com [::1]:77` Forces "test.com" to resolve to IPv6 loopback. Will
also force the port of the resulting socket address to be 77.
* `MAP * baz, EXCLUDE www.google.com` Remaps everything to "baz", except for
"www.google.com".
These mappings apply to the endpoint host in a net request (the TCP connect
and host resolver in a direct connection, and the `CONNECT` in an http proxy
connection, and the endpoint host in a `SOCKS` proxy connection).
## --host-resolver-rules=`rules`
Like `--host-rules` but these `rules` only apply to the host resolver.
[app]: app.md
[append-switch]: app.md#appcommandlineappendswitchswitch-value
[ready]: app.md#event-ready
## --ignore-certificate-errors
Ignore certificate related errors.
## --v=`log_level`
Gives the default maximal active V-logging level; 0 is the default. Normally
positive values are used for V-logging levels.
Passing `--v=-1` will disable logging.
## --vmodule=`pattern`
Gives the per-module maximal V-logging levels to override the value given by
`--v`. E.g. `my_module=2,foo*=3` would change the logging level for all code in
source files `my_module.*` and `foo*.*`.
Any pattern containing a forward or backward slash will be tested against the
whole pathname and not just the module. E.g. `*/foo/bar/*=2` would change the
logging level for all code in source files under a `foo/bar` directory.
To disable all chromium related logs and only enable your application logs you
can do:
```javascript
app.commandLine.appendSwitch('v', -1);
app.commandLine.appendSwitch('vmodule', 'console=0');
```
| {
"content_hash": "0c983fa9056a02ed97759be31bb38937",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 31.825581395348838,
"alnum_prop": 0.7398611618560468,
"repo_name": "ibare/Electron-KitchenSink",
"id": "de124ac8ceba1912f0864044a6a195562464cb66",
"size": "2779",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/contents/chrome-command-line-switches.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1942"
},
{
"name": "CoffeeScript",
"bytes": "4284"
},
{
"name": "HTML",
"bytes": "5317"
},
{
"name": "JavaScript",
"bytes": "7190"
}
],
"symlink_target": ""
} |
@interface ABI42_0_0EXSMSModule () <MFMessageComposeViewControllerDelegate>
@property (nonatomic, weak) id<ABI42_0_0UMUtilitiesInterface> utils;
@property (nonatomic, strong) ABI42_0_0UMPromiseResolveBlock resolve;
@property (nonatomic, strong) ABI42_0_0UMPromiseRejectBlock reject;
@end
@implementation ABI42_0_0EXSMSModule
ABI42_0_0UM_EXPORT_MODULE(ExpoSMS);
- (dispatch_queue_t)methodQueue
{
// Everything in this module uses `MFMessageComposeViewController` which is a subclass of UIViewController,
// so everything should be called from main thread.
return dispatch_get_main_queue();
}
- (void)setModuleRegistry:(ABI42_0_0UMModuleRegistry *)moduleRegistry
{
_utils = [moduleRegistry getModuleImplementingProtocol:@protocol(ABI42_0_0UMUtilitiesInterface)];
}
ABI42_0_0UM_EXPORT_METHOD_AS(isAvailableAsync,
isAvailable:(ABI42_0_0UMPromiseResolveBlock)resolve
rejecter:(ABI42_0_0UMPromiseRejectBlock)reject)
{
resolve(@([MFMessageComposeViewController canSendText]));
}
ABI42_0_0UM_EXPORT_METHOD_AS(sendSMSAsync,
sendSMS:(NSArray<NSString *> *)addresses
message:(NSString *)message
options:(NSDictionary *)options
resolver:(ABI42_0_0UMPromiseResolveBlock)resolve
rejecter:(ABI42_0_0UMPromiseRejectBlock)reject)
{
if (![MFMessageComposeViewController canSendText]) {
reject(@"E_SMS_UNAVAILABLE", @"SMS service not available", nil);
return;
}
if (_resolve != nil || _reject != nil) {
reject(@"E_SMS_SENDING_IN_PROGRESS", @"Different SMS sending in progress. Await the old request and then try again.", nil);
return;
}
_resolve = resolve;
_reject = reject;
MFMessageComposeViewController *messageComposeViewController = [[MFMessageComposeViewController alloc] init];
messageComposeViewController.messageComposeDelegate = self;
messageComposeViewController.recipients = addresses;
messageComposeViewController.body = message;
if (options) {
if (options[@"attachments"]) {
NSArray *attachments = (NSArray *) [options objectForKey:@"attachments"];
for (NSDictionary* attachment in attachments) {
NSString *mimeType = attachment[@"mimeType"];
CFStringRef mimeTypeRef = (__bridge CFStringRef)mimeType;
CFStringRef utiRef = UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeTypeRef, NULL);
if (utiRef == NULL) {
reject(@"E_SMS_ATTACHMENT", [NSString stringWithFormat:@"Failed to find UTI for mimeType: %@", mimeType], nil);
_resolve = nil;
_reject = nil;
return;
}
NSString *typeIdentifier = (__bridge_transfer NSString *)utiRef;
NSString *uri = attachment[@"uri"];
NSString *filename = attachment[@"filename"];
NSError *error;
NSData *attachmentData = [NSData dataWithContentsOfURL:[NSURL URLWithString:uri] options:(NSDataReadingOptions)0 error:&error];
bool attached = [messageComposeViewController addAttachmentData:attachmentData typeIdentifier:typeIdentifier filename:filename];
if (!attached) {
reject(@"E_SMS_ATTACHMENT", [NSString stringWithFormat:@"Failed to attach file: %@", uri], nil);
_resolve = nil;
_reject = nil;
return;
}
}
}
}
[self.utils.currentViewController presentViewController:messageComposeViewController animated:YES completion:nil];
}
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller
didFinishWithResult:(MessageComposeResult)result
{
NSDictionary *resolveData;
NSString *rejectMessage;
switch (result) {
case MessageComposeResultCancelled:
resolveData = @{@"result": @"cancelled"};
break;
case MessageComposeResultSent:
resolveData = @{@"result": @"sent"};
break;
case MessageComposeResultFailed:
rejectMessage = @"User's attempt to save or send an SMS was unsuccessful. This can occur when the device loses connection to Wifi or Cellular.";
break;
default:
rejectMessage = @"SMS message sending failed with unknown error";
break;
}
ABI42_0_0UM_WEAKIFY(self);
[controller dismissViewControllerAnimated:YES completion:^{
ABI42_0_0UM_ENSURE_STRONGIFY(self);
if (rejectMessage) {
self->_reject(@"E_SMS_SENDING_FAILED", rejectMessage, nil);
} else {
self->_resolve(resolveData);
}
self->_reject = nil;
self->_resolve = nil;
}];
}
@end
| {
"content_hash": "5096073d0c75f92a89b3a4c5abde77e3",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 150,
"avg_line_length": 37.66115702479339,
"alnum_prop": 0.6892692560895326,
"repo_name": "exponent/exponent",
"id": "81488007cd89157d90eb2b4eefd2f52319ce6c71",
"size": "4858",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ios/versioned-react-native/ABI42_0_0/Expo/EXSMS/ABI42_0_0EXSMS/ABI42_0_0EXSMSModule.m",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "113276"
},
{
"name": "Batchfile",
"bytes": "127"
},
{
"name": "C",
"bytes": "1744836"
},
{
"name": "C++",
"bytes": "1801159"
},
{
"name": "CSS",
"bytes": "7854"
},
{
"name": "HTML",
"bytes": "176329"
},
{
"name": "IDL",
"bytes": "897"
},
{
"name": "Java",
"bytes": "6251130"
},
{
"name": "JavaScript",
"bytes": "4416558"
},
{
"name": "Makefile",
"bytes": "18061"
},
{
"name": "Objective-C",
"bytes": "13971362"
},
{
"name": "Objective-C++",
"bytes": "725480"
},
{
"name": "Perl",
"bytes": "5860"
},
{
"name": "Prolog",
"bytes": "287"
},
{
"name": "Python",
"bytes": "125673"
},
{
"name": "Ruby",
"bytes": "61190"
},
{
"name": "Shell",
"bytes": "4441"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>classical-realizability: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.15.1 / classical-realizability - 8.8.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
classical-realizability
<small>
8.8.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-11 09:27:55 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-11 09:27:55 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 4 Virtual package relying on a GMP lib system installation
coq 8.15.1 Formal proof management system
dune 3.4.1 Fast, portable, and opinionated build system
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
ocaml-secondary-compiler 4.08.1-1 OCaml 4.08.1 Secondary Switch Compiler
ocamlfind 1.9.1 A library manager for OCaml
ocamlfind-secondary 1.9.1 Adds support for ocaml-secondary-compiler to ocamlfind
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/classical-realizability"
license: "BSD"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/ClassicalRealizability"]
depends: [
"ocaml"
"coq" {>= "8.8" & < "8.9~"}
]
tags: [ "keyword: classical realizability" "keyword: Krivine's realizability" "keyword: primitive datatype" "keyword: non determinism" "keyword: quote" "keyword: axiom of countable choice" "keyword: real numbers" "category: Mathematics/Logic/Foundations" ]
authors: [ "Lionel Rieg <lionel.rieg@ens-lyon.org>" ]
bug-reports: "https://github.com/coq-contribs/classical-realizability/issues"
dev-repo: "git+https://github.com/coq-contribs/classical-realizability.git"
synopsis: "Krivine's classical realizability"
description: """
The aim of this Coq library is to provide a framework for checking
proofs in Krivine's classical realizability for second-order Peano arithmetic.
It is designed to be as extensible as the original theory by Krivine and to
support on-the-fly extensions by new instructions with their evaluation
rules."""
flags: light-uninstall
url {
src:
"https://github.com/coq-contribs/classical-realizability/archive/v8.8.0.tar.gz"
checksum: "md5=70ca4b39adfad0bb0589a7cd55947901"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-classical-realizability.8.8.0 coq.8.15.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.15.1).
The following dependencies couldn't be met:
- coq-classical-realizability -> coq < 8.9~ -> ocaml < 4.03.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-classical-realizability.8.8.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "128d389a41c5dd4492954e9975589dd5",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 340,
"avg_line_length": 45.133720930232556,
"alnum_prop": 0.5651165786422775,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "b5f9356e1b7f5a68122ed80f13a96e31adcd969f",
"size": "7788",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.15.1/classical-realizability/8.8.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
export default (app) => {
const headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'csrf-token': window.csrf
}
app.on('POST:article', data => {
fetch(`/api/${packageName}`, {
method: 'post',
credentials: 'same-origin',
headers,
body: JSON.stringify(data)
})
.then(checkStatus)
.then(body => app.emit('POST:article:response', body))
.catch(function(error) {
app.emit('POST:article:error', error)
})
})
app.on('PUT:article', (id, data) => {
fetch(`/api/${packageName}/${id}`, {
method: 'put',
credentials: 'same-origin',
headers,
body: JSON.stringify(data)
})
.then(checkStatus)
.then(body => app.emit('PUT:article:response', body))
.catch(function(error) {
app.emit('PUT:article:error', error)
})
})
app.on('DELETE:article', id => {
fetch(`/api/${packageName}/${id}`, {
method: 'delete',
credentials: 'same-origin',
headers
})
.then(checkStatus)
.then(body => app.emit('DELETE:article:response', body))
.catch(function(body) {
app.emit('DELETE:article:error', body)
})
})
function checkStatus(resp) {
let json = resp.json()
if (resp.status >= 200 && resp.status < 300) return json
else return json.then(Promise.reject.bind(Promise))
}
}
| {
"content_hash": "a9ea56383a2e7cfae4b38e10eaf89c46",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 62,
"avg_line_length": 25.436363636363637,
"alnum_prop": 0.5632594710507506,
"repo_name": "imperodesign/clever-articles",
"id": "8a23019378ecc3403c57efde62efeff42ab5cbe8",
"size": "1399",
"binary": false,
"copies": "4",
"ref": "refs/heads/development",
"path": "assets/src/admin/js/models/article.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1596"
},
{
"name": "HTML",
"bytes": "11024"
},
{
"name": "JavaScript",
"bytes": "27297"
}
],
"symlink_target": ""
} |
<?php
namespace Gpupo\SubmarinoSdk\Entity\Product;
use Gpupo\CommonSdk\Entity\EntityAbstract;
use Gpupo\CommonSdk\Entity\EntityInterface;
class MarketStructure extends EntityAbstract implements EntityInterface
{
public function getSchema()
{
return [
'categoryId' => 'integer',
'subCategoryId' => 'integer',
'familyId' => 'integer',
'subFamilyId' => 'integer'
];
}
}
| {
"content_hash": "32f0a7acb18b61890c68e9eb0702628b",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 71,
"avg_line_length": 21.80952380952381,
"alnum_prop": 0.6157205240174672,
"repo_name": "mobly/submarino-sdk",
"id": "32c5a3e882e56b6c608e31fc16f32618bc3dc2aa",
"size": "673",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Entity/Product/MarketStructure.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "112561"
}
],
"symlink_target": ""
} |
using System;
class HexadecimalToBinary
{
static void Main()
{
string hexNumber = Console.ReadLine();
char[] hexNumberCharArray = hexNumber.ToCharArray();
string[] hexNumberArray = new string[hexNumberCharArray.Length];
for (int i = 0; i < hexNumberCharArray.Length; i++)
{
hexNumberArray[i] = hexNumberCharArray[i].ToString();
}
for (int i = 0; i < hexNumberArray.Length; i++)
{
hexNumberArray[i]=ConvertToBase2(hexNumberArray[i]);
}
for (int i = 0; i < hexNumberArray.Length; i++)
{
Console.Write(hexNumberArray[i]);
}
Console.WriteLine();
}
static string ConvertToBase2(string hexNumber)
{
switch(hexNumber)
{
case "A":
hexNumber = "10"; break;
case "B":
hexNumber = "11"; break;
case "C":
hexNumber = "12"; break;
case "D":
hexNumber = "13"; break;
case "E":
hexNumber = "14"; break;
case "F":
hexNumber = "15"; break;
}
int intHexNumber = int.Parse(hexNumber);
string reversedBinary = "";
while (intHexNumber > 0)
{
reversedBinary += intHexNumber % 2;
intHexNumber = intHexNumber / 2;
}
char[] reversedBinaryArray = reversedBinary.ToCharArray();
Array.Reverse(reversedBinaryArray);
string binaryNumber = "";
for (int i = 0; i < reversedBinaryArray.Length; i++)
{
binaryNumber += reversedBinaryArray[i];
}
return binaryNumber;
}
} | {
"content_hash": "ec154e180d2ede00b0791b8af78afeca",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 72,
"avg_line_length": 26.646153846153847,
"alnum_prop": 0.5098152424942263,
"repo_name": "hackohackob/TelerikAcademy",
"id": "a028554cb56075b184328de0b8b4e2e33fb14d74",
"size": "1734",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "C#2/NumeralSystems/05.HexadecimalToBinary/05.HexadecimalToBinary.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "749523"
},
{
"name": "CSS",
"bytes": "58913"
},
{
"name": "CoffeeScript",
"bytes": "3700"
},
{
"name": "HTML",
"bytes": "220858"
},
{
"name": "JavaScript",
"bytes": "728487"
}
],
"symlink_target": ""
} |
package org.apache.isis.applib.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @deprecated - use {@link Property#maxLength()} and {@link Parameter#maxLength()} instead.
*/
@Deprecated
@Inherited
@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
public @interface MaxLength {
/**
* @deprecated - use {@link Property#maxLength()} and {@link Parameter#maxLength()} instead.
*/
@Deprecated
int value();
}
| {
"content_hash": "1c680d0b73ef7afe22218563c58d03e1",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 96,
"avg_line_length": 26.36,
"alnum_prop": 0.7405159332321699,
"repo_name": "niv0/isis",
"id": "0a17193a24b61073f91a8251b920f018ccfba7d3",
"size": "1484",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "core/applib/src/main/java/org/apache/isis/applib/annotation/MaxLength.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "53186"
},
{
"name": "Cucumber",
"bytes": "2158"
},
{
"name": "Groovy",
"bytes": "28310"
},
{
"name": "HTML",
"bytes": "440399"
},
{
"name": "Java",
"bytes": "11833294"
},
{
"name": "JavaScript",
"bytes": "115833"
},
{
"name": "Shell",
"bytes": "14797"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60-ea) on Thu Dec 15 09:48:38 EST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface org.wildfly.swarm.config.security.SecurityDomainConsumer (Public javadocs 2016.12.1 API)</title>
<meta name="date" content="2016-12-15">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface org.wildfly.swarm.config.security.SecurityDomainConsumer (Public javadocs 2016.12.1 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2016.12.1</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/config/security/class-use/SecurityDomainConsumer.html" target="_top">Frames</a></li>
<li><a href="SecurityDomainConsumer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Interface org.wildfly.swarm.config.security.SecurityDomainConsumer" class="title">Uses of Interface<br>org.wildfly.swarm.config.security.SecurityDomainConsumer</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.wildfly.swarm.config">org.wildfly.swarm.config</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.wildfly.swarm.config.security">org.wildfly.swarm.config.security</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.wildfly.swarm.config">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a> in <a href="../../../../../../org/wildfly/swarm/config/package-summary.html">org.wildfly.swarm.config</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../org/wildfly/swarm/config/package-summary.html">org.wildfly.swarm.config</a> with parameters of type <a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../org/wildfly/swarm/config/Security.html" title="type parameter in Security">T</a></code></td>
<td class="colLast"><span class="typeNameLabel">Security.</span><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/Security.html#securityDomain-java.lang.String-org.wildfly.swarm.config.security.SecurityDomainConsumer-">securityDomain</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> childKey,
<a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a> consumer)</code>
<div class="block">Create and configure a SecurityDomain object to the list of subresources</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.wildfly.swarm.config.security">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a> in <a href="../../../../../../org/wildfly/swarm/config/security/package-summary.html">org.wildfly.swarm.config.security</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../org/wildfly/swarm/config/security/package-summary.html">org.wildfly.swarm.config.security</a> that return <a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>default <a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="type parameter in SecurityDomainConsumer">T</a>></code></td>
<td class="colLast"><span class="typeNameLabel">SecurityDomainConsumer.</span><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html#andThen-org.wildfly.swarm.config.security.SecurityDomainConsumer-">andThen</a></span>(<a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="type parameter in SecurityDomainConsumer">T</a>> after)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../org/wildfly/swarm/config/security/package-summary.html">org.wildfly.swarm.config.security</a> with parameters of type <a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>default <a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="type parameter in SecurityDomainConsumer">T</a>></code></td>
<td class="colLast"><span class="typeNameLabel">SecurityDomainConsumer.</span><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html#andThen-org.wildfly.swarm.config.security.SecurityDomainConsumer-">andThen</a></span>(<a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">SecurityDomainConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="type parameter in SecurityDomainConsumer">T</a>> after)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/wildfly/swarm/config/security/SecurityDomainConsumer.html" title="interface in org.wildfly.swarm.config.security">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2016.12.1</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/config/security/class-use/SecurityDomainConsumer.html" target="_top">Frames</a></li>
<li><a href="SecurityDomainConsumer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2016 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "eb5da7a210605f367701bd6e831735ef",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 641,
"avg_line_length": 56.970873786407765,
"alnum_prop": 0.6735685071574642,
"repo_name": "wildfly-swarm/wildfly-swarm-javadocs",
"id": "95751388a500069ca1bb22a7749d42242afc7af3",
"size": "11736",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "2016.12.1/apidocs/org/wildfly/swarm/config/security/class-use/SecurityDomainConsumer.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
describe('Transition', function () {
var transition = require('vue/src/transition'),
config = require('vue/src/config'),
codes = transition.codes,
endEvents = transition.sniff(),
enterClass = config.enterClass,
leaveClass = config.leaveClass,
nextTick = Vue.nextTick
describe('General', function () {
it('should skip if compiler is in init stage', function () {
var c = mockChange(),
compiler = mockCompiler()
compiler.init = true
var code = transition(null, 1, c.change, compiler)
assert.ok(c.called)
assert.strictEqual(code, codes.INIT)
assert.ok(compiler.attached)
})
it('should skip if no transition is found on the node', function () {
var c = mockChange(),
compiler = mockCompiler(),
code = transition(mockEl(), 1, c.change, compiler)
assert.ok(c.called)
assert.strictEqual(code, codes.SKIP)
assert.ok(compiler.attached)
})
})
describe('CSS Transitions', function () {
if (!endEvents.trans) { // IE9 only test case
it('should skip if transition is not available', function () {
var c = mockChange(),
compiler = mockCompiler(),
code = transition(mockEl('css'), 1, c.change, compiler)
assert.ok(c.called)
assert.strictEqual(code, codes.CSS_SKIP)
assert.ok(compiler.attached)
})
// skip the rest
return
}
describe('enter: transition', function () {
var el = mockEl('css'),
c = mockChange(function () {
c.called = true
assert.ok(el.classList.contains(enterClass))
}),
compiler = mockCompiler(),
code,
cbCalled = false
el.vue_trans_cb = function () {
cbCalled = true
}
el.addEventListener(endEvents.trans, el.vue_trans_cb)
it('should add the class before calling changeState()', function () {
code = transition(el, 1, c.change, compiler)
assert.ok(c.called)
})
it('should remove unfinished leave callback if exists', function () {
assert.notOk(el.vue_trans_cb)
var e = mockHTMLEvent(endEvents.trans)
el.dispatchEvent(e)
assert.notOk(cbCalled)
})
it('should remove the v-leave class if the leave callback exists', function () {
var el = mockEl('css')
document.body.appendChild(el)
el.style.width = '1px'
code = transition(el, -1, function(){}, compiler)
code = transition(el, 1, function(){}, compiler)
assert.notOk(el.classList.contains(leaveClass))
})
it('should remove the class afterwards', function (done) {
nextTick(function () {
assert.notOk(el.classList.contains(enterClass))
done()
})
})
it('should return correct code', function () {
assert.strictEqual(code, codes.CSS_E)
})
it('should have called attached hook', function () {
assert.ok(compiler.attached)
})
})
describe('enter: animation', function () {
var el = mockEl('css'),
c = mockChange(function () {
c.called = true
assert.ok(el.classList.contains(enterClass))
}),
compiler = mockCompiler(),
code
// mark it to use CSS animation instead of transition
el.vue_anim = ''
before(function () {
document.body.appendChild(el)
})
after(function () {
document.body.removeChild(el)
})
it('should add enterClass before calling changeState()', function () {
code = transition(el, 1, c.change, compiler)
assert.ok(c.called)
})
it('should still have the class on nextTick', function (done) {
nextTick(function () {
assert.ok(el.classList.contains(enterClass))
done()
})
})
it('should remove the class when the animation is done', function (done) {
el.addEventListener(endEvents.anim, function () {
assert.notOk(el.vue_trans_cb)
assert.notOk(el.classList.contains(enterClass))
done()
})
var e = mockHTMLEvent(endEvents.anim)
el.dispatchEvent(e)
})
})
describe('leave', function () {
var el = mockEl('css'),
c = mockChange(),
compiler = mockCompiler(),
code
before(function () {
document.body.appendChild(el)
})
after(function () {
document.body.removeChild(el)
})
it('should call change immediately if el is invisible', function () {
var el = mockEl('css'),
c = mockChange(),
compiler = mockCompiler()
code = transition(el, -1, c.change, compiler)
assert.ok(c.called)
assert.ok(compiler.detached)
})
it('should attach an ontransitionend listener', function () {
el.style.width = '1px'
code = transition(el, -1, c.change, compiler)
assert.ok(typeof el.vue_trans_cb === 'function')
})
it('should add the class', function () {
assert.ok(el.classList.contains(leaveClass))
})
it('should call changeState on transitionend', function () {
var e = mockHTMLEvent(endEvents.trans)
el.dispatchEvent(e)
assert.ok(c.called)
})
it('should remove the callback after called', function () {
assert.notOk(el.vue_trans_cb)
var e = mockHTMLEvent(endEvents.trans)
el.dispatchEvent(e)
assert.strictEqual(c.n, 1)
})
it('should remove the class after called', function () {
assert.notOk(el.classList.contains(leaveClass))
})
it('should return correct code', function () {
assert.strictEqual(code, codes.CSS_L)
})
it('should have called detached hook', function () {
assert.ok(compiler.detached)
})
})
})
describe('JavaScript Transitions', function () {
it('should skip if correspinding option is not defined', function () {
var c = mockChange(),
compiler = mockCompiler(),
code = transition(mockEl('js'), 1, c.change, compiler)
assert.ok(c.called)
assert.strictEqual(code, codes.JS_SKIP)
assert.ok(compiler.attached)
})
it('should skip if the option is given but the enter/leave func is not defined', function () {
var c = mockChange(),
compiler = mockCompiler({}),
code = transition(mockEl('js'), 1, c.change, compiler)
assert.ok(c.called)
assert.strictEqual(code, codes.JS_SKIP_E)
assert.ok(compiler.attached)
c = mockChange()
compiler = mockCompiler({})
code = transition(mockEl('js'), -1, c.change, compiler)
assert.ok(c.called)
assert.strictEqual(code, codes.JS_SKIP_L)
assert.ok(compiler.detached)
})
describe('enter', function () {
var code,
c = mockChange(),
el = mockEl('js'),
def = {
enter: function (element, change) {
assert.strictEqual(el, element)
change()
}
},
compiler = mockCompiler(def)
it('should call the enter function', function () {
code = transition(el, 1, c.change, compiler)
assert.ok(c.called)
})
it('should return correct code', function () {
assert.strictEqual(code, codes.JS_E)
})
it('should have called attached hook', function () {
assert.ok(compiler.attached)
})
})
describe('leave', function () {
var code,
c = mockChange(),
el = mockEl('js'),
def = {
leave: function (element, change) {
assert.strictEqual(el, element)
change()
}
},
compiler = mockCompiler(def)
it('should call the leave function', function () {
code = transition(el, -1, c.change, compiler)
assert.ok(c.called)
})
it('should return correct code', function () {
assert.strictEqual(code, codes.JS_L)
})
it('should have called detached hook', function () {
assert.ok(compiler.detached)
})
})
describe('wrapped timeout', function () {
var el = mockEl('js'),
c = mockChange(),
timerFired = false,
def = {
enter: function (el, change, timeout) {
change()
timeout(function () {
timerFired = true
}, 0)
},
leave: function () {}
},
compiler = mockCompiler(def)
it('should cancel previous unfired timers', function (done) {
transition(el, 1, c.change, compiler)
assert.strictEqual(el.vue_timeouts.length, 1)
transition(el, -1, c.change, compiler)
assert.strictEqual(el.vue_timeouts.length, 0)
setTimeout(function () {
assert.notOk(timerFired)
done()
}, 0)
})
})
})
function mockChange (change) {
var c = {
called: false,
n: 0,
change: change || function () {
c.called = true
c.n += 1
}
}
return c
}
function mockEl (type) {
var el = document.createElement('div')
if (type === 'css') {
el.vue_trans = ''
} else if (type === 'js') {
el.vue_effect = 'test'
}
return el
}
function mockCompiler (opt) {
return {
getOption: function () {
return opt
},
execHook: function (hook) {
this[hook] = true
}
}
}
}) | {
"content_hash": "1537c88e81da258e86f2484780090fc3",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 102,
"avg_line_length": 32.239554317548745,
"alnum_prop": 0.46284776222567825,
"repo_name": "ryogeisya/vue",
"id": "7aa32d9e897e4087ecd96907e31d2b4a5e3a00b0",
"size": "11574",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "test/unit/specs/transition.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4381"
},
{
"name": "HTML",
"bytes": "42503"
},
{
"name": "JavaScript",
"bytes": "735158"
}
],
"symlink_target": ""
} |
namespace impala {
// Returns a value representing a point in time with microsecond accuracy that is
// unaffected by daylight savings or manual adjustments to the system clock. This should
// not be assumed to be a Unix time. Typically the value corresponds to elapsed time
// since the system booted. See UnixMillis() below if you need to send a time to a
// different host.
inline int64_t MonotonicMicros() { // 63 bits ~= 5K years uptime
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return now.tv_sec * 1000000 + now.tv_nsec / 1000;
}
inline int64_t MonotonicMillis() {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return now.tv_sec * 1000 + now.tv_nsec / 1000000;
}
inline int64_t MonotonicSeconds() {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
return now.tv_sec;
}
// Returns the number of milliseconds that have passed since the Unix epoch. This is
// affected by manual changes to the system clock but is more suitable for use across
// a cluster. For more accurate timings on the local host use the monotonic functions
// above.
inline int64_t UnixMillis() {
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
return now.tv_sec * 1000 + now.tv_nsec / 1000000;
}
// Sleeps the current thread for at least duration_ms milliseconds.
void SleepForMs(const int64_t duration_ms);
}
#endif
| {
"content_hash": "056e89168d0df40da89edc72f70ecbe8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 88,
"avg_line_length": 33.53658536585366,
"alnum_prop": 0.7396363636363636,
"repo_name": "ImpalaToGo/ImpalaToGo",
"id": "fa44ef141e7f3440dc850bbd58171aefb992d1f8",
"size": "2093",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "be/src/util/time.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "185578"
},
{
"name": "C++",
"bytes": "6494955"
},
{
"name": "CMake",
"bytes": "91381"
},
{
"name": "CSS",
"bytes": "86925"
},
{
"name": "Groff",
"bytes": "1633"
},
{
"name": "HTML",
"bytes": "56"
},
{
"name": "Java",
"bytes": "3353893"
},
{
"name": "Lex",
"bytes": "21664"
},
{
"name": "PLpgSQL",
"bytes": "3646"
},
{
"name": "Python",
"bytes": "1526877"
},
{
"name": "Shell",
"bytes": "177751"
},
{
"name": "Thrift",
"bytes": "243288"
},
{
"name": "Yacc",
"bytes": "79842"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<entry type="method" name="jQuery.extend" return="Object">
<title>jQuery.extend()</title>
<signature>
<added>1.0</added>
<argument name="target" type="Object">
<desc> An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.</desc>
</argument>
<argument name="object1" type="Object" optional="true">
<desc>An object containing additional properties to merge in.</desc>
</argument>
<argument name="objectN" optional="true" type="Object">
<desc>Additional objects containing properties to merge in.</desc>
</argument>
</signature>
<signature>
<added>1.1.4</added>
<argument name="deep" optional="true" type="Boolean">
<desc>If true, the merge becomes recursive (aka. deep copy).</desc>
</argument>
<argument name="target" type="Object">
<desc>The object to extend. It will receive the new properties.</desc>
</argument>
<argument name="object1" type="Object">
<desc>An object containing additional properties to merge in.</desc>
</argument>
<argument name="objectN" optional="true" type="Object">
<desc>Additional objects containing properties to merge in.</desc>
</argument>
</signature>
<desc>Merge the contents of two or more objects together into the first object.</desc>
<longdesc>
<p>When two or more object arguments are supplied to <code>$.extend()</code>, properties from all of the objects are added to the target object. Arguments that are <code>null</code> or <code>undefined</code> are ignored.</p>
<p>If only one argument is supplied to <code>$.extend()</code>, this means the target argument was omitted. In this case, the jQuery object itself is assumed to be the target. By doing this, you can add new functions to the jQuery namespace. This can be useful for plugin authors wishing to add new methods to JQuery.</p>
<p>Keep in mind that the target object (first argument) will be modified, and will also be returned from <code>$.extend()</code>. If, however, you want to preserve both of the original objects, you can do so by passing an empty object as the target:</p>
<pre><code>var object = $.extend({}, object1, object2);</code></pre>
<p>The merge performed by <code>$.extend()</code> is not recursive by default; if a property of the first object is itself an object or array, it will be completely overwritten by a property with the same key in the second or subsequent object. The values are not merged. This can be seen in the example below by examining the value of banana. However, by passing <code>true</code> for the first function argument, objects will be recursively merged.</p>
<p><strong>Warning</strong>: Passing <code>false</code> for the first argument is not supported.</p>
<p>Undefined properties are not copied. However, properties inherited from the object's prototype <em>will</em> be copied over. Properties that are an object constructed via <code>new MyCustomObject(args)</code>, or built-in JavaScript types such as Date or RegExp, are not re-constructed and will appear as plain Objects in the resulting object or array.</p>
<p>On a <code>deep</code> extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not. Deep-extending a cyclical data structure will result in an error.</p>
<p>For needs that fall outside of this behavior, write a custom extend method instead, or use a library like <a href="http://lodash.com">lodash</a>. </p>
</longdesc>
<example>
<desc>Merge two objects, modifying the first.</desc>
<code><![CDATA[
var object1 = {
apple: 0,
banana: { weight: 52, price: 100 },
cherry: 97
};
var object2 = {
banana: { price: 200 },
durian: 100
};
// Merge object2 into object1
$.extend( object1, object2 );
// Assuming JSON.stringify - not available in IE<8
$( "#log" ).append( JSON.stringify( object1 ) );
]]></code>
<html><![CDATA[
<div id="log"></div>
]]></html>
</example>
<example>
<desc>Merge two objects recursively, modifying the first.</desc>
<code><![CDATA[
var object1 = {
apple: 0,
banana: { weight: 52, price: 100 },
cherry: 97
};
var object2 = {
banana: { price: 200 },
durian: 100
};
// Merge object2 into object1, recursively
$.extend( true, object1, object2 );
// Assuming JSON.stringify - not available in IE<8
$( "#log" ).append( JSON.stringify( object1 ) );
]]></code>
<html><![CDATA[
<div id="log"></div>
]]></html>
</example>
<example>
<desc>Merge defaults and options, without modifying the defaults. This is a common plugin development pattern.</desc>
<code><![CDATA[
var defaults = { validate: false, limit: 5, name: "foo" };
var options = { validate: true, name: "bar" };
// Merge defaults and options, without modifying defaults
var settings = $.extend( {}, defaults, options );
// Assuming JSON.stringify - not available in IE<8
$( "#log" ).append( "<div><b>defaults -- </b>" + JSON.stringify( defaults ) + "</div>" );
$( "#log" ).append( "<div><b>options -- </b>" + JSON.stringify( options ) + "</div>" );
$( "#log" ).append( "<div><b>settings -- </b>" + JSON.stringify( settings ) + "</div>" );
]]></code>
<html><![CDATA[
<div id="log"></div>
]]></html>
</example>
<category slug="utilities"/>
<category slug="version/1.0"/>
</entry>
| {
"content_hash": "5633afb9e48104db43c282a898bd7ca0",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 458,
"avg_line_length": 49.862385321100916,
"alnum_prop": 0.6840846366145354,
"repo_name": "phax/ph-oton",
"id": "ee6fb4a70744da100fe6756fce16368dc8c9f0d5",
"size": "5435",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ph-oton-jquery/src/test/resources/jquery/entries/jQuery.extend.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "4949"
},
{
"name": "Batchfile",
"bytes": "2999"
},
{
"name": "CSS",
"bytes": "972450"
},
{
"name": "HTML",
"bytes": "64002"
},
{
"name": "Java",
"bytes": "9783110"
},
{
"name": "JavaScript",
"bytes": "11459373"
},
{
"name": "SCSS",
"bytes": "6736"
}
],
"symlink_target": ""
} |
package org.carlspring.strongbox.cron;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.carlspring.strongbox.cron.api.jobs.RebuildMavenMetadataCronJob;
import org.carlspring.strongbox.cron.config.JobManager;
import org.carlspring.strongbox.cron.context.CronTaskTest;
import org.carlspring.strongbox.cron.domain.CronTaskConfiguration;
import org.carlspring.strongbox.cron.exceptions.CronTaskException;
import org.carlspring.strongbox.cron.exceptions.CronTaskNotFoundException;
import org.carlspring.strongbox.cron.services.CronTaskConfigurationService;
import org.carlspring.strongbox.resource.ConfigurationResourceResolver;
import org.carlspring.strongbox.services.ArtifactMetadataService;
import org.carlspring.strongbox.services.ConfigurationManagementService;
import org.carlspring.strongbox.services.RepositoryManagementService;
import org.carlspring.strongbox.storage.Storage;
import org.carlspring.strongbox.storage.repository.Repository;
import org.carlspring.strongbox.storage.repository.RepositoryPolicyEnum;
import org.carlspring.strongbox.testing.TestCaseWithArtifactGeneration;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.quartz.SchedulerException;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.xml.bind.JAXBException;
import java.io.File;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
/**
* @author Kate Novik.
*/
@CronTaskTest
@RunWith(SpringJUnit4ClassRunner.class)
public class RebuildMavenMetadataCronJobTest
extends TestCaseWithArtifactGeneration
{
@Inject
private CronTaskConfigurationService cronTaskConfigurationService;
@Inject
private ArtifactMetadataService artifactMetadataService;
@Inject
private ConfigurationManagementService configurationManagementService;
@Inject
private RepositoryManagementService repositoryManagementService;
@Inject
private JobManager jobManager;
private static final File REPOSITORY_BASEDIR_1 = new File(ConfigurationResourceResolver.getVaultDirectory() +
"/storages/storage0/snapshots");
private static final File REPOSITORY_BASEDIR_2 = new File(ConfigurationResourceResolver.getVaultDirectory() +
"/storages/storage0/releases");
private static final File REPOSITORY_BASEDIR_3 = new File(ConfigurationResourceResolver.getVaultDirectory() +
"/storages/storage1/releases");
private static final String[] CLASSIFIERS = { "javadoc",
"sources",
"source-release" };
private static final String ARTIFACT_BASE_PATH_STRONGBOX_METADATA = "org/carlspring/strongbox/strongbox-metadata-one";
private static Artifact artifact1;
private static Artifact artifact2;
private static Artifact artifact3;
private static Artifact artifact4;
private static boolean initialized;
@Before
public void setUp()
throws Exception
{
if (!initialized)
{
//noinspection ResultOfMethodCallIgnored
REPOSITORY_BASEDIR_1.mkdirs();
REPOSITORY_BASEDIR_2.mkdirs();
REPOSITORY_BASEDIR_3.mkdirs();
//Create snapshot artifact in repository snapshots
artifact1 = createTimestampedSnapshotArtifact(REPOSITORY_BASEDIR_1.getAbsolutePath(),
"org.carlspring.strongbox",
"strongbox-metadata-one",
"2.0",
"jar",
CLASSIFIERS,
5);
//Create snapshot artifact in repository snapshots
artifact2 = createTimestampedSnapshotArtifact(REPOSITORY_BASEDIR_1.getAbsolutePath(),
"org.carlspring.strongbox",
"strongbox-metadata-second",
"2.0",
"jar",
CLASSIFIERS,
5);
//Create released artifact
String ga = "org.carlspring.strongbox.metadata:strongbox-metadata";
artifact3 = generateArtifact(REPOSITORY_BASEDIR_2.getAbsolutePath(), ga + ":1.0:jar");
//Create storage and repository for testing rebuild metadata in storages
Storage storage = new Storage("storage1");
Repository repository = new Repository("releases");
repository.setPolicy(RepositoryPolicyEnum.RELEASE.getPolicy());
repository.setStorage(storage);
configurationManagementService.addOrUpdateStorage(storage);
repositoryManagementService.createRepository("storage1", "releases");
storage.addOrUpdateRepository(repository);
//Create released artifact
artifact4 = generateArtifact(REPOSITORY_BASEDIR_3.getAbsolutePath(), ga + ":1.0:jar");
changeCreationDate(artifact1);
changeCreationDate(artifact2);
changeCreationDate(artifact3);
changeCreationDate(artifact4);
initialized = true;
}
}
public void addRebuildCronJobConfig(String name,
String storageId,
String repositoryId,
String basePath)
throws Exception
{
CronTaskConfiguration cronTaskConfiguration = new CronTaskConfiguration();
cronTaskConfiguration.setName(name);
cronTaskConfiguration.addProperty("jobClass", RebuildMavenMetadataCronJob.class.getName());
cronTaskConfiguration.addProperty("cronExpression", "0 0/10 * 1/1 * ? *");
cronTaskConfiguration.addProperty("storageId", storageId);
cronTaskConfiguration.addProperty("repositoryId", repositoryId);
cronTaskConfiguration.addProperty("basePath", basePath);
cronTaskConfigurationService.saveConfiguration(cronTaskConfiguration);
CronTaskConfiguration obj = cronTaskConfigurationService.findOne(name);
assertNotNull(obj);
}
public void deleteRebuildCronJobConfig(String name)
throws Exception
{
List<CronTaskConfiguration> confs = cronTaskConfigurationService.getConfiguration(name);
for (CronTaskConfiguration cnf : confs)
{
assertNotNull(cnf);
cronTaskConfigurationService.deleteConfiguration(cnf);
}
assertNull(cronTaskConfigurationService.findOne(name));
}
@Test
public void testRebuildArtifactsMetadata()
throws Exception
{
String jobName = "Rebuild-1";
addRebuildCronJobConfig(jobName, "storage0", "snapshots", ARTIFACT_BASE_PATH_STRONGBOX_METADATA);
//Checking if job was executed
while (!jobManager.getExecutedJobs().containsKey(jobName))
{
Thread.sleep(8000);
}
System.out.println(jobManager.getExecutedJobs().toString());
Metadata metadata = artifactMetadataService.getMetadata("storage0", "snapshots",
"org/carlspring/strongbox/strongbox-metadata-one");
assertNotNull(metadata);
Versioning versioning = metadata.getVersioning();
assertEquals("Incorrect artifactId!", artifact1.getArtifactId(), metadata.getArtifactId());
assertEquals("Incorrect groupId!", artifact1.getGroupId(), metadata.getGroupId());
assertNotNull("No versioning information could be found in the metadata!", versioning.getVersions().size());
assertEquals("Incorrect number of versions stored in metadata!", 1, versioning.getVersions().size());
deleteRebuildCronJobConfig(jobName);
}
@Test
public void testRebuildMetadataInRepository()
throws Exception
{
String jobName = "Rebuild-2";
addRebuildCronJobConfig(jobName, "storage0", "snapshots", null);
//Checking if job was executed
while (!jobManager.getExecutedJobs().containsKey(jobName))
{
Thread.sleep(8000);
}
Metadata metadata1 = artifactMetadataService.getMetadata("storage0", "snapshots",
"org/carlspring/strongbox/strongbox-metadata-one");
Metadata metadata2 = artifactMetadataService.getMetadata("storage0", "snapshots",
"org/carlspring/strongbox/strongbox-metadata-second");
assertNotNull(metadata1);
assertNotNull(metadata2);
Versioning versioning1 = metadata1.getVersioning();
Versioning versioning2 = metadata1.getVersioning();
assertEquals("Incorrect artifactId!", artifact1.getArtifactId(), metadata1.getArtifactId());
assertEquals("Incorrect groupId!", artifact1.getGroupId(), metadata1.getGroupId());
assertEquals("Incorrect artifactId!", artifact2.getArtifactId(), metadata2.getArtifactId());
assertEquals("Incorrect groupId!", artifact2.getGroupId(), metadata2.getGroupId());
assertNotNull("No versioning information could be found in the metadata!", versioning1.getVersions().size());
assertEquals("Incorrect number of versions stored in metadata!", 1, versioning1.getVersions().size());
assertNotNull("No versioning information could be found in the metadata!", versioning2.getVersions().size());
assertEquals("Incorrect number of versions stored in metadata!", 1, versioning2.getVersions().size());
deleteRebuildCronJobConfig(jobName);
}
@Test
public void testRebuildMetadataInStorage()
throws Exception
{
String jobName = "Rebuild-3";
addRebuildCronJobConfig(jobName, "storage0", null, null);
//Checking if job was executed
while (!jobManager.getExecutedJobs().containsKey(jobName))
{
Thread.sleep(8000);
}
Metadata metadata1 = artifactMetadataService.getMetadata("storage0", "snapshots",
"org/carlspring/strongbox/strongbox-metadata-one");
Metadata metadata2 = artifactMetadataService.getMetadata("storage0", "releases",
"org/carlspring/strongbox/metadata/strongbox-metadata");
assertNotNull(metadata1);
assertNotNull(metadata2);
Versioning versioning1 = metadata1.getVersioning();
Versioning versioning2 = metadata1.getVersioning();
assertEquals("Incorrect artifactId!", artifact1.getArtifactId(), metadata1.getArtifactId());
assertEquals("Incorrect groupId!", artifact1.getGroupId(), metadata1.getGroupId());
assertEquals("Incorrect artifactId!", artifact3.getArtifactId(), metadata2.getArtifactId());
assertEquals("Incorrect groupId!", artifact3.getGroupId(), metadata2.getGroupId());
assertNotNull("No versioning information could be found in the metadata!", versioning1.getVersions().size());
assertEquals("Incorrect number of versions stored in metadata!", 1, versioning1.getVersions().size());
assertNotNull("No versioning information could be found in the metadata!", versioning2.getVersions().size());
assertEquals("Incorrect number of versions stored in metadata!", 1, versioning2.getVersions().size());
deleteRebuildCronJobConfig(jobName);
}
@Test
public void testRebuildMetadataInStorages()
throws Exception
{
String jobName = "Rebuild-4";
addRebuildCronJobConfig(jobName, null, null, null);
//Checking if job was executed
while (!jobManager.getExecutedJobs().containsKey(jobName))
{
Thread.sleep(8000);
}
Metadata metadata1 = artifactMetadataService.getMetadata("storage0", "snapshots",
"org/carlspring/strongbox/strongbox-metadata-one");
Metadata metadata2 = artifactMetadataService.getMetadata("storage1", "releases",
"org/carlspring/strongbox/metadata/strongbox-metadata");
assertNotNull(metadata1);
assertNotNull(metadata2);
Versioning versioning1 = metadata1.getVersioning();
Versioning versioning2 = metadata1.getVersioning();
assertEquals("Incorrect artifactId!", artifact1.getArtifactId(), metadata1.getArtifactId());
assertEquals("Incorrect groupId!", artifact1.getGroupId(), metadata1.getGroupId());
assertEquals("Incorrect artifactId!", artifact4.getArtifactId(), metadata2.getArtifactId());
assertEquals("Incorrect groupId!", artifact4.getGroupId(), metadata2.getGroupId());
assertNotNull("No versioning information could be found in the metadata!", versioning1.getVersions().size());
assertEquals("Incorrect number of versions stored in metadata!", 1, versioning1.getVersions().size());
assertNotNull("No versioning information could be found in the metadata!", versioning2.getVersions().size());
assertEquals("Incorrect number of versions stored in metadata!", 1, versioning2.getVersions().size());
deleteRebuildCronJobConfig(jobName);
}
}
| {
"content_hash": "92b945829f49127142b409ec4bda71c6",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 122,
"avg_line_length": 43.75609756097561,
"alnum_prop": 0.6462513935340022,
"repo_name": "nenko-tabakov/strongbox",
"id": "9599c6f70c0634b2383b60d341a127eb5e74a486",
"size": "14352",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "strongbox-cron-tasks/src/test/java/org.carlspring.strongbox.cron/RebuildMavenMetadataCronJobTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "144"
},
{
"name": "Java",
"bytes": "1247127"
}
],
"symlink_target": ""
} |
''' Bokeh Application Handler to look for Bokeh server lifecycle callbacks
in a specified Python module.
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import annotations
import logging # isort:skip
log = logging.getLogger(__name__)
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
import os
from types import ModuleType
# Bokeh imports
from ...core.types import PathLike
from ...util.callback_manager import _check_callback
from .code_runner import CodeRunner
from .lifecycle import LifecycleHandler
#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------
__all__ = (
'ServerLifecycleHandler',
)
#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------
class ServerLifecycleHandler(LifecycleHandler):
''' Load a script which contains server lifecycle callbacks.
.. autoclasstoc::
'''
def __init__(self, *, filename: PathLike, argv: list[str] = [], package: ModuleType | None = None) -> None:
'''
Keyword Args:
filename (str) : path to a module to load lifecycle callbacks from
argv (list[str], optional) : a list of string arguments to use as
``sys.argv`` when the callback code is executed. (default: [])
'''
super().__init__()
with open(filename, encoding='utf-8') as f:
source = f.read()
self._runner = CodeRunner(source, filename, argv, package=package)
if not self._runner.failed:
# unlike ScriptHandler, we only load the module one time
self._module = self._runner.new_module()
def extract_callbacks() -> None:
contents = self._module.__dict__
if 'on_server_loaded' in contents:
self._on_server_loaded = contents['on_server_loaded']
if 'on_server_unloaded' in contents:
self._on_server_unloaded = contents['on_server_unloaded']
if 'on_session_created' in contents:
self._on_session_created = contents['on_session_created']
if 'on_session_destroyed' in contents:
self._on_session_destroyed = contents['on_session_destroyed']
_check_callback(self._on_server_loaded, ('server_context',), what="on_server_loaded")
_check_callback(self._on_server_unloaded, ('server_context',), what="on_server_unloaded")
_check_callback(self._on_session_created, ('session_context',), what="on_session_created")
_check_callback(self._on_session_destroyed, ('session_context',), what="on_session_destroyed")
self._runner.run(self._module, extract_callbacks)
# Properties --------------------------------------------------------------
@property
def error(self) -> str | None:
''' If the handler fails, may contain a related error message.
'''
return self._runner.error
@property
def error_detail(self) -> str | None:
''' If the handler fails, may contain a traceback or other details.
'''
return self._runner.error_detail
@property
def failed(self) -> bool:
''' ``True`` if the lifecycle callbacks failed to execute
'''
return self._runner.failed
# Public methods ----------------------------------------------------------
def url_path(self) -> str | None:
''' The last path component for the basename of the path to the
callback module.
'''
if self.failed:
return None
else:
# TODO should fix invalid URL characters
return '/' + os.path.splitext(os.path.basename(self._runner.path))[0]
#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
| {
"content_hash": "356b1222b245c7f6fddbfd01e822d34f",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 111,
"avg_line_length": 35.81060606060606,
"alnum_prop": 0.4482758620689655,
"repo_name": "bokeh/bokeh",
"id": "ed88b030654f25f378892451b7f0957f4b8bdf3e",
"size": "5058",
"binary": false,
"copies": "1",
"ref": "refs/heads/branch-3.1",
"path": "src/bokeh/application/handlers/server_lifecycle.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "1884"
},
{
"name": "Dockerfile",
"bytes": "1924"
},
{
"name": "GLSL",
"bytes": "44696"
},
{
"name": "HTML",
"bytes": "53475"
},
{
"name": "JavaScript",
"bytes": "20301"
},
{
"name": "Less",
"bytes": "46376"
},
{
"name": "Python",
"bytes": "4475226"
},
{
"name": "Shell",
"bytes": "7673"
},
{
"name": "TypeScript",
"bytes": "3652153"
}
],
"symlink_target": ""
} |
import cgi
import random
import shlex
import logging
import traceback
import oembed
import jinja2
from operator import attrgetter
from urlparse import urlparse, urlunparse
import pymongo
from pylons import tmpl_context as c, app_globals as g
from pylons import request
from paste.deploy.converters import asint
from BeautifulSoup import BeautifulSoup
from . import helpers as h
from . import security
log = logging.getLogger(__name__)
_macros = {}
class macro(object):
def __init__(self, context=None):
self._context = context
def __call__(self, func):
_macros[func.__name__] = (func, self._context)
return func
class parse(object):
def __init__(self, context):
self._context = context
def __call__(self, s):
try:
if s.startswith('quote '):
return '[[' + s[len('quote '):] + ']]'
try:
parts = [unicode(x, 'utf-8')
for x in shlex.split(s.encode('utf-8'))]
if not parts:
return '[[' + s + ']]'
macro = self._lookup_macro(parts[0])
if not macro:
return '[[' + s + ']]'
for t in parts[1:]:
if '=' not in t:
return '[-%s: missing =-]' % ' '.join(parts)
args = dict(t.split('=', 1) for t in parts[1:])
response = macro(**h.encode_keys(args))
return response
except (ValueError, TypeError) as ex:
log.warn('macro error. Upwards stack is %s',
''.join(traceback.format_stack()),
exc_info=True)
msg = cgi.escape(u'[[%s]] (%s)' % (s, repr(ex)))
return '\n<div class="error"><pre><code>%s</code></pre></div>' % msg
except Exception, ex:
raise
return '[[Error parsing %s: %s]]' % (s, ex)
def _lookup_macro(self, s):
macro, context = _macros.get(s, (None, None))
if context is None or context == self._context:
return macro
else:
return None
@macro('neighborhood-wiki')
def neighborhood_feeds(tool_name, max_number=5, sort='pubdate'):
from allura import model as M
from allura.lib.widgets.macros import NeighborhoodFeeds
feed = M.Feed.query.find(
dict(
tool_name=tool_name,
neighborhood_id=c.project.neighborhood._id))
feed = feed.sort(sort, pymongo.DESCENDING).limit(int(max_number)).all()
output = ((dict(
href=item.link,
title=item.title,
author=item.author_name,
ago=h.ago(item.pubdate),
description=g.markdown.cached_convert(item, 'description')))
for item in feed)
feeds = NeighborhoodFeeds(feeds=output)
g.resource_manager.register(feeds)
response = feeds.display(feeds=output)
return response
@macro('neighborhood-wiki')
def neighborhood_blog_posts(max_number=5, sort='timestamp', summary=False):
from forgeblog import model as BM
from allura.lib.widgets.macros import BlogPosts
posts = BM.BlogPost.query.find(dict(
neighborhood_id=c.project.neighborhood._id,
state='published'))
posts = posts.sort(sort, pymongo.DESCENDING).limit(int(max_number)).all()
output = ((dict(
href=post.url(),
title=post.title,
author=post.author().display_name,
ago=h.ago(post.timestamp),
description=summary and ' ' or g.markdown.cached_convert(post, 'text')))
for post in posts if post.app and
security.has_access(post, 'read', project=post.app.project)() and
security.has_access(post.app.project, 'read', project=post.app.project)())
posts = BlogPosts(posts=output)
g.resource_manager.register(posts)
response = posts.display(posts=output)
return response
@macro()
def project_blog_posts(max_number=5, sort='timestamp', summary=False, mount_point=None):
from forgeblog import model as BM
from allura.lib.widgets.macros import BlogPosts
app_config_ids = []
for conf in c.project.app_configs:
if conf.tool_name.lower() == 'blog' and (mount_point is None or conf.options.mount_point == mount_point):
app_config_ids.append(conf._id)
posts = BM.BlogPost.query.find({
'app_config_id': {'$in': app_config_ids},
'state': 'published',
})
posts = posts.sort(sort, pymongo.DESCENDING).limit(int(max_number)).all()
output = ((dict(
href=post.url(),
title=post.title,
author=post.author().display_name,
ago=h.ago(post.timestamp),
description=summary and ' ' or g.markdown.cached_convert(post, 'text')))
for post in posts if security.has_access(post, 'read', project=post.app.project)() and
security.has_access(post.app.project, 'read', project=post.app.project)())
posts = BlogPosts(posts=output)
g.resource_manager.register(posts)
response = posts.display(posts=output)
return response
def get_projects_for_macro(
category=None, sort='last_updated',
show_total=False, limit=100, labels='', award='', private=False,
columns=1, show_proj_icon=True, show_download_button=False, show_awards_banner=True,
initial_q={}):
from allura.lib.widgets.project_list import ProjectList
from allura.lib import utils
from allura import model as M
# 'trove' is internal substitution for 'category' filter in wiki macro
trove = category
limit = int(limit)
q = dict(
deleted=False,
is_nbhd_project=False)
q.update(initial_q)
if labels:
or_labels = labels.split('|')
q['$or'] = [{'labels': {'$all': l.split(',')}} for l in or_labels]
if trove is not None:
trove = M.TroveCategory.query.get(fullpath=trove)
if award:
aw = M.Award.query.find(dict(
created_by_neighborhood_id=c.project.neighborhood_id,
short=award)).first()
if aw:
ids = [grant.granted_to_project_id for grant in
M.AwardGrant.query.find(dict(
granted_by_neighborhood_id=c.project.neighborhood_id,
award_id=aw._id))]
if '_id' in q:
ids = list(set(q['_id']['$in']).intersection(ids))
q['_id'] = {'$in': ids}
if trove is not None:
q['trove_' + trove.type] = trove._id
sort_key, sort_dir = 'last_updated', pymongo.DESCENDING
if sort == 'alpha':
sort_key, sort_dir = 'name', pymongo.ASCENDING
elif sort == 'random':
sort_key, sort_dir = None, None
elif sort == 'last_registered':
sort_key, sort_dir = '_id', pymongo.DESCENDING
elif sort == '_id':
sort_key, sort_dir = '_id', pymongo.DESCENDING
projects = []
if private:
# Only return private projects.
# Can't filter these with a mongo query directly - have to iterate
# through and check the ACL of each project.
for chunk in utils.chunked_find(M.Project, q, sort_key=sort_key,
sort_dir=sort_dir):
projects.extend([p for p in chunk if p.private])
total = len(projects)
if sort == 'random':
projects = random.sample(projects, min(limit, total))
else:
projects = projects[:limit]
else:
total = None
if sort == 'random':
# MongoDB doesn't have a random sort built in, so...
# 1. Do a direct pymongo query (faster than ORM) to fetch just the
# _ids of objects that match our criteria
# 2. Choose a random sample of those _ids
# 3. Do an ORM query to fetch the objects with those _ids
# 4. Shuffle the results
from ming.orm import mapper
m = mapper(M.Project)
collection = M.main_doc_session.db[m.collection.m.collection_name]
docs = list(collection.find(q, {'_id': 1}))
if docs:
ids = [doc['_id'] for doc in
random.sample(docs, min(limit, len(docs)))]
if '_id' in q:
ids = list(set(q['_id']['$in']).intersection(ids))
q['_id'] = {'$in': ids}
projects = M.Project.query.find(q).all()
random.shuffle(projects)
else:
projects = M.Project.query.find(q).limit(limit).sort(sort_key,
sort_dir).all()
pl = ProjectList()
g.resource_manager.register(pl)
response = pl.display(projects=projects,
columns=columns, show_proj_icon=show_proj_icon,
show_download_button=show_download_button,
show_awards_banner=show_awards_banner,
)
if show_total:
if total is None:
total = 0
for p in M.Project.query.find(q):
if h.has_access(p, 'read')():
total = total + 1
response = '<p class="macro_projects_total">%s Projects</p>%s' % \
(total, response)
return response
@macro('neighborhood-wiki')
def projects(category=None, sort='last_updated',
show_total=False, limit=100, labels='', award='', private=False,
columns=1, show_proj_icon=True, show_download_button=False, show_awards_banner=True,
display_mode=None, grid_view_tools='', # old & unused now
):
initial_q = dict(neighborhood_id=c.project.neighborhood_id)
return get_projects_for_macro(
category=category, sort=sort,
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
show_awards_banner=show_awards_banner,
initial_q=initial_q)
@macro('userproject-wiki')
def my_projects(category=None, sort='last_updated',
show_total=False, limit=100, labels='', award='', private=False,
columns=1, show_proj_icon=True, show_download_button=False, show_awards_banner=True,
display_mode=None, grid_view_tools='', # old & unused now
):
myproj_user = c.project.user_project_of
if myproj_user is None:
myproj_user = c.user.anonymous()
ids = []
for p in myproj_user.my_projects():
ids.append(p._id)
initial_q = dict(_id={'$in': ids})
return get_projects_for_macro(
category=category, sort=sort,
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
show_awards_banner=show_awards_banner,
initial_q=initial_q)
@macro()
def project_screenshots():
from allura.lib.widgets.project_list import ProjectScreenshots
ps = ProjectScreenshots()
g.resource_manager.register(ps)
response = ps.display(project=c.project)
return response
@macro()
def gittip_button(username):
from allura.lib.widgets.macros import GittipButton
button = GittipButton(username=username)
g.resource_manager.register(button)
response = button.display(username=username)
return response
def parse_repo(repo):
if not repo:
return None
from allura import model as M
parts = repo.split(':')
project, app = c.project, None
nbhd = c.project.neighborhood if c.project else None
if len(parts) == 3:
nbhd = M.Neighborhood.query.get(url_prefix='/' + parts[0] + '/')
project = M.Project.query.get(
shortname=parts[1],
neighborhood_id=nbhd._id) if nbhd else None
app = project.app_instance(parts[2]) if project else None
if len(parts) == 2:
project = M.Project.query.get(
shortname=parts[0],
neighborhood_id=nbhd._id) if nbhd else None
app = project.app_instance(parts[1]) if project else None
elif len(parts) == 1:
app = project.app_instance(parts[0]) if project else None
return app
def include_file(repo, path=None, rev=None, **kw):
app = parse_repo(repo)
if not app:
return '[[include repo %s (not found)]]' % repo
if not h.has_access(app.repo, 'read')():
return "[[include: you don't have a read permission for repo %s]]" % repo
rev = app.repo.head if rev is None else rev
try:
file = app.repo.commit(rev).get_path(path)
except Exception:
return "[[include can't find file %s in revision %s]]" % (path, rev)
text = ''
if file.has_pypeline_view:
text = h.render_any_markup(file.name, file.text, code_mode=True)
elif file.has_html_view:
text = g.highlight(file.text, filename=file.name)
else:
return "[[include can't display file %s in revision %s]]" % (path, rev)
from allura.lib.widgets.macros import Include
sb = Include()
g.resource_manager.register(sb)
return sb.display(text=text, attrs=kw)
@macro()
def include(ref=None, repo=None, **kw):
from allura import model as M
from allura.lib.widgets.macros import Include
if repo is not None:
return include_file(repo, **kw)
if ref is None:
return '[-include-]'
link = M.Shortlink.lookup(ref)
if not link:
return '[[include %s (not found)]]' % ref
artifact = link.ref.artifact
if artifact is None:
return '[[include (artifact not found)]]' % ref
if not h.has_access(artifact, 'read')():
return "[[include: you don't have a read permission for %s]]" % ref
included = request.environ.setdefault('allura.macro.included', set())
if artifact in included:
return '[[include %s (already included)]' % ref
else:
included.add(artifact)
sb = Include()
g.resource_manager.register(sb)
response = sb.display(artifact=artifact, attrs=kw)
return response
@macro()
def img(src=None, **kw):
attrs = ('%s="%s"' % t for t in kw.iteritems())
included = request.environ.setdefault('allura.macro.att_embedded', set())
included.add(src)
if '://' in src:
return '<img src="%s" %s/>' % (src, ' '.join(attrs))
else:
return '<img src="./attachment/%s" %s/>' % (src, ' '.join(attrs))
@macro()
def project_admins():
admins = c.project.users_with_role('Admin')
from allura.lib.widgets.macros import ProjectAdmins
output = ((dict(
url=user.url(),
name=user.display_name))
for user in admins)
users = ProjectAdmins(users=output)
g.resource_manager.register(users)
response = users.display(users=output)
return response
@macro()
def members(limit=20):
from allura.lib.widgets.macros import Members
limit = asint(limit)
admins = set(c.project.users_with_role('Admin'))
members = sorted(c.project.users(), key=attrgetter('display_name'))
output = [dict(
url=user.url(),
name=user.display_name,
admin=' (admin)' if user in admins else '',
)
for user in members[:limit]]
over_limit = len(members) > limit
users = Members(users=output, over_limit=over_limit)
g.resource_manager.register(users)
response = users.display(users=output, over_limit=over_limit)
return response
@macro()
def embed(url=None):
consumer = oembed.OEmbedConsumer()
endpoint = oembed.OEmbedEndpoint(
'http://www.youtube.com/oembed', ['http://*.youtube.com/*', 'https://*.youtube.com/*'])
consumer.addEndpoint(endpoint)
try:
html = consumer.embed(url)['html']
except oembed.OEmbedNoEndpoint:
html = None
if html:
# youtube has a trailing ")" at the moment
html = html.rstrip(')')
# convert iframe src from http to https, to avoid mixed security blocking when used on an https page
html = BeautifulSoup(html)
embed_url = html.find('iframe').get('src')
if embed_url:
embed_url = urlparse(embed_url)
if embed_url.scheme == 'http':
embed_url = urlunparse(['https'] + list(embed_url[1:]))
else:
embed_url = embed_url.geturl()
html.find('iframe')['src'] = embed_url
return jinja2.Markup('<p>%s</p>' % html)
return '[[embed url=%s]]' % url
| {
"content_hash": "01626e35016df3dc27659345c9ac2633",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 113,
"avg_line_length": 36.11159737417943,
"alnum_prop": 0.5922559534630067,
"repo_name": "heiths/allura",
"id": "c65c504c0488bfb1d3c2e631468aa2cee9ccc7d5",
"size": "17373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Allura/allura/lib/macro.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6142"
},
{
"name": "CSS",
"bytes": "173671"
},
{
"name": "HTML",
"bytes": "751039"
},
{
"name": "JavaScript",
"bytes": "1136845"
},
{
"name": "Makefile",
"bytes": "7788"
},
{
"name": "Puppet",
"bytes": "6872"
},
{
"name": "Python",
"bytes": "4238265"
},
{
"name": "RAML",
"bytes": "26153"
},
{
"name": "Ruby",
"bytes": "7006"
},
{
"name": "Shell",
"bytes": "131827"
},
{
"name": "XSLT",
"bytes": "3357"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iflyapi.blog.dao.UserMapper">
<resultMap id="BaseResultMap" type="cn.iflyapi.blog.entity.User">
<id column="user_id" jdbcType="BIGINT" property="userId" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="nick_name" jdbcType="VARCHAR" property="nickName" />
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="sex" jdbcType="TINYINT" property="sex" />
<result column="sign" jdbcType="VARCHAR" property="sign" />
<result column="company" jdbcType="VARCHAR" property="company" />
<result column="country" jdbcType="VARCHAR" property="country" />
<result column="area" jdbcType="VARCHAR" property="area" />
<result column="province" jdbcType="VARCHAR" property="province" />
<result column="city" jdbcType="VARCHAR" property="city" />
<result column="platform" jdbcType="TINYINT" property="platform" />
<result column="fame_value" jdbcType="INTEGER" property="fameValue" />
<result column="view_num" jdbcType="INTEGER" property="viewNum" />
<result column="support_word" jdbcType="VARCHAR" property="supportWord" />
<result column="support_qrcode" jdbcType="VARCHAR" property="supportQrcode" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_disable" jdbcType="BIT" property="isDisable" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
user_id, username, password, nick_name, avatar, phone, email, sex, sign, company,
country, area, province, city, platform, fame_value, view_num, support_word, support_qrcode,
create_time, update_time, is_disable, is_delete
</sql>
<select id="selectByExample" parameterType="cn.iflyapi.blog.entity.UserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ucenter_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ucenter_user
where user_id = #{userId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ucenter_user
where user_id = #{userId,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="cn.iflyapi.blog.entity.UserExample">
delete from ucenter_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="cn.iflyapi.blog.entity.User">
insert into ucenter_user (user_id, username, password,
nick_name, avatar, phone,
email, sex, sign, company,
country, area, province,
city, platform, fame_value,
view_num, support_word, support_qrcode,
create_time, update_time, is_disable,
is_delete)
values (#{userId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{nickName,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR}, #{sex,jdbcType=TINYINT}, #{sign,jdbcType=VARCHAR}, #{company,jdbcType=VARCHAR},
#{country,jdbcType=VARCHAR}, #{area,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR},
#{city,jdbcType=VARCHAR}, #{platform,jdbcType=TINYINT}, #{fameValue,jdbcType=INTEGER},
#{viewNum,jdbcType=INTEGER}, #{supportWord,jdbcType=VARCHAR}, #{supportQrcode,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDisable,jdbcType=BIT},
#{isDelete,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="cn.iflyapi.blog.entity.User">
insert into ucenter_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="username != null">
username,
</if>
<if test="password != null">
password,
</if>
<if test="nickName != null">
nick_name,
</if>
<if test="avatar != null">
avatar,
</if>
<if test="phone != null">
phone,
</if>
<if test="email != null">
email,
</if>
<if test="sex != null">
sex,
</if>
<if test="sign != null">
sign,
</if>
<if test="company != null">
company,
</if>
<if test="country != null">
country,
</if>
<if test="area != null">
area,
</if>
<if test="province != null">
province,
</if>
<if test="city != null">
city,
</if>
<if test="platform != null">
platform,
</if>
<if test="fameValue != null">
fame_value,
</if>
<if test="viewNum != null">
view_num,
</if>
<if test="supportWord != null">
support_word,
</if>
<if test="supportQrcode != null">
support_qrcode,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isDisable != null">
is_disable,
</if>
<if test="isDelete != null">
is_delete,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="nickName != null">
#{nickName,jdbcType=VARCHAR},
</if>
<if test="avatar != null">
#{avatar,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="sex != null">
#{sex,jdbcType=TINYINT},
</if>
<if test="sign != null">
#{sign,jdbcType=VARCHAR},
</if>
<if test="company != null">
#{company,jdbcType=VARCHAR},
</if>
<if test="country != null">
#{country,jdbcType=VARCHAR},
</if>
<if test="area != null">
#{area,jdbcType=VARCHAR},
</if>
<if test="province != null">
#{province,jdbcType=VARCHAR},
</if>
<if test="city != null">
#{city,jdbcType=VARCHAR},
</if>
<if test="platform != null">
#{platform,jdbcType=TINYINT},
</if>
<if test="fameValue != null">
#{fameValue,jdbcType=INTEGER},
</if>
<if test="viewNum != null">
#{viewNum,jdbcType=INTEGER},
</if>
<if test="supportWord != null">
#{supportWord,jdbcType=VARCHAR},
</if>
<if test="supportQrcode != null">
#{supportQrcode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDisable != null">
#{isDisable,jdbcType=BIT},
</if>
<if test="isDelete != null">
#{isDelete,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="cn.iflyapi.blog.entity.UserExample" resultType="java.lang.Long">
select count(*) from ucenter_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ucenter_user
<set>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.password != null">
password = #{record.password,jdbcType=VARCHAR},
</if>
<if test="record.nickName != null">
nick_name = #{record.nickName,jdbcType=VARCHAR},
</if>
<if test="record.avatar != null">
avatar = #{record.avatar,jdbcType=VARCHAR},
</if>
<if test="record.phone != null">
phone = #{record.phone,jdbcType=VARCHAR},
</if>
<if test="record.email != null">
email = #{record.email,jdbcType=VARCHAR},
</if>
<if test="record.sex != null">
sex = #{record.sex,jdbcType=TINYINT},
</if>
<if test="record.sign != null">
sign = #{record.sign,jdbcType=VARCHAR},
</if>
<if test="record.company != null">
company = #{record.company,jdbcType=VARCHAR},
</if>
<if test="record.country != null">
country = #{record.country,jdbcType=VARCHAR},
</if>
<if test="record.area != null">
area = #{record.area,jdbcType=VARCHAR},
</if>
<if test="record.province != null">
province = #{record.province,jdbcType=VARCHAR},
</if>
<if test="record.city != null">
city = #{record.city,jdbcType=VARCHAR},
</if>
<if test="record.platform != null">
platform = #{record.platform,jdbcType=TINYINT},
</if>
<if test="record.fameValue != null">
fame_value = #{record.fameValue,jdbcType=INTEGER},
</if>
<if test="record.viewNum != null">
view_num = #{record.viewNum,jdbcType=INTEGER},
</if>
<if test="record.supportWord != null">
support_word = #{record.supportWord,jdbcType=VARCHAR},
</if>
<if test="record.supportQrcode != null">
support_qrcode = #{record.supportQrcode,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.isDisable != null">
is_disable = #{record.isDisable,jdbcType=BIT},
</if>
<if test="record.isDelete != null">
is_delete = #{record.isDelete,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ucenter_user
set user_id = #{record.userId,jdbcType=BIGINT},
username = #{record.username,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
nick_name = #{record.nickName,jdbcType=VARCHAR},
avatar = #{record.avatar,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR},
email = #{record.email,jdbcType=VARCHAR},
sex = #{record.sex,jdbcType=TINYINT},
sign = #{record.sign,jdbcType=VARCHAR},
company = #{record.company,jdbcType=VARCHAR},
country = #{record.country,jdbcType=VARCHAR},
area = #{record.area,jdbcType=VARCHAR},
province = #{record.province,jdbcType=VARCHAR},
city = #{record.city,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=TINYINT},
fame_value = #{record.fameValue,jdbcType=INTEGER},
view_num = #{record.viewNum,jdbcType=INTEGER},
support_word = #{record.supportWord,jdbcType=VARCHAR},
support_qrcode = #{record.supportQrcode,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_disable = #{record.isDisable,jdbcType=BIT},
is_delete = #{record.isDelete,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="cn.iflyapi.blog.entity.User">
update ucenter_user
<set>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="nickName != null">
nick_name = #{nickName,jdbcType=VARCHAR},
</if>
<if test="avatar != null">
avatar = #{avatar,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="sex != null">
sex = #{sex,jdbcType=TINYINT},
</if>
<if test="sign != null">
sign = #{sign,jdbcType=VARCHAR},
</if>
<if test="company != null">
company = #{company,jdbcType=VARCHAR},
</if>
<if test="country != null">
country = #{country,jdbcType=VARCHAR},
</if>
<if test="area != null">
area = #{area,jdbcType=VARCHAR},
</if>
<if test="province != null">
province = #{province,jdbcType=VARCHAR},
</if>
<if test="city != null">
city = #{city,jdbcType=VARCHAR},
</if>
<if test="platform != null">
platform = #{platform,jdbcType=TINYINT},
</if>
<if test="fameValue != null">
fame_value = #{fameValue,jdbcType=INTEGER},
</if>
<if test="viewNum != null">
view_num = #{viewNum,jdbcType=INTEGER},
</if>
<if test="supportWord != null">
support_word = #{supportWord,jdbcType=VARCHAR},
</if>
<if test="supportQrcode != null">
support_qrcode = #{supportQrcode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDisable != null">
is_disable = #{isDisable,jdbcType=BIT},
</if>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=BIT},
</if>
</set>
where user_id = #{userId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.iflyapi.blog.entity.User">
update ucenter_user
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
nick_name = #{nickName,jdbcType=VARCHAR},
avatar = #{avatar,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
sex = #{sex,jdbcType=TINYINT},
sign = #{sign,jdbcType=VARCHAR},
company = #{company,jdbcType=VARCHAR},
country = #{country,jdbcType=VARCHAR},
area = #{area,jdbcType=VARCHAR},
province = #{province,jdbcType=VARCHAR},
city = #{city,jdbcType=VARCHAR},
platform = #{platform,jdbcType=TINYINT},
fame_value = #{fameValue,jdbcType=INTEGER},
view_num = #{viewNum,jdbcType=INTEGER},
support_word = #{supportWord,jdbcType=VARCHAR},
support_qrcode = #{supportQrcode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_disable = #{isDisable,jdbcType=BIT},
is_delete = #{isDelete,jdbcType=BIT}
where user_id = #{userId,jdbcType=BIGINT}
</update>
</mapper> | {
"content_hash": "459da52e8a922fad862d414ad82d57ab",
"timestamp": "",
"source": "github",
"line_count": 495,
"max_line_length": 113,
"avg_line_length": 36.484848484848484,
"alnum_prop": 0.5770764119601329,
"repo_name": "flyhero/flyapi",
"id": "0e2a1d88cd3711f3529857f32594847b51cdb4af",
"size": "18060",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/resources/mapper/UserMapper.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "427583"
}
],
"symlink_target": ""
} |
<?php namespace App\Http\Controllers\Admin\Settings;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Model\Groups;
use Illuminate\Http\Request;
use App\User;
use Bllim\Datatables\Datatables;
use Illuminate\Support\Facades\Auth;
class UserController extends Controller {
/**
* User Model
* @var User
*/
protected $user;
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return view("cms.settings.users.index");
}
public function getIndex(){
$users = User::select(['id','name','surname','email'])->live()->orderBy('id','DESC');
return Datatables::of($users)
->add_column('groups',function($user){
return implode(', ',$user->Groups()->lists('name')->all());
})
->add_column('actions',function($row){
return permshtml('settings/users/'.$row->id.'/edit','<a href="'.url('settings/users/'.$row->id.'/edit').'" class="btn btn-xs btn-default">'.trans('app.edit').'</a>') . " " . permshtml('settings/users/'.$row->id,'<a href="'.url('settings/users/'.$row->id).'" data-token="'.csrf_token().'" class="del-item btn btn-xs btn-danger">'.trans('app.delete').'</a>',"delete");
})
->removeColumn('id')
->make();
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$groups = Groups::live()->lists('name','id');
return view("cms.settings.users.create")->withGroups($groups);
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$this->validate($request,[
'name' => "required|min:2",
'surname' => "required|min:2",
'email' => "required|email|unique:users,email",
'password' => 'required|min:6',
'password_repeat' => 'required|same:password'
]);
$request->offsetSet('status',1);
$request->offsetSet('password',bcrypt($request->input('password')));
if($user = User::create($request->only(['name','surname','email','password','status']))){
$user->Groups()->attach($request->input('groups'));
return redirect('settings/users')->with('custom_success',trans('app.user').trans('app.successfully_saved'));
}else{
return redirect('settings/users/create')->withErrors(['email' => trans('app.an_error_occured')])->withInput($request->input());
}
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$user = User::where('id','=',$id)->live()->firstOrFail();
$groups = Groups::live()->lists('name','id')->all();
return view("cms.settings.users.edit")->withUser($user)->withGroups($groups);
}
public function getProfile(){
$user = User::where('id','=',Auth::user()->id)->live()->firstOrFail();
return view("cms.settings.users.profile")->withUser($user);
}
public function postProfile(Request $request)
{
$id = Auth::user()->id;
$this->validate($request,[
'name' => "required|min:2",
'surname' => "required|min:2",
'password' => '',
'password_repeat' => 'same:password'
]);
$user = User::where('id','=',$id)->live()->firstOrFail();
$user->name = $request->input('name');
$user->surname = $request->input('surname');
if(strlen($request->input('password'))>0) $user->password = bcrypt($request->input('password'));
if($user->save()) {
return back()->with('custom_success', trans('app.user').trans('app.successfully_saved'));
}else
return back()->withErrors(['name' => trans('app.an_error_occured')])->withInput($request->input());
}
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id,Request $request)
{
$this->validate($request,[
'name' => "required|min:2",
'surname' => "required|min:2",
'email' => "required|email|unique:users,email,".$id.",id",
'password' => '',
'password_repeat' => 'same:password'
]);
$user = User::where('id','=',$id)->live()->firstOrFail();
$user->name = $request->input('name');
$user->surname = $request->input('surname');
$user->email = $request->input('email');
if(strlen($request->input('password'))>0) $user->password = bcrypt($request->input('password'));
if($user->save()) {
$user->Groups()->sync((array)$request->input('groups'));
return redirect('settings/users/' . $user->id . '/edit')->with('custom_success', trans('app.user').trans('app.successfully_saved'));
}else
return redirect('settings/users/'.$user->id.'/edit')->withErrors([trans('app.an_error_occured')])->withInput($request->input());
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id, Request $request)
{
if($request->ajax()){
$user = User::where('id','=',$id)->live()->firstOrFail();
$user->status = -1;
$user->save();
echo "ok";
}
}
}
| {
"content_hash": "0a345183a2568ba89b6c9e724aba0dcc",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 380,
"avg_line_length": 32.31547619047619,
"alnum_prop": 0.560508380917296,
"repo_name": "faozimipa/basecms-laravel",
"id": "729405ec67c83c2fb2dc0befce469f864764f707",
"size": "5429",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/Http/Controllers/Admin/Settings/UserController.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "392"
},
{
"name": "CSS",
"bytes": "54583"
},
{
"name": "HTML",
"bytes": "147532"
},
{
"name": "JavaScript",
"bytes": "1372431"
},
{
"name": "PHP",
"bytes": "162236"
},
{
"name": "Shell",
"bytes": "1383"
}
],
"symlink_target": ""
} |
require 'test_helper'
class TestCoinList < Minitest::Test
COINLIST_TOP_LEVEL_RESPONSE_KEYS = %w[
Response
Message
BaseImageUrl
BaseLinkUrl
DefaultWatchlist
Data
Type
].freeze
COIN_DATA_KEYS = %w[
Id
Url
Name
Symbol
CoinName
FullName
Algorithm
ProofType
FullyPremined
TotalCoinSupply
PreMinedValue
TotalCoinsFreeFloat
SortOrder
Sponsored
].freeze
def test_find_all_coins
VCR.use_cassette('coin_list') do
resp = Cryptocompare::CoinList.all
COINLIST_TOP_LEVEL_RESPONSE_KEYS.each do |data_key|
assert resp.has_key?(data_key)
end
resp['Data'].each do |coin, coin_data|
COIN_DATA_KEYS.each do |data_key|
assert coin_data.has_key?(data_key)
end
end
end
end
end
| {
"content_hash": "adcc6daa541256b1208311521dc08426",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 57,
"avg_line_length": 17.97826086956522,
"alnum_prop": 0.6287787182587666,
"repo_name": "alexanderdavidpan/cryptocompare",
"id": "f0503d0b3aff70606cbc5fffb535784fc698cc97",
"size": "827",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/test_coin_list.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "73247"
},
{
"name": "Shell",
"bytes": "131"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">PracticalTest02</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="server">Server</string>
<string name="server_port">Port</string>
<string name="connect">Connect</string>
<string name="client">Client</string>
<string name="client_address">Address</string>
<string name="client_port">Port</string>
<string name="get_time">Get Time</string>
</resources>
| {
"content_hash": "39151eaa669442912b263b30f560c71d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 52,
"avg_line_length": 36,
"alnum_prop": 0.6777777777777778,
"repo_name": "MadalinaGrosu/PracticalTest02",
"id": "52f9ae6ae4bf16a5d64593e17fcb41240b4b5a1a",
"size": "540",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PracticalTest02/res/values/strings.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "12148"
}
],
"symlink_target": ""
} |
export DEST_TYPE="maprdb"
# Dealing with bad data
# Set to 1 to remove fields, starting left to right in the variable REMOVE_FIELDS to see if the json parsing works
export REMOVE_FIELDS_ON_FAIL=1
# If REMOVE_FIELDS_ON_FAIL is set to 1, and there is an error, the parser will remove the data from fields left to right, once json conversion works, it will break and move on (so not all fields may be removed)
export REMOVE_FIELDS="key1,key2"
# Turn on verbose logging. For Silence export DEBUG=0
export DEBUG=1
# Kafka or MapR Stream config
# You must provide Bootstrap servers (kafka nodes and their ports OR Zookeepers and the kafka ID of the chroot for your kafka instance
#
# If using mapr streams comment out ZOOKEEPERS, and instead provide BOOTSTRAP_BROKERS="mapr" and the specify the topic in the MapR Format: i.e. TOPIC="/path/to/maprstreams:topicname"
# You must provide Bootstrap servers (kafka nodes and their ports OR Zookeepers and the kafka ID of the chroot for your kafka instance
#export ZOOKEEPERS=""
#export KAFKA_ID=""
# OR
export BOOTSTRAP_BROKERS="mapr"
# This is the name of the consumer group your client will create/join. If you are running multiple instances this is great, name them the same and Kafka will partition the info
export GROUP_ID="some_groupid"
# When registering a consumer group, do you want to start at the first data in the queue (earliest) or the last (latest)
export OFFSET_RESET="earliest"
# The Topic to connect to
# the path to data is the HDFS path, not the mapr posix path. (i.e. not /mapr/cluster/path/to, just /path/to)
export TOPIC="/path/to/data/in/hdfs:topicname"
# This is the loop timeout, so that when this time is reached, it will cause the loop to occur (checking for older files etc)
export LOOP_TIMEOUT="5.0"
# The next three items has to do with the cacheing of records. As this come off the kafka queue, we store them in a list to keep from making smallish writes and dataframes
# These are very small/conservative, you should be able to increase, but we need to do testing at volume
export ROWMAX=2000 # Total max records cached. Regardless of size, once the number of records hits this number, the next record will cause a flush and write to parquet
export SIZEMAX=128000000 # Total size of records. This is a rough running size of records in bytes. Once the total hits this size, the next record will cause a flush and write to parquet
export TIMEMAX=10 # seconds since last write to force a write # The number of seconds since the last flush. Once this has been met, the next record from KAfka will cause a flush and write.
#### MapR DB items
# This is where you want to write the maprdb table. This the HDFS (maprfs) path, not the posix path
#export MAPRDB_TABLE_BASE="/path/to/mytable"
# Note another option is to use RANDOMROWKEYVAL to put a random number in the row key
# This is the field(s) in your json you want to use as the hbase/maprdb row key If you want to concat fields, seperate by a comma and ensure your printed delim is correct
#export MAPRDB_ROW_KEY_FIELDS='key1,key2,RANDOMROWKEYVAL'
# This is the character, if you specified your fields as CSV above, that when we concat the fields, we put between them. so if you have ip,ts as your row_key_fields, and use _ as your delim it may look like 123.123.123.123_2015-12-12 as your key
#export MAPRDB_ROW_KEY_DELIM="_"
# For the columns in your data, which fields will be in which column families.
# Format: cf1:field1,cf1:field2,cf2:field3,cf4:field4
#export MAPRDB_FAMILY_MAPPING='cf1:field1,cf1:field2,cf2:field3,cf4:field4"
# If the table does not exist, if this is set to 1, it will create it based on the column families. Otherwise it will exit (if not set to 1) - This could get ugly we don't set region size or permissions
#export MAPRDB_CREATE_TABLE=0
# If batch inserts are enabled, set to 1
#export MAPRDB_BATCH_ENABLED=1
# Print a drill view and exit
#export MAPRDB_PRINT_DRILL_VIEW=0
#### For type JSON and PARQ there are file options that are common.
# The base directory for the table (Posix only at this time, for MapR /mapr/cluster/path/to/data)
#export FILE_TABLE_BASE="/mapr/mycluster/data/mydata/mytable"
# Files of this size will cause the current file to be closed, and new one started
#export FILE_MAXSIZE="128000000"
# This is the value to use as a uniq identifier so when you have multiple writes writing to the same partition, they each get their own file. HOSTNAME in docker containers works well for this
#export FILE_UNIQ_ENV="HOSTNAME"
# The field in the src data that will be used for partitions
#export FILE_PARTITION_FIELD="day"
# If a partition has not been written to in this many seconds, close the file and move to the live data (so it can be queried)
#export FILE_PARTMAXAGE="30"
# If the partition field can not be found, use this instead
#export FILE_UNKNOWNPART="unknown"
# The diretory used for tmp files (in not write live setups, .something works because tools like drill don't query directory starting with .)
#export FILE_TMP_PART_DIR=".tmp"
# Should we write directly to the live directory? Usually not, this causes things querying the data to freak out.
#export FILE_WRITE_LIVE="0"
#### Json Specific Item
#export JSON_GZ_COMPRESS="1"
#### Parquet specific items
# Size to use for Parquet Offers
#export PARQ_OFFSETS="50000000"
# Commpression to use for Parquet Files
#export PARQ_COMPRESS="SNAPPY"
# Does the data have nulls in (Fast Parquet wants to know)
#export PARQ_HAS_NULLS="1"
# Do you want us to merge files, i.e. take a file that has lots of row groups read it all in and write it all out to reduce the row groups in the file?
#export PARQ_MERGE_FILE="1"
##################################
# The derived section allows us to create a field on the fly from a slice of a different field.
# for example, if you had a source field named ts of 2017-08-08T21:26:10.843768Z you could create a derived field of ts_day of 2017-08-08 by setting src to ts, dst to ts_day, start to 0 and end to 10
# If you want the script to fail if this conversion fails, then set req to 1
# Note, if you set DERIVED_SRC="" (or don't set it) nothing happens
#export DERIVED_SRC="" # The field to src
#export DERIVED_DST="" # The Field to place the derived value
#export DERIVED_START="0" # The position to start things on
#export DERIVED_END="0" # The End position, if you put 0 for this, it assumes the end of the string.. (essentially 0 is like doing a sliced of val[0:]
#export DERIVED_REQ="0" # if this is 1 the script will exit if things go bonkers"
# Run Py ETL!
if [ "$DEST_TYPE" == "maprdb" ]; then
# Mapr DB requires Python 2
python -u /app/code/pyetl.py
else
python3 -u /app/code/pyetl.py
fi
| {
"content_hash": "4bdb1843bfcf9ada6fab18012603930a",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 246,
"avg_line_length": 56.54621848739496,
"alnum_prop": 0.7510774260662803,
"repo_name": "JohnOmernik/pyetl",
"id": "eec77e0f418c4931b458205d68498f1bef25ba0a",
"size": "6805",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bin/mapr_conf_all.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "22127"
},
{
"name": "Shell",
"bytes": "28324"
}
],
"symlink_target": ""
} |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mcleodmoores.starling.platform</groupId>
<artifactId>platform-public</artifactId>
<version>2.1.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>quandl</artifactId>
<packaging>jar</packaging>
<name>quandl</name>
<description>Starling Platform Quandl integration</description>
<scm>
<url>https://github.com/McLeodMoores/starling/tree/master/projects/quandl</url>
</scm>
<dependencies>
<dependency>
<groupId>com.jimmoores</groupId>
<artifactId>quandl-jersey1</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>com.mcleodmoores.starling.platform</groupId>
<artifactId>integration-bloomberg</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<properties>
<tests.testng.excludedgroups>integration, unitdb, unitslow</tests.testng.excludedgroups>
<fudge.proto.equals>false</fudge.proto.equals>
<fudge.proto.hashCode>false</fudge.proto.hashCode>
</properties>
</project>
| {
"content_hash": "e63e19457339c0feb91570d27bc29ccb",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 104,
"avg_line_length": 34.05128205128205,
"alnum_prop": 0.7048192771084337,
"repo_name": "McLeodMoores/starling",
"id": "2193a02dfbeaf07f9fcee85dbd04e15c4a6e2907",
"size": "1328",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "projects/quandl/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2505"
},
{
"name": "CSS",
"bytes": "213501"
},
{
"name": "FreeMarker",
"bytes": "310184"
},
{
"name": "GAP",
"bytes": "1490"
},
{
"name": "Groovy",
"bytes": "11518"
},
{
"name": "HTML",
"bytes": "318295"
},
{
"name": "Java",
"bytes": "79541905"
},
{
"name": "JavaScript",
"bytes": "1511230"
},
{
"name": "PLSQL",
"bytes": "398"
},
{
"name": "PLpgSQL",
"bytes": "26901"
},
{
"name": "Shell",
"bytes": "11481"
},
{
"name": "TSQL",
"bytes": "604117"
}
],
"symlink_target": ""
} |
module DSLMacros
module InstanceMethods
def capture_stdout
@@original_stdout = STDOUT
$stdout = StringIO.new
end
def restore_stdout
$stdout = @@original_stdout
end
end
module ClassMethods
def it_should_return_true(msg, &block)
it "returns true #{msg}" do
capture_stdout
begin
FailFast(SIMPLE_FILE_PATH).check.but_fail_later do
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
result = self.instance_eval(&block)
#TODO : BETTER ERROR REPORTING
result.should == true
end
rescue => e
raise e
end
restore_stdout
end
end
def it_should_return_false(msg, &block)
it "returns false #{msg}" do
capture_stdout
begin
FailFast(SIMPLE_FILE_PATH).check.but_fail_later do
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
result = self.instance_eval(&block)
#TODO : BETTER ERROR REPORTING
result.should == false
end
rescue => e
raise e
end
restore_stdout
end
end
def it_should_not_raise_an_error(msg, &block)
it "does not raise an error #{msg}" do
capture_stdout
begin
FailFast(SIMPLE_FILE_PATH).check do
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
self.instance_eval(&block)
end
rescue => e
raise e
ensure
if FailFast.failed?
fail "ZZshould not have raised an error, but it raised\n#{FailFast.global_errors.join("\n")}"
end
end
restore_stdout
end
end
def it_should_raise_an_error(key, kind, msg, &block)
it "raises an error #{kind}-#{key}-#{msg}" do
capture_stdout
begin
FailFast(SIMPLE_FILE_PATH).check do
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
self.instance_eval(&block)
end
rescue => e
# uncomment the next line after the refactoring/once error are no longer raise
# raise e
ensure
if !FailFast.failed?
fail "\ne2d\nshould have raised a #{kind} error for #{key} \n==#{e}"
elsif FailFast.global_errors.length == 1 && !FailFast.global_errors.first.has_key_and_kind?(key, kind)
fail "\ne2e\nshould have raised a #{kind.inspect} error for #{key.inspect}, but raised instead #{FailFast.global_errors.inspect}"
elsif 2 <= FailFast.global_errors.length
fail "\ne2f\nshould have raised only a #{kind} error for #{key}\n#{FailFast.global_errors.join("\n")}"
end
end
restore_stdout
end
end
def it_should_raise_a_direct_error(value, kind, msg, &block)
it "raises an error #{kind}-#{value}-#{msg}" do
capture_stdout
begin
FailFast(SIMPLE_FILE_PATH).check do
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
self.instance_eval(&block)
end
rescue => e
# uncomment the next line after the refactoring/once error are no longer raise
# raise e
ensure
if !FailFast.failed?
fail "\ne2d\nshould have raised a #{kind} error for #{value} \n==#{e}"
elsif FailFast.global_errors.length == 1 && !FailFast.global_errors.first.has_value_and_kind?(value, kind)
fail "\ne2e\nshould have raised a #{kind.inspect} error for #{value.inspect}\n, but raised instead\n#{FailFast.global_errors.inspect}"
elsif 2 <= FailFast.global_errors.length
fail "\ne2f\nshould have raised only 1 #{kind} error for #{value}\nbut raised instead\n#{FailFast.global_errors.join("\n")}"
end
end
restore_stdout
end
end
end
def self.included(receiver)
receiver.extend(ClassMethods)
receiver.send :include, InstanceMethods
end
end
Spec::Runner.configure do |config|
config.include(DSLMacros)
end | {
"content_hash": "9e1ea79cf777261b8c9716825dfb3c83",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 146,
"avg_line_length": 33.72,
"alnum_prop": 0.5862396204033214,
"repo_name": "alainravet/fail_fast",
"id": "ac72b4c01128e631fff54424441935bc176dca4c",
"size": "4216",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/_/support/it_extensions.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "86284"
}
],
"symlink_target": ""
} |
"""
test_romannumeral
----------------------------------
Tests for `romannumeral` module.
"""
import unittest
from romannumeral import RomanNumeral
from romannumeral import ParseError
from romannumeral import OutOfRangeError
class TestRomannumeral(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_create_roman_from_int(self):
r = RomanNumeral(10)
self.assertEqual(r.value, 10)
self.assertEqual(r.string, 'X')
def test_create_roman_from_str(self):
r = RomanNumeral('X')
self.assertEqual(r.value, 10)
self.assertEqual(r.string, 'X')
def test_create_roman_exhaustive(self):
for n in range(10000):
if n == 0 or n >= 4000:
self.assertRaises(OutOfRangeError, RomanNumeral, n)
else:
r = RomanNumeral(n)
self.assertEqual(r.value, n)
def test_roman_from_badstring(self):
""" Roman from malformed string should through parse exception """
# no random sstring to roman
self.assertRaises(ParseError, RomanNumeral, 'dfadsfafaf')
# no string representation of number
self.assertRaises(ParseError, RomanNumeral, '101')
# no lower case
self.assertRaises(ParseError, RomanNumeral, 'xviii')
# no spaces
self.assertRaises(ParseError, RomanNumeral, 'X V I I I')
def test_roman_from_decimal(self):
""" Roman from malformed string should through parse exception """
self.assertRaises(ParseError, RomanNumeral, 3.14)
def test_roman_from_negative(self):
""" Roman below 0 throw an overflow exception """
self.assertRaises(OutOfRangeError, RomanNumeral, -1)
def test_roman_from_over_3999(self):
""" Roman over 3999 throw an overflow exception """
self.assertRaises(OutOfRangeError, RomanNumeral, 9001)
def test_roman_addition(self):
x = 2000
for y in range(1, 4000):
if 0 < x + y < 4000:
roman_math = RomanNumeral(x) + RomanNumeral(y)
self.assertEqual(roman_math, RomanNumeral(x + y))
else:
self.assertRaises(OutOfRangeError, RomanNumeral, x + y)
def test_roman_subtraction(self):
x = 2000
for y in range(1, 4000):
if 0 < x - y < 4000:
roman_math = RomanNumeral(x) - RomanNumeral(y)
self.assertEqual(roman_math, RomanNumeral(x - y))
else:
self.assertRaises(OutOfRangeError, RomanNumeral, x - y)
def test_roman_multiplication(self):
x = 10
for y in range(1, 4000):
if 0 < x * y < 4000:
roman_math = RomanNumeral(x) * RomanNumeral(y)
self.assertEqual(roman_math, RomanNumeral(x * y))
else:
self.assertRaises(OutOfRangeError, RomanNumeral, x * y)
def test_roman_division(self):
x = 3999
for y in range(1, 4000):
if 0 < x / y < 4000:
roman_math = RomanNumeral(x) / RomanNumeral(y)
self.assertEqual(roman_math, RomanNumeral(x // y))
else:
self.assertRaises(OutOfRangeError, RomanNumeral, x // y)
def test_roman_exponent(self):
x = 2
for y in range(1, 60):
if 0 < x ** y < 4000:
roman_math = RomanNumeral(x) ** RomanNumeral(y)
self.assertEqual(roman_math, RomanNumeral(x ** y))
else:
self.assertRaises(OutOfRangeError, RomanNumeral, x ** y)
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "af2a6e9b24572b2cf2840a8da3eb3a97",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 74,
"avg_line_length": 28.765625,
"alnum_prop": 0.5760456273764258,
"repo_name": "jay3686/romannumeral",
"id": "c76802f2f79ee70c0d3a1d61fe181dd2b9dd40bb",
"size": "3729",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_romannumeral.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "17365"
},
{
"name": "Shell",
"bytes": "6466"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>Shadow Animation</title><link rel="stylesheet" href="small_farm_shadows_Aug15.css">
<script src="small_farm_shadows_Aug15.js"></script></head>
<body>
<div class="img-comp-container" onmouseover="showZoomText()" onmouseout="hideZoomText()">
<div>
<div class="img-comp-img">
<img class="shadowImage" src="small_farm_shadows_Aug15.gif" width="814" height="600">
</div>
<div id="timeLabel" class="label1-text">15/08/2021</div>
<div class="wbt-text">Powered by WhiteboxTools</div>
<div id="scrollText" class="scroll-text">Scroll to zoom</div>
</div>
<script>
showLabel();
wheelzoom(document.querySelector('img.shadowImage'));
</script>
</body> | {
"content_hash": "3922b582fdb96958e5f5f0f1bbf2cf56",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 121,
"avg_line_length": 45.857142857142854,
"alnum_prop": 0.6344755970924195,
"repo_name": "jblindsay/jblindsay.github.io",
"id": "549c1197725fb783c97b4819b0331cedefe33235",
"size": "963",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ghrg/WhiteboxTools/samples/shadows/small_farm_shadows_Aug15.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "52"
},
{
"name": "CSS",
"bytes": "1086446"
},
{
"name": "Groovy",
"bytes": "2186907"
},
{
"name": "HTML",
"bytes": "11454480"
},
{
"name": "Java",
"bytes": "5373007"
},
{
"name": "JavaScript",
"bytes": "1745824"
},
{
"name": "Python",
"bytes": "82583"
},
{
"name": "SCSS",
"bytes": "173472"
},
{
"name": "TeX",
"bytes": "15589"
}
],
"symlink_target": ""
} |
package org.h2.store.fs;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.channels.NonWritableChannelException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.h2.api.ErrorCode;
import org.h2.compress.CompressLZF;
import org.h2.message.DbException;
import org.h2.util.MathUtils;
import org.h2.util.New;
/**
* This file system keeps files fully in memory. There is an option to compress
* file blocks to save memory.
*/
public class FilePathMem extends FilePath {
private static final TreeMap<String, FileMemData> MEMORY_FILES =
new TreeMap<String, FileMemData>();
private static final FileMemData DIRECTORY = new FileMemData("", false);
@Override
public FilePathMem getPath(String path) {
FilePathMem p = new FilePathMem();
p.name = getCanonicalPath(path);
return p;
}
@Override
public long size() {
return getMemoryFile().length();
}
@Override
public void moveTo(FilePath newName, boolean atomicReplace) {
synchronized (MEMORY_FILES) {
if (!atomicReplace && !newName.name.equals(name) &&
MEMORY_FILES.containsKey(newName.name)) {
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2,
new String[] { name, newName + " (exists)" });
}
FileMemData f = getMemoryFile();
f.setName(newName.name);
MEMORY_FILES.remove(name);
MEMORY_FILES.put(newName.name, f);
}
}
@Override
public boolean createFile() {
synchronized (MEMORY_FILES) {
if (exists()) {
return false;
}
getMemoryFile();
}
return true;
}
@Override
public boolean exists() {
if (isRoot()) {
return true;
}
synchronized (MEMORY_FILES) {
return MEMORY_FILES.get(name) != null;
}
}
@Override
public void delete() {
if (isRoot()) {
return;
}
synchronized (MEMORY_FILES) {
MEMORY_FILES.remove(name);
}
}
@Override
public List<FilePath> newDirectoryStream() {
ArrayList<FilePath> list = New.arrayList();
synchronized (MEMORY_FILES) {
for (String n : MEMORY_FILES.tailMap(name).keySet()) {
if (n.startsWith(name)) {
if (!n.equals(name) && n.indexOf('/', name.length() + 1) < 0) {
list.add(getPath(n));
}
} else {
break;
}
}
return list;
}
}
@Override
public boolean setReadOnly() {
return getMemoryFile().setReadOnly();
}
@Override
public boolean canWrite() {
return getMemoryFile().canWrite();
}
@Override
public FilePathMem getParent() {
int idx = name.lastIndexOf('/');
return idx < 0 ? null : getPath(name.substring(0, idx));
}
@Override
public boolean isDirectory() {
if (isRoot()) {
return true;
}
synchronized (MEMORY_FILES) {
FileMemData d = MEMORY_FILES.get(name);
return d == DIRECTORY;
}
}
@Override
public boolean isAbsolute() {
// TODO relative files are not supported
return true;
}
@Override
public FilePathMem toRealPath() {
return this;
}
@Override
public long lastModified() {
return getMemoryFile().getLastModified();
}
@Override
public void createDirectory() {
if (exists()) {
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1,
name + " (a file with this name already exists)");
}
synchronized (MEMORY_FILES) {
MEMORY_FILES.put(name, DIRECTORY);
}
}
@Override
public OutputStream newOutputStream(boolean append) throws IOException {
FileMemData obj = getMemoryFile();
FileMem m = new FileMem(obj, false);
return new FileChannelOutputStream(m, append);
}
@Override
public InputStream newInputStream() {
FileMemData obj = getMemoryFile();
FileMem m = new FileMem(obj, true);
return new FileChannelInputStream(m, true);
}
@Override
public FileChannel open(String mode) {
FileMemData obj = getMemoryFile();
return new FileMem(obj, "r".equals(mode));
}
private FileMemData getMemoryFile() {
synchronized (MEMORY_FILES) {
FileMemData m = MEMORY_FILES.get(name);
if (m == DIRECTORY) {
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1,
name + " (a directory with this name already exists)");
}
if (m == null) {
m = new FileMemData(name, compressed());
MEMORY_FILES.put(name, m);
}
return m;
}
}
private boolean isRoot() {
return name.equals(getScheme() + ":");
}
private static String getCanonicalPath(String fileName) {
fileName = fileName.replace('\\', '/');
int idx = fileName.indexOf(':') + 1;
if (fileName.length() > idx && fileName.charAt(idx) != '/') {
fileName = fileName.substring(0, idx) + "/" + fileName.substring(idx);
}
return fileName;
}
@Override
public String getScheme() {
return "memFS";
}
/**
* Whether the file should be compressed.
*
* @return if it should be compressed.
*/
boolean compressed() {
return false;
}
}
/**
* A memory file system that compresses blocks to conserve memory.
*/
class FilePathMemLZF extends FilePathMem {
@Override
boolean compressed() {
return true;
}
@Override
public String getScheme() {
return "memLZF";
}
}
/**
* This class represents an in-memory file.
*/
class FileMem extends FileBase {
/**
* The file data.
*/
final FileMemData data;
private final boolean readOnly;
private long pos;
FileMem(FileMemData data, boolean readOnly) {
this.data = data;
this.readOnly = readOnly;
}
@Override
public long size() {
return data.length();
}
@Override
public FileChannel truncate(long newLength) throws IOException {
// compatibility with JDK FileChannel#truncate
if (readOnly) {
throw new NonWritableChannelException();
}
if (newLength < size()) {
data.touch(readOnly);
pos = Math.min(pos, newLength);
data.truncate(newLength);
}
return this;
}
@Override
public FileChannel position(long newPos) {
this.pos = (int) newPos;
return this;
}
@Override
public int write(ByteBuffer src) throws IOException {
int len = src.remaining();
if (len == 0) {
return 0;
}
data.touch(readOnly);
pos = data.readWrite(pos, src.array(),
src.arrayOffset() + src.position(), len, true);
src.position(src.position() + len);
return len;
}
@Override
public int read(ByteBuffer dst) throws IOException {
int len = dst.remaining();
if (len == 0) {
return 0;
}
long newPos = data.readWrite(pos, dst.array(),
dst.arrayOffset() + dst.position(), len, false);
len = (int) (newPos - pos);
if (len <= 0) {
return -1;
}
dst.position(dst.position() + len);
pos = newPos;
return len;
}
@Override
public long position() {
return pos;
}
@Override
public void implCloseChannel() throws IOException {
pos = 0;
}
@Override
public void force(boolean metaData) throws IOException {
// do nothing
}
@Override
public synchronized FileLock tryLock(long position, long size,
boolean shared) throws IOException {
if (shared) {
if (!data.lockShared()) {
return null;
}
} else {
if (!data.lockExclusive()) {
return null;
}
}
// cast to FileChannel to avoid JDK 1.7 ambiguity
FileLock lock = new FileLock((FileChannel) null, position, size, shared) {
@Override
public boolean isValid() {
return true;
}
@Override
public void release() throws IOException {
data.unlock();
}
};
return lock;
}
@Override
public String toString() {
return data.getName();
}
}
/**
* This class contains the data of an in-memory random access file.
* Data compression using the LZF algorithm is supported as well.
*/
class FileMemData {
private static final int CACHE_SIZE = 8;
private static final int BLOCK_SIZE_SHIFT = 10;
private static final int BLOCK_SIZE = 1 << BLOCK_SIZE_SHIFT;
private static final int BLOCK_SIZE_MASK = BLOCK_SIZE - 1;
private static final CompressLZF LZF = new CompressLZF();
private static final byte[] BUFFER = new byte[BLOCK_SIZE * 2];
private static final byte[] COMPRESSED_EMPTY_BLOCK;
private static final Cache<CompressItem, CompressItem> COMPRESS_LATER =
new Cache<CompressItem, CompressItem>(CACHE_SIZE);
private String name;
private final boolean compress;
private long length;
private byte[][] data;
private long lastModified;
private boolean isReadOnly;
private boolean isLockedExclusive;
private int sharedLockCount;
static {
byte[] n = new byte[BLOCK_SIZE];
int len = LZF.compress(n, BLOCK_SIZE, BUFFER, 0);
COMPRESSED_EMPTY_BLOCK = new byte[len];
System.arraycopy(BUFFER, 0, COMPRESSED_EMPTY_BLOCK, 0, len);
}
FileMemData(String name, boolean compress) {
this.name = name;
this.compress = compress;
data = new byte[0][];
lastModified = System.currentTimeMillis();
}
/**
* Lock the file in exclusive mode if possible.
*
* @return if locking was successful
*/
synchronized boolean lockExclusive() {
if (sharedLockCount > 0 || isLockedExclusive) {
return false;
}
isLockedExclusive = true;
return true;
}
/**
* Lock the file in shared mode if possible.
*
* @return if locking was successful
*/
synchronized boolean lockShared() {
if (isLockedExclusive) {
return false;
}
sharedLockCount++;
return true;
}
/**
* Unlock the file.
*/
synchronized void unlock() {
if (isLockedExclusive) {
isLockedExclusive = false;
} else {
sharedLockCount = Math.max(0, sharedLockCount - 1);
}
}
/**
* This small cache compresses the data if an element leaves the cache.
*/
static class Cache<K, V> extends LinkedHashMap<K, V> {
private static final long serialVersionUID = 1L;
private final int size;
Cache(int size) {
super(size, (float) 0.75, true);
this.size = size;
}
@Override
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
if (size() < size) {
return false;
}
CompressItem c = (CompressItem) eldest.getKey();
compress(c.data, c.page);
return true;
}
}
/**
* Represents a compressed item.
*/
static class CompressItem {
/**
* The file data.
*/
byte[][] data;
/**
* The page to compress.
*/
int page;
@Override
public int hashCode() {
return page;
}
@Override
public boolean equals(Object o) {
if (o instanceof CompressItem) {
CompressItem c = (CompressItem) o;
return c.data == data && c.page == page;
}
return false;
}
}
private static void compressLater(byte[][] data, int page) {
CompressItem c = new CompressItem();
c.data = data;
c.page = page;
synchronized (LZF) {
COMPRESS_LATER.put(c, c);
}
}
private static void expand(byte[][] data, int page) {
byte[] d = data[page];
if (d.length == BLOCK_SIZE) {
return;
}
byte[] out = new byte[BLOCK_SIZE];
if (d != COMPRESSED_EMPTY_BLOCK) {
synchronized (LZF) {
LZF.expand(d, 0, d.length, out, 0, BLOCK_SIZE);
}
}
data[page] = out;
}
/**
* Compress the data in a byte array.
*
* @param data the page array
* @param page which page to compress
*/
static void compress(byte[][] data, int page) {
byte[] d = data[page];
synchronized (LZF) {
int len = LZF.compress(d, BLOCK_SIZE, BUFFER, 0);
if (len <= BLOCK_SIZE) {
d = new byte[len];
System.arraycopy(BUFFER, 0, d, 0, len);
data[page] = d;
}
}
}
/**
* Update the last modified time.
*
* @param openReadOnly if the file was opened in read-only mode
*/
void touch(boolean openReadOnly) throws IOException {
if (isReadOnly || openReadOnly) {
throw new IOException("Read only");
}
lastModified = System.currentTimeMillis();
}
/**
* Get the file length.
*
* @return the length
*/
long length() {
return length;
}
/**
* Truncate the file.
*
* @param newLength the new length
*/
void truncate(long newLength) {
changeLength(newLength);
long end = MathUtils.roundUpLong(newLength, BLOCK_SIZE);
if (end != newLength) {
int lastPage = (int) (newLength >>> BLOCK_SIZE_SHIFT);
expand(data, lastPage);
byte[] d = data[lastPage];
for (int i = (int) (newLength & BLOCK_SIZE_MASK); i < BLOCK_SIZE; i++) {
d[i] = 0;
}
if (compress) {
compressLater(data, lastPage);
}
}
}
private void changeLength(long len) {
length = len;
len = MathUtils.roundUpLong(len, BLOCK_SIZE);
int blocks = (int) (len >>> BLOCK_SIZE_SHIFT);
if (blocks != data.length) {
byte[][] n = new byte[blocks][];
System.arraycopy(data, 0, n, 0, Math.min(data.length, n.length));
for (int i = data.length; i < blocks; i++) {
n[i] = COMPRESSED_EMPTY_BLOCK;
}
data = n;
}
}
/**
* Read or write.
*
* @param pos the position
* @param b the byte array
* @param off the offset within the byte array
* @param len the number of bytes
* @param write true for writing
* @return the new position
*/
long readWrite(long pos, byte[] b, int off, int len, boolean write) {
long end = pos + len;
if (end > length) {
if (write) {
changeLength(end);
} else {
len = (int) (length - pos);
}
}
while (len > 0) {
int l = (int) Math.min(len, BLOCK_SIZE - (pos & BLOCK_SIZE_MASK));
int page = (int) (pos >>> BLOCK_SIZE_SHIFT);
expand(data, page);
byte[] block = data[page];
int blockOffset = (int) (pos & BLOCK_SIZE_MASK);
if (write) {
System.arraycopy(b, off, block, blockOffset, l);
} else {
System.arraycopy(block, blockOffset, b, off, l);
}
if (compress) {
compressLater(data, page);
}
off += l;
pos += l;
len -= l;
}
return pos;
}
/**
* Set the file name.
*
* @param name the name
*/
void setName(String name) {
this.name = name;
}
/**
* Get the file name
*
* @return the name
*/
String getName() {
return name;
}
/**
* Get the last modified time.
*
* @return the time
*/
long getLastModified() {
return lastModified;
}
/**
* Check whether writing is allowed.
*
* @return true if it is
*/
boolean canWrite() {
return !isReadOnly;
}
/**
* Set the read-only flag.
*
* @return true
*/
boolean setReadOnly() {
isReadOnly = true;
return true;
}
}
| {
"content_hash": "c9154956317cbd82864ca286c70ebbfe",
"timestamp": "",
"source": "github",
"line_count": 684,
"max_line_length": 84,
"avg_line_length": 25.252923976608187,
"alnum_prop": 0.5316389741214612,
"repo_name": "vdr007/ThriftyPaxos",
"id": "524c6bd0be03ee7b27a0aa2bc51952bea25a25e3",
"size": "17442",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/applications/h2/src/main/org/h2/store/fs/FilePathMem.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5721"
},
{
"name": "CSS",
"bytes": "17734"
},
{
"name": "HTML",
"bytes": "556900"
},
{
"name": "Java",
"bytes": "9411023"
},
{
"name": "JavaScript",
"bytes": "24600"
},
{
"name": "NSIS",
"bytes": "6422"
},
{
"name": "PLSQL",
"bytes": "278490"
},
{
"name": "PLpgSQL",
"bytes": "2709"
},
{
"name": "Shell",
"bytes": "15848"
}
],
"symlink_target": ""
} |
//
// use_future.hpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
//
#ifndef ASIO_USE_FUTURE_HPP
#define ASIO_USE_FUTURE_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/config.hpp"
#include <memory>
#include "asio/detail/push_options.hpp"
namespace asio {
/// Class used to specify that an asynchronous operation should return a future.
/**
* The use_future_t class is used to indicate that an asynchronous operation
* should return a std::future object. A use_future_t object may be passed as a
* handler to an asynchronous operation, typically using the special value @c
* asio::use_future. For example:
*
* @code std::future<std::size_t> my_future
* = my_socket.async_read_some(my_buffer, asio::use_future); @endcode
*
* The initiating function (async_read_some in the above example) returns a
* future that will receive the result of the operation. If the operation
* completes with an error_code indicating failure, it is converted into a
* system_error and passed back to the caller via the future.
*/
template <typename Allocator = std::allocator<void> >
class use_future_t
{
public:
/// The allocator type. The allocator is used when constructing the
/// @c std::promise object for a given asynchronous operation.
typedef Allocator allocator_type;
/// Construct using default-constructed allocator.
ASIO_CONSTEXPR use_future_t()
{
}
/// Construct using specified allocator.
explicit use_future_t(const Allocator& allocator)
: allocator_(allocator)
{
}
#if !defined(ASIO_NO_DEPRECATED)
/// (Deprecated: Use rebind().) Specify an alternate allocator.
template <typename OtherAllocator>
use_future_t<OtherAllocator> operator[](const OtherAllocator& allocator) const
{
return use_future_t<OtherAllocator>(allocator);
}
#endif // !defined(ASIO_NO_DEPRECATED)
/// Specify an alternate allocator.
template <typename OtherAllocator>
use_future_t<OtherAllocator> rebind(const OtherAllocator& allocator) const
{
return use_future_t<OtherAllocator>(allocator);
}
/// Obtain allocator.
allocator_type get_allocator() const
{
return allocator_;
}
private:
Allocator allocator_;
};
/// A special value, similar to std::nothrow.
/**
* See the documentation for asio::use_future_t for a usage example.
*/
#if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
constexpr use_future_t<> use_future;
#elif defined(ASIO_MSVC)
__declspec(selectany) use_future_t<> use_future;
#endif
} // namespace asio
#include "asio/detail/pop_options.hpp"
#include "asio/impl/use_future.hpp"
#endif // ASIO_USE_FUTURE_HPP
| {
"content_hash": "dcff5fd8b5c9423bee63b5c59f343a2d",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 80,
"avg_line_length": 28.792079207920793,
"alnum_prop": 0.717331499312242,
"repo_name": "mojmir-svoboda/DbgToolkit",
"id": "15136a86c8ef7bfdfe808b9c8c8cc71346f29143",
"size": "2908",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "3rd/asio/include/asio/use_future.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Awk",
"bytes": "3960"
},
{
"name": "Batchfile",
"bytes": "2926"
},
{
"name": "C",
"bytes": "3527150"
},
{
"name": "C++",
"bytes": "8094856"
},
{
"name": "CMake",
"bytes": "240374"
},
{
"name": "HTML",
"bytes": "330871"
},
{
"name": "M4",
"bytes": "9332"
},
{
"name": "Makefile",
"bytes": "221500"
},
{
"name": "PAWN",
"bytes": "673"
},
{
"name": "Perl",
"bytes": "36555"
},
{
"name": "Python",
"bytes": "1459"
},
{
"name": "QMake",
"bytes": "9561"
},
{
"name": "Scheme",
"bytes": "6418020"
},
{
"name": "Shell",
"bytes": "1747"
},
{
"name": "TeX",
"bytes": "1961"
},
{
"name": "XSLT",
"bytes": "77656"
}
],
"symlink_target": ""
} |
{
it("should trim spaces", function() {
expect(trim(" foo ")).toEqual("foo");
});
it("should trim tabs", function() {
expect(trim("\tfoo\t")).toEqual("foo");
});
}
| {
"content_hash": "54e8abf8ec76944c0101358e5406df13",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 43,
"avg_line_length": 22.75,
"alnum_prop": 0.5384615384615384,
"repo_name": "stas-vilchik/bdd-ml",
"id": "7a4aaccf69d1b13af27bd2f3baed3e52ce863bf2",
"size": "182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "data/796.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6666795"
},
{
"name": "Python",
"bytes": "3199"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
android:id="@+id/cv_bangumi"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:clickable="true"
android:foreground="?selectableItemBackground"
app:cardCornerRadius="@dimen/shape">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/ac_rv_bangumi_img"
android:layout_width="match_parent"
android:layout_height="170dp"/>
<TextView
android:id="@+id/ac_rv_bangumi_title_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:maxLines="2"
android:singleLine="true"
android:textColor="@color/font_light"
android:textSize="12sp"/>
<TextView
android:id="@+id/ac_rv_bangumi_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:singleLine="true"
android:textSize="12sp"/>
</LinearLayout>
</android.support.v7.widget.CardView> | {
"content_hash": "a5d5e45e025794878d79e7abc900e604",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 62,
"avg_line_length": 36.48936170212766,
"alnum_prop": 0.6262390670553936,
"repo_name": "succlz123/BlueTube",
"id": "b365d7b6ff76e4655459ba402e0237486862a2c4",
"size": "1715",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/ac_rv_bangumi.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "662682"
}
],
"symlink_target": ""
} |
package org.talend.components.salesforce;
import org.talend.components.api.properties.ComponentBasePropertiesImpl;
import org.talend.daikon.properties.presentation.Form;
import org.talend.daikon.properties.presentation.Widget;
import org.talend.daikon.properties.property.Property;
import java.util.EnumSet;
import static org.talend.daikon.properties.presentation.Widget.widget;
import static org.talend.daikon.properties.property.PropertyFactory.newBoolean;
import static org.talend.daikon.properties.property.PropertyFactory.newString;
public class SalesforceSSLProperties extends ComponentBasePropertiesImpl {
public Property<Boolean> mutualAuth = newBoolean("mutualAuth"); //$NON-NLS-1$
public Property<String> keyStorePath = newString("keyStorePath"); //$NON-NLS-1$
public Property<String> keyStorePwd = newString("keyStorePwd")
.setFlags(EnumSet.of(Property.Flags.ENCRYPT, Property.Flags.SUPPRESS_LOGGING));
public SalesforceSSLProperties(String name) {
super(name);
}
@Override
public void setupLayout() {
super.setupLayout();
Form form = Form.create(this, Form.MAIN);
form.addRow(widget(mutualAuth));
form.addRow(widget(keyStorePath));
form.addRow(widget(keyStorePath).setWidgetType(Widget.FILE_WIDGET_TYPE));
form.addRow(widget(keyStorePwd).setWidgetType(Widget.HIDDEN_TEXT_WIDGET_TYPE));
}
@Override
public void refreshLayout(Form form) {
super.refreshLayout(form);
if (form.getName().equals(Form.MAIN)) {
boolean isMutualAuth = mutualAuth.getValue();
form.getWidget(keyStorePath.getName()).setHidden(!isMutualAuth);
form.getWidget(keyStorePwd.getName()).setHidden(!isMutualAuth);
}
}
public void afterMutualAuth() {
refreshLayout(getForm(Form.MAIN));
}
}
| {
"content_hash": "08216698226b4c80767f2fa9bc562400",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 91,
"avg_line_length": 35.92307692307692,
"alnum_prop": 0.7248394004282656,
"repo_name": "Talend/components",
"id": "38ab2f0a1bd444a90074a44650d54c9e3c92f9e5",
"size": "2389",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/components-salesforce/components-salesforce-definition/src/main/java/org/talend/components/salesforce/SalesforceSSLProperties.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "1597"
},
{
"name": "Dockerfile",
"bytes": "1425"
},
{
"name": "Java",
"bytes": "8804569"
},
{
"name": "Shell",
"bytes": "17954"
}
],
"symlink_target": ""
} |
package edu.gemini.p1monitor.fetch
import javax.servlet.http.HttpServletRequest
import edu.gemini.model.p1.immutable.SpecialProposalType
/**
* A servlet request wrapper that makes it convenient to obtain the request
* parameters in a format that the servlet can use.
*/
object FetchRequest {
val DIR_PARAM = "dir"
val TYPE_PARAM = "type"
val PROP_PARAM = "proposal"
val FORMAT_PARAM= "format"
}
class FetchRequest(req: HttpServletRequest) {
val dir = getParam(req, FetchRequest.DIR_PARAM)
val proposalType = getParam(req, FetchRequest.TYPE_PARAM)
val proposal = getParam(req, FetchRequest.PROP_PARAM)
val formatStr: String = getParam(req, FetchRequest.FORMAT_PARAM)
val format = FetchFormat.valueOf(formatStr)
def getParam(req: HttpServletRequest, paramName: String): String =
Option(req.getParameter(paramName)) match {
case Some(s:String) => s
case _ => throw new FetchException("Missing param '" + paramName + "'")
}
} | {
"content_hash": "664773c19347c887985c3b9fbd39534d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 90,
"avg_line_length": 32.733333333333334,
"alnum_prop": 0.725050916496945,
"repo_name": "arturog8m/ocs",
"id": "b09d9aa8d4da0578071db230dae91b0de967ee78",
"size": "982",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "bundle/edu.gemini.p1monitor/src/main/scala/edu/gemini/p1monitor/fetch/FetchRequest.scala",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "7919"
},
{
"name": "HTML",
"bytes": "490242"
},
{
"name": "Java",
"bytes": "14504312"
},
{
"name": "JavaScript",
"bytes": "7962"
},
{
"name": "Scala",
"bytes": "4967047"
},
{
"name": "Shell",
"bytes": "4989"
},
{
"name": "Tcl",
"bytes": "2841"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Explain Git with D3</title>
<script data-main="js/main" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.4/require.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/1140/2.0/1140.css">
<link rel="stylesheet" href="css/explaingit.css">
</head>
<body>
<a href="https://github.com/onlywei/explain-git-with-d3" id="fork-me">
<img style="position: absolute; top: 0; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
alt="Fork me on GitHub">
</a>
<div class="container">
<div class="row intro">
<div class="twelvecol">
<h1>Visualizing Git Concepts with D3</h1>
<p>
.این وب سایت برای کمک به شما و درک برخی از مفاهیم اساسی گیت بصورت بصری طراحی شده است
.این اولین تلاش من برای استفاده از هردو مورد اس وی جی و دی ثری است
</p>
<p>اضافه کردن /سکوگذاری فایلهای شما برای کمیت کردن توسط این سایت پوشش داده نخواهد شد.بروی این سایت تمام
درتمام محیط مجازی و انلاین کد نویسی بروی این سایت
.فقط وانمود می کند که شما همیشه فایلهایی سکوگذاری شده و اماده کمیت کردن در همه زمانها دارید
اگر شما در مورد چگونه اضافه یا سکوکردن فایلها برای کمیت کردن نیاز به یک یاداوری دارید لطفن بخوانید
<a href="http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository">گیت بیسیک</a>.
</p>
<p>
.محیط های مجازی به دستورات مشخصی تقسیم شده اند که درزیر لیست شده اند
</p>
</div>
</div>
<div class="row command-list">
<div class="twocol">
<h4>Basic Commands</h3>
<a id="open-commit" class="openswitch" href="#commit">git commit</a>
<a id="open-branch" class="openswitch" href="#branch">git branch</a>
</div>
<div class="twocol">
<h4> </h4>
<a id="open-checkout" class="openswitch" href="#checkout">git checkout</a>
<a id="open-checkout-b" class="openswitch" href="#checkout-b">git checkout -b</a>
</div>
<div class="twocol">
<h4>Undo Commits</h4>
<a id="open-reset" class="openswitch" href="#reset">git reset</a>
<a id="open-revert" class="openswitch" href="#revert">git revert</a>
</div>
<div class="twocol">
<h4>Combine Branches</h4>
<a id="open-merge" class="openswitch" href="#merge">git merge</a>
<a id="open-rebase" class="openswitch" href="#rebase">git rebase</a>
</div>
<div class="twocol">
<h4>Remote Server</h4>
<a id="open-fetch" class="openswitch" href="#fetch">git fetch</a>
<a id="open-pull" class="openswitch" href="#pull">git pull</a>
</div>
<div class="twocol last">
<h4> </h4>
<a id="open-push" class="openswitch" href="#push">git push</a>
<a id="open-tag" class="openswitch" href="#tag">git tag</a>
</div>
</div>
<div class="row concept-area">
<div id="ExplainGitCommit-Container" class="twelvecol concept-container">
<p>
We are going to skip instructing you on how to add your files for commit in this explanation.
Let's assume you already know how to do that. If you don't, go read some other tutorials.
</p>
<p>
Pretend that you already have your files staged for commit and enter <span class="cmd">git commit</span>
as many times as you like in the terminal box.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitTag-Container" class="twelvecol concept-container">
<p>
<span class="cmd">git tag name</span> will create a new tag named "name".
Creating tags just creates a new tag pointing to the currently checked out commit.
</p>
<p>
Tags can be deleted using the command <span class="cmd">git tag -d name</span> (coming soon).
</p>
<p>
Type <span class="cmd">git commit</span> and <span class="cmd">git tag</span> commands
to your hearts desire until you understand this concept.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitBranch-Container" class="twelvecol concept-container">
<p>
<span class="cmd">git branch name</span> will create a new branch named "name".
Creating branches just creates a new tag pointing to the currently checked out commit.
</p>
<p>
Branches can be deleted using the command <span class="cmd">git branch -d name</span>.
</p>
<p>
Type <span class="cmd">git commit</span> and <span class="cmd">git branch</span> commands
to your hearts desire until you understand this concept.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitCheckout-Container" class="twelvecol concept-container">
<p>
<span class="cmd">git checkout</span> has many uses,
but the main one is to switch between branches.</br>
For example, to switch from master branch to dev branch,
I would type <span class="cmd">git checkout dev</span>.
After that, if I do a git commit, notice where it goes. Try it.
</p>
<p>
In addition to checking out branches, you can also checkout individual commits. Try it.</br>
Make a new commit and then type <span class="cmd">git checkout bb92e0e</span>
and see what happens.
</p>
<p>
Type <span class="cmd">git commit</span>, <span class="cmd">git branch</span>,
and <span class="cmd">git checkout</span> commands to your hearts desire
until you understand this concept.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitCheckout-b-Container" class="twelvecol concept-container">
<p>
You can combine <span class="cmd">git branch</span> and <span class="cmd">git checkout</span>
into a single command by typing <span class="cmd">git checkout -b branchname</span>.
This will create the branch if it does not already exist and immediately check it out.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitReset-Container" class="twelvecol concept-container">
<p>
<span class="cmd">git reset</span> will move HEAD and the current branch back to wherever
you specify, abandoning any commits that may be left behind. This is useful to undo a commit
that you no longer need.
</p>
<p>
This command is normally used with one of three flags: "--soft", "--mixed", and "--hard".
The soft and mixed flags deal with what to do with the work that was inside the commit after
you reset, and you can read about it <a href="http://git-scm.com/2011/07/11/reset.html">here</a>.
Since this visualization cannot graphically display that work, only the "--hard" flag will work
on this site.
</p>
<p>
The ref "HEAD^" is usually used together with this command. "HEAD^" means "the commit right
before HEAD. "HEAD^^" means "two commits before HEAD", and so on.
</p>
<p>
Note that you must <b>never</b> use <span class="cmd">git reset</span> to abandon commits
that have already been pushed and merged into the origin. This can cause your local repository
to become out of sync with the origin. Don't do it unless you really know what you're doing.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitRevert-Container" class="twelvecol concept-container">
<p>
To undo commits that have already been pushed and shared with the team, we cannot use the
<span class="cmd">git reset</span> command. Instead, we have to use <span class="cmd">git revert</span>.
</p>
<p>
<span class="cmd">git revert</span> will create a new commit that will undo all of the work that
was done in the commit you want to revert.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitMerge-Container" class="twelvecol concept-container">
<p>
<span class="cmd">git merge</span> دستورگیت مرج ایجاد میکند یک کامیت به همراه دومرجع .
نتایج کامیت ذخیره خواهد شد به صورت یک عکس که شامل تمام کارهایی است که بروی هر بخش انجام شده است
اگرهیچ اختلافی بین دوکامیت وجود نداشته باشد گیت انجام خواهددادیک متد بازگشت سریع از حالت مرجع برای اینکه اتفاق افتادن این حالت را ببینیم برنچ راچک کرده و دستورگیت مرج دیو را اجرا میکنیم
</p>
<p>
If there was no divergence between the two commits, git will do a "fast-forward" method merge.</br>
To see this happen, checkout the 'ff' branch and then type <span class="cmd">git merge dev</span>.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitRebase-Container" class="twelvecol concept-container">
<p>
<span class="cmd">git rebase</span> will take the commits on this branch and "move" them so that their
new "base" is at the point you specify.
</p>
<p>
You should pay close attention to the commit IDs of the circles as they move when you do this exercise.
</p>
<p>
The reason I put "move" in quotations because this process actually generates brand new commits with
completely different IDs than the old commits, and leaves the old commits where they were. For this reason,
you never want to rebase commits that have already been shared with the team you are working with.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitFetch-Container" class="twelvecol concept-container">
<p>
<span class="cmd">git fetch</span> ".تمام انشعابات مسیر یابی را در مخزن محلی خود بروز رسانی خواهد کرد.که آن انشعابات را با برچسبی خاکستری رنگ مشخص می نماید."
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitPull-Container" class="twelvecol concept-container">
<p>
A <span class="cmd">git pull</span> is a two step process that first does a <span class="cmd">git fetch</span>,
and then does a <span class="cmd">git merge</span> of the remote tracking branch associated with your current branch.
If you have no current branch, the process will stop after fetching.
</p>
<p>
If the argument "--rebase" was given by typing <span class="cmd">git pull --rebase</span>, the second step of
pull process will be a rebase instead of a merge. This can be set to the default behavior by configuration by typing:
<span class="cmd">git config branch.BRANCHNAME.rebase true</span>.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitPush-Container" class="twelvecol concept-container">
<p>
A <span class="cmd">git push</span> will find the commits you have on your local branch that the corresponding branch
on the origin server does not have, and send them to the remote repository.
</p>
<p>
By default, all pushes must cause a fast-forward merge on the remote repository. If there is any divergence between
your local branch and the remote branch, your push will be rejected. In this scenario, you need to pull first and then
you will be able to push again.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitClean-Container" class="twelvecol concept-container">
<p>
One simple example of the use of <span class="cmd">git reset</span> is to completely restore your local repository
state to that of the origin.</br>
You can do so by typing <span class="cmd">git reset origin/master</span>.
</p>
<p>
Note that this won't delete untracked files, you will have to delete those separately with
the command <span class="cmd">git clean -df</span>.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitFetchRebase-Container" class="twelvecol concept-container">
<p>
Below is a situation in which you are working in a local branch that is all your own. You want to receive the latest code
from the origin server's master branch. To update your local branch, you can do it without having to switch branches!
</p>
<p>
First do a <span class="cmd">git fetch</span>, then type <span class="cmd">git rebase origin/master</span>!
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitDeleteBranches-Container" class="twelvecol concept-container">
<p>
<span class="cmd">git branch -d</span> is used to delete branches.
I have pre-created a bunch of branches for you to delete in the playground below.
Have at it.
</p>
<div class="playground-container"></div>
</div>
<div id="ExplainGitFree-Container" class="twelvecol concept-container">
<p>
Do whatever you want in this free playground.
</p>
<div class="playground-container"></div>
</div>
</div>
<div class="row">
<div class="twelvecol">
<h2>Specific Examples</h2>
<p>Below I have created some specific real-world scenarios that I feel are quite common and useful.</p>
</div>
</div>
<div class="row example-list">
<div class="tencol">
<a id="open-clean" class="openswitch" href="#clean">Restore Local Branch to State on Origin Server</a>
<a id="open-fetchrebase" class="openswitch" href="#fetchrebase">Update Private Local Branch with Latest from Origin</a>
<a id="open-deletebranches" class="openswitch" href="#deletebranches">Deleting Local Branches</a>
</div>
<div class="twocol last">
<a id="open-freeplay" class="openswitch" href="#freeplay">Free Playground</a>
<a id="open-zen" class="openswitch" href="#zen">Zen Mode</a>
</div>
</div>
</div>
<div id="ExplainGitZen-Container" style="display:none">
<div class="playground-container"></div>
</div>
<svg version="1.1" baseProfile="full"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:ev="http://www.w3.org/2001/xml-events"
width="0" height="0">
<marker id="triangle" refX="5" refY="5" markerUnits="strokeWidth" fill="#666"
markerWidth="4" markerHeight="3" orient="auto" viewBox="0 0 10 10">
<path d="M 0 0 L 10 5 L 0 10 z"/>
</marker>
<marker id="faded-triangle" refX="5" refY="5" markerUnits="strokeWidth" fill="#DDD"
markerWidth="4" markerHeight="3" orient="auto" viewBox="0 0 10 10">
<path d="M 0 0 L 10 5 L 0 10 z"/>
</marker>
<marker id="brown-triangle" refX="5" refY="5" markerUnits="strokeWidth" fill="#663300"
markerWidth="4" markerHeight="3" orient="auto" viewBox="0 0 10 10">
<path d="M 0 0 L 10 5 L 0 10 z"/>
</marker>
</svg>
<script type="text/javascript">
require(['explaingit'], function (explainGit) {
var examples = {
'commit': {
name: 'Commit',
height: 200,
baseLine: 0.4,
commitData: [
{id: 'e137e9b', tags: ['master']}
],
initialMessage: 'Type git commit a few times.'
},
'branch': {
name: 'Branch',
baseLine: 0.6,
commitData: [
{id: 'e137e9b', tags: ['master']}
]
},
'tag': {
name: 'Tag',
baseLine: 0.6,
commitData: [
{id: 'e137e9b', tags: ['master']}
]
},
'checkout': {
name: 'Checkout',
height: 500,
commitData: [
{id: 'e137e9b'},
{id: 'bb92e0e', parent: 'e137e9b', tags: ['master']},
{id: 'e088135', parent: 'e137e9b', tags: ['dev']}
],
initialMessage:
'Use git checkout, git branch, and git commit commands until you understand.'
},
'checkout-b': {
name: 'Checkout-b',
height: 500,
commitData: [
{id: 'e137e9b'},
{id: 'f5b32c8', parent: 'e137e9b'},
{id: 'bb92e0e', parent: 'f5b32c8', tags: ['master']},
{id: 'e088135', parent: 'e137e9b', tags: ['dev']}
],
initialMessage:
'Use git checkout -b and git commit commands until you understand.'
},
'reset': {
name: 'Reset',
height: 200,
baseLine: 0.5,
commitData: [
{id: 'e137e9b'},
{id: '0e70093', parent: 'e137e9b'},
{id: '3e33afd', parent: '0e70093', tags: ['master']}
],
initialMessage: 'Type "git reset HEAD^".'
},
'revert': {
name: 'Revert',
height: 200,
baseLine: 0.5,
commitData: [
{id: 'e137e9b'},
{id: '0e70093', parent: 'e137e9b'},
{id: '3e33afd', parent: '0e70093', tags: ['master']}
],
initialMessage: 'Type "git revert 0e70093".'
},
'merge': {
name: 'Merge',
height: 500,
commitData: [
{id: 'e137e9b'},
{id: 'bb92e0e', parent: 'e137e9b', tags: ['master']},
{id: 'f5b32c8', parent: 'e137e9b', tags: ['ff']},
{id: 'e088135', parent: 'f5b32c8', tags: ['dev']}
],
initialMessage:
'Type "git merge dev".'
},
'rebase': {
name: 'Rebase',
height: 500,
commitData: [
{id: 'e137e9b'},
{id: 'bb92e0e', parent: 'e137e9b', tags: ['master']},
{id: 'f5b32c8', parent: 'e137e9b'},
{id: 'e088135', parent: 'f5b32c8', tags: ['dev']}
],
currentBranch: 'dev',
initialMessage:
'Type "git rebase master".'
},
'fetch': {
name: 'Fetch',
height: 500,
commitData: [
{id: 'e137e9b', tags: ['origin/master']},
{id: '6ce726f', parent: 'e137e9b'},
{id: 'bb92e0e', parent: '6ce726f', tags: ['master']},
{id: '0cff760', parent: 'e137e9b', tags: ['origin/dev']},
{id: '4ed301d', parent: '0cff760', tags: ['dev']}
],
originData: [
{id: 'e137e9b'},
{id: '7eb7654', parent: 'e137e9b'},
{id: '090e2b8', parent: '7eb7654'},
{id: 'ee5df4b', parent: '090e2b8', tags: ['master']},
{id: '0cff760', parent: 'e137e9b'},
{id: '2f8d946', parent: '0cff760'},
{id: '29235ca', parent: '2f8d946', tags: ['dev']}
],
initialMessage:
'Carefully compare the commit IDs between the origin and the local repository. ' +
'Then type "git fetch".'
},
'pull': {
name: 'Pull',
height: 500,
commitData: [
{id: 'e137e9b', tags: ['origin/master']},
{id: '46d095b', parent: 'e137e9b', tags: ['master']}
],
originData: [
{id: 'e137e9b'},
{id: '7eb7654', parent: 'e137e9b'},
{id: '090e2b8', parent: '7eb7654'},
{id: 'ee5df4b', parent: '090e2b8', tags: ['master']}
],
initialMessage:
'Carefully compare the commit IDs between the origin and the local repository. ' +
'Then type "git pull".'
},
'push': {
name: 'Push',
height: 500,
commitData: [
{id: 'e137e9b', tags: ['origin/master']},
{id: '46d095b', parent: 'e137e9b', tags: ['master']}
],
originData: [
{id: 'e137e9b'},
{id: '7eb7654', parent: 'e137e9b', tags: ['master']}
],
initialMessage:
'Carefully compare the commit IDs between the origin and the local repository. ' +
'Then type "git push".'
},
'clean': {
name: 'Clean',
height: 200,
baseLine: 0.4,
commitData: [
{id: 'e137e9b', tags: ['origin/master']},
{id: '0e70093', parent: 'e137e9b'},
{id: '3e33afd', parent: '0e70093', tags: ['master']}
],
initialMessage: 'Type "git reset origin/master".'
},
'fetchrebase': {
name: 'FetchRebase',
height: 500,
commitData: [
{id: 'e137e9b', tags: ['origin/master', 'master']},
{id: '46d095b', parent: 'e137e9b'},
{id: 'dccdc4d', parent: '46d095b', tags: ['my-branch']}
],
currentBranch: 'my-branch',
originData: [
{id: 'e137e9b'},
{id: '7eb7654', parent: 'e137e9b'},
{id: '090e2b8', parent: '7eb7654'},
{id: 'ee5df4b', parent: '090e2b8', tags: ['master']}
],
initialMessage:
'First type "git fetch". Then type "git rebase origin/master".'
},
'deletebranches': {
name: 'DeleteBranches',
height: 500,
baseLine: 0.6,
commitData: [
{id: 'e137e9b'},
{id: 'bb92e0e', parent: 'e137e9b'},
{id: 'd25ee9b', parent: 'bb92e0e', tags: ['master']},
{id: '071ff28', parent: 'e137e9b', tags: ['protoss']},
{id: 'f5b32c8', parent: 'bb92e0e'},
{id: 'e088135', parent: 'f5b32c8', tags: ['zerg']},
{id: '9e6c322', parent: 'bb92e0e'},
{id: '593ae02', parent: '9e6c322', tags: ['terran']}
],
currentBranch: 'terran',
initialMessage:
'Delete some branches.'
},
'freeplay': {
name: 'Free',
height: 500,
commitData: [
{id: 'e137e9b', tags: ['origin/master', 'master']}
],
originData: [
{id: 'e137e9b'},
{id: '7eb7654', parent: 'e137e9b'},
{id: '090e2b8', parent: '7eb7654'},
{id: 'ee5df4b', parent: '090e2b8', tags: ['master']}
],
initialMessage:
'Have fun.'
}
};
window.addEventListener('hashchange', open, false);
window.addEventListener('load', open, false);
function open() {
var hash = window.location.hash.substr(1),
linkId = 'open-' + hash,
example = examples[hash];
if (example) {
explainGit.reset();
document.getElementById(linkId).classList.add('selected');
explainGit.open(example);
} else if (hash === 'zen') {
var elements = document.getElementsByClassName('row');
for(var i = 0; i != elements.length; ++i)
{
elements[i].style.display = 'none';
}
document.getElementById('fork-me').style.display = 'none';
explainGit.reset();
explainGit.open({
name: 'Zen',
height: '100%',
commitData: [
{id: 'e137e9b', tags: ['master'], message: 'first commit'}
],
initialMessage:
'Have fun.'
});
}
}
});
</script>
</body>
</html>
| {
"content_hash": "0e87ef695ace8accf3bd018f077a3f73",
"timestamp": "",
"source": "github",
"line_count": 564,
"max_line_length": 185,
"avg_line_length": 42.505319148936174,
"alnum_prop": 0.5615484086263713,
"repo_name": "majidmosafer/jahad",
"id": "8122cd89e83429abcb7ffd09209c4a84b97a26b5",
"size": "24789",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4410"
},
{
"name": "HTML",
"bytes": "26071"
},
{
"name": "JavaScript",
"bytes": "56408"
}
],
"symlink_target": ""
} |
Each sketch can have Intelligence items associated with it. This comes in the form of simple strings extracted from events,
usually as IOCs. (e.g. a suspicious IP address in a log file that you want to highlight.)
Intelligence entries have the following, simple format;
```json
{
"externalURI" :"yeti/127.0.0.1"
"ioc" :"127.0.0.1"
"tags": ["evil", "c2", "random"]
"type": "ip"
}
```
## Adding new intelligence
Timesketch will parse events attributes for potential IOCs to be added as Intelligence (e.g. when Timesketch finds something that looks like a SHA-256 hash, IP address, etc.). This will be surfaced to you by a grey highlight on the corresponding string. You can then click the highlighted string to open and pre-fill the `add local intelligence` dialog. You can optionally change the IOC type before confirming the suggestion.
To add an IOC that isn't highlighted, just select the string you want to add with your cursor. The string will become highlighted, and you will be able to follow the same steps as above to add it.
The currently supported IOC types are:
* `fs_path`
* `hash_sha256`
* `hash_sha1`
* `hash_md5`
* `hostname`
* `ipv4`
If a string doesn't match any of the aforementioned IOC types, the type will fall back to `other`.
## Intelligence view
The list of all the IOCs added to a sketch can be seen in the *Intelligence* tab (accessible at `/sketch/{SKETCH_ID}/intelligence`).

### IOC table
From the IOC table section, one can:
* Copy IOC to clipboard.
* Search a sketch for a given IOC.
* Open the external reference in a new browser tab, if it looks like a link.
* Edit IOCs that have been added.
* Delete IOCs.
By clicking the lens icon next to the IOC, you will be taken to the Explore view with a query for the given value.
### Tags
IOCs that have been added to the sketch can be tagged with lightweight context tags. These tags are not currently
being reused elsewhere in the Timesketch.
The `Tag list` card in the intelligence view contains a table of tags that have been thusly associated with IOCs.
Clicking on the lens icon will take you to the Explore view, searching for *IOC values* that have this tag.
### Event tags
The `Event tags` card contains a list of all tags that can be found in a sketch. Contrary to the `Tag list`, these
are not tags associated to IOCs but tags that have been applied to timeline events. Clicking on the lens icon will
take you to the Explore view, searching for all events that have the corresponding tag.#
| {
"content_hash": "8abb93accdd53f1df28a441108e6d8bc",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 426,
"avg_line_length": 40.65079365079365,
"alnum_prop": 0.7532213978914487,
"repo_name": "google/timesketch",
"id": "599d9f041ed74cf70fd42c6bbae50af48cae7cd0",
"size": "2577",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/guides/user/intelligence.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "245"
},
{
"name": "Dockerfile",
"bytes": "3735"
},
{
"name": "HTML",
"bytes": "8718"
},
{
"name": "JavaScript",
"bytes": "97456"
},
{
"name": "Jupyter Notebook",
"bytes": "340247"
},
{
"name": "Makefile",
"bytes": "593"
},
{
"name": "Mako",
"bytes": "412"
},
{
"name": "PowerShell",
"bytes": "7120"
},
{
"name": "Python",
"bytes": "1859758"
},
{
"name": "SCSS",
"bytes": "17377"
},
{
"name": "Shell",
"bytes": "22830"
},
{
"name": "Vue",
"bytes": "584825"
}
],
"symlink_target": ""
} |
package org.orekit.time;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.orekit.Utils;
import org.orekit.utils.Constants;
public class GPSScaleTest {
@Test
public void testT0() {
TimeScale scale = TimeScalesFactory.getGPS();
Assertions.assertEquals("GPS", scale.toString());
AbsoluteDate t0 =
new AbsoluteDate(new DateComponents(1980, 1, 6), TimeComponents.H00, scale);
Assertions.assertEquals(AbsoluteDate.GPS_EPOCH, t0);
}
@Test
public void testArbitrary() {
AbsoluteDate tGPS =
new AbsoluteDate(new DateComponents(1999, 3, 4), TimeComponents.H00, TimeScalesFactory.getGPS());
AbsoluteDate tUTC =
new AbsoluteDate(new DateComponents(1999, 3, 3), new TimeComponents(23, 59, 47),
TimeScalesFactory.getUTC());
Assertions.assertEquals(tUTC, tGPS);
}
@Test
public void testConstant() {
TimeScale scale = TimeScalesFactory.getGPS();
double reference = scale.offsetFromTAI(AbsoluteDate.J2000_EPOCH);
for (double dt = -10000; dt < 10000; dt += 123.456789) {
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt * Constants.JULIAN_DAY);
Assertions.assertEquals(reference, scale.offsetFromTAI(date), 1.0e-15);
}
}
@Test
public void testSymmetry() {
TimeScale scale = TimeScalesFactory.getGPS();
for (double dt = -10000; dt < 10000; dt += 123.456789) {
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt * Constants.JULIAN_DAY);
double dt1 = scale.offsetFromTAI(date);
DateTimeComponents components = date.getComponents(scale);
double dt2 = scale.offsetToTAI(components.getDate(), components.getTime());
Assertions.assertEquals( 0.0, dt1 + dt2, 1.0e-10);
}
}
@Test
public void testDuringLeap() {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getGPS();
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assertions.assertEquals(61, utc.minuteDuration(during));
Assertions.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assertions.assertEquals(60, scale.minuteDuration(during));
Assertions.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@BeforeEach
public void setUp() {
Utils.setDataRoot("regular-data");
}
}
| {
"content_hash": "b663ba1e17a00339f4aace28a0d4697d",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 109,
"avg_line_length": 38.69444444444444,
"alnum_prop": 0.6274228284278536,
"repo_name": "CS-SI/Orekit",
"id": "c33015c59144f1de847f8c605c728bfed2167fa4",
"size": "3586",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/test/java/org/orekit/time/GPSScaleTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Fortran",
"bytes": "7408"
},
{
"name": "HTML",
"bytes": "19673"
},
{
"name": "Java",
"bytes": "25367949"
},
{
"name": "Roff",
"bytes": "31072"
},
{
"name": "XSLT",
"bytes": "734"
}
],
"symlink_target": ""
} |
<head>
<title>InstantILL</title>
<link rel="stylesheet" href="/static/oabutton_rebrand.css"> <!-- gets the new css (still also uses the old css, just overwrites where necessary) -->
<meta name="description" content="InstantILL instantly delivers papers your patrons need from your holdings, Open Access and simplifies your ILL process to save you and your patrons money and time. It’s free, open source, community owned and easily set up in minutes." />
<meta property="og:description" content="InstantILL instantly delivers papers your patrons need from your holdings, Open Access and simplifies your ILL process to save you and your patrons money and time. It’s free, open source, community owned and easily set up in minutes." />
<meta property="og:url" content="https://instantill.org" />
<meta name="twitter:description" content="InstantILL instantly delivers papers your patrons need from your holdings, Open Access and simplifies your ILL process to save you and your patrons money and time. It’s free, open source, community owned and easily set up in minutes.">
<meta property="og:title" content="InstantILL" />
<meta name="twitter:title" content="InstantILL">
<meta property="og:image" content="https://instantill.org/static/Instant-ILL-transparent-green.png">
<meta name="twitter:card" content="summary_large_image">
</head>
<style>
#topnav {
display: none;
}
#footer {
display: none;
}
.form-control {
color:#46b633;
border:2px solid #46b633;
}
a {
color:#46b633;
font-weight:normal;
}
a:hover {
color:#46b633;
}
.btn-hollow-green:hover {
color: #edf8ed;
}
p{
padding:0;
margin: 10px 0;
}
h2{
text-align: left;
}
div.green {
padding-bottom:0px;
}
.alert-new {
width: 100%;
padding: 10px;
background-color: #46b633;
color: white;
text-align: center !important;
}
</style>
<div id="demo-mobile" class="container-fluid">
<div class="green-bg">
<div class="center-col header">
<div><span><strong><a href="/">InstantILL</a></strong> by <a href="https://oa.works" style="color:white">OA.Works</a></span></div>
</div>
</div>
<div class="center-col">
<div class="pitch">
<div class="pitchhalf">
<h2>This page is intentionally left blank</h2>
<p style="padding: 30px 0">
While InstantILL itself is fully responsive and works at all screen sizes, this set up doesn't. The setup system lets you interactive and adjust the alongside detailed explainations of what you're seeing and why. That just doesn't work so well on a phone.
</p>
<p>
Please come back on your computer.
</p>
</div>
</div>
</div>
<!-- footer -->
<div class="green-bg">
<div class="center-col footer">
<div>
<p>Open Source • Community Controlled • Not for Profit</p>
</div>
<div>
<span><a href="https://openaccessbutton.org/api">API</a></span>
<span><a href="https://openaccessbutton.org/privacy">Privacy</a></span>
<span><a href="https://openaccessbutton.org/terms">Terms</a></span>
<span><a href="mailto:joe@openaccessbutton.org">Contact</a></span>
<span><a href="https://status.openaccessbutton.org">Status</a></span>
</div>
</div>
</div>
</div>
<div id="demo" class="container-fluid">
<!--
<div class="alert-new">
<div class="center-col">
<div>
<p style="text-align:center;">
We're in Beta. <a href="https://doodle.com/mm/josephmcarthur/book-instantill" class="green" style="color:white"><b>Schedule a time</b></a> to get demos / help with setup. Please <a href="/feedback#bug" class="green" style="color:white"><b>report problems</b></a> if you find them.
</p>
</div>
</div>
</div>
-->
<div id="setup" class="row full">
<div class="col-md-6 col-md-offset-1 content">
<div id="instantill"></div>
</div>
<div class="settings col-md-4 col-md-offset-1 green">
<div id="loginorurl" style="display:none;" class="greenery">
<div class="noddyLogin">
<h2>First log in!</h2>
<p>Logging in allows us to save your settings, but you can test and try it without doing so</p>
<input type="text" class="form-control" id="noddyEmail" placeholder="Enter your Email Address">
<p>
By using InstantILL you agree to the Open Access Button <a href="/privacy">privacy policy</a> and <a href="/terms">terms of service</a>.
</p>
<p><a id="noddyLogin" class="btn btn-demo-green" href="#">Login</a></p>
</div>
<div class="noddyToken" style="display:none;">
<h2>Go check your email!</h2>
<p>Click the link or use the code to login.</p>
<input type="text" class="form-control" id="noddyToken" placeholder="Enter your login code">
</div>
</div>
<div id="menu" class="section greenery">
<h2>Let’s get you set up!</h2>
<p>
Congrats, you already have InstantILL partly set up! It finds Open Access articles and submit loans to your email. As you complete the steps below you’ll be able to customize further. It requires no coding or systems expertise, on <a href="#compatibility" class="view green">compatible systems</a> and doesn’t take long.
</p>
<p>
At any time you can test InstantILL, with your settings, on the left. It’ll work just like it would on your pages, although it won’t be styled to fit with your brand yet.
</p>
<p><b>
Get InstantILL working with your:
</b></p>
<ul class="arrowed">
<li>
<a class="green view" val="10.1145/2908080.2908114" href="#ill">
<span class="glyphicon glyphicon-arrow-right">
</span> Interlibrary loans</a>
</li>
<li>
<a class="green view" val="10.1145/2908080.2908114" href="#subscription"><span class="glyphicon glyphicon-arrow-right">
</span> Subscriptions</a>
</li>
<li>
<a class="green view" val="10.1145/2908080.2908114" href="#embed">
<span class="glyphicon glyphicon-arrow-right">
</span> Website & Brand</a>
</li>
<li>
<a class="green view" val="10.1145/2908080.2908114" href="#workflow">
<span class="glyphicon glyphicon-arrow-right">
</span> Discovery tools</a>
</li>
</ul>
<p><b>Once set up, it's time to:</b></p>
<ul class="arrowed">
<li>
<a class="green view" href="#rollout">
<span class="glyphicon glyphicon-arrow-right"></span> Pilot & Rollout</a>
</li>
<li>
<a class="green" href="https://instantill.org/leadership">
<span class="glyphicon glyphicon-arrow-right"></span> Support & Upgrade InstantILL</a>
</li>
<li>
<a class="green view" val="10.1145/2908080.2908114" href="#analytics">
<span class="glyphicon glyphicon-arrow-right"></span> View Analytics</a>
</li>
</ul>
<p>For more, check the
<a class="green view" val="10.1145/2908080.2908114" href="#advanced">advanced settings</a>.
</p>
</div>
<div id="ill" class="section greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Interlibrary loans: Submission (1/3)</h2>
<p>
InstantILL uses your existing Interlibrary Loan systems to manage authentication, fulfillment, and payment, or can submit to an email address.
</p>
<p><b>What is your ILL article form link?</b></p>
<input id="ill_form" type="text" class="form-control setting green" placeholder="URL">
<p>
Or <a href="#ill_email" class="view green">submit over email</a>
</p>
<br>
<p>
If everything works, hit next! If it doesn’t, <a href="#ill_advanced" class="view green">see advanced settings</a>.
</p>
</div>
<div id="ill_email" class="section skip greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Interlibrary loans: Submission (1/3)</h2>
<p>
InstantILL uses your existing Interlibrary Loan systems to manage authentication, fulfillment, and payment, or can submit to an email address.
</p>
<p><b>What email address do you want ILLs sent to? (optional for email alternative)</b></p>
<input id="email" type="text" class="form-control setting green" placeholder="default: your email address">
<br>
<p><b>
If you use Worldshare, inside our notifications we can provide direct links to journals to save you time. Just let us know your WMS URL.
</b>
<input id="search" type="text" class="form-control setting green" placeholder="e.g https://ambslibrary.share.worldcat.org/wms/cmnd/nd/discover/items/search"><br>
</p>
<br>
<p><b>Terms and conditions link</b><p>
<input id="terms" type="text" class="form-control setting green" placeholder="e.g https://libguides.newman.ac.uk/students/inter_library/terms">
<br>
</div>
<div id="ill_input" class="section greenery" save ="10.1126/science.196.4287.293">
<p><a class="green view" href="#ill"><span class="glyphicon glyphicon-arrow-left"></span> Go back</a></p>
<h2>Interlibrary loan: Input (2/3)</h2>
<p>
Now that you can submit article requests, you can adjust some key details about loans. Everything is optional, and we’ve set common defaults. In this section, we'll adjust what users see before they submit.
</p>
<p><b>What is the name of your institution?</b></p>
<input id="institution" type="text" class="form-control setting green" placeholder="Institution name">
<br>
<p><b>What email address do you want users referred to if there is a problem?</b></p>
<input id="problem" type="text" class="form-control setting green" placeholder="User will be told to 'contact their library'">
<br>
<p><b>
We use 'article' to refer to academic journal publications by default. Would you like to change that?
</b></p>
<p>
<input id="say_paper" type="checkbox" class="setting green">
Yes, use 'paper' instead.
</p>
<br>
<p><b>Where do you want people sent if they want a book?</b></p>
<input id="book" type="text" class="form-control setting green" placeholder="e.g https://ill.ulib.iupui.edu/ILLiad/IUP/illiad.dll?Action=10&Form=21">
<br>
<p><b>Where do you want people sent if they want something other than a book or article?</b></p>
<input id="other" type="text" class="form-control setting green" placeholder="e.g https://ill.ulib.iupui.edu/ILLiad/IUP/illiad.dll?Action=10&Form=10">
<br>
<p><b>If you want patrons want to learn details about Interlibrary Loan services, where can they find that?</b></p>
<small>This helps keep the page you embed InstantILL on clean and tidy while still making sure interested patrons can learn about ILL</small>
<input id="ill_info" type="text" class="form-control setting green" placeholder="e.g https://ulib.iupui.edu/services/ILL">
<br>
<p><b>If you want to allow users to view their account and outstanding loans, let us know where they can do that. </b></p>
<small>This helps keep the page you embed InstantILL on clean and tidy while allowing users to manage their accounts.</small>
<input id="account" type="text" class="form-control setting green" placeholder="e.g https://ill.ulib.iupui.edu/ILLiad/IUP/illiad.dll?Action=10&Form=62">
<br>
<p><b>If you want people to still be able to submit ILLs manually, let us know how they can do that.</b></p>
<small>This helps make sure people who liked the old way of doing things still can</small>
<input id="advanced_ill_form" type="text" class="form-control setting green" placeholder="e.g https://ill.ulib.iupui.edu/ILLiad/IUP/illiad.dll?Action=10&Form=10">
<br>
</div>
<div id="ill_results" class="section greenery" preview ="10.1126/science.196.4287.293" >
<p><a class="green view" href="#ill"><span class="glyphicon glyphicon-arrow-left"></span> Go back</a></p>
<h2>Interlibrary loan: Results (3/3)</h2>
<p>
Now that you can submit article requests, you can adjust some key details about loans. Everything is optional, and we’ve set common defaults. In this section, we'll adjust what patrons see for results.
</p>
<p><b>What do your article ILLs cost?</b></p>
<small>Please include your currency symbol e.g $4</small>
<input id="cost" type="text" class="form-control setting green" placeholder="default free">
<br>
<p><b>How long do your article ILLs take to deliver on average?</b></p>
<small>Please include the unit e.g 24 hours</small>
<input id="time" type="text" class="form-control setting green" placeholder="default 24 hours">
<br>
<p><b>
If we find an article Open Access, do you want to let patrons request an ILL?
</b></p>
<p>
<input id="ill_if_oa_off" type="checkbox" class="setting green">
No
</p>
<br>
<p><b>
If we find that you're subscribed to an article, do you still want patrons to be able to request an ILL?
</b></p>
<p>
<input id="ill_if_sub_off" type="checkbox" class="setting green">
No
</p>
<br>
</div>
<div id="ill_advanced" class="section skip greenery">
<p><a class="green view" href="#ill"><span class="glyphicon glyphicon-arrow-left"></span> Go back</a></p>
<h2>Interlibrary loan: Advanced</h2>
<p>
InstantILL uses your existing Interlibrary Loan systems to manage authentication, fulfillment, and payment, or can submit to an email address.
</p>
Add any additional params your base URL needs, such as a=b&c=d<br>
<input id="ill_added_params" type="text" class="form-control setting green" placeholder="Add any additional params your base URL needs"><br>
<!--<input id="method" type="text" class="form-control setting" placeholder="default GET"><br>-->
Add the param used to provide a service ID (which will be InstantILL)<br>
<input id="sid" type="text" class="form-control setting green" placeholder="default sid">
<br>
Title<br>
<input id="title" type="text" class="form-control setting green" placeholder="default atitle">
<br>
Journal title<br>
<input id="journal" type="text" class="form-control setting green" placeholder="default title">
<br>
DOI<br>
<input id="doi" type="text" class="form-control setting green" placeholder="default rft_id">
<br>
Author<br>
<input id="author" type="text" class="form-control setting green" placeholder="default au">
<br>
ISSN<br>
<input id="issn" type="text" class="form-control setting green" placeholder="default issn">
<br>
Volume<br>
<input id="volume" type="text" class="form-control setting green" placeholder="default volume">
<br>
Issue<br>
<input id="issue" type="text" class="form-control setting green" placeholder="default issue">
<br>
Page<br>
<input id="page" type="text" class="form-control setting green" placeholder="default pages">
<br>
Published<br>
<input id="published" type="text" class="form-control setting green" placeholder="default date">
<br>
PMID<br>
<input id="pmid" type="text" class="form-control setting green" placeholder="default pmid">
<br>
<!--<input id="pmcid" type="text" class="form-control setting" placeholder="default pmcid"><br>-->
Year
<input id="year" type="text" class="form-control setting green" placeholder="default rft.year">
<br>
Notes
<input id="notes" type="text" class="form-control setting green" placeholder="default notes">
<br>
</p>
</div>
<div id="subscription" class="section greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Subscriptions</h2>
<p>
We use your link resolver to understand what you do and don’t have access to. Then, we figure out the best link and send your patrons to it through your proxy.
<p><b>What is your link resolver URL?</b></p>
<small>Examples include: http://rx8kl6yf4x.search.serialssolutions.com, https://cricksfx.hosted.exlibrisgroup.com<!--, http://resolver.ebscohost.com/openurl-->.</small>
<input style="margin-top:10px;" type="text" class="form-control subscription setting green" placeholder="e.g http://rx8kl6yf4x.search.serialssolutions.com">
<select style="margin-top:10px;" class="form-control subscription_type setting green">
<option value="">select link resolver type...</option>
<option value="sfx">SFX</option>
<!--<option value="eds">EDS / Ebsco</option>-->
<option value="serialssolutions">Serials Solutions</option>
<option value="exlibris">Exlibris</option>
</select>
<a style="margin-top:10px;" class="btn btn-demo-green" id="addsubscription" href="#">Add another</a>
</p>
<p>What is the DOI of an article you definitely have access to, which can be used for testing?</p>
<p><input id="val" type="text" class="form-control setting green" placeholder="e.g 10.1234/567890"></p>
</div>
<div id="embed" class="section greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Website & Brand</h2>
<p>
InstantILL can be integrated onto any webpage on your website, and blend in with your brand.
</p>
<p>
To do that copy and paste the following into the source code (HTML) (or ask a developer to):
</p>
<div id="embed_code">
<pre style="word-break: break-all;"><div id="instantill"></div>
<script src="<span class="site_url">{{site_url}}/static/embed/oab_embed.js</span>"></script>
<script><span class="dev_var">_oab=</span>instantill({<span class="dev_api"></span><span class="user_id"></span>config: <span id="_oab_config"></span>});</script></pre>
</div>
<p>Then, you should be good to go! If not, review our <a href="#embed-advanced" class="view green">advanced settings</a>.</p>
<h3>We suggest:</h3>
<ul>
<li>Calling your page ‘Get a paper’</li>
<li>Not mentioning 'InstantILL' to patrons</li>
<li>Not putting anything above InstantILL (except a page title)</li>
</ul>
</div>
<div id="embed-advanced" class="section skip greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Website & Brand: Advanced</h2>
<p>You can control where the search widget gets displayed by moving:</p>
<pre>
<div id="instantill"></div></pre>
</p>
<p>
If you put the scripts in your `head` you may see a performance improvement.
</p>
<p>
If the script doesn't work, the system that runs your website (CMS) may be removing the script. This can sometimes be prevented by putting the code we provide between `<form></form>` or `<p></p>` elements.
</p>
<p>
If you don’t think it’s styled correctly, a developer can help you. If you have one, great, if not <a href="mailto:joe@openaccessbutton.org" class="light">reach out</a>.
</p>
<p>
We include a small amount of CSS with InstantILL to make it look nice. You can override that:
</p>
<p>
<input id="css_off" type="checkbox" class="setting green">
Override
</p>
<p>
We also use Bootstrap class names as a fallback option, these are btn btn-primary on buttons, and form-control on input elements. You can override that too:
</p>
<p>
<input id="bootstrap_off" type="checkbox" class="setting green">
Override
</p>
<p>
If you remove our css and remove bootstrap, you can write your own css styles into your page for the embed to follow. The class names we use are _oab_button for buttons and _oab_form for input elements.
</p>
</div>
<div id="workflow" class="section greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Discovery tools</h2>
<p>
To ensure users never need to re-enter their search across different systems you can link to InstantILL from any library system to integrate it into your existing workflows, say from library search or a link resolver.
</p>
<p id="embeddedexample" style="display:none;word-wrap:break-word"></p>
<p id="noembeddedexampleavailable">
Once you've used InstantILL on one of your domains, we'll show you an example link you can use to integrate into other systems.
</p>
<p>
If everything works, hit next! If it doesn’t, <a href="#workflow_advanced" class="view green">see advanced settings</a>
</p>
</div>
<div id="workflow_advanced" class="section skip greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Workflow: advanced</h2>
<p>
InstantILL will run automatically on the embedded page if it sees any of the following parameters in the URL: 'doi','title','url','atitle','rft_id','journal','issn','year','author'.
</p>
<p><b>
If you're only linking to InstantILL in the middle of a workflow, you may not want the instructions to show.
</b></p>
<small>The instructions are what appear above InstantILLs search box</small>
<p>
<input id="intro_off" type="checkbox" class="setting">
Don't show
</p>
<p><b>
You can completely turn off this feature too.
</b></p>
<p>
<input id="autorun_off" type="checkbox" class="setting">
Turn off
</p>
</div>
<div id="rollout" class="section greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Rollout</h2>
<p>
Once you're all set up, and you know it's working, it's time to put InstantILL in patron's hands.
</p>
<p><b>
Have you rolled it out?
</b></p>
<small>
Only click this around when you rollout InstantILL to patrons. This helps us support you best, track your stats, and understand how we're doing.
</small>
<p>
<input id="live" type="checkbox" class="setting green">
Yes
</p>
<p><b>
Activate pilot mode?
</b></p>
<small>
Pilot mode makes it easy to rollout a pilot. Patrons will know why you're trying something new, be able to give feedback and go back to old way. We'll also track the performance of your pilot, and you can ask us to let you know.
</small>
<p>
<input id="pilot" type="checkbox" class="setting green">
Yes
</p>
<p><b>
Can others contact you to find out about InstantILL?
</b></p>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSdK7CQ8J0lJ2hauS0A-qr3g5uBz9h3WZ6Uvj6vxzz0ut8GVbA/viewform?usp=sf_link" class="green">
Yes, sign me up!
</a>
</p>
</div>
<div id="analytics" class="section greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Analytics</h2>
<p>
We can provide anonymized analytics detailing your use of InstantILL. We can tell you:
</p>
<ul>
<li>How many searches have been made</li>
<li>How often we delivered subscribed materials</li>
<li>How often we delivered open access materials</li>
<li>How many ILL's were made</li>
<li>How often ILL's could be automated from our metadata</li>
<li>How often we returned an incorrect paper</li>
</ul>
<p>
Since this is not essential to delivering an excellent service to patrons, we only provide this to libraries who support our work through our leadership tier or who are piloting. To find our more, go <a href="https://instantill.org/leadership">here</a>.
</p>
<p>
If you're on our leadership tier, or in pilot mode, and would like a report email <a href="joe@openaccessbutton.org">Joe@openaccessbutton.org</a>.
</p>
</div>
<div id="advanced" class="section skip greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Advanced</h2>
<p>
These aren't needed for normal InstantILL set ups, but you may still be useful.
</p>
<h3>API</h3>
<p>
You can integrate with InstantILL using APIs. For example, you can reteive all the ILLs made through your embed, or use individual features (e.g OA finding, metadata retreival).
</p>
<p>
Full documentation on how to do this can be found <a href="https://openaccessbutton.org/api" class="green">here</a>.
</p>
<h3>Making your ILL form work well with InstantILL</h3>
<p>
InstantILL is designed to work with your standard form. However, you can improve the user experience by changing it. We suggest passing as much data in the background (not in user visible fields) and treating the page as a confirmation form. We’d like to provide examples of this in various systems, so if you do this and can share your code please <a href=”mailto:joe@openaccessbutton.org”>send it to us</a>.
</p>
<h3>Multiple Accounts</h3>
<p>
You can have as many InstantILL accounts as you need. This can be helpful for embedding InstantILL into different places (e.g homepage, link resolver, ILL page) with different settings.
</p>
<h3>Emails to Authors</h3>
<p>
To lower the cost of Interlibrary Loan, and make more articles freely available to everyone, when ILLs are submitted through InstantILL we reach out to the authors of those articles to ask them to make them Open Access.
</p>
<p>
We do this on your behalf, as we have done for years for users of the Open Access Button. The current text of emails we send can be found <a href="https://docs.google.com/document/d/1Kh7Smw0nchvFnfhaglNkPc6aJoJV1j0sooKY-enMhhE/edit?usp=sharing" class="green">here</a>.
</p>
<p>
To protect patron privacy, we won't:
<ul>
<li>Include patron names, or details, in emails (we don't even know them!)</li>
<li>Contact authors several times from the same institution within three months</li>
<li>Contact authors at the same institution as it's being sent from</li>
</ul>
</p>
<p>
If you have any questions or concerns about this, you can <a href="joe@openaccessbutton.org">email us</a>.
</p>
<p><b>
If you'd prefer we didn't make work Open Access on your behalf, you can do that below.
</b></p>
<p>
<input id="requests_off" type="checkbox" class="setting green">
Do not generate Open Access Button requests
</p>
</div>
<div id="prev_start_continue" class="greenery">
<p id="previewer" style="display:none;"><a class="btn btn-demo-green preview" href="#">Preview</a></p>
<p><a id="startsave" class="btn btn-hollow-green view" href="#">Get Started</a></p> <!-- becomes Save & Continue -->
<p><a class="green" href="/feedback#general">Feedback</a> | <a class="green view" href="#faq">FAQ</a> | <a class="green" href="/feedback#bug"> Report Issue</a></p>
</div>
</div>
</div>
<div id="faq" class="row full skip section">
<div class="col-md-6 col-md-offset-1 content">
<h1 style="text-align:left;margin-top:25px;margin-bottom:25px;font-size:4em;">FAQ</h1>
<h1>Contents</h1>
<p>1. How, generally, does InstantILL work?</p>
<p>2. What systems do you work with?</p>
<p>3. How do you find my subscriptions?</p>
<p>4. How do you find Open Access?</p>
<p>5. How do you find article metadata?</p>
<p>6. How do you submit ILLs?</p>
<p>7. How much OA can I expect to find?</p>
<p>8. How do you decide what links to Open Access / Subscriptions to provide?</p>
<p>9. Where do I put InstantILL?</p>
<p>10. How can I be sure InstantILL is sustainable?</p>
<p>11. Who's using InstantILL?</p>
<p>12. What's on the roadmap?</p>
<p>13. Can I alter the text of InstantILL?</p>
<p>14. Is InstantILL a link resolver?</p>
<p>15. How do you handle our patrons data?</p>
<br /><br />
<h1>1. How, generally, does InstantILL work?</h1>
<p>A brief overview can be found <a href="https://blog.openaccessbutton.org/instantill-is-being-rolled-out-at-iupui-heres-how-it-works-8103a096df0d">here</a>. A deeper dive can be found <a href="https://scholarworks.iupui.edu/bitstream/handle/1805/20422/07-PAXTON.pdf?sequence=1&isAllowed=y">here</a>.</p>
<h1>2. What systems do you work with?</h1>
<p>See the <a href="https://dev.openaccessbutton.org/instantill/setup#compatibility">compatibility list</a>.</p>
<h1>3. How do you find my subscriptions?</h1>
<p>Our goal is to find what you have subscribed to and be able to direct users on or off campus to a full-text link.</p>
<p>We understand your holdings by integrating with your link resolver. If it says you have access, we tell the patron that you do, and we provide them with the link. This means that you handle authentication, you don't have another system to maintain, and only you know what your patron is accessing. To set this up, all we need is your link resolver URL.</p>
<h1>4. How do you find Open Access?</h1>
<p>Sometimes, patrons need help finding an accessible copy. If there is an open access copy, we'll use the Open Access Button API to give immediate access and provide clear instructions on how it can and can't be used. We've been pioneers in discovering and delivering open access copies, and our content comes only from legal aggregators such as Unpaywall, DOAJ, and <a href="https://openaccessbutton.org/about#sources">many more</a>.</p>
<p>Our sources include all of the aggregated repositories in the world, hybrid articles, open access journals, and those on authors' personal pages. We don't use content from ResearchGate or Academia.edu.</p>
<h1>5. How do you find article metadata?</h1>
<p>Our goal is to identify, from reliable sources, metadata about articles so we can give ILL teams (and other services) everything they need to know. We do that using a similar approach and <a href="https://openaccessbutton.org/about#sources">sources that we use for finding Open Access</a>, plus Crossref.</p>
<h1>6. How do you submit ILLs?</h1>
<p>Our goal is to streamline the submission of your ILL forms without you needing to change systems or do complex integrations.</p>
<p>InstantILL works with your existing ILL systems to create requests in one of three ways. The primary method is to use a flexible OpenURL (or URL parameters, where article information is communicated through the URL), commonly supported in library systems, to send patrons to your existing ILL form with all the required fields filled out for confirmation. This means your existing ILL system handles login, submission, payment, and fulfillment, and as we never want to handle your patrons' information. If your patrons submit requests via email instead of a form, InstantILL can submit requests to any email address. Lastly, we provide a free, documented API that your technical staff can use to integrate with your ILL system.</p>
<p>Soon, we hope to do deep integrations over APIs with ILL systems to enable users to submit requests directly through our streamlined UI.</p>
<h1>7. How much OA can I expect to find?</h1>
<p>In short, an increasing amount. It depends on what your patrons read, what you subscribe to, and how you configure your systems to access the content. There is no one-size-fits-all answer. We've seen as <a href="https://pdxscholar.library.pdx.edu/cgi/viewcontent.cgi?article=1276&context=ulib_fac">high as 23%</a> and <a href="https://blog.openaccessbutton.org/what-weve-been-doing-to-understand-how-to-put-open-access-into-ill-5d4b9a3e89e3">as low as 5%</a>. We consider 10% to be a reasonable guess, and we <a href="https://openaccessbutton.org/oasheet">built OAsheets so you can get an exact answer</a>. However, what we know is that <a href="https://blog.ourresearch.org/future-oa-key-findings/">more and more articles will be Open Access</a>, so this is increasingly important to take into account.</p>
<h1>8. How do you decide what links to Open Access / Subscriptions to provide?</h1>
<p>If we find you have subscribed access to something, we'll provide that even if we find an open access version. With both subscribed and open access content, we try to provide links directly to full text (i.e. avoiding splash pages).</p>
<h1>9. Where do I put InstantILL?</h1>
<p>Wherever you want your Interlibrary Loan form. Anywhere you can put a couple of lines of code InstantILL can be integrated. This means it can be put:</p>
<ul>
<li>On your ILL information pages</li>
<li>Inside your current ILL system</li>
<li>Inside your library search</li>
<li>On a link resolver page</li>
<li>On an alternative access page</li>
<li>Into the middle of a workflow (e.g. Link resolver to ILL form)</li>
</ul>
<p>And more.</p>
<h1>10. How can I be sure InstantILL is sustainable?</h1>
<p>A focus on sustainability is essential for open-source community-owned projects, and it's something that we have given a lot of thought to. While we keep a version of InstantILL free for anyone to use in order to serve our mission, we offer a paid service and strongly recommend that institutions concerned about the sustainability of the tool pay to ensure it is. Details of what you'll get in return can be found at <a href="https://instantill.org/leadership">InstantILL.org/leadership</a>. Even for those who pay, we're committed to creating more cost savings for institutions than we request back in financial support.</p>
<p>If we're not able to sustain the tool, then our <a href="https://openaccessbutton.org/contingency-and-succession-plan">contingency and succession plan</a> will come into effect.</p>
<h1>11. Who's using InstantILL?</h1>
<p>We partnered with IUPUI to be the first to rollout InstantILL. In late 2019, we started a beta where others could implement it. With over 400 institutions on the waiting list for InstantILL, we expect many campuses to be using it soon.</p>
<p>Soon, we'll have examples for you to see and people you can contact to discuss experiences with InstantILL.</p>
<h1>12. What's on the roadmap?</h1>
<p>We're continuing to build out features from your requests and user feedback — for example, supporting purchase on demand, using InstantILL as a replacement for link resolvers/library search, and enabling InstantILL to help authors make their work open access. You can track what we're planning on <a href="https://github.com/oaworks/discussion/issues?q=is%3Aopen+is%3Aissue+label%3A%221.+InstantILL%22+sort%3Aupdated-desc">Github</a>, where we openly discuss issues and enhancements to make.</p>
<h1>13. Can I alter the text of InstantILL?</h1>
<p>The goal of InstantILL's copy is to succinctly and simply explain to an end-user how to use the tool, while ensuring users understand what they're receiving. To this end, we work with experts in website copywriting and librarians, we test directly with users (through user testing), and we review real usage data. This means any sentence you see in InstantILL has likely undergone dozens of revisions and benefits from hours of real work testing. This often results in counter-intuitive results, but ones that work.</p>
<p>Copy is automatically customized to meet major use cases (e.g placement on front pages, link resolvers, ILL forms, etc.), significant settings changes (e.g enabling forms for books, changing ILL price and delivery times), and regional differences.</p>
<p>Generally, we don't allow individual libraries to further customize copy for their version given the above process helping ensure high quality and consistent copy for users while ensuring we can build and maintain InstantILL for a broad audience at a low cost without individual libraries needing to manage updates. However, we gratefully accept feedback and suggestions, and where we see strong ideas or frequent issues, we'll ensure they're resolved through the process above.</p>
<p>If you want deeply customized copy, you're welcome to use our APIs and code to replicate the functionality with your own preferences.</p>
<h1>14. Is InstantILL a link resolver?</h1>
<p>InstantILL is a next generation Interlibrary Loan form with a strong focus on excellent user interfaces and experience. It delivers accessible content immediately, while streamlining Interlibrary Loan requesting and management. As we speak with the library community we're hearing that it feels similar to a link resolver, and we're exploring if there is a strong desire to actively cultivate that.</p>
<p>Currently, we don't consider InstantILL a fully fledged link resolver because it can't directly manage what you do or don't subscribe to. We use your existing Link Resolver for that. However, we can:</p>
<ul>
<li>Be integrated into databases via OpenURL</li>
<li>Streamline access to research articles through subscriptions, Open Access, and interlibrary loan</li>
<li>Provide a new user interface for your current link resolver</li>
<li>Be placed between your current link resolver and ILL form to ensure patrons don't submit ILL requests for available content.</li>
</ul>
<h1>15. How do you protect our patrons' privacy?</h1>
<p>We value, and are strong advocates for, privacy. We don't want your patrons' data, and so we build products and business models that don't rely on collecting it.</p>
<p>Whenever possible, we try not to collect data on who's using InstantILL, for example we rely on your authentication systems to log patrons in. The one exception to this is when ILLs are submitted over email, where we ask for a patron's email so the library can contact them.</p>
<p>Analytics provided through InstantILL only give aggregated figures on how many searches have been done, and what their outcome was.</p>
<p>You can find more in our <a href="https://openaccessbutton.org/privacy">privacy policy</a>, and <a href="https://openaccessbutton.org/terms">terms of use</a>. If you have concerns, let us know.</p>
</div>
<div id="issues" class="settings col-md-4 col-md-offset-1 green">
<div class="greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Not got your question answered?</h2>
<p>
Drop <a href="mailto:Joe@openaccessbutton.org" class="green">Joe@openaccessbutton.org</a> an email.
</p>
<h2>Think you've found an issue?</h2>
<p>
Report it <a href="/feedback#bug" class="green">here</a>.
</p>
</div>
<div class="greenery">
<p><a class="btn btn-demo-green view" href="#menu">Go to Menu</a></p>
<p><a class="green" href="/feedback#general">Feedback</a> | <a class="green view" href="#faq">FAQ</a> | <a class="green" href="/feedback#bug"> Report Issue</a></p>
</div>
</div>
</div>
<div id="compatibility" class="row full skip section">
<div class="col-md-6 col-md-offset-1 content">
<h1 style="text-align:left;margin-top:25px;margin-bottom:25px;font-size:3em;">Compatibility</h1>
<h2>Supported systems</h2>
<p>
<b>ILL</b>
<ul>
<li>ILLiad</li>
<li>Relais ILL</li>
<li>Tipasa</li>
<li>Worldshare</li>
<li>Email</li>
</ul>
</p>
<p>
<b>Subscriptions</b>
<ul>
<li>Serial Solutions</li>
<li>EBSCO Full Text Finder</li>
<li>SFX</li>
</ul>
</p>
<h2>Soon to be supported systems</h2>
<p>
<li>Primo</li>
<li>Alma</li>
</p>
<h2>I don't see my system...</h2>
<p>
That doesn't mean InstantILL won't work for you! InstantILL can submit ILL's to most systems that can fill forms with OpenURL. Even if not all the integrations work, that mean InstantILL can't still provide significant value.
</p>
<p>
If you find your system works, <a href="mailto:joe@openaccessbutton.org">let us know</a>, and we'll add it to supported systems.
</p>
<p>
Our hope is that InstantILL will support all major, or open, library systems.
</p>
</div>
<div class="settings col-md-4 col-md-offset-1 green">
<div class="greenery">
<p><a class="green view restart" href="#menu"><span class="glyphicon glyphicon-arrow-left"></span> Go to Menu</a></p>
<h2>Need help?</h2>
<p>
Drop <a href="mailto:Joe@openaccessbutton.org" class="green">Joe@openaccessbutton.org</a> an email.
</p>
</div>
<div class="greenery">
<p><a class="btn btn-demo-green view" href="#menu">Go to Menu</a></p>
<p><a class="green" href="/feedback#general">Feedback</a> | <a class="green view" href="#faq">FAQ</a> | <a class="green" href="/feedback#bug"> Report Issue</a></p>
</div>
</div>
</div>
</div>
<script src="/static/embed/oab_embed.js"></script>
<script>
_oab = instantill({api: api, css: false, pushstate: false});
// uid:(api.indexOf('dev.') !== -1 ? 'qZooaHWRz9NLFNcgR' : 'eZwJ83xp3oZDaec86'),
var addsubscription = function(e) {
try {e.preventDefault(); } catch(err) {}
if ($('.subscription').last().val() && $('.subscription_type').last().val()) {
$('.subscription').last().clone().val('').insertBefore($('#addsubscription'));
$('.subscription_type').last().clone().val('').insertBefore($('#addsubscription'));
} else {
$('.subscription').last().focus();
}
};
$('body').on('click','#addsubscription',addsubscription);
var guesssubscription = function(e) {
if ($(this).val().indexOf('sfx.') !== -1) {
$(this).next('.subscription_type').val('sfx');
} else if ($(this).val().indexOf('ebscohost.') !== -1) {
$(this).next('.subscription_type').val('eds');
} else if ($(this).val().indexOf('serialssolutions.') !== -1) {
$(this).next('.subscription_type').val('serialssolutions');
} else if ($(this).val().indexOf('.exlibris') !== -1) {
$(this).next('.subscription_type').val('exlibris');
}
};
$('body').on('keyup','.subscription',guesssubscription);
</script>
<script src="/static/embed/oab_embed_ui.js"></script>
<script async defer src="https://sa.instantill.org/latest.js"></script>
<noscript><img src="https://sa.instantill.org/noscript.gif" alt=""/></noscript>
| {
"content_hash": "6631835dddada6a6aad1a9c2129081e6",
"timestamp": "",
"source": "github",
"line_count": 861,
"max_line_length": 824,
"avg_line_length": 52.53658536585366,
"alnum_prop": 0.6381482955299111,
"repo_name": "OAButton/website",
"id": "b4b87a80ea00a34728981bfd4482ded753572505",
"size": "45278",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "content/instantill/setup.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "21774"
},
{
"name": "CoffeeScript",
"bytes": "383374"
},
{
"name": "HTML",
"bytes": "881121"
},
{
"name": "JavaScript",
"bytes": "421255"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Fri Aug 28 09:51:24 EDT 2015 -->
<title>ResourceWatcher (apache-cassandra API)</title>
<meta name="date" content="2015-08-28">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ResourceWatcher (apache-cassandra API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ResourceWatcher.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/cassandra/utils/PureJavaCrc32.html" title="class in org.apache.cassandra.utils"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../org/apache/cassandra/utils/ResourceWatcher.WatchedResource.html" title="class in org.apache.cassandra.utils"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/cassandra/utils/ResourceWatcher.html" target="_top">Frames</a></li>
<li><a href="ResourceWatcher.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.cassandra.utils</div>
<h2 title="Class ResourceWatcher" class="title">Class ResourceWatcher</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.cassandra.utils.ResourceWatcher</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">ResourceWatcher</span>
extends java.lang.Object</pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/utils/ResourceWatcher.WatchedResource.html" title="class in org.apache.cassandra.utils">ResourceWatcher.WatchedResource</a></span></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/utils/ResourceWatcher.html#ResourceWatcher--">ResourceWatcher</a></span>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/cassandra/utils/ResourceWatcher.html#watch-java.lang.String-java.lang.Runnable-int-">watch</a></span>(java.lang.String resource,
java.lang.Runnable callback,
int period)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="ResourceWatcher--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ResourceWatcher</h4>
<pre>public ResourceWatcher()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="watch-java.lang.String-java.lang.Runnable-int-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>watch</h4>
<pre>public static void watch(java.lang.String resource,
java.lang.Runnable callback,
int period)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ResourceWatcher.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/cassandra/utils/PureJavaCrc32.html" title="class in org.apache.cassandra.utils"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../org/apache/cassandra/utils/ResourceWatcher.WatchedResource.html" title="class in org.apache.cassandra.utils"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/cassandra/utils/ResourceWatcher.html" target="_top">Frames</a></li>
<li><a href="ResourceWatcher.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2015 The Apache Software Foundation</small></p>
</body>
</html>
| {
"content_hash": "4288a5d522a5890192123734e8166428",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 389,
"avg_line_length": 35.932203389830505,
"alnum_prop": 0.6410377358490567,
"repo_name": "mitch-kyle/message-board",
"id": "cc2411f455ee1ad5597cc491ab568e560988e294",
"size": "10600",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "support/apache-cassandra-2.2.1/javadoc/org/apache/cassandra/utils/ResourceWatcher.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "38895"
},
{
"name": "CSS",
"bytes": "436"
},
{
"name": "HTML",
"bytes": "2427"
},
{
"name": "JavaScript",
"bytes": "7435"
},
{
"name": "PowerShell",
"bytes": "39336"
},
{
"name": "Python",
"bytes": "413224"
},
{
"name": "Shell",
"bytes": "60549"
},
{
"name": "Thrift",
"bytes": "40282"
}
],
"symlink_target": ""
} |
/*
* 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 code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.youtube.model;
/**
* DEPRECATED Region restriction of the video.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the YouTube Data API v3. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class VideoContentDetailsRegionRestriction extends com.google.api.client.json.GenericJson {
/**
* A list of region codes that identify countries where the video is viewable. If this property is
* present and a country is not listed in its value, then the video is blocked from appearing in
* that country. If this property is present and contains an empty list, the video is blocked in
* all countries.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> allowed;
/**
* A list of region codes that identify countries where the video is blocked. If this property is
* present and a country is not listed in its value, then the video is viewable in that country.
* If this property is present and contains an empty list, the video is viewable in all countries.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> blocked;
/**
* A list of region codes that identify countries where the video is viewable. If this property is
* present and a country is not listed in its value, then the video is blocked from appearing in
* that country. If this property is present and contains an empty list, the video is blocked in
* all countries.
* @return value or {@code null} for none
*/
public java.util.List<java.lang.String> getAllowed() {
return allowed;
}
/**
* A list of region codes that identify countries where the video is viewable. If this property is
* present and a country is not listed in its value, then the video is blocked from appearing in
* that country. If this property is present and contains an empty list, the video is blocked in
* all countries.
* @param allowed allowed or {@code null} for none
*/
public VideoContentDetailsRegionRestriction setAllowed(java.util.List<java.lang.String> allowed) {
this.allowed = allowed;
return this;
}
/**
* A list of region codes that identify countries where the video is blocked. If this property is
* present and a country is not listed in its value, then the video is viewable in that country.
* If this property is present and contains an empty list, the video is viewable in all countries.
* @return value or {@code null} for none
*/
public java.util.List<java.lang.String> getBlocked() {
return blocked;
}
/**
* A list of region codes that identify countries where the video is blocked. If this property is
* present and a country is not listed in its value, then the video is viewable in that country.
* If this property is present and contains an empty list, the video is viewable in all countries.
* @param blocked blocked or {@code null} for none
*/
public VideoContentDetailsRegionRestriction setBlocked(java.util.List<java.lang.String> blocked) {
this.blocked = blocked;
return this;
}
@Override
public VideoContentDetailsRegionRestriction set(String fieldName, Object value) {
return (VideoContentDetailsRegionRestriction) super.set(fieldName, value);
}
@Override
public VideoContentDetailsRegionRestriction clone() {
return (VideoContentDetailsRegionRestriction) super.clone();
}
}
| {
"content_hash": "64297debf509964a61781b6e5606e4f1",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 182,
"avg_line_length": 42.819047619047616,
"alnum_prop": 0.734653024911032,
"repo_name": "googleapis/google-api-java-client-services",
"id": "babf04874adfddfdda916a0df99ac18d8ebde8ea",
"size": "4496",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "clients/google-api-services-youtube/v3/2.0.0/com/google/api/services/youtube/model/VideoContentDetailsRegionRestriction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
"""Tests boosted_trees prediction kernels."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from google.protobuf import text_format
from tensorflow.core.kernels.boosted_trees import boosted_trees_pb2
from tensorflow.python.framework import test_util
from tensorflow.python.ops import boosted_trees_ops
from tensorflow.python.ops import resources
from tensorflow.python.platform import googletest
class TrainingPredictionOpsTest(test_util.TensorFlowTestCase):
"""Tests prediction ops for training."""
def testCachedPredictionOnEmptyEnsemble(self):
"""Tests that prediction on a dummy ensemble does not fail."""
with self.test_session() as session:
# Create a dummy ensemble.
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto='')
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
# No previous cached values.
cached_tree_ids = [0, 0]
cached_node_ids = [0, 0]
# We have two features: 0 and 1. Values don't matter here on a dummy
# ensemble.
feature_0_values = [67, 5]
feature_1_values = [9, 17]
# Grow tree ensemble.
predict_op = boosted_trees_ops.training_predict(
tree_ensemble_handle,
cached_tree_ids=cached_tree_ids,
cached_node_ids=cached_node_ids,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits_updates, new_tree_ids, new_node_ids = session.run(predict_op)
# Nothing changed.
self.assertAllClose(cached_tree_ids, new_tree_ids)
self.assertAllClose(cached_node_ids, new_node_ids)
self.assertAllClose([[0], [0]], logits_updates)
def testNoCachedPredictionButTreeExists(self):
"""Tests that predictions are updated once trees are added."""
with self.test_session() as session:
tree_ensemble_config = boosted_trees_pb2.TreeEnsemble()
text_format.Merge("""
trees {
nodes {
bucketized_split {
feature_id: 0
threshold: 15
left_id: 1
right_id: 2
}
metadata {
gain: 7.62
}
}
nodes {
leaf {
scalar: 1.14
}
}
nodes {
leaf {
scalar: 8.79
}
}
}
tree_weights: 0.1
tree_metadata {
is_finalized: true
num_layers_grown: 1
}
growing_metadata {
num_trees_attempted: 1
num_layers_attempted: 2
}
""", tree_ensemble_config)
# Create existing ensemble with one root split
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto=tree_ensemble_config.SerializeToString())
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
# Two examples, none were cached before.
cached_tree_ids = [0, 0]
cached_node_ids = [0, 0]
feature_0_values = [67, 5]
# Grow tree ensemble.
predict_op = boosted_trees_ops.training_predict(
tree_ensemble_handle,
cached_tree_ids=cached_tree_ids,
cached_node_ids=cached_node_ids,
bucketized_features=[feature_0_values],
logits_dimension=1)
logits_updates, new_tree_ids, new_node_ids = session.run(predict_op)
# We are in the first tree.
self.assertAllClose([0, 0], new_tree_ids)
self.assertAllClose([2, 1], new_node_ids)
self.assertAllClose([[0.1 * 8.79], [0.1 * 1.14]], logits_updates)
def testCachedPredictionIsCurrent(self):
"""Tests that prediction based on previous node in the tree works."""
with self.test_session() as session:
tree_ensemble_config = boosted_trees_pb2.TreeEnsemble()
text_format.Merge("""
trees {
nodes {
bucketized_split {
feature_id: 1
threshold: 15
left_id: 1
right_id: 2
}
metadata {
gain: 7.62
original_leaf {
scalar: -2
}
}
}
nodes {
leaf {
scalar: 1.14
}
}
nodes {
leaf {
scalar: 8.79
}
}
}
tree_weights: 0.1
tree_metadata {
is_finalized: true
num_layers_grown: 2
}
growing_metadata {
num_trees_attempted: 1
num_layers_attempted: 2
}
""", tree_ensemble_config)
# Create existing ensemble with one root split
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto=tree_ensemble_config.SerializeToString())
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
# Two examples, one was cached in node 1 first, another in node 0.
cached_tree_ids = [0, 0]
cached_node_ids = [1, 2]
# We have two features: 0 and 1. Values don't matter because trees didn't
# change.
feature_0_values = [67, 5]
feature_1_values = [9, 17]
# Grow tree ensemble.
predict_op = boosted_trees_ops.training_predict(
tree_ensemble_handle,
cached_tree_ids=cached_tree_ids,
cached_node_ids=cached_node_ids,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits_updates, new_tree_ids, new_node_ids = session.run(predict_op)
# Nothing changed.
self.assertAllClose(cached_tree_ids, new_tree_ids)
self.assertAllClose(cached_node_ids, new_node_ids)
self.assertAllClose([[0], [0]], logits_updates)
def testCachedPredictionFromTheSameTree(self):
"""Tests that prediction based on previous node in the tree works."""
with self.test_session() as session:
tree_ensemble_config = boosted_trees_pb2.TreeEnsemble()
text_format.Merge("""
trees {
nodes {
bucketized_split {
feature_id: 1
threshold: 15
left_id: 1
right_id: 2
}
metadata {
gain: 7.62
original_leaf {
scalar: -2
}
}
}
nodes {
bucketized_split {
feature_id: 1
threshold: 7
left_id: 3
right_id: 4
}
metadata {
gain: 1.4
original_leaf {
scalar: 7.14
}
}
}
nodes {
bucketized_split {
feature_id: 0
threshold: 7
left_id: 5
right_id: 6
}
metadata {
gain: 2.7
original_leaf {
scalar: -4.375
}
}
}
nodes {
leaf {
scalar: 1.14
}
}
nodes {
leaf {
scalar: 8.79
}
}
nodes {
leaf {
scalar: -5.875
}
}
nodes {
leaf {
scalar: -2.075
}
}
}
tree_weights: 0.1
tree_metadata {
is_finalized: true
num_layers_grown: 2
}
growing_metadata {
num_trees_attempted: 1
num_layers_attempted: 2
}
""", tree_ensemble_config)
# Create existing ensemble with one root split
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto=tree_ensemble_config.SerializeToString())
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
# Two examples, one was cached in node 1 first, another in node 0.
cached_tree_ids = [0, 0]
cached_node_ids = [1, 0]
# We have two features: 0 and 1.
feature_0_values = [67, 5]
feature_1_values = [9, 17]
# Grow tree ensemble.
predict_op = boosted_trees_ops.training_predict(
tree_ensemble_handle,
cached_tree_ids=cached_tree_ids,
cached_node_ids=cached_node_ids,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits_updates, new_tree_ids, new_node_ids = session.run(predict_op)
# We are still in the same tree.
self.assertAllClose([0, 0], new_tree_ids)
# When using the full tree, the first example will end up in node 4,
# the second in node 5.
self.assertAllClose([4, 5], new_node_ids)
# Full predictions for each instance would be 8.79 and -5.875,
# so an update from the previous cached values lr*(7.14 and -2) would be
# 1.65 and -3.875, and then multiply them by 0.1 (lr)
self.assertAllClose([[0.1 * 1.65], [0.1 * -3.875]], logits_updates)
def testCachedPredictionFromPreviousTree(self):
"""Tests the predictions work when we have cache from previous trees."""
with self.test_session() as session:
tree_ensemble_config = boosted_trees_pb2.TreeEnsemble()
text_format.Merge("""
trees {
nodes {
bucketized_split {
feature_id: 1
threshold: 28
left_id: 1
right_id: 2
}
metadata {
gain: 7.62
}
}
nodes {
leaf {
scalar: 1.14
}
}
nodes {
leaf {
scalar: 8.79
}
}
}
trees {
nodes {
bucketized_split {
feature_id: 1
threshold: 26
left_id: 1
right_id: 2
}
}
nodes {
bucketized_split {
feature_id: 0
threshold: 50
left_id: 3
right_id: 4
}
}
nodes {
leaf {
scalar: 7
}
}
nodes {
leaf {
scalar: 5
}
}
nodes {
leaf {
scalar: 6
}
}
}
trees {
nodes {
bucketized_split {
feature_id: 0
threshold: 34
left_id: 1
right_id: 2
}
}
nodes {
leaf {
scalar: -7.0
}
}
nodes {
leaf {
scalar: 5.0
}
}
}
tree_metadata {
is_finalized: true
}
tree_metadata {
is_finalized: true
}
tree_metadata {
is_finalized: false
}
tree_weights: 0.1
tree_weights: 0.1
tree_weights: 0.1
""", tree_ensemble_config)
# Create existing ensemble with one root split
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto=tree_ensemble_config.SerializeToString())
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
# Two examples, one was cached in node 1 first, another in node 2.
cached_tree_ids = [0, 0]
cached_node_ids = [1, 0]
# We have two features: 0 and 1.
feature_0_values = [36, 32]
feature_1_values = [11, 27]
# Grow tree ensemble.
predict_op = boosted_trees_ops.training_predict(
tree_ensemble_handle,
cached_tree_ids=cached_tree_ids,
cached_node_ids=cached_node_ids,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits_updates, new_tree_ids, new_node_ids = session.run(predict_op)
# Example 1 will get to node 3 in tree 1 and node 2 of tree 2
# Example 2 will get to node 2 in tree 1 and node 1 of tree 2
# We are in the last tree.
self.assertAllClose([2, 2], new_tree_ids)
# When using the full tree, the first example will end up in node 4,
# the second in node 5.
self.assertAllClose([2, 1], new_node_ids)
# Example 1: tree 0: 8.79, tree 1: 5.0, tree 2: 5.0 = >
# change = 0.1*(5.0+5.0)
# Example 2: tree 0: 1.14, tree 1: 7.0, tree 2: -7 = >
# change= 0.1(1.14+7.0-7.0)
self.assertAllClose([[1], [0.114]], logits_updates)
def testCachedPredictionFromTheSameTreeWithPostPrunedNodes(self):
"""Tests that prediction based on previous node in the tree works."""
with self.test_session() as session:
tree_ensemble_config = boosted_trees_pb2.TreeEnsemble()
text_format.Merge("""
trees {
nodes {
bucketized_split {
feature_id:0
threshold: 33
left_id: 1
right_id: 2
}
metadata {
gain: -0.2
}
}
nodes {
leaf {
scalar: 0.01
}
}
nodes {
bucketized_split {
feature_id: 1
threshold: 5
left_id: 3
right_id: 4
}
metadata {
gain: 0.5
original_leaf {
scalar: 0.0143
}
}
}
nodes {
leaf {
scalar: 0.0553
}
}
nodes {
leaf {
scalar: 0.0783
}
}
}
tree_weights: 1.0
tree_metadata {
num_layers_grown: 3
is_finalized: true
post_pruned_nodes_meta {
new_node_id: 0
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 2
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: -0.07
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: -0.083
}
post_pruned_nodes_meta {
new_node_id: 3
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 4
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: -0.22
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: -0.57
}
}
growing_metadata {
num_trees_attempted: 1
num_layers_attempted: 3
}
""", tree_ensemble_config)
# Create existing ensemble.
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto=tree_ensemble_config.SerializeToString())
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
cached_tree_ids = [0, 0, 0, 0, 0, 0]
# Leaves 3,4, 7 and 8 got deleted during post-pruning, leaves 5 and 6
# changed the ids to 3 and 4 respectively.
cached_node_ids = [3, 4, 5, 6, 7, 8]
# We have two features: 0 and 1.
feature_0_values = [12, 17, 35, 36, 23, 11]
feature_1_values = [12, 12, 17, 18, 123, 24]
# Grow tree ensemble.
predict_op = boosted_trees_ops.training_predict(
tree_ensemble_handle,
cached_tree_ids=cached_tree_ids,
cached_node_ids=cached_node_ids,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits_updates, new_tree_ids, new_node_ids = session.run(predict_op)
# We are still in the same tree.
self.assertAllClose([0, 0, 0, 0, 0, 0], new_tree_ids)
# Examples from leaves 3,4,7,8 should be in leaf 1, examples from leaf 5
# and 6 in leaf 3 and 4.
self.assertAllClose([1, 1, 3, 4, 1, 1], new_node_ids)
cached_values = [[0.08], [0.093], [0.0553], [0.0783], [0.15 + 0.08],
[0.5 + 0.08]]
self.assertAllClose([[0.01], [0.01], [0.0553], [0.0783], [0.01], [0.01]],
logits_updates + cached_values)
def testCachedPredictionFromThePreviousTreeWithPostPrunedNodes(self):
"""Tests that prediction based on previous node in the tree works."""
with self.test_session() as session:
tree_ensemble_config = boosted_trees_pb2.TreeEnsemble()
text_format.Merge("""
trees {
nodes {
bucketized_split {
feature_id:0
threshold: 33
left_id: 1
right_id: 2
}
metadata {
gain: -0.2
}
}
nodes {
leaf {
scalar: 0.01
}
}
nodes {
bucketized_split {
feature_id: 1
threshold: 5
left_id: 3
right_id: 4
}
metadata {
gain: 0.5
original_leaf {
scalar: 0.0143
}
}
}
nodes {
leaf {
scalar: 0.0553
}
}
nodes {
leaf {
scalar: 0.0783
}
}
}
trees {
nodes {
leaf {
scalar: 0.55
}
}
}
tree_weights: 1.0
tree_weights: 1.0
tree_metadata {
num_layers_grown: 3
is_finalized: true
post_pruned_nodes_meta {
new_node_id: 0
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 2
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: -0.07
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: -0.083
}
post_pruned_nodes_meta {
new_node_id: 3
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 4
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: -0.22
}
post_pruned_nodes_meta {
new_node_id: 1
logit_change: -0.57
}
}
tree_metadata {
num_layers_grown: 1
is_finalized: false
}
growing_metadata {
num_trees_attempted: 2
num_layers_attempted: 4
}
""", tree_ensemble_config)
# Create existing ensemble.
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto=tree_ensemble_config.SerializeToString())
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
cached_tree_ids = [0, 0, 0, 0, 0, 0]
# Leaves 3,4, 7 and 8 got deleted during post-pruning, leaves 5 and 6
# changed the ids to 3 and 4 respectively.
cached_node_ids = [3, 4, 5, 6, 7, 8]
# We have two features: 0 and 1.
feature_0_values = [12, 17, 35, 36, 23, 11]
feature_1_values = [12, 12, 17, 18, 123, 24]
# Grow tree ensemble.
predict_op = boosted_trees_ops.training_predict(
tree_ensemble_handle,
cached_tree_ids=cached_tree_ids,
cached_node_ids=cached_node_ids,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits_updates, new_tree_ids, new_node_ids = session.run(predict_op)
# We are in the last tree.
self.assertAllClose([1, 1, 1, 1, 1, 1], new_tree_ids)
# Examples from leaves 3,4,7,8 should be in leaf 1, examples from leaf 5
# and 6 in leaf 3 and 4 in tree 0. For tree 1, all of the examples are in
# the root node.
self.assertAllClose([0, 0, 0, 0, 0, 0], new_node_ids)
cached_values = [[0.08], [0.093], [0.0553], [0.0783], [0.15 + 0.08],
[0.5 + 0.08]]
root = 0.55
self.assertAllClose([[root + 0.01], [root + 0.01], [root + 0.0553],
[root + 0.0783], [root + 0.01], [root + 0.01]],
logits_updates + cached_values)
def testCachedPredictionTheWholeTreeWasPruned(self):
"""Tests that prediction based on previous node in the tree works."""
with self.test_session() as session:
tree_ensemble_config = boosted_trees_pb2.TreeEnsemble()
text_format.Merge("""
trees {
nodes {
leaf {
scalar: 0.00
}
}
}
tree_weights: 1.0
tree_metadata {
num_layers_grown: 1
is_finalized: true
post_pruned_nodes_meta {
new_node_id: 0
logit_change: 0.0
}
post_pruned_nodes_meta {
new_node_id: 0
logit_change: -6.0
}
post_pruned_nodes_meta {
new_node_id: 0
logit_change: 5.0
}
}
growing_metadata {
num_trees_attempted: 1
num_layers_attempted: 1
}
""", tree_ensemble_config)
# Create existing ensemble.
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto=tree_ensemble_config.SerializeToString())
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
cached_tree_ids = [
0,
0,
]
# The predictions were cached in 1 and 2, both were pruned to the root.
cached_node_ids = [1, 2]
# We have two features: 0 and 1.These are not going to be used anywhere.
feature_0_values = [12, 17]
feature_1_values = [12, 12]
# Grow tree ensemble.
predict_op = boosted_trees_ops.training_predict(
tree_ensemble_handle,
cached_tree_ids=cached_tree_ids,
cached_node_ids=cached_node_ids,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits_updates, new_tree_ids, new_node_ids = session.run(predict_op)
# We are in the last tree.
self.assertAllClose([0, 0], new_tree_ids)
self.assertAllClose([0, 0], new_node_ids)
self.assertAllClose([[-6.0], [5.0]], logits_updates)
class PredictionOpsTest(test_util.TensorFlowTestCase):
"""Tests prediction ops for inference."""
def testPredictionMultipleTree(self):
"""Tests the predictions work when we have multiple trees."""
with self.test_session() as session:
tree_ensemble_config = boosted_trees_pb2.TreeEnsemble()
text_format.Merge("""
trees {
nodes {
bucketized_split {
feature_id: 1
threshold: 28
left_id: 1
right_id: 2
}
metadata {
gain: 7.62
}
}
nodes {
leaf {
scalar: 1.14
}
}
nodes {
leaf {
scalar: 8.79
}
}
}
trees {
nodes {
bucketized_split {
feature_id: 1
threshold: 26
left_id: 1
right_id: 2
}
}
nodes {
bucketized_split {
feature_id: 0
threshold: 50
left_id: 3
right_id: 4
}
}
nodes {
leaf {
scalar: 7.0
}
}
nodes {
leaf {
scalar: 5.0
}
}
nodes {
leaf {
scalar: 6.0
}
}
}
trees {
nodes {
bucketized_split {
feature_id: 0
threshold: 34
left_id: 1
right_id: 2
}
}
nodes {
leaf {
scalar: -7.0
}
}
nodes {
leaf {
scalar: 5.0
}
}
}
tree_weights: 0.1
tree_weights: 0.2
tree_weights: 1.0
""", tree_ensemble_config)
# Create existing ensemble with one root split
tree_ensemble = boosted_trees_ops.TreeEnsemble(
'ensemble', serialized_proto=tree_ensemble_config.SerializeToString())
tree_ensemble_handle = tree_ensemble.resource_handle
resources.initialize_resources(resources.shared_resources()).run()
feature_0_values = [36, 32]
feature_1_values = [11, 27]
# Example 1: tree 0: 1.14, tree 1: 5.0, tree 2: 5.0 = >
# logit = 0.1*5.0+0.2*5.0+1*5
# Example 2: tree 0: 1.14, tree 1: 7.0, tree 2: -7 = >
# logit= 0.1*1.14+0.2*7.0-1*7.0
expected_logits = [[6.114], [-5.486]]
# Do with parallelization, e.g. EVAL
predict_op = boosted_trees_ops.predict(
tree_ensemble_handle,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits = session.run(predict_op)
self.assertAllClose(expected_logits, logits)
# Do without parallelization, e.g. INFER - the result is the same
predict_op = boosted_trees_ops.predict(
tree_ensemble_handle,
bucketized_features=[feature_0_values, feature_1_values],
logits_dimension=1)
logits = session.run(predict_op)
self.assertAllClose(expected_logits, logits)
if __name__ == '__main__':
googletest.main()
| {
"content_hash": "3b9e11bc28e3c1217107be0b1f6f61f4",
"timestamp": "",
"source": "github",
"line_count": 902,
"max_line_length": 80,
"avg_line_length": 29.446784922394677,
"alnum_prop": 0.503708444712172,
"repo_name": "eaplatanios/tensorflow",
"id": "54f33f336015cc9cb50658941b8e157cc1b94df9",
"size": "27250",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tensorflow/python/kernel_tests/boosted_trees/prediction_ops_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "9274"
},
{
"name": "C",
"bytes": "163987"
},
{
"name": "C++",
"bytes": "34944901"
},
{
"name": "CMake",
"bytes": "5123"
},
{
"name": "CSS",
"bytes": "9206"
},
{
"name": "Go",
"bytes": "1047216"
},
{
"name": "HTML",
"bytes": "4680032"
},
{
"name": "Java",
"bytes": "423531"
},
{
"name": "JavaScript",
"bytes": "3127"
},
{
"name": "Jupyter Notebook",
"bytes": "1833814"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "Objective-C",
"bytes": "7056"
},
{
"name": "Objective-C++",
"bytes": "63210"
},
{
"name": "Perl",
"bytes": "6179"
},
{
"name": "Perl 6",
"bytes": "1357"
},
{
"name": "PureBasic",
"bytes": "24932"
},
{
"name": "Python",
"bytes": "19718973"
},
{
"name": "Ruby",
"bytes": "327"
},
{
"name": "Scala",
"bytes": "3606806"
},
{
"name": "Shell",
"bytes": "352897"
},
{
"name": "Smarty",
"bytes": "6870"
}
],
"symlink_target": ""
} |
import { Theme } from './createTheme';
import { Breakpoint } from './createBreakpoints';
import { Variant } from './createTypography';
export interface ResponsiveFontSizesOptions {
breakpoints?: Breakpoint[];
disableAlign?: boolean;
factor?: number;
variants?: Variant[];
}
export default function responsiveFontSizes(
theme: Theme,
options?: ResponsiveFontSizesOptions,
): Theme;
| {
"content_hash": "40b4f767c4363a3a09528345e4afc126",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 49,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.739240506329114,
"repo_name": "cdnjs/cdnjs",
"id": "ca94fecd36328d7d953ce94093501164eb89fce3",
"size": "395",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "ajax/libs/material-ui/5.0.0-alpha.34/styles/responsiveFontSizes.d.ts",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
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. See accompanying LICENSE file.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-project</artifactId>
<version>3.4.0-SNAPSHOT</version>
<relativePath>../../hadoop-project</relativePath>
</parent>
<artifactId>hadoop-client-minicluster</artifactId>
<version>3.4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<description>Apache Hadoop Minicluster for Clients</description>
<name>Apache Hadoop Client Test Minicluster</name>
<properties>
<shaded.dependency.prefix>org.apache.hadoop.shaded</shaded.dependency.prefix>
<!-- We contain no source -->
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-api</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-runtime</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Leave JUnit as a direct dependency -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Adding hadoop-annotations so we can make it optional to remove from our transitive tree -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-annotations</artifactId>
<scope>compile</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- uncomment this dependency if you need to use
`mvn dependency:tree -Dverbose` to determine if a dependency shows up
in both the hadoop-client-* artifacts and something under minicluster.
-->
<!--
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<scope>provided</scope>
</dependency>
-->
<!-- Anything we're going to include in the relocated jar we list as optional
in order to work around MNG-5899
-->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minicluster</artifactId>
<optional>true</optional>
<exclusions>
<!-- exclude everything that comes in via the shaded runtime and api TODO remove once we have a filter for "is in these artifacts" -->
<!-- Skip jersey, since we need it again here. -->
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-app</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
</exclusion>
<!-- exclude things that came in via transitive in shaded runtime and api -->
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-common</artifactId>
</exclusion>
<exclusion>
<groupId>${leveldbjni.group}</groupId>
<artifactId>leveldbjni-all</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</exclusion>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
<!-- removing dependency jars from yarn-server-common, which are
already included in hadoop-client-runtime and hadoop-client-api
-->
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-auth</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
</exclusion>
<exclusion>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</exclusion>
<exclusion>
<groupId>net.minidev</groupId>
<artifactId>accessors-smart</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-simplekdc</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-util</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>token-provider</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-crypto</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerby-util</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerby-pkix</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerby-asn1</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerby-config</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerby-xdr</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-identity</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-server</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-identity</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kerby</groupId>
<artifactId>kerb-admin</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</exclusion>
<exclusion>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
</exclusion>
<exclusion>
<groupId>dnsjava</groupId>
<artifactId>dnsjava</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop.thirdparty</groupId>
<artifactId>hadoop-shaded-guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Add optional runtime dependency on the in-development timeline server module
to indicate that downstream folks interested in turning it on need that dep.
-->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-server-timelineservice</artifactId>
<scope>runtime</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Add back in transitive dependencies of hadoop-minicluster that are test-jar artifacts excluded as a side effect of excluding the jar
Note that all of these must be marked "optional" because they won't be removed from the reduced-dependencies pom after they're included.
-->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<scope>compile</scope>
<type>test-jar</type>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<scope>compile</scope>
<type>test-jar</type>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<scope>compile</scope>
<type>test-jar</type>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Add back in Mockito since the hadoop-hdfs test jar needs it. -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<optional>true</optional>
</dependency>
<!-- Add back in the transitive dependencies excluded from hadoop-common in client TODO remove once we have a filter for "is in these artifacts" -->
<!-- skip javax.servlet:servlet-api because it's in client -->
<!-- Skip commons-logging:commons-logging-api because it looks like nothing actually included it -->
<!-- Skip jetty-util because it's in client -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<optional>true</optional>
</dependency>
<!-- skip org.apache.avro:avro-ipc because it doesn't look like hadoop-common actually uses it -->
<dependency>
<groupId>net.sf.kosmosfs</groupId>
<artifactId>kfs</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<optional>true</optional>
</dependency>
<!-- add back in transitive dependencies of hadoop-mapreduce-client-app removed in client -->
<!-- Skipping javax.servlet:servlet-api because it's in client -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-server-nodemanager</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-registry</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-server-common</artifactId>
</exclusion>
<exclusion>
<groupId>${leveldbjni.group}</groupId>
<artifactId>leveldbjni-all</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop.thirdparty</groupId>
<artifactId>hadoop-shaded-guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-server-web-proxy</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-server-common</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop.thirdparty</groupId>
<artifactId>hadoop-shaded-guava</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- skipping hadoop-annotations -->
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<optional>true</optional>
</dependency>
<!-- skipping junit:junit because it is test scope -->
<!-- skipping avro because it is in client via hadoop-common -->
<!-- skipping jline:jline because it is only present at test scope in the original -->
<!-- skipping io.netty:netty because it's in client -->
<!-- add back in transitive dependencies of hadoop-yarn-api removed in client -->
<!-- skipping hadoop-annotations -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly2</artifactId>
<optional>true</optional>
<exclusions>
<!-- excluding because client already has the tomcat version -->
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- skipping jersey-server because it's above -->
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-guice</artifactId>
<optional>true</optional>
</dependency>
<!-- skipping guice-servlet because it's above -->
<!-- skipping avro because it is in client via hadoop-common -->
<!-- skipping jersey-core because it's above -->
<!-- skipping jersey-json because it's above. -->
<!-- skipping io.netty:netty because it's in client -->
<!-- Add back in transitive dependencies from hadoop-mapreduce-client-core that were excluded by client -->
<!-- skipping junit:junit because it is test scope -->
<!-- skipping guice because it's above -->
<!-- skipping jersey-test-framework-grizzly2 because it's above -->
<!-- skipping jersey-server because it's above -->
<!-- skipping jersey-guice because it's above -->
<!-- skipping avro because it is in client via hadoop-common -->
<!-- skipping hadoop-annotations -->
<!-- skipping guice-servlet because it's above -->
<!-- skipping jersey-json because it's above. -->
<!-- skipping io.netty:netty because it's in client -->
<!-- add back in transitive dependencies of hadoop-mapreduce-client-jobclient that were excluded from client -->
<!-- skipping junit:junit because it is test scope -->
<!-- skipping avro because it is in client via hadoop-common -->
<!-- skipping hadoop-annotations -->
<!-- skipping guice-servlet because it's above -->
<!-- skipping io.netty:netty because it's in client -->
</dependencies>
<profiles>
<profile>
<id>shade</id>
<activation>
<property><name>!skipShade</name></property>
</activation>
<build>
<plugins>
<!-- We contain no source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-maven-plugins</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<!-- Fine to expose our already-shaded deps as dependencies -->
<exclude>org.apache.hadoop:hadoop-annotations</exclude>
<exclude>org.apache.hadoop:hadoop-client-api</exclude>
<exclude>org.apache.hadoop:hadoop-client-runtime</exclude>
<!-- Fine to expose our purposefully not-shaded deps as dependencies -->
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>commons-logging:commons-logging</exclude>
<exclude>junit:junit</exclude>
<exclude>com.google.code.findbugs:jsr305</exclude>
<exclude>log4j:log4j</exclude>
<exclude>org.eclipse.jetty.websocket:websocket-common</exclude>
<exclude>org.eclipse.jetty.websocket:websocket-api</exclude>
<!-- We need a filter that matches just those things that are included in the above artiacts -->
<!-- Leave bouncycastle unshaded because it's signed with a special Oracle certificate so it can be a custom JCE security provider -->
<exclude>org.bouncycastle:*</exclude>
</excludes>
</artifactSet>
<filters>
<!-- Some of our dependencies include source, so remove it. -->
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</filter>
<!-- We pull in several test jars; keep out the actual test classes -->
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/Test*.class</exclude>
</excludes>
</filter>
<!-- Since runtime has classes for these jars, we exclude them.
We still want the java services api files, since those were excluded in runtime
-->
<filter>
<artifact>com.sun.jersey:jersey-client</artifact>
<excludes>
<exclude>**/*.class</exclude>
</excludes>
</filter>
<filter>
<artifact>com.sun.jersey:jersey-core</artifact>
<excludes>
<exclude>**/*.class</exclude>
</excludes>
</filter>
<filter>
<artifact>com.sun.jersey:jersey-servlet</artifact>
<excludes>
<exclude>**/*.class</exclude>
</excludes>
</filter>
<filter>
<artifact>org.apache.hadoop:hadoop-mapreduce-client-jobclient:*</artifact>
<excludes>
<exclude>testjar/*</exclude>
<exclude>testshell/*</exclude>
<exclude>testdata/*</exclude>
</excludes>
</filter>
<!-- Mockito tries to include its own unrelocated copy of hamcrest. :( -->
<filter>
<artifact>org.mockito:mockito-core</artifact>
<excludes>
<exclude>asm-license.txt</exclude>
<exclude>cglib-license.txt</exclude>
<exclude>hamcrest-license.txt</exclude>
<exclude>objenesis-license.txt</exclude>
<exclude>org/hamcrest/**/*.class</exclude>
<exclude>org/hamcrest/*.class</exclude>
<exclude>org/objenesis/**/*.class</exclude>
<exclude>org/objenesis/*.class</exclude>
</excludes>
</filter>
<!-- skip grizzly internals we don't need to run. -->
<filter>
<artifact>org.glassfish.grizzly:grizzly-http-servlet</artifact>
<excludes>
<exclude>catalog.cat</exclude>
<exclude>javaee_5.xsd</exclude>
<exclude>javaee_6.xsd</exclude>
<exclude>javaee_web_services_client_1_2.xsd</exclude>
<exclude>javaee_web_services_client_1_3.xsd</exclude>
<exclude>jsp_2_1.xsd</exclude>
<exclude>jsp_2_2.xsd</exclude>
<exclude>web-app_2_5.xsd</exclude>
<exclude>web-app_3_0.xsd</exclude>
<exclude>web-common_3_0.xsd</exclude>
<exclude>xml.xsd</exclude>
</excludes>
</filter>
<filter>
<!-- skip jetty license info already incorporated into LICENSE/NOTICE -->
<artifact>org.eclipse.jetty:*</artifact>
<excludes>
<exclude>about.html</exclude>
</excludes>
</filter>
<filter>
<!-- skip jetty license info already incorporated into LICENSE/NOTICE -->
<artifact>org.eclipse.jetty.websocket:*</artifact>
<excludes>
<exclude>about.html</exclude>
</excludes>
</filter>
<filter>
<artifact>org.apache.hadoop:*</artifact>
<excludes>
<!-- No shipping log4j configs in a downstream facing library -->
<exclude>log4j.properties</exclude>
<exclude>container-log4j.properties</exclude>
<!-- keep optional runtime configuration out of the jar; downstream can provide -->
<exclude>capacity-scheduler.xml</exclude>
<exclude>krb5.conf</exclude>
<exclude>.keep</exclude>
</excludes>
</filter>
<!-- remove .xsd from ehcache -->
<filter>
<artifact>org.ehcache</artifact>
<excludes>
<exclude>ehcache-107ext.xsd</exclude>
<exclude>ehcache-core.xsd</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty.websocket:javax-websocket-server-impl</artifact>
<excludes>
<exclude>*/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty.websocket:websocket-client</artifact>
<excludes>
<exclude>*/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty:jetty-io</artifact>
<excludes>
<exclude>*/**</exclude>
</excludes>
</filter>
<!-- Jetty 9.4.x: jetty-client and jetty-xml are depended by org.eclipse.jetty.websocket:websocket-client.-->
<filter>
<artifact>org.eclipse.jetty:jetty-client</artifact>
<excludes>
<exclude>*/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty:jetty-xml</artifact>
<excludes>
<exclude>*/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty:jetty-http</artifact>
<excludes>
<exclude>*/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty:jetty-util-ajax</artifact>
<excludes>
<exclude>*/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.eclipse.jetty:jetty-server</artifact>
<excludes>
<exclude>jetty-dir.css</exclude>
</excludes>
</filter>
</filters>
<!-- relocate classes from mssql-jdbc -->
<relocations>
<relocation>
<pattern>microsoft/</pattern>
<shadedPattern>${shaded.dependency.prefix}.microsoft.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>org/</pattern>
<shadedPattern>${shaded.dependency.prefix}.org.</shadedPattern>
<excludes>
<exclude>org/apache/hadoop/*</exclude>
<exclude>org/apache/hadoop/**/*</exclude>
<!-- Our non-shaded logging libraries -->
<exclude>org/slf4j/*</exclude>
<exclude>org/slf4j/**/*</exclude>
<exclude>org/apache/commons/logging/*</exclude>
<exclude>org/apache/commons/logging/**/*</exclude>
<exclude>org/apache/log4j/*</exclude>
<exclude>org/apache/log4j/**/*</exclude>
<exclude>**/pom.xml</exclude>
<!-- Our non-shaded JUnit library -->
<exclude>org/junit/*</exclude>
<exclude>org/junit/**/*</exclude>
<!-- Not the org/ packages that are a part of the jdk -->
<exclude>org/ietf/jgss/*</exclude>
<exclude>org/omg/**/*</exclude>
<exclude>org/w3c/dom/*</exclude>
<exclude>org/w3c/dom/**/*</exclude>
<exclude>org/xml/sax/*</exclude>
<exclude>org/xml/sax/**/*</exclude>
<exclude>org/bouncycastle/*</exclude>
<exclude>org/bouncycastle/**/*</exclude>
</excludes>
</relocation>
<relocation>
<pattern>contribs/</pattern>
<shadedPattern>${shaded.dependency.prefix}.contribs.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>com/</pattern>
<shadedPattern>${shaded.dependency.prefix}.com.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
<!-- Not the com/ packages that are a part of particular jdk implementations -->
<exclude>com/sun/tools/*</exclude>
<exclude>com/sun/javadoc/*</exclude>
<exclude>com/sun/security/*</exclude>
<exclude>com/sun/jndi/*</exclude>
<exclude>com/sun/management/*</exclude>
<exclude>com/sun/tools/**/*</exclude>
<exclude>com/sun/javadoc/**/*</exclude>
<exclude>com/sun/security/**/*</exclude>
<exclude>com/sun/jndi/**/*</exclude>
<exclude>com/sun/management/**/*</exclude>
</excludes>
</relocation>
<relocation>
<pattern>io/</pattern>
<shadedPattern>${shaded.dependency.prefix}.io.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
<!-- Exclude config keys for Hadoop that look like package names -->
<exclude>io/compression/*</exclude>
<exclude>io/compression/**/*</exclude>
<exclude>io/mapfile/*</exclude>
<exclude>io/mapfile/**/*</exclude>
<exclude>io/map/index/*</exclude>
<exclude>io/seqfile/*</exclude>
<exclude>io/seqfile/**/*</exclude>
<exclude>io/file/buffer/size</exclude>
<exclude>io/skip/checksum/errors</exclude>
<exclude>io/sort/*</exclude>
<exclude>io/serializations</exclude>
</excludes>
</relocation>
<relocation>
<pattern>javassist/</pattern>
<shadedPattern>${shaded.dependency.prefix}.javassist.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<!-- JSRs that haven't made it to inclusion in J2SE -->
<relocation>
<pattern>javax/el/</pattern>
<shadedPattern>${shaded.dependency.prefix}.javax.el.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>javax/cache/</pattern>
<shadedPattern>${shaded.dependency.prefix}.javax.cache.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>javax/inject/</pattern>
<shadedPattern>${shaded.dependency.prefix}.javax.inject.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>javax/servlet/</pattern>
<shadedPattern>${shaded.dependency.prefix}.javax.servlet.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>javax/ws/</pattern>
<shadedPattern>${shaded.dependency.prefix}.javax.ws.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>javax/websocket/</pattern>
<shadedPattern>${shaded.dependency.prefix}.javax.websocket.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>javax/annotation/</pattern>
<shadedPattern>${shaded.dependency.prefix}.javax.websocket.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>jersey/</pattern>
<shadedPattern>${shaded.dependency.prefix}.jersey.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
</excludes>
</relocation>
<relocation>
<pattern>net/</pattern>
<shadedPattern>${shaded.dependency.prefix}.net.</shadedPattern>
<excludes>
<exclude>**/pom.xml</exclude>
<!-- Exclude config keys for Hadoop that look like package names -->
<exclude>net/topology/*</exclude>
<exclude>net/topology/**/*</exclude>
</excludes>
</relocation>
<!-- okio declares a top level package instead of nested -->
<relocation>
<pattern>okio/</pattern>
<shadedPattern>${shaded.dependency.prefix}.okio.</shadedPattern>
</relocation>
</relocations>
<transformers>
<!-- Needed until MSHADE-182 -->
<transformer implementation="org.apache.hadoop.maven.plugin.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
<resources>
<resource>LICENSE</resource>
<resource>LICENSE.txt</resource>
<resource>NOTICE</resource>
<resource>NOTICE.txt</resource>
<resource>Grizzly_THIRDPARTYLICENSEREADME.txt</resource>
<resource>LICENSE.dom-documentation.txt</resource>
<resource>LICENSE.dom-software.txt</resource>
<resource>LICENSE.dom-documentation.txt</resource>
<resource>LICENSE.sax.txt</resource>
</resources>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/LICENSE.txt</resource>
<file>${basedir}/../../LICENSE.txt</file>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/NOTICE.txt</resource>
<file>${basedir}/../../NOTICE.txt</file>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>noshade</id>
<activation>
<property><name>skipShade</name></property>
</activation>
<build>
<plugins>
<!-- We contain no source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
| {
"content_hash": "08506186f8e9c01ea64d388d278a6667",
"timestamp": "",
"source": "github",
"line_count": 1074,
"max_line_length": 156,
"avg_line_length": 41.25232774674115,
"alnum_prop": 0.5280668096151676,
"repo_name": "nandakumar131/hadoop",
"id": "a35d832a76c049f76ad0376a378caea9a18be69a",
"size": "44305",
"binary": false,
"copies": "2",
"ref": "refs/heads/trunk",
"path": "hadoop-client-modules/hadoop-client-minicluster/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "78118"
},
{
"name": "C",
"bytes": "1963896"
},
{
"name": "C++",
"bytes": "2858990"
},
{
"name": "CMake",
"bytes": "114811"
},
{
"name": "CSS",
"bytes": "117127"
},
{
"name": "Dockerfile",
"bytes": "8160"
},
{
"name": "HTML",
"bytes": "401158"
},
{
"name": "Java",
"bytes": "91592443"
},
{
"name": "JavaScript",
"bytes": "1175143"
},
{
"name": "Python",
"bytes": "77552"
},
{
"name": "Roff",
"bytes": "8817"
},
{
"name": "Shell",
"bytes": "467526"
},
{
"name": "TLA",
"bytes": "14997"
},
{
"name": "TSQL",
"bytes": "30600"
},
{
"name": "TeX",
"bytes": "19322"
},
{
"name": "XSLT",
"bytes": "18026"
}
],
"symlink_target": ""
} |
require './lib/writetheman'
require 'factory_girl'
require 'faker'
require 'shared_values'
FactoryGirl.find_definitions
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
end
| {
"content_hash": "c45e12d7c0b0edb6aa328e056ad54fee",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 77,
"avg_line_length": 35.666666666666664,
"alnum_prop": 0.7441588785046729,
"repo_name": "davidtysman/writetheman",
"id": "a3e1df560dba1452f859853e86f042edd7a73941",
"size": "856",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/spec_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "27817"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Walty</title>
<link rel="stylesheet" href="foundation/css/foundation.css" />
<link rel="stylesheet" href="css/home-page.css"/>
<link rel="stylesheet" href="foundation/foundation-icons/foundation-icons.css" />
<link rel="shortcut icon" type="image/png" href="img/favicon.png"/>
<link rel="apple-touch-icon" type="image/png" href="img/favicon.png"/>
<script src="foundation/js/vendor/modernizr.js"></script>
<script src="foundation/js/vendor/jquery.js"></script>
<script src="foundation/js/foundation/foundation.js"></script>
<script src="foundation/js/foundation/foundation.reveal.js"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body>
<div id="homeScreen">
<div class='row' style="margin-bottom: 3%">
<a href="#" onClick="openSearchModal()"><i class="fi-magnifying-glass" style="font-size:80px; color:#D7D7D7; margin-top:2%; margin-left:2%"></i></a>
<img src="img/logo.png" style="height:100px; float:right; margin-right: 2%; margin-top:2%; ">
</div>
<div class="row">
<a class="small-4 large-4 columns" href="#" onClick="submitSearch('civil')">
<div class="panel">
<div class='crop'><img src="img/skyscraper-1-1523706-1600x1200.jpg"></div>
<p class="text-center">Civil</p>
</div>
</a>
<a class="small-4 large-4 columns" href="#" onClick="submitSearch('mechanical')">
<div class="panel">
<div class='crop'><img src="img/gears-4-1566682.jpg"></div>
<p class="text-center">Mechanical</p>
</div>
</a>
<a class="small-4 large-4 columns" href="#" onClick="submitSearch('electrical')">
<div class="panel">
<div class='crop'><img src="img/circuit-board.jpg"></div>
<p class="text-center">Electrical</p>
</div>
</a>
</div>
<div class="row">
<a class="small-4 large-4 columns" href="#" onClick="submitSearch('software')">
<div class="panel">
<div class='crop'><img src="img/code-1243504-1600x1200.jpg"></div>
<p class="text-center">Software</p>
</div>
</a>
<a class="small-4 large-4 columns" href="#" onClick="submitSearch('id')">
<div class="panel">
<div class='crop'><img src="img/film-case-1456210-1280x960.jpg"></div>
<p class="text-center">ID</p>
</div>
</a>
<a class="small-4 large-4 columns" href="#" onClick="submitSearch('people')">
<div class="panel">
<div class='crop'><img src="img/people-1458971.jpg"></div>
<p class="text-center">People</p>
</div>
</a>
</div>
<a href='setup.html'><p class='text-center' style="margin-top:5%""><i class="fi-widget" style="font-size:50px; color:#5F5F5F;"></i></p></a>
</div>
<div id="resultsScreen" style="display:none;">
<div class='row' style="margin-bottom:2%">
<a href="#" onClick="openSearchModal()"><i class="fi-magnifying-glass" style="font-size:80px; color:#D7D7D7; margin-top:2%; margin-left:2%"></i></a>
<a href="#" onClick="gotoHomeScreen()"><i class="fi-arrow-left" style="font-size:80px; color:#D7D7D7; margin-top:2%; margin-left:2%"></i></a>
<img src="img/logo.png" style="height:100px; float:right; margin-right: 2%; margin-top:2%">
</div>
<div id ="searchResults">Results</div>
</div>
<div id="photoScreen" style="display:none; height:100%">
<a href="#" onClick="gotoResultsScreen()"><i class="fi-arrow-left" style="position: fixed; font-size:80px; color:#A7A7A7; margin-top:2%; margin-left:2%"></i></a>
<div id="bigPhotoArea"></div>
</div>
<div id="fullscreenCheckModal" class="reveal-modal small" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h2 class="text-center">This app would like to go fullscreen. </h2>
<div class="large-6 columns">
<div class="button round alert expand" onClick="okFullscreen()">OK</div>
</div>
<div class="large-6 columns">
<div class="button round expand" onClick="noFullscreen()">Nope</div>
</div>
</div>
<div id="searchModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<div class="small-8 large-4 columns small-centered">
<a href="#" onClick="submitSearch()" class="button large round alert expand" style="font-size:40px; margin-top:40px"" id="searchButton"> search </a>
</div>
<div id="tagsArea"></div>
<a class="close-reveal-modal" aria-label="Close"><i class="fi-x" style="font-size:80px; color:#D7D7D7; "></i></a>
</div>
</body>
<script>
// Find the right method, call on correct element
function launchIntoFullscreen(element) {
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if(element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
function toggleHomeScreen() {
$("#homeScreen").toggle();
}
function gotoHomeScreen() {
$("#resultsScreen").hide();
$("#homeScreen").show();
}
function gotoResultsScreen() {
$("#photoScreen").hide();
$("#resultsScreen").show();
}
function okFullscreen() {
$('#fullscreenCheckModal').foundation('reveal', 'close');
launchIntoFullscreen(document.documentElement);
}
function noFullscreen() {
$('#fullscreenCheckModal').foundation('reveal', 'close');
}
function submitSearch(keyword) {
if(keyword)
searchTags.push(keyword);
$.ajax({
type: "POST",
url: "search-tags.php",
data: {'tags':JSON.stringify(searchTags)},
dataType: "json",
beforeSend: function(html) {
$('#searchModal').foundation('reveal', 'close');
$("#searchResults").html('');
$("#homeScreen").hide();
$("#resultsScreen").show();
},
success: function(data){
html = data.html;
$("#searchResults").show();
$("#searchResults").append(html);
},
// error: function(html){
// alert("Error in search.");
// $("#searchResults").append(html);
// }
error: function(xhr, status, error) {
alert(xhr);
alert(status);
alert(error);
//var err = eval("(" + xhr.responseText + ")");
//alert(err.Message);
}
});
searchTags = [];
return false;
};
function viewPhoto(path) {
$("#resultsScreen").hide();
$("#bigPhotoArea").empty();
$("#bigPhotoArea").css("background-image","url("+path+")");
$("#photoScreen").show();
}
$( document ).ready(function() {
//$('#fullscreenCheckModal').foundation('reveal', 'open');
});
function openSearchModal() {
searchTags = [];
$.ajax({
type: "GET",
url: "get-tags.php",
success: function(html){
$('#searchModal').foundation('reveal', 'open');
$(document).on('opened.fndtn.reveal', '[data-reveal]', function () {
$("#tagsArea").empty();
$("#tagsArea").append(html);
});
},
error: function(html){
alert("Error getting tags.");
}
});
}
function toggleTagButton(tag) {
state = $("#tagButton"+tag).css('font-style');
if (state=='italic') {
searchTags = jQuery.grep(searchTags, function(value) {
return value != tag;
});
$("#tagButton"+tag).css('background','#E7E7E7');
$("#tagButton"+tag).css('font-style','normal');
} else {
searchTags.push(tag);
$("#tagButton"+tag).css('background','#43AC6A');
$("#tagButton"+tag).css('font-style','italic');
}
}
</script>
<script type="text/javascript">
$(document).foundation();
searchTags = [];
</script>
</html>
| {
"content_hash": "f0c9f4555359109c194ad7e4251ed5fa",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 180,
"avg_line_length": 35.8155737704918,
"alnum_prop": 0.5533813937521456,
"repo_name": "aninternetof/walty",
"id": "b983bb7b2ffd87f1ed52fbe8f3830798d175d637",
"size": "8739",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20961"
},
{
"name": "HTML",
"bytes": "349807"
},
{
"name": "JavaScript",
"bytes": "43892"
},
{
"name": "PHP",
"bytes": "9574"
}
],
"symlink_target": ""
} |
zomb-y-site
===========
The official website of Zomb-Y. | {
"content_hash": "9c644279151f39786d552c9002446bd4",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 31,
"avg_line_length": 14,
"alnum_prop": 0.6071428571428571,
"repo_name": "zomb-y/zomb-y-site",
"id": "5b2e30be611dadd15ba145fac9f263b81a8cebc1",
"size": "56",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
using namespace llvm;
namespace {
class SpecialCaseListTest : public ::testing::Test {
protected:
std::unique_ptr<SpecialCaseList> makeSpecialCaseList(StringRef List,
std::string &Error) {
std::unique_ptr<MemoryBuffer> MB = MemoryBuffer::getMemBuffer(List);
return SpecialCaseList::create(MB.get(), Error);
}
std::unique_ptr<SpecialCaseList> makeSpecialCaseList(StringRef List) {
std::string Error;
auto SCL = makeSpecialCaseList(List, Error);
assert(SCL);
assert(Error == "");
return SCL;
}
std::string makeSpecialCaseListFile(StringRef Contents) {
int FD;
SmallString<64> Path;
sys::fs::createTemporaryFile("SpecialCaseListTest", "temp", FD, Path);
raw_fd_ostream OF(FD, true, true);
OF << Contents;
OF.close();
return Path.str();
}
};
TEST_F(SpecialCaseListTest, Basic) {
std::unique_ptr<SpecialCaseList> SCL =
makeSpecialCaseList("# This is a comment.\n"
"\n"
"src:hello\n"
"src:bye\n"
"src:hi=category\n"
"src:z*=category\n");
EXPECT_TRUE(SCL->inSection("", "src", "hello"));
EXPECT_TRUE(SCL->inSection("", "src", "bye"));
EXPECT_TRUE(SCL->inSection("", "src", "hi", "category"));
EXPECT_TRUE(SCL->inSection("", "src", "zzzz", "category"));
EXPECT_FALSE(SCL->inSection("", "src", "hi"));
EXPECT_FALSE(SCL->inSection("", "fun", "hello"));
EXPECT_FALSE(SCL->inSection("", "src", "hello", "category"));
EXPECT_EQ(3u, SCL->inSectionBlame("", "src", "hello"));
EXPECT_EQ(4u, SCL->inSectionBlame("", "src", "bye"));
EXPECT_EQ(5u, SCL->inSectionBlame("", "src", "hi", "category"));
EXPECT_EQ(6u, SCL->inSectionBlame("", "src", "zzzz", "category"));
EXPECT_EQ(0u, SCL->inSectionBlame("", "src", "hi"));
EXPECT_EQ(0u, SCL->inSectionBlame("", "fun", "hello"));
EXPECT_EQ(0u, SCL->inSectionBlame("", "src", "hello", "category"));
}
TEST_F(SpecialCaseListTest, CorrectErrorLineNumberWithBlankLine) {
std::string Error;
EXPECT_EQ(nullptr, makeSpecialCaseList("# This is a comment.\n"
"\n"
"[not valid\n",
Error));
EXPECT_TRUE(
((StringRef)Error).startswith("malformed section header on line 3:"));
EXPECT_EQ(nullptr, makeSpecialCaseList("\n\n\n"
"[not valid\n",
Error));
EXPECT_TRUE(
((StringRef)Error).startswith("malformed section header on line 4:"));
}
TEST_F(SpecialCaseListTest, SectionRegexErrorHandling) {
std::string Error;
EXPECT_EQ(makeSpecialCaseList("[address", Error), nullptr);
EXPECT_TRUE(((StringRef)Error).startswith("malformed section header "));
EXPECT_EQ(makeSpecialCaseList("[[]", Error), nullptr);
EXPECT_TRUE(((StringRef)Error).startswith("malformed regex for section [: "));
EXPECT_EQ(makeSpecialCaseList("src:=", Error), nullptr);
EXPECT_TRUE(((StringRef)Error).endswith("Supplied regexp was blank"));
}
TEST_F(SpecialCaseListTest, Section) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("src:global\n"
"[sect1|sect2]\n"
"src:test1\n"
"[sect3*]\n"
"src:test2\n");
EXPECT_TRUE(SCL->inSection("arbitrary", "src", "global"));
EXPECT_TRUE(SCL->inSection("", "src", "global"));
EXPECT_TRUE(SCL->inSection("sect1", "src", "test1"));
EXPECT_FALSE(SCL->inSection("sect1-arbitrary", "src", "test1"));
EXPECT_FALSE(SCL->inSection("sect", "src", "test1"));
EXPECT_FALSE(SCL->inSection("sect1", "src", "test2"));
EXPECT_TRUE(SCL->inSection("sect2", "src", "test1"));
EXPECT_TRUE(SCL->inSection("sect3", "src", "test2"));
EXPECT_TRUE(SCL->inSection("sect3-arbitrary", "src", "test2"));
EXPECT_FALSE(SCL->inSection("", "src", "test1"));
EXPECT_FALSE(SCL->inSection("", "src", "test2"));
}
TEST_F(SpecialCaseListTest, GlobalInit) {
std::unique_ptr<SpecialCaseList> SCL =
makeSpecialCaseList("global:foo=init\n");
EXPECT_FALSE(SCL->inSection("", "global", "foo"));
EXPECT_FALSE(SCL->inSection("", "global", "bar"));
EXPECT_TRUE(SCL->inSection("", "global", "foo", "init"));
EXPECT_FALSE(SCL->inSection("", "global", "bar", "init"));
SCL = makeSpecialCaseList("type:t2=init\n");
EXPECT_FALSE(SCL->inSection("", "type", "t1"));
EXPECT_FALSE(SCL->inSection("", "type", "t2"));
EXPECT_FALSE(SCL->inSection("", "type", "t1", "init"));
EXPECT_TRUE(SCL->inSection("", "type", "t2", "init"));
SCL = makeSpecialCaseList("src:hello=init\n");
EXPECT_FALSE(SCL->inSection("", "src", "hello"));
EXPECT_FALSE(SCL->inSection("", "src", "bye"));
EXPECT_TRUE(SCL->inSection("", "src", "hello", "init"));
EXPECT_FALSE(SCL->inSection("", "src", "bye", "init"));
}
TEST_F(SpecialCaseListTest, Substring) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("src:hello\n"
"fun:foo\n"
"global:bar\n");
EXPECT_FALSE(SCL->inSection("", "src", "othello"));
EXPECT_FALSE(SCL->inSection("", "fun", "tomfoolery"));
EXPECT_FALSE(SCL->inSection("", "global", "bartender"));
SCL = makeSpecialCaseList("fun:*foo*\n");
EXPECT_TRUE(SCL->inSection("", "fun", "tomfoolery"));
EXPECT_TRUE(SCL->inSection("", "fun", "foobar"));
}
TEST_F(SpecialCaseListTest, InvalidSpecialCaseList) {
std::string Error;
EXPECT_EQ(nullptr, makeSpecialCaseList("badline", Error));
EXPECT_EQ("malformed line 1: 'badline'", Error);
EXPECT_EQ(nullptr, makeSpecialCaseList("src:bad[a-", Error));
EXPECT_EQ("malformed regex in line 1: 'bad[a-': invalid character range",
Error);
EXPECT_EQ(nullptr, makeSpecialCaseList("src:a.c\n"
"fun:fun(a\n",
Error));
EXPECT_EQ("malformed regex in line 2: 'fun(a': parentheses not balanced",
Error);
std::vector<std::string> Files(1, "unexisting");
EXPECT_EQ(nullptr, SpecialCaseList::create(Files, Error));
EXPECT_EQ(0U, Error.find("can't open file 'unexisting':"));
}
TEST_F(SpecialCaseListTest, EmptySpecialCaseList) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("");
EXPECT_FALSE(SCL->inSection("", "foo", "bar"));
}
TEST_F(SpecialCaseListTest, MultipleBlacklists) {
std::vector<std::string> Files;
Files.push_back(makeSpecialCaseListFile("src:bar\n"
"src:*foo*\n"
"src:ban=init\n"));
Files.push_back(makeSpecialCaseListFile("src:baz\n"
"src:*fog*\n"));
auto SCL = SpecialCaseList::createOrDie(Files);
EXPECT_TRUE(SCL->inSection("", "src", "bar"));
EXPECT_TRUE(SCL->inSection("", "src", "baz"));
EXPECT_FALSE(SCL->inSection("", "src", "ban"));
EXPECT_TRUE(SCL->inSection("", "src", "ban", "init"));
EXPECT_TRUE(SCL->inSection("", "src", "tomfoolery"));
EXPECT_TRUE(SCL->inSection("", "src", "tomfoglery"));
for (auto &Path : Files)
sys::fs::remove(Path);
}
TEST_F(SpecialCaseListTest, NoTrigramsInRules) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("fun:b.r\n"
"fun:za*az\n");
EXPECT_TRUE(SCL->inSection("", "fun", "bar"));
EXPECT_FALSE(SCL->inSection("", "fun", "baz"));
EXPECT_TRUE(SCL->inSection("", "fun", "zakaz"));
EXPECT_FALSE(SCL->inSection("", "fun", "zaraza"));
}
TEST_F(SpecialCaseListTest, NoTrigramsInARule) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("fun:*bar*\n"
"fun:za*az\n");
EXPECT_TRUE(SCL->inSection("", "fun", "abara"));
EXPECT_FALSE(SCL->inSection("", "fun", "bor"));
EXPECT_TRUE(SCL->inSection("", "fun", "zakaz"));
EXPECT_FALSE(SCL->inSection("", "fun", "zaraza"));
}
TEST_F(SpecialCaseListTest, RepetitiveRule) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("fun:*bar*bar*bar*bar*\n"
"fun:bar*\n");
EXPECT_TRUE(SCL->inSection("", "fun", "bara"));
EXPECT_FALSE(SCL->inSection("", "fun", "abara"));
EXPECT_TRUE(SCL->inSection("", "fun", "barbarbarbar"));
EXPECT_TRUE(SCL->inSection("", "fun", "abarbarbarbar"));
EXPECT_FALSE(SCL->inSection("", "fun", "abarbarbar"));
}
TEST_F(SpecialCaseListTest, SpecialSymbolRule) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("src:*c\\+\\+abi*\n");
EXPECT_TRUE(SCL->inSection("", "src", "c++abi"));
EXPECT_FALSE(SCL->inSection("", "src", "c\\+\\+abi"));
}
TEST_F(SpecialCaseListTest, PopularTrigram) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("fun:*aaaaaa*\n"
"fun:*aaaaa*\n"
"fun:*aaaa*\n"
"fun:*aaa*\n");
EXPECT_TRUE(SCL->inSection("", "fun", "aaa"));
EXPECT_TRUE(SCL->inSection("", "fun", "aaaa"));
EXPECT_TRUE(SCL->inSection("", "fun", "aaaabbbaaa"));
}
TEST_F(SpecialCaseListTest, EscapedSymbols) {
std::unique_ptr<SpecialCaseList> SCL = makeSpecialCaseList("src:*c\\+\\+abi*\n"
"src:*hello\\\\world*\n");
EXPECT_TRUE(SCL->inSection("", "src", "dir/c++abi"));
EXPECT_FALSE(SCL->inSection("", "src", "dir/c\\+\\+abi"));
EXPECT_FALSE(SCL->inSection("", "src", "c\\+\\+abi"));
EXPECT_TRUE(SCL->inSection("", "src", "C:\\hello\\world"));
EXPECT_TRUE(SCL->inSection("", "src", "hello\\world"));
EXPECT_FALSE(SCL->inSection("", "src", "hello\\\\world"));
}
}
| {
"content_hash": "fe86a1511548cf9559fb2f014bf9ec78",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 87,
"avg_line_length": 43.21888412017167,
"alnum_prop": 0.564051638530288,
"repo_name": "GPUOpen-Drivers/llvm",
"id": "2245588d97cae6c82c9a3a72345e2a2e71992e8f",
"size": "10584",
"binary": false,
"copies": "9",
"ref": "refs/heads/amd-vulkan-dev",
"path": "unittests/Support/SpecialCaseListTest.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "53726601"
},
{
"name": "Batchfile",
"bytes": "9235"
},
{
"name": "C",
"bytes": "848003"
},
{
"name": "C++",
"bytes": "85310923"
},
{
"name": "CMake",
"bytes": "530158"
},
{
"name": "CSS",
"bytes": "12605"
},
{
"name": "Dockerfile",
"bytes": "5884"
},
{
"name": "Go",
"bytes": "149213"
},
{
"name": "HTML",
"bytes": "37873"
},
{
"name": "LLVM",
"bytes": "135880251"
},
{
"name": "Logos",
"bytes": "28"
},
{
"name": "OCaml",
"bytes": "305839"
},
{
"name": "Objective-C",
"bytes": "10226"
},
{
"name": "Perl",
"bytes": "25574"
},
{
"name": "Python",
"bytes": "993907"
},
{
"name": "Roff",
"bytes": "39"
},
{
"name": "Shell",
"bytes": "97425"
},
{
"name": "Swift",
"bytes": "271"
},
{
"name": "Vim script",
"bytes": "17482"
}
],
"symlink_target": ""
} |
using System;
using System.Linq.Expressions;
namespace Atata
{
/// <summary>
/// Represents the hierarchical control (a control containing structured hierarchy of controls of <typeparamref name="TItem"/> type).
/// Default search finds the first occurring element.
/// </summary>
/// <typeparam name="TItem">The type of the item control.</typeparam>
/// <typeparam name="TOwner">The type of the owner page object.</typeparam>
[FindSettings(OuterXPath = "./", TargetName = nameof(Children))]
public class HierarchicalControl<TItem, TOwner> : Control<TOwner>
where TItem : HierarchicalItem<TItem, TOwner>
where TOwner : PageObject<TOwner>
{
/// <summary>
/// Gets the children <see cref="ControlList{TItem, TOwner}"/> instance.
/// </summary>
public ControlList<TItem, TOwner> Children { get; private set; }
/// <summary>
/// Gets the descendants (all items at any level of hierarchy) <see cref="ControlList{TItem, TOwner}"/> instance.
/// </summary>
public ControlList<TItem, TOwner> Descendants { get; private set; }
/// <summary>
/// Gets the child item at the specified index.
/// </summary>
/// <param name="index">The zero-based index of the item to get.</param>
/// <returns>The child item at the specified index.</returns>
public TItem this[int index] => Children[index];
/// <summary>
/// Gets the child item that matches the conditions defined by the specified predicate expression.
/// </summary>
/// <param name="predicateExpression">The predicate expression to test each item.</param>
/// <returns>The first child item that matches the conditions of the specified predicate.</returns>
public TItem this[Expression<Func<TItem, bool>> predicateExpression] => Children[predicateExpression];
}
}
| {
"content_hash": "15dd9365d7423d903e7af82c21b259be",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 137,
"avg_line_length": 47.926829268292686,
"alnum_prop": 0.6371501272264631,
"repo_name": "YevgeniyShunevych/Atata",
"id": "811437217632c614bdd4dbf04a06b9f741df1ec9",
"size": "1967",
"binary": false,
"copies": "1",
"ref": "refs/heads/v2.0.0",
"path": "src/Atata/Components/HierarchicalControl`2.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "220178"
},
{
"name": "HTML",
"bytes": "8639"
}
],
"symlink_target": ""
} |
set :css_dir, 'css'
set :js_dir, 'js'
set :images_dir, 'images'
# Make Bower & NPM files available to Sprockets
sprockets.append_path File.join root, 'bower_components'
sprockets.append_path File.join root, 'node_modules'
# Configure Babel
require 'babel'
::Babel.options do |o|
o[:loose] = %w{es6.classes es6.modules} # loose mode enables better IE <= 10 compatibility
end
# Output .js.es6 files as .js
def remap_es6_files(dir)
Dir.foreach(File.join(config[:source], dir)) do |file|
next if file == '.' or file == '..'
path = File.join(dir, file)
if File.directory?(File.join(config[:source], path))
remap_es6_files(path)
elsif file =~ /\.es6$/
proxy path.gsub(/\.es6$/, ''), path
ignore path
elsif file =~ /\.es6\.erb$/
proxy path.gsub(/\.es6\.erb$/, ''), path.gsub(/\.erb$/, '')
ignore path
end
end
end
remap_es6_files(config[:js_dir])
# Dev-specific configuration
configure :development do
set :debug_assets, true
# reload page
activate :livereload, :apply_js_live => true, :apply_css_live => true
config[:file_watcher_ignore] << %r{\.idea\/}
end | {
"content_hash": "4729d301590c5d307c981545351d64fd",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 92,
"avg_line_length": 26.785714285714285,
"alnum_prop": 0.6471111111111111,
"repo_name": "70mainstreet/sprockets-babel-demo",
"id": "1f24d3d07faf1fd19a08778e9b04a6ed4033d2bb",
"size": "1125",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "345"
},
{
"name": "JavaScript",
"bytes": "970"
},
{
"name": "Ruby",
"bytes": "1360"
}
],
"symlink_target": ""
} |
"""Example code for
Service : ReportDefinitionService
Operation: mutate (ADD)
API Reference: https://github.com/yahoojp-marketing/sponsored-search-api-documents/blob/201901/docs/en/api_reference/services/ReportDefinitionService.md
Generated by 'api_reference_example_generator.py' using code template 'examples/sample_template.py.template'
"""
import logging
import json
from yahooads import promotionalads
logging.basicConfig(level=logging.INFO)
# logging.getLogger('suds.client').setLevel(logging.DEBUG)
# logging.getLogger('suds.transport').setLevel(logging.DEBUG)
SERVICE = 'ReportDefinitionService'
OPERATION = 'mutate (ADD)'
OPERAND = {
"operator": "ADD",
"accountId": "SAMPLE-ACCOUNT-ID",
"operand": {
"reportName": "Sample Report Definition",
"reportType": "ACCOUNT",
"dateRangeType": "CUSTOM_DATE",
"dateRange": {
"startDate": "19700101",
"endDate": "20371231"
},
"fields": [
"COST",
"IMPS",
"CLICKS",
"CLICK_RATE",
"AVG_CPC",
"AVG_DELIVER_RANK",
"TRACKING_URL",
"CONVERSIONS",
"CONV_RATE",
"CONV_VALUE",
"COST_PER_CONV",
"VALUE_PER_CONV",
"NETWORK",
"CLICK_TYPE",
"DEVICE",
"DAY",
"DAY_OF_WEEK",
"QUARTER",
"YEAR",
"MONTH",
"MONTH_OF_YEAR",
"WEEK",
"HOUR_OF_DAY"
],
"sortFields": {
"type": "ASC",
"field": "CLICKS"
},
"filters": {
"field": "COST",
"operator": "NOT_EQUALS",
"value": "100"
},
"isTemplate": "TRUE",
"intervalType": "SPECIFYDAY",
"specifyDay": "1",
"format": "CSV",
"encode": "UTF-8",
"language": "JA",
"compress": "NONE",
"includeZeroImpressions": "TRUE",
"includeDeleted": "TRUE"
}
}
"""
SAMPLE RESPONSE = {
"rval": {
"ListReturnValue.Type": "ReportDefinitionReturnValue",
"Operation.Type": "ADD",
"values": {
"operationSucceeded": "true",
"reportDefinition": {
"accountId": "SAMPLE-ACCOUNT-ID",
"reportId": "22222",
"reportName": "Sample Report Definition",
"reportType": "ACCOUNT",
"dateRangeType": "CUSTOM_DATE",
"dateRange": {
"startDate": "19700101",
"endDate": "20371231"
},
"fields": [
"COST",
"IMPS",
"CLICKS",
"CLICK_RATE",
"AVG_CPC",
"AVG_DELIVER_RANK",
"TRACKING_URL",
"CONVERSIONS",
"CONV_RATE",
"CONV_VALUE",
"COST_PER_CONV",
"VALUE_PER_CONV",
"NETWORK",
"CLICK_TYPE",
"DEVICE",
"DAY",
"DAY_OF_WEEK",
"QUARTER",
"YEAR",
"MONTH",
"MONTH_OF_YEAR",
"WEEK",
"HOUR_OF_DAY"
],
"sortFields": {
"type": "ASC",
"field": "CLICKS"
},
"filters": {
"field": "COST",
"operator": "NOT_EQUALS",
"value": "100"
},
"isTemplate": "TRUE",
"intervalType": "SPECIFYDAY",
"specifyDay": "1",
"format": "CSV",
"encode": "UTF-8",
"language": "JA",
"compress": "NONE",
"includeZeroImpressions": "TRUE",
"includeDeleted": "TRUE"
}
}
}
}
"""
def main():
client = promotionalads.PromotionalAdsClient.LoadFromConfiguration()
service = client.GetService(SERVICE)
print("REQUEST : {}.{}\n{}".format(SERVICE, OPERATION, json.dumps(OPERAND, indent=2)))
try:
if OPERATION == "get":
response = service.get(OPERAND)
elif OPERATION.startswith("get"):
get_method = getattr(service, OPERATION)
response = get_method(OPERAND)
elif OPERATION.startswith("mutate"):
response = service.mutate(OPERAND)
else:
raise("Unknown Operation '{}'".format(OPERATION))
print("RESPONSE :\n{}".format(response))
except Exception as e:
print("Exception at '{}' operations \n{}".format(SERVICE, e))
raise e
if __name__ == '__main__':
main()
| {
"content_hash": "dcc0790864a37113feba4e42144dd190",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 152,
"avg_line_length": 25.548192771084338,
"alnum_prop": 0.5201603395425607,
"repo_name": "becomejapan/yahooads-python-lib",
"id": "9c2114384b5217d56898f991e5f1c9cc14ceb96d",
"size": "4840",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/ReportDefinitionService/ReportDefinitionService_mutate_ADD.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "30856"
}
],
"symlink_target": ""
} |
import React, { PropTypes } from 'react';
import Arbiter from 'promissory-arbiter';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Home.css';
import Graph from '../../components/Graph/Graph';
class Home extends React.Component {
static propTypes = {
news: PropTypes.arrayOf(PropTypes.shape({
title: PropTypes.string.isRequired,
link: PropTypes.string.isRequired,
contentSnippet: PropTypes.string,
})).isRequired,
};
state = { data: null }
componentDidMount() {
Arbiter.subscribe('data_fetched', d => {
this.setState({ data: d });
});
}
render() {
console.log(this.state);
let graph = null;
if (this.state.data !== null) {
graph = <Graph key={JSON.stringify(this.state.data)} data={this.state.data} />;
}
return (
<div className={s.root}>
<div className={s.container}>
{graph}
</div>
</div>
);
}
}
export default withStyles(s)(Home);
| {
"content_hash": "d0cbbad8bf420e7d1bffa282cbc1504e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 85,
"avg_line_length": 24.29268292682927,
"alnum_prop": 0.6204819277108434,
"repo_name": "chakshuahuja/crunchgraph",
"id": "a6555788df153d2c17b9289c5412135527f56772",
"size": "1257",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/routes/home/Home.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14105"
},
{
"name": "JavaScript",
"bytes": "62826"
}
],
"symlink_target": ""
} |
package pkg
import (
"os"
"path"
"strings"
"github.com/pinpt/dialect/pkg/types"
)
// SingleSymbolProcessor can be used when you only have a single symbol which designates the line is a comment
func SingleSymbolProcessor(commentSymbol string, line *types.DialectLine) {
if strings.HasPrefix(line.Contents, commentSymbol) {
line.IsComment = true
} else {
line.IsCode = true
}
}
// MultiSymbolProcessor can be used when you have more than one symbol which designates the line is a comment
func MultiSymbolProcessor(commentSymbols []string, line *types.DialectLine) {
var found bool
for _, commentSymbol := range commentSymbols {
if strings.HasPrefix(line.Contents, commentSymbol) {
found = true
break
}
}
if found {
line.IsComment = true
} else {
line.IsCode = true
}
}
// FileExists returns true if the filename path exists or false if not
func FileExists(filename ...string) bool {
fn := path.Join(filename...)
if _, err := os.Stat(fn); os.IsNotExist(err) {
return false
}
return true
}
| {
"content_hash": "a8c6d8abcb23fb6e97184dfe495fe320",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 110,
"avg_line_length": 23.906976744186046,
"alnum_prop": 0.7237354085603113,
"repo_name": "pinpt/dialect",
"id": "7f65c0effa78d3962297056da218d2a1681bc5e3",
"size": "1028",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pkg/util.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "135431"
},
{
"name": "Groovy",
"bytes": "358"
},
{
"name": "Makefile",
"bytes": "1435"
}
],
"symlink_target": ""
} |
package org.apache.harmony.test.func.reg.vm.btest6008;
import java.util.logging.Logger;
import org.apache.harmony.test.share.reg.CrashTest;
public class Btest6008 extends CrashTest {
public static void main(String[] args) {
System.exit(new Btest6008().test(Logger.global, args));
}
public int test(Logger logger, String[] args) {
setTestName("org.apache.harmony.test.func.reg.vm.btest6008.Btest6008_test");
System.out.println("XXX: getCommand(args)");
return run(getCommand(args));
}
} | {
"content_hash": "9b8353025fec867b2d7d52b8f97f3c66",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 84,
"avg_line_length": 30.11111111111111,
"alnum_prop": 0.6937269372693727,
"repo_name": "freeVM/freeVM",
"id": "6e21bb35d93197cdcb47ac87aaf39fcc57518fa5",
"size": "1354",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "enhanced/buildtest/tests/functional/src/test/functional/org/apache/harmony/test/func/reg/vm/btest6008/Btest6008.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "116828"
},
{
"name": "C",
"bytes": "17860389"
},
{
"name": "C++",
"bytes": "19007206"
},
{
"name": "CSS",
"bytes": "217777"
},
{
"name": "Java",
"bytes": "152108632"
},
{
"name": "Objective-C",
"bytes": "106412"
},
{
"name": "Objective-J",
"bytes": "11029421"
},
{
"name": "Perl",
"bytes": "305690"
},
{
"name": "Scilab",
"bytes": "34"
},
{
"name": "Shell",
"bytes": "153821"
},
{
"name": "XSLT",
"bytes": "152859"
}
],
"symlink_target": ""
} |
<?php defined('SYSPATH') or die('No direct script access.');
class Kohana_HAPI_Security
{
/**
* Login using HTTP Basic Auth. `username` and `api_token` columns are used for authentication.
*
* @param string $authorization_string HTTP 'Authorization' header value
* @return bool|Model_User Logged in user or false
*/
public static function login($authorization_string)
{
// Basic ZGhhcmE6ddVzdA==
$tokens = Arr::get(explode(' ', $authorization_string), 1);
// ZGhhcmE6ddVzdA==
$tokens = base64_decode($tokens);
// user:pass
$tokens = explode(':', $tokens);
$username = Arr::get($tokens, 0);
$api_token = Arr::get($tokens, 1);
if (empty($username) || empty($api_token))
{
return FALSE;
}
$user = ORM::factory('User', ['username' => $username, 'api_token' => $api_token]);
if (! $user->loaded())
{
return FALSE;
}
Auth::instance()->force_login($user);
// Hack to access the user object within the context of the current Request (without redirect)
Session::instance()->set(Kohana::$config->load('auth.session_key'), $user);
return $user;
}
/**
* Check that we have an active Auth session
*
* @param Request $request
* @return bool
*/
public static function is_request_authenticated(Request $request)
{
// User is authenticated automatically on most AJAX calls.
// Session cookie is transmitted with the request
$user = Auth::instance()->get_user();
return $user !== NULL && $user->loaded();
}
/**
* @param Request $request
* @return bool
* @since 1.0
*/
public static function is_request_signature_valid(Request $request)
{
$public_key = $request->headers('X-Auth');
$private_key = Arr::get(Kohana::$config->load('hapi.keys'), $public_key);
if (! $public_key or ! $private_key)
{
return FALSE;
}
$provided_request_signature = $request->headers('X-Auth-Hash');
$expected_request_signature = self::calculate_hmac($request, $private_key);
return $expected_request_signature === $provided_request_signature;
}
/**
* Calculate the signature of a request.
* Should be called just before the request is sent.
*
* @param Request $request
* @param $private_key
* @return string Calculated HMAC
*/
public static function calculate_hmac(Request $request, $private_key)
{
// Consolidate data that's not in the main route (params)
$query = array_change_key_case($request->query());
$post = array_change_key_case($request->post());
// Sort alphabetically
ksort($query);
ksort($post);
$data_to_sign = [
'method' => $request->method(),
'uri' => $request->uri(),
'post' => $post,
'query' => $query,
];
// Calculate the signature
return hash_hmac('sha256', json_encode($data_to_sign), $private_key);
}
/**
* Send a www-authenticate response
*
* @param string $message
* @throws HTTP_Exception_401
*/
public static function require_auth($message = 'Authenticate!')
{
$http_401 = new HTTP_Exception_401($message);
$http_401->authenticate('Basic realm="'.Kohana::$config->load("hapi.realm").'"');
throw $http_401;
}
} | {
"content_hash": "b9c9282ddeac827f6b3e87faf53b7477",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 96,
"avg_line_length": 25.211382113821138,
"alnum_prop": 0.6507578200580458,
"repo_name": "anroots/kohana-hapi",
"id": "20529be19a5ee630c781a8cf00bab6b6633223a4",
"size": "3287",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "classes/Kohana/HAPI/Security.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "34209"
}
],
"symlink_target": ""
} |
package dk.brics.tajs.monitoring.inspector.datacollection;
import java.net.URL;
import java.util.Objects;
/**
* Represents a line of source code.
*/
public class SourceLine {
private final URL location;
private final int line;
public SourceLine(URL location, int line) {
this.location = location;
this.line = line;
}
public URL getLocation() {
return location;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SourceLine that = (SourceLine) o;
if (line != that.line) return false;
return Objects.equals(location, that.location);
}
@Override
public int hashCode() {
int result = location != null ? location.hashCode() : 0;
result = 31 * result + line;
return result;
}
public int getLine() {
return line;
}
}
| {
"content_hash": "112658fc4d2fe1acae9df85d8312acd0",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 66,
"avg_line_length": 20.404255319148938,
"alnum_prop": 0.5964546402502607,
"repo_name": "cs-au-dk/TAJS",
"id": "c71da980131b0888f4ba9f4e9b6fe1018feed762",
"size": "1564",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/dk/brics/tajs/monitoring/inspector/datacollection/SourceLine.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1661159"
},
{
"name": "Java",
"bytes": "4740144"
},
{
"name": "JavaScript",
"bytes": "3347530"
},
{
"name": "Shell",
"bytes": "1839"
},
{
"name": "TypeScript",
"bytes": "1299"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.accessanalyzer.model.transform;
import java.util.Map;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.accessanalyzer.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* KmsGrantConstraintsMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class KmsGrantConstraintsMarshaller {
private static final MarshallingInfo<Map> ENCRYPTIONCONTEXTEQUALS_BINDING = MarshallingInfo.builder(MarshallingType.MAP)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("encryptionContextEquals").build();
private static final MarshallingInfo<Map> ENCRYPTIONCONTEXTSUBSET_BINDING = MarshallingInfo.builder(MarshallingType.MAP)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("encryptionContextSubset").build();
private static final KmsGrantConstraintsMarshaller instance = new KmsGrantConstraintsMarshaller();
public static KmsGrantConstraintsMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(KmsGrantConstraints kmsGrantConstraints, ProtocolMarshaller protocolMarshaller) {
if (kmsGrantConstraints == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(kmsGrantConstraints.getEncryptionContextEquals(), ENCRYPTIONCONTEXTEQUALS_BINDING);
protocolMarshaller.marshall(kmsGrantConstraints.getEncryptionContextSubset(), ENCRYPTIONCONTEXTSUBSET_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| {
"content_hash": "a7fad52d036f10c80225455c0bfb2b7f",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 124,
"avg_line_length": 37.97959183673469,
"alnum_prop": 0.7571198280494358,
"repo_name": "aws/aws-sdk-java",
"id": "4a189ae5e9dc513bdcf510a4f9a805f7bc35b6aa",
"size": "2441",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-accessanalyzer/src/main/java/com/amazonaws/services/accessanalyzer/model/transform/KmsGrantConstraintsMarshaller.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
@interface MainViewController : UIViewController<ScrollMenuBarDelegate, UITableViewDataSource, UITableViewDelegate>
@end
| {
"content_hash": "d8dfd55d222e3115e71988ab6f4a5884",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 115,
"avg_line_length": 24.8,
"alnum_prop": 0.8629032258064516,
"repo_name": "tjnet/MultipleTableViewModernNewsApp",
"id": "33cf707efcb14b11435f89a5542f921feb45b8c1",
"size": "315",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "NewsAppSample/MainViewController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "104"
},
{
"name": "Objective-C",
"bytes": "36987"
},
{
"name": "Ruby",
"bytes": "116"
},
{
"name": "Swift",
"bytes": "4517"
}
],
"symlink_target": ""
} |
module HTTP
class RequestStream
# CRLF is the universal HTTP delimiter
CRLF = "\r\n"
def initialize(socket, body, headers, headerstart)
@body = body
raise ArgumentError, "body of wrong type" unless valid_body_type
@socket = socket
@headers = headers
@request_header = [headerstart]
end
def valid_body_type
valid_types= [String, NilClass, Enumerable]
checks = valid_types.map {|type| @body.is_a? type}
checks.any?
end
#Adds headers to the request header from the headers array
def add_headers
@headers.each do |field, value|
@request_header << "#{field}: #{value}"
end
end
# Stream the request to a socket
def stream
self.send_request_header
self.send_request_body
end
# Adds the headers to the header array for the given request body we are working
# with
def add_body_type_headers
if @body.is_a? String and not @headers['Content-Length']
@request_header << "Content-Length: #{@body.length}"
elsif @body.is_a? Enumerable
if encoding = @headers['Transfer-Encoding'] and not encoding == "chunked"
raise ArgumentError, "invalid transfer encoding"
else
@request_header << "Transfer-Encoding: chunked"
end
end
end
# Joins the headers specified in the request into a correctly formatted
# http request header string
def join_headers
# join the headers array with crlfs, stick two on the end because
# that ends the request header
@request_header.join(CRLF) + (CRLF)*2
end
def send_request_header
self.add_headers
self.add_body_type_headers
header = self.join_headers
@socket << header
end
def send_request_body
if @body.is_a? String
@socket << @body
elsif @body.is_a? Enumerable
@body.each do |chunk|
@socket << chunk.bytesize.to_s(16) << CRLF
@socket << chunk
end
@socket << "0" << CRLF * 2
end
end
end
end
| {
"content_hash": "7fe30d4a227690e8bcec9cf194adc677",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 84,
"avg_line_length": 27.272727272727273,
"alnum_prop": 0.6071428571428571,
"repo_name": "cloudbearings/Personalization-framework",
"id": "6983ec607fc179d1ab1bc70c65a422757208c0fc",
"size": "2100",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "logstash-1.4.0/vendor/bundle/jruby/1.9/gems/http-0.5.0/lib/http/request_stream.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "11343"
},
{
"name": "C",
"bytes": "1360"
},
{
"name": "CSS",
"bytes": "44622"
},
{
"name": "Groff",
"bytes": "589"
},
{
"name": "HTML",
"bytes": "102657"
},
{
"name": "Java",
"bytes": "28500"
},
{
"name": "JavaScript",
"bytes": "51931"
},
{
"name": "Makefile",
"bytes": "6529"
},
{
"name": "Python",
"bytes": "14426"
},
{
"name": "Ruby",
"bytes": "949264"
},
{
"name": "Shell",
"bytes": "28295"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
<version>3.8.0-SNAPSHOT</version>
</parent>
<artifactId>camel-jetty</artifactId>
<packaging>jar</packaging>
<name>Camel :: Jetty</name>
<description>Camel Jetty support</description>
<properties>
<camel.osgi.import.before.defaults>
org.eclipse.jetty.*;version="[9.4,10)",
javax.activation.*;version="${javax-activation-version-range}",
javax.servlet.*;version="${servlet-version-range}"
</camel.osgi.import.before.defaults>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-support</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jetty-common</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty9-version}</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty9-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-security</artifactId>
<version>${jetty9-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty9-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>${jetty9-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>${jetty9-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty9-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-management</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-xpath</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<scope>test</scope>
</dependency>
<!-- for testing rest-dsl -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-swagger-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxb</artifactId>
<scope>test</scope>
</dependency>
<!-- testing with ok http client -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okclient-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- skip jetty producer tests as its deprecated and causes CI server hangs -->
<excludes>
<exclude>org/apache/camel/component/jetty/jettyproducer/**.java</exclude>
</excludes>
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
</configuration>
</plugin>
</plugins>
</build>
</project>
| {
"content_hash": "d6d2e75ff99f2c7b82a720bce618ad91",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 204,
"avg_line_length": 36.677083333333336,
"alnum_prop": 0.5793808577108776,
"repo_name": "gnodet/camel",
"id": "a08404f9dfdb4311b719f219d676032f6fb5c91f",
"size": "7042",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/camel-jetty/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6521"
},
{
"name": "Batchfile",
"bytes": "2353"
},
{
"name": "CSS",
"bytes": "5472"
},
{
"name": "Dockerfile",
"bytes": "5462"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "8015"
},
{
"name": "Groovy",
"bytes": "25954"
},
{
"name": "HTML",
"bytes": "205030"
},
{
"name": "Java",
"bytes": "106323474"
},
{
"name": "JavaScript",
"bytes": "101298"
},
{
"name": "Jsonnet",
"bytes": "1734"
},
{
"name": "RobotFramework",
"bytes": "8461"
},
{
"name": "Ruby",
"bytes": "88"
},
{
"name": "Shell",
"bytes": "16564"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "280836"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
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.
-->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/backgroud"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<ImageButton
android:id="@+id/btSpeak"
android:onClick="speak"
android:src="@drawable/punch_selector"
android:background="@color/white"
tools:context=".VoiceRecognitionActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_below="@+id/btWalk"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp" />
<ImageButton
android:src="@drawable/left_selector"
android:background="@color/white"
android:id="@+id/btLeftSpin"
android:onClick="leftSpinMove"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_above="@+id/btSpeak"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/btSpeak" />
<ImageButton
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/right_selector"
android:background="@color/white"
android:id="@+id/btRightSpin"
android:onClick="rightSpinMove"
android:layout_gravity="right|center_vertical"
android:layout_above="@+id/btSpeak"
android:layout_alignParentEnd="true"
android:layout_toEndOf="@+id/btWalk" />
<ImageButton
android:src="@drawable/walk_selector"
android:id="@+id/btWalk"
android:onClick="walkMove"
android:background="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_centerVertical="true"
android:layout_marginTop="10dp"
android:layout_alignEnd="@+id/btSpeak"
android:layout_toEndOf="@+id/btLeftSpin" />
<ImageButton
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/right_walk_selector"
android:background="@color/white"
android:id="@+id/btRightWalk"
android:onClick="rightWalkMove"
android:layout_gravity="right|center_vertical"
android:layout_alignTop="@+id/btSpeak"
android:layout_alignStart="@+id/btRightSpin"
android:layout_alignParentEnd="true" />
<ImageButton
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/left_walk_selector"
android:background="@color/white"
android:id="@+id/btLeftWalk"
android:onClick="leftWalkMove"
android:layout_gravity="right|center_vertical"
android:layout_alignTop="@+id/btSpeak"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/btSpeak"
android:layout_alignBottom="@+id/btRightWalk" />
</RelativeLayout>
| {
"content_hash": "5736e86fd9d86bed2ab7b3f16d48be5a",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 77,
"avg_line_length": 37.28155339805825,
"alnum_prop": 0.6638020833333333,
"repo_name": "juandesi/android-wear-voice-message",
"id": "4055a79bd6c4f33ca78be0de9fddab577d711992",
"size": "3840",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "wear/src/main/res/layout/main_activity.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "19621"
}
],
"symlink_target": ""
} |
<?php
namespace Gobie\Debug\Message\Start\GlobalDumpers;
/**
* Dumper pro HTTP response.
*/
class ResponseGlobalDumper implements IGlobalDumper
{
/**
* Vrátí data k dumpnutí.
*
* @return mixed
*/
public function getData()
{
$response = $matches = array();
foreach (headers_list() as $value) {
preg_match('~^([^:]+):\s*(.+)$~', $value, $matches);
$response[$matches[1]] = $matches[2];
}
ksort($response);
return $response;
}
/**
* Vrátí název dumperu.
*
* @return string
*/
public function getName()
{
return 'Response';
}
}
| {
"content_hash": "ea6e7dad019f5d22dd6278afeb1cd9d4",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 64,
"avg_line_length": 18.243243243243242,
"alnum_prop": 0.5155555555555555,
"repo_name": "Gobie/debug",
"id": "7255e10a7c66ab7d9a7a8006ef0c1b628e0eeea8",
"size": "681",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Gobie/Debug/Message/Start/GlobalDumpers/ResponseGlobalDumper.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9066"
},
{
"name": "JavaScript",
"bytes": "54099"
},
{
"name": "PHP",
"bytes": "153646"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Asana Oauth Example: Browser Redirect</title>
<script src="asana.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<div id="ui">Authorizing...</div>
<script>
//<![CDATA[
/**
* Fill in this client ID before using the app.
*/
var CLIENT_ID = YOUR_CLIENT_ID_HERE;
var REDIRECT_URI = 'http://localhost:8338/redirect.html';
// Create a client.
var client = Asana.Client.create({
clientId: CLIENT_ID,
// By default, the redirect URI is the current URL, so for this example
// we don't actually have to pass it. We do anyway to show that you can.
redirectUri: REDIRECT_URI
});
// Configure the way we want to use Oauth. This auto-detects that we're
// in a browser and so defaults to the redirect flow, which we want.
client.useOauth();
// Now call `authorize` to get authorization. If the Oauth token
// is already in the URL, it will pull it out and proceed. Otherwise it
// will redirect to Asana.
client.authorize().then(function() {
// The client is authorized! Make a simple request.
$('#ui').html('Fetching...');
return client.users.me().then(function(me) {
$('#ui').text('Hello ' + me.name);
});
}).catch(function(err) {
$('#ui').html('Error: ' + err);
});
//]]>
</script>
</body> </html>
| {
"content_hash": "ad0f7c76fec6b3551a90e9f6b58f1bd9",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 84,
"avg_line_length": 28.897959183673468,
"alnum_prop": 0.6384180790960452,
"repo_name": "gitumarkk/node-asana",
"id": "d1883e6c5270cd74201bfdb10dc8ad82e92c4723",
"size": "1416",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "examples/oauth/browser/public/redirect.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "221442"
}
],
"symlink_target": ""
} |
[VAR_MODULE].controller('[NAME_CONTROLLER]', ['$scope', function($scope) {
$scope.objectExample = { name: "Fábio Rogério SJ" };
}]);
| {
"content_hash": "dbf6b0d511058bc268e9560ff183eb70",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 74,
"avg_line_length": 27.4,
"alnum_prop": 0.635036496350365,
"repo_name": "fabiorogeriosj/mockapp",
"id": "f1fe6dad1a61d3e6eb4d6eba086296eac7876e27",
"size": "139",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bin/template/controller.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "176"
},
{
"name": "JavaScript",
"bytes": "84101"
}
],
"symlink_target": ""
} |
/*
* Copyright (C) 2014 Cloudius Systems, Ltd.
*/
#ifndef PACKET_UTIL_HH_
#define PACKET_UTIL_HH_
#include "net/packet.hh"
#include <map>
#include <iostream>
namespace net {
template <typename Offset, typename Tag>
class packet_merger {
private:
static uint64_t& linearizations_ref() {
static thread_local uint64_t linearization_count;
return linearization_count;
}
public:
std::map<Offset, packet> map;
static uint64_t linearizations() {
return linearizations_ref();
}
void merge(Offset offset, packet p) {
bool insert = true;
auto beg = offset;
auto end = beg + p.len();
// Fisrt, try to merge the packet with existing segment
for (auto it = map.begin(); it != map.end();) {
auto& seg_pkt = it->second;
auto seg_beg = it->first;
auto seg_end = seg_beg + seg_pkt.len();
// There are 6 cases:
if (seg_beg <= beg && end <= seg_end) {
// 1) seg_beg beg end seg_end
// We already have data in this packet
return;
} else if (beg <= seg_beg && seg_end <= end) {
// 2) beg seg_beg seg_end end
// The new segment contains more data than this old segment
// Delete the old one, insert the new one
it = map.erase(it);
insert = true;
break;
} else if (beg < seg_beg && seg_beg <= end && end <= seg_end) {
// 3) beg seg_beg end seg_end
// Merge two segments, trim front of old segment
auto trim = end - seg_beg;
seg_pkt.trim_front(trim);
p.append(std::move(seg_pkt));
// Delete the old one, insert the new one
it = map.erase(it);
insert = true;
break;
} else if (seg_beg <= beg && beg <= seg_end && seg_end < end) {
// 4) seg_beg beg seg_end end
// Merge two segments, trim front of new segment
auto trim = seg_end - beg;
p.trim_front(trim);
// Append new data to the old segment, keep the old segment
seg_pkt.append(std::move(p));
seg_pkt.linearize();
++linearizations_ref();
insert = false;
break;
} else {
// 5) beg end < seg_beg seg_end
// or
// 6) seg_beg seg_end < beg end
// Can not merge with this segment, keep looking
it++;
insert = true;
}
}
if (insert) {
p.linearize();
++linearizations_ref();
map.emplace(beg, std::move(p));
}
// Second, merge adjacent segments after this packet has been merged,
// becasue this packet might fill a "whole" and make two adjacent
// segments mergable
for (auto it = map.begin(); it != map.end();) {
// The first segment
auto& seg_pkt = it->second;
auto seg_beg = it->first;
auto seg_end = seg_beg + seg_pkt.len();
// The second segment
auto it_next = it;
it_next++;
if (it_next == map.end()) {
break;
}
auto& p = it_next->second;
auto beg = it_next->first;
auto end = beg + p.len();
// Merge the the second segment into first segment if possible
if (seg_beg <= beg && beg <= seg_end && seg_end < end) {
// Merge two segments, trim front of second segment
auto trim = seg_end - beg;
p.trim_front(trim);
// Append new data to the first segment, keep the first segment
seg_pkt.append(std::move(p));
// Delete the second segment
map.erase(it_next);
// Keep merging this first segment with its new next packet
// So we do not update the iterator: it
continue;
} else if (end <= seg_end) {
// The first segment has all the data in the second segment
// Delete the second segment
map.erase(it_next);
continue;
} else if (seg_end < beg) {
// Can not merge first segment with second segment
it = it_next;
continue;
} else {
// If we reach here, we have a bug with merge.
std::cout << "packet_merger: merge error\n";
abort();
break;
}
}
}
};
}
#endif
| {
"content_hash": "03b7e4a908cf21934f8916d6737cf0ae",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 79,
"avg_line_length": 34.41428571428571,
"alnum_prop": 0.4746782897467829,
"repo_name": "kjniemi/seastar",
"id": "0ca8bee8dd7e0b63c7b2e939fd164594828ec4c3",
"size": "5552",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "net/packet-util.hh",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "1792201"
},
{
"name": "Protocol Buffer",
"bytes": "2051"
},
{
"name": "Python",
"bytes": "99132"
},
{
"name": "Ragel in Ruby Host",
"bytes": "10719"
},
{
"name": "Shell",
"bytes": "14963"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
namespace NUnit.Framework.Constraints
{
[TestFixture]
public class BinarySerializableTest : ConstraintTestBase
{
[SetUp]
public void SetUp()
{
theConstraint = new BinarySerializableConstraint();
expectedDescription = "binary serializable";
stringRepresentation = "<binaryserializable>";
}
static object[] SuccessData = new object[] { 1, "a", new List<int>(), new InternalWithSerializableAttributeClass() };
static object[] FailureData = new object[] { new TestCaseData( new InternalClass(), "<NUnit.Framework.Constraints.InternalClass>" ) };
[Test]
public void NullArgumentThrowsException()
{
object o = null;
Assert.Throws<ArgumentNullException>(() => theConstraint.ApplyTo(o));
}
}
}
#endif
| {
"content_hash": "ad93d0153a9b9416708c669e0252276a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 142,
"avg_line_length": 31.344827586206897,
"alnum_prop": 0.6292629262926293,
"repo_name": "NikolayPianikov/nunit",
"id": "fe9c46f866f447123b18e530616bf3639882db41",
"size": "2207",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/NUnitFramework/tests/Constraints/BinarySerializableTest.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "48"
},
{
"name": "C#",
"bytes": "4603410"
},
{
"name": "PowerShell",
"bytes": "8019"
},
{
"name": "Shell",
"bytes": "3249"
},
{
"name": "Visual Basic",
"bytes": "1689"
}
],
"symlink_target": ""
} |
package co.cask.cdap.api.workflow;
import co.cask.cdap.api.customaction.CustomAction;
/**
* Represents an action that can be executed in a {@link Workflow}. The lifecycle of a {@link WorkflowAction} is:
*
* <pre>
* try {
* {@link #initialize(WorkflowContext)}
* {@link #run()}
* // Success
* } catch (Exception e) {
* // Failure
* } finally {
* {@link #destroy()}
* }
* </pre>
* @deprecated Deprecated as of 3.5.0. Please use {@link CustomAction} instead.
*/
@Deprecated
public interface WorkflowAction extends Runnable {
/**
* Configures the {@link WorkflowAction} with the given {@link WorkflowActionConfigurer}.
*
* @param configurer A {@link WorkflowActionConfigurer} to configure the action
*/
void configure(WorkflowActionConfigurer configurer);
/**
* Initializes a {@link WorkflowAction}. This method is called before the {@link #run()} method.
*
* @param context Context object containing runtime information for this action.
* @throws Exception If there is any error during initialization. When an exception is thrown, the execution of
* this action is treated as failure of the {@link Workflow}.
*
*/
void initialize(WorkflowContext context) throws Exception;
/**
* This method is called after the {@link #run} method completes and it can be used for resource cleanup.
* Any exception thrown only gets logged but does not affect execution of the {@link Workflow}.
*/
void destroy();
}
| {
"content_hash": "8482239447f8a6147bce6f1178f93392",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 113,
"avg_line_length": 31.659574468085108,
"alnum_prop": 0.6915322580645161,
"repo_name": "caskdata/cdap",
"id": "b2000b04b4c9600cff940b96ecc8abc05044d6aa",
"size": "2090",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "cdap-api/src/main/java/co/cask/cdap/api/workflow/WorkflowAction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "26055"
},
{
"name": "CSS",
"bytes": "478678"
},
{
"name": "HTML",
"bytes": "647505"
},
{
"name": "Java",
"bytes": "19722699"
},
{
"name": "JavaScript",
"bytes": "2362906"
},
{
"name": "Python",
"bytes": "166065"
},
{
"name": "Ruby",
"bytes": "3178"
},
{
"name": "Scala",
"bytes": "173411"
},
{
"name": "Shell",
"bytes": "225202"
},
{
"name": "Visual Basic",
"bytes": "870"
}
],
"symlink_target": ""
} |
using System;
using System.IO;
using System.Text;
namespace ColorManager.ICC
{
/// <summary>
/// Provides methods to write ICC data types
/// </summary>
public sealed class ICCDataWriter
{
#region Variables
/// <summary>
/// The underlying stream where the data is written to
/// </summary>
public readonly Stream DataStream;
private static readonly bool LittleEndian = BitConverter.IsLittleEndian;
private static readonly double[,] IdentityMatrix = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
#endregion
/// <summary>
/// Creates a new instance of the <see cref="ICCDataWriter"/> class
/// </summary>
/// <param name="stream">The stream to write the data into</param>
public ICCDataWriter(Stream stream)
{
if (stream == null) throw new ArgumentNullException(nameof(stream));
if (!stream.CanWrite) throw new ArgumentException("Stream must be writable");
DataStream = stream;
}
#region Write Primitives
/// <summary>
/// Writes a byte
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteByte(byte value)
{
DataStream.WriteByte(value);
return 1;
}
/// <summary>
/// Writes an ushort
/// </summary>
/// <returns>the number of bytes written</returns>
public unsafe int WriteUInt16(ushort value)
{
return WriteBytes((byte*)&value, 2);
}
/// <summary>
/// Writes a short
/// </summary>
/// <returns>the number of bytes written</returns>
public unsafe int WriteInt16(short value)
{
return WriteBytes((byte*)&value, 2);
}
/// <summary>
/// Writes an uint
/// </summary>
/// <returns>the number of bytes written</returns>
public unsafe int WriteUInt32(uint value)
{
return WriteBytes((byte*)&value, 4);
}
/// <summary>
/// Writes an int
/// </summary>
/// <returns>the number of bytes written</returns>
public unsafe int WriteInt32(int value)
{
return WriteBytes((byte*)&value, 4);
}
/// <summary>
/// Writes an ulong
/// </summary>
/// <returns>the number of bytes written</returns>
public unsafe int WriteUInt64(ulong value)
{
return WriteBytes((byte*)&value, 8);
}
/// <summary>
/// Writes a long
/// </summary>
/// <returns>the number of bytes written</returns>
public unsafe int WriteInt64(long value)
{
return WriteBytes((byte*)&value, 8);
}
/// <summary>
/// Writes a float
/// </summary>
/// <returns>the number of bytes written</returns>
public unsafe int WriteSingle(float value)
{
return WriteBytes((byte*)&value, 4);
}
/// <summary>
/// Writes a double
/// </summary>
/// <returns>the number of bytes written</returns>
public unsafe int WriteDouble(double value)
{
return WriteBytes((byte*)&value, 8);
}
/// <summary>
/// Writes a signed 32bit number with 1 sign bit, 15 value bits and 16 fractional bits
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteFix16(double value)
{
const double max = short.MaxValue + (65535d / 65536d);
const double min = short.MinValue;
if (value > max) value = max;
else if (value < min) value = min;
value *= 65536d;
return WriteInt32((int)Math.Round(value, MidpointRounding.AwayFromZero));
}
/// <summary>
/// Writes an unsigned 32bit number with 16 value bits and 16 fractional bits
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteUFix16(double value)
{
const double max = ushort.MaxValue + (65535d / 65536d);
const double min = ushort.MinValue;
if (value > max) value = max;
else if (value < min) value = min;
value *= 65536d;
return WriteUInt32((uint)Math.Round(value, MidpointRounding.AwayFromZero));
}
/// <summary>
/// Writes an unsigned 16bit number with 1 value bit and 15 fractional bits
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteU1Fix15(double value)
{
const double max = 1 + (32767d / 32768d);
const double min = 0;
if (value > max) value = max;
else if (value < min) value = min;
value *= 32768d;
return WriteUInt16((ushort)Math.Round(value, MidpointRounding.AwayFromZero));
}
/// <summary>
/// Writes an unsigned 16bit number with 8 value bits and 8 fractional bits
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteUFix8(double value)
{
const double max = byte.MaxValue + (255d / 256d);
const double min = byte.MinValue;
if (value > max) value = max;
else if (value < min) value = min;
value *= 256d;
return WriteUInt16((ushort)Math.Round(value, MidpointRounding.AwayFromZero));
}
/// <summary>
/// Writes an ASCII encoded string
/// </summary>
/// <param name="value">the string to write</param>
/// <returns>the number of bytes written</returns>
public int WriteASCIIString(string value)
{
return WriteASCIIString(value, value.Length);
}
/// <summary>
/// Writes an ASCII encoded string
/// </summary>
/// <param name="value">the string to write</param>
/// <param name="length">the desired length of the string</param>
/// <returns>the number of bytes written</returns>
public int WriteASCIIString(string value, int length)
{
byte[] data = Encoding.ASCII.GetBytes(SetRange(value, length));
DataStream.Write(data, 0, data.Length);
return data.Length;
}
/// <summary>
/// Writes an UTF-16 big-endian encoded string
/// </summary>
/// <param name="value">the string to write</param>
/// <returns>the number of bytes written</returns>
public int WriteUnicodeString(string value)
{
byte[] data = Encoding.BigEndianUnicode.GetBytes(value);
DataStream.Write(data, 0, data.Length);
return data.Length;
}
#endregion
#region Write Structs
/// <summary>
/// Writes a DateTime
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteDateTime(DateTime value)
{
return WriteUInt16((ushort)value.Year)
+ WriteUInt16((ushort)value.Month)
+ WriteUInt16((ushort)value.Day)
+ WriteUInt16((ushort)value.Hour)
+ WriteUInt16((ushort)value.Minute)
+ WriteUInt16((ushort)value.Second);
}
/// <summary>
/// Writes an ICC profile version number
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteVersionNumber(VersionNumber value)
{
byte major = SetRangeUInt8(value.Major);
byte minor = (byte)SetRange(value.Minor, 0, 15);
byte bugfix = (byte)SetRange(value.Bugfix, 0, 15);
byte mb = (byte)((minor << 4) | bugfix);
return WriteByte(major)
+ WriteByte(mb)
+ WriteEmpty(2);
}
/// <summary>
/// Writes an ICC profile flag
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteProfileFlag(ProfileFlag value)
{
int flags = 0;
for (int i = value.Flags.Length - 1; i >= 0; i--)
{
if (value.Flags[i]) flags |= 1 << i;
}
return WriteUInt16((ushort)flags)
+ WriteEmpty(2);
}
/// <summary>
/// Writes ICC device attributes
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteDeviceAttribute(DeviceAttribute value)
{
int flags = 0;
flags |= (int)value.Opacity << 7;
flags |= (int)value.Reflectivity << 6;
flags |= (int)value.Polarity << 5;
flags |= (int)value.Chroma << 4;
return WriteByte((byte)flags)
+ WriteEmpty(3)
+ WriteArray(value.VendorData);
}
/// <summary>
/// Writes an XYZ number
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteXYZNumber(XYZNumber value)
{
return WriteFix16(value.X)
+ WriteFix16(value.Y)
+ WriteFix16(value.Z);
}
/// <summary>
/// Writes a profile ID
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteProfileID(ProfileID value)
{
return WriteArray(value.Values);
}
/// <summary>
/// Writes a position number
/// </summary>
/// <returns>the number of bytes written</returns>
public int WritePositionNumber(PositionNumber value)
{
return WriteUInt32(value.Offset)
+ WriteUInt32(value.Size);
}
/// <summary>
/// Writes a response number
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteResponseNumber(ResponseNumber value)
{
return WriteUInt16(value.DeviceCode)
+ WriteFix16(value.MeasurementValue);
}
/// <summary>
/// Writes a named color
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteNamedColor(NamedColor value)
{
return WriteASCIIString(value.Name, 31)
+ WriteEmpty(1) //Null terminator
+ WriteArray(value.PCScoordinates)
+ WriteArray(value.DeviceCoordinates);
}
/// <summary>
/// Writes a profile description
/// </summary>
/// <returns>the number of bytes written</returns>
public int WriteProfileDescription(ProfileDescription value)
{
return WriteUInt32(value.DeviceManufacturer)
+ WriteUInt32(value.DeviceModel)
+ WriteDeviceAttribute(value.DeviceAttributes)
+ WriteUInt32((uint)value.TechnologyInformation)
+ WriteTagDataEntryHeader(TypeSignature.MultiLocalizedUnicode)
+ WriteMultiLocalizedUnicodeTagDataEntry(new MultiLocalizedUnicodeTagDataEntry(value.DeviceManufacturerInfo))
+ WriteTagDataEntryHeader(TypeSignature.MultiLocalizedUnicode)
+ WriteMultiLocalizedUnicodeTagDataEntry(new MultiLocalizedUnicodeTagDataEntry(value.DeviceModelInfo));
}
#endregion
#region Write Tag Data Entries
/// <summary>
/// Writes a tag data entry
/// </summary>
/// <param name="data">The entry to write</param>
/// <param name="table">The table entry for the written data entry</param>
/// <returns>The number of bytes written (excluding padding)</returns>
public int WriteTagDataEntry(TagDataEntry data, out TagTableEntry table)
{
uint offset = (uint)DataStream.Position;
int c = WriteTagDataEntry(data);
WritePadding();
table = new TagTableEntry(data.TagSignature, offset, (uint)c);
return c;
}
/// <summary>
/// Writes a tag data entry (without padding)
/// </summary>
/// <param name="entry">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteTagDataEntry(TagDataEntry entry)
{
TypeSignature t = entry.Signature;
int c = WriteTagDataEntryHeader(entry.Signature);
switch (t)
{
case TypeSignature.Chromaticity:
c += WriteChromaticityTagDataEntry(entry as ChromaticityTagDataEntry);
break;
case TypeSignature.ColorantOrder:
c += WriteColorantOrderTagDataEntry(entry as ColorantOrderTagDataEntry);
break;
case TypeSignature.ColorantTable:
c += WriteColorantTableTagDataEntry(entry as ColorantTableTagDataEntry);
break;
case TypeSignature.Curve:
c += WriteCurveTagDataEntry(entry as CurveTagDataEntry);
break;
case TypeSignature.Data:
c += WriteDataTagDataEntry(entry as DataTagDataEntry);
break;
case TypeSignature.DateTime:
c += WriteDateTimeTagDataEntry(entry as DateTimeTagDataEntry);
break;
case TypeSignature.Lut16:
c += WriteLut16TagDataEntry(entry as Lut16TagDataEntry);
break;
case TypeSignature.Lut8:
c += WriteLut8TagDataEntry(entry as Lut8TagDataEntry);
break;
case TypeSignature.LutAToB:
c += WriteLutAToBTagDataEntry(entry as LutAToBTagDataEntry);
break;
case TypeSignature.LutBToA:
c += WriteLutBToATagDataEntry(entry as LutBToATagDataEntry);
break;
case TypeSignature.Measurement:
c += WriteMeasurementTagDataEntry(entry as MeasurementTagDataEntry);
break;
case TypeSignature.MultiLocalizedUnicode:
c += WriteMultiLocalizedUnicodeTagDataEntry(entry as MultiLocalizedUnicodeTagDataEntry);
break;
case TypeSignature.MultiProcessElements:
c += WriteMultiProcessElementsTagDataEntry(entry as MultiProcessElementsTagDataEntry);
break;
case TypeSignature.NamedColor2:
c += WriteNamedColor2TagDataEntry(entry as NamedColor2TagDataEntry);
break;
case TypeSignature.ParametricCurve:
c += WriteParametricCurveTagDataEntry(entry as ParametricCurveTagDataEntry);
break;
case TypeSignature.ProfileSequenceDesc:
c += WriteProfileSequenceDescTagDataEntry(entry as ProfileSequenceDescTagDataEntry);
break;
case TypeSignature.ProfileSequenceIdentifier:
c += WriteProfileSequenceIdentifierTagDataEntry(entry as ProfileSequenceIdentifierTagDataEntry);
break;
case TypeSignature.ResponseCurveSet16:
c += WriteResponseCurveSet16TagDataEntry(entry as ResponseCurveSet16TagDataEntry);
break;
case TypeSignature.S15Fixed16Array:
c += WriteFix16ArrayTagDataEntry(entry as Fix16ArrayTagDataEntry);
break;
case TypeSignature.Signature:
c += WriteSignatureTagDataEntry(entry as SignatureTagDataEntry);
break;
case TypeSignature.Text:
c += WriteTextTagDataEntry(entry as TextTagDataEntry);
break;
case TypeSignature.U16Fixed16Array:
c += WriteUFix16ArrayTagDataEntry(entry as UFix16ArrayTagDataEntry);
break;
case TypeSignature.UInt16Array:
c += WriteUInt16ArrayTagDataEntry(entry as UInt16ArrayTagDataEntry);
break;
case TypeSignature.UInt32Array:
c += WriteUInt32ArrayTagDataEntry(entry as UInt32ArrayTagDataEntry);
break;
case TypeSignature.UInt64Array:
c += WriteUInt64ArrayTagDataEntry(entry as UInt64ArrayTagDataEntry);
break;
case TypeSignature.UInt8Array:
c += WriteUInt8ArrayTagDataEntry(entry as UInt8ArrayTagDataEntry);
break;
case TypeSignature.ViewingConditions:
c += WriteViewingConditionsTagDataEntry(entry as ViewingConditionsTagDataEntry);
break;
case TypeSignature.XYZ:
c += WriteXYZTagDataEntry(entry as XYZTagDataEntry);
break;
//V2 Type:
case TypeSignature.TextDescription:
c += WriteTextDescriptionTagDataEntry(entry as TextDescriptionTagDataEntry);
break;
case TypeSignature.Unknown:
default:
c += WriteUnknownTagDataEntry(entry as UnknownTagDataEntry);
break;
}
return c;
}
/// <summary>
/// Writes the header of a <see cref="TagDataEntry"/>
/// </summary>
/// <param name="signature">The signature of the entry</param>
/// <returns>The number of bytes written</returns>
public int WriteTagDataEntryHeader(TypeSignature signature)
{
return WriteUInt32((uint)signature)
+ WriteEmpty(4);
}
/// <summary>
/// Writes a <see cref="UnknownTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteUnknownTagDataEntry(UnknownTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteArray(value.Data);
}
/// <summary>
/// Writes a <see cref="ChromaticityTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteChromaticityTagDataEntry(ChromaticityTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteUInt16((ushort)value.ChannelCount);
c += WriteUInt16((ushort)value.ColorantType);
for (int i = 0; i < value.ChannelCount; i++)
{
c += WriteUFix16(value.ChannelValues[i][0]);
c += WriteUFix16(value.ChannelValues[i][1]);
}
return c;
}
/// <summary>
/// Writes a <see cref="ColorantOrderTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteColorantOrderTagDataEntry(ColorantOrderTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteUInt32((uint)value.ColorantNumber.Length)
+ WriteArray(value.ColorantNumber);
}
/// <summary>
/// Writes a <see cref="ColorantTableTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteColorantTableTagDataEntry(ColorantTableTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteUInt32((uint)value.ColorantData.Length);
foreach (var colorant in value.ColorantData)
{
c += WriteASCIIString(colorant.Name, 32);
c += WriteUInt16(colorant.PCS1);
c += WriteUInt16(colorant.PCS2);
c += WriteUInt16(colorant.PCS3);
}
return c;
}
/// <summary>
/// Writes a <see cref="CurveTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteCurveTagDataEntry(CurveTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
if (value.IsIdentityResponse)
{
c += WriteUInt32(0);
}
else if (value.IsGamma)
{
c += WriteUInt32(1);
c += WriteUFix8(value.Gamma);
}
else
{
c += WriteUInt32((uint)value.CurveData.Length);
for (int i = 0; i < value.CurveData.Length; i++)
{
c += WriteUInt16(SetRangeUInt16(value.CurveData[i]));
}
}
return c;
//TODO: Page 48: If the input is PCSXYZ, 1+(32 767/32 768) shall be mapped to the value 1,0. If the output is PCSXYZ, the value 1,0 shall be mapped to 1+(32 767/32 768).
}
/// <summary>
/// Writes a <see cref="DataTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteDataTagDataEntry(DataTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteEmpty(3)
+ WriteByte((byte)(value.IsASCII ? 0x01 : 0x00))
+ WriteArray(value.Data);
}
/// <summary>
/// Writes a <see cref="DateTimeTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteDateTimeTagDataEntry(DateTimeTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteDateTime(value.Value);
}
/// <summary>
/// Writes a <see cref="Lut16TagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteLut16TagDataEntry(Lut16TagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteByte((byte)value.InputValues.Length);
c += WriteByte((byte)value.OutputValues.Length);
c += WriteByte(value.CLUTValues.GridPointCount[0]);
c += WriteEmpty(1);
c += WriteMatrix(value.Matrix ?? IdentityMatrix, false);
c += WriteUInt16((ushort)value.InputValues[0].Values.Length);
c += WriteUInt16((ushort)value.OutputValues[0].Values.Length);
foreach (var lut in value.InputValues) { c += WriteLUT16(lut); }
c += WriteCLUT16(value.CLUTValues);
foreach (var lut in value.OutputValues) { c += WriteLUT16(lut); }
return c;
}
/// <summary>
/// Writes a <see cref="Lut8TagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteLut8TagDataEntry(Lut8TagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteByte((byte)value.InputChannelCount);
c += WriteByte((byte)value.OutputChannelCount);
c += WriteByte((byte)value.CLUTValues.Values[0].Length);
c += WriteEmpty(1);
c += WriteMatrix(value.Matrix ?? IdentityMatrix, false);
foreach (var lut in value.InputValues) { c += WriteLUT8(lut); }
c += WriteCLUT8(value.CLUTValues);
foreach (var lut in value.OutputValues) { c += WriteLUT8(lut); }
return c;
}
/// <summary>
/// Writes a <see cref="LutAToBTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteLutAToBTagDataEntry(LutAToBTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
long start = DataStream.Position - 8;
int c = WriteByte((byte)value.InputChannelCount);
c += WriteByte((byte)value.OutputChannelCount);
c += WriteEmpty(2);
long bCurveOffset = 0;
long matrixOffset = 0;
long mCurveOffset = 0;
long CLUTOffset = 0;
long aCurveOffset = 0;
//Jump over offset values
long offsetpos = DataStream.Position;
DataStream.Position += 5 * 4;
if (value.CurveB != null)
{
bCurveOffset = DataStream.Position;
c += WriteCurves(value.CurveB);
c += WritePadding();
}
if (value.Matrix3x1 != null && value.Matrix3x3 != null)
{
matrixOffset = DataStream.Position;
c += WriteMatrix(value.Matrix3x3, false);
c += WriteMatrix(value.Matrix3x1, false);
c += WritePadding();
}
if (value.CurveM != null)
{
mCurveOffset = DataStream.Position;
c += WriteCurves(value.CurveM);
c += WritePadding();
}
if (value.CLUTValues != null)
{
CLUTOffset = DataStream.Position;
c += WriteCLUT(value.CLUTValues);
c += WritePadding();
}
if (value.CurveA != null)
{
aCurveOffset = DataStream.Position;
c += WriteCurves(value.CurveA);
c += WritePadding();
}
//Set offset values
long lpos = DataStream.Position;
DataStream.Position = offsetpos;
if (bCurveOffset != 0) bCurveOffset -= start;
if (matrixOffset != 0) matrixOffset -= start;
if (mCurveOffset != 0) mCurveOffset -= start;
if (CLUTOffset != 0) CLUTOffset -= start;
if (aCurveOffset != 0) aCurveOffset -= start;
c += WriteUInt32((uint)bCurveOffset);
c += WriteUInt32((uint)matrixOffset);
c += WriteUInt32((uint)mCurveOffset);
c += WriteUInt32((uint)CLUTOffset);
c += WriteUInt32((uint)aCurveOffset);
DataStream.Position = lpos;
return c;
}
/// <summary>
/// Writes a <see cref="LutBToATagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteLutBToATagDataEntry(LutBToATagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
long start = DataStream.Position - 8;
int c = WriteByte((byte)value.InputChannelCount);
c += WriteByte((byte)value.OutputChannelCount);
c += WriteEmpty(2);
long bCurveOffset = 0;
long matrixOffset = 0;
long mCurveOffset = 0;
long CLUTOffset = 0;
long aCurveOffset = 0;
//Jump over offset values
long offsetpos = DataStream.Position;
DataStream.Position += 5 * 4;
if (value.CurveB != null)
{
bCurveOffset = DataStream.Position;
c += WriteCurves(value.CurveB);
c += WritePadding();
}
if (value.Matrix3x1 != null && value.Matrix3x3 != null)
{
matrixOffset = DataStream.Position;
c += WriteMatrix(value.Matrix3x3, false);
c += WriteMatrix(value.Matrix3x1, false);
c += WritePadding();
}
if (value.CurveM != null)
{
mCurveOffset = DataStream.Position;
c += WriteCurves(value.CurveM);
c += WritePadding();
}
if (value.CLUTValues != null)
{
CLUTOffset = DataStream.Position;
c += WriteCLUT(value.CLUTValues);
c += WritePadding();
}
if (value.CurveA != null)
{
aCurveOffset = DataStream.Position;
c += WriteCurves(value.CurveA);
c += WritePadding();
}
//Set offset values
long lpos = DataStream.Position;
DataStream.Position = offsetpos;
if (bCurveOffset != 0) bCurveOffset -= start;
if (matrixOffset != 0) matrixOffset -= start;
if (mCurveOffset != 0) mCurveOffset -= start;
if (CLUTOffset != 0) CLUTOffset -= start;
if (aCurveOffset != 0) aCurveOffset -= start;
c += WriteUInt32((uint)bCurveOffset);
c += WriteUInt32((uint)matrixOffset);
c += WriteUInt32((uint)mCurveOffset);
c += WriteUInt32((uint)CLUTOffset);
c += WriteUInt32((uint)aCurveOffset);
DataStream.Position = lpos;
return c;
}
/// <summary>
/// Writes a <see cref="MeasurementTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteMeasurementTagDataEntry(MeasurementTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteUInt32((uint)value.Observer)
+ WriteXYZNumber(value.XYZBacking)
+ WriteUInt32((uint)value.Geometry)
+ WriteUFix16(value.Flare)
+ WriteUInt32((uint)value.Illuminant);
}
/// <summary>
/// Writes a <see cref="MultiLocalizedUnicodeTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteMultiLocalizedUnicodeTagDataEntry(MultiLocalizedUnicodeTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
long start = DataStream.Position - 8;
int count = value.Text.Length;
int c = WriteUInt32((uint)count);
c += WriteUInt32(12);//One record has always 12 bytes size
//Jump over position table
long tpos = DataStream.Position;
DataStream.Position += count * 12;
var offset = new uint[count];
var length = new int[count];
for (int i = 0; i < count; i++)
{
offset[i] = (uint)(DataStream.Position - start);
c += length[i] = WriteUnicodeString(value.Text[i].Text);
}
//Write position table
long lpos = DataStream.Position;
DataStream.Position = tpos;
for (int i = 0; i < count; i++)
{
string[] code = value.Text[i].Culture.Split('-');
if (code.Length != 2) throw new Exception();
c += WriteASCIIString(code[0], 2);
c += WriteASCIIString(code[1], 2);
c += WriteUInt32((uint)length[i]);
c += WriteUInt32(offset[i]);
}
DataStream.Position = lpos;
return c;
}
/// <summary>
/// Writes a <see cref="MultiProcessElementsTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteMultiProcessElementsTagDataEntry(MultiProcessElementsTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
long start = DataStream.Position - 8;
int c = WriteUInt16((ushort)value.InputChannelCount);
c += WriteUInt16((ushort)value.OutputChannelCount);
c += WriteUInt32((uint)value.Data.Length);
//Jump over position table
long tpos = DataStream.Position;
DataStream.Position += value.Data.Length * 8;
var posTable = new PositionNumber[value.Data.Length];
for (int i = 0; i < value.Data.Length; i++)
{
uint offset = (uint)(DataStream.Position - start);
int size = WriteMultiProcessElement(value.Data[i]);
c += WritePadding();
posTable[i] = new PositionNumber(offset, (uint)size);
c += size;
}
//Write position table
long lpos = DataStream.Position;
DataStream.Position = tpos;
foreach (var pos in posTable) { c += WritePositionNumber(pos); }
DataStream.Position = lpos;
return c;
}
/// <summary>
/// Writes a <see cref="NamedColor2TagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteNamedColor2TagDataEntry(NamedColor2TagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteArray(value.VendorFlags)
+ WriteEmpty(4 - value.VendorFlags.Length)
+ WriteUInt32((uint)value.Colors.Length)
+ WriteUInt32((uint)value.CoordCount)
+ WriteASCIIString(value.Prefix, 31)
+ WriteEmpty(1)//Null terminator
+ WriteASCIIString(value.Suffix, 31)
+ WriteEmpty(1);//Null terminator
foreach (var color in value.Colors) { c += WriteNamedColor(color); }
return c;
}
/// <summary>
/// Writes a <see cref="ParametricCurveTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteParametricCurveTagDataEntry(ParametricCurveTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteParametricCurve(value.Curve);
}
/// <summary>
/// Writes a <see cref="ProfileSequenceDescTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteProfileSequenceDescTagDataEntry(ProfileSequenceDescTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteUInt32((uint)value.Descriptions.Length);
foreach (var desc in value.Descriptions) { c += WriteProfileDescription(desc); }
return c;
}
/// <summary>
/// Writes a <see cref="ProfileSequenceIdentifierTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteProfileSequenceIdentifierTagDataEntry(ProfileSequenceIdentifierTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
long start = DataStream.Position - 8;
int count = value.Data.Length;
int c = WriteUInt32((uint)count);
//Jump over position table
long tpos = DataStream.Position;
DataStream.Position += count * 8;
var table = new PositionNumber[count];
for (int i = 0; i < count; i++)
{
uint offset = (uint)(DataStream.Position - start);
int size = WriteProfileID(value.Data[i].ID);
size += WriteTagDataEntry(new MultiLocalizedUnicodeTagDataEntry(value.Data[i].Description));
size += WritePadding();
table[i] = new PositionNumber(offset, (uint)size);
c += size;
}
//Write position table
long lpos = DataStream.Position;
DataStream.Position = tpos;
foreach (var pos in table) { c += WritePositionNumber(pos); }
DataStream.Position = lpos;
return c;
}
/// <summary>
/// Writes a <see cref="ResponseCurveSet16TagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteResponseCurveSet16TagDataEntry(ResponseCurveSet16TagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
long start = DataStream.Position - 8;
int c = WriteUInt16(value.ChannelCount);
c += WriteUInt16((ushort)value.Curves.Length);
//Jump over position table
long tpos = DataStream.Position;
DataStream.Position += value.Curves.Length * 4;
var offset = new uint[value.Curves.Length];
for (int i = 0; i < value.Curves.Length; i++)
{
offset[i] = (uint)(DataStream.Position - start);
c += WriteResponseCurve(value.Curves[i]);
c += WritePadding();
}
//Write position table
long lpos = DataStream.Position;
DataStream.Position = tpos;
c += WriteArray(offset);
DataStream.Position = lpos;
return c;
}
/// <summary>
/// Writes a <see cref="Fix16ArrayTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteFix16ArrayTagDataEntry(Fix16ArrayTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
for (int i = 0; i < value.Data.Length; i++) { c += WriteFix16(value.Data[i] * 256d); }
return c;
}
/// <summary>
/// Writes a <see cref="SignatureTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteSignatureTagDataEntry(SignatureTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteASCIIString(value.SignatureData, 4);
}
/// <summary>
/// Writes a <see cref="TextTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteTextTagDataEntry(TextTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteASCIIString(value.Text);
}
/// <summary>
/// Writes a <see cref="UFix16ArrayTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteUFix16ArrayTagDataEntry(UFix16ArrayTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
for (int i = 0; i < value.Data.Length; i++) { c += WriteUFix16(value.Data[i]); }
return c;
}
/// <summary>
/// Writes a <see cref="UInt16ArrayTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteUInt16ArrayTagDataEntry(UInt16ArrayTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteArray(value.Data);
}
/// <summary>
/// Writes a <see cref="UInt32ArrayTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteUInt32ArrayTagDataEntry(UInt32ArrayTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteArray(value.Data);
}
/// <summary>
/// Writes a <see cref="UInt64ArrayTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteUInt64ArrayTagDataEntry(UInt64ArrayTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteArray(value.Data);
}
/// <summary>
/// Writes a <see cref="UInt8ArrayTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteUInt8ArrayTagDataEntry(UInt8ArrayTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteArray(value.Data);
}
/// <summary>
/// Writes a <see cref="ViewingConditionsTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteViewingConditionsTagDataEntry(ViewingConditionsTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteXYZNumber(value.IlluminantXYZ)
+ WriteXYZNumber(value.SurroundXYZ)
+ WriteUInt32((uint)value.Illuminant);
}
/// <summary>
/// Writes a <see cref="XYZTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteXYZTagDataEntry(XYZTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
for (int i = 0; i < value.Data.Length; i++) { c += WriteXYZNumber(value.Data[i]); }
return c;
}
/// <summary>
/// Writes a <see cref="TextDescriptionTagDataEntry"/>
/// </summary>
/// <param name="value">The entry to write</param>
/// <returns>The number of bytes written</returns>
public int WriteTextDescriptionTagDataEntry(TextDescriptionTagDataEntry value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int size, c = 0;
if (value.ASCII == null) c += WriteUInt32(0);
else
{
DataStream.Position += 4;
c += size = WriteASCIIString(value.ASCII + '\0');
DataStream.Position -= size + 4;
c += WriteUInt32((uint)size);
DataStream.Position += size;
}
if (value.Unicode == null)
{
c += WriteUInt32(0);
c += WriteUInt32(0);
}
else
{
DataStream.Position += 8;
c += size = WriteUnicodeString(value.Unicode + '\0');
DataStream.Position -= size + 8;
c += WriteUInt32(value.UnicodeLanguageCode);
c += WriteUInt32((uint)value.Unicode.Length + 1);
DataStream.Position += size;
}
if (value.ScriptCode == null)
{
c += WriteUInt16(0);
c += WriteByte(0);
c += WriteEmpty(67);
}
else
{
DataStream.Position += 3;
c += size = WriteASCIIString(SetRange(value.ScriptCode, 66) + '\0');
DataStream.Position -= size + 3;
c += WriteUInt16(value.ScriptCodeCode);
c += WriteByte((byte)(value.ScriptCode.Length > 66 ? 67 : value.ScriptCode.Length + 1));
DataStream.Position += size;
}
return c;
}
#endregion
#region Write Matrix
/// <summary>
/// Writes a two dimensional matrix
/// </summary>
/// <param name="value">The matrix to write</param>
/// <param name="isSingle">True if the values are encoded as Single; false if encoded as Fix16</param>
/// <returns>The number of bytes written</returns>
public int WriteMatrix(double[,] value, bool isSingle)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
for (int y = 0; y < value.GetLength(1); y++)
{
for (int x = 0; x < value.GetLength(0); x++)
{
if (isSingle) { c += WriteSingle((float)value[x, y]); }
else { c += WriteFix16(value[x, y]); }
}
}
return c;
}
/// <summary>
/// Writes a one dimensional matrix
/// </summary>
/// <param name="value">The matrix to write</param>
/// <param name="isSingle">True if the values are encoded as Single; false if encoded as Fix16</param>
/// <returns>The number of bytes written</returns>
public int WriteMatrix(double[] value, bool isSingle)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
for (int i = 0; i < value.Length; i++)
{
if (isSingle) { c += WriteSingle((float)value[i]); }
else { c += WriteFix16(value[i]); }
}
return c;
}
#endregion
#region Write (C)LUT
/// <summary>
/// Writes an 8bit lookup table
/// </summary>
/// <param name="value">The LUT to write</param>
/// <returns>The number of bytes written</returns>
public int WriteLUT8(LUT value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
foreach (var item in value.Values) { c += WriteByte(SetRangeUInt8(item)); }
return c;
}
/// <summary>
/// Writes an 16bit lookup table
/// </summary>
/// <param name="value">The LUT to write</param>
/// <returns>The number of bytes written</returns>
public int WriteLUT16(LUT value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
foreach (var item in value.Values) { c += WriteUInt16(SetRangeUInt16(item)); }
return c;
}
/// <summary>
/// Writes an color lookup table
/// </summary>
/// <param name="value">The CLUT to write</param>
/// <returns>The number of bytes written</returns>
public int WriteCLUT(CLUT value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteArray(value.GridPointCount);
c += WriteEmpty(16 - value.GridPointCount.Length);
switch (value.DataType)
{
case CLUTDataType.Float:
return c + WriteCLUTf32(value);
case CLUTDataType.UInt8:
c += WriteByte(1);
c += WriteEmpty(3);
return c + WriteCLUT8(value);
case CLUTDataType.UInt16:
c += WriteByte(2);
c += WriteEmpty(3);
return c + WriteCLUT16(value);
default:
throw new CorruptProfileException("CLUT");
}
}
/// <summary>
/// Writes a 8bit color lookup table
/// </summary>
/// <param name="value">The CLUT to write</param>
/// <returns>The number of bytes written</returns>
public int WriteCLUT8(CLUT value)
{
int c = 0;
foreach (var inArr in value.Values)
{
foreach (var item in inArr)
{
c += WriteByte(SetRangeUInt8(item));
}
}
return c;
}
/// <summary>
/// Writes a 16bit color lookup table
/// </summary>
/// <param name="value">The CLUT to write</param>
/// <returns>The number of bytes written</returns>
public int WriteCLUT16(CLUT value)
{
int c = 0;
foreach (var inArr in value.Values)
{
foreach (var item in inArr)
{
c += WriteUInt16(SetRangeUInt16(item));
}
}
return c;
}
/// <summary>
/// Writes a 32bit float color lookup table
/// </summary>
/// <param name="value">The CLUT to write</param>
/// <returns>The number of bytes written</returns>
public int WriteCLUTf32(CLUT value)
{
int c = 0;
foreach (var inArr in value.Values)
{
foreach (var item in inArr)
{
c += WriteSingle((float)item);
}
}
return c;
}
#endregion
#region Write MultiProcessElement
/// <summary>
/// Writes a <see cref="MultiProcessElement"/>
/// </summary>
/// <param name="value">The element to write</param>
/// <returns>The number of bytes written</returns>
public int WriteMultiProcessElement(MultiProcessElement value)
{
int c = WriteUInt32((uint)value.Signature);
c += WriteUInt16((ushort)value.InputChannelCount);
c += WriteUInt16((ushort)value.OutputChannelCount);
switch (value.Signature)
{
case MultiProcessElementSignature.CurveSet:
return c + WriteCurveSetProcessElement(value as CurveSetProcessElement);
case MultiProcessElementSignature.Matrix:
return c + WriteMatrixProcessElement(value as MatrixProcessElement);
case MultiProcessElementSignature.CLUT:
return c + WriteCLUTProcessElement(value as CLUTProcessElement);
case MultiProcessElementSignature.bACS:
case MultiProcessElementSignature.eACS:
return c + WriteEmpty(8);
default:
throw new CorruptProfileException("MultiProcessElement");
}
}
/// <summary>
/// Writes a CurveSet <see cref="MultiProcessElement"/>
/// </summary>
/// <param name="value">The element to write</param>
/// <returns>The number of bytes written</returns>
public int WriteCurveSetProcessElement(CurveSetProcessElement value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = 0;
foreach (var curve in value.Curves)
{
c += WriteOneDimensionalCurve(curve);
c += WritePadding();
}
return c;
}
/// <summary>
/// Writes a Matrix <see cref="MultiProcessElement"/>
/// </summary>
/// <param name="value">The element to write</param>
/// <returns>The number of bytes written</returns>
public int WriteMatrixProcessElement(MatrixProcessElement value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteMatrix(value.MatrixIxO, true)
+ WriteMatrix(value.MatrixOx1, true);
}
/// <summary>
/// Writes a CLUT <see cref="MultiProcessElement"/>
/// </summary>
/// <param name="value">The element to write</param>
/// <returns>The number of bytes written</returns>
public int WriteCLUTProcessElement(CLUTProcessElement value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return WriteCLUT(value.CLUTValue);
}
#endregion
#region Write Curves
/// <summary>
/// Writes a <see cref="OneDimensionalCurve"/>
/// </summary>
/// <param name="value">The curve to write</param>
/// <returns>The number of bytes written</returns>
public int WriteOneDimensionalCurve(OneDimensionalCurve value)
{
int c = WriteUInt16((ushort)value.Segments.Length);
c += WriteEmpty(2);
foreach (var point in value.BreakPoints) { c += WriteSingle((float)point); }
foreach (var segment in value.Segments) { c += WriteCurveSegment(segment); }
return c;
}
/// <summary>
/// Writes a <see cref="ResponseCurve"/>
/// </summary>
/// <param name="value">The curve to write</param>
/// <returns>The number of bytes written</returns>
public int WriteResponseCurve(ResponseCurve value)
{
int c = WriteUInt32((uint)value.CurveType);
int channels = value.XYZvalues.Length;
foreach (var responseArr in value.ResponseArrays) { c += WriteUInt32((uint)responseArr.Length); }
foreach (var xyz in value.XYZvalues) { c += WriteXYZNumber(xyz); }
foreach (var responseArr in value.ResponseArrays)
{
foreach (var response in responseArr)
{
c += WriteResponseNumber(response);
}
}
return c;
}
/// <summary>
/// Writes a <see cref="ParametricCurve"/>
/// </summary>
/// <param name="value">The curve to write</param>
/// <returns>The number of bytes written</returns>
public int WriteParametricCurve(ParametricCurve value)
{
int c = WriteUInt16(value.type);
c += WriteEmpty(2);
if (value.type >= 0 && value.type <= 4) c += WriteFix16(value.g);
if (value.type > 0 && value.type <= 4)
{
c += WriteFix16(value.a);
c += WriteFix16(value.b);
}
if (value.type > 1 && value.type <= 4) c += WriteFix16(value.c);
if (value.type > 2 && value.type <= 4) c += WriteFix16(value.d);
if (value.type == 4)
{
c += WriteFix16(value.e);
c += WriteFix16(value.f);
}
return c;
}
/// <summary>
/// Writes a <see cref="CurveSegment"/>
/// </summary>
/// <param name="value">The curve to write</param>
/// <returns>The number of bytes written</returns>
public int WriteCurveSegment(CurveSegment value)
{
int c = WriteUInt32((uint)value.Signature);
c += WriteEmpty(4);
switch (value.Signature)
{
case CurveSegmentSignature.FormulaCurve:
return c + WriteFormulaCurveElement(value as FormulaCurveElement);
case CurveSegmentSignature.SampledCurve:
return c + WriteSampledCurveElement(value as SampledCurveElement);
default:
throw new CorruptProfileException("CurveSegment");
}
}
/// <summary>
/// Writes a <see cref="FormulaCurveElement"/>
/// </summary>
/// <param name="value">The curve to write</param>
/// <returns>The number of bytes written</returns>
public int WriteFormulaCurveElement(FormulaCurveElement value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteUInt16(value.type);
c += WriteEmpty(2);
if (value.type == 0 || value.type == 1) c += WriteSingle((float)value.gamma);
if (value.type >= 0 && value.type <= 2)
{
c += WriteSingle((float)value.a);
c += WriteSingle((float)value.b);
c += WriteSingle((float)value.c);
}
if (value.type == 1 || value.type == 2) c += WriteSingle((float)value.d);
if (value.type == 2) c += WriteSingle((float)value.e);
return c;
}
/// <summary>
/// Writes a <see cref="SampledCurveElement"/>
/// </summary>
/// <param name="value">The curve to write</param>
/// <returns>The number of bytes written</returns>
public int WriteSampledCurveElement(SampledCurveElement value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
int c = WriteUInt32((uint)value.CurveEntries.Length);
foreach (var entry in value.CurveEntries) { c += WriteSingle((float)entry); }
return c;
}
#endregion
#region Write Array
/// <summary>
/// Writes a byte array
/// </summary>
/// <param name="data">The array to write</param>
/// <returns>The number of bytes written</returns>
public int WriteArray(byte[] data)
{
DataStream.Write(data, 0, data.Length);
return data.Length;
}
/// <summary>
/// Writes a ushort array
/// </summary>
/// <param name="data">The array to write</param>
/// <returns>The number of bytes written</returns>
public int WriteArray(ushort[] data)
{
int c = 0;
for (int i = 0; i < data.Length; i++) { c += WriteUInt16(data[i]); }
return c;
}
/// <summary>
/// Writes a short array
/// </summary>
/// <param name="data">The array to write</param>
/// <returns>The number of bytes written</returns>
public int WriteArray(short[] data)
{
int c = 0;
for (int i = 0; i < data.Length; i++) { c += WriteInt16(data[i]); }
return c;
}
/// <summary>
/// Writes a uint array
/// </summary>
/// <param name="data">The array to write</param>
/// <returns>The number of bytes written</returns>
public int WriteArray(uint[] data)
{
int c = 0;
for (int i = 0; i < data.Length; i++) { c += WriteUInt32(data[i]); }
return c;
}
/// <summary>
/// Writes an int array
/// </summary>
/// <param name="data">The array to write</param>
/// <returns>The number of bytes written</returns>
public int WriteArray(int[] data)
{
int c = 0;
for (int i = 0; i < data.Length; i++) { c += WriteInt32(data[i]); }
return c;
}
/// <summary>
/// Writes a ulong array
/// </summary>
/// <param name="data">The array to write</param>
/// <returns>The number of bytes written</returns>
public int WriteArray(ulong[] data)
{
int c = 0;
for (int i = 0; i < data.Length; i++) { c += WriteUInt64(data[i]); }
return c;
}
#endregion
#region Write Misc
/// <summary>
/// Write a number of empty bytes
/// </summary>
/// <param name="length">The number of bytes to write</param>
/// <returns>The number of bytes written</returns>
public int WriteEmpty(int length)
{
for (int i = 0; i < length; i++)
{
DataStream.WriteByte(0);
}
return length;
}
/// <summary>
/// Writes empty bytes to a 4-byte margin
/// </summary>
/// <returns>The number of bytes written</returns>
public int WritePadding()
{
int p = 4 - (int)DataStream.Position % 4;
return WriteEmpty(p >= 4 ? 0 : p);
}
/// <summary>
/// Writes given bytes from pointer
/// </summary>
/// <param name="data">Pointer to the bytes to write</param>
/// <param name="length">The number of bytes to write</param>
/// <returns>The number of bytes written</returns>
private unsafe int WriteBytes(byte* data, int length)
{
if (LittleEndian)
{
for (int i = length - 1; i >= 0; i--)
DataStream.WriteByte(data[i]);
}
else
{
for (int i = 0; i < length; i++)
DataStream.WriteByte(data[i]);
}
return length;
}
/// <summary>
/// Writes curve data
/// </summary>
/// <param name="curves">The curves to write</param>
/// <returns>The number of bytes written</returns>
private int WriteCurves(TagDataEntry[] curves)
{
int c = 0;
foreach (var curve in curves)
{
if (curve.Signature != TypeSignature.Curve && curve.Signature != TypeSignature.ParametricCurve)
{
string msg = "Curve has to be either of type \"Curve\" or \"ParametricCurve\" for LutAToB- and LutBToA-TagDataEntries";
throw new CorruptProfileException(msg);
}
c += WriteTagDataEntry(curve);
c += WritePadding();
}
return c;
}
#endregion
#region Subroutines
/// <summary>
/// Changes the value to fit into the given bounds (if out of bounds)
/// </summary>
/// <param name="value">The value to check</param>
/// <param name="min">The minimum value</param>
/// <param name="max">The maximum value</param>
/// <returns>The given value within the bounds</returns>
private int SetRange(int value, int min, int max)
{
if (value > max) return max;
else if (value < min) return min;
else return value;
}
/// <summary>
/// Changes the value to fit into the given bounds (if out of bounds)
/// </summary>
/// <param name="value">The value to check</param>
/// <param name="min">The minimum value</param>
/// <param name="max">The maximum value</param>
/// <returns>The given value within the bounds</returns>
private double SetRange(double value, double min, double max)
{
if (value > max) return max;
else if (value < min) return min;
else return value;
}
/// <summary>
/// Shortens a string to a given maximum length
/// </summary>
/// <param name="value">The string to check</param>
/// <param name="length">The maximum number of characters</param>
/// <returns>The given string within the bounds</returns>
private string SetRange(string value, int length)
{
if (value.Length < length) return value.PadRight(length);
else if (value.Length > length) return value.Substring(0, length);
else return value;
}
/// <summary>
/// Checks a double to fit into the range of 0-1 and scales it up to the range of an unsigned 16bit integer
/// </summary>
/// <param name="value"></param>
/// <returns>The ushort representation of the given value</returns>
private ushort SetRangeUInt16(double value)
{
if (value > 1) value = 1;
else if (value < 0) value = 0;
return (ushort)(value * ushort.MaxValue + 0.5);
}
/// <summary>
/// Checks a double to fit into the range of 0-1 and scales it up to the range of an unsigned 8bit integer
/// </summary>
/// <param name="value"></param>
/// <returns>The ushort representation of the given value</returns>
private byte SetRangeUInt8(double value)
{
if (value > 1) value = 1;
else if (value < 0) value = 0;
return (byte)(value * byte.MaxValue + 0.5);
}
/// <summary>
/// Fits an integer into the byte range and converts it to a byte
/// </summary>
/// <param name="value">The integer to convert</param>
/// <returns>The byte representation of the given value</returns>
private byte SetRangeUInt8(int value)
{
if (value > byte.MaxValue) return byte.MaxValue;
else if (value < byte.MinValue) return byte.MinValue;
else return (byte)value;
}
#endregion
}
}
| {
"content_hash": "86ea42895e341bf07b5178948a57edd0",
"timestamp": "",
"source": "github",
"line_count": 1845,
"max_line_length": 181,
"avg_line_length": 36.02872628726287,
"alnum_prop": 0.5332390594677539,
"repo_name": "JBildstein/NCM",
"id": "515cebd9b91d7448c32e8a8e9fd279ebe85f9887",
"size": "66475",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ColorManager/ICC/ICCDataWriter.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1381840"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BookLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BookLibrary")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6577fb69-c4e0-4fb6-ba2d-dc61542a925c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "2f9c8dc8813840e9375f353d74c53091",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 38.75,
"alnum_prop": 0.7448028673835125,
"repo_name": "arobertov/SoftUniExercises",
"id": "a43da3992220147305a4e5e8b61211352b309b37",
"size": "1398",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ObjectAndClassesExercises/BookLibrary/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "131486"
}
],
"symlink_target": ""
} |
<TEST>
<DEFINE name="schema.xml">
<application name="Application">
<key>ApplicationKey</key>
<options>
<option name="StorageService">OLAPService</option>
</options>
<tables>
<table name="Table">
<fields>
<field name="DirectReports" type="LINK" table="Table" inverse="Manager"/>
<field name="Name" type="TEXT"/>
<field name="Size" type="INTEGER"/>
<field name="Manager" type="LINK" table="Table" inverse="DirectReports"/>
</fields>
</table>
</tables>
</application>
</DEFINE>
<DEFINE name="data.xml">
<batch>
<docs>
<doc _table="Table" _ID="1001" >
<field name="DirectReports">2001</field>
<field name="Name">Michael Dell</field>
<field name="Size">100</field>
</doc>
<doc _table="Table" _ID="2001" >
<field name="Size">110</field>
<field name="DirectReports">3001</field>
<field name="Manager">1001</field>
<field name="Name">Alan Kucheck</field>
</doc>
<doc _table="Table" _ID="3001" >
<field name="Size">120</field>
<field name="DirectReports">
<add>
<value>4001</value>
<value>4002</value>
<value>4003</value>
</add>
</field>
<field name="Manager">2001</field>
<field name="Name">Alexander Ivanov</field>
</doc>
<doc _table="Table" _ID="4001" >
<field name="Size">120</field>
<field name="DirectReports">
<add>
<value>5001</value>
<value>5002</value>
<value>5003</value>
<value>5004</value>
</add>
</field>
<field name="Manager">3001</field>
<field name="Name">Michail Okrugin</field>
</doc>
<doc _table="Table" _ID="4002" >
<field name="Manager">3001</field>
<field name="Name">Michail Plavsky</field>
</doc>
<doc _table="Table" _ID="4003" >
<field name="Manager">3001</field>
<field name="Name">Irina Stepanova</field>
</doc>
<doc _table="Table" _ID="5001" >
<field name="DirectReports">6001</field>
<field name="Manager">4001</field>
<field name="Name">Konstantin Gud</field>
</doc>
<doc _table="Table" _ID="5002" >
<field name="Manager">4001</field>
<field name="Name">Oleg Tarakanov</field>
</doc>
<doc _table="Table" _ID="5003" >
<field name="Manager">4001</field>
<field name="Name">Alexey Sharov</field>
</doc>
<doc _table="Table" _ID="5004" >
<field name="Manager">4001</field>
<field name="Name">Larisa Cheraneva</field>
</doc>
<doc _table="Table" _ID="6001" >
<field name="Manager">5001</field>
<field name="Name">Ravshan Jamshut</field>
</doc>
</docs>
</batch>
</DEFINE>
<JSON-FROM-XML name ="schema.json" value="${schema.xml}"/>
<JSON-FROM-XML name ="data.json" value="${data.xml}"/>
</TEST> | {
"content_hash": "1abbc004f418cfe8a843cbaf744d0fb3",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 75,
"avg_line_length": 33.154639175257735,
"alnum_prop": 0.507773631840796,
"repo_name": "kod3r/Doradus",
"id": "50c27001a01d8bf916d5c01e0e4825f1f70043eb",
"size": "3216",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "doradus-regression-tests/src/main/regression-tests/olap/query/clauses/in.defs.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2377"
},
{
"name": "HTML",
"bytes": "436"
},
{
"name": "Java",
"bytes": "3474289"
},
{
"name": "Shell",
"bytes": "6763"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.