Dataset Preview
Duplicate
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:    TypeError
Message:      Couldn't cast array of type
struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, symlink_target: string>
to
{'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2011, in _prepare_split_single
                  writer.write_table(table)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 585, in write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2302, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in cast_table_to_schema
                  arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in <listcomp>
                  arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in wrapper
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in <listcomp>
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2122, in cast_array_to_feature
                  raise TypeError(f"Couldn't cast array of type\n{_short_str(array.type)}\nto\n{_short_str(feature)}")
              TypeError: Couldn't cast array of type
              struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, symlink_target: string>
              to
              {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}
              
              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 dataset

Need 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
TXTCOLOR_DEFAULT="\033[0;m" TXTCOLOR_RED="\033[0;31m" TXTCOLOR_GREEN="\033[0;32m" COCOS2DX20_TRUNK=$HOME/etc/software/cocos2d-x-2.2.4 OUTPUT_DEBUG=$COCOS2DX20_TRUNK/lib/linux/debug/ OUTPUT_RELEASE=$COCOS2DX20_TRUNK/lib/linux/release/ check_make_result() { if [ 0 != $? ]; then exit 1 fi } DEPENDS='libx11-dev' DEPENDS+=' libxmu-dev' DEPENDS+=' libglu1-mesa-dev' DEPENDS+=' libgl2ps-dev' DEPENDS+=' libxi-dev' DEPENDS+=' libglfw-dev' DEPENDS+=' g++' DEPENDS+=' libzip-dev' DEPENDS+=' libcurl4-gnutls-dev' DEPENDS+=' libfontconfig1-dev' DEPENDS+=' libsqlite3-dev' DEPENDS+=' libglew-dev' for i in $DEPENDS; do PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed") echo Checking for $i: $PKG_OK if [ "" == "$PKG_OK" ]; then echo -e $TXTCOLOR_GREEN"No $i. Setting up $i, please enter your password:"$TXTCOLOR_DEFAULT sudo apt-get --force-yes --yes install $i fi done mkdir -p $OUTPUT_DEBUG mkdir -p $OUTPUT_RELEASE make -C $COCOS2DX20_TRUNK/external/Box2D/proj.linux DEBUG=1 check_make_result make -C $COCOS2DX20_TRUNK/external/chipmunk/proj.linux DEBUG=1 check_make_result make -C $COCOS2DX20_TRUNK/cocos2dx/proj.linux DEBUG=1 check_make_result make -C $COCOS2DX20_TRUNK/CocosDenshion/proj.linux DEBUG=1 check_make_result make -C $COCOS2DX20_TRUNK/extensions/proj.linux DEBUG=1 check_make_result make DEBUG=1 check_make_result
{ "content_hash": "fc7db40a478560ddf3441db4104b83db", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 94, "avg_line_length": 24.29824561403509, "alnum_prop": 0.7212996389891697, "repo_name": "ponkotuy/CocosSample", "id": "9a85c055704ce731abb010c0c8c607b8e7e953b9", "size": "1398", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "proj.linux/build.sh", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "2803" }, { "name": "C#", "bytes": "23484" }, { "name": "C++", "bytes": "29927" }, { "name": "Java", "bytes": "1932" }, { "name": "Objective-C", "bytes": "3642" }, { "name": "Objective-C++", "bytes": "8859" }, { "name": "Shell", "bytes": "2947" } ] }
namespace inet { namespace httptools { Define_Module(HttpServer); void HttpServer::initialize(int stage) { HttpServerBase::initialize(stage); if (stage == INITSTAGE_LOCAL) { numBroken = 0; socketsOpened = 0; WATCH(numBroken); WATCH(socketsOpened); } else if (stage == INITSTAGE_APPLICATION_LAYER) { EV_DEBUG << "Initializing server component (sockets version)" << endl; int port = par("port"); TCPSocket listensocket; listensocket.setOutputGate(gate("tcpOut")); listensocket.setDataTransferMode(TCP_TRANSFER_OBJECT); listensocket.bind(port); listensocket.setCallbackObject(this); listensocket.listen(); } } void HttpServer::finish() { HttpServerBase::finish(); EV_INFO << "Sockets opened: " << socketsOpened << endl; EV_INFO << "Broken connections: " << numBroken << endl; recordScalar("sock.opened", socketsOpened); recordScalar("sock.broken", numBroken); // Clean up sockets and data structures sockCollection.deleteSockets(); } void HttpServer::handleMessage(cMessage *msg) { if (msg->isSelfMessage()) { // Self messages not used at the moment } else { EV_DEBUG << "Handle inbound message " << msg->getName() << " of kind " << msg->getKind() << endl; TCPSocket *socket = sockCollection.findSocketFor(msg); if (!socket) { EV_DEBUG << "No socket found for the message. Create a new one" << endl; // new connection -- create new socket object and server process socket = new TCPSocket(msg); socket->setOutputGate(gate("tcpOut")); socket->setDataTransferMode(TCP_TRANSFER_OBJECT); socket->setCallbackObject(this, socket); sockCollection.addSocket(socket); } EV_DEBUG << "Process the message " << msg->getName() << endl; socket->processMessage(msg); } updateDisplay(); } void HttpServer::socketEstablished(int connId, void *yourPtr) { EV_INFO << "connected socket with id=" << connId << endl; socketsOpened++; } void HttpServer::socketDataArrived(int connId, void *yourPtr, cPacket *msg, bool urgent) { if (yourPtr == NULL) { EV_ERROR << "Socket establish failure. Null pointer" << endl; return; } TCPSocket *socket = (TCPSocket *)yourPtr; // Should be a HttpReplyMessage EV_DEBUG << "Socket data arrived on connection " << connId << ". Message=" << msg->getName() << ", kind=" << msg->getKind() << endl; // call the message handler to process the message. cMessage *reply = handleReceivedMessage(msg); if (reply != NULL) { socket->send(reply); // Send to socket if the reply is non-zero. } delete msg; // Delete the received message here. Must not be deleted in the handler! } void HttpServer::socketPeerClosed(int connId, void *yourPtr) { if (yourPtr == NULL) { EV_ERROR << "Socket establish failure. Null pointer" << endl; return; } TCPSocket *socket = (TCPSocket *)yourPtr; // close the connection (if not already closed) if (socket->getState() == TCPSocket::PEER_CLOSED) { EV_INFO << "remote TCP closed, closing here as well. Connection id is " << connId << endl; socket->close(); // Call the close method to properly dispose of the socket. } } void HttpServer::socketClosed(int connId, void *yourPtr) { EV_INFO << "connection closed. Connection id " << connId << endl; if (yourPtr == NULL) { EV_ERROR << "Socket establish failure. Null pointer" << endl; return; } // Cleanup TCPSocket *socket = (TCPSocket *)yourPtr; sockCollection.removeSocket(socket); delete socket; } void HttpServer::socketFailure(int connId, void *yourPtr, int code) { EV_WARN << "connection broken. Connection id " << connId << endl; numBroken++; EV_INFO << "connection closed. Connection id " << connId << endl; if (yourPtr == NULL) { EV_ERROR << "Socket establish failure. Null pointer" << endl; return; } TCPSocket *socket = (TCPSocket *)yourPtr; if (code == TCP_I_CONNECTION_RESET) EV_WARN << "Connection reset!\n"; else if (code == TCP_I_CONNECTION_REFUSED) EV_WARN << "Connection refused!\n"; // Cleanup sockCollection.removeSocket(socket); delete socket; } } // namespace httptools } // namespace inet
{ "content_hash": "e1cdef63b0591692e7a10f9f532af314", "timestamp": "", "source": "github", "line_count": 149, "max_line_length": 136, "avg_line_length": 30.033557046979865, "alnum_prop": 0.6250279329608939, "repo_name": "googleinterns/vectio", "id": "0c90fe987e5f29b4377ddd63329ab947d329858f", "size": "5266", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "inet/src/inet/applications/httptools/server/HttpServer.cc", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "12899" }, { "name": "C", "bytes": "187862" }, { "name": "C++", "bytes": "10383707" }, { "name": "CSS", "bytes": "2751" }, { "name": "FreeMarker", "bytes": "15828" }, { "name": "HTML", "bytes": "41036" }, { "name": "Makefile", "bytes": "5303" }, { "name": "Perl", "bytes": "25486" }, { "name": "Python", "bytes": "158836" }, { "name": "R", "bytes": "51230" }, { "name": "Raku", "bytes": "150" }, { "name": "Roff", "bytes": "22957" }, { "name": "Shell", "bytes": "21282" }, { "name": "Tcl", "bytes": "18098" }, { "name": "XSLT", "bytes": "14040" } ] }
/* header 6 */ /* leading retained */ export default function usedNamedFunction () { console.log( 'named' ); } // trailing retained /* footer 6 */
{ "content_hash": "d210a07dad2d76b0fa03fa18c9ad0a81", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 46, "avg_line_length": 18.75, "alnum_prop": 0.6533333333333333, "repo_name": "corneliusweig/rollup", "id": "7e1d70befbe6621818a4bd6e24e5e79024742776", "size": "150", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "test/form/samples/tree-shake-default-exports/usedNamedFunction.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "636637" } ] }
<manifest package="com.cyrillrx.templates" />
{ "content_hash": "e819cd79260579096726047b67a977fc", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 45, "avg_line_length": 46, "alnum_prop": 0.7608695652173914, "repo_name": "cyrillrx/android_libraries", "id": "06a75552dded21419834204f12194cc3cbe7c699", "size": "46", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "templates/src/main/AndroidManifest.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "39664" }, { "name": "Kotlin", "bytes": "21437" } ] }
{% from 'macros/helpers.html' import sprite %} <!doctype html> <html> <head> <meta charset="utf-8"> <title>{% block title %}Gulp Asset Pipeline{% endblock %}</title> <link rel="stylesheet" href="stylesheets/global.css"> {% block head %}{% endblock %} </head> <body> <h1>Gulp All The Things!</h1> {% include "shared/page-nav.html" %} {% block content %}{% endblock %} <footer> <p>Made with ♥ at <br><a href="http://viget.com">{{sprite('viget', '0 0 500 182')}}</a></p> </footer> <script src="javascripts/shared.js"></script> {% block javascript %}{% endblock %} </body> </html>
{ "content_hash": "7628251e43671b6f688616fd38ab72a9", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 95, "avg_line_length": 28.761904761904763, "alnum_prop": 0.6125827814569537, "repo_name": "tinystride/gulp-starter", "id": "f4d3d6ad500da3dff47c218d77134c35f6a313ca", "size": "606", "binary": false, "copies": "16", "ref": "refs/heads/master", "path": "src/html/layouts/application.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3490" }, { "name": "HTML", "bytes": "2178" }, { "name": "JavaScript", "bytes": "24038" } ] }
"""Utilities for probability distributions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import hashlib import math import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape from tensorflow.python.framework import tensor_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import check_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import nn def assert_close( x, y, data=None, summarize=None, message=None, name="assert_close"): """Assert that that x and y are within machine epsilon of each other. Args: x: Floating-point `Tensor` y: Floating-point `Tensor` data: The tensors to print out if the condition is `False`. Defaults to error message and first few entries of `x` and `y`. summarize: Print this many entries of each tensor. message: A string to prefix to the default message. name: A name for this operation (optional). Returns: Op raising `InvalidArgumentError` if |x - y| > machine epsilon. """ message = message or "" x = ops.convert_to_tensor(x, name="x") y = ops.convert_to_tensor(y, name="y") if data is None: data = [ message, "Condition x ~= y did not hold element-wise: x = ", x.name, x, "y = ", y.name, y ] if x.dtype.is_integer: return check_ops.assert_equal( x, y, data=data, summarize=summarize, message=message, name=name) with ops.name_scope(name, "assert_close", [x, y, data]): tol = np.finfo(x.dtype.as_numpy_dtype).eps condition = math_ops.reduce_all(math_ops.less_equal(math_ops.abs(x-y), tol)) return control_flow_ops.Assert( condition, data, summarize=summarize) def assert_integer_form( x, data=None, summarize=None, message=None, name="assert_integer_form"): """Assert that x has integer components (or floats equal to integers). Args: x: Floating-point `Tensor` data: The tensors to print out if the condition is `False`. Defaults to error message and first few entries of `x` and `y`. summarize: Print this many entries of each tensor. message: A string to prefix to the default message. name: A name for this operation (optional). Returns: Op raising `InvalidArgumentError` if round(x) != x. """ message = message or "x has non-integer components" x = ops.convert_to_tensor(x, name="x") casted_x = math_ops.to_int64(x) return check_ops.assert_equal( x, math_ops.cast(math_ops.round(casted_x), x.dtype), data=data, summarize=summarize, message=message, name=name) def assert_symmetric(matrix): matrix_t = array_ops.matrix_transpose(matrix) return control_flow_ops.with_dependencies( [check_ops.assert_equal(matrix, matrix_t)], matrix) def embed_check_nonnegative_discrete(x, check_integer=True): """Assert x is a non-negative tensor, and optionally of integers.""" assertions = [check_ops.assert_non_negative( x, message="x must be non-negative.")] if check_integer: assertions += [assert_integer_form( x, message="x cannot contain fractional components.")] return control_flow_ops.with_dependencies(assertions, x) def same_dynamic_shape(a, b): """Returns whether a and b have the same dynamic shape. Args: a: `Tensor` b: `Tensor` Returns: `bool` `Tensor` representing if both tensors have the same shape. """ a = ops.convert_to_tensor(a, name="a") b = ops.convert_to_tensor(b, name="b") # Here we can't just do math_ops.equal(a.shape, b.shape), since # static shape inference may break the equality comparison between # shape(a) and shape(b) in math_ops.equal. def all_shapes_equal(): return math_ops.reduce_all(math_ops.equal( array_ops.concat([array_ops.shape(a), array_ops.shape(b)], 0), array_ops.concat([array_ops.shape(b), array_ops.shape(a)], 0))) # One of the shapes isn't fully defined, so we need to use the dynamic # shape. return control_flow_ops.cond( math_ops.equal(array_ops.rank(a), array_ops.rank(b)), all_shapes_equal, lambda: constant_op.constant(False)) def get_logits_and_probs(logits=None, probs=None, multidimensional=False, validate_args=False, name="get_logits_and_probs"): """Converts logit to probabilities (or vice-versa), and returns both. Args: logits: Floating-point `Tensor` representing log-odds. probs: Floating-point `Tensor` representing probabilities. multidimensional: Python `bool`, default `False`. If `True`, represents whether the last dimension of `logits` or `probs`, a `[N1, N2, ... k]` dimensional tensor, representing the logit or probability of `shape[-1]` classes. validate_args: Python `bool`, default `False`. When `True`, either assert `0 <= probs <= 1` (if not `multidimensional`) or that the last dimension of `probs` sums to one. name: A name for this operation (optional). Returns: logits, probs: Tuple of `Tensor`s. If `probs` has an entry that is `0` or `1`, then the corresponding entry in the returned logit will be `-Inf` and `Inf` respectively. Raises: ValueError: if neither `probs` nor `logits` were passed in, or both were. """ with ops.name_scope(name, values=[probs, logits]): if (probs is None) == (logits is None): raise ValueError("Must pass probs or logits, but not both.") if probs is None: logits = ops.convert_to_tensor(logits, name="logits") if multidimensional: return logits, nn.softmax(logits, name="probs") return logits, math_ops.sigmoid(logits, name="probs") probs = ops.convert_to_tensor(probs, name="probs") if validate_args: with ops.name_scope("validate_probs"): one = constant_op.constant(1., probs.dtype) dependencies = [check_ops.assert_non_negative(probs)] if multidimensional: dependencies += [assert_close(math_ops.reduce_sum(probs, -1), one, message="probs does not sum to 1.")] else: dependencies += [check_ops.assert_less_equal( probs, one, message="probs has components greater than 1.")] probs = control_flow_ops.with_dependencies(dependencies, probs) with ops.name_scope("logits"): if multidimensional: # Here we don't compute the multidimensional case, in a manner # consistent with respect to the unidimensional case. We do so # following the TF convention. Typically, you might expect to see # logits = log(probs) - log(probs[pivot]). A side-effect of # being consistent with the TF approach is that the unidimensional case # implicitly handles the second dimension but the multidimensional case # explicitly keeps the pivot dimension. return math_ops.log(probs), probs return math_ops.log(probs) - math_ops.log1p(-1. * probs), probs def log_combinations(n, counts, name="log_combinations"): """Multinomial coefficient. Given `n` and `counts`, where `counts` has last dimension `k`, we compute the multinomial coefficient as: ```n! / sum_i n_i!``` where `i` runs over all `k` classes. Args: n: Floating-point `Tensor` broadcastable with `counts`. This represents `n` outcomes. counts: Floating-point `Tensor` broadcastable with `n`. This represents counts in `k` classes, where `k` is the last dimension of the tensor. name: A name for this operation (optional). Returns: `Tensor` representing the multinomial coefficient between `n` and `counts`. """ # First a bit about the number of ways counts could have come in: # E.g. if counts = [1, 2], then this is 3 choose 2. # In general, this is (sum counts)! / sum(counts!) # The sum should be along the last dimension of counts. This is the # "distribution" dimension. Here n a priori represents the sum of counts. with ops.name_scope(name, values=[n, counts]): n = ops.convert_to_tensor(n, name="n") counts = ops.convert_to_tensor(counts, name="counts") total_permutations = math_ops.lgamma(n + 1) counts_factorial = math_ops.lgamma(counts + 1) redundant_permutations = math_ops.reduce_sum(counts_factorial, axis=[-1]) return total_permutations - redundant_permutations def matrix_diag_transform(matrix, transform=None, name=None): """Transform diagonal of [batch-]matrix, leave rest of matrix unchanged. Create a trainable covariance defined by a Cholesky factor: ```python # Transform network layer into 2 x 2 array. matrix_values = tf.contrib.layers.fully_connected(activations, 4) matrix = tf.reshape(matrix_values, (batch_size, 2, 2)) # Make the diagonal positive. If the upper triangle was zero, this would be a # valid Cholesky factor. chol = matrix_diag_transform(matrix, transform=tf.nn.softplus) # OperatorPDCholesky ignores the upper triangle. operator = OperatorPDCholesky(chol) ``` Example of heteroskedastic 2-D linear regression. ```python # Get a trainable Cholesky factor. matrix_values = tf.contrib.layers.fully_connected(activations, 4) matrix = tf.reshape(matrix_values, (batch_size, 2, 2)) chol = matrix_diag_transform(matrix, transform=tf.nn.softplus) # Get a trainable mean. mu = tf.contrib.layers.fully_connected(activations, 2) # This is a fully trainable multivariate normal! dist = tf.contrib.distributions.MVNCholesky(mu, chol) # Standard log loss. Minimizing this will "train" mu and chol, and then dist # will be a distribution predicting labels as multivariate Gaussians. loss = -1 * tf.reduce_mean(dist.log_prob(labels)) ``` Args: matrix: Rank `R` `Tensor`, `R >= 2`, where the last two dimensions are equal. transform: Element-wise function mapping `Tensors` to `Tensors`. To be applied to the diagonal of `matrix`. If `None`, `matrix` is returned unchanged. Defaults to `None`. name: A name to give created ops. Defaults to "matrix_diag_transform". Returns: A `Tensor` with same shape and `dtype` as `matrix`. """ with ops.name_scope(name, "matrix_diag_transform", [matrix]): matrix = ops.convert_to_tensor(matrix, name="matrix") if transform is None: return matrix # Replace the diag with transformed diag. diag = array_ops.matrix_diag_part(matrix) transformed_diag = transform(diag) transformed_mat = array_ops.matrix_set_diag(matrix, transformed_diag) return transformed_mat def rotate_transpose(x, shift, name="rotate_transpose"): """Circularly moves dims left or right. Effectively identical to: ```python numpy.transpose(x, numpy.roll(numpy.arange(len(x.shape)), shift)) ``` When `validate_args=False` additional graph-runtime checks are performed. These checks entail moving data from to GPU to CPU. Example: ```python x = ... # Tensor of shape [1, 2, 3, 4]. rotate_transpose(x, -1) # result shape: [2, 3, 4, 1] rotate_transpose(x, -2) # result shape: [3, 4, 1, 2] rotate_transpose(x, 1) # result shape: [4, 1, 2, 3] rotate_transpose(x, 2) # result shape: [3, 4, 1, 2] rotate_transpose(x, 7) == rotate_transpose(x, 3) rotate_transpose(x, -7) == rotate_transpose(x, -3) ``` Args: x: `Tensor`. shift: `Tensor`. Number of dimensions to transpose left (shift<0) or transpose right (shift>0). name: Python `str`. The name to give this op. Returns: rotated_x: Input `Tensor` with dimensions circularly rotated by shift. Raises: TypeError: if shift is not integer type. """ with ops.name_scope(name, values=[x, shift]): x = ops.convert_to_tensor(x, name="x") shift = ops.convert_to_tensor(shift, name="shift") # We do not assign back to preserve constant-ness. check_ops.assert_integer(shift) shift_value_static = tensor_util.constant_value(shift) ndims = x.get_shape().ndims if ndims is not None and shift_value_static is not None: if ndims < 2: return x shift_value_static = np.sign(shift_value_static) * ( abs(shift_value_static) % ndims) if shift_value_static == 0: return x perm = np.roll(np.arange(ndims), shift_value_static) return array_ops.transpose(x, perm=perm) else: # Consider if we always had a positive shift, and some specified # direction. # When shifting left we want the new array: # last(x, n-shift) + first(x, shift) # and if shifting right then we want: # last(x, shift) + first(x, n-shift) # Observe that last(a) == slice(a, n) and first(a) == slice(0, a). # Also, we can encode direction and shift as one: direction * shift. # Combining these facts, we have: # a = cond(shift<0, -shift, n-shift) # last(x, n-a) + first(x, a) == x[a:n] + x[0:a] # Finally, we transform shift by modulo length so it can be specified # independently from the array upon which it operates (like python). ndims = array_ops.rank(x) shift = array_ops.where(math_ops.less(shift, 0), math_ops.mod(-shift, ndims), ndims - math_ops.mod(shift, ndims)) first = math_ops.range(0, shift) last = math_ops.range(shift, ndims) perm = array_ops.concat([last, first], 0) return array_ops.transpose(x, perm=perm) def pick_vector(cond, true_vector, false_vector, name="pick_vector"): """Picks possibly different length row `Tensor`s based on condition. Value `Tensor`s should have exactly one dimension. If `cond` is a python Boolean or `tf.constant` then either `true_vector` or `false_vector` is immediately returned. I.e., no graph nodes are created and no validation happens. Args: cond: `Tensor`. Must have `dtype=tf.bool` and be scalar. true_vector: `Tensor` of one dimension. Returned when cond is `True`. false_vector: `Tensor` of one dimension. Returned when cond is `False`. name: Python `str`. The name to give this op. Example: ```python pick_vector(tf.less(0, 5), tf.range(10, 12), tf.range(15, 18)) # result is tensor: [10, 11]. pick_vector(tf.less(5, 0), tf.range(10, 12), tf.range(15, 18)) # result is tensor: [15, 16, 17]. ``` Returns: true_or_false_vector: `Tensor`. Raises: TypeError: if `cond.dtype != tf.bool` TypeError: if `cond` is not a constant and `true_vector.dtype != false_vector.dtype` """ with ops.name_scope(name, values=(cond, true_vector, false_vector)): cond = ops.convert_to_tensor(cond, name="cond") if cond.dtype != dtypes.bool: raise TypeError("%s.dtype=%s which is not %s" % (cond.name, cond.dtype, dtypes.bool)) cond_value_static = tensor_util.constant_value(cond) if cond_value_static is not None: return true_vector if cond_value_static else false_vector true_vector = ops.convert_to_tensor(true_vector, name="true_vector") false_vector = ops.convert_to_tensor(false_vector, name="false_vector") if true_vector.dtype != false_vector.dtype: raise TypeError( "%s.dtype=%s does not match %s.dtype=%s" % (true_vector.name, true_vector.dtype, false_vector.name, false_vector.dtype)) n = array_ops.shape(true_vector)[0] return array_ops.slice( array_ops.concat([true_vector, false_vector], 0), [array_ops.where(cond, 0, n)], [array_ops.where(cond, n, -1)]) def gen_new_seed(seed, salt): """Generate a new seed, from the given seed and salt.""" if seed is None: return None string = (str(seed) + salt).encode("utf-8") return int(hashlib.md5(string).hexdigest()[:8], 16) & 0x7FFFFFFF def fill_lower_triangular(x, validate_args=False, name="fill_lower_triangular"): """Creates a (batch of) lower triangular matrix from a vector of inputs. If `x.get_shape()` is `[b1, b2, ..., bK, d]` then the output shape is `[b1, b2, ..., bK, n, n]` where `n` is such that `d = n(n+1)/2`, i.e., `n = int(0.5 * (math.sqrt(1. + 8. * d) - 1.))`. Although the non-batch complexity is O(n**2), large constants and sub-optimal vectorization means the complexity of this function is 5x slower than zeroing out the upper triangular, i.e., `tf.matrix_band_part(X, -1, 0)`. This function becomes competitive only when several matmul/cholesky/etc ops can be ellided in constructing the input. Example: wiring a fully connected layer as a covariance matrix; this function reduces the final layer by 2x and possibly reduces the network arch complexity considerably. In most cases it is better to simply build a full matrix and zero out the upper triangular elements, e.g., `tril = tf.matrix_band_part(full, -1, 0)`, rather than directly construct a lower triangular. Example: ```python fill_lower_triangular([1, 2, 3, 4, 5, 6]) # Returns: [[1, 0, 0], # [2, 3, 0], # [4, 5, 6]] ``` For comparison, a pure numpy version of this function can be found in `distribution_util_test.py`, function `_fill_lower_triangular`. Args: x: `Tensor` representing lower triangular elements. validate_args: Python `bool`, default `False`. Whether to ensure the shape of `x` can be mapped to a lower triangular matrix (controls non-static checks only). name: Python `str`. The name to give this op. Returns: tril: `Tensor` with lower triangular elements filled from `x`. Raises: ValueError: if shape if `x` has static shape which cannot be mapped to a lower triangular matrix. """ # TODO(jvdillon): Replace this code with dedicated op when it exists. with ops.name_scope(name, values=[x]): x = ops.convert_to_tensor(x, name="x") if (x.get_shape().ndims is not None and x.get_shape()[-1].value is not None): d = x.get_shape()[-1].value # d = n(n+1)/2 implies n is: n = int(0.5 * (math.sqrt(1. + 8. * d) - 1.)) d_inferred = n * (n + 1) /2 if d != d_inferred: raise ValueError("Input cannot be mapped to a lower triangular; " "n*(n+1)/2 = %d != %d" % (d_inferred, d)) final_shape = x.get_shape()[:-1].concatenate( tensor_shape.TensorShape([n, n])) else: d = math_ops.cast(array_ops.shape(x)[-1], dtype=dtypes.float32) # d = n(n+1)/2 implies n is: n = math_ops.cast(0.5 * (dtypes.sqrt(1. + 8. * d) - 1.), dtype=dtypes.int32) if validate_args: is_valid_input_shape = check_ops.assert_equal( n * (n + 1) / 2, d, message="Input cannot be mapped to a lower triangular.") n = control_flow_ops.with_dependencies([is_valid_input_shape], n) final_shape = x.get_shape()[:-1].concatenate( tensor_shape.TensorShape([None, None])) def tril_ids(n): """Internal helper to create vector of linear indices into y.""" # Build the ids statically; chose 512 because it implies 1MiB. if not tensor_util.is_tensor(n) and n <= 512: ids = np.arange(n**2, dtype=np.int32) rows = (ids / n).astype(np.int32) # Implicit floor. # We need to stop incrementing the index when we encounter # upper-triangular elements. The idea here is to compute the # lower-right number of zeros then by "symmetry" subtract this from the # total number of zeros, n(n-1)/2. # Then we note that: n(n-1)/2 - (n-r)*(n-r-1)/2 = r(2n-r-1)/2 offset = (rows * (2 * n - rows - 1) / 2).astype(np.int32) # We could also zero out when (rows < cols) == (rows < ids-n*rows). # mask = (ids <= (n + 1) * rows).astype(np.int32) else: ids = math_ops.range(n**2) rows = math_ops.cast(ids / n, dtype=dtypes.int32) offset = math_ops.cast(rows * (2 * n - rows - 1) / 2, dtype=dtypes.int32) return ids - offset # Special-case non-batch case. if x.get_shape().ndims == 1: y = array_ops.gather(x, array_ops.reshape(tril_ids(n), [n, n])) y = array_ops.matrix_band_part(y, -1, 0) y.set_shape(y.get_shape().merge_with(final_shape)) return y # Make ids for each batch dim. if (x.get_shape().ndims is not None and x.get_shape()[:-1].is_fully_defined()): batch_shape = np.asarray(x.get_shape()[:-1].as_list(), dtype=np.int32) m = np.prod(batch_shape).astype(np.int32) else: batch_shape = array_ops.shape(x)[:-1] m = math_ops.reduce_prod(array_ops.shape(x)[:-1]) batch_ids = math_ops.range(m) # Assemble the tril_ids into batch,tril_id pairs. idx = array_ops.stack([ array_ops.tile(array_ops.expand_dims(batch_ids, 1), [1, n * n]), array_ops.tile(array_ops.expand_dims(tril_ids(n), 0), [m, 1]) ]) idx = array_ops.transpose(idx, [1, 2, 0]) # Gather up, reshape, and return. y = array_ops.reshape(x, [-1, d]) y = array_ops.gather_nd(y, idx) y = array_ops.reshape(y, array_ops.concat([batch_shape, [n, n]], 0)) y = array_ops.matrix_band_part(y, -1, 0) y.set_shape(y.get_shape().merge_with(final_shape)) return y # TODO(jvdillon): Merge this test back into: # tensorflow/python/ops/softplus_op_test.py # once TF core is accepting new ops. def softplus_inverse(x, name=None): """Computes the inverse softplus, i.e., x = softplus_inverse(softplus(x)). Mathematically this op is equivalent to: ```none softplus_inverse = log(exp(x) - 1.) ``` Args: x: `Tensor`. Non-negative (not enforced), floating-point. name: A name for the operation (optional). Returns: `Tensor`. Has the same type/shape as input `x`. """ with ops.name_scope(name, "softplus_inverse", values=[x]): x = ops.convert_to_tensor(x, name="x") # We begin by deriving a more numerically stable softplus_inverse: # x = softplus(y) = Log[1 + exp{y}], (which means x > 0). # ==> exp{x} = 1 + exp{y} (1) # ==> y = Log[exp{x} - 1] (2) # = Log[(exp{x} - 1) / exp{x}] + Log[exp{x}] # = Log[(1 - exp{-x}) / 1] + Log[exp{x}] # = Log[1 - exp{-x}] + x (3) # (2) is the "obvious" inverse, but (3) is more stable than (2) for large x. # For small x (e.g. x = 1e-10), (3) will become -inf since 1 - exp{-x} will # be zero. To fix this, we use 1 - exp{-x} approx x for small x > 0. # # In addition to the numerically stable derivation above, we clamp # small/large values to be congruent with the logic in: # tensorflow/core/kernels/softplus_op.h # # Finally, we set the input to one whenever the input is too large or too # small. This ensures that no unchosen codepath is +/- inf. This is # necessary to ensure the gradient doesn't get NaNs. Recall that the # gradient of `where` behaves like `pred*pred_true + (1-pred)*pred_false` # thus an `inf` in an unselected path results in `0*inf=nan`. We are careful # to overwrite `x` with ones only when we will never actually use this # value. Note that we use ones and not zeros since `log(expm1(0.)) = -inf`. threshold = np.log(np.finfo(x.dtype.as_numpy_dtype).eps) + 2. is_too_small = math_ops.less(x, np.exp(threshold)) is_too_large = math_ops.greater(x, -threshold) too_small_value = math_ops.log(x) too_large_value = x # This `where` will ultimately be a NOP because we won't select this # codepath whenever we used the surrogate `ones_like`. x = array_ops.where(math_ops.logical_or(is_too_small, is_too_large), array_ops.ones_like(x), x) y = x + math_ops.log(-math_ops.expm1(-x)) # == log(expm1(x)) return array_ops.where(is_too_small, too_small_value, array_ops.where(is_too_large, too_large_value, y)) # TODO(b/35290280): Add unit-tests. def dimension_size(x, axis): """Returns the size of a specific dimension.""" # Since tf.gather isn't "constant-in, constant-out", we must first check the # static shape or fallback to dynamic shape. num_rows = (None if x.get_shape().ndims is None else x.get_shape()[axis].value) if num_rows is not None: return num_rows return array_ops.shape(x)[axis] class AppendDocstring(object): """Helper class to promote private subclass docstring to public counterpart. Example: ```python class TransformedDistribution(Distribution): @distribution_util.AppendDocstring( additional_note="A special note!", kwargs_dict={"foo": "An extra arg."}) def _prob(self, y, foo=None): pass ``` In this case, the `AppendDocstring` decorator appends the `additional_note` to the docstring of `prob` (not `_prob`) and adds a new `kwargs` section with each dictionary item as a bullet-point. For a more detailed example, see `TransformedDistribution`. """ def __init__(self, additional_note="", kwargs_dict=None): """Initializes the AppendDocstring object. Args: additional_note: Python string added as additional docstring to public version of function. kwargs_dict: Python string/string dictionary representing specific kwargs expanded from the **kwargs input. Raises: ValueError: if kwargs_dict.key contains whitespace. ValueError: if kwargs_dict.value contains newlines. """ self._additional_note = additional_note if kwargs_dict: bullets = [] for key in sorted(kwargs_dict.keys()): value = kwargs_dict[key] if any(x.isspace() for x in key): raise ValueError( "Parameter name \"%s\" contains whitespace." % key) value = value.lstrip() if "\n" in value: raise ValueError( "Parameter description for \"%s\" contains newlines." % key) bullets.append("* `%s`: %s" % (key, value)) self._additional_note += ("\n\n##### `kwargs`:\n\n" + "\n".join(bullets)) def __call__(self, fn): @functools.wraps(fn) def _fn(*args, **kwargs): return fn(*args, **kwargs) if _fn.__doc__ is None: _fn.__doc__ = self._additional_note else: _fn.__doc__ += "\n%s" % self._additional_note return _fn
{ "content_hash": "1108a46aabc41c3f29087ac9a5cc1852", "timestamp": "", "source": "github", "line_count": 679, "max_line_length": 80, "avg_line_length": 39.26067746686304, "alnum_prop": 0.641571010578438, "repo_name": "Bulochkin/tensorflow_pack", "id": "05c6f4da5700382dbd5b4b5dae497696feff836d", "size": "27347", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "tensorflow/python/ops/distributions/util.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "8642" }, { "name": "C", "bytes": "1828001" }, { "name": "C#", "bytes": "2514007" }, { "name": "C++", "bytes": "45095967" }, { "name": "CMake", "bytes": "548000" }, { "name": "CSS", "bytes": "5436" }, { "name": "Cuda", "bytes": "133557" }, { "name": "Emacs Lisp", "bytes": "7822" }, { "name": "Fortran", "bytes": "1326303" }, { "name": "Go", "bytes": "906942" }, { "name": "HTML", "bytes": "19326" }, { "name": "Java", "bytes": "4277149" }, { "name": "JavaScript", "bytes": "489911" }, { "name": "Jupyter Notebook", "bytes": "1833659" }, { "name": "LLVM", "bytes": "6536" }, { "name": "M4", "bytes": "56312" }, { "name": "Makefile", "bytes": "186932" }, { "name": "Objective-C", "bytes": "2960956" }, { "name": "Objective-C++", "bytes": "66107" }, { "name": "PHP", "bytes": "464331" }, { "name": "Protocol Buffer", "bytes": "2002776" }, { "name": "PureBasic", "bytes": "24932" }, { "name": "Python", "bytes": "23512203" }, { "name": "Ruby", "bytes": "152468" }, { "name": "Shell", "bytes": "454403" }, { "name": "Swift", "bytes": "20112" }, { "name": "Vim script", "bytes": "3759" } ] }
**Browsers and versions affected** **Description** **Steps to reproduce** **Expected results** **Actual results**
{ "content_hash": "0806e200ffa4a3d038938602668e3669", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 34, "avg_line_length": 9.384615384615385, "alnum_prop": 0.6721311475409836, "repo_name": "noahlvb/dotfiles", "id": "bb734d6a4558240fb53c5eb0cd6e8905d1d06097", "size": "122", "binary": false, "copies": "33", "ref": "refs/heads/master", "path": ".atom/packages/teletype/node_modules/webrtc-adapter/ISSUE_TEMPLATE.md", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "220" }, { "name": "CSS", "bytes": "117043" }, { "name": "CoffeeScript", "bytes": "653982" }, { "name": "HTML", "bytes": "38" }, { "name": "JavaScript", "bytes": "695056" }, { "name": "Shell", "bytes": "37894" }, { "name": "TeX", "bytes": "404" } ] }
<?php error_reporting(E_STRICT | E_ALL); // You can set the include path to src directory or reference // DfpUser.php directly via require_once. // $path = '/path/to/dfp_api_php_lib/src'; $path = dirname(__FILE__) . '/../../../../src'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php'; require_once 'Google/Api/Ads/Dfp/Util/v201408/StatementBuilder.php'; require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php'; try { // Get DfpUser from credentials in "../auth.ini" // relative to the DfpUser.php file's directory. $user = new DfpUser(); // Log SOAP XML request and response. $user->LogDefaults(); // Get the OrderService. $orderService = $user->GetService('OrderService', 'v201408'); // Create a statement to select only orders that are starting soon. $statementBuilder = new StatementBuilder(); $statementBuilder->Where( 'status = :status AND startDateTime >= :now AND startDateTime <= :soon') ->OrderBy('id ASC') ->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT) ->WithBindVariableValue('status', 'APPROVED') ->WithBindVariableValue( 'now', date(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT, strtotime('now')) ) ->WithBindVariableValue( 'soon', date(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT, strtotime('5 day')) ); // Default for total result set size. $totalResultSetSize = 0; do { // Get orders by statement. $page = $orderService->getOrdersByStatement( $statementBuilder->ToStatement()); // Display results. if (isset($page->results)) { $totalResultSetSize = $page->totalResultSetSize; $i = $page->startIndex; foreach ($page->results as $order) { printf("%d) Order with ID %d, name '%s', and advertiser ID %d was " . "found.\n", $i++, $order->id, $order->name, $order->advertiserId); } } $statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT); } while ($statementBuilder->GetOffset() < $totalResultSetSize); printf("Number of results found: %d\n", $totalResultSetSize); } catch (OAuth2Exception $e) { ExampleUtils::CheckForOAuth2Errors($e); } catch (ValidationException $e) { ExampleUtils::CheckForOAuth2Errors($e); } catch (Exception $e) { printf("%s\n", $e->getMessage()); }
{ "content_hash": "bbea5dc5663073c6606209229f6c31c1", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 80, "avg_line_length": 33.19178082191781, "alnum_prop": 0.6442426743706149, "repo_name": "claimsmall/googleads-php-lib", "id": "e1b7e9867c7cc93cff91ae41ebebbfad806ee704", "size": "3475", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "examples/Dfp/v201408/OrderService/GetOrdersStartingSoon.php", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "42946353" }, { "name": "XSLT", "bytes": "17842" } ] }
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <script src="../../resources/js-test.js"></script> </head> <body> <p id="description"></p> <div id="console"></div> <script src="resources/ie-test-pre.js"></script> <script src="TestCases/15.2.3.3-4-70.js"></script> <script src="resources/ie-test-post.js"></script> </body> </html>
{ "content_hash": "d1e56c7f330a30f386b4607e63637b93", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 50, "avg_line_length": 26.384615384615383, "alnum_prop": 0.6443148688046647, "repo_name": "hgl888/blink-crosswalk-efl", "id": "d5636f6c6686b9a3205ddcbf1eb175a304e05702", "size": "343", "binary": false, "copies": "9", "ref": "refs/heads/efl/crosswalk-10/39.0.2171.19", "path": "LayoutTests/ietestcenter/Javascript/15.2.3.3-4-70.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "1835" }, { "name": "Assembly", "bytes": "14584" }, { "name": "Batchfile", "bytes": "35" }, { "name": "C", "bytes": "113661" }, { "name": "C++", "bytes": "41933223" }, { "name": "CSS", "bytes": "525836" }, { "name": "GLSL", "bytes": "11578" }, { "name": "Groff", "bytes": "28067" }, { "name": "HTML", "bytes": "54848115" }, { "name": "Java", "bytes": "100403" }, { "name": "JavaScript", "bytes": "26269146" }, { "name": "Makefile", "bytes": "653" }, { "name": "Objective-C", "bytes": "111951" }, { "name": "Objective-C++", "bytes": "377325" }, { "name": "PHP", "bytes": "167892" }, { "name": "Perl", "bytes": "583834" }, { "name": "Python", "bytes": "3855349" }, { "name": "Ruby", "bytes": "141818" }, { "name": "Shell", "bytes": "8888" }, { "name": "XSLT", "bytes": "49099" }, { "name": "Yacc", "bytes": "64128" } ] }
<ion-view> <ion-content style="background-color: deepskyblue;"> <div class="list"> <!--<ion-md-input placeholder="Username" ng-model="vm.user" highlight-color="balanced" type="text" ng-click='vm.createUesr()'></ion-md-input>--> <form novalidate name="form"> <ion-md-input placeholder="Email" ng-model="vm.email" highlight-color="balanced" type="email" ng-click='vm.createUser()' ng-minlength="10" name="email" ng-required="true"></ion-md-input> <ion-md-input placeholder="Password" highlight-color="energized" ng-model="vm.password" type="password" ng-click='vm.createUser()' ng-minlength="5" name="password" ng-required="true"></ion-md-input> </form> </div> <button id="createUser" class="button button-small button-border icon-left ion-email button-100" ng-click='vm.createUser()' ng-disabled='form.email.$invalid || form.password.$invalid ' ui-sref="app.splash">Create User</button> <!--<button class="button button-small button-border icon-left ion-email button-100" ng-click='vm.authWithPassword()'>Login by Email</button>--> </ion-content> </ion-view>
{ "content_hash": "47ea129c882615a67a60a010c4a81ff0", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 234, "avg_line_length": 89.61538461538461, "alnum_prop": 0.6618025751072961, "repo_name": "mkteagle/angular-game", "id": "465ad41e6a6dbe472d2e2562b026549a200ed2b5", "size": "1165", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/www/templates/registerEmail.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3736747" }, { "name": "HTML", "bytes": "124695" }, { "name": "JavaScript", "bytes": "18637535" } ] }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="ja"> <head> <!-- Generated by javadoc (1.8.0_20) on Tue Aug 25 07:27:06 JST 2015 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>クラス階層</title> <meta name="date" content="2015-08-25"> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> <script type="text/javascript" src="script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="\u30AF\u30E9\u30B9\u968E\u5C64"; } } catch(err) { } //--> </script> <noscript> <div>ブラウザのJavaScriptが無効になっています。</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="ナビゲーション・リンクをスキップ">ナビゲーション・リンクをスキップ</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="ナビゲーション"> <li><a href="canal/package-summary.html">パッケージ</a></li> <li>クラス</li> <li>使用</li> <li class="navBarCell1Rev">階層ツリー</li> <li><a href="deprecated-list.html">非推奨</a></li> <li><a href="index-files/index-1.html">索引</a></li> <li><a href="help-doc.html">ヘルプ</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>前</li> <li>次</li> </ul> <ul class="navList"> <li><a href="index.html?overview-tree.html" target="_top">フレーム</a></li> <li><a href="overview-tree.html" target="_top">フレームなし</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="allclasses-noframe.html">すべてのクラス</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 class="title">すべてのパッケージの階層</h1> <span class="packageHierarchyLabel">パッケージ階層:</span> <ul class="horizontal"> <li><a href="canal/package-tree.html">canal</a></li> </ul> </div> <div class="contentContainer"> <h2 title="クラス階層">クラス階層</h2> <ul> <li type="circle">java.lang.Object <ul> <li type="circle">javafx.application.Application <ul> <li type="circle">canal.<a href="canal/Main.html" title="canal内のクラス"><span class="typeNameLink">Main</span></a></li> </ul> </li> <li type="circle">canal.<a href="canal/Configuration.html" title="canal内のクラス"><span class="typeNameLink">Configuration</span></a></li> <li type="circle">canal.<a href="canal/ExpeditionLine.html" title="canal内のクラス"><span class="typeNameLink">ExpeditionLine</span></a></li> <li type="circle">canal.<a href="canal/ExpeditionLineDrawer.html" title="canal内のクラス"><span class="typeNameLink">ExpeditionLineDrawer</span></a></li> <li type="circle">canal.<a href="canal/Field.html" title="canal内のクラス"><span class="typeNameLink">Field</span></a></li> <li type="circle">canal.<a href="canal/GameContext.html" title="canal内のクラス"><span class="typeNameLink">GameContext</span></a></li> <li type="circle">canal.<a href="canal/Level.html" title="canal内のクラス"><span class="typeNameLink">Level</span></a></li> <li type="circle">canal.<a href="canal/Levels.html" title="canal内のクラス"><span class="typeNameLink">Levels</span></a></li> <li type="circle">javafx.scene.Node (implements javafx.event.EventTarget, javafx.css.Styleable) <ul> <li type="circle">javafx.scene.Parent <ul> <li type="circle">javafx.scene.layout.Region <ul> <li type="circle">javafx.scene.layout.Pane <ul> <li type="circle">canal.<a href="canal/Screen.html" title="canal内のクラス"><span class="typeNameLink">Screen</span></a> <ul> <li type="circle">canal.<a href="canal/GameScreen.html" title="canal内のクラス"><span class="typeNameLink">GameScreen</span></a></li> <li type="circle">canal.<a href="canal/ResultScreen.html" title="canal内のクラス"><span class="typeNameLink">ResultScreen</span></a></li> <li type="circle">canal.<a href="canal/TitleScreen.html" title="canal内のクラス"><span class="typeNameLink">TitleScreen</span></a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> <li type="circle">canal.<a href="canal/Point.html" title="canal内のクラス"><span class="typeNameLink">Point</span></a></li> <li type="circle">canal.<a href="canal/Region.html" title="canal内のクラス"><span class="typeNameLink">Region</span></a></li> <li type="circle">canal.<a href="canal/Sprite.html" title="canal内のクラス"><span class="typeNameLink">Sprite</span></a> <ul> <li type="circle">canal.<a href="canal/Enemy.html" title="canal内のクラス"><span class="typeNameLink">Enemy</span></a> <ul> <li type="circle">canal.<a href="canal/BigPentagonEnemy.html" title="canal内のクラス"><span class="typeNameLink">BigPentagonEnemy</span></a></li> <li type="circle">canal.<a href="canal/BigSquareEnemy.html" title="canal内のクラス"><span class="typeNameLink">BigSquareEnemy</span></a></li> <li type="circle">canal.<a href="canal/BigTriangleEnemy.html" title="canal内のクラス"><span class="typeNameLink">BigTriangleEnemy</span></a></li> <li type="circle">canal.<a href="canal/SquareEnemy.html" title="canal内のクラス"><span class="typeNameLink">SquareEnemy</span></a></li> <li type="circle">canal.<a href="canal/TriangleEnemy.html" title="canal内のクラス"><span class="typeNameLink">TriangleEnemy</span></a></li> </ul> </li> <li type="circle">canal.<a href="canal/Player.html" title="canal内のクラス"><span class="typeNameLink">Player</span></a></li> </ul> </li> <li type="circle">canal.<a href="canal/SpriteDrawer.html" title="canal内のクラス"><span class="typeNameLink">SpriteDrawer</span></a> <ul> <li type="circle">canal.<a href="canal/BigPentagonEnemyDrawer.html" title="canal内のクラス"><span class="typeNameLink">BigPentagonEnemyDrawer</span></a></li> <li type="circle">canal.<a href="canal/BigSquareEnemyDrawer.html" title="canal内のクラス"><span class="typeNameLink">BigSquareEnemyDrawer</span></a></li> <li type="circle">canal.<a href="canal/BigTriangleEnemyDrawer.html" title="canal内のクラス"><span class="typeNameLink">BigTriangleEnemyDrawer</span></a></li> <li type="circle">canal.<a href="canal/PlayerDrawer.html" title="canal内のクラス"><span class="typeNameLink">PlayerDrawer</span></a></li> <li type="circle">canal.<a href="canal/SquareEnemyDrawer.html" title="canal内のクラス"><span class="typeNameLink">SquareEnemyDrawer</span></a></li> <li type="circle">canal.<a href="canal/TriangleEnemyDrawer.html" title="canal内のクラス"><span class="typeNameLink">TriangleEnemyDrawer</span></a></li> </ul> </li> <li type="circle">canal.<a href="canal/Territory.html" title="canal内のクラス"><span class="typeNameLink">Territory</span></a></li> <li type="circle">canal.<a href="canal/TerritoryDrawer.html" title="canal内のクラス"><span class="typeNameLink">TerritoryDrawer</span></a></li> </ul> </li> </ul> <h2 title="列挙型階層">列挙型階層</h2> <ul> <li type="circle">java.lang.Object <ul> <li type="circle">java.lang.Enum&lt;E&gt; (implements java.lang.Comparable&lt;T&gt;, java.io.Serializable) <ul> <li type="circle">canal.<a href="canal/Territory.State.html" title="canal内の列挙型"><span class="typeNameLink">Territory.State</span></a></li> <li type="circle">canal.<a href="canal/GameContext.State.html" title="canal内の列挙型"><span class="typeNameLink">GameContext.State</span></a></li> <li type="circle">canal.<a href="canal/Direction.html" title="canal内の列挙型"><span class="typeNameLink">Direction</span></a></li> </ul> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="ナビゲーション・リンクをスキップ">ナビゲーション・リンクをスキップ</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="ナビゲーション"> <li><a href="canal/package-summary.html">パッケージ</a></li> <li>クラス</li> <li>使用</li> <li class="navBarCell1Rev">階層ツリー</li> <li><a href="deprecated-list.html">非推奨</a></li> <li><a href="index-files/index-1.html">索引</a></li> <li><a href="help-doc.html">ヘルプ</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>前</li> <li>次</li> </ul> <ul class="navList"> <li><a href="index.html?overview-tree.html" target="_top">フレーム</a></li> <li><a href="overview-tree.html" target="_top">フレームなし</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="allclasses-noframe.html">すべてのクラス</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "content_hash": "a6a62d0c268428bda2801a5e59e0c5c7", "timestamp": "", "source": "github", "line_count": 212, "max_line_length": 152, "avg_line_length": 41.52358490566038, "alnum_prop": 0.681358627740543, "repo_name": "calotocen/Canal", "id": "212e396f0c361978cd1cbe6c9e8158878f003156", "size": "9587", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/overview-tree.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "121731" } ] }
module Fog module Compute class RackspaceV2 class Real # Retrieves single metadatum item by key. # @param [String<images, servers>] collection type of metadata # @param [String] obj_id id of the object where the metadata is attached # @param [String] key the key of the metadata to retrieve # @return [Excon::Response] response: # * body [Hash]: # * meta [Hash]: # @raise [Fog::Compute::RackspaceV2::NotFound] - HTTP 404 # @raise [Fog::Compute::RackspaceV2::BadRequest] - HTTP 400 # @raise [Fog::Compute::RackspaceV2::InternalServerError] - HTTP 500 # @raise [Fog::Compute::RackspaceV2::ServiceError] # @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Get_Metadata_Item-d1e5507.html def get_metadata_item(collection, obj_id, key) request( :expects => 200, :method => 'GET', :path => "#{collection}/#{obj_id}/metadata/#{key}" ) end end class Mock def get_metadata_item(collection, obj_id, key) raise Fog::Compute::RackspaceV2::NotFound if obj_id == 0 response = Excon::Response.new response.status = 202 response.body = {"meta" => {"environment" => "dev"}} response end end end end end
{ "content_hash": "73b3d7d29f814cf3d44930ffa0c9edba", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 106, "avg_line_length": 36.31578947368421, "alnum_prop": 0.5797101449275363, "repo_name": "ralzate/Aerosanidad-Correciones", "id": "c5fbc6986a3b96ca0abb63e0011accef954a9e45", "size": "1380", "binary": false, "copies": "64", "ref": "refs/heads/master", "path": "vendor/bundle/ruby/2.1.0/gems/fog-1.35.0/lib/fog/rackspace/requests/compute_v2/get_metadata_item.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6750" }, { "name": "CoffeeScript", "bytes": "3898" }, { "name": "HTML", "bytes": "394687" }, { "name": "JavaScript", "bytes": "14915" }, { "name": "Ruby", "bytes": "2300529" } ] }
from ctypes import * from ctypes.util import find_library from os import path import sys __all__ = ['libsvm', 'svm_problem', 'svm_parameter', 'toPyModel', 'gen_svm_nodearray', 'print_null', 'svm_node', 'C_SVC', 'EPSILON_SVR', 'LINEAR', 'NU_SVC', 'NU_SVR', 'ONE_CLASS', 'POLY', 'PRECOMPUTED', 'PRINT_STRING_FUN', 'RBF', 'SIGMOID', 'c_double', 'svm_model'] try: dirname = path.dirname(path.abspath(__file__)) if sys.platform == 'win32': libsvm = CDLL(path.join(dirname, r'..\windows\libsvm.dll')) else: libsvm = CDLL(path.join(dirname, '../libsvm.so.2')) except: # For unix the prefix 'lib' is not considered. if find_library('svm'): libsvm = CDLL(find_library('svm')) elif find_library('libsvm'): libsvm = CDLL(find_library('libsvm')) else: raise Exception('LIBSVM library not found.') C_SVC = 0 NU_SVC = 1 ONE_CLASS = 2 EPSILON_SVR = 3 NU_SVR = 4 LINEAR = 0 POLY = 1 RBF = 2 SIGMOID = 3 PRECOMPUTED = 4 PRINT_STRING_FUN = CFUNCTYPE(None, c_char_p) def print_null(s): return def genFields(names, types): return list(zip(names, types)) def fillprototype(f, restype, argtypes): f.restype = restype f.argtypes = argtypes class svm_node(Structure): _names = ["index", "value"] _types = [c_int, c_double] _fields_ = genFields(_names, _types) def __str__(self): return '%d:%g' % (self.index, self.value) def gen_svm_nodearray(xi, feature_max=None, isKernel=None): if isinstance(xi, dict): index_range = xi.keys() elif isinstance(xi, (list, tuple)): if not isKernel: xi = [0] + xi # idx should start from 1 index_range = range(len(xi)) else: raise TypeError('xi should be a dictionary, list or tuple') if feature_max: assert(isinstance(feature_max, int)) index_range = filter(lambda j: j <= feature_max, index_range) if not isKernel: index_range = filter(lambda j:xi[j] != 0, index_range) index_range = sorted(index_range) ret = (svm_node * (len(index_range)+1))() ret[-1].index = -1 for idx, j in enumerate(index_range): ret[idx].index = j ret[idx].value = xi[j] max_idx = 0 if index_range: max_idx = index_range[-1] return ret, max_idx class svm_problem(Structure): _names = ["l", "y", "x"] _types = [c_int, POINTER(c_double), POINTER(POINTER(svm_node))] _fields_ = genFields(_names, _types) def __init__(self, y, x, isKernel=None): if len(y) != len(x): raise ValueError("len(y) != len(x)") self.l = l = len(y) max_idx = 0 x_space = self.x_space = [] for i, xi in enumerate(x): tmp_xi, tmp_idx = gen_svm_nodearray(xi,isKernel=isKernel) x_space += [tmp_xi] max_idx = max(max_idx, tmp_idx) self.n = max_idx self.y = (c_double * l)() for i, yi in enumerate(y): self.y[i] = yi self.x = (POINTER(svm_node) * l)() for i, xi in enumerate(self.x_space): self.x[i] = xi class svm_parameter(Structure): _names = ["svm_type", "kernel_type", "degree", "gamma", "coef0", "cache_size", "eps", "C", "nr_weight", "weight_label", "weight", "nu", "p", "shrinking", "probability"] _types = [c_int, c_int, c_int, c_double, c_double, c_double, c_double, c_double, c_int, POINTER(c_int), POINTER(c_double), c_double, c_double, c_int, c_int] _fields_ = genFields(_names, _types) def __init__(self, options = None): if options == None: options = '' self.parse_options(options) def __str__(self): s = '' attrs = svm_parameter._names + list(self.__dict__.keys()) values = map(lambda attr: getattr(self, attr), attrs) for attr, val in zip(attrs, values): s += (' %s: %s\n' % (attr, val)) s = s.strip() return s def set_to_default_values(self): self.svm_type = C_SVC; self.kernel_type = RBF self.degree = 3 self.gamma = 0 self.coef0 = 0 self.nu = 0.5 self.cache_size = 100 self.C = 1 self.eps = 0.001 self.p = 0.1 self.shrinking = 1 self.probability = 0 self.nr_weight = 0 self.weight_label = (c_int*0)() self.weight = (c_double*0)() self.cross_validation = False self.nr_fold = 0 self.print_func = cast(None, PRINT_STRING_FUN) def parse_options(self, options): if isinstance(options, list): argv = options elif isinstance(options, str): argv = options.split() else: raise TypeError("arg 1 should be a list or a str.") self.set_to_default_values() self.print_func = cast(None, PRINT_STRING_FUN) weight_label = [] weight = [] i = 0 while i < len(argv): if argv[i] == "-s": i = i + 1 self.svm_type = int(argv[i]) elif argv[i] == "-t": i = i + 1 self.kernel_type = int(argv[i]) elif argv[i] == "-d": i = i + 1 self.degree = int(argv[i]) elif argv[i] == "-g": i = i + 1 self.gamma = float(argv[i]) elif argv[i] == "-r": i = i + 1 self.coef0 = float(argv[i]) elif argv[i] == "-n": i = i + 1 self.nu = float(argv[i]) elif argv[i] == "-m": i = i + 1 self.cache_size = float(argv[i]) elif argv[i] == "-c": i = i + 1 self.C = float(argv[i]) elif argv[i] == "-e": i = i + 1 self.eps = float(argv[i]) elif argv[i] == "-p": i = i + 1 self.p = float(argv[i]) elif argv[i] == "-h": i = i + 1 self.shrinking = int(argv[i]) elif argv[i] == "-b": i = i + 1 self.probability = int(argv[i]) elif argv[i] == "-q": self.print_func = PRINT_STRING_FUN(print_null) elif argv[i] == "-v": i = i + 1 self.cross_validation = 1 self.nr_fold = int(argv[i]) if self.nr_fold < 2: raise ValueError("n-fold cross validation: n must >= 2") elif argv[i].startswith("-w"): i = i + 1 self.nr_weight += 1 nr_weight = self.nr_weight weight_label += [int(argv[i-1][2:])] weight += [float(argv[i])] else: raise ValueError("Wrong options") i += 1 libsvm.svm_set_print_string_function(self.print_func) self.weight_label = (c_int*self.nr_weight)() self.weight = (c_double*self.nr_weight)() for i in range(self.nr_weight): self.weight[i] = weight[i] self.weight_label[i] = weight_label[i] class svm_model(Structure): _names = ['param', 'nr_class', 'l', 'SV', 'sv_coef', 'rho', 'probA', 'probB', 'sv_indices', 'label', 'nSV', 'free_sv'] _types = [svm_parameter, c_int, c_int, POINTER(POINTER(svm_node)), POINTER(POINTER(c_double)), POINTER(c_double), POINTER(c_double), POINTER(c_double), POINTER(c_int), POINTER(c_int), POINTER(c_int), c_int] _fields_ = genFields(_names, _types) def __init__(self): self.__createfrom__ = 'python' def __del__(self): # free memory created by C to avoid memory leak if hasattr(self, '__createfrom__') and self.__createfrom__ == 'C': libsvm.svm_free_and_destroy_model(pointer(self)) def get_svm_type(self): return libsvm.svm_get_svm_type(self) def get_nr_class(self): return libsvm.svm_get_nr_class(self) def get_svr_probability(self): return libsvm.svm_get_svr_probability(self) def get_labels(self): nr_class = self.get_nr_class() labels = (c_int * nr_class)() libsvm.svm_get_labels(self, labels) return labels[:nr_class] def get_sv_indices(self): total_sv = self.get_nr_sv() sv_indices = (c_int * total_sv)() libsvm.svm_get_sv_indices(self, sv_indices) return sv_indices[:total_sv] def get_nr_sv(self): return libsvm.svm_get_nr_sv(self) def is_probability_model(self): return (libsvm.svm_check_probability_model(self) == 1) def get_sv_coef(self): return [tuple(self.sv_coef[j][i] for j in xrange(self.nr_class - 1)) for i in xrange(self.l)] def get_SV(self): result = [] for sparse_sv in self.SV[:self.l]: row = dict() i = 0 while True: row[sparse_sv[i].index] = sparse_sv[i].value if sparse_sv[i].index == -1: break i += 1 result.append(row) return result def toPyModel(model_ptr): """ toPyModel(model_ptr) -> svm_model Convert a ctypes POINTER(svm_model) to a Python svm_model """ if bool(model_ptr) == False: raise ValueError("Null pointer") m = model_ptr.contents m.__createfrom__ = 'C' return m fillprototype(libsvm.svm_train, POINTER(svm_model), [POINTER(svm_problem), POINTER(svm_parameter)]) fillprototype(libsvm.svm_cross_validation, None, [POINTER(svm_problem), POINTER(svm_parameter), c_int, POINTER(c_double)]) fillprototype(libsvm.svm_save_model, c_int, [c_char_p, POINTER(svm_model)]) fillprototype(libsvm.svm_load_model, POINTER(svm_model), [c_char_p]) fillprototype(libsvm.svm_get_svm_type, c_int, [POINTER(svm_model)]) fillprototype(libsvm.svm_get_nr_class, c_int, [POINTER(svm_model)]) fillprototype(libsvm.svm_get_labels, None, [POINTER(svm_model), POINTER(c_int)]) fillprototype(libsvm.svm_get_sv_indices, None, [POINTER(svm_model), POINTER(c_int)]) fillprototype(libsvm.svm_get_nr_sv, c_int, [POINTER(svm_model)]) fillprototype(libsvm.svm_get_svr_probability, c_double, [POINTER(svm_model)]) fillprototype(libsvm.svm_predict_values, c_double, [POINTER(svm_model), POINTER(svm_node), POINTER(c_double)]) fillprototype(libsvm.svm_predict, c_double, [POINTER(svm_model), POINTER(svm_node)]) fillprototype(libsvm.svm_predict_probability, c_double, [POINTER(svm_model), POINTER(svm_node), POINTER(c_double)]) fillprototype(libsvm.svm_free_model_content, None, [POINTER(svm_model)]) fillprototype(libsvm.svm_free_and_destroy_model, None, [POINTER(POINTER(svm_model))]) fillprototype(libsvm.svm_destroy_param, None, [POINTER(svm_parameter)]) fillprototype(libsvm.svm_check_parameter, c_char_p, [POINTER(svm_problem), POINTER(svm_parameter)]) fillprototype(libsvm.svm_check_probability_model, c_int, [POINTER(svm_model)]) fillprototype(libsvm.svm_set_print_string_function, None, [PRINT_STRING_FUN])
{ "content_hash": "5df6d82f149d1a2ff22305de817feed0", "timestamp": "", "source": "github", "line_count": 326, "max_line_length": 122, "avg_line_length": 29.392638036809817, "alnum_prop": 0.6376539344604467, "repo_name": "tomazas/icist2015", "id": "e1a4923c15cb3b399f8a1489db6f83da1df20b0e", "size": "9605", "binary": false, "copies": "33", "ref": "refs/heads/master", "path": "libsvm/python/svm.py", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "392" }, { "name": "C", "bytes": "71688" }, { "name": "C++", "bytes": "96257" }, { "name": "HTML", "bytes": "79048" }, { "name": "Java", "bytes": "100815" }, { "name": "M4", "bytes": "63095" }, { "name": "MATLAB", "bytes": "55191" }, { "name": "Makefile", "bytes": "3593" }, { "name": "Python", "bytes": "43862" } ] }
package org.jetbrains.plugins.ipnb; import com.intellij.psi.PsiFile; import com.jetbrains.python.inspections.PyDocstringInspection; import com.jetbrains.python.inspections.PyStatementEffectInspection; import com.jetbrains.python.inspections.PythonVisitorFilter; import org.jetbrains.annotations.NotNull; public class IpnbVisitorFilter implements PythonVisitorFilter { @Override public boolean isSupported(@NotNull final Class visitorClass, @NotNull final PsiFile file) { if (visitorClass == PyDocstringInspection.class || visitorClass == PyStatementEffectInspection.class) { return false; } return true; } }
{ "content_hash": "67058179cf5a7881dedb71e5f135b7e2", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 107, "avg_line_length": 35.27777777777778, "alnum_prop": 0.8047244094488188, "repo_name": "ol-loginov/intellij-community", "id": "46bcfdd5a8506cab905dac110587871b64e4c6e1", "size": "1235", "binary": false, "copies": "35", "ref": "refs/heads/master", "path": "python/ipnb/src/org/jetbrains/plugins/ipnb/IpnbVisitorFilter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AspectJ", "bytes": "182" }, { "name": "Batchfile", "bytes": "63659" }, { "name": "C", "bytes": "214180" }, { "name": "C#", "bytes": "1538" }, { "name": "C++", "bytes": "190028" }, { "name": "CSS", "bytes": "108843" }, { "name": "CoffeeScript", "bytes": "1759" }, { "name": "Cucumber", "bytes": "14382" }, { "name": "Erlang", "bytes": "10" }, { "name": "FLUX", "bytes": "57" }, { "name": "Groff", "bytes": "35232" }, { "name": "Groovy", "bytes": "2220132" }, { "name": "HTML", "bytes": "1676451" }, { "name": "J", "bytes": "5050" }, { "name": "JFlex", "bytes": "166194" }, { "name": "Java", "bytes": "146810567" }, { "name": "JavaScript", "bytes": "125292" }, { "name": "Kotlin", "bytes": "225413" }, { "name": "Makefile", "bytes": "2352" }, { "name": "NSIS", "bytes": "85968" }, { "name": "Objective-C", "bytes": "28634" }, { "name": "Perl6", "bytes": "26" }, { "name": "Protocol Buffer", "bytes": "6570" }, { "name": "Python", "bytes": "21486998" }, { "name": "Ruby", "bytes": "1213" }, { "name": "Scala", "bytes": "11698" }, { "name": "Shell", "bytes": "63323" }, { "name": "Smalltalk", "bytes": "64" }, { "name": "TeX", "bytes": "60798" }, { "name": "TypeScript", "bytes": "6152" }, { "name": "XSLT", "bytes": "113040" } ] }
 using System; using System.Collections.Generic; using System.IO; namespace MongoDB.Bson.IO { /// <summary> /// Represents a factory for IBsonBuffers. /// </summary> public static class ByteBufferFactory { /// <summary> /// Creates a buffer of the specified length. Depending on the length, either a SingleChunkBuffer or a MultiChunkBuffer will be created. /// </summary> /// <param name="chunkPool">The chunk pool.</param> /// <param name="length">The length.</param> /// <returns>A buffer.</returns> public static IByteBuffer Create(BsonChunkPool chunkPool, int length) { if (chunkPool == null) { throw new ArgumentNullException("pool"); } if (length <= 0) { throw new ArgumentOutOfRangeException("length"); } if (length < chunkPool.ChunkSize) { var chunk = chunkPool.AcquireChunk(); return new SingleChunkBuffer(chunk, 0, length, false); } else { var chunksNeeded = ((length - 1) / chunkPool.ChunkSize) + 1; var chunks = new List<BsonChunk>(chunksNeeded); for (int i = 0; i < chunksNeeded; i++) { chunks.Add(chunkPool.AcquireChunk()); } return new MultiChunkBuffer(chunks, 0, length, false); } } /// <summary> /// Loads a byte buffer from a stream (the first 4 bytes in the stream are the length of the data). /// Depending on the required capacity, either a SingleChunkBuffer or a MultiChunkBuffer will be created. /// </summary> /// <param name="stream">The stream.</param> /// <returns>A buffer.</returns> /// <exception cref="System.ArgumentNullException">stream</exception> public static IByteBuffer LoadLengthPrefixedDataFrom(Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } var streamReader = new BsonStreamReader(stream, Utf8Helper.StrictUtf8Encoding); var length = streamReader.ReadInt32(); var byteBuffer = Create(BsonChunkPool.Default, length); byteBuffer.Length = length; byteBuffer.WriteBytes(0, BitConverter.GetBytes(length), 0, 4); byteBuffer.LoadFrom(stream, 4, length - 4); byteBuffer.MakeReadOnly(); return byteBuffer; } } }
{ "content_hash": "9194ff985f3f0113713eefabe45327cd", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 144, "avg_line_length": 35.63513513513514, "alnum_prop": 0.5566932119833143, "repo_name": "antonnik/code-classifier", "id": "1ae6a07d7aba4d4c59248aebe154e0e433417de2", "size": "3219", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "naive_bayes/resources/c#/ByteBufferFactory.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "786556" }, { "name": "C#", "bytes": "7197222" }, { "name": "C++", "bytes": "1142843" }, { "name": "HTML", "bytes": "442" }, { "name": "Java", "bytes": "1964348" }, { "name": "JavaScript", "bytes": "1817078" }, { "name": "PHP", "bytes": "180152" }, { "name": "Perl", "bytes": "236747" }, { "name": "Perl6", "bytes": "11938" }, { "name": "Python", "bytes": "1301749" }, { "name": "Ruby", "bytes": "321339" }, { "name": "Scala", "bytes": "169585" } ] }
from __future__ import absolute_import from __future__ import division from __future__ import print_function import unittest import ray import subprocess import sys import tempfile import time class MultiNodeTest(unittest.TestCase): def setUp(self): # Start the Ray processes on this machine. out = subprocess.check_output( ["ray", "start", "--head"]).decode("ascii") # Get the redis address from the output. redis_substring_prefix = "redis_address=\"" redis_address_location = (out.find(redis_substring_prefix) + len(redis_substring_prefix)) redis_address = out[redis_address_location:] self.redis_address = redis_address.split("\"")[0] def tearDown(self): # Kill the Ray cluster. subprocess.Popen(["ray", "stop"]).wait() def testErrorIsolation(self): # Connect a driver to the Ray cluster. ray.init(redis_address=self.redis_address, driver_mode=ray.SILENT_MODE) # There shouldn't be any errors yet. self.assertEqual(len(ray.error_info()), 0) error_string1 = "error_string1" error_string2 = "error_string2" @ray.remote def f(): raise Exception(error_string1) # Run a remote function that throws an error. with self.assertRaises(Exception): ray.get(f.remote()) # Wait for the error to appear in Redis. while len(ray.error_info()) != 1: time.sleep(0.1) print("Waiting for error to appear.") # Make sure we got the error. self.assertEqual(len(ray.error_info()), 1) self.assertIn(error_string1, ray.error_info()[0][b"message"].decode("ascii")) # Start another driver and make sure that it does not receive this # error. Make the other driver throw an error, and make sure it # receives that error. driver_script = """ import ray import time ray.init(redis_address="{}") time.sleep(1) assert len(ray.error_info()) == 0 @ray.remote def f(): raise Exception("{}") try: ray.get(f.remote()) except Exception as e: pass while len(ray.error_info()) != 1: print(len(ray.error_info())) time.sleep(0.1) assert len(ray.error_info()) == 1 assert "{}" in ray.error_info()[0][b"message"].decode("ascii") print("success") """.format(self.redis_address, error_string2, error_string2) # Save the driver script as a file so we can call it using subprocess. with tempfile.NamedTemporaryFile() as f: f.write(driver_script.encode("ascii")) f.flush() out = subprocess.check_output([sys.executable, f.name]).decode("ascii") # Make sure the other driver succeeded. self.assertIn("success", out) # Make sure that the other error message doesn't show up for this # driver. self.assertEqual(len(ray.error_info()), 1) self.assertIn(error_string1, ray.error_info()[0][b"message"].decode("ascii")) ray.worker.cleanup() def testRemoteFunctionIsolation(self): # This test will run multiple remote functions with the same names in # two different drivers. Connect a driver to the Ray cluster. ray.init(redis_address=self.redis_address, driver_mode=ray.SILENT_MODE) # Start another driver and make sure that it can define and call its # own commands with the same names. driver_script = """ import ray import time ray.init(redis_address="{}") @ray.remote def f(): return 3 @ray.remote def g(x, y): return 4 for _ in range(10000): result = ray.get([f.remote(), g.remote(0, 0)]) assert result == [3, 4] print("success") """.format(self.redis_address) # Save the driver script as a file so we can call it using subprocess. with tempfile.NamedTemporaryFile() as f: f.write(driver_script.encode("ascii")) f.flush() out = subprocess.check_output([sys.executable, f.name]).decode("ascii") @ray.remote def f(): return 1 @ray.remote def g(x): return 2 for _ in range(10000): result = ray.get([f.remote(), g.remote(0)]) self.assertEqual(result, [1, 2]) # Make sure the other driver succeeded. self.assertIn("success", out) ray.worker.cleanup() class StartRayScriptTest(unittest.TestCase): def testCallingStartRayHead(self): # Test that we can call start-ray.sh with various command line # parameters. TODO(rkn): This test only tests the --head code path. We # should also test the non-head node code path. # Test starting Ray with no arguments. subprocess.check_output(["ray", "start", "--head"]).decode("ascii") subprocess.Popen(["ray", "stop"]).wait() # Test starting Ray with a number of workers specified. subprocess.check_output(["ray", "start", "--head", "--num-workers", "20"]) subprocess.Popen(["ray", "stop"]).wait() # Test starting Ray with a redis port specified. subprocess.check_output(["ray", "start", "--head", "--redis-port", "6379"]) subprocess.Popen(["ray", "stop"]).wait() # Test starting Ray with a node IP address specified. subprocess.check_output(["ray", "start", "--head", "--node-ip-address", "127.0.0.1"]) subprocess.Popen(["ray", "stop"]).wait() # Test starting Ray with an object manager port specified. subprocess.check_output(["ray", "start", "--head", "--object-manager-port", "12345"]) subprocess.Popen(["ray", "stop"]).wait() # Test starting Ray with the number of CPUs specified. subprocess.check_output(["ray", "start", "--head", "--num-cpus", "100"]) subprocess.Popen(["ray", "stop"]).wait() # Test starting Ray with the number of GPUs specified. subprocess.check_output(["ray", "start", "--head", "--num-gpus", "100"]) subprocess.Popen(["ray", "stop"]).wait() # Test starting Ray with all arguments specified. subprocess.check_output(["ray", "start", "--head", "--num-workers", "20", "--redis-port", "6379", "--object-manager-port", "12345", "--num-cpus", "100", "--num-gpus", "0"]) subprocess.Popen(["ray", "stop"]).wait() # Test starting Ray with invalid arguments. with self.assertRaises(Exception): subprocess.check_output(["ray", "start", "--head", "--redis-address", "127.0.0.1:6379"]) subprocess.Popen(["ray", "stop"]).wait() if __name__ == "__main__": unittest.main(verbosity=2)
{ "content_hash": "80f179f75e55f9df9d55a43942fa7839", "timestamp": "", "source": "github", "line_count": 213, "max_line_length": 79, "avg_line_length": 33.816901408450704, "alnum_prop": 0.562404553658198, "repo_name": "Wapaul1/ray", "id": "952e08da0c7026ef022477e91784f2e78e5aac65", "size": "7203", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/multi_node_test.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "92944" }, { "name": "C++", "bytes": "653846" }, { "name": "CMake", "bytes": "12971" }, { "name": "CSS", "bytes": "70" }, { "name": "HTML", "bytes": "396" }, { "name": "Jupyter Notebook", "bytes": "2507" }, { "name": "Python", "bytes": "954494" }, { "name": "Ruby", "bytes": "953" }, { "name": "Shell", "bytes": "27206" } ] }
<?xml version='1.0' encoding='utf-8'?> <!-- This is a sample XML file displayed when the user hasn't specified any quotes. --> <Quotes> <Quote> <Text>He asked me if I knew what time it was. I said, "Yes, but not right now."</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I've been doing a lot of abstract painting lately, extremely abstract. No brush, no paint, no canvas, I just think about it.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>You can't have everything. Where would you put it?</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>When I die, I'm leaving my body to science fiction.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I went to this restaurant last night that was set up like a big buffet in the shape of an Ouija board. You'd think about what kind of food you want, and the table would move across the floor to it.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I went to a general store. They wouldn't let me buy anything specifically.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I went down the street to the 24-hour grocery. When I got there, the guy was locking the front door. I said, "Hey, the sign says you're open 24 hours." He said, "Yes, but not in a row."</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>When I go shopping, I love to freak out salespeople. They ask me if they can help me and I say, "Have you got anything I'd like?" Then they ask me what size I need and I say, "Extra medium."</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I went to the hardware store and bought some used paint. It was in the shape of a house. I also bought some batteries, but they weren't included so I had to buy them again.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I bought my brother some gift-wrap for Christmas. I took it to the Gift Wrap Department and told them to wrap it, but in a different print so he would know when to stop unwrapping.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>Friday, I was in a bookstore and I started talking to a French-looking girl. She was a bilingual illiterate —she couldn't read in two different languages.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>Last week I bought a new phone. I took it out of the box, hooked it up to the wall. Pressed redial. The phone had a nervous breakdown.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I bought a self-learning record to learn Spanish. I turned it on and went to sleep; the record got stuck. The next day I could only stutter in Spanish.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I went down to the store and bought some blank cassette tapes. When I got home I put one in my cassette deck and turned it up full blast. I was walking around my house when I heard a knock on my door. It was my neighbor complaining about the noise. He's a mime.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I'm writing a book. I've got the page numbers done, so now I just have to fill in the rest.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I'm writing an unauthorized autobiography.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I just got out of the hospital. I was in a speed reading accident —I crashed into a bookmark.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I have a decaffeinated coffee table. You'd never know it to look at it.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>One time a cop pulled me over for running a stop sign. He said, "Didn't you see the stop sign?" I said, "Yeah, but I don't believe everything I read."</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>There's a fine line between fishing and standing on the shore looking like an idiot.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>A friend of mine is into Voodoo Acupuncture. You don't have to go. You'll just be walking down the street, and...Ooooohhhhhh, that feels better...</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I hate it when my foot falls asleep during the day because that means it's going to be up all night.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>When I woke up this morning my girlfriend asked me, "Did you sleep well?" I said, "No, I made a few mistakes."</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I was once arrested for walking in someone else's sleep.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>Some people are afraid of heights. Not me, I'm afraid of widths.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>Last year I went fishing with Salvador Dali. He was using a dotted line. He caught every other fish.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>When I was a little kid we had a sand box. It was a quicksand box. I was an only child. Eventually.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I don't know how she did it but my girlfriend got poison ivy on her brain and the only way she can scratch it is if she thinks about sandpaper.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>After they make styrofoam, what do they ship it in?</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I saw a subliminal advertising executive, but only for a second.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I have two very rare photographs. One is a picture of Houdini locking his keys in his car. The other is a photograph of Norman Rockwell beating up a child.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I stayed up all night playing poker with Tarot cards. I got a full house and four people died.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>George is a radio announcer, and when he walks under a bridge, you can't hear him talk.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I had some eyeglasses. I was walking down the street when suddenly the prescription ran out.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>When my kid turned two I was really anxious, because he'd doubled his age in a year. I thought, if this keeps up, by the time he's six he'll be ninety.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I had fried octopus last night. You have to be really quiet when you eat it, otherwise it emits a cloud of black smoke and falls on the floor.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>You know how it is when you go to be the subject of a psychology experiment and nobody else shows up and you think maybe that's part of the experiment? I'm like that all the time.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>A metaphor is like a simile.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>Every day, the hummingbird eats its own weight in food. You may wonder how it weighs the food. It doesn't —it just eats another hummingbird.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I listen to the police band on my CB radio. Once I dialed 911 and dedicated a crime to my girlfriend.</Text> <Attribution>Steven Wright</Attribution> </Quote> <Quote> <Text>I daydreamed that I was falling and just before I hit the ground, I fell asleep.</Text> <Attribution>Steven Wright</Attribution> </Quote> </Quotes>
{ "content_hash": "46da888b695ebaa833c7e46df996260e", "timestamp": "", "source": "github", "line_count": 171, "max_line_length": 279, "avg_line_length": 46.87134502923977, "alnum_prop": 0.7317529631940112, "repo_name": "pawrsccouk/Fortune-Saver", "id": "9e2938d7b1ecd805a0e0cfde6b955f83366136e2", "size": "8021", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Fortune/Default Quotes.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "69755" } ] }
End of preview.

No dataset card yet

Downloads last month
2