Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 1028
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 3217)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 1028
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the file specified on the command line.
Do a simple split() on whitespace to obtain all the words in the file.
Rather than read the file line by line, it's easier to read
it into one giant string and split it once.
Build a "mimic" dict that maps each word that appears in the file
to a list of all the words that immediately follow that word in the file.
The list of words can be be in any order and should include
duplicates. So for example the key "and" might have the list
["then", "best", "then", "after", ...] listing
all the words which came after "and" in the text.
We'll say that the empty string is what comes before
the first word in the file.
With the mimic dict, it's fairly easy to emit random
text that mimics the original. Print a word, then look
up what words might come next and pick one at random as
the next work.
Use the empty string as the first word to prime things.
If we ever get stuck with a word that is not in the dict,
go back to the empty string to keep things moving.
Note: the standard python module 'random' includes a
random.choice(list) method which picks a random element
from a non-empty list.
For fun, feed your program to itself as input.
Could work on getting it to put in linebreaks around 70
columns, so the output looks better.
"""
import random
import sys
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
# +++your code here+++
f = open(filename, "r")
words = (" ".join(f.readlines())).split()
word_dic = { "" : [words[0]] }
for id in range(0, len(words) - 1):
if words[id] in word_dic.keys():
word_dic[words[id]].append(words[id + 1])
else:
word_dic[words[id]] = [ words[id + 1] ]
# for key in word_dic.keys():
# print key, word_dic[key]
return word_dic
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
output = ""
for i in range(200):
if word in mimic_dict.keys():
word = random.choice(mimic_dict[word])
output += " " + word
else:
word = random.choice(mimic_dict[""])
output += " " + word
for i in range(0, len(output), 70):
print output[i:i + 70]
return output
# Provided main(), calls mimic_dict() and mimic()
def main():
if len(sys.argv) != 2:
print 'usage: ./mimic.py file-to-read'
sys.exit(1)
dict = mimic_dict(sys.argv[1])
print_mimic(dict, '')
if __name__ == '__main__':
main()
|
{
"content_hash": "e950ce912dd7d01a729a8912097540de",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 78,
"avg_line_length": 30.843373493975903,
"alnum_prop": 0.679296875,
"repo_name": "haozai309/hello_python",
"id": "3ed1cf24d7ec57b5b96b96282c2533582ad331c3",
"size": "2791",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "google-python-exercises/basic/mimic.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "74317"
}
]
}
|
import App from './app';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { showPage } from '../../actions/navigation';
const mapStateToProps = state => {
return {
displayName: state.user.me.name,
isSignedIn: state.user.isSignedIn,
page: state.navigation.page
};
};
const mapDispatchToProps = dispatch => {
return bindActionCreators({
onTabSelected: showPage,
onUserMenuClick: showPage
},
dispatch);
};
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
{
"content_hash": "f9f666a161449a59a0603adc38de2efe",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 65,
"avg_line_length": 26,
"alnum_prop": 0.6695804195804196,
"repo_name": "colinjeanne/learning-site",
"id": "efc28f2394a2025bad40128a54ed9699b6e37827",
"size": "572",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "assets/javascript/components/app/container.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "483"
},
{
"name": "CSS",
"bytes": "5143"
},
{
"name": "JavaScript",
"bytes": "67800"
},
{
"name": "PHP",
"bytes": "211110"
}
]
}
|
package org.apache.commons.vfs2.provider.local;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileType;
/**
* A local file URI.
*
* @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
* @version $Revision$ $Date$
*/
public class WindowsFileName extends LocalFileName
{
protected WindowsFileName(final String scheme,
final String rootFile,
final String path,
final FileType type)
{
super(scheme, rootFile, path, type);
}
/**
* Factory method for creating name instances.
* @param path The file path.
* @param type The file type.
* @return The FileName.
*/
@Override
public FileName createName(final String path, FileType type)
{
return new WindowsFileName(getScheme(), getRootFile(), path, type);
}
/**
* Builds the root URI for this file name.
*/
@Override
protected void appendRootUri(final StringBuilder buffer, boolean addPassword)
{
buffer.append(getScheme());
buffer.append("://");
if (getRootFile() != null && !getRootFile().startsWith("/"))
{
// next is drive-letter (else unc name)
buffer.append("/");
}
buffer.append(getRootFile());
}
}
|
{
"content_hash": "19e964368b435275843506ae9c83f237",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 86,
"avg_line_length": 27.58,
"alnum_prop": 0.5888324873096447,
"repo_name": "easel/commons-vfs",
"id": "ebdfd5bb7742d6d0d3ccfebe1bf1513de2285c34",
"size": "2181",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1596898"
},
{
"name": "Shell",
"bytes": "2365"
}
]
}
|
// This file canonicalize reduction ops in hlo dialect to match the
// capacity of codegen backend.
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.h"
#include "mlir-hlo/Dialect/mhlo/transforms/PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
namespace mlir {
namespace mhlo {
namespace {
// All the reduce ops can be divided into following four types:
// - a) column reduction, only reduce the most significant dimensions.
// - b) row reduction, only reduce the least significant dimensions.
// - c) reduce to scalar, all dimensions are reduced.
// - d) others. (not support now, maybe use transpose to canonicalize)
//
// Currently we do following canonicalization to match the capacity of codegen
// backend.
//
// For case a):
// ====================================================================================
// we convert all column reduction to rank-2 column reduction.
// For example, suppose we have:
// ```
// func @test(%arg0: tensor<?x?x?xf32>) -> tensor<?x?xf32> {
// ...
// %2 = "mhlo.reduce"(%arg0, ...) ({...})
// {dimensions = dense<[0]> : tensor<1xi64>} :
// (tensor<?x?x?xf32>, tensor<f32>) -> tensor<?x?xf32>
// return %2 : tensor<?x?xf32>
// }
// ```
// After conversion:
// func @test(%arg0: tensor<?x?x?xf32>) -> tensor<?x?xf32> {
// // [a, b, c] -> [a, b*c]
// %1 = mhlo.dynamic_reshape(%arg0, ...) : (tensor<?x?x?xf32>,
// tensor<2xi64>) -> tensor<?x?xf32> %2 = "mhlo.reduce"(%1, ...) ({...})
// {dimensions = dense<[0]> : tensor<1xi64>} :
// (tensor<?x?xf32>, tensor<f32>) -> tensor<?xf32>
// %3 = "mhlo.dynamic_reshape"(%2, ...) : (tensor<?xf32>, tensor<1xi64>)
// -> tensor<?x?f32> return %3 : tensor<?x?xf32>
// }
// ```
//
// For case b):
// ====================================================================================
// we convert all row reduction to rank-2 row reduction.
// For example, suppose we have:
// ```
// func @test(%arg0: tensor<?x?x?xf32>) -> tensor<?x?xf32> {
// ...
// %2 = "mhlo.reduce"(%arg0, ...) ({...})
// {dimensions = dense<[2]> : tensor<1xi64>} :
// (tensor<?x?x?xf32>, tensor<f32>) -> tensor<?x?xf32>
// return %2 : tensor<?x?xf32>
// }
// ```
// After conversion:
// func @test(%arg0: tensor<?x?x?xf32>) -> tensor<?x?xf32> {
// // [a, b, c] -> [a*b, c]
// %1 = mhlo.dynamic_reshape(%arg0, ...) : (tensor<?x?x?xf32>,
// tensor<2xi64>) -> tensor<?x?xf32> %2 = "mhlo.reduce"(%1, ...) ({...})
// {dimensions = dense<[1]> : tensor<1xi64>} :
// (tensor<?x?xf32>, tensor<f32>) -> tensor<?xf32>
// %3 = "mhlo.dynamic_reshape"(%2, ...) : (tensor<?xf32>, tensor<1xi64>)
// -> tensor<?x?f32> return %3 : tensor<?x?xf32>
// }
// ```
//
// For case c):
// ====================================================================================
// we convert all reduce-to-scalar to rank-2 column reduction.
//
// For example, suppose we have:
// ```
// func @test(%arg0: tensor<?x?x?xf32>) -> tensor<f32> {
// ...
// %2 = "mhlo.reduce"(%arg0, ...) ({...})
// {dimensions = dense<[0,1,2]> : tensor<3xi64>} :
// (tensor<?x?x?xf32>, tensor<f32>) -> tensor<f32>
// return %2 : tensor<f32>
// }
// ```
// After conversion:
// func @test(%arg0: tensor<?x?x?xf32>) -> tensor<f32> {
// // [a, b, c] -> [a*b*c, 1]
// %1 = mhlo.dynamic_reshape(%arg0, ...) : (tensor<?x?x?xf32>,
// tensor<2xi64>) -> tensor<?x?xf32> %2 = "mhlo.reduce"(%1, ...) ({...})
// {dimensions = dense<[0]> : tensor<1xi64>} :
// (tensor<?x?xf32>, tensor<f32>) -> tensor<?xf32>
// %3 = "mhlo.reshape"(%2, ...) : (tensor<?xf32>, tensor<1xi64>) ->
// tensor<f32> return %3 : tensor<f32>
// }
// ```
struct HloCanonicalizeReductionPass
: HloCanonicalizeReductionPassBase<HloCanonicalizeReductionPass> {
void getDependentDialects(DialectRegistry& registry) const override {
registry.insert<tensor::TensorDialect>();
}
void runOnOperation() override {
getOperation().walk([&](ReduceOp op) {
SmallVector<int64_t, 4> dims_to_reduce;
DenseSet<int64_t> dims_to_reduce_set;
for (auto dim : op.dimensions().getValues<APInt>()) {
dims_to_reduce.push_back(dim.getSExtValue());
dims_to_reduce_set.insert(dims_to_reduce.back());
}
// empty reduction is just a no-op, thus no need to do codegen.
if (dims_to_reduce.empty()) return;
// suppose reduce input is a ranked tensor
auto ty = op.getOperand(0).getType().dyn_cast<RankedTensorType>();
if (!ty) return signalPassFailure();
int rank = ty.getRank();
int ndims_to_reduce = dims_to_reduce.size();
auto elem_ty = ty.getElementType();
llvm::sort(dims_to_reduce);
// skip case d) form since we don't support it.
if ((dims_to_reduce.back() - dims_to_reduce[0]) !=
(ndims_to_reduce - 1) ||
(dims_to_reduce[0] != 0 && dims_to_reduce.back() != (rank - 1))) {
return;
}
// rank 2 row/column reduction is already supported.
if (rank == 2 && ndims_to_reduce == 1) {
return;
}
SmallVector<int64_t, 4> dims_to_keep;
for (int i = 0; i < rank; ++i) {
if (!dims_to_reduce_set.count(i)) dims_to_keep.push_back(i);
}
OpBuilder b(op);
auto loc = op.getLoc();
// TODO(disc): uniformed shape_scalar_type with shape_derivation
auto shape_scalar_type = b.getIntegerType(32);
auto one = b.create<arith::ConstantIntOp>(loc, 1ll, shape_scalar_type);
// funtion to get total elements in selected dimensions
auto dim_prod = [&](ArrayRef<int64_t> dims) {
Value nelems = one;
for (int64_t v : dims) {
Value dim_index = b.create<tensor::DimOp>(loc, op.getOperand(0), v);
nelems = b.create<arith::MulIOp>(
loc, nelems,
b.create<arith::IndexCastOp>(loc, shape_scalar_type, dim_index));
}
return nelems;
};
SmallVector<Value, 2> new_operand_dims;
DenseIntElementsAttr attr;
Value nelem_to_reduce = dim_prod(dims_to_reduce);
Value nelem_to_keep = dim_prod(dims_to_keep);
if (rank == ndims_to_reduce) {
// case c) Reduce to scalar.
// Currently we don't support reduce to scalar directly.
// As a workaround, we convert the `reduce to scalar` to a rank 2
// column reduction having following form:
// Suppose nelems = ProdutionOp(ShapeOp(I)), We convert I into
// shape `[nelems, 1]`.
// TODO(disc): this may have performance issue. Implements a reduce to
// scalar schedule if necessary.
new_operand_dims.push_back(nelem_to_reduce);
new_operand_dims.push_back(nelem_to_keep);
attr = DenseIntElementsAttr::get(
RankedTensorType::get({1}, b.getIntegerType(64)), {0ll});
} else if (dims_to_reduce[0] == 0) {
// case a) column reduction
new_operand_dims.push_back(nelem_to_reduce);
new_operand_dims.push_back(nelem_to_keep);
attr = DenseIntElementsAttr::get(
RankedTensorType::get({1}, b.getIntegerType(64)), {0ll});
} else {
// case b) row reduction
new_operand_dims.push_back(nelem_to_keep);
new_operand_dims.push_back(nelem_to_reduce);
attr = DenseIntElementsAttr::get(
RankedTensorType::get({1}, b.getIntegerType(64)), {1ll});
}
Value new_operand_shape =
b.create<tensor::FromElementsOp>(loc, new_operand_dims);
SmallVector<Value, 4> new_operands;
for (Value operand : op.operands()) {
new_operands.push_back(b.create<DynamicReshapeOp>(
loc,
RankedTensorType::get(
SmallVector<int64_t, 4>(new_operand_dims.size(),
ShapedType::kDynamicSize),
elem_ty),
operand, new_operand_shape));
}
auto new_op =
b.create<ReduceOp>(loc, new_operands, op.init_values(), attr);
new_op.body().takeBody(op.body());
SmallVector<Value, 4> new_results;
if (dims_to_keep.empty()) {
// case c) reduce to scalar
// reshape rank 1 tensor with size 1 to a rank 0 tensor
for (Value result : new_op.getResults()) {
new_results.push_back(b.create<ReshapeOp>(
loc, RankedTensorType::get({}, elem_ty), result));
}
} else {
SmallVector<Value, 4> result_dims;
for (int64_t i : dims_to_keep) {
Value dim_index = b.create<tensor::DimOp>(loc, op.getOperand(0), i);
result_dims.push_back(
b.create<arith::IndexCastOp>(loc, shape_scalar_type, dim_index));
}
Value result_shape = b.create<tensor::FromElementsOp>(loc, result_dims);
for (auto&& e : llvm::zip(op.getResults(), new_op.getResults())) {
new_results.push_back(b.create<DynamicReshapeOp>(
loc, std::get<0>(e).getType(), std::get<1>(e), result_shape));
}
}
for (auto&& e : llvm::zip(op.getResults(), new_results)) {
std::get<0>(e).replaceAllUsesWith(std::get<1>(e));
}
op.erase();
});
}
};
} // namespace
std::unique_ptr<OperationPass<func::FuncOp>>
createHloCanonicalizeReductionPass() {
return std::make_unique<HloCanonicalizeReductionPass>();
}
} // namespace mhlo
} // namespace mlir
|
{
"content_hash": "4ecab0b718915c58e9a535a415d8e150",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 87,
"avg_line_length": 39.166666666666664,
"alnum_prop": 0.5538142189932538,
"repo_name": "gautam1858/tensorflow",
"id": "da53c2a21fcc4b0a493cdcb85928fe561a96db34",
"size": "10303",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/transforms/mhlo_canonicalize_reduction.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "47492"
},
{
"name": "C",
"bytes": "1129549"
},
{
"name": "C#",
"bytes": "13496"
},
{
"name": "C++",
"bytes": "116904214"
},
{
"name": "CMake",
"bytes": "165809"
},
{
"name": "Cython",
"bytes": "5003"
},
{
"name": "Dockerfile",
"bytes": "341994"
},
{
"name": "Go",
"bytes": "2052513"
},
{
"name": "HTML",
"bytes": "4686483"
},
{
"name": "Java",
"bytes": "1053827"
},
{
"name": "JavaScript",
"bytes": "5772"
},
{
"name": "Jupyter Notebook",
"bytes": "787371"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "MLIR",
"bytes": "9549263"
},
{
"name": "Makefile",
"bytes": "2760"
},
{
"name": "Objective-C",
"bytes": "180638"
},
{
"name": "Objective-C++",
"bytes": "295149"
},
{
"name": "Pawn",
"bytes": "5336"
},
{
"name": "Perl",
"bytes": "7536"
},
{
"name": "Python",
"bytes": "43775271"
},
{
"name": "Roff",
"bytes": "5034"
},
{
"name": "Ruby",
"bytes": "7854"
},
{
"name": "Shell",
"bytes": "566970"
},
{
"name": "Smarty",
"bytes": "89664"
},
{
"name": "SourcePawn",
"bytes": "8509"
},
{
"name": "Starlark",
"bytes": "6897556"
},
{
"name": "Swift",
"bytes": "78435"
},
{
"name": "Vim Snippet",
"bytes": "58"
}
]
}
|
package com.wandrell.tabletop.punkapocalyptic.procedure;
import java.util.Collection;
import com.wandrell.tabletop.interval.Interval;
import com.wandrell.tabletop.punkapocalyptic.model.availability.option.ArmorOption;
import com.wandrell.tabletop.punkapocalyptic.model.inventory.Equipment;
import com.wandrell.tabletop.punkapocalyptic.model.inventory.UnitWeapon;
import com.wandrell.tabletop.punkapocalyptic.model.inventory.WeaponEnhancement;
import com.wandrell.tabletop.punkapocalyptic.model.unit.mutation.Mutation;
public interface UnitConfigurationOptions {
public Interval getAllowedWeaponsInterval();
public Collection<ArmorOption> getArmorOptions();
public Collection<Equipment> getEquipmentOptions();
public Integer getMaxMutations();
public Collection<Mutation> getMutations();
public Collection<WeaponEnhancement> getWeaponEnhancements(
final UnitWeapon weapon);
public Collection<UnitWeapon> getWeaponOptions();
}
|
{
"content_hash": "bc20e6b5dfa31208eb7a6e9206bd5a82",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 83,
"avg_line_length": 33.6551724137931,
"alnum_prop": 0.8165983606557377,
"repo_name": "Bernardo-MG/Tabletop-Punkapocalyptic-Ruleset-API",
"id": "53411c1eaf12e8e24fe4fa3561f3d622d70f89e0",
"size": "976",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/main/java/com/wandrell/tabletop/punkapocalyptic/procedure/UnitConfigurationOptions.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "9200"
},
{
"name": "Shell",
"bytes": "2574"
}
]
}
|
package org.caleydo.view.pathway;
import org.caleydo.core.util.color.Color;
import org.caleydo.core.view.opengl.camera.ViewFrustum;
import org.caleydo.core.view.opengl.renderstyle.GeneralRenderStyle;
public class PathwayRenderStyle extends GeneralRenderStyle {
public static final int neighborhoodNodeColorArraysize = 4;
public static final int ENZYME_NODE_PIXEL_WIDTH = 46;
public static final int ENZYME_NODE_PIXEL_HEIGHT = 17;
public static final int COMPOUND_NODE_PIXEL_WIDTH = 8;
public static final int COMPOUND_NODE_PIXEL_HEIGHT = 8;
public static final float Z_OFFSET = 0.01f;
public static final Color ENZYME_NODE_COLOR = new Color(0.3f, 0.3f, 0.3f, 1);
public static final Color COMPOUND_NODE_COLOR = new Color(0.3f, 0.3f, 0.3f, 1);
public static final Color PATHWAY_NODE_COLOR = new Color(0.7f, 0.7f, 1f, 1);
public static final float[] PATH_COLOR = new float[] { 1, 1, 1, 0.0f };
public static final float[] STD_DEV_COLOR = new float[] { 49f / 255f, 163f / 255, 84f / 255, 1f };
public static final int STD_DEV_BAR_PIXEL_WIDTH = 6;
public static final int STD_DEV_BAR_PIXEL_HEIGHT = 6;
public enum NodeShape {
RECTANGULAR, ROUND, ROUNDRECTANGULAR
}
protected NodeShape enzymeNodeShape;
protected NodeShape compoundNodeShape;
protected NodeShape pathwayNodeShape;
public PathwayRenderStyle(ViewFrustum viewFrustum) {
super(viewFrustum);
init();
}
/**
* Constructor. Initializes the pathway render style. TODO: load pathway style from XML file.
*/
private void init() {
// TODO: use float[] constants for colors
enzymeNodeShape = NodeShape.RECTANGULAR;
compoundNodeShape = NodeShape.ROUND;
pathwayNodeShape = NodeShape.ROUNDRECTANGULAR;
}
public NodeShape getCompoundNodeShape() {
return compoundNodeShape;
}
public NodeShape getEnzymeNodeShape() {
return enzymeNodeShape;
}
public NodeShape getPathwayNodeShape() {
return pathwayNodeShape;
}
}
|
{
"content_hash": "79ccbb3bca804bd25821525af8f4ec16",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 99,
"avg_line_length": 28.36764705882353,
"alnum_prop": 0.7501296008294454,
"repo_name": "Caleydo/caleydo",
"id": "af0758807570478a5e7e13563ec4dd4044fbb07c",
"size": "2295",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "org.caleydo.view.pathway/src/org/caleydo/view/pathway/PathwayRenderStyle.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "2493"
},
{
"name": "GLSL",
"bytes": "2781"
},
{
"name": "HTML",
"bytes": "27930"
},
{
"name": "Java",
"bytes": "9111375"
},
{
"name": "JavaScript",
"bytes": "81257"
},
{
"name": "PHP",
"bytes": "546"
},
{
"name": "Python",
"bytes": "33906"
},
{
"name": "R",
"bytes": "5894"
},
{
"name": "Shell",
"bytes": "14669"
}
]
}
|
define([
"dojo/_base/declare",
"dojo/Stateful"
], function (declare, Stateful) {
/**
* @class jazzHands.query._Expression
* @interface
*/
return declare([Stateful], {
/**
* @param {jazzHands.query.DataRow} dataRow - single row to run the expression against
* @param {Object} execData - execution data to be used generating distinct values and doing query validation
* @return {RdfJs.Node} - the results of this expression
* @public
*/
resolve: function (execData, dataRow) {
}
});
});
|
{
"content_hash": "5deb80d803736372367ab1a9cbe1e8dd",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 117,
"avg_line_length": 28.095238095238095,
"alnum_prop": 0.5864406779661017,
"repo_name": "CosmicDynamo/jazzHands",
"id": "661c7b8598e9184d0b4c09479629254678ca84b3",
"size": "1781",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "query/_Expression.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "608278"
},
{
"name": "Ruby",
"bytes": "28544"
}
]
}
|
<?php
namespace Dende\PolmediaBundle\EventListener;
use Doctrine\ORM\Event\PostFlushEventArgs;
use Dende\PolmediaBundle\Entity\Video;
use Doctrine\ORM\EntityManager;
class UpdateOrders {
private $needsFlush = false;
/**
*
* @var EntityManager
*/
private $em;
private function assignOrders() {
$videos = $this->em->getRepository("PolmediaBundle:Video")->getAllVideos();
$order = $step = 10;
/** @var Video video */
foreach ($videos as $video) {
$video->setOrder($order);
$this->em->persist($video);
$order+=$step;
}
$this->needsFlush = true;
}
public function postFlush(PostFlushEventArgs $args) {
$this->em = $args->getEntityManager();
$this->assignOrders();
if ($this->needsFlush)
{
$this->needsFlush = false;
$args->getEntityManager()->flush();
}
}
}
|
{
"content_hash": "18ede237193b58038332d975dd9a5465",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 83,
"avg_line_length": 21.266666666666666,
"alnum_prop": 0.5663531870428422,
"repo_name": "uirapuru/polmedia.pl",
"id": "7d352bca08c5b7cf0934d4927af3a69a3643ccd3",
"size": "957",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Dende/PolmediaBundle/EventListener/_UpdateOrders.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "551165"
},
{
"name": "CoffeeScript",
"bytes": "2586"
},
{
"name": "JavaScript",
"bytes": "1907556"
},
{
"name": "PHP",
"bytes": "112251"
},
{
"name": "Ruby",
"bytes": "1330"
}
]
}
|
require 'spec_helper'
describe "article_agents_parts_search", type: :feature, dbscope: :example do
let(:site) { cms_site }
let(:layout) { create_cms_layout part }
let(:node) { create :cms_node, layout_id: layout.id, filename: "node" }
let(:part) { create :article_part_search, filename: "node/part" }
context "public" do
before do
Capybara.app_host = "http://#{site.domain}"
end
it "#index" do
visit node.url
expect(status_code).to eq 200
expect(page).to have_css(".article-search")
end
end
end
|
{
"content_hash": "7337e72da0f9f050ccf37a2d3cb31b4d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 76,
"avg_line_length": 27.8,
"alnum_prop": 0.6330935251798561,
"repo_name": "shirasagi/shirasagi",
"id": "6949f926be18fe2db9c740826401cb4d3d34b60b",
"size": "556",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "spec/features/article/agents/parts/search_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "82226"
},
{
"name": "HTML",
"bytes": "3237226"
},
{
"name": "JavaScript",
"bytes": "11966681"
},
{
"name": "Ruby",
"bytes": "12375064"
},
{
"name": "SCSS",
"bytes": "526557"
},
{
"name": "Shell",
"bytes": "20130"
}
]
}
|
#include <aws/elasticache/model/ReplicationGroupPendingModifiedValues.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace ElastiCache
{
namespace Model
{
ReplicationGroupPendingModifiedValues::ReplicationGroupPendingModifiedValues() :
m_primaryClusterIdHasBeenSet(false),
m_automaticFailoverStatusHasBeenSet(false)
{
}
ReplicationGroupPendingModifiedValues::ReplicationGroupPendingModifiedValues(const XmlNode& xmlNode) :
m_primaryClusterIdHasBeenSet(false),
m_automaticFailoverStatusHasBeenSet(false)
{
*this = xmlNode;
}
ReplicationGroupPendingModifiedValues& ReplicationGroupPendingModifiedValues::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode primaryClusterIdNode = resultNode.FirstChild("PrimaryClusterId");
if(!primaryClusterIdNode.IsNull())
{
m_primaryClusterId = StringUtils::Trim(primaryClusterIdNode.GetText().c_str());
m_primaryClusterIdHasBeenSet = true;
}
XmlNode automaticFailoverStatusNode = resultNode.FirstChild("AutomaticFailoverStatus");
if(!automaticFailoverStatusNode.IsNull())
{
m_automaticFailoverStatus = PendingAutomaticFailoverStatusMapper::GetPendingAutomaticFailoverStatusForName(StringUtils::Trim(automaticFailoverStatusNode.GetText().c_str()).c_str());
m_automaticFailoverStatusHasBeenSet = true;
}
}
return *this;
}
void ReplicationGroupPendingModifiedValues::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_primaryClusterIdHasBeenSet)
{
oStream << location << index << locationValue << ".PrimaryClusterId=" << StringUtils::URLEncode(m_primaryClusterId.c_str()) << "&";
}
if(m_automaticFailoverStatusHasBeenSet)
{
oStream << location << index << locationValue << ".AutomaticFailoverStatus=" << PendingAutomaticFailoverStatusMapper::GetNameForPendingAutomaticFailoverStatus(m_automaticFailoverStatus) << "&";
}
}
void ReplicationGroupPendingModifiedValues::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_primaryClusterIdHasBeenSet)
{
oStream << location << ".PrimaryClusterId=" << StringUtils::URLEncode(m_primaryClusterId.c_str()) << "&";
}
if(m_automaticFailoverStatusHasBeenSet)
{
oStream << location << ".AutomaticFailoverStatus=" << PendingAutomaticFailoverStatusMapper::GetNameForPendingAutomaticFailoverStatus(m_automaticFailoverStatus) << "&";
}
}
} // namespace Model
} // namespace ElastiCache
} // namespace Aws
|
{
"content_hash": "b9c53f07bc6581295d97810ce24182d0",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 199,
"avg_line_length": 33.13253012048193,
"alnum_prop": 0.7643636363636364,
"repo_name": "ambasta/aws-sdk-cpp",
"id": "555e1967b36c3c1a00b44800b6be39eeef29d4b7",
"size": "3323",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-elasticache/source/model/ReplicationGroupPendingModifiedValues.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2305"
},
{
"name": "C++",
"bytes": "74273816"
},
{
"name": "CMake",
"bytes": "412257"
},
{
"name": "Java",
"bytes": "229873"
},
{
"name": "Python",
"bytes": "62933"
}
]
}
|
package de.tudarmstadt.informatik.tk.assistance.sdk.provider.dao.sensing;
import de.tudarmstadt.informatik.tk.assistance.sdk.db.DbRunningProcessesSensor;
/**
* @author Wladimir Schmidt (wlsc.dev@gmail.com)
* @date 24.11.2015
*/
public interface RunningProcessesSensorDao extends CommonEventDao<DbRunningProcessesSensor> {
}
|
{
"content_hash": "bc5530fd7d1b6c5571252452ee7cd284",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 93,
"avg_line_length": 32.9,
"alnum_prop": 0.8085106382978723,
"repo_name": "Telecooperation/assistance-platform-client-sdk-android",
"id": "68c1555977195676a1492570e2365d686181e79e",
"size": "329",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AssistanceSDK/app/src/main/java/de/tudarmstadt/informatik/tk/assistance/sdk/provider/dao/sensing/RunningProcessesSensorDao.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1458250"
}
]
}
|
`Zend\InputFilter` allows configuration-driven creation of input filters via
`Zend\InputFilter\InputFilterAbstractServiceFactory`. This abstract factory is
responsible for creating and returning an appropriate input filter given named
configuration under the top-level configuration key `input_filter_specs`.
It is registered with `Zend\InputFilter\InputFilterPluginManager`, allowing you
to pull the input filter via that plugin manager. A side effect is that forms
pulled from `Zend\Form\FormElementManager` can use these named input filters.
## Setup
When using zend-mvc version 2 releases, this functionality is disabled by
default. To enable it, you must add the
`Zend\InputFilter\InputFilterAbstractServiceFactory` abstract factory to the
`Zend\InputFilter\InputFilterPluginManager` configuration, which is under the
`input_filters` configuration key.
```php
return [
'input_filters' => [
'abstract_factories' => [
'Zend\InputFilter\InputFilterAbstractServiceFactory',
],
],
];
```
For [Expressive](https://docs.zendframework.com/zend-expressive/) when using
the configuration manager, and for zend-mvc v3 releases, the functionality is
enabled by default, assuming you are using the
[component installer](https://docs.zendframework.com/zend-component-installer/).
## Example
In the following code, we define configuration for an input filter named `foobar`:
```php
return [
'input_filter_specs' => [
'foobar' => [
[
'name' => 'name',
'required' => true,
'filters' => [
[
'name' => 'Zend\Filter\StringTrim',
'options' => [],
],
],
'validators' => [],
'description' => 'Hello to name',
'allow_empty' => false,
'continue_if_empty' => false,
],
],
],
];
```
When creating a controller, we might then pull the `InputFilterManager`, and
retrieve the `foobar` input filter we've defined in order to inject it:
```php
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class MyValidatingControllerFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $controllers)
{
// Retrieve the application service manager
$services = $controllers->getServiceLocator();
// Retrieve the InputFilterManager
$filters = $services->get('InputFilterManager');
// Instantiate the controller and pass it the foobar input filter
return new MyValidatingController($filters->get('foobar'));
}
}
```
And you can use it as you already did with other input filters:
```php
$inputFilter->setData([
'name' => 'test',
]);
if (! $inputFilter->isValid()) {
echo 'Data invalid';
}
```
|
{
"content_hash": "7979dd6822ccc651011b7345433d0890",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 82,
"avg_line_length": 31.344086021505376,
"alnum_prop": 0.6631217838765009,
"repo_name": "zendframework/zend-inputfilter",
"id": "074f3bc6d9093027db4fb56bdc8b5fb0d487ed60",
"size": "2933",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/book/specs.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "325556"
}
]
}
|
namespace {
std::vector<GURL> GURLVectorFromStringList(
const base::Value::List& update_url_list) {
std::vector<GURL> ret;
ret.reserve(update_url_list.size());
for (const base::Value& url : update_url_list) {
CHECK(url.is_string()) << "Non-string Value in update URL list";
ret.push_back(GURL(url.GetString()));
}
return ret;
}
} // anonymous namespace
namespace updater {
ExternalConstantsOverrider::ExternalConstantsOverrider(
base::Value::Dict override_values,
scoped_refptr<ExternalConstants> next_provider)
: ExternalConstants(std::move(next_provider)),
override_values_(std::move(override_values)) {}
ExternalConstantsOverrider::~ExternalConstantsOverrider() = default;
std::vector<GURL> ExternalConstantsOverrider::UpdateURL() const {
if (!override_values_.contains(kDevOverrideKeyUrl)) {
return next_provider_->UpdateURL();
}
const base::Value* update_url_value =
override_values_.Find(kDevOverrideKeyUrl);
switch (update_url_value->type()) {
case base::Value::Type::STRING:
return {GURL(update_url_value->GetString())};
case base::Value::Type::LIST:
return GURLVectorFromStringList(update_url_value->GetList());
default:
LOG(FATAL) << "Unexpected type of override[" << kDevOverrideKeyUrl
<< "]: " << base::Value::GetTypeName(update_url_value->type());
NOTREACHED();
}
NOTREACHED();
return {};
}
bool ExternalConstantsOverrider::UseCUP() const {
if (!override_values_.contains(kDevOverrideKeyUseCUP)) {
return next_provider_->UseCUP();
}
const base::Value* use_cup_value =
override_values_.Find(kDevOverrideKeyUseCUP);
CHECK(use_cup_value->is_bool())
<< "Unexpected type of override[" << kDevOverrideKeyUseCUP
<< "]: " << base::Value::GetTypeName(use_cup_value->type());
return use_cup_value->GetBool();
}
double ExternalConstantsOverrider::InitialDelay() const {
if (!override_values_.contains(kDevOverrideKeyInitialDelay)) {
return next_provider_->InitialDelay();
}
const base::Value* initial_delay_value =
override_values_.Find(kDevOverrideKeyInitialDelay);
CHECK(initial_delay_value->is_double())
<< "Unexpected type of override[" << kDevOverrideKeyInitialDelay
<< "]: " << base::Value::GetTypeName(initial_delay_value->type());
return initial_delay_value->GetDouble();
}
int ExternalConstantsOverrider::ServerKeepAliveSeconds() const {
if (!override_values_.contains(kDevOverrideKeyServerKeepAliveSeconds)) {
return next_provider_->ServerKeepAliveSeconds();
}
const base::Value* server_keep_alive_seconds_value =
override_values_.Find(kDevOverrideKeyServerKeepAliveSeconds);
CHECK(server_keep_alive_seconds_value->is_int())
<< "Unexpected type of override[" << kDevOverrideKeyServerKeepAliveSeconds
<< "]: "
<< base::Value::GetTypeName(server_keep_alive_seconds_value->type());
return server_keep_alive_seconds_value->GetInt();
}
crx_file::VerifierFormat ExternalConstantsOverrider::CrxVerifierFormat() const {
if (!override_values_.contains(kDevOverrideKeyCrxVerifierFormat)) {
return next_provider_->CrxVerifierFormat();
}
const base::Value* crx_format_verifier_value =
override_values_.Find(kDevOverrideKeyCrxVerifierFormat);
CHECK(crx_format_verifier_value->is_int())
<< "Unexpected type of override[" << kDevOverrideKeyCrxVerifierFormat
<< "]: " << base::Value::GetTypeName(crx_format_verifier_value->type());
return static_cast<crx_file::VerifierFormat>(
crx_format_verifier_value->GetInt());
}
base::Value::Dict ExternalConstantsOverrider::GroupPolicies() const {
if (!override_values_.contains(kDevOverrideKeyGroupPolicies)) {
return next_provider_->GroupPolicies();
}
const base::Value* group_policies_value =
override_values_.Find(kDevOverrideKeyGroupPolicies);
CHECK(group_policies_value->is_dict())
<< "Unexpected type of override[" << kDevOverrideKeyGroupPolicies
<< "]: " << base::Value::GetTypeName(group_policies_value->type());
return group_policies_value->GetDict().Clone();
}
base::TimeDelta ExternalConstantsOverrider::OverinstallTimeout() const {
if (!override_values_.contains(kDevOverrideKeyOverinstallTimeout)) {
return next_provider_->OverinstallTimeout();
}
const base::Value* value =
override_values_.Find(kDevOverrideKeyOverinstallTimeout);
CHECK(value->is_int()) << "Unexpected type of override["
<< kDevOverrideKeyOverinstallTimeout
<< "]: " << base::Value::GetTypeName(value->type());
return base::Seconds(value->GetInt());
}
// static
scoped_refptr<ExternalConstantsOverrider>
ExternalConstantsOverrider::FromDefaultJSONFile(
scoped_refptr<ExternalConstants> next_provider) {
const absl::optional<base::FilePath> data_dir_path =
GetBaseDataDirectory(GetUpdaterScope());
if (!data_dir_path) {
LOG(ERROR) << "Cannot find app data path.";
return nullptr;
}
const base::FilePath override_file_path =
data_dir_path->AppendASCII(kDevOverrideFileName);
JSONFileValueDeserializer parser(override_file_path,
base::JSON_ALLOW_TRAILING_COMMAS);
int error_code = 0;
std::string error_message;
std::unique_ptr<base::Value> parsed_value(
parser.Deserialize(&error_code, &error_message));
if (error_code || !parsed_value) {
VLOG(2) << "Could not parse " << override_file_path << ": error "
<< error_code << ": " << error_message;
return nullptr;
}
if (!parsed_value->is_dict()) {
LOG(ERROR) << "Invalid data in " << override_file_path << ": not a dict";
return nullptr;
}
return base::MakeRefCounted<ExternalConstantsOverrider>(
std::move(parsed_value->GetDict()), next_provider);
}
// Declared in external_constants.h. This implementation of the function is
// used only if external_constants_override is linked into the binary.
scoped_refptr<ExternalConstants> CreateExternalConstants() {
scoped_refptr<ExternalConstants> overrider =
ExternalConstantsOverrider::FromDefaultJSONFile(
CreateDefaultExternalConstants());
return overrider ? overrider : CreateDefaultExternalConstants();
}
} // namespace updater
|
{
"content_hash": "65c71c69efd284831095e1a1e8b3276a",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 80,
"avg_line_length": 37.10059171597633,
"alnum_prop": 0.6982456140350877,
"repo_name": "nwjs/chromium.src",
"id": "9cd2e1e0665484d43c5f7da46c4e94795ed52e11",
"size": "7456",
"binary": false,
"copies": "1",
"ref": "refs/heads/nw70",
"path": "chrome/updater/external_constants_override.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": []
}
|
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "51553bc4a69c7cb18ae98748ccd187d6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "26084e5fee72a529ea43ce6e60070eb9e412cae7",
"size": "187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Solidago/Solidago ptarmicoides/ Syn. Eucephalus albus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
package com.khartec.waltz.model.physical_specification_definition;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.khartec.waltz.model.*;
import org.immutables.value.Value;
import java.util.Optional;
@Value.Immutable
@JsonSerialize(as = ImmutablePhysicalSpecDefinition.class)
@JsonDeserialize(as = ImmutablePhysicalSpecDefinition.class)
public abstract class PhysicalSpecDefinition implements
IdProvider,
CreatedProvider,
LastUpdatedProvider,
ProvenanceProvider {
public abstract long specificationId();
public abstract String version();
public abstract Optional<String> delimiter();
public abstract PhysicalSpecDefinitionType type();
public abstract ReleaseLifecycleStatus status();
}
|
{
"content_hash": "24679ed3222c50431212a6680d6cc118",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 66,
"avg_line_length": 31.037037037037038,
"alnum_prop": 0.7911694510739857,
"repo_name": "rovats/waltz",
"id": "93e7c860f52035c450dc07d5486296e0a5fc87d4",
"size": "1475",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "waltz-model/src/main/java/com/khartec/waltz/model/physical_specification_definition/PhysicalSpecDefinition.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "152506"
},
{
"name": "HTML",
"bytes": "1380564"
},
{
"name": "Java",
"bytes": "3436612"
},
{
"name": "JavaScript",
"bytes": "2233210"
},
{
"name": "Shell",
"bytes": "305"
}
]
}
|
import { Directive } from '@angular/core';
@Directive({
selector: '[zpHasRole]'
})
export class HasRoleDirective {
constructor() { }
}
|
{
"content_hash": "ea209f1e7d3c8d16bb2a5362fd5d37a3",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 42,
"avg_line_length": 14.2,
"alnum_prop": 0.6619718309859155,
"repo_name": "zetapush/angular-zetapush-starter",
"id": "9b37681a4668d7933952c05606bc5d18fda0a661",
"size": "142",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/role/has-role.directive.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3146"
},
{
"name": "HTML",
"bytes": "7335"
},
{
"name": "JavaScript",
"bytes": "1996"
},
{
"name": "Shell",
"bytes": "757"
},
{
"name": "TypeScript",
"bytes": "136023"
}
]
}
|
package jp.coppermine.neptunium.core.util;
public class CSVFormatException extends IllegalArgumentException {
/**
* Serial version UID of this class.
*/
private static final long serialVersionUID = 3469715507542889427L;
public CSVFormatException() {
super();
}
public CSVFormatException(String s) {
super(s);
}
}
|
{
"content_hash": "35e3fbfe311024bc98dd3511c02dbc03",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 18.5,
"alnum_prop": 0.6675675675675675,
"repo_name": "khasunuma/neptunium",
"id": "0d87eed1d8c839927a083959b6d1fbfdacc973ed",
"size": "1731",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "neptunium-core/src/main/java/jp/coppermine/neptunium/core/util/CSVFormatException.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Java",
"bytes": "350986"
}
]
}
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test.jmetal</groupId>
<artifactId>JMetalTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JMetalTest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.uma.jmetal</groupId>
<artifactId>jmetal-core</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.uma.jmetal</groupId>
<artifactId>jmetal-exec</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.uma.jmetal</groupId>
<artifactId>jmetal-algorithm</artifactId>
<version>5.1</version>
</dependency>
</dependencies>
</project>
|
{
"content_hash": "4be7b8cf6cc93175c4dd0a1ce102e496",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 104,
"avg_line_length": 29.163265306122447,
"alnum_prop": 0.6445066480055983,
"repo_name": "tarunchhabra26/fss16dst",
"id": "65d8940602796ad9ded2816175bd3b368782f8c8",
"size": "1429",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "project/JMetalTest/target/classes/META-INF/maven/test.jmetal/JMetalTest/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "404"
},
{
"name": "Java",
"bytes": "4314968"
},
{
"name": "Jupyter Notebook",
"bytes": "388314"
},
{
"name": "PostScript",
"bytes": "54774"
},
{
"name": "Python",
"bytes": "42476"
},
{
"name": "R",
"bytes": "117318"
},
{
"name": "Scheme",
"bytes": "545714"
},
{
"name": "TeX",
"bytes": "37409"
}
]
}
|
package gov.hhs.fha.nhinc.notify.nhin.proxy.service;
import gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor;
import org.oasis_open.docs.wsn.bw_2.NotificationConsumer;
/**
* @author akong
*
*/
public class NhinHiemNotifyServicePortDescriptor implements ServicePortDescriptor<NotificationConsumer> {
private static final String NAMESPACE_URI = "http://docs.oasis-open.org/wsn/bw-2";
private static final String SERVICE_LOCAL_PART = "NotificationConsumerService";
private static final String PORT_LOCAL_PART = "NotificationConsumerPort";
private static final String WSDL_FILE = "NhinSubscription.wsdl";
private static final String WS_ADDRESSING_ACTION = "http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer/Notify";
private String wsAddressingAction = WS_ADDRESSING_ACTION;
/*
* (non-Javadoc)
*
* @see gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor#getNamespaceUri()
*/
@Override
public String getNamespaceUri() {
return NAMESPACE_URI;
}
/*
* (non-Javadoc)
*
* @see gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor#getServiceLocalPart()
*/
@Override
public String getServiceLocalPart() {
return SERVICE_LOCAL_PART;
}
/*
* (non-Javadoc)
*
* @see gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor#getPortLocalPart()
*/
@Override
public String getPortLocalPart() {
return PORT_LOCAL_PART;
}
/*
* (non-Javadoc)
*
* @see gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor#getWSDLFileName()
*/
@Override
public String getWSDLFileName() {
return WSDL_FILE;
}
/*
* (non-Javadoc)
*
* @see gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor#getWSAddressingAction()
*/
@Override
public String getWSAddressingAction() {
return wsAddressingAction;
}
/**
* Sets the Ws-Addressing action associated with this port descriptor.
*
* @param action
*/
public void setWSAddressingAction(String action) {
wsAddressingAction = action;
}
/*
* (non-Javadoc)
*
* @see gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor#getPortClass()
*/
@Override
public Class<NotificationConsumer> getPortClass() {
return NotificationConsumer.class;
}
}
|
{
"content_hash": "d5188e71bdd7cc211288cb3d13577fd4",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 121,
"avg_line_length": 26.623655913978496,
"alnum_prop": 0.6668012924071083,
"repo_name": "alameluchidambaram/CONNECT",
"id": "6121af1a3191a4cedaded2a624ad72fc6e6b6082",
"size": "4168",
"binary": false,
"copies": "1",
"ref": "refs/heads/CONNECT_integration",
"path": "Product/Production/Services/HIEMCore/src/main/java/gov/hhs/fha/nhinc/notify/nhin/proxy/service/NhinHiemNotifyServicePortDescriptor.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "5539"
},
{
"name": "Groovy",
"bytes": "23395"
},
{
"name": "Java",
"bytes": "11595092"
},
{
"name": "Shell",
"bytes": "16812"
},
{
"name": "XSLT",
"bytes": "572555"
}
]
}
|
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='pyntrospection',
version='0.1.0',
description='Provides facility for runtime introspection in C++ program',
long_description=readme,
author='Mickael Camier',
author_email='mickael.camier@gmail.com',
url='https://github.com/mcamier/pyntrospection',
license=license,
packages=find_packages(exclude=('tests', 'docs'))
)
|
{
"content_hash": "dbc7e6870612e4618b712f127cdd61b8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 77,
"avg_line_length": 27,
"alnum_prop": 0.682261208576998,
"repo_name": "mcamier/pyntrospection",
"id": "a6def06526dadd037be1ecce3d83b901dae4b34a",
"size": "513",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "setup.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "21863"
},
{
"name": "CMake",
"bytes": "691"
},
{
"name": "Makefile",
"bytes": "62"
},
{
"name": "Mako",
"bytes": "1495"
},
{
"name": "Python",
"bytes": "11021"
}
]
}
|
YUI.add('node-core', function (Y, NAME) {
/**
* The Node Utility provides a DOM-like interface for interacting with DOM nodes.
* @module node
* @main node
* @submodule node-core
*/
/**
* The Node class provides a wrapper for manipulating DOM Nodes.
* Node properties can be accessed via the set/get methods.
* Use `Y.one()` to retrieve Node instances.
*
* <strong>NOTE:</strong> Node properties are accessed using
* the <code>set</code> and <code>get</code> methods.
*
* @class Node
* @constructor
* @param {DOMNode} node the DOM node to be mapped to the Node instance.
* @uses EventTarget
*/
// "globals"
var DOT = '.',
NODE_NAME = 'nodeName',
NODE_TYPE = 'nodeType',
OWNER_DOCUMENT = 'ownerDocument',
TAG_NAME = 'tagName',
UID = '_yuid',
EMPTY_OBJ = {},
_slice = Array.prototype.slice,
Y_DOM = Y.DOM,
Y_Node = function(node) {
if (!this.getDOMNode) { // support optional "new"
return new Y_Node(node);
}
if (typeof node == 'string') {
node = Y_Node._fromString(node);
if (!node) {
return null; // NOTE: return
}
}
var uid = (node.nodeType !== 9) ? node.uniqueID : node[UID];
if (uid && Y_Node._instances[uid] && Y_Node._instances[uid]._node !== node) {
node[UID] = null; // unset existing uid to prevent collision (via clone or hack)
}
uid = uid || Y.stamp(node);
if (!uid) { // stamp failed; likely IE non-HTMLElement
uid = Y.guid();
}
this[UID] = uid;
/**
* The underlying DOM node bound to the Y.Node instance
* @property _node
* @type DOMNode
* @private
*/
this._node = node;
this._stateProxy = node; // when augmented with Attribute
if (this._initPlugins) { // when augmented with Plugin.Host
this._initPlugins();
}
},
// used with previous/next/ancestor tests
_wrapFn = function(fn) {
var ret = null;
if (fn) {
ret = (typeof fn == 'string') ?
function(n) {
return Y.Selector.test(n, fn);
} :
function(n) {
return fn(Y.one(n));
};
}
return ret;
};
// end "globals"
Y_Node.ATTRS = {};
Y_Node.DOM_EVENTS = {};
Y_Node._fromString = function(node) {
if (node) {
if (node.indexOf('doc') === 0) { // doc OR document
node = Y.config.doc;
} else if (node.indexOf('win') === 0) { // win OR window
node = Y.config.win;
} else {
node = Y.Selector.query(node, null, true);
}
}
return node || null;
};
/**
* The name of the component
* @static
* @type String
* @property NAME
*/
Y_Node.NAME = 'node';
/*
* The pattern used to identify ARIA attributes
*/
Y_Node.re_aria = /^(?:role$|aria-)/;
Y_Node.SHOW_TRANSITION = 'fadeIn';
Y_Node.HIDE_TRANSITION = 'fadeOut';
/**
* A list of Node instances that have been created
* @private
* @type Object
* @property _instances
* @static
*
*/
Y_Node._instances = {};
/**
* Retrieves the DOM node bound to a Node instance
* @method getDOMNode
* @static
*
* @param {Node | HTMLNode} node The Node instance or an HTMLNode
* @return {HTMLNode} The DOM node bound to the Node instance. If a DOM node is passed
* as the node argument, it is simply returned.
*/
Y_Node.getDOMNode = function(node) {
if (node) {
return (node.nodeType) ? node : node._node || null;
}
return null;
};
/**
* Checks Node return values and wraps DOM Nodes as Y.Node instances
* and DOM Collections / Arrays as Y.NodeList instances.
* Other return values just pass thru. If undefined is returned (e.g. no return)
* then the Node instance is returned for chainability.
* @method scrubVal
* @static
*
* @param {any} node The Node instance or an HTMLNode
* @return {Node | NodeList | Any} Depends on what is returned from the DOM node.
*/
Y_Node.scrubVal = function(val, node) {
if (val) { // only truthy values are risky
if (typeof val == 'object' || typeof val == 'function') { // safari nodeList === function
if (NODE_TYPE in val || Y_DOM.isWindow(val)) {// node || window
val = Y.one(val);
} else if ((val.item && !val._nodes) || // dom collection or Node instance
(val[0] && val[0][NODE_TYPE])) { // array of DOM Nodes
val = Y.all(val);
}
}
} else if (typeof val === 'undefined') {
val = node; // for chaining
} else if (val === null) {
val = null; // IE: DOM null not the same as null
}
return val;
};
/**
* Adds methods to the Y.Node prototype, routing through scrubVal.
* @method addMethod
* @static
*
* @param {String} name The name of the method to add
* @param {Function} fn The function that becomes the method
* @param {Object} context An optional context to call the method with
* (defaults to the Node instance)
* @return {any} Depends on what is returned from the DOM node.
*/
Y_Node.addMethod = function(name, fn, context) {
if (name && fn && typeof fn == 'function') {
Y_Node.prototype[name] = function() {
var args = _slice.call(arguments),
node = this,
ret;
if (args[0] && args[0]._node) {
args[0] = args[0]._node;
}
if (args[1] && args[1]._node) {
args[1] = args[1]._node;
}
args.unshift(node._node);
ret = fn.apply(node, args);
if (ret) { // scrub truthy
ret = Y_Node.scrubVal(ret, node);
}
(typeof ret != 'undefined') || (ret = node);
return ret;
};
} else {
Y.log('unable to add method: ' + name, 'warn', 'Node');
}
};
/**
* Imports utility methods to be added as Y.Node methods.
* @method importMethod
* @static
*
* @param {Object} host The object that contains the method to import.
* @param {String} name The name of the method to import
* @param {String} altName An optional name to use in place of the host name
* @param {Object} context An optional context to call the method with
*/
Y_Node.importMethod = function(host, name, altName) {
if (typeof name == 'string') {
altName = altName || name;
Y_Node.addMethod(altName, host[name], host);
} else {
Y.Array.each(name, function(n) {
Y_Node.importMethod(host, n);
});
}
};
/**
* Retrieves a NodeList based on the given CSS selector.
* @method all
*
* @param {string} selector The CSS selector to test against.
* @return {NodeList} A NodeList instance for the matching HTMLCollection/Array.
* @for YUI
*/
/**
* Returns a single Node instance bound to the node or the
* first element matching the given selector. Returns null if no match found.
* <strong>Note:</strong> For chaining purposes you may want to
* use <code>Y.all</code>, which returns a NodeList when no match is found.
* @method one
* @param {String | HTMLElement} node a node or Selector
* @return {Node | null} a Node instance or null if no match found.
* @for YUI
*/
/**
* Returns a single Node instance bound to the node or the
* first element matching the given selector. Returns null if no match found.
* <strong>Note:</strong> For chaining purposes you may want to
* use <code>Y.all</code>, which returns a NodeList when no match is found.
* @method one
* @static
* @param {String | HTMLElement} node a node or Selector
* @return {Node | null} a Node instance or null if no match found.
* @for Node
*/
Y_Node.one = function(node) {
var instance = null,
cachedNode,
uid;
if (node) {
if (typeof node == 'string') {
node = Y_Node._fromString(node);
if (!node) {
return null; // NOTE: return
}
} else if (node.getDOMNode) {
return node; // NOTE: return
}
if (node.nodeType || Y.DOM.isWindow(node)) { // avoid bad input (numbers, boolean, etc)
uid = (node.uniqueID && node.nodeType !== 9) ? node.uniqueID : node._yuid;
instance = Y_Node._instances[uid]; // reuse exising instances
cachedNode = instance ? instance._node : null;
if (!instance || (cachedNode && node !== cachedNode)) { // new Node when nodes don't match
instance = new Y_Node(node);
if (node.nodeType != 11) { // dont cache document fragment
Y_Node._instances[instance[UID]] = instance; // cache node
}
}
}
}
return instance;
};
/**
* The default setter for DOM properties
* Called with instance context (this === the Node instance)
* @method DEFAULT_SETTER
* @static
* @param {String} name The attribute/property being set
* @param {any} val The value to be set
* @return {any} The value
*/
Y_Node.DEFAULT_SETTER = function(name, val) {
var node = this._stateProxy,
strPath;
if (name.indexOf(DOT) > -1) {
strPath = name;
name = name.split(DOT);
// only allow when defined on node
Y.Object.setValue(node, name, val);
} else if (typeof node[name] != 'undefined') { // pass thru DOM properties
node[name] = val;
}
return val;
};
/**
* The default getter for DOM properties
* Called with instance context (this === the Node instance)
* @method DEFAULT_GETTER
* @static
* @param {String} name The attribute/property to look up
* @return {any} The current value
*/
Y_Node.DEFAULT_GETTER = function(name) {
var node = this._stateProxy,
val;
if (name.indexOf && name.indexOf(DOT) > -1) {
val = Y.Object.getValue(node, name.split(DOT));
} else if (typeof node[name] != 'undefined') { // pass thru from DOM
val = node[name];
}
return val;
};
Y.mix(Y_Node.prototype, {
DATA_PREFIX: 'data-',
/**
* The method called when outputting Node instances as strings
* @method toString
* @return {String} A string representation of the Node instance
*/
toString: function() {
var str = this[UID] + ': not bound to a node',
node = this._node,
attrs, id, className;
if (node) {
attrs = node.attributes;
id = (attrs && attrs.id) ? node.getAttribute('id') : null;
className = (attrs && attrs.className) ? node.getAttribute('className') : null;
str = node[NODE_NAME];
if (id) {
str += '#' + id;
}
if (className) {
str += '.' + className.replace(' ', '.');
}
// TODO: add yuid?
str += ' ' + this[UID];
}
return str;
},
/**
* Returns an attribute value on the Node instance.
* Unless pre-configured (via `Node.ATTRS`), get hands
* off to the underlying DOM node. Only valid
* attributes/properties for the node will be queried.
* @method get
* @param {String} attr The attribute
* @return {any} The current value of the attribute
*/
get: function(attr) {
var val;
if (this._getAttr) { // use Attribute imple
val = this._getAttr(attr);
} else {
val = this._get(attr);
}
if (val) {
val = Y_Node.scrubVal(val, this);
} else if (val === null) {
val = null; // IE: DOM null is not true null (even though they ===)
}
return val;
},
/**
* Helper method for get.
* @method _get
* @private
* @param {String} attr The attribute
* @return {any} The current value of the attribute
*/
_get: function(attr) {
var attrConfig = Y_Node.ATTRS[attr],
val;
if (attrConfig && attrConfig.getter) {
val = attrConfig.getter.call(this);
} else if (Y_Node.re_aria.test(attr)) {
val = this._node.getAttribute(attr, 2);
} else {
val = Y_Node.DEFAULT_GETTER.apply(this, arguments);
}
return val;
},
/**
* Sets an attribute on the Node instance.
* Unless pre-configured (via Node.ATTRS), set hands
* off to the underlying DOM node. Only valid
* attributes/properties for the node will be set.
* To set custom attributes use setAttribute.
* @method set
* @param {String} attr The attribute to be set.
* @param {any} val The value to set the attribute to.
* @chainable
*/
set: function(attr, val) {
var attrConfig = Y_Node.ATTRS[attr];
if (this._setAttr) { // use Attribute imple
this._setAttr.apply(this, arguments);
} else { // use setters inline
if (attrConfig && attrConfig.setter) {
attrConfig.setter.call(this, val, attr);
} else if (Y_Node.re_aria.test(attr)) { // special case Aria
this._node.setAttribute(attr, val);
} else {
Y_Node.DEFAULT_SETTER.apply(this, arguments);
}
}
return this;
},
/**
* Sets multiple attributes.
* @method setAttrs
* @param {Object} attrMap an object of name/value pairs to set
* @chainable
*/
setAttrs: function(attrMap) {
if (this._setAttrs) { // use Attribute imple
this._setAttrs(attrMap);
} else { // use setters inline
Y.Object.each(attrMap, function(v, n) {
this.set(n, v);
}, this);
}
return this;
},
/**
* Returns an object containing the values for the requested attributes.
* @method getAttrs
* @param {Array} attrs an array of attributes to get values
* @return {Object} An object with attribute name/value pairs.
*/
getAttrs: function(attrs) {
var ret = {};
if (this._getAttrs) { // use Attribute imple
this._getAttrs(attrs);
} else { // use setters inline
Y.Array.each(attrs, function(v, n) {
ret[v] = this.get(v);
}, this);
}
return ret;
},
/**
* Compares nodes to determine if they match.
* Node instances can be compared to each other and/or HTMLElements.
* @method compareTo
* @param {HTMLElement | Node} refNode The reference node to compare to the node.
* @return {Boolean} True if the nodes match, false if they do not.
*/
compareTo: function(refNode) {
var node = this._node;
if (refNode && refNode._node) {
refNode = refNode._node;
}
return node === refNode;
},
/**
* Determines whether the node is appended to the document.
* @method inDoc
* @param {Node|HTMLElement} doc optional An optional document to check against.
* Defaults to current document.
* @return {Boolean} Whether or not this node is appended to the document.
*/
inDoc: function(doc) {
var node = this._node;
doc = (doc) ? doc._node || doc : node[OWNER_DOCUMENT];
if (doc.documentElement) {
return Y_DOM.contains(doc.documentElement, node);
}
},
getById: function(id) {
var node = this._node,
ret = Y_DOM.byId(id, node[OWNER_DOCUMENT]);
if (ret && Y_DOM.contains(node, ret)) {
ret = Y.one(ret);
} else {
ret = null;
}
return ret;
},
/**
* Returns the nearest ancestor that passes the test applied by supplied boolean method.
* @method ancestor
* @param {String | Function} fn A selector string or boolean method for testing elements.
* If a function is used, it receives the current node being tested as the only argument.
* If fn is not passed as an argument, the parent node will be returned.
* @param {Boolean} testSelf optional Whether or not to include the element in the scan
* @param {String | Function} stopFn optional A selector string or boolean
* method to indicate when the search should stop. The search bails when the function
* returns true or the selector matches.
* If a function is used, it receives the current node being tested as the only argument.
* @return {Node} The matching Node instance or null if not found
*/
ancestor: function(fn, testSelf, stopFn) {
// testSelf is optional, check for stopFn as 2nd arg
if (arguments.length === 2 &&
(typeof testSelf == 'string' || typeof testSelf == 'function')) {
stopFn = testSelf;
}
return Y.one(Y_DOM.ancestor(this._node, _wrapFn(fn), testSelf, _wrapFn(stopFn)));
},
/**
* Returns the ancestors that pass the test applied by supplied boolean method.
* @method ancestors
* @param {String | Function} fn A selector string or boolean method for testing elements.
* @param {Boolean} testSelf optional Whether or not to include the element in the scan
* If a function is used, it receives the current node being tested as the only argument.
* @return {NodeList} A NodeList instance containing the matching elements
*/
ancestors: function(fn, testSelf, stopFn) {
if (arguments.length === 2 &&
(typeof testSelf == 'string' || typeof testSelf == 'function')) {
stopFn = testSelf;
}
return Y.all(Y_DOM.ancestors(this._node, _wrapFn(fn), testSelf, _wrapFn(stopFn)));
},
/**
* Returns the previous matching sibling.
* Returns the nearest element node sibling if no method provided.
* @method previous
* @param {String | Function} fn A selector or boolean method for testing elements.
* If a function is used, it receives the current node being tested as the only argument.
* @return {Node} Node instance or null if not found
*/
previous: function(fn, all) {
return Y.one(Y_DOM.elementByAxis(this._node, 'previousSibling', _wrapFn(fn), all));
},
/**
* Returns the next matching sibling.
* Returns the nearest element node sibling if no method provided.
* @method next
* @param {String | Function} fn A selector or boolean method for testing elements.
* If a function is used, it receives the current node being tested as the only argument.
* @return {Node} Node instance or null if not found
*/
next: function(fn, all) {
return Y.one(Y_DOM.elementByAxis(this._node, 'nextSibling', _wrapFn(fn), all));
},
/**
* Returns all matching siblings.
* Returns all siblings if no method provided.
* @method siblings
* @param {String | Function} fn A selector or boolean method for testing elements.
* If a function is used, it receives the current node being tested as the only argument.
* @return {NodeList} NodeList instance bound to found siblings
*/
siblings: function(fn) {
return Y.all(Y_DOM.siblings(this._node, _wrapFn(fn)));
},
/**
* Retrieves a Node instance of nodes based on the given CSS selector.
* @method one
*
* @param {string} selector The CSS selector to test against.
* @return {Node} A Node instance for the matching HTMLElement.
*/
one: function(selector) {
return Y.one(Y.Selector.query(selector, this._node, true));
},
/**
* Retrieves a NodeList based on the given CSS selector.
* @method all
*
* @param {string} selector The CSS selector to test against.
* @return {NodeList} A NodeList instance for the matching HTMLCollection/Array.
*/
all: function(selector) {
var nodelist = Y.all(Y.Selector.query(selector, this._node));
nodelist._query = selector;
nodelist._queryRoot = this._node;
return nodelist;
},
// TODO: allow fn test
/**
* Test if the supplied node matches the supplied selector.
* @method test
*
* @param {string} selector The CSS selector to test against.
* @return {boolean} Whether or not the node matches the selector.
*/
test: function(selector) {
return Y.Selector.test(this._node, selector);
},
/**
* Removes the node from its parent.
* Shortcut for myNode.get('parentNode').removeChild(myNode);
* @method remove
* @param {Boolean} destroy whether or not to call destroy() on the node
* after removal.
* @chainable
*
*/
remove: function(destroy) {
var node = this._node;
if (node && node.parentNode) {
node.parentNode.removeChild(node);
}
if (destroy) {
this.destroy();
}
return this;
},
/**
* Replace the node with the other node. This is a DOM update only
* and does not change the node bound to the Node instance.
* Shortcut for myNode.get('parentNode').replaceChild(newNode, myNode);
* @method replace
* @param {Node | HTMLNode} newNode Node to be inserted
* @chainable
*
*/
replace: function(newNode) {
var node = this._node;
if (typeof newNode == 'string') {
newNode = Y_Node.create(newNode);
}
node.parentNode.replaceChild(Y_Node.getDOMNode(newNode), node);
return this;
},
/**
* @method replaceChild
* @for Node
* @param {String | HTMLElement | Node} node Node to be inserted
* @param {HTMLElement | Node} refNode Node to be replaced
* @return {Node} The replaced node
*/
replaceChild: function(node, refNode) {
if (typeof node == 'string') {
node = Y_DOM.create(node);
}
return Y.one(this._node.replaceChild(Y_Node.getDOMNode(node), Y_Node.getDOMNode(refNode)));
},
/**
* Nulls internal node references, removes any plugins and event listeners.
* Note that destroy() will not remove the node from its parent or from the DOM. For that
* functionality, call remove(true).
* @method destroy
* @param {Boolean} recursivePurge (optional) Whether or not to remove listeners from the
* node's subtree (default is false)
*
*/
destroy: function(recursive) {
var UID = Y.config.doc.uniqueID ? 'uniqueID' : '_yuid',
instance;
this.purge(); // TODO: only remove events add via this Node
if (this.unplug) { // may not be a PluginHost
this.unplug();
}
this.clearData();
if (recursive) {
Y.NodeList.each(this.all('*'), function(node) {
instance = Y_Node._instances[node[UID]];
if (instance) {
instance.destroy();
} else { // purge in case added by other means
Y.Event.purgeElement(node);
}
});
}
this._node = null;
this._stateProxy = null;
delete Y_Node._instances[this._yuid];
},
/**
* Invokes a method on the Node instance
* @method invoke
* @param {String} method The name of the method to invoke
* @param {Any} a, b, c, etc. Arguments to invoke the method with.
* @return Whatever the underly method returns.
* DOM Nodes and Collections return values
* are converted to Node/NodeList instances.
*
*/
invoke: function(method, a, b, c, d, e) {
var node = this._node,
ret;
if (a && a._node) {
a = a._node;
}
if (b && b._node) {
b = b._node;
}
ret = node[method](a, b, c, d, e);
return Y_Node.scrubVal(ret, this);
},
/**
* @method swap
* @description Swap DOM locations with the given node.
* This does not change which DOM node each Node instance refers to.
* @param {Node} otherNode The node to swap with
* @chainable
*/
swap: Y.config.doc.documentElement.swapNode ?
function(otherNode) {
this._node.swapNode(Y_Node.getDOMNode(otherNode));
} :
function(otherNode) {
otherNode = Y_Node.getDOMNode(otherNode);
var node = this._node,
parent = otherNode.parentNode,
nextSibling = otherNode.nextSibling;
if (nextSibling === node) {
parent.insertBefore(node, otherNode);
} else if (otherNode === node.nextSibling) {
parent.insertBefore(otherNode, node);
} else {
node.parentNode.replaceChild(otherNode, node);
Y_DOM.addHTML(parent, node, nextSibling);
}
return this;
},
hasMethod: function(method) {
var node = this._node;
return !!(node && method in node &&
typeof node[method] != 'unknown' &&
(typeof node[method] == 'function' ||
String(node[method]).indexOf('function') === 1)); // IE reports as object, prepends space
},
isFragment: function() {
return (this.get('nodeType') === 11);
},
/**
* Removes and destroys all of the nodes within the node.
* @method empty
* @chainable
*/
empty: function() {
this.get('childNodes').remove().destroy(true);
return this;
},
/**
* Returns the DOM node bound to the Node instance
* @method getDOMNode
* @return {DOMNode}
*/
getDOMNode: function() {
return this._node;
}
}, true);
Y.Node = Y_Node;
Y.one = Y_Node.one;
/**
* The NodeList module provides support for managing collections of Nodes.
* @module node
* @submodule node-core
*/
/**
* The NodeList class provides a wrapper for manipulating DOM NodeLists.
* NodeList properties can be accessed via the set/get methods.
* Use Y.all() to retrieve NodeList instances.
*
* @class NodeList
* @constructor
* @param nodes {String|element|Node|Array} A selector, DOM element, Node, list of DOM elements, or list of Nodes with which to populate this NodeList.
*/
var NodeList = function(nodes) {
var tmp = [];
if (nodes) {
if (typeof nodes === 'string') { // selector query
this._query = nodes;
nodes = Y.Selector.query(nodes);
} else if (nodes.nodeType || Y_DOM.isWindow(nodes)) { // domNode || window
nodes = [nodes];
} else if (nodes._node) { // Y.Node
nodes = [nodes._node];
} else if (nodes[0] && nodes[0]._node) { // allow array of Y.Nodes
Y.Array.each(nodes, function(node) {
if (node._node) {
tmp.push(node._node);
}
});
nodes = tmp;
} else { // array of domNodes or domNodeList (no mixed array of Y.Node/domNodes)
nodes = Y.Array(nodes, 0, true);
}
}
/**
* The underlying array of DOM nodes bound to the Y.NodeList instance
* @property _nodes
* @private
*/
this._nodes = nodes || [];
};
NodeList.NAME = 'NodeList';
/**
* Retrieves the DOM nodes bound to a NodeList instance
* @method getDOMNodes
* @static
*
* @param {NodeList} nodelist The NodeList instance
* @return {Array} The array of DOM nodes bound to the NodeList
*/
NodeList.getDOMNodes = function(nodelist) {
return (nodelist && nodelist._nodes) ? nodelist._nodes : nodelist;
};
NodeList.each = function(instance, fn, context) {
var nodes = instance._nodes;
if (nodes && nodes.length) {
Y.Array.each(nodes, fn, context || instance);
} else {
Y.log('no nodes bound to ' + this, 'warn', 'NodeList');
}
};
NodeList.addMethod = function(name, fn, context) {
if (name && fn) {
NodeList.prototype[name] = function() {
var ret = [],
args = arguments;
Y.Array.each(this._nodes, function(node) {
var UID = (node.uniqueID && node.nodeType !== 9 ) ? 'uniqueID' : '_yuid',
instance = Y.Node._instances[node[UID]],
ctx,
result;
if (!instance) {
instance = NodeList._getTempNode(node);
}
ctx = context || instance;
result = fn.apply(ctx, args);
if (result !== undefined && result !== instance) {
ret[ret.length] = result;
}
});
// TODO: remove tmp pointer
return ret.length ? ret : this;
};
} else {
Y.log('unable to add method: ' + name + ' to NodeList', 'warn', 'node');
}
};
NodeList.importMethod = function(host, name, altName) {
if (typeof name === 'string') {
altName = altName || name;
NodeList.addMethod(name, host[name]);
} else {
Y.Array.each(name, function(n) {
NodeList.importMethod(host, n);
});
}
};
NodeList._getTempNode = function(node) {
var tmp = NodeList._tempNode;
if (!tmp) {
tmp = Y.Node.create('<div></div>');
NodeList._tempNode = tmp;
}
tmp._node = node;
tmp._stateProxy = node;
return tmp;
};
Y.mix(NodeList.prototype, {
_invoke: function(method, args, getter) {
var ret = (getter) ? [] : this;
this.each(function(node) {
var val = node[method].apply(node, args);
if (getter) {
ret.push(val);
}
});
return ret;
},
/**
* Retrieves the Node instance at the given index.
* @method item
*
* @param {Number} index The index of the target Node.
* @return {Node} The Node instance at the given index.
*/
item: function(index) {
return Y.one((this._nodes || [])[index]);
},
/**
* Applies the given function to each Node in the NodeList.
* @method each
* @param {Function} fn The function to apply. It receives 3 arguments:
* the current node instance, the node's index, and the NodeList instance
* @param {Object} context optional An optional context to apply the function with
* Default context is the current Node instance
* @chainable
*/
each: function(fn, context) {
var instance = this;
Y.Array.each(this._nodes, function(node, index) {
node = Y.one(node);
return fn.call(context || node, node, index, instance);
});
return instance;
},
batch: function(fn, context) {
var nodelist = this;
Y.Array.each(this._nodes, function(node, index) {
var instance = Y.Node._instances[node[UID]];
if (!instance) {
instance = NodeList._getTempNode(node);
}
return fn.call(context || instance, instance, index, nodelist);
});
return nodelist;
},
/**
* Executes the function once for each node until a true value is returned.
* @method some
* @param {Function} fn The function to apply. It receives 3 arguments:
* the current node instance, the node's index, and the NodeList instance
* @param {Object} context optional An optional context to execute the function from.
* Default context is the current Node instance
* @return {Boolean} Whether or not the function returned true for any node.
*/
some: function(fn, context) {
var instance = this;
return Y.Array.some(this._nodes, function(node, index) {
node = Y.one(node);
context = context || node;
return fn.call(context, node, index, instance);
});
},
/**
* Creates a documenFragment from the nodes bound to the NodeList instance
* @method toFrag
* @return {Node} a Node instance bound to the documentFragment
*/
toFrag: function() {
return Y.one(Y.DOM._nl2frag(this._nodes));
},
/**
* Returns the index of the node in the NodeList instance
* or -1 if the node isn't found.
* @method indexOf
* @param {Node | DOMNode} node the node to search for
* @return {Int} the index of the node value or -1 if not found
*/
indexOf: function(node) {
return Y.Array.indexOf(this._nodes, Y.Node.getDOMNode(node));
},
/**
* Filters the NodeList instance down to only nodes matching the given selector.
* @method filter
* @param {String} selector The selector to filter against
* @return {NodeList} NodeList containing the updated collection
* @see Selector
*/
filter: function(selector) {
return Y.all(Y.Selector.filter(this._nodes, selector));
},
/**
* Creates a new NodeList containing all nodes at every n indices, where
* remainder n % index equals r.
* (zero-based index).
* @method modulus
* @param {Int} n The offset to use (return every nth node)
* @param {Int} r An optional remainder to use with the modulus operation (defaults to zero)
* @return {NodeList} NodeList containing the updated collection
*/
modulus: function(n, r) {
r = r || 0;
var nodes = [];
NodeList.each(this, function(node, i) {
if (i % n === r) {
nodes.push(node);
}
});
return Y.all(nodes);
},
/**
* Creates a new NodeList containing all nodes at odd indices
* (zero-based index).
* @method odd
* @return {NodeList} NodeList containing the updated collection
*/
odd: function() {
return this.modulus(2, 1);
},
/**
* Creates a new NodeList containing all nodes at even indices
* (zero-based index), including zero.
* @method even
* @return {NodeList} NodeList containing the updated collection
*/
even: function() {
return this.modulus(2);
},
destructor: function() {
},
/**
* Reruns the initial query, when created using a selector query
* @method refresh
* @chainable
*/
refresh: function() {
var doc,
nodes = this._nodes,
query = this._query,
root = this._queryRoot;
if (query) {
if (!root) {
if (nodes && nodes[0] && nodes[0].ownerDocument) {
root = nodes[0].ownerDocument;
}
}
this._nodes = Y.Selector.query(query, root);
}
return this;
},
/**
* Returns the current number of items in the NodeList.
* @method size
* @return {Int} The number of items in the NodeList.
*/
size: function() {
return this._nodes.length;
},
/**
* Determines if the instance is bound to any nodes
* @method isEmpty
* @return {Boolean} Whether or not the NodeList is bound to any nodes
*/
isEmpty: function() {
return this._nodes.length < 1;
},
toString: function() {
var str = '',
errorMsg = this[UID] + ': not bound to any nodes',
nodes = this._nodes,
node;
if (nodes && nodes[0]) {
node = nodes[0];
str += node[NODE_NAME];
if (node.id) {
str += '#' + node.id;
}
if (node.className) {
str += '.' + node.className.replace(' ', '.');
}
if (nodes.length > 1) {
str += '...[' + nodes.length + ' items]';
}
}
return str || errorMsg;
},
/**
* Returns the DOM node bound to the Node instance
* @method getDOMNodes
* @return {Array}
*/
getDOMNodes: function() {
return this._nodes;
}
}, true);
NodeList.importMethod(Y.Node.prototype, [
/**
* Called on each Node instance. Nulls internal node references,
* removes any plugins and event listeners
* @method destroy
* @param {Boolean} recursivePurge (optional) Whether or not to
* remove listeners from the node's subtree (default is false)
* @see Node.destroy
*/
'destroy',
/**
* Called on each Node instance. Removes and destroys all of the nodes
* within the node
* @method empty
* @chainable
* @see Node.empty
*/
'empty',
/**
* Called on each Node instance. Removes the node from its parent.
* Shortcut for myNode.get('parentNode').removeChild(myNode);
* @method remove
* @param {Boolean} destroy whether or not to call destroy() on the node
* after removal.
* @chainable
* @see Node.remove
*/
'remove',
/**
* Called on each Node instance. Sets an attribute on the Node instance.
* Unless pre-configured (via Node.ATTRS), set hands
* off to the underlying DOM node. Only valid
* attributes/properties for the node will be set.
* To set custom attributes use setAttribute.
* @method set
* @param {String} attr The attribute to be set.
* @param {any} val The value to set the attribute to.
* @chainable
* @see Node.set
*/
'set'
]);
// one-off implementation to convert array of Nodes to NodeList
// e.g. Y.all('input').get('parentNode');
/** Called on each Node instance
* @method get
* @see Node
*/
NodeList.prototype.get = function(attr) {
var ret = [],
nodes = this._nodes,
isNodeList = false,
getTemp = NodeList._getTempNode,
instance,
val;
if (nodes[0]) {
instance = Y.Node._instances[nodes[0]._yuid] || getTemp(nodes[0]);
val = instance._get(attr);
if (val && val.nodeType) {
isNodeList = true;
}
}
Y.Array.each(nodes, function(node) {
instance = Y.Node._instances[node._yuid];
if (!instance) {
instance = getTemp(node);
}
val = instance._get(attr);
if (!isNodeList) { // convert array of Nodes to NodeList
val = Y.Node.scrubVal(val, instance);
}
ret.push(val);
});
return (isNodeList) ? Y.all(ret) : ret;
};
Y.NodeList = NodeList;
Y.all = function(nodes) {
return new NodeList(nodes);
};
Y.Node.all = Y.all;
/**
* @module node
* @submodule node-core
*/
var Y_NodeList = Y.NodeList,
ArrayProto = Array.prototype,
ArrayMethods = {
/** Returns a new NodeList combining the given NodeList(s)
* @for NodeList
* @method concat
* @param {NodeList | Array} valueN Arrays/NodeLists and/or values to
* concatenate to the resulting NodeList
* @return {NodeList} A new NodeList comprised of this NodeList joined with the input.
*/
'concat': 1,
/** Removes the last from the NodeList and returns it.
* @for NodeList
* @method pop
* @return {Node} The last item in the NodeList.
*/
'pop': 0,
/** Adds the given Node(s) to the end of the NodeList.
* @for NodeList
* @method push
* @param {Node | DOMNode} nodes One or more nodes to add to the end of the NodeList.
*/
'push': 0,
/** Removes the first item from the NodeList and returns it.
* @for NodeList
* @method shift
* @return {Node} The first item in the NodeList.
*/
'shift': 0,
/** Returns a new NodeList comprising the Nodes in the given range.
* @for NodeList
* @method slice
* @param {Number} begin Zero-based index at which to begin extraction.
As a negative index, start indicates an offset from the end of the sequence. slice(-2) extracts the second-to-last element and the last element in the sequence.
* @param {Number} end Zero-based index at which to end extraction. slice extracts up to but not including end.
slice(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3).
As a negative index, end indicates an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence.
If end is omitted, slice extracts to the end of the sequence.
* @return {NodeList} A new NodeList comprised of this NodeList joined with the input.
*/
'slice': 1,
/** Changes the content of the NodeList, adding new elements while removing old elements.
* @for NodeList
* @method splice
* @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end.
* @param {Number} howMany An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed. In this case, you should specify at least one new element. If no howMany parameter is specified (second syntax above, which is a SpiderMonkey extension), all elements after index are removed.
* {Node | DOMNode| element1, ..., elementN
The elements to add to the array. If you don't specify any elements, splice simply removes elements from the array.
* @return {NodeList} The element(s) removed.
*/
'splice': 1,
/** Adds the given Node(s) to the beginning of the NodeList.
* @for NodeList
* @method unshift
* @param {Node | DOMNode} nodes One or more nodes to add to the NodeList.
*/
'unshift': 0
};
Y.Object.each(ArrayMethods, function(returnNodeList, name) {
Y_NodeList.prototype[name] = function() {
var args = [],
i = 0,
arg,
ret;
while (typeof (arg = arguments[i++]) != 'undefined') { // use DOM nodes/nodeLists
args.push(arg._node || arg._nodes || arg);
}
ret = ArrayProto[name].apply(this._nodes, args);
if (returnNodeList) {
ret = Y.all(ret);
} else {
ret = Y.Node.scrubVal(ret);
}
return ret;
};
});
/**
* @module node
* @submodule node-core
*/
Y.Array.each([
/**
* Passes through to DOM method.
* @for Node
* @method removeChild
* @param {HTMLElement | Node} node Node to be removed
* @return {Node} The removed node
*/
'removeChild',
/**
* Passes through to DOM method.
* @method hasChildNodes
* @return {Boolean} Whether or not the node has any childNodes
*/
'hasChildNodes',
/**
* Passes through to DOM method.
* @method cloneNode
* @param {Boolean} deep Whether or not to perform a deep clone, which includes
* subtree and attributes
* @return {Node} The clone
*/
'cloneNode',
/**
* Passes through to DOM method.
* @method hasAttribute
* @param {String} attribute The attribute to test for
* @return {Boolean} Whether or not the attribute is present
*/
'hasAttribute',
/**
* Passes through to DOM method.
* @method scrollIntoView
* @chainable
*/
'scrollIntoView',
/**
* Passes through to DOM method.
* @method getElementsByTagName
* @param {String} tagName The tagName to collect
* @return {NodeList} A NodeList representing the HTMLCollection
*/
'getElementsByTagName',
/**
* Passes through to DOM method.
* @method focus
* @chainable
*/
'focus',
/**
* Passes through to DOM method.
* @method blur
* @chainable
*/
'blur',
/**
* Passes through to DOM method.
* Only valid on FORM elements
* @method submit
* @chainable
*/
'submit',
/**
* Passes through to DOM method.
* Only valid on FORM elements
* @method reset
* @chainable
*/
'reset',
/**
* Passes through to DOM method.
* @method select
* @chainable
*/
'select',
/**
* Passes through to DOM method.
* Only valid on TABLE elements
* @method createCaption
* @chainable
*/
'createCaption'
], function(method) {
Y.log('adding: ' + method, 'info', 'node');
Y.Node.prototype[method] = function(arg1, arg2, arg3) {
var ret = this.invoke(method, arg1, arg2, arg3);
return ret;
};
});
/**
* Passes through to DOM method.
* @method removeAttribute
* @param {String} attribute The attribute to be removed
* @chainable
*/
// one-off implementation due to IE returning boolean, breaking chaining
Y.Node.prototype.removeAttribute = function(attr) {
var node = this._node;
if (node) {
node.removeAttribute(attr, 0); // comma zero for IE < 8 to force case-insensitive
}
return this;
};
Y.Node.importMethod(Y.DOM, [
/**
* Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.
* @method contains
* @param {Node | HTMLElement} needle The possible node or descendent
* @return {Boolean} Whether or not this node is the needle its ancestor
*/
'contains',
/**
* Allows setting attributes on DOM nodes, normalizing in some cases.
* This passes through to the DOM node, allowing for custom attributes.
* @method setAttribute
* @for Node
* @chainable
* @param {string} name The attribute name
* @param {string} value The value to set
*/
'setAttribute',
/**
* Allows getting attributes on DOM nodes, normalizing in some cases.
* This passes through to the DOM node, allowing for custom attributes.
* @method getAttribute
* @for Node
* @param {string} name The attribute name
* @return {string} The attribute value
*/
'getAttribute',
/**
* Wraps the given HTML around the node.
* @method wrap
* @param {String} html The markup to wrap around the node.
* @chainable
* @for Node
*/
'wrap',
/**
* Removes the node's parent node.
* @method unwrap
* @chainable
*/
'unwrap',
/**
* Applies a unique ID to the node if none exists
* @method generateID
* @return {String} The existing or generated ID
*/
'generateID'
]);
Y.NodeList.importMethod(Y.Node.prototype, [
/**
* Allows getting attributes on DOM nodes, normalizing in some cases.
* This passes through to the DOM node, allowing for custom attributes.
* @method getAttribute
* @see Node
* @for NodeList
* @param {string} name The attribute name
* @return {string} The attribute value
*/
'getAttribute',
/**
* Allows setting attributes on DOM nodes, normalizing in some cases.
* This passes through to the DOM node, allowing for custom attributes.
* @method setAttribute
* @see Node
* @for NodeList
* @chainable
* @param {string} name The attribute name
* @param {string} value The value to set
*/
'setAttribute',
/**
* Allows for removing attributes on DOM nodes.
* This passes through to the DOM node, allowing for custom attributes.
* @method removeAttribute
* @see Node
* @for NodeList
* @param {string} name The attribute to remove
*/
'removeAttribute',
/**
* Removes the parent node from node in the list.
* @method unwrap
* @chainable
*/
'unwrap',
/**
* Wraps the given HTML around each node.
* @method wrap
* @param {String} html The markup to wrap around the node.
* @chainable
*/
'wrap',
/**
* Applies a unique ID to each node if none exists
* @method generateID
* @return {String} The existing or generated ID
*/
'generateID'
]);
}, '3.7.3', {"requires": ["dom-core", "selector"]});
|
{
"content_hash": "7ec99c71feb205ce4c48a294434052bc",
"timestamp": "",
"source": "github",
"line_count": 1600,
"max_line_length": 335,
"avg_line_length": 29.955,
"alnum_prop": 0.5741320313804039,
"repo_name": "giros/alloy-ui",
"id": "3c4b24caa774052d26b9d6c3855ab850f357b4d7",
"size": "48095",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "build/node-core/node-core-debug.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "629833"
},
{
"name": "Java",
"bytes": "1365375"
},
{
"name": "JavaScript",
"bytes": "38813019"
},
{
"name": "PHP",
"bytes": "9242"
},
{
"name": "Shell",
"bytes": "7343"
}
]
}
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
// ========================================================================
// Copyright (c) Webtide LLC
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.apache.org/licenses/LICENSE-2.0.txt
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-sessions-parent</artifactId>
<version>7.4.3.v20110701</version>
</parent>
<artifactId>test-hash-sessions</artifactId>
<name>Jetty Tests :: Sessions :: Hash</name>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-sessions-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
|
{
"content_hash": "977c6947e70e99136fd0dcc3ba387b53",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 201,
"avg_line_length": 38.74242424242424,
"alnum_prop": 0.5612045365662887,
"repo_name": "wang88/jetty",
"id": "65ca541c5168bfaffb4595261537c830aba0573d",
"size": "2557",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test-sessions/test-hash-sessions/pom.xml",
"mode": "33261",
"license": "apache-2.0",
"language": []
}
|
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<changeSet author="evan" id="20150528-add-column-retry-num">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="secondary_manifest" columnName="retry_num"/>
</not>
</preConditions>
<addColumn tableName="secondary_manifest">
<column name="retry_num" type="BIGINT" defaultValueNumeric="0">
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
|
{
"content_hash": "1c2089d51d1271b9a120cc00e683da8a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 85,
"avg_line_length": 46.94117647058823,
"alnum_prop": 0.6215538847117794,
"repo_name": "socrata-platform/data-coordinator",
"id": "f87c2d008c0ddaec3d2b1595e6604038bb44af3a",
"size": "798",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "coordinatorlib/src/main/resources/com.socrata.datacoordinator.truth.schema/20150528-add-column-retry-num.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "868"
},
{
"name": "Java",
"bytes": "894"
},
{
"name": "Jinja",
"bytes": "1337"
},
{
"name": "PLpgSQL",
"bytes": "6864"
},
{
"name": "Scala",
"bytes": "1272442"
},
{
"name": "Shell",
"bytes": "6221"
}
]
}
|
<!doctype html>
<html>
<head>
<title>Values and Constants</title>
<style>
th {
background-color: #BEBEBE;
}
td {
width: 100px;
}
</style>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular-route.min.js"></script>
</head>
<body ng-app="myApp">
<div ng-view></div>
<script src="app.js"></script>
<script src="values.js"></script>
<script src="controllers.js"></script>
<script src="directives.js"></script>
<script src="services.js"></script>
</body>
</html>
|
{
"content_hash": "a74bf7db0daadeb81178b06172f48a16",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 97,
"avg_line_length": 26.916666666666668,
"alnum_prop": 0.6037151702786377,
"repo_name": "miroamarillo/AngularJS-Bits-and-Twists",
"id": "2ef1e8359946471937af8d67a0bcc234b8addd1e",
"size": "646",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "11_RESTFUL API and $http/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "0"
},
{
"name": "JavaScript",
"bytes": "39676"
}
]
}
|
using System;
using System.Windows.Forms;
using System.IO;
using DMS;
using System.Drawing.Imaging;
using System.Collections.Generic;
namespace DMS.Camera
{
public partial class frmCamera : Form
{
#region
public static WebCamera camera;
public static DeviceCapabilityInfo _DeviceCapabilityInfo;
public static DeviceInfo _DeviceInfo;
string photopath;
public static string ScanDocPath = cConfig.strWorkPath + "\\" + cConfig.strScanType;
//string ftpsource;
#endregion
public static List<DeviceInfo> ls1;
public frmCamera()
{
InitializeComponent();
camera = new WebCamera();
ls1 = new List<DeviceInfo>();
foreach (DeviceInfo info in camera.GetCameras())
{
ls1.Add(info);
}
camera.NewFrameEvent += new NewFrameEventHandler(camera_NewFrameEvent);
Control.CheckForIllegalCrossThreadCalls = false;
}
private void frmCamera_Load(object sender, EventArgs e)
{
while (cConfig.CameraIndex < 0 || cConfig.resolutionIndex < 0)
{
if (frmSetting.isClose)
{ break; }
using (frmSetting fs = new frmSetting())
{
fs.ShowDialog();
}
}
if (frmSetting.isClose)
{ this.Close(); return; }
ls2.Clear();
_DeviceCapabilityInfo = null;
_DeviceInfo = ls1[cConfig.CameraIndex];
foreach (DeviceCapabilityInfo info in camera.GetDeviceCapability(_DeviceInfo))
{
ls2.Add(info);
}
_DeviceCapabilityInfo = ls2[cConfig.resolutionIndex];
if (_DeviceInfo != null && _DeviceCapabilityInfo != null)
{
if (camera.StartVideo(_DeviceInfo, _DeviceCapabilityInfo))
{
btnphotograph.Enabled = true;
}
}
toolStripStatusLabel1.Text = "工作中......";
pictureBox2.Visible = false;
}
#region 拖动窗体
/// <summary>
/// 判断鼠标是否按下
/// </summary>
private bool _isDown = false;
/// <summary>
/// 原来的鼠标点
/// </summary>
private System.Drawing.Point _oldPoint;
/// <summary>
/// 原来窗口点
/// </summary>
private System.Drawing.Point _oldForm;
private void _MouseDown(object sender, MouseEventArgs e)
{
_isDown = true;
_oldPoint = new System.Drawing.Point();
_oldPoint = e.Location;
_oldForm = this.Location;
}
private void _MouseMove(object sender, MouseEventArgs e)
{
if (_isDown)
{
_oldForm.Offset(e.X - _oldPoint.X, e.Y - _oldPoint.Y);
this.Location = _oldForm;
}
}
private void _MouseUp(object sender, MouseEventArgs e)
{
_isDown = false;
}
#endregion
void camera_NewFrameEvent(object sender, EventArgs e)
{
pictureBox1.Image = camera.NewFrame;
}
public static List<DeviceCapabilityInfo> ls2 = new List<DeviceCapabilityInfo>();
//private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
//{
// comboBox2.Items.Clear();
// _DeviceCapabilityInfo = null;
// _DeviceInfo = (DeviceInfo)comboBox1.SelectedItem;
// foreach (DeviceCapabilityInfo info in camera.GetDeviceCapability(_DeviceInfo))
// {
// comboBox2.Items.Add(info);
// }
//}
//private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
//{
// _DeviceCapabilityInfo = (DeviceCapabilityInfo)comboBox2.SelectedItem;
//}
//private void btnreunion_Click(object sender, EventArgs e)
//{
// if (_DeviceInfo != null && _DeviceCapabilityInfo != null)
// {
// if (camera.StartVideo(_DeviceInfo, _DeviceCapabilityInfo))
// {
// btnphotograph.Enabled = true;
// }
// }
//}
public static bool shouldBeSave = false;
public static string name, note;
private void btnphotograph_Click(object sender, EventArgs e)
{
pictureBox2.Image = camera.NewFrame;
pictureBox2.Visible = true;
using (frmSave fs = new frmSave())
{ fs.ShowDialog(); }
if (shouldBeSave)
{
if (!Directory.Exists(ScanDocPath)) Directory.CreateDirectory(ScanDocPath);
pictureBox2.Image.Save(ScanDocPath + "\\" + name + ".jpg", ImageFormat.Jpeg);
photopath = ScanDocPath + "\\" + name + ".jpg";
cAccess.add(name, "", photopath, cConfig.strScanType, DateTime.Now.ToString(), Environment.UserName, note);
frmMain.fm.initialize();
toolStripStatusLabel1.Text = "照片已储存";
shouldBeSave = false;
}
pictureBox2.Image = null;
pictureBox2.Visible = false;
}
private void frmCamera_FormClosing(object sender, FormClosingEventArgs e)
{
if (pictureBox2.Image != null && toolStripStatusLabel1.Text != "照片已储存")
{
if (MessageBox.Show("照片未保存,确定要退出吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
this.Dispose();
}
else
e.Cancel = true;
}
}
private void button1_Click(object sender, EventArgs e)
{
using (frmSetting fs = new frmSetting())
{
fs.ShowDialog();
}
}
private void btnMax_Click(object sender, EventArgs e)
{
if (this.WindowState != FormWindowState.Normal)
{
this.WindowState = FormWindowState.Normal;
}
else
{
this.WindowState = FormWindowState.Maximized;
}
}
private void btnMin_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void Camera_FormClosed(object sender, FormClosedEventArgs e)
{
if (camera.DeviceExist)
{
if (camera.CloseVideo())
btnphotograph.Enabled = false;
}
if (camera.DeviceExist)
camera.CloseVideo();
this.Dispose();
}
}
}
|
{
"content_hash": "4e8493450a8161a461a749a633badf90",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 131,
"avg_line_length": 29.0875,
"alnum_prop": 0.5185503509525856,
"repo_name": "NaturalWill/DMS",
"id": "470dd8042ba0d27d81a2dc9c4d0d2d36456ce27c",
"size": "7085",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DMS/Camera/frmCamera.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "207783"
}
]
}
|
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "a717782d9db08d0d2d4ab5b7d76a7011",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "13d71827437ad3506e62e9e3bb319cbca9351af2",
"size": "188",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Phyllanthaceae/Phyllanthus/Phyllanthus unioensis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/trace_event/cfi_backtrace_android.h"
#include <sys/mman.h>
#include <sys/types.h>
#include "base/android/apk_assets.h"
#include "base/android/library_loader/anchor_functions.h"
#if !defined(ARCH_CPU_ARMEL)
#error This file should not be built for this architecture.
#endif
/*
Basics of unwinding:
For each instruction in a function we need to know what is the offset of SP
(Stack Pointer) to reach the previous function's stack frame. To know which
function is being invoked, we need the return address of the next function. The
CFI information for an instruction is made up of 2 offsets, CFA (Call Frame
Address) offset and RA (Return Address) offset. The CFA offset is the change in
SP made by the function till the current instruction. This depends on amount of
memory allocated on stack by the function plus some registers that the function
stores that needs to be restored at the end of function. So, at each instruction
the CFA offset tells the offset from original SP before the function call. The
RA offset tells us the offset from the previous SP into the current function
where the return address is stored.
The unwind table file has 2 tables UNW_INDEX and UNW_DATA, inspired from ARM
EHABI format. The first table contains function addresses and an index into the
UNW_DATA table. The second table contains one or more rows for the function
unwind information.
UNW_INDEX contains two columns of N rows each, where N is the number of
functions.
1. First column 4 byte rows of all the function start address as offset from
start of the binary, in sorted order.
2. For each function addr, the second column contains 2 byte indices in order.
The indices are offsets (in count of 2 bytes) of the CFI data from start of
UNW_DATA.
The last entry in the table always contains CANT_UNWIND index to specify the
end address of the last function.
UNW_DATA contains data of all the functions. Each function data contains N rows.
The data found at the address pointed from UNW_INDEX will be:
2 bytes: N - number of rows that belong to current function.
N * 4 bytes: N rows of data. 16 bits : Address offset from function start.
14 bits : CFA offset / 4.
2 bits : RA offset / 4.
If the RA offset of a row is 0, then use the offset of the previous rows in the
same function.
TODO(ssid): Make sure RA offset is always present.
See extract_unwind_tables.py for details about how this data is extracted from
breakpad symbol files.
*/
extern "C" {
// The address of |__executable_start| gives the start address of the
// executable or shared library. This value is used to find the offset address
// of the instruction in binary from PC.
extern char __executable_start;
}
namespace base {
namespace trace_event {
namespace {
// The value of index when the function does not have unwind information.
constexpr uint32_t kCantUnwind = 0xFFFF;
// The mask on the CFI row data that is used to get the high 14 bits and
// multiply it by 4 to get CFA offset. Since the last 2 bits are masked out, a
// shift is not necessary.
constexpr uint16_t kCFAMask = 0xfffc;
// The mask on the CFI row data that is used to get the low 2 bits and multiply
// it by 4 to get the RA offset.
constexpr uint16_t kRAMask = 0x3;
constexpr uint16_t kRAShift = 2;
// The code in this file assumes we are running in 32-bit builds since all the
// addresses in the unwind table are specified in 32 bits.
static_assert(sizeof(uintptr_t) == 4,
"The unwind table format is only valid for 32 bit builds.");
// The CFI data in UNW_DATA table starts with number of rows (N) and then
// followed by N rows of 4 bytes long. The CFIUnwindDataRow represents a single
// row of CFI data of a function in the table. Since we cast the memory at the
// address after the address of number of rows, into an array of
// CFIUnwindDataRow, the size of the struct should be 4 bytes and the order of
// the members is fixed according to the given format. The first 2 bytes tell
// the address of function and last 2 bytes give the CFI data for the offset.
struct CFIUnwindDataRow {
// The address of the instruction in terms of offset from the start of the
// function.
uint16_t addr_offset;
// Represents the CFA and RA offsets to get information about next stack
// frame. This is the CFI data at the point before executing the instruction
// at |addr_offset| from the start of the function.
uint16_t cfi_data;
// Return the RA offset for the current unwind row.
size_t ra_offset() const { return (cfi_data & kRAMask) << kRAShift; }
// Returns the CFA offset for the current unwind row.
size_t cfa_offset() const { return cfi_data & kCFAMask; }
};
static_assert(
sizeof(CFIUnwindDataRow) == 4,
"The CFIUnwindDataRow struct must be exactly 4 bytes for searching.");
} // namespace
// static
CFIBacktraceAndroid* CFIBacktraceAndroid::GetInitializedInstance() {
static CFIBacktraceAndroid* instance = new CFIBacktraceAndroid();
return instance;
}
// static
bool CFIBacktraceAndroid::is_chrome_address(uintptr_t pc) {
return pc >= base::android::kStartOfText && pc < executable_end_addr();
}
// static
uintptr_t CFIBacktraceAndroid::executable_start_addr() {
return reinterpret_cast<uintptr_t>(&__executable_start);
}
// static
uintptr_t CFIBacktraceAndroid::executable_end_addr() {
return base::android::kEndOfText;
}
CFIBacktraceAndroid::CFIBacktraceAndroid()
: thread_local_cfi_cache_(
[](void* ptr) { delete static_cast<CFICache*>(ptr); }) {
Initialize();
}
CFIBacktraceAndroid::~CFIBacktraceAndroid() {}
void CFIBacktraceAndroid::Initialize() {
// This file name is defined by extract_unwind_tables.gni.
static constexpr char kCfiFileName[] = "assets/unwind_cfi_32";
MemoryMappedFile::Region cfi_region;
int fd = base::android::OpenApkAsset(kCfiFileName, &cfi_region);
if (fd < 0)
return;
cfi_mmap_ = std::make_unique<MemoryMappedFile>();
// The CFI region starts at |cfi_region.offset|.
if (!cfi_mmap_->Initialize(base::File(fd), cfi_region))
return;
ParseCFITables();
can_unwind_stack_frames_ = true;
}
void CFIBacktraceAndroid::ParseCFITables() {
// The first 4 bytes in the file is the number of entries in UNW_INDEX table.
size_t unw_index_size = 0;
memcpy(&unw_index_size, cfi_mmap_->data(), sizeof(unw_index_size));
// UNW_INDEX table starts after 4 bytes.
unw_index_function_col_ =
reinterpret_cast<const uintptr_t*>(cfi_mmap_->data()) + 1;
unw_index_row_count_ = unw_index_size;
unw_index_indices_col_ = reinterpret_cast<const uint16_t*>(
unw_index_function_col_ + unw_index_row_count_);
// The UNW_DATA table data is right after the end of UNW_INDEX table.
// Interpret the UNW_DATA table as an array of 2 byte numbers since the
// indexes we have from the UNW_INDEX table are in terms of 2 bytes.
unw_data_start_addr_ = unw_index_indices_col_ + unw_index_row_count_;
}
size_t CFIBacktraceAndroid::Unwind(const void** out_trace, size_t max_depth) {
// This function walks the stack using the call frame information to find the
// return addresses of all the functions that belong to current binary in call
// stack. For each function the CFI table defines the offset of the previous
// call frame and offset where the return address is stored.
if (!can_unwind_stack_frames())
return 0;
// Get the current register state. This register state can be taken at any
// point in the function and the unwind information would be for this point.
// Define local variables before trying to get the current PC and SP to make
// sure the register state obtained is consistent with each other.
uintptr_t pc = 0, sp = 0;
asm volatile("mov %0, pc" : "=r"(pc));
asm volatile("mov %0, sp" : "=r"(sp));
return Unwind(pc, sp, /*lr=*/0, out_trace, max_depth);
}
size_t CFIBacktraceAndroid::Unwind(uintptr_t pc,
uintptr_t sp,
uintptr_t lr,
const void** out_trace,
size_t max_depth) {
if (!can_unwind_stack_frames())
return 0;
// We can only unwind as long as the pc is within the chrome.so.
size_t depth = 0;
while (is_chrome_address(pc) && depth < max_depth) {
out_trace[depth++] = reinterpret_cast<void*>(pc);
// The offset of function from the start of the chrome.so binary:
uintptr_t func_addr = pc - executable_start_addr();
CFIRow cfi{};
if (!FindCFIRowForPC(func_addr, &cfi)) {
if (depth == 1 && lr != 0 && pc != lr) {
// If CFI data is not found for the frame, then we stopped in prolog of
// a function. The return address is stored in LR when in function
// prolog. So, update the PC with address in LR and do not update SP
// since SP was not updated by the prolog yet.
// TODO(ssid): Write tests / add info to detect if we are actually in
// function prolog. https://crbug.com/898276
pc = lr;
continue;
}
break;
}
// The rules for unwinding using the CFI information are:
// SP_prev = SP_cur + cfa_offset and
// PC_prev = * (SP_prev - ra_offset).
sp = sp + cfi.cfa_offset;
memcpy(&pc, reinterpret_cast<uintptr_t*>(sp - cfi.ra_offset),
sizeof(uintptr_t));
}
return depth;
}
void CFIBacktraceAndroid::AllocateCacheForCurrentThread() {
GetThreadLocalCFICache();
}
bool CFIBacktraceAndroid::FindCFIRowForPC(uintptr_t func_addr,
CFIBacktraceAndroid::CFIRow* cfi) {
if (!can_unwind_stack_frames())
return false;
auto* cache = GetThreadLocalCFICache();
*cfi = {0};
if (cache->Find(func_addr, cfi))
return true;
// Consider each column of UNW_INDEX table as arrays of uintptr_t (function
// addresses) and uint16_t (indices). Define start and end iterator on the
// first column array (addresses) and use std::lower_bound() to binary search
// on this array to find the required function address.
static const uintptr_t* const unw_index_fn_end =
unw_index_function_col_ + unw_index_row_count_;
const uintptr_t* found =
std::lower_bound(unw_index_function_col_, unw_index_fn_end, func_addr);
// If found is start, then the given function is not in the table. If the
// given pc is start of a function then we cannot unwind.
if (found == unw_index_function_col_ || *found == func_addr)
return false;
// std::lower_bound() returns the iter that corresponds to the first address
// that is greater than the given address. So, the required iter is always one
// less than the value returned by std::lower_bound().
--found;
uintptr_t func_start_addr = *found;
size_t row_num = found - unw_index_function_col_;
uint16_t index = unw_index_indices_col_[row_num];
DCHECK_LE(func_start_addr, func_addr);
// If the index is CANT_UNWIND then we do not have unwind infomation for the
// function.
if (index == kCantUnwind)
return false;
// The unwind data for the current function is at an offsset of the index
// found in UNW_INDEX table.
const uint16_t* unwind_data = unw_data_start_addr_ + index;
// The value of first 2 bytes is the CFI data row count for the function.
uint16_t row_count = 0;
memcpy(&row_count, unwind_data, sizeof(row_count));
// And the actual CFI rows start after 2 bytes from the |unwind_data|. Cast
// the data into an array of CFIUnwindDataRow since the struct is designed to
// represent each row. We should be careful to read only |row_count| number of
// elements in the array.
const CFIUnwindDataRow* function_data =
reinterpret_cast<const CFIUnwindDataRow*>(unwind_data + 1);
// Iterate through the CFI rows of the function to find the row that gives
// offset for the given instruction address.
CFIUnwindDataRow cfi_row = {0, 0};
uint16_t ra_offset = 0;
for (uint16_t i = 0; i < row_count; ++i) {
CFIUnwindDataRow row;
memcpy(&row, function_data + i, sizeof(CFIUnwindDataRow));
// The return address of the function is the instruction that is not yet
// been executed. The cfi row specifies the unwind info before executing the
// given instruction. If the given address is equal to the instruction
// offset, then use the current row. Or use the row with highest address
// less than the given address.
if (row.addr_offset + func_start_addr > func_addr)
break;
cfi_row = row;
// The ra offset of the last specified row should be used, if unspecified.
// So, keep updating the RA offset till we reach the correct CFI row.
// TODO(ssid): This should be fixed in the format and we should always
// output ra offset.
if (cfi_row.ra_offset())
ra_offset = cfi_row.ra_offset();
}
DCHECK_NE(0u, cfi_row.addr_offset);
*cfi = {cfi_row.cfa_offset(), ra_offset};
DCHECK(cfi->cfa_offset);
DCHECK(cfi->ra_offset);
// safe to update since the cache is thread local.
cache->Add(func_addr, *cfi);
return true;
}
CFIBacktraceAndroid::CFICache* CFIBacktraceAndroid::GetThreadLocalCFICache() {
auto* cache = static_cast<CFICache*>(thread_local_cfi_cache_.Get());
if (!cache) {
cache = new CFICache();
thread_local_cfi_cache_.Set(cache);
}
return cache;
}
void CFIBacktraceAndroid::CFICache::Add(uintptr_t address, CFIRow cfi) {
cache_[address % kLimit] = {address, cfi};
}
bool CFIBacktraceAndroid::CFICache::Find(uintptr_t address, CFIRow* cfi) {
if (cache_[address % kLimit].address == address) {
*cfi = cache_[address % kLimit].cfi;
return true;
}
return false;
}
} // namespace trace_event
} // namespace base
|
{
"content_hash": "ebc385c379756938a5ad2646223c07b4",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 80,
"avg_line_length": 39.72571428571428,
"alnum_prop": 0.6977848101265823,
"repo_name": "endlessm/chromium-browser",
"id": "593c55505813424d4841f7f9d7db9ce8a7024822",
"size": "13904",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "base/trace_event/cfi_backtrace_android.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": []
}
|
package cmd
import (
boshtpl "github.com/cloudfoundry/bosh-init/director/template"
boshui "github.com/cloudfoundry/bosh-init/ui"
)
type DeleteCmd struct {
ui boshui.UI
envProvider func(string, boshtpl.Variables) DeploymentDeleter
}
func NewDeleteCmd(ui boshui.UI, envProvider func(string, boshtpl.Variables) DeploymentDeleter) *DeleteCmd {
return &DeleteCmd{ui: ui, envProvider: envProvider}
}
func (c *DeleteCmd) Run(stage boshui.Stage, opts DeleteEnvOpts) error {
c.ui.BeginLinef("Deployment manifest: '%s'\n", opts.Args.Manifest.Path)
depDeleter := c.envProvider(opts.Args.Manifest.Path, opts.VarFlags.AsVariables())
return depDeleter.DeleteDeployment(stage)
}
|
{
"content_hash": "3807cec03172d9acbe6568b8a989d791",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 107,
"avg_line_length": 29.869565217391305,
"alnum_prop": 0.7685589519650655,
"repo_name": "forrestsill/bosh-init",
"id": "4cdae230833ae5ab3fc9631ea64deb0aeff67cab",
"size": "687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cmd/delete_cmd.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "2758972"
},
{
"name": "Ruby",
"bytes": "974"
},
{
"name": "Shell",
"bytes": "18137"
}
]
}
|
seosuite-dashboard-ui
=====================
A front end for the seo dashboard.
|
{
"content_hash": "9f4b33d2ffcf29677d6106586296ad9c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 34,
"avg_line_length": 20,
"alnum_prop": 0.575,
"repo_name": "saymedia/seosuite-dashboard-ui",
"id": "e8048b38ecfad43b02a2b5919f92e69c90a766da",
"size": "80",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5876"
},
{
"name": "JavaScript",
"bytes": "32797"
},
{
"name": "PHP",
"bytes": "809"
},
{
"name": "Perl",
"bytes": "24183"
},
{
"name": "Scala",
"bytes": "631"
},
{
"name": "Shell",
"bytes": "8"
}
]
}
|
FROM test:latest
RUN yum install -y screen
|
{
"content_hash": "e8a1d6f398b551c7e354e7350a5734ac",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 25,
"avg_line_length": 14.666666666666666,
"alnum_prop": 0.7727272727272727,
"repo_name": "peitur/docker-util",
"id": "44b5fe89275480ef060f21c0491480220a3bff81",
"size": "44",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "44"
},
{
"name": "Python",
"bytes": "108539"
},
{
"name": "Shell",
"bytes": "2925"
}
]
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Messaging.ServiceBus.Amqp;
using Azure.Messaging.ServiceBus.Authorization;
using Microsoft.Azure.Amqp;
using Microsoft.Azure.Amqp.Transport;
using Moq;
using Moq.Protected;
using NUnit.Framework;
namespace Azure.Messaging.ServiceBus.Tests
{
/// <summary>
/// The suite of tests for the <see cref="AmqpConnectionScope" />
/// class.
/// </summary>
///
[TestFixture]
public class AmqpConnectionScopeTests
{
/// <summary>
/// Verifies functionality of the <see cref="AmqpConnectionScope.CalculateLinkAuthorizationRefreshInterval" />
/// method.
/// </summary>
///
[Test]
public void CalculateLinkAuthorizationRefreshIntervalRespectsTheRefreshBuffer()
{
var credential = new Mock<ServiceBusTokenCredential>(Mock.Of<TokenCredential>());
var endpoint = new Uri("sb://mine.hubs.com");
var mockScope = new MockConnectionScope(endpoint, endpoint, credential.Object, ServiceBusTransportType.AmqpTcp, null);
var currentTime = new DateTime(2015, 10, 27, 00, 00, 00);
var expireTime = currentTime.AddHours(1);
var buffer = GetAuthorizationRefreshBuffer();
var jitterBuffer = TimeSpan.FromSeconds(GetAuthorizationBaseJitterSeconds()).Add(TimeSpan.FromSeconds(5));
var calculatedRefresh = mockScope.InvokeCalculateLinkAuthorizationRefreshInterval(expireTime, currentTime);
var calculatedExpire = currentTime.Add(calculatedRefresh);
Assert.That(calculatedExpire, Is.LessThan(expireTime), "The refresh should be account for the buffer and be earlier than expiration.");
Assert.That(calculatedExpire, Is.EqualTo(expireTime.Subtract(buffer)).Within(jitterBuffer), "The authorization buffer should have been used for buffering.");
}
/// <summary>
/// Verifies functionality of the <see cref="AmqpConnectionScope.CalculateLinkAuthorizationRefreshInterval" />
/// method.
/// </summary>
///
[Test]
public void CalculateLinkAuthorizationRefreshIntervalRespectsTheMinimumDuration()
{
var credential = new Mock<ServiceBusTokenCredential>(Mock.Of<TokenCredential>());
var endpoint = new Uri("sb://mine.hubs.com");
var mockScope = new MockConnectionScope(endpoint, endpoint, credential.Object, ServiceBusTransportType.AmqpTcp, null);
var currentTime = new DateTime(2015, 10, 27, 00, 00, 00);
var jitterBuffer = TimeSpan.FromSeconds(GetAuthorizationBaseJitterSeconds()).Add(TimeSpan.FromSeconds(5));
var minimumRefresh = GetMinimumAuthorizationRefresh();
var expireTime = currentTime.Add(minimumRefresh.Subtract(TimeSpan.FromMilliseconds(500)));
var calculatedRefresh = mockScope.InvokeCalculateLinkAuthorizationRefreshInterval(expireTime, currentTime);
Assert.That(calculatedRefresh, Is.GreaterThanOrEqualTo(minimumRefresh), "The minimum refresh duration should be violated.");
Assert.That(calculatedRefresh, Is.EqualTo(minimumRefresh).Within(jitterBuffer), "The minimum refresh duration should have been used.");
}
/// <summary>
/// Verifies functionality of the <see cref="AmqpConnectionScope.CalculateLinkAuthorizationRefreshInterval" />
/// method.
/// </summary>
///
[Test]
public void CalculateLinkAuthorizationRefreshIntervalRespectsTheMaximumDuration()
{
var credential = new Mock<ServiceBusTokenCredential>(Mock.Of<TokenCredential>());
var endpoint = new Uri("sb://mine.hubs.com");
var mockScope = new MockConnectionScope(endpoint, endpoint, credential.Object, ServiceBusTransportType.AmqpTcp, null);
var currentTime = new DateTime(2015, 10, 27, 00, 00, 00);
var refreshBuffer = GetAuthorizationRefreshBuffer();
var jitterBuffer = TimeSpan.FromSeconds(GetAuthorizationBaseJitterSeconds()).Add(TimeSpan.FromSeconds(5));
var maximumRefresh = GetMaximumAuthorizationRefresh();
var expireTime = currentTime.Add(maximumRefresh.Add(refreshBuffer).Add(TimeSpan.FromMilliseconds(500)));
var calculatedRefresh = mockScope.InvokeCalculateLinkAuthorizationRefreshInterval(expireTime, currentTime);
Assert.That(calculatedRefresh, Is.LessThanOrEqualTo(maximumRefresh), "The maximum refresh duration should not be exceeded.");
Assert.That(calculatedRefresh, Is.EqualTo(maximumRefresh).Within(jitterBuffer), "The maximum refresh duration should have been used.");
}
/// <summary>
/// Verifies functionality of the <see cref="AmqpConnectionScope.OpenAmqpObjectAsync" />
/// method.
/// </summary>
///
[Test]
[TestCase(typeof(InvalidOperationException))]
[TestCase(typeof(ObjectDisposedException))]
public async Task OpenAmqpObjectAsyncTranslatesInvalidStateExceptions(Type exceptionType)
{
var observedException = default(Exception);
var openException = (Exception)Activator.CreateInstance(exceptionType, "stringArg");
var endpoint = new Uri("amqp://test.service.gov");
var transport = ServiceBusTransportType.AmqpTcp;
var mockCredential = new Mock<TokenCredential>();
var mockServiceBusCredential = new Mock<ServiceBusTokenCredential>(mockCredential.Object);
var mockScope = new MockConnectionScope(endpoint, endpoint, mockServiceBusCredential.Object, transport, null);
mockScope.MockConnection
.Protected()
.Setup("OpenInternal")
.Throws(openException)
.Verifiable();
try
{
await mockScope.InvokeOpenAmqpObjectAsync(mockScope.MockConnection.Object, TimeSpan.FromMinutes(5));
}
catch (Exception ex)
{
observedException = ex;
}
Assert.That(observedException, Is.Not.Null, "An exception should have been observed.");
Assert.That(observedException, Is.TypeOf<ServiceBusException>(), "The exception should have been translated.");
Assert.That(((ServiceBusException)observedException).IsTransient, Is.True, "The exception should be transient.");
mockScope.MockConnection.VerifyAll();
}
/// <summary>
/// Verifies functionality of the <see cref="AmqpConnectionScope.OpenSenderLinkAsync(string, string, TimeSpan, CancellationToken)" />
/// method.
/// </summary>
///
[Test]
public async Task OpenLinkAssociatesSendLinkSource()
{
var credential = new Mock<ServiceBusTokenCredential>(Mock.Of<TokenCredential>());
var endpoint = new Uri("amqp://mine.hubs.com");
var linkIdentifier = "MyAmqpConnectionScope";
var mockConnection = new AmqpConnection(new MockTransport(), CreateMockAmqpSettings(), new AmqpConnectionSettings());
var cancellationSource = new CancellationTokenSource();
var mockSession = new AmqpSession(mockConnection, new AmqpSessionSettings(), Mock.Of<ILinkFactory>());
var mockScope = new Mock<AmqpConnectionScope>(endpoint, endpoint, credential.Object, ServiceBusTransportType.AmqpTcp, null, false, default, default)
{
CallBase = true,
};
mockScope
.Protected()
.Setup<Task<AmqpConnection>>("CreateAndOpenConnectionAsync",
ItExpr.IsAny<Version>(),
ItExpr.IsAny<Uri>(),
ItExpr.IsAny<Uri>(),
ItExpr.IsAny<ServiceBusTransportType>(),
ItExpr.IsAny<IWebProxy>(),
ItExpr.IsAny<string>(),
ItExpr.IsAny<TimeSpan>(),
ItExpr.IsAny<ServiceBusTransportMetrics>())
.Returns(Task.FromResult(mockConnection))
.Verifiable();
mockScope
.Protected()
.Setup<Task<DateTime>>("RequestAuthorizationUsingCbsAsync",
ItExpr.IsAny<AmqpConnection>(),
ItExpr.IsAny<CbsTokenProvider>(),
ItExpr.IsAny<Uri>(),
ItExpr.IsAny<string[]>(),
ItExpr.IsAny<string[]>(),
ItExpr.IsAny<TimeSpan>(),
ItExpr.IsAny<string>())
.Returns(Task.FromResult(DateTime.UtcNow.AddDays(1)))
.Verifiable();
mockScope
.Protected()
.Setup<Task>("OpenAmqpObjectAsync",
ItExpr.IsAny<AmqpObject>(),
ItExpr.IsAny<TimeSpan>())
.Returns(Task.CompletedTask)
.Verifiable();
mockScope
.Protected()
.Setup<Task>("OpenAmqpLinkAsync",
ItExpr.IsAny<SendingAmqpLink>(),
ItExpr.IsAny<string>(),
ItExpr.IsAny<CancellationToken>())
.Returns(Task.CompletedTask)
.Verifiable();
var link = await mockScope.Object.OpenSenderLinkAsync("fake/path", linkIdentifier, TimeSpan.FromDays(1), cancellationSource.Token);
Assert.That(link, Is.Not.Null, "The link produced was null");
Assert.That(link.Settings.Source.ToString(), Contains.Substring(linkIdentifier));
}
/// <summary>
/// Verifies functionality of the <see cref="AmqpConnectionScope.OpenReceiverLinkAsync(string, string, TimeSpan, uint, ServiceBusReceiveMode, string, bool, CancellationToken)" />
/// method.
/// </summary>
///
[Test]
public async Task OpenLinkAssociatesReceiveLinkTarget()
{
var credential = new Mock<ServiceBusTokenCredential>(Mock.Of<TokenCredential>());
var endpoint = new Uri("amqp://mine.hubs.com");
var linkIdentifier = "MyAmqpConnectionScope";
var mockConnection = new AmqpConnection(new MockTransport(), CreateMockAmqpSettings(), new AmqpConnectionSettings());
var cancellationSource = new CancellationTokenSource();
var mockSession = new AmqpSession(mockConnection, new AmqpSessionSettings(), Mock.Of<ILinkFactory>());
var mockScope = new Mock<AmqpConnectionScope>(endpoint, endpoint, credential.Object, ServiceBusTransportType.AmqpTcp, null, false, default, default)
{
CallBase = true,
};
mockScope
.Protected()
.Setup<Task<AmqpConnection>>("CreateAndOpenConnectionAsync",
ItExpr.IsAny<Version>(),
ItExpr.IsAny<Uri>(),
ItExpr.IsAny<Uri>(),
ItExpr.IsAny<ServiceBusTransportType>(),
ItExpr.IsAny<IWebProxy>(),
ItExpr.IsAny<string>(),
ItExpr.IsAny<TimeSpan>(),
ItExpr.IsAny<ServiceBusTransportMetrics>())
.Returns(Task.FromResult(mockConnection))
.Verifiable();
mockScope
.Protected()
.Setup<Task<DateTime>>("RequestAuthorizationUsingCbsAsync",
ItExpr.IsAny<AmqpConnection>(),
ItExpr.IsAny<CbsTokenProvider>(),
ItExpr.IsAny<Uri>(),
ItExpr.IsAny<string[]>(),
ItExpr.IsAny<string[]>(),
ItExpr.IsAny<TimeSpan>(),
ItExpr.IsAny<string>())
.Returns(Task.FromResult(DateTime.UtcNow.AddDays(1)))
.Verifiable();
mockScope
.Protected()
.Setup<Task>("OpenAmqpObjectAsync",
ItExpr.IsAny<AmqpObject>(),
ItExpr.IsAny<TimeSpan>())
.Returns(Task.CompletedTask)
.Verifiable();
mockScope
.Protected()
.Setup<Task>("OpenAmqpLinkAsync",
ItExpr.IsAny<ReceivingAmqpLink>(),
ItExpr.IsAny<string>(),
ItExpr.IsAny<CancellationToken>())
.Returns(Task.CompletedTask)
.Verifiable();
var link = await mockScope.Object.OpenReceiverLinkAsync(linkIdentifier, "fake/path", TimeSpan.FromDays(1), 100, ServiceBusReceiveMode.ReceiveAndDelete, "0", false, cancellationSource.Token);
Assert.That(link, Is.Not.Null, "The link produced was null");
Assert.That(link.Settings.Target.ToString(), Contains.Substring(linkIdentifier));
}
/// <summary>
/// Gets the token refresh buffer for the scope, using the
/// private property accessor.
/// </summary>
///
private static TimeSpan GetAuthorizationRefreshBuffer() =>
(TimeSpan)
typeof(AmqpConnectionScope)
.GetProperty("AuthorizationRefreshBuffer", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetProperty)
.GetValue(null);
/// <summary>
/// Gets the minimum authorization refresh interval, using the
/// private property accessor.
/// </summary>
///
private static TimeSpan GetMinimumAuthorizationRefresh() =>
(TimeSpan)
typeof(AmqpConnectionScope)
.GetProperty("MinimumAuthorizationRefresh", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetProperty)
.GetValue(null);
/// <summary>
/// Gets the maximum authorization refresh interval, using the
/// private property accessor.
/// </summary>
///
private static TimeSpan GetMaximumAuthorizationRefresh() =>
(TimeSpan)
typeof(AmqpConnectionScope)
.GetProperty("MaximumAuthorizationRefresh", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetProperty)
.GetValue(null);
/// <summary>
/// Gets the base time used to calculate random jitter for refreshing authorization,
/// using the private accessor.
/// </summary>
///
private static int GetAuthorizationBaseJitterSeconds() =>
(int)
typeof(AmqpConnectionScope)
.GetProperty("AuthorizationBaseJitterSeconds", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetProperty)
.GetValue(null);
/// <summary>
/// Creates a set of dummy settings for testing purposes.
/// </summary>
///
private static AmqpSettings CreateMockAmqpSettings()
{
var transportProvider = new AmqpTransportProvider();
transportProvider.Versions.Add(new AmqpVersion(new Version(1, 0, 0, 0)));
var amqpSettings = new AmqpSettings();
amqpSettings.TransportProviders.Add(transportProvider);
return amqpSettings;
}
/// <summary>
/// Provides a dummy transport for testing purposes.
/// </summary>
///
private class MockTransport : TransportBase
{
public MockTransport() : base("Mock") { }
public override string LocalEndPoint { get; }
public override string RemoteEndPoint { get; }
public override bool ReadAsync(TransportAsyncCallbackArgs args) => throw new NotImplementedException();
public override void SetMonitor(ITransportMonitor usageMeter) => throw new NotImplementedException();
public override bool WriteAsync(TransportAsyncCallbackArgs args) => throw new NotImplementedException();
protected override void AbortInternal() => throw new NotImplementedException();
protected override bool CloseInternal() => throw new NotImplementedException();
}
/// <summary>
/// Provides a mock to use with a mocked connection.
/// </summary>
///
private class MockConnectionScope : AmqpConnectionScope
{
public readonly Mock<AmqpConnection> MockConnection;
public MockConnectionScope(
Uri serviceEndpoint,
Uri customConnectionEndpoint,
ServiceBusTokenCredential credential,
ServiceBusTransportType transport,
IWebProxy proxy) : base(serviceEndpoint, customConnectionEndpoint, credential, transport, proxy, false, default, default)
{
MockConnection = new Mock<AmqpConnection>(new MockTransport(), CreateMockAmqpSettings(), new AmqpConnectionSettings());
}
public Task InvokeOpenAmqpObjectAsync(
AmqpObject target,
TimeSpan timeout) =>
base.OpenAmqpObjectAsync(target, timeout);
public TimeSpan InvokeCalculateLinkAuthorizationRefreshInterval(
DateTime expirationTimeUtc,
DateTime currentTimeUtc) => base.CalculateLinkAuthorizationRefreshInterval(expirationTimeUtc, currentTimeUtc);
protected override Task<AmqpConnection> CreateAndOpenConnectionAsync(Version amqpVersion,
Uri serviceEndpoint,
Uri connectionEndpoint,
ServiceBusTransportType transportType,
IWebProxy proxy,
string scopeIdentifier,
TimeSpan timeout,
ServiceBusTransportMetrics metrics)
{
return Task.FromResult(MockConnection.Object);
}
}
}
}
|
{
"content_hash": "81f8f2805f656899b3cb340ccfb034da",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 202,
"avg_line_length": 48.14987080103359,
"alnum_prop": 0.5996028764623806,
"repo_name": "Azure/azure-sdk-for-net",
"id": "5eaae65ea8fa79f769047567d763d92f1eaef389",
"size": "18636",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/servicebus/Azure.Messaging.ServiceBus/tests/Amqp/AmqpConnectionScopeTests.cs",
"mode": "33188",
"license": "mit",
"language": []
}
|
* Remove trailing slashes from ruby directories when iterating over `RUBIES`.
(@halostatue)
* Ensure all temporary variables are local or unset.
#### auto.sh
* Ensure that `chruby_auto` can read `.ruby-version` files that do not end with
a new-line. (@hosiawak)
#### scripts/setup.sh
* Install ruby-install 0.3.3.
#### scripts/bug_report.sh
* Print `$HOME`, `$RUBY_AUTO_VERSION`.
* Print `trap -p`, `$preexec_functions` and `$precmd_functions`.
* Print env variables even when they are empty.
### 0.3.7 / 2013-08-18
* Multiple style changes and optimizations. (@zendeavor)
* Safely glob the contents of `/opt/rubies` and `~/.rubies`.
This prevents nullglob errors under zsh and `.rbx` directories from being
added to `RUBIES`.
* Unset `GEM_PATH` in `chruby_reset` if it has become empty.
Allows the RubyGems to use the default `GEM_PATH`.
* Safely quote `RUBIES[@]` to prevent implicit word-splitting when listing
`RUBIES`.
* Map `-V` to `--version` in `chruby`. (@havenwood)
* Added benchmarks.
#### auto.sh
* Unset `RUBY_AUTO_VERSION` when loaded. Forces sub-shells to re-detect any
`.ruby-version` file. (@KevinSjoberg)
* No longer export `RUBY_AUTO_VERSION`. Allows new windows in tmux to detect
the `.ruby-version` file.
* Set `RUBY_AUTO_VERSION` even if `.ruby-version` contains an unknown Ruby.
Prevents `chruby` from printing errors after every command.
* Fixed a typo where `RUBY_VERSION_FILE` was still being used. (@KevinSjoberg)
#### chruby-exec
* If stdin is a TTY, then spawn an interactive shell.
### 0.3.6 / 2013-06-23
* `chruby_use` no longer echos the selected Ruby.
#### chruby-exec
* Now runs under bash.
* Load `chruby.sh` for `CHRUBY_VERSION`.
#### auto.sh
* Record and compare the contents of `.ruby-version` files in order to detect
modifications, such as when switching between branches.
### 0.3.5 / 2013-05-28
* Added a RPM spec.
* Respect `PREFIX` when auto-detecting `/opt/rubies/*`.
* Do not set `GEM_ROOT` if rubygems is not installed (Charlie Somerville).
* `chruby_use` now echos the select ruby and the version, only if the shell is
in interactive mode (Brian D. Burns).
* `chruby_reset` no longer accidentally removes `/bin` if `GEM_HOME` or
`GEM_ROOT` are empty (David Grayson).
* `chruby` now selects the last lexical match for the given ruby.
#### auto.sh
* Ensure that auto-switching works in non-interactive mode:
* zsh: use `preexec_functions` which runs in both interactive and
non-interactive sessions.
* bash: use `trap DEBUG` which runs before every command, in both interactive
and non-interactive mode. `PROMPT_COMMAND` only runs in interactive mode.
* Fixed a serious design flaw, where `chruby_auto` passed the contents of
`.ruby-version` as multiple arguments to the `chruby` function. Originally,
this allowed for `.ruby-version` files to specify additional `RUBYOPT` options
(ex: `jruby --1.8`). However, an attacker could craft a malicious
`.ruby-version` file that would require arbitrary code
(ex: `1.9.3 -r./evil.rb`). The `./evil.rb` file would then be required when
`ruby` is invoked by `chruby_use` in order to determine `RUBY_ENGINE`,
`RUBY_VERSION`, `GEM_ROOT`.
In order to prevent the abuse of this feature, `chruby_auto` now passes the
entire contents of `.ruby-version` as a first and only argument to the
`chruby` function.
If you have `auto.sh` enabled, it is recommended that you upgrade.
If you cannot upgrade, consider disabling `auto.sh`.
If you want to scan your entire system for malicious `.ruby-version` files:
find / -name .ruby-version 2>/dev/null | xargs -i{} grep -H " " {}
Thanks to David Grayson for reporting this flaw.
#### scripts/setup.sh
* Do not assume bash is installed at `/bin/bash` (Shannon Skipper).
### 0.3.4 / 2013-02-28
* Prepend the new gem paths to `GEM_PATH` in `chruby_use`, instead of
overriding the variable. This allows users to add common gem paths to
`GEM_PATH` in `~/.bashrc`.
* Only remove the gem paths used by the Ruby in `chruby_reset`.
#### auto.sh
* Detect when `PROMPT_COMMAND=" "` before checking if `PROMPT_COMMAND` is an
empty String. This appears to only happen on OSX Mountain Lion.
#### scripts/bug_report.sh
* Include `CHRUBY_VERSION` in the output.
### 0.3.3 / 2013-02-18
* Added `-v` `--version` options to `chruby` and `chruby-exec`.
* Added `scripts/bug_report.sh` for collecting environment information
for bug reports.
* Initialize `RUBIES` to `()` to avoid double-loading `chruby.sh`.
* Invoke `ruby` using the absolute path to avoid shell aliases.
This fixes a bug caused by [ohmyzsh] aliases.
#### auto.sh
* Unset `RUBY_VERSION_FILE` on initial load for [tmux].
* Remove trailing `;` and whitespace from `PROMPT_COMMAND` before
appending `; chruby_auto`.
#### scripts/setup.sh
* Bump MRI version to 1.9.3-p385.
* Use `\x1b` instead of `\e` for OSX.
### 0.3.2 / 2013-01-15
* Prevent `auto.sh` from being loaded more than once.
* Recommend using `~/.bash_profile` and `~/.zprofile`.
* Use `cp` and `mkdir` instead of `install` in the `Makefile`.
#### chruby-exec
* Run under [bash], to avoid the [dash] shell.
* Invoke `$SHELL` with the `-i` option, so [zsh] will load shell configuration.
#### scripts/setup.sh
* Install [JRuby] 1.7.2.
* Use special `./configure` options for [homebrew].
* Also install openssl and readline via homebrew.
### 0.3.1 / 2012-12-29
* Fixed the auto-detection of `~/.rubies/*`.
* Check if `bin/ruby` exists and is executable before switching to a Ruby.
* Prevent `export=""` from accidentally being set under [zsh].
* Prevent `script/setup.sh` from exiting if a `brew install` fails because all
packages are already installed.
* Updated the example `/etc/profile.d/chruby.sh` to only load under [bash]
and [zsh].
### 0.3.0 / 2012-12-20
* Added the `chruby-exec` utility for use in `crontab` or with Continuous
Integration (CI).
* Added support for auto-detecting Rubies installed into `/opt/rubies/` or
`~/.rubies/`.
* Added `share/chruby/auto.sh`, which provides support for auto-switching
to Rubies specified in the [.ruby-version](https://gist.github.com/1912050)
file.
* Removed the "short circuit" check in `chruby_use`, to allow forcibly
switching to the current Ruby, in case `PATH` or `GEM_PATH` become corrupted.
### 0.2.6 / 2012-12-18
* Forcibly switch to system Ruby when loading `share/chruby/chruby.sh`.
This fixes switching issues for [tmux] users.
### 0.2.5 / 2012-12-15
* Renamed the `RUBY` environment variable to `RUBY_ROOT` to avoid breaking
the `FileUtils#ruby` method in [rake](http://rake.rubyforge.org/).
* Do not unset `GEM_HOME`, `GEM_PATH`, `GEM_ROOT` if running under root.
### 0.2.4 / 2012-12-13
* Added a `Vagrantfile` for testing chruby in various environments.
* Changed all code and examples to reference `/opt/rubies/`.
* Ensure all error messages are printed to stderr.
* Refactored `scripts/setup.sh` to manually install all Rubies and install any
dependencies via the System Package Manager.
* PGP signatures are now stored in `pkg/`.
#### Makefile
* Updated the `Makefile` to be compatible with BSD automake.
* Do not override `PREFIX`.
* Added a `test` task.
#### Homebrew
* Use `HOMEBREW_PREFIX`.
* Use `sha1` instead of `md5` (deprecated).
* No longer dynamically generate the example configuration.
### 0.2.3 / 2012-11-19
* Updated the `Makefile` to be compatible with the [dash] shell.
* Use inline substring substitutions instead of `sed`.
### 0.2.2 / 2012-11-17
* Use `typeset` to declare `RUBIES` as an indexed Array.
* Use the correct globbed Array syntax for both [zsh] and [bash].
* Improved the post-installation message in the [homebrew] recipe to auto-detect
[RVM], [rbenv] and [rbfu].
### 0.2.1 / 2012-10-23
* Fixed `make install` to work on OS X.
* Added a [homebrew] recipe.
### 0.2.0 / 2012-10-16
* Install `chruby.sh` into `$PREFIX/share/chruby/`.
### 0.1.2 / 2012-08-29
* Check if `$RUBY` _and_ `$RUBYOPT` are different from the arguments passed to
`chruby_use`.
* Fixed a spelling error in the README (thanks Ian Barnett).
### 0.1.1 / 2012-08-24
* Added unit-tests using [shunit2](http://code.google.com/p/shunit2/)
* Improved sanitation of `$PATH` in `chruby_reset`. (thanks mpapis)
* If the desired Ruby is already in use, immediately return from `chruby_use`.
* Export `$RUBY_ENGINE`, `$RUBY_VERSION`, `$GEM_ROOT` in `chruby_use`.
### 0.1.0 / 2012-08-18
* Added support for [zsh].
* Renamed the `$RUBY_PATH` variable to `$RUBY`.
* Set the `$RUBY_ENGINE` variable.
* Set the `$GEM_ROOT` variable to `Gem.default_dir`.
This supports the custom RubyGems directory used by [Rubinius].
* Only initialize the `$RUBIES` variable if it does not have a value.
### 0.0.2 / 2012-08-14
* Added a `LICENSE.txt`.
* Added a `ChangeLog.md`.
* Updated the `Makefile` to generate proper tar archives.
### 0.0.1 / 2012-08-01
* Initial release.
[dash]: http://gondor.apana.org.au/~herbert/dash/
[bash]: http://www.gnu.org/software/bash/
[zsh]: http://www.zsh.org/
[tmux]: http://tmux.sourceforge.net/
[ohmyzsh]: https://github.com/robbyrussell/oh-my-zsh#readme
[Rubinius]: http://rubini.us/
[homebrew]: http://mxcl.github.com/homebrew/
[RVM]: https://rvm.io/
[rbenv]: https://github.com/sstephenson/rbenv#readme
[rbfu]: https://github.com/hmans/rbfu#readme
[MRI]: http://www.ruby-lang.org/en/
[JRuby]: http://jruby.org/
[Rubinius]: http://rubini.us/
|
{
"content_hash": "c6ce49abe91dda65a54ba718a725a6f7",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 80,
"avg_line_length": 33.81720430107527,
"alnum_prop": 0.7022787493375728,
"repo_name": "eunomie/chgo",
"id": "19885afb4bd13804e2fff5eaa2a2e2de5fe7e70a",
"size": "9475",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ChangeLog.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AGS Script",
"bytes": "3960"
},
{
"name": "Ruby",
"bytes": "1136"
},
{
"name": "Shell",
"bytes": "22031"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 3