Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 1319
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 11322)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 1319
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
function [expe, options] = expe_build_conditions(options)
% Creates the options and expe structs. Those contain all conditions and
% params that are needed for the experiment.
%% ----------- Create Instructions
options.instructions.start = ['We want to test your understanding of speech in the presence of another speaker.\n'...
'The target sentence you have to repeat will start half a second after the masking speech.\n'...
'The background speech will be made of chopped up words that should not make much sense.\n'...
'Your task is to repeat the target sentence. Your spoken responses will be recorded for further analyses.\n\n'...
'-------------------------------------------------\n\n'...
''];
options.instructions.training1 = ['You will now listen to ONLY the target speaker \n'...
'just to get acquainted with how he/she sounds like.\n Please repeat the sentence.\n\n'...
'-------------------------------------------------\n\n'...
''];
options.instructions.training2 = ['You will now listen to samples of BOTH the target speaker AND \n'...
'the masker just to get used to the task.\n Please repeat the target sentence.\n\n'...
'-------------------------------------------------\n\n'...
''];
options.instructions.test = ['You will now begin the actual test. The target sentence you have to repeat \n'...
'will start half a second after the masking speech. The background speech will be made of chopped up words '...
'that should not make much sense. Your task is to repeat the target sentence.\nYour spoken responses will be '...
'recorded for further analyses.\n'...
'-------------------------------------------------\n\n'...
''];
options.instructions.vocoded = ['All the following sounds will now be a simulation of what\n'...
'Cochlear Implant subjects hear. For this reason, all sounds will be very distorted.\n\n'...
'-------------------------------------------------\n\n'];
options.instructions.listen = ['Listen carefully to the target sentence.\n\n'...
'-------------------------------------------------\n\n'];
options.instructions.repeat = ['Now repeat the target sentence.\n\n'...
'-------------------------------------------------\n\n'];
options.instructions.feedback = ['This is the correct sentence.\n\n'...
'-------------------------------------------------\n'];
options.instructions.end = ['Congratulations!! This session is over. Thanks for participating.\n\n'...
'-------------------------------------------------\n'];
options.instructions.breaktime = ['And now it''s time for a 5min break. Please leave everything as is. When you''re\n'...
'ready to proceed, please click the ''CONTINUE'' button below.\n\n'...
'-------------------------------------------------\n'];
test_machine = is_test_machine();
if test_machine %If it's computer in Tinnitus Room
disp('-------------------------');
disp('--- In Tinnitus Room ---');
disp('-------------------------');
options.sound_path = '/Users/dbaskent/Sounds/VU_zinnen/Vrouw/equalized';
options.tmp_path = '/Users/dbaskent/Sounds/VU_zinnen/Vrouw/processed';
else %If it's experimenter's OWN computer:
disp('-------------------------');
disp('--- On coding machine ---');
disp('-------------------------');
options.sound_path = '~/Library/Matlab/Sounds/VU_zinnen/Vrouw/equalized';
options.tmp_path = '~/Library/Matlab/Sounds/VU_zinnen/Vrouw/processed';
end
%% ----------- Signal options
options.fs = 44100;
if test_machine
options.attenuation_dB = 3; % General attenuation
else
options.attenuation_dB = 3; % General attenuation
end
options.ear = 'both'; % right, left or both
%% ----------- Design specification
options.test.nsentences = 4; % Number of test sentences per condition
%% ----------- Stimuli options
options.test.f0s = [4, 9, 12];
options.test.vtls = [4, 9, 12];
options.test.voices(1).label = 'female'; % 130.26 = average pitch of original female voice
options.test.voices(1).f0 = 1;
options.test.voices(1).ser = 1;
i_voices = 2;
for i_f0 = 1:length(options.test.f0s)
for i_vtl = 1:length(options.test.vtls)
options.test.voices(i_voices).label = ['f0-' num2str(options.test.f0s(i_f0)) '-vtl-' num2str(options.test.vtls(i_vtl))];
options.test.voices(i_voices).f0 = 2^(options.test.f0s(i_f0)/12);
options.test.voices(i_voices).ser = 2^(options.test.vtls(i_vtl)/12);
i_voices = i_voices + 1;
end
end
%--- Voice pairs
% [ref_voice, dir_voice]
options.test.voice_pairs = [ones(length(options.test.voices),1), (1:length(options.test.voices))'];
%--- Define training voices:
% F0 = 8 ST, VTL = 8 ST
options.training.voices(1).label = 'f0-8-vtl-8';
options.training.voices(1).f0 = 2^(8/12);
options.training.voices(1).label = 2^(8/12);
list_size = 13; %nsentences per list
options.training.nsentences = list_size; %number of training sentences per condition.
options.training.voice_pairs = [ones(length(options.training.voices),1), (1:length(options.training.voices))'];
%% --- Define sentence bank for each stimulus type:
%1. Define the lists:
options.sentence_bank = 'VU_zinnen_vrouw.mat'; %Where all sentences in the vrouw database are stored as string.
options.list = {''};
[~,name,~] = fileparts(options.sentence_bank);
sentences = load(options.sentence_bank,name);
sentences = sentences.(name);
for i = 1:list_size:length(sentences)
if i == 1
options.list{end} = [i i+12];
else
options.list{end+1} = [i i+12];
end
end
%2. Define the sentence bank for each stimulus type:
options.trainSentences = [options.list{22}(1) options.list{24}(2)]; %training sentences (target)
options.testS1 = [options.list{1}(1) options.list{12}(2)]; %test sentences Session 1 (target)
options.testS2 = [options.list{12}(1) options.list{20}(2)]; %test sentences Session 2 (target)
options.masker = [options.list{27}(1) options.list{31}(2)]; %masker sentences training+test all sessions
%--- Define Target-to-Masker Ratio in dB:
options.unVocTMR = [-8 -4 0];
options.VocTMR = [0 2 6 12];
%This protocol was adopted from Mike and Nikki's Musician effect on SOS
%performance; TMR values taken from Pals et al. 2015, and Stickney et al.
%2004
%% --- Vocoder options
% Base parameters
p = struct();
p.envelope = struct();
p.envelope.method = 'low-pass';
p.envelope.rectify = 'half-wave';
p.envelope.order = 2; %4th order envelope
p.synth = struct();
p.synth.carrier = 'noise';
p.synth.filter_before = false;
p.synth.filter_after = true;
p.synth.f0 = 1;
p.envelope.fc = 200;
vi = 1; %vocoder index (how many vocoder instances u are simulating)
vo = 3; %butterworth filter order fixed to 12th order.
nc = 8; %run for 8 chs only
range = [150 7000];
carriers = {'noise','sin'};
for i = 1:length(carriers) %loop on the different carriers
p.synth.carrier = carriers{i};
p.analysis_filters = estfilt_shift(nc, 'greenwood', options.fs, range, vo);
p.synthesis_filters = estfilt_shift(nc, 'greenwood', options.fs, range, vo);
options.vocoder(vi).label = sprintf('n-%dch-%dord', nc, 4*vo);
options.vocoder(vi).description = sprintf('%s vocoder, type %s ,%i bands from %d to %d Hz, order %i, %i Hz envelope cutoff.',...
p.synth.carrier,'greenwood', nc, range(1),range(2) , 4*vo, p.envelope.fc);
options.vocoder(vi).parameters = p;
vi = vi +1;
end
%% Build Experimental Conditions:
rng('shuffle');
%================================================== Build test block
test = struct();
%1. Define the training sentences:
trainSeq = options.trainSentences(1):options.trainSentences(2);
for session = 1:2
s = 1; %counter for indexing sent_seq
rndSequence = randperm(size(options.test.voice_pairs, 1));
%2. Randomize Vocoders
RandVocInd = randperm(length(options.vocoder));
Vocs = 1:length(options.vocoder);
RandVocs = Vocs(RandVocInd);
%3. Randomize the test sentences:
bank = ['testS' num2str(session)];
sent_seq = options.(bank)(1):options.(bank)(2);
rand_sent_seq = datasample(sent_seq,length(sent_seq),'Replace',false); %shuffle the order of the sentences
for i_voc = [0 RandVocs] %0 to indicate the non-vocoded condition
%3. Randomize TMRs
RandunVocTMRind = randperm(length(options.unVocTMR));
RandunVocTMR = options.unVocTMR(RandunVocTMRind);
RandVocTMRind = randperm(length(options.VocTMR));
RandVocTMR = options.VocTMR(RandVocTMRind);
if i_voc == 0
RandTMR = RandunVocTMR;
else
RandTMR = RandVocTMR;
end
for i_TMR = RandTMR
seq = datasample(trainSeq,options.training.nsentences*2,'Replace',false);
for i_vp = rndSequence
for ir = 1:options.test.nsentences
condition = struct();
condition.session = session;
condition.vocoder = i_voc;
condition.TMR = i_TMR;
condition.test_sentence = rand_sent_seq(s);
condition.ref_voice = options.test.voice_pairs(i_vp, 1);
condition.dir_voice = options.test.voice_pairs(i_vp, 2);
condition.training1.sentences = [seq(1) seq(2) seq(3)];
condition.training2.sentences = [seq(4) seq(5) seq(6)];
condition.done = 0;
condition.visual_feedback = 0;
s = s+1; %increment the counter.
if ~isfield(test,'conditions')
test.conditions = condition;
else
test.conditions(end+1) = condition;
end
end
end
end
end
end
%====================================== Create the expe structure and save
expe.test = test;
%--
if isfield(options, 'res_filename')
save(options.res_filename, 'options', 'expe');
else
warning('The test file was not saved: no filename provided.');
end
|
{
"content_hash": "8ea655c18794a486ac4848d278351a75",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 140,
"avg_line_length": 33.94426229508197,
"alnum_prop": 0.5855307640297498,
"repo_name": "NawalElBoghdady/S2_E1_SOS",
"id": "fc8db7e93b47802006d168bde2a41ee984a962ca",
"size": "10353",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "expe_build_conditions_ignore_for_now.m",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Matlab",
"bytes": "118273"
},
{
"name": "PostScript",
"bytes": "27652"
},
{
"name": "R",
"bytes": "2926"
}
]
}
|
<!--
~ Copyright (c) 2015 Tapglue (https://www.tapglue.com/). All rights reserved.
~
~ 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.
~
-->
<manifest package="com.tapglue"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:fullBackupContent="true"
android:label="@string/app_name"
android:supportsRtl="true">
</application>
</manifest>
|
{
"content_hash": "3858a69ec6b2f1e0298f168e4aca5027",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 34.87096774193548,
"alnum_prop": 0.7012025901942646,
"repo_name": "AutomatedPlayground/android_sdk",
"id": "023eaf4bfed718adb367e0aa264af7fa4542be35",
"size": "1081",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tapglue-android-sdk/src/main/AndroidManifest.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "320565"
},
{
"name": "Shell",
"bytes": "515"
}
]
}
|
package com.amazonaws.services.iotthingsgraph.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.iotthingsgraph.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* MetricsConfigurationMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class MetricsConfigurationMarshaller {
private static final MarshallingInfo<Boolean> CLOUDMETRICENABLED_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("cloudMetricEnabled").build();
private static final MarshallingInfo<String> METRICRULEROLEARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("metricRuleRoleArn").build();
private static final MetricsConfigurationMarshaller instance = new MetricsConfigurationMarshaller();
public static MetricsConfigurationMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(MetricsConfiguration metricsConfiguration, ProtocolMarshaller protocolMarshaller) {
if (metricsConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(metricsConfiguration.getCloudMetricEnabled(), CLOUDMETRICENABLED_BINDING);
protocolMarshaller.marshall(metricsConfiguration.getMetricRuleRoleArn(), METRICRULEROLEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
|
{
"content_hash": "b87191ca283bc8188af4c80ac43c2324",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 127,
"avg_line_length": 38.680851063829785,
"alnum_prop": 0.7546754675467546,
"repo_name": "aws/aws-sdk-java",
"id": "33bc079c75b4895ddf81bcb6d66c829b1f17e840",
"size": "2398",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-iotthingsgraph/src/main/java/com/amazonaws/services/iotthingsgraph/model/transform/MetricsConfigurationMarshaller.java",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
from __future__ import print_function, absolute_import
import sys
import llvmlite.llvmpy.core as lc
import llvmlite.binding as ll
from numba import _dynfunc, config
from numba.callwrapper import PyCallWrapper
from .base import BaseContext, PYOBJECT
from numba import utils, cgutils, types
from numba.utils import cached_property
from numba.targets import callconv, codegen, externals, intrinsics, listobj, setobj
from .options import TargetOptions
from numba.runtime import rtsys
# Keep those structures in sync with _dynfunc.c.
class ClosureBody(cgutils.Structure):
_fields = [('env', types.pyobject)]
class EnvBody(cgutils.Structure):
_fields = [
('globals', types.pyobject),
('consts', types.pyobject),
]
class CPUContext(BaseContext):
"""
Changes BaseContext calling convention
"""
# Overrides
def create_module(self, name):
return self._internal_codegen._create_empty_module(name)
def init(self):
self.is32bit = (utils.MACHINE_BITS == 32)
self._internal_codegen = codegen.JITCPUCodegen("numba.exec")
# Map external C functions.
externals.c_math_functions.install(self)
# Initialize NRT runtime
rtsys.initialize(self)
def load_additional_registries(self):
# Add target specific implementations
from . import (cffiimpl, cmathimpl, mathimpl, npyimpl, operatorimpl,
printimpl, randomimpl)
self.install_registry(cmathimpl.registry)
self.install_registry(cffiimpl.registry)
self.install_registry(mathimpl.registry)
self.install_registry(npyimpl.registry)
self.install_registry(operatorimpl.registry)
self.install_registry(printimpl.registry)
self.install_registry(randomimpl.registry)
# Initialize PRNG state
randomimpl.random_init()
@property
def target_data(self):
return self._internal_codegen.target_data
def with_aot_codegen(self, name, **aot_options):
aot_codegen = codegen.AOTCPUCodegen(name, **aot_options)
return self.subtarget(_internal_codegen=aot_codegen,
aot_mode=True)
def codegen(self):
return self._internal_codegen
@cached_property
def call_conv(self):
return callconv.CPUCallConv(self)
def get_env_from_closure(self, builder, clo):
"""
From the pointer *clo* to a _dynfunc.Closure, get a pointer
to the enclosed _dynfunc.Environment.
"""
with cgutils.if_unlikely(builder, cgutils.is_null(builder, clo)):
self.debug_print(builder, "Fatal error: missing _dynfunc.Closure")
builder.unreachable()
clo_body_ptr = cgutils.pointer_add(
builder, clo, _dynfunc._impl_info['offsetof_closure_body'])
clo_body = ClosureBody(self, builder, ref=clo_body_ptr, cast_ref=True)
return clo_body.env
def get_env_body(self, builder, envptr):
"""
From the given *envptr* (a pointer to a _dynfunc.Environment object),
get a EnvBody allowing structured access to environment fields.
"""
body_ptr = cgutils.pointer_add(
builder, envptr, _dynfunc._impl_info['offsetof_env_body'])
return EnvBody(self, builder, ref=body_ptr, cast_ref=True)
def get_generator_state(self, builder, genptr, return_type):
"""
From the given *genptr* (a pointer to a _dynfunc.Generator object),
get a pointer to its state area.
"""
return cgutils.pointer_add(
builder, genptr, _dynfunc._impl_info['offsetof_generator_state'],
return_type=return_type)
def build_list(self, builder, list_type, items):
"""
Build a list from the Numba *list_type* and its initial *items*.
"""
return listobj.build_list(self, builder, list_type, items)
def build_set(self, builder, set_type, items):
"""
Build a set from the Numba *set_type* and its initial *items*.
"""
return setobj.build_set(self, builder, set_type, items)
def post_lowering(self, mod, library):
if self.is32bit:
# 32-bit machine needs to replace all 64-bit div/rem to avoid
# calls to compiler-rt
intrinsics.fix_divmod(mod)
library.add_linking_library(rtsys.library)
def create_cpython_wrapper(self, library, fndesc, env, call_helper,
release_gil=False):
wrapper_module = self.create_module("wrapper")
fnty = self.call_conv.get_function_type(fndesc.restype, fndesc.argtypes)
wrapper_callee = wrapper_module.add_function(fnty, fndesc.llvm_func_name)
builder = PyCallWrapper(self, wrapper_module, wrapper_callee,
fndesc, env, call_helper=call_helper,
release_gil=release_gil)
builder.build()
library.add_ir_module(wrapper_module)
def get_executable(self, library, fndesc, env):
"""
Returns
-------
(cfunc, fnptr)
- cfunc
callable function (Can be None)
- fnptr
callable function address
- env
an execution environment (from _dynfunc)
"""
# Code generation
baseptr = library.get_pointer_to_function(fndesc.llvm_func_name)
fnptr = library.get_pointer_to_function(fndesc.llvm_cpython_wrapper_name)
# Note: we avoid reusing the original docstring to avoid encoding
# issues on Python 2, see issue #1908
doc = "compiled wrapper for %r" % (fndesc.qualname,)
cfunc = _dynfunc.make_function(fndesc.lookup_module(),
fndesc.qualname.split('.')[-1],
doc, fnptr, env,
# objects to keepalive with the function
(library,)
)
return cfunc
def calc_array_sizeof(self, ndim):
'''
Calculate the size of an array struct on the CPU target
'''
aryty = types.Array(types.int32, ndim, 'A')
return self.get_abi_sizeof(self.get_value_type(aryty))
# ----------------------------------------------------------------------------
# TargetOptions
class CPUTargetOptions(TargetOptions):
OPTIONS = {
"nopython": bool,
"nogil": bool,
"forceobj": bool,
"looplift": bool,
"boundcheck": bool,
"_nrt": bool,
"no_rewrites": bool,
}
# ----------------------------------------------------------------------------
# Internal
def remove_refct_calls(func):
"""
Remove redundant incref/decref within on a per block basis
"""
for bb in func.basic_blocks:
remove_null_refct_call(bb)
remove_refct_pairs(bb)
def remove_null_refct_call(bb):
"""
Remove refct api calls to NULL pointer
"""
pass
## Skipped for now
# for inst in bb.instructions:
# if isinstance(inst, lc.CallOrInvokeInstruction):
# fname = inst.called_function.name
# if fname == "Py_IncRef" or fname == "Py_DecRef":
# arg = inst.args[0]
# print(type(arg))
# if isinstance(arg, lc.ConstantPointerNull):
# inst.erase_from_parent()
def remove_refct_pairs(bb):
"""
Remove incref decref pairs on the same variable
"""
didsomething = True
while didsomething:
didsomething = False
increfs = {}
decrefs = {}
# Mark
for inst in bb.instructions:
if isinstance(inst, lc.CallOrInvokeInstruction):
fname = inst.called_function.name
if fname == "Py_IncRef":
arg = inst.operands[0]
increfs[arg] = inst
elif fname == "Py_DecRef":
arg = inst.operands[0]
decrefs[arg] = inst
# Sweep
for val in increfs.keys():
if val in decrefs:
increfs[val].erase_from_parent()
decrefs[val].erase_from_parent()
didsomething = True
|
{
"content_hash": "be94fd66469f66a1a3b437d27b42ee22",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 83,
"avg_line_length": 33.22,
"alnum_prop": 0.5824202287778447,
"repo_name": "stefanseefeld/numba",
"id": "54bcc830f1ba3cd883c630f0eb4989ff4738e93a",
"size": "8305",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "numba/targets/cpu.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Batchfile",
"bytes": "5535"
},
{
"name": "C",
"bytes": "303376"
},
{
"name": "C++",
"bytes": "17024"
},
{
"name": "Cuda",
"bytes": "214"
},
{
"name": "HTML",
"bytes": "98846"
},
{
"name": "Jupyter Notebook",
"bytes": "110325"
},
{
"name": "Python",
"bytes": "3946372"
},
{
"name": "Shell",
"bytes": "2414"
}
]
}
|
#include "platform/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN
#include "platform/CCCommon.h"
#include "platform/tizen/CCStdC-tizen.h"
#include "base/CCConsole.h"
NS_CC_BEGIN
void MessageBox(const char * msg, const char * title)
{
log("%s: %s", title, msg);
}
void LuaLog(const char * format)
{
puts(format);
}
NS_CC_END
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN
|
{
"content_hash": "56e8bda6c74a5a2ba4ef539e687f6f7c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 53,
"avg_line_length": 17,
"alnum_prop": 0.6911764705882353,
"repo_name": "ecmas/cocos2d",
"id": "4b4e60b5f0f0835ce9ccb449e079cce75828b94f",
"size": "1737",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cocos/platform/tizen/CCCommon-tizen.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "120"
},
{
"name": "C",
"bytes": "1366096"
},
{
"name": "C++",
"bytes": "12227916"
},
{
"name": "CMake",
"bytes": "243785"
},
{
"name": "GLSL",
"bytes": "67202"
},
{
"name": "Java",
"bytes": "378817"
},
{
"name": "JavaScript",
"bytes": "14719"
},
{
"name": "Lua",
"bytes": "15057"
},
{
"name": "Makefile",
"bytes": "31752"
},
{
"name": "Objective-C",
"bytes": "423269"
},
{
"name": "Objective-C++",
"bytes": "439915"
},
{
"name": "Python",
"bytes": "41173"
},
{
"name": "Shell",
"bytes": "24062"
}
]
}
|
"""
Module defining ZeroIntelligenceBoundedTrader agent class.
"""
import random
from fms import agents
from fms.utils import BUY, SELL
from fms.utils.exceptions import MissingParameter
class ZeroIntelligenceBoundedTrader(agents.Agent):
"""
Simulate an agent taking random decisions
This agent subclass should have two keys in the
args dict :
- maxprice : maximum order price (float)
- maxbuy : maximum quantity to buy (int)
If any of those parameters is missing, a MissingParameter
exception is raised.
>>> from fms.agents import zerointelligencetrader
>>> params = {'agents': [{'money':10000, 'stocks':200}]}
>>> agent = zerointelligencetrader.ZeroIntelligenceTrader(params)
Traceback (most recent call last):
...
MissingParameter: maxprice
>>> params = {'agents': [{'money':10000, 'stocks':200, 'args':[999]}]}
>>> agent = zerointelligencetrader.ZeroIntelligenceTrader(params)
Traceback (most recent call last):
...
MissingParameter: maxbuy
>>> params = {'agents': [{'money':10000, 'stocks':200, 'args':[999, 100]}]}
>>> agent = zerointelligencetrader.ZeroIntelligenceTrader(params)
>>> print agent.state()
Agent ... - owns $10000.00 and 200 securities
>>> print agent.maxprice
999
>>> print agent.maxbuy
100
The ZeroIntelligenceBoundedTrader acts by returning a
dict with (direction, price, quantity) keys.
The 3 elements of the dict are randomly chosen,
in uniform distributions. Leverage discouraged.
Buy price is in the lower 2 thirds.
Sell price is in the upper 2 thirds.
>>> len(agent.act())
3
- direction is buy or sell
- price is a %.2f float in [0.01,maxprice]
- quantity is an int in :
- if direction==BUY, [1,self.maxbuy]
- if direction==SELL, [1,self.stocks]
Thus, shortselling is not allowed.
"""
def __init__(self, params, offset=0):
agents.Agent.__init__(self, params, offset)
try:
self.maxprice = self.args[0]
except (AttributeError, IndexError):
raise MissingParameter, 'maxprice'
try:
self.maxbuy = self.args[1]
except IndexError:
raise MissingParameter, 'maxbuy'
del self.args
def act(self, world=None, market=None):
"""
Return random order as a dict with keys in (direction, price, quantity).
To avoid short selling as far as possible, if # of stocks
is zero or negative, force BUY direction.
To avoid levering up as far as possible, if money
is zero or negative, force SELL.
"""
if self.stocks > 0 and self.money > 0:
direction = random.choice((BUY, SELL))
elif self.stocks <= 0:
# Short selling is forbidden
direction = BUY
else:
# money<=0, levering is discouraged
direction = SELL
if direction:
price = random.randint(int(self.maxprice*100/3.), \
self.maxprice*100)/100.
quantity = random.randint(1, self.stocks)
else:
price = random.randint(1, int(self.maxprice*200/3.))/100.
quantity = random.randint(1, self.maxbuy)
return {'direction':direction, 'price':price, 'quantity':quantity}
def _test():
"""
Run tests in docstrings
"""
import doctest
doctest.testmod(optionflags=+doctest.ELLIPSIS)
if __name__ == '__main__':
_test()
|
{
"content_hash": "a8a8cd7adc188fca09406b597d6dfc77",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 80,
"avg_line_length": 33.61904761904762,
"alnum_prop": 0.6195467422096317,
"repo_name": "jcbagneris/fms",
"id": "e4a78913194baa7a0bd9c01799131d95fdb8b58f",
"size": "3575",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "fms/contrib/coleman/agents/zerointelligenceboundedtrader.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "112564"
}
]
}
|
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/arena.h"
#include <string.h>
#include <new>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gprpp/memory.h"
namespace {
void* ArenaStorage(size_t initial_size) {
static constexpr size_t base_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_core::Arena));
initial_size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(initial_size);
size_t alloc_size = base_size + initial_size;
static constexpr size_t alignment =
(GPR_CACHELINE_SIZE > GPR_MAX_ALIGNMENT &&
GPR_CACHELINE_SIZE % GPR_MAX_ALIGNMENT == 0)
? GPR_CACHELINE_SIZE
: GPR_MAX_ALIGNMENT;
return gpr_malloc_aligned(alloc_size, alignment);
}
} // namespace
namespace grpc_core {
Arena::~Arena() {
Zone* z = last_zone_;
while (z) {
Zone* prev_z = z->prev;
z->~Zone();
gpr_free_aligned(z);
z = prev_z;
}
}
Arena* Arena::Create(size_t initial_size) {
return new (ArenaStorage(initial_size)) Arena(initial_size);
}
std::pair<Arena*, void*> Arena::CreateWithAlloc(size_t initial_size,
size_t alloc_size) {
static constexpr size_t base_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Arena));
auto* new_arena =
new (ArenaStorage(initial_size)) Arena(initial_size, alloc_size);
void* first_alloc = reinterpret_cast<char*>(new_arena) + base_size;
return std::make_pair(new_arena, first_alloc);
}
size_t Arena::Destroy() {
size_t size = total_used_.Load(MemoryOrder::RELAXED);
this->~Arena();
gpr_free_aligned(this);
return size;
}
void* Arena::AllocZone(size_t size) {
// If the allocation isn't able to end in the initial zone, create a new
// zone for this allocation, and any unused space in the initial zone is
// wasted. This overflowing and wasting is uncommon because of our arena
// sizing hysteresis (that is, most calls should have a large enough initial
// zone and will not need to grow the arena).
static constexpr size_t zone_base_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Zone));
size_t alloc_size = zone_base_size + size;
Zone* z = new (gpr_malloc_aligned(alloc_size, GPR_MAX_ALIGNMENT)) Zone();
{
gpr_spinlock_lock(&arena_growth_spinlock_);
z->prev = last_zone_;
last_zone_ = z;
gpr_spinlock_unlock(&arena_growth_spinlock_);
}
return reinterpret_cast<char*>(z) + zone_base_size;
}
} // namespace grpc_core
|
{
"content_hash": "99578cfdfad54479eed8d9499a1821a7",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 29.517241379310345,
"alnum_prop": 0.6674454828660437,
"repo_name": "donnadionne/grpc",
"id": "61688258a1ccd823cd083d6a92f305efecfb36b1",
"size": "3170",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "src/core/lib/gprpp/arena.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "5444"
},
{
"name": "Batchfile",
"bytes": "28628"
},
{
"name": "C",
"bytes": "6403510"
},
{
"name": "C#",
"bytes": "2620252"
},
{
"name": "C++",
"bytes": "14264354"
},
{
"name": "CMake",
"bytes": "499835"
},
{
"name": "CSS",
"bytes": "1519"
},
{
"name": "Cython",
"bytes": "302472"
},
{
"name": "DTrace",
"bytes": "147"
},
{
"name": "Dockerfile",
"bytes": "159399"
},
{
"name": "Go",
"bytes": "34794"
},
{
"name": "HTML",
"bytes": "14"
},
{
"name": "Java",
"bytes": "6259"
},
{
"name": "JavaScript",
"bytes": "112392"
},
{
"name": "M4",
"bytes": "87664"
},
{
"name": "Makefile",
"bytes": "246627"
},
{
"name": "Objective-C",
"bytes": "694725"
},
{
"name": "Objective-C++",
"bytes": "77696"
},
{
"name": "PHP",
"bytes": "484892"
},
{
"name": "PowerShell",
"bytes": "3985"
},
{
"name": "Python",
"bytes": "3749620"
},
{
"name": "Ruby",
"bytes": "1045127"
},
{
"name": "Shell",
"bytes": "675777"
},
{
"name": "Starlark",
"bytes": "628488"
},
{
"name": "Swift",
"bytes": "8643"
},
{
"name": "XSLT",
"bytes": "9846"
}
]
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="ru">
<head>
<title>Uses of Class org.apache.poi.hssf.record.aggregates.CustomViewSettingsRecordAggregate (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.poi.hssf.record.aggregates.CustomViewSettingsRecordAggregate (POI API Documentation)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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/apache/poi/hssf/record/aggregates/CustomViewSettingsRecordAggregate.html" title="class in org.apache.poi.hssf.record.aggregates">Class</a></li>
<li class="navBarCell1Rev">Use</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>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/poi/hssf/record/aggregates/class-use/CustomViewSettingsRecordAggregate.html" target="_top">Frames</a></li>
<li><a href="CustomViewSettingsRecordAggregate.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 Class org.apache.poi.hssf.record.aggregates.CustomViewSettingsRecordAggregate" class="title">Uses of Class<br>org.apache.poi.hssf.record.aggregates.CustomViewSettingsRecordAggregate</h2>
</div>
<div class="classUseContainer">No usage of org.apache.poi.hssf.record.aggregates.CustomViewSettingsRecordAggregate</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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/apache/poi/hssf/record/aggregates/CustomViewSettingsRecordAggregate.html" title="class in org.apache.poi.hssf.record.aggregates">Class</a></li>
<li class="navBarCell1Rev">Use</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>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/poi/hssf/record/aggregates/class-use/CustomViewSettingsRecordAggregate.html" target="_top">Frames</a></li>
<li><a href="CustomViewSettingsRecordAggregate.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>
<i>Copyright 2014 The Apache Software Foundation or
its licensors, as applicable.</i>
</small></p>
</body>
</html>
|
{
"content_hash": "e29dc6b86636a6edf196153260f51a59",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 205,
"avg_line_length": 40.05982905982906,
"alnum_prop": 0.6255600597397055,
"repo_name": "pedro93/ifarmaStudents",
"id": "aff41ded55885c118ff46c26250b547cdcd68969",
"size": "4687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "poi-3.10-FINAL/docs/apidocs/org/apache/poi/hssf/record/aggregates/class-use/CustomViewSettingsRecordAggregate.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "25085"
},
{
"name": "Java",
"bytes": "26983"
}
]
}
|
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
cloneableTags[boolTag] = cloneableTags[dateTag] =
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
cloneableTags[int32Tag] = cloneableTags[mapTag] =
cloneableTags[numberTag] = cloneableTags[objectTag] =
cloneableTags[regexpTag] = cloneableTags[setTag] =
cloneableTags[stringTag] = cloneableTags[symbolTag] =
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[weakMapTag] = false;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
} catch (e) {}
}());
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* Adds the key-value `pair` to `map`.
*
* @private
* @param {Object} map The map to modify.
* @param {Array} pair The key-value pair to add.
* @returns {Object} Returns `map`.
*/
function addMapEntry(map, pair) {
// Don't return `map.set` because it's not chainable in IE 11.
map.set(pair[0], pair[1]);
return map;
}
/**
* Adds `value` to `set`.
*
* @private
* @param {Object} set The set to modify.
* @param {*} value The value to add.
* @returns {Object} Returns `set`.
*/
function addSetEntry(set, value) {
// Don't return `set.add` because it's not chainable in IE 11.
set.add(value);
return set;
}
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
/**
* A specialized version of `_.reduce` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initAccum] Specify using the first element of `array` as
* the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1,
length = array ? array.length : 0;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined,
Symbol = root.Symbol,
Uint8Array = root.Uint8Array,
getPrototype = overArg(Object.getPrototypeOf, Object),
objectCreate = Object.create,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeKeys = overArg(Object.keys, Object),
nativeMax = Math.max;
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),
WeakMap = getNative(root, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
this.__data__ = new ListCache(entries);
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
}
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
return this.__data__['delete'](key);
}
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache) {
var pairs = cache.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
return this;
}
cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq(object[key], value)) ||
(typeof key == 'number' && value === undefined && !(key in object))) {
object[key] = value;
}
}
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
object[key] = value;
}
}
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* The base implementation of `_.assign` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return object && copyObject(source, keys(source), object);
}
/**
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
* traversed objects.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @param {boolean} [isFull] Specify a clone including symbols.
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
var result;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result);
}
} else {
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
if (isHostObject(value)) {
return object ? value : {};
}
result = initCloneObject(isFunc ? {} : value);
if (!isDeep) {
return copySymbols(value, baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = initCloneByTag(value, tag, baseClone, isDeep);
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new Stack);
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
if (!isArr) {
var props = isFull ? getAllKeys(value) : keys(value);
}
arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
// Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
});
return result;
}
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} prototype The object to inherit from.
* @returns {Object} Returns the new object.
*/
function baseCreate(proto) {
return isObject(proto) ? objectCreate(proto) : {};
}
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
/**
* The base implementation of `_.merge` without support for multiple sources.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
if (!(isArray(source) || isTypedArray(source))) {
var props = baseKeysIn(source);
}
arrayEach(props || source, function(srcValue, key) {
if (props) {
key = srcValue;
srcValue = source[key];
}
if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer
? customizer(object[key], srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
});
}
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = object[key],
srcValue = source[key],
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
newValue = srcValue;
if (isArray(srcValue) || isTypedArray(srcValue)) {
if (isArray(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else {
isCommon = false;
newValue = baseClone(srcValue, true);
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
isCommon = false;
newValue = baseClone(srcValue, true);
}
else {
newValue = objValue;
}
}
else {
isCommon = false;
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
assignMergeValue(object, key, newValue);
}
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = array;
return apply(func, this, otherArgs);
};
}
/**
* Creates a clone of `buffer`.
*
* @private
* @param {Buffer} buffer The buffer to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var result = new buffer.constructor(buffer.length);
buffer.copy(result);
return result;
}
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
return result;
}
/**
* Creates a clone of `dataView`.
*
* @private
* @param {Object} dataView The data view to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned data view.
*/
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
/**
* Creates a clone of `map`.
*
* @private
* @param {Object} map The map to clone.
* @param {Function} cloneFunc The function to clone values.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned map.
*/
function cloneMap(map, isDeep, cloneFunc) {
var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
return arrayReduce(array, addMapEntry, new map.constructor);
}
/**
* Creates a clone of `regexp`.
*
* @private
* @param {Object} regexp The regexp to clone.
* @returns {Object} Returns the cloned regexp.
*/
function cloneRegExp(regexp) {
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result.lastIndex = regexp.lastIndex;
return result;
}
/**
* Creates a clone of `set`.
*
* @private
* @param {Object} set The set to clone.
* @param {Function} cloneFunc The function to clone values.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned set.
*/
function cloneSet(set, isDeep, cloneFunc) {
var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
return arrayReduce(array, addSetEntry, new set.constructor);
}
/**
* Creates a clone of the `symbol` object.
*
* @private
* @param {Object} symbol The symbol object to clone.
* @returns {Object} Returns the cloned symbol object.
*/
function cloneSymbol(symbol) {
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
}
/**
* Creates a clone of `typedArray`.
*
* @private
* @param {Object} typedArray The typed array to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
assignValue(object, key, newValue === undefined ? source[key] : newValue);
}
return object;
}
/**
* Copies own symbol properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbols(source, object) {
return copyObject(source, getSymbols(source), object);
}
/**
* Creates a function like `_.assign`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
object = Object(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/**
* Creates an array of the own enumerable symbol properties of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge < 14, and promises in Node.js.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : undefined;
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
return (typeof object.constructor == 'function' && !isPrototype(object))
? baseCreate(getPrototype(object))
: {};
}
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {Function} cloneFunc The function to clone values.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, cloneFunc, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
return cloneMap(object, isDeep, cloneFunc);
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
return cloneRegExp(object);
case setTag:
return cloneSet(object, isDeep, cloneFunc);
case symbolTag:
return cloneSymbol(object);
}
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(object[index], value);
}
return false;
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* Used by `_.defaultsDeep` to customize its `_.merge` use.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to merge.
* @param {Object} object The parent object of `objValue`.
* @param {Object} source The parent object of `srcValue`.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
* @returns {*} Returns the value to assign.
*/
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
stack['delete'](srcValue);
}
return objValue;
}
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse;
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) ||
objectToString.call(value) != objectTag || isHostObject(value)) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return (typeof Ctor == 'function' &&
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
}
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
/**
* This method is like `_.defaults` except that it recursively assigns
* default properties.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaults
* @example
*
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
* // => { 'a': { 'b': 2, 'c': 3 } }
*/
var defaultsDeep = baseRest(function(args) {
args.push(undefined, mergeDefaults);
return apply(mergeWith, undefined, args);
});
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
/**
* This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source
* properties. If `customizer` returns `undefined`, merging is handled by the
* method instead. The `customizer` is invoked with seven arguments:
* (objValue, srcValue, key, object, source, stack).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* function customizer(objValue, srcValue) {
* if (_.isArray(objValue)) {
* return objValue.concat(srcValue);
* }
* }
*
* var object = { 'a': [1], 'b': [2] };
* var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
* // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
module.exports = defaultsDeep;
|
{
"content_hash": "ff657c88f21c7202e6b5bfa7eeb67e2e",
"timestamp": "",
"source": "github",
"line_count": 2247,
"max_line_length": 98,
"avg_line_length": 26.39163328882955,
"alnum_prop": 0.6465043337492833,
"repo_name": "isabela-angelo/scratch-tangible-blocks",
"id": "6dbf06897cde4f360f542e710bd50a80756945b5",
"size": "59689",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "node_modules/lodash.defaultsdeep/index.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "2600"
},
{
"name": "CSS",
"bytes": "126624"
},
{
"name": "Emacs Lisp",
"bytes": "2410"
},
{
"name": "HTML",
"bytes": "1386607"
},
{
"name": "JavaScript",
"bytes": "25042017"
},
{
"name": "Python",
"bytes": "137663"
},
{
"name": "Ruby",
"bytes": "607"
},
{
"name": "Shell",
"bytes": "16905"
}
]
}
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>statsmodels.tsa.statespace.mlemodel.MLEResults.remove_data — statsmodels v0.10.1 documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.tsa.statespace.mlemodel.MLEResults.resid" href="statsmodels.tsa.statespace.mlemodel.MLEResults.resid.html" />
<link rel="prev" title="statsmodels.tsa.statespace.mlemodel.MLEResults.pvalues" href="statsmodels.tsa.statespace.mlemodel.MLEResults.pvalues.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />
<script type="text/javascript" src="../_static/scripts.js">
</script>
<script type="text/javascript" src="../_static/facebox.js">
</script>
<script type="text/javascript">
$.facebox.settings.closeImage = "../_static/closelabel.png"
$.facebox.settings.loadingImage = "../_static/loading.gif"
</script>
<script>
$(document).ready(function() {
$.getJSON("../../versions.json", function(versions) {
var dropdown = document.createElement("div");
dropdown.className = "dropdown";
var button = document.createElement("button");
button.className = "dropbtn";
button.innerHTML = "Other Versions";
var content = document.createElement("div");
content.className = "dropdown-content";
dropdown.appendChild(button);
dropdown.appendChild(content);
$(".header").prepend(dropdown);
for (var i = 0; i < versions.length; i++) {
if (versions[i].substring(0, 1) == "v") {
versions[i] = [versions[i], versions[i].substring(1)];
} else {
versions[i] = [versions[i], versions[i]];
};
};
for (var i = 0; i < versions.length; i++) {
var a = document.createElement("a");
a.innerHTML = versions[i][1];
a.href = "../../" + versions[i][0] + "/index.html";
a.title = versions[i][1];
$(".dropdown-content").append(a);
};
});
});
</script>
</head><body>
<div class="headerwrap">
<div class = "header">
<a href = "../index.html">
<img src="../_static/statsmodels_hybi_banner.png" alt="Logo"
style="padding-left: 15px"/></a>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="statsmodels.tsa.statespace.mlemodel.MLEResults.resid.html" title="statsmodels.tsa.statespace.mlemodel.MLEResults.resid"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="statsmodels.tsa.statespace.mlemodel.MLEResults.pvalues.html" title="statsmodels.tsa.statespace.mlemodel.MLEResults.pvalues"
accesskey="P">previous</a> |</li>
<li><a href ="../install.html">Install</a></li> |
<li><a href="https://groups.google.com/forum/?hl=en#!forum/pystatsmodels">Support</a></li> |
<li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> |
<li><a href="../dev/index.html">Develop</a></li> |
<li><a href="../examples/index.html">Examples</a></li> |
<li><a href="../faq.html">FAQ</a></li> |
<li class="nav-item nav-item-1"><a href="../statespace.html" >Time Series Analysis by State Space Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">statespace</span></code></a> |</li>
<li class="nav-item nav-item-2"><a href="statsmodels.tsa.statespace.mlemodel.MLEResults.html" accesskey="U">statsmodels.tsa.statespace.mlemodel.MLEResults</a> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="statsmodels-tsa-statespace-mlemodel-mleresults-remove-data">
<h1>statsmodels.tsa.statespace.mlemodel.MLEResults.remove_data<a class="headerlink" href="#statsmodels-tsa-statespace-mlemodel-mleresults-remove-data" title="Permalink to this headline">¶</a></h1>
<p>method</p>
<dl class="method">
<dt id="statsmodels.tsa.statespace.mlemodel.MLEResults.remove_data">
<code class="sig-prename descclassname">MLEResults.</code><code class="sig-name descname">remove_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#statsmodels.tsa.statespace.mlemodel.MLEResults.remove_data" title="Permalink to this definition">¶</a></dt>
<dd><p>remove data arrays, all nobs arrays from result and model</p>
<p>This reduces the size of the instance, so it can be pickled with less
memory. Currently tested for use with predict from an unpickled
results and model instance.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Since data and some intermediate results have been removed
calculating new statistics that require them will raise exceptions.
The exception will occur the first time an attribute is accessed
that has been set to None.</p>
</div>
<p>Not fully tested for time series models, tsa, and might delete too much
for prediction or not all that would be possible.</p>
<p>The lists of arrays to delete are maintained as attributes of
the result and model instance, except for cached values. These
lists could be changed before calling remove_data.</p>
<p>The attributes to remove are named in:</p>
<dl class="simple">
<dt>model._data_attr<span class="classifier">arrays attached to both the model instance</span></dt><dd><p>and the results instance with the same attribute name.</p>
</dd>
<dt>result.data_in_cache<span class="classifier">arrays that may exist as values in</span></dt><dd><p>result._cache (TODO : should privatize name)</p>
</dd>
<dt>result._data_attr_model<span class="classifier">arrays attached to the model</span></dt><dd><p>instance but not to the results instance</p>
</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="statsmodels.tsa.statespace.mlemodel.MLEResults.pvalues.html"
title="previous chapter">statsmodels.tsa.statespace.mlemodel.MLEResults.pvalues</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="statsmodels.tsa.statespace.mlemodel.MLEResults.resid.html"
title="next chapter">statsmodels.tsa.statespace.mlemodel.MLEResults.resid</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/generated/statsmodels.tsa.statespace.mlemodel.MLEResults.remove_data.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2018, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.1.2.
</div>
</body>
</html>
|
{
"content_hash": "61ba05167a991e0ffec20f36e90fbb44",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 308,
"avg_line_length": 47.57446808510638,
"alnum_prop": 0.6633497316636852,
"repo_name": "statsmodels/statsmodels.github.io",
"id": "4851a085ca63b90de4651348b1a66f250b0d8501",
"size": "8948",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v0.10.1/generated/statsmodels.tsa.statespace.mlemodel.MLEResults.remove_data.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": []
}
|
package armblueprint
import (
"encoding/json"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"reflect"
"regexp"
"strings"
"time"
)
const (
utcLayoutJSON = `"2006-01-02T15:04:05.999999999"`
utcLayout = "2006-01-02T15:04:05.999999999"
rfc3339JSON = `"` + time.RFC3339Nano + `"`
)
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`)
type timeRFC3339 time.Time
func (t timeRFC3339) MarshalJSON() (json []byte, err error) {
tt := time.Time(t)
return tt.MarshalJSON()
}
func (t timeRFC3339) MarshalText() (text []byte, err error) {
tt := time.Time(t)
return tt.MarshalText()
}
func (t *timeRFC3339) UnmarshalJSON(data []byte) error {
layout := utcLayoutJSON
if tzOffsetRegex.Match(data) {
layout = rfc3339JSON
}
return t.Parse(layout, string(data))
}
func (t *timeRFC3339) UnmarshalText(data []byte) (err error) {
layout := utcLayout
if tzOffsetRegex.Match(data) {
layout = time.RFC3339Nano
}
return t.Parse(layout, string(data))
}
func (t *timeRFC3339) Parse(layout, value string) error {
p, err := time.Parse(layout, strings.ToUpper(value))
*t = timeRFC3339(p)
return err
}
func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) {
if t == nil {
return
} else if azcore.IsNullValue(t) {
m[k] = nil
return
} else if reflect.ValueOf(t).IsNil() {
return
}
m[k] = (*timeRFC3339)(t)
}
func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error {
if data == nil || strings.EqualFold(string(data), "null") {
return nil
}
var aux timeRFC3339
if err := json.Unmarshal(data, &aux); err != nil {
return fmt.Errorf("struct field %s: %v", fn, err)
}
*t = (*time.Time)(&aux)
return nil
}
|
{
"content_hash": "deccec31544e48695c7ce96b9c700f8b",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 91,
"avg_line_length": 22.987179487179485,
"alnum_prop": 0.6731734523145566,
"repo_name": "Azure/azure-sdk-for-go",
"id": "2d0a46b1712fe8c1d9912422e4549163eead3d3a",
"size": "2132",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/resourcemanager/blueprint/armblueprint/zz_generated_time_rfc3339.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1629"
},
{
"name": "Bicep",
"bytes": "8394"
},
{
"name": "CSS",
"bytes": "6089"
},
{
"name": "Dockerfile",
"bytes": "1435"
},
{
"name": "Go",
"bytes": "5463500"
},
{
"name": "HTML",
"bytes": "8933"
},
{
"name": "JavaScript",
"bytes": "8137"
},
{
"name": "PowerShell",
"bytes": "504494"
},
{
"name": "Shell",
"bytes": "3893"
},
{
"name": "Smarty",
"bytes": "1723"
}
]
}
|
@interface MPStaticNativeAdRenderer () <MPNativeAdRendererImageHandlerDelegate>
@property (nonatomic) UIView<MPNativeAdRendering> *adView;
@property (nonatomic) id<MPNativeAdAdapter> adapter;
@property (nonatomic) BOOL adViewInViewHierarchy;
@property (nonatomic) Class renderingViewClass;
@property (nonatomic) MPNativeAdRendererImageHandler *rendererImageHandler;
@end
@implementation MPStaticNativeAdRenderer
+ (MPNativeAdRendererConfiguration *)rendererConfigurationWithRendererSettings:(id<MPNativeAdRendererSettings>)rendererSettings
{
MPNativeAdRendererConfiguration *config = [[MPNativeAdRendererConfiguration alloc] init];
config.rendererClass = [self class];
config.rendererSettings = rendererSettings;
config.supportedCustomEvents = @[@"MPMoPubNativeCustomEvent", @"FacebookNativeCustomEvent", @"InMobiNativeCustomEvent"];
return config;
}
- (instancetype)initWithRendererSettings:(id<MPNativeAdRendererSettings>)rendererSettings
{
if (self = [super init]) {
MPStaticNativeAdRendererSettings *settings = (MPStaticNativeAdRendererSettings *)rendererSettings;
_renderingViewClass = settings.renderingViewClass;
_viewSizeHandler = [settings.viewSizeHandler copy];
_rendererImageHandler = [MPNativeAdRendererImageHandler new];
_rendererImageHandler.delegate = self;
}
return self;
}
- (UIView *)retrieveViewWithAdapter:(id<MPNativeAdAdapter>)adapter error:(NSError **)error
{
if (!adapter) {
if (error) {
*error = MPNativeAdNSErrorForRenderValueTypeError();
}
return nil;
}
self.adapter = adapter;
if ([self.renderingViewClass respondsToSelector:@selector(nibForAd)]) {
self.adView = (UIView<MPNativeAdRendering> *)[[[self.renderingViewClass nibForAd] instantiateWithOwner:nil options:nil] firstObject];
} else {
self.adView = [[self.renderingViewClass alloc] init];
}
self.adView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
// We only load text here. We delay loading of images until the view is added to the view hierarchy
// so we don't unnecessarily load images from the cache if the user is scrolling fast. So we will
// just store the image URLs for now.
if ([self.adView respondsToSelector:@selector(nativeMainTextLabel)]) {
self.adView.nativeMainTextLabel.text = [adapter.properties objectForKey:kAdTextKey];
}
if ([self.adView respondsToSelector:@selector(nativeTitleTextLabel)]) {
self.adView.nativeTitleTextLabel.text = [adapter.properties objectForKey:kAdTitleKey];
}
if ([self.adView respondsToSelector:@selector(nativeCallToActionTextLabel)] && self.adView.nativeCallToActionTextLabel) {
self.adView.nativeCallToActionTextLabel.text = [adapter.properties objectForKey:kAdCTATextKey];
}
if ([self.adView respondsToSelector:@selector(nativePrivacyInformationIconImageView)]) {
// MoPub ads pass the privacy information icon key through the properties dictionary.
NSString *daaIconImageLoc = [adapter.properties objectForKey:kAdDAAIconImageKey];
if (daaIconImageLoc) {
UIImageView *imageView = self.adView.nativePrivacyInformationIconImageView;
imageView.hidden = NO;
UIImage *daaIconImage = [UIImage imageNamed:daaIconImageLoc];
imageView.image = daaIconImage;
// Attach a gesture recognizer to handle loading the daa icon URL.
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(DAAIconTapped)];
imageView.userInteractionEnabled = YES;
[imageView addGestureRecognizer:tapRecognizer];
} else if ([adapter respondsToSelector:@selector(privacyInformationIconView)]) {
// The ad network may provide its own view for its privacy information icon. We assume the ad handles the tap on the icon as well.
UIView *privacyIconAdView = [adapter privacyInformationIconView];
privacyIconAdView.frame = self.adView.nativePrivacyInformationIconImageView.bounds;
privacyIconAdView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.adView.nativePrivacyInformationIconImageView.userInteractionEnabled = YES;
[self.adView.nativePrivacyInformationIconImageView addSubview:privacyIconAdView];
self.adView.nativePrivacyInformationIconImageView.hidden = NO;
} else {
self.adView.nativePrivacyInformationIconImageView.userInteractionEnabled = NO;
self.adView.nativePrivacyInformationIconImageView.hidden = YES;
}
}
if ([self shouldLoadMediaView]) {
UIView *mediaView = [self.adapter mainMediaView];
UIView *mainImageView = [self.adView nativeMainImageView];
mediaView.frame = mainImageView.bounds;
mediaView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
mainImageView.userInteractionEnabled = YES;
[mainImageView addSubview:mediaView];
}
// See if the ad contains a star rating and notify the view if it does.
if ([self.adView respondsToSelector:@selector(layoutStarRating:)]) {
NSNumber *starRatingNum = [adapter.properties objectForKey:kAdStarRatingKey];
if ([starRatingNum isKindOfClass:[NSNumber class]] && starRatingNum.floatValue >= kStarRatingMinValue && starRatingNum.floatValue <= kStarRatingMaxValue) {
[self.adView layoutStarRating:starRatingNum];
}
}
return self.adView;
}
- (BOOL)shouldLoadMediaView
{
return [self.adapter respondsToSelector:@selector(mainMediaView)]
&& [self.adapter mainMediaView]
&& [self.adView respondsToSelector:@selector(nativeMainImageView)];
}
- (void)DAAIconTapped
{
if ([self.adapter respondsToSelector:@selector(displayContentForDAAIconTap)]) {
[self.adapter displayContentForDAAIconTap];
}
}
- (void)adViewWillMoveToSuperview:(UIView *)superview
{
self.adViewInViewHierarchy = (superview != nil);
if (superview) {
// We'll start asychronously loading the native ad images now.
if ([self.adapter.properties objectForKey:kAdIconImageKey] && [self.adView respondsToSelector:@selector(nativeIconImageView)]) {
[self.rendererImageHandler loadImageForURL:[NSURL URLWithString:[self.adapter.properties objectForKey:kAdIconImageKey]] intoImageView:self.adView.nativeIconImageView];
}
// Only handle the loading of the main image if the adapter doesn't already have a view for it.
if (!([self.adapter respondsToSelector:@selector(mainMediaView)] && [self.adapter mainMediaView])) {
if ([self.adapter.properties objectForKey:kAdMainImageKey] && [self.adView respondsToSelector:@selector(nativeMainImageView)]) {
[self.rendererImageHandler loadImageForURL:[NSURL URLWithString:[self.adapter.properties objectForKey:kAdMainImageKey]] intoImageView:self.adView.nativeMainImageView];
}
}
// Layout custom assets here as the custom assets may contain images that need to be loaded.
if ([self.adView respondsToSelector:@selector(layoutCustomAssetsWithProperties:imageLoader:)]) {
// Create a simplified image loader for the ad view to use.
MPNativeAdRenderingImageLoader *imageLoader = [[MPNativeAdRenderingImageLoader alloc] initWithImageHandler:self.rendererImageHandler];
[self.adView layoutCustomAssetsWithProperties:self.adapter.properties imageLoader:imageLoader];
}
}
}
#pragma mark - MPNativeAdRendererImageHandlerDelegate
- (BOOL)nativeAdViewInViewHierarchy
{
return self.adViewInViewHierarchy;
}
@end
|
{
"content_hash": "0431e3be30c86a3d293f90514b1a2197",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 183,
"avg_line_length": 46.396449704142015,
"alnum_prop": 0.7360030608340773,
"repo_name": "LawrenceHan/iOS-project-playground",
"id": "53d8567cf4caf088e327ff3df7b2321281266b27",
"size": "8425",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "mopub-ios-sdk-master/MoPubSDK/Native Ads/MPStaticNativeAdRenderer.m",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Awk",
"bytes": "478"
},
{
"name": "C",
"bytes": "313417"
},
{
"name": "C++",
"bytes": "1976805"
},
{
"name": "CSS",
"bytes": "16017"
},
{
"name": "DTrace",
"bytes": "3708"
},
{
"name": "HTML",
"bytes": "645689"
},
{
"name": "JavaScript",
"bytes": "138236"
},
{
"name": "Metal",
"bytes": "4464"
},
{
"name": "Objective-C",
"bytes": "14856610"
},
{
"name": "Objective-C++",
"bytes": "2017738"
},
{
"name": "Ruby",
"bytes": "13122"
},
{
"name": "Shell",
"bytes": "180624"
},
{
"name": "Swift",
"bytes": "1517280"
}
]
}
|
package com.hotels.styx.admin.handlers;
import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricFilter;
import com.codahale.metrics.MetricRegistryListener;
import com.codahale.metrics.Timer;
import com.codahale.metrics.json.MetricsModule;
import com.google.common.base.Predicate;
import com.hotels.styx.api.MetricRegistry;
import java.time.Duration;
import java.util.Optional;
import java.util.SortedMap;
import java.util.SortedSet;
import static com.google.common.collect.Maps.filterKeys;
import static com.google.common.collect.Sets.filter;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
/**
* Handler for showing the JVM statistics. Can cache page content.
*/
public class JVMMetricsHandler extends JsonHandler<MetricRegistry> {
private static final Predicate<String> STARTS_WITH_JVM = input -> input.startsWith("jvm");
private static final boolean DO_NOT_SHOW_SAMPLES = false;
/**
* Constructs a new handler.
*
* @param metricRegistry metrics registry
* @param cacheExpiration duration for which generated page content should be cached
*/
public JVMMetricsHandler(MetricRegistry metricRegistry, Optional<Duration> cacheExpiration) {
super(new FilteredRegistry(metricRegistry), cacheExpiration, new MetricsModule(SECONDS, MILLISECONDS, DO_NOT_SHOW_SAMPLES));
}
private static final class FilteredRegistry implements MetricRegistry {
private final MetricRegistry original;
public FilteredRegistry(MetricRegistry original) {
this.original = original;
}
@Override
public MetricRegistry scope(String name) {
return null;
}
@Override
public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
return null;
}
@Override
public boolean deregister(String name) {
return false;
}
@Override
public Counter counter(String name) {
return null;
}
@Override
public Histogram histogram(String name) {
return null;
}
@Override
public Meter meter(String name) {
return null;
}
@Override
public Timer timer(String name) {
return null;
}
@Override
public void addListener(MetricRegistryListener listener) {
}
@Override
public void removeListener(MetricRegistryListener listener) {
}
@Override
public SortedSet<String> getNames() {
return filter(original.getNames(), STARTS_WITH_JVM);
}
@Override
public SortedMap<String, Gauge> getGauges() {
return filterKeys(original.getGauges(), STARTS_WITH_JVM);
}
@Override
public SortedMap<String, Gauge> getGauges(MetricFilter filter) {
return null;
}
@Override
public SortedMap<String, Counter> getCounters() {
return filterKeys(original.getCounters(), STARTS_WITH_JVM);
}
@Override
public SortedMap<String, Counter> getCounters(MetricFilter filter) {
return null;
}
@Override
public SortedMap<String, Histogram> getHistograms() {
return filterKeys(original.getHistograms(), STARTS_WITH_JVM);
}
@Override
public SortedMap<String, Histogram> getHistograms(MetricFilter filter) {
return null;
}
@Override
public SortedMap<String, Meter> getMeters() {
return filterKeys(original.getMeters(), STARTS_WITH_JVM);
}
@Override
public SortedMap<String, Meter> getMeters(MetricFilter filter) {
return null;
}
@Override
public SortedMap<String, Timer> getTimers() {
return filterKeys(original.getTimers(), STARTS_WITH_JVM);
}
@Override
public SortedMap<String, Timer> getTimers(MetricFilter filter) {
return null;
}
@Override
public SortedMap<String, Metric> getMetrics() {
return filterKeys(original.getMetrics(), STARTS_WITH_JVM);
}
}
}
|
{
"content_hash": "6c2956b632e19bacc0a0e73ca7c2c478",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 132,
"avg_line_length": 29.22875816993464,
"alnum_prop": 0.6464669051878354,
"repo_name": "mikkokar/styx",
"id": "d739fcd3a96d3987a115a3f3b4cd2a37acdb0f0b",
"size": "5056",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/proxy/src/main/java/com/hotels/styx/admin/handlers/JVMMetricsHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "1331"
},
{
"name": "CSS",
"bytes": "8097"
},
{
"name": "Dockerfile",
"bytes": "1645"
},
{
"name": "Groovy",
"bytes": "132"
},
{
"name": "HTML",
"bytes": "9844"
},
{
"name": "Java",
"bytes": "3246363"
},
{
"name": "JavaScript",
"bytes": "26394"
},
{
"name": "Kotlin",
"bytes": "575195"
},
{
"name": "Lua",
"bytes": "4188"
},
{
"name": "Makefile",
"bytes": "4800"
},
{
"name": "Python",
"bytes": "18100"
},
{
"name": "Scala",
"bytes": "396930"
},
{
"name": "Shell",
"bytes": "14026"
}
]
}
|
DELIMITER /
CREATE TABLE SEQ_IACUC_PROTO_CORRESP_TEMPL (
id bigint(19) not null auto_increment, primary key (id)
) ENGINE MyISAM
/
ALTER TABLE SEQ_IACUC_PROTO_CORRESP_TEMPL auto_increment = 1
/
DELIMITER ;
|
{
"content_hash": "f3c9ffd9baa55662c64cfef19264bd6d",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 60,
"avg_line_length": 23.22222222222222,
"alnum_prop": 0.7511961722488039,
"repo_name": "blackcathacker/kc.preclean",
"id": "589ae694a2ef662c50b2b00a24610ee8b814f399",
"size": "209",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/current_mysql/5.0.1/sequences/KC_SEQ_IACUC_PROTO_CORRESP_TEMPL.sql",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "96034"
},
{
"name": "Java",
"bytes": "27623677"
},
{
"name": "JavaScript",
"bytes": "749782"
},
{
"name": "Perl",
"bytes": "1278"
},
{
"name": "Scheme",
"bytes": "8283377"
},
{
"name": "Shell",
"bytes": "69314"
},
{
"name": "XSLT",
"bytes": "20298494"
}
]
}
|
<?hh // strict
namespace traitorous\http\headers\response;
use traitorous\http\headers\HttpResponseHeader;
class WwwAuthenticateHeader extends HttpResponseHeader {
public function getKey(): string {
return "WWW-Authenticate";
}
}
|
{
"content_hash": "9bdbf894aa958de21ab38c95cffc7651",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 20.75,
"alnum_prop": 0.7469879518072289,
"repo_name": "traitorous/traitorous",
"id": "9840a8742976749c8d57d7918dc84ac8423fb727",
"size": "249",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/traitorous/http/headers/response/WwwAuthenticateHeader.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "167792"
}
]
}
|
<?php
declare(strict_types=1);
namespace Sonata\MediaBundle\CDN;
use Aws\CloudFront\CloudFrontClient;
use Aws\CloudFront\Exception\CloudFrontException;
/**
* From http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html.
*
* Invalidating Objects (Web Distributions Only)
* If you need to remove an object from CloudFront edge-server caches before it
* expires, you can do one of the following:
* Invalidate the object. The next time a viewer requests the object, CloudFront
* returns to the origin to fetch the latest version of the object.
* Use object versioning to serve a different version of the object that has a
* different name. For more information, see Updating Existing Objects Using
* Versioned Object Names.
* Important:
* You can invalidate most types of objects that are served by a web
* distribution, but you cannot invalidate media files in the Microsoft Smooth
* Streaming format when you have enabled Smooth Streaming for the corresponding
* cache behavior. In addition, you cannot invalidate objects that are served by
* an RTMP distribution. You can invalidate a specified number of objects each
* month for free. Above that limit, you pay a fee for each object that you
* invalidate. For example, to invalidate a directory and all of the files in
* the directory, you must invalidate the directory and each file individually.
* If you need to invalidate a lot of files, it might be easier and less
* expensive to create a new distribution and change your object paths to refer
* to the new distribution. For more information about the charges for
* invalidation, see Paying for Object Invalidation.
*
* @final since sonata-project/media-bundle 3.21.0
*
* @todo Remove this class when support for aws/aws-sdk-php < 3.0 is dropped.
*
* @uses CloudFrontClient for establishing a connection with CloudFront service
*
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.htmlInvalidating Objects (Web Distributions Only)
*
* @author Javier Spagnoletti <phansys@gmail.com>
*/
class CloudFront implements CDNInterface
{
private const AVAILABLE_STATUSES = [
self::STATUS_OK => 'Completed',
self::STATUS_WAITING => 'InProgress',
];
/**
* NEXT_MAJOR: Remove this property.
*
* @var string
*/
protected $path;
/**
* NEXT_MAJOR: Remove this property.
*
* @var string
*/
protected $key;
/**
* NEXT_MAJOR: Remove this property.
*
* @var string
*/
protected $secret;
/**
* NEXT_MAJOR: Remove this property.
*
* @var string
*/
protected $distributionId;
/**
* @var CloudFrontClient
*/
protected $client;
/**
* @var string
*/
private $region;
/**
* @var string
*/
private $version;
/**
* NEXT_MAJOR: Use `CloudFrontClient $client, string $distributionId, string $path` as signature for this method.
*
* @param CloudFrontClient|string $clientOrPath
* @param string $distributionIdOrKey
* @param string $pathOrSecret
* @param string|null $distributionId
*/
public function __construct(
$clientOrPath,
$distributionIdOrKey,
$pathOrSecret,
$distributionId = null
/* , ?string $region = null, ?string $version = null */
) {
// NEXT_MAJOR: Remove the following conditional block.
if (!$clientOrPath instanceof CloudFrontClient) {
@trigger_error(sprintf(
'Passing another type than %s as argument 1 for "%s()" is deprecated since sonata-project/media-bundle 3.28'
.' and will throw a %s error in version 4.0. You must pass these arguments: CDN client, CDN distribution id, CDN path.',
CloudFrontClient::class,
__METHOD__,
\TypeError::class
), E_USER_DEPRECATED);
$this->path = rtrim($clientOrPath, '/');
$this->key = $distributionIdOrKey;
$this->secret = $pathOrSecret;
$this->distributionId = $distributionId;
$args = \func_get_args();
$this->region = $args[4] ?? null;
$this->version = $args[5] ?? null;
return;
}
if (\func_num_args() > 3) {
throw new \InvalidArgumentException(sprintf(
'Number of arguments passed to "%s()" cannot be higher than 3 when using the new signature.'
.' You must pass these arguments: CDN client, CDN distribution id, CDN path.',
__METHOD__
));
}
$this->client = $clientOrPath;
$this->distributionId = $distributionIdOrKey;
$this->path = rtrim($pathOrSecret, '/');
}
public function getPath($relativePath, $isFlushable = false)
{
return sprintf('%s/%s', $this->path, ltrim($relativePath, '/'));
}
public function flushByString($string)
{
return $this->flushPaths([$string]);
}
public function flush($string)
{
return $this->flushPaths([$string]);
}
/**
* {@inheritdoc}
*
* @see http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.CloudFront.CloudFrontClient.html#_createInvalidation
*/
public function flushPaths(array $paths)
{
if (empty($paths)) {
throw new \RuntimeException('Unable to flush: expected at least one path.');
}
// Normalizes paths due possible typos since all the CloudFront's
// objects starts with a leading slash
$normalizedPaths = array_map(static function (string $path): string {
return '/'.ltrim($path, '/');
}, $paths);
try {
$result = $this->client->createInvalidation([
'DistributionId' => $this->distributionId,
'Paths' => [
'Quantity' => \count($normalizedPaths),
'Items' => $normalizedPaths,
],
'CallerReference' => $this->getCallerReference($normalizedPaths),
]);
$status = $result->get('Status');
if (false === array_search($status, self::AVAILABLE_STATUSES, true)) {
throw new \RuntimeException(sprintf('Unable to determine the flush status from the given response: "%s".', $status));
}
return $result->get('Id');
} catch (CloudFrontException $ex) {
throw new \RuntimeException(sprintf('Unable to flush paths "%s".', implode('", "', $paths), 0, $ex));
}
}
public function getFlushStatus($identifier)
{
try {
$result = $this->client->getInvalidation([
'DistributionId' => $this->distributionId,
'Id' => $identifier,
]);
$status = array_search($result->get('Status'), self::AVAILABLE_STATUSES, true);
if (false === $status) {
@trigger_error(sprintf(
'Returning a value not present in the `%s::STATUS_*` constants from %s() is deprecated since sonata-project/media-bundle 3.28'
.' and will not be possible in version 4.0.',
CDNInterface::class,
__METHOD__
), E_USER_DEPRECATED);
// NEXT_MAJOR: Remove the previous deprecation and uncomment the following exception.
// throw new \RuntimeException(sprintf('Unable to determine the flush status from the given response: "%s".', $status));
}
return $status;
} catch (CloudFrontException $ex) {
throw new \RuntimeException(sprintf('Unable to retrieve flush status for identifier %s.', $identifier), 0, $ex);
}
}
/**
* @deprecated since sonata-project/media-bundle 3.28, to be removed in version 4.0.
*
* @static
*
* @return string[]
*/
public static function getStatusList()
{
@trigger_error(sprintf(
'Method "%s()" is deprecated since sonata-project/media-bundle 3.28 and will be removed in version 4.0.',
__METHOD__
), E_USER_DEPRECATED);
// @todo: check for a complete list of available CloudFront statuses
return [
self::STATUS_OK => 'Completed',
self::STATUS_TO_SEND => 'STATUS_TO_SEND',
self::STATUS_TO_FLUSH => 'STATUS_TO_FLUSH',
self::STATUS_ERROR => 'STATUS_ERROR',
self::STATUS_WAITING => 'InProgress',
];
}
/**
* NEXT_MAJOR: Remove this method.
*
* @deprecated since sonata-project/media-bundle 3.28, to be removed in version 4.0.
*
* @param CloudFrontClient $client
*/
public function setClient($client)
{
@trigger_error(sprintf(
'Method "%s()" is deprecated since sonata-project/media-bundle 3.28 and will be removed in version 4.0.',
__METHOD__
), E_USER_DEPRECATED);
if (!$this->client) {
$config = [
'key' => $this->region,
'secret' => $this->version,
];
if (null !== $this->region) {
$config['region'] = $this->region;
}
if (null !== $this->version) {
$config['version'] = $this->version;
}
$this->client = CloudFrontClient::factory($config);
}
}
/**
* Generates a valid caller reference from given paths regardless its order.
*
* @return string a md5 representation
*/
protected function getCallerReference(array $paths)
{
sort($paths);
return md5(implode(',', $paths));
}
}
|
{
"content_hash": "9e6c972ddce7a931751ba064d810ae26",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 146,
"avg_line_length": 33.440677966101696,
"alnum_prop": 0.5871262037506335,
"repo_name": "jerome-fix/SonataMediaBundle",
"id": "cedd0331dea4fcc4b0795fbcdc30fef7a7d7e77f",
"size": "10112",
"binary": false,
"copies": "1",
"ref": "refs/heads/3.x",
"path": "src/CDN/CloudFront.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5154"
},
{
"name": "HTML",
"bytes": "39851"
},
{
"name": "JavaScript",
"bytes": "10949"
},
{
"name": "Makefile",
"bytes": "1651"
},
{
"name": "PHP",
"bytes": "762835"
},
{
"name": "Shell",
"bytes": "2810"
}
]
}
|
class Bloc_Destructible :
public Blocs
{
public:
Bloc_Destructible();
~Bloc_Destructible();
};
|
{
"content_hash": "226ed043794ef9ce25a54272d180d96f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 25,
"avg_line_length": 13.375,
"alnum_prop": 0.6542056074766355,
"repo_name": "MasterKkaj/TP3-bart-sdl-Bomberman",
"id": "eb4fdb9e72e35d702219fe167c44d3a9c256c2c8",
"size": "192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TP3-bart-sdl-bomberman/TP3-bart-sdl-bomberman/Bloc_Destructible.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "31769"
}
]
}
|
export function NoListenToGiven(msg) {
this.name = 'NoListenToGiven';
this.message = msg || 'Reducer must listen to something.';
}
NoListenToGiven.prototype = Error.prototype;
|
{
"content_hash": "b2132822c808a973ed6dcec01a3a56f9",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 60,
"avg_line_length": 36,
"alnum_prop": 0.75,
"repo_name": "JiriChara/redux-blower",
"id": "0fc48568ca99a263290389c6399c714a48f51f90",
"size": "180",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/errors/NoListenToGiven.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "26630"
}
]
}
|
namespace rocksdb {
class EnvMirrorTest : public testing::Test {
public:
Env* default_;
MockEnv* a_, *b_;
EnvMirror* env_;
const EnvOptions soptions_;
EnvMirrorTest()
: default_(Env::Default()),
a_(new MockEnv(default_)),
b_(new MockEnv(default_)),
env_(new EnvMirror(a_, b_)) {}
~EnvMirrorTest() {
delete env_;
delete a_;
delete b_;
}
};
TEST_F(EnvMirrorTest, Basics) {
uint64_t file_size;
unique_ptr<WritableFile> writable_file;
std::vector<std::string> children;
ASSERT_OK(env_->CreateDir("/dir"));
// Check that the directory is empty.
ASSERT_EQ(Status::NotFound(), env_->FileExists("/dir/non_existent"));
ASSERT_TRUE(!env_->GetFileSize("/dir/non_existent", &file_size).ok());
ASSERT_OK(env_->GetChildren("/dir", &children));
ASSERT_EQ(0U, children.size());
// Create a file.
ASSERT_OK(env_->NewWritableFile("/dir/f", &writable_file, soptions_));
writable_file.reset();
// Check that the file exists.
ASSERT_OK(env_->FileExists("/dir/f"));
ASSERT_OK(a_->FileExists("/dir/f"));
ASSERT_OK(b_->FileExists("/dir/f"));
ASSERT_OK(env_->GetFileSize("/dir/f", &file_size));
ASSERT_EQ(0U, file_size);
ASSERT_OK(env_->GetChildren("/dir", &children));
ASSERT_EQ(1U, children.size());
ASSERT_EQ("f", children[0]);
ASSERT_OK(a_->GetChildren("/dir", &children));
ASSERT_EQ(1U, children.size());
ASSERT_EQ("f", children[0]);
ASSERT_OK(b_->GetChildren("/dir", &children));
ASSERT_EQ(1U, children.size());
ASSERT_EQ("f", children[0]);
// Write to the file.
ASSERT_OK(env_->NewWritableFile("/dir/f", &writable_file, soptions_));
ASSERT_OK(writable_file->Append("abc"));
writable_file.reset();
// Check for expected size.
ASSERT_OK(env_->GetFileSize("/dir/f", &file_size));
ASSERT_EQ(3U, file_size);
ASSERT_OK(a_->GetFileSize("/dir/f", &file_size));
ASSERT_EQ(3U, file_size);
ASSERT_OK(b_->GetFileSize("/dir/f", &file_size));
ASSERT_EQ(3U, file_size);
// Check that renaming works.
ASSERT_TRUE(!env_->RenameFile("/dir/non_existent", "/dir/g").ok());
ASSERT_OK(env_->RenameFile("/dir/f", "/dir/g"));
ASSERT_EQ(Status::NotFound(), env_->FileExists("/dir/f"));
ASSERT_OK(env_->FileExists("/dir/g"));
ASSERT_OK(env_->GetFileSize("/dir/g", &file_size));
ASSERT_EQ(3U, file_size);
ASSERT_OK(a_->FileExists("/dir/g"));
ASSERT_OK(a_->GetFileSize("/dir/g", &file_size));
ASSERT_EQ(3U, file_size);
ASSERT_OK(b_->FileExists("/dir/g"));
ASSERT_OK(b_->GetFileSize("/dir/g", &file_size));
ASSERT_EQ(3U, file_size);
// Check that opening non-existent file fails.
unique_ptr<SequentialFile> seq_file;
unique_ptr<RandomAccessFile> rand_file;
ASSERT_TRUE(
!env_->NewSequentialFile("/dir/non_existent", &seq_file, soptions_).ok());
ASSERT_TRUE(!seq_file);
ASSERT_TRUE(!env_->NewRandomAccessFile("/dir/non_existent", &rand_file,
soptions_).ok());
ASSERT_TRUE(!rand_file);
// Check that deleting works.
ASSERT_TRUE(!env_->DeleteFile("/dir/non_existent").ok());
ASSERT_OK(env_->DeleteFile("/dir/g"));
ASSERT_EQ(Status::NotFound(), env_->FileExists("/dir/g"));
ASSERT_OK(env_->GetChildren("/dir", &children));
ASSERT_EQ(0U, children.size());
ASSERT_OK(env_->DeleteDir("/dir"));
}
TEST_F(EnvMirrorTest, ReadWrite) {
unique_ptr<WritableFile> writable_file;
unique_ptr<SequentialFile> seq_file;
unique_ptr<RandomAccessFile> rand_file;
Slice result;
char scratch[100];
ASSERT_OK(env_->CreateDir("/dir"));
ASSERT_OK(env_->NewWritableFile("/dir/f", &writable_file, soptions_));
ASSERT_OK(writable_file->Append("hello "));
ASSERT_OK(writable_file->Append("world"));
writable_file.reset();
// Read sequentially.
ASSERT_OK(env_->NewSequentialFile("/dir/f", &seq_file, soptions_));
ASSERT_OK(seq_file->Read(5, &result, scratch)); // Read "hello".
ASSERT_EQ(0, result.compare("hello"));
ASSERT_OK(seq_file->Skip(1));
ASSERT_OK(seq_file->Read(1000, &result, scratch)); // Read "world".
ASSERT_EQ(0, result.compare("world"));
ASSERT_OK(seq_file->Read(1000, &result, scratch)); // Try reading past EOF.
ASSERT_EQ(0U, result.size());
ASSERT_OK(seq_file->Skip(100)); // Try to skip past end of file.
ASSERT_OK(seq_file->Read(1000, &result, scratch));
ASSERT_EQ(0U, result.size());
// Random reads.
ASSERT_OK(env_->NewRandomAccessFile("/dir/f", &rand_file, soptions_));
ASSERT_OK(rand_file->Read(6, 5, &result, scratch)); // Read "world".
ASSERT_EQ(0, result.compare("world"));
ASSERT_OK(rand_file->Read(0, 5, &result, scratch)); // Read "hello".
ASSERT_EQ(0, result.compare("hello"));
ASSERT_OK(rand_file->Read(10, 100, &result, scratch)); // Read "d".
ASSERT_EQ(0, result.compare("d"));
// Too high offset.
ASSERT_TRUE(!rand_file->Read(1000, 5, &result, scratch).ok());
}
TEST_F(EnvMirrorTest, Locks) {
FileLock* lock;
// These are no-ops, but we test they return success.
ASSERT_OK(env_->LockFile("some file", &lock));
ASSERT_OK(env_->UnlockFile(lock));
}
TEST_F(EnvMirrorTest, Misc) {
std::string test_dir;
ASSERT_OK(env_->GetTestDirectory(&test_dir));
ASSERT_TRUE(!test_dir.empty());
unique_ptr<WritableFile> writable_file;
ASSERT_OK(env_->NewWritableFile("/a/b", &writable_file, soptions_));
// These are no-ops, but we test they return success.
ASSERT_OK(writable_file->Sync());
ASSERT_OK(writable_file->Flush());
ASSERT_OK(writable_file->Close());
writable_file.reset();
}
TEST_F(EnvMirrorTest, LargeWrite) {
const size_t kWriteSize = 300 * 1024;
char* scratch = new char[kWriteSize * 2];
std::string write_data;
for (size_t i = 0; i < kWriteSize; ++i) {
write_data.append(1, static_cast<char>(i));
}
unique_ptr<WritableFile> writable_file;
ASSERT_OK(env_->NewWritableFile("/dir/f", &writable_file, soptions_));
ASSERT_OK(writable_file->Append("foo"));
ASSERT_OK(writable_file->Append(write_data));
writable_file.reset();
unique_ptr<SequentialFile> seq_file;
Slice result;
ASSERT_OK(env_->NewSequentialFile("/dir/f", &seq_file, soptions_));
ASSERT_OK(seq_file->Read(3, &result, scratch)); // Read "foo".
ASSERT_EQ(0, result.compare("foo"));
size_t read = 0;
std::string read_data;
while (read < kWriteSize) {
ASSERT_OK(seq_file->Read(kWriteSize - read, &result, scratch));
read_data.append(result.data(), result.size());
read += result.size();
}
ASSERT_TRUE(write_data == read_data);
delete[] scratch;
}
} // namespace rocksdb
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
#else
#include <stdio.h>
int main(int argc, char** argv) {
fprintf(stderr, "SKIPPED as EnvMirror is not supported in ROCKSDB_LITE\n");
return 0;
}
#endif // !ROCKSDB_LITE
|
{
"content_hash": "72762127be27394eaf913b8b22cfcd1b",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 80,
"avg_line_length": 32.161137440758296,
"alnum_prop": 0.6457412319481285,
"repo_name": "hkernbach/arangodb",
"id": "0de68b305df6f4f933e16ad291d45a70a0ed6326",
"size": "7334",
"binary": false,
"copies": "3",
"ref": "refs/heads/devel",
"path": "3rdParty/rocksdb/v5.6.X/utilities/env_mirror_test.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "89079"
},
{
"name": "Assembly",
"bytes": "391227"
},
{
"name": "Awk",
"bytes": "7502"
},
{
"name": "Batchfile",
"bytes": "62496"
},
{
"name": "C",
"bytes": "9184899"
},
{
"name": "C#",
"bytes": "96431"
},
{
"name": "C++",
"bytes": "278343201"
},
{
"name": "CMake",
"bytes": "664691"
},
{
"name": "CSS",
"bytes": "650173"
},
{
"name": "CWeb",
"bytes": "174166"
},
{
"name": "Cuda",
"bytes": "52444"
},
{
"name": "DIGITAL Command Language",
"bytes": "259402"
},
{
"name": "Emacs Lisp",
"bytes": "14637"
},
{
"name": "Fortran",
"bytes": "1856"
},
{
"name": "Groovy",
"bytes": "51836"
},
{
"name": "HTML",
"bytes": "2415724"
},
{
"name": "Java",
"bytes": "1048556"
},
{
"name": "JavaScript",
"bytes": "54219725"
},
{
"name": "LLVM",
"bytes": "24019"
},
{
"name": "Lex",
"bytes": "1231"
},
{
"name": "Lua",
"bytes": "17899"
},
{
"name": "M4",
"bytes": "658700"
},
{
"name": "Makefile",
"bytes": "522586"
},
{
"name": "Max",
"bytes": "36857"
},
{
"name": "Module Management System",
"bytes": "1545"
},
{
"name": "NSIS",
"bytes": "42998"
},
{
"name": "Objective-C",
"bytes": "98866"
},
{
"name": "Objective-C++",
"bytes": "2503"
},
{
"name": "PHP",
"bytes": "118092"
},
{
"name": "Pascal",
"bytes": "150599"
},
{
"name": "Perl",
"bytes": "906737"
},
{
"name": "Perl 6",
"bytes": "25883"
},
{
"name": "PowerShell",
"bytes": "20434"
},
{
"name": "Python",
"bytes": "4557865"
},
{
"name": "QMake",
"bytes": "16692"
},
{
"name": "R",
"bytes": "5123"
},
{
"name": "Rebol",
"bytes": "354"
},
{
"name": "Roff",
"bytes": "1089418"
},
{
"name": "Ruby",
"bytes": "1141022"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Scheme",
"bytes": "10604"
},
{
"name": "Shell",
"bytes": "508528"
},
{
"name": "Swift",
"bytes": "116"
},
{
"name": "Tcl",
"bytes": "1172"
},
{
"name": "TeX",
"bytes": "32117"
},
{
"name": "Visual Basic",
"bytes": "11568"
},
{
"name": "XSLT",
"bytes": "567028"
},
{
"name": "Yacc",
"bytes": "53063"
}
]
}
|
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
|
{
"content_hash": "7b0252cffefcb5d682d322aa97899af0",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 90,
"avg_line_length": 31.6,
"alnum_prop": 0.6582278481012658,
"repo_name": "xiaofei86/LPLaunchManager",
"id": "fb86c8612e181a3459c04069c605dcd2dae0b7b9",
"size": "343",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LPLaunchManagerDemo/LPLaunchManagerDemo/main.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "196266"
},
{
"name": "Ruby",
"bytes": "159"
},
{
"name": "Shell",
"bytes": "4587"
}
]
}
|
package org.lockss.plugin.highwire;
import java.io.*;
import org.lockss.util.*;
import org.lockss.test.LockssTestCase;
public class TestHighWireFilterRule extends LockssTestCase {
private HighWireFilterRule rule;
public void setUp() throws Exception {
super.setUp();
rule = new HighWireFilterRule();
}
private static final String inst1 = "<FONT SIZE=\"-2\" FACE=\"verdana,arial,helvetica\">\n <NOBR><STRONG>Institution: Periodicals Department/Lane Library</STRONG></NOBR>\n <NOBR><A TARGET=\"_top\" HREF=\"/cgi/login?uri=%2Fcgi%2Fcontent%2Ffull%2F4%2F1%2F121\">Sign In as Personal Subscriber</A></NOBR>";
private static final String inst2 = "<FONT SIZE=\"-2\" FACE=\"verdana,arial,helvetica\">\n <NOBR><STRONG>Institution: Stanford University Libraries</STRONG></NOBR>\n <NOBR><A TARGET=\"_top\" HREF=\"/cgi/login?uri=%2Fcgi%2Fcontent%2Ffull%2F4%2F1%2F121\">Sign In as Personal Subscriber</A></NOBR>";
private static final String inst3 = "<FONT SIZE=\"-2\" FACE=\"verdana,arial,helvetica\">\n <NOBR><STRONG>Institution: Stanford University Libraries</STRONG></NOBR>\n <NOBR><A TARGET=\"_top\" HREF=\"/cgi/login?uri=%2Fcgi%2Fcontent%2Ffull%2F4%2F1%2F121\">Sign In as SOMETHING SOMETHING</A></NOBR>";
public void testFiltering() throws IOException {
Reader readerA;
Reader readerB;
readerA = rule.createFilteredReader(new StringReader(inst1));
readerB = rule.createFilteredReader(new StringReader(inst2));
assertEquals(StringUtil.fromReader(readerA),
StringUtil.fromReader(readerB));
readerA = rule.createFilteredReader(new StringReader(inst1));
readerB = rule.createFilteredReader(new StringReader(inst3));
assertEquals(StringUtil.fromReader(readerA),
StringUtil.fromReader(readerB));
}
}
|
{
"content_hash": "9a599650ee03fdf2767ff1be5524772f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 306,
"avg_line_length": 45,
"alnum_prop": 0.7172222222222222,
"repo_name": "lockss/lockss-daemon",
"id": "c56de1f43da0d996fa71c1210ab1c8fbe158d264",
"size": "3334",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plugins/test/src/org/lockss/plugin/highwire/TestHighWireFilterRule.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ANTLR",
"bytes": "19051"
},
{
"name": "Awk",
"bytes": "14488"
},
{
"name": "Batchfile",
"bytes": "77"
},
{
"name": "C",
"bytes": "4376"
},
{
"name": "CSS",
"bytes": "8825"
},
{
"name": "HTML",
"bytes": "747906"
},
{
"name": "Java",
"bytes": "34571927"
},
{
"name": "JavaScript",
"bytes": "1093221"
},
{
"name": "Perl",
"bytes": "237235"
},
{
"name": "Python",
"bytes": "392081"
},
{
"name": "Shell",
"bytes": "198060"
},
{
"name": "mIRC Script",
"bytes": "12320"
}
]
}
|
namespace arthr.Web.Models.ManageViewModels
{
public class FactorViewModel
{
#region Properties
public string Purpose { get; set; }
#endregion
}
}
|
{
"content_hash": "36609e76fe803a646cb3f0a8c86cf1cf",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 44,
"avg_line_length": 16.90909090909091,
"alnum_prop": 0.6182795698924731,
"repo_name": "timbjames/arthR",
"id": "35f84741a310e71ecab232d3c765e8f0060fa326",
"size": "188",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "arthr.Web/Models/ManageViewModels/FactorViewModel.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "36"
},
{
"name": "C#",
"bytes": "96032"
},
{
"name": "CSS",
"bytes": "58243"
},
{
"name": "CoffeeScript",
"bytes": "3263"
},
{
"name": "HTML",
"bytes": "668868"
},
{
"name": "JavaScript",
"bytes": "162089"
},
{
"name": "PHP",
"bytes": "4522"
}
]
}
|
module Para
module Component
module Subclassable
extend ActiveSupport::Concern
included do
configurable_on :subclasses
end
def subclassable?
@subclassable ||= subclass_names.length > 0
end
def subclassable_with?(class_name)
subclassable? && class_name.in?(subclass_names)
end
def subclass_names
@subclass_names ||= if subclasses.present?
eval(subclasses)
else
[]
end
end
end
end
end
|
{
"content_hash": "3e68750f85d1f72a0381cb3c6b36cb75",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 55,
"avg_line_length": 19.296296296296298,
"alnum_prop": 0.5834932821497121,
"repo_name": "para-cms/para",
"id": "3048738637da10b1049c0549124a9ca5d11c43a1",
"size": "521",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/para/component/subclassable.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "80724"
},
{
"name": "CoffeeScript",
"bytes": "20798"
},
{
"name": "HTML",
"bytes": "32453"
},
{
"name": "JavaScript",
"bytes": "1280"
},
{
"name": "Ruby",
"bytes": "279750"
}
]
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tribute Page - Leonardo da Vinci</title>
<link href='https://fonts.googleapis.com/css?family=Berkshire+Swash' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<div class="well">
<div class="text-center">
<h1><strong>Leonardo da Vinci</strong></h1>
<h4><em>The most notable polymath in history</em></h4>
</div>
<img class="img-responsive center-block" src="img/leonardo-da-vinci.jpg" />
<p class="text-center">A small list of facts about Leonardo:</p>
<!-- This list is not centered because it looks bad (when centered) -->
<ul>
<li>He was born on 15 April 1452</li>
<li>During his life, he was among the best in almost every field of study.</li>
<li>His areas of interest included invention, painting, sculpting, architecture, science, music, mathematics, engineering, literature, anatomy, geology, astronomy, botany, writing, history, and cartography.</li>
<li>He was considered <em>"a man who can do all things if he will"</em> by people of his time.</li>
<li>He is considered one of the best painters of all time.</li>
<li>He was a vegetarian.</li>
<li>It took da Vinci about ten years to paint Mona Lisa's lips.</li>
</ul>
<p class="text-center">Want to know more? You can find more information about Leonardo's life and creations on <a href="https://en.wikipedia.org/wiki/Leonardo_da_Vinci" target="_blank">Wikipedia</a>.</p>
</div>
<p class="text-center">This page was made by <a href="https://www.freecodecamp.com/atomk" target="_blank">Atomk</a> for <a href="https://www.freecodecamp.com" target="_blank">freeCodeCamp</a>.</p>
</div>
</body>
</html>
|
{
"content_hash": "9843a342806b06d6329cae063b47ffbf",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 221,
"avg_line_length": 58.02777777777778,
"alnum_prop": 0.6476783149832456,
"repo_name": "Atomk/fcc-projects",
"id": "7c2dee3e93a4fe0670e215b4a78290cc95ed83f7",
"size": "2089",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "1. Frontend/Tribute page/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "19658"
},
{
"name": "HTML",
"bytes": "31194"
},
{
"name": "JavaScript",
"bytes": "103567"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 5