text
stringlengths 2
99.9k
| meta
dict |
---|---|
//---------------------------------------------------------------------------//
// Copyright (c) 2015 Jakub Szuppe <[email protected]>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_HPP
#define BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_HPP
#include <algorithm>
#include <iterator>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/functional.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
#include <boost/compute/algorithm/detail/serial_reduce_by_key.hpp>
#include <boost/compute/algorithm/detail/reduce_by_key_with_scan.hpp>
#include <boost/compute/type_traits.hpp>
namespace boost {
namespace compute {
namespace detail {
template<class InputKeyIterator, class InputValueIterator,
class OutputKeyIterator, class OutputValueIterator,
class BinaryFunction, class BinaryPredicate>
size_t reduce_by_key_on_gpu(InputKeyIterator keys_first,
InputKeyIterator keys_last,
InputValueIterator values_first,
OutputKeyIterator keys_result,
OutputValueIterator values_result,
BinaryFunction function,
BinaryPredicate predicate,
command_queue &queue)
{
return detail::reduce_by_key_with_scan(keys_first, keys_last, values_first,
keys_result, values_result, function,
predicate, queue);
}
template<class InputKeyIterator, class InputValueIterator,
class OutputKeyIterator, class OutputValueIterator>
bool reduce_by_key_on_gpu_requirements_met(InputKeyIterator keys_first,
InputValueIterator values_first,
OutputKeyIterator keys_result,
OutputValueIterator values_result,
const size_t count,
command_queue &queue)
{
const device &device = queue.get_device();
return (count > 256)
&& !(device.type() & device::cpu)
&& reduce_by_key_with_scan_requirements_met(keys_first, values_first,
keys_result,values_result,
count, queue);
return true;
}
template<class InputKeyIterator, class InputValueIterator,
class OutputKeyIterator, class OutputValueIterator,
class BinaryFunction, class BinaryPredicate>
inline std::pair<OutputKeyIterator, OutputValueIterator>
dispatch_reduce_by_key(InputKeyIterator keys_first,
InputKeyIterator keys_last,
InputValueIterator values_first,
OutputKeyIterator keys_result,
OutputValueIterator values_result,
BinaryFunction function,
BinaryPredicate predicate,
command_queue &queue)
{
typedef typename
std::iterator_traits<OutputKeyIterator>::difference_type key_difference_type;
typedef typename
std::iterator_traits<OutputValueIterator>::difference_type value_difference_type;
const size_t count = detail::iterator_range_size(keys_first, keys_last);
if (count < 2) {
boost::compute::copy_n(keys_first, count, keys_result, queue);
boost::compute::copy_n(values_first, count, values_result, queue);
return
std::make_pair<OutputKeyIterator, OutputValueIterator>(
keys_result + static_cast<key_difference_type>(count),
values_result + static_cast<value_difference_type>(count)
);
}
size_t result_size = 0;
if(reduce_by_key_on_gpu_requirements_met(keys_first, values_first, keys_result,
values_result, count, queue)){
result_size =
detail::reduce_by_key_on_gpu(keys_first, keys_last, values_first,
keys_result, values_result, function,
predicate, queue);
}
else {
result_size =
detail::serial_reduce_by_key(keys_first, keys_last, values_first,
keys_result, values_result, function,
predicate, queue);
}
return
std::make_pair<OutputKeyIterator, OutputValueIterator>(
keys_result + static_cast<key_difference_type>(result_size),
values_result + static_cast<value_difference_type>(result_size)
);
}
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_HPP
| {
"pile_set_name": "Github"
} |
# Maintainer: Manuel Schmitzberger <[email protected]>
pkgname=python-cppheaderparser
_name=CppHeaderParser
pkgver=2.7.4
pkgrel=3
pkgdesc="Parse C++ header files and generate a data structure representing the class"
arch=('any')
url="http://senexcanis.com/open-source/cppheaderparser"
license=('custom')
depends=('python-ply')
makedepends=('python-setuptools')
source=("https://pypi.org/packages/source/${_name:0:1}/$_name/$_name-$pkgver.tar.gz"
'https://bitbucket.org/senex/cppheaderparser/raw/6613bc9718009a3bd90b9de2f64e0e94eec5afcc/LICENSE.txt')
sha256sums=('382b30416d95b0a5e8502b214810dcac2a56432917e2651447d3abe253e3cc42'
'eb7b784bb4d031e970db11186fdbd3833b327d77d0250687daffd18b4900693d')
build() {
cd "$_name-$pkgver"
python setup.py build
}
package() {
cd "$_name-$pkgver"
python setup.py install --root="$pkgdir" --optimize=1 --skip-build
install -Dm644 "$srcdir/LICENSE.txt" -t "$pkgdir/usr/share/licenses/$pkgname"
}
| {
"pile_set_name": "Github"
} |
{-# OPTIONS_GHC -Wall #-}
module ElmFormat where
import Prelude hiding (putStr, putStrLn)
import System.Exit (ExitCode(..))
import System.Environment (getArgs)
import Messages.Types
import Messages.Formatter.Format
import Control.Monad.Free
import qualified CommandLine.Helpers as Helpers
import ElmVersion
import ElmFormat.FileStore (FileStore)
import ElmFormat.FileWriter (FileWriter)
import ElmFormat.InputConsole (InputConsole)
import ElmFormat.OutputConsole (OutputConsole)
import ElmFormat.World
import qualified AST.Json
import qualified AST.Module
import qualified Flags
import qualified Data.Text as Text
import qualified ElmFormat.Execute as Execute
import qualified ElmFormat.InputConsole as InputConsole
import qualified ElmFormat.Parse as Parse
import qualified ElmFormat.Render.Text as Render
import qualified ElmFormat.FileStore as FileStore
import qualified ElmFormat.FileWriter as FileWriter
import qualified ElmFormat.Filesystem as FS
import qualified ElmFormat.OutputConsole as OutputConsole
import qualified ElmFormat.Version
import qualified Options.Applicative as Opt
import qualified Reporting.Result as Result
import qualified Text.JSON
resolveFile :: FileStore f => FilePath -> Free f (Either InputFileMessage [FilePath])
resolveFile path =
do
fileType <- FileStore.stat path
case fileType of
FileStore.IsFile ->
return $ Right [path]
FileStore.IsDirectory ->
do
elmFiles <- FS.findAllElmFiles path
case elmFiles of
[] -> return $ Left $ NoElmFiles path
_ -> return $ Right elmFiles
FileStore.DoesNotExist ->
return $ Left $ FileDoesNotExist path
collectErrors :: [Either l r] -> Either [l] [r]
collectErrors list =
let
step acc next =
case (next, acc) of
(Left l, Right _) ->
Left [l]
(Left l, Left ls) ->
Left (l : ls)
(Right r, Right rs) ->
Right (r : rs)
(Right _, Left ls) ->
Left ls
in
foldl step (Right []) list
resolveFiles :: FileStore f => [FilePath] -> Free f (Either [InputFileMessage] [FilePath])
resolveFiles inputFiles =
do
result <- collectErrors <$> mapM resolveFile inputFiles
case result of
Left ls ->
return $ Left ls
Right files ->
return $ Right $ concat files
data WhatToDo
= FormatToFile FilePath FilePath
| StdinToFile FilePath
| FormatInPlace FilePath [FilePath]
| StdinToStdout
| ValidateStdin
| ValidateFiles FilePath [FilePath]
| FileToJson FilePath
| StdinToJson
data Source
= Stdin
| FromFiles FilePath [FilePath]
data Destination
= ValidateOnly
| UpdateInPlace
| ToFile FilePath
| ToJson
determineSource :: Bool -> Either [InputFileMessage] [FilePath] -> Either ErrorMessage Source
determineSource stdin inputFiles =
case ( stdin, inputFiles ) of
( _, Left fileErrors ) -> Left $ BadInputFiles fileErrors
( True, Right [] ) -> Right Stdin
( False, Right [] ) -> Left NoInputs
( False, Right (first:rest) ) -> Right $ FromFiles first rest
( True, Right (_:_) ) -> Left TooManyInputs
determineDestination :: Maybe FilePath -> Bool -> Bool -> Either ErrorMessage Destination
determineDestination output doValidate json =
case ( output, doValidate, json ) of
( _, True, True ) -> Left OutputAndValidate
( Nothing, True, False ) -> Right ValidateOnly
( Nothing, False, False ) -> Right UpdateInPlace
( Just path, False, False ) -> Right $ ToFile path
( Just _, True, _ ) -> Left OutputAndValidate
( _, False, True ) -> Right ToJson
determineWhatToDo :: Source -> Destination -> Either ErrorMessage WhatToDo
determineWhatToDo source destination =
case ( source, destination ) of
( Stdin, ValidateOnly ) -> Right $ ValidateStdin
( FromFiles first rest, ValidateOnly) -> Right $ ValidateFiles first rest
( Stdin, UpdateInPlace ) -> Right StdinToStdout
( Stdin, ToJson ) -> Right StdinToJson
( Stdin, ToFile output ) -> Right $ StdinToFile output
( FromFiles first [], ToFile output ) -> Right $ FormatToFile first output
( FromFiles first rest, UpdateInPlace ) -> Right $ FormatInPlace first rest
( FromFiles _ _, ToFile _ ) -> Left SingleOutputWithMultipleInputs
( FromFiles first [], ToJson ) -> Right $ FileToJson first
( FromFiles _ _, ToJson ) -> Left SingleOutputWithMultipleInputs
determineWhatToDoFromConfig :: Flags.Config -> Either [InputFileMessage] [FilePath] -> Either ErrorMessage WhatToDo
determineWhatToDoFromConfig config resolvedInputFiles =
do
source <- determineSource (Flags._stdin config) resolvedInputFiles
destination <- determineDestination (Flags._output config) (Flags._validate config) (Flags._json config)
determineWhatToDo source destination
exitWithError :: World m => ErrorMessage -> m ()
exitWithError message =
(putStrLnStderr $ Helpers.r $ message)
>> exitFailure
determineVersion :: ElmVersion -> Bool -> Either ErrorMessage ElmVersion
determineVersion elmVersion upgrade =
case (elmVersion, upgrade) of
(Elm_0_18, True) ->
Right Elm_0_18_Upgrade
(Elm_0_19, True) ->
Right Elm_0_19_Upgrade
(_, True) ->
Left $ MustSpecifyVersionWithUpgrade Elm_0_19_Upgrade
(_, False) ->
Right elmVersion
elmFormatVersion :: String
elmFormatVersion =
ElmFormat.Version.asString
experimental :: Maybe String
experimental =
ElmFormat.Version.experimental
{-| copied from Options.Applicative -}
handleParseResult :: World m => Opt.ParserResult a -> m (Maybe a)
handleParseResult (Opt.Success a) = return (Just a)
handleParseResult (Opt.Failure failure) = do
progn <- getProgName
let (msg, exit) = Opt.renderFailure failure progn
case exit of
ExitSuccess -> putStrLn msg *> exitSuccess *> return Nothing
_ -> putStrLnStderr msg *> exitFailure *> return Nothing
handleParseResult (Opt.CompletionInvoked _) = do
-- progn <- getProgName
-- msg <- Opt.execCompletion compl progn
-- putStr msg
-- const undefined <$> exitSuccess
error "Shell completion not yet implemented"
main :: IO ()
main =
do
args <- getArgs
main' args
main' :: World m => [String] -> m ()
main' args =
main'' elmFormatVersion experimental args
main'' :: World m => String -> Maybe String -> [String] -> m ()
main'' elmFormatVersion_ experimental_ args =
do
c <- handleParseResult $ Flags.parse elmFormatVersion_ experimental_ args
case c of
Nothing -> return ()
Just config ->
do
let autoYes = Flags._yes config
resolvedInputFiles <- Execute.run (Execute.forHuman autoYes) $ resolveFiles (Flags._input config)
case determineWhatToDoFromConfig config resolvedInputFiles of
Left NoInputs ->
(handleParseResult $ Flags.showHelpText elmFormatVersion_ experimental_)
-- TODO: handleParseResult is exitSuccess, so we never get to exitFailure
>> exitFailure
Left message ->
exitWithError message
Right whatToDo -> do
elmVersionChoice <- case Flags._elmVersion config of
Just v -> return $ Right v
Nothing -> autoDetectElmVersion
case elmVersionChoice of
Left message ->
putStr message *> exitFailure
Right elmVersionChoice' -> do
let elmVersionResult = determineVersion elmVersionChoice' (Flags._upgrade config)
case elmVersionResult of
Left message ->
exitWithError message
Right elmVersion ->
do
let run = case (Flags._validate config) of
True -> Execute.run $ Execute.forMachine elmVersion True
False -> Execute.run $ Execute.forHuman autoYes
result <- run $ doIt elmVersion whatToDo
if result
then exitSuccess
else exitFailure
autoDetectElmVersion :: World m => m (Either String ElmVersion)
autoDetectElmVersion =
do
hasElmPackageJson <- doesFileExist "elm-package.json"
if hasElmPackageJson
then
do
hasElmJson <- doesFileExist "elm.json"
if hasElmJson
then return $ Right Elm_0_19
else return $ Right Elm_0_18
else return $ Right Elm_0_19
validate :: ElmVersion -> (FilePath, Text.Text) -> Either InfoMessage ()
validate elmVersion (inputFile, inputText) =
case Parse.parse elmVersion inputText of
Result.Result _ (Result.Ok modu) ->
if inputText /= Render.render elmVersion modu then
Left $ FileWouldChange inputFile
else
Right ()
Result.Result _ (Result.Err errs) ->
Left $ ParseError inputFile (Text.unpack inputText) errs
data FormatResult
= NoChange FilePath Text.Text
| Changed FilePath Text.Text
parseModule :: ElmVersion -> (FilePath, Text.Text) -> Either InfoMessage AST.Module.Module
parseModule elmVersion (inputFile, inputText) =
case Parse.parse elmVersion inputText of
Result.Result _ (Result.Ok modu) ->
Right modu
Result.Result _ (Result.Err errs) ->
Left $ ParseError inputFile (Text.unpack inputText) errs
format :: ElmVersion -> (FilePath, Text.Text) -> Either InfoMessage FormatResult
format elmVersion (inputFile, inputText) =
case parseModule elmVersion (inputFile, inputText) of
Right modu ->
let
outputText = Render.render elmVersion modu
in
Right $
if inputText == outputText
then NoChange inputFile outputText
else Changed inputFile outputText
Left message ->
Left message
readStdin :: InputConsole f => Free f (FilePath, Text.Text)
readStdin =
(,) "<STDIN>" <$> InputConsole.readStdin
readFile :: (FileStore f, InfoFormatter f) => FilePath -> Free f (FilePath, Text.Text)
readFile filePath =
onInfo (ProcessingFile filePath)
*> ((,) filePath <$> FileStore.readFile filePath)
getOutputText :: FormatResult -> Text.Text
getOutputText result =
case result of
NoChange _ text -> text
Changed _ text -> text
updateFile :: FileWriter f => FormatResult -> Free f ()
updateFile result =
case result of
NoChange _ _ -> return ()
Changed outputFile outputText -> FileWriter.overwriteFile outputFile outputText
logError :: InfoFormatter f => Either InfoMessage () -> Free f Bool
logError result =
case result of
Left message ->
onInfo message *> return False
Right () ->
return True
logErrorOr :: InfoFormatter f => (a -> Free f ()) -> Either InfoMessage a -> Free f Bool
logErrorOr fn result =
case result of
Left message ->
onInfo message *> return False
Right value ->
fn value *> return True
doIt :: (InputConsole f, OutputConsole f, InfoFormatter f, FileStore f, FileWriter f) => ElmVersion -> WhatToDo -> Free f Bool
doIt elmVersion whatToDo =
case whatToDo of
ValidateStdin ->
(validate elmVersion <$> readStdin) >>= logError
ValidateFiles first rest ->
all id <$> mapM validateFile (first:rest)
where validateFile file = (validate elmVersion <$> ElmFormat.readFile file) >>= logError
StdinToStdout ->
(fmap getOutputText <$> format elmVersion <$> readStdin) >>= logErrorOr OutputConsole.writeStdout
StdinToFile outputFile ->
(fmap getOutputText <$> format elmVersion <$> readStdin) >>= logErrorOr (FileWriter.overwriteFile outputFile)
FormatToFile inputFile outputFile ->
(fmap getOutputText <$> format elmVersion <$> ElmFormat.readFile inputFile) >>= logErrorOr (FileWriter.overwriteFile outputFile)
FormatInPlace first rest ->
do
canOverwrite <- approve $ FilesWillBeOverwritten (first:rest)
if canOverwrite
then all id <$> mapM formatFile (first:rest)
else return True
where
formatFile file = (format elmVersion <$> ElmFormat.readFile file) >>= logErrorOr ElmFormat.updateFile
StdinToJson ->
(fmap (Text.pack . Text.JSON.encode . AST.Json.showModule) <$> parseModule elmVersion <$> readStdin) >>= logErrorOr OutputConsole.writeStdout
-- TODO: this prints "Processing such-and-such-a-file.elm" which makes the JSON output invalid
-- FileToJson inputFile ->
-- (fmap (Text.pack . Text.JSON.encode . AST.Json.showJSON) <$> parseModule <$> ElmFormat.readFile inputFile) >>= logErrorOr OutputConsole.writeStdout
| {
"pile_set_name": "Github"
} |
/* $Xorg: fontxlfd.h,v 1.4 2001/02/09 02:04:04 xorgcvs Exp $ */
/*
Copyright 1990, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/* $XFree86: xc/lib/font/include/fontxlfd.h,v 1.5 2001/01/17 19:43:32 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
*/
#ifndef _FONTXLFD_H_
#define _FONTXLFD_H_
#include <X11/fonts/FSproto.h>
/* Constants for values_supplied bitmap */
#define SIZE_SPECIFY_MASK 0xf
#define PIXELSIZE_MASK 0x3
#define PIXELSIZE_UNDEFINED 0
#define PIXELSIZE_SCALAR 0x1
#define PIXELSIZE_ARRAY 0x2
#define PIXELSIZE_SCALAR_NORMALIZED 0x3 /* Adjusted for resolution */
#define POINTSIZE_MASK 0xc
#define POINTSIZE_UNDEFINED 0
#define POINTSIZE_SCALAR 0x4
#define POINTSIZE_ARRAY 0x8
#define PIXELSIZE_WILDCARD 0x10
#define POINTSIZE_WILDCARD 0x20
#define ENHANCEMENT_SPECIFY_MASK 0x40
#define CHARSUBSET_SPECIFIED 0x40
#define EPS 1.0e-20
#define XLFD_NDIGITS 3 /* Round numbers in pixel and
point arrays to this many
digits for repeatability */
typedef struct _FontScalable {
int values_supplied; /* Bitmap identifying what advanced
capabilities or enhancements
were specified in the font name */
double pixel_matrix[4];
double point_matrix[4];
/* Pixel and point fields are deprecated in favor of the
transformation matrices. They are provided and filled in for the
benefit of rasterizers that do not handle the matrices. */
int pixel,
point;
int x,
y,
width;
char *xlfdName;
int nranges;
fsRange *ranges;
} FontScalableRec, *FontScalablePtr;
extern double xlfd_round_double ( double x );
extern Bool FontParseXLFDName ( char *fname, FontScalablePtr vals, int subst );
extern fsRange *FontParseRanges ( char *name, int *nranges );
#define FONT_XLFD_REPLACE_NONE 0
#define FONT_XLFD_REPLACE_STAR 1
#define FONT_XLFD_REPLACE_ZERO 2
#define FONT_XLFD_REPLACE_VALUE 3
#endif /* _FONTXLFD_H_ */
| {
"pile_set_name": "Github"
} |
// Tencent is pleased to support the open source community by making RapidJSON available.
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#ifndef RAPIDJSON_FILEWRITESTREAM_H_
#define RAPIDJSON_FILEWRITESTREAM_H_
#include "stream.h"
#include <cstdio>
#ifdef __clang__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(unreachable-code)
#endif
RAPIDJSON_NAMESPACE_BEGIN
//! Wrapper of C file stream for input using fread().
/*!
\note implements Stream concept
*/
class FileWriteStream {
public:
typedef char Ch; //!< Character type. Only support char.
FileWriteStream(std::FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferEnd_(buffer + bufferSize), current_(buffer_) {
RAPIDJSON_ASSERT(fp_ != 0);
}
void Put(char c) {
if (current_ >= bufferEnd_)
Flush();
*current_++ = c;
}
void PutN(char c, size_t n) {
size_t avail = static_cast<size_t>(bufferEnd_ - current_);
while (n > avail) {
std::memset(current_, c, avail);
current_ += avail;
Flush();
n -= avail;
avail = static_cast<size_t>(bufferEnd_ - current_);
}
if (n > 0) {
std::memset(current_, c, n);
current_ += n;
}
}
void Flush() {
if (current_ != buffer_) {
size_t result = fwrite(buffer_, 1, static_cast<size_t>(current_ - buffer_), fp_);
if (result < static_cast<size_t>(current_ - buffer_)) {
// failure deliberately ignored at this time
// added to avoid warn_unused_result build errors
}
current_ = buffer_;
}
}
// Not implemented
char Peek() const { RAPIDJSON_ASSERT(false); return 0; }
char Take() { RAPIDJSON_ASSERT(false); return 0; }
size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
char* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(char*) { RAPIDJSON_ASSERT(false); return 0; }
private:
// Prohibit copy constructor & assignment operator.
FileWriteStream(const FileWriteStream&);
FileWriteStream& operator=(const FileWriteStream&);
std::FILE* fp_;
char *buffer_;
char *bufferEnd_;
char *current_;
};
//! Implement specialized version of PutN() with memset() for better performance.
template<>
inline void PutN(FileWriteStream& stream, char c, size_t n) {
stream.PutN(c, n);
}
RAPIDJSON_NAMESPACE_END
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_FILESTREAM_H_
| {
"pile_set_name": "Github"
} |
<?php
namespace Illuminate\Tests\Routing;
use Illuminate\Routing\SortedMiddleware;
use PHPUnit\Framework\TestCase;
class RoutingSortedMiddlewareTest extends TestCase
{
public function testMiddlewareCanBeSortedByPriority()
{
$priority = [
'First',
'Second',
'Third',
];
$middleware = [
'Something',
'Something',
'Something',
'Something',
'Second',
'Otherthing',
'First:api',
'Third:foo',
'First:foo,bar',
'Third',
'Second',
];
$expected = [
'Something',
'First:api',
'First:foo,bar',
'Second',
'Otherthing',
'Third:foo',
'Third',
];
$this->assertEquals($expected, (new SortedMiddleware($priority, $middleware))->all());
$this->assertEquals([], (new SortedMiddleware(['First'], []))->all());
$this->assertEquals(['First'], (new SortedMiddleware(['First'], ['First']))->all());
$this->assertEquals(['First', 'Second'], (new SortedMiddleware(['First', 'Second'], ['Second', 'First']))->all());
}
public function testItDoesNotMoveNonStringValues()
{
$closure = function () {
return 'foo';
};
$closure2 = function () {
return 'bar';
};
$this->assertEquals([2, 1], (new SortedMiddleware([1, 2], [2, 1]))->all());
$this->assertEquals(['Second', $closure], (new SortedMiddleware(['First', 'Second'], ['Second', $closure]))->all());
$this->assertEquals(['a', 'b', $closure], (new SortedMiddleware(['a', 'b'], ['b', $closure, 'a']))->all());
$this->assertEquals([$closure2, 'a', 'b', $closure, 'foo'], (new SortedMiddleware(['a', 'b'], [$closure2, 'b', $closure, 'a', 'foo']))->all());
$this->assertEquals([$closure, 'a', 'b', $closure2, 'foo'], (new SortedMiddleware(['a', 'b'], [$closure, 'b', $closure2, 'foo', 'a']))->all());
$this->assertEquals(['a', $closure, 'b', $closure2, 'foo'], (new SortedMiddleware(['a', 'b'], ['a', $closure, 'b', $closure2, 'foo']))->all());
$this->assertEquals([$closure, $closure2, 'foo', 'a'], (new SortedMiddleware(['a', 'b'], [$closure, $closure2, 'foo', 'a']))->all());
}
}
| {
"pile_set_name": "Github"
} |
/*
*
* i2c-mux.h - functions for the i2c-bus mux support
*
* Copyright (c) 2008-2009 Rodolfo Giometti <[email protected]>
* Copyright (c) 2008-2009 Eurotech S.p.A. <[email protected]>
* Michael Lawnick <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/
#ifndef _LINUX_I2C_MUX_H
#define _LINUX_I2C_MUX_H
#ifdef __KERNEL__
#include <linux/bitops.h>
struct i2c_mux_core {
struct i2c_adapter *parent;
struct device *dev;
unsigned int mux_locked:1;
unsigned int arbitrator:1;
unsigned int gate:1;
void *priv;
int (*select)(struct i2c_mux_core *, u32 chan_id);
int (*deselect)(struct i2c_mux_core *, u32 chan_id);
int num_adapters;
int max_adapters;
struct i2c_adapter *adapter[0];
};
struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
struct device *dev, int max_adapters,
int sizeof_priv, u32 flags,
int (*select)(struct i2c_mux_core *, u32),
int (*deselect)(struct i2c_mux_core *, u32));
/* flags for i2c_mux_alloc */
#define I2C_MUX_LOCKED BIT(0)
#define I2C_MUX_ARBITRATOR BIT(1)
#define I2C_MUX_GATE BIT(2)
static inline void *i2c_mux_priv(struct i2c_mux_core *muxc)
{
return muxc->priv;
}
struct i2c_adapter *i2c_root_adapter(struct device *dev);
/*
* Called to create an i2c bus on a multiplexed bus segment.
* The chan_id parameter is passed to the select and deselect
* callback functions to perform hardware-specific mux control.
*/
int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
u32 force_nr, u32 chan_id,
unsigned int class);
void i2c_mux_del_adapters(struct i2c_mux_core *muxc);
#endif /* __KERNEL__ */
#endif /* _LINUX_I2C_MUX_H */
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <iTunesStoreUI/NSObject-Protocol.h>
@class NSError, SSRequest;
@protocol SSRequestDelegate <NSObject>
@optional
- (void)requestDidFinish:(SSRequest *)arg1;
- (void)request:(SSRequest *)arg1 didFailWithError:(NSError *)arg2;
@end
| {
"pile_set_name": "Github"
} |
Error: The number of nodes must be positive and at least 2 in one direction.
Quitting (on error).
| {
"pile_set_name": "Github"
} |
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package serializer
import (
"k8s.io/apimachinery/pkg/runtime"
)
// TODO: We should split negotiated serializers that we can change versions on from those we can change
// serialization formats on
type negotiatedSerializerWrapper struct {
info runtime.SerializerInfo
}
func NegotiatedSerializerWrapper(info runtime.SerializerInfo) runtime.NegotiatedSerializer {
return &negotiatedSerializerWrapper{info}
}
func (n *negotiatedSerializerWrapper) SupportedMediaTypes() []runtime.SerializerInfo {
return []runtime.SerializerInfo{n.info}
}
func (n *negotiatedSerializerWrapper) EncoderForVersion(e runtime.Encoder, _ runtime.GroupVersioner) runtime.Encoder {
return e
}
func (n *negotiatedSerializerWrapper) DecoderToVersion(d runtime.Decoder, _gv runtime.GroupVersioner) runtime.Decoder {
return d
}
| {
"pile_set_name": "Github"
} |
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
*/
#ifndef _RMNET_MAP_H_
#define _RMNET_MAP_H_
#include <linux/if_rmnet.h>
struct rmnet_map_control_command {
u8 command_name;
u8 cmd_type:2;
u8 reserved:6;
u16 reserved2;
u32 transaction_id;
union {
struct {
u16 ip_family:2;
u16 reserved:14;
__be16 flow_control_seq_num;
__be32 qos_id;
} flow_control;
u8 data[0];
};
} __aligned(1);
enum rmnet_map_commands {
RMNET_MAP_COMMAND_NONE,
RMNET_MAP_COMMAND_FLOW_DISABLE,
RMNET_MAP_COMMAND_FLOW_ENABLE,
/* These should always be the last 2 elements */
RMNET_MAP_COMMAND_UNKNOWN,
RMNET_MAP_COMMAND_ENUM_LENGTH
};
#define RMNET_MAP_GET_MUX_ID(Y) (((struct rmnet_map_header *) \
(Y)->data)->mux_id)
#define RMNET_MAP_GET_CD_BIT(Y) (((struct rmnet_map_header *) \
(Y)->data)->cd_bit)
#define RMNET_MAP_GET_PAD(Y) (((struct rmnet_map_header *) \
(Y)->data)->pad_len)
#define RMNET_MAP_GET_CMD_START(Y) ((struct rmnet_map_control_command *) \
((Y)->data + \
sizeof(struct rmnet_map_header)))
#define RMNET_MAP_GET_LENGTH(Y) (ntohs(((struct rmnet_map_header *) \
(Y)->data)->pkt_len))
#define RMNET_MAP_COMMAND_REQUEST 0
#define RMNET_MAP_COMMAND_ACK 1
#define RMNET_MAP_COMMAND_UNSUPPORTED 2
#define RMNET_MAP_COMMAND_INVALID 3
#define RMNET_MAP_NO_PAD_BYTES 0
#define RMNET_MAP_ADD_PAD_BYTES 1
struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,
struct rmnet_port *port);
struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb,
int hdrlen, int pad);
void rmnet_map_command(struct sk_buff *skb, struct rmnet_port *port);
int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len);
void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,
struct net_device *orig_dev);
#endif /* _RMNET_MAP_H_ */
| {
"pile_set_name": "Github"
} |
JWasm is a MASM v6 compatible assembler. It's a fork of Open Watcom's WASM
and released under the Sybase Open Watcom Public License, which allows
free commercial and non-commercial use. JWasm is written in C, source code
is open.
JWasm Features:
- JWasm natively supports output formats Intel OMF, MS Coff (32- and
64-bit), Elf (32- and 64-bit), Bin and DOS MZ.
- precompiled JWasm binaries are available for DOS, Windows and Linux. For
OS/2 and FreeBSD, makefiles are supplied.
- Instructions up to SSSE3 are supported.
- The JWasm source is portable and has successfully been tested with Open
Watcom, MS VC, GCC and more.
- As far as programming for Windows is concerned, JWasm can be used with
both Win32Inc and Masm32.
- C header files can be converted to include files for JWasm with h2incX.
WWW: https://github.com/Baron-von-Riedesel/JWasm
| {
"pile_set_name": "Github"
} |
require 'benchmark'
module ActiveSupport
# See ActiveSupport::Cache::Store for documentation.
module Cache
# Creates a new CacheStore object according to the given options.
#
# If no arguments are passed to this method, then a new
# ActiveSupport::Cache::MemoryStore object will be returned.
#
# If you pass a Symbol as the first argument, then a corresponding cache
# store class under the ActiveSupport::Cache namespace will be created.
# For example:
#
# ActiveSupport::Cache.lookup_store(:memory_store)
# # => returns a new ActiveSupport::Cache::MemoryStore object
#
# ActiveSupport::Cache.lookup_store(:drb_store)
# # => returns a new ActiveSupport::Cache::DRbStore object
#
# Any additional arguments will be passed to the corresponding cache store
# class's constructor:
#
# ActiveSupport::Cache.lookup_store(:file_store, "/tmp/cache")
# # => same as: ActiveSupport::Cache::FileStore.new("/tmp/cache")
#
# If the first argument is not a Symbol, then it will simply be returned:
#
# ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new)
# # => returns MyOwnCacheStore.new
def self.lookup_store(*store_option)
store, *parameters = *([ store_option ].flatten)
case store
when Symbol
store_class_name = (store == :drb_store ? "DRbStore" : store.to_s.camelize)
store_class = ActiveSupport::Cache.const_get(store_class_name)
store_class.new(*parameters)
when nil
ActiveSupport::Cache::MemoryStore.new
else
store
end
end
def self.expand_cache_key(key, namespace = nil)
expanded_cache_key = namespace ? "#{namespace}/" : ""
if ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"]
expanded_cache_key << "#{ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"]}/"
end
expanded_cache_key << case
when key.respond_to?(:cache_key)
key.cache_key
when key.is_a?(Array)
key.collect { |element| expand_cache_key(element) }.to_param
when key
key.to_param
end.to_s
expanded_cache_key
end
# An abstract cache store class. There are multiple cache store
# implementations, each having its own additional features. See the classes
# under the ActiveSupport::Cache module, e.g.
# ActiveSupport::Cache::MemCacheStore. MemCacheStore is currently the most
# popular cache store for large production websites.
#
# ActiveSupport::Cache::Store is meant for caching strings. Some cache
# store implementations, like MemoryStore, are able to cache arbitrary
# Ruby objects, but don't count on every cache store to be able to do that.
#
# cache = ActiveSupport::Cache::MemoryStore.new
#
# cache.read("city") # => nil
# cache.write("city", "Duckburgh")
# cache.read("city") # => "Duckburgh"
class Store
cattr_accessor :logger
def silence!
@silence = true
self
end
# Fetches data from the cache, using the given key. If there is data in
# the cache with the given key, then that data is returned.
#
# If there is no such data in the cache (a cache miss occurred), then
# then nil will be returned. However, if a block has been passed, then
# that block will be run in the event of a cache miss. The return value
# of the block will be written to the cache under the given cache key,
# and that return value will be returned.
#
# cache.write("today", "Monday")
# cache.fetch("today") # => "Monday"
#
# cache.fetch("city") # => nil
# cache.fetch("city") do
# "Duckburgh"
# end
# cache.fetch("city") # => "Duckburgh"
#
# You may also specify additional options via the +options+ argument.
# Setting <tt>:force => true</tt> will force a cache miss:
#
# cache.write("today", "Monday")
# cache.fetch("today", :force => true) # => nil
#
# Other options will be handled by the specific cache store implementation.
# Internally, #fetch calls #read, and calls #write on a cache miss.
# +options+ will be passed to the #read and #write calls.
#
# For example, MemCacheStore's #write method supports the +:expires_in+
# option, which tells the memcached server to automatically expire the
# cache item after a certain period. We can use this option with #fetch
# too:
#
# cache = ActiveSupport::Cache::MemCacheStore.new
# cache.fetch("foo", :force => true, :expires_in => 5.seconds) do
# "bar"
# end
# cache.fetch("foo") # => "bar"
# sleep(6)
# cache.fetch("foo") # => nil
def fetch(key, options = {})
@logger_off = true
if !options[:force] && value = read(key, options)
@logger_off = false
log("hit", key, options)
value
elsif block_given?
@logger_off = false
log("miss", key, options)
value = nil
seconds = Benchmark.realtime { value = yield }
@logger_off = true
write(key, value, options)
@logger_off = false
log("write (will save #{'%.2f' % (seconds * 1000)}ms)", key, nil)
value
end
end
# Fetches data from the cache, using the given key. If there is data in
# the cache with the given key, then that data is returned. Otherwise,
# nil is returned.
#
# You may also specify additional options via the +options+ argument.
# The specific cache store implementation will decide what to do with
# +options+.
def read(key, options = nil)
log("read", key, options)
end
# Writes the given value to the cache, with the given key.
#
# You may also specify additional options via the +options+ argument.
# The specific cache store implementation will decide what to do with
# +options+.
#
# For example, MemCacheStore supports the +:expires_in+ option, which
# tells the memcached server to automatically expire the cache item after
# a certain period:
#
# cache = ActiveSupport::Cache::MemCacheStore.new
# cache.write("foo", "bar", :expires_in => 5.seconds)
# cache.read("foo") # => "bar"
# sleep(6)
# cache.read("foo") # => nil
def write(key, value, options = nil)
log("write", key, options)
end
def delete(key, options = nil)
log("delete", key, options)
end
def delete_matched(matcher, options = nil)
log("delete matched", matcher.inspect, options)
end
def exist?(key, options = nil)
log("exist?", key, options)
end
def increment(key, amount = 1)
log("incrementing", key, amount)
if num = read(key)
write(key, num + amount)
else
nil
end
end
def decrement(key, amount = 1)
log("decrementing", key, amount)
if num = read(key)
write(key, num - amount)
else
nil
end
end
private
def log(operation, key, options)
logger.debug("Cache #{operation}: #{key}#{options ? " (#{options.inspect})" : ""}") if logger && !@silence && !@logger_off
end
end
end
end
require 'active_support/cache/file_store'
require 'active_support/cache/memory_store'
require 'active_support/cache/drb_store'
require 'active_support/cache/mem_cache_store'
require 'active_support/cache/compressed_mem_cache_store'
| {
"pile_set_name": "Github"
} |
"""Ledger base class."""
import re
from abc import ABC, abstractmethod, ABCMeta
from typing import Tuple, Sequence
from ..issuer.base import BaseIssuer
from .endpoint_type import EndpointType
class BaseLedger(ABC, metaclass=ABCMeta):
"""Base class for ledger."""
LEDGER_TYPE = None
async def __aenter__(self) -> "BaseLedger":
"""
Context manager entry.
Returns:
The current instance
"""
return self
async def __aexit__(self, exc_type, exc, tb):
"""Context manager exit."""
@property
@abstractmethod
def type(self) -> str:
"""Accessor for the ledger type."""
@abstractmethod
async def get_key_for_did(self, did: str) -> str:
"""Fetch the verkey for a ledger DID.
Args:
did: The DID to look up on the ledger or in the cache
"""
@abstractmethod
async def get_endpoint_for_did(
self, did: str, endpoint_type: EndpointType = EndpointType.ENDPOINT
) -> str:
"""Fetch the endpoint for a ledger DID.
Args:
did: The DID to look up on the ledger or in the cache
endpoint_type: The type of the endpoint (default 'endpoint')
"""
@abstractmethod
async def update_endpoint_for_did(
self,
did: str,
endpoint: str,
endpoint_type: EndpointType = EndpointType.ENDPOINT,
) -> bool:
"""Check and update the endpoint on the ledger.
Args:
did: The ledger DID
endpoint: The endpoint address
endpoint_type: The type of the endpoint (default 'endpoint')
"""
@abstractmethod
async def register_nym(
self, did: str, verkey: str, alias: str = None, role: str = None
):
"""
Register a nym on the ledger.
Args:
did: DID to register on the ledger.
verkey: The verification key of the keypair.
alias: Human-friendly alias to assign to the DID.
role: For permissioned ledgers, what role should the new DID have.
"""
@abstractmethod
async def get_nym_role(self, did: str):
"""
Return the role registered to input public DID on the ledger.
Args:
did: DID to register on the ledger.
"""
@abstractmethod
def nym_to_did(self, nym: str) -> str:
"""Format a nym with the ledger's DID prefix."""
@abstractmethod
async def rotate_public_did_keypair(self, next_seed: str = None) -> None:
"""
Rotate keypair for public DID: create new key, submit to ledger, update wallet.
Args:
next_seed: seed for incoming ed25519 keypair (default random)
"""
def did_to_nym(self, did: str) -> str:
"""Remove the ledger's DID prefix to produce a nym."""
if did:
return re.sub(r"^did:\w+:", "", did)
async def get_txn_author_agreement(self, reload: bool = False):
"""Get the current transaction author agreement, fetching it if necessary."""
async def fetch_txn_author_agreement(self):
"""Fetch the current AML and TAA from the ledger."""
async def accept_txn_author_agreement(
self, taa_record: dict, mechanism: str, accept_time: int = None
):
"""Save a new record recording the acceptance of the TAA."""
async def get_latest_txn_author_acceptance(self):
"""Look up the latest TAA acceptance."""
def taa_digest(self, version: str, text: str):
"""Generate the digest of a TAA record."""
@abstractmethod
async def create_and_send_schema(
self,
issuer: BaseIssuer,
schema_name: str,
schema_version: str,
attribute_names: Sequence[str],
) -> Tuple[str, dict]:
"""
Send schema to ledger.
Args:
issuer: The issuer instance to use for schema creation
schema_name: The schema name
schema_version: The schema version
attribute_names: A list of schema attributes
"""
@abstractmethod
async def get_revoc_reg_def(self, revoc_reg_id: str) -> dict:
"""Look up a revocation registry definition by ID."""
@abstractmethod
async def send_revoc_reg_def(self, revoc_reg_def: dict, issuer_did: str = None):
"""Publish a revocation registry definition to the ledger."""
@abstractmethod
async def send_revoc_reg_entry(
self,
revoc_reg_id: str,
revoc_def_type: str,
revoc_reg_entry: dict,
issuer_did: str = None,
):
"""Publish a revocation registry entry to the ledger."""
@abstractmethod
async def create_and_send_credential_definition(
self,
issuer: BaseIssuer,
schema_id: str,
signature_type: str = None,
tag: str = None,
support_revocation: bool = False,
) -> Tuple[str, dict, bool]:
"""
Send credential definition to ledger and store relevant key matter in wallet.
Args:
issuer: The issuer instance to use for credential definition creation
schema_id: The schema id of the schema to create cred def for
signature_type: The signature type to use on the credential definition
tag: Optional tag to distinguish multiple credential definitions
support_revocation: Optional flag to enable revocation for this cred def
Returns:
Tuple with cred def id, cred def structure, and whether it's novel
"""
@abstractmethod
async def get_credential_definition(self, credential_definition_id: str) -> dict:
"""
Get a credential definition from the cache if available, otherwise the ledger.
Args:
credential_definition_id: The schema id of the schema to fetch cred def for
"""
@abstractmethod
async def get_revoc_reg_delta(
self, revoc_reg_id: str, timestamp_from=0, timestamp_to=None
) -> (dict, int):
"""Look up a revocation registry delta by ID."""
@abstractmethod
async def get_schema(self, schema_id: str) -> dict:
"""
Get a schema from the cache if available, otherwise fetch from the ledger.
Args:
schema_id: The schema id (or stringified sequence number) to retrieve
"""
@abstractmethod
async def get_revoc_reg_entry(self, revoc_reg_id: str, timestamp: int):
"""Get revocation registry entry by revocation registry ID and timestamp."""
| {
"pile_set_name": "Github"
} |
/**
* Copyright (C) 2011 Angelo Zerr <[email protected]>, Pascal Leclercq <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package fr.opensagres.xdocreport.examples.old.registry;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import fr.opensagres.xdocreport.core.XDocReportException;
import fr.opensagres.xdocreport.document.IXDocReport;
import fr.opensagres.xdocreport.document.debug.SysOutDebugger;
import fr.opensagres.xdocreport.document.odt.ODTReport;
import fr.opensagres.xdocreport.document.registry.XDocReportRegistry;
import fr.opensagres.xdocreport.examples.old.model.Command;
import fr.opensagres.xdocreport.examples.old.model.Project;
import fr.opensagres.xdocreport.template.IContext;
public class TestWithRegistry {
public static void main(String[] args) {
try {
// Set debugger
XDocReportRegistry.getRegistry().setDebugger(
SysOutDebugger.INSTANCE);
// Load ODT file and cache it to the registry
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(
TestWithRegistry.class
.getResourceAsStream("TestWithRegistry.odt"));
// Here report id was updated. You can set the id with
// XDocReportRegistry.getRegistry().loadReport(stream, id)
if (report instanceof ODTReport) {
System.out.println("ODT report");
} else {
System.out.println("Argh! C'est pas un ODT");
}
// Generate report
generate(report, 1);
// Retrieve report from the registry
String id = report.getId();
IXDocReport report2 = XDocReportRegistry.getRegistry()
.getReport(id);
if (report != null && report.equals(report2)) {
System.out.println("Report retrouv� dans le registry ");
} else {
System.out.println("Argh! Le registry ne marche pas");
}
// Generate a second report generation. See log to check that
// performance report generation are improved.
generate(report, 2);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XDocReportException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static void generate(IXDocReport report2, int i)
throws XDocReportException, IOException, FileNotFoundException {
IContext context = report2.createContext();
Project project = new Project("XDocReport_" + i);
context.put("project", project);
context.put("adresse_magasin", "yessssssssssss");
List<Command> commands = new ArrayList<Command>();
commands.add(new Command("ref1_" + i));
commands.add(new Command("ref2_" + i));
context.put("lines", commands);
File outFolder = new File("out");
if (!outFolder.exists())
outFolder.mkdir();
File file = new File(outFolder, "TestWithRegistry" + i + "_Out.odt");
report2.process(context, new FileOutputStream(file));
}
}
| {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
from detectron2.modeling import ROI_HEADS_REGISTRY, StandardROIHeads
from detectron2.modeling.poolers import ROIPooler
from detectron2.modeling.roi_heads import select_foreground_proposals
from .densepose_head import (
build_densepose_data_filter,
build_densepose_head,
build_densepose_losses,
build_densepose_predictor,
densepose_inference,
)
@ROI_HEADS_REGISTRY.register()
class DensePoseROIHeads(StandardROIHeads):
"""
A Standard ROIHeads which contains an addition of DensePose head.
"""
def __init__(self, cfg, input_shape):
super().__init__(cfg, input_shape)
self._init_densepose_head(cfg)
def _init_densepose_head(self, cfg):
# fmt: off
self.densepose_on = cfg.MODEL.DENSEPOSE_ON
if not self.densepose_on:
return
self.densepose_data_filter = build_densepose_data_filter(cfg)
dp_pooler_resolution = cfg.MODEL.ROI_DENSEPOSE_HEAD.POOLER_RESOLUTION
dp_pooler_scales = tuple(1.0 / self.feature_strides[k] for k in self.in_features)
dp_pooler_sampling_ratio = cfg.MODEL.ROI_DENSEPOSE_HEAD.POOLER_SAMPLING_RATIO
dp_pooler_type = cfg.MODEL.ROI_DENSEPOSE_HEAD.POOLER_TYPE
# fmt: on
in_channels = [self.feature_channels[f] for f in self.in_features][0]
self.densepose_pooler = ROIPooler(
output_size=dp_pooler_resolution,
scales=dp_pooler_scales,
sampling_ratio=dp_pooler_sampling_ratio,
pooler_type=dp_pooler_type,
)
self.densepose_head = build_densepose_head(cfg, in_channels)
self.densepose_predictor = build_densepose_predictor(
cfg, self.densepose_head.n_out_channels
)
self.densepose_losses = build_densepose_losses(cfg)
def _forward_densepose(self, features, instances):
"""
Forward logic of the densepose prediction branch.
Args:
features (list[Tensor]): #level input features for densepose prediction
instances (list[Instances]): the per-image instances to train/predict densepose.
In training, they can be the proposals.
In inference, they can be the predicted boxes.
Returns:
In training, a dict of losses.
In inference, update `instances` with new fields "densepose" and return it.
"""
if not self.densepose_on:
return {} if self.training else instances
if self.training:
proposals, _ = select_foreground_proposals(instances, self.num_classes)
proposals_dp = self.densepose_data_filter(proposals)
if len(proposals_dp) > 0:
proposal_boxes = [x.proposal_boxes for x in proposals_dp]
features_dp = self.densepose_pooler(features, proposal_boxes)
densepose_head_outputs = self.densepose_head(features_dp)
densepose_outputs, _ = self.densepose_predictor(densepose_head_outputs)
densepose_loss_dict = self.densepose_losses(proposals_dp, densepose_outputs)
return densepose_loss_dict
else:
pred_boxes = [x.pred_boxes for x in instances]
features_dp = self.densepose_pooler(features, pred_boxes)
if len(features_dp) > 0:
densepose_head_outputs = self.densepose_head(features_dp)
densepose_outputs, _ = self.densepose_predictor(densepose_head_outputs)
else:
# If no detection occurred instances
# set densepose_outputs to empty tensors
empty_tensor = torch.zeros(size=(0, 0, 0, 0), device=features_dp.device)
densepose_outputs = tuple([empty_tensor] * 4)
densepose_inference(densepose_outputs, instances)
return instances
def forward(self, images, features, proposals, targets=None):
features_list = [features[f] for f in self.in_features]
instances, losses = super().forward(images, features, proposals, targets)
del targets, images
if self.training:
losses.update(self._forward_densepose(features_list, instances))
else:
instances = self._forward_densepose(features_list, instances)
return instances, losses
| {
"pile_set_name": "Github"
} |
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.IO
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Public Class StatementSyntaxWalkerTests
<Fact>
Public Sub TestStatementSyntaxWalker()
Dim tree = ParseAndVerify(<![CDATA[
Option Explicit Off
Imports System
<Assembly: CLSCompliant(False)>
Namespace Foo.Bar
Public Class Class1
Dim x As Integer
Public Function f(ByVal a As Boolean) As Integer
Dim r = 1, s = 4
Try
If a Then r = 4 Else r = 3 : s = f(True)
If a Then
r = 17 : s = 45
s = r + 1
Else
r = 25
End If
Catch e As Exception
Throw e
Finally
Console.WriteLine("finally!")
End Try
Select Case r
Case 4
Console.WriteLine("f")
Case Else
Return 4 + s
End Select
While r < s
r = r + 1
s = s - 1
End While
Return s
End Function
End Class
End Namespace
]]>)
Dim writer As New StringWriter()
Dim myWalker = New TestWalker(writer)
myWalker.Visit(tree.GetRoot())
Dim expected = <![CDATA[
Option Explicit Off
Imports System
<Assembly: CLSCompliant(False)>
Namespace Foo.Bar
Public Class Class1
Dim x As Integer
Public Function f(ByVal a As Boolean) As Integer
Dim r = 1, s = 4
Try
r = 4
r = 3
s = f(True)
If a Then
r = 17
s = 45
s = r + 1
Else
r = 25
End If
Catch e As Exception
Throw e
Finally
Console.WriteLine("finally!")
End Try
Select Case r
Case 4
Console.WriteLine("f")
Case Else
Return 4 + s
End Select
While r < s
r = r + 1
s = s - 1
End While
Return s
End Function
End Class
End Namespace
]]>.Value
expected = expected.Replace(vbLf, vbCrLf).Trim()
Dim actual = writer.ToString().Trim()
Assert.Equal(expected, actual)
End Sub
Friend Class TestWalker
Inherits StatementSyntaxWalker
Dim arg As TextWriter
Public Sub New(arg As TextWriter)
Me.arg = arg
End Sub
Public Overrides Sub DefaultVisit(node As SyntaxNode)
If TypeOf node Is StatementSyntax Then
arg.WriteLine(node.ToString())
End If
MyBase.DefaultVisit(node)
End Sub
End Class
End Class
| {
"pile_set_name": "Github"
} |
import { NAME_REGEX } from "../constants";
export default {
name: "correct-casing",
isObjectRule: false,
message: 'script name "{{name}}" must be camel case',
validate: (key: string) => NAME_REGEX.test(key),
};
| {
"pile_set_name": "Github"
} |
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAwRrWvzL0zR9OFg1ipRU+Pvd9v+WN4ILKxU2jxlutvZOevsyx
flzRNOQImejpdXEtA/yZTKNYOdU+dMdPDdSsMPFzRgzQfiJDKqJw4jB+SF2XROuZ
EYMjxoJtueAGnw1DO9tgzn40NtHrPJNKadrYljEF+zycNLcPf78GK/ug+5rK5Mkp
NVmxO4yjqxk5ZB3KD4Gol3RaheVKYmTfjNIAO0wk8O2NbvG/JxOPTpDSaElgpfdy
3Bxv4JJpjgNKrHEUYUqkwlqmrinTw8MSfKJq0MJ8nIx8HRojrYrf6Jh8zDpPYuql
UygcwSz0sQEY6UceaupQmlvDT9QLLVBm6aOibQIDAQABAoIBACeo73oNaSHH0C3P
SfdFyab9BaKn7t+xfRvQulY+9gv9iZj+SWX+gikuvGV/5JLuT6SF+KY41iHqng01
8hKRH1xd+qLkdt2xA8J54l1SQF10e2D4UlO6b1qR5x9J15JLEwf0IonGecrYikvC
pIHhJKKUJvpWlG5vOouuHAJkh8ekwz17cEle6IOPY+p9hiivk80npUzbdybnHK26
pNGPICich8sUWNaiSUia/TCwIDzU4NkNhsOxoV/QZOTOFnHl4lR81dSeptdVusPg
JdC0+VCMc8wGgXdDqWxPzDdT7CIGNZcqpltBEe/27QPVYxckK3kDkOFRXshD5lPv
56USHrECgYEA9pB5ChHu9JqkedN8QgUfipl/doAOz80vghG0gi+wvkeD/XrzXaES
rXlkGJFKbPkTGhemSzBPQNEbpQa8Y+h+GfKLHux+Kd7pWRym4vXojxeJyaCCG73i
d2qtoHi5QeZOY36AJT7bq3T1ZKHG157vEXRghth+ozpzb1w+KeO1ZNcCgYEAyH6j
FpowWYdsPljqx+7SfoPdes/LGtfIWnGRM12C6H2Lb9FX6l1yIMNJQgYhyRPSbifL
uArj/Jf9LskaaRYHvjXbtBANHHU92kBZszMj3x437otADwL9iWsV/cyIDkei5QTl
fP//M5RSZj2WyRQJ8hXTA7Ya5e3rGJYlHQ1aRlsCgYBJMK2dXaFvHpCAUVTrTBYG
0HXTuUOsT54woAzTMFDoytXVYq/nNS8UK5qY6FgNbQpMjoSggSClfu0T2aIGjjcQ
gLznWxBAYZknCKhJavGzuCsAnRLCJWWaSSJtJijn9POD+UMUy0nt5XQKgTNDQjx5
E/CrVoyQ64LkpZ8WVC++VQKBgQCLUMu8cem03FAPxrNluAKWHMTyiJ8mCNjUV+PA
YHMNX+dbDIlddg9OysQF18L0OQzYtFhvi0m+hFJOhzkN2lwJBN2kch7aLnGLTXnG
9nsvl4zf+ezKQZaxPTLrx4qm+YosP0nDoRLQ4XicSKGVGZKLoDSfeJOaP8dDr1kc
peGbzwKBgQC3Tz57NVbIDa3SdMlpgV5iUj+AQ4Q4OLxAWzePttic1+nalQyFLMBI
dq4HytJEen/CK/XwelHpMfMv/t2bZcqags+Epm9Qhd7jLMaFsmrscmdjXdp41kRR
KOjZHBUuhK7HfeBLJ7oLGDlXHvtfwC59DRLipYrtJLG4Etkcjfav8Q==
-----END RSA PRIVATE KEY-----
| {
"pile_set_name": "Github"
} |
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.
**Environment (please complete the following information):**
- OS: [e.g. Linux]
- Version [e.g. Ubuntu 16.04]
- PySwarms Version [e.g. v.0.2.0]
- Python Version [e.g. 3.6.X]
**Additional context**
Add any other context about the problem here.
| {
"pile_set_name": "Github"
} |
//! moment-timezone.js
//! version : 0.5.13
//! Copyright (c) JS Foundation and other contributors
//! license : MIT
//! github.com/moment/moment-timezone
(function (root, factory) {
"use strict";
/*global define*/
if (typeof define === 'function' && define.amd) {
define(['moment'], factory); // AMD
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('moment')); // Node
} else {
factory(root.moment); // Browser
}
}(this, function (moment) {
"use strict";
// Do not load moment-timezone a second time.
// if (moment.tz !== undefined) {
// logError('Moment Timezone ' + moment.tz.version + ' was already loaded ' + (moment.tz.dataVersion ? 'with data from ' : 'without any data') + moment.tz.dataVersion);
// return moment;
// }
var VERSION = "0.5.13",
zones = {},
links = {},
names = {},
guesses = {},
cachedGuess,
momentVersion = moment.version.split('.'),
major = +momentVersion[0],
minor = +momentVersion[1];
// Moment.js version check
if (major < 2 || (major === 2 && minor < 6)) {
logError('Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js ' + moment.version + '. See momentjs.com');
}
/************************************
Unpacking
************************************/
function charCodeToInt(charCode) {
if (charCode > 96) {
return charCode - 87;
} else if (charCode > 64) {
return charCode - 29;
}
return charCode - 48;
}
function unpackBase60(string) {
var i = 0,
parts = string.split('.'),
whole = parts[0],
fractional = parts[1] || '',
multiplier = 1,
num,
out = 0,
sign = 1;
// handle negative numbers
if (string.charCodeAt(0) === 45) {
i = 1;
sign = -1;
}
// handle digits before the decimal
for (i; i < whole.length; i++) {
num = charCodeToInt(whole.charCodeAt(i));
out = 60 * out + num;
}
// handle digits after the decimal
for (i = 0; i < fractional.length; i++) {
multiplier = multiplier / 60;
num = charCodeToInt(fractional.charCodeAt(i));
out += num * multiplier;
}
return out * sign;
}
function arrayToInt (array) {
for (var i = 0; i < array.length; i++) {
array[i] = unpackBase60(array[i]);
}
}
function intToUntil (array, length) {
for (var i = 0; i < length; i++) {
array[i] = Math.round((array[i - 1] || 0) + (array[i] * 60000)); // minutes to milliseconds
}
array[length - 1] = Infinity;
}
function mapIndices (source, indices) {
var out = [], i;
for (i = 0; i < indices.length; i++) {
out[i] = source[indices[i]];
}
return out;
}
function unpack (string) {
var data = string.split('|'),
offsets = data[2].split(' '),
indices = data[3].split(''),
untils = data[4].split(' ');
arrayToInt(offsets);
arrayToInt(indices);
arrayToInt(untils);
intToUntil(untils, indices.length);
return {
name : data[0],
abbrs : mapIndices(data[1].split(' '), indices),
offsets : mapIndices(offsets, indices),
untils : untils,
population : data[5] | 0
};
}
/************************************
Zone object
************************************/
function Zone (packedString) {
if (packedString) {
this._set(unpack(packedString));
}
}
Zone.prototype = {
_set : function (unpacked) {
this.name = unpacked.name;
this.abbrs = unpacked.abbrs;
this.untils = unpacked.untils;
this.offsets = unpacked.offsets;
this.population = unpacked.population;
},
_index : function (timestamp) {
var target = +timestamp,
untils = this.untils,
i;
for (i = 0; i < untils.length; i++) {
if (target < untils[i]) {
return i;
}
}
},
parse : function (timestamp) {
var target = +timestamp,
offsets = this.offsets,
untils = this.untils,
max = untils.length - 1,
offset, offsetNext, offsetPrev, i;
for (i = 0; i < max; i++) {
offset = offsets[i];
offsetNext = offsets[i + 1];
offsetPrev = offsets[i ? i - 1 : i];
if (offset < offsetNext && tz.moveAmbiguousForward) {
offset = offsetNext;
} else if (offset > offsetPrev && tz.moveInvalidForward) {
offset = offsetPrev;
}
if (target < untils[i] - (offset * 60000)) {
return offsets[i];
}
}
return offsets[max];
},
abbr : function (mom) {
return this.abbrs[this._index(mom)];
},
offset : function (mom) {
return this.offsets[this._index(mom)];
}
};
/************************************
Current Timezone
************************************/
function OffsetAt(at) {
var timeString = at.toTimeString();
var abbr = timeString.match(/\([a-z ]+\)/i);
if (abbr && abbr[0]) {
// 17:56:31 GMT-0600 (CST)
// 17:56:31 GMT-0600 (Central Standard Time)
abbr = abbr[0].match(/[A-Z]/g);
abbr = abbr ? abbr.join('') : undefined;
} else {
// 17:56:31 CST
// 17:56:31 GMT+0800 (台北標準時間)
abbr = timeString.match(/[A-Z]{3,5}/g);
abbr = abbr ? abbr[0] : undefined;
}
if (abbr === 'GMT') {
abbr = undefined;
}
this.at = +at;
this.abbr = abbr;
this.offset = at.getTimezoneOffset();
}
function ZoneScore(zone) {
this.zone = zone;
this.offsetScore = 0;
this.abbrScore = 0;
}
ZoneScore.prototype.scoreOffsetAt = function (offsetAt) {
this.offsetScore += Math.abs(this.zone.offset(offsetAt.at) - offsetAt.offset);
if (this.zone.abbr(offsetAt.at).replace(/[^A-Z]/g, '') !== offsetAt.abbr) {
this.abbrScore++;
}
};
function findChange(low, high) {
var mid, diff;
while ((diff = ((high.at - low.at) / 12e4 | 0) * 6e4)) {
mid = new OffsetAt(new Date(low.at + diff));
if (mid.offset === low.offset) {
low = mid;
} else {
high = mid;
}
}
return low;
}
function userOffsets() {
var startYear = new Date().getFullYear() - 2,
last = new OffsetAt(new Date(startYear, 0, 1)),
offsets = [last],
change, next, i;
for (i = 1; i < 48; i++) {
next = new OffsetAt(new Date(startYear, i, 1));
if (next.offset !== last.offset) {
change = findChange(last, next);
offsets.push(change);
offsets.push(new OffsetAt(new Date(change.at + 6e4)));
}
last = next;
}
for (i = 0; i < 4; i++) {
offsets.push(new OffsetAt(new Date(startYear + i, 0, 1)));
offsets.push(new OffsetAt(new Date(startYear + i, 6, 1)));
}
return offsets;
}
function sortZoneScores (a, b) {
if (a.offsetScore !== b.offsetScore) {
return a.offsetScore - b.offsetScore;
}
if (a.abbrScore !== b.abbrScore) {
return a.abbrScore - b.abbrScore;
}
return b.zone.population - a.zone.population;
}
function addToGuesses (name, offsets) {
var i, offset;
arrayToInt(offsets);
for (i = 0; i < offsets.length; i++) {
offset = offsets[i];
guesses[offset] = guesses[offset] || {};
guesses[offset][name] = true;
}
}
function guessesForUserOffsets (offsets) {
var offsetsLength = offsets.length,
filteredGuesses = {},
out = [],
i, j, guessesOffset;
for (i = 0; i < offsetsLength; i++) {
guessesOffset = guesses[offsets[i].offset] || {};
for (j in guessesOffset) {
if (guessesOffset.hasOwnProperty(j)) {
filteredGuesses[j] = true;
}
}
}
for (i in filteredGuesses) {
if (filteredGuesses.hasOwnProperty(i)) {
out.push(names[i]);
}
}
return out;
}
function rebuildGuess () {
// use Intl API when available and returning valid time zone
try {
var intlName = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (intlName){
var name = names[normalizeName(intlName)];
if (name) {
return name;
}
logError("Moment Timezone found " + intlName + " from the Intl api, but did not have that data loaded.");
}
} catch (e) {
// Intl unavailable, fall back to manual guessing.
}
var offsets = userOffsets(),
offsetsLength = offsets.length,
guesses = guessesForUserOffsets(offsets),
zoneScores = [],
zoneScore, i, j;
for (i = 0; i < guesses.length; i++) {
zoneScore = new ZoneScore(getZone(guesses[i]), offsetsLength);
for (j = 0; j < offsetsLength; j++) {
zoneScore.scoreOffsetAt(offsets[j]);
}
zoneScores.push(zoneScore);
}
zoneScores.sort(sortZoneScores);
return zoneScores.length > 0 ? zoneScores[0].zone.name : undefined;
}
function guess (ignoreCache) {
if (!cachedGuess || ignoreCache) {
cachedGuess = rebuildGuess();
}
return cachedGuess;
}
/************************************
Global Methods
************************************/
function normalizeName (name) {
return (name || '').toLowerCase().replace(/\//g, '_');
}
function addZone (packed) {
var i, name, split, normalized;
if (typeof packed === "string") {
packed = [packed];
}
for (i = 0; i < packed.length; i++) {
split = packed[i].split('|');
name = split[0];
normalized = normalizeName(name);
zones[normalized] = packed[i];
names[normalized] = name;
if (split[5]) {
addToGuesses(normalized, split[2].split(' '));
}
}
}
function getZone (name, caller) {
name = normalizeName(name);
var zone = zones[name];
var link;
if (zone instanceof Zone) {
return zone;
}
if (typeof zone === 'string') {
zone = new Zone(zone);
zones[name] = zone;
return zone;
}
// Pass getZone to prevent recursion more than 1 level deep
if (links[name] && caller !== getZone && (link = getZone(links[name], getZone))) {
zone = zones[name] = new Zone();
zone._set(link);
zone.name = names[name];
return zone;
}
return null;
}
function getNames () {
var i, out = [];
for (i in names) {
if (names.hasOwnProperty(i) && (zones[i] || zones[links[i]]) && names[i]) {
out.push(names[i]);
}
}
return out.sort();
}
function addLink (aliases) {
var i, alias, normal0, normal1;
if (typeof aliases === "string") {
aliases = [aliases];
}
for (i = 0; i < aliases.length; i++) {
alias = aliases[i].split('|');
normal0 = normalizeName(alias[0]);
normal1 = normalizeName(alias[1]);
links[normal0] = normal1;
names[normal0] = alias[0];
links[normal1] = normal0;
names[normal1] = alias[1];
}
}
function loadData (data) {
addZone(data.zones);
addLink(data.links);
tz.dataVersion = data.version;
}
function zoneExists (name) {
if (!zoneExists.didShowError) {
zoneExists.didShowError = true;
logError("moment.tz.zoneExists('" + name + "') has been deprecated in favor of !moment.tz.zone('" + name + "')");
}
return !!getZone(name);
}
function needsOffset (m) {
return !!(m._a && (m._tzm === undefined));
}
function logError (message) {
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
}
/************************************
moment.tz namespace
************************************/
function tz (input) {
var args = Array.prototype.slice.call(arguments, 0, -1),
name = arguments[arguments.length - 1],
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
tz.version = VERSION;
tz.dataVersion = '';
tz._zones = zones;
tz._links = links;
tz._names = names;
tz.add = addZone;
tz.link = addLink;
tz.load = loadData;
tz.zone = getZone;
tz.zoneExists = zoneExists; // deprecated in 0.1.0
tz.guess = guess;
tz.names = getNames;
tz.Zone = Zone;
tz.unpack = unpack;
tz.unpackBase60 = unpackBase60;
tz.needsOffset = needsOffset;
tz.moveInvalidForward = true;
tz.moveAmbiguousForward = false;
/************************************
Interface with Moment.js
************************************/
var fn = moment.fn;
moment.tz = tz;
moment.defaultZone = null;
moment.updateOffset = function (mom, keepTime) {
var zone = moment.defaultZone,
offset;
if (mom._z === undefined) {
if (zone && needsOffset(mom) && !mom._isUTC) {
mom._d = moment.utc(mom._a)._d;
mom.utc().add(zone.parse(mom), 'minutes');
}
mom._z = zone;
}
if (mom._z) {
offset = mom._z.offset(mom);
if (Math.abs(offset) < 16) {
offset = offset / 60;
}
if (mom.utcOffset !== undefined) {
mom.utcOffset(-offset, keepTime);
} else {
mom.zone(offset, keepTime);
}
}
};
fn.tz = function (name) {
if (name) {
this._z = getZone(name);
if (this._z) {
moment.updateOffset(this);
} else {
logError("Moment Timezone has no data for " + name + ". See http://momentjs.com/timezone/docs/#/data-loading/.");
}
return this;
}
if (this._z) { return this._z.name; }
};
function abbrWrap (old) {
return function () {
if (this._z) { return this._z.abbr(this); }
return old.call(this);
};
}
function resetZoneWrap (old) {
return function () {
this._z = null;
return old.apply(this, arguments);
};
}
fn.zoneName = abbrWrap(fn.zoneName);
fn.zoneAbbr = abbrWrap(fn.zoneAbbr);
fn.utc = resetZoneWrap(fn.utc);
moment.tz.setDefault = function(name) {
if (major < 2 || (major === 2 && minor < 9)) {
logError('Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js ' + moment.version + '.');
}
moment.defaultZone = name ? getZone(name) : null;
return moment;
};
// Cloning a moment should include the _z property.
var momentProperties = moment.momentProperties;
if (Object.prototype.toString.call(momentProperties) === '[object Array]') {
// moment 2.8.1+
momentProperties.push('_z');
momentProperties.push('_a');
} else if (momentProperties) {
// moment 2.7.0
momentProperties._z = null;
}
loadData({
"version": "2017b",
"zones": [
"Africa/Abidjan|GMT|0|0||48e5",
"Africa/Khartoum|EAT|-30|0||51e5",
"Africa/Algiers|CET|-10|0||26e5",
"Africa/Lagos|WAT|-10|0||17e6",
"Africa/Maputo|CAT|-20|0||26e5",
"Africa/Cairo|EET EEST|-20 -30|01010|1M2m0 gL0 e10 mn0|15e6",
"Africa/Casablanca|WET WEST|0 -10|0101010101010101010101010101010101010101010|1H3C0 wM0 co0 go0 1o00 s00 dA0 vc0 11A0 A00 e00 y00 11A0 uM0 e00 Dc0 11A0 s00 e00 IM0 WM0 mo0 gM0 LA0 WM0 jA0 e00 Rc0 11A0 e00 e00 U00 11A0 8o0 e00 11A0 11A0 5A0 e00 17c0 1fA0 1a00|32e5",
"Europe/Paris|CET CEST|-10 -20|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|11e6",
"Africa/Johannesburg|SAST|-20|0||84e5",
"Africa/Tripoli|EET CET CEST|-20 -10 -20|0120|1IlA0 TA0 1o00|11e5",
"Africa/Windhoek|WAST WAT|-20 -10|01010101010101010101010|1GQo0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0|32e4",
"America/Adak|HST HDT|a0 90|01010101010101010101010|1GIc0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|326",
"America/Anchorage|AKST AKDT|90 80|01010101010101010101010|1GIb0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|30e4",
"America/Santo_Domingo|AST|40|0||29e5",
"America/Araguaina|-03 -02|30 20|010|1IdD0 Lz0|14e4",
"America/Fortaleza|-03|30|0||34e5",
"America/Asuncion|-03 -04|30 40|01010101010101010101010|1GTf0 1cN0 17b0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0|28e5",
"America/Panama|EST|50|0||15e5",
"America/Bahia|-02 -03|20 30|01|1GCq0|27e5",
"America/Mexico_City|CST CDT|60 50|01010101010101010101010|1GQw0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0|20e6",
"America/Managua|CST|60|0||22e5",
"America/La_Paz|-04|40|0||19e5",
"America/Lima|-05|50|0||11e6",
"America/Denver|MST MDT|70 60|01010101010101010101010|1GI90 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|26e5",
"America/Campo_Grande|-03 -04|30 40|01010101010101010101010|1GCr0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1C10 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0|77e4",
"America/Cancun|CST CDT EST|60 50 50|01010102|1GQw0 1nX0 14p0 1lb0 14p0 1lb0 Dd0|63e4",
"America/Caracas|-0430 -04|4u 40|01|1QMT0|29e5",
"America/Chicago|CST CDT|60 50|01010101010101010101010|1GI80 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|92e5",
"America/Chihuahua|MST MDT|70 60|01010101010101010101010|1GQx0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0|81e4",
"America/Phoenix|MST|70|0||42e5",
"America/Los_Angeles|PST PDT|80 70|01010101010101010101010|1GIa0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|15e6",
"America/New_York|EST EDT|50 40|01010101010101010101010|1GI70 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|21e6",
"America/Rio_Branco|-04 -05|40 50|01|1KLE0|31e4",
"America/Fort_Nelson|PST PDT MST|80 70 70|01010102|1GIa0 1zb0 Op0 1zb0 Op0 1zb0 Op0|39e2",
"America/Halifax|AST ADT|40 30|01010101010101010101010|1GI60 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|39e4",
"America/Godthab|-03 -02|30 20|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|17e3",
"America/Grand_Turk|EST EDT AST|50 40 40|010101012|1GI70 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|37e2",
"America/Havana|CST CDT|50 40|01010101010101010101010|1GQt0 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0|21e5",
"America/Metlakatla|PST AKST AKDT|80 90 80|0121212121212121|1PAa0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|14e2",
"America/Miquelon|-03 -02|30 20|01010101010101010101010|1GI50 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|61e2",
"America/Montevideo|-02 -03|20 30|01010101|1GI40 1o10 11z0 1o10 11z0 1o10 11z0|17e5",
"America/Noronha|-02|20|0||30e2",
"America/Port-au-Prince|EST EDT|50 40|010101010101010101010|1GI70 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 3iN0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|23e5",
"Antarctica/Palmer|-03 -04|30 40|010101010|1H3D0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0|40",
"America/Santiago|-03 -04|30 40|010101010101010101010|1H3D0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1Nb0 Dd0 1Nb0 Ap0|62e5",
"America/Sao_Paulo|-02 -03|20 30|01010101010101010101010|1GCq0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1C10 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0|20e6",
"Atlantic/Azores|-01 +00|10 0|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|25e4",
"America/St_Johns|NST NDT|3u 2u|01010101010101010101010|1GI5u 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|11e4",
"Antarctica/Casey|+11 +08|-b0 -80|010|1GAF0 blz0|10",
"Antarctica/Davis|+05 +07|-50 -70|01|1GAI0|70",
"Pacific/Port_Moresby|+10|-a0|0||25e4",
"Pacific/Guadalcanal|+11|-b0|0||11e4",
"Asia/Tashkent|+05|-50|0||23e5",
"Pacific/Auckland|NZDT NZST|-d0 -c0|01010101010101010101010|1GQe0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00|14e5",
"Asia/Baghdad|+03|-30|0||66e5",
"Antarctica/Troll|+00 +02|0 -20|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|40",
"Asia/Dhaka|+06|-60|0||16e6",
"Asia/Amman|EET EEST|-20 -30|010101010101010101010|1GPy0 4bX0 Dd0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00|25e5",
"Asia/Kamchatka|+12|-c0|0||18e4",
"Asia/Baku|+04 +05|-40 -50|010101010|1GNA0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00|27e5",
"Asia/Bangkok|+07|-70|0||15e6",
"Asia/Barnaul|+07 +06|-70 -60|010|1N7v0 3rd0",
"Asia/Beirut|EET EEST|-20 -30|01010101010101010101010|1GNy0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0|22e5",
"Asia/Manila|+08|-80|0||24e6",
"Asia/Kolkata|IST|-5u|0||15e6",
"Asia/Chita|+10 +08 +09|-a0 -80 -90|012|1N7s0 3re0|33e4",
"Asia/Ulaanbaatar|+08 +09|-80 -90|01010|1O8G0 1cJ0 1cP0 1cJ0|12e5",
"Asia/Shanghai|CST|-80|0||23e6",
"Asia/Colombo|+0530|-5u|0||22e5",
"Asia/Damascus|EET EEST|-20 -30|01010101010101010101010|1GPy0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0|26e5",
"Asia/Dili|+09|-90|0||19e4",
"Asia/Dubai|+04|-40|0||39e5",
"Asia/Famagusta|EET EEST +03|-20 -30 -30|01010101012|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 15U0",
"Asia/Gaza|EET EEST|-20 -30|01010101010101010101010|1GPy0 1a00 1fA0 1cL0 1cN0 1nX0 1210 1nz0 1220 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0|18e5",
"Asia/Hong_Kong|HKT|-80|0||73e5",
"Asia/Hovd|+07 +08|-70 -80|01010|1O8H0 1cJ0 1cP0 1cJ0|81e3",
"Asia/Irkutsk|+09 +08|-90 -80|01|1N7t0|60e4",
"Europe/Istanbul|EET EEST +03|-20 -30 -30|01010101012|1GNB0 1qM0 11A0 1o00 1200 1nA0 11A0 1tA0 U00 15w0|13e6",
"Asia/Jakarta|WIB|-70|0||31e6",
"Asia/Jayapura|WIT|-90|0||26e4",
"Asia/Jerusalem|IST IDT|-20 -30|01010101010101010101010|1GPA0 1aL0 1eN0 1oL0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0|81e4",
"Asia/Kabul|+0430|-4u|0||46e5",
"Asia/Karachi|PKT|-50|0||24e6",
"Asia/Kathmandu|+0545|-5J|0||12e5",
"Asia/Yakutsk|+10 +09|-a0 -90|01|1N7s0|28e4",
"Asia/Krasnoyarsk|+08 +07|-80 -70|01|1N7u0|10e5",
"Asia/Magadan|+12 +10 +11|-c0 -a0 -b0|012|1N7q0 3Cq0|95e3",
"Asia/Makassar|WITA|-80|0||15e5",
"Europe/Athens|EET EEST|-20 -30|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|35e5",
"Asia/Novosibirsk|+07 +06|-70 -60|010|1N7v0 4eN0|15e5",
"Asia/Omsk|+07 +06|-70 -60|01|1N7v0|12e5",
"Asia/Pyongyang|KST KST|-90 -8u|01|1P4D0|29e5",
"Asia/Rangoon|+0630|-6u|0||48e5",
"Asia/Sakhalin|+11 +10|-b0 -a0|010|1N7r0 3rd0|58e4",
"Asia/Seoul|KST|-90|0||23e6",
"Asia/Srednekolymsk|+12 +11|-c0 -b0|01|1N7q0|35e2",
"Asia/Tehran|+0330 +0430|-3u -4u|01010101010101010101010|1GLUu 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0|14e6",
"Asia/Tokyo|JST|-90|0||38e6",
"Asia/Tomsk|+07 +06|-70 -60|010|1N7v0 3Qp0|10e5",
"Asia/Vladivostok|+11 +10|-b0 -a0|01|1N7r0|60e4",
"Asia/Yekaterinburg|+06 +05|-60 -50|01|1N7w0|14e5",
"Europe/Lisbon|WET WEST|0 -10|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|27e5",
"Atlantic/Cape_Verde|-01|10|0||50e4",
"Australia/Sydney|AEDT AEST|-b0 -a0|01010101010101010101010|1GQg0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0|40e5",
"Australia/Adelaide|ACDT ACST|-au -9u|01010101010101010101010|1GQgu 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0|11e5",
"Australia/Brisbane|AEST|-a0|0||20e5",
"Australia/Darwin|ACST|-9u|0||12e4",
"Australia/Eucla|+0845|-8J|0||368",
"Australia/Lord_Howe|+11 +1030|-b0 -au|01010101010101010101010|1GQf0 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu|347",
"Australia/Perth|AWST|-80|0||18e5",
"Pacific/Easter|-05 -06|50 60|010101010101010101010|1H3D0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1Nb0 Dd0 1Nb0 Ap0|30e2",
"Europe/Dublin|GMT IST|0 -10|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|12e5",
"Pacific/Tahiti|-10|a0|0||18e4",
"Pacific/Niue|-11|b0|0||12e2",
"Etc/GMT+12|-12|c0|0|",
"Pacific/Galapagos|-06|60|0||25e3",
"Etc/GMT+7|-07|70|0|",
"Pacific/Pitcairn|-08|80|0||56",
"Pacific/Gambier|-09|90|0||125",
"Etc/GMT-1|+01|-10|0|",
"Pacific/Fakaofo|+13|-d0|0||483",
"Pacific/Kiritimati|+14|-e0|0||51e2",
"Etc/GMT-2|+02|-20|0|",
"Etc/UCT|UCT|0|0|",
"Etc/UTC|UTC|0|0|",
"Europe/Astrakhan|+04 +03|-40 -30|010|1N7y0 3rd0",
"Europe/London|GMT BST|0 -10|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|10e6",
"Europe/Chisinau|EET EEST|-20 -30|01010101010101010101010|1GNA0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|67e4",
"Europe/Kaliningrad|+03 EET|-30 -20|01|1N7z0|44e4",
"Europe/Volgograd|+04 +03|-40 -30|01|1N7y0|10e5",
"Europe/Moscow|MSK MSK|-40 -30|01|1N7y0|16e6",
"Europe/Saratov|+04 +03|-40 -30|010|1N7y0 5810",
"Europe/Simferopol|EET EEST MSK MSK|-20 -30 -40 -30|0101023|1GNB0 1qM0 11A0 1o00 11z0 1nW0|33e4",
"Pacific/Honolulu|HST|a0|0||37e4",
"MET|MET MEST|-10 -20|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0",
"Pacific/Chatham|+1345 +1245|-dJ -cJ|01010101010101010101010|1GQe0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00|600",
"Pacific/Apia|+14 +13|-e0 -d0|01010101010101010101010|1GQe0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00|37e3",
"Pacific/Bougainville|+10 +11|-a0 -b0|01|1NwE0|18e4",
"Pacific/Fiji|+13 +12|-d0 -c0|01010101010101010101010|1Goe0 1Nc0 Ao0 1Q00 xz0 1SN0 uM0 1SM0 uM0 1VA0 s00 1VA0 uM0 1SM0 uM0 1SM0 uM0 1SM0 uM0 1VA0 s00 1VA0|88e4",
"Pacific/Guam|ChST|-a0|0||17e4",
"Pacific/Marquesas|-0930|9u|0||86e2",
"Pacific/Pago_Pago|SST|b0|0||37e2",
"Pacific/Norfolk|+1130 +11|-bu -b0|01|1PoCu|25e4",
"Pacific/Tongatapu|+13 +14|-d0 -e0|01010101010101|1S4d0 s00 1VA0 uM0 1SM0 uM0 1SM0 uM0 1SM0 uM0 1VA0 s00 1VA0|75e3"
],
"links": [
"Africa/Abidjan|Africa/Accra",
"Africa/Abidjan|Africa/Bamako",
"Africa/Abidjan|Africa/Banjul",
"Africa/Abidjan|Africa/Bissau",
"Africa/Abidjan|Africa/Conakry",
"Africa/Abidjan|Africa/Dakar",
"Africa/Abidjan|Africa/Freetown",
"Africa/Abidjan|Africa/Lome",
"Africa/Abidjan|Africa/Monrovia",
"Africa/Abidjan|Africa/Nouakchott",
"Africa/Abidjan|Africa/Ouagadougou",
"Africa/Abidjan|Africa/Sao_Tome",
"Africa/Abidjan|Africa/Timbuktu",
"Africa/Abidjan|America/Danmarkshavn",
"Africa/Abidjan|Atlantic/Reykjavik",
"Africa/Abidjan|Atlantic/St_Helena",
"Africa/Abidjan|Etc/GMT",
"Africa/Abidjan|Etc/GMT+0",
"Africa/Abidjan|Etc/GMT-0",
"Africa/Abidjan|Etc/GMT0",
"Africa/Abidjan|Etc/Greenwich",
"Africa/Abidjan|GMT",
"Africa/Abidjan|GMT+0",
"Africa/Abidjan|GMT-0",
"Africa/Abidjan|GMT0",
"Africa/Abidjan|Greenwich",
"Africa/Abidjan|Iceland",
"Africa/Algiers|Africa/Tunis",
"Africa/Cairo|Egypt",
"Africa/Casablanca|Africa/El_Aaiun",
"Africa/Johannesburg|Africa/Maseru",
"Africa/Johannesburg|Africa/Mbabane",
"Africa/Khartoum|Africa/Addis_Ababa",
"Africa/Khartoum|Africa/Asmara",
"Africa/Khartoum|Africa/Asmera",
"Africa/Khartoum|Africa/Dar_es_Salaam",
"Africa/Khartoum|Africa/Djibouti",
"Africa/Khartoum|Africa/Juba",
"Africa/Khartoum|Africa/Kampala",
"Africa/Khartoum|Africa/Mogadishu",
"Africa/Khartoum|Africa/Nairobi",
"Africa/Khartoum|Indian/Antananarivo",
"Africa/Khartoum|Indian/Comoro",
"Africa/Khartoum|Indian/Mayotte",
"Africa/Lagos|Africa/Bangui",
"Africa/Lagos|Africa/Brazzaville",
"Africa/Lagos|Africa/Douala",
"Africa/Lagos|Africa/Kinshasa",
"Africa/Lagos|Africa/Libreville",
"Africa/Lagos|Africa/Luanda",
"Africa/Lagos|Africa/Malabo",
"Africa/Lagos|Africa/Ndjamena",
"Africa/Lagos|Africa/Niamey",
"Africa/Lagos|Africa/Porto-Novo",
"Africa/Maputo|Africa/Blantyre",
"Africa/Maputo|Africa/Bujumbura",
"Africa/Maputo|Africa/Gaborone",
"Africa/Maputo|Africa/Harare",
"Africa/Maputo|Africa/Kigali",
"Africa/Maputo|Africa/Lubumbashi",
"Africa/Maputo|Africa/Lusaka",
"Africa/Tripoli|Libya",
"America/Adak|America/Atka",
"America/Adak|US/Aleutian",
"America/Anchorage|America/Juneau",
"America/Anchorage|America/Nome",
"America/Anchorage|America/Sitka",
"America/Anchorage|America/Yakutat",
"America/Anchorage|US/Alaska",
"America/Campo_Grande|America/Cuiaba",
"America/Chicago|America/Indiana/Knox",
"America/Chicago|America/Indiana/Tell_City",
"America/Chicago|America/Knox_IN",
"America/Chicago|America/Matamoros",
"America/Chicago|America/Menominee",
"America/Chicago|America/North_Dakota/Beulah",
"America/Chicago|America/North_Dakota/Center",
"America/Chicago|America/North_Dakota/New_Salem",
"America/Chicago|America/Rainy_River",
"America/Chicago|America/Rankin_Inlet",
"America/Chicago|America/Resolute",
"America/Chicago|America/Winnipeg",
"America/Chicago|CST6CDT",
"America/Chicago|Canada/Central",
"America/Chicago|US/Central",
"America/Chicago|US/Indiana-Starke",
"America/Chihuahua|America/Mazatlan",
"America/Chihuahua|Mexico/BajaSur",
"America/Denver|America/Boise",
"America/Denver|America/Cambridge_Bay",
"America/Denver|America/Edmonton",
"America/Denver|America/Inuvik",
"America/Denver|America/Ojinaga",
"America/Denver|America/Shiprock",
"America/Denver|America/Yellowknife",
"America/Denver|Canada/Mountain",
"America/Denver|MST7MDT",
"America/Denver|Navajo",
"America/Denver|US/Mountain",
"America/Fortaleza|America/Argentina/Buenos_Aires",
"America/Fortaleza|America/Argentina/Catamarca",
"America/Fortaleza|America/Argentina/ComodRivadavia",
"America/Fortaleza|America/Argentina/Cordoba",
"America/Fortaleza|America/Argentina/Jujuy",
"America/Fortaleza|America/Argentina/La_Rioja",
"America/Fortaleza|America/Argentina/Mendoza",
"America/Fortaleza|America/Argentina/Rio_Gallegos",
"America/Fortaleza|America/Argentina/Salta",
"America/Fortaleza|America/Argentina/San_Juan",
"America/Fortaleza|America/Argentina/San_Luis",
"America/Fortaleza|America/Argentina/Tucuman",
"America/Fortaleza|America/Argentina/Ushuaia",
"America/Fortaleza|America/Belem",
"America/Fortaleza|America/Buenos_Aires",
"America/Fortaleza|America/Catamarca",
"America/Fortaleza|America/Cayenne",
"America/Fortaleza|America/Cordoba",
"America/Fortaleza|America/Jujuy",
"America/Fortaleza|America/Maceio",
"America/Fortaleza|America/Mendoza",
"America/Fortaleza|America/Paramaribo",
"America/Fortaleza|America/Recife",
"America/Fortaleza|America/Rosario",
"America/Fortaleza|America/Santarem",
"America/Fortaleza|Antarctica/Rothera",
"America/Fortaleza|Atlantic/Stanley",
"America/Fortaleza|Etc/GMT+3",
"America/Halifax|America/Glace_Bay",
"America/Halifax|America/Goose_Bay",
"America/Halifax|America/Moncton",
"America/Halifax|America/Thule",
"America/Halifax|Atlantic/Bermuda",
"America/Halifax|Canada/Atlantic",
"America/Havana|Cuba",
"America/La_Paz|America/Boa_Vista",
"America/La_Paz|America/Guyana",
"America/La_Paz|America/Manaus",
"America/La_Paz|America/Porto_Velho",
"America/La_Paz|Brazil/West",
"America/La_Paz|Etc/GMT+4",
"America/Lima|America/Bogota",
"America/Lima|America/Guayaquil",
"America/Lima|Etc/GMT+5",
"America/Los_Angeles|America/Dawson",
"America/Los_Angeles|America/Ensenada",
"America/Los_Angeles|America/Santa_Isabel",
"America/Los_Angeles|America/Tijuana",
"America/Los_Angeles|America/Vancouver",
"America/Los_Angeles|America/Whitehorse",
"America/Los_Angeles|Canada/Pacific",
"America/Los_Angeles|Canada/Yukon",
"America/Los_Angeles|Mexico/BajaNorte",
"America/Los_Angeles|PST8PDT",
"America/Los_Angeles|US/Pacific",
"America/Los_Angeles|US/Pacific-New",
"America/Managua|America/Belize",
"America/Managua|America/Costa_Rica",
"America/Managua|America/El_Salvador",
"America/Managua|America/Guatemala",
"America/Managua|America/Regina",
"America/Managua|America/Swift_Current",
"America/Managua|America/Tegucigalpa",
"America/Managua|Canada/East-Saskatchewan",
"America/Managua|Canada/Saskatchewan",
"America/Mexico_City|America/Bahia_Banderas",
"America/Mexico_City|America/Merida",
"America/Mexico_City|America/Monterrey",
"America/Mexico_City|Mexico/General",
"America/New_York|America/Detroit",
"America/New_York|America/Fort_Wayne",
"America/New_York|America/Indiana/Indianapolis",
"America/New_York|America/Indiana/Marengo",
"America/New_York|America/Indiana/Petersburg",
"America/New_York|America/Indiana/Vevay",
"America/New_York|America/Indiana/Vincennes",
"America/New_York|America/Indiana/Winamac",
"America/New_York|America/Indianapolis",
"America/New_York|America/Iqaluit",
"America/New_York|America/Kentucky/Louisville",
"America/New_York|America/Kentucky/Monticello",
"America/New_York|America/Louisville",
"America/New_York|America/Montreal",
"America/New_York|America/Nassau",
"America/New_York|America/Nipigon",
"America/New_York|America/Pangnirtung",
"America/New_York|America/Thunder_Bay",
"America/New_York|America/Toronto",
"America/New_York|Canada/Eastern",
"America/New_York|EST5EDT",
"America/New_York|US/East-Indiana",
"America/New_York|US/Eastern",
"America/New_York|US/Michigan",
"America/Noronha|Atlantic/South_Georgia",
"America/Noronha|Brazil/DeNoronha",
"America/Noronha|Etc/GMT+2",
"America/Panama|America/Atikokan",
"America/Panama|America/Cayman",
"America/Panama|America/Coral_Harbour",
"America/Panama|America/Jamaica",
"America/Panama|EST",
"America/Panama|Jamaica",
"America/Phoenix|America/Creston",
"America/Phoenix|America/Dawson_Creek",
"America/Phoenix|America/Hermosillo",
"America/Phoenix|MST",
"America/Phoenix|US/Arizona",
"America/Rio_Branco|America/Eirunepe",
"America/Rio_Branco|America/Porto_Acre",
"America/Rio_Branco|Brazil/Acre",
"America/Santiago|Chile/Continental",
"America/Santo_Domingo|America/Anguilla",
"America/Santo_Domingo|America/Antigua",
"America/Santo_Domingo|America/Aruba",
"America/Santo_Domingo|America/Barbados",
"America/Santo_Domingo|America/Blanc-Sablon",
"America/Santo_Domingo|America/Curacao",
"America/Santo_Domingo|America/Dominica",
"America/Santo_Domingo|America/Grenada",
"America/Santo_Domingo|America/Guadeloupe",
"America/Santo_Domingo|America/Kralendijk",
"America/Santo_Domingo|America/Lower_Princes",
"America/Santo_Domingo|America/Marigot",
"America/Santo_Domingo|America/Martinique",
"America/Santo_Domingo|America/Montserrat",
"America/Santo_Domingo|America/Port_of_Spain",
"America/Santo_Domingo|America/Puerto_Rico",
"America/Santo_Domingo|America/St_Barthelemy",
"America/Santo_Domingo|America/St_Kitts",
"America/Santo_Domingo|America/St_Lucia",
"America/Santo_Domingo|America/St_Thomas",
"America/Santo_Domingo|America/St_Vincent",
"America/Santo_Domingo|America/Tortola",
"America/Santo_Domingo|America/Virgin",
"America/Sao_Paulo|Brazil/East",
"America/St_Johns|Canada/Newfoundland",
"Antarctica/Palmer|America/Punta_Arenas",
"Asia/Baghdad|Antarctica/Syowa",
"Asia/Baghdad|Asia/Aden",
"Asia/Baghdad|Asia/Bahrain",
"Asia/Baghdad|Asia/Kuwait",
"Asia/Baghdad|Asia/Qatar",
"Asia/Baghdad|Asia/Riyadh",
"Asia/Baghdad|Etc/GMT-3",
"Asia/Baghdad|Europe/Minsk",
"Asia/Bangkok|Asia/Ho_Chi_Minh",
"Asia/Bangkok|Asia/Novokuznetsk",
"Asia/Bangkok|Asia/Phnom_Penh",
"Asia/Bangkok|Asia/Saigon",
"Asia/Bangkok|Asia/Vientiane",
"Asia/Bangkok|Etc/GMT-7",
"Asia/Bangkok|Indian/Christmas",
"Asia/Dhaka|Antarctica/Vostok",
"Asia/Dhaka|Asia/Almaty",
"Asia/Dhaka|Asia/Bishkek",
"Asia/Dhaka|Asia/Dacca",
"Asia/Dhaka|Asia/Kashgar",
"Asia/Dhaka|Asia/Qyzylorda",
"Asia/Dhaka|Asia/Thimbu",
"Asia/Dhaka|Asia/Thimphu",
"Asia/Dhaka|Asia/Urumqi",
"Asia/Dhaka|Etc/GMT-6",
"Asia/Dhaka|Indian/Chagos",
"Asia/Dili|Etc/GMT-9",
"Asia/Dili|Pacific/Palau",
"Asia/Dubai|Asia/Muscat",
"Asia/Dubai|Asia/Tbilisi",
"Asia/Dubai|Asia/Yerevan",
"Asia/Dubai|Etc/GMT-4",
"Asia/Dubai|Europe/Samara",
"Asia/Dubai|Indian/Mahe",
"Asia/Dubai|Indian/Mauritius",
"Asia/Dubai|Indian/Reunion",
"Asia/Gaza|Asia/Hebron",
"Asia/Hong_Kong|Hongkong",
"Asia/Jakarta|Asia/Pontianak",
"Asia/Jerusalem|Asia/Tel_Aviv",
"Asia/Jerusalem|Israel",
"Asia/Kamchatka|Asia/Anadyr",
"Asia/Kamchatka|Etc/GMT-12",
"Asia/Kamchatka|Kwajalein",
"Asia/Kamchatka|Pacific/Funafuti",
"Asia/Kamchatka|Pacific/Kwajalein",
"Asia/Kamchatka|Pacific/Majuro",
"Asia/Kamchatka|Pacific/Nauru",
"Asia/Kamchatka|Pacific/Tarawa",
"Asia/Kamchatka|Pacific/Wake",
"Asia/Kamchatka|Pacific/Wallis",
"Asia/Kathmandu|Asia/Katmandu",
"Asia/Kolkata|Asia/Calcutta",
"Asia/Makassar|Asia/Ujung_Pandang",
"Asia/Manila|Asia/Brunei",
"Asia/Manila|Asia/Kuala_Lumpur",
"Asia/Manila|Asia/Kuching",
"Asia/Manila|Asia/Singapore",
"Asia/Manila|Etc/GMT-8",
"Asia/Manila|Singapore",
"Asia/Rangoon|Asia/Yangon",
"Asia/Rangoon|Indian/Cocos",
"Asia/Seoul|ROK",
"Asia/Shanghai|Asia/Chongqing",
"Asia/Shanghai|Asia/Chungking",
"Asia/Shanghai|Asia/Harbin",
"Asia/Shanghai|Asia/Macao",
"Asia/Shanghai|Asia/Macau",
"Asia/Shanghai|Asia/Taipei",
"Asia/Shanghai|PRC",
"Asia/Shanghai|ROC",
"Asia/Tashkent|Antarctica/Mawson",
"Asia/Tashkent|Asia/Aqtau",
"Asia/Tashkent|Asia/Aqtobe",
"Asia/Tashkent|Asia/Ashgabat",
"Asia/Tashkent|Asia/Ashkhabad",
"Asia/Tashkent|Asia/Atyrau",
"Asia/Tashkent|Asia/Dushanbe",
"Asia/Tashkent|Asia/Oral",
"Asia/Tashkent|Asia/Samarkand",
"Asia/Tashkent|Etc/GMT-5",
"Asia/Tashkent|Indian/Kerguelen",
"Asia/Tashkent|Indian/Maldives",
"Asia/Tehran|Iran",
"Asia/Tokyo|Japan",
"Asia/Ulaanbaatar|Asia/Choibalsan",
"Asia/Ulaanbaatar|Asia/Ulan_Bator",
"Asia/Vladivostok|Asia/Ust-Nera",
"Asia/Yakutsk|Asia/Khandyga",
"Atlantic/Azores|America/Scoresbysund",
"Atlantic/Cape_Verde|Etc/GMT+1",
"Australia/Adelaide|Australia/Broken_Hill",
"Australia/Adelaide|Australia/South",
"Australia/Adelaide|Australia/Yancowinna",
"Australia/Brisbane|Australia/Lindeman",
"Australia/Brisbane|Australia/Queensland",
"Australia/Darwin|Australia/North",
"Australia/Lord_Howe|Australia/LHI",
"Australia/Perth|Australia/West",
"Australia/Sydney|Australia/ACT",
"Australia/Sydney|Australia/Canberra",
"Australia/Sydney|Australia/Currie",
"Australia/Sydney|Australia/Hobart",
"Australia/Sydney|Australia/Melbourne",
"Australia/Sydney|Australia/NSW",
"Australia/Sydney|Australia/Tasmania",
"Australia/Sydney|Australia/Victoria",
"Etc/UCT|UCT",
"Etc/UTC|Etc/Universal",
"Etc/UTC|Etc/Zulu",
"Etc/UTC|UTC",
"Etc/UTC|Universal",
"Etc/UTC|Zulu",
"Europe/Astrakhan|Europe/Ulyanovsk",
"Europe/Athens|Asia/Nicosia",
"Europe/Athens|EET",
"Europe/Athens|Europe/Bucharest",
"Europe/Athens|Europe/Helsinki",
"Europe/Athens|Europe/Kiev",
"Europe/Athens|Europe/Mariehamn",
"Europe/Athens|Europe/Nicosia",
"Europe/Athens|Europe/Riga",
"Europe/Athens|Europe/Sofia",
"Europe/Athens|Europe/Tallinn",
"Europe/Athens|Europe/Uzhgorod",
"Europe/Athens|Europe/Vilnius",
"Europe/Athens|Europe/Zaporozhye",
"Europe/Chisinau|Europe/Tiraspol",
"Europe/Dublin|Eire",
"Europe/Istanbul|Asia/Istanbul",
"Europe/Istanbul|Turkey",
"Europe/Lisbon|Atlantic/Canary",
"Europe/Lisbon|Atlantic/Faeroe",
"Europe/Lisbon|Atlantic/Faroe",
"Europe/Lisbon|Atlantic/Madeira",
"Europe/Lisbon|Portugal",
"Europe/Lisbon|WET",
"Europe/London|Europe/Belfast",
"Europe/London|Europe/Guernsey",
"Europe/London|Europe/Isle_of_Man",
"Europe/London|Europe/Jersey",
"Europe/London|GB",
"Europe/London|GB-Eire",
"Europe/Moscow|W-SU",
"Europe/Paris|Africa/Ceuta",
"Europe/Paris|Arctic/Longyearbyen",
"Europe/Paris|Atlantic/Jan_Mayen",
"Europe/Paris|CET",
"Europe/Paris|Europe/Amsterdam",
"Europe/Paris|Europe/Andorra",
"Europe/Paris|Europe/Belgrade",
"Europe/Paris|Europe/Berlin",
"Europe/Paris|Europe/Bratislava",
"Europe/Paris|Europe/Brussels",
"Europe/Paris|Europe/Budapest",
"Europe/Paris|Europe/Busingen",
"Europe/Paris|Europe/Copenhagen",
"Europe/Paris|Europe/Gibraltar",
"Europe/Paris|Europe/Ljubljana",
"Europe/Paris|Europe/Luxembourg",
"Europe/Paris|Europe/Madrid",
"Europe/Paris|Europe/Malta",
"Europe/Paris|Europe/Monaco",
"Europe/Paris|Europe/Oslo",
"Europe/Paris|Europe/Podgorica",
"Europe/Paris|Europe/Prague",
"Europe/Paris|Europe/Rome",
"Europe/Paris|Europe/San_Marino",
"Europe/Paris|Europe/Sarajevo",
"Europe/Paris|Europe/Skopje",
"Europe/Paris|Europe/Stockholm",
"Europe/Paris|Europe/Tirane",
"Europe/Paris|Europe/Vaduz",
"Europe/Paris|Europe/Vatican",
"Europe/Paris|Europe/Vienna",
"Europe/Paris|Europe/Warsaw",
"Europe/Paris|Europe/Zagreb",
"Europe/Paris|Europe/Zurich",
"Europe/Paris|Poland",
"Europe/Volgograd|Europe/Kirov",
"Pacific/Auckland|Antarctica/McMurdo",
"Pacific/Auckland|Antarctica/South_Pole",
"Pacific/Auckland|NZ",
"Pacific/Chatham|NZ-CHAT",
"Pacific/Easter|Chile/EasterIsland",
"Pacific/Fakaofo|Etc/GMT-13",
"Pacific/Fakaofo|Pacific/Enderbury",
"Pacific/Galapagos|Etc/GMT+6",
"Pacific/Gambier|Etc/GMT+9",
"Pacific/Guadalcanal|Antarctica/Macquarie",
"Pacific/Guadalcanal|Etc/GMT-11",
"Pacific/Guadalcanal|Pacific/Efate",
"Pacific/Guadalcanal|Pacific/Kosrae",
"Pacific/Guadalcanal|Pacific/Noumea",
"Pacific/Guadalcanal|Pacific/Pohnpei",
"Pacific/Guadalcanal|Pacific/Ponape",
"Pacific/Guam|Pacific/Saipan",
"Pacific/Honolulu|HST",
"Pacific/Honolulu|Pacific/Johnston",
"Pacific/Honolulu|US/Hawaii",
"Pacific/Kiritimati|Etc/GMT-14",
"Pacific/Niue|Etc/GMT+11",
"Pacific/Pago_Pago|Pacific/Midway",
"Pacific/Pago_Pago|Pacific/Samoa",
"Pacific/Pago_Pago|US/Samoa",
"Pacific/Pitcairn|Etc/GMT+8",
"Pacific/Port_Moresby|Antarctica/DumontDUrville",
"Pacific/Port_Moresby|Etc/GMT-10",
"Pacific/Port_Moresby|Pacific/Chuuk",
"Pacific/Port_Moresby|Pacific/Truk",
"Pacific/Port_Moresby|Pacific/Yap",
"Pacific/Tahiti|Etc/GMT+10",
"Pacific/Tahiti|Pacific/Rarotonga"
]
});
return moment;
}));
| {
"pile_set_name": "Github"
} |
# Copyright 2019, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import time
from opencensus.ext.azure import metrics_exporter
from opencensus.stats import aggregation as aggregation_module
from opencensus.stats import measure as measure_module
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
stats = stats_module.stats
view_manager = stats.view_manager
stats_recorder = stats.stats_recorder
CARROTS_MEASURE = measure_module.MeasureInt("carrots",
"number of carrots",
"carrots")
CARROTS_VIEW = view_module.View("carrots_view",
"number of carrots",
[],
CARROTS_MEASURE,
aggregation_module.CountAggregation())
def main():
# Enable metrics
# Set the interval in seconds in which you want to send metrics
# TODO: you need to specify the instrumentation key in a connection string
# and place it in the APPLICATIONINSIGHTS_CONNECTION_STRING
# environment variable.
exporter = metrics_exporter.new_metrics_exporter()
view_manager.register_exporter(exporter)
view_manager.register_view(CARROTS_VIEW)
mmap = stats_recorder.new_measurement_map()
tmap = tag_map_module.TagMap()
mmap.measure_int_put(CARROTS_MEASURE, 1000)
mmap.record(tmap)
time.sleep(60)
print("Done recording metrics")
if __name__ == "__main__":
main()
| {
"pile_set_name": "Github"
} |
{
"name": "lifecycle_unittest_app",
"display_name": "Lifecycle Unittest App",
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
"lifecycle_unittest:lifecycle_control": [
"service_manager::test::mojom::LifecycleControl"
]
}
}
}
}
| {
"pile_set_name": "Github"
} |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v3.proto.resources import ad_group_feed_pb2 as google_dot_ads_dot_googleads__v3_dot_proto_dot_resources_dot_ad__group__feed__pb2
from google.ads.google_ads.v3.proto.services import ad_group_feed_service_pb2 as google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_ad__group__feed__service__pb2
class AdGroupFeedServiceStub(object):
"""Proto file describing the AdGroupFeed service.
Service to manage ad group feeds.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetAdGroupFeed = channel.unary_unary(
'/google.ads.googleads.v3.services.AdGroupFeedService/GetAdGroupFeed',
request_serializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_ad__group__feed__service__pb2.GetAdGroupFeedRequest.SerializeToString,
response_deserializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_resources_dot_ad__group__feed__pb2.AdGroupFeed.FromString,
)
self.MutateAdGroupFeeds = channel.unary_unary(
'/google.ads.googleads.v3.services.AdGroupFeedService/MutateAdGroupFeeds',
request_serializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_ad__group__feed__service__pb2.MutateAdGroupFeedsRequest.SerializeToString,
response_deserializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_ad__group__feed__service__pb2.MutateAdGroupFeedsResponse.FromString,
)
class AdGroupFeedServiceServicer(object):
"""Proto file describing the AdGroupFeed service.
Service to manage ad group feeds.
"""
def GetAdGroupFeed(self, request, context):
"""Returns the requested ad group feed in full detail.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def MutateAdGroupFeeds(self, request, context):
"""Creates, updates, or removes ad group feeds. Operation statuses are
returned.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_AdGroupFeedServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetAdGroupFeed': grpc.unary_unary_rpc_method_handler(
servicer.GetAdGroupFeed,
request_deserializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_ad__group__feed__service__pb2.GetAdGroupFeedRequest.FromString,
response_serializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_resources_dot_ad__group__feed__pb2.AdGroupFeed.SerializeToString,
),
'MutateAdGroupFeeds': grpc.unary_unary_rpc_method_handler(
servicer.MutateAdGroupFeeds,
request_deserializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_ad__group__feed__service__pb2.MutateAdGroupFeedsRequest.FromString,
response_serializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_ad__group__feed__service__pb2.MutateAdGroupFeedsResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'google.ads.googleads.v3.services.AdGroupFeedService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
| {
"pile_set_name": "Github"
} |
# https://docs.codecov.io/docs/codecov-yaml
# https://github.com/codecov/support/wiki/Codecov-Yaml
coverage:
status:
project:
default: false
patch:
default: false
ignore:
- "**/Mocks/*"
fixes:
- "build/src/::src/"
comment:
layout: "diff"
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<TRAPS>
<TRAP trap_type="ACTION"
trap_name="SERVICE_EXCEPTION_TRAP_ACTION"
name="serviceError" CATEGORY="serviceError"/>
<TRAP trap_type="ACTION"
trap_name="ENGINE_STARTUP_EXCEPTION_TRAP_ACTION"
name="startupError" CATEGORY="startupError"/>
<TRAP trap_type="ACTION"
trap_name="DRAW_MAP_SERVICE_EXCEPTION_TRAP_ACTION"
name="drawMapServiceError" CATEGORY="drawMapServiceError"/>
</TRAPS> | {
"pile_set_name": "Github"
} |
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* https://opensso.dev.java.net/public/CDDLv1.0.html or
* opensso/legal/CDDLv1.0.txt
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: DefaultValues.java,v 1.3 2008/06/25 05:44:03 qcheng Exp $
*
*/
package com.sun.identity.sm;
import java.util.Map;
import java.util.Set;
import org.w3c.dom.Node;
/**
* The abstract class <code>DefaultValues</code> provides a mechanism for
* services to obtain their default values dynamically instead of being
* statically defined in the service XML file stored in the directory.
* <p>
* An implementation of this class must be specified in the service
* configuration XML file in the definition of the respective attribute schema.
* Instead of providing the default values in the XML configuration file, the
* class name must be specified within the XML node
* <code>DefaultValuesClassName</code>.
*
* @supported.all.api
*/
public abstract class DefaultValues {
/**
* Abstract method that must be implemented by a class extending this
* interface, and should return the default values for the attribute.
*
* @return defaults values for the attribute as a <code>java.util.Set</code>
*/
public abstract Set getDefaultValues();
/**
* Returns a Set of default values for the attribute, given the environment
* parameters. The default implementation calls the interface
* <code>getDefaultValues()</code> which takes no parameters. The class
* extending this class can override this method to take advantage of the
* additional environment parameters.
*
* @return defaults values for the attribute as a <code>java.util.Set</code>
*/
public Set getDefaultValues(Map envParams) {
return (getDefaultValues());
}
/**
* Returns the name of the attribute for which the default values will be
* returned.
*
* @return the name of attribute for which the default values are returned
*/
public final String getAttributeName() {
return (attributeSchema.getName());
}
/**
* Returns the configured key-value pairs for the class in the service's
* configuration file
*
* @return key-value pairs configured for this class in the service schema
* XML file
*/
public final Map getConfiguredKeyValues() {
return (keyValues);
}
/**
* Returns the XML <code>AttributeSchema</code> node associated with this
* attribute
*
* @return XML node of <code>AttributeSchema</code>
*/
public final Node getAttributeSchemaNode() {
return (parentNode);
}
/**
* Set the <code>AttributeSchema</code> for which the default values are
* being obtained
*/
final void setAttributeSchema(AttributeSchemaImpl as) {
attributeSchema = as;
}
/**
* Sets the key-values pairs configured for this object
*/
final void setKeyValues(Node node) {
keyValues = CreateServiceConfig.getAttributeValuePairs(node);
}
/**
* Sets the <code>AttributeSchema</code> node of the XML schema
*/
final void setParentNode(Node n) {
parentNode = n;
}
// Pointer to AttributeSchema, key-value pairs and parent node
AttributeSchemaImpl attributeSchema;
Map keyValues;
Node parentNode;
}
| {
"pile_set_name": "Github"
} |
for(x in range [1,10)) {Fuck();}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.dev.resource.impl.testdata.cpe1.com.google.gwt.user.client;
/**
* Classes for testing resource infrastructure.
*/
public class Timer {
// test class
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>Bird_01</string>
<string>Bird_02</string>
<string>Bird_03</string>
<string>Bird_04</string>
<string>Bird_05</string>
<string>Bird_06</string>
<string>Bird_07</string>
<string>Bird_08</string>
<string>Bird_09</string>
<string>Bird_10</string>
<string>Bird_11</string>
<string>Bird_12</string>
<string>Bird_13</string>
<string>Bird_14</string>
<string>Bird_15</string>
<string>Bird_16</string>
<string>Bird_17</string>
<string>Bird_18</string>
<string>Bird_01</string>
<string>Bird_02</string>
<string>Bird_03</string>
<string>Bird_04</string>
<string>Bird_05</string>
<string>Bird_06</string>
<string>Bird_07</string>
<string>Bird_08</string>
<string>Bird_09</string>
<string>Bird_10</string>
<string>Bird_11</string>
<string>Bird_12</string>
<string>Bird_13</string>
<string>Bird_14</string>
<string>Bird_15</string>
<string>Bird_16</string>
<string>Bird_17</string>
<string>Bird_18</string>
</array>
</plist>
| {
"pile_set_name": "Github"
} |
<?php
session_start();
require "global_func.php";
if ($_SESSION['loggedin'] == 0)
{
header("Location: login.php");
exit;
}
$userid = $_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is =
mysql_query(
"SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",
$c) or die(mysql_error());
$ir = mysql_fetch_array($is);
check_level();
$fm = money_formatter($ir['money']);
$cm = money_formatter($ir['crystals'], '');
$lv = date('F j, Y, g:i a', $ir['laston']);
$h->userdata($ir, $lv, $fm, $cm);
$h->menuarea();
$tresder = (int) (rand(100, 999));
$maxbet = $ir['level'] * 150;
$_GET['tresde'] = abs((int) $_GET['tresde']);
if (($_SESSION['tresde'] == $_GET['tresde']) || $_GET['tresde'] < 100)
{
die(
"Error, you cannot refresh or go back on the slots, please use a side link to go somewhere else.<br />
<a href='roulette.php?tresde=$tresder'>> Back</a>");
}
$_SESSION['tresde'] = $_GET['tresde'];
$_GET['bet'] = abs((int) $_GET['bet']);
$_GET['number'] = abs((int) $_GET['number']);
print "<h3>Roulette: Pick a number between 0 - 36</h3>";
if ($_GET['bet'])
{
if ($_GET['bet'] > $ir['money'])
{
die(
"You are trying to bet more than you have.<br />
<a href='roulette.php?tresde=$tresder'>> Back</a>");
}
else if ($_GET['bet'] > $maxbet)
{
die(
"You have gone over the max bet.<br />
<a href='roulette.php?tresde=$tresder'>> Back</a>");
}
else if ($_GET['number'] > 36 or $_GET['number'] < 0 or $_GET['bet'] < 0)
{
die(
"The Numbers are only 0 - 36.<br />
<a href='roulette.php?tresde=$tresder'>> Back</a>");
}
$slot[1] = (int) rand(0, 36);
print
"You place \${$_GET['bet']} into the slot and pull the pole.<br />
You see the number: <b>$slot[1]</b><br />
You bet \${$_GET['bet']} ";
if ($slot[1] == $_GET['number'])
{
$won = $_GET['bet'] * 37;
$gain = $_GET['bet'] * 36;
print
"and won \$$won by matching the number u bet pocketing you \$$gain extra.";
}
else
{
$won = 0;
$gain = -$_GET['bet'];
print "and lost it.";
}
mysql_query(
"UPDATE users SET money=money+({$gain}) where userid=$userid", $c);
$tresder = (int) (rand(100, 999));
print
"<br />
<a href='roulette.php?bet={$_GET['bet']}&tresde=$tresder&number={$_GET['number']}'>> Another time, same bet.</a><br />
<a href='roulette.php?tresde=$tresder'>> I'll continue, but I'm changing my bet.</a><br />
<a href='explore.php'>> Enough's enough, I'm off.</a>";
}
else
{
print
"Ready to try your luck? Play today!<br />
The maximum bet for your level is \$$maxbet.<br />
<form action='roulette.php' method='get'>
Bet: \$<input type='text' name='bet' value='5' /><br />
Pick (0-36): <input type='text' name='number' value='18' /><br />
<input type='hidden' name='tresde' value='$tresder' />
<input type='submit' value='Play!!' />
</form>";
}
$h->endpage();
| {
"pile_set_name": "Github"
} |
# 시작하기
## 소개
Electron은 자바스크립트와 함께 제공된 풍부한 네이티브 API를 사용하여 멋진 데스크탑
애플리케이션을 만들 수 있도록 해주는 프레임워크입니다. 이 프레임워크의 Node.js는 웹
서버 개발이 아닌 데스크탑 애플리케이션 개발에 초점을 맞췄습니다.
이 말은 Electron이 GUI 라이브러리의 자바스크립트 바인딩이라는 뜻이 아닙니다. 대신,
Electron은 웹 페이지의 GUI를 사용합니다. 쉽게 말해 Electron은 자바스크립트를 사용하여
조작하는 작은 Chromium 브라우저로 볼 수 있습니다.
### 메인 프로세스
Electron은 실행될 때 __메인 프로세스__ 로 불리는 `package.json`의 `main` 스크립트를
호출합니다. 이 스크립트는 메인 프로세스에서 작동합니다. GUI 컴포넌트를 조작하거나 웹
페이지 창을 생성할 수 있습니다.
### 렌더러 프로세스
Electron이 웹페이지를 보여줄 때 Chromium의 multi-processes 구조도 같이 사용됩니다.
Electron 프로세스 내에서 작동하는 웹 페이지를 __렌더러 프로세스__ 라고 불립니다.
보통 일반 브라우저의 웹 페이지들은 샌드박스가 적용된 환경에서 작동하며 네이티브
리소스에는 접근할 수 없도록 되어 있습니다. 하지만 Electron은 웹 페이지 내에서 Node.js
API를 사용하여 low-level 수준으로 운영체제와 상호작용할 수 있습니다.
### 메인 프로세스와 렌더러 프로세스의 차이점
메인 프로세스는 `BrowserWindow` Class를 사용하여 새로운 창을 만들 수 있습니다.
`BrowserWindow` 인스턴스는 따로 분리된 프로세스에서 렌더링 되며 이 프로세스를 렌더러
프로세스라고 합니다. `BrowserWindow` 인스턴스가 소멸할 때 그 창의 렌더러 프로세스도
같이 소멸합니다.
메인 프로세스는 모든 웹 페이지와 렌더러 프로세스를 관리하며 렌더러 프로세스는 각각의
프로세스에 고립되며 웹 페이지의 작동에만 영향을 끼칩니다.
웹 페이지 내에선 기본적으로 네이티브 GUI와 관련된 API를 호출할 수 없도록 설계 되어
있습니다. 왜냐하면 웹 페이지 내에서 네이티브 GUI 리소스를 관리하는 것은 보안에 취약하고
리소스를 누수시킬 수 있기 때문입니다. 꼭 웹 페이지 내에서 API를 사용해야 한다면 메인
프로세스에서 그 작업을 처리할 수 있도록 메인 프로세스와 통신을 해야 합니다.
Electron에는 메인 프로세스와 렌더러 프로세스 사이에 통신을 할 수 있도록
[`ipcRenderer`](../api/ipc-renderer.md)와 [`ipcMain`](../api/ipc-main.md) 모듈을
제공하고 있습니다. 또는 [remote](../api/remote.md) 모듈을 사용하여 RPC 스타일로
통신할 수도 있습니다. 또한 FAQ에서 [다양한 객체를 공유하는 방법](share-data)도
소개하고 있습니다.
## 첫번째 Electron 앱 만들기
보통 Electron 앱은 다음과 같은 폴더 구조를 가집니다:
```text
your-app/
├── package.json
├── main.js
└── index.html
```
`package.json`은 node 모듈의 package.json과 같습니다. 그리고 `main` 필드에 스크립트
파일을 지정하면 메인 프로세스의 엔트리 포인트로 사용합니다. 예를 들어 사용할 수 있는
`package.json`은 다음과 같습니다:
```json
{
"name" : "your-app",
"version" : "0.1.0",
"main" : "main.js"
}
```
__알림__: 만약 `main` 필드가 `package.json`에 설정되어 있지 않으면 Electron은
자동으로 같은 디렉터리의 `index.js`를 로드합니다.
반드시 `main.js`에서 창을 만들고 시스템 이벤트를 처리해야 합니다. 대표적인 예시로
다음과 같이 작성할 수 있습니다:
```javascript
const electron = require('electron');
// 애플리케이션 생명주기를 조작 하는 모듈.
const {app} = electron;
// 네이티브 브라우저 창을 만드는 모듈.
const {BrowserWindow} = electron;
// 윈도우 객체를 전역에 유지합니다. 만약 이렇게 하지 않으면
// 자바스크립트 GC가 일어날 때 창이 멋대로 닫혀버립니다.
let win;
function createWindow () {
// 새로운 브라우저 창을 생성합니다.
win = new BrowserWindow({width: 800, height: 600});
// 그리고 현재 디렉터리의 index.html을 로드합니다.
win.loadURL(`file://${__dirname}/index.html`);
// 개발자 도구를 엽니다.
win.webContents.openDevTools();
// 창이 닫히면 호출됩니다.
win.on('closed', () => {
// 윈도우 객체의 참조를 삭제합니다. 보통 멀티 윈도우 지원을 위해
// 윈도우 객체를 배열에 저장하는 경우가 있는데 이 경우
// 해당하는 모든 윈도우 객체의 참조를 삭제해 주어야 합니다.
win = null;
});
}
// 이 메서드는 Electron의 초기화가 끝나면 실행되며 브라우저
// 윈도우를 생성할 수 있습니다. 몇몇 API는 이 이벤트 이후에만
// 사용할 수 있습니다.
app.on('ready', createWindow);
// 모든 창이 닫히면 애플리케이션 종료.
app.on('window-all-closed', () => {
// macOS의 대부분의 애플리케이션은 유저가 Cmd + Q 커맨드로 확실하게
// 종료하기 전까지 메뉴바에 남아 계속 실행됩니다.
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
// macOS에선 보통 독 아이콘이 클릭되고 나서도
// 열린 윈도우가 없으면, 새로운 윈도우를 다시 만듭니다.
if (win === null) {
createWindow();
}
});
// 이 파일엔 제작할 애플리케이션에 특화된 메인 프로세스 코드를
// 포함할 수 있습니다. 또한 파일을 분리하여 require하는 방법으로
// 코드를 작성할 수도 있습니다.
```
마지막으로, 사용자에게 보여줄 `index.html` 웹 페이지의 예시입니다:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>헬로 월드!</title>
</head>
<body>
<h1>헬로 월드!</h1>
이 애플리케이션은 node <script>document.write(process.version)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
Electron <script>document.write(process.versions.electron)</script>을 사용합니다.
</body>
</html>
```
## 앱 실행하기
앱을 작성한 후 [애플리케이션 배포](application-distribution.md) 가이드를 따라 앱을
패키징 하고 패키징한 앱을 실행할 수 있습니다. 또한 Electron 실행파일을 다운로드 받아
바로 실행해 볼 수도 있습니다.
### electron-prebuilt
[`electron-prebuilt`](https://github.com/electron-userland/electron-prebuilt)는
Electron의 미리 컴파일된 바이너리를 포함하는 `npm` 모듈입니다.
만약 `npm`을 통해 전역에 이 모듈을 설치했다면, 애플리케이션 소스 디렉터리에서 다음
명령을 실행하면 바로 실행할 수 있습니다:
```bash
electron .
```
또는 앱 디렉터리 밖에서 앱을 실행할 수도 있습니다:
```bash
electron app
```
npm 모듈을 로컬에 설치했다면 다음 명령으로 실행할 수 있습니다:
```bash
./node_modules/.bin/electron .
```
### 다운로드 받은 Electron 바이너리 사용
따로 Electron 바이너리를 다운로드 받았다면 다음 예시와 같이 실행하면 됩니다.
#### Windows
```bash
$ .\electron\electron.exe your-app\
```
#### Linux
```bash
$ ./electron/electron your-app/
```
#### macOS
```bash
$ ./Electron.app/Contents/MacOS/Electron your-app/
```
애플리케이션 실행파일은 `Electron`의 release 패키지에 포함되어 있습니다.
[여기](https://github.com/electron/electron/releases)에서 다운로드 받을 수 있습니다.
### 배포용 실행 파일 만들기
애플리케이션 작성을 모두 끝냈다면 [애플리케이션 배포](application-distribution.md)
가이드를 통해 제작한 앱을 패키징하고 배포할 수 있습니다.
### 미리 작성된 앱 실행하기
[`electron/electron-quick-start`](https://github.com/electron/electron-quick-start)
저장소를 클론하면 이 문서에서 작성한 예시 앱을 바로 실행해 볼 수 있습니다.
**참고**: 이 예시를 실행시키려면 [Git](https://git-scm.com)과
[Node.js](https://nodejs.org/en/download/)가 필요합니다. (CLI에서 실행 가능한
[npm](https://npmjs.org)이 있어야 합니다)
**역자주**: `npm`은 보통 Node.js를 설치하면 자동으로 같이 설치됩니다.
```bash
# 저장소를 클론합니다
$ git clone https://github.com/electron/electron-quick-start
# 저장소 안으로 들어갑니다
$ cd electron-quick-start
# 애플리케이션의 종속성 모듈을 설치한 후 실행합니다
$ npm install && npm start
```
[share-data]: ../faq.md#어떻게-웹-페이지-간에-데이터를-공유할-수-있나요
| {
"pile_set_name": "Github"
} |
platform :ios,'7.0' # 运行平台
# Data
pod 'AFNetworking' # 网络请求
pod 'Reachability' # 检测网络状况
pod 'JSONModel' # JSON 和对象互转
pod 'FMDB' # 本地缓存, sql
pod 'FMDB/SQLCipher' # sqllite cipher
pod 'TMCache' # 本地缓存, tumblr 出品, NSCoding
pod 'SSKeychain' # 钥匙串
pod 'SDWebImage' # 异步加载图片
pod 'UIActivityIndicator-for-SDWebImage' # SDWebImage upgrade
pod 'NSDate+TimeAgo' # 时间显示
# Cocoa Extension
pod 'BlocksKit' # cocoa api Blocks 扩展
pod 'UIActionSheet+Blocks' # 同上
pod 'UIAlertView+Blocks' # 同上
pod 'NSStringEmojize' # emoj NSString 互转
# Refresh
pod 'RefreshControl' # 刷新控件
pod 'ODRefreshControl' # 下拉刷新 like Apple's iOS6 Mail App
# HUD
pod 'JGProgressHUD' # 吐司框
pod 'MessageBanner' # 消息提示框
pod 'TSMessages' # 消息提示框 (more stars)
pod 'M13ProgressSuite' # 指示器
pod 'AMPopTip' # 类似系统复制提示
# Graph
pod 'JBChartView' # 绘制图表
pod 'TEAChart.' # 绘制图表
# Parallax
pod 'A3ParallaxScrollView' # 下拉视差效果(cover)
pod 'MDCParallaxView' # 下拉视差效果(❤ addSubView)
pod 'APParallaxHeader' # 下拉视差效果(❤ category)
pod 'CHTwitterCover' # 下拉视差效果(category, blur)
pod 'XHPathCover' # 下拉视差效果(带微信朋友圈刷新效果)
pod 'LeafScrollView' # 下拉视差效果(带刷新效果)
pod 'SWParallaxScrollView' # 多个图层上以不同速度滑动的自定义 ScrollView
pod 'GKLParallaxPictures' # 下拉视差效果(多图展示)
# View
pod 'CHTCollectionViewWaterfallLayout' # 瀑布流 (支持 Swift)
pod 'Shimmer' # 让 view 展示波光粼粼的效果
pod 'REMenu' # 下拉菜单
pod 'M80AttributedLabel' # label 功能扩展 (❤)
pod 'RSKImageCropper' # 圆形取图器
pod 'THContactPicker' # 搜索过滤
POD 'HPGrowingTextView' # 输入自动增加高度
pod 'SDSegmentedControl' # 小三角指示选中状态
pod 'DZNSegmentedControl' # 可以显示数字的segment,通常用于profile的顶部
pod 'CSNotificationView' # 透明的导航栏下面,滑下的Notif(iOS7)
pod 'FRDLivelyButton' # 用 CA 实现的补间动画形状按钮
pod 'TDBadgedCell' # 在 TableCell 右侧添加 badge 有不同风格
pod 'SWTableViewCell' # 类似 iOS7 邮件中的 Cell, 左右滑动出现多个功能键
pod 'AMScrollingNavbar' # 上滑收起 navi bar (适用于阅读)
pod 'MWPhotoBrowser' # 一套图片浏览控件 高仿 iOS 默认 支持网络图片
pod 'ios-realtimeblur.podspec' # 毛玻璃效果 (blur)
pod 'QBImagePickerController' # 多选图片
pod 'TTTAttributedLabel' # 富文本
pod 'MDRadialProgress' # 圆形百分比 (❤)
pod 'LASIImageView' # 圆形百分比
pod 'LLACircularProgressView' # app store 下载圆圈效果
# https://github.com/MaheshRS/Download-Indicator # 扇形百分比效果
pod 'UzysAssetsPickerController' # 图片选择器
pod 'RSDayFlow' # 日历控件
pod 'DAKeyboardControl' # 键盘监听事件
# Transition
pod 'MPParallaxCollection' # 左右切换视差效果,启动动画
# https://github.com/michaelhenry/MHYahooParallaxView # 左右切换视差效果,启动动画
pod 'RMStepsController' # 分步展示效果(可以做引导页,介绍页)
pod 'EAIntroView' # 引导页(❤)
pod 'MYIntroduction' # 引导页
pod 'MYBlurIntroductionView' # 引导页(模糊效果,号称不再需要其它介绍页了)
pod 'BCGenieEffect' # 视图 present 动画,类似于最小化到 dock 栏效果
pod 'AMWaveTransition' # 波浪转场效果(cell)
pod 'Onboard' # 引导页(支持 Swift)
# App framework
pod 'MMDrawerController' # 侧滑菜单(❤)
pod 'AMSlideMenu' # 侧滑菜单(❤)
pod 'MSDynamicsDrawerViewController' # 侧滑菜单
pod 'ChameleonFramework' # 颜色管理 | {
"pile_set_name": "Github"
} |
// Nautilus
// Copyright (C) 2020 Daniel Teuchert, Cornelius Aschermann, Sergej Schumilo
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
use std::iter::Step;
use std::ops::Add;
#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash, Serialize, Deserialize)]
pub struct RuleID(usize);
#[derive(PartialEq, PartialOrd, Eq, Clone, Copy, Debug, Hash, Serialize, Deserialize)]
pub struct NodeID(usize);
#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash, Serialize, Deserialize)]
pub struct NTermID(usize);
impl RuleID {
pub fn to_i(&self) -> usize {
self.0
}
}
impl From<usize> for RuleID {
fn from(i: usize) -> Self {
return RuleID(i);
}
}
impl Into<usize> for RuleID {
fn into(self) -> usize {
return self.0;
}
}
impl Add<usize> for RuleID {
type Output = RuleID;
fn add(self, rhs: usize) -> RuleID {
return RuleID(self.0 + rhs);
}
}
impl NodeID {
pub fn to_i(&self) -> usize {
self.0
}
}
impl From<usize> for NodeID {
fn from(i: usize) -> Self {
return NodeID(i);
}
}
impl Into<usize> for NodeID {
fn into(self) -> usize {
return self.0;
}
}
impl Add<usize> for NodeID {
type Output = NodeID;
fn add(self, rhs: usize) -> NodeID {
return NodeID(self.0 + rhs);
}
}
impl Step for NodeID {
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
let start_i = start.to_i();
let end_i = end.to_i();
if start > end {
return None;
}
return Some(end_i - start_i);
}
fn replace_one(&mut self) -> Self {
return NodeID::from(0);
}
fn replace_zero(&mut self) -> Self {
return NodeID::from(1);
}
fn add_one(&self) -> Self {
return self.add(1);
}
fn sub_one(&self) -> Self {
return NodeID(self.0 - 1);
}
fn add_usize(&self, n: usize) -> Option<Self> {
match self.0.checked_add(n) {
Some(x) => return Some(NodeID::from(x)),
None => return None,
}
}
}
impl NTermID {
pub fn to_i(&self) -> usize {
self.0
}
}
impl From<usize> for NTermID {
fn from(i: usize) -> Self {
return NTermID(i);
}
}
impl Into<usize> for NTermID {
fn into(self) -> usize {
return self.0;
}
}
impl Add<usize> for NTermID {
type Output = NTermID;
fn add(self, rhs: usize) -> NTermID {
return NTermID(self.0 + rhs);
}
}
#[cfg(test)]
mod tests {
use newtypes::NTermID;
use newtypes::NodeID;
use newtypes::RuleID;
#[test]
fn rule_id() {
let r1: RuleID = 1337.into();
let r2 = RuleID::from(1338);
let i1: usize = r1.into();
assert_eq!(i1, 1337);
let i2: usize = 1338;
assert_eq!(i2, r2.into());
let r3 = r2 + 3;
assert_eq!(r3, 1341.into());
}
#[test]
fn node_id() {
let r1: NodeID = 1337.into();
let r2 = NodeID::from(1338);
let i1: usize = r1.into();
assert_eq!(i1, 1337);
let i2: usize = 1338;
assert_eq!(i2, r2.into());
let r3 = r2 + 3;
assert_eq!(r3, 1341.into());
}
#[test]
fn nterm_id() {
let r1: NTermID = 1337.into();
let r2 = NTermID::from(1338);
let i1: usize = r1.into();
assert_eq!(i1, 1337);
let i2: usize = 1338;
assert_eq!(i2, r2.into());
let r3 = r2 + 3;
assert_eq!(r3, 1341.into());
}
#[test]
fn test_node_id_trait_step_impl() {
let x = 1337;
let y = 1360;
let r1: NodeID = x.into();
let r2 = NodeID::from(y);
let mut sum_from_nodes = 0;
for node in r1..r2 {
sum_from_nodes += node.to_i();
}
let mut sum_from_ints = 0;
for i in x..y {
sum_from_ints += i;
}
assert_eq!(sum_from_ints, sum_from_nodes);
}
}
| {
"pile_set_name": "Github"
} |
package ml.combust.mleap.runtime.transformer.feature
import ml.combust.mleap.core.feature.NGramModel
import ml.combust.mleap.core.types._
import ml.combust.mleap.runtime.frame.{DefaultLeapFrame, Row}
import org.scalatest.FunSpec
/**
* Created by mikhail on 10/16/16.
*/
class NGramSpec extends FunSpec{
val schema = StructType(Seq(StructField("test_string_seq", ListType(BasicType.String)))).get
val dataset = Seq(Row("a b c".split(" ").toSeq), Row("d e f".split(" ").toSeq), Row("g h i".split(" ").toSeq))
val frame = DefaultLeapFrame(schema,dataset)
val ngram = NGram(
shape = NodeShape().withStandardInput("test_string_seq").
withStandardOutput("output_ngram"),
model = NGramModel(2)
)
describe("#transform") {
it("converts an array of string into a bi-gram array") {
val frame2 = ngram.transform(frame).get
val data = frame2.dataset.toArray
assert(data(0).getSeq[String](1).head == "a b")
assert(data(0).getSeq[String](1)(1) == "b c")
}
}
describe("with invalid input column") {
val ngram2 = ngram.copy(shape = NodeShape().withStandardInput("bad_input").
withStandardOutput("output"))
it("returns a failure") {assert(ngram2.transform(frame).isFailure)}
}
describe("input/output schema") {
it("has the correct inputs and outputs") {
assert(ngram.schema.fields ==
Seq(StructField("test_string_seq", ListType(BasicType.String)),
StructField("output_ngram", ListType(BasicType.String))))
}
}
}
| {
"pile_set_name": "Github"
} |
cd src
if ! command -v nosetests ; then
echo >&2 'Testing networkx requires the package nose to be installed'
exit 1
fi
nosetests networkx -v
| {
"pile_set_name": "Github"
} |
<!doctype html>
<html>
<head>
<title>CodeMirror 2: Oracle PL/SQL mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="plsql.js"></script>
<link rel="stylesheet" href="../../theme/default.css">
<link rel="stylesheet" href="../../css/docs.css">
<style>.CodeMirror {border: 2px inset #dee;}</style>
</head>
<body>
<h1>CodeMirror 2: Oracle PL/SQL mode</h1>
<form><textarea id="code" name="code">
-- Oracle PL/SQL Code Demo
/*
based on c-like mode, adapted to PL/SQL by Peter Raganitsch ( http://www.oracle-and-apex.com/ )
April 2011
*/
DECLARE
vIdx NUMBER;
vString VARCHAR2(100);
cText CONSTANT VARCHAR2(100) := 'That''s it! Have fun with CodeMirror 2';
BEGIN
vIdx := 0;
--
FOR rDATA IN
( SELECT *
FROM EMP
ORDER BY EMPNO
)
LOOP
vIdx := vIdx + 1;
vString := rDATA.EMPNO || ' - ' || rDATA.ENAME;
--
UPDATE EMP
SET SAL = SAL * 101/100
WHERE EMPNO = rDATA.EMPNO
;
END LOOP;
--
SYS.DBMS_OUTPUT.Put_Line (cText);
END;
--
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-plsql"
});
</script>
<p>
Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course).
</p>
<p><strong>MIME type defined:</strong> <code>text/x-plsql</code>
(PLSQL code)
</html>
| {
"pile_set_name": "Github"
} |
"death_prophet_spirit_siphon"
{
"challengetype" "192"
"desc" "#DOTA_ChallengeDesc_DeathProphetSpiritSiphon"
"requiredhero" "43"
"multi_query" "1"
"events"
{
"1"
{
"desc" "#DOTA_ChallengeDesc_DeathProphetSpiritSiphon_Sub1"
"status_text" "#DOTA_ChallengeStatusText_DeathProphetSpiritSiphon_Sub1"
"matching_type" "linear_series"
"query"
{
"spirit_siphon"
{
"event" "modifier_remove"
"caster_playerid" "!playerid"
"target_must_be_hero" "1"
"modifier" "modifier_death_prophet_spirit_siphon_slow"
"duration_greater_than_mseconds" "0.100000"
"storage"
{
"3"
{
"key" "elapsed_duration"
"aggregator" "sum"
}
}
}
}
"progress_stored_in" "3"
"post_tests"
{
"test_spirit_siphon_duration"
{
"storage" "3"
"compare" ">="
"amount" "<total_spirit_siphon_duration>"
}
}
}
"2"
{
"desc" "#DOTA_ChallengeDesc_DeathProphetSpiritSiphon_Sub2"
"status_text" "#DOTA_ChallengeStatusText_DeathProphetSpiritSiphon_Sub2"
"matching_type" "timeblock_accumulate_after_trigger"
"query"
{
"trigger"
{
"event" "ability"
"caster" "!hero"
"ability" "death_prophet_silence"
}
"time_block_after_trigger" "1.000000"
"accumulate_event"
{
"event" "modifier_add"
"caster" "!hero"
"target_must_be_hero" "1"
"is_silence" "1"
"storage"
{
"1"
{
"aggregator" "increment"
}
}
}
}
"postmatch_increments"
{
"pre_storage_test"
{
"test_stunned_heroes_per_cast"
{
"storage" "1"
"compare" ">="
"amount" "2"
}
}
"storage"
{
"2"
{
"aggregator" "increment"
}
}
}
"clear_storage_per_trigger_or_pre_test_pass"
{
"1" "1"
"2" "0"
}
"progress_stored_in" "2"
"post_tests"
{
"test_stunned_heroes"
{
"storage" "2"
"compare" ">="
"amount" "<double_silences>"
}
}
}
}
"variables"
{
"<total_spirit_siphon_duration>"
{
"format" "int"
"index" "0"
}
"<double_silences>"
{
"format" "int"
"index" "1"
}
}
}
| {
"pile_set_name": "Github"
} |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography import utils
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.backends.openssl.utils import _truncate_digest
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import (
AsymmetricSignatureContext, AsymmetricVerificationContext, dsa
)
def _truncate_digest_for_dsa(dsa_cdata, digest, backend):
"""
This function truncates digests that are longer than a given DS
key's length so they can be signed. OpenSSL does this for us in
1.0.0c+ and it isn't needed in 0.9.8, but that leaves us with three
releases (1.0.0, 1.0.0a, and 1.0.0b) where this is a problem. This
truncation is not required in 0.9.8 because DSA is limited to SHA-1.
"""
order_bits = backend._lib.BN_num_bits(dsa_cdata.q)
return _truncate_digest(digest, order_bits)
@utils.register_interface(AsymmetricVerificationContext)
class _DSAVerificationContext(object):
def __init__(self, backend, public_key, signature, algorithm):
self._backend = backend
self._public_key = public_key
self._signature = signature
self._algorithm = algorithm
self._hash_ctx = hashes.Hash(self._algorithm, self._backend)
def update(self, data):
self._hash_ctx.update(data)
def verify(self):
data_to_verify = self._hash_ctx.finalize()
data_to_verify = _truncate_digest_for_dsa(
self._public_key._dsa_cdata, data_to_verify, self._backend
)
# The first parameter passed to DSA_verify is unused by OpenSSL but
# must be an integer.
res = self._backend._lib.DSA_verify(
0, data_to_verify, len(data_to_verify), self._signature,
len(self._signature), self._public_key._dsa_cdata)
if res != 1:
self._backend._consume_errors()
raise InvalidSignature
@utils.register_interface(AsymmetricSignatureContext)
class _DSASignatureContext(object):
def __init__(self, backend, private_key, algorithm):
self._backend = backend
self._private_key = private_key
self._algorithm = algorithm
self._hash_ctx = hashes.Hash(self._algorithm, self._backend)
def update(self, data):
self._hash_ctx.update(data)
def finalize(self):
data_to_sign = self._hash_ctx.finalize()
data_to_sign = _truncate_digest_for_dsa(
self._private_key._dsa_cdata, data_to_sign, self._backend
)
sig_buf_len = self._backend._lib.DSA_size(self._private_key._dsa_cdata)
sig_buf = self._backend._ffi.new("unsigned char[]", sig_buf_len)
buflen = self._backend._ffi.new("unsigned int *")
# The first parameter passed to DSA_sign is unused by OpenSSL but
# must be an integer.
res = self._backend._lib.DSA_sign(
0, data_to_sign, len(data_to_sign), sig_buf,
buflen, self._private_key._dsa_cdata)
self._backend.openssl_assert(res == 1)
self._backend.openssl_assert(buflen[0])
return self._backend._ffi.buffer(sig_buf)[:buflen[0]]
@utils.register_interface(dsa.DSAParametersWithNumbers)
class _DSAParameters(object):
def __init__(self, backend, dsa_cdata):
self._backend = backend
self._dsa_cdata = dsa_cdata
def parameter_numbers(self):
return dsa.DSAParameterNumbers(
p=self._backend._bn_to_int(self._dsa_cdata.p),
q=self._backend._bn_to_int(self._dsa_cdata.q),
g=self._backend._bn_to_int(self._dsa_cdata.g)
)
def generate_private_key(self):
return self._backend.generate_dsa_private_key(self)
@utils.register_interface(dsa.DSAPrivateKeyWithSerialization)
class _DSAPrivateKey(object):
def __init__(self, backend, dsa_cdata, evp_pkey):
self._backend = backend
self._dsa_cdata = dsa_cdata
self._evp_pkey = evp_pkey
self._key_size = self._backend._lib.BN_num_bits(self._dsa_cdata.p)
key_size = utils.read_only_property("_key_size")
def signer(self, signature_algorithm):
return _DSASignatureContext(self._backend, self, signature_algorithm)
def private_numbers(self):
return dsa.DSAPrivateNumbers(
public_numbers=dsa.DSAPublicNumbers(
parameter_numbers=dsa.DSAParameterNumbers(
p=self._backend._bn_to_int(self._dsa_cdata.p),
q=self._backend._bn_to_int(self._dsa_cdata.q),
g=self._backend._bn_to_int(self._dsa_cdata.g)
),
y=self._backend._bn_to_int(self._dsa_cdata.pub_key)
),
x=self._backend._bn_to_int(self._dsa_cdata.priv_key)
)
def public_key(self):
dsa_cdata = self._backend._lib.DSA_new()
self._backend.openssl_assert(dsa_cdata != self._backend._ffi.NULL)
dsa_cdata = self._backend._ffi.gc(
dsa_cdata, self._backend._lib.DSA_free
)
dsa_cdata.p = self._backend._lib.BN_dup(self._dsa_cdata.p)
dsa_cdata.q = self._backend._lib.BN_dup(self._dsa_cdata.q)
dsa_cdata.g = self._backend._lib.BN_dup(self._dsa_cdata.g)
dsa_cdata.pub_key = self._backend._lib.BN_dup(self._dsa_cdata.pub_key)
evp_pkey = self._backend._dsa_cdata_to_evp_pkey(dsa_cdata)
return _DSAPublicKey(self._backend, dsa_cdata, evp_pkey)
def parameters(self):
dsa_cdata = self._backend._lib.DSA_new()
self._backend.openssl_assert(dsa_cdata != self._backend._ffi.NULL)
dsa_cdata = self._backend._ffi.gc(
dsa_cdata, self._backend._lib.DSA_free
)
dsa_cdata.p = self._backend._lib.BN_dup(self._dsa_cdata.p)
dsa_cdata.q = self._backend._lib.BN_dup(self._dsa_cdata.q)
dsa_cdata.g = self._backend._lib.BN_dup(self._dsa_cdata.g)
return _DSAParameters(self._backend, dsa_cdata)
def private_bytes(self, encoding, format, encryption_algorithm):
return self._backend._private_key_bytes(
encoding,
format,
encryption_algorithm,
self._evp_pkey,
self._dsa_cdata
)
@utils.register_interface(dsa.DSAPublicKeyWithSerialization)
class _DSAPublicKey(object):
def __init__(self, backend, dsa_cdata, evp_pkey):
self._backend = backend
self._dsa_cdata = dsa_cdata
self._evp_pkey = evp_pkey
self._key_size = self._backend._lib.BN_num_bits(self._dsa_cdata.p)
key_size = utils.read_only_property("_key_size")
def verifier(self, signature, signature_algorithm):
if not isinstance(signature, bytes):
raise TypeError("signature must be bytes.")
return _DSAVerificationContext(
self._backend, self, signature, signature_algorithm
)
def public_numbers(self):
return dsa.DSAPublicNumbers(
parameter_numbers=dsa.DSAParameterNumbers(
p=self._backend._bn_to_int(self._dsa_cdata.p),
q=self._backend._bn_to_int(self._dsa_cdata.q),
g=self._backend._bn_to_int(self._dsa_cdata.g)
),
y=self._backend._bn_to_int(self._dsa_cdata.pub_key)
)
def parameters(self):
dsa_cdata = self._backend._lib.DSA_new()
self._backend.openssl_assert(dsa_cdata != self._backend._ffi.NULL)
dsa_cdata = self._backend._ffi.gc(
dsa_cdata, self._backend._lib.DSA_free
)
dsa_cdata.p = self._backend._lib.BN_dup(self._dsa_cdata.p)
dsa_cdata.q = self._backend._lib.BN_dup(self._dsa_cdata.q)
dsa_cdata.g = self._backend._lib.BN_dup(self._dsa_cdata.g)
return _DSAParameters(self._backend, dsa_cdata)
def public_bytes(self, encoding, format):
if format is serialization.PublicFormat.PKCS1:
raise ValueError(
"DSA public keys do not support PKCS1 serialization"
)
return self._backend._public_key_bytes(
encoding,
format,
self._evp_pkey,
None
)
| {
"pile_set_name": "Github"
} |
using Abp.Application.Editions;
using Abp.Application.Features;
using Abp.Domain.Repositories;
namespace Volo.PostgreSqlDemo.Editions
{
public class EditionManager : AbpEditionManager
{
public const string DefaultEditionName = "Standard";
public EditionManager(
IRepository<Edition> editionRepository,
IAbpZeroFeatureValueStore featureValueStore)
: base(
editionRepository,
featureValueStore)
{
}
}
}
| {
"pile_set_name": "Github"
} |
#pragma once
#include "dxvk_include.h"
namespace dxvk {
class DxvkDataSlice;
/**
* \brief Data buffer
*
* Provides a fixed-size buffer with a linear memory
* allocator for arbitrary data. Can be used to copy
* data to or from resources. Note that allocations
* will be aligned to a cache line boundary.
*/
class DxvkDataBuffer : public RcObject {
friend class DxvkDataSlice;
public:
DxvkDataBuffer();
DxvkDataBuffer(size_t size);
~DxvkDataBuffer();
/**
* \brief Allocates a slice
*
* If the desired slice length is larger than the
* number of bytes left in the buffer, this will
* fail and the returned slice points to \c nullptr.
* \param [in] n Number of bytes to allocate
* \returns The slice, or an empty slice on failure
*/
DxvkDataSlice alloc(size_t n);
private:
char* m_data = nullptr;
size_t m_size = 0;
size_t m_offset = 0;
};
/**
* \brief Data buffer slice
*
* A slice of a \ref DxvkDataBuffer which stores
* a strong reference to the backing buffer object.
*/
class DxvkDataSlice {
public:
DxvkDataSlice() { }
DxvkDataSlice(
const Rc<DxvkDataBuffer>& buffer,
size_t offset,
size_t length)
: m_buffer(buffer),
m_offset(offset),
m_length(length) { }
void* ptr() const {
return m_buffer != nullptr
? m_buffer->m_data + m_offset
: nullptr;
}
size_t offset() const { return m_offset; }
size_t length() const { return m_length; }
private:
Rc<DxvkDataBuffer> m_buffer;
size_t m_offset = 0;
size_t m_length = 0;
};
} | {
"pile_set_name": "Github"
} |
require 'sidekiq'
require 'sidekiq/fetch'
require 'redis_rate_limiter'
module Sidekiq::RateLimiter
DEFAULT_LIMIT_NAME =
'sidekiq-rate-limit'.freeze unless defined?(DEFAULT_LIMIT_NAME)
class Fetch < Sidekiq::BasicFetch
def retrieve_work
limit(super)
end
def limit(work)
message = JSON.parse(work.respond_to?(:message) ? work.message : work.job) rescue {}
args = message['args']
klass = message['class']
rate = Rate.new(message)
return work unless !!(klass && rate.valid?)
limit = rate.limit
interval = rate.interval
name = rate.name
options = {
:limit => (limit.respond_to?(:call) ? limit.call(*args) : limit).to_i,
:interval => (interval.respond_to?(:call) ? interval.call(*args) : interval).to_i,
:name => (name.respond_to?(:call) ? name.call(*args) : name).to_s,
}
Sidekiq.redis do |conn|
lim = Limit.new(conn, options)
if lim.exceeded?(klass)
conn.lpush("queue:#{work.queue_name}", work.respond_to?(:message) ? work.message : work.job)
nil
else
lim.add(klass)
work
end
end
end
end
class Rate
def initialize(message)
@message = message
end
def limit
rate['limit'] || rate['threshold']
end
def interval
rate['interval'] || rate['period']
end
def name
rate['name'] || DEFAULT_LIMIT_NAME
end
def valid?
!!(limit && interval)
end
private
def rate
use_server_rate? ? server_rate : client_rate
end
def use_server_rate?
server_rate['limit'] && server_rate['limit'].respond_to?(:call) ||
server_rate['threshold'] && server_rate['threshold'].respond_to?(:call) ||
server_rate['period'] && server_rate['period'].respond_to?(:call) ||
server_rate['interval'] && server_rate['interval'].respond_to?(:call) ||
server_rate['name'] && server_rate['name'].respond_to?(:call)
end
def client_rate
@client_rate ||= @message['rate'] || @message['throttle'] || {}
end
def server_rate
return @server_rate if @server_rate
worker_class = @message['class']
options = Object.const_get(worker_class).get_sidekiq_options rescue {}
server_rate = options['rate'] || options['throttle'] || {}
@server_rate = server_rate.map { |k, v| [k.to_s, v] }.to_h
end
end
class Limit < RedisRateLimiter
def initialize(redis, options = {})
options = options.dup
name = options.delete('name') ||
options.delete(:name)
super(name, redis, options)
end
end
end
| {
"pile_set_name": "Github"
} |
/*
* Generated by confdc --mib2yang-std
* Source: mgmt/dmi/model/common/mib-source/CISCO-IPSLA-JITTER-MIB.mib
*/
/*
* This YANG module has been generated by smidump 0.5.0:
*
* smidump -f yang CISCO-IPSLA-JITTER-MIB
*
* Do not edit. Edit the source file instead!
*/
module CISCO-IPSLA-JITTER-MIB {
namespace "urn:ietf:params:xml:ns:yang:smiv2:CISCO-IPSLA-JITTER-MIB";
prefix CISCO-IPSLA-JITTER-MIB;
import CISCO-IPSLA-TC-MIB {
prefix "cisco-ipsla";
}
import INET-ADDRESS-MIB {
prefix "inet-address";
}
import SNMP-FRAMEWORK-MIB {
prefix "snmp-framework";
}
import SNMPv2-TC {
prefix "snmpv2-tc";
}
import ietf-inet-types {
prefix "inet";
}
import ietf-yang-smiv2 {
prefix "smiv2";
}
organization
"Cisco Systems, Inc.";
contact
"Cisco Systems, Inc.
Customer Service
Postal: 170 W Tasman Drive
San Jose, CA 95134
Tel: +1 800 553 NETS
Email: [email protected]";
description
"This MIB module defines templates for IP SLA operations of UDP
Jitter and ICMP Jitter.
The UDP Jitter operation is designed to measure the delay
variance and packet loss in IP networks by generating synthetic
UDP traffic.
The ICMP Jitter operation provides capability to measure metrics
such as RTT (Round Trip Time), jitter, packet loss, one-way
latency by sending ICMP Timestamp stream to the destination
devices.";
revision 2007-07-24 {
description
"Initial version of this MIB module.";
}
container CISCO-IPSLA-JITTER-MIB {
config false;
container cipslaUdpJitterTmplTable {
description
"A table that contains UDP jitter template specific definitions.";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1";
list cipslaUdpJitterTmplEntry {
key "cipslaUdpJitterTmplName";
description
"A row entry representing an IPSLA UDP jitter template.";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1";
leaf cipslaUdpJitterTmplName {
type snmp-framework:SnmpAdminString {
length "1..64";
}
description
"A string which specifies the UDP Jitter template name.";
smiv2:max-access "not-accessible";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.1";
}
leaf cipslaUdpJitterTmplDescription {
type snmp-framework:SnmpAdminString {
length "0..128";
}
description
"A string which provides description of UDP Jitter
template.";
smiv2:defval "";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.2";
}
leaf cipslaUdpJitterTmplControlEnable {
type boolean;
description
"If this object is enabled, then the IP SLA application
will send control messages to a responder, residing on the
target router to respond to the data request packets being
sent by the source router.";
smiv2:defval "true";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.3";
}
leaf cipslaUdpJitterTmplTimeOut {
type uint32 {
range "0..604800000";
}
units "milliseconds";
description
"Specifies the duration to wait for a IP SLA operation
completion.
For connection oriented protocols, this may cause the
connection to be closed by the operation. Once closed, it
will be assumed that the connection reestablishment
will be performed. To prevent unwanted closure of
connections, be sure to set this value to a realistic
connection timeout.";
smiv2:defval "5000";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.4";
}
leaf cipslaUdpJitterTmplVerifyData {
type boolean;
description
"When set to true, the resulting data in each IP SLA
operation is compared with the expected data. This
includes checking header information (if possible) and
exact packet size.";
smiv2:defval "false";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.5";
}
leaf cipslaUdpJitterTmplCodecType {
type cisco-ipsla:IpSlaCodecType;
description
"Specifies the codec type to be used with UDP jitter operation.
If codec-type is configured the following parameters cannot be
configured.
cipslaUdpJitterReqDataSize
cipslaUdpJitterInterval
cipslaUdpJitterNumPkts";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.6";
}
leaf cipslaUdpJitterTmplCodecInterval {
type uint32 {
range "4..60000";
}
units "milliseconds";
description
"This field represents the inter-packet delay between
packets and is in milliseconds. This object is applicable
only to UDP jitter operation which uses codec type.";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.7";
}
leaf cipslaUdpJitterTmplCodecPayload {
type uint32 {
range "0..16384";
}
units "octets";
description
"This object represents the number of octets that needs to be
placed into the Data portion of the message. This value is
used only for UDP jitter operation which uses codec type.";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.8";
}
leaf cipslaUdpJitterTmplCodecNumPkts {
type uint32 {
range "1..60000";
}
units "packets";
description
"This value represents the number of packets that need to
be transmitted. This value is used only for UDP jitter
operation which uses codec type.";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.9";
}
leaf cipslaUdpJitterTmplInterval {
type uint32 {
range "4..60000";
}
units "milliseconds";
description
"This value represents the inter-packet delay between packets
and is in milliseconds.";
smiv2:defval "20";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.10";
}
leaf cipslaUdpJitterTmplNumPkts {
type uint32 {
range "1..60000";
}
units "packets";
description
"This value represents the number of packets that need to be
transmitted.";
smiv2:defval "10";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.11";
}
leaf cipslaUdpJitterTmplSrcAddrType {
type inet-address:InetAddressType;
description
"An enumerated value which specifies the IP address type
of the source. It must be used along with the
cipslaUdpJitterTmplSrcAddr object.";
smiv2:defval "ipv4";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.12";
}
leaf cipslaUdpJitterTmplSrcAddr {
type inet-address:InetAddress;
description
"This field specifies the IP address of the source.";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.13";
}
leaf cipslaUdpJitterTmplSrcPort {
type inet:port-number;
description
"This object represents the source's port number. If this
object is not specified, the application will get a
port allocated by the system.";
smiv2:defval "0";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.14";
}
leaf cipslaUdpJitterTmplPrecision {
type enumeration {
enum "milliseconds" {
value "1";
}
enum "microseconds" {
value "2";
}
}
description
"This object specifies the accuracy of jitter statistics in
rttMonJitterStatsTable that needs to be calculated.
milliseconds(1) - The accuracy of stats will be of milliseconds.
microseconds(2) - The accuracy of stats will be in microseconds.";
smiv2:defval "milliseconds";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.15";
}
leaf cipslaUdpJitterTmplReqDataSize {
type uint32 {
range "16..65024";
}
units "octets";
description
"This object represents the number of octets to be
placed into the ARR Data portion of the request
message, when using SNA protocols.
For non-ARR protocols' IP SLA request/responses,
this value represents the native payload size.
REMEMBER: The ARR Header overhead is not included
in this value.";
smiv2:defval "32";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.16";
}
leaf cipslaUdpJitterTmplPktPriority {
type enumeration {
enum "normal" {
value "1";
}
enum "high" {
value "2";
}
}
description
"This object specifies the priority that will be assigned
to operation packet.
normal(1) - The packet is of normal priority.
high(2) - The packet is of high priority.";
smiv2:defval "normal";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.17";
}
leaf cipslaUdpJitterTmplTOS {
type uint32 {
range "0..255";
}
description
"This object represents the type of service octet in an
IP header.";
reference
"Refer to the following documents for TOS definition.
RFC791/1349 for IPv4, IPv6, draft-ietf-diffserv-header-02.txt";
smiv2:defval "0";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.18";
}
leaf cipslaUdpJitterTmplVrfName {
type snmp-framework:SnmpAdminString {
length "0..32";
}
description
"This field is used to specify the VRF name in
which the IP SLA operation will be used. For regular IP SLA
operation this field should not be configured. The agent
will use this field to identify the VPN routing table for
this operation.";
smiv2:defval "";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.19";
}
leaf cipslaUdpJitterTmplThreshold {
type uint32 {
range "0..2147483647";
}
units "milliseconds";
description
"This object defines an administrative threshold limit.
If the IP SLA operation time exceeds this limit, then
one threshold crossing occurrence will be counted.";
smiv2:defval "5000";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.20";
}
leaf cipslaUdpJitterTmplNTPTolAbs {
type uint32 {
range "0..100000";
}
units "microseconds";
description
"This object specifies the total clock synchronization error
on source and responder that is considered tolerable for
oneway measurement when NTP is used as clock synchronization
mechanism. The total clock synchronization error is sum of
NTP offsets on source and responder. The value specified is
microseconds. This value can be set only for UDP jitter operation
with precision of microsecond.";
smiv2:defval "0";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.21";
}
leaf cipslaUdpJitterTmplNTPTolPct {
type uint32 {
range "0..100";
}
description
"This object specifies the total clock synchronization error
on source and responder that is considered tolerable for
oneway measurement when NTP is used as clock synchronization
mechanism. The total clock synchronization error is sum of
NTP offsets on source and responder. The value is expressed
as the percentage of actual oneway latency that is measured.
This value can be set only for UDP jitter operation with precision
of microsecond.";
smiv2:defval "0";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.22";
}
leaf cipslaUdpJitterTmplNTPTolType {
type enumeration {
enum "percent" {
value "1";
}
enum "absolute" {
value "2";
}
}
description
"This object specifies whether the value specified for oneway
NTP sync tolerance is absolute value or percent value.
percent(1) - The value for oneway NTP sync tolerance is
absolute value.
absolute(2) - The value for oneway NTP sync tolerance is
percent value.";
smiv2:defval "percent";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.23";
}
leaf cipslaUdpJitterTmplIcpifFactor {
type uint32 {
range "0..20";
}
description
"The advantage factor is dependant on the type of access and
how the service is to be used.
Conventional Wire-line 0
Mobility within Building 5
Mobility within geographic area 10
Access to hard-to-reach location 20
It is used when calculating the ICPIF value.";
smiv2:defval "0";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.24";
}
leaf cipslaUdpJitterTmplStatsHours {
type uint32 {
range "0..25";
}
units "hours";
description
"The maximum number of hours for which statistics are
maintained. Specifically this is the number of hourly
groups to keep before rolling over.
The value of one is not advisable because the hourly
group will close and immediately be deleted before
the network management station will have the
opportunity to retrieve the statistics.
The value of zero will shut off data collection.";
smiv2:defval "2";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.25";
}
leaf cipslaUdpJitterTmplDistBuckets {
type uint32 {
range "1..20";
}
description
"The maximum number of statistical distribution
buckets to accumulate.
Since this index does not rollover, only the first
cipslaUdpJitterTmplDistBuckets will be kept.
The last bucket will contain all entries from its
distribution interval start point to infinity.";
smiv2:defval "1";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.26";
}
leaf cipslaUdpJitterTmplDistInterval {
type uint32 {
range "1..100";
}
units "milliseconds";
description
"The statistical distribution buckets interval.
Distribution Bucket Example:
cipslaUdpJitterTmplDistBuckets = 5 buckets
cipslaUdpJitterTmplDistInterval = 10 milliseconds
| Bucket 1 | Bucket 2 | Bucket 3 | Bucket 4 | Bucket 5 |
| 0-9 ms | 10-19 ms | 20-29 ms | 30-39 ms | 40-Inf ms |
Odd Example:
cipslaUdpJitterTmplDistBuckets = 1 buckets
cipslaUdpJitterTmplDistInterval = 10 milliseconds
| Bucket 1 |
| 0-Inf ms |
Thus, this odd example shows that the value of
cipslaUdpJitterTmplDistInterval does not apply when
cipslaUdpJitterTmplDistBuckets is one.";
smiv2:defval "20";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.27";
}
leaf cipslaUdpJitterTmplStorageType {
type snmpv2-tc:StorageType;
description
"The storage type of this conceptual row.";
smiv2:defval "nonVolatile";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.28";
}
leaf cipslaUdpJitterTmplRowStatus {
type snmpv2-tc:RowStatus;
description
"The status of the conceptual UDP Jitter template control row.
When the status is active, all the read-create objects in that
row can be modified.";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.1.1.30";
}
}
}
container cipslaIcmpJitterTmplTable {
description
"A table that contains ICMP jitter template specific definitions.";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2";
list cipslaIcmpJitterTmplEntry {
key "cipslaIcmpJitterTmplName";
description
"A row entry representing an IP SLA ICMP Jitter template.";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1";
leaf cipslaIcmpJitterTmplName {
type snmp-framework:SnmpAdminString {
length "1..64";
}
description
"A string which specifies the ICMP jitter template name.";
smiv2:max-access "not-accessible";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.1";
}
leaf cipslaIcmpJitterTmplDescription {
type snmp-framework:SnmpAdminString {
length "0..128";
}
description
"A string which provides description of ICMP Jitter
template.";
smiv2:defval "";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.2";
}
leaf cipslaIcmpJitterTmplTimeOut {
type uint32 {
range "0..604800000";
}
units "milliseconds";
description
"Specifies the duration to wait for a IP SLA operation
completion.
For connection oriented protocols, this may cause the
connection to be closed by the operation. Once closed, it
will be assumed that the connection reestablishment
will be performed. To prevent unwanted closure of
connections, be sure to set this value to a realistic
connection timeout.";
smiv2:defval "5000";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.3";
}
leaf cipslaIcmpJitterTmplVerifyData {
type boolean;
description
"When set to true, the resulting data in each IP SLA
operation is compared with the expected data. This
includes checking header information (if possible) and
exact packet size.";
smiv2:defval "false";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.4";
}
leaf cipslaIcmpJitterTmplNumPkts {
type uint32 {
range "1..60000";
}
units "packets";
description
"This value represents the number of packets that need to be
transmitted.";
smiv2:defval "10";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.5";
}
leaf cipslaIcmpJitterTmplInterval {
type uint32 {
range "4..60000";
}
units "milliseconds";
description
"This value represents the inter-packet delay between packets
and is in milliseconds.";
smiv2:defval "20";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.6";
}
leaf cipslaIcmpJitterTmplSrcAddrType {
type inet-address:InetAddressType;
description
"An enumerated value which specifies the IP address type
of the source. It must be used along with the
cipslaIcmpJitterTmplSrcAddr object.";
smiv2:defval "ipv4";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.7";
}
leaf cipslaIcmpJitterTmplSrcAddr {
type inet-address:InetAddress;
description
"A string which specifies the IP address of the source.";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.8";
}
leaf cipslaIcmpJitterTmplTOS {
type uint32 {
range "0..255";
}
description
"This object represents the type of service octet in an
IP header.";
reference
"Refer to the following documents for TOS definition.
RFC791/1349 for IPv4, IPv6, draft-ietf-diffserv-header-02.txt";
smiv2:defval "0";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.9";
}
leaf cipslaIcmpJitterTmplVrfName {
type snmp-framework:SnmpAdminString {
length "0..32";
}
description
"This field is used to specify the VRF name in
which the IP SLA operation will be used. For regular IP SLA
operation this field should not be configured. The agent
will use this field to identify the VPN routing Table for
this operation.";
smiv2:defval "";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.10";
}
leaf cipslaIcmpJitterTmplThreshold {
type uint32 {
range "0..2147483647";
}
units "milliseconds";
description
"This object defines an administrative threshold limit.
If the IP SLA operation time exceeds this limit, then
one threshold crossing occurrence will be counted.";
smiv2:defval "5000";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.11";
}
leaf cipslaIcmpJitterTmplStatsHours {
type uint32 {
range "0..25";
}
units "hours";
description
"The maximum number of hourss for which statistics are
maintained. Specifically this is the number of hourly
groups to keep before rolling over.
The value of one is not advisable because the hourly
group will close and immediately be deleted before
the network management station will have the
opportunity to retrieve the statistics.
The value of zero will shut off data collection.";
smiv2:defval "2";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.12";
}
leaf cipslaIcmpJitterTmplDistBuckets {
type uint32 {
range "1..20";
}
description
"The maximum number of statistical distribution
buckets to accumulate.
Since this index does not rollover, only the first
cipslaIcmpJitterTmplDistBuckets will be kept.
The last bucket will contain all entries from its
distribution interval start point to infinity.";
smiv2:defval "1";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.13";
}
leaf cipslaIcmpJitterTmplDistInterval {
type uint32 {
range "1..100";
}
units "milliseconds";
description
"The statistical distribution buckets interval.
Distribution Bucket Example:
cipslaIcmpJitterTmplDistBuckets = 5 buckets
cipslaIcmpJitterTmplDistInterval = 10 milliseconds
| Bucket 1 | Bucket 2 | Bucket 3 | Bucket 4 | Bucket 5 |
| 0-9 ms | 10-19 ms | 20-29 ms | 30-39 ms | 40-Inf ms |
Odd Example:
cipslaIcmpJitterTmplDistBuckets = 1 buckets
cipslaIcmpJitterTmplDistInterval = 10 milliseconds
| Bucket 1 |
| 0-Inf ms |
Thus, this odd example shows that the value of
cipslaIcmpJitterTmplDistInterval does not apply when
cipslaIcmpJitterTmplDistBuckets is one.";
smiv2:defval "20";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.14";
}
leaf cipslaIcmpJitterTmplStorageType {
type snmpv2-tc:StorageType;
description
"The storage type of this conceptual row.";
smiv2:defval "nonVolatile";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.15";
}
leaf cipslaIcmpJitterTmplRowStatus {
type snmpv2-tc:RowStatus;
description
"The status of the conceptual ICMP jitter template control row.
When the status is active, all the read-create objects in
that row can be modified.";
smiv2:max-access "read-write";
smiv2:oid "1.3.6.1.4.1.9.9.635.1.2.1.16";
}
}
}
}
smiv2:alias "ciscoIpSlaJitterMIB" {
smiv2:oid "1.3.6.1.4.1.9.9.635";
}
smiv2:alias "ciscoIpSlaJitterMIBNotifs" {
smiv2:oid "1.3.6.1.4.1.9.9.635.0";
}
smiv2:alias "ciscoIpSlaJitterMIBObjects" {
smiv2:oid "1.3.6.1.4.1.9.9.635.1";
}
smiv2:alias "ciscoIpSlaJitterMIBConform" {
smiv2:oid "1.3.6.1.4.1.9.9.635.2";
}
smiv2:alias "ciscoIpSlaJitterMIBCompliances" {
smiv2:oid "1.3.6.1.4.1.9.9.635.2.1";
}
smiv2:alias "ciscoIpSlaJitterMIBGroups" {
smiv2:oid "1.3.6.1.4.1.9.9.635.2.2";
}
}
| {
"pile_set_name": "Github"
} |
2 0 0 2
4 16 8 2
2 64 32 4
1024 1024 64 0
1
| {
"pile_set_name": "Github"
} |
#nullable disable // TODO: This code is moving to the VSTest adapter
#if NETFRAMEWORK
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Xunit.Sdk;
namespace Xunit
{
class DiaSessionWrapperHelper : LongLivedMarshalByRefObject
{
static readonly Func<MethodInfo, Type> GetStateMachineType = InitializeGetStateMachineType();
readonly Assembly assembly;
readonly Dictionary<string, Type> typeNameMap;
public DiaSessionWrapperHelper(string assemblyFileName)
{
try
{
assembly = Assembly.ReflectionOnlyLoadFrom(assemblyFileName);
string assemblyDirectory = Path.GetDirectoryName(assemblyFileName);
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += (sender, args) =>
{
try
{
// Try to load it normally
var name = AppDomain.CurrentDomain.ApplyPolicy(args.Name);
return Assembly.ReflectionOnlyLoad(name);
}
catch
{
try
{
// If a normal implicit load fails, try to load it from the directory that
// the test assembly lives in
return Assembly.ReflectionOnlyLoadFrom(
Path.Combine(
assemblyDirectory,
new AssemblyName(args.Name).Name + ".dll"
)
);
}
catch
{
// If all else fails, say we couldn't find it
return null;
}
}
};
}
catch { }
if (assembly != null)
{
Type[] types = null;
try
{
types = assembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
types = ex.Types;
}
catch { } // Ignore anything other than ReflectionTypeLoadException
if (types != null)
typeNameMap = types.Where(t => t != null && !string.IsNullOrEmpty(t.FullName))
.ToDictionaryIgnoringDuplicateKeys(k => k.FullName);
else
typeNameMap = new Dictionary<string, Type>();
}
}
static Type GetStateMachineType_NoOp(MethodInfo method)
{
return null;
}
static Func<MethodInfo, Type> InitializeGetStateMachineType()
{
Type asyncStateMachineAttribute = Type.GetType("System.Runtime.CompilerServices.AsyncStateMachineAttribute");
if (asyncStateMachineAttribute == null)
return GetStateMachineType_NoOp;
ConstructorInfo asyncStateMachineAttributeConstructor = asyncStateMachineAttribute.GetConstructor(new[] { typeof(Type) });
if (asyncStateMachineAttributeConstructor == null)
return GetStateMachineType_NoOp;
// Types and constants used in the expression construction
Type customAttributeDataType = typeof(CustomAttributeData);
Type methodInfoType = typeof(MethodInfo);
Type memberInfoType = typeof(MemberInfo);
Type objectType = typeof(object);
Type typeType = typeof(Type);
Type enumerableType = typeof(Enumerable);
// Lambda input parameter: MethodInfo method
var methodParam = Expression.Parameter(methodInfoType, "method");
// CustomAttributeData.GetCustomAttributes(method)
var attributes = Expression.Call(
customAttributeDataType,
"GetCustomAttributes",
new Type[0],
new Expression[] { Expression.Convert(methodParam, memberInfoType) }
);
// attr => attr.Constructor == asyncStateMachineAttributeConstructor
var attrParameter = Expression.Parameter(customAttributeDataType, "attr");
var constructorProperty = Expression.Property(attrParameter, "Constructor");
var asyncMachineAttributeConstructorValue = Expression.Constant(asyncStateMachineAttributeConstructor);
var constructorEquality = Expression.Equal(constructorProperty, asyncMachineAttributeConstructorValue);
var attributeSelector = Expression.Lambda<Func<CustomAttributeData, bool>>(constructorEquality, new[] { attrParameter });
// var attribute = CustomAttributeData.GetCustomAttributes(method).SingleOrDefault(attr => attr.Constructor == asyncStateMachineAttributeConstructor);
var attribute = Expression.Call(
enumerableType,
"SingleOrDefault",
new Type[] { customAttributeDataType },
new Expression[] { attributes, attributeSelector }
);
// attribute == null
var attributeNullEquality = Expression.Equal(attribute, Expression.Constant(null, objectType));
// (Type)attribute.ConstructorArguments[0].Value
var constructorArguments = Expression.Property(attribute, "ConstructorArguments");
var firstConstructorArgument = Expression.Call(constructorArguments, "get_Item", new Type[0], Expression.Constant(0));
var firstConstructorArgumentValue = Expression.Property(firstConstructorArgument, "Value");
var firstConstructorArgumentValueAsType = Expression.Convert(firstConstructorArgumentValue, typeType);
// if (attribute == null)
// return null;
// else
// return (Type)attribute.ConstructorArguments[0].Value;
var conditional = Expression.Condition(
attributeNullEquality,
Expression.Constant(null, typeType),
firstConstructorArgumentValueAsType
);
return Expression.Lambda<Func<MethodInfo, Type>>(conditional, methodParam).Compile();
}
public void Normalize(ref string typeName, ref string methodName, ref string assemblyPath)
{
try
{
if (assembly == null)
return;
Type type;
if (typeNameMap.TryGetValue(typeName, out type) && type != null)
{
MethodInfo method = type.GetMethod(methodName);
if (method != null)
{
// DiaSession only ever wants you to ask for the declaring type
typeName = method.DeclaringType.FullName;
assemblyPath = method.DeclaringType.Assembly.Location;
// See if this is an async method by looking for [AsyncStateMachine] on the method,
// which means we need to pass the state machine's "MoveNext" method.
Type stateMachineType = GetStateMachineType(method);
if (stateMachineType != null)
{
typeName = stateMachineType.FullName;
methodName = "MoveNext";
}
}
}
}
catch { }
}
}
}
#endif
| {
"pile_set_name": "Github"
} |
# frozen_string_literal: true
require 'spec_helper'
describe 'my specs' do
it { expect(Class1.new).to be_a(Class1) }
it { expect(Class2.new).to be_a(Class2) }
end
| {
"pile_set_name": "Github"
} |
.ContactsLayout .panels {
//position: relative;
//left: 0%;
-webkit-transition: -webkit-transform 500ms ease 0s;
-moz-transition: -moz-transform 500ms ease 0s;
transition: transform 500ms ease 0s;
//.transition(left 500ms ease 0s);
&.list_active {
-webkit-transform: translateX(-100%);
-moz-transform: translateX(-100%);
-o-transform: translateX(-100%);
transform: translateX(-100%);
//left: -100%;
}
&.viewer_active {
-webkit-transform: translateX(-200%);
-moz-transform: translateX(-200%);
-o-transform: translateX(-200%);
transform: translateX(-200%);
//left: -200%;
}
}
.panel.groups {
.ui-droppable-disabled {
opacity: 1 !important;
}
}
/*=== Contacts screen CSS ===*/
.panel.contacts {
.panel_content {
margin-right: 0px;
}
.panel_top .search_block {
padding-right: 0px;
html.rtl & {
padding-right: 30px;
padding-left: 0px;
}
}
.panel_bottom {
.box-sizing();
background-color: transparent;
border-top: 0 none;
bottom: 10px;
height: 26px;
padding: 0;
position: absolute;
text-align: center;
white-space: nowrap;
width: 100%;
.pagination {
background: #F5F5F5;
border: 1px solid #D5D5D5;
border-radius: 21px;
box-shadow: 0 0 5px #E1E1E1;
cursor: default;
display: inline-block;
padding: 4px 10px;
text-align: right;
}
}
.middle_bar {
.resize_compensation_top(39px);
.resize_compensation_bottom(0px);
}
.item {
.me {
background: #F1F1F1;
border-radius: 10px 10px 10px 10px;
color: #6D6D6D;
float: right;
padding: 2px 8px;
}
&.selected .me {
color: #519CE2;
}
.data {
.box-sizing;
.name {
display: block;
margin-bottom: 10px;
font-size: 10.5pt;
font-weight: bold;
}
.email {
color: #519CE2;
}
}
&.selected .data .email {
color: #fff;
}
&.noname .data .name {
font-weight: normal;
color: #888;
.opacity(0.3);
}
&.selected.noname .data .name {
color: #fff;
}
}
.search_form {
float: right;
margin-top: -25px;
}
.right_panel {
overflow-x: hidden;
overflow-y: auto;
height: 100%;
}
.contact_form {
border: 3px solid #69A8F5;
background: #69A8F5;
border-radius: 4px;
.contact_content{
padding: 20px;
background: #fff;
border-radius: 2px;
}
.title{
margin-top: 0px;
font-weight: normal;
}
.subtitle {
font-size: 11pt;
color: #636C78;
}
.buttons {
border-top: 0px;
margin-top: 0px;
padding: 10px 0px 0px;
}
.value {
font-weight: bold;
font-size: 12pt;
}
}
}
/*=== END Contacts screen CSS ===*/
/*=== Contact viewer CSS ===*/
.panel.contact_viewer {
.panel_content {
background: url("images/contacts-bg.png?%VERSION%") repeat 0 0;
}
.middle_bar {
.box-sizing;
.resize_compensation_top(100px);
&.edit_contact,
&.edit_group,
&.import,
&.contact {
.resize_compensation_bottom(69px);
}
}
.panel_top {
margin: 0px 20px;
padding: 23px 0px;
min-height: 50px;
background: none;
border-bottom: 0px;
}
.contact_content {
height: 100%;
.fields_switcher {
margin: 10px 20px;
text-align: right;
}
}
.title {
font-size: 16pt;
color: #4d4d4d;
padding: 0px;
margin: 0 0 6px;
overflow: hidden;
white-space: normal;
.break-word();
&.email {
color: #3983c8;
margin: 0px;
font-size: 10.5pt;
font-weight: bold;
}
}
.item.mail_to_title {
text-decoration: none;
}
.panel_center {
.buttons {
position: relative;
z-index: 1;
margin: 0px;
.button {
position: absolute;
right: 0px;
top: 0px;
margin: 20px 40px 0px 0px;
html.rtl & {
right: auto;
left: 0px;
margin-right: 0px;
margin-left: 40px;
}
}
}
}
//.contact_content .toolbar {
// margin: 20px 30px 0px 0px;
//}
.panel_top .toolbar {
.content {
padding: 0;
.item.mail_to {
background: none repeat 0 0 #88CF50;
border-color: #7BBE45;
border-radius: 5px 5px 5px 5px;
overflow: hidden;
padding: 5px 10px 2px;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
color: #FFFFFF;
box-shadow: none;
}
}
.icon {
display: none;
}
.text {
display: inline-block;
}
}
.panel_bottom {
border: 0px;
border-radius: 0px;
background: none;
padding: 0px;
height: auto;
.buttons {
text-align: right;
margin: 0px 20px;
padding: 20px 0px;
border-top: 1px solid #D9D9D9;
html.rtl & {
text-align: left;
}
}
}
.decor {
border: 1px solid #D9D9D9;
border-bottom: 0px;
border-radius: 4px 4px 0px 0px;
padding-top: 3px;
margin: 0px 20px;
}
}
.contact_data_groups {
color: #626262;
border: 1px solid #D9D9D9;
border-top: 0px;
border-radius: 0px 0px 4px 4px;
margin: 0px 20px;
min-height: 100px;
.fields {
padding: 12px 20px 1px;
}
.subtitle,
.row {
margin-top: 0px;
margin-bottom: 22px;
padding: 0px;
}
.subtitle {
font-size: 10.5pt;
}
&.edit {
.label {
width: 25%;
}
.value {
width: 75%;
}
}
.address {
margin-bottom: 12px;
.row {
margin-bottom: 5px;
clear: none;
&:after {
display: none;
}
}
.label {
width: 20px;
height: 0px;
text-indent: 20px;
overflow: hidden;
&.address {
float: left;
width: 20px;
height: 20px;
text-indent: 0px;
overflow: hidden;
vertical-align: middle;
margin-right: -20px;
word-wrap: normal;
.iconFontInit();
&:before {
font-size: 20px;
margin-right: 20px;
content: "\e662";
html.rtl {
margin-left: 20px;
margin-right: 0px;
}
}
}
}
}
.mobile .label,
.phone .label,
.fax .label {
width: 20px;
height: 20px;
text-indent: 0px;
overflow: hidden;
vertical-align: middle;
.iconFontInit();
&:before {
font-size: 20px;
margin-right: 20px;
content: "\e663";
html.rtl {
margin-left: 20px;
margin-right: 0px;
}
}
.text {
display: none;
}
}
.link.call {
margin-left: 10px;
html.rtl & {
margin-left: 0px;
margin-right: 10px;
}
}
}
.contact_card {
.link.call {
margin-left: 4px;
}
.groups .row {
font-size: 9pt;
}
}
.import .contact_data_groups .buttons {
text-align: left;
margin-top: 0px;
}
/*=== END Contact viewer CSS ===*/
| {
"pile_set_name": "Github"
} |
Apache Maven is a software project management and comprehension tool. Based on
the concept of a project object model (POM), Maven can manage a project's
build, reporting and documentation from a central piece of information.
WWW: http://maven.apache.org/
| {
"pile_set_name": "Github"
} |
var loadRemoteResource = require('../reader/load-remote-resource');
function fetchFrom(callback) {
return callback || loadRemoteResource;
}
module.exports = fetchFrom;
| {
"pile_set_name": "Github"
} |
describe('jsonPath', function(){
describe('compiles valid syntax while rejecting invalid', function() {
it("compiles a basic pattern without throwing", function(){
expect(compiling('!')).not.toThrow();
});
describe("syntactically invalid patterns", function() {
it("fail on single invalid token", function(){
expect(compiling('/')).toThrow();
});
it("fail on invalid pattern with some valid tokens", function(){
expect(compiling('foo/')).toThrow();
});
it("fail on unclosed duck clause", function(){
expect(compiling('{foo')).toThrow();
});
it("fail on token with capture alone", function(){
expect(compiling('foo$')).toThrow();
});
});
});
describe('patterns match correct paths', function() {
describe('when pattern has only bang', function() {
it("should match root", function(){
expect('!').toMatchPath([]);
});
it("should miss non-root", function(){
expect('!').not.toMatchPath(['a']);
expect('!').not.toMatchPath(['a', 'b']);
});
});
it('should match * universally', function() {
expect('*').toMatchPath( [] );
expect('*').toMatchPath( ['a'] );
expect('*').toMatchPath( ['a', 2] );
expect('*').toMatchPath( ['a','b'] );
});
it('should match empty pattern universally', function() {
expect('').toMatchPath( [] );
expect('').toMatchPath( ['a'] );
expect('').toMatchPath( ['a', 2] );
expect('').toMatchPath( ['a','b'] );
});
it('should match !.* against any top-level path node', function() {
expect('!.*').toMatchPath( ['foo'])
expect('!.*').toMatchPath( ['bar'])
expect('!.*').not.toMatchPath( [])
expect('!.*').not.toMatchPath( ['foo', 'bar'])
});
it('should match !..* against anything but the root', function() {
expect('!..*').not.toMatchPath( [] );
expect('!..*').toMatchPath( ['a'] );
expect('!..*').toMatchPath( ['a','b'] );
});
it('should match *..* against anything except the root since it requires a decendant ' +
'which the root will never satisfy because it cannot have an ancestor', function() {
expect('*..*').not.toMatchPath( [] );
expect('*..*').toMatchPath( ['a'] );
expect('*..*').toMatchPath( ['a','b'] );
});
it('should match !.foo against foo node at first level only', function(){
expect('!.foo').toMatchPath( ['foo'] );
expect('!.foo').not.toMatchPath( [] );
expect('!.foo').not.toMatchPath( ['foo', 'bar']);
expect('!.foo').not.toMatchPath( ['bar'] );
});
it('should match !.foo.bar against paths with foo as first node and bar as second', function() {
expect('!.a.b').toMatchPath( ['a', 'b'])
expect('!.a.b').not.toMatchPath( [])
expect('!.a.b').not.toMatchPath( ['a'])
});
it('should match !..foo against any path ending in foo', function(){
expect('!..foo').not.toMatchPath( []);
expect('!..foo').toMatchPath( ['foo']);
expect('!..foo').toMatchPath( ['a', 'foo']);
expect('!..foo').not.toMatchPath( ['a', 'foo', 'a']);
expect('!..foo').toMatchPath( ['a', 'foo', 'foo']);
expect('!..foo').toMatchPath( ['a', 'a', 'foo']);
expect('!..foo').not.toMatchPath( ['a', 'a', 'foot']);
expect('!..foo').not.toMatchPath( ['a', 'foo', 'foo', 'a']);
});
it('should match ..foo like !..foo', function() {
expect('..foo').not.toMatchPath( []);
expect('..foo').toMatchPath( ['foo']);
expect('..foo').toMatchPath( ['a', 'foo']);
expect('..foo').not.toMatchPath( ['a', 'foo', 'a']);
expect('..foo').toMatchPath( ['a', 'foo', 'foo']);
expect('..foo').toMatchPath( ['a', 'a', 'foo']);
expect('..foo').not.toMatchPath( ['a', 'a', 'foot']);
expect('..foo').not.toMatchPath( ['a', 'foo', 'foo', 'a']);
});
it('should match foo like !..foo or ..foo', function() {
expect('foo').not.toMatchPath( []);
expect('foo').toMatchPath( ['foo']);
expect('foo').toMatchPath( ['a', 'foo']);
expect('foo').not.toMatchPath( ['a', 'foo', 'a']);
expect('foo').toMatchPath( ['a', 'foo', 'foo']);
expect('foo').toMatchPath( ['a', 'a', 'foo']);
expect('foo').not.toMatchPath( ['a', 'a', 'foot']);
expect('foo').not.toMatchPath( ['a', 'foo', 'foo', 'a']);
});
it('is not fooled by substrings in path nodes', function(){
expect('!.foo').not.toMatchPath( ['foot'])
});
it('matches !..foo.bar against bars which are direct children of a foo anywhere in the document', function() {
expect('!..foo.bar').not.toMatchPath( []);
expect('!..foo.bar').not.toMatchPath( ['foo']);
expect('!..foo.bar').not.toMatchPath( ['a', 'foo']);
expect('!..foo.bar').toMatchPath( ['a', 'foo', 'bar']);
expect('!..foo.bar').not.toMatchPath( ['a', 'foo', 'foo']);
expect('!..foo.bar').toMatchPath( ['a', 'a', 'a', 'foo', 'bar']);
expect('!..foo.bar').not.toMatchPath( ['a', 'a', 'a', 'foo', 'bar', 'a']);
});
it('matches foo.bar like !..foo.bar', function() {
expect('foo.bar').not.toMatchPath( [])
expect('foo.bar').not.toMatchPath( ['foo'])
expect('foo.bar').not.toMatchPath( ['a', 'foo'])
expect('foo.bar').toMatchPath( ['a', 'foo', 'bar'])
expect('foo.bar').not.toMatchPath( ['a', 'foo', 'foo'])
expect('foo.bar').toMatchPath( ['a', 'a', 'a', 'foo', 'bar'])
expect('foo.bar').not.toMatchPath( ['a', 'a', 'a', 'foo', 'bar', 'a'])
});
it('matches !..foo.*.bar only if there is an intermediate node between foo and bar', function(){
expect('!..foo.*.bar').not.toMatchPath( [])
expect('!..foo.*.bar').not.toMatchPath( ['foo'])
expect('!..foo.*.bar').not.toMatchPath( ['a', 'foo'])
expect('!..foo.*.bar').not.toMatchPath( ['a', 'foo', 'bar'])
expect('!..foo.*.bar').toMatchPath( ['a', 'foo', 'a', 'bar'])
expect('!..foo.*.bar').not.toMatchPath( ['a', 'foo', 'foo'])
expect('!..foo.*.bar').not.toMatchPath( ['a', 'a', 'a', 'foo', 'bar'])
expect('!..foo.*.bar').toMatchPath( ['a', 'a', 'a', 'foo', 'a', 'bar'])
expect('!..foo.*.bar').not.toMatchPath( ['a', 'a', 'a', 'foo', 'bar', 'a'])
expect('!..foo.*.bar').not.toMatchPath( ['a', 'a', 'a', 'foo', 'a', 'bar', 'a'])
});
describe('with numeric path nodes in the pattern', function() {
it('should be able to handle numeric nodes in object notation', function(){
expect('!.a.2').toMatchPath( ['a', 2])
expect('!.a.2').toMatchPath( ['a', '2'])
expect('!.a.2').not.toMatchPath( [])
expect('!.a.2').not.toMatchPath( ['a'])
});
it('should be able to handle numberic nodes in array notation', function(){
expect('!.a[2]').toMatchPath( ['a', 2])
expect('!.a[2]').toMatchPath( ['a', '2'])
expect('!.a[2]').not.toMatchPath( [])
expect('!.a[2]').not.toMatchPath( ['a'])
});
});
describe('with array notation', function() {
it('should handle adjacent array notations', function(){
expect('!["a"][2]').toMatchPath( ['a', 2])
expect('!["a"][2]').toMatchPath( ['a', '2'])
expect('!["a"][2]').not.toMatchPath( [])
expect('!["a"][2]').not.toMatchPath( ['a'])
});
it('should allow to specify child of root', function(){
expect('![2]').toMatchPath( [2])
expect('![2]').toMatchPath( ['2'])
expect('![2]').not.toMatchPath( [])
expect('![2]').not.toMatchPath( ['a'])
});
it('should be allowed to contain a star', function(){
expect('![*]').toMatchPath( [2])
expect('![*]').toMatchPath( ['2'])
expect('![*]').toMatchPath( ['a'])
expect('![*]').not.toMatchPath( [])
});
});
describe('composition of several tokens into complex patterns', function() {
it('should be able to handle more than one double dot', function() {
expect('!..foods..fr')
.toMatchPath( ['foods', 2, 'name', 'fr']);
});
it('should be able to match ..* or ..[*] as if it were * because .. matches zero nodes', function(){
expect('!..*.bar')
.toMatchPath(['anything', 'bar']);
expect('!..[*].bar')
.toMatchPath(['anything', 'bar']);
});
});
describe('using css4-style syntax', function() {
it('returns deepest node when no css4-style syntax is used', function(){
expect( matchOf( 'l2.*' ).against(
ascentFrom({ l1: {l2: {l3:'leaf'}}})
)).toSpecifyNode('leaf');
});
it('returns correct named node', function(){
expect( matchOf( '$l2.*' ).against(
ascentFrom({ l1: {l2: {l3:'leaf'}}})
)).toSpecifyNode({l3:'leaf'});
});
it('returns correct node when css4-style pattern is followed by double dot', function() {
expect( matchOf( '!..$foo..bar' ).against(
ascentFrom({ l1: {foo: {l3: {bar: 'leaf'}}}})
)).toSpecifyNode({l3: {bar: 'leaf'}});
});
it('can match children of root while capturing the root', function() {
expect( matchOf( '$!.*' ).against(
ascentFrom({ l1: 'leaf' })
)).toSpecifyNode({ l1: 'leaf' });
});
it('returns captured node with array notation', function() {
expect( matchOf( '$["l1"].l2' ).against(
ascentFrom({ l1: {l2:'leaf'} })
)).toSpecifyNode({ l2: 'leaf' });
});
it('returns captured node with array numbered notation', function() {
expect( matchOf( '$["2"].l2' ).against(
ascentFrom({ '2': {l2:'leaf'} })
)).toSpecifyNode({ l2: 'leaf' });
});
it('returns captured node with star notation', function() {
expect( matchOf( '!..$*.l3' ).against(
ascentFrom({ l1: {l2:{l3:'leaf'}} })
)).toSpecifyNode({ l3: 'leaf' });
});
it('returns captured node with array star notation', function(){
expect( matchOf( '!..$[*].l3' ).against(
ascentFrom({ l1: {l2:{l3:'leaf'}} })
)).toSpecifyNode({ l3: 'leaf' });
});
});
describe('with duck matching', function() {
it('can do basic ducking', function(){
var rootJson = {
people:{
jack:{
name: 'Jack'
, email: '[email protected]'
}
}
};
expect( matchOf( '{name email}' ).against(
asAscent(
[ 'people', 'jack' ],
[rootJson, rootJson.people, rootJson.people.jack ]
)
)).toSpecifyNode({name: 'Jack', email: '[email protected]'});
});
it('can duck on two levels of a path', function(){
var rootJson = {
people:{
jack:{
name: 'Jack'
, email: '[email protected]'
}
}
};
expect( matchOf( '{people}.{jack}.{name email}' ).against(
asAscent(
[ 'people', 'jack' ],
[rootJson, rootJson.people, rootJson.people.jack ]
)
)).toSpecifyNode({name: 'Jack', email: '[email protected]'});
});
it('fails if one duck is unsatisfied', function(){
var rootJson = {
people:{
jack:{
name: 'Jack'
, email: '[email protected]'
}
}
};
expect( matchOf( '{people}.{alberto}.{name email}' ).against(
asAscent(
[ 'people', 'jack' ],
[rootJson, rootJson.people, rootJson.people.jack ]
)
)).not.toSpecifyNode({name: 'Jack', email: '[email protected]'});
});
it('can construct the root duck type', function(){
var rootJson = {
people:{
jack:{
name: 'Jack'
, email: '[email protected]'
}
}
};
expect( matchOf( '{}' ).against(
asAscent(
[ 'people', 'jack' ],
[rootJson, rootJson.people, rootJson.people.jack ]
)
)).toSpecifyNode({name: 'Jack', email: '[email protected]'});
});
it('does not match if not all fields are there', function(){
var rootJson = {
people:{
jack:{
// no name here!
email: '[email protected]'
}
}
};
expect( matchOf( '{name email}' ).against(
asAscent(
[ 'people', 'jack' ],
[rootJson, rootJson.people, rootJson.people.jack ]
)
)).not.toSpecifyNode({name: 'Jack', email: '[email protected]'});
});
it('fails if something upstream fails', function(){
var rootJson = {
women:{
betty:{
name:'Betty'
, email: '[email protected]'
}
},
men:{
// we don't have no menz!
}
};
expect( matchOf( 'men.{name email}' ).against(
asAscent(
[ 'women', 'betty' ],
[rootJson, rootJson.women, rootJson.women.betty ]
)
)).not.toSpecifyNode({name: 'Jack', email: '[email protected]'});
});
it('does not crash given ascent starting from non-objects', function(){
var rootJson = [ 1, 2, 3 ];
expect( function(){ matchOf( '{spin taste}' ).against(
asAscent(
[ '0' ],
[rootJson, rootJson[0] ]
)
)}).not.toThrow();
});
it('does not match when given non-object', function(){
var rootJson = [ 1, 2, 3 ];
expect( matchOf( '{spin taste}' ).against(
asAscent(
[ '0' ],
[rootJson, rootJson[0] ]
)
)).toBeFalsy();
});
});
});
beforeEach(function(){
jasmine.addMatchers({
toSpecifyNode: function() {
return {
compare: function(actual, expectedNode) {
var result = {};
function jsonSame(a,b) {
return JSON.stringify(a) == JSON.stringify(b);
}
var match = actual;
result.message = "Expected node " + JSON.stringify(expectedNode) +
"but got " + (match.node? JSON.stringify(match.node) : 'no match');
result.pass = jsonSame( expectedNode, match.node );
return result;
}
};
},
toMatchPath: function() {
return {
compare: function(actual, pathStack) {
var result = {};
var pattern = actual;
try {
result.pass = !!matchOf(pattern).against(asAscent(pathStack));
} catch( e ) {
result.message = 'Error thrown running pattern "' + pattern +
'" against path [' + pathStack.join(',') + ']' + "\n" +
(e.stack || e.message);
result.pass = false;
};
return result;
}
};
}
});
});
function compiling(pattern) {
return function(){
jsonPathCompiler(pattern);
};
}
function matchOf(pattern) {
var compiledPattern = jsonPathCompiler(pattern);
return {
against:function(ascent) {
return compiledPattern(ascent);
}
};
}
// for the given pattern, return an array of empty objects of the one greater length to
// stand in for the nodestack in the cases where we only care about match or not match.
// one greater because the root node doesnt have a name
function fakeNodeStack(path){
var rtn = path.map(function(){return {}});
rtn.unshift({iAm:'root'});
return rtn;
}
function asAscent(pathStack, nodeStack){
// first, make a defensive copy of the vars so that we can mutate them at will:
pathStack = pathStack && JSON.parse(JSON.stringify(pathStack));
nodeStack = nodeStack && JSON.parse(JSON.stringify(nodeStack));
// change the two parameters into the test from arrays (which are easy to write as in-line js) to
// lists (which is what the code under test needs)
nodeStack = nodeStack || fakeNodeStack(pathStack);
pathStack.unshift(ROOT_PATH);
// NB: can't use the more functional Array.prototype.reduce here, IE8 doesn't have it and might not
// be polyfilled
var ascent = emptyList;
for (var i = 0; i < pathStack.length; i++) {
var mapping = {key: pathStack[i], node:nodeStack[i]};
ascent = cons( mapping, ascent );
}
return ascent;
}
});
| {
"pile_set_name": "Github"
} |
/*!
Pure v1.0.0
Copyright 2013 Yahoo!
Licensed under the BSD License.
https://github.com/yahoo/pure/blob/master/LICENSE.md
*/
@media screen and (min-width: 35.5em) {
.pure-u-sm-1,
.pure-u-sm-1-1,
.pure-u-sm-1-2,
.pure-u-sm-1-3,
.pure-u-sm-2-3,
.pure-u-sm-1-4,
.pure-u-sm-3-4,
.pure-u-sm-1-5,
.pure-u-sm-2-5,
.pure-u-sm-3-5,
.pure-u-sm-4-5,
.pure-u-sm-5-5,
.pure-u-sm-1-6,
.pure-u-sm-5-6,
.pure-u-sm-1-8,
.pure-u-sm-3-8,
.pure-u-sm-5-8,
.pure-u-sm-7-8,
.pure-u-sm-1-12,
.pure-u-sm-5-12,
.pure-u-sm-7-12,
.pure-u-sm-11-12,
.pure-u-sm-1-24,
.pure-u-sm-2-24,
.pure-u-sm-3-24,
.pure-u-sm-4-24,
.pure-u-sm-5-24,
.pure-u-sm-6-24,
.pure-u-sm-7-24,
.pure-u-sm-8-24,
.pure-u-sm-9-24,
.pure-u-sm-10-24,
.pure-u-sm-11-24,
.pure-u-sm-12-24,
.pure-u-sm-13-24,
.pure-u-sm-14-24,
.pure-u-sm-15-24,
.pure-u-sm-16-24,
.pure-u-sm-17-24,
.pure-u-sm-18-24,
.pure-u-sm-19-24,
.pure-u-sm-20-24,
.pure-u-sm-21-24,
.pure-u-sm-22-24,
.pure-u-sm-23-24,
.pure-u-sm-24-24 {
display: inline-block;
*display: inline;
zoom: 1;
letter-spacing: normal;
word-spacing: normal;
vertical-align: top;
text-rendering: auto;
}
.pure-u-sm-1-24 {
width: 4.1667%;
*width: 4.1357%;
}
.pure-u-sm-1-12,
.pure-u-sm-2-24 {
width: 8.3333%;
*width: 8.3023%;
}
.pure-u-sm-1-8,
.pure-u-sm-3-24 {
width: 12.5000%;
*width: 12.4690%;
}
.pure-u-sm-1-6,
.pure-u-sm-4-24 {
width: 16.6667%;
*width: 16.6357%;
}
.pure-u-sm-1-5 {
width: 20%;
*width: 19.9690%;
}
.pure-u-sm-5-24 {
width: 20.8333%;
*width: 20.8023%;
}
.pure-u-sm-1-4,
.pure-u-sm-6-24 {
width: 25%;
*width: 24.9690%;
}
.pure-u-sm-7-24 {
width: 29.1667%;
*width: 29.1357%;
}
.pure-u-sm-1-3,
.pure-u-sm-8-24 {
width: 33.3333%;
*width: 33.3023%;
}
.pure-u-sm-3-8,
.pure-u-sm-9-24 {
width: 37.5000%;
*width: 37.4690%;
}
.pure-u-sm-2-5 {
width: 40%;
*width: 39.9690%;
}
.pure-u-sm-5-12,
.pure-u-sm-10-24 {
width: 41.6667%;
*width: 41.6357%;
}
.pure-u-sm-11-24 {
width: 45.8333%;
*width: 45.8023%;
}
.pure-u-sm-1-2,
.pure-u-sm-12-24 {
width: 50%;
*width: 49.9690%;
}
.pure-u-sm-13-24 {
width: 54.1667%;
*width: 54.1357%;
}
.pure-u-sm-7-12,
.pure-u-sm-14-24 {
width: 58.3333%;
*width: 58.3023%;
}
.pure-u-sm-3-5 {
width: 60%;
*width: 59.9690%;
}
.pure-u-sm-5-8,
.pure-u-sm-15-24 {
width: 62.5000%;
*width: 62.4690%;
}
.pure-u-sm-2-3,
.pure-u-sm-16-24 {
width: 66.6667%;
*width: 66.6357%;
}
.pure-u-sm-17-24 {
width: 70.8333%;
*width: 70.8023%;
}
.pure-u-sm-3-4,
.pure-u-sm-18-24 {
width: 75%;
*width: 74.9690%;
}
.pure-u-sm-19-24 {
width: 79.1667%;
*width: 79.1357%;
}
.pure-u-sm-4-5 {
width: 80%;
*width: 79.9690%;
}
.pure-u-sm-5-6,
.pure-u-sm-20-24 {
width: 83.3333%;
*width: 83.3023%;
}
.pure-u-sm-7-8,
.pure-u-sm-21-24 {
width: 87.5000%;
*width: 87.4690%;
}
.pure-u-sm-11-12,
.pure-u-sm-22-24 {
width: 91.6667%;
*width: 91.6357%;
}
.pure-u-sm-23-24 {
width: 95.8333%;
*width: 95.8023%;
}
.pure-u-sm-1,
.pure-u-sm-1-1,
.pure-u-sm-5-5,
.pure-u-sm-24-24 {
width: 100%;
}
}
@media screen and (min-width: 48em) {
.pure-u-md-1,
.pure-u-md-1-1,
.pure-u-md-1-2,
.pure-u-md-1-3,
.pure-u-md-2-3,
.pure-u-md-1-4,
.pure-u-md-3-4,
.pure-u-md-1-5,
.pure-u-md-2-5,
.pure-u-md-3-5,
.pure-u-md-4-5,
.pure-u-md-5-5,
.pure-u-md-1-6,
.pure-u-md-5-6,
.pure-u-md-1-8,
.pure-u-md-3-8,
.pure-u-md-5-8,
.pure-u-md-7-8,
.pure-u-md-1-12,
.pure-u-md-5-12,
.pure-u-md-7-12,
.pure-u-md-11-12,
.pure-u-md-1-24,
.pure-u-md-2-24,
.pure-u-md-3-24,
.pure-u-md-4-24,
.pure-u-md-5-24,
.pure-u-md-6-24,
.pure-u-md-7-24,
.pure-u-md-8-24,
.pure-u-md-9-24,
.pure-u-md-10-24,
.pure-u-md-11-24,
.pure-u-md-12-24,
.pure-u-md-13-24,
.pure-u-md-14-24,
.pure-u-md-15-24,
.pure-u-md-16-24,
.pure-u-md-17-24,
.pure-u-md-18-24,
.pure-u-md-19-24,
.pure-u-md-20-24,
.pure-u-md-21-24,
.pure-u-md-22-24,
.pure-u-md-23-24,
.pure-u-md-24-24 {
display: inline-block;
*display: inline;
zoom: 1;
letter-spacing: normal;
word-spacing: normal;
vertical-align: top;
text-rendering: auto;
}
.pure-u-md-1-24 {
width: 4.1667%;
*width: 4.1357%;
}
.pure-u-md-1-12,
.pure-u-md-2-24 {
width: 8.3333%;
*width: 8.3023%;
}
.pure-u-md-1-8,
.pure-u-md-3-24 {
width: 12.5000%;
*width: 12.4690%;
}
.pure-u-md-1-6,
.pure-u-md-4-24 {
width: 16.6667%;
*width: 16.6357%;
}
.pure-u-md-1-5 {
width: 20%;
*width: 19.9690%;
}
.pure-u-md-5-24 {
width: 20.8333%;
*width: 20.8023%;
}
.pure-u-md-1-4,
.pure-u-md-6-24 {
width: 25%;
*width: 24.9690%;
}
.pure-u-md-7-24 {
width: 29.1667%;
*width: 29.1357%;
}
.pure-u-md-1-3,
.pure-u-md-8-24 {
width: 33.3333%;
*width: 33.3023%;
}
.pure-u-md-3-8,
.pure-u-md-9-24 {
width: 37.5000%;
*width: 37.4690%;
}
.pure-u-md-2-5 {
width: 40%;
*width: 39.9690%;
}
.pure-u-md-5-12,
.pure-u-md-10-24 {
width: 41.6667%;
*width: 41.6357%;
}
.pure-u-md-11-24 {
width: 45.8333%;
*width: 45.8023%;
}
.pure-u-md-1-2,
.pure-u-md-12-24 {
width: 50%;
*width: 49.9690%;
}
.pure-u-md-13-24 {
width: 54.1667%;
*width: 54.1357%;
}
.pure-u-md-7-12,
.pure-u-md-14-24 {
width: 58.3333%;
*width: 58.3023%;
}
.pure-u-md-3-5 {
width: 60%;
*width: 59.9690%;
}
.pure-u-md-5-8,
.pure-u-md-15-24 {
width: 62.5000%;
*width: 62.4690%;
}
.pure-u-md-2-3,
.pure-u-md-16-24 {
width: 66.6667%;
*width: 66.6357%;
}
.pure-u-md-17-24 {
width: 70.8333%;
*width: 70.8023%;
}
.pure-u-md-3-4,
.pure-u-md-18-24 {
width: 75%;
*width: 74.9690%;
}
.pure-u-md-19-24 {
width: 79.1667%;
*width: 79.1357%;
}
.pure-u-md-4-5 {
width: 80%;
*width: 79.9690%;
}
.pure-u-md-5-6,
.pure-u-md-20-24 {
width: 83.3333%;
*width: 83.3023%;
}
.pure-u-md-7-8,
.pure-u-md-21-24 {
width: 87.5000%;
*width: 87.4690%;
}
.pure-u-md-11-12,
.pure-u-md-22-24 {
width: 91.6667%;
*width: 91.6357%;
}
.pure-u-md-23-24 {
width: 95.8333%;
*width: 95.8023%;
}
.pure-u-md-1,
.pure-u-md-1-1,
.pure-u-md-5-5,
.pure-u-md-24-24 {
width: 100%;
}
}
@media screen and (min-width: 64em) {
.pure-u-lg-1,
.pure-u-lg-1-1,
.pure-u-lg-1-2,
.pure-u-lg-1-3,
.pure-u-lg-2-3,
.pure-u-lg-1-4,
.pure-u-lg-3-4,
.pure-u-lg-1-5,
.pure-u-lg-2-5,
.pure-u-lg-3-5,
.pure-u-lg-4-5,
.pure-u-lg-5-5,
.pure-u-lg-1-6,
.pure-u-lg-5-6,
.pure-u-lg-1-8,
.pure-u-lg-3-8,
.pure-u-lg-5-8,
.pure-u-lg-7-8,
.pure-u-lg-1-12,
.pure-u-lg-5-12,
.pure-u-lg-7-12,
.pure-u-lg-11-12,
.pure-u-lg-1-24,
.pure-u-lg-2-24,
.pure-u-lg-3-24,
.pure-u-lg-4-24,
.pure-u-lg-5-24,
.pure-u-lg-6-24,
.pure-u-lg-7-24,
.pure-u-lg-8-24,
.pure-u-lg-9-24,
.pure-u-lg-10-24,
.pure-u-lg-11-24,
.pure-u-lg-12-24,
.pure-u-lg-13-24,
.pure-u-lg-14-24,
.pure-u-lg-15-24,
.pure-u-lg-16-24,
.pure-u-lg-17-24,
.pure-u-lg-18-24,
.pure-u-lg-19-24,
.pure-u-lg-20-24,
.pure-u-lg-21-24,
.pure-u-lg-22-24,
.pure-u-lg-23-24,
.pure-u-lg-24-24 {
display: inline-block;
*display: inline;
zoom: 1;
letter-spacing: normal;
word-spacing: normal;
vertical-align: top;
text-rendering: auto;
}
.pure-u-lg-1-24 {
width: 4.1667%;
*width: 4.1357%;
}
.pure-u-lg-1-12,
.pure-u-lg-2-24 {
width: 8.3333%;
*width: 8.3023%;
}
.pure-u-lg-1-8,
.pure-u-lg-3-24 {
width: 12.5000%;
*width: 12.4690%;
}
.pure-u-lg-1-6,
.pure-u-lg-4-24 {
width: 16.6667%;
*width: 16.6357%;
}
.pure-u-lg-1-5 {
width: 20%;
*width: 19.9690%;
}
.pure-u-lg-5-24 {
width: 20.8333%;
*width: 20.8023%;
}
.pure-u-lg-1-4,
.pure-u-lg-6-24 {
width: 25%;
*width: 24.9690%;
}
.pure-u-lg-7-24 {
width: 29.1667%;
*width: 29.1357%;
}
.pure-u-lg-1-3,
.pure-u-lg-8-24 {
width: 33.3333%;
*width: 33.3023%;
}
.pure-u-lg-3-8,
.pure-u-lg-9-24 {
width: 37.5000%;
*width: 37.4690%;
}
.pure-u-lg-2-5 {
width: 40%;
*width: 39.9690%;
}
.pure-u-lg-5-12,
.pure-u-lg-10-24 {
width: 41.6667%;
*width: 41.6357%;
}
.pure-u-lg-11-24 {
width: 45.8333%;
*width: 45.8023%;
}
.pure-u-lg-1-2,
.pure-u-lg-12-24 {
width: 50%;
*width: 49.9690%;
}
.pure-u-lg-13-24 {
width: 54.1667%;
*width: 54.1357%;
}
.pure-u-lg-7-12,
.pure-u-lg-14-24 {
width: 58.3333%;
*width: 58.3023%;
}
.pure-u-lg-3-5 {
width: 60%;
*width: 59.9690%;
}
.pure-u-lg-5-8,
.pure-u-lg-15-24 {
width: 62.5000%;
*width: 62.4690%;
}
.pure-u-lg-2-3,
.pure-u-lg-16-24 {
width: 66.6667%;
*width: 66.6357%;
}
.pure-u-lg-17-24 {
width: 70.8333%;
*width: 70.8023%;
}
.pure-u-lg-3-4,
.pure-u-lg-18-24 {
width: 75%;
*width: 74.9690%;
}
.pure-u-lg-19-24 {
width: 79.1667%;
*width: 79.1357%;
}
.pure-u-lg-4-5 {
width: 80%;
*width: 79.9690%;
}
.pure-u-lg-5-6,
.pure-u-lg-20-24 {
width: 83.3333%;
*width: 83.3023%;
}
.pure-u-lg-7-8,
.pure-u-lg-21-24 {
width: 87.5000%;
*width: 87.4690%;
}
.pure-u-lg-11-12,
.pure-u-lg-22-24 {
width: 91.6667%;
*width: 91.6357%;
}
.pure-u-lg-23-24 {
width: 95.8333%;
*width: 95.8023%;
}
.pure-u-lg-1,
.pure-u-lg-1-1,
.pure-u-lg-5-5,
.pure-u-lg-24-24 {
width: 100%;
}
}
@media screen and (min-width: 80em) {
.pure-u-xl-1,
.pure-u-xl-1-1,
.pure-u-xl-1-2,
.pure-u-xl-1-3,
.pure-u-xl-2-3,
.pure-u-xl-1-4,
.pure-u-xl-3-4,
.pure-u-xl-1-5,
.pure-u-xl-2-5,
.pure-u-xl-3-5,
.pure-u-xl-4-5,
.pure-u-xl-5-5,
.pure-u-xl-1-6,
.pure-u-xl-5-6,
.pure-u-xl-1-8,
.pure-u-xl-3-8,
.pure-u-xl-5-8,
.pure-u-xl-7-8,
.pure-u-xl-1-12,
.pure-u-xl-5-12,
.pure-u-xl-7-12,
.pure-u-xl-11-12,
.pure-u-xl-1-24,
.pure-u-xl-2-24,
.pure-u-xl-3-24,
.pure-u-xl-4-24,
.pure-u-xl-5-24,
.pure-u-xl-6-24,
.pure-u-xl-7-24,
.pure-u-xl-8-24,
.pure-u-xl-9-24,
.pure-u-xl-10-24,
.pure-u-xl-11-24,
.pure-u-xl-12-24,
.pure-u-xl-13-24,
.pure-u-xl-14-24,
.pure-u-xl-15-24,
.pure-u-xl-16-24,
.pure-u-xl-17-24,
.pure-u-xl-18-24,
.pure-u-xl-19-24,
.pure-u-xl-20-24,
.pure-u-xl-21-24,
.pure-u-xl-22-24,
.pure-u-xl-23-24,
.pure-u-xl-24-24 {
display: inline-block;
*display: inline;
zoom: 1;
letter-spacing: normal;
word-spacing: normal;
vertical-align: top;
text-rendering: auto;
}
.pure-u-xl-1-24 {
width: 4.1667%;
*width: 4.1357%;
}
.pure-u-xl-1-12,
.pure-u-xl-2-24 {
width: 8.3333%;
*width: 8.3023%;
}
.pure-u-xl-1-8,
.pure-u-xl-3-24 {
width: 12.5000%;
*width: 12.4690%;
}
.pure-u-xl-1-6,
.pure-u-xl-4-24 {
width: 16.6667%;
*width: 16.6357%;
}
.pure-u-xl-1-5 {
width: 20%;
*width: 19.9690%;
}
.pure-u-xl-5-24 {
width: 20.8333%;
*width: 20.8023%;
}
.pure-u-xl-1-4,
.pure-u-xl-6-24 {
width: 25%;
*width: 24.9690%;
}
.pure-u-xl-7-24 {
width: 29.1667%;
*width: 29.1357%;
}
.pure-u-xl-1-3,
.pure-u-xl-8-24 {
width: 33.3333%;
*width: 33.3023%;
}
.pure-u-xl-3-8,
.pure-u-xl-9-24 {
width: 37.5000%;
*width: 37.4690%;
}
.pure-u-xl-2-5 {
width: 40%;
*width: 39.9690%;
}
.pure-u-xl-5-12,
.pure-u-xl-10-24 {
width: 41.6667%;
*width: 41.6357%;
}
.pure-u-xl-11-24 {
width: 45.8333%;
*width: 45.8023%;
}
.pure-u-xl-1-2,
.pure-u-xl-12-24 {
width: 50%;
*width: 49.9690%;
}
.pure-u-xl-13-24 {
width: 54.1667%;
*width: 54.1357%;
}
.pure-u-xl-7-12,
.pure-u-xl-14-24 {
width: 58.3333%;
*width: 58.3023%;
}
.pure-u-xl-3-5 {
width: 60%;
*width: 59.9690%;
}
.pure-u-xl-5-8,
.pure-u-xl-15-24 {
width: 62.5000%;
*width: 62.4690%;
}
.pure-u-xl-2-3,
.pure-u-xl-16-24 {
width: 66.6667%;
*width: 66.6357%;
}
.pure-u-xl-17-24 {
width: 70.8333%;
*width: 70.8023%;
}
.pure-u-xl-3-4,
.pure-u-xl-18-24 {
width: 75%;
*width: 74.9690%;
}
.pure-u-xl-19-24 {
width: 79.1667%;
*width: 79.1357%;
}
.pure-u-xl-4-5 {
width: 80%;
*width: 79.9690%;
}
.pure-u-xl-5-6,
.pure-u-xl-20-24 {
width: 83.3333%;
*width: 83.3023%;
}
.pure-u-xl-7-8,
.pure-u-xl-21-24 {
width: 87.5000%;
*width: 87.4690%;
}
.pure-u-xl-11-12,
.pure-u-xl-22-24 {
width: 91.6667%;
*width: 91.6357%;
}
.pure-u-xl-23-24 {
width: 95.8333%;
*width: 95.8023%;
}
.pure-u-xl-1,
.pure-u-xl-1-1,
.pure-u-xl-5-5,
.pure-u-xl-24-24 {
width: 100%;
}
} | {
"pile_set_name": "Github"
} |
[
{
"kids":[],
"uid":"3044669284",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AklBAfXF2",
"date":"2013-11-25 12:12:08"
},
{
"kids":[],
"uid":"3044204540",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"Akk8AquGq",
"date":"2013-11-25 08:27:57"
},
{
"kids":[],
"uid":"2920604422",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AkjCugmRC",
"date":"2013-11-25 07:08:53"
},
{
"kids":[],
"uid":"2802905310",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"Ajz92w1Qj",
"date":"2013-11-20 08:49:59"
},
{
"kids":[],
"uid":"2789699604",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"Ajq2AvyVo",
"date":"2013-11-19 09:39:21"
},
{
"kids":[],
"uid":"2802787934",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AjpKylarY",
"date":"2013-11-19 08:54:55"
},
{
"kids":[],
"uid":"2937010151",
"parent":"",
"text":"",
"mid":"AjmpSopb8",
"date":"2013-11-19 00:25:43"
},
{
"kids":[],
"uid":"2919374522",
"parent":"AgdTSdktO",
"text":"",
"mid":"AiOFG4Eil",
"date":"2013-11-15 10:31:16"
},
{
"kids":[],
"uid":"3044883620",
"parent":"AgdTSdktO",
"text":"",
"mid":"AiOi5osAD",
"date":"2013-11-15 09:33:09"
},
{
"kids":[],
"uid":"2810891932",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AiFEXeZcH",
"date":"2013-11-14 11:34:47"
},
{
"kids":[],
"uid":"1778397184",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AiElKmu3n",
"date":"2013-11-14 08:14:42"
},
{
"kids":[],
"uid":"1583269584",
"parent":"AgdTSdktO",
"text":"",
"mid":"AiBka5UZD",
"date":"2013-11-14 00:32:32"
},
{
"kids":[],
"uid":"2805456054",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AiAA3cmoY",
"date":"2013-11-13 22:38:53"
},
{
"kids":[],
"uid":"1723810823",
"parent":"AgdTSdktO",
"text":"",
"mid":"AhLchm6eH",
"date":"2013-11-08 11:50:18"
},
{
"kids":[],
"uid":"3045175312",
"parent":"AgdTSdktO",
"text":"",
"mid":"AhJtd8I0l",
"date":"2013-11-08 07:26:31"
},
{
"kids":[],
"uid":"2746150937",
"parent":"",
"text":"",
"mid":"AhvDpCvDK",
"date":"2013-11-06 20:13:11"
},
{
"kids":[],
"uid":"2808710392",
"parent":"Ag0O0jePU",
"text":"",
"mid":"Ah8fkDsq1",
"date":"2013-11-04 08:40:43"
},
{
"kids":[],
"uid":"3041577465",
"parent":"Ag0KgEAPY",
"text":"",
"mid":"Ah36jlPc8",
"date":"2013-11-03 19:34:44"
},
{
"kids":[],
"uid":"3044800142",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AgZ36dCmC",
"date":"2013-11-03 09:15:50"
},
{
"kids":[],
"uid":"3045416420",
"parent":"AgdTSdktO",
"text":"",
"mid":"AgYWorSPY",
"date":"2013-11-03 08:59:20"
},
{
"kids":[],
"uid":"1992859992",
"parent":"",
"text":"等待一份坦诚的爱!",
"mid":"AgWliylLu",
"date":"2013-11-03 02:22:27"
},
{
"kids":[],
"uid":"1582800377",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AgQwAdpuP",
"date":"2013-11-02 11:33:46"
},
{
"kids":[],
"uid":"ununa",
"parent":"AgMdlnOQ9",
"text":"",
"mid":"AgPz1deoz",
"date":"2013-11-02 09:07:02"
},
{
"kids":[],
"uid":"2789912562",
"parent":"Ag0UdDjMH",
"text":"",
"mid":"AgPhQv5Ho",
"date":"2013-11-02 08:24:42"
},
{
"kids":[],
"uid":"2920464020",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"AgPcZESmJ",
"date":"2013-11-02 08:12:45"
},
{
"kids":[],
"uid":"2804570732",
"parent":"Ag0UdDjMH",
"text":"",
"mid":"AgP1NhnVN",
"date":"2013-11-02 07:45:08"
},
{
"kids":[],
"uid":"3045067290",
"parent":"Ag3Gg1Suu",
"text":"",
"mid":"AgOz722Fg",
"date":"2013-11-02 06:34:30"
},
{
"kids":[],
"uid":"3043447740",
"parent":"Ag1rG1dMX",
"text":"",
"mid":"AgMNOuTa6",
"date":"2013-11-02 02:05:14"
},
{
"kids":[
"AgPz1deoz"
],
"uid":"2789780094",
"parent":"AgdTSdktO",
"text":"",
"mid":"AgMdlnOQ9",
"date":"2013-11-02 00:35:21"
},
{
"kids":[],
"uid":"2295910670",
"parent":"",
"text":",",
"mid":"AgLlX3zXi",
"date":"2013-11-01 22:23:50"
},
{
"kids":[],
"uid":"3044760142",
"parent":"Ag0ItwtOf",
"text":"",
"mid":"AgHA7z0yp",
"date":"2013-11-01 12:47:45"
},
{
"kids":[],
"uid":"2808826690",
"parent":"Ag0ItwtOf",
"text":"",
"mid":"AgyRZr5Ad",
"date":"2013-10-31 14:37:04"
},
{
"kids":[],
"uid":"2919900142",
"parent":"Ag0ItwtOf",
"text":"",
"mid":"AgyKDvw8M",
"date":"2013-10-31 14:18:58"
},
{
"kids":[],
"uid":"2810855394",
"parent":"Ag0UdDjMH",
"text":"",
"mid":"AgwyWyaHX",
"date":"2013-10-31 08:44:38"
},
{
"kids":[],
"uid":"2920108500",
"parent":"Ag0UdDjMH",
"text":"",
"mid":"AgwdCvTmc",
"date":"2013-10-31 07:52:06"
},
{
"kids":[],
"uid":"1886609527",
"parent":"",
"text":"",
"mid":"Agrmh9cfq",
"date":"2013-10-30 19:29:42"
},
{
"kids":[],
"uid":"1202434215",
"parent":"",
"text":"轉發微博",
"mid":"AgqLHfhPY",
"date":"2013-10-30 17:59:35"
},
{
"kids":[],
"uid":"3818831651",
"parent":"",
"text":"",
"mid":"AgouFnTMb",
"date":"2013-10-30 12:12:08"
},
{
"kids":[],
"uid":"210122985",
"parent":"",
"text":"",
"mid":"AgjuEdVmr",
"date":"2013-10-29 23:28:22"
},
{
"kids":[],
"uid":"2715957130",
"parent":"Agf0ttGlS",
"text":"",
"mid":"AggwH7B29",
"date":"2013-10-29 15:55:09"
},
{
"kids":[
"AggwH7B29"
],
"uid":"3044257442",
"parent":"Ag1wmrfn3",
"text":"",
"mid":"Agf0ttGlS",
"date":"2013-10-29 12:03:02"
},
{
"kids":[],
"uid":"1583937451",
"parent":"Ag0O0jePU",
"text":"",
"mid":"AgeMKb5iy",
"date":"2013-10-29 11:29:11"
},
{
"kids":[
"AiOFG4Eil",
"AiOi5osAD",
"AiBka5UZD",
"AhLchm6eH",
"AhJtd8I0l",
"AgYWorSPY",
"AgPz1deoz",
"AgMdlnOQ9"
],
"uid":"2708420121",
"parent":"",
"text":"",
"mid":"AgdTSdktO",
"date":"2013-10-29 09:14:01"
},
{
"kids":[],
"uid":"2920206464",
"parent":"",
"text":"",
"mid":"AgdG7nBGy",
"date":"2013-10-29 08:40:08"
},
{
"kids":[],
"uid":"1674425800",
"parent":"",
"text":"",
"mid":"Agaeb5r5l",
"date":"2013-10-28 23:53:03"
},
{
"kids":[],
"uid":"3391854980",
"parent":"",
"text":"",
"mid":"Aga3ezSwq",
"date":"2013-10-28 23:26:07"
},
{
"kids":[],
"uid":"3153120414",
"parent":"",
"text":"",
"mid":"Ag6NU9rxc",
"date":"2013-10-28 15:10:05"
},
{
"kids":[],
"uid":"3191934624",
"parent":"",
"text":"",
"mid":"Ag6NnChHQ",
"date":"2013-10-28 15:08:47"
},
{
"kids":[],
"uid":"1700435814",
"parent":"",
"text":"",
"mid":"Ag6nMxvUd",
"date":"2013-10-28 14:05:44"
},
{
"kids":[],
"uid":"1857304861",
"parent":"",
"text":"",
"mid":"Ag6fK2Ysn",
"date":"2013-10-28 13:45:54"
},
{
"kids":[],
"uid":"2564412647",
"parent":"",
"text":"人这一生总会爱上这样一个人……",
"mid":"Ag64GcoBX",
"date":"2013-10-28 13:18:41"
},
{
"kids":[],
"uid":"2089015395",
"parent":"",
"text":"",
"mid":"Ag5XAwgbP",
"date":"2013-10-28 13:01:11"
},
{
"kids":[],
"uid":"3112810671",
"parent":"",
"text":"",
"mid":"Ag5X5rVlx",
"date":"2013-10-28 12:59:58"
},
{
"kids":[],
"uid":"3044060800",
"parent":"Ag2KeofuW",
"text":"",
"mid":"Ag5lBrc5J",
"date":"2013-10-28 11:27:38"
},
{
"kids":[],
"uid":"3171783875",
"parent":"",
"text":"",
"mid":"Ag5iYEm1z",
"date":"2013-10-28 11:21:09"
},
{
"kids":[],
"uid":"3043786810",
"parent":"",
"text":"",
"mid":"Ag5c6deho",
"date":"2013-10-28 11:04:10"
},
{
"kids":[],
"uid":"2730902177",
"parent":"",
"text":"",
"mid":"Ag59ax9A3",
"date":"2013-10-28 10:56:59"
},
{
"kids":[],
"uid":"3044275780",
"parent":"Ag0O0jePU",
"text":"",
"mid":"Ag58GE3QP",
"date":"2013-10-28 10:55:48"
},
{
"kids":[],
"uid":"3866104145",
"parent":"",
"text":"",
"mid":"Ag54H4u8B",
"date":"2013-10-28 10:45:57"
},
{
"kids":[],
"uid":"2900761402",
"parent":"",
"text":"没有合适不合适,感觉两情相悦就好。",
"mid":"Ag52pekkP",
"date":"2013-10-28 10:40:19"
},
{
"kids":[],
"uid":"2804483584",
"parent":"Ag3iNiCHz",
"text":"",
"mid":"Ag4WGAK30",
"date":"2013-10-28 10:26:13"
},
{
"kids":[],
"uid":"2682606462",
"parent":"",
"text":"",
"mid":"Ag4Vc8j8V",
"date":"2013-10-28 10:22:33"
},
{
"kids":[],
"uid":"2808293762",
"parent":"Ag0TC5PEv",
"text":"",
"mid":"Ag4UtbDzc",
"date":"2013-10-28 10:20:47"
},
{
"kids":[],
"uid":"1252194535",
"parent":"",
"text":"",
"mid":"Ag4Tlcrqk",
"date":"2013-10-28 10:17:57"
},
{
"kids":[],
"uid":"nancyts",
"parent":"",
"text":"",
"mid":"Ag4PMtfax",
"date":"2013-10-28 10:09:13"
},
{
"kids":[],
"uid":"2920648704",
"parent":"Ag0O0jePU",
"text":"",
"mid":"Ag4P2k5A9",
"date":"2013-10-28 10:07:22"
},
{
"kids":[],
"uid":"3514643765",
"parent":"",
"text":"",
"mid":"Ag4OzFlm0",
"date":"2013-10-28 10:06:14"
},
{
"kids":[],
"uid":"3172802423",
"parent":"",
"text":"@柴晋露",
"mid":"Ag4Nswlam",
"date":"2013-10-28 10:03:29"
},
{
"kids":[],
"uid":"2920166320",
"parent":"Ag0NNByLe",
"text":"",
"mid":"Ag4M61fGb",
"date":"2013-10-28 10:00:06"
},
{
"kids":[],
"uid":"2283661242",
"parent":"",
"text":"哇靠,讲的是我?",
"mid":"Ag4KNFJQ1",
"date":"2013-10-28 09:56:56"
},
{
"kids":[],
"uid":"3256122224",
"parent":"",
"text":"",
"mid":"Ag4CFhWL4",
"date":"2013-10-28 09:36:54"
},
{
"kids":[],
"uid":"1560962933",
"parent":"Ag0UdDjMH",
"text":"",
"mid":"Ag4BRzFEQ",
"date":"2013-10-28 09:34:55"
},
{
"kids":[],
"uid":"3295643751",
"parent":"",
"text":"",
"mid":"Ag4A85nIl",
"date":"2013-10-28 09:30:38"
},
{
"kids":[],
"uid":"2753215303",
"parent":"",
"text":"没有合适不合适,感觉两情相悦就好。",
"mid":"Ag4u1x5Pg",
"date":"2013-10-28 09:15:37"
},
{
"kids":[],
"uid":"3285672742",
"parent":"",
"text":"互相偏爱!",
"mid":"Ag4skD5EM",
"date":"2013-10-28 09:11:25"
},
{
"kids":[],
"uid":"2804036232",
"parent":"Ag0Mo9mJz",
"text":"",
"mid":"Ag4rxftN0",
"date":"2013-10-28 09:09:29"
},
{
"kids":[],
"uid":"2565236355",
"parent":"",
"text":"@Bye______",
"mid":"Ag4r8aFwG",
"date":"2013-10-28 09:08:28"
},
{
"kids":[],
"uid":"2918319043",
"parent":"",
"text":"",
"mid":"Ag4lrjmV4",
"date":"2013-10-28 08:54:28"
},
{
"kids":[],
"uid":"1763663365",
"parent":"",
"text":"",
"mid":"Ag4jqltZ9",
"date":"2013-10-28 08:49:30"
},
{
"kids":[],
"uid":"lintingcao",
"parent":"",
"text":"",
"mid":"Ag4iizuyT",
"date":"2013-10-28 08:46:44"
},
{
"kids":[],
"uid":"3032571177",
"parent":"",
"text":"once",
"mid":"Ag4hDwcsI",
"date":"2013-10-28 08:45:06"
},
{
"kids":[],
"uid":"1969898377",
"parent":"",
"text":"",
"mid":"Ag4heaD01",
"date":"2013-10-28 08:44:05"
},
{
"kids":[],
"uid":"2809150932",
"parent":"",
"text":"",
"mid":"Ag47TwZYY",
"date":"2013-10-28 08:21:06"
},
{
"kids":[],
"uid":"3044632883",
"parent":"Ag3eTghrA",
"text":"",
"mid":"Ag45r3Kmf",
"date":"2013-10-28 08:15:01"
},
{
"kids":[],
"uid":"2803386192",
"parent":"Ag0UdDjMH",
"text":"",
"mid":"Ag44FcymN",
"date":"2013-10-28 08:13:07"
},
{
"kids":[],
"uid":"hxt1115",
"parent":"",
"text":"只有你能补全。。。",
"mid":"Ag44oDpCE",
"date":"2013-10-28 08:12:29"
},
{
"kids":[],
"uid":"2920284492",
"parent":"Ag1rG1dMX",
"text":"",
"mid":"Ag44fcdtT",
"date":"2013-10-28 08:12:05"
},
{
"kids":[],
"uid":"1226341755",
"parent":"Ag3ik53SU",
"text":"大姐,我似乎懂了。。",
"mid":"Ag448ojr0",
"date":"2013-10-28 08:11:50"
},
{
"kids":[],
"uid":"2919708370",
"parent":"Ag3iNiCHz",
"text":"",
"mid":"Ag42DBLgS",
"date":"2013-10-28 08:08:09"
},
{
"kids":[],
"uid":"3043861484",
"parent":"Ag0X67M2t",
"text":"",
"mid":"Ag41gv3x6",
"date":"2013-10-28 08:04:46"
},
{
"kids":[],
"uid":"2219198117",
"parent":"",
"text":"",
"mid":"Ag3YJls6k",
"date":"2013-10-28 07:58:32"
},
{
"kids":[],
"uid":"3046834024",
"parent":"",
"text":"",
"mid":"Ag3Y8p6C5",
"date":"2013-10-28 07:57:03"
},
{
"kids":[],
"uid":"2919697822",
"parent":"Ag1wmrfn3",
"text":"",
"mid":"Ag3XL2J7S",
"date":"2013-10-28 07:56:06"
},
{
"kids":[],
"uid":"3152920592",
"parent":"",
"text":"可他以后选择了偏爱别人",
"mid":"Ag3W27b4Y",
"date":"2013-10-28 07:51:53"
},
{
"kids":[],
"uid":"3100202965",
"parent":"",
"text":"",
"mid":"Ag3VlxNfy",
"date":"2013-10-28 07:50:10"
},
{
"kids":[],
"uid":"1583924084",
"parent":"Ag0NNByLe",
"text":"",
"mid":"Ag3ULsTnU",
"date":"2013-10-28 07:48:44"
},
{
"kids":[],
"uid":"3860686298",
"parent":"",
"text":"转发微博。",
"mid":"Ag3TGFHUS",
"date":"2013-10-28 07:46:06"
},
{
"kids":[],
"uid":"1815312182",
"parent":"",
"text":"",
"mid":"Ag3Tb6Dzh",
"date":"2013-10-28 07:44:49"
},
{
"kids":[],
"uid":"3097420710",
"parent":"",
"text":"",
"mid":"Ag3SCe0nC",
"date":"2013-10-28 07:43:26"
},
{
"kids":[],
"uid":"2838203800",
"parent":"",
"text":"",
"mid":"Ag3MMxSJ2",
"date":"2013-10-28 07:29:05"
},
{
"kids":[],
"uid":"1267849744",
"parent":"",
"text":"只因爱他",
"mid":"Ag3My2tx7",
"date":"2013-10-28 07:28:30"
},
{
"kids":[],
"uid":"2151338841",
"parent":"",
"text":"[巨蟹]",
"mid":"Ag3M3jC2N",
"date":"2013-10-28 07:27:16"
},
{
"kids":[],
"uid":"2436567225",
"parent":"",
"text":"",
"mid":"Ag3LK8aiH",
"date":"2013-10-28 07:26:31"
},
{
"kids":[],
"uid":"2657853450",
"parent":"",
"text":"",
"mid":"Ag3Jz2Wdz",
"date":"2013-10-28 07:21:09"
},
{
"kids":[],
"uid":"3195862423",
"parent":"",
"text":"精辟哦!",
"mid":"Ag3H329ay",
"date":"2013-10-28 07:14:57"
},
{
"kids":[
"AgOz722Fg"
],
"uid":"1982559335",
"parent":"",
"text":"",
"mid":"Ag3Gg1Suu",
"date":"2013-10-28 07:13:00"
},
{
"kids":[],
"uid":"3751677664",
"parent":"",
"text":"",
"mid":"Ag3FKElsU",
"date":"2013-10-28 07:11:46"
},
{
"kids":[],
"uid":"1885406644",
"parent":"",
"text":"",
"mid":"Ag3EKj8mJ",
"date":"2013-10-28 07:09:17"
},
{
"kids":[],
"uid":"2270719837",
"parent":"",
"text":"学校里,没有个喜欢的人,学习真心没有动力",
"mid":"Ag3ECDcRj",
"date":"2013-10-28 07:08:59"
},
{
"kids":[],
"uid":"1455938140",
"parent":"",
"text":"",
"mid":"Ag3E6s9hQ",
"date":"2013-10-28 07:07:41"
},
{
"kids":[],
"uid":"3297408271",
"parent":"",
"text":"",
"mid":"Ag3DWmB8O",
"date":"2013-10-28 07:07:17"
},
{
"kids":[],
"uid":"634520890",
"parent":"",
"text":"",
"mid":"Ag3CQpJhj",
"date":"2013-10-28 07:04:36"
},
{
"kids":[],
"uid":"1816302704",
"parent":"",
"text":"",
"mid":"Ag3C9B1y4",
"date":"2013-10-28 07:02:53"
},
{
"kids":[],
"uid":"1930820374",
"parent":"",
"text":"图片里的是什么",
"mid":"Ag3BGCQVb",
"date":"2013-10-28 07:01:45"
},
{
"kids":[],
"uid":"yangjuan1989",
"parent":"",
"text":"",
"mid":"Ag3BgAML2",
"date":"2013-10-28 07:00:43"
},
{
"kids":[],
"uid":"1921706262",
"parent":"",
"text":"说的太对了",
"mid":"Ag3ybr7N1",
"date":"2013-10-28 06:53:06"
},
{
"kids":[],
"uid":"3170971764",
"parent":"",
"text":"",
"mid":"Ag3xxxuP9",
"date":"2013-10-28 06:51:32"
},
{
"kids":[],
"uid":"3856420356",
"parent":"",
"text":"因为偏爱,所以一意孤行。没有理由,只因你灵魂缺失的一角只有他能补全。",
"mid":"Ag3wZgUst",
"date":"2013-10-28 06:50:10"
},
{
"kids":[],
"uid":"2427822647",
"parent":"",
"text":"",
"mid":"Ag3qJg8AU",
"date":"2013-10-28 06:34:45"
},
{
"kids":[],
"uid":"3262415581",
"parent":"",
"text":"说的很对的吧",
"mid":"Ag3ppaDSy",
"date":"2013-10-28 06:31:28"
},
{
"kids":[],
"uid":"3557832080",
"parent":"",
"text":"",
"mid":"Ag3mMBCxK",
"date":"2013-10-28 06:25:01"
},
{
"kids":[],
"uid":"zhuangyufeng",
"parent":"",
"text":"",
"mid":"Ag3m14co3",
"date":"2013-10-28 06:23:08"
},
{
"kids":[],
"uid":"3616619122",
"parent":"",
"text":"",
"mid":"Ag3lZ0Iya",
"date":"2013-10-28 06:23:03"
},
{
"kids":[],
"uid":"2328950850",
"parent":"",
"text":"",
"mid":"Ag3lOBdXP",
"date":"2013-10-28 06:22:39"
},
{
"kids":[],
"uid":"3209568020",
"parent":"",
"text":"",
"mid":"Ag3lD7UdM",
"date":"2013-10-28 06:22:10"
},
{
"kids":[],
"uid":"1575122057",
"parent":"",
"text":"",
"mid":"Ag3l093H3",
"date":"2013-10-28 06:20:38"
},
{
"kids":[
"Ag4WGAK30",
"Ag42DBLgS"
],
"uid":"3550894105",
"parent":"",
"text":"",
"mid":"Ag3iNiCHz",
"date":"2013-10-28 06:15:11"
},
{
"kids":[
"Ag448ojr0"
],
"uid":"3732443492",
"parent":"",
"text":"",
"mid":"Ag3ik53SU",
"date":"2013-10-28 06:14:02"
},
{
"kids":[],
"uid":"2835785424",
"parent":"",
"text":"",
"mid":"Ag3guhG5o",
"date":"2013-10-28 06:09:30"
},
{
"kids":[],
"uid":"3636562722",
"parent":"",
"text":"",
"mid":"Ag3fpepjs",
"date":"2013-10-28 06:06:50"
},
{
"kids":[
"Ag45r3Kmf"
],
"uid":"2785608074",
"parent":"",
"text":"灵魂缺脚",
"mid":"Ag3eTghrA",
"date":"2013-10-28 06:05:35"
},
{
"kids":[],
"uid":"3826687130",
"parent":"",
"text":"捕梦网吗",
"mid":"Ag3eus8ip",
"date":"2013-10-28 06:04:35"
},
{
"kids":[],
"uid":"2711886364",
"parent":"",
"text":"",
"mid":"Ag3b7hAHZ",
"date":"2013-10-28 05:56:17"
},
{
"kids":[],
"uid":"2833145113",
"parent":"",
"text":"[做鬼脸]",
"mid":"Ag35v9BAY",
"date":"2013-10-28 05:42:27"
},
{
"kids":[],
"uid":"2071937827",
"parent":"",
"text":"",
"mid":"Ag2RAjyTn",
"date":"2013-10-28 05:08:10"
},
{
"kids":[],
"uid":"638174012",
"parent":"",
"text":"",
"mid":"Ag2Rmqbz4",
"date":"2013-10-28 05:07:37"
},
{
"kids":[
"Ag5lBrc5J"
],
"uid":"1765189154",
"parent":"",
"text":"",
"mid":"Ag2KeofuW",
"date":"2013-10-28 04:50:03"
},
{
"kids":[],
"uid":"3851822857",
"parent":"",
"text":"[晕]",
"mid":"Ag2D4wNKc",
"date":"2013-10-28 04:32:25"
},
{
"kids":[],
"uid":"2654251347",
"parent":"",
"text":"@青少年思维很跳跃 写的真好[嘻嘻]",
"mid":"Ag2D12wwb",
"date":"2013-10-28 04:32:16"
},
{
"kids":[],
"uid":"3767345332",
"parent":"",
"text":"偏爱,一意孤行。",
"mid":"Ag2CHv1Qy",
"date":"2013-10-28 04:31:29"
},
{
"kids":[],
"uid":"638212358",
"parent":"",
"text":"[伤心]",
"mid":"Ag2Ck8Wb7",
"date":"2013-10-28 04:30:34"
},
{
"kids":[],
"uid":"601567412",
"parent":"",
"text":"",
"mid":"Ag2AJsmC3",
"date":"2013-10-28 04:26:39"
},
{
"kids":[],
"uid":"3480117264",
"parent":"",
"text":"",
"mid":"Ag2zj5Fms",
"date":"2013-10-28 04:23:08"
},
{
"kids":[],
"uid":"600126116",
"parent":"",
"text":"",
"mid":"Ag2yYooZ8",
"date":"2013-10-28 04:22:19"
},
{
"kids":[],
"uid":"3167884344",
"parent":"",
"text":"",
"mid":"Ag2wlA0T8",
"date":"2013-10-28 04:15:51"
},
{
"kids":[],
"uid":"2076282060",
"parent":"",
"text":"",
"mid":"Ag2wllBSZ",
"date":"2013-10-28 04:15:50"
},
{
"kids":[],
"uid":"1891735594",
"parent":"",
"text":"可能吧",
"mid":"Ag2vcEHyS",
"date":"2013-10-28 04:13:02"
},
{
"kids":[],
"uid":"3131748663",
"parent":"",
"text":"",
"mid":"Ag2uKC77j",
"date":"2013-10-28 04:11:55"
},
{
"kids":[],
"uid":"2491664285",
"parent":"",
"text":"听到鸡鸣了,接着睡。[瞌睡]",
"mid":"Ag2qbh407",
"date":"2013-10-28 04:00:39"
},
{
"kids":[],
"uid":"2368943671",
"parent":"",
"text":"",
"mid":"Ag2j7k6hc",
"date":"2013-10-28 03:43:15"
},
{
"kids":[],
"uid":"729217567",
"parent":"",
"text":"[哈哈]",
"mid":"Ag2gHbNoh",
"date":"2013-10-28 03:37:17"
},
{
"kids":[],
"uid":"3395582414",
"parent":"",
"text":"",
"mid":"Ag2cOElAA",
"date":"2013-10-28 03:27:44"
},
{
"kids":[],
"uid":"2690834692",
"parent":"",
"text":"",
"mid":"Ag2bFrsX8",
"date":"2013-10-28 03:24:54"
},
{
"kids":[],
"uid":"634526516",
"parent":"",
"text":"[疑问]",
"mid":"Ag2bl4fMM",
"date":"2013-10-28 03:24:05"
},
{
"kids":[],
"uid":"3198284360",
"parent":"",
"text":"",
"mid":"Ag2aL1c9n",
"date":"2013-10-28 03:22:39"
},
{
"kids":[],
"uid":"2833260874",
"parent":"",
"text":"",
"mid":"Ag2aqmS7u",
"date":"2013-10-28 03:21:50"
},
{
"kids":[],
"uid":"aizz512",
"parent":"",
"text":"",
"mid":"Ag1UhtvJh",
"date":"2013-10-28 02:42:04"
},
{
"kids":[],
"uid":"hignking",
"parent":"Ag0TX36xr",
"text":"",
"mid":"Ag1Udlm4k",
"date":"2013-10-28 02:41:54"
},
{
"kids":[],
"uid":"2801749731",
"parent":"",
"text":"愿捕梦网带给今晚好梦~",
"mid":"Ag1Pqrg7z",
"date":"2013-10-28 02:30:05"
},
{
"kids":[],
"uid":"2313359734",
"parent":"",
"text":"[哈哈]",
"mid":"Ag1NlAmVF",
"date":"2013-10-28 02:24:59"
},
{
"kids":[],
"uid":"721947896",
"parent":"",
"text":"",
"mid":"Ag1Mxjok1",
"date":"2013-10-28 02:22:59"
},
{
"kids":[],
"uid":"2693688295",
"parent":"",
"text":"",
"mid":"Ag1FndYzI",
"date":"2013-10-28 02:05:20"
},
{
"kids":[],
"uid":"emonaiwei",
"parent":"",
"text":"你值得偏爱的地方是你的纯良,你值得抱怨的地方也是你太过纯良了。",
"mid":"Ag1DJAM95",
"date":"2013-10-28 02:01:18"
},
{
"kids":[],
"uid":"1359877125",
"parent":"",
"text":"",
"mid":"Ag1z6EhiF",
"date":"2013-10-28 01:49:54"
},
{
"kids":[],
"uid":"1365724793",
"parent":"",
"text":"[泪]",
"mid":"Ag1yoj79X",
"date":"2013-10-28 01:48:08"
},
{
"kids":[],
"uid":"3122328204",
"parent":"",
"text":"",
"mid":"Ag1xs9xwR",
"date":"2013-10-28 01:45:49"
},
{
"kids":[
"AggwH7B29",
"Agf0ttGlS",
"Ag3XL2J7S"
],
"uid":"2412004290",
"parent":"",
"text":"",
"mid":"Ag1wmrfn3",
"date":"2013-10-28 01:43:08"
},
{
"kids":[],
"uid":"iamyaolan",
"parent":"",
"text":"偏爱而已",
"mid":"Ag1urFtc4",
"date":"2013-10-28 01:38:25"
},
{
"kids":[],
"uid":"3386431264",
"parent":"",
"text":"",
"mid":"Ag1sUwm43",
"date":"2013-10-28 01:34:37"
},
{
"kids":[],
"uid":"1960666081",
"parent":"",
"text":"什么叫合适的人",
"mid":"Ag1sbiay7",
"date":"2013-10-28 01:32:50"
},
{
"kids":[
"AgMNOuTa6",
"Ag44fcdtT"
],
"uid":"3203465594",
"parent":"",
"text":"",
"mid":"Ag1rG1dMX",
"date":"2013-10-28 01:31:34"
},
{
"kids":[],
"uid":"1781214391",
"parent":"",
"text":"",
"mid":"Ag1pu5LlS",
"date":"2013-10-28 01:26:11"
},
{
"kids":[],
"uid":"2838572752",
"parent":"",
"text":"",
"mid":"Ag1mWvVUr",
"date":"2013-10-28 01:19:56"
},
{
"kids":[],
"uid":"1321596545",
"parent":"",
"text":"",
"mid":"Ag1mSruuP",
"date":"2013-10-28 01:19:45"
},
{
"kids":[],
"uid":"3242445015",
"parent":"",
"text":"",
"mid":"Ag1mzbo8z",
"date":"2013-10-28 01:18:59"
},
{
"kids":[],
"uid":"2069414285",
"parent":"",
"text":"",
"mid":"Ag1m52Xi9",
"date":"2013-10-28 01:17:48"
},
{
"kids":[],
"uid":"1765317573",
"parent":"",
"text":"@YuVi-hu就是四月啊 这句话形容我再合适不过了",
"mid":"Ag1lowomK",
"date":"2013-10-28 01:16:07"
},
{
"kids":[],
"uid":"2120270544",
"parent":"",
"text":"",
"mid":"Ag1ldz8jY",
"date":"2013-10-28 01:15:41"
},
{
"kids":[],
"uid":"1848848612",
"parent":"",
"text":"[围观]",
"mid":"Ag1hAoa2H",
"date":"2013-10-28 01:06:44"
},
{
"kids":[],
"uid":"2978585351",
"parent":"",
"text":"",
"mid":"Ag1hwzcEN",
"date":"2013-10-28 01:06:35"
},
{
"kids":[],
"uid":"3300377694",
"parent":"",
"text":"",
"mid":"Ag1gs4sPs",
"date":"2013-10-28 01:03:56"
},
{
"kids":[],
"uid":"1968375673",
"parent":"",
"text":"安!",
"mid":"Ag1eP0IHe",
"date":"2013-10-28 00:59:55"
},
{
"kids":[],
"uid":"2684164297",
"parent":"",
"text":"",
"mid":"Ag1crzXD0",
"date":"2013-10-28 00:54:03"
},
{
"kids":[],
"uid":"HJP1688",
"parent":"",
"text":"你那么坏我那么好[思考]",
"mid":"Ag1ayzHKA",
"date":"2013-10-28 00:49:26"
},
{
"kids":[],
"uid":"2371321315",
"parent":"",
"text":"",
"mid":"Ag1a9bBG1",
"date":"2013-10-28 00:48:24"
},
{
"kids":[],
"uid":"3227458484",
"parent":"",
"text":"嗯嗯!希望有一个这样的他",
"mid":"Ag1a6vjHP",
"date":"2013-10-28 00:48:16"
},
{
"kids":[],
"uid":"dengxiadelingdang",
"parent":"",
"text":"",
"mid":"Ag19X4Hcw",
"date":"2013-10-28 00:47:55"
},
{
"kids":[],
"uid":"fenghuangshifeng",
"parent":"",
"text":"任何妹子,如果你深爱一个人,但那个人却抛弃了你,事实也证明了他不值得你爱。那么请记住,不要说这是真爱,真正的问题在于:一、你心理还不够成熟;二、你智商不够高。这两点使你无法认清真相,而只是迷失在自己的一厢情愿中。各方面努力提高自己,你才能找到真正的真爱,否则你永远只是爱情的奴隶。",
"mid":"Ag19Jq1fm",
"date":"2013-10-28 00:47:23"
},
{
"kids":[],
"uid":"1793947181",
"parent":"",
"text":"",
"mid":"Ag192hv0X",
"date":"2013-10-28 00:45:40"
},
{
"kids":[],
"uid":"2712456182",
"parent":"",
"text":"",
"mid":"Ag19226g3",
"date":"2013-10-28 00:45:37"
},
{
"kids":[],
"uid":"litao908",
"parent":"",
"text":"",
"mid":"Ag18hDMhD",
"date":"2013-10-28 00:43:49"
},
{
"kids":[],
"uid":"sweetrose",
"parent":"",
"text":"[泪][泪]最后一句走心了",
"mid":"Ag17ejpuJ",
"date":"2013-10-28 00:41:13"
},
{
"kids":[],
"uid":"3216966345",
"parent":"",
"text":"",
"mid":"Ag17652TJ",
"date":"2013-10-28 00:40:53"
},
{
"kids":[],
"uid":"3208352480",
"parent":"",
"text":"",
"mid":"Ag16StfhL",
"date":"2013-10-28 00:40:20"
},
{
"kids":[],
"uid":"3631070767",
"parent":"",
"text":"爱,不解释",
"mid":"Ag16yFby5",
"date":"2013-10-28 00:39:33"
},
{
"kids":[],
"uid":"3125402425",
"parent":"",
"text":"",
"mid":"Ag16mygv3",
"date":"2013-10-28 00:39:05"
},
{
"kids":[],
"uid":"1252434795",
"parent":"",
"text":"",
"mid":"Ag15x8D4T",
"date":"2013-10-28 00:37:02"
},
{
"kids":[],
"uid":"2532525787",
"parent":"",
"text":"",
"mid":"Ag1578VB1",
"date":"2013-10-28 00:36:00"
},
{
"kids":[],
"uid":"3200926081",
"parent":"",
"text":"",
"mid":"Ag14JtEhj",
"date":"2013-10-28 00:35:04"
},
{
"kids":[],
"uid":"2665103965",
"parent":"",
"text":"",
"mid":"Ag14tc91c",
"date":"2013-10-28 00:34:25"
},
{
"kids":[],
"uid":"1474232742",
"parent":"",
"text":"",
"mid":"Ag13ybMxU",
"date":"2013-10-28 00:32:10"
},
{
"kids":[],
"uid":"3105313693",
"parent":"",
"text":"因为偏爱",
"mid":"Ag130cgdz",
"date":"2013-10-28 00:30:45"
},
{
"kids":[],
"uid":"2447795952",
"parent":"",
"text":"所以会感觉累。",
"mid":"Ag12quc51",
"date":"2013-10-28 00:29:23"
},
{
"kids":[],
"uid":"3285076230",
"parent":"",
"text":"",
"mid":"Ag12m2CK6",
"date":"2013-10-28 00:29:09"
},
{
"kids":[],
"uid":"willowmin",
"parent":"",
"text":"[玫瑰]",
"mid":"Ag11samQ6",
"date":"2013-10-28 00:27:00"
},
{
"kids":[],
"uid":"1812068591",
"parent":"",
"text":"哎",
"mid":"Ag11dEPQQ",
"date":"2013-10-28 00:26:25"
},
{
"kids":[],
"uid":"1870853980",
"parent":"",
"text":"不错",
"mid":"Ag10Rxh2G",
"date":"2013-10-28 00:25:32"
},
{
"kids":[],
"uid":"1720798567",
"parent":"",
"text":"说得好矫情",
"mid":"Ag10d3QJx",
"date":"2013-10-28 00:23:55"
},
{
"kids":[],
"uid":"QQ1249879459",
"parent":"",
"text":"",
"mid":"Ag10bzfVz",
"date":"2013-10-28 00:23:48"
},
{
"kids":[],
"uid":"1672617355",
"parent":"",
"text":"",
"mid":"Ag0Zs4GEs",
"date":"2013-10-28 00:22:03"
},
{
"kids":[],
"uid":"110104860",
"parent":"",
"text":"",
"mid":"Ag0ZruRlM",
"date":"2013-10-28 00:22:02"
},
{
"kids":[],
"uid":"2946240153",
"parent":"",
"text":"",
"mid":"Ag0Z80K5K",
"date":"2013-10-28 00:21:12"
},
{
"kids":[],
"uid":"3216034484",
"parent":"",
"text":"[爱心传递]",
"mid":"Ag0YS4h3N",
"date":"2013-10-28 00:20:34"
},
{
"kids":[],
"uid":"2976562627",
"parent":"",
"text":"",
"mid":"Ag0YAzYsi",
"date":"2013-10-28 00:19:54"
},
{
"kids":[],
"uid":"3155842667",
"parent":"",
"text":"",
"mid":"Ag0YjbN4V",
"date":"2013-10-28 00:19:14"
},
{
"kids":[],
"uid":"3088635704",
"parent":"",
"text":"",
"mid":"Ag0Y4ojQU",
"date":"2013-10-28 00:18:39"
},
{
"kids":[],
"uid":"1202434215",
"parent":"",
"text":"轉發微博",
"mid":"Ag0XQtiwK",
"date":"2013-10-28 00:18:06"
},
{
"kids":[],
"uid":"3158125545",
"parent":"",
"text":"",
"mid":"Ag0XzE14j",
"date":"2013-10-28 00:17:26"
},
{
"kids":[
"Ag41gv3x6"
],
"uid":"zhangchao234",
"parent":"",
"text":"晚安[可爱]",
"mid":"Ag0X67M2t",
"date":"2013-10-28 00:16:13"
},
{
"kids":[],
"uid":"3208836713",
"parent":"",
"text":"偏执的爱了你好多年",
"mid":"Ag0X0ebpA",
"date":"2013-10-28 00:16:01"
},
{
"kids":[],
"uid":"209801515",
"parent":"",
"text":"",
"mid":"Ag0W12RYo",
"date":"2013-10-28 00:13:33"
},
{
"kids":[],
"uid":"2658625151",
"parent":"",
"text":"好像一股电流激过,夜半灵魂又出窍了",
"mid":"Ag0VWyg5t",
"date":"2013-10-28 00:13:23"
},
{
"kids":[],
"uid":"3092297913",
"parent":"",
"text":"",
"mid":"Ag0VKtEnv",
"date":"2013-10-28 00:12:54"
},
{
"kids":[],
"uid":"3514873641",
"parent":"",
"text":"",
"mid":"Ag0UTz8Zf",
"date":"2013-10-28 00:10:50"
},
{
"kids":[],
"uid":"3131638757",
"parent":"",
"text":"",
"mid":"Ag0UOzVH9",
"date":"2013-10-28 00:10:37"
},
{
"kids":[],
"uid":"1785987082",
"parent":"",
"text":"",
"mid":"Ag0UBhhv2",
"date":"2013-10-28 00:10:06"
},
{
"kids":[],
"uid":"1903449495",
"parent":"",
"text":"说得很对啊",
"mid":"Ag0Ut0SY9",
"date":"2013-10-28 00:09:44"
},
{
"kids":[],
"uid":"2825142755",
"parent":"",
"text":"晚安[爱你]",
"mid":"Ag0Ujer8O",
"date":"2013-10-28 00:09:23"
},
{
"kids":[],
"uid":"533194564",
"parent":"",
"text":"goodnight",
"mid":"Ag0Uebq1q",
"date":"2013-10-28 00:09:11"
},
{
"kids":[
"AgPhQv5Ho",
"AgP1NhnVN",
"AgwyWyaHX",
"AgwdCvTmc",
"Ag4BRzFEQ",
"Ag44FcymN"
],
"uid":"3875168195",
"parent":"",
"text":"乖",
"mid":"Ag0UdDjMH",
"date":"2013-10-28 00:09:08"
},
{
"kids":[],
"uid":"ccpcly",
"parent":"",
"text":"",
"mid":"Ag0UdBo1O",
"date":"2013-10-28 00:09:10"
},
{
"kids":[],
"uid":"2370253824",
"parent":"",
"text":"",
"mid":"Ag0U3AqSb",
"date":"2013-10-28 00:08:44"
},
{
"kids":[],
"uid":"2199511603",
"parent":"",
"text":"",
"mid":"Ag0TYhodP",
"date":"2013-10-28 00:08:33"
},
{
"kids":[
"Ag1Udlm4k"
],
"uid":"china20141111",
"parent":"",
"text":"呵呵 [雪人]",
"mid":"Ag0TX36xr",
"date":"2013-10-28 00:08:28"
},
{
"kids":[],
"uid":"2448983230",
"parent":"",
"text":"说的真好~",
"mid":"Ag0TNkrgL",
"date":"2013-10-28 00:08:04"
},
{
"kids":[
"Ag4UtbDzc"
],
"uid":"2671691922",
"parent":"",
"text":"",
"mid":"Ag0TC5PEv",
"date":"2013-10-28 00:07:40"
},
{
"kids":[],
"uid":"2414541770",
"parent":"",
"text":"",
"mid":"Ag0T46hPw",
"date":"2013-10-28 00:06:18"
},
{
"kids":[],
"uid":"2430263904",
"parent":"",
"text":"",
"mid":"Ag0SOaWV5",
"date":"2013-10-28 00:05:40"
},
{
"kids":[],
"uid":"2114246597",
"parent":"",
"text":"",
"mid":"Ag0SDuQXg",
"date":"2013-10-28 00:05:16"
},
{
"kids":[],
"uid":"3269172652",
"parent":"",
"text":"",
"mid":"Ag0Sr7PCf",
"date":"2013-10-28 00:04:44"
},
{
"kids":[],
"uid":"2652058503",
"parent":"",
"text":"也许吧,感情的事就是这么奇妙……",
"mid":"Ag0Sfjizy",
"date":"2013-10-28 00:04:19"
},
{
"kids":[],
"uid":"2152975125",
"parent":"",
"text":"",
"mid":"Ag0S0ciSd",
"date":"2013-10-28 00:03:42"
},
{
"kids":[],
"uid":"2693979295",
"parent":"",
"text":"",
"mid":"Ag0RIslsl",
"date":"2013-10-28 00:03:00"
},
{
"kids":[],
"uid":"2895806887",
"parent":"",
"text":"人就是这么奇怪,,好吧,晚安!",
"mid":"Ag0Rto7d7",
"date":"2013-10-28 00:02:24"
},
{
"kids":[],
"uid":"1864765525",
"parent":"",
"text":"",
"mid":"Ag0Rg8ZYe",
"date":"2013-10-28 00:01:52"
},
{
"kids":[],
"uid":"3148712702",
"parent":"",
"text":"",
"mid":"Ag0R90Sww",
"date":"2013-10-28 00:01:35"
},
{
"kids":[],
"uid":"2952084924",
"parent":"",
"text":"",
"mid":"Ag0R6FkuO",
"date":"2013-10-28 00:01:30"
},
{
"kids":[],
"uid":"3550520560",
"parent":"",
"text":"",
"mid":"Ag0QUxrYB",
"date":"2013-10-28 00:01:00"
},
{
"kids":[],
"uid":"2090702171",
"parent":"",
"text":"梦的网。",
"mid":"Ag0QRjpKE",
"date":"2013-10-28 00:00:51"
},
{
"kids":[],
"uid":"2122679012",
"parent":"",
"text":"没有理由。",
"mid":"Ag0QOm4Yo",
"date":"2013-10-28 00:00:44"
},
{
"kids":[],
"uid":"2573826180",
"parent":"",
"text":"",
"mid":"Ag0QwlirM",
"date":"2013-10-28 00:00:01"
},
{
"kids":[],
"uid":"1747503561",
"parent":"",
"text":"晚安[爱你][爱你][爱你][爱你][爱你]",
"mid":"Ag0QoCx24",
"date":"2013-10-27 23:59:45"
},
{
"kids":[],
"uid":"2097206943",
"parent":"",
"text":"人这一生总会爱上那么一个人,他可能并没有多好,你只是刚好就喜欢那几分好。他的一分关心让你放弃了十分的甜言蜜语,一分坦诚放弃十分信誓旦旦,再加一分在意便像让你得了全世界。这叫偏爱。因为偏爱,所以一意孤行。没有理由,只因你灵魂缺失的一角只有他能补全",
"mid":"Ag0Qj1VCY",
"date":"2013-10-27 23:59:28"
},
{
"kids":[],
"uid":"207292567",
"parent":"Ag0OMcIV0",
"text":"哎呀呀!不自觉想@ 某人了",
"mid":"Ag0Qir0t8",
"date":"2013-10-27 23:59:29"
},
{
"kids":[],
"uid":"2550486247",
"parent":"",
"text":"",
"mid":"Ag0QbCoZF",
"date":"2013-10-27 23:59:13"
},
{
"kids":[],
"uid":"3059224255",
"parent":"",
"text":"……",
"mid":"Ag0POA2OZ",
"date":"2013-10-27 23:58:19"
},
{
"kids":[],
"uid":"2197389930",
"parent":"",
"text":"",
"mid":"Ag0PNpcoN",
"date":"2013-10-27 23:58:14"
},
{
"kids":[],
"uid":"2662067341",
"parent":"",
"text":"晚安~",
"mid":"Ag0PMfe2k",
"date":"2013-10-27 23:58:11"
},
{
"kids":[],
"uid":"3869011293",
"parent":"",
"text":"",
"mid":"Ag0PBg8zc",
"date":"2013-10-27 23:57:49"
},
{
"kids":[],
"uid":"2848438727",
"parent":"",
"text":"捕梦网",
"mid":"Ag0PyCwlq",
"date":"2013-10-27 23:57:40"
},
{
"kids":[],
"uid":"1827338250",
"parent":"",
"text":"",
"mid":"Ag0Pp9fsy",
"date":"2013-10-27 23:57:17"
},
{
"kids":[],
"uid":"3306256457",
"parent":"",
"text":"转发微博。",
"mid":"Ag0PlkJ3n",
"date":"2013-10-27 23:57:07"
},
{
"kids":[],
"uid":"3300365975",
"parent":"",
"text":"",
"mid":"Ag0PefcTg",
"date":"2013-10-27 23:56:52"
},
{
"kids":[],
"uid":"2281134562",
"parent":"",
"text":"",
"mid":"Ag0P8A9z4",
"date":"2013-10-27 23:56:38"
},
{
"kids":[],
"uid":"1862078062",
"parent":"",
"text":"",
"mid":"Ag0OXpxjg",
"date":"2013-10-27 23:56:12"
},
{
"kids":[],
"uid":"2339775594",
"parent":"",
"text":"",
"mid":"Ag0OP9axc",
"date":"2013-10-27 23:55:53"
},
{
"kids":[],
"uid":"snailking",
"parent":"",
"text":"因为偏爱,所以一意孤行。",
"mid":"Ag0ONFaJV",
"date":"2013-10-27 23:55:49"
},
{
"kids":[
"Ag0Qir0t8"
],
"uid":"1846847220",
"parent":"",
"text":"扬子晚报你恋爱了咩?你肿么了!",
"mid":"Ag0OMcIV0",
"date":"2013-10-27 23:55:45"
},
{
"kids":[],
"uid":"2678413771",
"parent":"",
"text":"偏爱[思考][思考][思考]",
"mid":"Ag0OIDKiP",
"date":"2013-10-27 23:55:36"
},
{
"kids":[],
"uid":"2702933504",
"parent":"",
"text":"转发微博。",
"mid":"Ag0OwvTYS",
"date":"2013-10-27 23:55:08"
},
{
"kids":[],
"uid":"3257358491",
"parent":"",
"text":"",
"mid":"Ag0OwsZTH",
"date":"2013-10-27 23:55:09"
},
{
"kids":[],
"uid":"271811009",
"parent":"",
"text":"",
"mid":"Ag0OtgXx8",
"date":"2013-10-27 23:54:57"
},
{
"kids":[],
"uid":"2750713212",
"parent":"",
"text":"",
"mid":"Ag0Op9FTT",
"date":"2013-10-27 23:54:49"
},
{
"kids":[],
"uid":"water19899",
"parent":"",
"text":"我在等你吖!不是我的灵魂缺了一角,而是你使我的灵魂更美好!",
"mid":"Ag0OfkHH0",
"date":"2013-10-27 23:54:28"
},
{
"kids":[],
"uid":"2100514744",
"parent":"",
"text":"",
"mid":"Ag0O8gONe",
"date":"2013-10-27 23:54:11"
},
{
"kids":[],
"uid":"3090329874",
"parent":"",
"text":"",
"mid":"Ag0O5B5Yj",
"date":"2013-10-27 23:54:05"
},
{
"kids":[],
"uid":"1896887601",
"parent":"",
"text":"",
"mid":"Ag0O2FPPY",
"date":"2013-10-27 23:53:55"
},
{
"kids":[
"Ah8fkDsq1",
"AgeMKb5iy",
"Ag58GE3QP",
"Ag4P2k5A9"
],
"uid":"2179819463",
"parent":"",
"text":"",
"mid":"Ag0O0jePU",
"date":"2013-10-27 23:53:51"
},
{
"kids":[
"Ag4M61fGb",
"Ag3ULsTnU"
],
"uid":"3854606027",
"parent":"",
"text":"",
"mid":"Ag0NNByLe",
"date":"2013-10-27 23:53:22"
},
{
"kids":[],
"uid":"532078950",
"parent":"",
"text":"",
"mid":"Ag0Nn13El",
"date":"2013-10-27 23:52:15"
},
{
"kids":[],
"uid":"2306470411",
"parent":"",
"text":"",
"mid":"Ag0Nk3IFB",
"date":"2013-10-27 23:52:10"
},
{
"kids":[],
"uid":"3517127160",
"parent":"",
"text":"",
"mid":"Ag0NjsZNm",
"date":"2013-10-27 23:52:09"
},
{
"kids":[],
"uid":"2929664743",
"parent":"",
"text":"",
"mid":"Ag0N2269j",
"date":"2013-10-27 23:51:25"
},
{
"kids":[],
"uid":"3118970537",
"parent":"",
"text":"晚安[爱你][爱你]",
"mid":"Ag0MOsi7o",
"date":"2013-10-27 23:50:55"
},
{
"kids":[],
"uid":"2461940913",
"parent":"",
"text":"",
"mid":"Ag0Mvwutr",
"date":"2013-10-27 23:50:10"
},
{
"kids":[],
"uid":"2203986652",
"parent":"",
"text":"",
"mid":"Ag0MrE8hk",
"date":"2013-10-27 23:50:02"
},
{
"kids":[],
"uid":"2715241763",
"parent":"",
"text":"偏爱",
"mid":"Ag0Mp0QN2",
"date":"2013-10-27 23:49:53"
},
{
"kids":[
"AklBAfXF2",
"Akk8AquGq",
"AkjCugmRC",
"Ajz92w1Qj",
"Ajq2AvyVo",
"AjpKylarY",
"AiFEXeZcH",
"AiElKmu3n",
"AiAA3cmoY",
"AgZ36dCmC",
"AgQwAdpuP",
"AgPcZESmJ",
"Ag4rxftN0"
],
"uid":"3203358303",
"parent":"",
"text":"",
"mid":"Ag0Mo9mJz",
"date":"2013-10-27 23:49:53"
},
{
"kids":[],
"uid":"3851443415",
"parent":"",
"text":"",
"mid":"Ag0MhjIYc",
"date":"2013-10-27 23:49:36"
},
{
"kids":[],
"uid":"1640314480",
"parent":"",
"text":"",
"mid":"Ag0Mfhmgm",
"date":"2013-10-27 23:49:28"
},
{
"kids":[],
"uid":"2716423491",
"parent":"",
"text":"",
"mid":"Ag0MbqMez",
"date":"2013-10-27 23:49:20"
},
{
"kids":[],
"uid":"2964268363",
"parent":"",
"text":"没有合适不合适,感觉两情相悦就好。",
"mid":"Ag0LWE5Gh",
"date":"2013-10-27 23:48:47"
},
{
"kids":[],
"uid":"3115161577",
"parent":"",
"text":"",
"mid":"Ag0LUxSCf",
"date":"2013-10-27 23:48:41"
},
{
"kids":[],
"uid":"2261892734",
"parent":"",
"text":"",
"mid":"Ag0LLqo49",
"date":"2013-10-27 23:48:17"
},
{
"kids":[],
"uid":"2791868872",
"parent":"",
"text":"",
"mid":"Ag0LD8und",
"date":"2013-10-27 23:48:01"
},
{
"kids":[],
"uid":"3137880231",
"parent":"",
"text":"@盛开",
"mid":"Ag0LvqReS",
"date":"2013-10-27 23:47:42"
},
{
"kids":[],
"uid":"2516560140",
"parent":"",
"text":"对于感情我总是那么偏爱,晚安。。。",
"mid":"Ag0Lqps9b",
"date":"2013-10-27 23:47:30"
},
{
"kids":[],
"uid":"yunqinxuan",
"parent":"",
"text":"骗爱[汗]",
"mid":"Ag0LndrHj",
"date":"2013-10-27 23:47:20"
},
{
"kids":[],
"uid":"chinaxiaodong",
"parent":"",
"text":"",
"mid":"Ag0LlqXm5",
"date":"2013-10-27 23:47:18"
},
{
"kids":[],
"uid":"yudatears",
"parent":"",
"text":"",
"mid":"Ag0Lg6XMx",
"date":"2013-10-27 23:47:06"
},
{
"kids":[],
"uid":"2612047281",
"parent":"",
"text":"",
"mid":"Ag0L3pkPQ",
"date":"2013-10-27 23:46:33"
},
{
"kids":[],
"uid":"3292206551",
"parent":"",
"text":"",
"mid":"Ag0KJAfrc",
"date":"2013-10-27 23:45:48"
},
{
"kids":[],
"uid":"1810888654",
"parent":"Ag0JCsa86",
"text":"偏爱!",
"mid":"Ag0KzeAzo",
"date":"2013-10-27 23:45:23"
},
{
"kids":[],
"uid":"2679673223",
"parent":"",
"text":"",
"mid":"Ag0KtCHXw",
"date":"2013-10-27 23:45:08"
},
{
"kids":[],
"uid":"5201315wo",
"parent":"",
"text":"",
"mid":"Ag0KolKUD",
"date":"2013-10-27 23:44:57"
},
{
"kids":[
"Ah36jlPc8"
],
"uid":"1928202680",
"parent":"",
"text":"",
"mid":"Ag0KgEAPY",
"date":"2013-10-27 23:44:39"
},
{
"kids":[],
"uid":"3226632651",
"parent":"",
"text":"waiting~~~though you are not in my weibo。。。。。",
"mid":"Ag0Kb0izr",
"date":"2013-10-27 23:44:23"
},
{
"kids":[],
"uid":"2120990187",
"parent":"Ag0IkmRtU",
"text":"",
"mid":"Ag0K4f3tQ",
"date":"2013-10-27 23:44:09"
},
{
"kids":[],
"uid":"2035425474",
"parent":"",
"text":"",
"mid":"Ag0JWhh89",
"date":"2013-10-27 23:43:50"
},
{
"kids":[],
"uid":"2069037685",
"parent":"",
"text":"他可能并没有多好,你只是刚好就喜欢那几分好。",
"mid":"Ag0JWghFD",
"date":"2013-10-27 23:43:47"
},
{
"kids":[],
"uid":"pianpian2010",
"parent":"",
"text":"@Dec-长庚 可以早睡早起啦呀",
"mid":"Ag0JPbKTN",
"date":"2013-10-27 23:43:30"
},
{
"kids":[],
"uid":"2190404505",
"parent":"",
"text":"晚安",
"mid":"Ag0JMdqmJ",
"date":"2013-10-27 23:43:25"
},
{
"kids":[],
"uid":"3831047287",
"parent":"",
"text":"",
"mid":"Ag0JLCMc6",
"date":"2013-10-27 23:43:25"
},
{
"kids":[],
"uid":"2621607055",
"parent":"",
"text":"[爱你][爱你]",
"mid":"Ag0JLBMww",
"date":"2013-10-27 23:43:25"
},
{
"kids":[],
"uid":"3105262814",
"parent":"",
"text":"直切神经末梢",
"mid":"Ag0JKrVGs",
"date":"2013-10-27 23:43:22"
},
{
"kids":[],
"uid":"2987543492",
"parent":"",
"text":"",
"mid":"Ag0JJh5eS",
"date":"2013-10-27 23:43:19"
},
{
"kids":[],
"uid":"3606929217",
"parent":"",
"text":"",
"mid":"Ag0JHbZBa",
"date":"2013-10-27 23:43:12"
},
{
"kids":[],
"uid":"3404698532",
"parent":"",
"text":"@我家妞亲 爱你 [爱心]",
"mid":"Ag0JEwfUN",
"date":"2013-10-27 23:43:05"
},
{
"kids":[
"Ag0KzeAzo"
],
"uid":"3732554155",
"parent":"",
"text":"有陆雪琪的三分偏执就足够了。",
"mid":"Ag0JCsa86",
"date":"2013-10-27 23:43:02"
},
{
"kids":[],
"uid":"1082785730",
"parent":"",
"text":"",
"mid":"Ag0Js8HF7",
"date":"2013-10-27 23:42:38"
},
{
"kids":[],
"uid":"2941915121",
"parent":"",
"text":"额,就算是偏爱也得是彼此倾心吧~",
"mid":"Ag0Jn6gYZ",
"date":"2013-10-27 23:42:27"
},
{
"kids":[],
"uid":"316172888",
"parent":"",
"text":"",
"mid":"Ag0Jf7v8T",
"date":"2013-10-27 23:42:08"
},
{
"kids":[],
"uid":"2589861077",
"parent":"",
"text":"",
"mid":"Ag0J0ivhN",
"date":"2013-10-27 23:41:32"
},
{
"kids":[],
"uid":"3854669413",
"parent":"",
"text":"是的,就喜欢你的那几分不同,但已经是我的全部,尤其是你那撅嘴的样子……",
"mid":"Ag0INkBBd",
"date":"2013-10-27 23:40:58"
},
{
"kids":[],
"uid":"1985393125",
"parent":"",
"text":"轉發微博",
"mid":"Ag0ILehKK",
"date":"2013-10-27 23:40:56"
},
{
"kids":[],
"uid":"208282950",
"parent":"",
"text":"[月亮][月亮]",
"mid":"Ag0IIAaDq",
"date":"2013-10-27 23:40:49"
},
{
"kids":[],
"uid":"2489191981",
"parent":"",
"text":"@猪猪猪大闹_地球圈 是继承者们里的",
"mid":"Ag0ICpwdL",
"date":"2013-10-27 23:40:35"
},
{
"kids":[],
"uid":"234511836",
"parent":"",
"text":"晚安,生安",
"mid":"Ag0IviYnf",
"date":"2013-10-27 23:40:15"
},
{
"kids":[
"AgHA7z0yp",
"AgyRZr5Ad",
"AgyKDvw8M"
],
"uid":"2258185321",
"parent":"",
"text":"",
"mid":"Ag0ItwtOf",
"date":"2013-10-27 23:40:11"
},
{
"kids":[
"Ag0K4f3tQ"
],
"uid":"201266946",
"parent":"",
"text":"[泪]",
"mid":"Ag0IkmRtU",
"date":"2013-10-27 23:39:53"
},
{
"kids":[],
"uid":"2813289543",
"parent":"",
"text":"",
"mid":"Ag0Ih7sGh",
"date":"2013-10-27 23:39:44"
},
{
"kids":[],
"uid":"sunjianan520",
"parent":"",
"text":"",
"mid":"Ag0If3Pd0",
"date":"2013-10-27 23:39:39"
},
{
"kids":[],
"uid":"2042102705",
"parent":"",
"text":"是这样吗?",
"mid":"Ag0IeaA82",
"date":"2013-10-27 23:39:34"
},
{
"kids":[],
"uid":"2749637523",
"parent":"",
"text":"晚安 世界",
"mid":"Ag0Ie8wQy",
"date":"2013-10-27 23:39:37"
},
{
"kids":[],
"uid":"2532913574",
"parent":"",
"text":"真好[呵呵]",
"mid":"Ag0Ia2oAD",
"date":"2013-10-27 23:39:27"
},
{
"kids":[],
"uid":"3517732627",
"parent":"",
"text":"好像捕梦网,其实不需要着急,等待着合适的时间合适的场合还有那个合适的人就好,在那之前我们开心就好",
"mid":"Ag0Ia0mFb",
"date":"2013-10-27 23:39:27"
},
{
"kids":[],
"uid":"2126624410",
"parent":"",
"text":"晚安,",
"mid":"Ag0I9sSI9",
"date":"2013-10-27 23:39:25"
},
{
"kids":[],
"uid":"3139831830",
"parent":"",
"text":"",
"mid":"Ag0I8xvxc",
"date":"2013-10-27 23:39:22"
},
{
"kids":[],
"uid":"2652901853",
"parent":"",
"text":"",
"mid":"Ag0I4njLd",
"date":"2013-10-27 23:39:13"
},
{
"kids":[],
"uid":"1219225767",
"parent":"",
"text":"",
"mid":"Ag0I2mklF",
"date":"2013-10-27 23:39:08"
},
{
"kids":[],
"uid":"3763748764",
"parent":"",
"text":"",
"mid":"Ag0HXCuQM",
"date":"2013-10-27 23:38:55"
},
{
"kids":[],
"uid":"3199313007",
"parent":"",
"text":"",
"mid":"Ag0HWrEko",
"date":"2013-10-27 23:38:54"
},
{
"kids":[],
"uid":"2144170042",
"parent":"",
"text":"偏爱",
"mid":"Ag0HMpP8v",
"date":"2013-10-27 23:38:31"
},
{
"kids":[],
"uid":"2735830975",
"parent":"",
"text":"",
"mid":"Ag0HKkH0W",
"date":"2013-10-27 23:38:24"
},
{
"kids":[],
"uid":"2206712473",
"parent":"",
"text":"",
"mid":"Ag0HIvdjl",
"date":"2013-10-27 23:38:23"
},
{
"kids":[],
"uid":"1993201437",
"parent":"",
"text":"大抵是这个样子的",
"mid":"Ag0HGsK3Q",
"date":"2013-10-27 23:38:16"
},
{
"kids":[],
"uid":"1749736901",
"parent":"",
"text":"",
"mid":"Ag0HDtO7e",
"date":"2013-10-27 23:38:07"
},
{
"kids":[],
"uid":"3496317122",
"parent":"",
"text":"",
"mid":"Ag0HtciMT",
"date":"2013-10-27 23:37:42"
},
{
"kids":[],
"uid":"345319082",
"parent":"",
"text":"",
"mid":"Ag0HrqRbd",
"date":"2013-10-27 23:37:39"
},
{
"kids":[],
"uid":"2331578251",
"parent":"",
"text":"",
"mid":"Ag0HkCW58",
"date":"2013-10-27 23:37:25"
},
{
"kids":[],
"uid":"2104824451",
"parent":"",
"text":"偏爱……[落叶]",
"mid":"Ag0HiyQnV",
"date":"2013-10-27 23:37:20"
},
{
"kids":[],
"uid":"1695336984",
"parent":"",
"text":"",
"mid":"Ag0H5h25C",
"date":"2013-10-27 23:36:48"
},
{
"kids":[],
"uid":"2518431901",
"parent":"",
"text":"",
"mid":"Ag0H2AeUM",
"date":"2013-10-27 23:36:42"
},
{
"kids":[],
"uid":"2066829533",
"parent":"",
"text":"",
"mid":"Ag0GQukRC",
"date":"2013-10-27 23:36:14"
},
{
"kids":[],
"uid":"1252839442",
"parent":"",
"text":"唉,是的。",
"mid":"Ag0GMjwGl",
"date":"2013-10-27 23:36:04"
},
{
"kids":[],
"uid":"3873729149",
"parent":"",
"text":"",
"mid":"Ag0GxgMoi",
"date":"2013-10-27 23:35:26"
},
{
"kids":[],
"uid":"2218180572",
"parent":"",
"text":"",
"mid":"Ag0GvuhWq",
"date":"2013-10-27 23:35:20"
},
{
"kids":[],
"uid":"2646033810",
"parent":"",
"text":"何尝不是呢!@梁小梅会坚持到底",
"mid":"Ag0GtqbXt",
"date":"2013-10-27 23:35:16"
},
{
"kids":[],
"uid":"2520281540",
"parent":"",
"text":"",
"mid":"Ag0Gqbfy7",
"date":"2013-10-27 23:35:07"
},
{
"kids":[],
"uid":"1818732531",
"parent":"",
"text":"",
"mid":"Ag0GkfGuH",
"date":"2013-10-27 23:34:56"
},
{
"kids":[],
"uid":"2628950635",
"parent":"",
"text":"因为偏爱,所以一意孤行[熊猫][熊猫][熊猫]",
"mid":"Ag0G2eVBV",
"date":"2013-10-27 23:34:12"
},
{
"kids":[],
"uid":"3479995835",
"parent":"",
"text":"",
"mid":"Ag0FZzbOP",
"date":"2013-10-27 23:34:06"
},
{
"kids":[],
"uid":"3648696264",
"parent":"",
"text":"",
"mid":"Ag0FWE296",
"date":"2013-10-27 23:34:01"
},
{
"kids":[],
"uid":"3202762637",
"parent":"",
"text":"对了,就是你,哈哈",
"mid":"Ag0FW4Pne",
"date":"2013-10-27 23:33:57"
},
{
"kids":[],
"uid":"2576352830",
"parent":"",
"text":"@蟹黄小笼包包包包",
"mid":"Ag0FUx0Ws",
"date":"2013-10-27 23:33:54"
},
{
"kids":[],
"uid":"2951938927",
"parent":"",
"text":"",
"mid":"Ag0FUhfIJ",
"date":"2013-10-27 23:33:50"
},
{
"kids":[],
"uid":"iamyyf",
"parent":"",
"text":"",
"mid":"Ag0FT7uvb",
"date":"2013-10-27 23:33:50"
},
{
"kids":[],
"uid":"3854669413",
"parent":"",
"text":"",
"mid":"Ag0FGD7KX",
"date":"2013-10-27 23:33:22"
},
{
"kids":[],
"uid":"1758091493",
"parent":"",
"text":"啥叫对的人啊,就是你觉得那是你的缺点,结果在她眼里却是优点!",
"mid":"Ag0FE3c1n",
"date":"2013-10-27 23:33:13"
},
{
"kids":[],
"uid":"2532645361",
"parent":"",
"text":"",
"mid":"Ag0FBk7kT",
"date":"2013-10-27 23:33:10"
},
{
"kids":[],
"uid":"1884610542",
"parent":"",
"text":"",
"mid":"Ag0FwCwVS",
"date":"2013-10-27 23:32:56"
},
{
"kids":[],
"uid":"2696200622",
"parent":"",
"text":"",
"mid":"Ag0FvsMbX",
"date":"2013-10-27 23:32:55"
},
{
"kids":[],
"uid":"1742818317",
"parent":"",
"text":"",
"mid":"Ag0FnqJZY",
"date":"2013-10-27 23:32:36"
},
{
"kids":[],
"uid":"3156538014",
"parent":"",
"text":"",
"mid":"Ag0FjlOEW",
"date":"2013-10-27 23:32:23"
},
{
"kids":[],
"uid":"1815466320",
"parent":"",
"text":"",
"mid":"Ag0FhzkiJ",
"date":"2013-10-27 23:32:22"
},
{
"kids":[],
"uid":"3761322703",
"parent":"",
"text":"",
"mid":"Ag0FheuGl",
"date":"2013-10-27 23:32:21"
},
{
"kids":[],
"uid":"2695451262",
"parent":"",
"text":"",
"mid":"Ag0Ffvez3",
"date":"2013-10-27 23:32:17"
},
{
"kids":[],
"uid":"1782882521",
"parent":"",
"text":"爱与被爱?不如相爱",
"mid":"Ag0Ffs0MF",
"date":"2013-10-27 23:32:15"
},
{
"kids":[],
"uid":"2066384270",
"parent":"",
"text":"晚安",
"mid":"Ag0FeBZos",
"date":"2013-10-27 23:32:12"
},
{
"kids":[],
"uid":"1320502745",
"parent":"",
"text":"",
"mid":"Ag0FbEEm6",
"date":"2013-10-27 23:32:07"
},
{
"kids":[],
"uid":"2806955301",
"parent":"",
"text":"捕梦网。。。",
"mid":"Ag0F57B9Y",
"date":"2013-10-27 23:31:52"
},
{
"kids":[],
"uid":"2177437307",
"parent":"",
"text":"",
"mid":"Ag0EV4MPU",
"date":"2013-10-27 23:31:28"
},
{
"kids":[],
"uid":"1851082392",
"parent":"",
"text":"",
"mid":"Ag0EQmXT9",
"date":"2013-10-27 23:31:17"
},
{
"kids":[],
"uid":"206069375",
"parent":"",
"text":"",
"mid":"Ag0EKaGpz",
"date":"2013-10-27 23:31:00"
},
{
"kids":[],
"uid":"232145699",
"parent":"",
"text":"",
"mid":"Ag0EIobTt",
"date":"2013-10-27 23:30:57"
}
] | {
"pile_set_name": "Github"
} |
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-11
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env ruby
# TODO (temporary here, we'll move this into the Github issues once
# redis-trib initial implementation is completed).
#
# - Make sure that if the rehashing fails in the middle redis-trib will try
# to recover.
# - When redis-trib performs a cluster check, if it detects a slot move in
# progress it should prompt the user to continue the move from where it
# stopped.
# - Gracefully handle Ctrl+C in move_slot to prompt the user if really stop
# while rehashing, and performing the best cleanup possible if the user
# forces the quit.
# - When doing "fix" set a global Fix to true, and prompt the user to
# fix the problem if automatically fixable every time there is something
# to fix. For instance:
# 1) If there is a node that pretend to receive a slot, or to migrate a
# slot, but has no entries in that slot, fix it.
# 2) If there is a node having keys in slots that are not owned by it
# fix this condition moving the entries in the same node.
# 3) Perform more possibly slow tests about the state of the cluster.
# 4) When aborted slot migration is detected, fix it.
require 'rubygems'
require 'redis'
ClusterHashSlots = 16384
def xputs(s)
case s[0..2]
when ">>>"
color="29;1"
when "[ER"
color="31;1"
when "[OK"
color="32"
when "[FA","***"
color="33"
else
color=nil
end
color = nil if ENV['TERM'] != "xterm"
print "\033[#{color}m" if color
print s
print "\033[0m" if color
print "\n"
end
class ClusterNode
def initialize(addr)
s = addr.split(":")
if s.length < 2
puts "Invalid IP or Port (given as #{addr}) - use IP:Port format"
exit 1
end
port = s.pop # removes port from split array
ip = s.join(":") # if s.length > 1 here, it's IPv6, so restore address
@r = nil
@info = {}
@info[:host] = ip
@info[:port] = port
@info[:slots] = {}
@info[:migrating] = {}
@info[:importing] = {}
@info[:replicate] = false
@dirty = false # True if we need to flush slots info into node.
@friends = []
end
def friends
@friends
end
def slots
@info[:slots]
end
def has_flag?(flag)
@info[:flags].index(flag)
end
def to_s
"#{@info[:host]}:#{@info[:port]}"
end
def connect(o={})
return if @r
print "Connecting to node #{self}: "
STDOUT.flush
begin
@r = Redis.new(:host => @info[:host], :port => @info[:port], :timeout => 60)
@r.ping
rescue
xputs "[ERR] Sorry, can't connect to node #{self}"
exit 1 if o[:abort]
@r = nil
end
xputs "OK"
end
def assert_cluster
info = @r.info
if !info["cluster_enabled"] || info["cluster_enabled"].to_i == 0
xputs "[ERR] Node #{self} is not configured as a cluster node."
exit 1
end
end
def assert_empty
if !(@r.cluster("info").split("\r\n").index("cluster_known_nodes:1")) ||
(@r.info['db0'])
xputs "[ERR] Node #{self} is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0."
exit 1
end
end
def load_info(o={})
self.connect
nodes = @r.cluster("nodes").split("\n")
nodes.each{|n|
# name addr flags role ping_sent ping_recv link_status slots
split = n.split
name,addr,flags,master_id,ping_sent,ping_recv,config_epoch,link_status = split[0..6]
slots = split[8..-1]
info = {
:name => name,
:addr => addr,
:flags => flags.split(","),
:replicate => master_id,
:ping_sent => ping_sent.to_i,
:ping_recv => ping_recv.to_i,
:link_status => link_status
}
info[:replicate] = false if master_id == "-"
if info[:flags].index("myself")
@info = @info.merge(info)
@info[:slots] = {}
slots.each{|s|
if s[0..0] == '['
if s.index("->-") # Migrating
slot,dst = s[1..-1].split("->-")
@info[:migrating][slot.to_i] = dst
elsif s.index("-<-") # Importing
slot,src = s[1..-1].split("-<-")
@info[:importing][slot.to_i] = src
end
elsif s.index("-")
start,stop = s.split("-")
self.add_slots((start.to_i)..(stop.to_i))
else
self.add_slots((s.to_i)..(s.to_i))
end
} if slots
@dirty = false
@r.cluster("info").split("\n").each{|e|
k,v=e.split(":")
k = k.to_sym
v.chop!
if k != :cluster_state
@info[k] = v.to_i
else
@info[k] = v
end
}
elsif o[:getfriends]
@friends << info
end
}
end
def add_slots(slots)
slots.each{|s|
@info[:slots][s] = :new
}
@dirty = true
end
def set_as_replica(node_id)
@info[:replicate] = node_id
@dirty = true
end
def flush_node_config
return if !@dirty
if @info[:replicate]
begin
@r.cluster("replicate",@info[:replicate])
rescue
# If the cluster did not already joined it is possible that
# the slave does not know the master node yet. So on errors
# we return ASAP leaving the dirty flag set, to flush the
# config later.
return
end
else
new = []
@info[:slots].each{|s,val|
if val == :new
new << s
@info[:slots][s] = true
end
}
@r.cluster("addslots",*new)
end
@dirty = false
end
def info_string
# We want to display the hash slots assigned to this node
# as ranges, like in: "1-5,8-9,20-25,30"
#
# Note: this could be easily written without side effects,
# we use 'slots' just to split the computation into steps.
# First step: we want an increasing array of integers
# for instance: [1,2,3,4,5,8,9,20,21,22,23,24,25,30]
slots = @info[:slots].keys.sort
# As we want to aggregate adjacent slots we convert all the
# slot integers into ranges (with just one element)
# So we have something like [1..1,2..2, ... and so forth.
slots.map!{|x| x..x}
# Finally we group ranges with adjacent elements.
slots = slots.reduce([]) {|a,b|
if !a.empty? && b.first == (a[-1].last)+1
a[0..-2] + [(a[-1].first)..(b.last)]
else
a + [b]
end
}
# Now our task is easy, we just convert ranges with just one
# element into a number, and a real range into a start-end format.
# Finally we join the array using the comma as separator.
slots = slots.map{|x|
x.count == 1 ? x.first.to_s : "#{x.first}-#{x.last}"
}.join(",")
role = self.has_flag?("master") ? "M" : "S"
if self.info[:replicate] and @dirty
is = "S: #{self.info[:name]} #{self.to_s}"
else
is = "#{role}: #{self.info[:name]} #{self.to_s}\n"+
" slots:#{slots} (#{self.slots.length} slots) "+
"#{(self.info[:flags]-["myself"]).join(",")}"
end
if self.info[:replicate]
is += "\n replicates #{info[:replicate]}"
elsif self.has_flag?("master") && self.info[:replicas]
is += "\n #{info[:replicas].length} additional replica(s)"
end
is
end
# Return a single string representing nodes and associated slots.
# TODO: remove slaves from config when slaves will be handled
# by Redis Cluster.
def get_config_signature
config = []
@r.cluster("nodes").each_line{|l|
s = l.split
slots = s[8..-1].select {|x| x[0..0] != "["}
next if slots.length == 0
config << s[0]+":"+(slots.sort.join(","))
}
config.sort.join("|")
end
def info
@info
end
def is_dirty?
@dirty
end
def r
@r
end
end
class RedisTrib
def initialize
@nodes = []
@fix = false
@errors = []
end
def check_arity(req_args, num_args)
if ((req_args > 0 and num_args != req_args) ||
(req_args < 0 and num_args < req_args.abs))
xputs "[ERR] Wrong number of arguments for specified sub command"
exit 1
end
end
def add_node(node)
@nodes << node
end
def cluster_error(msg)
@errors << msg
xputs msg
end
def get_node_by_name(name)
@nodes.each{|n|
return n if n.info[:name] == name.downcase
}
return nil
end
# This function returns the master that has the least number of replicas
# in the cluster. If there are multiple masters with the same smaller
# number of replicas, one at random is returned.
def get_master_with_least_replicas
masters = @nodes.select{|n| n.has_flag? "master"}
sorted = masters.sort{|a,b|
a.info[:replicas].length <=> b.info[:replicas].length
}
sorted[0]
end
def check_cluster
xputs ">>> Performing Cluster Check (using node #{@nodes[0]})"
show_nodes
check_config_consistency
check_open_slots
check_slots_coverage
end
# Merge slots of every known node. If the resulting slots are equal
# to ClusterHashSlots, then all slots are served.
def covered_slots
slots = {}
@nodes.each{|n|
slots = slots.merge(n.slots)
}
slots
end
def check_slots_coverage
xputs ">>> Check slots coverage..."
slots = covered_slots
if slots.length == ClusterHashSlots
xputs "[OK] All #{ClusterHashSlots} slots covered."
else
cluster_error \
"[ERR] Not all #{ClusterHashSlots} slots are covered by nodes."
fix_slots_coverage if @fix
end
end
def check_open_slots
xputs ">>> Check for open slots..."
open_slots = []
@nodes.each{|n|
if n.info[:migrating].size > 0
cluster_error \
"[WARNING] Node #{n} has slots in migrating state (#{n.info[:migrating].keys.join(",")})."
open_slots += n.info[:migrating].keys
elsif n.info[:importing].size > 0
cluster_error \
"[WARNING] Node #{n} has slots in importing state (#{n.info[:importing].keys.join(",")})."
open_slots += n.info[:importing].keys
end
}
open_slots.uniq!
if open_slots.length > 0
xputs "[WARNING] The following slots are open: #{open_slots.join(",")}"
end
if @fix
open_slots.each{|slot| fix_open_slot slot}
end
end
def nodes_with_keys_in_slot(slot)
nodes = []
@nodes.each{|n|
nodes << n if n.r.cluster("getkeysinslot",slot,1).length > 0
}
nodes
end
def fix_slots_coverage
not_covered = (0...ClusterHashSlots).to_a - covered_slots.keys
xputs ">>> Fixing slots coverage..."
xputs "List of not covered slots: " + not_covered.join(",")
# For every slot, take action depending on the actual condition:
# 1) No node has keys for this slot.
# 2) A single node has keys for this slot.
# 3) Multiple nodes have keys for this slot.
slots = {}
not_covered.each{|slot|
nodes = nodes_with_keys_in_slot(slot)
slots[slot] = nodes
xputs "Slot #{slot} has keys in #{nodes.length} nodes: #{nodes.join}"
}
none = slots.select {|k,v| v.length == 0}
single = slots.select {|k,v| v.length == 1}
multi = slots.select {|k,v| v.length > 1}
# Handle case "1": keys in no node.
if none.length > 0
xputs "The folowing uncovered slots have no keys across the cluster:"
xputs none.keys.join(",")
yes_or_die "Fix these slots by covering with a random node?"
none.each{|slot,nodes|
node = @nodes.sample
xputs ">>> Covering slot #{slot} with #{node}"
node.r.cluster("addslots",slot)
}
end
# Handle case "2": keys only in one node.
if single.length > 0
xputs "The folowing uncovered slots have keys in just one node:"
puts single.keys.join(",")
yes_or_die "Fix these slots by covering with those nodes?"
single.each{|slot,nodes|
xputs ">>> Covering slot #{slot} with #{nodes[0]}"
nodes[0].r.cluster("addslots",slot)
}
end
# Handle case "3": keys in multiple nodes.
if multi.length > 0
xputs "The folowing uncovered slots have keys in multiple nodes:"
xputs multi.keys.join(",")
yes_or_die "Fix these slots by moving keys into a single node?"
multi.each{|slot,nodes|
xputs ">>> Covering slot #{slot} moving keys to #{nodes[0]}"
# TODO
# 1) Set all nodes as "MIGRATING" for this slot, so that we
# can access keys in the hash slot using ASKING.
# 2) Move everything to node[0]
# 3) Clear MIGRATING from nodes, and ADDSLOTS the slot to
# node[0].
raise "TODO: Work in progress"
}
end
end
# Return the owner of the specified slot
def get_slot_owner(slot)
@nodes.each{|n|
n.slots.each{|s,_|
return n if s == slot
}
}
nil
end
# Slot 'slot' was found to be in importing or migrating state in one or
# more nodes. This function fixes this condition by migrating keys where
# it seems more sensible.
def fix_open_slot(slot)
puts ">>> Fixing open slot #{slot}"
# Try to obtain the current slot owner, according to the current
# nodes configuration.
owner = get_slot_owner(slot)
# If there is no slot owner, set as owner the slot with the biggest
# number of keys, among the set of migrating / importing nodes.
if !owner
xputs "*** Fix me, some work to do here."
# Select owner...
# Use ADDSLOTS to assign the slot.
exit 1
end
migrating = []
importing = []
@nodes.each{|n|
next if n.has_flag? "slave"
if n.info[:migrating][slot]
migrating << n
elsif n.info[:importing][slot]
importing << n
elsif n.r.cluster("countkeysinslot",slot) > 0 && n != owner
xputs "*** Found keys about slot #{slot} in node #{n}!"
importing << n
end
}
puts "Set as migrating in: #{migrating.join(",")}"
puts "Set as importing in: #{importing.join(",")}"
# Case 1: The slot is in migrating state in one slot, and in
# importing state in 1 slot. That's trivial to address.
if migrating.length == 1 && importing.length == 1
move_slot(migrating[0],importing[0],slot,:verbose=>true,:fix=>true)
# Case 2: There are multiple nodes that claim the slot as importing,
# they probably got keys about the slot after a restart so opened
# the slot. In this case we just move all the keys to the owner
# according to the configuration.
elsif migrating.length == 0 && importing.length > 0
xputs ">>> Moving all the #{slot} slot keys to its owner #{owner}"
importing.each {|node|
next if node == owner
move_slot(node,owner,slot,:verbose=>true,:fix=>true,:cold=>true)
xputs ">>> Setting #{slot} as STABLE in #{node}"
node.r.cluster("setslot",slot,"stable")
}
# Case 3: There are no slots claiming to be in importing state, but
# there is a migrating node that actually don't have any key. We
# can just close the slot, probably a reshard interrupted in the middle.
elsif importing.length == 0 && migrating.length == 1 &&
migrating[0].r.cluster("getkeysinslot",slot,10).length == 0
migrating[0].r.cluster("setslot",slot,"stable")
else
xputs "[ERR] Sorry, Redis-trib can't fix this slot yet (work in progress). Slot is set as migrating in #{migrating.join(",")}, as importing in #{importing.join(",")}, owner is #{owner}"
end
end
# Check if all the nodes agree about the cluster configuration
def check_config_consistency
if !is_config_consistent?
cluster_error "[ERR] Nodes don't agree about configuration!"
else
xputs "[OK] All nodes agree about slots configuration."
end
end
def is_config_consistent?
signatures=[]
@nodes.each{|n|
signatures << n.get_config_signature
}
return signatures.uniq.length == 1
end
def wait_cluster_join
print "Waiting for the cluster to join"
while !is_config_consistent?
print "."
STDOUT.flush
sleep 1
end
print "\n"
end
def alloc_slots
nodes_count = @nodes.length
masters_count = @nodes.length / (@replicas+1)
masters = []
# The first step is to split instances by IP. This is useful as
# we'll try to allocate master nodes in different physical machines
# (as much as possible) and to allocate slaves of a given master in
# different physical machines as well.
#
# This code assumes just that if the IP is different, than it is more
# likely that the instance is running in a different physical host
# or at least a different virtual machine.
ips = {}
@nodes.each{|n|
ips[n.info[:host]] = [] if !ips[n.info[:host]]
ips[n.info[:host]] << n
}
# Select master instances
puts "Using #{masters_count} masters:"
interleaved = []
stop = false
while not stop do
# Take one node from each IP until we run out of nodes
# across every IP.
ips.each do |ip,nodes|
if nodes.empty?
# if this IP has no remaining nodes, check for termination
if interleaved.length == nodes_count
# stop when 'interleaved' has accumulated all nodes
stop = true
next
end
else
# else, move one node from this IP to 'interleaved'
interleaved.push nodes.shift
end
end
end
masters = interleaved.slice!(0, masters_count)
nodes_count -= masters.length
masters.each{|m| puts m}
# Alloc slots on masters
slots_per_node = ClusterHashSlots.to_f / masters_count
first = 0
cursor = 0.0
masters.each_with_index{|n,masternum|
last = (cursor+slots_per_node-1).round
if last > ClusterHashSlots || masternum == masters.length-1
last = ClusterHashSlots-1
end
last = first if last < first # Min step is 1.
n.add_slots first..last
first = last+1
cursor += slots_per_node
}
# Select N replicas for every master.
# We try to split the replicas among all the IPs with spare nodes
# trying to avoid the host where the master is running, if possible.
#
# Note we loop two times. The first loop assigns the requested
# number of replicas to each master. The second loop assigns any
# remaining instances as extra replicas to masters. Some masters
# may end up with more than their requested number of replicas, but
# all nodes will be used.
assignment_verbose = false
[:requested,:unused].each do |assign|
masters.each do |m|
assigned_replicas = 0
while assigned_replicas < @replicas
break if nodes_count == 0
if assignment_verbose
if assign == :requested
puts "Requesting total of #{@replicas} replicas " \
"(#{assigned_replicas} replicas assigned " \
"so far with #{nodes_count} total remaining)."
elsif assign == :unused
puts "Assigning extra instance to replication " \
"role too (#{nodes_count} remaining)."
end
end
# Return the first node not matching our current master
node = interleaved.find{|n| n.info[:host] != m.info[:host]}
# If we found a node, use it as a best-first match.
# Otherwise, we didn't find a node on a different IP, so we
# go ahead and use a same-IP replica.
if node
slave = node
interleaved.delete node
else
slave = interleaved.shift
end
slave.set_as_replica(m.info[:name])
nodes_count -= 1
assigned_replicas += 1
puts "Adding replica #{slave} to #{m}"
# If we are in the "assign extra nodes" loop,
# we want to assign one extra replica to each
# master before repeating masters.
# This break lets us assign extra replicas to masters
# in a round-robin way.
break if assign == :unused
end
end
end
end
def flush_nodes_config
@nodes.each{|n|
n.flush_node_config
}
end
def show_nodes
@nodes.each{|n|
xputs n.info_string
}
end
# Redis Cluster config epoch collision resolution code is able to eventually
# set a different epoch to each node after a new cluster is created, but
# it is slow compared to assign a progressive config epoch to each node
# before joining the cluster. However we do just a best-effort try here
# since if we fail is not a problem.
def assign_config_epoch
config_epoch = 1
@nodes.each{|n|
begin
n.r.cluster("set-config-epoch",config_epoch)
rescue
end
config_epoch += 1
}
end
def join_cluster
# We use a brute force approach to make sure the node will meet
# each other, that is, sending CLUSTER MEET messages to all the nodes
# about the very same node.
# Thanks to gossip this information should propagate across all the
# cluster in a matter of seconds.
first = false
@nodes.each{|n|
if !first then first = n.info; next; end # Skip the first node
n.r.cluster("meet",first[:host],first[:port])
}
end
def yes_or_die(msg)
print "#{msg} (type 'yes' to accept): "
STDOUT.flush
if !(STDIN.gets.chomp.downcase == "yes")
xputs "*** Aborting..."
exit 1
end
end
def load_cluster_info_from_node(nodeaddr)
node = ClusterNode.new(nodeaddr)
node.connect(:abort => true)
node.assert_cluster
node.load_info(:getfriends => true)
add_node(node)
node.friends.each{|f|
next if f[:flags].index("noaddr") ||
f[:flags].index("disconnected") ||
f[:flags].index("fail")
fnode = ClusterNode.new(f[:addr])
fnode.connect()
next if !fnode.r
begin
fnode.load_info()
add_node(fnode)
rescue => e
xputs "[ERR] Unable to load info for node #{fnode}"
end
}
populate_nodes_replicas_info
end
# This function is called by load_cluster_info_from_node in order to
# add additional information to every node as a list of replicas.
def populate_nodes_replicas_info
# Start adding the new field to every node.
@nodes.each{|n|
n.info[:replicas] = []
}
# Populate the replicas field using the replicate field of slave
# nodes.
@nodes.each{|n|
if n.info[:replicate]
master = get_node_by_name(n.info[:replicate])
if !master
xputs "*** WARNING: #{n} claims to be slave of unknown node ID #{n.info[:replicate]}."
else
master.info[:replicas] << n
end
end
}
end
# Given a list of source nodes return a "resharding plan"
# with what slots to move in order to move "numslots" slots to another
# instance.
def compute_reshard_table(sources,numslots)
moved = []
# Sort from bigger to smaller instance, for two reasons:
# 1) If we take less slots than instances it is better to start
# getting from the biggest instances.
# 2) We take one slot more from the first instance in the case of not
# perfect divisibility. Like we have 3 nodes and need to get 10
# slots, we take 4 from the first, and 3 from the rest. So the
# biggest is always the first.
sources = sources.sort{|a,b| b.slots.length <=> a.slots.length}
source_tot_slots = sources.inject(0) {|sum,source|
sum+source.slots.length
}
sources.each_with_index{|s,i|
# Every node will provide a number of slots proportional to the
# slots it has assigned.
n = (numslots.to_f/source_tot_slots*s.slots.length)
if i == 0
n = n.ceil
else
n = n.floor
end
s.slots.keys.sort[(0...n)].each{|slot|
if moved.length < numslots
moved << {:source => s, :slot => slot}
end
}
}
return moved
end
def show_reshard_table(table)
table.each{|e|
puts " Moving slot #{e[:slot]} from #{e[:source].info[:name]}"
}
end
# Move slots between source and target nodes using MIGRATE.
#
# Options:
# :verbose -- Print a dot for every moved key.
# :fix -- We are moving in the context of a fix. Use REPLACE.
# :cold -- Move keys without opening / reconfiguring the nodes.
def move_slot(source,target,slot,o={})
# We start marking the slot as importing in the destination node,
# and the slot as migrating in the target host. Note that the order of
# the operations is important, as otherwise a client may be redirected
# to the target node that does not yet know it is importing this slot.
print "Moving slot #{slot} from #{source} to #{target}: "; STDOUT.flush
if !o[:cold]
target.r.cluster("setslot",slot,"importing",source.info[:name])
source.r.cluster("setslot",slot,"migrating",target.info[:name])
end
# Migrate all the keys from source to target using the MIGRATE command
while true
keys = source.r.cluster("getkeysinslot",slot,10)
break if keys.length == 0
keys.each{|key|
begin
source.r.client.call(["migrate",target.info[:host],target.info[:port],key,0,15000])
rescue => e
if o[:fix] && e.to_s =~ /BUSYKEY/
xputs "*** Target key #{key} exists. Replacing it for FIX."
source.r.client.call(["migrate",target.info[:host],target.info[:port],key,0,15000,:replace])
else
puts ""
xputs "[ERR] #{e}"
exit 1
end
end
print "." if o[:verbose]
STDOUT.flush
}
end
puts
# Set the new node as the owner of the slot in all the known nodes.
if !o[:cold]
@nodes.each{|n|
n.r.cluster("setslot",slot,"node",target.info[:name])
}
end
end
# redis-trib subcommands implementations
def check_cluster_cmd(argv,opt)
load_cluster_info_from_node(argv[0])
check_cluster
end
def fix_cluster_cmd(argv,opt)
@fix = true
load_cluster_info_from_node(argv[0])
check_cluster
end
def reshard_cluster_cmd(argv,opt)
load_cluster_info_from_node(argv[0])
check_cluster
if @errors.length != 0
puts "*** Please fix your cluster problems before resharding"
exit 1
end
# Get number of slots
if opt['slots']
numslots = opt['slots'].to_i
else
numslots = 0
while numslots <= 0 or numslots > ClusterHashSlots
print "How many slots do you want to move (from 1 to #{ClusterHashSlots})? "
numslots = STDIN.gets.to_i
end
end
# Get the target instance
if opt['to']
target = get_node_by_name(opt['to'])
if !target || target.has_flag?("slave")
xputs "*** The specified node is not known or not a master, please retry."
exit 1
end
else
target = nil
while not target
print "What is the receiving node ID? "
target = get_node_by_name(STDIN.gets.chop)
if !target || target.has_flag?("slave")
xputs "*** The specified node is not known or not a master, please retry."
target = nil
end
end
end
# Get the source instances
sources = []
if opt['from']
opt['from'].split(',').each{|node_id|
if node_id == "all"
sources = "all"
break
end
src = get_node_by_name(node_id)
if !src || src.has_flag?("slave")
xputs "*** The specified node is not known or is not a master, please retry."
exit 1
end
sources << src
}
else
xputs "Please enter all the source node IDs."
xputs " Type 'all' to use all the nodes as source nodes for the hash slots."
xputs " Type 'done' once you entered all the source nodes IDs."
while true
print "Source node ##{sources.length+1}:"
line = STDIN.gets.chop
src = get_node_by_name(line)
if line == "done"
break
elsif line == "all"
sources = "all"
break
elsif !src || src.has_flag?("slave")
xputs "*** The specified node is not known or is not a master, please retry."
elsif src.info[:name] == target.info[:name]
xputs "*** It is not possible to use the target node as source node."
else
sources << src
end
end
end
if sources.length == 0
puts "*** No source nodes given, operation aborted"
exit 1
end
# Handle soures == all.
if sources == "all"
sources = []
@nodes.each{|n|
next if n.info[:name] == target.info[:name]
next if n.has_flag?("slave")
sources << n
}
end
# Check if the destination node is the same of any source nodes.
if sources.index(target)
xputs "*** Target node is also listed among the source nodes!"
exit 1
end
puts "\nReady to move #{numslots} slots."
puts " Source nodes:"
sources.each{|s| puts " "+s.info_string}
puts " Destination node:"
puts " #{target.info_string}"
reshard_table = compute_reshard_table(sources,numslots)
puts " Resharding plan:"
show_reshard_table(reshard_table)
if !opt['yes']
print "Do you want to proceed with the proposed reshard plan (yes/no)? "
yesno = STDIN.gets.chop
exit(1) if (yesno != "yes")
end
reshard_table.each{|e|
move_slot(e[:source],target,e[:slot],:verbose=>true)
}
end
# This is an helper function for create_cluster_cmd that verifies if
# the number of nodes and the specified replicas have a valid configuration
# where there are at least three master nodes and enough replicas per node.
def check_create_parameters
masters = @nodes.length/(@replicas+1)
if masters < 3
puts "*** ERROR: Invalid configuration for cluster creation."
puts "*** Redis Cluster requires at least 3 master nodes."
puts "*** This is not possible with #{@nodes.length} nodes and #{@replicas} replicas per node."
puts "*** At least #{3*(@replicas+1)} nodes are required."
exit 1
end
end
def create_cluster_cmd(argv,opt)
opt = {'replicas' => 0}.merge(opt)
@replicas = opt['replicas'].to_i
xputs ">>> Creating cluster"
argv[0..-1].each{|n|
node = ClusterNode.new(n)
node.connect(:abort => true)
node.assert_cluster
node.load_info
node.assert_empty
add_node(node)
}
check_create_parameters
xputs ">>> Performing hash slots allocation on #{@nodes.length} nodes..."
alloc_slots
show_nodes
yes_or_die "Can I set the above configuration?"
flush_nodes_config
xputs ">>> Nodes configuration updated"
xputs ">>> Assign a different config epoch to each node"
assign_config_epoch
xputs ">>> Sending CLUSTER MEET messages to join the cluster"
join_cluster
# Give one second for the join to start, in order to avoid that
# wait_cluster_join will find all the nodes agree about the config as
# they are still empty with unassigned slots.
sleep 1
wait_cluster_join
flush_nodes_config # Useful for the replicas
check_cluster
end
def addnode_cluster_cmd(argv,opt)
xputs ">>> Adding node #{argv[0]} to cluster #{argv[1]}"
# Check the existing cluster
load_cluster_info_from_node(argv[1])
check_cluster
# If --master-id was specified, try to resolve it now so that we
# abort before starting with the node configuration.
if opt['slave']
if opt['master-id']
master = get_node_by_name(opt['master-id'])
if !master
xputs "[ERR] No such master ID #{opt['master-id']}"
end
else
master = get_master_with_least_replicas
xputs "Automatically selected master #{master}"
end
end
# Add the new node
new = ClusterNode.new(argv[0])
new.connect(:abort => true)
new.assert_cluster
new.load_info
new.assert_empty
first = @nodes.first.info
add_node(new)
# Send CLUSTER MEET command to the new node
xputs ">>> Send CLUSTER MEET to node #{new} to make it join the cluster."
new.r.cluster("meet",first[:host],first[:port])
# Additional configuration is needed if the node is added as
# a slave.
if opt['slave']
wait_cluster_join
xputs ">>> Configure node as replica of #{master}."
new.r.cluster("replicate",master.info[:name])
end
xputs "[OK] New node added correctly."
end
def delnode_cluster_cmd(argv,opt)
id = argv[1].downcase
xputs ">>> Removing node #{id} from cluster #{argv[0]}"
# Load cluster information
load_cluster_info_from_node(argv[0])
# Check if the node exists and is not empty
node = get_node_by_name(id)
if !node
xputs "[ERR] No such node ID #{id}"
exit 1
end
if node.slots.length != 0
xputs "[ERR] Node #{node} is not empty! Reshard data away and try again."
exit 1
end
# Send CLUSTER FORGET to all the nodes but the node to remove
xputs ">>> Sending CLUSTER FORGET messages to the cluster..."
@nodes.each{|n|
next if n == node
if n.info[:replicate] && n.info[:replicate].downcase == id
# Reconfigure the slave to replicate with some other node
master = get_master_with_least_replicas
xputs ">>> #{n} as replica of #{master}"
n.r.cluster("replicate",master.info[:name])
end
n.r.cluster("forget",argv[1])
}
# Finally shutdown the node
xputs ">>> SHUTDOWN the node."
node.r.shutdown
end
def set_timeout_cluster_cmd(argv,opt)
timeout = argv[1].to_i
if timeout < 100
puts "Setting a node timeout of less than 100 milliseconds is a bad idea."
exit 1
end
# Load cluster information
load_cluster_info_from_node(argv[0])
ok_count = 0
err_count = 0
# Send CLUSTER FORGET to all the nodes but the node to remove
xputs ">>> Reconfiguring node timeout in every cluster node..."
@nodes.each{|n|
begin
n.r.config("set","cluster-node-timeout",timeout)
n.r.config("rewrite")
ok_count += 1
xputs "*** New timeout set for #{n}"
rescue => e
puts "ERR setting node-timeot for #{n}: #{e}"
err_count += 1
end
}
xputs ">>> New node timeout set. #{ok_count} OK, #{err_count} ERR."
end
def call_cluster_cmd(argv,opt)
cmd = argv[1..-1]
cmd[0] = cmd[0].upcase
# Load cluster information
load_cluster_info_from_node(argv[0])
xputs ">>> Calling #{cmd.join(" ")}"
@nodes.each{|n|
begin
res = n.r.send(*cmd)
puts "#{n}: #{res}"
rescue => e
puts "#{n}: #{e}"
end
}
end
def import_cluster_cmd(argv,opt)
source_addr = opt['from']
xputs ">>> Importing data from #{source_addr} to cluster #{argv[1]}"
use_copy = opt['copy']
use_replace = opt['replace']
# Check the existing cluster.
load_cluster_info_from_node(argv[0])
check_cluster
# Connect to the source node.
xputs ">>> Connecting to the source Redis instance"
src_host,src_port = source_addr.split(":")
source = Redis.new(:host =>src_host, :port =>src_port)
if source.info['cluster_enabled'].to_i == 1
xputs "[ERR] The source node should not be a cluster node."
end
xputs "*** Importing #{source.dbsize} keys from DB 0"
# Build a slot -> node map
slots = {}
@nodes.each{|n|
n.slots.each{|s,_|
slots[s] = n
}
}
# Use SCAN to iterate over the keys, migrating to the
# right node as needed.
cursor = nil
while cursor != 0
cursor,keys = source.scan(cursor, :count => 1000)
cursor = cursor.to_i
keys.each{|k|
# Migrate keys using the MIGRATE command.
slot = key_to_slot(k)
target = slots[slot]
print "Migrating #{k} to #{target}: "
STDOUT.flush
begin
cmd = ["migrate",target.info[:host],target.info[:port],k,0,15000]
cmd << :copy if use_copy
cmd << :replace if use_replace
source.client.call(cmd)
rescue => e
puts e
else
puts "OK"
end
}
end
end
def help_cluster_cmd(argv,opt)
show_help
exit 0
end
# Parse the options for the specific command "cmd".
# Returns an hash populate with option => value pairs, and the index of
# the first non-option argument in ARGV.
def parse_options(cmd)
idx = 1 ; # Current index into ARGV
options={}
while idx < ARGV.length && ARGV[idx][0..1] == '--'
if ARGV[idx][0..1] == "--"
option = ARGV[idx][2..-1]
idx += 1
if ALLOWED_OPTIONS[cmd] == nil || ALLOWED_OPTIONS[cmd][option] == nil
puts "Unknown option '#{option}' for command '#{cmd}'"
exit 1
end
if ALLOWED_OPTIONS[cmd][option]
value = ARGV[idx]
idx += 1
else
value = true
end
options[option] = value
else
# Remaining arguments are not options.
break
end
end
# Enforce mandatory options
if ALLOWED_OPTIONS[cmd]
ALLOWED_OPTIONS[cmd].each {|option,val|
if !options[option] && val == :required
puts "Option '--#{option}' is required "+ \
"for subcommand '#{cmd}'"
exit 1
end
}
end
return options,idx
end
end
#################################################################################
# Libraries
#
# We try to don't depend on external libs since this is a critical part
# of Redis Cluster.
#################################################################################
# This is the CRC16 algorithm used by Redis Cluster to hash keys.
# Implementation according to CCITT standards.
#
# This is actually the XMODEM CRC 16 algorithm, using the
# following parameters:
#
# Name : "XMODEM", also known as "ZMODEM", "CRC-16/ACORN"
# Width : 16 bit
# Poly : 1021 (That is actually x^16 + x^12 + x^5 + 1)
# Initialization : 0000
# Reflect Input byte : False
# Reflect Output CRC : False
# Xor constant to output CRC : 0000
# Output for "123456789" : 31C3
module RedisClusterCRC16
def RedisClusterCRC16.crc16(bytes)
crc = 0
bytes.each_byte{|b|
crc = ((crc<<8) & 0xffff) ^ XMODEMCRC16Lookup[((crc>>8)^b) & 0xff]
}
crc
end
private
XMODEMCRC16Lookup = [
0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,
0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef,
0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,0x72f7,0x62d6,
0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de,
0x2462,0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485,
0xa56a,0xb54b,0x8528,0x9509,0xe5ee,0xf5cf,0xc5ac,0xd58d,
0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,0x5695,0x46b4,
0xb75b,0xa77a,0x9719,0x8738,0xf7df,0xe7fe,0xd79d,0xc7bc,
0x48c4,0x58e5,0x6886,0x78a7,0x0840,0x1861,0x2802,0x3823,
0xc9cc,0xd9ed,0xe98e,0xf9af,0x8948,0x9969,0xa90a,0xb92b,
0x5af5,0x4ad4,0x7ab7,0x6a96,0x1a71,0x0a50,0x3a33,0x2a12,
0xdbfd,0xcbdc,0xfbbf,0xeb9e,0x9b79,0x8b58,0xbb3b,0xab1a,
0x6ca6,0x7c87,0x4ce4,0x5cc5,0x2c22,0x3c03,0x0c60,0x1c41,
0xedae,0xfd8f,0xcdec,0xddcd,0xad2a,0xbd0b,0x8d68,0x9d49,
0x7e97,0x6eb6,0x5ed5,0x4ef4,0x3e13,0x2e32,0x1e51,0x0e70,
0xff9f,0xefbe,0xdfdd,0xcffc,0xbf1b,0xaf3a,0x9f59,0x8f78,
0x9188,0x81a9,0xb1ca,0xa1eb,0xd10c,0xc12d,0xf14e,0xe16f,
0x1080,0x00a1,0x30c2,0x20e3,0x5004,0x4025,0x7046,0x6067,
0x83b9,0x9398,0xa3fb,0xb3da,0xc33d,0xd31c,0xe37f,0xf35e,
0x02b1,0x1290,0x22f3,0x32d2,0x4235,0x5214,0x6277,0x7256,
0xb5ea,0xa5cb,0x95a8,0x8589,0xf56e,0xe54f,0xd52c,0xc50d,
0x34e2,0x24c3,0x14a0,0x0481,0x7466,0x6447,0x5424,0x4405,
0xa7db,0xb7fa,0x8799,0x97b8,0xe75f,0xf77e,0xc71d,0xd73c,
0x26d3,0x36f2,0x0691,0x16b0,0x6657,0x7676,0x4615,0x5634,
0xd94c,0xc96d,0xf90e,0xe92f,0x99c8,0x89e9,0xb98a,0xa9ab,
0x5844,0x4865,0x7806,0x6827,0x18c0,0x08e1,0x3882,0x28a3,
0xcb7d,0xdb5c,0xeb3f,0xfb1e,0x8bf9,0x9bd8,0xabbb,0xbb9a,
0x4a75,0x5a54,0x6a37,0x7a16,0x0af1,0x1ad0,0x2ab3,0x3a92,
0xfd2e,0xed0f,0xdd6c,0xcd4d,0xbdaa,0xad8b,0x9de8,0x8dc9,
0x7c26,0x6c07,0x5c64,0x4c45,0x3ca2,0x2c83,0x1ce0,0x0cc1,
0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8,
0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0
]
end
# Turn a key name into the corrisponding Redis Cluster slot.
def key_to_slot(key)
# Only hash what is inside {...} if there is such a pattern in the key.
# Note that the specification requires the content that is between
# the first { and the first } after the first {. If we found {} without
# nothing in the middle, the whole key is hashed as usually.
s = key.index "{"
if s
e = key.index "}",s+1
if e && e != s+1
key = key[s+1..e-1]
end
end
RedisClusterCRC16.crc16(key) % 16384
end
#################################################################################
# Definition of commands
#################################################################################
COMMANDS={
"create" => ["create_cluster_cmd", -2, "host1:port1 ... hostN:portN"],
"check" => ["check_cluster_cmd", 2, "host:port"],
"fix" => ["fix_cluster_cmd", 2, "host:port"],
"reshard" => ["reshard_cluster_cmd", 2, "host:port"],
"add-node" => ["addnode_cluster_cmd", 3, "new_host:new_port existing_host:existing_port"],
"del-node" => ["delnode_cluster_cmd", 3, "host:port node_id"],
"set-timeout" => ["set_timeout_cluster_cmd", 3, "host:port milliseconds"],
"call" => ["call_cluster_cmd", -3, "host:port command arg arg .. arg"],
"import" => ["import_cluster_cmd", 2, "host:port"],
"help" => ["help_cluster_cmd", 1, "(show this help)"]
}
ALLOWED_OPTIONS={
"create" => {"replicas" => true},
"add-node" => {"slave" => false, "master-id" => true},
"import" => {"from" => :required, "copy" => false, "replace" => false},
"reshard" => {"from" => true, "to" => true, "slots" => true, "yes" => false}
}
def show_help
puts "Usage: redis-trib <command> <options> <arguments ...>\n\n"
COMMANDS.each{|k,v|
o = ""
puts " #{k.ljust(15)} #{v[2]}"
if ALLOWED_OPTIONS[k]
ALLOWED_OPTIONS[k].each{|optname,has_arg|
puts " --#{optname}" + (has_arg ? " <arg>" : "")
}
end
}
puts "\nFor check, fix, reshard, del-node, set-timeout you can specify the host and port of any working node in the cluster.\n"
end
# Sanity check
if ARGV.length == 0
show_help
exit 1
end
rt = RedisTrib.new
cmd_spec = COMMANDS[ARGV[0].downcase]
if !cmd_spec
puts "Unknown redis-trib subcommand '#{ARGV[0]}'"
exit 1
end
# Parse options
cmd_options,first_non_option = rt.parse_options(ARGV[0].downcase)
rt.check_arity(cmd_spec[1],ARGV.length-(first_non_option-1))
# Dispatch
rt.send(cmd_spec[0],ARGV[first_non_option..-1],cmd_options)
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='utf-8'?>
<nrml xmlns:gml="http://www.opengis.net/gml"
xmlns="http://openquake.org/xmlns/nrml/0.5">
<simpleFaultRupture>
<magnitude>6.7</magnitude>
<rake>90.0</rake>
<hypocenter lat="38.1124" lon="-122.0000" depth="10.0"/>
<simpleFaultGeometry>
<gml:LineString>
<gml:posList>
-122.0000 38.0000
-122.0000 38.2248
</gml:posList>
</gml:LineString>
<dip>90.0</dip>
<upperSeismoDepth>0.0</upperSeismoDepth>
<lowerSeismoDepth>20.0</lowerSeismoDepth>
</simpleFaultGeometry>
</simpleFaultRupture>
</nrml> | {
"pile_set_name": "Github"
} |
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// r_surf.c: surface-related refresh code
#include "sw.h"
drawsurf_t r_drawsurf;
static int sourcetstep;
static void *prowdestbase;
static byte *pbasesource;
static int surfrowbytes;
static unsigned *r_lightptr;
static int r_stepback;
static int r_lightwidth;
static int r_numhblocks, r_numvblocks;
static byte *r_source, *r_sourcemax;
static void R_DrawSurfaceBlock8_mip0(void);
static void R_DrawSurfaceBlock8_mip1(void);
static void R_DrawSurfaceBlock8_mip2(void);
static void R_DrawSurfaceBlock8_mip3(void);
static void (*surfmiptable[4])(void) = {
R_DrawSurfaceBlock8_mip0,
R_DrawSurfaceBlock8_mip1,
R_DrawSurfaceBlock8_mip2,
R_DrawSurfaceBlock8_mip3
};
static int sc_size;
static surfcache_t *sc_rover, *sc_base;
/*
===============
R_TextureAnimation
Returns the proper texture for a given time and base texture
===============
*/
static image_t *R_TextureAnimation(mtexinfo_t *tex)
{
int c;
if (!tex->next)
return tex->image;
c = currententity->frame % tex->numframes;
while (c) {
tex = tex->next;
c--;
}
return tex->image;
}
/*
===============
R_DrawSurface
===============
*/
static void R_DrawSurface(void)
{
byte *basetptr;
int smax, tmax, twidth;
int u;
int soffset, toffset;
int horzblockstep;
byte *pcolumndest;
void (*pblockdrawer)(void);
image_t *mt;
int blocksize;
int blockdivshift;
surfrowbytes = r_drawsurf.rowbytes;
mt = r_drawsurf.image;
r_source = mt->pixels[r_drawsurf.surfmip];
twidth = (mt->upload_width >> r_drawsurf.surfmip) * TEX_BYTES;
blocksize = 16 >> r_drawsurf.surfmip;
blockdivshift = 4 - r_drawsurf.surfmip;
r_lightwidth = S_MAX(r_drawsurf.surf) * LIGHTMAP_BYTES;
r_numhblocks = r_drawsurf.surfwidth >> blockdivshift;
r_numvblocks = r_drawsurf.surfheight >> blockdivshift;
pblockdrawer = surfmiptable[r_drawsurf.surfmip];
// TODO: only needs to be set when there is a display settings change
horzblockstep = blocksize * TEX_BYTES;
smax = mt->upload_width >> r_drawsurf.surfmip;
tmax = mt->upload_height >> r_drawsurf.surfmip;
sourcetstep = twidth;
r_stepback = tmax * twidth;
r_sourcemax = r_source + tmax * smax * TEX_BYTES;
soffset = r_drawsurf.surf->texturemins[0];
toffset = r_drawsurf.surf->texturemins[1];
// << 16 components are to guarantee positive values for %
soffset = ((soffset >> r_drawsurf.surfmip) + (smax << 16)) % smax;
toffset = ((toffset >> r_drawsurf.surfmip) + (tmax << 16)) % tmax;
basetptr = &r_source[toffset * twidth];
pcolumndest = r_drawsurf.surfdat;
for (u = 0; u < r_numhblocks; u++) {
r_lightptr = (unsigned *)blocklights + u * LIGHTMAP_BYTES;
prowdestbase = pcolumndest;
pbasesource = basetptr + soffset * TEX_BYTES;
(*pblockdrawer)();
soffset += blocksize;
if (soffset >= smax)
soffset = 0;
pcolumndest += horzblockstep;
}
}
//=============================================================================
#define BLOCK_FUNC R_DrawSurfaceBlock8_mip0
#define BLOCK_SHIFT 4
#include "block.h"
#define BLOCK_FUNC R_DrawSurfaceBlock8_mip1
#define BLOCK_SHIFT 3
#include "block.h"
#define BLOCK_FUNC R_DrawSurfaceBlock8_mip2
#define BLOCK_SHIFT 2
#include "block.h"
#define BLOCK_FUNC R_DrawSurfaceBlock8_mip3
#define BLOCK_SHIFT 1
#include "block.h"
//============================================================================
/*
================
R_InitCaches
================
*/
void R_InitCaches(void)
{
int size;
int pix;
// calculate size to allocate
if (sw_surfcacheoverride->integer) {
size = Cvar_ClampInteger(sw_surfcacheoverride,
SURFCACHE_SIZE_AT_320X240,
SURFCACHE_SIZE_AT_320X240 * 25);
} else {
size = SURFCACHE_SIZE_AT_320X240;
pix = vid.width * vid.height;
if (pix > 64000)
size += (pix - 64000) * 3;
}
size *= TEX_BYTES;
// round up to page size
size = (size + 8191) & ~8191;
Com_DPrintf("%ik surface cache\n", size / 1024);
sc_size = size;
sc_base = (surfcache_t *)R_Malloc(size);
sc_rover = sc_base;
sc_base->next = NULL;
sc_base->owner = NULL;
sc_base->size = sc_size;
}
void R_FreeCaches(void)
{
if (sc_base) {
Z_Free(sc_base);
sc_base = NULL;
}
sc_size = 0;
sc_rover = NULL;
}
/*
==================
D_FlushCaches
==================
*/
void D_FlushCaches(void)
{
surfcache_t *c;
if (!sc_base)
return;
for (c = sc_base; c; c = c->next) {
if (c->owner) {
*c->owner = NULL;
}
}
sc_rover = sc_base;
sc_base->next = NULL;
sc_base->owner = NULL;
sc_base->size = sc_size;
}
/*
=================
D_SCAlloc
=================
*/
static surfcache_t *D_SCAlloc(int width, int size)
{
surfcache_t *new;
if ((width < 0) || (width > 256))
Com_Error(ERR_FATAL, "D_SCAlloc: bad cache width %d\n", width);
if ((size <= 0) || (size > 0x10000 * TEX_BYTES))
Com_Error(ERR_FATAL, "D_SCAlloc: bad cache size %d\n", size);
size += sizeof(surfcache_t) - 4;
size = (size + 3) & ~3;
if (size > sc_size)
Com_Error(ERR_FATAL, "D_SCAlloc: %i > cache size of %i", size, sc_size);
// if there is not size bytes after the rover, reset to the start
if (!sc_rover || (byte *)sc_rover - (byte *)sc_base > sc_size - size) {
sc_rover = sc_base;
}
// colect and free surfcache_t blocks until the rover block is large enough
new = sc_rover;
if (sc_rover->owner)
*sc_rover->owner = NULL;
while (new->size < size) {
// free another
sc_rover = sc_rover->next;
if (!sc_rover)
Com_Error(ERR_FATAL, "D_SCAlloc: hit the end of memory");
if (sc_rover->owner)
*sc_rover->owner = NULL;
new->size += sc_rover->size;
new->next = sc_rover->next;
}
// create a fragment out of any leftovers
if (new->size - size > 256) {
sc_rover = (surfcache_t *)((byte *)new + size);
sc_rover->size = new->size - size;
sc_rover->next = new->next;
sc_rover->width = 0;
sc_rover->owner = NULL;
new->next = sc_rover;
new->size = size;
} else
sc_rover = new->next;
new->width = width;
// DEBUG
if (width > 0)
new->height = (size - sizeof(*new) + sizeof(new->data)) / width;
new->owner = NULL; // should be set properly after return
return new;
}
/*
=================
D_SCDump
=================
*/
void D_SCDump_f(void)
{
surfcache_t *test;
for (test = sc_base; test; test = test->next) {
if (test == sc_rover)
Com_Printf("ROVER:\n");
Com_Printf("%p : %i bytes %i width\n", test, test->size,
test->width);
}
}
//=============================================================================
/*
================
D_CacheSurface
================
*/
surfcache_t *D_CacheSurface(mface_t *surface, int miplevel)
{
surfcache_t *cache;
float surfscale;
//
// if the surface is animating or flashing, flush the cache
//
r_drawsurf.image = R_TextureAnimation(surface->texinfo);
r_drawsurf.lightadj[0] = r_newrefdef.lightstyles[surface->styles[0]].white * sw_modulate->value * 256;
r_drawsurf.lightadj[1] = r_newrefdef.lightstyles[surface->styles[1]].white * sw_modulate->value * 256;
r_drawsurf.lightadj[2] = r_newrefdef.lightstyles[surface->styles[2]].white * sw_modulate->value * 256;
r_drawsurf.lightadj[3] = r_newrefdef.lightstyles[surface->styles[3]].white * sw_modulate->value * 256;
//
// see if the cache holds apropriate data
//
cache = surface->cachespots[miplevel];
if (cache && !cache->dlight && surface->dlightframe != r_framecount
&& cache->image == r_drawsurf.image
&& cache->lightadj[0] == r_drawsurf.lightadj[0]
&& cache->lightadj[1] == r_drawsurf.lightadj[1]
&& cache->lightadj[2] == r_drawsurf.lightadj[2]
&& cache->lightadj[3] == r_drawsurf.lightadj[3])
return cache;
//
// determine shape of surface
//
surfscale = 1.0 / (1 << miplevel);
r_drawsurf.surfmip = miplevel;
r_drawsurf.surfwidth = surface->extents[0] >> miplevel;
r_drawsurf.rowbytes = r_drawsurf.surfwidth * TEX_BYTES;
r_drawsurf.surfheight = surface->extents[1] >> miplevel;
//
// allocate memory if needed
//
if (!cache) { // if a texture just animated, don't reallocate it
cache = D_SCAlloc(r_drawsurf.surfwidth,
r_drawsurf.surfwidth * r_drawsurf.surfheight * TEX_BYTES);
surface->cachespots[miplevel] = cache;
cache->owner = &surface->cachespots[miplevel];
cache->mipscale = surfscale;
}
if (surface->dlightframe == r_framecount)
cache->dlight = 1;
else
cache->dlight = 0;
r_drawsurf.surfdat = (pixel_t *)cache->data;
cache->image = r_drawsurf.image;
cache->lightadj[0] = r_drawsurf.lightadj[0];
cache->lightadj[1] = r_drawsurf.lightadj[1];
cache->lightadj[2] = r_drawsurf.lightadj[2];
cache->lightadj[3] = r_drawsurf.lightadj[3];
//
// draw and light the surface texture
//
r_drawsurf.surf = surface;
c_surf++;
// calculate the lightings
R_BuildLightMap();
// rasterize the surface into the cache
R_DrawSurface();
return cache;
}
| {
"pile_set_name": "Github"
} |
name follow.app
longname "Follow Me"
type appl, process, single
class FollowProcessClass
appobj FollowApp
tokenchars "FoMe"
tokenid 16431
platform gpc12
library geos
library ui
library ansic
library game
library sound
exempt game
exempt sound
resource AppResource object
resource Interface object
resource InterfaceDone object
resource InterfaceStartLevel object
resource InterfaceSpeed object
resource InterfaceReaction object
resource InterfaceSound object
resource StringsResource lmem read-only shared discardable
resource QTipsResource object
export FollowProcessClass
export FollowViewClass
export FollowContentClass
| {
"pile_set_name": "Github"
} |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const saveFile = (data: any, name: string) => {
const newData = JSON.stringify(data);
const tagA = document.createElement('a');
tagA.download = name;
tagA.style.display = 'none';
const blob = new Blob([newData]);
tagA.href = URL.createObjectURL(blob);
document.body.appendChild(tagA);
tagA.click();
document.body.removeChild(tagA);
};
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cdf="http://checklists.nist.gov/xccdf/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<!-- setting the external variable $notes identifies a file from which to add notes,
but set to nothing by default -->
<xsl:param name="notes" select="''" />
<xsl:variable name="notegroup" select="document($notes)/notegroup" />
<xsl:template match="/">
<html>
<head>
<title>Rules In <xsl:value-of select="/cdf:Benchmark/cdf:title" /><xsl:if test="$notes"> with Notes for Transition to <xsl:value-of select="$product_short_name" /> Consensus</xsl:if></title>
</head>
<body>
<br/>
<br/>
<div style="text-align: center; font-size: x-large; font-weight:bold">
Rules In <i><xsl:value-of select="/cdf:Benchmark/cdf:title" /></i><xsl:if test="$notes"> with Notes for Transition to <xsl:value-of select="$product_short_name" /> Consensus</xsl:if>
</div>
<br/>
<br/>
<xsl:apply-templates select="cdf:Benchmark"/>
</body>
</html>
</xsl:template>
<xsl:template match="cdf:Benchmark">
<xsl:call-template name="table-style" />
<table>
<thead>
<xsl:choose>
<xsl:when test="$notes">
<td>
<table class="bbl">
<tr><td class="bl">Title</td></tr>
<tr><td>V-ID</td></tr>
<tr><td>CCI</td></tr>
<tr><td>CAT</td></tr>
</table>
</td>
</xsl:when>
<xsl:otherwise>
<td>V-ID</td>
<td>CCI</td>
<td>CAT</td>
<td>Title</td>
</xsl:otherwise>
</xsl:choose>
<td>Description</td>
<td>Check Procedures</td>
<td>Fixtext</td>
<td>Version</td>
<xsl:if test='$notes'>
<td>Notes</td>
</xsl:if>
</thead>
<xsl:apply-templates select=".//cdf:Group" />
</table>
</xsl:template>
<xsl:template name="rule-output">
<xsl:param name="vulnid"/>
<tr>
<xsl:choose>
<xsl:when test="$notes">
<td>
<table class="bl">
<tr><td><xsl:value-of select="cdf:Rule/cdf:title" /></td></tr>
<tr><td><xsl:value-of select="@id"/></td></tr>
<!--<tr><td><xsl:value-of select="cdf:title" /></td></tr>-->
<tr><td><xsl:value-of select="cdf:Rule/@severity" /></td></tr>
</table>
</td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="@id"/></td>
<td> <xsl:value-of select="cdf:Rule/cdf:ident" /></td>
<!--<td> <xsl:value-of select="cdf:title" /></td>-->
<td> <xsl:value-of select="cdf:Rule/@severity" /></td>
<td> <xsl:value-of select="cdf:Rule/cdf:title" /></td>
</xsl:otherwise>
</xsl:choose>
<td> <xsl:call-template name="extract-vulndiscussion"><xsl:with-param name="desc" select="cdf:Rule/cdf:description"/></xsl:call-template> </td>
<td> <xsl:apply-templates select="cdf:Rule/cdf:check/cdf:check-content/node()"/> </td>
<td> <xsl:apply-templates select="cdf:Rule/cdf:fixtext/node()"/> </td>
<td> <xsl:apply-templates select="cdf:Rule/cdf:version/node()"/> </td>
<xsl:if test='$notes'>
<td> <table><xsl:call-template name="print-notes"><xsl:with-param name="vulnid" select="@id"/></xsl:call-template> </table> </td>
</xsl:if>
</tr>
</xsl:template>
<xsl:template match="cdf:Group">
<xsl:call-template name="rule-output" select="cdf:Rule">
<xsl:with-param name="vulnid" select="@id" />
</xsl:call-template>
</xsl:template>
<xsl:template name="print-notes">
<xsl:param name="vulnid"/>
<xsl:for-each select="$notegroup/note">
<xsl:call-template name="search_vulnidlist" select="note">
<xsl:with-param name="vulnid_sought" select="$vulnid" />
<xsl:with-param name="vulnid_list" select="@ref" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="search_vulnidlist">
<xsl:param name="vulnid_sought"/>
<xsl:param name="vulnid_list"/>
<xsl:variable name="delim" select="','" />
<xsl:choose>
<xsl:when test="$delim and contains($vulnid_list, $delim)">
<xsl:call-template name="note-output" >
<xsl:with-param name="vulnid_sought" select="$vulnid_sought" />
<xsl:with-param name="vulnid_found" select="substring-before($vulnid_list, $delim)" />
</xsl:call-template>
<!-- recurse for additional vuln ids in list -->
<xsl:call-template name="search_vulnidlist">
<xsl:with-param name="vulnid_sought" select="$vulnid_sought" />
<xsl:with-param name="vulnid_list" select="substring-after($vulnid_list, $delim)" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="note-output" >
<xsl:with-param name="vulnid_sought" select="$vulnid_sought" />
<xsl:with-param name="vulnid_found" select="$vulnid_list" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- output note text if vuln ID matches -->
<xsl:template name="note-output">
<xsl:param name="vulnid_sought"/>
<xsl:param name="vulnid_found"/>
<xsl:variable name="vulnid_found_normal" select="normalize-space($vulnid_found)" />
<xsl:variable name="vulnid_expanded" select="concat('V-', $vulnid_found_normal)" />
<xsl:if test="$vulnid_sought=$vulnid_expanded">
<tr><td><xsl:value-of select="@auth"/>: <xsl:value-of select="." /></td></tr>
</xsl:if>
</xsl:template>
<!-- remove any encoded non-XCCDF tags. -->
<!-- continue to wonder: -->
<!-- 1) why this is not in the XCCDF spec, if it's needed by one of its major users, or -->
<!-- 2) why this garbage is ever exported by VMS -->
<!-- this should be removed as soon as SRGs don't include this detritus -->
<xsl:template name="extract-vulndiscussion">
<xsl:param name="desc"/>
<xsl:if test="contains($desc, '<VulnDiscussion>')">
<xsl:variable name="desc_info" select="substring-before($desc, '</VulnDiscussion>')"/>
<xsl:value-of select="substring-after($desc_info, '<VulnDiscussion>')"/>
</xsl:if>
<xsl:if test="not(contains($desc, '<VulnDiscussion>'))">
<xsl:apply-templates select="$desc"/>
</xsl:if>
</xsl:template>
<!-- getting rid of XHTML namespace -->
<xsl:template match="xhtml:*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="cdf:description">
<xsl:apply-templates select="@*|node()" />
</xsl:template>
<xsl:template match="cdf:rationale">
<xsl:apply-templates select="@*|node()" />
</xsl:template>
</xsl:stylesheet>
| {
"pile_set_name": "Github"
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.loiane.cursojava.aula17.labs;
import java.util.Scanner;
/**
*
* @author loiane
*/
public class Exer16 {
public static void main(String[] args){
//Scanner scan = new Scanner(System.in);
int primeiro = 1;
int segundo = 1;
int proximo = 0;
System.out.println(primeiro);
System.out.println(segundo);
while (proximo <= 500){
proximo = primeiro + segundo;
primeiro = segundo;
segundo = proximo;
System.out.println(proximo);
}
}
}
| {
"pile_set_name": "Github"
} |
/**
* @fileoverview Require usage of specified node modules.
* @author Rich Trott
*/
'use strict';
var path = require('path');
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = function(context) {
// trim required module names
var requiredModules = context.options;
var foundModules = [];
// if no modules are required we don't need to check the CallExpressions
if (requiredModules.length === 0) {
return {};
}
/**
* Function to check if a node is a string literal.
* @param {ASTNode} node The node to check.
* @returns {boolean} If the node is a string literal.
*/
function isString(node) {
return node && node.type === 'Literal' && typeof node.value === 'string';
}
/**
* Function to check if a node is a require call.
* @param {ASTNode} node The node to check.
* @returns {boolean} If the node is a require call.
*/
function isRequireCall(node) {
return node.callee.type === 'Identifier' && node.callee.name === 'require';
}
/**
* Function to check if a node has an argument that is a required module and
* return its name.
* @param {ASTNode} node The node to check
* @returns {undefined|String} required module name or undefined
*/
function getRequiredModuleName(node) {
var moduleName;
// node has arguments and first argument is string
if (node.arguments.length && isString(node.arguments[0])) {
var argValue = path.basename(node.arguments[0].value.trim());
// check if value is in required modules array
if (requiredModules.indexOf(argValue) !== -1) {
moduleName = argValue;
}
}
return moduleName;
}
return {
'CallExpression': function(node) {
if (isRequireCall(node)) {
var requiredModuleName = getRequiredModuleName(node);
if (requiredModuleName) {
foundModules.push(requiredModuleName);
}
}
},
'Program:exit': function(node) {
if (foundModules.length < requiredModules.length) {
var missingModules = requiredModules.filter(
function(module) {
return foundModules.indexOf(module === -1);
}
);
missingModules.forEach(function(moduleName) {
context.report(
node,
'Mandatory module "{{moduleName}}" must be loaded.',
{ moduleName: moduleName }
);
});
}
}
};
};
module.exports.schema = {
'type': 'array',
'additionalItems': {
'type': 'string'
},
'uniqueItems': true
};
| {
"pile_set_name": "Github"
} |
const { expect } = require('chai');
const { captureConsoleInfo, captureConsoleWarn } = require('../capture_output');
const attention = require('../../lib/helpers/attention');
describe('attention helper', () => {
context('not in a TTY', () => {
it('has a working method info', () => {
const f = function () { attention.info('a message'); };
const stderr = captureConsoleInfo(f);
expect(stderr).to.equal('NOTICE: a message\n');
});
it('has a working method warn', () => {
const f = function () { attention.warn('a message'); };
const stderr = captureConsoleWarn(f);
expect(stderr).to.equal('WARNING: a message\n');
});
});
context('in a TTY', () => {
it('has a working method info with color', () => {
const f = function () { attention.info('a message'); };
const stderr = captureConsoleInfo(f, true);
expect(stderr).to.equal('\x1b[33;1mNOTICE: a message\x1b[0m\n');
});
it('has a working method warn with color', () => {
const f = function () { attention.warn('a message'); };
const stderr = captureConsoleWarn(f, true);
expect(stderr).to.equal('\x1b[31;1mWARNING: a message\x1b[0m\n');
});
});
});
| {
"pile_set_name": "Github"
} |
/*
* Created on 20-Dec-2005
* Created by Paul Gardner
* Copyright (C) 2005, 2006 Aelitis, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* AELITIS, SAS au capital de 46,603.30 euros
* 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
*
*/
package com.aelitis.azureus.core.instancemanager;
import java.net.InetAddress;
public interface
AZInstance
{
public String
getID();
public InetAddress
getInternalAddress();
public InetAddress
getExternalAddress();
public int
getTCPListenPort();
public int
getUDPListenPort();
public int
getUDPNonDataListenPort();
public String
getString();
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML>
<html>
<head>
<title> 可编辑表格</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../assets/css/dpl-min.css" rel="stylesheet" type="text/css" />
<link href="../assets/css/bui-min.css" rel="stylesheet" type="text/css" />
<link href="../assets/css/page-min.css" rel="stylesheet" type="text/css" /> <!-- 下面的样式,仅是为了显示代码,而不应该在项目中使用-->
<link href="../assets/css/prettify.css" rel="stylesheet" type="text/css" />
<style type="text/css">
code {
padding: 0px 4px;
color: #d14;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
}
</style>
</head>
<body>
<div class="container">
<div id="grid"></div>
<p>
<button id="btnSave" class="button button-primary">提交</button>
</p>
<h2>提交结果</h2>
<div class="row">
<div id="log" class="well span12">
</div>
</div>
<hr>
<div class="row">
<div class="span8">
<h2>简介</h2>
<p>可编辑表格在表单中经常使用,用于编辑列表信息。有以下需要处理的点:</p>
<ol>
<li>编辑器 : 不同类型的数据需要不同类型的编辑器,各类编辑器的配置项也有差异,验证信息需要配置在编辑器中。</li>
<li>添加操作 :添加数据时有2点需要注意:
<ol>
<li>字段的默认值</li>
<li>添加数据的位置,最前面还是最后面</li>
</ol>
</li>
<li>删除操作:可以批量删除或者单行删除</li>
<li>提交表格数据</li>
</ol>
</div>
<div class="span16">
<h2>编辑器</h2>
<p>编辑器在列定义时配置,使用<code>editor : {}</code>格式,其中的对象是编辑数据的字段的配置,可参看:<a href="http://http://www.builive.com//docs/#!/api/BUI.Form.Field" target="_blank">表单字段</a></p>
<p>编辑器的类型常使用<code>xtype</code>指定,常用类型如下:</p>
<ol>
<li><code>text</code> : 文本输入框,参看:<a href="http://http://www.builive.com//docs/#!/api/BUI.Form.Field.Text" target="_blank">表单文本字段</a></li>
<li><code>number</code> : 数字,参看:<a href="http://http://www.builive.com//docs/#!/api/BUI.Form.Field.Number" target="_blank">表单数字字段</a>,常见配置项
<ol>
<li><code>min</code> : 最小值</li>
<li><code>max</code> : 最大值</li>
<li><code>allowDecimals</code> : 允许小数,默认 true</li>
</ol>
</li>
<li><code>date</code> : 日期,参看<a href="http://http://www.builive.com//docs/#!/api/BUI.Form.Field.Date" target="_blank">表单日期字段</a>,常见配置:
<ol>
<li><code>min</code> : 最小日期</li>
<li><code>max</code> : 最大日期</li>
<li><code>showTime</code> : 是否选择时、分、秒</li>
</ol>
</li>
<li><code>select</code> :选择框,参看<a href="http://http://www.builive.com//docs/#!/api/BUI.Form.Field.Select" target="_blank">表单选择框字段</a>常见配置:
<ol>
<li><code>items</code> : 选择列表的选项,支持的格式 [{text : 'a',value:'a'},{text : 'b',value:'b'}],或者 {a : 'a',b : 'b'}
</li>
</ol>
</li>
</ol>
<p>
<span class="label label-warning">注意</span>:日期类型可以接受 字符串,数字(date.getTime())或者日期类型,但是返回类型全部是以数字类型返回,所以建议日期类型的初始类型也是数字格式。
</p>
</div>
</div>
<div class="row">
<div class="span8">
<h3>验证</h3>
<p>可以在编辑器中配置验证信息,支持2中方式:</p>
<ol>
<li>rules : 验证规则,参看:<a class="page-action" data-id="valid" href="#">表单基础验证</a></li>
<li>validator : 自定义验证函数,函数原型:function(value,obj){}</li>
</ol>
</div>
<div class="span16">
<h3>示例</h3>
<pre class="prettyprint linenums">
var columns = [
//文本编辑器,必填
{title : '学校名称',dataIndex :'school',editor : {xtype : 'text',rules:{required:true}}},
//日期编辑器
{title : '入学日期',dataIndex :'enter',editor : {xtype : 'date'},renderer : Grid.Format.dateRenderer},//使用现有的渲染函数,日期格式化
//日期编辑器,自定义验证函数
{title : '毕业日期',dataIndex :'outter',editor : {xtype : 'date',validator : function(value,obj){
if(obj.enter && value && obj.enter > value){
return '毕业日期不能晚于入学日期!'
}
}},renderer : Grid.Format.dateRenderer},
{title : '备注',dataIndex :'memo',width:200,editor : {xtype : 'text'}}
];
</pre>
</div>
</div>
<div class="row">
<div class="span8">
<h2>生成表格</h2>
<p>生成表格需要配置以下内容:</p>
<ol>
<li>列配置</li>
<li>初始化数据 </li>
<li>数据缓冲类</li>
<li>表格配置</li>
<li>单元格编辑插件</li>
</ol>
</div>
<div class="span16">
<h3>代码</h3>
<p>列配置在此处代码上面</p>
<pre class="prettyprint linenums">
//默认的数据
var data = [//日期数据以数字格式提供,为了使传入传出数据格式一致,返回值为date.getTime()生成的数字
{id:'1',school:'武汉第一初级中学',enter:936144000000,outter:993945600000,memo:'表现优异,多次评为三好学生'},
{id:'2',school:'武汉第一高级中学',enter:999561600000,outter:1057017600000,memo:'表现优异,多次评为三好学生'}
],
//数据缓冲类
store = new Data.Store({
data:data
}),
//单元格编辑插件
editing = new Grid.Plugins.CellEditing(),
//表格配置
grid = new Grid.Grid({
render : '#grid',
columns : columns,
width : 700,
forceFit : true,
store : store,
plugins : [Grid.Plugins.CheckSelection,editing],
tbar:{
items : [{
btnCls : 'button button-small',
text : '<i class="icon-plus"></i>添加',
listeners : {
'click' : addFunction
}
},
{
btnCls : 'button button-small',
text : '<i class="icon-remove"></i>删除',
listeners : {
'click' : delFunction
}
}]
}
});
grid.render();
</pre>
</div>
</div>
<div class="row">
<div class="span8">
<h2>其他操作</h2>
<p>表格的编辑操作可以直接点击单元格进行编辑,通过验证保存到表格中。</p>
<ol>
<li>添加和删除操作需要自定义函数,在上面的按钮栏上注册了<code>addFunction</code>和<code>delFunction</code>事件处理函数</li>
<li>提交表格数据,可以异步提交表格,或者将表格数据保存到表单的隐藏域中,进行提交,提交前,进行表格验证。 </li>
</ol>
</div>
<div class="span16">
<h3>添加,删除</h3>
<pre class="prettyprint linenums">
//添加记录
function addFunction(){
var newData = {school :'请输入学校名称'};
store.add(newData);//如果指定添加的位置,使用 store.addAt(newData,index);
editing.edit(newData,'school'); //添加记录后,直接编辑
}
//删除选中的记录
function delFunction(){
var selections = grid.getSelection();
store.remove(selections);
}
</pre>
<h3>提交数据</h3>
<p>本页未提供表单,所以,直接把数据显示出来。</p>
<pre class="prettyprint linenums">
var logEl = $('#log');
$('#btnSave').on('click',function(){
if(editing.isValid()){ //判断是否通过验证,如果在表单中,那么阻止表单提交
var records = store.getResult();
logEl.text(BUI.JSON.stringify(records));
}
});
</pre>
</div>
</div>
</div>
<script type="text/javascript" src="../assets/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="../assets/js/bui-min.js"></script>
<script type="text/javascript" src="../assets/js/config-min.js"></script>
<script type="text/javascript">
BUI.use('common/page');
</script>
<!-- 仅仅为了显示代码使用,不要在项目中引入使用-->
<script type="text/javascript" src="../assets/js/prettify.js"></script>
<script type="text/javascript">
$(function () {
prettyPrint();
});
</script>
<script type="text/javascript">
BUI.use(['bui/grid','bui/data'],function (Grid,Data) {
var columns = [{title : '学校名称',dataIndex :'school',editor : {xtype : 'text',rules:{required:true}}},
{title : '入学日期',dataIndex :'enter',editor : {xtype : 'date',rules:{required:true}},renderer : Grid.Format.dateRenderer},//使用现有的渲染函数,日期格式化
{title : '毕业日期',dataIndex :'outter',editor : {xtype : 'date',rules:{required:true},validator : function(value,obj){
if(obj.enter && value && obj.enter > value){
return '毕业日期不能晚于入学日期!'
}
}},renderer : Grid.Format.dateRenderer},
{title : '备注',dataIndex :'memo',width:200,editor : {xtype : 'text'}}
],
//默认的数据
data = [{id:'1',school:'武汉第一初级中学',enter:936144000000,outter:'2001-01-01',memo:'表现优异,多次评为三好学生'},
{id:'2',school:'武汉第一高级中学',enter:999561600000,outter:1057017600000,memo:'表现优异,多次评为三好学生'}],
store = new Data.Store({
data:data
}),
editing = new Grid.Plugins.CellEditing(),
grid = new Grid.Grid({
render : '#grid',
columns : columns,
width : 700,
forceFit : true,
store : store,
plugins : [Grid.Plugins.CheckSelection,editing],
tbar:{
items : [{
btnCls : 'button button-small',
text : '<i class="icon-plus"></i>添加',
listeners : {
'click' : addFunction
}
},
{
btnCls : 'button button-small',
text : '<i class="icon-remove"></i>删除',
listeners : {
'click' : delFunction
}
}]
}
});
grid.render();
function addFunction(){
var newData = {school :'请输入学校名称'};
store.add(newData);
editing.edit(newData,'school'); //添加记录后,直接编辑
}
function delFunction(){
var selections = grid.getSelection();
store.remove(selections);
}
var logEl = $('#log');
$('#btnSave').on('click',function(){
if(editing.isValid()){
var records = store.getResult();
logEl.text(BUI.JSON.stringify(records));
}
});
});
</script>
<body>
</html> | {
"pile_set_name": "Github"
} |
form=七律
tags=
一别三年长在梦,
梦中时蹑石棱层。
泉声入夜方堪听,
山色逢秋始好登。
岩鹿惯随锄药叟,
溪鸥不怕洗苔僧。
人间有许多般事,
求要身闲直未能。
| {
"pile_set_name": "Github"
} |
module.exports = {
plugins: ["gatsby-theme-mdx-deck", "gatsby-plugin-react-helmet"]
};
| {
"pile_set_name": "Github"
} |
# Copyright 2015 Tesora Inc.
# 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.
from oslo_log import log as logging
from trove.common.strategies.cluster import base
from trove.guestagent import api as guest_api
LOG = logging.getLogger(__name__)
class CassandraGuestAgentStrategy(base.BaseGuestAgentStrategy):
@property
def guest_client_class(self):
return CassandraGuestAgentAPI
class CassandraGuestAgentAPI(guest_api.API):
"""Cluster Specific Datastore Guest API
**** VERSION CONTROLLED API ****
The methods in this class are subject to version control as
coordinated by guestagent/api.py. Whenever a change is made to
any API method in this class, add a version number and comment
to the top of guestagent/api.py and use the version number as
appropriate in this file
"""
def get_data_center(self):
LOG.debug("Retrieving the data center for node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._call("get_data_center", self.agent_low_timeout,
version=version)
def get_rack(self):
LOG.debug("Retrieving the rack for node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._call("get_rack", self.agent_low_timeout,
version=version)
def set_seeds(self, seeds):
LOG.debug("Configuring the gossip seeds for node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._call("set_seeds", self.agent_low_timeout,
version=version, seeds=seeds)
def get_seeds(self):
LOG.debug("Retrieving the gossip seeds for node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._call("get_seeds", self.agent_low_timeout,
version=version)
def set_auto_bootstrap(self, enabled):
LOG.debug("Setting the auto-bootstrap to '%(enabled)s' "
"for node: %(id)s", {'enabled': enabled, 'id': self.id})
version = guest_api.API.API_BASE_VERSION
return self._call("set_auto_bootstrap", self.agent_low_timeout,
version=version, enabled=enabled)
def cluster_complete(self):
LOG.debug("Sending a setup completion notification for node: %s",
self.id)
version = guest_api.API.API_BASE_VERSION
return self._call("cluster_complete", self.agent_high_timeout,
version=version)
def node_cleanup_begin(self):
LOG.debug("Signaling the node to prepare for cleanup: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._call("node_cleanup_begin", self.agent_low_timeout,
version=version)
def node_cleanup(self):
LOG.debug("Running cleanup on node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._cast('node_cleanup', version=version)
def node_decommission(self):
LOG.debug("Decommission node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._cast("node_decommission", version=version)
def cluster_secure(self, password):
LOG.debug("Securing the cluster via node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._call(
"cluster_secure", self.agent_high_timeout,
version=version, password=password)
def get_admin_credentials(self):
LOG.debug("Retrieving the admin credentials from node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._call("get_admin_credentials", self.agent_low_timeout,
version=version)
def store_admin_credentials(self, admin_credentials):
LOG.debug("Storing the admin credentials on node: %s", self.id)
version = guest_api.API.API_BASE_VERSION
return self._call("store_admin_credentials",
self.agent_low_timeout,
version=version,
admin_credentials=admin_credentials)
| {
"pile_set_name": "Github"
} |
/**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'placeholder', 'de-ch', {
title: 'Platzhaltereinstellungen',
toolbar: 'Platzhalter',
name: 'Platzhaltername',
invalidName: 'Der Platzhalter darf nicht leer sein und folgende Zeichen nicht enthalten: [, ], <, >',
pathName: 'Platzhalter'
} );
| {
"pile_set_name": "Github"
} |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Customer\Model;
use Magento\Framework\Exception\InvalidEmailOrPasswordException;
use Magento\Framework\Exception\State\UserLockedException;
/**
* Interface \Magento\Customer\Model\AuthenticationInterface
* @api
* @since 100.1.0
*/
interface AuthenticationInterface
{
/**
* Process customer authentication failure
*
* @param int $customerId
* @return void
* @since 100.1.0
*/
public function processAuthenticationFailure($customerId);
/**
* Unlock customer
*
* @param int $customerId
* @return void
* @since 100.1.0
*/
public function unlock($customerId);
/**
* Check if a customer is locked
*
* @param int $customerId
* @return boolean
* @since 100.1.0
*/
public function isLocked($customerId);
/**
* Authenticate customer
*
* @param int $customerId
* @param string $password
* @return boolean
* @throws InvalidEmailOrPasswordException
* @throws UserLockedException
* @since 100.1.0
*/
public function authenticate($customerId, $password);
}
| {
"pile_set_name": "Github"
} |
# Spike.cfg
$sprite_factory = generic_sprite
@$sprite_scripts = Spike.as;
Stone.as;
$sprite_texture = Spike.png
s32_sprite_frame_width = 8
s32_sprite_frame_height = 8
f32 sprite_offset_x = 0
f32 sprite_offset_y = 0
$sprite_gibs_start = *start*
$sprite_gibs_end = *end*
$sprite_animation_start = *start*
$sprite_animation_default_name = default
u16 sprite_animation_default_time = 0
u8_sprite_animation_default_loop = 0
@u16 sprite_animation_default_frames = 0;
$sprite_animation_end = *end*
$shape_factory = box2d_shape
@$shape_scripts =
f32 shape_mass = 250.0
f32 shape_radius = 0.0
f32 shape_friction = 0.3
f32 shape_elasticity = 0.0
f32 shape_buoyancy = 0.8
f32 shape_drag = 0.2
bool shape_collides = no
bool shape_ladder = no
bool shape_platform = no
@f32 verticesXY = 0.0; 2.0;
2.0; 0.0;
4.0; 2.0;
4.0; 8.0;
0.0; 8.0;
u8 block_support = 0
bool block_background = no
bool block_lightpasses = yes
bool block_snaptogrid = no
$movement_factory =
$brain_factory =
$attachment_factory = generic_attachment
@$attachment_scripts =
@$attachment_points = PICKUP; 0; 0; 1; 0; 0;
MECHANISM; 0; 0; 0; 0; 0;
$inventory_factory =
$name = spike
@$scripts = GenericSpike.as;
IgnoreDamage.as;
f32_health = 1.0
$inventory_name =
$inventory_icon = -
u8 inventory_icon_frame = 0
u8 inventory_icon_frame_width = 0
u8 inventory_icon_frame_height = 0
u8 inventory_used_width = 0
u8 inventory_used_height = 0
u8 inventory_max_stacks = 0
| {
"pile_set_name": "Github"
} |
// RUN: rm -rf %t
// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s.result
#define YES __objc_yes
#define NO __objc_no
typedef long NSInteger;
typedef unsigned long NSUInteger;
typedef signed char BOOL;
#define nil ((void*) 0)
@interface NSObject
+ (id)alloc;
@end
@interface NSNumber : NSObject
@end
@interface NSNumber (NSNumberCreation)
- (id)initWithChar:(char)value;
- (id)initWithUnsignedChar:(unsigned char)value;
- (id)initWithShort:(short)value;
- (id)initWithUnsignedShort:(unsigned short)value;
- (id)initWithInt:(int)value;
- (id)initWithUnsignedInt:(unsigned int)value;
- (id)initWithLong:(long)value;
- (id)initWithUnsignedLong:(unsigned long)value;
- (id)initWithLongLong:(long long)value;
- (id)initWithUnsignedLongLong:(unsigned long long)value;
- (id)initWithFloat:(float)value;
- (id)initWithDouble:(double)value;
- (id)initWithBool:(BOOL)value;
- (id)initWithInteger:(NSInteger)value;
- (id)initWithUnsignedInteger:(NSUInteger)value;
+ (NSNumber *)numberWithChar:(char)value;
+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
+ (NSNumber *)numberWithShort:(short)value;
+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
+ (NSNumber *)numberWithInt:(int)value;
+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
+ (NSNumber *)numberWithLong:(long)value;
+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
+ (NSNumber *)numberWithLongLong:(long long)value;
+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
+ (NSNumber *)numberWithFloat:(float)value;
+ (NSNumber *)numberWithDouble:(double)value;
+ (NSNumber *)numberWithBool:(BOOL)value;
+ (NSNumber *)numberWithInteger:(NSInteger)value;
+ (NSNumber *)numberWithUnsignedInteger:(NSUInteger)value;
@end
#define VAL_INT 2
#define VAL_UINT 2U
#define VAL_CHAR 'a'
void foo() {
@'a';
[NSNumber numberWithChar:L'a'];
[NSNumber numberWithChar:2];
[NSNumber numberWithChar:2U];
[NSNumber numberWithChar:2u];
[NSNumber numberWithChar:2L];
[NSNumber numberWithChar:2l];
[NSNumber numberWithChar:2LL];
[NSNumber numberWithChar:2ll];
[NSNumber numberWithChar:2ul];
[NSNumber numberWithChar:2lu];
[NSNumber numberWithChar:2ull];
[NSNumber numberWithChar:2llu];
[NSNumber numberWithChar:2.0];
[NSNumber numberWithChar:2.0f];
[NSNumber numberWithChar:2.0F];
[NSNumber numberWithChar:2.0l];
[NSNumber numberWithChar:2.0L];
[NSNumber numberWithChar:0x2f];
[NSNumber numberWithChar:04];
[NSNumber numberWithChar:0];
[NSNumber numberWithChar:0.0];
[NSNumber numberWithChar:YES];
[NSNumber numberWithChar:NO];
[NSNumber numberWithChar:true];
[NSNumber numberWithChar:false];
[NSNumber numberWithChar:VAL_INT];
[NSNumber numberWithChar:VAL_UINT];
@VAL_CHAR;
[NSNumber numberWithUnsignedChar:'a'];
[NSNumber numberWithUnsignedChar:L'a'];
[NSNumber numberWithUnsignedChar:2];
[NSNumber numberWithUnsignedChar:2U];
[NSNumber numberWithUnsignedChar:2u];
[NSNumber numberWithUnsignedChar:2L];
[NSNumber numberWithUnsignedChar:2l];
[NSNumber numberWithUnsignedChar:2LL];
[NSNumber numberWithUnsignedChar:2ll];
[NSNumber numberWithUnsignedChar:2ul];
[NSNumber numberWithUnsignedChar:2lu];
[NSNumber numberWithUnsignedChar:2ull];
[NSNumber numberWithUnsignedChar:2llu];
[NSNumber numberWithUnsignedChar:2.0];
[NSNumber numberWithUnsignedChar:2.0f];
[NSNumber numberWithUnsignedChar:2.0F];
[NSNumber numberWithUnsignedChar:2.0l];
[NSNumber numberWithUnsignedChar:2.0L];
[NSNumber numberWithUnsignedChar:0x2f];
[NSNumber numberWithUnsignedChar:04];
[NSNumber numberWithUnsignedChar:0];
[NSNumber numberWithUnsignedChar:0.0];
[NSNumber numberWithUnsignedChar:YES];
[NSNumber numberWithUnsignedChar:NO];
[NSNumber numberWithUnsignedChar:true];
[NSNumber numberWithUnsignedChar:false];
[NSNumber numberWithUnsignedChar:VAL_INT];
[NSNumber numberWithUnsignedChar:VAL_UINT];
[NSNumber numberWithUnsignedChar:VAL_CHAR];
[NSNumber numberWithShort:'a'];
[NSNumber numberWithShort:L'a'];
[NSNumber numberWithShort:2];
[NSNumber numberWithShort:2U];
[NSNumber numberWithShort:2u];
[NSNumber numberWithShort:2L];
[NSNumber numberWithShort:2l];
[NSNumber numberWithShort:2LL];
[NSNumber numberWithShort:2ll];
[NSNumber numberWithShort:2ul];
[NSNumber numberWithShort:2lu];
[NSNumber numberWithShort:2ull];
[NSNumber numberWithShort:2llu];
[NSNumber numberWithShort:2.0];
[NSNumber numberWithShort:2.0f];
[NSNumber numberWithShort:2.0F];
[NSNumber numberWithShort:2.0l];
[NSNumber numberWithShort:2.0L];
[NSNumber numberWithShort:0x2f];
[NSNumber numberWithShort:04];
[NSNumber numberWithShort:0];
[NSNumber numberWithShort:0.0];
[NSNumber numberWithShort:YES];
[NSNumber numberWithShort:NO];
[NSNumber numberWithShort:true];
[NSNumber numberWithShort:false];
[NSNumber numberWithShort:VAL_INT];
[NSNumber numberWithShort:VAL_UINT];
[NSNumber numberWithUnsignedShort:'a'];
[NSNumber numberWithUnsignedShort:L'a'];
[NSNumber numberWithUnsignedShort:2];
[NSNumber numberWithUnsignedShort:2U];
[NSNumber numberWithUnsignedShort:2u];
[NSNumber numberWithUnsignedShort:2L];
[NSNumber numberWithUnsignedShort:2l];
[NSNumber numberWithUnsignedShort:2LL];
[NSNumber numberWithUnsignedShort:2ll];
[NSNumber numberWithUnsignedShort:2ul];
[NSNumber numberWithUnsignedShort:2lu];
[NSNumber numberWithUnsignedShort:2ull];
[NSNumber numberWithUnsignedShort:2llu];
[NSNumber numberWithUnsignedShort:2.0];
[NSNumber numberWithUnsignedShort:2.0f];
[NSNumber numberWithUnsignedShort:2.0F];
[NSNumber numberWithUnsignedShort:2.0l];
[NSNumber numberWithUnsignedShort:2.0L];
[NSNumber numberWithUnsignedShort:0x2f];
[NSNumber numberWithUnsignedShort:04];
[NSNumber numberWithUnsignedShort:0];
[NSNumber numberWithUnsignedShort:0.0];
[NSNumber numberWithUnsignedShort:YES];
[NSNumber numberWithUnsignedShort:NO];
[NSNumber numberWithUnsignedShort:true];
[NSNumber numberWithUnsignedShort:false];
[NSNumber numberWithUnsignedShort:VAL_INT];
[NSNumber numberWithUnsignedShort:VAL_UINT];
[NSNumber numberWithInt:'a'];
[NSNumber numberWithInt:L'a'];
@2;
@2;
@2;
@2;
@2;
@2;
@2;
@2;
@2;
@2;
@2;
[NSNumber numberWithInt:2.0];
[NSNumber numberWithInt:2.0f];
[NSNumber numberWithInt:2.0F];
[NSNumber numberWithInt:2.0l];
[NSNumber numberWithInt:2.0L];
@0x2f;
@04;
@0;
[NSNumber numberWithInt:0.0];
[NSNumber numberWithInt:YES];
[NSNumber numberWithInt:NO];
[NSNumber numberWithInt:true];
[NSNumber numberWithInt:false];
@VAL_INT;
[NSNumber numberWithInt:VAL_UINT];
(void)[[NSNumber alloc] initWithInt:2];
(void)[[NSNumber alloc] initWithInt:2U];
@+2;
@-2;
[NSNumber numberWithUnsignedInt:'a'];
[NSNumber numberWithUnsignedInt:L'a'];
@2U;
@2U;
@2u;
@2U;
@2u;
@2U;
@2u;
@2u;
@2u;
@2u;
@2u;
[NSNumber numberWithUnsignedInt:2.0];
[NSNumber numberWithUnsignedInt:2.0f];
[NSNumber numberWithUnsignedInt:2.0F];
[NSNumber numberWithUnsignedInt:2.0l];
[NSNumber numberWithUnsignedInt:2.0L];
@0x2fU;
@04U;
@0U;
[NSNumber numberWithUnsignedInt:0.0];
[NSNumber numberWithUnsignedInt:YES];
[NSNumber numberWithUnsignedInt:NO];
[NSNumber numberWithUnsignedInt:true];
[NSNumber numberWithUnsignedInt:false];
[NSNumber numberWithUnsignedInt:VAL_INT];
@VAL_UINT;
[NSNumber numberWithLong:'a'];
[NSNumber numberWithLong:L'a'];
@2L;
@2L;
@2l;
@2L;
@2l;
@2L;
@2l;
@2l;
@2l;
@2l;
@2l;
[NSNumber numberWithLong:2.0];
[NSNumber numberWithLong:2.0f];
[NSNumber numberWithLong:2.0F];
[NSNumber numberWithLong:2.0l];
[NSNumber numberWithLong:2.0L];
@0x2fL;
@04L;
@0L;
[NSNumber numberWithLong:0.0];
[NSNumber numberWithLong:YES];
[NSNumber numberWithLong:NO];
[NSNumber numberWithLong:true];
[NSNumber numberWithLong:false];
[NSNumber numberWithLong:VAL_INT];
[NSNumber numberWithLong:VAL_UINT];
[NSNumber numberWithUnsignedLong:'a'];
[NSNumber numberWithUnsignedLong:L'a'];
@2UL;
@2UL;
@2ul;
@2UL;
@2ul;
@2UL;
@2ul;
@2ul;
@2lu;
@2ul;
@2ul;
[NSNumber numberWithUnsignedLong:2.0];
[NSNumber numberWithUnsignedLong:2.0f];
[NSNumber numberWithUnsignedLong:2.0F];
[NSNumber numberWithUnsignedLong:2.0l];
[NSNumber numberWithUnsignedLong:2.0L];
@0x2fUL;
@04UL;
@0UL;
[NSNumber numberWithUnsignedLong:0.0];
[NSNumber numberWithUnsignedLong:YES];
[NSNumber numberWithUnsignedLong:NO];
[NSNumber numberWithUnsignedLong:true];
[NSNumber numberWithUnsignedLong:false];
[NSNumber numberWithUnsignedLong:VAL_INT];
[NSNumber numberWithUnsignedLong:VAL_UINT];
[NSNumber numberWithLongLong:'a'];
[NSNumber numberWithLongLong:L'a'];
@2LL;
@2LL;
@2ll;
@2LL;
@2ll;
@2LL;
@2ll;
@2ll;
@2ll;
@2ll;
@2ll;
[NSNumber numberWithLongLong:2.0];
[NSNumber numberWithLongLong:2.0f];
[NSNumber numberWithLongLong:2.0F];
[NSNumber numberWithLongLong:2.0l];
[NSNumber numberWithLongLong:2.0L];
@0x2fLL;
@04LL;
@0LL;
[NSNumber numberWithLongLong:0.0];
[NSNumber numberWithLongLong:YES];
[NSNumber numberWithLongLong:NO];
[NSNumber numberWithLongLong:true];
[NSNumber numberWithLongLong:false];
[NSNumber numberWithLongLong:VAL_INT];
[NSNumber numberWithLongLong:VAL_UINT];
[NSNumber numberWithUnsignedLongLong:'a'];
[NSNumber numberWithUnsignedLongLong:L'a'];
@2ULL;
@2ULL;
@2ull;
@2ULL;
@2ull;
@2ULL;
@2ull;
@2ull;
@2ull;
@2ull;
@2llu;
[NSNumber numberWithUnsignedLongLong:2.0];
[NSNumber numberWithUnsignedLongLong:2.0f];
[NSNumber numberWithUnsignedLongLong:2.0F];
[NSNumber numberWithUnsignedLongLong:2.0l];
[NSNumber numberWithUnsignedLongLong:2.0L];
@0x2fULL;
@04ULL;
@0ULL;
[NSNumber numberWithUnsignedLongLong:0.0];
[NSNumber numberWithUnsignedLongLong:YES];
[NSNumber numberWithUnsignedLongLong:NO];
[NSNumber numberWithUnsignedLongLong:true];
[NSNumber numberWithUnsignedLongLong:false];
[NSNumber numberWithUnsignedLongLong:VAL_INT];
[NSNumber numberWithUnsignedLongLong:VAL_UINT];
[NSNumber numberWithFloat:'a'];
[NSNumber numberWithFloat:L'a'];
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0f;
@2.0F;
@2.0f;
@2.0f;
[NSNumber numberWithFloat:0x2f];
[NSNumber numberWithFloat:04];
@0.0f;
@0.0f;
[NSNumber numberWithFloat:YES];
[NSNumber numberWithFloat:NO];
[NSNumber numberWithFloat:true];
[NSNumber numberWithFloat:false];
[NSNumber numberWithFloat:VAL_INT];
[NSNumber numberWithFloat:VAL_UINT];
[NSNumber numberWithDouble:'a'];
[NSNumber numberWithDouble:L'a'];
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
@2.0;
[NSNumber numberWithDouble:0x2f];
[NSNumber numberWithDouble:04];
@0.0;
@0.0;
[NSNumber numberWithDouble:YES];
[NSNumber numberWithDouble:NO];
[NSNumber numberWithDouble:true];
[NSNumber numberWithDouble:false];
[NSNumber numberWithDouble:VAL_INT];
[NSNumber numberWithDouble:VAL_UINT];
[NSNumber numberWithBool:'a'];
[NSNumber numberWithBool:L'a'];
[NSNumber numberWithBool:2];
[NSNumber numberWithBool:2U];
[NSNumber numberWithBool:2u];
[NSNumber numberWithBool:2L];
[NSNumber numberWithBool:2l];
[NSNumber numberWithBool:2LL];
[NSNumber numberWithBool:2ll];
[NSNumber numberWithBool:2ul];
[NSNumber numberWithBool:2lu];
[NSNumber numberWithBool:2ull];
[NSNumber numberWithBool:2llu];
[NSNumber numberWithBool:2.0];
[NSNumber numberWithBool:2.0f];
[NSNumber numberWithBool:2.0F];
[NSNumber numberWithBool:2.0l];
[NSNumber numberWithBool:2.0L];
[NSNumber numberWithBool:0x2f];
[NSNumber numberWithBool:04];
[NSNumber numberWithBool:0];
[NSNumber numberWithBool:0.0];
@YES;
@NO;
@true;
@false;
[NSNumber numberWithBool:VAL_INT];
[NSNumber numberWithBool:VAL_UINT];
[NSNumber numberWithInteger:'a'];
[NSNumber numberWithInteger:L'a'];
@2;
@2;
@2;
@2L;
@2l;
@2;
@2;
@2;
@2;
@2;
@2;
[NSNumber numberWithInteger:2.0];
[NSNumber numberWithInteger:2.0f];
[NSNumber numberWithInteger:2.0F];
[NSNumber numberWithInteger:2.0l];
[NSNumber numberWithInteger:2.0L];
@0x2f;
@04;
@0;
[NSNumber numberWithInteger:0.0];
[NSNumber numberWithInteger:YES];
[NSNumber numberWithInteger:NO];
[NSNumber numberWithInteger:true];
[NSNumber numberWithInteger:false];
@VAL_INT;
[NSNumber numberWithInteger:VAL_UINT];
[NSNumber numberWithUnsignedInteger:'a'];
[NSNumber numberWithUnsignedInteger:L'a'];
@2U;
@2U;
@2u;
@2U;
@2u;
@2U;
@2u;
@2ul;
@2lu;
@2u;
@2u;
[NSNumber numberWithUnsignedInteger:2.0];
[NSNumber numberWithUnsignedInteger:2.0f];
[NSNumber numberWithUnsignedInteger:2.0F];
[NSNumber numberWithUnsignedInteger:2.0l];
[NSNumber numberWithUnsignedInteger:2.0L];
@0x2fU;
@04U;
@0U;
[NSNumber numberWithUnsignedInteger:0.0];
[NSNumber numberWithUnsignedInteger:YES];
[NSNumber numberWithUnsignedInteger:NO];
[NSNumber numberWithUnsignedInteger:true];
[NSNumber numberWithUnsignedInteger:false];
[NSNumber numberWithUnsignedInteger:VAL_INT];
@VAL_UINT;
}
| {
"pile_set_name": "Github"
} |
Cyclic_Animation=On
Width=12
Height=12
Final_frame=16 ;; NR_ROTS
Antialias=On
Output_Alpha=On
Output_to_File=On
Output_File_Type=n
Input_File_Name=bits.pov
| {
"pile_set_name": "Github"
} |
/**
* @license
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import firebase from '@firebase/app';
import { name, version } from '../package.json';
firebase.registerVersion(name, version, 'app');
export default firebase;
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>CMSIS-DSP: Data Fields - Variables</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="stylsheetf" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 46px;">
<td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">CMSIS-DSP
 <span id="projectnumber">Verison 1.4.1</span>
</div>
<div id="projectbrief">CMSIS DSP Software Library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
<ul class="tablist">
<li><a href="../../General/html/index.html"><span>CMSIS</span></a></li>
<li><a href="../../Core/html/index.html"><span>CORE</span></a></li>
<li class="current"><a href="../../DSP/html/index.html"><span>DSP</span></a></li>
<li><a href="../../RTOS/html/index.html"><span>RTOS API</span></a></li>
<li><a href="../../SVD/html/index.html"><span>SVD</span></a></li>
</ul>
</div>
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Usage and Description</span></a></li>
<li><a href="modules.html"><span>Reference</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="functions.html"><span>All</span></a></li>
<li class="current"><a href="functions_vars.html"><span>Variables</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="functions_vars.html#index_a"><span>a</span></a></li>
<li><a href="functions_vars_0x62.html#index_b"><span>b</span></a></li>
<li><a href="functions_vars_0x65.html#index_e"><span>e</span></a></li>
<li><a href="functions_vars_0x66.html#index_f"><span>f</span></a></li>
<li><a href="functions_vars_0x69.html#index_i"><span>i</span></a></li>
<li><a href="functions_vars_0x6b.html#index_k"><span>k</span></a></li>
<li><a href="functions_vars_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="functions_vars_0x6d.html#index_m"><span>m</span></a></li>
<li class="current"><a href="functions_vars_0x6e.html#index_n"><span>n</span></a></li>
<li><a href="functions_vars_0x6f.html#index_o"><span>o</span></a></li>
<li><a href="functions_vars_0x70.html#index_p"><span>p</span></a></li>
<li><a href="functions_vars_0x72.html#index_r"><span>r</span></a></li>
<li><a href="functions_vars_0x73.html#index_s"><span>s</span></a></li>
<li><a href="functions_vars_0x74.html#index_t"><span>t</span></a></li>
<li><a href="functions_vars_0x78.html#index_x"><span>x</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('functions_vars_0x6e.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_n"></a>- n -</h3><ul>
<li>N
: <a class="el" href="structarm__dct4__instance__f32.html#a262b29a51c371b46efc89120e31ccf37">arm_dct4_instance_f32</a>
, <a class="el" href="structarm__dct4__instance__q31.html#a46a9f136457350676e2bfd3768ff9d6d">arm_dct4_instance_q31</a>
, <a class="el" href="structarm__dct4__instance__q15.html#a53d24009bb9b2e93d0aa07db7f1a6c25">arm_dct4_instance_q15</a>
</li>
<li>Nby2
: <a class="el" href="structarm__dct4__instance__f32.html#adb1ef2739ddbe62e5cdadc47455a4147">arm_dct4_instance_f32</a>
, <a class="el" href="structarm__dct4__instance__q31.html#a32d3268ba4629908dba056599f0a904d">arm_dct4_instance_q31</a>
, <a class="el" href="structarm__dct4__instance__q15.html#af43dcbbc2fc661ffbc525afe3dcbd7da">arm_dct4_instance_q15</a>
</li>
<li>normalize
: <a class="el" href="structarm__dct4__instance__q31.html#ac80ff7b28fca36aeef74dea12e8312dd">arm_dct4_instance_q31</a>
, <a class="el" href="structarm__dct4__instance__q15.html#a197098140d68e89a08f7a249003a0b86">arm_dct4_instance_q15</a>
, <a class="el" href="structarm__dct4__instance__f32.html#a61ce8c967b2e998a9c0041cca73cdef8">arm_dct4_instance_f32</a>
</li>
<li>numCols
: <a class="el" href="structarm__bilinear__interp__instance__q7.html#a860dd0d24380ea06cfbb348fb3b12c9a">arm_bilinear_interp_instance_q7</a>
, <a class="el" href="structarm__matrix__instance__f32.html#acdd1fb73734df68b89565c54f1dd8ae2">arm_matrix_instance_f32</a>
, <a class="el" href="structarm__matrix__instance__q15.html#acbbce67ba058d8e1c867c71d57288c97">arm_matrix_instance_q15</a>
, <a class="el" href="structarm__matrix__instance__q31.html#abd161da7614eda927157f18b698074b1">arm_matrix_instance_q31</a>
, <a class="el" href="structarm__bilinear__interp__instance__f32.html#aede17bebfb1f835b61d71dd813eab3f8">arm_bilinear_interp_instance_f32</a>
, <a class="el" href="structarm__bilinear__interp__instance__q31.html#a6c3eff4eb17ff1d43f170efb84713a2d">arm_bilinear_interp_instance_q31</a>
, <a class="el" href="structarm__bilinear__interp__instance__q15.html#a7fa8772d01583374ff8ac18205a26a37">arm_bilinear_interp_instance_q15</a>
</li>
<li>numRows
: <a class="el" href="structarm__matrix__instance__f32.html#a23f4e34d70a82c9cad7612add5640b7b">arm_matrix_instance_f32</a>
, <a class="el" href="structarm__matrix__instance__q15.html#a9bac6ed54be287c4d4f01a1a28be65f5">arm_matrix_instance_q15</a>
, <a class="el" href="structarm__matrix__instance__q31.html#a63bacac158a821c8cfc06088d251598c">arm_matrix_instance_q31</a>
, <a class="el" href="structarm__bilinear__interp__instance__f32.html#a34f2b17cc57b95011960df9718af6ed6">arm_bilinear_interp_instance_f32</a>
, <a class="el" href="structarm__bilinear__interp__instance__q31.html#a2082e3eac56354d75291f03e96ce4aa5">arm_bilinear_interp_instance_q31</a>
, <a class="el" href="structarm__bilinear__interp__instance__q15.html#a2130ae30a804995a9f5d0e2189e08565">arm_bilinear_interp_instance_q15</a>
, <a class="el" href="structarm__bilinear__interp__instance__q7.html#ad5a8067cab5f9ea4688b11a623e16607">arm_bilinear_interp_instance_q7</a>
</li>
<li>numStages
: <a class="el" href="structarm__fir__lattice__instance__f32.html#ad369bd9997a250f195254df37408a38f">arm_fir_lattice_instance_f32</a>
, <a class="el" href="structarm__iir__lattice__instance__q15.html#a96fbed313bef01070409fa182d26ba3f">arm_iir_lattice_instance_q15</a>
, <a class="el" href="structarm__iir__lattice__instance__q31.html#a9df4570ed28c50fd9193ab654ff236ad">arm_iir_lattice_instance_q31</a>
, <a class="el" href="structarm__biquad__cas__df1__32x64__ins__q31.html#ad7cb9a9f5df8f4fcfc7a0b633672e574">arm_biquad_cas_df1_32x64_ins_q31</a>
, <a class="el" href="structarm__iir__lattice__instance__f32.html#af8de449af5efe1f30be82f9ba35587ee">arm_iir_lattice_instance_f32</a>
, <a class="el" href="structarm__biquad__casd__df1__inst__q15.html#ad6d95e70abcf4ff1300181415ad92153">arm_biquad_casd_df1_inst_q15</a>
, <a class="el" href="structarm__biquad__casd__df1__inst__q31.html#a2c2b579f1df1d8273a5d9d945c27e1b2">arm_biquad_casd_df1_inst_q31</a>
, <a class="el" href="structarm__biquad__casd__df1__inst__f32.html#af69820c37a87252c46453e4cfe120585">arm_biquad_casd_df1_inst_f32</a>
, <a class="el" href="structarm__biquad__cascade__df2_t__instance__f32.html#a4d17958c33c3d0a905f974bac50f033f">arm_biquad_cascade_df2T_instance_f32</a>
, <a class="el" href="structarm__fir__lattice__instance__q15.html#a38b179138d6a6c9cac4f8f79b6fd5357">arm_fir_lattice_instance_q15</a>
, <a class="el" href="structarm__fir__lattice__instance__q31.html#a9f3773bbb76bc5a8a5ee9d37786bf478">arm_fir_lattice_instance_q31</a>
</li>
<li>numTaps
: <a class="el" href="structarm__lms__instance__f32.html#af73880d9009982f5d14529869494ec3d">arm_lms_instance_f32</a>
, <a class="el" href="structarm__fir__sparse__instance__q31.html#a07b6c01e58ec6dde384719130d36b0dc">arm_fir_sparse_instance_q31</a>
, <a class="el" href="structarm__fir__decimate__instance__q31.html#a37915d42b0dc5e3057ebe83110798482">arm_fir_decimate_instance_q31</a>
, <a class="el" href="structarm__fir__instance__q15.html#a0e46f93cf51bfb18b1be808be9c5bfc9">arm_fir_instance_q15</a>
, <a class="el" href="structarm__lms__instance__q31.html#ac0d84f7d054555931ef8a62511fbcb8a">arm_lms_instance_q31</a>
, <a class="el" href="structarm__lms__norm__instance__q15.html#a9ee7a45f4f315d7996a969e25fdc7146">arm_lms_norm_instance_q15</a>
, <a class="el" href="structarm__fir__decimate__instance__f32.html#a2aa2986129db8affef03ede88dd45a03">arm_fir_decimate_instance_f32</a>
, <a class="el" href="structarm__lms__norm__instance__f32.html#ac95f8ca3d816524c2070643852fac5e8">arm_lms_norm_instance_f32</a>
, <a class="el" href="structarm__lms__norm__instance__q31.html#a28e4c085af69c9c3e2e95dacf8004c3e">arm_lms_norm_instance_q31</a>
, <a class="el" href="structarm__fir__sparse__instance__q15.html#a0f66b126dd8b85f7467cfb01b7bc4d77">arm_fir_sparse_instance_q15</a>
, <a class="el" href="structarm__fir__instance__q31.html#a918fadd775b7a0482b21bf34dae2f094">arm_fir_instance_q31</a>
, <a class="el" href="structarm__fir__sparse__instance__f32.html#a5e19e7f234ac30a3db843352bf2a8515">arm_fir_sparse_instance_f32</a>
, <a class="el" href="structarm__lms__instance__q15.html#a0078e894f805af1b360369e619fb57b3">arm_lms_instance_q15</a>
, <a class="el" href="structarm__fir__instance__f32.html#a20cf98c92b5323799b7881c9ff4d2f7c">arm_fir_instance_f32</a>
, <a class="el" href="structarm__fir__instance__q7.html#a9b50840e2c5ef5b17e1a584fb4cf0d06">arm_fir_instance_q7</a>
, <a class="el" href="structarm__fir__decimate__instance__q15.html#ac1e9844488ec717da334fbd4c4f41990">arm_fir_decimate_instance_q15</a>
, <a class="el" href="structarm__fir__sparse__instance__q7.html#a54cdd27ca1c672b126c38763ce678b1c">arm_fir_sparse_instance_q7</a>
</li>
<li>nValues
: <a class="el" href="structarm__linear__interp__instance__f32.html#a95f02a926b16d35359aca5b31e813b11">arm_linear_interp_instance_f32</a>
</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Mon Mar 18 2013 13:37:58 for CMSIS-DSP by ARM Ltd. All rights reserved.
<!--
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.3.1
-->
</li>
</ul>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
## 题目
输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。
## 分析
这是一道考察二进制的题目
二进制或运算符`(or)`:符号为|,表示若两个二进制位都为`0`,则结果为`0`,否则为`1`。
二进制与运算符`(and)`:符号为&,表示若两个二进制位都为`1`,则结果为`1`,否则为`0`。
二进制否运算符`(not)`:符号为~,表示对一个二进制位取反。
异或运算符`(xor)`:符号为^,表示若两个二进制位不相同,则结果为1,否则为0
左移运算符`m << n `表示把m左移n位,左移n位的时候,最左边的n位将被丢弃,同时在最右边补上`n`个`0`,比如:
```js
00001010<<2 = 00101000
```
右移运算符`m >> n `表示把`m`右移`n`位,右移`n`位的时候,最右边的n位将被丢弃,同时在最左边补上`n`个`0`,比如:
```js
00001010>>2 = 00000010
```
我们可以让目标数字和一个数字做与运算
这个用户比较的数字必须只有一位是`1`其他位是`0`,这样就可以知道目标数字的这一位是否为`0`。
所以用于比较的这个数字初始值为`1`,比较完后让`1`左移`1`位,这样就可以依次比较所有位是否为`1`。
## 代码
```js
function NumberOf1(n)
{
let flag = 1;
let count = 0;
while(flag){
if(flag & n){
count++;
}
flag = flag << 1;
}
return count;
}
``` | {
"pile_set_name": "Github"
} |
---
name: "lux-win-2.2"
enable_cache: true
suites:
- "trusty"
architectures:
- "amd64"
packages:
- "curl"
- "g++"
- "git-core"
- "pkg-config"
- "autoconf"
- "libtool"
- "automake"
- "faketime"
- "bsdmainutils"
- "mingw-w64"
- "g++-mingw-w64"
- "nsis"
- "zip"
- "ca-certificates"
- "python"
remotes:
- "url": "https://github.com/lux-core/lux.git"
"dir": "lux"
files: []
script: |
WRAP_DIR=$HOME/wrapped
HOSTS="x86_64-w64-mingw32 i686-w64-mingw32"
CONFIGFLAGS="--enable-reduce-exports --disable-bench --disable-tests"
FAKETIME_HOST_PROGS="g++ ar ranlib nm windres strip objcopy"
FAKETIME_PROGS="date makensis zip"
HOST_CFLAGS="-O2 -g"
HOST_CXXFLAGS="-O2 -g"
export QT_RCC_TEST=1
export QT_RCC_SOURCE_DATE_OVERRIDE=1
export GZIP="-9n"
export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
export TZ="UTC"
export BUILD_DIR=`pwd`
mkdir -p ${WRAP_DIR}
if test -n "$GBUILD_CACHE_ENABLED"; then
export SOURCES_PATH=${GBUILD_COMMON_CACHE}
export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
fi
function create_global_faketime_wrappers {
for prog in ${FAKETIME_PROGS}; do
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
echo "\$REAL \$@" >> $WRAP_DIR/${prog}
chmod +x ${WRAP_DIR}/${prog}
done
}
function create_per-host_faketime_wrappers {
for i in $HOSTS; do
for prog in ${FAKETIME_HOST_PROGS}; do
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
chmod +x ${WRAP_DIR}/${i}-${prog}
done
done
}
function create_per-host_linker_wrapper {
# This is only needed for trusty, as the mingw linker leaks a few bytes of
# heap, causing non-determinism. See discussion in https://github.com/bitcoin/bitcoin/pull/6900
for i in $HOSTS; do
mkdir -p ${WRAP_DIR}/${i}
for prog in collect2; do
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}/${prog}
REAL=$(${i}-gcc -print-prog-name=${prog})
echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog}
echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog}
chmod +x ${WRAP_DIR}/${i}/${prog}
done
for prog in gcc g++; do
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
echo "REAL=\`which -a ${i}-${prog}-posix | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
echo "export COMPILER_PATH=${WRAP_DIR}/${i}" >> ${WRAP_DIR}/${i}-${prog}
echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
chmod +x ${WRAP_DIR}/${i}-${prog}
done
done
}
rm -r ${WRAP_DIR}
mkdir -p ${WRAP_DIR}
# Faketime for depends so intermediate results are comparable
export PATH_orig=${PATH}
create_global_faketime_wrappers "2000-01-01 12:00:00"
create_per-host_faketime_wrappers "2000-01-01 12:00:00"
create_per-host_linker_wrapper "2000-01-01 12:00:00"
export PATH=${WRAP_DIR}:${PATH}
cd lux
BASEPREFIX=`pwd`/depends
# Build dependencies for each host
for i in $HOSTS; do
make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
done
# Faketime for binaries
export PATH=${PATH_orig}
create_global_faketime_wrappers "${REFERENCE_DATETIME}"
create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
create_per-host_linker_wrapper "${REFERENCE_DATETIME}"
export PATH=${WRAP_DIR}:${PATH}
# Create the release tarball using (arbitrarily) the first host
./autogen.sh
CONFIG_SITE=${BASEPREFIX}/`echo "${HOSTS}" | awk '{print $1;}'`/share/config.site ./configure --prefix=/
make dist
SOURCEDIST=`echo lux-*.tar.gz`
DISTNAME=`echo ${SOURCEDIST} | sed 's/.tar.*//'`
# Correct tar file order
mkdir -p temp
pushd temp
tar xf ../$SOURCEDIST
find lux-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST
mkdir -p $OUTDIR/src
cp ../$SOURCEDIST $OUTDIR/src
popd
# Workaround for tarball not building with the bare tag version (prep)
make -C src obj/build.h
ORIGPATH="$PATH"
# Extract the release tarball into a dir for each host and build
for i in ${HOSTS}; do
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
mkdir -p distsrc-${i}
cd distsrc-${i}
INSTALLPATH=`pwd`/installed/${DISTNAME}
mkdir -p ${INSTALLPATH}
tar --strip-components=1 -xf ../$SOURCEDIST
echo '#!/bin/true' >share/genbuild.sh
mkdir src/obj
cp ../src/obj/build.h src/obj/
CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}"
make ${MAKEOPTS}
make ${MAKEOPTS} -C src check-security
make deploy
make install DESTDIR=${INSTALLPATH}
rename 's/-setup\.exe$/-setup-unsigned.exe/' *-setup.exe
cp -f lux-*setup*.exe $OUTDIR/
cd installed
mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/
find . -name "lib*.la" -delete
find . -name "lib*.a" -delete
rm -rf ${DISTNAME}/lib/pkgconfig
find ${DISTNAME}/bin -type f -executable -exec ${i}-objcopy --only-keep-debug {} {}.dbg \; -exec ${i}-strip -s {} \; -exec ${i}-objcopy --add-gnu-debuglink={}.dbg {} \;
find ${DISTNAME}/lib -type f -exec ${i}-objcopy --only-keep-debug {} {}.dbg \; -exec ${i}-strip -s {} \; -exec ${i}-objcopy --add-gnu-debuglink={}.dbg {} \;
find ${DISTNAME} -not -name "*.dbg" -type f | sort | zip -X@ ${OUTDIR}/${DISTNAME}-${i}.zip
find ${DISTNAME} -name "*.dbg" -type f | sort | zip -X@ ${OUTDIR}/${DISTNAME}-${i}-debug.zip
cd ../../
rm -rf distsrc-${i}
done
cp -rf contrib/windeploy $BUILD_DIR
cd $BUILD_DIR/windeploy
mkdir unsigned
cp $OUTDIR/lux-*setup-unsigned.exe unsigned/
find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-win-unsigned.tar.gz
mv ${OUTDIR}/${DISTNAME}-x86_64-*-debug.zip ${OUTDIR}/${DISTNAME}-win64-debug.zip
mv ${OUTDIR}/${DISTNAME}-i686-*-debug.zip ${OUTDIR}/${DISTNAME}-win32-debug.zip
mv ${OUTDIR}/${DISTNAME}-x86_64-*.zip ${OUTDIR}/${DISTNAME}-win64.zip
mv ${OUTDIR}/${DISTNAME}-i686-*.zip ${OUTDIR}/${DISTNAME}-win32.zip
| {
"pile_set_name": "Github"
} |
# Use only the built-in Error object
### One Paragraph Explainer
The permissive nature of JS along with its variety code-flow options (e.g. EventEmitter, Callbacks, Promises, etc) pushes to great variance in how developers raise errors – some use strings, other define their own custom types. Using Node.js built-in Error object helps to keep uniformity within your code and with 3rd party libraries, it also preserves significant information like the StackTrace. When raising the exception, it’s usually a good practice to fill it with additional contextual properties like the error name and the associated HTTP error code. To achieve this uniformity and practices, consider extending the Error object with additional properties, see code example below
### Code Example – doing it right
```javascript
// throwing an Error from typical function, whether sync or async
if(!productToAdd)
throw new Error("How can I add new product when no value provided?");
// 'throwing' an Error from EventEmitter
const myEmitter = new MyEmitter();
myEmitter.emit('error', new Error('whoops!'));
// 'throwing' an Error from a Promise
const addProduct = async (productToAdd) => {
try {
const existingProduct = await DAL.getProduct(productToAdd.id);
if (existingProduct !== null) {
throw new Error("Product already exists!");
}
} catch (err) {
// ...
}
}
```
### Code example – Anti Pattern
```javascript
// throwing a string lacks any stack trace information and other important data properties
if(!productToAdd)
throw ("How can I add new product when no value provided?");
```
### Code example – doing it even better
```javascript
// centralized error object that derives from Node’s Error
function AppError(name, httpCode, description, isOperational) {
Error.call(this);
Error.captureStackTrace(this);
this.name = name;
//...other properties assigned here
};
AppError.prototype = Object.create(Error.prototype);
AppError.prototype.constructor = AppError;
module.exports.AppError = AppError;
// client throwing an exception
if(user == null)
throw new AppError(commonErrors.resourceNotFound, commonHTTPErrors.notFound, "further explanation", true)
```
### Blog Quote: "I don’t see the value in having lots of different types"
From the blog, Ben Nadel ranked 5 for the keywords “Node.js error object”
>…”Personally, I don’t see the value in having lots of different types of error objects – JavaScript, as a language, doesn’t seem to cater to Constructor-based error-catching. As such, differentiating on an object property seems far easier than differentiating on a Constructor type…
### Blog Quote: "A string is not an error"
From the blog, devthought.com ranked 6 for the keywords “Node.js error object”
> …passing a string instead of an error results in reduced interoperability between modules. It breaks contracts with APIs that might be performing `instanceof` Error checks, or that want to know more about the error. Error objects, as we’ll see, have very interesting properties in modern JavaScript engines besides holding the message passed to the constructor…
### Blog Quote: "Inheriting from Error doesn’t add too much value"
From the blog machadogj
> …One problem that I have with the Error class is that is not so simple to extend. Of course, you can inherit the class and create your own Error classes like HttpError, DbError, etc. However, that takes time and doesn’t add too much value unless you are doing something with types. Sometimes, you just want to add a message and keep the inner error, and sometimes you might want to extend the error with parameters, and such…
### Blog Quote: "All JavaScript and System errors raised by Node.js inherit from Error"
From Node.js official documentation
> …All JavaScript and System errors raised by Node.js inherit from, or are instances of, the standard JavaScript Error class and are guaranteed to provide at least the properties available on that class. A generic JavaScript Error object that does not denote any specific circumstance of why the error occurred. Error objects capture a “stack trace” detailing the point in the code at which the Error was instantiated, and may provide a text description of the error. All errors generated by Node.js, including all System and JavaScript errors, will either be instances of or inherit from, the Error class…
| {
"pile_set_name": "Github"
} |
/**
* The `Matter` module is the top level namespace. It also includes a function for installing plugins on top of the library.
*
* @class Matter
*/
var Matter = {};
module.exports = Matter;
var Plugin = require('./Plugin');
var Common = require('./Common');
(function() {
/**
* The library name.
* @property name
* @readOnly
* @type {String}
*/
Matter.name = 'matter-js';
/**
* The library version.
* @property version
* @readOnly
* @type {String}
*/
Matter.version = typeof __MATTER_VERSION__ !== 'undefined' ? __MATTER_VERSION__ : '*';
/**
* A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`.
* Alternatively you may set `Matter.uses` manually and install them by calling `Plugin.use(Matter)`.
* @property uses
* @type {Array}
*/
Matter.uses = [];
/**
* The plugins that have been installed through `Matter.Plugin.install`. Read only.
* @property used
* @readOnly
* @type {Array}
*/
Matter.used = [];
/**
* Installs the given plugins on the `Matter` namespace.
* This is a short-hand for `Plugin.use`, see it for more information.
* Call this function once at the start of your code, with all of the plugins you wish to install as arguments.
* Avoid calling this function multiple times unless you intend to manually control installation order.
* @method use
* @param ...plugin {Function} The plugin(s) to install on `base` (multi-argument).
*/
Matter.use = function() {
Plugin.use(Matter, Array.prototype.slice.call(arguments));
};
/**
* Chains a function to excute before the original function on the given `path` relative to `Matter`.
* See also docs for `Common.chain`.
* @method before
* @param {string} path The path relative to `Matter`
* @param {function} func The function to chain before the original
* @return {function} The chained function that replaced the original
*/
Matter.before = function(path, func) {
path = path.replace(/^Matter./, '');
return Common.chainPathBefore(Matter, path, func);
};
/**
* Chains a function to excute after the original function on the given `path` relative to `Matter`.
* See also docs for `Common.chain`.
* @method after
* @param {string} path The path relative to `Matter`
* @param {function} func The function to chain after the original
* @return {function} The chained function that replaced the original
*/
Matter.after = function(path, func) {
path = path.replace(/^Matter./, '');
return Common.chainPathAfter(Matter, path, func);
};
})();
| {
"pile_set_name": "Github"
} |
#! /usr/bin/env python3
"""Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
times. See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.
Library usage: see the Timer class.
Command line usage:
python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-p] [-h] [--] [statement]
Options:
-n/--number N: how many times to execute 'statement' (default: see below)
-r/--repeat N: how many times to repeat the timer (default 3)
-s/--setup S: statement to be executed once initially (default 'pass')
-p/--process: use time.process_time() (default is time.perf_counter())
-t/--time: use time.time() (deprecated)
-c/--clock: use time.clock() (deprecated)
-v/--verbose: print raw timing results; repeat for more digits precision
-h/--help: print this usage message and exit
--: separate options from statement, use when statement starts with -
statement: statement to be timed (default 'pass')
A multi-line statement may be given by specifying each line as a
separate argument; indented lines are possible by enclosing an
argument in quotes and using leading spaces. Multiple -s options are
treated similarly.
If -n is not given, a suitable number of loops is calculated by trying
successive powers of 10 until the total time is at least 0.2 seconds.
The difference in default timer function is because on Windows,
clock() has microsecond granularity but time()'s granularity is 1/60th
of a second; on Unix, clock() has 1/100th of a second granularity and
time() is much more precise. On either platform, the default timer
functions measure wall clock time, not the CPU time. This means that
other processes running on the same computer may interfere with the
timing. The best thing to do when accurate timing is necessary is to
repeat the timing a few times and use the best time. The -r option is
good for this; the default of 3 repetitions is probably enough in most
cases. On Unix, you can use clock() to measure CPU time.
Note: there is a certain baseline overhead associated with executing a
pass statement. The code here doesn't try to hide it, but you should
be aware of it. The baseline overhead can be measured by invoking the
program without arguments.
The baseline overhead differs between Python versions! Also, to
fairly compare older Python versions to Python 2.3, you may want to
use python -O for the older versions to avoid timing SET_LINENO
instructions.
"""
import gc
import sys
import time
try:
import itertools
except ImportError:
# Must be an older Python version (see timeit() below)
itertools = None
__all__ = ["Timer"]
dummy_src_name = "<timeit-src>"
default_number = 1000000
default_repeat = 3
default_timer = time.perf_counter
# Don't change the indentation of the template; the reindent() calls
# in Timer.__init__() depend on setup being indented 4 spaces and stmt
# being indented 8 spaces.
template = """
def inner(_it, _timer):
{setup}
_t0 = _timer()
for _i in _it:
{stmt}
_t1 = _timer()
return _t1 - _t0
"""
def reindent(src, indent):
"""Helper to reindent a multi-line statement."""
return src.replace("\n", "\n" + " "*indent)
def _template_func(setup, func):
"""Create a timer function. Used if the "statement" is a callable."""
def inner(_it, _timer, _func=func):
setup()
_t0 = _timer()
for _i in _it:
_func()
_t1 = _timer()
return _t1 - _t0
return inner
class Timer:
"""Class for timing execution speed of small code snippets.
The constructor takes a statement to be timed, an additional
statement used for setup, and a timer function. Both statements
default to 'pass'; the timer function is platform-dependent (see
module doc string).
To measure the execution time of the first statement, use the
timeit() method. The repeat() method is a convenience to call
timeit() multiple times and return a list of results.
The statements may contain newlines, as long as they don't contain
multi-line string literals.
"""
def __init__(self, stmt="pass", setup="pass", timer=default_timer):
"""Constructor. See class doc string."""
self.timer = timer
ns = {}
if isinstance(stmt, str):
stmt = reindent(stmt, 8)
if isinstance(setup, str):
setup = reindent(setup, 4)
src = template.format(stmt=stmt, setup=setup)
elif callable(setup):
src = template.format(stmt=stmt, setup='_setup()')
ns['_setup'] = setup
else:
raise ValueError("setup is neither a string nor callable")
self.src = src # Save for traceback display
code = compile(src, dummy_src_name, "exec")
exec(code, globals(), ns)
self.inner = ns["inner"]
elif callable(stmt):
self.src = None
if isinstance(setup, str):
_setup = setup
def setup():
exec(_setup, globals(), ns)
elif not callable(setup):
raise ValueError("setup is neither a string nor callable")
self.inner = _template_func(setup, stmt)
else:
raise ValueError("stmt is neither a string nor callable")
def print_exc(self, file=None):
"""Helper to print a traceback from the timed code.
Typical use:
t = Timer(...) # outside the try/except
try:
t.timeit(...) # or t.repeat(...)
except:
t.print_exc()
The advantage over the standard traceback is that source lines
in the compiled template will be displayed.
The optional file argument directs where the traceback is
sent; it defaults to sys.stderr.
"""
import linecache, traceback
if self.src is not None:
linecache.cache[dummy_src_name] = (len(self.src),
None,
self.src.split("\n"),
dummy_src_name)
# else the source is already stored somewhere else
traceback.print_exc(file=file)
def timeit(self, number=default_number):
"""Time 'number' executions of the main statement.
To be precise, this executes the setup statement once, and
then returns the time it takes to execute the main statement
a number of times, as a float measured in seconds. The
argument is the number of times through the loop, defaulting
to one million. The main statement, the setup statement and
the timer function to be used are passed to the constructor.
"""
if itertools:
it = itertools.repeat(None, number)
else:
it = [None] * number
gcold = gc.isenabled()
gc.disable()
try:
timing = self.inner(it, self.timer)
finally:
if gcold:
gc.enable()
return timing
def repeat(self, repeat=default_repeat, number=default_number):
"""Call timeit() a few times.
This is a convenience function that calls the timeit()
repeatedly, returning a list of results. The first argument
specifies how many times to call timeit(), defaulting to 3;
the second argument specifies the timer argument, defaulting
to one million.
Note: it's tempting to calculate mean and standard deviation
from the result vector and report these. However, this is not
very useful. In a typical case, the lowest value gives a
lower bound for how fast your machine can run the given code
snippet; higher values in the result vector are typically not
caused by variability in Python's speed, but by other
processes interfering with your timing accuracy. So the min()
of the result is probably the only number you should be
interested in. After that, you should look at the entire
vector and apply common sense rather than statistics.
"""
r = []
for i in range(repeat):
t = self.timeit(number)
r.append(t)
return r
def timeit(stmt="pass", setup="pass", timer=default_timer,
number=default_number):
"""Convenience function to create Timer object and call timeit method."""
return Timer(stmt, setup, timer).timeit(number)
def repeat(stmt="pass", setup="pass", timer=default_timer,
repeat=default_repeat, number=default_number):
"""Convenience function to create Timer object and call repeat method."""
return Timer(stmt, setup, timer).repeat(repeat, number)
def main(args=None, *, _wrap_timer=None):
"""Main program, used when run as a script.
The optional 'args' argument specifies the command line to be parsed,
defaulting to sys.argv[1:].
The return value is an exit code to be passed to sys.exit(); it
may be None to indicate success.
When an exception happens during timing, a traceback is printed to
stderr and the return value is 1. Exceptions at other times
(including the template compilation) are not caught.
'_wrap_timer' is an internal interface used for unit testing. If it
is not None, it must be a callable that accepts a timer function
and returns another timer function (used for unit testing).
"""
if args is None:
args = sys.argv[1:]
import getopt
try:
opts, args = getopt.getopt(args, "n:s:r:tcpvh",
["number=", "setup=", "repeat=",
"time", "clock", "process",
"verbose", "help"])
except getopt.error as err:
print(err)
print("use -h/--help for command line help")
return 2
timer = default_timer
stmt = "\n".join(args) or "pass"
number = 0 # auto-determine
setup = []
repeat = default_repeat
verbose = 0
precision = 3
for o, a in opts:
if o in (0+"-n", "--number"):
number = int(a)
if o in (0+"-s", "--setup"):
setup.append(a)
if o in (0+"-r", "--repeat"):
repeat = int(a)
if repeat <= 0:
repeat = 1
if o in (0+"-t", "--time"):
timer = time.time
if o in (0+"-c", "--clock"):
timer = time.clock
if o in (0+"-p", "--process"):
timer = time.process_time
if o in (0+"-v", "--verbose"):
if verbose:
precision += 1
verbose += 1
if o in (0+"-h", "--help"):
print(__doc__, end=' ')
return 0
setup = "\n".join(setup) or "pass"
# Include the current directory, so that local imports work (sys.path
# contains the directory of this script, rather than the current
# directory)
import os
sys.path.insert(0, os.curdir)
if _wrap_timer is not None:
timer = _wrap_timer(timer)
t = Timer(stmt, setup, timer)
if number == 0:
# determine number so that 0.2 <= total time < 2.0
for i in range(1, 10):
number = 10**i
try:
x = t.timeit(number)
except:
t.print_exc()
return 1
if verbose:
print("%d loops -> %.*g secs" % (number, precision, x))
if x >= 0.2:
break
try:
r = t.repeat(repeat, number)
except:
t.print_exc()
return 1
best = min(r)
if verbose:
print("raw times:", " ".join(["%.*g" % (precision, x) for x in r]))
print("%d loops," % number, end=' ')
usec = best * 1e6 / number
if usec < 1000:
print("best of %d: %.*g usec per loop" % (repeat, precision, usec))
else:
msec = usec / 1000
if msec < 1000:
print("best of %d: %.*g msec per loop" % (repeat, precision, msec))
else:
sec = msec / 1000
print("best of %d: %.*g sec per loop" % (repeat, precision, sec))
return None
if __name__ == "__main__":
sys.exit(main())
| {
"pile_set_name": "Github"
} |
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs defs_darwin.go
package ipv6
const (
sysIPV6_UNICAST_HOPS = 0x4
sysIPV6_MULTICAST_IF = 0x9
sysIPV6_MULTICAST_HOPS = 0xa
sysIPV6_MULTICAST_LOOP = 0xb
sysIPV6_JOIN_GROUP = 0xc
sysIPV6_LEAVE_GROUP = 0xd
sysIPV6_PORTRANGE = 0xe
sysICMP6_FILTER = 0x12
sysIPV6_2292PKTINFO = 0x13
sysIPV6_2292HOPLIMIT = 0x14
sysIPV6_2292NEXTHOP = 0x15
sysIPV6_2292HOPOPTS = 0x16
sysIPV6_2292DSTOPTS = 0x17
sysIPV6_2292RTHDR = 0x18
sysIPV6_2292PKTOPTIONS = 0x19
sysIPV6_CHECKSUM = 0x1a
sysIPV6_V6ONLY = 0x1b
sysIPV6_IPSEC_POLICY = 0x1c
sysIPV6_RECVTCLASS = 0x23
sysIPV6_TCLASS = 0x24
sysIPV6_RTHDRDSTOPTS = 0x39
sysIPV6_RECVPKTINFO = 0x3d
sysIPV6_RECVHOPLIMIT = 0x25
sysIPV6_RECVRTHDR = 0x26
sysIPV6_RECVHOPOPTS = 0x27
sysIPV6_RECVDSTOPTS = 0x28
sysIPV6_USE_MIN_MTU = 0x2a
sysIPV6_RECVPATHMTU = 0x2b
sysIPV6_PATHMTU = 0x2c
sysIPV6_PKTINFO = 0x2e
sysIPV6_HOPLIMIT = 0x2f
sysIPV6_NEXTHOP = 0x30
sysIPV6_HOPOPTS = 0x31
sysIPV6_DSTOPTS = 0x32
sysIPV6_RTHDR = 0x33
sysIPV6_AUTOFLOWLABEL = 0x3b
sysIPV6_DONTFRAG = 0x3e
sysIPV6_PREFER_TEMPADDR = 0x3f
sysIPV6_MSFILTER = 0x4a
sysMCAST_JOIN_GROUP = 0x50
sysMCAST_LEAVE_GROUP = 0x51
sysMCAST_JOIN_SOURCE_GROUP = 0x52
sysMCAST_LEAVE_SOURCE_GROUP = 0x53
sysMCAST_BLOCK_SOURCE = 0x54
sysMCAST_UNBLOCK_SOURCE = 0x55
sysIPV6_BOUND_IF = 0x7d
sysIPV6_PORTRANGE_DEFAULT = 0x0
sysIPV6_PORTRANGE_HIGH = 0x1
sysIPV6_PORTRANGE_LOW = 0x2
sizeofSockaddrStorage = 0x80
sizeofSockaddrInet6 = 0x1c
sizeofInet6Pktinfo = 0x14
sizeofIPv6Mtuinfo = 0x20
sizeofIPv6Mreq = 0x14
sizeofGroupReq = 0x84
sizeofGroupSourceReq = 0x104
sizeofICMPv6Filter = 0x20
)
type sockaddrStorage struct {
Len uint8
Family uint8
X__ss_pad1 [6]int8
X__ss_align int64
X__ss_pad2 [112]int8
}
type sockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type inet6Pktinfo struct {
Addr [16]byte /* in6_addr */
Ifindex uint32
}
type ipv6Mtuinfo struct {
Addr sockaddrInet6
Mtu uint32
}
type ipv6Mreq struct {
Multiaddr [16]byte /* in6_addr */
Interface uint32
}
type icmpv6Filter struct {
Filt [8]uint32
}
type groupReq struct {
Interface uint32
Pad_cgo_0 [128]byte
}
type groupSourceReq struct {
Interface uint32
Pad_cgo_0 [128]byte
Pad_cgo_1 [128]byte
}
| {
"pile_set_name": "Github"
} |
// Shared variables and mixins
@import
"../global/var" // global variables
, "../bootstrap/bootstrap/mixins" // Bootstrap mixins
, "../bourbon/bourbon" // mixins
;
@import
// Core CSS
"components/scaffolding"
, "components/grid"
, "components/type"
, "components/tables"
, "components/tables-responsive"
, "components/form-checkbox-radio"
, "components/form-elements"
, "components/form-input"
, "components/form-select"
, "components/form-spinner"
, "components/form-switch"
, "components/form-validation"
, "components/buttons"
// Components
, "components/animation"
, "components/badges"
, "components/breadcrumbs"
, "components/boxes"
, "components/bullets"
, "components/callout"
, "components/charts"
, "components/dropdowns"
, "components/image-size"
, "components/labels"
, "components/list-group"
, "components/mail"
, "components/mail-compose"
, "components/navs"
, "components/panels"
, "components/popovers"
, "components/pricing-tables"
, "components/ribbons"
, "components/sprites"
, "components/timeline"
, "components/tooltip"
// Components w/ JavaScript
, "components/accordion"
, "components/map"
, "components/pagination"
, "components/progress-bars"
, "components/tab"
; | {
"pile_set_name": "Github"
} |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
import (
"internal/bytealg"
"unsafe"
)
// The constant is known to the compiler.
// There is no fundamental theory behind this number.
const tmpStringBufSize = 32
type tmpBuf [tmpStringBufSize]byte
// concatstrings implements a Go string concatenation x+y+z+...
// The operands are passed in the slice a.
// If buf != nil, the compiler has determined that the result does not
// escape the calling function, so the string data can be stored in buf
// if small enough.
func concatstrings(buf *tmpBuf, a []string) string {
idx := 0
l := 0
count := 0
for i, x := range a {
n := len(x)
if n == 0 {
continue
}
if l+n < l {
throw("string concatenation too long")
}
l += n
count++
idx = i
}
if count == 0 {
return ""
}
// If there is just one string and either it is not on the stack
// or our result does not escape the calling frame (buf != nil),
// then we can return that string directly.
if count == 1 && (buf != nil || !stringDataOnStack(a[idx])) {
return a[idx]
}
s, b := rawstringtmp(buf, l)
for _, x := range a {
copy(b, x)
b = b[len(x):]
}
return s
}
func concatstring2(buf *tmpBuf, a [2]string) string {
return concatstrings(buf, a[:])
}
func concatstring3(buf *tmpBuf, a [3]string) string {
return concatstrings(buf, a[:])
}
func concatstring4(buf *tmpBuf, a [4]string) string {
return concatstrings(buf, a[:])
}
func concatstring5(buf *tmpBuf, a [5]string) string {
return concatstrings(buf, a[:])
}
// Buf is a fixed-size buffer for the result,
// it is not nil if the result does not escape.
func slicebytetostring(buf *tmpBuf, b []byte) (str string) {
l := len(b)
if l == 0 {
// Turns out to be a relatively common case.
// Consider that you want to parse out data between parens in "foo()bar",
// you find the indices and convert the subslice to string.
return ""
}
if raceenabled {
racereadrangepc(unsafe.Pointer(&b[0]),
uintptr(l),
getcallerpc(),
funcPC(slicebytetostring))
}
if msanenabled {
msanread(unsafe.Pointer(&b[0]), uintptr(l))
}
if l == 1 {
stringStructOf(&str).str = unsafe.Pointer(&staticbytes[b[0]])
stringStructOf(&str).len = 1
return
}
var p unsafe.Pointer
if buf != nil && len(b) <= len(buf) {
p = unsafe.Pointer(buf)
} else {
p = mallocgc(uintptr(len(b)), nil, false)
}
stringStructOf(&str).str = p
stringStructOf(&str).len = len(b)
memmove(p, (*(*slice)(unsafe.Pointer(&b))).array, uintptr(len(b)))
return
}
// stringDataOnStack reports whether the string's data is
// stored on the current goroutine's stack.
func stringDataOnStack(s string) bool {
ptr := uintptr(stringStructOf(&s).str)
stk := getg().stack
return stk.lo <= ptr && ptr < stk.hi
}
func rawstringtmp(buf *tmpBuf, l int) (s string, b []byte) {
if buf != nil && l <= len(buf) {
b = buf[:l]
s = slicebytetostringtmp(b)
} else {
s, b = rawstring(l)
}
return
}
// slicebytetostringtmp returns a "string" referring to the actual []byte bytes.
//
// Callers need to ensure that the returned string will not be used after
// the calling goroutine modifies the original slice or synchronizes with
// another goroutine.
//
// The function is only called when instrumenting
// and otherwise intrinsified by the compiler.
//
// Some internal compiler optimizations use this function.
// - Used for m[string(k)] lookup where m is a string-keyed map and k is a []byte.
// - Used for "<"+string(b)+">" concatenation where b is []byte.
// - Used for string(b)=="foo" comparison where b is []byte.
func slicebytetostringtmp(b []byte) string {
if raceenabled && len(b) > 0 {
racereadrangepc(unsafe.Pointer(&b[0]),
uintptr(len(b)),
getcallerpc(),
funcPC(slicebytetostringtmp))
}
if msanenabled && len(b) > 0 {
msanread(unsafe.Pointer(&b[0]), uintptr(len(b)))
}
return *(*string)(unsafe.Pointer(&b))
}
func stringtoslicebyte(buf *tmpBuf, s string) []byte {
var b []byte
if buf != nil && len(s) <= len(buf) {
*buf = tmpBuf{}
b = buf[:len(s)]
} else {
b = rawbyteslice(len(s))
}
copy(b, s)
return b
}
func stringtoslicerune(buf *[tmpStringBufSize]rune, s string) []rune {
// two passes.
// unlike slicerunetostring, no race because strings are immutable.
n := 0
for range s {
n++
}
var a []rune
if buf != nil && n <= len(buf) {
*buf = [tmpStringBufSize]rune{}
a = buf[:n]
} else {
a = rawruneslice(n)
}
n = 0
for _, r := range s {
a[n] = r
n++
}
return a
}
func slicerunetostring(buf *tmpBuf, a []rune) string {
if raceenabled && len(a) > 0 {
racereadrangepc(unsafe.Pointer(&a[0]),
uintptr(len(a))*unsafe.Sizeof(a[0]),
getcallerpc(),
funcPC(slicerunetostring))
}
if msanenabled && len(a) > 0 {
msanread(unsafe.Pointer(&a[0]), uintptr(len(a))*unsafe.Sizeof(a[0]))
}
var dum [4]byte
size1 := 0
for _, r := range a {
size1 += encoderune(dum[:], r)
}
s, b := rawstringtmp(buf, size1+3)
size2 := 0
for _, r := range a {
// check for race
if size2 >= size1 {
break
}
size2 += encoderune(b[size2:], r)
}
return s[:size2]
}
type stringStruct struct {
str unsafe.Pointer
len int
}
// Variant with *byte pointer type for DWARF debugging.
type stringStructDWARF struct {
str *byte
len int
}
func stringStructOf(sp *string) *stringStruct {
return (*stringStruct)(unsafe.Pointer(sp))
}
func intstring(buf *[4]byte, v int64) string {
var s string
var b []byte
if buf != nil {
b = buf[:]
s = slicebytetostringtmp(b)
} else {
s, b = rawstring(4)
}
if int64(rune(v)) != v {
v = runeError
}
n := encoderune(b, rune(v))
return s[:n]
}
// rawstring allocates storage for a new string. The returned
// string and byte slice both refer to the same storage.
// The storage is not zeroed. Callers should use
// b to set the string contents and then drop b.
func rawstring(size int) (s string, b []byte) {
p := mallocgc(uintptr(size), nil, false)
stringStructOf(&s).str = p
stringStructOf(&s).len = size
*(*slice)(unsafe.Pointer(&b)) = slice{p, size, size}
return
}
// rawbyteslice allocates a new byte slice. The byte slice is not zeroed.
func rawbyteslice(size int) (b []byte) {
cap := roundupsize(uintptr(size))
p := mallocgc(cap, nil, false)
if cap != uintptr(size) {
memclrNoHeapPointers(add(p, uintptr(size)), cap-uintptr(size))
}
*(*slice)(unsafe.Pointer(&b)) = slice{p, size, int(cap)}
return
}
// rawruneslice allocates a new rune slice. The rune slice is not zeroed.
func rawruneslice(size int) (b []rune) {
if uintptr(size) > maxAlloc/4 {
throw("out of memory")
}
mem := roundupsize(uintptr(size) * 4)
p := mallocgc(mem, nil, false)
if mem != uintptr(size)*4 {
memclrNoHeapPointers(add(p, uintptr(size)*4), mem-uintptr(size)*4)
}
*(*slice)(unsafe.Pointer(&b)) = slice{p, size, int(mem / 4)}
return
}
// used by cmd/cgo
func gobytes(p *byte, n int) (b []byte) {
if n == 0 {
return make([]byte, 0)
}
if n < 0 || uintptr(n) > maxAlloc {
panic(errorString("gobytes: length out of range"))
}
bp := mallocgc(uintptr(n), nil, false)
memmove(bp, unsafe.Pointer(p), uintptr(n))
*(*slice)(unsafe.Pointer(&b)) = slice{bp, n, n}
return
}
func gostring(p *byte) string {
l := findnull(p)
if l == 0 {
return ""
}
s, b := rawstring(l)
memmove(unsafe.Pointer(&b[0]), unsafe.Pointer(p), uintptr(l))
return s
}
func gostringn(p *byte, l int) string {
if l == 0 {
return ""
}
s, b := rawstring(l)
memmove(unsafe.Pointer(&b[0]), unsafe.Pointer(p), uintptr(l))
return s
}
func index(s, t string) int {
if len(t) == 0 {
return 0
}
for i := 0; i < len(s); i++ {
if s[i] == t[0] && hasprefix(s[i:], t) {
return i
}
}
return -1
}
func contains(s, t string) bool {
return index(s, t) >= 0
}
func hasprefix(s, t string) bool {
return len(s) >= len(t) && s[:len(t)] == t
}
const (
maxUint = ^uint(0)
maxInt = int(maxUint >> 1)
)
// atoi parses an int from a string s.
// The bool result reports whether s is a number
// representable by a value of type int.
func atoi(s string) (int, bool) {
if s == "" {
return 0, false
}
neg := false
if s[0] == '-' {
neg = true
s = s[1:]
}
un := uint(0)
for i := 0; i < len(s); i++ {
c := s[i]
if c < '0' || c > '9' {
return 0, false
}
if un > maxUint/10 {
// overflow
return 0, false
}
un *= 10
un1 := un + uint(c) - '0'
if un1 < un {
// overflow
return 0, false
}
un = un1
}
if !neg && un > uint(maxInt) {
return 0, false
}
if neg && un > uint(maxInt)+1 {
return 0, false
}
n := int(un)
if neg {
n = -n
}
return n, true
}
// atoi32 is like atoi but for integers
// that fit into an int32.
func atoi32(s string) (int32, bool) {
if n, ok := atoi(s); n == int(int32(n)) {
return int32(n), ok
}
return 0, false
}
//go:nosplit
func findnull(s *byte) int {
if s == nil {
return 0
}
// Avoid IndexByteString on Plan 9 because it uses SSE instructions
// on x86 machines, and those are classified as floating point instructions,
// which are illegal in a note handler.
if GOOS == "plan9" {
p := (*[maxAlloc/2 - 1]byte)(unsafe.Pointer(s))
l := 0
for p[l] != 0 {
l++
}
return l
}
// pageSize is the unit we scan at a time looking for NULL.
// It must be the minimum page size for any architecture Go
// runs on. It's okay (just a minor performance loss) if the
// actual system page size is larger than this value.
const pageSize = 4096
offset := 0
ptr := unsafe.Pointer(s)
// IndexByteString uses wide reads, so we need to be careful
// with page boundaries. Call IndexByteString on
// [ptr, endOfPage) interval.
safeLen := int(pageSize - uintptr(ptr)%pageSize)
for {
t := *(*string)(unsafe.Pointer(&stringStruct{ptr, safeLen}))
// Check one page at a time.
if i := bytealg.IndexByteString(t, 0); i != -1 {
return offset + i
}
// Move to next page
ptr = unsafe.Pointer(uintptr(ptr) + uintptr(safeLen))
offset += safeLen
safeLen = pageSize
}
}
func findnullw(s *uint16) int {
if s == nil {
return 0
}
p := (*[maxAlloc/2/2 - 1]uint16)(unsafe.Pointer(s))
l := 0
for p[l] != 0 {
l++
}
return l
}
//go:nosplit
func gostringnocopy(str *byte) string {
ss := stringStruct{str: unsafe.Pointer(str), len: findnull(str)}
s := *(*string)(unsafe.Pointer(&ss))
return s
}
func gostringw(strw *uint16) string {
var buf [8]byte
str := (*[maxAlloc/2/2 - 1]uint16)(unsafe.Pointer(strw))
n1 := 0
for i := 0; str[i] != 0; i++ {
n1 += encoderune(buf[:], rune(str[i]))
}
s, b := rawstring(n1 + 4)
n2 := 0
for i := 0; str[i] != 0; i++ {
// check for race
if n2 >= n1 {
break
}
n2 += encoderune(b[n2:], rune(str[i]))
}
b[n2] = 0 // for luck
return s[:n2]
}
| {
"pile_set_name": "Github"
} |
<?php
class LeagueController extends Controller
{
/**
* @desc 添加球队
*/
public function actionAddTeam(){
$masterId = CommonFunction::getUserId();
$leagueId = Yii::app()->request->getPost('leagueId');
$teamId = Yii::app()->request->getPost('teamId');
if(empty($leagueId) || empty($teamId)){
CommonFunction::ajaxResult(State::$SYS_PARAM_ERROR_CODE, State::$SYS_PARAM_ERROR_MSG );
}
$leagueModel = new LeagueModel();
$groupModel = new GroupModel();
$Groups = $groupModel->findByLeagueId($leagueId);
if(empty($Groups)){
$res = $leagueModel->createRelation('teams','Team',$leagueId,$teamId);
if(isset($res->updatedAt)){
$resM = $leagueModel->findByMaster($masterId,1);
$teamModel = new TeamModel();
$leagueTeams = $teamModel->findRowsByRelation("teams","League",$resM[0]->objectId);
$addTeam = $teamModel->findTeamByObjectId($teamId);
if(isset($addTeam[0]->captain->username)){
$uid = $addTeam[0]->captain->username;
$pushMsg = '你的球队:'.$addTeam[0]->name.',已被添加进联赛:'.$resM[0]->name;
//给队长发送联赛邀请
$baiduPushModel=new BaiduPushModel();
$baiduPushModel->sendInviteMessageForTeamCaptain( $leagueId, $teamId, $addTeam[0]->captain );
// CommonFunction::pushAppMsg($uid,$pushMsg);
// $device = new InstallationModel();
// $msg = $device->findByUid($uid);
// if(isset($msg[0]) && !empty($msg[0])){
//
// $deviceMsg = $msg[0];
// $push = new PushMsgModel();
// $pushMsg = '你的球队:'.$addTeam[0]->name.',已被添加进联赛:'.$resM[0]->name;
//
// if(isset($deviceMsg->deviceToken) && isset($deviceMsg->deviceType) && $deviceMsg->deviceType == 'ios'){
// $push->createIosPush($deviceMsg->deviceToken,$pushMsg);
// }elseif(isset($deviceMsg->installationId) && isset($deviceMsg->deviceType) && $deviceMsg->deviceType == 'android'){
// $push->createAndroidPush($deviceMsg->installationId,$pushMsg);
// }
//
// }
}
}
CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG,array('leagueTeams'=>$leagueTeams));
}else{
CommonFunction::ajaxResult(State::$TEAM_ADD_ERROR_CODE, State::$TEAM_ADD_ERROR_MSG );
}
}
/**
* @desc 删除球队
*/
public function actionDeleteTeam(){
$masterId = CommonFunction::getUserId();
$leagueId = Yii::app()->request->getPost('leagueId');
$teamId = Yii::app()->request->getPost('teamId');
if(empty($leagueId) || empty($teamId)){
CommonFunction::ajaxResult(State::$SYS_PARAM_ERROR_CODE, State::$SYS_PARAM_ERROR_MSG );
}
$leagueModel = new LeagueModel();
$groupModel = new GroupModel();
$Groups = $groupModel->findByLeagueId($leagueId);
if(empty($Groups)){
$res = $leagueModel->removeRelation('teams','Team',$leagueId,$teamId);
if(isset($res->updatedAt)){
$resM = $leagueModel->findByMaster($masterId,1);
$teamModel = new TeamModel();
$leagueTeams = $teamModel->findRowsByRelation("teams","League",$resM[0]->objectId);
$deleteTeam = $teamModel->findTeamByObjectId($teamId);
if(isset($deleteTeam[0]->captain->username)){
$uid = $deleteTeam[0]->captain->username;
$pushMsg = '你的球队:'.$deleteTeam[0]->name.',已被联赛【'.$resM[0]->name.'】移除出联赛';
CommonFunction::pushAppMsg($uid,$pushMsg);
// $device = new InstallationModel();
// $msg = $device->findByUid($uid);
// if(isset($msg[0]) && !empty($msg[0])){
// $deviceMsg = $msg[0];
// $push = new PushMsgModel();
// $pushMsg = '你的球队:'.$deleteTeam[0]->name.',已被联赛【'.$resM[0]->name.'】移除出联赛';
// if(isset($deviceMsg->deviceToken) && isset($deviceMsg->deviceType) && $deviceMsg->deviceType == 'ios'){
// $push->createIosPush($deviceMsg->deviceToken,$pushMsg);
// }elseif(isset($deviceMsg->installationId) && isset($deviceMsg->deviceType) && $deviceMsg->deviceType == 'android'){
// $push->createAndroidPush($deviceMsg->installationId,$pushMsg);
// }
// }
}
}
CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG,array('leagueTeams'=>$leagueTeams));
}else{
CommonFunction::ajaxResult(State::$TEAM_DELETE_ERROR_CODE, State::$TEAM_DELETE_ERROR_MSG );
}
}
/**
* @desc 邀请球队
*/
public function actionInviteTeam(){
isset(Yii::app()->user->oid) ? $masterId = Yii::app()->user->oid : $masterId = '';
$teamName = Yii::app()->request->getPost('teamname');
$mobileNum = Yii::app()->request->getPost('mobilenum');
if(empty($teamName) || empty($mobileNum) || !CommonFunction::checkMobile($mobileNum)){
CommonFunction::ajaxResult(State::$TEAM_SENDMSG_ERROR_CODE, State::$TEAM_SENDMSG_ERROR_MSG );
}
$leagueModel = new LeagueModel();
$resM = $leagueModel->findByMaster($masterId,1);
$leagueId = $resM[0]->objectId;
$leagueName = $resM[0]->name;
$inviteCode = $resM[0]->inviteCode;
$msgUrl = Yii::app()->params['inviteMsgUrl'];
if(preg_match("/^0?(13[0-9]|15[0-9]|17[678]|18[0-9]|14[57])[0-9]{8}$/i", $mobileNum)){
// $data = array(
// 'account'=>Yii::app()->params['MsgUsername'],
// 'password'=>Yii::app()->params['MsgPwd'],
// 'destMobiles'=> $mobileNum,
// 'msgContents'=>'诚邀你的球队:'.$teamName.',加入联赛:'.$leagueName.',邀请码是:'.$leagueId.'【踢球吧】'
// );
// $msgBack = CommonFunction::sendMobileMsg($msgUrl,$data);
$data = array(
'mobile'=>$mobileNum,
'content'=>'诚邀你的球队:'.$teamName.',加入联赛:'.$leagueName.', 联赛邀请码是:'.$inviteCode
);
$mobileMsgModel = new BmobMobileMsg();
$msgBack = $mobileMsgModel->send($data);
} else {
CommonFunction::ajaxResult(State::$TEAM_SENDMSG_ERROR_CODE, State::$TEAM_SENDMSG_ERROR_MSG );
}
// echo $msgBack;exit;
// $msgBack = 1;
if(!is_numeric($msgBack) || $msgBack > 0){
$msgBack = 1;
}
CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG,array('response'=>$msgBack));
}
/**
* @desc 调用云端代码更新联赛榜单数据
*/
public function actionUpdateLeagueRange(){
$leagueId = Yii::app()->request->getPost('leagueid');
$cloudCodeModel = new BmobCloudCode('leagueScoreSingle');
$res = $cloudCodeModel->get(array('leagueId'=>"$leagueId"));
if(empty($res)){
CommonFunction::ajaxResult(State::$LEAGUE_RANGE_ERROR_CODE, State::$LEAGUE_RANGE_ERROR_MSG);
}else{
//更新积分榜发送推送
$baiduPushModel=new BaiduPushModel();
$baiduPushModel->sendMessageForAllLeague( 4, 21, $leagueId, "更新了积分榜");
CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG, array('response'=>$res));
}
}
/**
* @desc 调用云端代码更新联赛射手榜数据
*/
public function actionUpdateShooterData(){
$leagueId = Yii::app()->request->getPost('leagueid');
$cloudCodeModel = new BmobCloudCode('userGoalAssist');
$res = $cloudCodeModel->get(array('leagueId'=>"$leagueId"));
if(empty($res)){
CommonFunction::ajaxResult(State::$SHOOTER_RANGE_ERROR_CODE, State::$SHOOTER_RANGE_ERROR_MSG);
}else{
//更新射手榜发送推送
$baiduPushModel=new BaiduPushModel();
$baiduPushModel->sendMessageForAllLeague( 4, 21, $leagueId, "更新了射手榜");
CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG, array('response'=>$res));
}
}
public function actionPushMsg(){
$device = new InstallationModel();
$msg = $device->findByUid('18666486846');
// var_dump($msg);
$deviceMsg = $msg[0];
$push = new PushMsgModel();
if(isset($deviceMsg->deviceType) && $deviceMsg->deviceType == 'ios'){
$push->createIosPush($deviceMsg->deviceToken);
}
}
} | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
<!-- ********************************************************************
$Id: block.xsl 9667 2012-11-26 23:10:44Z bobstayton $
********************************************************************
This file is part of the XSL DocBook Stylesheet distribution.
See ../README or http://docbook.sf.net/release/xsl/current/ for
copyright and other information.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- What should we do about styling blockinfo? -->
<xsl:template match="blockinfo|info">
<!-- suppress -->
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="block.object">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="para">
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:if test="position() = 1 and parent::listitem">
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="parent::listitem"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="paragraph">
<xsl:param name="class" select="''"/>
<xsl:param name="content"/>
<xsl:variable name="p">
<p>
<xsl:call-template name="id.attribute"/>
<xsl:choose>
<xsl:when test="$class != ''">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="class" select="$class"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="class" select="''"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="$content"/>
</p>
</xsl:variable>
<xsl:choose>
<xsl:when test="$html.cleanup != 0">
<xsl:call-template name="unwrap.p">
<xsl:with-param name="p" select="$p"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$p"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="simpara">
<!-- see also listitem/simpara in lists.xsl -->
<p>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="locale.html.attributes"/>
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:apply-templates select="." mode="class.attribute">
<xsl:with-param name="class" select="@role"/>
</xsl:apply-templates>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="formalpara">
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Only use title from info -->
<xsl:template match="formalpara/info">
<xsl:apply-templates select="title"/>
</xsl:template>
<xsl:template match="formalpara/title|formalpara/info/title">
<xsl:variable name="titleStr">
<xsl:apply-templates/>
</xsl:variable>
<xsl:variable name="lastChar">
<xsl:if test="$titleStr != ''">
<xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="formalpara-title">
<xsl:copy-of select="$titleStr"/>
<xsl:if test="$lastChar != '' and not(contains($runinhead.title.end.punct, $lastChar))">
<xsl:value-of select="$runinhead.default.title.end.punct"/>
</xsl:if>
<xsl:text> </xsl:text>
</span>
</xsl:when>
<xsl:otherwise>
<strong>
<xsl:copy-of select="$titleStr"/>
<xsl:if test="$lastChar != '' and not(contains($runinhead.title.end.punct, $lastChar))">
<xsl:value-of select="$runinhead.default.title.end.punct"/>
</xsl:if>
<xsl:text> </xsl:text>
</strong>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="formalpara/para">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="blockquote">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:choose>
<xsl:when test="attribution">
<table border="{$table.border.off}" class="blockquote">
<xsl:if test="$css.decoration != 0">
<xsl:attribute name="style">
<xsl:text>width: 100%; cellspacing: 0; cellpadding: 0;</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">Block quote</xsl:attribute>
</xsl:if>
<tr>
<td valign="top"> </td>
<td valign="top">
<xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
</td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
<td colspan="2" align="{$direction.align.end}" valign="top">
<xsl:text>--</xsl:text>
<xsl:apply-templates select="attribution"/>
</td>
</tr>
</table>
</xsl:when>
<xsl:otherwise>
<blockquote>
<xsl:call-template name="common.html.attributes"/>
<xsl:apply-templates/>
</blockquote>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template match="blockquote/title|blockquote/info/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="blockquote-title">
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<div class="blockquote-title">
<p>
<strong>
<xsl:apply-templates/>
</strong>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Use an em dash per Chicago Manual of Style and https://sourceforge.net/tracker/index.php?func=detail&aid=2793878&group_id=21935&atid=373747 -->
<xsl:template match="epigraph">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
<xsl:if test="attribution">
<div class="attribution">
<span>—<xsl:apply-templates select="attribution"/></span>
</div>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="attribution">
<span>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="sidebar">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:call-template name="sidebar.titlepage"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="abstract/title|sidebar/title">
</xsl:template>
<xsl:template match="sidebar/sidebarinfo|sidebar/info"/>
<xsl:template match="abstract">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="anchor"/>
<xsl:call-template name="formal.object.heading">
<xsl:with-param name="title">
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="'1'"/>
</xsl:apply-templates>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</div>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="msgset">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgentry">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="simplemsgentry">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msg">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msgmain">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgmain/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgmain-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<strong><xsl:apply-templates/></strong>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgsub">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgsub/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgsub-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<strong><xsl:apply-templates/></strong>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgrel">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgrel/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgrel-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<strong><xsl:apply-templates/></strong>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgtext">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msginfo">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msglevel">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msglevel">
<span class="msglevel-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgLevel'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<strong>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgLevel'"/>
</xsl:call-template>
</strong>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgorig">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgorig">
<span class="msgorig-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgOrig'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<strong>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgOrig'"/>
</xsl:call-template>
</strong>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgaud">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgaud">
<span class="msgaud-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgAud'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<strong>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgAud'"/>
</xsl:call-template>
</strong>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgexplan">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msgexplan/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgexplan">
<span class="msgexplan-title">
<xsl:apply-templates/>
</span>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<strong>
<xsl:apply-templates/>
</strong>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="revhistory">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<table>
<xsl:if test="$css.decoration != 0">
<xsl:attribute name="style">
<xsl:text>border-style:solid; width:100%;</xsl:text>
</xsl:attribute>
</xsl:if>
<!-- include summary attribute if not HTML5 -->
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">
<xsl:call-template name="gentext">
<xsl:with-param name="key">revhistory</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<tr>
<th align="{$direction.align.start}" valign="top" colspan="3">
<strong>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RevHistory'"/>
</xsl:call-template>
</strong>
</th>
</tr>
<xsl:apply-templates/>
</table>
</div>
</xsl:template>
<xsl:template match="revhistory/revision">
<xsl:variable name="revnumber" select="revnumber"/>
<xsl:variable name="revdate" select="date"/>
<xsl:variable name="revauthor" select="authorinitials|author"/>
<xsl:variable name="revremark" select="revremark|revdescription"/>
<tr>
<td align="{$direction.align.start}">
<xsl:if test="$revnumber">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Revision'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:apply-templates select="$revnumber"/>
</xsl:if>
</td>
<td align="{$direction.align.start}">
<xsl:apply-templates select="$revdate"/>
</td>
<xsl:choose>
<xsl:when test="count($revauthor)=0">
<td align="{$direction.align.start}">
<xsl:call-template name="dingbat">
<xsl:with-param name="dingbat">nbsp</xsl:with-param>
</xsl:call-template>
</td>
</xsl:when>
<xsl:otherwise>
<td align="{$direction.align.start}">
<xsl:for-each select="$revauthor">
<xsl:apply-templates select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</td>
</xsl:otherwise>
</xsl:choose>
</tr>
<xsl:if test="$revremark">
<tr>
<td align="{$direction.align.start}" colspan="3">
<xsl:apply-templates select="$revremark"/>
</td>
</tr>
</xsl:if>
</xsl:template>
<xsl:template match="revision/revnumber">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/date">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/authorinitials">
<xsl:text>, </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/authorinitials[1]" priority="2">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/revremark">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/revdescription">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="ackno|acknowledgements[parent::article]">
<xsl:call-template name="block.object"/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="highlights">
<xsl:call-template name="block.object"/>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet> | {
"pile_set_name": "Github"
} |
<?php
/**
* GetSimple API Handler
*
* @package GetSimple
* @subpackage API
*/
include('inc/common.php');
include('inc/api.class.php');
#step 1 - check for post
if (empty($_POST)) exit;
if (!getDef('GSEXTAPI',true)) exit;
// disable libxml error output
if(!isDebug()) libxml_use_internal_errors(true);
// disable entity loading to avoid xxe
libxml_disable_entity_loader();
#step 1 - check post for data
if (!isset($_POST['data'])) {
$message = array('status' => 'error', 'message' => i18n_r('API_ERR_MISSINGPARAM'));
echo json_encode($message);
exit;
};
#step 2 - setup request
$in = simplexml_load_string($_POST['data'], 'SimpleXMLExtended', LIBXML_NOCDATA);
$request = new API_Request();
$request->add_data($in);
#step 3 - verify a compatible method was provided
$methods = array('page_read', 'page_save', 'all_pages_read', 'all_files_read', 'file_upload', 'settings_read' );
if (!in_array($in->method, $methods)) {
$message = array('status' => 'error', 'message' => sprintf(i18n_r('API_ERR_BADMETHOD'), $in->method));
echo json_encode($message);
exit;
}
#step 4 - process request
$method = (string)$in->method;
echo call_user_func(array($request, $method), '');
exit;
/*
----------------------------
EXAMPLE XML FILE COMING IN
----------------------------
<request>
<key>ABCDE12345</key>
<method>page_read</method>
<data>
<field1></field1>
<field2></field2>
<field3></field3>
</data>
</request>
*/
| {
"pile_set_name": "Github"
} |
// cgo -godefs types_aix.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build ppc64,aix
package unix
const (
SizeofPtr = 0x8
SizeofShort = 0x2
SizeofInt = 0x4
SizeofLong = 0x8
SizeofLongLong = 0x8
PathMax = 0x3ff
)
type (
_C_short int16
_C_int int32
_C_long int64
_C_long_long int64
)
type off64 int64
type off int64
type Mode_t uint32
type Timespec struct {
Sec int64
Nsec int64
}
type Timeval struct {
Sec int64
Usec int32
_ [4]byte
}
type Timeval32 struct {
Sec int32
Usec int32
}
type Timex struct{}
type Time_t int64
type Tms struct{}
type Utimbuf struct {
Actime int64
Modtime int64
}
type Timezone struct {
Minuteswest int32
Dsttime int32
}
type Rusage struct {
Utime Timeval
Stime Timeval
Maxrss int64
Ixrss int64
Idrss int64
Isrss int64
Minflt int64
Majflt int64
Nswap int64
Inblock int64
Oublock int64
Msgsnd int64
Msgrcv int64
Nsignals int64
Nvcsw int64
Nivcsw int64
}
type Rlimit struct {
Cur uint64
Max uint64
}
type Pid_t int32
type _Gid_t uint32
type dev_t uint64
type Stat_t struct {
Dev uint64
Ino uint64
Mode uint32
Nlink int16
Flag uint16
Uid uint32
Gid uint32
Rdev uint64
Ssize int32
Atim Timespec
Mtim Timespec
Ctim Timespec
Blksize int64
Blocks int64
Vfstype int32
Vfs uint32
Type uint32
Gen uint32
Reserved [9]uint32
Padto_ll uint32
Size int64
}
type StatxTimestamp struct{}
type Statx_t struct{}
type Dirent struct {
Offset uint64
Ino uint64
Reclen uint16
Namlen uint16
Name [256]uint8
_ [4]byte
}
type RawSockaddrInet4 struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]uint8
}
type RawSockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type RawSockaddrUnix struct {
Len uint8
Family uint8
Path [1023]uint8
}
type RawSockaddrDatalink struct {
Len uint8
Family uint8
Index uint16
Type uint8
Nlen uint8
Alen uint8
Slen uint8
Data [120]uint8
}
type RawSockaddr struct {
Len uint8
Family uint8
Data [14]uint8
}
type RawSockaddrAny struct {
Addr RawSockaddr
Pad [1012]uint8
}
type _Socklen uint32
type Cmsghdr struct {
Len uint32
Level int32
Type int32
}
type ICMPv6Filter struct {
Filt [8]uint32
}
type Iovec struct {
Base *byte
Len uint64
}
type IPMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type IPv6Mreq struct {
Multiaddr [16]byte /* in6_addr */
Interface uint32
}
type IPv6MTUInfo struct {
Addr RawSockaddrInet6
Mtu uint32
}
type Linger struct {
Onoff int32
Linger int32
}
type Msghdr struct {
Name *byte
Namelen uint32
Iov *Iovec
Iovlen int32
Control *byte
Controllen uint32
Flags int32
}
const (
SizeofSockaddrInet4 = 0x10
SizeofSockaddrInet6 = 0x1c
SizeofSockaddrAny = 0x404
SizeofSockaddrUnix = 0x401
SizeofSockaddrDatalink = 0x80
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofIPv6MTUInfo = 0x20
SizeofMsghdr = 0x30
SizeofCmsghdr = 0xc
SizeofICMPv6Filter = 0x20
)
const (
SizeofIfMsghdr = 0x10
)
type IfMsgHdr struct {
Msglen uint16
Version uint8
Type uint8
Addrs int32
Flags int32
Index uint16
Addrlen uint8
_ [1]byte
}
type FdSet struct {
Bits [1024]int64
}
type Utsname struct {
Sysname [32]byte
Nodename [32]byte
Release [32]byte
Version [32]byte
Machine [32]byte
}
type Ustat_t struct{}
type Sigset_t struct {
Set [4]uint64
}
const (
AT_FDCWD = -0x2
AT_REMOVEDIR = 0x1
AT_SYMLINK_NOFOLLOW = 0x1
)
type Termios struct {
Iflag uint32
Oflag uint32
Cflag uint32
Lflag uint32
Cc [16]uint8
}
type Termio struct {
Iflag uint16
Oflag uint16
Cflag uint16
Lflag uint16
Line uint8
Cc [8]uint8
_ [1]byte
}
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
type PollFd struct {
Fd int32
Events uint16
Revents uint16
}
const (
POLLERR = 0x4000
POLLHUP = 0x2000
POLLIN = 0x1
POLLNVAL = 0x8000
POLLOUT = 0x2
POLLPRI = 0x4
POLLRDBAND = 0x20
POLLRDNORM = 0x10
POLLWRBAND = 0x40
POLLWRNORM = 0x2
)
type Flock_t struct {
Type int16
Whence int16
Sysid uint32
Pid int32
Vfs int32
Start int64
Len int64
}
type Fsid_t struct {
Val [2]uint32
}
type Fsid64_t struct {
Val [2]uint64
}
type Statfs_t struct {
Version int32
Type int32
Bsize uint64
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Fsid Fsid64_t
Vfstype int32
Fsize uint64
Vfsnumber int32
Vfsoff int32
Vfslen int32
Vfsvers int32
Fname [32]uint8
Fpack [32]uint8
Name_max int32
_ [4]byte
}
const RNDGETENTCNT = 0x80045200
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
* All rights reserved
* www.brocade.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef __BFA_DEFS_IOC_H__
#define __BFA_DEFS_IOC_H__
#include <protocol/types.h>
#include <defs/bfa_defs_types.h>
#include <defs/bfa_defs_version.h>
#include <defs/bfa_defs_adapter.h>
#include <defs/bfa_defs_pm.h>
enum {
BFA_IOC_DRIVER_LEN = 16,
BFA_IOC_CHIP_REV_LEN = 8,
};
/**
* Driver and firmware versions.
*/
struct bfa_ioc_driver_attr_s {
char driver[BFA_IOC_DRIVER_LEN]; /* driver name */
char driver_ver[BFA_VERSION_LEN]; /* driver version */
char fw_ver[BFA_VERSION_LEN]; /* firmware version*/
char bios_ver[BFA_VERSION_LEN]; /* bios version */
char efi_ver[BFA_VERSION_LEN]; /* EFI version */
char ob_ver[BFA_VERSION_LEN]; /* openboot version*/
};
/**
* IOC PCI device attributes
*/
struct bfa_ioc_pci_attr_s {
u16 vendor_id; /* PCI vendor ID */
u16 device_id; /* PCI device ID */
u16 ssid; /* subsystem ID */
u16 ssvid; /* subsystem vendor ID */
u32 pcifn; /* PCI device function */
u32 rsvd; /* padding */
u8 chip_rev[BFA_IOC_CHIP_REV_LEN]; /* chip revision */
};
/**
* IOC states
*/
enum bfa_ioc_state {
BFA_IOC_RESET = 1, /* IOC is in reset state */
BFA_IOC_SEMWAIT = 2, /* Waiting for IOC hardware semaphore */
BFA_IOC_HWINIT = 3, /* IOC hardware is being initialized */
BFA_IOC_GETATTR = 4, /* IOC is being configured */
BFA_IOC_OPERATIONAL = 5, /* IOC is operational */
BFA_IOC_INITFAIL = 6, /* IOC hardware failure */
BFA_IOC_HBFAIL = 7, /* IOC heart-beat failure */
BFA_IOC_DISABLING = 8, /* IOC is being disabled */
BFA_IOC_DISABLED = 9, /* IOC is disabled */
BFA_IOC_FWMISMATCH = 10, /* IOC firmware different from drivers */
};
/**
* IOC firmware stats
*/
struct bfa_fw_ioc_stats_s {
u32 hb_count;
u32 cfg_reqs;
u32 enable_reqs;
u32 disable_reqs;
u32 stats_reqs;
u32 clrstats_reqs;
u32 unknown_reqs;
u32 ic_reqs; /* interrupt coalesce reqs */
};
/**
* IOC driver stats
*/
struct bfa_ioc_drv_stats_s {
u32 ioc_isrs;
u32 ioc_enables;
u32 ioc_disables;
u32 ioc_hbfails;
u32 ioc_boots;
u32 stats_tmos;
u32 hb_count;
u32 disable_reqs;
u32 enable_reqs;
u32 disable_replies;
u32 enable_replies;
};
/**
* IOC statistics
*/
struct bfa_ioc_stats_s {
struct bfa_ioc_drv_stats_s drv_stats; /* driver IOC stats */
struct bfa_fw_ioc_stats_s fw_stats; /* firmware IOC stats */
};
enum bfa_ioc_type_e {
BFA_IOC_TYPE_FC = 1,
BFA_IOC_TYPE_FCoE = 2,
BFA_IOC_TYPE_LL = 3,
};
/**
* IOC attributes returned in queries
*/
struct bfa_ioc_attr_s {
enum bfa_ioc_type_e ioc_type;
enum bfa_ioc_state state; /* IOC state */
struct bfa_adapter_attr_s adapter_attr; /* HBA attributes */
struct bfa_ioc_driver_attr_s driver_attr; /* driver attr */
struct bfa_ioc_pci_attr_s pci_attr;
u8 port_id; /* port number */
};
/**
* BFA IOC level events
*/
enum bfa_ioc_aen_event {
BFA_IOC_AEN_HBGOOD = 1, /* Heart Beat restore event */
BFA_IOC_AEN_HBFAIL = 2, /* Heart Beat failure event */
BFA_IOC_AEN_ENABLE = 3, /* IOC enabled event */
BFA_IOC_AEN_DISABLE = 4, /* IOC disabled event */
BFA_IOC_AEN_FWMISMATCH = 5, /* IOC firmware mismatch */
};
/**
* BFA IOC level event data, now just a place holder
*/
struct bfa_ioc_aen_data_s {
enum bfa_ioc_type_e ioc_type;
wwn_t pwwn;
mac_t mac;
};
#endif /* __BFA_DEFS_IOC_H__ */
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2020 Precog Data
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package quasar.connector.datasource
import quasar.RateLimiting
import quasar.api.datasource.DatasourceType
import quasar.api.datasource.DatasourceError.{ConfigurationError, InitializationError}
import quasar.api.resource.{ResourcePath, ResourcePathType}
import quasar.connector.{ByteStore, ExternalCredentials, MonadResourceErr, QueryResult}
import quasar.qscript.InterpretedRead
import scala.Option
import scala.concurrent.ExecutionContext
import scala.util.Either
import argonaut.Json
import cats.effect.{ConcurrentEffect, ContextShift, Timer, Resource, Sync}
import cats.kernel.Hash
import fs2.Stream
import java.util.UUID
trait LightweightDatasourceModule {
def kind: DatasourceType
def sanitizeConfig(config: Json): Json
def migrateConfig[F[_]: Sync](config: Json)
: F[Either[ConfigurationError[Json], Json]]
def reconfigure(original: Json, patch: Json)
: Either[ConfigurationError[Json], (Reconfiguration, Json)]
def lightweightDatasource[
F[_]: ConcurrentEffect: ContextShift: MonadResourceErr: Timer,
A: Hash](
config: Json,
rateLimiting: RateLimiting[F, A],
byteStore: ByteStore[F],
auth: UUID => F[Option[ExternalCredentials[F]]])(
implicit ec: ExecutionContext)
: Resource[F, Either[InitializationError[Json], LightweightDatasourceModule.DS[F]]]
}
object LightweightDatasourceModule {
type DSP[F[_], P <: ResourcePathType] = Datasource[Resource[F, ?], Stream[F, ?], InterpretedRead[ResourcePath], QueryResult[F], P]
type DS[F[_]] = DSP[F, ResourcePathType.Physical]
}
| {
"pile_set_name": "Github"
} |
using EventStore.Core.Messages;
using EventStore.Core.Messaging;
using EventStore.Core.Services.TimerService;
using EventStore.Core.Tests.Helpers;
using EventStore.Core.Tests.Services.TimeService;
using EventStore.Core.Util;
using EventStore.Projections.Core.Messages;
using EventStore.Projections.Core.Services;
using EventStore.Projections.Core.Services.Management;
using EventStore.Projections.Core.Services.Processing;
using NUnit.Framework;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace EventStore.Projections.Core.Tests.Services.projections_manager.managed_projection {
public class FailureConditions : IEnumerable {
public IEnumerator GetEnumerator() {
yield return OperationResult.CommitTimeout;
yield return OperationResult.ForwardTimeout;
yield return OperationResult.PrepareTimeout;
}
}
[TestFixture, TestFixtureSource(typeof(FailureConditions))]
public class when_persisted_state_write_fails : TestFixtureWithExistingEvents {
private new ITimeProvider _timeProvider;
private ManagedProjection _managedProjection;
private Guid _coreProjectionId;
private string _projectionName;
private string _projectionDefinitionStreamId;
private Guid _originalPersistedStateEventId;
private OperationResult _failureCondition;
public when_persisted_state_write_fails(OperationResult failureCondition) {
_failureCondition = failureCondition;
}
protected override ManualQueue GiveInputQueue() {
return new ManualQueue(_bus, _timeProvider);
}
[SetUp]
public void SetUp() {
AllWritesQueueUp();
WhenLoop();
}
protected override void Given() {
_projectionName = "projectionName";
_projectionDefinitionStreamId = ProjectionNamesBuilder.ProjectionsStreamPrefix + _projectionName;
_coreProjectionId = Guid.NewGuid();
_timeProvider = new FakeTimeProvider();
_managedProjection = new ManagedProjection(
Guid.NewGuid(),
Guid.NewGuid(),
1,
_projectionName,
true,
null,
_streamDispatcher,
_writeDispatcher,
_readDispatcher,
_bus,
_timeProvider, new RequestResponseDispatcher
<CoreProjectionManagementMessage.GetState, CoreProjectionStatusMessage.StateReport>(
_bus,
v => v.CorrelationId,
v => v.CorrelationId,
new PublishEnvelope(_bus)),
new RequestResponseDispatcher
<CoreProjectionManagementMessage.GetResult, CoreProjectionStatusMessage.ResultReport>(
_bus,
v => v.CorrelationId,
v => v.CorrelationId,
new PublishEnvelope(_bus)),
_ioDispatcher,
TimeSpan.FromMinutes(Opts.ProjectionsQueryExpiryDefault));
}
protected override IEnumerable<WhenStep> When() {
ProjectionManagementMessage.Command.Post message = new ProjectionManagementMessage.Command.Post(
Envelope, ProjectionMode.OneTime, _projectionName, ProjectionManagementMessage.RunAs.System,
typeof(FakeForeachStreamProjection), "", true, false, false, false);
_managedProjection.InitializeNew(
new ManagedProjection.PersistedState {
Enabled = message.Enabled,
HandlerType = message.HandlerType,
Query = message.Query,
Mode = message.Mode,
EmitEnabled = message.EmitEnabled,
CheckpointsDisabled = !message.CheckpointsEnabled,
Epoch = -1,
Version = -1,
RunAs = message.EnableRunAs ? SerializedRunAs.SerializePrincipal(message.RunAs) : null,
},
null);
var sourceDefinition = new FakeForeachStreamProjection("", Console.WriteLine).GetSourceDefinition();
var projectionSourceDefinition = ProjectionSourceDefinition.From(sourceDefinition);
_managedProjection.Handle(
new CoreProjectionStatusMessage.Prepared(
_coreProjectionId, projectionSourceDefinition));
_originalPersistedStateEventId = _consumer.HandledMessages.OfType<ClientMessage.WriteEvents>()
.Where(x => x.EventStreamId == _projectionDefinitionStreamId).First().Events[0].EventId;
CompleteWriteWithResult(_failureCondition);
_consumer.HandledMessages.Clear();
yield break;
}
[Test]
public void should_retry_writing_the_persisted_state_with_the_same_event_id() {
var eventId = _consumer.HandledMessages.OfType<ClientMessage.WriteEvents>()
.Where(x => x.EventStreamId == _projectionDefinitionStreamId).First().Events[0].EventId;
Assert.AreEqual(eventId, _originalPersistedStateEventId);
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build arm mips mipsle 386
// +build linux
package socket
import "unsafe"
func (h *msghdr) setIov(vs []iovec) {
l := len(vs)
if l == 0 {
return
}
h.Iov = &vs[0]
h.Iovlen = uint32(l)
}
func (h *msghdr) setControl(b []byte) {
h.Control = (*byte)(unsafe.Pointer(&b[0]))
h.Controllen = uint32(len(b))
}
| {
"pile_set_name": "Github"
} |
#
# setup.rb
#
# Copyright (c) 2000-2005 Minero Aoki
#
# This program is free software.
# You can distribute/modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
#
unless Enumerable.method_defined?(:map) # Ruby 1.4.6
module Enumerable
alias map collect
end
end
unless File.respond_to?(:read) # Ruby 1.6
def File.read(fname)
open(fname) {|f|
return f.read
}
end
end
unless Errno.const_defined?(:ENOTEMPTY) # Windows?
module Errno
class ENOTEMPTY
# We do not raise this exception, implementation is not needed.
end
end
end
def File.binread(fname)
open(fname, 'rb') {|f|
return f.read
}
end
# for corrupted Windows' stat(2)
def File.dir?(path)
File.directory?((path[-1,1] == '/') ? path : path + '/')
end
class ConfigTable
include Enumerable
def initialize(rbconfig)
@rbconfig = rbconfig
@items = []
@table = {}
# options
@install_prefix = nil
@config_opt = nil
@verbose = true
@no_harm = false
end
attr_accessor :install_prefix
attr_accessor :config_opt
attr_writer :verbose
def verbose?
@verbose
end
attr_writer :no_harm
def no_harm?
@no_harm
end
def [](key)
lookup(key).resolve(self)
end
def []=(key, val)
lookup(key).set val
end
def names
@items.map {|i| i.name }
end
def each(&block)
@items.each(&block)
end
def key?(name)
@table.key?(name)
end
def lookup(name)
@table[name] or setup_rb_error "no such config item: #{name}"
end
def add(item)
@items.push item
@table[item.name] = item
end
def remove(name)
item = lookup(name)
@items.delete_if {|i| i.name == name }
@table.delete_if {|name, i| i.name == name }
item
end
def load_script(path, inst = nil)
if File.file?(path)
MetaConfigEnvironment.new(self, inst).instance_eval File.read(path), path
end
end
def savefile
'.config'
end
def load_savefile
begin
File.foreach(savefile()) do |line|
k, v = *line.split(/=/, 2)
self[k] = v.strip
end
rescue Errno::ENOENT
setup_rb_error $!.message + "\n#{File.basename($0)} config first"
end
end
def save
@items.each {|i| i.value }
File.open(savefile(), 'w') {|f|
@items.each do |i|
f.printf "%s=%s\n", i.name, i.value if i.value? and i.value
end
}
end
def load_standard_entries
standard_entries(@rbconfig).each do |ent|
add ent
end
end
def standard_entries(rbconfig)
c = rbconfig
rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT'])
major = c['MAJOR'].to_i
minor = c['MINOR'].to_i
teeny = c['TEENY'].to_i
version = "#{major}.#{minor}"
# ruby ver. >= 1.4.4?
newpath_p = ((major >= 2) or
((major == 1) and
((minor >= 5) or
((minor == 4) and (teeny >= 4)))))
if c['rubylibdir']
# V > 1.6.3
libruby = "#{c['prefix']}/lib/ruby"
librubyver = c['rubylibdir']
librubyverarch = c['archdir']
siteruby = c['sitedir']
siterubyver = c['sitelibdir']
siterubyverarch = c['sitearchdir']
elsif newpath_p
# 1.4.4 <= V <= 1.6.3
libruby = "#{c['prefix']}/lib/ruby"
librubyver = "#{c['prefix']}/lib/ruby/#{version}"
librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
siteruby = c['sitedir']
siterubyver = "$siteruby/#{version}"
siterubyverarch = "$siterubyver/#{c['arch']}"
else
# V < 1.4.4
libruby = "#{c['prefix']}/lib/ruby"
librubyver = "#{c['prefix']}/lib/ruby/#{version}"
librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby"
siterubyver = siteruby
siterubyverarch = "$siterubyver/#{c['arch']}"
end
parameterize = lambda {|path|
path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')
}
if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
else
makeprog = 'make'
end
[
ExecItem.new('installdirs', 'std/site/home',
'std: install under libruby; site: install under site_ruby; home: install under $HOME')\
{|val, table|
case val
when 'std'
table['rbdir'] = '$librubyver'
table['sodir'] = '$librubyverarch'
when 'site'
table['rbdir'] = '$siterubyver'
table['sodir'] = '$siterubyverarch'
when 'home'
setup_rb_error '$HOME was not set' unless ENV['HOME']
table['prefix'] = ENV['HOME']
table['rbdir'] = '$libdir/ruby'
table['sodir'] = '$libdir/ruby'
end
},
PathItem.new('prefix', 'path', c['prefix'],
'path prefix of target environment'),
PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
'the directory for commands'),
PathItem.new('libdir', 'path', parameterize.call(c['libdir']),
'the directory for libraries'),
PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
'the directory for shared data'),
PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
'the directory for man pages'),
PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
'the directory for system configuration files'),
PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']),
'the directory for local state data'),
PathItem.new('libruby', 'path', libruby,
'the directory for ruby libraries'),
PathItem.new('librubyver', 'path', librubyver,
'the directory for standard ruby libraries'),
PathItem.new('librubyverarch', 'path', librubyverarch,
'the directory for standard ruby extensions'),
PathItem.new('siteruby', 'path', siteruby,
'the directory for version-independent aux ruby libraries'),
PathItem.new('siterubyver', 'path', siterubyver,
'the directory for aux ruby libraries'),
PathItem.new('siterubyverarch', 'path', siterubyverarch,
'the directory for aux ruby binaries'),
PathItem.new('rbdir', 'path', '$siterubyver',
'the directory for ruby scripts'),
PathItem.new('sodir', 'path', '$siterubyverarch',
'the directory for ruby extentions'),
PathItem.new('rubypath', 'path', rubypath,
'the path to set to #! line'),
ProgramItem.new('rubyprog', 'name', rubypath,
'the ruby program using for installation'),
ProgramItem.new('makeprog', 'name', makeprog,
'the make program to compile ruby extentions'),
SelectItem.new('shebang', 'all/ruby/never', 'ruby',
'shebang line (#!) editing mode'),
BoolItem.new('without-ext', 'yes/no', 'no',
'does not compile/install ruby extentions')
]
end
private :standard_entries
def load_multipackage_entries
multipackage_entries().each do |ent|
add ent
end
end
def multipackage_entries
[
PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
'package names that you want to install'),
PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
'package names that you do not want to install')
]
end
private :multipackage_entries
ALIASES = {
'std-ruby' => 'librubyver',
'stdruby' => 'librubyver',
'rubylibdir' => 'librubyver',
'archdir' => 'librubyverarch',
'site-ruby-common' => 'siteruby', # For backward compatibility
'site-ruby' => 'siterubyver', # For backward compatibility
'bin-dir' => 'bindir',
'bin-dir' => 'bindir',
'rb-dir' => 'rbdir',
'so-dir' => 'sodir',
'data-dir' => 'datadir',
'ruby-path' => 'rubypath',
'ruby-prog' => 'rubyprog',
'ruby' => 'rubyprog',
'make-prog' => 'makeprog',
'make' => 'makeprog'
}
def fixup
ALIASES.each do |ali, name|
@table[ali] = @table[name]
end
@items.freeze
@table.freeze
@options_re = /\A--(#{@table.keys.join('|')})(?:=(.*))?\z/
end
def parse_opt(opt)
m = @options_re.match(opt) or setup_rb_error "config: unknown option #{opt}"
m.to_a[1,2]
end
def dllext
@rbconfig['DLEXT']
end
def value_config?(name)
lookup(name).value?
end
class Item
def initialize(name, template, default, desc)
@name = name.freeze
@template = template
@value = default
@default = default
@description = desc
end
attr_reader :name
attr_reader :description
attr_accessor :default
alias help_default default
def help_opt
"--#{@name}=#{@template}"
end
def value?
true
end
def value
@value
end
def resolve(table)
@value.gsub(%r<\$([^/]+)>) { table[$1] }
end
def set(val)
@value = check(val)
end
private
def check(val)
setup_rb_error "config: --#{name} requires argument" unless val
val
end
end
class BoolItem < Item
def config_type
'bool'
end
def help_opt
"--#{@name}"
end
private
def check(val)
return 'yes' unless val
case val
when /\Ay(es)?\z/i, /\At(rue)?\z/i then 'yes'
when /\An(o)?\z/i, /\Af(alse)\z/i then 'no'
else
setup_rb_error "config: --#{@name} accepts only yes/no for argument"
end
end
end
class PathItem < Item
def config_type
'path'
end
private
def check(path)
setup_rb_error "config: --#{@name} requires argument" unless path
path[0,1] == '$' ? path : File.expand_path(path)
end
end
class ProgramItem < Item
def config_type
'program'
end
end
class SelectItem < Item
def initialize(name, selection, default, desc)
super
@ok = selection.split('/')
end
def config_type
'select'
end
private
def check(val)
unless @ok.include?(val.strip)
setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
end
val.strip
end
end
class ExecItem < Item
def initialize(name, selection, desc, &block)
super name, selection, nil, desc
@ok = selection.split('/')
@action = block
end
def config_type
'exec'
end
def value?
false
end
def resolve(table)
setup_rb_error "$#{name()} wrongly used as option value"
end
undef set
def evaluate(val, table)
v = val.strip.downcase
unless @ok.include?(v)
setup_rb_error "invalid option --#{@name}=#{val} (use #{@template})"
end
@action.call v, table
end
end
class PackageSelectionItem < Item
def initialize(name, template, default, help_default, desc)
super name, template, default, desc
@help_default = help_default
end
attr_reader :help_default
def config_type
'package'
end
private
def check(val)
unless File.dir?("packages/#{val}")
setup_rb_error "config: no such package: #{val}"
end
val
end
end
class MetaConfigEnvironment
def initialize(config, installer)
@config = config
@installer = installer
end
def config_names
@config.names
end
def config?(name)
@config.key?(name)
end
def bool_config?(name)
@config.lookup(name).config_type == 'bool'
end
def path_config?(name)
@config.lookup(name).config_type == 'path'
end
def value_config?(name)
@config.lookup(name).config_type != 'exec'
end
def add_config(item)
@config.add item
end
def add_bool_config(name, default, desc)
@config.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
end
def add_path_config(name, default, desc)
@config.add PathItem.new(name, 'path', default, desc)
end
def set_config_default(name, default)
@config.lookup(name).default = default
end
def remove_config(name)
@config.remove(name)
end
# For only multipackage
def packages
raise '[setup.rb fatal] multi-package metaconfig API packages() called for single-package; contact application package vendor' unless @installer
@installer.packages
end
# For only multipackage
def declare_packages(list)
raise '[setup.rb fatal] multi-package metaconfig API declare_packages() called for single-package; contact application package vendor' unless @installer
@installer.packages = list
end
end
end # class ConfigTable
# This module requires: #verbose?, #no_harm?
module FileOperations
def mkdir_p(dirname, prefix = nil)
dirname = prefix + File.expand_path(dirname) if prefix
$stderr.puts "mkdir -p #{dirname}" if verbose?
return if no_harm?
# Does not check '/', it's too abnormal.
dirs = File.expand_path(dirname).split(%r<(?=/)>)
if /\A[a-z]:\z/i =~ dirs[0]
disk = dirs.shift
dirs[0] = disk + dirs[0]
end
dirs.each_index do |idx|
path = dirs[0..idx].join('')
Dir.mkdir path unless File.dir?(path)
end
end
def rm_f(path)
$stderr.puts "rm -f #{path}" if verbose?
return if no_harm?
force_remove_file path
end
def rm_rf(path)
$stderr.puts "rm -rf #{path}" if verbose?
return if no_harm?
remove_tree path
end
def remove_tree(path)
if File.symlink?(path)
remove_file path
elsif File.dir?(path)
remove_tree0 path
else
force_remove_file path
end
end
def remove_tree0(path)
Dir.foreach(path) do |ent|
next if ent == '.'
next if ent == '..'
entpath = "#{path}/#{ent}"
if File.symlink?(entpath)
remove_file entpath
elsif File.dir?(entpath)
remove_tree0 entpath
else
force_remove_file entpath
end
end
begin
Dir.rmdir path
rescue Errno::ENOTEMPTY
# directory may not be empty
end
end
def move_file(src, dest)
force_remove_file dest
begin
File.rename src, dest
rescue
File.open(dest, 'wb') {|f|
f.write File.binread(src)
}
File.chmod File.stat(src).mode, dest
File.unlink src
end
end
def force_remove_file(path)
begin
remove_file path
rescue
end
end
def remove_file(path)
File.chmod 0777, path
File.unlink path
end
def install(from, dest, mode, prefix = nil)
$stderr.puts "install #{from} #{dest}" if verbose?
return if no_harm?
realdest = prefix ? prefix + File.expand_path(dest) : dest
realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
str = File.binread(from)
if diff?(str, realdest)
verbose_off {
rm_f realdest if File.exist?(realdest)
}
File.open(realdest, 'wb') {|f|
f.write str
}
File.chmod mode, realdest
File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
if prefix
f.puts realdest.sub(prefix, '')
else
f.puts realdest
end
}
end
end
def diff?(new_content, path)
return true unless File.exist?(path)
new_content != File.binread(path)
end
def command(*args)
$stderr.puts args.join(' ') if verbose?
system(*args) or raise RuntimeError,
"system(#{args.map{|a| a.inspect }.join(' ')}) failed"
end
def ruby(*args)
command config('rubyprog'), *args
end
def make(task = nil)
command(*[config('makeprog'), task].compact)
end
def extdir?(dir)
File.exist?("#{dir}/MANIFEST") or File.exist?("#{dir}/extconf.rb")
end
def files_of(dir)
Dir.open(dir) {|d|
return d.select {|ent| File.file?("#{dir}/#{ent}") }
}
end
DIR_REJECT = %w( . .. CVS SCCS RCS CVS.adm .svn )
def directories_of(dir)
Dir.open(dir) {|d|
return d.select {|ent| File.dir?("#{dir}/#{ent}") } - DIR_REJECT
}
end
end
# This module requires: #srcdir_root, #objdir_root, #relpath
module HookScriptAPI
def get_config(key)
@config[key]
end
alias config get_config
# obsolete: use metaconfig to change configuration
def set_config(key, val)
@config[key] = val
end
#
# srcdir/objdir (works only in the package directory)
#
def curr_srcdir
"#{srcdir_root()}/#{relpath()}"
end
def curr_objdir
"#{objdir_root()}/#{relpath()}"
end
def srcfile(path)
"#{curr_srcdir()}/#{path}"
end
def srcexist?(path)
File.exist?(srcfile(path))
end
def srcdirectory?(path)
File.dir?(srcfile(path))
end
def srcfile?(path)
File.file?(srcfile(path))
end
def srcentries(path = '.')
Dir.open("#{curr_srcdir()}/#{path}") {|d|
return d.to_a - %w(. ..)
}
end
def srcfiles(path = '.')
srcentries(path).select {|fname|
File.file?(File.join(curr_srcdir(), path, fname))
}
end
def srcdirectories(path = '.')
srcentries(path).select {|fname|
File.dir?(File.join(curr_srcdir(), path, fname))
}
end
end
class ToplevelInstaller
Version = '3.4.1'
Copyright = 'Copyright (c) 2000-2005 Minero Aoki'
TASKS = [
[ 'all', 'do config, setup, then install' ],
[ 'config', 'saves your configurations' ],
[ 'show', 'shows current configuration' ],
[ 'setup', 'compiles ruby extentions and others' ],
[ 'install', 'installs files' ],
[ 'test', 'run all tests in test/' ],
[ 'clean', "does `make clean' for each extention" ],
[ 'distclean',"does `make distclean' for each extention" ]
]
def ToplevelInstaller.invoke
config = ConfigTable.new(load_rbconfig())
config.load_standard_entries
config.load_multipackage_entries if multipackage?
config.fixup
klass = (multipackage?() ? ToplevelInstallerMulti : ToplevelInstaller)
klass.new(File.dirname($0), config).invoke
end
def ToplevelInstaller.multipackage?
File.dir?(File.dirname($0) + '/packages')
end
def ToplevelInstaller.load_rbconfig
if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
ARGV.delete(arg)
load File.expand_path(arg.split(/=/, 2)[1])
$".push 'rbconfig.rb'
else
require 'rbconfig'
end
::Config::CONFIG
end
def initialize(ardir_root, config)
@ardir = File.expand_path(ardir_root)
@config = config
# cache
@valid_task_re = nil
end
def config(key)
@config[key]
end
def inspect
"#<#{self.class} #{__id__()}>"
end
def invoke
run_metaconfigs
case task = parsearg_global()
when nil, 'all'
parsearg_config
init_installers
exec_config
exec_setup
exec_install
else
case task
when 'config', 'test'
;
when 'clean', 'distclean'
@config.load_savefile if File.exist?(@config.savefile)
else
@config.load_savefile
end
__send__ "parsearg_#{task}"
init_installers
__send__ "exec_#{task}"
end
end
def run_metaconfigs
@config.load_script "#{@ardir}/metaconfig"
end
def init_installers
@installer = Installer.new(@config, @ardir, File.expand_path('.'))
end
#
# Hook Script API bases
#
def srcdir_root
@ardir
end
def objdir_root
'.'
end
def relpath
'.'
end
#
# Option Parsing
#
def parsearg_global
while arg = ARGV.shift
case arg
when /\A\w+\z/
setup_rb_error "invalid task: #{arg}" unless valid_task?(arg)
return arg
when '-q', '--quiet'
@config.verbose = false
when '--verbose'
@config.verbose = true
when '--help'
print_usage $stdout
exit 0
when '--version'
puts "#{File.basename($0)} version #{Version}"
exit 0
when '--copyright'
puts Copyright
exit 0
else
setup_rb_error "unknown global option '#{arg}'"
end
end
nil
end
def valid_task?(t)
valid_task_re() =~ t
end
def valid_task_re
@valid_task_re ||= /\A(?:#{TASKS.map {|task,desc| task }.join('|')})\z/
end
def parsearg_no_options
unless ARGV.empty?
task = caller(0).first.slice(%r<`parsearg_(\w+)'>, 1)
setup_rb_error "#{task}: unknown options: #{ARGV.join(' ')}"
end
end
alias parsearg_show parsearg_no_options
alias parsearg_setup parsearg_no_options
alias parsearg_test parsearg_no_options
alias parsearg_clean parsearg_no_options
alias parsearg_distclean parsearg_no_options
def parsearg_config
evalopt = []
set = []
@config.config_opt = []
while i = ARGV.shift
if /\A--?\z/ =~ i
@config.config_opt = ARGV.dup
break
end
name, value = *@config.parse_opt(i)
if @config.value_config?(name)
@config[name] = value
else
evalopt.push [name, value]
end
set.push name
end
evalopt.each do |name, value|
@config.lookup(name).evaluate value, @config
end
# Check if configuration is valid
set.each do |n|
@config[n] if @config.value_config?(n)
end
end
def parsearg_install
@config.no_harm = false
@config.install_prefix = ''
while a = ARGV.shift
case a
when '--no-harm'
@config.no_harm = true
when /\A--prefix=/
path = a.split(/=/, 2)[1]
path = File.expand_path(path) unless path[0,1] == '/'
@config.install_prefix = path
else
setup_rb_error "install: unknown option #{a}"
end
end
end
def print_usage(out)
out.puts 'Typical Installation Procedure:'
out.puts " $ ruby #{File.basename $0} config"
out.puts " $ ruby #{File.basename $0} setup"
out.puts " # ruby #{File.basename $0} install (may require root privilege)"
out.puts
out.puts 'Detailed Usage:'
out.puts " ruby #{File.basename $0} <global option>"
out.puts " ruby #{File.basename $0} [<global options>] <task> [<task options>]"
fmt = " %-24s %s\n"
out.puts
out.puts 'Global options:'
out.printf fmt, '-q,--quiet', 'suppress message outputs'
out.printf fmt, ' --verbose', 'output messages verbosely'
out.printf fmt, ' --help', 'print this message'
out.printf fmt, ' --version', 'print version and quit'
out.printf fmt, ' --copyright', 'print copyright and quit'
out.puts
out.puts 'Tasks:'
TASKS.each do |name, desc|
out.printf fmt, name, desc
end
fmt = " %-24s %s [%s]\n"
out.puts
out.puts 'Options for CONFIG or ALL:'
@config.each do |item|
out.printf fmt, item.help_opt, item.description, item.help_default
end
out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's"
out.puts
out.puts 'Options for INSTALL:'
out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
out.printf fmt, '--prefix=path', 'install path prefix', ''
out.puts
end
#
# Task Handlers
#
def exec_config
@installer.exec_config
@config.save # must be final
end
def exec_setup
@installer.exec_setup
end
def exec_install
@installer.exec_install
end
def exec_test
@installer.exec_test
end
def exec_show
@config.each do |i|
printf "%-20s %s\n", i.name, i.value if i.value?
end
end
def exec_clean
@installer.exec_clean
end
def exec_distclean
@installer.exec_distclean
end
end # class ToplevelInstaller
class ToplevelInstallerMulti < ToplevelInstaller
include FileOperations
def initialize(ardir_root, config)
super
@packages = directories_of("#{@ardir}/packages")
raise 'no package exists' if @packages.empty?
@root_installer = Installer.new(@config, @ardir, File.expand_path('.'))
end
def run_metaconfigs
@config.load_script "#{@ardir}/metaconfig", self
@packages.each do |name|
@config.load_script "#{@ardir}/packages/#{name}/metaconfig"
end
end
attr_reader :packages
def packages=(list)
raise 'package list is empty' if list.empty?
list.each do |name|
raise "directory packages/#{name} does not exist"\
unless File.dir?("#{@ardir}/packages/#{name}")
end
@packages = list
end
def init_installers
@installers = {}
@packages.each do |pack|
@installers[pack] = Installer.new(@config,
"#{@ardir}/packages/#{pack}",
"packages/#{pack}")
end
with = extract_selection(config('with'))
without = extract_selection(config('without'))
@selected = @installers.keys.select {|name|
(with.empty? or with.include?(name)) \
and not without.include?(name)
}
end
def extract_selection(list)
a = list.split(/,/)
a.each do |name|
setup_rb_error "no such package: #{name}" unless @installers.key?(name)
end
a
end
def print_usage(f)
super
f.puts 'Inluded packages:'
f.puts ' ' + @packages.sort.join(' ')
f.puts
end
#
# Task Handlers
#
def exec_config
run_hook 'pre-config'
each_selected_installers {|inst| inst.exec_config }
run_hook 'post-config'
@config.save # must be final
end
def exec_setup
run_hook 'pre-setup'
each_selected_installers {|inst| inst.exec_setup }
run_hook 'post-setup'
end
def exec_install
run_hook 'pre-install'
each_selected_installers {|inst| inst.exec_install }
run_hook 'post-install'
end
def exec_test
run_hook 'pre-test'
each_selected_installers {|inst| inst.exec_test }
run_hook 'post-test'
end
def exec_clean
rm_f @config.savefile
run_hook 'pre-clean'
each_selected_installers {|inst| inst.exec_clean }
run_hook 'post-clean'
end
def exec_distclean
rm_f @config.savefile
run_hook 'pre-distclean'
each_selected_installers {|inst| inst.exec_distclean }
run_hook 'post-distclean'
end
#
# lib
#
def each_selected_installers
Dir.mkdir 'packages' unless File.dir?('packages')
@selected.each do |pack|
$stderr.puts "Processing the package `#{pack}' ..." if verbose?
Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
Dir.chdir "packages/#{pack}"
yield @installers[pack]
Dir.chdir '../..'
end
end
def run_hook(id)
@root_installer.run_hook id
end
# module FileOperations requires this
def verbose?
@config.verbose?
end
# module FileOperations requires this
def no_harm?
@config.no_harm?
end
end # class ToplevelInstallerMulti
class Installer
FILETYPES = %w( bin lib ext data conf man )
include FileOperations
include HookScriptAPI
def initialize(config, srcroot, objroot)
@config = config
@srcdir = File.expand_path(srcroot)
@objdir = File.expand_path(objroot)
@currdir = '.'
end
def inspect
"#<#{self.class} #{File.basename(@srcdir)}>"
end
def noop(rel)
end
#
# Hook Script API base methods
#
def srcdir_root
@srcdir
end
def objdir_root
@objdir
end
def relpath
@currdir
end
#
# Config Access
#
# module FileOperations requires this
def verbose?
@config.verbose?
end
# module FileOperations requires this
def no_harm?
@config.no_harm?
end
def verbose_off
begin
save, @config.verbose = @config.verbose?, false
yield
ensure
@config.verbose = save
end
end
#
# TASK config
#
def exec_config
exec_task_traverse 'config'
end
alias config_dir_bin noop
alias config_dir_lib noop
def config_dir_ext(rel)
extconf if extdir?(curr_srcdir())
end
alias config_dir_data noop
alias config_dir_conf noop
alias config_dir_man noop
def extconf
ruby "#{curr_srcdir()}/extconf.rb", *@config.config_opt
end
#
# TASK setup
#
def exec_setup
exec_task_traverse 'setup'
end
def setup_dir_bin(rel)
files_of(curr_srcdir()).each do |fname|
update_shebang_line "#{curr_srcdir()}/#{fname}"
end
end
alias setup_dir_lib noop
def setup_dir_ext(rel)
make if extdir?(curr_srcdir())
end
alias setup_dir_data noop
alias setup_dir_conf noop
alias setup_dir_man noop
def update_shebang_line(path)
return if no_harm?
return if config('shebang') == 'never'
old = Shebang.load(path)
if old
$stderr.puts "warning: #{path}: Shebang line includes too many args. It is not portable and your program may not work." if old.args.size > 1
new = new_shebang(old)
return if new.to_s == old.to_s
else
return unless config('shebang') == 'all'
new = Shebang.new(config('rubypath'))
end
$stderr.puts "updating shebang: #{File.basename(path)}" if verbose?
open_atomic_writer(path) {|output|
File.open(path, 'rb') {|f|
f.gets if old # discard
output.puts new.to_s
output.print f.read
}
}
end
def new_shebang(old)
if /\Aruby/ =~ File.basename(old.cmd)
Shebang.new(config('rubypath'), old.args)
elsif File.basename(old.cmd) == 'env' and old.args.first == 'ruby'
Shebang.new(config('rubypath'), old.args[1..-1])
else
return old unless config('shebang') == 'all'
Shebang.new(config('rubypath'))
end
end
def open_atomic_writer(path, &block)
tmpfile = File.basename(path) + '.tmp'
begin
File.open(tmpfile, 'wb', &block)
File.rename tmpfile, File.basename(path)
ensure
File.unlink tmpfile if File.exist?(tmpfile)
end
end
class Shebang
def Shebang.load(path)
line = nil
File.open(path) {|f|
line = f.gets
}
return nil unless /\A#!/ =~ line
parse(line)
end
def Shebang.parse(line)
cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ')
new(cmd, args)
end
def initialize(cmd, args = [])
@cmd = cmd
@args = args
end
attr_reader :cmd
attr_reader :args
def to_s
"#! #{@cmd}" + (@args.empty? ? '' : " #{@args.join(' ')}")
end
end
#
# TASK install
#
def exec_install
rm_f 'InstalledFiles'
exec_task_traverse 'install'
end
def install_dir_bin(rel)
install_files targetfiles(), "#{config('bindir')}/#{rel}", 0755
end
def install_dir_lib(rel)
install_files libfiles(), "#{config('rbdir')}/#{rel}", 0644
end
def install_dir_ext(rel)
return unless extdir?(curr_srcdir())
install_files rubyextentions('.'),
"#{config('sodir')}/#{File.dirname(rel)}",
0555
end
def install_dir_data(rel)
install_files targetfiles(), "#{config('datadir')}/#{rel}", 0644
end
def install_dir_conf(rel)
# FIXME: should not remove current config files
# (rename previous file to .old/.org)
install_files targetfiles(), "#{config('sysconfdir')}/#{rel}", 0644
end
def install_dir_man(rel)
install_files targetfiles(), "#{config('mandir')}/#{rel}", 0644
end
def install_files(list, dest, mode)
mkdir_p dest, @config.install_prefix
list.each do |fname|
install fname, dest, mode, @config.install_prefix
end
end
def libfiles
glob_reject(%w(*.y *.output), targetfiles())
end
def rubyextentions(dir)
ents = glob_select("*.#{@config.dllext}", targetfiles())
if ents.empty?
setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first"
end
ents
end
def targetfiles
mapdir(existfiles() - hookfiles())
end
def mapdir(ents)
ents.map {|ent|
if File.exist?(ent)
then ent # objdir
else "#{curr_srcdir()}/#{ent}" # srcdir
end
}
end
# picked up many entries from cvs-1.11.1/src/ignore.c
JUNK_FILES = %w(
core RCSLOG tags TAGS .make.state
.nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
*~ *.old *.bak *.BAK *.orig *.rej _$* *$
*.org *.in .*
)
def existfiles
glob_reject(JUNK_FILES, (files_of(curr_srcdir()) | files_of('.')))
end
def hookfiles
%w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt|
%w( config setup install clean ).map {|t| sprintf(fmt, t) }
}.flatten
end
def glob_select(pat, ents)
re = globs2re([pat])
ents.select {|ent| re =~ ent }
end
def glob_reject(pats, ents)
re = globs2re(pats)
ents.reject {|ent| re =~ ent }
end
GLOB2REGEX = {
'.' => '\.',
'$' => '\$',
'#' => '\#',
'*' => '.*'
}
def globs2re(pats)
/\A(?:#{
pats.map {|pat| pat.gsub(/[\.\$\#\*]/) {|ch| GLOB2REGEX[ch] } }.join('|')
})\z/
end
#
# TASK test
#
TESTDIR = 'test'
def exec_test
unless File.directory?('test')
$stderr.puts 'no test in this package' if verbose?
return
end
$stderr.puts 'Running tests...' if verbose?
begin
require 'test/unit'
rescue LoadError
setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'
end
runner = Test::Unit::AutoRunner.new(true)
runner.to_run << TESTDIR
runner.run
end
#
# TASK clean
#
def exec_clean
exec_task_traverse 'clean'
rm_f @config.savefile
rm_f 'InstalledFiles'
end
alias clean_dir_bin noop
alias clean_dir_lib noop
alias clean_dir_data noop
alias clean_dir_conf noop
alias clean_dir_man noop
def clean_dir_ext(rel)
return unless extdir?(curr_srcdir())
make 'clean' if File.file?('Makefile')
end
#
# TASK distclean
#
def exec_distclean
exec_task_traverse 'distclean'
rm_f @config.savefile
rm_f 'InstalledFiles'
end
alias distclean_dir_bin noop
alias distclean_dir_lib noop
def distclean_dir_ext(rel)
return unless extdir?(curr_srcdir())
make 'distclean' if File.file?('Makefile')
end
alias distclean_dir_data noop
alias distclean_dir_conf noop
alias distclean_dir_man noop
#
# Traversing
#
def exec_task_traverse(task)
run_hook "pre-#{task}"
FILETYPES.each do |type|
if type == 'ext' and config('without-ext') == 'yes'
$stderr.puts 'skipping ext/* by user option' if verbose?
next
end
traverse task, type, "#{task}_dir_#{type}"
end
run_hook "post-#{task}"
end
def traverse(task, rel, mid)
dive_into(rel) {
run_hook "pre-#{task}"
__send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '')
directories_of(curr_srcdir()).each do |d|
traverse task, "#{rel}/#{d}", mid
end
run_hook "post-#{task}"
}
end
def dive_into(rel)
return unless File.dir?("#{@srcdir}/#{rel}")
dir = File.basename(rel)
Dir.mkdir dir unless File.dir?(dir)
prevdir = Dir.pwd
Dir.chdir dir
$stderr.puts '---> ' + rel if verbose?
@currdir = rel
yield
Dir.chdir prevdir
$stderr.puts '<--- ' + rel if verbose?
@currdir = File.dirname(rel)
end
def run_hook(id)
path = [ "#{curr_srcdir()}/#{id}",
"#{curr_srcdir()}/#{id}.rb" ].detect {|cand| File.file?(cand) }
return unless path
begin
instance_eval File.read(path), path, 1
rescue
raise if $DEBUG
setup_rb_error "hook #{path} failed:\n" + $!.message
end
end
end # class Installer
class SetupError < StandardError; end
def setup_rb_error(msg)
raise SetupError, msg
end
if $0 == __FILE__
begin
ToplevelInstaller.invoke
rescue SetupError
raise if $DEBUG
$stderr.puts $!.message
$stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
exit 1
end
end
| {
"pile_set_name": "Github"
} |
'use strict';
var path = require('path');
var fileRe = require('filename-regex');
var win32 = process && process.platform === 'win32';
/**
* Expose `utils`
*/
var utils = module.exports;
utils.filename = function filename(fp) {
var seg = fp.match(fileRe());
return seg && seg[0];
};
utils.isPath = function isPath(pattern, opts) {
return function (fp) {
return utils.unixify(fp, opts) === pattern;
};
};
utils.hasPath = function hasPath(pattern, opts) {
return function (fp) {
return utils.unixify(fp, opts).indexOf(pattern) !== -1;
};
};
utils.matchPath = function matchPath(pattern, opts) {
var fn = (opts && opts.contains)
? utils.hasPath(pattern, opts)
: utils.isPath(pattern, opts);
return fn;
};
utils.hasFilename = function hasFilename(re) {
return function (fp) {
var name = utils.filename(fp);
return name && re.test(name);
};
};
/**
* Coerce `val` to an array
*
* @param {*} val
* @return {Array}
*/
utils.arrayify = function arrayify(val) {
return !Array.isArray(val)
? [val]
: val;
};
/**
* Normalize all slashes in a file path or glob pattern to
* forward slashes.
*/
utils.unixify = function unixify(fp, opts) {
if (opts && opts.unixify === false) return fp;
if (opts && opts.unixify === true || win32 || path.sep === '\\') {
return fp.split('\\').join('/');
}
if (opts && opts.unescape === true) {
return fp ? fp.toString().replace(/\\(\w)/g, '$1') : '';
}
return fp;
};
/**
* Escape/unescape utils
*/
utils.escapePath = function escapePath(fp) {
return fp.replace(/[\\.]/g, '\\$&');
};
utils.unescapeGlob = function unescapeGlob(fp) {
return fp.replace(/[\\"']/g, '');
};
utils.escapeRe = function escapeRe(str) {
return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&');
};
| {
"pile_set_name": "Github"
} |
DROP TABLE IF EXISTS TEST;
| {
"pile_set_name": "Github"
} |
package pflag
import (
"fmt"
"strconv"
)
// optional interface to indicate boolean flags that can be
// supplied without "=value" text
type boolFlag interface {
Value
IsBoolFlag() bool
}
// -- bool Value
type boolValue bool
func newBoolValue(val bool, p *bool) *boolValue {
*p = val
return (*boolValue)(p)
}
func (b *boolValue) Set(s string) error {
v, err := strconv.ParseBool(s)
*b = boolValue(v)
return err
}
func (b *boolValue) Type() string {
return "bool"
}
func (b *boolValue) String() string { return fmt.Sprintf("%v", *b) }
func (b *boolValue) IsBoolFlag() bool { return true }
// BoolVar defines a bool flag with specified name, default value, and usage string.
// The argument p points to a bool variable in which to store the value of the flag.
func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) {
f.VarP(newBoolValue(value, p), name, "", usage)
}
// Like BoolVar, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
f.VarP(newBoolValue(value, p), name, shorthand, usage)
}
// BoolVar defines a bool flag with specified name, default value, and usage string.
// The argument p points to a bool variable in which to store the value of the flag.
func BoolVar(p *bool, name string, value bool, usage string) {
CommandLine.VarP(newBoolValue(value, p), name, "", usage)
}
// Like BoolVar, but accepts a shorthand letter that can be used after a single dash.
func BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
CommandLine.VarP(newBoolValue(value, p), name, shorthand, usage)
}
// Bool defines a bool flag with specified name, default value, and usage string.
// The return value is the address of a bool variable that stores the value of the flag.
func (f *FlagSet) Bool(name string, value bool, usage string) *bool {
p := new(bool)
f.BoolVarP(p, name, "", value, usage)
return p
}
// Like Bool, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool {
p := new(bool)
f.BoolVarP(p, name, shorthand, value, usage)
return p
}
// Bool defines a bool flag with specified name, default value, and usage string.
// The return value is the address of a bool variable that stores the value of the flag.
func Bool(name string, value bool, usage string) *bool {
return CommandLine.BoolP(name, "", value, usage)
}
// Like Bool, but accepts a shorthand letter that can be used after a single dash.
func BoolP(name, shorthand string, value bool, usage string) *bool {
return CommandLine.BoolP(name, shorthand, value, usage)
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* Translation file
*
* Note: don't change the return array to short notation because Transifex can't handle those during `tx push -s`
*/
return array(
'notifications:subscriptions:personal:description' => 'Ricevi notifiche quando si svolgono azioni sui tuoi contenuti',
'notifications:subscriptions:personal:title' => 'Notifiche personali',
'notifications:subscriptions:collections:friends' => 'Impostazioni da usare per i nuovi utenti che aggiungi tra gli amici',
'notifications:subscriptions:collections:custom' => 'Impostazioni da usare per i nuovi amici che aggiungi alla lista %s',
'notifications:subscriptions:changesettings' => 'Notifiche',
'notifications:subscriptions:changesettings:groups' => 'Notifiche a livello di gruppo',
'notifications:subscriptions:title' => 'Notifiche a livello utente',
'notifications:subscriptions:description' => 'Per ricevere notifiche dai tuoi amici (su base individuale) quando creano nuovi contenuti, seleziona gli utenti qui sotto e seleziona il metodo di notifica che desideri utilizzare.',
'notifications:subscriptions:groups:description' => 'Per ricevere notifiche quando vengono creati nuovi contenuti in un gruppo di cui sei membro, seleziona il gruppo qui sotto e seleziona il metodo di notifica che desideri utilizzare.',
'notifications:subscriptions:success' => 'Le tue impostazioni di notifica sono state salvate.',
'notifications:subscriptions:no_results' => 'Ancora non ci sono dati di sottoscrizione',
'notifications:groups:subscribed' => 'Le notifiche del gruppo sono attive',
'notifications:groups:unsubscribed' => 'Le notifiche del gruppo sono disattivate',
);
| {
"pile_set_name": "Github"
} |
.. Node embedding models
.. _DeepWalk: https://arxiv.org/pdf/1403.6652.pdf
.. _LINE: https://arxiv.org/pdf/1503.03578.pdf
.. _node2vec: https://www.kdd.org/kdd2016/papers/files/rfp0218-groverA.pdf
.. Knowledge graph embedding models
.. _TransE: http://papers.nips.cc/paper/5071-translating-embeddings-for-modeling-multi-relational-data.pdf
.. _DistMult: https://arxiv.org/pdf/1412.6575.pdf
.. _ComplEx: http://proceedings.mlr.press/v48/trouillon16.pdf
.. _SimplE: https://papers.nips.cc/paper/7682-simple-embedding-for-link-prediction-in-knowledge-graphs.pdf
.. _RotatE: https://arxiv.org/pdf/1902.10197.pdf
.. _QuatE: https://papers.nips.cc/paper/8541-quaternion-knowledge-graph-embeddings.pdf
.. Graph & high-dimensional data visualization models
.. _LargeVis: https://arxiv.org/pdf/1602.00370.pdf
.. GraphVite
.. _GraphVite: https://arxiv.org/pdf/1903.00757.pdf
.. _Repo: https://github.com/DeepGraphLearning/graphvite
.. Graph datasets
.. _Youtube: http://conferences.sigcomm.org/imc/2007/papers/imc170.pdf
.. _Flickr: http://conferences.sigcomm.org/imc/2007/papers/imc170.pdf
.. _Friendster-small: https://arxiv.org/pdf/1903.00757.pdf
.. Knowledge graph datasets
.. _FB15k: http://papers.nips.cc/paper/5071-translating-embeddings-for-modeling-multi-relational-data.pdf
.. _FB15k-237: https://www.aclweb.org/anthology/W15-4007
.. _WN18: http://papers.nips.cc/paper/5071-translating-embeddings-for-modeling-multi-relational-data.pdf
.. _WN18RR: https://www.aaai.org/ocs/index.php/AAAI/AAAI18/paper/download/17366/15884
.. _Wikidata5m: https://arxiv.org/pdf/1911.06136.pdf
.. Image datasets
.. _MNIST: http://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdf
.. _ImageNet: https://arxiv.org/pdf/1409.0575.pdf
.. Misc
.. _WordNet: http://www.cs.columbia.edu/~vh/courses/LexicalSemantics/Ontologies/miller-wordnet95.pdf
.. _Wikidata: https://www.wikidata.org
.. _Wikipedia: https://www.wikipedia.org | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="@color/wikivoyage_card_divider_dark"/>
<corners android:radius="3dp"/>
</shape>
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace TestBundle\Fabpot\FooBundle\Controller;
/**
* DefaultController.
*
* @author Fabien Potencier <[email protected]>
*/
class DefaultController
{
}
| {
"pile_set_name": "Github"
} |
// Spinning Icons
// --------------------------
.@{fa-css-prefix}-spin {
-webkit-animation: fa-spin 2s infinite linear;
animation: fa-spin 2s infinite linear;
}
@-webkit-keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
| {
"pile_set_name": "Github"
} |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package translate
const (
// ErrCodeDetectedLanguageLowConfidenceException for service response error code
// "DetectedLanguageLowConfidenceException".
//
// The confidence that Amazon Comprehend accurately detected the source language
// is low. If a low confidence level is acceptable for your application, you
// can use the language in the exception to call Amazon Translate again. For
// more information, see the DetectDominantLanguage (https://docs.aws.amazon.com/comprehend/latest/dg/API_DetectDominantLanguage.html)
// operation in the Amazon Comprehend Developer Guide.
ErrCodeDetectedLanguageLowConfidenceException = "DetectedLanguageLowConfidenceException"
// ErrCodeInternalServerException for service response error code
// "InternalServerException".
//
// An internal server error occurred. Retry your request.
ErrCodeInternalServerException = "InternalServerException"
// ErrCodeInvalidRequestException for service response error code
// "InvalidRequestException".
//
// The request is invalid.
ErrCodeInvalidRequestException = "InvalidRequestException"
// ErrCodeServiceUnavailableException for service response error code
// "ServiceUnavailableException".
//
// Amazon Translate is unavailable. Retry your request later.
ErrCodeServiceUnavailableException = "ServiceUnavailableException"
// ErrCodeTextSizeLimitExceededException for service response error code
// "TextSizeLimitExceededException".
//
// The size of the input text exceeds the length constraint for the Text field.
// Try again with a shorter text.
ErrCodeTextSizeLimitExceededException = "TextSizeLimitExceededException"
// ErrCodeTooManyRequestsException for service response error code
// "TooManyRequestsException".
//
// The number of requests exceeds the limit. Resubmit your request later.
ErrCodeTooManyRequestsException = "TooManyRequestsException"
// ErrCodeUnsupportedLanguagePairException for service response error code
// "UnsupportedLanguagePairException".
//
// Amazon Translate cannot translate input text in the source language into
// this target language. For more information, see how-to-error-msg.
ErrCodeUnsupportedLanguagePairException = "UnsupportedLanguagePairException"
)
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.