content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Mixed
Python
fix typos and minor inconsistencies
85e51a0f8f6bfbb2ca8c0b5e07f87e843313c3e9
<ide><path>docs/templates/faq.md <ide> conv_output = get_conv_output(input_data_dict) <ide> <ide> ### Isn't there a bug with Merge or Graph related to input concatenation? <ide> <del>Yes, there was a known bug with tensor concatenation in Thenao that was fixed early 2015. <add>Yes, there was a known bug with tensor concatenation in Theano that was fixed early 2015. <ide> Please upgrade to the latest version of Theano: <ide> <ide> ```bash <ide> Find out more in the [callbacks documentation](callbacks.md). <ide> <ide> ### How is the validation split computed? <ide> <del>If you set the `validation_split` arugment in `model.fit` to e.g. 0.1, then the validation data used will be the *last 10%* of the data. If you set it to 0.25, it will be the last 25% of the data, etc. <add>If you set the `validation_split` argument in `model.fit` to e.g. 0.1, then the validation data used will be the *last 10%* of the data. If you set it to 0.25, it will be the last 25% of the data, etc. <ide> <ide> <ide> --- <ide> When using stateful RNNs, it is therefore assumed that: <ide> <ide> To use statefulness in RNNs, you need to: <ide> <del>- explicitely specify the batch size you are using, by passing a `batch_input_shape` argument to the first layer in your model. It should be a tuple of integers, e.g. `(32, 10, 16)` for a 32-samples batch of sequences of 10 timesteps with 16 features per timestep. <add>- explicitly specify the batch size you are using, by passing a `batch_input_shape` argument to the first layer in your model. It should be a tuple of integers, e.g. `(32, 10, 16)` for a 32-samples batch of sequences of 10 timesteps with 16 features per timestep. <ide> - set `stateful=True` in your RNN layer(s). <ide> <ide> To reset the states accumulated: <ide><path>docs/templates/index.md <ide> <ide> ## You have just found Keras. <ide> <del>Keras is a minimalist, highly modular neural networks library, written in Python and capable of running either on top of either [TensorFlow](https://github.com/tensorflow/tensorflow) or [Theano](https://github.com/Theano/Theano). It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research. <add>Keras is a minimalist, highly modular neural networks library, written in Python and capable of running on top of either [TensorFlow](https://github.com/tensorflow/tensorflow) or [Theano](https://github.com/Theano/Theano). It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research. <ide> <ide> Use Keras if you need a deep learning library that: <ide> - allows for easy and fast prototyping (through total modularity, minimalism, and extensibility). <ide> Keras is compatible with: __Python 2.7-3.5__. <ide> <ide> - __Easy extensibility.__ New modules are dead simple to add (as new classes and functions), and existing modules provide ample examples. To be able to easily create new modules allows for total expressiveness, making Keras suitable for advanced research. <ide> <del>- __Work with Python__. No separate models configuration files in a declarative format. Models are described in Python code, which is compact, easier to debug, and allows for ease of extensibility. <add>- __Work with Python__. No separate model configuration files in a declarative format. Models are described in Python code, which is compact, easier to debug, and allows for ease of extensibility. <ide> <ide> <ide> ------------------ <ide> <ide> <ide> ## Getting started: 30 seconds to Keras <ide> <del>The core datastructure of Keras is a __model__, a way to organize layers. There are two types of models: [`Sequential`](/models/#sequential) and [`Graph`](/models/#graph). <add>The core data structure of Keras is a __model__, a way to organize layers. There are two types of models: [`Sequential`](/models/#sequential) and [`Graph`](/models/#graph). <ide> <ide> Here's the `Sequential` model (a linear pile of layers): <ide> <ide> Keras was initially developed as part of the research effort of project ONEIROS <ide> <ide> >_"Oneiroi are beyond our unravelling --who can be sure what tale they tell? Not all that men look for comes to pass. Two gates there are that give passage to fleeting Oneiroi; one is made of horn, one of ivory. The Oneiroi that pass through sawn ivory are deceitful, bearing a message that will not be fulfilled; those that come out through polished horn have truth behind them, to be accomplished for men who see them."_ Homer, Odyssey 19. 562 ff (Shewring translation). <ide> <del>------------------ <ide>\ No newline at end of file <add>------------------ <ide><path>keras/activations.py <ide> def hard_sigmoid(x): <ide> <ide> def linear(x): <ide> ''' <del> The function returns the variable that is passed in, so all types work <add> The function returns the variable that is passed in, so all types work. <ide> ''' <ide> return x <ide> <ide><path>keras/backend/theano_backend.py <ide> <ide> <ide> def _on_gpu(): <del> '''Returns whether the session is set to <add> '''Return whether the session is set to <ide> run on GPU or not (i.e. on CPU). <ide> ''' <ide> return theano.config.device[:3] == 'gpu' <ide> <ide> <ide> if _on_gpu(): <ide> '''Import cuDNN only if running on GPU: <del> not having Cuda install should not <add> not having Cuda installed should not <ide> prevent from running the present code. <ide> ''' <ide> from theano.sandbox.cuda import dnn <ide> def permute_dimensions(x, pattern): <ide> <ide> <ide> def repeat_elements(x, rep, axis): <del> '''Repeats the elements of a tensor along an axis, like np.repeat <add> '''Repeat the elements of a tensor along an axis, like np.repeat. <ide> <ide> If x has shape (s1, s2, s3) and axis=1, the output <del> will have shape (s1, s2 * rep, s3) <add> will have shape (s1, s2 * rep, s3). <ide> ''' <ide> return T.repeat(x, rep, axis=axis) <ide> <ide> def repeat(x, n): <del> '''Repeat a 2D tensor: <add> '''Repeat a 2D tensor. <ide> <del> if x has shape (samples, dim) and n=2, <del> the output will have shape (samples, 2, dim) <add> If x has shape (samples, dim) and n=2, <add> the output will have shape (samples, 2, dim). <ide> ''' <ide> tensors = [x] * n <ide> stacked = T.stack(*tensors) <ide> def gradients(loss, variables): <ide> <ide> def rnn(step_function, inputs, initial_states, <ide> go_backwards=False, masking=True): <del> '''Iterates over the time dimension of a tensor. <add> '''Iterate over the time dimension of a tensor. <ide> <ide> Parameters <ide> ---------- <ide><path>keras/callbacks.py <ide> def __init__(self, filepath, monitor='val_loss', verbose=0, <ide> <ide> if mode not in ['auto', 'min', 'max']: <ide> warnings.warn('ModelCheckpoint mode %s is unknown, ' <del> 'fallback to auto mode' % (self.mode), <add> 'fallback to auto mode.' % (self.mode), <ide> RuntimeWarning) <ide> mode = 'auto' <ide> <ide> class EarlyStopping(Callback): <ide> mode: one of {auto, min, max}. In 'min' mode, <ide> training will stop when the quantity <ide> monitored has stopped decreasing; in 'max' <del> mode it will stopped when the quantity <add> mode it will stop when the quantity <ide> monitored has stopped increasing. <ide> ''' <ide> def __init__(self, monitor='val_loss', patience=0, verbose=0, mode='auto'): <ide> def __init__(self, monitor='val_loss', patience=0, verbose=0, mode='auto'): <ide> <ide> if mode not in ['auto', 'min', 'max']: <ide> warnings.warn('EarlyStopping mode %s is unknown, ' <del> 'fallback to auto mode' % (self.mode), RuntimeWarning) <add> 'fallback to auto mode.' % (self.mode), RuntimeWarning) <ide> mode = 'auto' <ide> <ide> if mode == 'min': <ide> class RemoteMonitor(Callback): <ide> Requires the `requests` library. <ide> <ide> # Arguments <del> root: root url to which the events will be send (at the end <add> root: root url to which the events will be sent (at the end <ide> of every epoch). Events are sent to <ide> `root + '/publish/epoch/end/'`. Calls are HTTP POST, <ide> with a `data` argument which is a JSON-encoded dictionary <ide> def __init__(self, log_dir='./logs', histogram_freq=0): <ide> super(Callback, self).__init__() <ide> if K._BACKEND != 'tensorflow': <ide> raise Exception('TensorBoard callback only works ' <del> 'with the TensorFlow backend') <add> 'with the TensorFlow backend.') <ide> self.log_dir = log_dir <ide> self.histogram_freq = histogram_freq <ide> <ide><path>keras/initializations.py <ide> def orthogonal(shape, scale=1.1): <ide> def identity(shape, scale=1): <ide> if len(shape) != 2 or shape[0] != shape[1]: <ide> raise Exception('Identity matrix initialization can only be used ' <del> 'for 2D square matrices') <add> 'for 2D square matrices.') <ide> else: <ide> return K.variable(scale * np.identity(shape[0])) <ide> <ide><path>keras/layers/containers.py <ide> def updates(self): <ide> @property <ide> def state_updates(self): <ide> """ <del> Returns the `updates` from all layers in the sequence that are <add> Return the `updates` from all layers in the sequence that are <ide> stateful. This is useful for separating _training_ updates and <ide> _prediction_ updates for when we need to update a layers internal state <ide> during a stateful prediction. <ide> def updates(self): <ide> @property <ide> def state_updates(self): <ide> """ <del> Returns the `updates` from all nodes in that graph for nodes that are <add> Return the `updates` from all nodes in that graph for nodes that are <ide> stateful. This is useful for separating _training_ updates and <ide> _prediction_ updates for when we need to update a layers internal state <ide> during a stateful prediction. <ide><path>keras/layers/convolutional.py <ide> def _pooling_function(self, inputs, pool_size, strides, <ide> <ide> <ide> class UpSampling1D(Layer): <del> '''Repeats each temporal step `length` times along the time axis. <add> '''Repeat each temporal step `length` times along the time axis. <ide> <ide> # Input shape <ide> 3D tensor with shape: `(samples, steps, features)`. <ide> def get_config(self): <ide> <ide> <ide> class UpSampling2D(Layer): <del> '''Repeats the rows and columns of the data <add> '''Repeat the rows and columns of the data <ide> by size[0] and size[1] respectively. <ide> <ide> # Input shape <ide><path>keras/layers/core.py <ide> def set_previous(self, layer, connection_map={}): <ide> ' but previous layer has output_shape ' + <ide> str(layer.output_shape)) <ide> if layer.get_output_mask() is not None: <del> assert self.supports_masked_input(), 'Cannot connect non-masking layer to layer with masked output' <add> assert self.supports_masked_input(), 'Cannot connect non-masking layer to layer with masked output.' <ide> self.previous = layer <ide> self.build() <ide> <ide> def get_output(self, train=False): <ide> for i in range(len(self.layers)): <ide> X = self.layers[i].get_output(train) <ide> if X.name is None: <del> raise ValueError('merge_mode="join" only works with named inputs') <add> raise ValueError('merge_mode="join" only works with named inputs.') <ide> else: <ide> inputs[X.name] = X <ide> return inputs <ide> def get_output(self, train=False): <ide> output = output.dimshuffle((0, 'x')) <ide> return output <ide> else: <del> raise Exception('Unknown merge mode') <add> raise Exception('Unknown merge mode.') <ide> <ide> def get_input(self, train=False): <ide> res = [] <ide> class Flatten(Layer): <ide> '''Flatten the input. Does not affect the batch size. <ide> <ide> # Input shape <del> Arbitrary, although all dimensions in the input shaped must be fixed. <add> Arbitrary, although all dimensions in the input shape must be fixed. <ide> Use the keyword argument `input_shape` <ide> (tuple of integers, does not include the samples axis) <ide> when using this layer as the first layer in a model. <ide> class LambdaMerge(Lambda): <ide> def __init__(self, layers, function, output_shape=None): <ide> if len(layers) < 2: <ide> raise Exception('Please specify two or more input layers ' <del> '(or containers) to merge') <add> '(or containers) to merge.') <ide> self.layers = layers <ide> self.params = [] <ide> self.regularizers = [] <ide> def output_shape(self): <ide> output_shape_func = types.FunctionType(output_shape_func, globals()) <ide> shape = output_shape_func(input_shapes) <ide> if type(shape) not in {list, tuple}: <del> raise Exception('output_shape function must return a tuple') <add> raise Exception('output_shape function must return a tuple.') <ide> return tuple(shape) <ide> <ide> def get_params(self): <ide> def __init__(self, layer, inputs, merge_mode='concat', <ide> <ide> if merge_mode in {'cos', 'dot'}: <ide> if len(inputs) > 2: <del> raise Exception(merge_mode + ' merge takes exactly 2 layers') <add> raise Exception(merge_mode + ' merge takes exactly 2 layers.') <ide> <ide> self.layer = layer <ide> self.trainable = layer.trainable <ide> def get_output_join(self, train=False): <ide> X = self.get_output_at(i, train) <ide> if X.name is None: <ide> raise ValueError('merge_mode="join" ' <del> 'only works with named inputs') <add> 'only works with named inputs.') <ide> o[X.name] = X <ide> return o <ide> <ide> def get_config(self): <ide> <ide> class SiameseHead(Layer): <ide> '''This layer should be added only on top of a Siamese layer <del> with merge_mode = None <add> with merge_mode = None. <ide> <ide> Outputs the output of the Siamese layer at a given index, <del> specified by the head argument <add> specified by the head argument. <ide> <ide> # Arguments <ide> head: The index at which the output of the Siamese layer <ide> def set_previous(self, layer): <ide> <ide> def add_shared_layer(layer, inputs): <ide> '''Use this function to add a shared layer across <del> multiple Sequential models without merging the outputs <add> multiple Sequential models without merging the outputs. <ide> ''' <ide> input_layers = [l.layers[-1] for l in inputs] <ide> s = Siamese(layer, input_layers, merge_mode=None) <ide> def add_shared_layer(layer, inputs): <ide> <ide> class Highway(Layer): <ide> '''Densely connected highway network, <del> a natural extension of LSTMs to feedforward networks <add> a natural extension of LSTMs to feedforward networks. <ide> <ide> cite: http://arxiv.org/pdf/1505.00387v2.pdf <ide> <ide><path>keras/layers/embeddings.py <ide> <ide> <ide> class Embedding(Layer): <del> '''Turn positive integers (indexes) into denses vectors of fixed size. <add> '''Turn positive integers (indexes) into dense vectors of fixed size. <ide> eg. [[4], [20]] -> [[0.25, 0.1], [0.6, -0.2]] <ide> <del> This layer can only be used as the first layer in a model. <add> This layer can only be used as the first layer in a model. <ide> <ide> # Input shape <ide> 2D tensor with shape: `(nb_samples, sequence_length)`. <ide> class Embedding(Layer): <ide> This is useful for [recurrent layers](recurrent.md) which may take <ide> variable length input. If this is `True` then all subsequent layers <ide> in the model need to support masking or an exception will be raised. <del> input_length: Length of input sequences, when it is constantself. <add> input_length: Length of input sequences, when it is constant. <ide> This argument is required if you are going to connect <ide> `Flatten` then `Dense` layers upstream <ide> (without it, the shape of the dense outputs cannot be computed). <ide><path>keras/layers/normalization.py <ide> class BatchNormalization(Layer): <ide> '''Normalize the activations of the previous layer at each batch, <ide> i.e. applies a transformation that maintains the mean activation <del> close to 0. and the activation standard deviation close to 1. <add> close to 0 and the activation standard deviation close to 1. <ide> <ide> # Input shape <ide> Arbitrary. Use the keyword argument `input_shape` <ide><path>keras/layers/recurrent.py <ide> class Recurrent(MaskedLayer): <ide> return_sequences: Boolean. Whether to return the last output <ide> in the output sequence, or the full sequence. <ide> go_backwards: Boolean (default False). <del> If True, rocess the input sequence backwards. <add> If True, process the input sequence backwards. <ide> stateful: Boolean (default False). If True, the last state <ide> for each sample at index i in a batch will be used as initial <ide> state for the sample of index i in the following batch. <ide> class Recurrent(MaskedLayer): <ide> `Flatten` then `Dense` layers upstream <ide> (without it, the shape of the dense outputs cannot be computed). <ide> Note that if the recurrent layer is not the first layer <del> in your model, you would need to specify the input Length <add> in your model, you would need to specify the input length <ide> at the level of the first layer <ide> (e.g. via the `input_shape` argument) <ide> <ide> def get_output(self, train=False): <ide> if K._BACKEND == 'tensorflow': <ide> if not self.input_shape[1]: <ide> raise Exception('When using TensorFlow, you should define ' + <del> 'explicitely the number of timesteps of ' + <add> 'explicitly the number of timesteps of ' + <ide> 'your sequences. Make sure the first layer ' + <ide> 'has a "batch_input_shape" argument ' + <ide> 'including the samples axis.') <ide><path>keras/models.py <ide> def slice_X(X, start=None, stop=None): <ide> ''' <ide> if type(X) == list: <ide> if hasattr(start, '__len__'): <del> # hdf5 dataset only support list object as indices <add> # hdf5 datasets only support list objects as indices <ide> if hasattr(start, 'shape'): <ide> start = start.tolist() <ide> return [x[start] for x in X] <ide> def weighted(y_true, y_pred, weights, mask=None): <ide> # mask should have the same shape as score_array <ide> score_array *= mask <ide> # the loss per batch should be proportional <del> # to the number of unmasked sampled. <add> # to the number of unmasked samples. <ide> score_array /= K.mean(mask) <ide> <ide> # reduce score_array to 1D <ide> def fit(self, X, y, batch_size=128, nb_epoch=100, verbose=1, callbacks=[], <ide> show_accuracy=False, class_weight=None, sample_weight=None): <ide> '''Train the model for a fixed number of epochs. <ide> <del> Returns a history object. It `history` attribute is a record of <add> Returns a history object. Its `history` attribute is a record of <ide> training loss values at successive epochs, <ide> as well as validation loss values (if applicable). <ide> <ide> def fit(self, data, batch_size=128, nb_epoch=100, verbose=1, callbacks=[], <ide> class_weight={}, sample_weight={}): <ide> '''Train the model for a fixed number of epochs. <ide> <del> Returns a history object. It `history` attribute is a record of <add> Returns a history object. Its `history` attribute is a record of <ide> training loss values at successive epochs, <ide> as well as validation loss values (if applicable). <ide> <ide><path>keras/objectives.py <ide> def hinge(y_true, y_pred): <ide> <ide> <ide> def categorical_crossentropy(y_true, y_pred): <del> '''Expects a binary class matrix instead of a vector of scalar classes <add> '''Expects a binary class matrix instead of a vector of scalar classes. <ide> ''' <ide> return K.mean(K.categorical_crossentropy(y_pred, y_true), axis=-1) <ide> <ide><path>keras/preprocessing/text.py <ide> def __init__(self, nb_words=None, filters=base_filter(), <ide> By default, all punctuation is removed, turning the texts into <ide> space-separated sequences of words <ide> (words maybe include the `'` character). These sequences are then <del> splits into lists of tokens. They will then be indexed or vectorized. <add> split into lists of tokens. They will then be indexed or vectorized. <ide> <ide> `0` is a reserved index that won't be assigned to any word. <ide> ''' <ide> def sequences_to_matrix(self, sequences, mode="binary"): <ide> if self.word_index: <ide> nb_words = len(self.word_index) + 1 <ide> else: <del> raise Exception("Specify a dimension (nb_words argument), or fit on some text data first") <add> raise Exception("Specify a dimension (nb_words argument), or fit on some text data first.") <ide> else: <ide> nb_words = self.nb_words <ide> <ide> if mode == "tfidf" and not self.document_count: <del> raise Exception("Fit the Tokenizer on some data before using tfidf mode") <add> raise Exception("Fit the Tokenizer on some data before using tfidf mode.") <ide> <ide> X = np.zeros((len(sequences), nb_words)) <ide> for i, seq in enumerate(sequences): <ide><path>keras/utils/np_utils.py <ide> <ide> def to_categorical(y, nb_classes=None): <ide> '''Convert class vector (integers from 0 to nb_classes) <del> to binary class matrix, for use with categorical_crossentropy <add> to binary class matrix, for use with categorical_crossentropy. <ide> ''' <ide> y = np.asarray(y, dtype='int32') <ide> if not nb_classes: <ide><path>keras/utils/visualize_util.py <ide> def __call__(self, model, recursive=True, show_shape=False, <ide> <ide> def to_graph(model, **kwargs): <ide> """ <del> `recursive` controls wether we recursively explore container layers <del> `show_shape` controls wether the shape is shown in the graph <add> `recursive` controls whether we recursively explore container layers <add> `show_shape` controls whether the shape is shown in the graph <ide> """ <ide> return ModelToDot()(model, **kwargs) <ide>
17
Python
Python
set default path for eucalyptus
b0b3f0a3c0311e960758c23a3a52f02e744010ac
<ide><path>libcloud/drivers/ec2.py <ide> class EucNodeDriver(EC2NodeDriver): <ide> <ide> def __init__(self, key, secret=None, secure=True, host=None, path=None, port=None): <ide> super(EucNodeDriver, self).__init__(key, secret, secure, host, port) <del> if path: <del> self.path = path <add> if path is None: <add> path = "/services/Eucalyptus" <add> self.path = path <ide> <ide> def list_locations(self): <ide> raise NotImplementedError, \
1
Java
Java
add getcontextpath to serverhttprequest
0bace1b0ae7aec176607a8ffdbf3497bab7755a5
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/ServerHttpRequest.java <ide> * Represents a reactive server-side HTTP request <ide> * <ide> * @author Arjen Poutsma <add> * @author Rossen Stoyanchev <ide> * @since 5.0 <ide> */ <ide> public interface ServerHttpRequest extends HttpRequest, ReactiveHttpInputMessage { <ide> <add> <add> // TODO: https://jira.spring.io/browse/SPR-14726 <add> <add> /** <add> * Returns the portion of the URL path that represents the context path for <add> * the current {@link HttpHandler}. The context path is always at the <add> * beginning of the request path. It starts with "/" but but does not end <add> * with "/". This method may return an empty string if no context path is <add> * configured. <add> * @return the context path (not decoded) or an empty string <add> */ <add> default String getContextPath() { <add> return ""; <add> } <add> <ide> /** <ide> * Return a read-only map with parsed and decoded query parameter values. <ide> */ <ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java <ide> public HttpMethod getMethod() { <ide> return HttpMethod.valueOf(getServletRequest().getMethod()); <ide> } <ide> <add> @Override <add> public String getContextPath() { <add> return getServletRequest().getContextPath(); <add> } <add> <ide> @Override <ide> protected URI initUri() throws URISyntaxException { <ide> StringBuffer url = this.request.getRequestURL(); <ide><path>spring-web/src/main/java/org/springframework/web/util/HttpRequestPathHelper.java <ide> import java.util.LinkedHashMap; <ide> import java.util.Map; <ide> <add>import org.springframework.http.server.reactive.ServerHttpRequest; <ide> import org.springframework.util.LinkedMultiValueMap; <ide> import org.springframework.util.MultiValueMap; <add>import org.springframework.util.StringUtils; <ide> import org.springframework.web.server.ServerWebExchange; <ide> <ide> /** <ide> public boolean shouldUrlDecode() { <ide> <ide> <ide> public String getLookupPathForRequest(ServerWebExchange exchange) { <del> String path = exchange.getRequest().getURI().getRawPath(); <add> String path = getPathWithinApplication(exchange.getRequest()); <ide> return (this.shouldUrlDecode() ? decode(exchange, path) : path); <ide> } <ide> <add> private String getPathWithinApplication(ServerHttpRequest request) { <add> String contextPath = request.getContextPath(); <add> String path = request.getURI().getRawPath(); <add> if (!StringUtils.hasText(contextPath)) { <add> return path; <add> } <add> return (path.length() > contextPath.length() ? path.substring(contextPath.length()) : ""); <add> } <add> <ide> private String decode(ServerWebExchange exchange, String path) { <ide> // TODO: look up request encoding? <ide> try {
3
PHP
PHP
add command output to the finished event
545c30d9158fd79126b3d336a97f4c7a07739fac
<ide><path>src/Illuminate/Console/Application.php <ide> public function run(InputInterface $input = null, OutputInterface $output = null <ide> $exitCode = parent::run($input, $output); <ide> <ide> $this->events->fire( <del> new Events\CommandFinished($commandName, $input, $exitCode) <add> new Events\CommandFinished($commandName, $input, $output, $exitCode) <ide> ); <ide> <ide> return $exitCode; <ide><path>src/Illuminate/Console/Events/CommandFinished.php <ide> namespace Illuminate\Console\Events; <ide> <ide> use Symfony\Component\Console\Input\InputInterface; <add>use Symfony\Component\Console\Output\OutputInterface; <ide> <ide> class CommandFinished <ide> { <ide> class CommandFinished <ide> */ <ide> public $exitCode; <ide> <add> /** <add> * The command output. <add> * <add> * @var \Symfony\Component\Console\Output\OutputInterface <add> */ <add> protected $output; <add> <ide> /** <ide> * Create a new event instance. <ide> * <ide> * @param string $command <ide> * @param \Symfony\Component\Console\Input\InputInterface $input <add> * @param \Symfony\Component\Console\Output\OutputInterface $output <ide> * @param int $exitCode <del> * @return void <ide> */ <del> public function __construct($command, InputInterface $input, $exitCode) <add> public function __construct($command, InputInterface $input, OutputInterface $output, $exitCode) <ide> { <ide> $this->command = $command; <ide> $this->input = $input; <add> $this->output = $output; <ide> $this->exitCode = $exitCode; <ide> } <ide> }
2
Javascript
Javascript
add test for split
aa1ef3ba3b92d427272ebfa9326ceb7c1021aa76
<ide><path>test/core/split-test.js <add>require("../env"); <add>require("../../d3"); <add> <add>var vows = require("vows"), <add> assert = require("assert"); <add> <add>var suite = vows.describe("d3.split"); <add> <add>suite.addBatch({ <add> "split": { <add> topic: function() { <add> return d3.split; <add> }, <add> "splits an array into arrays": function(split) { <add> var a = {}, b = {}, c = {}, d = {}, e = {}, f = {}; <add> assert.deepEqual(d3.split([a, null, b, c, undefined, d, e, f]), [[a], [b, c], [d, e, f]]); <add> }, <add> "splits using the specified function": function(split) { <add> assert.deepEqual(d3.split([1, 0, 2, 3, -1, 4, 5, 6], function(d) { return d <= 0; }), [[1], [2, 3], [4, 5, 6]]); <add> assert.deepEqual(d3.split([1, 0, 2, 3, -1, 4, 5, 6], function(d, i) { return i & 1; }), [[1], [2], [-1], [5]]); <add> }, <add> "ignores delimiters at the start or end": function(split) { <add> var a = {}, b = {}, c = {}; <add> assert.deepEqual(d3.split([null, a, b, null, c]), [[a, b], [c]]); <add> assert.deepEqual(d3.split([a, b, null, c, null]), [[a, b], [c]]); <add> assert.deepEqual(d3.split([null, a, b, null, c, null]), [[a, b], [c]]); <add> assert.deepEqual(d3.split([undefined, a, b, undefined, c]), [[a, b], [c]]); <add> assert.deepEqual(d3.split([a, b, undefined, c, undefined]), [[a, b], [c]]); <add> assert.deepEqual(d3.split([undefined, a, b, undefined, c, undefined]), [[a, b], [c]]); <add> } <add> } <add>}); <add> <add>suite.export(module);
1
PHP
PHP
show publishable tags in addition to providers
117fe4501d93119022f2e653e55dd961dddb22ff
<ide><path>src/Illuminate/Foundation/Console/VendorPublishCommand.php <ide> class VendorPublishCommand extends Command <ide> */ <ide> protected $files; <ide> <add> /** <add> * The provider to publish. <add> * <add> * @var string <add> */ <add> protected $provider = null; <add> <add> /** <add> * The tags to publish. <add> * <add> * @var array <add> */ <add> protected $tags = []; <add> <ide> /** <ide> * The console command signature. <ide> * <ide> public function __construct(Filesystem $files) <ide> */ <ide> public function fire() <ide> { <del> $tags = $this->option('tag') ?: [null]; <add> $this->setProviderOrTagsToPublish(); <add> <add> $tags = $this->tags ?: [null]; <ide> <del> foreach ((array) $tags as $tag) { <add> foreach ($tags as $tag) { <ide> $this->publishTag($tag); <ide> } <add> <add> $this->info('Publishing complete.'); <ide> } <ide> <ide> /** <del> * Publishes the assets for a tag. <add> * Determine the provider or tag(s) to publish. <ide> * <del> * @param string $tag <del> * @return mixed <add> * @return void <ide> */ <del> protected function publishTag($tag) <add> protected function setProviderOrTagsToPublish() <ide> { <del> foreach ($this->pathsToPublish($tag) as $from => $to) { <del> $this->publishItem($from, $to); <add> if ($this->option('all')) { <add> return; <ide> } <ide> <del> $this->info('Publishing complete.'); <add> $this->provider = $this->option('provider'); <add> <add> $this->tags = (array) $this->option('tag'); <add> <add> if ($this->provider || $this->tags) { <add> return; <add> } <add> <add> $this->promptForProviderOrTag(); <ide> } <ide> <ide> /** <del> * Determine the provider to publish. <add> * Prompt for which provider or tag to publish. <ide> * <del> * @return mixed <add> * @return void <ide> */ <del> protected function providerToPublish() <add> protected function promptForProviderOrTag() <ide> { <del> if ($this->option('all')) { <del> return null; <del> } <add> $choice = $this->choice( <add> "Which provider or tag's files would you like to publish?", <add> $choices = $this->publishableChoices() <add> ); <ide> <del> if ($this->option('provider')) { <del> return $this->option('provider'); <add> if ($choice == $choices[0]) { <add> return; <ide> } <ide> <del> $choice = $this->choice( <del> "Which package's files would you like to publish?", <del> array_merge( <del> [$all = '<comment>Publish files from all packages listed below</comment>'], <del> ServiceProvider::providersAvailableToPublish() <del> ) <add> $this->parseChoice($choice); <add> } <add> <add> /** <add> * The choices available via the prompt. <add> * <add> * @return array <add> */ <add> protected function publishableChoices() <add> { <add> return array_merge( <add> ['<comment>Publish files from all providers and tags listed below</comment>'], <add> preg_filter('/^/', '<comment>Provider: </comment>', ServiceProvider::publishableProviders()), <add> preg_filter('/^/', '<comment>Tag: </comment>', ServiceProvider::publishableGroups()) <ide> ); <add> } <add> <add> /** <add> * Parse the answer that was given via the prompt. <add> * <add> * @param string $choice <add> * @return void <add> */ <add> protected function parseChoice($choice) <add> { <add> list($type, $value) = explode(': ', strip_tags($choice)); <add> <add> if ($type == 'Provider') { <add> $this->provider = $value; <add> } elseif ($type == 'Tag') { <add> $this->tags = [$value]; <add> } <add> } <ide> <del> return $choice == $all ? null : $choice; <add> /** <add> * Publishes the assets for a tag. <add> * <add> * @param string $tag <add> * @return mixed <add> */ <add> protected function publishTag($tag) <add> { <add> foreach ($this->pathsToPublish($tag) as $from => $to) { <add> $this->publishItem($from, $to); <add> } <ide> } <ide> <ide> /** <ide> protected function providerToPublish() <ide> protected function pathsToPublish($tag) <ide> { <ide> return ServiceProvider::pathsToPublish( <del> $this->providerToPublish(), $tag <add> $this->provider, $tag <ide> ); <ide> } <ide> <ide><path>src/Illuminate/Support/ServiceProvider.php <ide> protected function addPublishGroup($group, $paths) <ide> * <ide> * @return array <ide> */ <del> public static function providersAvailableToPublish() <add> public static function publishableProviders() <ide> { <ide> return array_keys(static::$publishes); <ide> } <ide> <add> /** <add> * Get the groups available for publishing. <add> * <add> * @return array <add> */ <add> public static function publishableGroups() <add> { <add> return array_keys(static::$publishGroups); <add> } <add> <ide> /** <ide> * Get the paths to publish. <ide> * <ide><path>tests/Support/SupportServiceProviderTest.php <ide> public function tearDown() <ide> m::close(); <ide> } <ide> <del> public function testGetAvailableServiceProvidersToPublish() <add> public function testPublishableServiceProviders() <ide> { <del> $availableToPublish = ServiceProvider::providersAvailableToPublish(); <add> $toPublish = ServiceProvider::publishableProviders(); <ide> $expected = [ <ide> 'Illuminate\Tests\Support\ServiceProviderForTestingOne', <ide> 'Illuminate\Tests\Support\ServiceProviderForTestingTwo', <ide> ]; <del> $this->assertEquals($expected, $availableToPublish, 'Publishable service providers do not return expected set of providers.'); <add> $this->assertEquals($expected, $toPublish, 'Publishable service providers do not return expected set of providers.'); <add> } <add> <add> public function testPublishableGroups() <add> { <add> $toPublish = ServiceProvider::publishableGroups(); <add> $this->assertEquals(['some_tag'], $toPublish, 'Publishable groups do not return expected set of groups.'); <ide> } <ide> <ide> public function testSimpleAssetsArePublishedCorrectly()
3
Mixed
Ruby
clarify no support for non pk id columns
220494185c84cf62d60ddcb1fa3527da9d758578
<ide><path>activerecord/lib/active_record/attribute_methods/primary_key.rb <ide> def to_key <ide> [key] if key <ide> end <ide> <del> # Returns the primary key value. <add> # Returns the primary key column's value. <ide> def id <ide> sync_with_transaction_state <ide> primary_key = self.class.primary_key <ide> _read_attribute(primary_key) if primary_key <ide> end <ide> <del> # Sets the primary key value. <add> # Sets the primary key column's value. <ide> def id=(value) <ide> sync_with_transaction_state <ide> primary_key = self.class.primary_key <ide> _write_attribute(primary_key, value) if primary_key <ide> end <ide> <del> # Queries the primary key value. <add> # Queries the primary key column's value. <ide> def id? <ide> sync_with_transaction_state <ide> query_attribute(self.class.primary_key) <ide> end <ide> <del> # Returns the primary key value before type cast. <add> # Returns the primary key column's value before type cast. <ide> def id_before_type_cast <ide> sync_with_transaction_state <ide> read_attribute_before_type_cast(self.class.primary_key) <ide> end <ide> <del> # Returns the primary key previous value. <add> # Returns the primary key column's previous value. <ide> def id_was <ide> sync_with_transaction_state <ide> attribute_was(self.class.primary_key) <ide> end <ide> <add> # Returns the primary key column's value from the database. <ide> def id_in_database <ide> sync_with_transaction_state <ide> attribute_in_database(self.class.primary_key) <ide><path>guides/source/active_record_basics.md <ide> class Product < ApplicationRecord <ide> end <ide> ``` <ide> <add>NOTE: Active Record does not support using non-primary key columns named `id`. <add> <ide> CRUD: Reading and Writing Data <ide> ------------------------------ <ide>
2
Java
Java
fix cursordrawable color tint for android 10+
e7a14b803fdc8840bbcde51d4bfa9cf9a85a8472
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java <ide> <ide> import android.content.Context; <ide> import android.content.res.ColorStateList; <add>import android.graphics.BlendMode; <add>import android.graphics.BlendModeColorFilter; <ide> import android.graphics.PorterDuff; <ide> import android.graphics.drawable.Drawable; <ide> import android.os.Build; <ide> public void setSelectionColor(ReactEditText view, @Nullable Integer color) { <ide> <ide> @ReactProp(name = "cursorColor", customType = "Color") <ide> public void setCursorColor(ReactEditText view, @Nullable Integer color) { <del> // Evil method that uses reflection because there is no public API to changes <del> // the cursor color programmatically. <add> <add> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { <add> Drawable cursorDrawable = view.getTextCursorDrawable(); <add> if (cursorDrawable != null) { <add> cursorDrawable.setColorFilter(new BlendModeColorFilter(color, BlendMode.SRC_IN)); <add> view.setTextCursorDrawable(cursorDrawable); <add> } <add> return; <add> } <add> <add> if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) { <add> // Pre-Android 10, there was no supported API to change the cursor color programmatically. <add> // In Android 9.0, they changed the underlying implementation, <add> // but also "dark greylisted" the new field, rendering it unusable. <add> return; <add> } <add> <add> // The evil code that follows uses reflection to achieve this on Android 8.1 and below. <ide> // Based on <ide> // http://stackoverflow.com/questions/25996032/how-to-change-programatically-edittext-cursor-color-in-android. <ide> try {
1
Javascript
Javascript
upgrade unsupportedfeaturewarning to es6
4220556089e0ed5b601ac523600480afe6b9c111
<ide><path>lib/UnsupportedFeatureWarning.js <ide> MIT License http://www.opensource.org/licenses/mit-license.php <ide> Author Tobias Koppers @sokra <ide> */ <del>function UnsupportedFeatureWarning(module, message) { <del> Error.call(this); <del> Error.captureStackTrace(this, UnsupportedFeatureWarning); <del> this.name = "UnsupportedFeatureWarning"; <del> this.message = message; <del> this.origin = this.module = module; <add>"use strict"; <add> <add>class UnsupportedFeatureWarning extends Error { <add> <add> constructor(module, message) { <add> super(); <add> if(Error.hasOwnProperty("captureStackTrace")) { <add> Error.captureStackTrace(this, this.constructor); <add> } <add> this.name = "UnsupportedFeatureWarning"; <add> this.message = message; <add> this.origin = this.module = module; <add> } <ide> } <del>module.exports = UnsupportedFeatureWarning; <ide> <del>UnsupportedFeatureWarning.prototype = Object.create(Error.prototype); <del>UnsupportedFeatureWarning.prototype.constructor = UnsupportedFeatureWarning; <add>module.exports = UnsupportedFeatureWarning;
1
Python
Python
fix logic error when nm fails on 32-bit
3c1f89d91de3265e8e930809b08c2e39b18a4857
<ide><path>numpy/distutils/tests/test_mingw32ccompiler.py <ide> def test_build_import(): <ide> except FileNotFoundError: <ide> pytest.skip("'nm.exe' not on path, is mingw installed?") <ide> supported = out[out.find(b'supported targets:'):] <del> if sys.maxsize < 2**32 and b'pe-i386' not in supported: <del> raise ValueError("'nm.exe' found but it does not support 32-bit " <del> "dlls when using 32-bit python") <add> if sys.maxsize < 2**32: <add> if b'pe-i386' not in supported: <add> raise ValueError("'nm.exe' found but it does not support 32-bit " <add> "dlls when using 32-bit python. Supported " <add> "formats: '%s'" % supported) <ide> elif b'pe-x86-64' not in supported: <ide> raise ValueError("'nm.exe' found but it does not support 64-bit " <del> "dlls when using 64-bit python") <add> "dlls when using 64-bit python. Supported " <add> "formats: '%s'" % supported) <ide> # Hide the import library to force a build <ide> has_import_lib, fullpath = mingw32ccompiler._check_for_import_lib() <ide> if has_import_lib:
1
PHP
PHP
use contract for messagebag
ff3df6773e74fd9dd61a3b7b44b50b2b793f5e11
<ide><path>src/Illuminate/Support/ViewErrorBag.php <ide> <?php namespace Illuminate\Support; <ide> <ide> use Countable; <add>use Illuminate\Contracts\Support\MessageBag as MessageBagContract; <ide> <ide> class ViewErrorBag implements Countable { <ide> <ide> public function hasBag($key = 'default') <ide> * Get a MessageBag instance from the bags. <ide> * <ide> * @param string $key <del> * @return \Illuminate\Support\MessageBag <add> * @return \Illuminate\Contracts\Support\MessageBag <ide> */ <ide> public function getBag($key) <ide> { <ide> public function getBag($key) <ide> * Add a new MessageBag instance to the bags. <ide> * <ide> * @param string $key <del> * @param \Illuminate\Support\MessageBag $bag <add> * @param \Illuminate\Contracts\Support\MessageBag $bag <ide> * @return $this <ide> */ <del> public function put($key, MessageBag $bag) <add> public function put($key, MessageBagContract $bag) <ide> { <ide> $this->bags[$key] = $bag; <ide> <ide> public function __call($method, $parameters) <ide> * Dynamically access a view error bag. <ide> * <ide> * @param string $key <del> * @return \Illuminate\Support\MessageBag <add> * @return \Illuminate\Contracts\Support\MessageBag <ide> */ <ide> public function __get($key) <ide> { <ide> public function __get($key) <ide> * Dynamically set a view error bag. <ide> * <ide> * @param string $key <del> * @param \Illuminate\Support\MessageBag $value <add> * @param \Illuminate\Contracts\Support\MessageBag $value <ide> * @return void <ide> */ <ide> public function __set($key, $value)
1
Javascript
Javascript
fix some parser issues
294bcb33e6dc2d774deb4d6edbde2c1584e7bc20
<ide><path>lib/_debugger.js <ide> Protocol.prototype._newRes = function(raw) { <ide> this.res = { raw: raw || '', headers: {} }; <ide> this.state = 'headers'; <ide> this.reqSeq = 1; <add> this.execute(''); <ide> }; <ide> <ide> <ide><path>test/simple/test-debugger-client.js <ide> p.execute("Type: connect\r\n" + <ide> "Content-Length: 0\r\n\r\n"); <ide> assert.equal(1, resCount); <ide> <add>// Make sure split messages go in. <add> <add>var parts = []; <add>parts.push('Content-Length: 336\r\n'); <add>assert.equal(21, parts[0].length); <add>parts.push('\r\n'); <add>assert.equal(2, parts[1].length); <add>var bodyLength = 0; <add> <add>parts.push('{"seq":12,"type":"event","event":"break","body":' + <add> '{"invocationText":"#<a Server>'); <add>assert.equal(78, parts[2].length); <add>bodyLength += parts[2].length; <add> <add>parts.push('.[anonymous](req=#<an IncomingMessage>, res=#<a ServerResponse>)",' + <add> '"sourceLine"'); <add>assert.equal(78, parts[3].length); <add>bodyLength += parts[3].length; <add> <add>parts.push(':45,"sourceColumn":4,"sourceLineText":" debugger;","script":' + <add> '{"id":24,"name":"/home/ryan/projects/node/benchmark/http_simple.js",' + <add> '"lineOffset":0,"columnOffset":0,"lineCount":98}}}'); <add>assert.equal(180, parts[4].length); <add>bodyLength += parts[4].length; <add> <add>assert.equal(336, bodyLength); <add> <add>for (var i = 0; i < parts.length; i++) { <add> p.execute(parts[i]); <add>} <add>assert.equal(2, resCount); <add> <add> <add>// Make sure that if we get backed up, we still manage to get all the <add>// messages <add>var d = 'Content-Length: 466\r\n\r\n' + <add> '{"seq":10,"type":"event","event":"afterCompile","success":true,' + <add> '"body":{"script":{"handle":1,"type":"script","name":"dns.js",' + <add> '"id":34,"lineOffset":0,"columnOffset":0,"lineCount":241,"sourceStart":' + <add> '"(function (module, exports, require) {var dns = process.binding(\'cares\')' + <add> ';\\nvar ne","sourceLength":6137,"scriptType":2,"compilationType":0,' + <add> '"context":{"ref":0},"text":"dns.js (lines: 241)"}},"refs":[{"handle":0' + <add> ',"type":"context","text":"#<a ContextMirror>"}],"running":true}' + <add> 'Content-Length: 119\r\n\r\n' + <add> '{"seq":11,"type":"event","event":"scriptCollected","success":true,' + <add> '"body":{"script":{"id":26}},"refs":[],"running":true}'; <add>p.execute(d); <add>assert.equal(4, resCount); <add> <ide> var expectedConnections = 0; <ide> var tests = []; <ide> function addTest (cb) {
2
Javascript
Javascript
fix typo statemanager object in examples
6738647e3a5077db04c5fea4cc7c588f60dc6b2c
<ide><path>packages/ember-states/lib/state_manager.js <ide> require('ember-states/state'); <ide> And application code <ide> <ide> App = Ember.Application.create() <del> App.states = Ember.StateManager.create({ <add> App.appStates = Ember.StateManager.create({ <ide> initialState: 'aState', <ide> aState: Ember.State.create({ <ide> anAction: function(manager, context){} <ide> require('ember-states/state'); <ide> }) <ide> <ide> A user initiated click or touch event on "Go" will trigger the 'anAction' method of <del> `App.states.aState` with `App.states` as the first argument and a <add> `App.appStates.aState` with `App.appStates` as the first argument and a <ide> `jQuery.Event` object as the second object. The `jQuery.Event` will include a property <ide> `view` that references the `Ember.View` object that was interacted with. <ide>
1
Python
Python
prepare 2.0.6 release
f120a56009606f4f07711511d1d7df2f85dfbc08
<ide><path>keras/__init__.py <ide> # Importable from root because it's technically not a layer <ide> from .layers import Input <ide> <del>__version__ = '2.0.5' <add>__version__ = '2.0.6' <ide><path>setup.py <ide> <ide> <ide> setup(name='Keras', <del> version='2.0.5', <add> version='2.0.6', <ide> description='Deep Learning for Python', <ide> author='Francois Chollet', <ide> author_email='francois.chollet@gmail.com', <ide> url='https://github.com/fchollet/keras', <del> download_url='https://github.com/fchollet/keras/tarball/2.0.5', <add> download_url='https://github.com/fchollet/keras/tarball/2.0.6', <ide> license='MIT', <ide> install_requires=['theano', 'pyyaml', 'six'], <ide> extras_require={
2
Ruby
Ruby
pull `format` out of the options hash
39556884403ab5baa89574671f1a100c42792b02
<ide><path>actionpack/lib/action_dispatch/routing/mapper.rb <ide> def self.build(scope, set, path, as, controller, default_action, to, via, format <ide> options.delete :shallow_path <ide> options.delete :shallow_prefix <ide> options.delete :shallow <del> options.delete :format <ide> <ide> defaults = (scope[:defaults] || {}).dup <ide> scope_constraints = scope[:constraints] || {} <ide> def scope(*args) <ide> elsif option == :options <ide> value = options <ide> else <del> value = options.delete(option) <add> value = options.delete(option) { POISON } <ide> end <ide> <del> if value <add> unless POISON == value <ide> scope[option] = send("merge_#{option}_scope", @scope[option], value) <ide> end <ide> end <ide> def scope(*args) <ide> @scope = @scope.parent <ide> end <ide> <add> POISON = Object.new # :nodoc: <add> <ide> # Scopes routes to a specific controller <ide> # <ide> # controller "food" do <ide> def merge_via_scope(parent, child) #:nodoc: <ide> child <ide> end <ide> <add> def merge_format_scope(parent, child) #:nodoc: <add> child <add> end <add> <ide> def merge_path_names_scope(parent, child) #:nodoc: <ide> merge_options_scope(parent, child) <ide> end <ide> def match(path, *rest) <ide> via = Mapping.check_via Array(options.delete(:via) { <ide> @scope[:via] <ide> }) <del> formatted = options.delete(:format) { @scope.mapping_option(:format) } <add> formatted = options.delete(:format) { @scope[:format] } <ide> <ide> path_types = paths.group_by(&:class) <ide> path_types.fetch(String, []).each do |_path| <ide> def concerns(*args) <ide> class Scope # :nodoc: <ide> OPTIONS = [:path, :shallow_path, :as, :shallow_prefix, :module, <ide> :controller, :action, :path_names, :constraints, <del> :shallow, :blocks, :defaults, :via, :options] <add> :shallow, :blocks, :defaults, :via, :format, :options] <ide> <ide> RESOURCE_SCOPES = [:resource, :resources] <ide> RESOURCE_METHOD_SCOPES = [:collection, :member, :new] <ide> def options <ide> OPTIONS <ide> end <ide> <del> def mapping_option(name) <del> options = self[:options] <del> return unless options <del> options[name] <del> end <del> <ide> def new(hash) <ide> self.class.new hash, self, scope_level <ide> end
1
PHP
PHP
convert fixture task to use bake_compare
2535a03bb7dbcd9e7216d72dadda11320f9c694c
<ide><path>tests/TestCase/Shell/Task/FixtureTaskTest.php <ide> public function testImportRecordsFromDatabaseWithConditionsPoo() { <ide> <ide> $result = $this->Task->bake('Articles'); <ide> <del> $this->assertContains('namespace App\Test\Fixture;', $result); <del> $this->assertContains('use Cake\TestSuite\Fixture\TestFixture;', $result); <del> $this->assertContains('class ArticlesFixture extends TestFixture', $result); <del> $this->assertContains('public $records', $result); <del> $this->assertContains('public $import', $result); <del> $this->assertContains("'title' => 'First Article'", $result, 'Missing import data %s'); <del> $this->assertContains('Second Article', $result, 'Missing import data %s'); <del> $this->assertContains('Third Article', $result, 'Missing import data %s'); <add> $expected = file_get_contents(CORE_TESTS . '/bake_compare/test/Fixture/ArticleImportWithConditionsFixture.php'); <add> $this->assertTextEquals($expected, $result); <ide> } <ide> <ide> /** <ide> public function testImportOptionsAlternateConnection() { <ide> $this->Task->connection = 'test'; <ide> $this->Task->params = ['schema' => true]; <ide> $result = $this->Task->bake('Article'); <del> $this->assertContains("'connection' => 'test'", $result); <add> <add> $expected = file_get_contents(CORE_TESTS . '/bake_compare/test/Fixture/ArticleAlternateConnectionFixture.php'); <add> $this->assertTextEquals($expected, $result); <ide> } <ide> <ide> /** <ide> public function testImportRecordsNoEscaping() { <ide> $this->Task->connection = 'test'; <ide> $this->Task->params = ['schema' => 'true', 'records' => true]; <ide> $result = $this->Task->bake('Article'); <del> $this->assertContains("'body' => 'Body \"value\"'", $result, 'Data has bad escaping'); <add> <add> $expected = file_get_contents(CORE_TESTS . '/bake_compare/test/Fixture/ArticleNoEscapingFixture.php'); <add> $this->assertTextEquals($expected, $result, 'Data has bad escaping'); <ide> } <ide> <ide> /** <ide> public function testMainImportSchema() { <ide> $this->logicalNot($this->stringContains('public $fields')), <ide> $this->logicalNot($this->stringContains('public $records')) <ide> )); <del> $this->Task->bake('Article', 'comments'); <add> <add> $result = $this->Task->bake('Article', 'comments'); <add> <add> $expected = file_get_contents(CORE_TESTS . '/bake_compare/test/Fixture/ArticleCommentsFixture.php'); <add> $this->assertTextEquals($expected, $result); <ide> } <ide> <ide> /** <ide> public function testRecordGenerationForBinaryAndFloat() { <ide> $this->Task->connection = 'test'; <ide> <ide> $result = $this->Task->bake('Article', 'datatypes'); <del> $this->assertContains("'float_field' => 1", $result); <del> $this->assertContains("'bool' => 1", $result); <del> $this->assertContains("_constraints", $result); <del> $this->assertContains("'primary' => ['type' => 'primary'", $result); <del> $this->assertContains("'columns' => ['id']", $result); <add> <add> $expected = file_get_contents(CORE_TESTS . '/bake_compare/test/Fixture/ArticleDatatypesFixture.php'); <add> $this->assertTextEquals($expected, $result); <ide> <ide> $result = $this->Task->bake('Article', 'binary_tests'); <del> $this->assertContains("'data' => 'Lorem ipsum dolor sit amet'", $result); <add> $expected = file_get_contents(CORE_TESTS . '/bake_compare/test/Fixture/ArticleBinaryTestFixture.php'); <add> $this->assertTextEquals($expected, $result); <ide> } <ide> <ide> /** <ide><path>tests/bake_compare/test/Fixture/ArticleAlternateConnectionFixture.php <add><?php <add>namespace App\Test\Fixture; <add> <add>use Cake\TestSuite\Fixture\TestFixture; <add> <add>/** <add> * ArticleFixture <add> * <add> */ <add>class ArticleFixture extends TestFixture { <add> <add>/** <add> * Import <add> * <add> * @var array <add> */ <add> public $import = ['model' => 'Article', 'connection' => 'test']; <add> <add>/** <add> * Records <add> * <add> * @var array <add> */ <add> public $records = [ <add> [ <add> 'id' => 1, <add> 'author_id' => 1, <add> 'title' => 'Lorem ipsum dolor sit amet', <add> 'body' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', <add> 'published' => 'Lorem ipsum dolor sit ame' <add> ], <add> ]; <add> <add>} <ide><path>tests/bake_compare/test/Fixture/ArticleBinaryTestFixture.php <add><?php <add>namespace App\Test\Fixture; <add> <add>use Cake\TestSuite\Fixture\TestFixture; <add> <add>/** <add> * ArticleFixture <add> * <add> */ <add>class ArticleFixture extends TestFixture { <add> <add>/** <add> * Table name <add> * <add> * @var string <add> */ <add> public $table = 'binary_tests'; <add> <add>/** <add> * Fields <add> * <add> * @var array <add> */ <add> public $fields = [ <add> 'id' => ['type' => 'integer', 'length' => null, 'unsigned' => false, 'null' => false, 'default' => null, 'autoIncrement' => true, 'precision' => null, 'comment' => null], <add> 'data' => ['type' => 'binary', 'length' => null, 'null' => true, 'default' => null, 'precision' => null, 'comment' => null], <add> '_constraints' => [ <add> 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], <add> ], <add> ]; <add> <add>/** <add> * Records <add> * <add> * @var array <add> */ <add> public $records = [ <add> [ <add> 'id' => 1, <add> 'data' => 'Lorem ipsum dolor sit amet' <add> ], <add> ]; <add> <add>} <ide><path>tests/bake_compare/test/Fixture/ArticleCommentsFixture.php <add><?php <add>namespace App\Test\Fixture; <add> <add>use Cake\TestSuite\Fixture\TestFixture; <add> <add>/** <add> * ArticleFixture <add> * <add> */ <add>class ArticleFixture extends TestFixture { <add> <add>/** <add> * Table name <add> * <add> * @var string <add> */ <add> public $table = 'comments'; <add> <add>/** <add> * Import <add> * <add> * @var array <add> */ <add> public $import = ['model' => 'Article', 'records' => true, 'connection' => 'test']; <add> <add>} <ide><path>tests/bake_compare/test/Fixture/ArticleDatatypesFixture.php <add><?php <add>namespace App\Test\Fixture; <add> <add>use Cake\TestSuite\Fixture\TestFixture; <add> <add>/** <add> * ArticleFixture <add> * <add> */ <add>class ArticleFixture extends TestFixture { <add> <add>/** <add> * Table name <add> * <add> * @var string <add> */ <add> public $table = 'datatypes'; <add> <add>/** <add> * Fields <add> * <add> * @var array <add> */ <add> public $fields = [ <add> 'id' => ['type' => 'integer', 'length' => null, 'unsigned' => false, 'null' => false, 'default' => null, 'autoIncrement' => true, 'precision' => null, 'comment' => null], <add> 'decimal_field' => ['type' => 'decimal', 'length' => null, 'unsigned' => false, 'null' => true, 'default' => '0.000', 'precision' => null, 'comment' => null], <add> 'float_field' => ['type' => 'float', 'length' => null, 'unsigned' => false, 'null' => false, 'default' => null, 'precision' => null, 'comment' => null], <add> 'huge_int' => ['type' => 'biginteger', 'length' => null, 'unsigned' => false, 'null' => true, 'default' => null, 'precision' => null, 'comment' => null, 'autoIncrement' => null], <add> 'bool' => ['type' => 'boolean', 'length' => null, 'null' => false, 'default' => 'FALSE', 'precision' => null, 'comment' => null], <add> '_constraints' => [ <add> 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], <add> ], <add> ]; <add> <add>/** <add> * Records <add> * <add> * @var array <add> */ <add> public $records = [ <add> [ <add> 'id' => 1, <add> 'decimal_field' => '', <add> 'float_field' => 1, <add> 'huge_int' => '', <add> 'bool' => 1 <add> ], <add> ]; <add> <add>} <ide><path>tests/bake_compare/test/Fixture/ArticleImportWithConditionsFixture.php <add><?php <add>namespace App\Test\Fixture; <add> <add>use Cake\TestSuite\Fixture\TestFixture; <add> <add>/** <add> * ArticlesFixture <add> * <add> */ <add>class ArticlesFixture extends TestFixture { <add> <add>/** <add> * Import <add> * <add> * @var array <add> */ <add> public $import = ['model' => 'Articles', 'connection' => 'test']; <add> <add>/** <add> * Records <add> * <add> * @var array <add> */ <add> public $records = [ <add> [ <add> 'id' => 1, <add> 'author_id' => 1, <add> 'title' => 'First Article', <add> 'body' => 'First Article Body', <add> 'published' => 'Y' <add> ], <add> [ <add> 'id' => 2, <add> 'author_id' => 3, <add> 'title' => 'Second Article', <add> 'body' => 'Second Article Body', <add> 'published' => 'Y' <add> ], <add> [ <add> 'id' => 3, <add> 'author_id' => 1, <add> 'title' => 'Third Article', <add> 'body' => 'Third Article Body', <add> 'published' => 'Y' <add> ], <add> ]; <add> <add>} <ide><path>tests/bake_compare/test/Fixture/ArticleNoEscapingFixture.php <add><?php <add>namespace App\Test\Fixture; <add> <add>use Cake\TestSuite\Fixture\TestFixture; <add> <add>/** <add> * ArticleFixture <add> * <add> */ <add>class ArticleFixture extends TestFixture { <add> <add>/** <add> * Import <add> * <add> * @var array <add> */ <add> public $import = ['model' => 'Article', 'connection' => 'test']; <add> <add>/** <add> * Records <add> * <add> * @var array <add> */ <add> public $records = [ <add> [ <add> 'id' => 1, <add> 'author_id' => 1, <add> 'title' => 'First Article', <add> 'body' => 'Body "value"', <add> 'published' => 'Y' <add> ], <add> [ <add> 'id' => 2, <add> 'author_id' => 3, <add> 'title' => 'Second Article', <add> 'body' => 'Body "value"', <add> 'published' => 'Y' <add> ], <add> [ <add> 'id' => 3, <add> 'author_id' => 1, <add> 'title' => 'Third Article', <add> 'body' => 'Body "value"', <add> 'published' => 'Y' <add> ], <add> ]; <add> <add>}
7
Ruby
Ruby
use case statement
7fff04f4e8a5fcb8081adeeb81bbd7f866ac07ee
<ide><path>railties/lib/rails/source_annotation_extractor.rb <ide> def find_in(dir) <ide> <ide> if File.directory?(item) <ide> results.update(find_in(item)) <del> elsif item =~ /\.(builder|rb|coffee|rake)$/ <del> results.update(extract_annotations_from(item, /#\s*(#{tag}):?\s*(.*)$/)) <del> elsif item =~ /\.(css|scss|js)$/ <del> results.update(extract_annotations_from(item, /\/\/\s*(#{tag}):?\s*(.*)$/)) <del> elsif item =~ /\.erb$/ <del> results.update(extract_annotations_from(item, /<%\s*#\s*(#{tag}):?\s*(.*?)\s*%>/)) <del> elsif item =~ /\.haml$/ <del> results.update(extract_annotations_from(item, /-\s*#\s*(#{tag}):?\s*(.*)$/)) <del> elsif item =~ /\.slim$/ <del> results.update(extract_annotations_from(item, /\/\s*\s*(#{tag}):?\s*(.*)$/)) <add> else <add> pattern = <add> case item <add> when /\.(builder|rb|coffee|rake)$/ <add> /#\s*(#{tag}):?\s*(.*)$/ <add> when /\.(css|scss|js)$/ <add> /\/\/\s*(#{tag}):?\s*(.*)$/ <add> when /\.erb$/ <add> /<%\s*#\s*(#{tag}):?\s*(.*?)\s*%>/ <add> when /\.haml$/ <add> /-\s*#\s*(#{tag}):?\s*(.*)$/ <add> when /\.slim$/ <add> /\/\s*\s*(#{tag}):?\s*(.*)$/ <add> else nil <add> end <add> results.update(extract_annotations_from(item, pattern)) if pattern <ide> end <ide> end <ide>
1
Python
Python
fix batch normalization
c81d6ec93f6350eabec347acc4420456dc07312b
<ide><path>keras/layers/containers.py <ide> <ide> import theano.tensor as T <ide> from ..layers.core import Layer, Merge <add>from ..utils.theano_utils import ndim_tensor <ide> from six.moves import range <ide> <ide> <del>def ndim_tensor(ndim): <del> if ndim == 2: <del> return T.matrix() <del> elif ndim == 3: <del> return T.tensor3() <del> elif ndim == 4: <del> return T.tensor4() <del> return T.matrix() <del> <del> <ide> class Sequential(Layer): <ide> ''' <ide> Simple linear stack of layers. <ide> def __init__(self, layers=[]): <ide> self.params = [] <ide> self.regularizers = [] <ide> self.constraints = [] <add> self.updates = [] <ide> <ide> for layer in layers: <ide> self.add(layer) <ide> def add(self, layer): <ide> self.layers.append(layer) <ide> if len(self.layers) > 1: <ide> self.layers[-1].set_previous(self.layers[-2]) <add> if not hasattr(self.layers[0], 'input'): <add> self.set_input() <add> layer.init_updates() <ide> <del> params, regularizers, constraints = layer.get_params() <add> params, regularizers, constraints, updates = layer.get_params() <ide> self.params += params <ide> self.regularizers += regularizers <ide> self.constraints += constraints <add> self.updates += updates <ide> <ide> def get_output(self, train=False): <ide> return self.layers[-1].get_output(train) <ide> def __init__(self): <ide> self.params = [] <ide> self.regularizers = [] <ide> self.constraints = [] <add> self.updates = [] <ide> <ide> def set_previous(self, layer): <ide> if len(self.inputs) != 1 or len(self.outputs) != 1: <ide> def add_input(self, name, ndim=2, dtype='float'): <ide> raise Exception('Duplicate node identifier: ' + name) <ide> self.namespace.add(name) <ide> self.input_order.append(name) <del> layer = Layer() # empty layer <add> layer = Layer() # empty layer <ide> if dtype == 'float': <ide> layer.input = ndim_tensor(ndim) <ide> else: <ide> def add_node(self, layer, name, input=None, inputs=[], merge_mode='concat'): <ide> 'input': input, <ide> 'inputs': inputs, <ide> 'merge_mode': merge_mode}) <del> params, regularizers, constraints = layer.get_params() <add> layer.init_updates() <add> params, regularizers, constraints, updates = layer.get_params() <ide> self.params += params <ide> self.regularizers += regularizers <ide> self.constraints += constraints <add> self.updates += updates <ide> <ide> def add_output(self, name, input=None, inputs=[], merge_mode='concat'): <ide> if name in self.namespace: <ide><path>keras/layers/core.py <ide> class Layer(object): <ide> def __init__(self): <ide> self.params = [] <ide> <add> def init_updates(self): <add> self.updates = [] <add> <ide> def set_previous(self, layer): <ide> if not self.supports_masked_input() and layer.get_output_mask() is not None: <ide> raise Exception("Attached non-masking layer to layer with masked output") <ide> def get_config(self): <ide> <ide> def get_params(self): <ide> consts = [] <add> updates = [] <ide> <ide> if hasattr(self, 'regularizers'): <ide> regularizers = self.regularizers <ide> def get_params(self): <ide> else: <ide> consts += [constraints.identity() for _ in range(len(self.params))] <ide> <del> return self.params, regularizers, consts <add> if hasattr(self, 'updates') and self.updates: <add> updates += self.updates <add> <add> return self.params, regularizers, consts, updates <ide> <ide> def set_name(self, name): <ide> for i in range(len(self.params)): <ide> def get_config(self): <ide> "mask_value": self.mask_value} <ide> <ide> <del>class Merge(object): <add>class Merge(Layer): <ide> def __init__(self, layers, mode='sum'): <ide> ''' Merge the output of a list of layers or containers into a single tensor. <ide> mode: {'sum', 'concat'} <ide> def __init__(self, layers, mode='sum'): <ide> self.params = [] <ide> self.regularizers = [] <ide> self.constraints = [] <add> self.updates = [] <ide> for l in self.layers: <del> params, regs, consts = l.get_params() <add> params, regs, consts, updates = l.get_params() <ide> self.regularizers += regs <add> self.updates += updates <ide> # params and constraints have the same size <ide> for p, c in zip(params, consts): <ide> if p not in self.params: <ide> self.params.append(p) <ide> self.constraints.append(c) <ide> <ide> def get_params(self): <del> return self.params, self.regularizers, self.constraints <add> return self.params, self.regularizers, self.constraints, self.updates <ide> <ide> def get_output(self, train=False): <ide> if self.mode == 'sum': <ide> def __init__(self, encoder, decoder, output_reconstruction=True, weights=None): <ide> self.params = [] <ide> self.regularizers = [] <ide> self.constraints = [] <add> self.updates = [] <ide> for layer in [self.encoder, self.decoder]: <del> params, regularizers, constraints = layer.get_params() <add> params, regularizers, constraints, updates = layer.get_params() <ide> self.regularizers += regularizers <add> self.updates += updates <ide> for p, c in zip(params, constraints): <ide> if p not in self.params: <ide> self.params.append(p) <ide><path>keras/layers/normalization.py <ide> from ..layers.core import Layer <del>from ..utils.theano_utils import shared_zeros <add>from ..utils.theano_utils import shared_zeros, shared_ones, ndim_tensor <ide> from .. import initializations <ide> <ide> import theano.tensor as T <ide> <add> <ide> class BatchNormalization(Layer): <ide> ''' <ide> Reference: <ide> class BatchNormalization(Layer): <ide> momentum: momentum term in the computation of a running estimate of the mean and std of the data <ide> ''' <ide> def __init__(self, input_shape, epsilon=1e-6, mode=0, momentum=0.9, weights=None): <del> super(BatchNormalization,self).__init__() <add> super(BatchNormalization, self).__init__() <ide> self.init = initializations.get("uniform") <ide> self.input_shape = input_shape <ide> self.epsilon = epsilon <ide> self.mode = mode <ide> self.momentum = momentum <add> self.input = ndim_tensor(len(self.input_shape)) <ide> <ide> self.gamma = self.init((self.input_shape)) <ide> self.beta = shared_zeros(self.input_shape) <ide> <del> self.running_mean = None <del> self.running_std = None <del> <ide> self.params = [self.gamma, self.beta] <ide> if weights is not None: <ide> self.set_weights(weights) <ide> <add> def init_updates(self): <add> self.running_mean = shared_zeros(self.input_shape) <add> self.running_std = shared_ones((self.input_shape)) <add> X = self.get_input(train=True) <add> m = X.mean(axis=0) <add> std = std = T.mean((X - m) ** 2 + self.epsilon, axis=0) ** 0.5 <add> mean_update = self.momentum * self.running_mean + (1-self.momentum) * m <add> std_update = self.momentum * self.running_std + (1-self.momentum) * std <add> self.updates = [(self.running_mean, mean_update), (self.running_std, std_update)] <add> <ide> def get_output(self, train): <ide> X = self.get_input(train) <ide> <ide> if self.mode == 0: <del> if train: <del> m = X.mean(axis=0) <del> # manual computation of std to prevent NaNs <del> std = T.mean((X-m)**2 + self.epsilon, axis=0) ** 0.5 <del> X_normed = (X - m) / (std + self.epsilon) <del> <del> if self.running_mean is None: <del> self.running_mean = m <del> self.running_std = std <del> else: <del> self.running_mean *= self.momentum <del> self.running_mean += (1-self.momentum) * m <del> self.running_std *= self.momentum <del> self.running_std += (1-self.momentum) * std <del> else: <del> X_normed = (X - self.running_mean) / (self.running_std + self.epsilon) <add> X_normed = (X - self.running_mean) / (self.running_std + self.epsilon) <ide> <ide> elif self.mode == 1: <ide> m = X.mean(axis=-1, keepdims=True) <ide> def get_output(self, train): <ide> return out <ide> <ide> def get_config(self): <del> return {"name":self.__class__.__name__, <del> "input_shape":self.input_shape, <del> "epsilon":self.epsilon, <del> "mode":self.mode} <add> return {"name": self.__class__.__name__, <add> "input_shape": self.input_shape, <add> "epsilon": self.epsilon, <add> "mode": self.mode} <ide> <ide> <ide> class LRN2D(Layer): <ide> def get_output(self, train): <ide> return X / scale <ide> <ide> def get_config(self): <del> return {"name":self.__class__.__name__, <del> "alpha":self.alpha, <del> "k":self.k, <del> "beta":self.beta, <del> "n": self.n} <ide>\ No newline at end of file <add> return {"name": self.__class__.__name__, <add> "alpha": self.alpha, <add> "k": self.k, <add> "beta": self.beta, <add> "n": self.n} <ide><path>keras/models.py <ide> def compile(self, optimizer, loss, class_mode="categorical", theano_mode=None): <ide> for r in self.regularizers: <ide> train_loss = r(train_loss) <ide> updates = self.optimizer.get_updates(self.params, self.constraints, train_loss) <add> updates += self.updates <ide> <ide> if type(self.X_train) == list: <ide> train_ins = self.X_train + [self.y, self.weights] <ide> def compile(self, optimizer, loss, class_mode="categorical", theano_mode=None): <ide> test_ins = [self.X_test, self.y, self.weights] <ide> predict_ins = [self.X_test] <ide> <del> self._train = theano.function(train_ins, train_loss, <del> updates=updates, allow_input_downcast=True, mode=theano_mode) <del> self._train_with_acc = theano.function(train_ins, [train_loss, train_accuracy], <del> updates=updates, allow_input_downcast=True, mode=theano_mode) <add> self._train = theano.function(train_ins, train_loss, updates=updates, <add> allow_input_downcast=True, mode=theano_mode) <add> self._train_with_acc = theano.function(train_ins, [train_loss, train_accuracy], updates=updates, <add> allow_input_downcast=True, mode=theano_mode) <ide> self._predict = theano.function(predict_ins, self.y_test, <del> allow_input_downcast=True, mode=theano_mode) <add> allow_input_downcast=True, mode=theano_mode) <ide> self._test = theano.function(test_ins, test_loss, <del> allow_input_downcast=True, mode=theano_mode) <add> allow_input_downcast=True, mode=theano_mode) <ide> self._test_with_acc = theano.function(test_ins, [test_loss, test_accuracy], <del> allow_input_downcast=True, mode=theano_mode) <add> allow_input_downcast=True, mode=theano_mode) <ide> <ide> def train_on_batch(self, X, y, accuracy=False, class_weight=None, sample_weight=None): <ide> X = standardize_X(X) <ide> def compile(self, optimizer, loss, theano_mode=None): <ide> train_loss = r(train_loss) <ide> self.optimizer = optimizers.get(optimizer) <ide> updates = self.optimizer.get_updates(self.params, self.constraints, train_loss) <add> updates += self.updates <ide> self.theano_mode = theano_mode <ide> self.loss = loss <ide> <del> self._train = theano.function(train_ins, train_loss, <del> updates=updates, allow_input_downcast=True, mode=theano_mode) <add> self._train = theano.function(train_ins, train_loss, updates=updates, <add> allow_input_downcast=True, mode=theano_mode) <ide> self._test = theano.function(test_ins, test_loss, <del> allow_input_downcast=True, mode=theano_mode) <add> allow_input_downcast=True, mode=theano_mode) <ide> self._predict = theano.function(inputs=ins, outputs=ys_test, <del> allow_input_downcast=True, mode=theano_mode) <add> allow_input_downcast=True, mode=theano_mode) <ide> <ide> def train_on_batch(self, data, class_weight={}, sample_weight={}): <ide> # data is a dictionary mapping output and input names to arrays <ide><path>keras/objectives.py <ide> def binary_crossentropy(y_true, y_pred): <ide> bce = T.nnet.binary_crossentropy(y_pred, y_true).mean(axis=-1) <ide> return bce <ide> <add> <ide> def poisson_loss(y_true, y_pred): <ide> return T.mean(y_pred - y_true * T.log(y_pred), axis=-1) <ide> <ide><path>keras/utils/theano_utils.py <ide> def shared_ones(shape, dtype=theano.config.floatX, name=None): <ide> <ide> def alloc_zeros_matrix(*dims): <ide> return T.alloc(np.cast[theano.config.floatX](0.), *dims) <add> <add> <add>def ndim_tensor(ndim): <add> if ndim == 2: <add> return T.matrix() <add> elif ndim == 3: <add> return T.tensor3() <add> elif ndim == 4: <add> return T.tensor4() <add> return T.matrix() <ide><path>tests/auto/keras/test_normalization.py <ide> from numpy.testing import assert_allclose <ide> from theano import tensor as T <ide> from keras.layers import normalization <add>from keras.models import Sequential <add> <ide> <ide> class TestBatchNormalization(unittest.TestCase): <ide> def setUp(self): <ide> self.input_1 = np.arange(10) <ide> self.input_2 = np.zeros(10) <ide> self.input_3 = np.ones((10)) <ide> <del> self.input_shapes = [np.ones((10,10)), np.ones((10,10,10))] <add> self.input_shapes = [np.ones((10, 10)), np.ones((10, 10, 10))] <ide> <ide> def test_setup(self): <del> norm_m0 = normalization.BatchNormalization((10,10)) <del> norm_m1 = normalization.BatchNormalization((10,10), mode=1) <add> norm_m0 = normalization.BatchNormalization((10, 10)) <add> norm_m1 = normalization.BatchNormalization((10, 10), mode=1) <ide> <ide> # mode 3 does not exist <del> self.assertRaises(Exception,normalization.BatchNormalization((10,10),mode=3)) <add> self.assertRaises(Exception, normalization.BatchNormalization((10, 10), mode=3)) <ide> <ide> def test_mode_0(self): <del> """ <del> Test the function of mode 0. Need to be somewhat lenient with the <del> equality assertions because of the epsilon trick used to avoid NaNs. <del> """ <del> norm_m0 = normalization.BatchNormalization((10,), momentum=0.5) <del> <del> norm_m0.input = self.input_1 <del> out = (norm_m0.get_output(train=True) - norm_m0.beta)/norm_m0.gamma <del> self.assertAlmostEqual(out.mean().eval(), 0.0) <del> self.assertAlmostEqual(out.std().eval(), 1.0, places=2) <add> model = Sequential() <add> norm_m0 = normalization.BatchNormalization((10,)) <add> model.add(norm_m0) <add> model.compile(loss='mse', optimizer='sgd') <ide> <del> self.assertAlmostEqual(norm_m0.running_mean, 4.5) <del> self.assertAlmostEqual(norm_m0.running_std.eval(), np.arange(10).std(), places=2) <add> # centered on 5.0, variance 10.0 <add> X = np.random.normal(loc=5.0, scale=10.0, size=(1000, 10)) <add> model.fit(X, X, nb_epoch=5, verbose=0) <add> norm_m0.input = X <add> out = (norm_m0.get_output(train=True) - norm_m0.beta) / norm_m0.gamma <ide> <del> norm_m0.input = self.input_2 <del> out = (norm_m0.get_output(train=True) - norm_m0.beta)/norm_m0.gamma <del> self.assertAlmostEqual(out.mean().eval(), 0.0) <del> self.assertAlmostEqual(out.std().eval(), 0.0, places=2) <del> <del> #Values calculated by hand <del> self.assertAlmostEqual(norm_m0.running_mean, 2.25) <del> self.assertAlmostEqual(norm_m0.running_std.eval(), 0.5*np.arange(10).std(), places=2) <del> <del> out_test = (norm_m0.get_output(train=False) - norm_m0.beta)/norm_m0.gamma <del> self.assertAlmostEqual(out_test.mean().eval(), -2.25 / (0.5*np.arange(10).std()),places=2) <del> self.assertAlmostEqual(out_test.std().eval(), 0.0, places=2) <del> <del> norm_m0.input = self.input_3 <del> out = (norm_m0.get_output(train=True) - norm_m0.beta)/norm_m0.gamma <del> self.assertAlmostEqual(out.mean().eval(), 0.0) <del> self.assertAlmostEqual(out.std().eval(), 0.0, places=2) <add> self.assertAlmostEqual(out.mean().eval(), 0.0, places=1) <add> self.assertAlmostEqual(out.std().eval(), 1.0, places=1) <ide> <ide> def test_mode_1(self): <ide> norm_m1 = normalization.BatchNormalization((10,), mode=1) <add> norm_m1.init_updates() <ide> <ide> for inp in [self.input_1, self.input_2, self.input_3]: <ide> norm_m1.input = inp <del> out = (norm_m1.get_output(train=True) - norm_m1.beta)/norm_m1.gamma <add> out = (norm_m1.get_output(train=True) - norm_m1.beta) / norm_m1.gamma <ide> self.assertAlmostEqual(out.mean().eval(), 0.0) <ide> if inp.std() > 0.: <ide> self.assertAlmostEqual(out.std().eval(), 1.0, places=2) <ide> def test_shapes(self): <ide> """ <ide> for inp in self.input_shapes: <ide> norm_m0 = normalization.BatchNormalization(inp.shape, mode=0) <add> norm_m0.init_updates() <ide> norm_m0.input = inp <del> out = (norm_m0.get_output(train=True) - norm_m0.beta)/norm_m0.gamma <add> out = (norm_m0.get_output(train=True) - norm_m0.beta) / norm_m0.gamma <ide> <ide> norm_m1 = normalization.BatchNormalization(inp.shape, mode=1) <ide> norm_m1.input = inp <del> out = (norm_m1.get_output(train=True) - norm_m1.beta)/norm_m1.gamma <add> out = (norm_m1.get_output(train=True) - norm_m1.beta) / norm_m1.gamma <ide> <ide> def test_weight_init(self): <ide> """ <ide> Test weight initialization <ide> """ <ide> <del> norm_m1 = normalization.BatchNormalization((10,), mode=1, weights=[np.ones(10),np.ones(10)]) <add> norm_m1 = normalization.BatchNormalization((10,), mode=1, weights=[np.ones(10), np.ones(10)]) <add> norm_m1.init_updates() <ide> <ide> for inp in [self.input_1, self.input_2, self.input_3]: <ide> norm_m1.input = inp <del> out = (norm_m1.get_output(train=True) - np.ones(10))/1. <add> out = (norm_m1.get_output(train=True) - np.ones(10)) / 1. <ide> self.assertAlmostEqual(out.mean().eval(), 0.0) <ide> if inp.std() > 0.: <ide> self.assertAlmostEqual(out.std().eval(), 1.0, places=2) <ide> else: <ide> self.assertAlmostEqual(out.std().eval(), 0.0, places=2) <ide> <del> assert_allclose(norm_m1.gamma.eval(),np.ones(10)) <del> assert_allclose(norm_m1.beta.eval(),np.ones(10)) <del> <del> #Weights must be an iterable of gamma AND beta. <del> self.assertRaises(Exception,normalization.BatchNormalization(10,), weights = np.ones(10)) <add> assert_allclose(norm_m1.gamma.eval(), np.ones(10)) <add> assert_allclose(norm_m1.beta.eval(), np.ones(10)) <ide> <add> # Weights must be an iterable of gamma AND beta. <add> self.assertRaises(Exception, normalization.BatchNormalization((10,)), weights=np.ones(10)) <ide> <ide> def test_config(self): <del> norm = normalization.BatchNormalization((10,10), mode=1, epsilon=0.1) <add> norm = normalization.BatchNormalization((10, 10), mode=1, epsilon=0.1) <ide> conf = norm.get_config() <del> conf_target = {"input_shape": (10,10), "name": normalization.BatchNormalization.__name__, <del> "epsilon":0.1, "mode": 1} <add> conf_target = {"input_shape": (10, 10), "name": normalization.BatchNormalization.__name__, <add> "epsilon": 0.1, "mode": 1} <ide> <ide> self.assertDictEqual(conf, conf_target) <ide>
7
Javascript
Javascript
add tests for invokeguardedcallback
e577bfb1cedc56f93d8e5967088932e7100d4829
<ide><path>packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> */ <add> <add>'use strict'; <add> <add>describe('ReactDOMConsoleErrorReporting', () => { <add> let act; <add> let React; <add> let ReactDOM; <add> <add> let ErrorBoundary; <add> let NoError; <add> let container; <add> let windowOnError; <add> <add> beforeEach(() => { <add> jest.resetModules(); <add> act = require('jest-react').act; <add> React = require('react'); <add> ReactDOM = require('react-dom'); <add> <add> ErrorBoundary = class extends React.Component { <add> state = {error: null}; <add> static getDerivedStateFromError(error) { <add> return {error}; <add> } <add> render() { <add> if (this.state.error) { <add> return <h1>Caught: {this.state.error.message}</h1>; <add> } <add> return this.props.children; <add> } <add> }; <add> NoError = function() { <add> return <h1>OK</h1>; <add> }; <add> container = document.createElement('div'); <add> document.body.appendChild(container); <add> windowOnError = jest.fn(); <add> window.addEventListener('error', windowOnError); <add> }); <add> <add> afterEach(() => { <add> document.body.removeChild(container); <add> window.removeEventListener('error', windowOnError); <add> }); <add> <add> describe('ReactDOM.createRoot', () => { <add> it('logs errors during event handlers', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> return ( <add> <button <add> onClick={() => { <add> throw Error('Boom'); <add> }}> <add> click me <add> </button> <add> ); <add> } <add> <add> const root = ReactDOM.createRoot(container); <add> act(() => { <add> root.render(<Foo />); <add> }); <add> <add> act(() => { <add> container.firstChild.dispatchEvent( <add> new MouseEvent('click', { <add> bubbles: true, <add> }), <add> ); <add> }); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported because we're in a browser click event: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // This one is jsdom-only. Real browser deduplicates it. <add> // (In DEV, we have a nested event due to guarded callback.) <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported because we're in a browser click event: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // This one is jsdom-only. Real browser deduplicates it. <add> // (In DEV, we have a nested event due to guarded callback.) <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } else { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported because we're in a browser click event: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported because we're in a browser click event: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> root.render(<NoError />); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([]); <add> } <add> }); <add> <add> it('logs render errors without an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> throw Error('Boom'); <add> } <add> <add> const root = ReactDOM.createRoot(container); <add> expect(() => { <add> act(() => { <add> root.render(<Foo />); <add> }); <add> }).toThrow('Boom'); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // TODO: This is duplicated only with createRoot. Why? <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // TODO: This is duplicated only with createRoot. Why? <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> root.render(<NoError />); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([]); <add> } <add> }); <add> <add> it('logs render errors with an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> throw Error('Boom'); <add> } <add> <add> const root = ReactDOM.createRoot(container); <add> act(() => { <add> root.render( <add> <ErrorBoundary> <add> <Foo /> <add> </ErrorBoundary>, <add> ); <add> }); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // TODO: This is duplicated only with createRoot. Why? <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by jsdom due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> [ <add> // TODO: This is duplicated only with createRoot. Why? <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // TODO: This is duplicated only with createRoot. Why? <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // TODO: This is duplicated only with createRoot. Why? <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> root.render(<NoError />); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([]); <add> } <add> }); <add> <add> // TODO: this is broken due to https://github.com/facebook/react/issues/21712. <add> xit('logs layout effect errors without an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> React.useLayoutEffect(() => { <add> throw Error('Boom'); <add> }, []); <add> return null; <add> } <add> <add> const root = ReactDOM.createRoot(container); <add> expect(() => { <add> act(() => { <add> root.render(<Foo />); <add> }); <add> }).toThrow('Boom'); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> root.render(<NoError />); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([]); <add> } <add> }); <add> <add> // TODO: this is broken due to https://github.com/facebook/react/issues/21712. <add> xit('logs layout effect errors with an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> React.useLayoutEffect(() => { <add> throw Error('Boom'); <add> }, []); <add> return null; <add> } <add> <add> const root = ReactDOM.createRoot(container); <add> act(() => { <add> root.render( <add> <ErrorBoundary> <add> <Foo /> <add> </ErrorBoundary>, <add> ); <add> }); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by jsdom due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> root.render(<NoError />); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([]); <add> } <add> }); <add> <add> // TODO: this is broken due to https://github.com/facebook/react/issues/21712. <add> xit('logs passive effect errors without an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> React.useEffect(() => { <add> throw Error('Boom'); <add> }, []); <add> return null; <add> } <add> <add> const root = ReactDOM.createRoot(container); <add> expect(() => { <add> act(() => { <add> root.render(<Foo />); <add> }); <add> }).toThrow('Boom'); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> root.render(<NoError />); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([]); <add> } <add> }); <add> <add> // TODO: this is broken due to https://github.com/facebook/react/issues/21712. <add> xit('logs passive effect errors with an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> React.useEffect(() => { <add> throw Error('Boom'); <add> }, []); <add> return null; <add> } <add> <add> const root = ReactDOM.createRoot(container); <add> act(() => { <add> root.render( <add> <ErrorBoundary> <add> <Foo /> <add> </ErrorBoundary>, <add> ); <add> }); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by jsdom due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> root.render(<NoError />); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([]); <add> } <add> }); <add> }); <add> <add> describe('ReactDOM.render', () => { <add> it('logs errors during event handlers', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> return ( <add> <button <add> onClick={() => { <add> throw Error('Boom'); <add> }}> <add> click me <add> </button> <add> ); <add> } <add> <add> act(() => { <add> ReactDOM.render(<Foo />, container); <add> }); <add> <add> act(() => { <add> container.firstChild.dispatchEvent( <add> new MouseEvent('click', { <add> bubbles: true, <add> }), <add> ); <add> }); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported because we're in a browser click event: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // This one is jsdom-only. Real browser deduplicates it. <add> // (In DEV, we have a nested event due to guarded callback.) <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> [ <add> // Reported because we're in a browser click event: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // This one is jsdom-only. Real browser deduplicates it. <add> // (In DEV, we have a nested event due to guarded callback.) <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } else { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported because we're in a browser click event: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported because we're in a browser click event: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> ReactDOM.render(<NoError />, container); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> ]); <add> } <add> }); <add> <add> it('logs render errors without an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> throw Error('Boom'); <add> } <add> <add> expect(() => { <add> act(() => { <add> ReactDOM.render(<Foo />, container); <add> }); <add> }).toThrow('Boom'); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> [ <add> // Reported due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> ReactDOM.render(<NoError />, container); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> ]); <add> } <add> }); <add> <add> it('logs render errors with an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> throw Error('Boom'); <add> } <add> <add> act(() => { <add> ReactDOM.render( <add> <ErrorBoundary> <add> <Foo /> <add> </ErrorBoundary>, <add> container, <add> ); <add> }); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> [ <add> // Reported by jsdom due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> ReactDOM.render(<NoError />, container); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> ]); <add> } <add> }); <add> <add> // TODO: this is broken due to https://github.com/facebook/react/issues/21712. <add> xit('logs layout effect errors without an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> React.useLayoutEffect(() => { <add> throw Error('Boom'); <add> }, []); <add> return null; <add> } <add> <add> expect(() => { <add> act(() => { <add> ReactDOM.render(<Foo />, container); <add> }); <add> }).toThrow('Boom'); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> [ <add> // Reported due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> ReactDOM.render(<NoError />, container); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> ]); <add> } <add> }); <add> <add> // TODO: this is broken due to https://github.com/facebook/react/issues/21712. <add> xit('logs layout effect errors with an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> React.useLayoutEffect(() => { <add> throw Error('Boom'); <add> }, []); <add> return null; <add> } <add> <add> act(() => { <add> ReactDOM.render( <add> <ErrorBoundary> <add> <Foo /> <add> </ErrorBoundary>, <add> container, <add> ); <add> }); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> [ <add> // Reported by jsdom due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> ReactDOM.render(<NoError />, container); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> ]); <add> } <add> }); <add> <add> // TODO: this is broken due to https://github.com/facebook/react/issues/21712. <add> xit('logs passive effect errors without an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> React.useEffect(() => { <add> throw Error('Boom'); <add> }, []); <add> return null; <add> } <add> <add> expect(() => { <add> act(() => { <add> ReactDOM.render(<Foo />, container); <add> }); <add> }).toThrow('Boom'); <add> <add> if (__DEV__) { <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> // Reported due to guarded callback: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> [ <add> // Reported due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> ReactDOM.render(<NoError />, container); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> ]); <add> } <add> }); <add> <add> // TODO: this is broken due to https://github.com/facebook/react/issues/21712. <add> xit('logs passive effect errors with an error boundary', () => { <add> spyOnDevAndProd(console, 'error'); <add> <add> function Foo() { <add> React.useEffect(() => { <add> throw Error('Boom'); <add> }, []); <add> return null; <add> } <add> <add> act(() => { <add> ReactDOM.render( <add> <ErrorBoundary> <add> <Foo /> <add> </ErrorBoundary>, <add> container, <add> ); <add> }); <add> <add> if (__DEV__) { <add> // Reported due to guarded callback: <add> expect(windowOnError.mock.calls).toEqual([ <add> [ <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> [ <add> // Reported by jsdom due to the guarded callback: <add> expect.stringContaining('Error: Uncaught [Error: Boom]'), <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> [ <add> // Addendum by React: <add> expect.stringContaining( <add> 'The above error occurred in the <Foo> component', <add> ), <add> ], <add> ]); <add> } else { <add> // The top-level error was caught with try/catch, and there's no guarded callback, <add> // so in production we don't see an error event. <add> expect(windowOnError.mock.calls).toEqual([]); <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [ <add> // Reported by React with no extra message: <add> expect.objectContaining({ <add> message: 'Boom', <add> }), <add> ], <add> ]); <add> } <add> <add> // Check next render doesn't throw. <add> windowOnError.mockReset(); <add> console.error.calls.reset(); <add> act(() => { <add> ReactDOM.render(<NoError />, container); <add> }); <add> expect(container.textContent).toBe('OK'); <add> expect(windowOnError.mock.calls).toEqual([]); <add> if (__DEV__) { <add> expect(console.error.calls.all().map(c => c.args)).toEqual([ <add> [expect.stringContaining('ReactDOM.render is no longer supported')], <add> ]); <add> } <add> }); <add> }); <add>});
1
PHP
PHP
fix failing test
8485ffac3944f11bd4bde0fded157c984ad0fbfe
<ide><path>tests/TestCase/Console/Command/BakeShellTest.php <ide> public function testMain() { <ide> ->with($this->stringContains('The following commands')); <ide> $this->Shell->expects($this->at(3)) <ide> ->method('out') <del> ->with('controller'); <add> ->with('behavior'); <ide> $this->Shell->main(); <ide> } <ide>
1
Javascript
Javascript
annotate empty objects in xplat
abb21dd908729fa69daf2fa63366e488009b63bd
<ide><path>Libraries/Animated/AnimatedImplementation.js <ide> const parallel = function ( <ide> ): CompositeAnimation { <ide> let doneCount = 0; <ide> // Make sure we only call stop() at most once for each animation <del> const hasEnded = {}; <add> const hasEnded: {[number]: boolean} = {}; <ide> const stopTogether = !(config && config.stopTogether === false); <ide> <ide> const result = { <ide><path>Libraries/Animated/NativeAnimatedHelper.js <ide> const useSingleOpBatching = <ide> ReactNativeFeatureFlags.animatedShouldUseSingleOp(); <ide> let flushQueueTimeout = null; <ide> <del>const eventListenerGetValueCallbacks = {}; <del>const eventListenerAnimationFinishedCallbacks = {}; <add>const eventListenerGetValueCallbacks: { <add> [$FlowFixMe | number]: ((value: number) => void) | void, <add>} = {}; <add>const eventListenerAnimationFinishedCallbacks: { <add> [$FlowFixMe | number]: EndCallback | void, <add>} = {}; <ide> let globalEventEmitterGetValueListener: ?EventSubscription = null; <ide> let globalEventEmitterAnimationFinishedListener: ?EventSubscription = null; <ide> <ide> const nativeOps: ?typeof NativeAnimatedModule = useSingleOpBatching <ide> 'addListener', // 20 <ide> 'removeListener', // 21 <ide> ]; <del> return apis.reduce((acc, functionName, i) => { <add> return apis.reduce<{[string]: number}>((acc, functionName, i) => { <ide> // These indices need to be kept in sync with the indices in native (see NativeAnimatedModule in Java, or the equivalent for any other native platform). <ide> // $FlowFixMe[prop-missing] <ide> acc[functionName] = i + 1; <ide><path>Libraries/Inspector/NetworkOverlay.js <ide> class NetworkOverlay extends React.Component<Props, State> { <ide> this.setState(({requests}) => { <ide> const networkRequestInfo = requests[xhrIndex]; <ide> if (!networkRequestInfo.requestHeaders) { <del> networkRequestInfo.requestHeaders = {}; <add> networkRequestInfo.requestHeaders = ({}: {[any]: any}); <ide> } <ide> networkRequestInfo.requestHeaders[header] = value; <ide> return {requests}; <ide><path>packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js <ide> function PointerEventAttributesHoverablePointersTestCase( <ide> ) { <ide> const {harness} = props; <ide> <del> const detected_pointertypesRef = useRef({}); <del> const detected_eventTypesRef = useRef({}); <add> const detected_pointertypesRef = useRef(({}: {[string]: boolean})); <add> const detected_eventTypesRef = useRef(({}: {[string]: boolean})); <ide> const expectedPointerIdRef = useRef(NaN); <ide> <ide> const [square1Visible, setSquare1Visible] = useState(true); <ide> function PointerEventAttributesHoverablePointersTestCase( <ide> eventList.length <ide> ) { <ide> setSquare1Visible(false); <del> detected_eventTypesRef.current = {}; <add> detected_eventTypesRef.current = ({}: {[string]: boolean}); <ide> setSquare2Visible(true); <ide> expectedPointerIdRef.current = NaN; <ide> } <ide><path>packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js <ide> function PointerEventAttributesNoHoverPointersTestCase( <ide> ) { <ide> const {harness} = props; <ide> <del> const detected_pointertypesRef = useRef({}); <del> const detected_eventTypesRef = useRef({}); <add> const detected_pointertypesRef = useRef(({}: {[string]: boolean})); <add> const detected_eventTypesRef = useRef(({}: {[string]: boolean})); <ide> const expectedPointerIdRef = useRef(NaN); <ide> <ide> const [square1Visible, setSquare1Visible] = useState(true); <ide> function PointerEventAttributesNoHoverPointersTestCase( <ide> eventList.length <ide> ) { <ide> setSquare1Visible(false); <del> detected_eventTypesRef.current = {}; <add> detected_eventTypesRef.current = ({}: {[string]: boolean}); <ide> setSquare2Visible(true); <ide> expectedPointerIdRef.current = NaN; <ide> } <ide><path>packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js <ide> function PointerEventPointerMoveTestCase( <ide> ) { <ide> const {harness} = props; <ide> <del> const detectedPointerTypesRef = useRef({}); <add> const detectedPointerTypesRef = useRef(({}: {[string]: boolean})); <ide> const testPointerMove = harness.useAsyncTest('pointermove event received'); <ide> <ide> const handlers = useTestEventHandler( <ide><path>packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js <ide> function PointerEventPrimaryTouchPointerTestCase( <ide> ) { <ide> const {harness} = props; <ide> <del> const detected_eventsRef = useRef({}); <add> const detected_eventsRef = useRef(({}: {[string]: boolean})); <ide> <ide> const handleIncomingPointerEvent = useCallback( <ide> (boxLabel: string, eventType: string, isPrimary: boolean) => { <ide><path>packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js <ide> export function useTestEventHandler( <ide> const eventProps: any = useMemo(() => { <ide> const handlerFactory = (eventName: string) => (event: any) => <ide> handler(event, eventName); <del> const props = {}; <add> const props: {[string]: (event: any) => void} = {}; <ide> for (const eventName of eventNames) { <ide> const eventPropName = <ide> 'on' + eventName[0].toUpperCase() + eventName.slice(1); <ide><path>packages/rn-tester/js/utils/RNTesterReducer.js <ide> const getUpdatedBookmarks = ({ <ide> key, <ide> bookmarks, <ide> }: { <del> exampleType: string, <add> exampleType: 'apis' | 'components', <ide> key: string, <ide> bookmarks: ComponentList, <ide> }) => { <ide> const getUpdatedRecentlyUsed = ({ <ide> key, <ide> recentlyUsed, <ide> }: { <del> exampleType: string, <add> exampleType: 'apis' | 'components', <ide> key: string, <ide> recentlyUsed: ComponentList, <ide> }) => {
9
Go
Go
use cobra built-in --version feature
0c3192da8c0686b1fe6aba393c1d3279e41c48a0
<ide><path>cli/cobra.go <ide> func SetupRootCommand(rootCmd *cobra.Command) { <ide> rootCmd.SetHelpTemplate(helpTemplate) <ide> rootCmd.SetFlagErrorFunc(FlagErrorFunc) <ide> rootCmd.SetHelpCommand(helpCommand) <add> rootCmd.SetVersionTemplate("Docker version {{.Version}}\n") <ide> <ide> rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage") <ide> rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help") <ide><path>cmd/dockerd/docker.go <ide> func newDaemonCommand() *cobra.Command { <ide> SilenceErrors: true, <ide> Args: cli.NoArgs, <ide> RunE: func(cmd *cobra.Command, args []string) error { <del> if opts.version { <del> showVersion() <del> return nil <del> } <ide> opts.flags = cmd.Flags() <ide> return runDaemon(opts) <ide> }, <ide> DisableFlagsInUseLine: true, <add> Version: fmt.Sprintf("%s, build %s", dockerversion.Version, dockerversion.GitCommit), <ide> } <ide> cli.SetupRootCommand(cmd) <ide> <ide> flags := cmd.Flags() <del> flags.BoolVarP(&opts.version, "version", "v", false, "Print version information and quit") <add> flags.BoolP("version", "v", false, "Print version information and quit") <ide> flags.StringVar(&opts.configFile, "config-file", defaultDaemonConfigFile, "Daemon configuration file") <ide> opts.InstallFlags(flags) <ide> installConfigFlags(opts.daemonConfig, flags) <ide> func newDaemonCommand() *cobra.Command { <ide> return cmd <ide> } <ide> <del>func showVersion() { <del> fmt.Printf("Docker version %s, build %s\n", dockerversion.Version, dockerversion.GitCommit) <del>} <del> <ide> func main() { <ide> if reexec.Init() { <ide> return <ide><path>cmd/dockerd/options.go <ide> var ( <ide> ) <ide> <ide> type daemonOptions struct { <del> version bool <ide> configFile string <ide> daemonConfig *config.Config <ide> flags *pflag.FlagSet
3
Python
Python
remove dev log
6b131205034c35b25535c39c0d7d4b550a485c10
<ide><path>glances/plugins/glances_fs.py <ide> def update(self): <ide> except UnicodeDecodeError: <ide> return self.stats <ide> <del> logger.info(fs_stat) <del> <ide> # Loop over fs <ide> for fs in fs_stat: <ide> fs_current = {}
1
Javascript
Javascript
fix variable leak
bc02d47b213785f9560f4b9c5426bc16124e89c3
<ide><path>lib/fs.js <ide> fs.readSync = function (fd, buffer, offset, length, position) { <ide> if (!Buffer.isBuffer(buffer)) { <ide> // legacy string interface (fd, length, position, encoding, callback) <ide> legacy = true; <del> encoding = arguments[3]; <add> var encoding = arguments[3]; <ide> position = arguments[2]; <ide> length = arguments[1]; <ide> buffer = new Buffer(length);
1
Text
Text
add gitter badge and use map art instead of logo
926151ff8b53042b9cd1b6755f59dcad011557d0
<ide><path>README.md <add><img src="https://s3.amazonaws.com/freecodecamp/wide-social-banner.png"> <add> <ide> [![Throughput Graph](https://graphs.waffle.io/freecodecamp/freecodecamp/throughput.svg)](https://waffle.io/freecodecamp/freecodecamp/metrics) <ide> <del>[![Stories in Ready](https://badge.waffle.io/FreeCodeCamp/freecodecamp.png?label=ready&title=Ready)](https://waffle.io/FreeCodeCamp/freecodecamp) <del><img src="https://s3.amazonaws.com/freecodecamp/logo4.0LG.png"> <add>[![Join the chat at https://gitter.im/sahat/hackathon-starter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sahat/hackathon-starter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) <ide> <ide> Welcome to Free Code Camp's open source codebase! <ide> =======================
1
PHP
PHP
remove the input flashing from filters
837b4802312b60b2c1338639cdc406ec6b7adbe7
<ide><path>application/filters.php <ide> <ide> 'after' => function($response) <ide> { <del> Input::flash(); <add> // Do stuff after every request to your application. <ide> }, <ide> <ide>
1
PHP
PHP
improve casting of integer routing parameters
50efa360d95f2c5a8cd5215c30f5bf5cf3a66b9e
<ide><path>src/Controller/ControllerFactory.php <ide> protected function coerceStringToType(string $argument, ReflectionNamedType $typ <ide> case 'float': <ide> return is_numeric($argument) ? (float)$argument : null; <ide> case 'int': <del> return ctype_digit($argument) ? (int)$argument : null; <add> return ctype_digit($argument) || filter_var($argument, FILTER_VALIDATE_INT) ? (int)$argument : null; <ide> case 'bool': <ide> return $argument === '0' ? false : ($argument === '1' ? true : null); <ide> case 'array': <ide><path>tests/TestCase/Controller/ControllerFactoryTest.php <ide> public function testInvokePassedParametersCoercion(): void <ide> <ide> $result = $this->factory->invoke($controller); <ide> $data = json_decode((string)$result->getBody(), true); <del> <del> $this->assertNotNull($data); <ide> $this->assertSame(['one' => 1.0, 'two' => 2, 'three' => false, 'four' => ['8', '9']], $data); <ide> <ide> $request = new ServerRequest([ <ide> public function testInvokePassedParametersCoercion(): void <ide> <ide> $result = $this->factory->invoke($controller); <ide> $data = json_decode((string)$result->getBody(), true); <del> <del> $this->assertNotNull($data); <ide> $this->assertSame(['one' => 1.0, 'two' => 2, 'three' => false, 'four' => []], $data); <add> <add> $request = new ServerRequest([ <add> 'url' => 'test_plugin_three/dependencies/requiredTyped', <add> 'params' => [ <add> 'plugin' => null, <add> 'controller' => 'Dependencies', <add> 'action' => 'requiredTyped', <add> 'pass' => ['1.0', '-1', '0', ''], <add> ], <add> ]); <add> $controller = $this->factory->create($request); <add> <add> $result = $this->factory->invoke($controller); <add> $data = json_decode((string)$result->getBody(), true); <add> $this->assertSame(['one' => 1.0, 'two' => -1, 'three' => false, 'four' => []], $data); <ide> } <ide> <ide> /** <ide> public function testInvokeOptionalTypedParam(): void <ide> $result = $this->factory->invoke($controller); <ide> $data = json_decode((string)$result->getBody(), true); <ide> <del> $this->assertNotNull($data); <ide> $this->assertSame(['one' => 1.0, 'two' => 2, 'three' => true], $data); <ide> } <ide>
2
Javascript
Javascript
delay routing while contexts are loading
852f41faa7862cd3908ebee08041fef160c29f03
<ide><path>packages/ember-routing/lib/resolved_state.js <add>var get = Ember.get; <add> <add>Ember._ResolvedState = Ember.Object.extend({ <add> manager: null, <add> state: null, <add> match: null, <add> <add> object: Ember.computed(function(key, value) { <add> if (arguments.length === 2) { <add> this._object = value; <add> return value; <add> } else { <add> if (this._object) { <add> return this._object; <add> } else { <add> var state = get(this, 'state'), <add> match = get(this, 'match'), <add> manager = get(this, 'manager'); <add> return state.deserialize(manager, match.hash); <add> } <add> } <add> }).property(), <add> <add> hasPromise: Ember.computed(function() { <add> return Ember.canInvoke(get(this, 'object'), 'then'); <add> }).property('object'), <add> <add> promise: Ember.computed(function() { <add> var object = get(this, 'object'); <add> if (Ember.canInvoke(object, 'then')) { <add> return object; <add> } else { <add> return { <add> then: function(success) { success(object); } <add> }; <add> } <add> }).property('object'), <add> <add> transition: function() { <add> var manager = get(this, 'manager'), <add> path = get(this, 'state.path'), <add> object = get(this, 'object'); <add> manager.transitionTo(path, object); <add> } <add>}); <ide><path>packages/ember-routing/lib/routable.js <add>require('ember-routing/resolved_state'); <add> <ide> var get = Ember.get; <ide> <ide> // The Ember Routable mixin assumes the existance of a simple <ide> Ember.Routable = Ember.Mixin.create({ <ide> <ide> /** <ide> @private <del> <del> Once `unroute` has finished unwinding, `routePath` will be called <del> with the remainder of the route. <del> <del> For example, if you were in the /posts/1/comments state, and you <del> moved into the /posts/2/comments state, `routePath` will be called <del> on the state whose path is `/posts` with the path `/2/comments`. <ide> */ <del> routePath: function(manager, path) { <del> if (get(this, 'isLeafRoute')) { return; } <add> resolvePath: function(manager, path) { <add> if (get(this, 'isLeafRoute')) { return Ember.A(); } <ide> <ide> var childStates = get(this, 'childStates'), match; <ide> <ide> Ember.Routable = Ember.Mixin.create({ <ide> <ide> Ember.assert("Could not find state for path " + path, !!state); <ide> <del> var object = state.deserialize(manager, match.hash); <del> manager.transitionTo(get(state, 'path'), object); <del> manager.send('routePath', match.remaining); <add> var resolvedState = Ember._ResolvedState.create({ <add> manager: manager, <add> state: state, <add> match: match <add> }); <add> <add> var states = state.resolvePath(manager, match.remaining); <add> <add> return Ember.A([resolvedState]).pushObjects(states); <add> }, <add> <add> /** <add> @private <add> <add> Once `unroute` has finished unwinding, `routePath` will be called <add> with the remainder of the route. <add> <add> For example, if you were in the /posts/1/comments state, and you <add> moved into the /posts/2/comments state, `routePath` will be called <add> on the state whose path is `/posts` with the path `/2/comments`. <add> */ <add> routePath: function(manager, path) { <add> if (get(this, 'isLeafRoute')) { return; } <add> <add> var resolvedStates = this.resolvePath(manager, path), <add> hasPromises = resolvedStates.some(function(s) { return get(s, 'hasPromise'); }); <add> <add> function runTransition() { <add> resolvedStates.forEach(function(rs) { rs.transition(); }); <add> } <add> <add> if (hasPromises) { <add> manager.transitionTo('loading'); <add> <add> Ember.assert('Loading state should be the child of a route', Ember.Routable.detect(get(manager, 'currentState.parentState'))); <add> Ember.assert('Loading state should not be a route', !Ember.Routable.detect(get(manager, 'currentState'))); <add> <add> manager.handleStatePromises(resolvedStates, runTransition); <add> } else { <add> runTransition(); <add> } <ide> }, <ide> <ide> /** <ide><path>packages/ember-routing/lib/router.js <ide> Ember.Router = Ember.StateManager.extend( <ide> */ <ide> transitionEvent: 'connectOutlets', <ide> <add> transitionTo: function() { <add> this.abortRoutingPromises(); <add> this._super.apply(this, arguments); <add> }, <add> <ide> route: function(path) { <add> this.abortRoutingPromises(); <add> <ide> set(this, 'isRouting', true); <ide> <ide> var routableState; <ide> Ember.Router = Ember.StateManager.extend( <ide> } <ide> }, <ide> <add> abortRoutingPromises: function() { <add> if (this._routingPromises) { <add> this._routingPromises.abort(); <add> this._routingPromises = null; <add> } <add> }, <add> <add> /** <add> @private <add> */ <add> handleStatePromises: function(states, complete) { <add> this.abortRoutingPromises(); <add> <add> this.set('isLocked', true); <add> <add> var manager = this; <add> <add> this._routingPromises = Ember._PromiseChain.create({ <add> promises: states.slice(), <add> <add> successCallback: function() { <add> manager.set('isLocked', false); <add> complete(); <add> }, <add> <add> failureCallback: function() { <add> throw "Unable to load object"; <add> }, <add> <add> promiseSuccessCallback: function(item, args) { <add> set(item, 'object', args[0]); <add> }, <add> <add> abortCallback: function() { <add> manager.set('isLocked', false); <add> } <add> }).start(); <add> }, <add> <ide> /** @private */ <ide> init: function() { <ide> this._super(); <ide><path>packages/ember-routing/tests/routable_test.js <ide> test("should use a specified class `modelType` in the default `deserialize`", fu <ide> router.route("/users/1"); <ide> }); <ide> <del>module("default serialize and deserialize without modelType", { <add>var postSuccessCallback, postFailureCallback, <add> userSuccessCallback, userFailureCallback, <add> connectedUser, connectedPost, connectedChild, connectedOther, <add> isLoading, userLoaded; <add> <add>module("modelType with promise", { <ide> setup: function() { <ide> window.TestApp = Ember.Namespace.create(); <del> window.TestApp.Post = Ember.Object.extend(); <add> <add> window.TestApp.User = Ember.Object.extend({ <add> then: function(success, failure) { <add> userLoaded = true; <add> userSuccessCallback = success; <add> userFailureCallback = failure; <add> } <add> }); <add> window.TestApp.User.find = function(id) { <add> if (id === "1") { <add> return firstUser; <add> } <add> }; <add> <add> window.TestApp.Post = Ember.Object.extend({ <add> then: function(success, failure) { <add> postSuccessCallback = success; <add> postFailureCallback = failure; <add> } <add> }); <ide> window.TestApp.Post.find = function(id) { <add> // Simulate dependency on user <add> if (!userLoaded) { return; } <ide> if (id === "1") { return firstPost; } <ide> }; <ide> <del> window.TestApp.User = Ember.Object.extend(); <del> window.TestApp.User.find = function(id) { <del> if (id === "1") { return firstUser; } <add> firstUser = window.TestApp.User.create({ id: 1 }); <add> firstPost = window.TestApp.Post.create({ id: 1 }); <add> <add> router = Ember.Router.create({ <add> location: { <add> setURL: function(passedURL) { <add> url = passedURL; <add> } <add> }, <add> <add> root: Ember.Route.extend({ <add> users: Ember.Route.extend({ <add> route: '/users', <add> <add> user: Ember.Route.extend({ <add> route: '/:user_id', <add> modelType: 'TestApp.User', <add> <add> connectOutlets: function(router, obj) { <add> connectedUser = obj; <add> }, <add> <add> posts: Ember.Route.extend({ <add> route: '/posts', <add> <add> post: Ember.Route.extend({ <add> route: '/:post_id', <add> modelType: 'TestApp.Post', <add> <add> connectOutlets: function(router, obj) { <add> connectedPost = obj; <add> }, <add> <add> show: Ember.Route.extend({ <add> route: '/', <add> <add> connectOutlets: function(router) { <add> connectedChild = true; <add> } <add> }) <add> }) <add> }) <add> }) <add> }), <add> <add> other: Ember.Route.extend({ <add> route: '/other', <add> <add> connectOutlets: function() { <add> connectedOther = true; <add> } <add> }), <add> <add> loading: Ember.State.extend({ <add> connectOutlets: function() { <add> isLoading = true; <add> }, <add> <add> exit: function() { <add> isLoading = false; <add> } <add> }) <add> }) <add> }); <add> }, <add> <add> teardown: function() { <add> window.TestApp = undefined; <add> postSuccessCallback = postFailureCallback = undefined; <add> userSuccessCallback = userFailureCallback = undefined; <add> connectedUser = connectedPost = connectedChild = connectedOther = undefined; <add> isLoading = userLoaded = undefined; <add> } <add>}); <add> <add>test("should handle promise success", function() { <add> ok(!isLoading, 'precond - should not start loading'); <add> <add> Ember.run(function() { <add> router.route('/users/1/posts/1'); <add> }); <add> <add> ok(!connectedUser, 'precond - should not connect user immediately'); <add> ok(!connectedPost, 'precond - should not connect post immediately'); <add> ok(!connectedChild, 'precond - should not connect child immediately'); <add> ok(isLoading, 'should be loading'); <add> <add> Ember.run(function() { <add> userSuccessCallback('loadedUser'); <add> }); <add> <add> ok(!connectedUser, 'should not connect user until all promises are loaded'); <add> ok(!connectedPost, 'should not connect post until all promises are loaded'); <add> ok(!connectedChild, 'should not connect child until all promises are loaded'); <add> ok(isLoading, 'should still be loading'); <add> <add> Ember.run(function() { <add> postSuccessCallback('loadedPost'); <add> }); <add> <add> equal(connectedUser, 'loadedUser', 'should connect user after success callback'); <add> equal(connectedPost, 'loadedPost', 'should connect post after success callback'); <add> ok(connectedChild, "should connect child's outlets after success callback"); <add> ok(!isLoading, 'should not be loading'); <add>}); <add> <add>test("should handle early promise failure", function() { <add> router.route('/users/1/posts/1'); <add> <add> ok(userFailureCallback, 'precond - has failureCallback'); <add> <add> raises(function() { <add> userFailureCallback('failedUser'); <add> }, "Unable to load record.", "should throw exception on failure"); <add> <add> ok(!connectedUser, 'should not connect user after early failure'); <add> ok(!connectedPost, 'should not connect post after early failure'); <add> ok(!connectedChild, 'should not connect child after early failure'); <add>}); <add> <add>test("should handle late promise failure", function() { <add> router.route('/users/1/posts/1'); <add> <add> userSuccessCallback('loadedUser'); <add> <add> ok(postFailureCallback, 'precond - has failureCallback'); <add> <add> raises(function() { <add> postFailureCallback('failedPost'); <add> }, "Unable to load record.", "should throw exception on failure"); <add> <add> ok(!connectedUser, 'should not connect user after late failure'); <add> ok(!connectedPost, 'should not connect post after late failure'); <add> ok(!connectedChild, 'should not connect child after late failure'); <add>}); <add> <add>test("should stop promises if new route is targeted", function() { <add> router.route('/users/1/posts/1'); <add> <add> userSuccessCallback('loadedUser'); <add> <add> ok(!connectedOther, 'precond - has not yet connected other'); <add> <add> Ember.run(function() { <add> router.route('/other'); <add> }); <add> <add> ok(connectedOther, 'should connect other'); <add> <add> postSuccessCallback('loadedPost'); <add> <add> ok(!connectedUser, 'should not connect user after reroute'); <add> ok(!connectedPost, 'should not connect post after reroute'); <add> ok(!connectedChild, 'should not connect child after reroute'); <add>}); <add> <add>test("should stop promises if transitionTo is called", function() { <add> router.route('/users/1/posts/1'); <add> <add> userSuccessCallback('loadedUser'); <add> <add> ok(!connectedOther, 'precond - has not yet connected other'); <add> <add> Ember.run(function() { <add> router.transitionTo('other'); <add> }); <add> <add> ok(connectedOther, 'should connect other'); <add> <add> postSuccessCallback('loadedPost'); <add> <add> ok(!connectedUser, 'should not connect user after reroute'); <add> ok(!connectedPost, 'should not connect post after reroute'); <add> ok(!connectedChild, 'should not connect child after reroute'); <add>}); <add> <add>module("default serialize and deserialize without modelType", { <add> setup: function() { <add> window.TestApp = Ember.Namespace.create(); <add> window.TestApp.Post = Ember.Object.extend(); <add> window.TestApp.Post.find = function(id) { <add> if (id === "1") { return firstPost; } <ide> }; <ide> <ide> firstPost = window.TestApp.Post.create({ id: 1 }); <del> firstUser = window.TestApp.User.create({ id: 1 }); <ide> <ide> router = Ember.Router.create({ <ide> namespace: window.TestApp,
4
Javascript
Javascript
parse json response on error
8025f96fa177f0d343297ee6e6e5b54cd9011380
<ide><path>common/utils/ajax-stream.js <ide> function getCORSRequest() { <ide> } <ide> } <ide> <add>function parseXhrResponse(responseType, xhr) { <add> switch (responseType) { <add> case 'json': <add> if ('response' in xhr) { <add> return xhr.responseType ? <add> xhr.response : <add> JSON.parse(xhr.response || xhr.responseText || 'null'); <add> } else { <add> return JSON.parse(xhr.responseText || 'null'); <add> } <add> case 'xml': <add> return xhr.responseXML; <add> case 'text': <add> default: <add> return ('response' in xhr) ? xhr.response : xhr.responseText; <add> } <add>} <add> <ide> function normalizeAjaxSuccessEvent(e, xhr, settings) { <del> var response = ('response' in xhr) ? xhr.response : xhr.responseText; <del> response = settings.responseType === 'json' ? JSON.parse(response) : response; <ide> return { <del> response: response, <add> response: parseXhrResponse(settings.responseType || xhr.responseType, xhr), <ide> status: xhr.status, <ide> responseType: xhr.responseType, <ide> xhr: xhr, <ide> export function postJSON$(url, body) { <ide> headers: { <ide> 'Content-Type': 'application/json', <ide> Accept: 'application/json' <del> } <add> }, <add> normalizeError: (e, xhr) => parseXhrResponse('json', xhr) <ide> }) <ide> .map(({ response }) => response); <ide> } <ide> export function getJSON$(url) { <ide> headers: { <ide> 'Content-Type': 'application/json', <ide> Accept: 'application/json' <del> } <add> }, <add> normalizeError: (e, xhr) => parseXhrResponse('json', xhr) <ide> }).map(({ response }) => response); <ide> }
1
Mixed
Javascript
support uint8array prime in createdh
0db49fef4152e3642c2a0686c30bf59813e7ce1c
<ide><path>doc/api/crypto.md <ide> The `key` is the raw key used by the `algorithm` and `iv` is an <ide> <!-- YAML <ide> added: v0.11.12 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/11983 <add> description: The `prime` argument can be a `Uint8Array` now. <ide> - version: v6.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/5522 <ide> description: The default for the encoding parameters changed <ide> from `binary` to `utf8`. <ide> --> <del>- `prime` {string | Buffer} <add>- `prime` {string | Buffer | Uint8Array} <ide> - `prime_encoding` {string} <ide> - `generator` {number | string | Buffer | Uint8Array} Defaults to `2`. <ide> - `generator_encoding` {string} <ide> The `prime_encoding` and `generator_encoding` arguments can be `'latin1'`, <ide> `'hex'`, or `'base64'`. <ide> <ide> If `prime_encoding` is specified, `prime` is expected to be a string; otherwise <del>a [`Buffer`][] is expected. <add>a [`Buffer`][] or `Uint8Array` is expected. <ide> <ide> If `generator_encoding` is specified, `generator` is expected to be a string; <ide> otherwise either a number or [`Buffer`][] or `Uint8Array` is expected. <ide><path>lib/crypto.js <ide> const timingSafeEqual = binding.timingSafeEqual; <ide> const Buffer = require('buffer').Buffer; <ide> const stream = require('stream'); <ide> const util = require('util'); <add>const { isUint8Array } = process.binding('util'); <ide> const LazyTransform = require('internal/streams/lazy_transform'); <ide> <ide> const DH_GENERATOR = 2; <ide> function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) { <ide> if (!(this instanceof DiffieHellman)) <ide> return new DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding); <ide> <del> if (!(sizeOrKey instanceof Buffer) && <del> typeof sizeOrKey !== 'number' && <del> typeof sizeOrKey !== 'string') <del> throw new TypeError('First argument should be number, string or Buffer'); <add> if (typeof sizeOrKey !== 'number' && <add> typeof sizeOrKey !== 'string' && <add> !isUint8Array(sizeOrKey)) { <add> throw new TypeError('First argument should be number, string, ' + <add> 'Uint8Array or Buffer'); <add> } <ide> <ide> if (keyEncoding) { <ide> if (typeof keyEncoding !== 'string' || <ide><path>test/parallel/test-crypto-dh.js <ide> assert.strictEqual(dh1.verifyError, 0); <ide> assert.strictEqual(dh2.verifyError, 0); <ide> <ide> const argumentsError = <del> /^TypeError: First argument should be number, string or Buffer$/; <add> /^TypeError: First argument should be number, string, Uint8Array or Buffer$/; <ide> <ide> assert.throws(() => { <ide> crypto.createDiffieHellman([0x1, 0x2]); <ide> const modp2buf = Buffer.from([ <ide> 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec, 0xe6, 0x53, 0x81, <ide> 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff <ide> ]); <del>const exmodp2 = crypto.createDiffieHellman(modp2buf, Buffer.from([2])); <del>modp2.generateKeys(); <del>exmodp2.generateKeys(); <del>let modp2Secret = modp2.computeSecret(exmodp2.getPublicKey()).toString('hex'); <del>const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey()) <del> .toString('hex'); <del>assert.strictEqual(modp2Secret, exmodp2Secret); <del>assert.strictEqual(modp2.verifyError, DH_NOT_SUITABLE_GENERATOR); <del>assert.strictEqual(exmodp2.verifyError, DH_NOT_SUITABLE_GENERATOR); <del> <del> <del>// Ensure specific generator (string with encoding) works as expected. <del>const exmodp2_2 = crypto.createDiffieHellman(modp2buf, '02', 'hex'); <del>exmodp2_2.generateKeys(); <del>modp2Secret = modp2.computeSecret(exmodp2_2.getPublicKey()).toString('hex'); <del>const exmodp2_2Secret = exmodp2_2.computeSecret(modp2.getPublicKey()) <del> .toString('hex'); <del>assert.strictEqual(modp2Secret, exmodp2_2Secret); <del>assert.strictEqual(exmodp2_2.verifyError, DH_NOT_SUITABLE_GENERATOR); <del> <del> <del>// Ensure specific generator (string without encoding) works as expected. <del>const exmodp2_3 = crypto.createDiffieHellman(modp2buf, '\x02'); <del>exmodp2_3.generateKeys(); <del>modp2Secret = modp2.computeSecret(exmodp2_3.getPublicKey()).toString('hex'); <del>const exmodp2_3Secret = exmodp2_3.computeSecret(modp2.getPublicKey()) <del> .toString('hex'); <del>assert.strictEqual(modp2Secret, exmodp2_3Secret); <del>assert.strictEqual(exmodp2_3.verifyError, DH_NOT_SUITABLE_GENERATOR); <del> <del> <del>// Ensure specific generator (numeric) works as expected. <del>const exmodp2_4 = crypto.createDiffieHellman(modp2buf, 2); <del>exmodp2_4.generateKeys(); <del>modp2Secret = modp2.computeSecret(exmodp2_4.getPublicKey()).toString('hex'); <del>const exmodp2_4Secret = exmodp2_4.computeSecret(modp2.getPublicKey()) <del> .toString('hex'); <del>assert.strictEqual(modp2Secret, exmodp2_4Secret); <del>assert.strictEqual(exmodp2_4.verifyError, DH_NOT_SUITABLE_GENERATOR); <add> <add>{ <add> const exmodp2 = crypto.createDiffieHellman(modp2buf, Buffer.from([2])); <add> modp2.generateKeys(); <add> exmodp2.generateKeys(); <add> const modp2Secret = modp2.computeSecret(exmodp2.getPublicKey()) <add> .toString('hex'); <add> const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey()) <add> .toString('hex'); <add> assert.strictEqual(modp2Secret, exmodp2Secret); <add> assert.strictEqual(modp2.verifyError, DH_NOT_SUITABLE_GENERATOR); <add> assert.strictEqual(exmodp2.verifyError, DH_NOT_SUITABLE_GENERATOR); <add>} <add> <add>{ <add> // Ensure specific generator (string with encoding) works as expected. <add> const exmodp2 = crypto.createDiffieHellman(modp2buf, '02', 'hex'); <add> exmodp2.generateKeys(); <add> const modp2Secret = modp2.computeSecret(exmodp2.getPublicKey()) <add> .toString('hex'); <add> const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey()) <add> .toString('hex'); <add> assert.strictEqual(modp2Secret, exmodp2Secret); <add> assert.strictEqual(exmodp2.verifyError, DH_NOT_SUITABLE_GENERATOR); <add>} <add> <add>{ <add> // Ensure specific generator (string with encoding) works as expected, <add> // with a Uint8Array as the first argument to createDiffieHellman(). <add> const exmodp2 = crypto.createDiffieHellman(new Uint8Array(modp2buf), <add> '02', 'hex'); <add> exmodp2.generateKeys(); <add> const modp2Secret = modp2.computeSecret(exmodp2.getPublicKey()) <add> .toString('hex'); <add> const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey()) <add> .toString('hex'); <add> assert.strictEqual(modp2Secret, exmodp2Secret); <add> assert.strictEqual(exmodp2.verifyError, DH_NOT_SUITABLE_GENERATOR); <add>} <add> <add>{ <add> // Ensure specific generator (string without encoding) works as expected. <add> const exmodp2 = crypto.createDiffieHellman(modp2buf, '\x02'); <add> exmodp2.generateKeys(); <add> const modp2Secret = modp2.computeSecret(exmodp2.getPublicKey()) <add> .toString('hex'); <add> const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey()) <add> .toString('hex'); <add> assert.strictEqual(modp2Secret, exmodp2Secret); <add> assert.strictEqual(exmodp2.verifyError, DH_NOT_SUITABLE_GENERATOR); <add>} <add> <add>{ <add> // Ensure specific generator (numeric) works as expected. <add> const exmodp2 = crypto.createDiffieHellman(modp2buf, 2); <add> exmodp2.generateKeys(); <add> const modp2Secret = modp2.computeSecret(exmodp2.getPublicKey()) <add> .toString('hex'); <add> const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey()) <add> .toString('hex'); <add> assert.strictEqual(modp2Secret, exmodp2Secret); <add> assert.strictEqual(exmodp2.verifyError, DH_NOT_SUITABLE_GENERATOR); <add>} <ide> <ide> <ide> const p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' +
3
Ruby
Ruby
reduce footprint of readline hack
0b425178ec51c076b0acddd7f38b3cc2302dfccd
<ide><path>Library/Homebrew/debrew.rb <del>def can_use_readline? <del> not ENV['HOMEBREW_NO_READLINE'] <del>end <del> <ide> require 'debrew/menu' <ide> require 'debrew/raise_plus' <del>require 'debrew/irb' if can_use_readline? <del> <del>class Object <del> include RaisePlus <del>end <ide> <del>def has_debugger? <add>unless ENV['HOMEBREW_NO_READLINE'] <ide> begin <ide> require 'rubygems' <ide> require 'ruby-debug' <del> true <ide> rescue LoadError <del> false <del> end if can_use_readline? <add> end <add> <add> require 'debrew/irb' <add>end <add> <add>class Object <add> include RaisePlus <ide> end <ide> <ide> def debrew(exception, formula=nil) <ide> def debrew(exception, formula=nil) <ide> menu.choice(:debug) do <ide> puts "When you exit the debugger, execution will continue." <ide> exception.restart { debugger } <del> end if has_debugger? <add> end if Object.const_defined?(:Debugger) <ide> menu.choice(:irb) do <ide> puts "When you exit this IRB session, execution will continue." <ide> exception.restart do <ide> def debrew(exception, formula=nil) <ide> end <ide> } <ide> end <del> end if can_use_readline? <add> end if Object.const_defined?(:IRB) <ide> menu.choice(:shell) do <ide> puts "When you exit this shell, you will return to the menu." <ide> interactive_shell formula
1
Javascript
Javascript
use common.buildtype in repl-domain-abort
2f47b6869ad4e5f49a8234edd2635fef6f0bb6c6
<ide><path>test/addons/repl-domain-abort/test.js <ide> const assert = require('assert'); <ide> const repl = require('repl'); <ide> const stream = require('stream'); <ide> const path = require('path'); <del>const buildType = process.config.target_defaults.default_configuration; <del>let buildPath = path.join(__dirname, 'build', buildType, 'binding'); <add>let buildPath = path.join(__dirname, 'build', common.buildType, 'binding'); <ide> // On Windows, escape backslashes in the path before passing it to REPL. <ide> if (common.isWindows) <ide> buildPath = buildPath.replace(/\\/g, '/');
1
Javascript
Javascript
increase timeout for statstestcases
ad308f9d5ac064b4eb6b861c88087adfe38e7f14
<ide><path>test/StatsTestCases.test.js <ide> const tests = fs <ide> describe("StatsTestCases", () => { <ide> tests.forEach(testName => { <ide> it("should print correct stats for " + testName, done => { <del> jest.setTimeout(10000); <add> jest.setTimeout(30000); <ide> let options = { <ide> mode: "development", <ide> entry: "./index",
1
PHP
PHP
remove duplicate line
2dfb40bac053041dcbe2b59e963f8064ce36df54
<ide><path>lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php <ide> public function testAddMiddle() { <ide> $expected = array_merge(array($modelClass => array('name' => 'testAddMiddle', $parentField => '2')), $result); <ide> $this->assertSame($expected, $result); <ide> <del> $laterCount = $this->Tree->find('count'); <del> <ide> $laterCount = $this->Tree->find('count'); <ide> $this->assertEquals($initialCount + 1, $laterCount); <ide>
1
Python
Python
improve cumsum documentation
99bb6a48ced27e5ce7bbf1fc7b606c5bd840af3a
<ide><path>numpy/core/fromnumeric.py <ide> def cumsum(a, axis=None, dtype=None, out=None): <ide> Arithmetic is modular when using integer types, and no error is <ide> raised on overflow. <ide> <add> ``cumsum(a)[-1]`` may not be equal to ``sum(a)`` for floating-point <add> values since ``sum`` may use a pairwise summation routine, reducing <add> the roundoff-error. See `sum` for more information. <add> <ide> Examples <ide> -------- <ide> >>> a = np.array([[1,2,3], [4,5,6]]) <ide> def cumsum(a, axis=None, dtype=None, out=None): <ide> array([[ 1, 3, 6], <ide> [ 4, 9, 15]]) <ide> <add> ``cumsum(b)[-1]`` may not be equal to ``sum(b)`` <add> <add> >>> b = np.array([1, 2e-9, 3e-9] * 1000000) <add> >>> b.cumsum()[-1] <add> 1000000.0050045159 <add> >>> b.sum() <add> 1000000.0050000029 <add> <ide> """ <ide> return _wrapfunc(a, 'cumsum', axis=axis, dtype=dtype, out=out) <ide>
1
Javascript
Javascript
update example to use a module
aecdd9d630aad424d487c91ff90463bd8e026660
<ide><path>src/ng/directive/ngInit.js <ide> * @param {expression} ngInit {@link guide/expression Expression} to eval. <ide> * <ide> * @example <del> <example> <add> <example module="initExample"> <ide> <file name="index.html"> <ide> <script> <del> function Ctrl($scope) { <del> $scope.list = [['a', 'b'], ['c', 'd']]; <del> } <add> angular.module('initExample', []) <add> .controller('ExampleController', ['$scope', function($scope) { <add> $scope.list = [['a', 'b'], ['c', 'd']]; <add> }]); <ide> </script> <del> <div ng-controller="Ctrl"> <add> <div ng-controller="ExampleController"> <ide> <div ng-repeat="innerList in list" ng-init="outerIndex = $index"> <ide> <div ng-repeat="value in innerList" ng-init="innerIndex = $index"> <ide> <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
1
Javascript
Javascript
display error informations to top left (#615)
ef06aeee450d57e1b05a37df4e73e0aeca8b1469
<ide><path>pages/_error-debug.js <ide> export default class ErrorDebug extends React.Component { <ide> `}</style> <ide> <style jsx>{` <ide> .errorDebug { <del> height: 100vh; <add> height: 100%; <ide> padding: 16px; <ide> box-sizing: border-box; <del> display: flex; <del> flex-direction: column; <del> align-items: center; <del> justify-content: center; <ide> } <ide> <ide> .message {
1
PHP
PHP
fix code style
eb41172e22a28fcfa7e3ffbcc71e2d449a84fc6c
<ide><path>tests/View/Blade/BladeVerbatimTest.php <ide> public function testMultilineTemplatesWithRawBlocksAreRenderedInTheRightOrder() <ide> @include("users") <ide> @verbatim <ide> {{ $fourth }} @include("test") <del>@endverbatim <add>@endverbatim <ide> @php echo $fifth; @endphp'; <ide> <ide> $expected = '<?php echo e($first); ?> <ide> public function testMultilineTemplatesWithRawBlocksAreRenderedInTheRightOrder() <ide> <?php echo $__env->make("users", \Illuminate\Support\Arr::except(get_defined_vars(), [\'__data\', \'__path\']))->render(); ?> <ide> <ide> {{ $fourth }} @include("test") <del> <add> <ide> <?php echo $fifth; ?>'; <ide> <ide> $this->assertSame($expected, $this->compiler->compileString($string));
1
Text
Text
remove duplicate options
686e092202514dfc3cf93a463e9177a80dd42133
<ide><path>doc/api/child_process.md <ide> changes: <ide> <ide> * `command` {string} The command to run, with space-separated arguments. <ide> * `options` {Object} <del> * `timeout` {number} (Default: `0`) <ide> * `cwd` {string} Current working directory of the child process. <ide> * `env` {Object} Environment key-value pairs. <ide> * `encoding` {string} **Default:** `'utf8'`
1
Ruby
Ruby
update to_param docs [ci skip]
03404936945b452b8e66e53e183973176dae8301
<ide><path>activesupport/lib/active_support/core_ext/object/to_param.rb <ide> def to_param <ide> end <ide> <ide> class NilClass <add> # Returns +self+. <ide> def to_param <ide> self <ide> end <ide> end <ide> <ide> class TrueClass <add> # Returns +self+. <ide> def to_param <ide> self <ide> end <ide> end <ide> <ide> class FalseClass <add> # Returns +self+. <ide> def to_param <ide> self <ide> end <ide> class Hash <ide> # Returns a string representation of the receiver suitable for use as a URL <ide> # query string: <ide> # <del> # {:name => 'David', :nationality => 'Danish'}.to_param <add> # {name: 'David', nationality: 'Danish'}.to_param <ide> # # => "name=David&nationality=Danish" <ide> # <ide> # An optional namespace can be passed to enclose the param names: <ide> # <del> # {:name => 'David', :nationality => 'Danish'}.to_param('user') <add> # {name: 'David', nationality: 'Danish'}.to_param('user') <ide> # # => "user[name]=David&user[nationality]=Danish" <ide> # <ide> # The string pairs "key=value" that conform the query string
1
Python
Python
set version to v2.1.0a11
4e8a07c7d343ae82b78bd7375785f9e150b3e64b
<ide><path>spacy/about.py <ide> # fmt: off <ide> <ide> __title__ = "spacy-nightly" <del>__version__ = "2.1.0a10" <add>__version__ = "2.1.0a11" <ide> __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython" <ide> __uri__ = "https://spacy.io" <ide> __author__ = "Explosion AI"
1
Ruby
Ruby
show the right file when test raises
ccee7eea8e5a8a34256467dd1096ac549dd17362
<ide><path>railties/lib/rails/test_unit/reporter.rb <ide> def aggregated_results # :nodoc: <ide> filtered_results = results.dup <ide> filtered_results.reject!(&:skipped?) unless options[:verbose] <ide> filtered_results.map do |result| <del> result.failures.map { |failure| <del> "bin/rails test #{failure.location}\n" <del> }.join "\n" <del> end.join <add> location, line = result.method(result.name).source_location <add> "bin/rails test #{location}:#{line}" <add> end.join "\n" <ide> end <ide> end <ide> end <ide><path>railties/test/application/test_test.rb <ide> def test_failure <ide> <ide> output = run_test_file('unit/failing_test.rb', env: { "BACKTRACE" => "1" }) <ide> assert_match %r{/app/test/unit/failing_test\.rb}, output <add> assert_match %r{/app/test/unit/failing_test\.rb:4}, output <ide> end <ide> <ide> test "ruby schema migrations" do
2
PHP
PHP
use type constants in postgres schema
17381f2cba1ae1604db4b03b1671aea52aa828eb
<ide><path>src/Database/Schema/PostgresSchema.php <ide> namespace Cake\Database\Schema; <ide> <ide> use Cake\Database\Exception; <add>use Cake\Database\Schema\TableSchema; <ide> <ide> /** <ide> * Schema management/reflection features for Postgres. <ide> protected function _convertColumn($column) <ide> return ['type' => $col, 'length' => null]; <ide> } <ide> if (strpos($col, 'timestamp') !== false) { <del> return ['type' => 'timestamp', 'length' => null]; <add> return ['type' => TableSchema::TYPE_TIMESTAMP, 'length' => null]; <ide> } <ide> if (strpos($col, 'time') !== false) { <del> return ['type' => 'time', 'length' => null]; <add> return ['type' => TableSchema::TYPE_TIME, 'length' => null]; <ide> } <ide> if ($col === 'serial' || $col === 'integer') { <del> return ['type' => 'integer', 'length' => 10]; <add> return ['type' => TableSchema::TYPE_INTEGER, 'length' => 10]; <ide> } <ide> if ($col === 'bigserial' || $col === 'bigint') { <del> return ['type' => 'biginteger', 'length' => 20]; <add> return ['type' => TableSchema::TYPE_BIGINTEGER, 'length' => 20]; <ide> } <ide> if ($col === 'smallint') { <del> return ['type' => 'smallinteger', 'length' => 5]; <add> return ['type' => TableSchema::TYPE_SMALLINTEGER, 'length' => 5]; <ide> } <ide> if ($col === 'inet') { <del> return ['type' => 'string', 'length' => 39]; <add> return ['type' => TableSchema::TYPE_STRING, 'length' => 39]; <ide> } <ide> if ($col === 'uuid') { <del> return ['type' => 'uuid', 'length' => null]; <add> return ['type' => TableSchema::TYPE_UUID, 'length' => null]; <ide> } <ide> if ($col === 'char' || $col === 'character') { <del> return ['type' => 'string', 'fixed' => true, 'length' => $length]; <add> return ['type' => TableSchema::TYPE_STRING, 'fixed' => true, 'length' => $length]; <ide> } <ide> // money is 'string' as it includes arbitrary text content <ide> // before the number value. <ide> if (strpos($col, 'char') !== false || <ide> strpos($col, 'money') !== false <ide> ) { <del> return ['type' => 'string', 'length' => $length]; <add> return ['type' => TableSchema::TYPE_STRING, 'length' => $length]; <ide> } <ide> if (strpos($col, 'text') !== false) { <del> return ['type' => 'text', 'length' => null]; <add> return ['type' => TableSchema::TYPE_TEXT, 'length' => null]; <ide> } <ide> if ($col === 'bytea') { <del> return ['type' => 'binary', 'length' => null]; <add> return ['type' => TableSchema::TYPE_BINARY, 'length' => null]; <ide> } <ide> if ($col === 'real' || strpos($col, 'double') !== false) { <del> return ['type' => 'float', 'length' => null]; <add> return ['type' => TableSchema::TYPE_FLOAT, 'length' => null]; <ide> } <ide> if (strpos($col, 'numeric') !== false || <ide> strpos($col, 'decimal') !== false <ide> ) { <del> return ['type' => 'decimal', 'length' => null]; <add> return ['type' => TableSchema::TYPE_DECIMAL, 'length' => null]; <ide> } <ide> <ide> if (strpos($col, 'json') !== false) { <del> return ['type' => 'json', 'length' => null]; <add> return ['type' => TableSchema::TYPE_JSON, 'length' => null]; <ide> } <ide> <del> return ['type' => 'string', 'length' => null]; <add> return ['type' => TableSchema::TYPE_STRING, 'length' => null]; <ide> } <ide> <ide> /** <ide> public function convertColumnDescription(TableSchema $schema, $row) <ide> { <ide> $field = $this->_convertColumn($row['type']); <ide> <del> if ($field['type'] === 'boolean') { <add> if ($field['type'] === TableSchema::TYPE_BOOLEAN) { <ide> if ($row['default'] === 'true') { <ide> $row['default'] = 1; <ide> } <ide> public function columnSql(TableSchema $schema, $name) <ide> $data = $schema->column($name); <ide> $out = $this->_driver->quoteIdentifier($name); <ide> $typeMap = [ <del> 'tinyinteger' => ' SMALLINT', <del> 'smallinteger' => ' SMALLINT', <del> 'boolean' => ' BOOLEAN', <del> 'binary' => ' BYTEA', <del> 'float' => ' FLOAT', <del> 'decimal' => ' DECIMAL', <del> 'date' => ' DATE', <del> 'time' => ' TIME', <del> 'datetime' => ' TIMESTAMP', <del> 'timestamp' => ' TIMESTAMP', <del> 'uuid' => ' UUID', <del> 'json' => ' JSONB' <add> TableSchema::TYPE_TINYINTEGER => ' SMALLINT', <add> TableSchema::TYPE_SMALLINTEGER => ' SMALLINT', <add> TableSchema::TYPE_BINARY => ' BYTEA', <add> TableSchema::TYPE_BOOLEAN => ' BOOLEAN', <add> TableSchema::TYPE_FLOAT => ' FLOAT', <add> TableSchema::TYPE_DECIMAL => ' DECIMAL', <add> TableSchema::TYPE_DATE => ' DATE', <add> TableSchema::TYPE_TIME => ' TIME', <add> TableSchema::TYPE_DATETIME => ' TIMESTAMP', <add> TableSchema::TYPE_TIMESTAMP => ' TIMESTAMP', <add> TableSchema::TYPE_UUID => ' UUID', <add> TableSchema::TYPE_JSON => ' JSONB' <ide> ]; <ide> <ide> if (isset($typeMap[$data['type']])) { <ide> $out .= $typeMap[$data['type']]; <ide> } <ide> <del> if ($data['type'] === 'integer' || $data['type'] === 'biginteger') { <del> $type = $data['type'] === 'integer' ? ' INTEGER' : ' BIGINT'; <add> if ($data['type'] === TableSchema::TYPE_INTEGER || $data['type'] === TableSchema::TYPE_BIGINTEGER) { <add> $type = $data['type'] === TableSchema::TYPE_INTEGER ? ' INTEGER' : ' BIGINT'; <ide> if ([$name] === $schema->primaryKey() || $data['autoIncrement'] === true) { <del> $type = $data['type'] === 'integer' ? ' SERIAL' : ' BIGSERIAL'; <add> $type = $data['type'] === TableSchema::TYPE_INTEGER ? ' SERIAL' : ' BIGSERIAL'; <ide> unset($data['null'], $data['default']); <ide> } <ide> $out .= $type; <ide> } <ide> <del> if ($data['type'] === 'text' && $data['length'] !== TableSchema::LENGTH_TINY) { <add> if ($data['type'] === TableSchema::TYPE_TEXT && $data['length'] !== TableSchema::LENGTH_TINY) { <ide> $out .= ' TEXT'; <ide> } <ide> <del> if ($data['type'] === 'string' || ($data['type'] === 'text' && $data['length'] === TableSchema::LENGTH_TINY)) { <add> if ($data['type'] === TableSchema::TYPE_STRING || <add> ($data['type'] === TableSchema::TYPE_TEXT && $data['length'] === TableSchema::LENGTH_TINY) <add> ) { <ide> $isFixed = !empty($data['fixed']); <ide> $type = ' VARCHAR'; <ide> if ($isFixed) { <ide> public function columnSql(TableSchema $schema, $name) <ide> } <ide> } <ide> <del> $hasCollate = ['text', 'string']; <add> $hasCollate = [TableSchema::TYPE_TEXT, TableSchema::TYPE_STRING]; <ide> if (in_array($data['type'], $hasCollate, true) && isset($data['collate']) && $data['collate'] !== '') { <ide> $out .= ' COLLATE "' . $data['collate'] . '"'; <ide> } <ide> <del> if ($data['type'] === 'float' && isset($data['precision'])) { <add> if ($data['type'] === TableSchema::TYPE_FLOAT && isset($data['precision'])) { <ide> $out .= '(' . (int)$data['precision'] . ')'; <ide> } <ide> <del> if ($data['type'] === 'decimal' && <add> if ($data['type'] === TableSchema::TYPE_DECIMAL && <ide> (isset($data['length']) || isset($data['precision'])) <ide> ) { <ide> $out .= '(' . (int)$data['length'] . ',' . (int)$data['precision'] . ')'; <ide> public function columnSql(TableSchema $schema, $name) <ide> } <ide> <ide> if (isset($data['default']) && <del> in_array($data['type'], ['timestamp', 'datetime']) && <del> strtolower($data['default']) === 'current_timestamp') { <add> in_array($data['type'], [TableSchema::TYPE_TIMESTAMP, TableSchema::TYPE_DATETIME]) && <add> strtolower($data['default']) === 'current_timestamp' <add> ) { <ide> $out .= ' DEFAULT CURRENT_TIMESTAMP'; <ide> } elseif (isset($data['default'])) { <ide> $defaultValue = $data['default'];
1
PHP
PHP
update fixtureinjector with addwarning
eaca7ca34fb058e9fdd31bee5150a2a4a2649cd6
<ide><path>src/TestSuite/Fixture/FixtureInjector.php <ide> use PHPUnit_Framework_Test; <ide> use PHPUnit_Framework_TestListener; <ide> use PHPUnit_Framework_TestSuite; <add>use PHPUnit_Framework_Warning; <add> <ide> <ide> /** <ide> * Test listener used to inject a fixture manager in all tests that <ide> public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) <ide> { <ide> } <ide> <add> /** <add> * Not Implemented <add> * <add> * @param \PHPUnit_Framework_Test $test The test to add warnings from. <add> * @param \PHPUnit_Warning $e The warning <add> * @param float $time current time <add> * @return void <add> */ <add> public function addWarning(PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time) <add> { <add> } <add> <ide> /** <ide> * Not Implemented <ide> *
1
Python
Python
remove unittest dependencies in numpy/f2py/tests
69bc7b19d2a665c8301c3df07aee61fc469ff4e3
<ide><path>numpy/f2py/tests/test_array_from_pyobj.py <ide> wrap = None <ide> <ide> <del>def setup(): <add>def setup_module(): <ide> """ <ide> Build the required testing extension module <ide> <ide> def has_shared_memory(self): <ide> return obj_attr[0] == self.arr_attr[0] <ide> <ide> <del>class test_intent(unittest.TestCase): <add>class TestIntent(object): <ide> <ide> def test_in_out(self): <ide> assert_equal(str(intent.in_.out), 'intent(in,out)') <ide> def test_in_out(self): <ide> assert_(not intent.in_.is_intent('c')) <ide> <ide> <del>class _test_shared_memory: <add>class _test_shared_memory(object): <ide> num2seq = [1, 2] <ide> num23seq = [[1, 2, 3], [4, 5, 6]] <ide> <ide> def test_inplace_from_casttype(self): <ide> <ide> for t in _type_names: <ide> exec('''\ <del>class test_%s_gen(unittest.TestCase, <del> _test_shared_memory <del> ): <del> def setUp(self): <add>class TestGen_%s(_test_shared_memory): <add> def setup(self): <ide> self.type = Type(%r) <ide> array = lambda self,dims,intent,obj: Array(Type(%r),dims,intent,obj) <ide> ''' % (t, t, t)) <ide> <ide> if __name__ == "__main__": <del> setup() <add> setup_module() <ide> run_module_suite() <ide><path>numpy/f2py/tests/util.py <ide> class F2PyTest(object): <ide> module = None <ide> module_name = None <ide> <del> def setUp(self): <add> def setup(self): <ide> if self.module is not None: <ide> return <ide>
2
Java
Java
switch responseencodedhtmlescape default to true
3bfe4dcca7ec9e6b2bb2e21a5d5b7c6737f60216
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContext.java <ide> else if (localeResolver != null) { <ide> // context-param in web.xml, if any. <ide> this.defaultHtmlEscape = WebUtils.getDefaultHtmlEscape(this.webApplicationContext.getServletContext()); <ide> <add> // Determine response-encoded HTML escape setting from the "responseEncodedHtmlEscape" <add> // context-param in web.xml, if any. <ide> this.responseEncodedHtmlEscape = WebUtils.getResponseEncodedHtmlEscape(this.webApplicationContext.getServletContext()); <ide> <ide> this.urlPathHelper = new UrlPathHelper(); <ide> public Boolean getDefaultHtmlEscape() { <ide> /** <ide> * Is HTML escaping using the response encoding by default? <ide> * If enabled, only XML markup significant characters will be escaped with UTF-* encodings. <del> * <p>Falls back to {@code false} in case of no explicit default given. <add> * <p>Falls back to {@code true} in case of no explicit default given, as of Spring 4.2. <ide> * @since 4.1.2 <ide> */ <ide> public boolean isResponseEncodedHtmlEscape() { <del> return (this.responseEncodedHtmlEscape != null && this.responseEncodedHtmlEscape.booleanValue()); <add> return (this.responseEncodedHtmlEscape == null || this.responseEncodedHtmlEscape.booleanValue()); <ide> } <ide> <ide> /**
1
Javascript
Javascript
handle esc key properly inside of the closebutton
f5fd94f61012af2269a5528746c7d62a7b435467
<ide><path>src/js/close-button.js <ide> */ <ide> import Button from './button'; <ide> import Component from './component'; <add>import keycode from 'keycode'; <ide> <ide> /** <ide> * The `CloseButton` is a `{@link Button}` that fires a `close` event when <ide> class CloseButton extends Button { <ide> */ <ide> this.trigger({type: 'close', bubbles: false}); <ide> } <add> /** <add> * Event handler that is called when a `CloseButton` receives a <add> * `keydown` event. <add> * <add> * By default, if the key is Esc, it will trigger a `click` event. <add> * <add> * @param {EventTarget~Event} event <add> * The `keydown` event that caused this function to be called. <add> * <add> * @listens keydown <add> */ <add> handleKeyDown(event) { <add> // Esc button will trigger `click` event <add> if (keycode.isEventKey(event, 'Esc')) { <add> event.preventDefault(); <add> event.stopPropagation(); <add> this.trigger('click'); <add> } else { <add> // Pass keypress handling up for unsupported keys <add> super.handleKeyDown(event); <add> } <add> } <ide> } <ide> <ide> Component.registerComponent('CloseButton', CloseButton); <ide><path>test/unit/close-button.test.js <ide> import CloseButton from '../../src/js/close-button'; <ide> import sinon from 'sinon'; <ide> import TestHelpers from './test-helpers'; <ide> <add>const getMockEscapeEvent = () => ({ <add> which: 27, <add> preventDefault() {}, <add> stopPropagation() {} <add>}); <add> <ide> QUnit.module('CloseButton', { <ide> <ide> beforeEach() { <ide> QUnit.test('should trigger an event on activation', function(assert) { <ide> assert.expect(1); <ide> assert.strictEqual(spy.callCount, 1, 'the "close" event was triggered'); <ide> }); <add> <add>QUnit.test('pressing ESC triggers close()', function(assert) { <add> const spy = sinon.spy(); <add> <add> this.btn.on('close', spy); <add> this.btn.handleKeyDown(getMockEscapeEvent()); <add> assert.expect(1); <add> assert.strictEqual(spy.callCount, 1, 'ESC closed the modal'); <add>});
2
PHP
PHP
remove nonexistent params and returns
f46d93805d81d8e10133a410a511eb2dc0eb6f4b
<ide><path>src/Console/Command/UpgradeShell.php <ide> public function app_uses() { <ide> * Replace all the App::uses() calls with `use`. <ide> * <ide> * @param string $file The file to search and replace. <del> * @param boolean $dryRun Whether or not to do the thing <del> * @return mixed Replacement of uses call <ide> */ <ide> protected function _replaceUses($file) { <ide> $pattern = '#App::uses\([\'"]([a-z0-9_]+)[\'"],\s*[\'"]([a-z0-9/_]+)(?:\.([a-z0-9/_]+))?[\'"]\)#i'; <ide><path>src/Controller/Component/Acl/IniAcl.php <ide> public function initialize(Component $component) { <ide> * @param string $aro ARO The requesting object identifier. <ide> * @param string $aco ACO The controlled object identifier. <ide> * @param string $action Action (defaults to *) <del> * @return boolean Success <ide> */ <ide> public function allow($aro, $aco, $action = "*") { <ide> } <ide> public function allow($aro, $aco, $action = "*") { <ide> * @param string $aro ARO The requesting object identifier. <ide> * @param string $aco ACO The controlled object identifier. <ide> * @param string $action Action (defaults to *) <del> * @return boolean Success <ide> */ <ide> public function deny($aro, $aco, $action = "*") { <ide> } <ide> public function deny($aro, $aco, $action = "*") { <ide> * @param string $aro ARO The requesting object identifier. <ide> * @param string $aco ACO The controlled object identifier. <ide> * @param string $action Action (defaults to *) <del> * @return boolean Success <ide> */ <ide> public function inherit($aro, $aco, $action = "*") { <ide> } <ide><path>src/Controller/Component/Auth/BaseAuthenticate.php <ide> public function getUser(Request $request) { <ide> * <ide> * @param Cake\Network\Request $request A request object. <ide> * @param Cake\Network\Response $response A response object. <del> * @return mixed Either true to indicate the unauthenticated request has been <del> * dealt with and no more action is required by AuthComponent or void (default). <ide> */ <ide> public function unauthenticated(Request $request, Response $response) { <ide> } <ide><path>src/Controller/Component/PaginatorComponent.php <ide> public function getDefaults($alias, $defaults) { <ide> * <ide> * @param Table $object The model being paginated. <ide> * @param array $options The pagination options being used for this request. <del> * @param array $whitelist The list of columns that can be used for sorting. If empty all keys are allowed. <ide> * @return array An array of options with sort + direction removed and replaced with order if possible. <ide> */ <ide> public function validateSort(Table $object, array $options) { <ide><path>src/Controller/Component/RequestHandlerComponent.php <ide> protected function _setExtension() { <ide> * to the $data property of the controller, which can then be saved to a model object. <ide> * <ide> * @param Event $event The startup event that was fired. <del> * @param Controller $controller A reference to the controller <ide> * @return void <ide> */ <ide> public function startup(Event $event) { <ide> public function beforeRedirect(Event $event, $url, $response) { <ide> * "304 Not Modified" header. <ide> * <ide> * @param Event $event The Controller.beforeRender event. <del> * @param Controller $controller <ide> * @return boolean false if the render process should be aborted <ide> */ <ide> public function beforeRender(Event $event) { <ide><path>src/Controller/Controller.php <ide> public function beforeRender(Event $event) { <ide> * or an absolute URL <ide> * @param integer $status Optional HTTP status code (eg: 404) <ide> * @param boolean $exit If true, exit() will be called after the redirect <del> * @return mixed <ide> * false to stop redirection event, <ide> * string controllers a new redirection URL or <ide> * array with the keys url, status and exit to be used by the redirect method. <ide> public function beforeRedirect(Event $event, $url, $status = null, $exit = true) <ide> * Called after the controller action is run and rendered. <ide> * <ide> * @param Event $event An Event instance <del> * @return void <ide> * @link http://book.cakephp.org/2.0/en/controllers.html#request-life-cycle-callbacks <ide> */ <ide> public function afterFilter(Event $event) { <ide><path>src/Database/Connection.php <ide> class Connection { <ide> * Constructor <ide> * <ide> * @param array $config configuration for connecting to database <del> * @return self <ide> */ <ide> public function __construct($config) { <ide> $this->_config = $config; <ide><path>src/Database/IdentifierQuoter.php <ide> protected function _quoteJoins($joins) { <ide> * Quotes the table name and columns for an insert query <ide> * <ide> * @param Query $query <del> * @return Query <ide> */ <ide> protected function _quoteInsert($query) { <ide> list($table, $columns) = $query->clause('insert'); <ide><path>src/Network/Http/Message.php <ide> public function cookies() { <ide> /** <ide> * Get the HTTP version used. <ide> * <del> * @param null|string $version <ide> * @return string <ide> */ <ide> public function version() { <ide><path>src/ORM/Associations.php <ide> public function saveParents(Table $table, Entity $entity, $associations, $option <ide> * <ide> * @param Table $table The table entity is for. <ide> * @param Entity $entity The entity to save associated data for. <del> * @param Entity $entity The entity to save associated data for. <ide> * @param array $associations The list of associations to save children from. <ide> * associations not in this list will not be saved. <ide> * @param array $options The options for the save operation.
10
Text
Text
add caution to any type documentation
28b92c31a7638ef0fbf1dc62b597de0be3d85c20
<ide><path>guide/english/typescript/any-type/index.md <ide> title: Any Type <ide> <ide> The Any type instructs Typescript to suspend type checking for the specified variables. Useful when working with dynamic content for which you don't know the type, and for transitioning your codebase from Javascript to Typescript in pieces. You can use Javascript's implicit typing with variables declared with a type of Any. <ide> <add>Although the Any type can be helpful in specific circumstances, it should be used with caution, since it means we opt out of TypeScript's typechecking. <add> <ide> ```typescript <ide> let notSure: any = 4; <ide> notSure = "maybe a string instead";
1
Javascript
Javascript
drop the tests relying on applets
95c0a10e15477a5031185e2d656d896905562afa
<ide><path>test/unit/data.js <ide> test("jQuery.data(<embed>)", 25, function() { <ide> dataTests( document.createElement("embed") ); <ide> }); <ide> <del>test("jQuery.data(<applet>)", 25, function() { <del> dataTests( document.createElement("applet") ); <del>}); <del> <ide> test("jQuery.data(object/flash)", 25, function() { <ide> var flash = document.createElement("object"); <ide> flash.setAttribute( "classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ); <ide> test(".data doesn't throw when calling selection is empty. #13551", function() { <ide> } <ide> }); <ide> <del>test("jQuery.acceptData", 11, function() { <add>test("jQuery.acceptData", function() { <add> expect( 10 ); <add> <ide> var flash, pdf; <ide> <ide> ok( jQuery.acceptData( document ), "document" ); <ide> ok( jQuery.acceptData( document.documentElement ), "documentElement" ); <ide> ok( jQuery.acceptData( {} ), "object" ); <ide> ok( jQuery.acceptData( document.createElement( "embed" ) ), "embed" ); <del> ok( jQuery.acceptData( document.createElement( "applet" ) ), "applet" ); <ide> <ide> flash = document.createElement( "object" ); <ide> flash.setAttribute( "classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" );
1
Java
Java
address various extendedbeaninfo bugs
b50bb5071ac353e77e9d38c72f888de3add923b2
<ide><path>spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java <ide> <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <add>import org.springframework.core.BridgeMethodResolver; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.util.ReflectionUtils; <ide> public ExtendedBeanInfo(BeanInfo delegate) throws IntrospectionException { <ide> <ide> ALL_METHODS: <ide> for (MethodDescriptor md : delegate.getMethodDescriptors()) { <del> Method method = md.getMethod(); <add> Method method = resolveMethod(md.getMethod()); <ide> <ide> // bypass non-getter java.lang.Class methods for efficiency <ide> if (ReflectionUtils.isObjectMethod(method) && !method.getName().startsWith("get")) { <ide> public ExtendedBeanInfo(BeanInfo delegate) throws IntrospectionException { <ide> continue ALL_METHODS; <ide> } <ide> for (PropertyDescriptor pd : delegate.getPropertyDescriptors()) { <del> Method readMethod = pd.getReadMethod(); <del> Method writeMethod = pd.getWriteMethod(); <add> Method readMethod = readMethodFor(pd); <add> Method writeMethod = writeMethodFor(pd); <ide> // has the setter already been found by the wrapped BeanInfo? <ide> if (writeMethod != null <ide> && writeMethod.getName().equals(method.getName())) { <ide> public ExtendedBeanInfo(BeanInfo delegate) throws IntrospectionException { <ide> continue DELEGATE_PD; <ide> } <ide> IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd; <del> Method readMethod = ipd.getReadMethod(); <del> Method writeMethod = ipd.getWriteMethod(); <del> Method indexedReadMethod = ipd.getIndexedReadMethod(); <del> Method indexedWriteMethod = ipd.getIndexedWriteMethod(); <add> Method readMethod = readMethodFor(ipd); <add> Method writeMethod = writeMethodFor(ipd); <add> Method indexedReadMethod = indexedReadMethodFor(ipd); <add> Method indexedWriteMethod = indexedWriteMethodFor(ipd); <ide> // has the setter already been found by the wrapped BeanInfo? <ide> if (!(indexedWriteMethod != null <ide> && indexedWriteMethod.getName().equals(method.getName()))) { <ide> public ExtendedBeanInfo(BeanInfo delegate) throws IntrospectionException { <ide> for (PropertyDescriptor pd : delegate.getPropertyDescriptors()) { <ide> // have we already copied this read method to a property descriptor locally? <ide> String propertyName = pd.getName(); <del> Method readMethod = pd.getReadMethod(); <add> Method readMethod = readMethodFor(pd); <ide> Method mostSpecificReadMethod = ClassUtils.getMostSpecificMethod(readMethod, method.getDeclaringClass()); <ide> for (PropertyDescriptor existingPD : this.propertyDescriptors) { <ide> if (method.equals(mostSpecificReadMethod) <ide> && existingPD.getName().equals(propertyName)) { <del> if (existingPD.getReadMethod() == null) { <add> if (readMethodFor(existingPD) == null) { <ide> // no -> add it now <del> this.addOrUpdatePropertyDescriptor(pd, propertyName, method, pd.getWriteMethod()); <add> this.addOrUpdatePropertyDescriptor(pd, propertyName, method, writeMethodFor(pd)); <ide> } <ide> // yes -> do not add a duplicate <ide> continue ALL_METHODS; <ide> } <ide> } <ide> if (method.equals(mostSpecificReadMethod) <del> || (pd instanceof IndexedPropertyDescriptor && method.equals(((IndexedPropertyDescriptor) pd).getIndexedReadMethod()))) { <add> || (pd instanceof IndexedPropertyDescriptor && method.equals(indexedReadMethodFor((IndexedPropertyDescriptor) pd)))) { <ide> // yes -> copy it, including corresponding setter method (if any -- may be null) <ide> if (pd instanceof IndexedPropertyDescriptor) { <del> this.addOrUpdatePropertyDescriptor(pd, propertyName, readMethod, pd.getWriteMethod(), ((IndexedPropertyDescriptor)pd).getIndexedReadMethod(), ((IndexedPropertyDescriptor)pd).getIndexedWriteMethod()); <add> this.addOrUpdatePropertyDescriptor(pd, propertyName, readMethod, writeMethodFor(pd), indexedReadMethodFor((IndexedPropertyDescriptor)pd), indexedWriteMethodFor((IndexedPropertyDescriptor)pd)); <ide> } else { <del> this.addOrUpdatePropertyDescriptor(pd, propertyName, readMethod, pd.getWriteMethod()); <add> this.addOrUpdatePropertyDescriptor(pd, propertyName, readMethod, writeMethodFor(pd)); <ide> } <ide> continue ALL_METHODS; <ide> } <ide> } <ide> } <ide> } <ide> <add> <add> private static Method resolveMethod(Method method) { <add> return BridgeMethodResolver.findBridgedMethod(method); <add> } <add> <add> private static Method readMethodFor(PropertyDescriptor pd) { <add> return resolveMethod(pd.getReadMethod()); <add> } <add> <add> private static Method writeMethodFor(PropertyDescriptor pd) { <add> return resolveMethod(pd.getWriteMethod()); <add> } <add> <add> private static Method indexedReadMethodFor(IndexedPropertyDescriptor ipd) { <add> return resolveMethod(ipd.getIndexedReadMethod()); <add> } <add> <add> private static Method indexedWriteMethodFor(IndexedPropertyDescriptor ipd) { <add> return resolveMethod(ipd.getIndexedWriteMethod()); <add> } <add> <ide> private void addOrUpdatePropertyDescriptor(PropertyDescriptor pd, String propertyName, Method readMethod, Method writeMethod) throws IntrospectionException { <ide> addOrUpdatePropertyDescriptor(pd, propertyName, readMethod, writeMethod, null, null); <ide> } <ide> private void addOrUpdatePropertyDescriptor(PropertyDescriptor pd, String propert <ide> for (PropertyDescriptor existingPD : this.propertyDescriptors) { <ide> if (existingPD.getName().equals(propertyName)) { <ide> // is there already a descriptor that captures this read method or its corresponding write method? <del> if (existingPD.getReadMethod() != null) { <del> if (readMethod != null && existingPD.getReadMethod().getReturnType() != readMethod.getReturnType() <del> || writeMethod != null && existingPD.getReadMethod().getReturnType() != writeMethod.getParameterTypes()[0]) { <add> if (readMethodFor(existingPD) != null) { <add> if (readMethod != null && readMethodFor(existingPD).getReturnType() != readMethod.getReturnType() <add> || writeMethod != null && readMethodFor(existingPD).getReturnType() != writeMethod.getParameterTypes()[0]) { <ide> // no -> add a new descriptor for it below <ide> break; <ide> } <ide> private void addOrUpdatePropertyDescriptor(PropertyDescriptor pd, String propert <ide> } <ide> <ide> // is there already a descriptor that captures this write method or its corresponding read method? <del> if (existingPD.getWriteMethod() != null) { <del> if (readMethod != null && existingPD.getWriteMethod().getParameterTypes()[0] != readMethod.getReturnType() <del> || writeMethod != null && existingPD.getWriteMethod().getParameterTypes()[0] != writeMethod.getParameterTypes()[0]) { <add> if (writeMethodFor(existingPD) != null) { <add> if (readMethod != null && writeMethodFor(existingPD).getParameterTypes()[0] != readMethod.getReturnType() <add> || writeMethod != null && writeMethodFor(existingPD).getParameterTypes()[0] != writeMethod.getParameterTypes()[0]) { <ide> // no -> add a new descriptor for it below <ide> break; <ide> } <ide> private void addOrUpdatePropertyDescriptor(PropertyDescriptor pd, String propert <ide> IndexedPropertyDescriptor existingIPD = (IndexedPropertyDescriptor) existingPD; <ide> <ide> // is there already a descriptor that captures this indexed read method or its corresponding indexed write method? <del> if (existingIPD.getIndexedReadMethod() != null) { <del> if (indexedReadMethod != null && existingIPD.getIndexedReadMethod().getReturnType() != indexedReadMethod.getReturnType() <del> || indexedWriteMethod != null && existingIPD.getIndexedReadMethod().getReturnType() != indexedWriteMethod.getParameterTypes()[1]) { <add> if (indexedReadMethodFor(existingIPD) != null) { <add> if (indexedReadMethod != null && indexedReadMethodFor(existingIPD).getReturnType() != indexedReadMethod.getReturnType() <add> || indexedWriteMethod != null && indexedReadMethodFor(existingIPD).getReturnType() != indexedWriteMethod.getParameterTypes()[1]) { <ide> // no -> add a new descriptor for it below <ide> break; <ide> } <ide> private void addOrUpdatePropertyDescriptor(PropertyDescriptor pd, String propert <ide> } <ide> <ide> // is there already a descriptor that captures this indexed write method or its corresponding indexed read method? <del> if (existingIPD.getIndexedWriteMethod() != null) { <del> if (indexedReadMethod != null && existingIPD.getIndexedWriteMethod().getParameterTypes()[1] != indexedReadMethod.getReturnType() <del> || indexedWriteMethod != null && existingIPD.getIndexedWriteMethod().getParameterTypes()[1] != indexedWriteMethod.getParameterTypes()[1]) { <add> if (indexedWriteMethodFor(existingIPD) != null) { <add> if (indexedReadMethod != null && indexedWriteMethodFor(existingIPD).getParameterTypes()[1] != indexedReadMethod.getReturnType() <add> || indexedWriteMethod != null && indexedWriteMethodFor(existingIPD).getParameterTypes()[1] != indexedWriteMethod.getParameterTypes()[1]) { <ide> // no -> add a new descriptor for it below <ide> break; <ide> } <ide><path>spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java <ide> <ide> package org.springframework.beans; <ide> <del>import static org.hamcrest.CoreMatchers.equalTo; <del>import static org.hamcrest.CoreMatchers.instanceOf; <del>import static org.hamcrest.CoreMatchers.is; <del>import static org.hamcrest.Matchers.greaterThan; <del>import static org.hamcrest.Matchers.lessThan; <del>import static org.junit.Assert.assertThat; <del>import static org.junit.Assert.assertTrue; <del>import static org.junit.Assert.fail; <del> <ide> import java.beans.BeanInfo; <ide> import java.beans.IndexedPropertyDescriptor; <ide> import java.beans.IntrospectionException; <ide> import java.beans.Introspector; <ide> import java.beans.PropertyDescriptor; <add> <ide> import java.lang.reflect.Method; <ide> <add>import org.junit.Ignore; <ide> import org.junit.Test; <add> <ide> import org.springframework.beans.ExtendedBeanInfo.PropertyDescriptorComparator; <ide> import org.springframework.core.JdkVersion; <ide> import org.springframework.util.ClassUtils; <ide> <ide> import test.beans.TestBean; <ide> <add>import static org.junit.Assert.*; <add>import static org.hamcrest.CoreMatchers.equalTo; <add>import static org.hamcrest.CoreMatchers.instanceOf; <add>import static org.hamcrest.CoreMatchers.is; <add>import static org.hamcrest.Matchers.greaterThan; <add>import static org.hamcrest.Matchers.lessThan; <add> <ide> /** <ide> * Unit tests for {@link ExtendedBeanInfo}. <ide> * <ide> public void standardReadMethodsAndOverloadedNonStandardWriteMethods() throws Exc <ide> ExtendedBeanInfo ebi = new ExtendedBeanInfo(bi); <ide> <ide> assertThat(hasReadMethodForProperty(bi, "foo"), is(true)); <del> assertThat(hasWriteMethodForProperty(bi, "foo"), is(true)); <add> assertThat(hasWriteMethodForProperty(bi, "foo"), is(trueUntilJdk17())); <ide> <ide> assertThat(hasReadMethodForProperty(ebi, "foo"), is(true)); <ide> assertThat(hasWriteMethodForProperty(ebi, "foo"), is(true)); <ide> public void standardReadMethodsAndOverloadedNonStandardWriteMethods() throws Exc <ide> fail("never matched write method"); <ide> } <ide> <add> @Test <add> public void cornerSpr9414() throws IntrospectionException { <add> @SuppressWarnings("unused") class Parent { <add> public Number getProperty1() { <add> return 1; <add> } <add> } <add> class Child extends Parent { <add> @Override <add> public Integer getProperty1() { <add> return 2; <add> } <add> } <add> { // always passes <add> ExtendedBeanInfo bi = new ExtendedBeanInfo(Introspector.getBeanInfo(Parent.class)); <add> assertThat(hasReadMethodForProperty(bi, "property1"), is(true)); <add> } <add> { // failed prior to fix for SPR-9414 <add> ExtendedBeanInfo bi = new ExtendedBeanInfo(Introspector.getBeanInfo(Child.class)); <add> assertThat(hasReadMethodForProperty(bi, "property1"), is(true)); <add> } <add> } <add> <add> interface Spr9453<T> { <add> T getProp(); <add> } <add> <add> @Test <add> public void cornerSpr9453() throws IntrospectionException { <add> final class Bean implements Spr9453<Class<?>> { <add> public Class<?> getProp() { <add> return null; <add> } <add> } <add> { // always passes <add> BeanInfo info = Introspector.getBeanInfo(Bean.class); <add> assertThat(info.getPropertyDescriptors().length, equalTo(2)); <add> } <add> { // failed prior to fix for SPR-9453 <add> BeanInfo info = new ExtendedBeanInfo(Introspector.getBeanInfo(Bean.class)); <add> assertThat(info.getPropertyDescriptors().length, equalTo(2)); <add> } <add> } <add> <ide> @Test <ide> public void standardReadMethodInSuperclassAndNonStandardWriteMethodInSubclass() throws Exception { <ide> @SuppressWarnings("unused") class B { <ide> class C { <ide> assertThat(hasIndexedWriteMethodForProperty(ebi, "foos"), is(true)); <ide> } <ide> <add> @Ignore // see comments at SPR-9702 <add> @Test <add> public void cornerSpr9702() throws IntrospectionException { <add> { // baseline with standard write method <add> @SuppressWarnings("unused") <add> class C { <add> // VOID-RETURNING, NON-INDEXED write method <add> public void setFoos(String[] foos) { } <add> // indexed read method <add> public String getFoos(int i) { return null; } <add> } <add> <add> BeanInfo bi = Introspector.getBeanInfo(C.class); <add> assertThat(hasReadMethodForProperty(bi, "foos"), is(false)); <add> assertThat(hasIndexedReadMethodForProperty(bi, "foos"), is(true)); <add> assertThat(hasWriteMethodForProperty(bi, "foos"), is(true)); <add> assertThat(hasIndexedWriteMethodForProperty(bi, "foos"), is(false)); <add> <add> BeanInfo ebi = Introspector.getBeanInfo(C.class); <add> assertThat(hasReadMethodForProperty(ebi, "foos"), is(false)); <add> assertThat(hasIndexedReadMethodForProperty(ebi, "foos"), is(true)); <add> assertThat(hasWriteMethodForProperty(ebi, "foos"), is(true)); <add> assertThat(hasIndexedWriteMethodForProperty(ebi, "foos"), is(false)); <add> } <add> { // variant with non-standard write method <add> @SuppressWarnings("unused") <add> class C { <add> // NON-VOID-RETURNING, NON-INDEXED write method <add> public C setFoos(String[] foos) { return this; } <add> // indexed read method <add> public String getFoos(int i) { return null; } <add> } <add> <add> BeanInfo bi = Introspector.getBeanInfo(C.class); <add> assertThat(hasReadMethodForProperty(bi, "foos"), is(false)); <add> assertThat(hasIndexedReadMethodForProperty(bi, "foos"), is(true)); <add> assertThat(hasWriteMethodForProperty(bi, "foos"), is(false)); <add> assertThat(hasIndexedWriteMethodForProperty(bi, "foos"), is(false)); <add> <add> BeanInfo ebi = new ExtendedBeanInfo(Introspector.getBeanInfo(C.class)); <add> assertThat(hasReadMethodForProperty(ebi, "foos"), is(false)); <add> assertThat(hasIndexedReadMethodForProperty(ebi, "foos"), is(true)); <add> assertThat(hasWriteMethodForProperty(ebi, "foos"), is(true)); <add> assertThat(hasIndexedWriteMethodForProperty(ebi, "foos"), is(false)); <add> } <add> } <add> <ide> @Test <ide> public void subclassWriteMethodWithCovariantReturnType() throws IntrospectionException { <ide> @SuppressWarnings("unused") class B {
2
Go
Go
remove bsdtar by checking magic
0425f65e6373dc38cd18a6d0f2a50671544ad4b2
<ide><path>archive.go <ide> package docker <ide> <ide> import ( <add> "bytes" <ide> "errors" <ide> "fmt" <add> "github.com/dotcloud/docker/utils" <ide> "io" <ide> "io/ioutil" <ide> "os" <ide> const ( <ide> Xz <ide> ) <ide> <add>func DetectCompression(source []byte) Compression { <add> for _, c := range source[:10] { <add> utils.Debugf("%x", c) <add> } <add> <add> sourceLen := len(source) <add> for compression, m := range map[Compression][]byte{ <add> Bzip2: {0x42, 0x5A, 0x68}, <add> Gzip: {0x1F, 0x8B, 0x08}, <add> Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}, <add> } { <add> fail := false <add> if len(m) > sourceLen { <add> utils.Debugf("Len too short") <add> continue <add> } <add> i := 0 <add> for _, b := range m { <add> if b != source[i] { <add> fail = true <add> break <add> } <add> i++ <add> } <add> if !fail { <add> return compression <add> } <add> } <add> return Uncompressed <add>} <add> <ide> func (compression *Compression) Flag() string { <ide> switch *compression { <ide> case Bzip2: <ide> func (compression *Compression) Extension() string { <ide> } <ide> <ide> func Tar(path string, compression Compression) (io.Reader, error) { <del> cmd := exec.Command("bsdtar", "-f", "-", "-C", path, "-c"+compression.Flag(), ".") <del> return CmdStream(cmd) <add> return CmdStream(exec.Command("tar", "-f", "-", "-C", path, "-c"+compression.Flag(), ".")) <ide> } <ide> <ide> func Untar(archive io.Reader, path string) error { <del> cmd := exec.Command("bsdtar", "-f", "-", "-C", path, "-x") <add> <add> buf := make([]byte, 10) <add> if _, err := archive.Read(buf); err != nil { <add> return err <add> } <add> compression := DetectCompression(buf) <add> archive = io.MultiReader(bytes.NewReader(buf), archive) <add> <add> utils.Debugf("Archive compression detected: %s", compression.Extension()) <add> <add> cmd := exec.Command("tar", "-f", "-", "-C", path, "-x"+compression.Flag()) <ide> cmd.Stdin = archive <ide> // Hardcode locale environment for predictable outcome regardless of host configuration. <ide> // (see https://github.com/dotcloud/docker/issues/355)
1
PHP
PHP
allow slackattachment color override
84842c1d845cd01a2def163539204cbc15a59821
<ide><path>src/Illuminate/Notifications/Channels/SlackWebhookChannel.php <ide> protected function attachments(SlackMessage $message) <ide> { <ide> return collect($message->attachments)->map(function ($attachment) use ($message) { <ide> return array_filter([ <del> 'color' => $message->color(), <add> 'color' => $attachment->color ?: $message->color(), <ide> 'title' => $attachment->title, <ide> 'text' => $attachment->content, <ide> 'title_link' => $attachment->url, <ide><path>src/Illuminate/Notifications/Messages/SlackAttachment.php <ide> class SlackAttachment <ide> */ <ide> public $content; <ide> <add> /** <add> * The attachment's color. <add> * <add> * @var string <add> */ <add> public $color; <add> <ide> /** <ide> * The attachment's fields. <ide> * <ide> public function content($content) <ide> return $this; <ide> } <ide> <add> /** <add> * Set the color of the attachment. <add> * <add> * @param string $color <add> * @return $this <add> */ <add> public function color($color) <add> { <add> $this->color = $color; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Set the fields of the attachment. <ide> *
2
PHP
PHP
add test for belongsto and hasone optimization
364c293e16c0f5286eee45b286e58d2e9ffa5396
<ide><path>lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php <ide> public function testReadOnlyCallingQueryAssociationWhenDefined() { <ide> $this->assertTrue(is_array($result)); <ide> } <ide> <add>/** <add> * test that queryAssociation() reuse already joined data for 'belongsTo' and 'hasOne' associations <add> * instead of running unneeded queries for each record <add> * <add> * @return void <add> */ <add> public function testQueryAssociationUnneededQueries() { <add> $this->loadFixtures('Article', 'User', 'Comment', 'Attachment', 'Tag', 'ArticlesTag'); <add> $Comment = new Comment; <add> <add> $fullDebug = $this->db->fullDebug; <add> $this->db->fullDebug = true; <add> <add> $Comment->find('all', array('recursive' => 2)); // ensure Model descriptions are saved <add> $this->db->getLog(); <add> <add> // case: Comment belongsTo User and Article <add> $Comment->unbindModel(array( <add> 'hasOne' => array('Attachment') <add> )); <add> $Comment->Article->unbindModel(array( <add> 'belongsTo' => array('User'), <add> 'hasMany' => array('Comment'), <add> 'hasAndBelongsToMany' => array('Tag') <add> )); <add> $Comment->find('all', array('recursive' => 2)); <add> $log = $this->db->getLog(); <add> $this->assertEquals(1, count($log['log'])); <add> <add> // case: Comment belongsTo Article, Article belongsTo User <add> $Comment->unbindModel(array( <add> 'belongsTo' => array('User'), <add> 'hasOne' => array('Attachment') <add> )); <add> $Comment->Article->unbindModel(array( <add> 'hasMany' => array('Comment'), <add> 'hasAndBelongsToMany' => array('Tag'), <add> )); <add> $Comment->find('all', array('recursive' => 2)); <add> $log = $this->db->getLog(); <add> $this->assertEquals(7, count($log['log'])); <add> <add> // case: Comment hasOne Attachment <add> $Comment->unbindModel(array( <add> 'belongsTo' => array('Article', 'User'), <add> )); <add> $Comment->Attachment->unbindModel(array( <add> 'belongsTo' => array('Comment'), <add> )); <add> $Comment->find('all', array('recursive' => 2)); <add> $log = $this->db->getLog(); <add> $this->assertEquals(1, count($log['log'])); <add> <add> $this->db->fullDebug = $fullDebug; <add> } <add> <ide> /** <ide> * test that fields() is using methodCache() <ide> *
1
PHP
PHP
convert spaces to tab
441ad9252dcc16d03966ca7e961f1c798d89fb50
<ide><path>app/config/database.php <ide> 'password' => '', <ide> 'charset' => 'utf8', <ide> 'prefix' => '', <del> 'schema' => 'public', <add> 'schema' => 'public', <ide> ), <ide> <ide> 'sqlsrv' => array(
1
Javascript
Javascript
remove unused exports from stylesheettypes
b58e377961ddd278bfa36df0e15953f976875de6
<ide><path>Libraries/StyleSheet/StyleSheet.js <ide> import type { <ide> StyleSheetStyle as _StyleSheetStyle, <ide> Styles as _Styles, <ide> StyleSheet as _StyleSheet, <del> StyleValue as _StyleValue, <ide> StyleObj, <add> LayoutStyle <ide> } from 'StyleSheetTypes'; <ide> <ide> export type StyleProp = StyleObj; <ide> export type Styles = _Styles; <ide> export type StyleSheet<S> = _StyleSheet<S>; <del>export type StyleValue = _StyleValue; <ide> export type StyleSheetStyle = _StyleSheetStyle; <ide> <ide> let hairlineWidth = PixelRatio.roundToNearestPixel(0.4); <ide> if (hairlineWidth === 0) { <ide> hairlineWidth = 1 / PixelRatio.get(); <ide> } <ide> <del>const absoluteFillObject = { <del> position: ('absolute': 'absolute'), <add>const absoluteFillObject: LayoutStyle = { <add> position: 'absolute', <ide> left: 0, <ide> right: 0, <ide> top: 0, <ide> bottom: 0, <ide> }; <del>const absoluteFill: typeof absoluteFillObject = <add>const absoluteFill: StyleSheetStyle = <ide> ReactNativePropRegistry.register(absoluteFillObject); // This also freezes it <ide> <ide> /** <ide><path>Libraries/StyleSheet/StyleSheetTypes.js <ide> export type Style = { <ide> +overlayColor?: string, <ide> }; <ide> <del>export type StyleProp<+T> = <add>type GenericStyleProp<+T> = <ide> | null <ide> | void <ide> | T <ide> | StyleSheetStyle <ide> | number <ide> | false <ide> | '' <del> | $ReadOnlyArray<StyleProp<T>>; <add> | $ReadOnlyArray<GenericStyleProp<T>>; <ide> <del>// export type ViewStyleProp = StyleProp<$Shape<ViewStyle<DimensionValue>>>; <del>// export type TextStyleProp = StyleProp< <del>// $Shape<TextStyle<DimensionValue, ColorValue>>, <del>// >; <del>// export type ImageStyleProp = StyleProp< <del>// $Shape<ImageStyle<DimensionValue, ColorValue>>, <del>// >; <add>export type StyleObj = GenericStyleProp<$Shape<Style>>; <ide> <del>export type StyleObj = StyleProp<$Shape<Style>>; <del>export type StyleValue = StyleObj; <del> <del>export type ViewStyleProp = StyleProp<$ReadOnly<$Shape<ViewStyle>>>; <del>export type TextStyleProp = StyleProp<$ReadOnly<$Shape<TextStyle>>>; <del>export type ImageStyleProp = StyleProp<$ReadOnly<$Shape<ImageStyle>>>; <add>export type ViewStyleProp = GenericStyleProp<$ReadOnly<$Shape<ViewStyle>>>; <add>export type TextStyleProp = GenericStyleProp<$ReadOnly<$Shape<TextStyle>>>; <add>export type ImageStyleProp = GenericStyleProp<$ReadOnly<$Shape<ImageStyle>>>; <ide> <ide> export type Styles = { <ide> +[key: string]: $Shape<Style>, <ide> }; <add> <ide> export type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>; <ide> <ide> /* <ide><path>Libraries/StyleSheet/flattenStyle.js <ide> <ide> var ReactNativePropRegistry; <ide> <del>import type { StyleProp, Style } from 'StyleSheetTypes'; <add>import type { StyleObj, Style } from 'StyleSheetTypes'; <ide> <ide> function getStyle(style) { <ide> if (ReactNativePropRegistry === undefined) { <ide> function getStyle(style) { <ide> return style; <ide> } <ide> <del>function flattenStyle(style: ?StyleProp<Style>): ?Style { <add>function flattenStyle(style: ?StyleObj): ?Style { <ide> if (style == null) { <ide> return undefined; <ide> }
3
Python
Python
fix sdist command
105a91975b55d28ab33718d9292bda6d28853acd
<ide><path>fabfile.py <ide> def make(): <ide> def sdist(): <ide> with virtualenv(VENV_DIR) as venv_local: <ide> with lcd(path.dirname(__file__)): <del> local('python -m pip install -U setuptools') <add> local('python -m pip install -U setuptools srsly') <ide> local('python setup.py sdist') <ide> <ide> def wheel():
1
PHP
PHP
add removeall() method
74db983e93fd0ee5bcd3c935a393efea21a072b2
<ide><path>src/ORM/Associations.php <ide> public function remove($alias) { <ide> unset($this->_items[strtolower($alias)]); <ide> } <ide> <add>/** <add> * Remove all registered associations. <add> * <add> * Once removed associations will not longer be reachable <add> * <add> * @return void <add> */ <add> public function removeAll() { <add> foreach ($this->_items as $alias => $object) { <add> $this->remove($alias); <add> } <add> } <add> <ide> /** <ide> * Save all the associations that are parents of the given entity. <ide> * <ide><path>tests/TestCase/ORM/AssociationsTest.php <ide> public function testAddHasRemoveAndGet() { <ide> $this->assertNull($this->associations->get('Users')); <ide> } <ide> <add>/** <add> * Test removeAll method <add> * <add> * @return void <add> */ <add> public function testRemoveAll() { <add> $this->assertEmpty($this->associations->keys()); <add> <add> $belongsTo = new BelongsTo([]); <add> $this->assertSame($belongsTo, $this->associations->add('Users', $belongsTo)); <add> $belongsToMany = new BelongsToMany([]); <add> $this->assertSame($belongsToMany, $this->associations->add('Cart', $belongsToMany)); <add> <add> $this->associations->removeAll(); <add> $this->assertEmpty($this->associations->keys()); <add> } <add> <ide> /** <ide> * Test getting associations by property. <ide> *
2
Javascript
Javascript
remove unused var
0d787ceeecb164ea09c12a35d768bbc6831c42e6
<ide><path>client/src/components/layouts/Guide.js <ide> import Spacer from '../helpers/Spacer'; <ide> <ide> import 'prismjs/themes/prism.css'; <ide> import './guide.css'; <del>import Footer from '../Footer'; <ide> <ide> const propTypes = { <ide> children: PropTypes.any,
1
Ruby
Ruby
fix a tiny typo in custom validators documentation
fd17ffc7a27c2fc5c3c2afb82c9e1909fd5ba7a1
<ide><path>activemodel/lib/active_model/validations/validates.rb <ide> module ClassMethods <ide> # <ide> # Additionally validator classes may be in another namespace and still used within any class. <ide> # <del> # validates :name, :'file/title' => true <add> # validates :name, :'film/title' => true <ide> # <ide> # The validators hash can also handle regular expressions, ranges, <ide> # arrays and strings in shortcut form, e.g.
1
Python
Python
update doc links for tensorboard/embeddings
63543a7e35639e8b0b8bce6bb3f80406bb925cf3
<ide><path>keras/callbacks.py <ide> def on_epoch_end(self, epoch, logs=None): <ide> class TensorBoard(Callback): <ide> """TensorBoard basic visualizations. <ide> <del> [TensorBoard](https://www.tensorflow.org/get_started/summaries_and_tensorboard) <add> [TensorBoard](https://www.tensorflow.org/guide/summaries_and_tensorboard) <ide> is a visualization tool provided with TensorFlow. <ide> <ide> This callback writes a log for TensorBoard, which allows <ide> class TensorBoard(Callback): <ide> None or empty list all the embedding layer will be watched. <ide> embeddings_metadata: a dictionary which maps layer name to a file name <ide> in which metadata for this embedding layer is saved. See the <del> [details](https://www.tensorflow.org/how_tos/embedding_viz/#metadata_optional) <add> [details](https://www.tensorflow.org/guide/embedding#metadata) <ide> about metadata files format. In case if the same metadata file is <ide> used for all embedding layers, string can be passed. <ide> embeddings_data: data to be embedded at layers specified in <ide> `embeddings_layer_names`. Numpy array (if the model has a single <ide> input) or list of Numpy arrays (if the model has multiple inputs). <ide> Learn [more about embeddings]( <del> https://www.tensorflow.org/programmers_guide/embedding). <add> https://www.tensorflow.org/guide/embedding). <ide> update_freq: `'batch'` or `'epoch'` or integer. When using `'batch'`, writes <ide> the losses and metrics to TensorBoard after each batch. The same <ide> applies for `'epoch'`. If using an integer, let's say `10000`,
1
Ruby
Ruby
fix postgresql distinct requirement in pluck test
2dd95a775c7aa9565f5b43f41ccf09a302ca1832
<ide><path>activerecord/test/cases/calculations_test.rb <ide> def test_pluck_loaded_relation_multiple_columns <ide> end <ide> <ide> def test_pluck_loaded_relation_sql_fragment <del> companies = Company.order(:id).limit(3).load <add> companies = Company.order(:name).limit(3).load <ide> assert_queries 1 do <del> assert_equal ['37signals', 'Summit', 'Microsoft'], companies.pluck('DISTINCT name') <add> assert_equal ['37signals', 'Apex', 'Ex Nihilo'], companies.pluck('DISTINCT name') <ide> end <ide> end <ide>
1
Python
Python
return none instead of raising xcomexception
6ef6a650dfab103c54cf380b2d8ed1034184d68a
<ide><path>airflow/models.py <ide> from airflow.executors import DEFAULT_EXECUTOR, LocalExecutor <ide> from airflow.configuration import conf <ide> from airflow.utils import ( <del> AirflowException, XComException, State, apply_defaults, provide_session, <add> AirflowException, State, apply_defaults, provide_session, <ide> is_container, as_tuple) <ide> <ide> Base = declarative_base() <ide> def get( <ide> inplace=True) <ide> <ide> if result.empty: <del> raise XComException('No XCom values found.') <add> return None <ide> <ide> if limit is None: <ide> return result.iloc[0].value <ide><path>airflow/utils.py <ide> class AirflowException(Exception): <ide> pass <ide> <ide> <del>class XComException(AirflowException): <del> pass <del> <del> <ide> class AirflowSensorTimeout(Exception): <ide> pass <ide>
2
Javascript
Javascript
remove config argument from usetransition
ddd1faa1972b614dfbfae205f2aa4a6c0b39a759
<ide><path>packages/react-debug-tools/src/ReactDebugHooks.js <ide> import type { <ide> } from 'react-reconciler/src/ReactInternalTypes'; <ide> import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig'; <ide> <del>import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberTransition'; <ide> import {NoMode} from 'react-reconciler/src/ReactTypeOfMode'; <ide> <ide> import ErrorStackParser from 'error-stack-parser'; <ide> type Hook = { <ide> next: Hook | null, <ide> }; <ide> <del>type TimeoutConfig = {| <del> timeoutMs: number, <del>|}; <del> <ide> function getPrimitiveStackCache(): Map<string, Array<any>> { <ide> // This initializes a cache of all primitive hooks so that the top <ide> // most stack frames added by calling the primitive hook can be removed. <ide> function useMutableSource<Source, Snapshot>( <ide> return value; <ide> } <ide> <del>function useTransition( <del> config: SuspenseConfig | null | void, <del>): [(() => void) => void, boolean] { <add>function useTransition(): [(() => void) => void, boolean] { <ide> // useTransition() composes multiple hooks internally. <ide> // Advance the current hook index the same number of times <ide> // so that subsequent hooks have the right memoized state. <ide> function useTransition( <ide> hookLog.push({ <ide> primitive: 'Transition', <ide> stackError: new Error(), <del> value: config, <add> value: undefined, <ide> }); <ide> return [callback => {}, false]; <ide> } <ide> <del>function useDeferredValue<T>(value: T, config: TimeoutConfig | null | void): T { <add>function useDeferredValue<T>(value: T): T { <ide> // useDeferredValue() composes multiple hooks internally. <ide> // Advance the current hook index the same number of times <ide> // so that subsequent hooks have the right memoized state. <ide><path>packages/react-dom/src/server/ReactPartialRendererHooks.js <ide> import type { <ide> MutableSourceSubscribeFn, <ide> ReactContext, <ide> } from 'shared/ReactTypes'; <del>import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberTransition'; <ide> import type PartialRenderer from './ReactPartialRenderer'; <ide> <ide> import {validateContextBounds} from './ReactPartialRendererContext'; <ide> type Hook = {| <ide> next: Hook | null, <ide> |}; <ide> <del>type TimeoutConfig = {| <del> timeoutMs: number, <del>|}; <del> <ide> type OpaqueIDType = string; <ide> <ide> let currentlyRenderingComponent: Object | null = null; <ide> function useMutableSource<Source, Snapshot>( <ide> return getSnapshot(source._source); <ide> } <ide> <del>function useDeferredValue<T>(value: T, config: TimeoutConfig | null | void): T { <add>function useDeferredValue<T>(value: T): T { <ide> resolveCurrentlyRenderingComponent(); <ide> return value; <ide> } <ide> <del>function useTransition( <del> config: SuspenseConfig | null | void, <del>): [(callback: () => void) => void, boolean] { <add>function useTransition(): [(callback: () => void) => void, boolean] { <ide> resolveCurrentlyRenderingComponent(); <ide> const startTransition = callback => { <ide> callback(); <ide><path>packages/react-reconciler/src/ReactFiberHooks.new.js <ide> import type { <ide> import type {Fiber, Dispatcher} from './ReactInternalTypes'; <ide> import type {Lanes, Lane} from './ReactFiberLane'; <ide> import type {HookEffectTag} from './ReactHookEffectTags'; <del>import type {SuspenseConfig} from './ReactFiberTransition'; <ide> import type {ReactPriorityLevel} from './ReactInternalTypes'; <ide> import type {FiberRoot} from './ReactInternalTypes'; <ide> import type {OpaqueIDType} from './ReactFiberHostConfig'; <ide> export type Effect = {| <ide> <ide> export type FunctionComponentUpdateQueue = {|lastEffect: Effect | null|}; <ide> <del>type TimeoutConfig = {| <del> timeoutMs: number, <del>|}; <del> <ide> type BasicStateAction<S> = (S => S) | S; <ide> <ide> type Dispatch<A> = A => void; <ide> function updateMemo<T>( <ide> return nextValue; <ide> } <ide> <del>function mountDeferredValue<T>( <del> value: T, <del> config: TimeoutConfig | void | null, <del>): T { <add>function mountDeferredValue<T>(value: T): T { <ide> const [prevValue, setValue] = mountState(value); <ide> mountEffect(() => { <ide> const prevTransition = ReactCurrentBatchConfig.transition; <ide> function mountDeferredValue<T>( <ide> } finally { <ide> ReactCurrentBatchConfig.transition = prevTransition; <ide> } <del> }, [value, config]); <add> }, [value]); <ide> return prevValue; <ide> } <ide> <del>function updateDeferredValue<T>( <del> value: T, <del> config: TimeoutConfig | void | null, <del>): T { <add>function updateDeferredValue<T>(value: T): T { <ide> const [prevValue, setValue] = updateState(value); <ide> updateEffect(() => { <ide> const prevTransition = ReactCurrentBatchConfig.transition; <ide> function updateDeferredValue<T>( <ide> } finally { <ide> ReactCurrentBatchConfig.transition = prevTransition; <ide> } <del> }, [value, config]); <add> }, [value]); <ide> return prevValue; <ide> } <ide> <del>function rerenderDeferredValue<T>( <del> value: T, <del> config: TimeoutConfig | void | null, <del>): T { <add>function rerenderDeferredValue<T>(value: T): T { <ide> const [prevValue, setValue] = rerenderState(value); <ide> updateEffect(() => { <ide> const prevTransition = ReactCurrentBatchConfig.transition; <ide> function rerenderDeferredValue<T>( <ide> } finally { <ide> ReactCurrentBatchConfig.transition = prevTransition; <ide> } <del> }, [value, config]); <add> }, [value]); <ide> return prevValue; <ide> } <ide> <del>function startTransition(setPending, config, callback) { <add>function startTransition(setPending, callback) { <ide> const priorityLevel = getCurrentPriorityLevel(); <ide> if (decoupleUpdatePriorityFromScheduler) { <ide> const previousLanePriority = getCurrentUpdateLanePriority(); <ide> function startTransition(setPending, config, callback) { <ide> }, <ide> ); <ide> <del> // If there's no SuspenseConfig set, we'll use the DefaultLanePriority for this transition. <add> // TODO: Can remove this. Was only necessary because we used to give <add> // different behavior to transitions without a config object. Now they are <add> // all treated the same. <ide> setCurrentUpdateLanePriority(DefaultLanePriority); <ide> <ide> runWithPriority( <ide> function startTransition(setPending, config, callback) { <ide> } <ide> } <ide> <del>function mountTransition( <del> config: SuspenseConfig | void | null, <del>): [(() => void) => void, boolean] { <add>function mountTransition(): [(() => void) => void, boolean] { <ide> const [isPending, setPending] = mountState(false); <del> const start = mountCallback(startTransition.bind(null, setPending, config), [ <del> setPending, <del> config, <del> ]); <add> // The `start` method can be stored on a ref, since `setPending` <add> // never changes. <add> const start = startTransition.bind(null, setPending); <add> mountRef(start); <ide> return [start, isPending]; <ide> } <ide> <del>function updateTransition( <del> config: SuspenseConfig | void | null, <del>): [(() => void) => void, boolean] { <del> const [isPending, setPending] = updateState(false); <del> const start = updateCallback(startTransition.bind(null, setPending, config), [ <del> setPending, <del> config, <del> ]); <add>function updateTransition(): [(() => void) => void, boolean] { <add> const [isPending] = updateState(false); <add> const startRef = updateRef(); <add> const start: (() => void) => void = (startRef.current: any); <ide> return [start, isPending]; <ide> } <ide> <del>function rerenderTransition( <del> config: SuspenseConfig | void | null, <del>): [(() => void) => void, boolean] { <del> const [isPending, setPending] = rerenderState(false); <del> const start = updateCallback(startTransition.bind(null, setPending, config), [ <del> setPending, <del> config, <del> ]); <add>function rerenderTransition(): [(() => void) => void, boolean] { <add> const [isPending] = rerenderState(false); <add> const startRef = updateRef(); <add> const start: (() => void) => void = (startRef.current: any); <ide> return [start, isPending]; <ide> } <ide> <ide> if (__DEV__) { <ide> mountHookTypesDev(); <ide> return mountDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> mountHookTypesDev(); <del> return mountDeferredValue(value, config); <add> return mountDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> mountHookTypesDev(); <del> return mountTransition(config); <add> return mountTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return mountDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> updateHookTypesDev(); <del> return mountDeferredValue(value, config); <add> return mountDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> updateHookTypesDev(); <del> return mountTransition(config); <add> return mountTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return updateDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> updateHookTypesDev(); <del> return updateDeferredValue(value, config); <add> return updateDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> updateHookTypesDev(); <del> return updateTransition(config); <add> return updateTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return updateDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> updateHookTypesDev(); <del> return rerenderDeferredValue(value, config); <add> return rerenderDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> updateHookTypesDev(); <del> return rerenderTransition(config); <add> return rerenderTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> mountHookTypesDev(); <ide> return mountDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> warnInvalidHookAccess(); <ide> mountHookTypesDev(); <del> return mountDeferredValue(value, config); <add> return mountDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> warnInvalidHookAccess(); <ide> mountHookTypesDev(); <del> return mountTransition(config); <add> return mountTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return updateDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> warnInvalidHookAccess(); <ide> updateHookTypesDev(); <del> return updateDeferredValue(value, config); <add> return updateDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> warnInvalidHookAccess(); <ide> updateHookTypesDev(); <del> return updateTransition(config); <add> return updateTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return updateDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> warnInvalidHookAccess(); <ide> updateHookTypesDev(); <del> return rerenderDeferredValue(value, config); <add> return rerenderDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> warnInvalidHookAccess(); <ide> updateHookTypesDev(); <del> return rerenderTransition(config); <add> return rerenderTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide><path>packages/react-reconciler/src/ReactFiberHooks.old.js <ide> import type { <ide> import type {Fiber, Dispatcher} from './ReactInternalTypes'; <ide> import type {Lanes, Lane} from './ReactFiberLane'; <ide> import type {HookEffectTag} from './ReactHookEffectTags'; <del>import type {SuspenseConfig} from './ReactFiberTransition'; <ide> import type {ReactPriorityLevel} from './ReactInternalTypes'; <ide> import type {FiberRoot} from './ReactInternalTypes'; <ide> import type {OpaqueIDType} from './ReactFiberHostConfig'; <ide> export type Effect = {| <ide> <ide> export type FunctionComponentUpdateQueue = {|lastEffect: Effect | null|}; <ide> <del>type TimeoutConfig = {| <del> timeoutMs: number, <del>|}; <del> <ide> type BasicStateAction<S> = (S => S) | S; <ide> <ide> type Dispatch<A> = A => void; <ide> function updateMemo<T>( <ide> return nextValue; <ide> } <ide> <del>function mountDeferredValue<T>( <del> value: T, <del> config: TimeoutConfig | void | null, <del>): T { <add>function mountDeferredValue<T>(value: T): T { <ide> const [prevValue, setValue] = mountState(value); <ide> mountEffect(() => { <ide> const prevTransition = ReactCurrentBatchConfig.transition; <ide> function mountDeferredValue<T>( <ide> } finally { <ide> ReactCurrentBatchConfig.transition = prevTransition; <ide> } <del> }, [value, config]); <add> }, [value]); <ide> return prevValue; <ide> } <ide> <del>function updateDeferredValue<T>( <del> value: T, <del> config: TimeoutConfig | void | null, <del>): T { <add>function updateDeferredValue<T>(value: T): T { <ide> const [prevValue, setValue] = updateState(value); <ide> updateEffect(() => { <ide> const prevTransition = ReactCurrentBatchConfig.transition; <ide> function updateDeferredValue<T>( <ide> } finally { <ide> ReactCurrentBatchConfig.transition = prevTransition; <ide> } <del> }, [value, config]); <add> }, [value]); <ide> return prevValue; <ide> } <ide> <del>function rerenderDeferredValue<T>( <del> value: T, <del> config: TimeoutConfig | void | null, <del>): T { <add>function rerenderDeferredValue<T>(value: T): T { <ide> const [prevValue, setValue] = rerenderState(value); <ide> updateEffect(() => { <ide> const prevTransition = ReactCurrentBatchConfig.transition; <ide> function rerenderDeferredValue<T>( <ide> } finally { <ide> ReactCurrentBatchConfig.transition = prevTransition; <ide> } <del> }, [value, config]); <add> }, [value]); <ide> return prevValue; <ide> } <ide> <del>function startTransition(setPending, config, callback) { <add>function startTransition(setPending, callback) { <ide> const priorityLevel = getCurrentPriorityLevel(); <ide> if (decoupleUpdatePriorityFromScheduler) { <ide> const previousLanePriority = getCurrentUpdateLanePriority(); <ide> function startTransition(setPending, config, callback) { <ide> }, <ide> ); <ide> <del> // If there's no SuspenseConfig set, we'll use the DefaultLanePriority for this transition. <add> // TODO: Can remove this. Was only necessary because we used to give <add> // different behavior to transitions without a config object. Now they are <add> // all treated the same. <ide> setCurrentUpdateLanePriority(DefaultLanePriority); <ide> <ide> runWithPriority( <ide> function startTransition(setPending, config, callback) { <ide> } <ide> } <ide> <del>function mountTransition( <del> config: SuspenseConfig | void | null, <del>): [(() => void) => void, boolean] { <add>function mountTransition(): [(() => void) => void, boolean] { <ide> const [isPending, setPending] = mountState(false); <del> const start = mountCallback(startTransition.bind(null, setPending, config), [ <del> setPending, <del> config, <del> ]); <add> // The `start` method can be stored on a ref, since `setPending` <add> // never changes. <add> const start = startTransition.bind(null, setPending); <add> mountRef(start); <ide> return [start, isPending]; <ide> } <ide> <del>function updateTransition( <del> config: SuspenseConfig | void | null, <del>): [(() => void) => void, boolean] { <del> const [isPending, setPending] = updateState(false); <del> const start = updateCallback(startTransition.bind(null, setPending, config), [ <del> setPending, <del> config, <del> ]); <add>function updateTransition(): [(() => void) => void, boolean] { <add> const [isPending] = updateState(false); <add> const startRef = updateRef(); <add> const start: (() => void) => void = (startRef.current: any); <ide> return [start, isPending]; <ide> } <ide> <del>function rerenderTransition( <del> config: SuspenseConfig | void | null, <del>): [(() => void) => void, boolean] { <del> const [isPending, setPending] = rerenderState(false); <del> const start = updateCallback(startTransition.bind(null, setPending, config), [ <del> setPending, <del> config, <del> ]); <add>function rerenderTransition(): [(() => void) => void, boolean] { <add> const [isPending] = rerenderState(false); <add> const startRef = updateRef(); <add> const start: (() => void) => void = (startRef.current: any); <ide> return [start, isPending]; <ide> } <ide> <ide> if (__DEV__) { <ide> mountHookTypesDev(); <ide> return mountDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> mountHookTypesDev(); <del> return mountDeferredValue(value, config); <add> return mountDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> mountHookTypesDev(); <del> return mountTransition(config); <add> return mountTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return mountDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> updateHookTypesDev(); <del> return mountDeferredValue(value, config); <add> return mountDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> updateHookTypesDev(); <del> return mountTransition(config); <add> return mountTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return updateDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> updateHookTypesDev(); <del> return updateDeferredValue(value, config); <add> return updateDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> updateHookTypesDev(); <del> return updateTransition(config); <add> return updateTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return updateDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> updateHookTypesDev(); <del> return rerenderDeferredValue(value, config); <add> return rerenderDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> updateHookTypesDev(); <del> return rerenderTransition(config); <add> return rerenderTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> mountHookTypesDev(); <ide> return mountDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> warnInvalidHookAccess(); <ide> mountHookTypesDev(); <del> return mountDeferredValue(value, config); <add> return mountDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> warnInvalidHookAccess(); <ide> mountHookTypesDev(); <del> return mountTransition(config); <add> return mountTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return updateDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> warnInvalidHookAccess(); <ide> updateHookTypesDev(); <del> return updateDeferredValue(value, config); <add> return updateDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> warnInvalidHookAccess(); <ide> updateHookTypesDev(); <del> return updateTransition(config); <add> return updateTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> if (__DEV__) { <ide> updateHookTypesDev(); <ide> return updateDebugValue(value, formatterFn); <ide> }, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T { <add> useDeferredValue<T>(value: T): T { <ide> currentHookNameInDev = 'useDeferredValue'; <ide> warnInvalidHookAccess(); <ide> updateHookTypesDev(); <del> return rerenderDeferredValue(value, config); <add> return rerenderDeferredValue(value); <ide> }, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean] { <add> useTransition(): [(() => void) => void, boolean] { <ide> currentHookNameInDev = 'useTransition'; <ide> warnInvalidHookAccess(); <ide> updateHookTypesDev(); <del> return rerenderTransition(config); <add> return rerenderTransition(); <ide> }, <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide><path>packages/react-reconciler/src/ReactFiberThrow.new.js <ide> function throwException( <ide> // that we can show the initial loading state as quickly as possible. <ide> // <ide> // If we hit a "Delayed" case, such as when we'd switch from content back into <del> // a fallback, then we should always suspend/restart. SuspenseConfig applies to <del> // this case. If none is defined, JND is used instead. <add> // a fallback, then we should always suspend/restart. Transitions apply <add> // to this case. If none is defined, JND is used instead. <ide> // <ide> // If we're already showing a fallback and it gets "retried", allowing us to show <ide> // another level, but there's still an inner boundary that would show a fallback, <ide><path>packages/react-reconciler/src/ReactFiberThrow.old.js <ide> function throwException( <ide> // that we can show the initial loading state as quickly as possible. <ide> // <ide> // If we hit a "Delayed" case, such as when we'd switch from content back into <del> // a fallback, then we should always suspend/restart. SuspenseConfig applies to <del> // this case. If none is defined, JND is used instead. <add> // a fallback, then we should always suspend/restart. Transitions apply <add> // to this case. If none is defined, JND is used instead. <ide> // <ide> // If we're already showing a fallback and it gets "retried", allowing us to show <ide> // another level, but there's still an inner boundary that would show a fallback, <ide><path>packages/react-reconciler/src/ReactFiberTransition.js <ide> <ide> import ReactSharedInternals from 'shared/ReactSharedInternals'; <ide> <del>// Deprecated <del>export type SuspenseConfig = {| <del> timeoutMs: number, <del> busyDelayMs?: number, <del> busyMinDurationMs?: number, <del>|}; <del> <del>// Deprecated <del>export type TimeoutConfig = {| <del> timeoutMs: number, <del>|}; <del> <ide> const {ReactCurrentBatchConfig} = ReactSharedInternals; <ide> <ide> export const NoTransition = 0; <ide><path>packages/react-reconciler/src/ReactInternalTypes.js <ide> import type {RootTag} from './ReactRootTags'; <ide> import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig'; <ide> import type {Wakeable} from 'shared/ReactTypes'; <ide> import type {Interaction} from 'scheduler/src/Tracing'; <del>import type {SuspenseConfig, TimeoutConfig} from './ReactFiberTransition'; <ide> <ide> export type ReactPriorityLevel = 99 | 98 | 97 | 96 | 95 | 90; <ide> <ide> export type Dispatcher = {| <ide> deps: Array<mixed> | void | null, <ide> ): void, <ide> useDebugValue<T>(value: T, formatterFn: ?(value: T) => mixed): void, <del> useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T, <del> useTransition( <del> config: SuspenseConfig | void | null, <del> ): [(() => void) => void, boolean], <add> useDeferredValue<T>(value: T): T, <add> useTransition(): [(() => void) => void, boolean], <ide> useMutableSource<Source, Snapshot>( <ide> source: MutableSource<Source>, <ide> getSnapshot: MutableSourceGetSnapshotFn<Source, Snapshot>, <ide><path>packages/react/src/ReactBatchConfig.js <ide> * @flow <ide> */ <ide> <del>import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberTransition'; <del> <ide> import ReactCurrentBatchConfig from './ReactCurrentBatchConfig'; <ide> <ide> // This is a copy of startTransition, except if null or undefined is passed, <ide> // then updates inside the scope are opted-out of the outer transition scope. <ide> // TODO: Deprecated. Remove in favor of startTransition. Figure out how scopes <ide> // should nest, and whether we need an API to opt-out nested scopes. <del>export function withSuspenseConfig(scope: () => void, config?: SuspenseConfig) { <add>export function withSuspenseConfig(scope: () => void, config?: mixed) { <ide> const prevTransition = ReactCurrentBatchConfig.transition; <ide> ReactCurrentBatchConfig.transition = <ide> config === undefined || config === null ? 0 : 1; <ide><path>packages/react/src/ReactHooks.js <ide> export function useDebugValue<T>( <ide> <ide> export const emptyObject = {}; <ide> <del>export function useTransition( <del> config: ?Object, <del>): [(() => void) => void, boolean] { <add>export function useTransition(): [(() => void) => void, boolean] { <ide> const dispatcher = resolveDispatcher(); <del> return dispatcher.useTransition(config); <add> return dispatcher.useTransition(); <ide> } <ide> <del>export function useDeferredValue<T>(value: T, config: ?Object): T { <add>export function useDeferredValue<T>(value: T): T { <ide> const dispatcher = resolveDispatcher(); <del> return dispatcher.useDeferredValue(value, config); <add> return dispatcher.useDeferredValue(value); <ide> } <ide> <ide> export function useOpaqueIdentifier(): OpaqueIDType | void {
10
Javascript
Javascript
remove var in rntester
811a99caab4032c5780d6b6f0b93c862c93d8c17
<ide><path>RNTester/js/AnimatedGratuitousApp/AnExApp.js <ide> <ide> 'use strict'; <ide> <del>var React = require('react'); <del>var ReactNative = require('react-native'); <del>var {Animated, LayoutAnimation, PanResponder, StyleSheet, View} = ReactNative; <add>const React = require('react'); <add>const ReactNative = require('react-native'); <add>const {Animated, LayoutAnimation, PanResponder, StyleSheet, View} = ReactNative; <ide> <del>var AnExSet = require('AnExSet'); <add>const AnExSet = require('AnExSet'); <ide> <del>var CIRCLE_SIZE = 80; <del>var CIRCLE_MARGIN = 18; <del>var NUM_CIRCLES = 30; <add>const CIRCLE_SIZE = 80; <add>const CIRCLE_MARGIN = 18; <add>const NUM_CIRCLES = 30; <ide> <ide> class Circle extends React.Component<any, any> { <ide> longTimer: number; <ide> class Circle extends React.Component<any, any> { <ide> } <ide> <ide> _onLongPress(): void { <del> var config = {tension: 40, friction: 3}; <add> const config = {tension: 40, friction: 3}; <ide> this.state.pan.addListener(value => { <ide> // Async listener for state changes (step1: uncomment) <ide> this.props.onMove && this.props.onMove(value); <ide> class Circle extends React.Component<any, any> { <ide> } <ide> <ide> render(): React.Node { <add> let handlers; <add> let dragStyle = null; <ide> if (this.state.panResponder) { <del> var handlers = this.state.panResponder.panHandlers; <del> var dragStyle = { <add> handlers = this.state.panResponder.panHandlers; <add> dragStyle = { <ide> // Used to position while dragging <ide> position: 'absolute', // Hoist out of layout (step1: uncomment) <ide> ...this.state.pan.getLayout(), // Convenience converter (step1: uncomment) <ide> class Circle extends React.Component<any, any> { <ide> }, <ide> }; <ide> } <del> var animatedStyle: Object = { <add> const animatedStyle: Object = { <ide> shadowOpacity: this.state.pop, // no need for interpolation (step2d: uncomment) <ide> transform: [ <ide> { <ide> class Circle extends React.Component<any, any> { <ide> }, <ide> ], <ide> }; <del> var openVal = this.props.openVal; <add> const openVal = this.props.openVal; <add> let innerOpenStyle = null; <ide> if (this.props.dummy) { <ide> animatedStyle.opacity = 0; <ide> } else if (this.state.isActive) { <del> var innerOpenStyle = [ <add> innerOpenStyle = [ <ide> styles.open, <ide> { <ide> // (step4: uncomment) <ide> class Circle extends React.Component<any, any> { <ide> ); <ide> } <ide> _toggleIsActive(velocity) { <del> var config = {tension: 30, friction: 7}; <add> const config = {tension: 30, friction: 7}; <ide> if (this.state.isActive) { <ide> Animated.spring(this.props.openVal, {toValue: 0, ...config}).start(() => { <ide> // (step4: uncomment) <ide> class AnExApp extends React.Component<any, any> { <ide> _onMove: (position: Point) => void; <ide> constructor(props: any): void { <ide> super(props); <del> var keys = []; <del> for (var idx = 0; idx < NUM_CIRCLES; idx++) { <add> const keys = []; <add> for (let idx = 0; idx < NUM_CIRCLES; idx++) { <ide> keys.push('E' + idx); <ide> } <ide> this.state = { <ide> class AnExApp extends React.Component<any, any> { <ide> } <ide> <ide> render(): React.Node { <del> var circles = this.state.keys.map((key, idx) => { <add> const circles = this.state.keys.map((key, idx) => { <ide> if (key === this.state.activeKey) { <ide> return <Circle key={key + 'd'} dummy={true} />; <ide> } else { <add> let onLayout = null; <ide> if (!this.state.restLayouts[idx]) { <del> var onLayout = function(index, e) { <del> var layout = e.nativeEvent.layout; <add> onLayout = function(index, e) { <add> const layout = e.nativeEvent.layout; <ide> this.setState(state => { <ide> state.restLayouts[index] = layout; <ide> return state; <ide> class AnExApp extends React.Component<any, any> { <ide> } <ide> <ide> _onMove(position: Point): void { <del> var newKeys = moveToClosest(this.state, position); <add> const newKeys = moveToClosest(this.state, position); <ide> if (newKeys !== this.state.keys) { <ide> LayoutAnimation.easeInEaseOut(); // animates layout update as one batch (step3: uncomment) <ide> this.setState({keys: newKeys}); <ide> class AnExApp extends React.Component<any, any> { <ide> <ide> type Point = {x: number, y: number}; <ide> function distance(p1: Point, p2: Point): number { <del> var dx = p1.x - p2.x; <del> var dy = p1.y - p2.y; <add> const dx = p1.x - p2.x; <add> const dy = p1.y - p2.y; <ide> return dx * dx + dy * dy; <ide> } <ide> <ide> function moveToClosest({activeKey, keys, restLayouts}, position) { <del> var activeIdx = -1; <del> var closestIdx = activeIdx; <del> var minDist = Infinity; <del> var newKeys = []; <add> const activeIdx = -1; <add> let closestIdx = activeIdx; <add> let minDist = Infinity; <add> const newKeys = []; <ide> keys.forEach((key, idx) => { <del> var dist = distance(position, restLayouts[idx]); <add> const dist = distance(position, restLayouts[idx]); <ide> if (key === activeKey) { <ide> idx = activeIdx; <ide> } else { <ide> function moveToClosest({activeKey, keys, restLayouts}, position) { <ide> } <ide> } <ide> <del>var styles = StyleSheet.create({ <add>const styles = StyleSheet.create({ <ide> container: { <ide> flex: 1, <ide> }, <ide><path>RNTester/js/AnimatedGratuitousApp/AnExBobble.js <ide> <ide> 'use strict'; <ide> <del>var React = require('react'); <del>var ReactNative = require('react-native'); <del>var {Animated, PanResponder, StyleSheet, View} = ReactNative; <add>const React = require('react'); <add>const ReactNative = require('react-native'); <add>const {Animated, PanResponder, StyleSheet, View} = ReactNative; <ide> <del>var NUM_BOBBLES = 5; <del>var RAD_EACH = Math.PI / 2 / (NUM_BOBBLES - 2); <del>var RADIUS = 160; <del>var BOBBLE_SPOTS = [...Array(NUM_BOBBLES)].map((_, i) => { <add>const NUM_BOBBLES = 5; <add>const RAD_EACH = Math.PI / 2 / (NUM_BOBBLES - 2); <add>const RADIUS = 160; <add>const BOBBLE_SPOTS = [...Array(NUM_BOBBLES)].map((_, i) => { <ide> // static positions <ide> return i === 0 <ide> ? {x: 0, y: 0} <ide> class AnExBobble extends React.Component<Object, any> { <ide> return new Animated.ValueXY(); <ide> }); <ide> this.state.selectedBobble = null; <del> var bobblePanListener = (e, gestureState) => { <add> const bobblePanListener = (e, gestureState) => { <ide> // async events => change selection <del> var newSelected = computeNewSelected(gestureState); <add> const newSelected = computeNewSelected(gestureState); <ide> if (this.state.selectedBobble !== newSelected) { <ide> if (this.state.selectedBobble !== null) { <del> var restSpot = BOBBLE_SPOTS[this.state.selectedBobble]; <add> const restSpot = BOBBLE_SPOTS[this.state.selectedBobble]; <ide> Animated.spring(this.state.bobbles[this.state.selectedBobble], { <ide> toValue: restSpot, // return previously selected bobble to rest position <ide> }).start(); <ide> class AnExBobble extends React.Component<Object, any> { <ide> this.state.selectedBobble = newSelected; <ide> } <ide> }; <del> var releaseBobble = () => { <add> const releaseBobble = () => { <ide> this.state.bobbles.forEach((bobble, i) => { <ide> Animated.spring(bobble, { <ide> toValue: {x: 0, y: 0}, // all bobbles return to zero <ide> class AnExBobble extends React.Component<Object, any> { <ide> return ( <ide> <View style={styles.bobbleContainer}> <ide> {this.state.bobbles.map((_, i) => { <del> var j = this.state.bobbles.length - i - 1; // reverse so lead on top <del> var handlers = j > 0 ? {} : this.state.bobbleResponder.panHandlers; <add> const j = this.state.bobbles.length - i - 1; // reverse so lead on top <add> const handlers = j > 0 ? {} : this.state.bobbleResponder.panHandlers; <ide> return ( <ide> <Animated.Image <ide> {...handlers} <ide> class AnExBobble extends React.Component<Object, any> { <ide> } <ide> } <ide> <del>var styles = StyleSheet.create({ <add>const styles = StyleSheet.create({ <ide> circle: { <ide> position: 'absolute', <ide> height: 60, <ide> var styles = StyleSheet.create({ <ide> }); <ide> <ide> function computeNewSelected(gestureState: Object): ?number { <del> var {dx, dy} = gestureState; <del> var minDist = Infinity; <del> var newSelected = null; <del> var pointRadius = Math.sqrt(dx * dx + dy * dy); <add> const {dx, dy} = gestureState; <add> let minDist = Infinity; <add> let newSelected = null; <add> const pointRadius = Math.sqrt(dx * dx + dy * dy); <ide> if (Math.abs(RADIUS - pointRadius) < 80) { <ide> BOBBLE_SPOTS.forEach((spot, idx) => { <del> var delta = {x: spot.x - dx, y: spot.y - dy}; <del> var dist = delta.x * delta.x + delta.y * delta.y; <add> const delta = {x: spot.x - dx, y: spot.y - dy}; <add> const dist = delta.x * delta.x + delta.y * delta.y; <ide> if (dist < minDist) { <ide> minDist = dist; <ide> newSelected = idx; <ide> function computeNewSelected(gestureState: Object): ?number { <ide> } <ide> <ide> function randColor(): string { <del> var colors = [0, 1, 2].map(() => Math.floor(Math.random() * 150 + 100)); <add> const colors = [0, 1, 2].map(() => Math.floor(Math.random() * 150 + 100)); <ide> return 'rgb(' + colors.join(',') + ')'; <ide> } <ide> <del>var BOBBLE_IMGS = [ <add>const BOBBLE_IMGS = [ <ide> 'https://scontent-sea1-1.xx.fbcdn.net/hphotos-xpf1/t39.1997-6/10173489_272703316237267_1025826781_n.png', <ide> 'https://scontent-sea1-1.xx.fbcdn.net/hphotos-xaf1/l/t39.1997-6/p240x240/851578_631487400212668_2087073502_n.png', <ide> 'https://scontent-sea1-1.xx.fbcdn.net/hphotos-xaf1/t39.1997-6/p240x240/851583_654446917903722_178118452_n.png', <ide><path>RNTester/js/AnimatedGratuitousApp/AnExChained.js <ide> <ide> 'use strict'; <ide> <del>var React = require('react'); <del>var ReactNative = require('react-native'); <del>var {Animated, PanResponder, StyleSheet, View} = ReactNative; <add>const React = require('react'); <add>const ReactNative = require('react-native'); <add>const {Animated, PanResponder, StyleSheet, View} = ReactNative; <ide> <ide> class AnExChained extends React.Component<Object, any> { <ide> constructor(props: Object) { <ide> super(props); <ide> this.state = { <ide> stickers: [new Animated.ValueXY()], // 1 leader <ide> }; <del> var stickerConfig = {tension: 2, friction: 3}; // soft spring <del> for (var i = 0; i < 4; i++) { <add> const stickerConfig = {tension: 2, friction: 3}; // soft spring <add> for (let i = 0; i < 4; i++) { <ide> // 4 followers <del> var sticker = new Animated.ValueXY(); <add> const sticker = new Animated.ValueXY(); <ide> Animated.spring(sticker, { <ide> ...stickerConfig, <ide> toValue: this.state.stickers[i], // Animated toValue's are tracked <ide> }).start(); <ide> this.state.stickers.push(sticker); // push on the followers <ide> } <del> var releaseChain = (e, gestureState) => { <add> const releaseChain = (e, gestureState) => { <ide> this.state.stickers[0].flattenOffset(); // merges offset into value and resets <ide> Animated.sequence([ <ide> // spring to start after decay finishes <ide> class AnExChained extends React.Component<Object, any> { <ide> return ( <ide> <View style={styles.chained}> <ide> {this.state.stickers.map((_, i) => { <del> var j = this.state.stickers.length - i - 1; // reverse so leader is on top <del> var handlers = j === 0 ? this.state.chainResponder.panHandlers : {}; <add> const j = this.state.stickers.length - i - 1; // reverse so leader is on top <add> const handlers = j === 0 ? this.state.chainResponder.panHandlers : {}; <ide> return ( <ide> <Animated.Image <ide> {...handlers} <ide> class AnExChained extends React.Component<Object, any> { <ide> } <ide> } <ide> <del>var styles = StyleSheet.create({ <add>const styles = StyleSheet.create({ <ide> chained: { <ide> alignSelf: 'flex-end', <ide> top: -160, <ide> var styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>var CHAIN_IMGS = [ <add>const CHAIN_IMGS = [ <ide> require('../hawk.png'), <ide> require('../bunny.png'), <ide> require('../relay.png'), <ide><path>RNTester/js/AnimatedGratuitousApp/AnExScroll.js <ide> <ide> 'use strict'; <ide> <del>var React = require('react'); <del>var ReactNative = require('react-native'); <del>var {Animated, Image, ScrollView, StyleSheet, Text, View} = ReactNative; <add>const React = require('react'); <add>const ReactNative = require('react-native'); <add>const {Animated, Image, ScrollView, StyleSheet, Text, View} = ReactNative; <ide> <ide> class AnExScroll extends React.Component<$FlowFixMeProps, any> { <ide> state: any = {scrollX: new Animated.Value(0)}; <ide> <ide> render() { <del> var width = this.props.panelWidth; <add> const width = this.props.panelWidth; <ide> return ( <ide> <View style={styles.container}> <ide> <ScrollView <ide> class AnExScroll extends React.Component<$FlowFixMeProps, any> { <ide> } <ide> } <ide> <del>var styles = StyleSheet.create({ <add>const styles = StyleSheet.create({ <ide> container: { <ide> backgroundColor: 'transparent', <ide> flex: 1, <ide> var styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>var HAWK_PIC = { <add>const HAWK_PIC = { <ide> uri: <ide> 'https://scontent-sea1-1.xx.fbcdn.net/hphotos-xfa1/t39.1997-6/10734304_1562225620659674_837511701_n.png', <ide> }; <del>var BUNNY_PIC = { <add>const BUNNY_PIC = { <ide> uri: <ide> 'https://scontent-sea1-1.xx.fbcdn.net/hphotos-xaf1/t39.1997-6/851564_531111380292237_1898871086_n.png', <ide> }; <ide><path>RNTester/js/AnimatedGratuitousApp/AnExSet.js <ide> <ide> 'use strict'; <ide> <del>var React = require('react'); <del>var ReactNative = require('react-native'); <del>var {Animated, PanResponder, StyleSheet, Text, View} = ReactNative; <add>const React = require('react'); <add>const ReactNative = require('react-native'); <add>const {Animated, PanResponder, StyleSheet, Text, View} = ReactNative; <ide> <del>var AnExBobble = require('./AnExBobble'); <del>var AnExChained = require('./AnExChained'); <del>var AnExScroll = require('./AnExScroll'); <del>var AnExTilt = require('./AnExTilt'); <add>const AnExBobble = require('./AnExBobble'); <add>const AnExChained = require('./AnExChained'); <add>const AnExScroll = require('./AnExScroll'); <add>const AnExTilt = require('./AnExTilt'); <ide> <ide> class AnExSet extends React.Component<Object, any> { <ide> constructor(props: Object) { <ide> super(props); <ide> function randColor() { <del> var colors = [0, 1, 2].map(() => Math.floor(Math.random() * 150 + 100)); <add> const colors = [0, 1, 2].map(() => Math.floor(Math.random() * 150 + 100)); <ide> return 'rgb(' + colors.join(',') + ')'; <ide> } <ide> this.state = { <ide> class AnExSet extends React.Component<Object, any> { <ide> }; <ide> } <ide> render(): React.Node { <del> var backgroundColor = this.props.openVal <add> const backgroundColor = this.props.openVal <ide> ? this.props.openVal.interpolate({ <ide> inputRange: [0, 1], <ide> outputRange: [ <ide> class AnExSet extends React.Component<Object, any> { <ide> ], <ide> }) <ide> : this.state.closeColor; <del> var panelWidth = <add> const panelWidth = <ide> (this.props.containerLayout && this.props.containerLayout.width) || 320; <ide> return ( <ide> <View style={styles.container}> <ide> class AnExSet extends React.Component<Object, any> { <ide> } <ide> } <ide> <del>var styles = StyleSheet.create({ <add>const styles = StyleSheet.create({ <ide> container: { <ide> flex: 1, <ide> }, <ide><path>RNTester/js/AnimatedGratuitousApp/AnExTilt.js <ide> <ide> 'use strict'; <ide> <del>var React = require('react'); <del>var ReactNative = require('react-native'); <del>var {Animated, PanResponder, StyleSheet} = ReactNative; <add>const React = require('react'); <add>const ReactNative = require('react-native'); <add>const {Animated, PanResponder, StyleSheet} = ReactNative; <ide> <ide> class AnExTilt extends React.Component<Object, any> { <ide> constructor(props: Object) { <ide> class AnExTilt extends React.Component<Object, any> { <ide> [null, {dx: this.state.panX}], // panX is linked to the gesture <ide> ), <ide> onPanResponderRelease: (e, gestureState) => { <del> var toValue = 0; <add> let toValue = 0; <ide> if (gestureState.dx > 100) { <ide> toValue = 500; <ide> } else if (gestureState.dx < -100) { <ide> class AnExTilt extends React.Component<Object, any> { <ide> friction: 3, <ide> }).start(); <ide> this.state.panX.removeAllListeners(); <del> var id = this.state.panX.addListener(({value}) => { <add> const id = this.state.panX.addListener(({value}) => { <ide> // listen until offscreen <ide> if (Math.abs(value) > 400) { <ide> this.state.panX.removeListener(id); // offscreen, so stop listening <ide> class AnExTilt extends React.Component<Object, any> { <ide> } <ide> } <ide> <del>var styles = StyleSheet.create({ <add>const styles = StyleSheet.create({ <ide> tilt: { <ide> overflow: 'hidden', <ide> height: 200, <ide><path>RNTester/js/createExamplePage.js <ide> const RNTesterExampleContainer = require('./RNTesterExampleContainer'); <ide> <ide> import type {ExampleModule} from 'ExampleTypes'; <ide> <del>var createExamplePage = function( <add>const createExamplePage = function( <ide> title: ?string, <ide> exampleModule: ExampleModule, <ide> ): React.ComponentType<any> {
7
Javascript
Javascript
correct scrolleventthrottle docs
a3ba25ed90b6896430f58a34eeaf831a953baeea
<ide><path>Libraries/Components/ScrollView/ScrollView.js <ide> var ScrollView = React.createClass({ <ide> scrollEnabled: PropTypes.bool, <ide> /** <ide> * This controls how often the scroll event will be fired while scrolling <del> * (in events per seconds). A higher number yields better accuracy for code <add> * (as a time interval in ms). A lower number yields better accuracy for code <ide> * that is tracking the scroll position, but can lead to scroll performance <ide> * problems due to the volume of information being send over the bridge. <del> * The default value is zero, which means the scroll event will be sent <del> * only once each time the view is scrolled. <add> * You will not notice a difference between values set between 1-16 as the <add> * JS run loop is synced to the screen refresh rate. If you do not need precise <add> * scroll position tracking, set this value higher to limit the information <add> * being sent across the bridge. The default value is zero, which results in <add> * the scroll event being sent only once each time the view is scrolled. <ide> * @platform ios <ide> */ <ide> scrollEventThrottle: PropTypes.number,
1
Go
Go
move default apparmor policy into package
35e50119fc2a2a6d9bcdc95c000df8b66d6cb9d3
<ide><path>daemon/execdriver/native/apparmor.go <del>// +build linux <del> <del>package native <del> <del>import ( <del> "bufio" <del> "io" <del> "os" <del> "os/exec" <del> "path" <del> "strings" <del> "text/template" <del> <del> "github.com/docker/docker/pkg/aaparser" <del> "github.com/opencontainers/runc/libcontainer/apparmor" <del>) <del> <del>const ( <del> apparmorProfilePath = "/etc/apparmor.d/docker" <del>) <del> <del>type data struct { <del> Name string <del> ExecPath string <del> Imports []string <del> InnerImports []string <del> MajorVersion int <del> MinorVersion int <del>} <del> <del>const baseTemplate = ` <del>{{range $value := .Imports}} <del>{{$value}} <del>{{end}} <del> <del>profile {{.Name}} flags=(attach_disconnected,mediate_deleted) { <del>{{range $value := .InnerImports}} <del> {{$value}} <del>{{end}} <del> <del> network, <del> capability, <del> file, <del> umount, <del> <del> deny @{PROC}/* w, # deny write for all files directly in /proc (not in a subdir) <del> # deny write to files not in /proc/<number>/** or /proc/sys/** <del> deny @{PROC}/{[^1-9],[^1-9][^0-9],[^1-9s][^0-9y][^0-9s],[^1-9][^0-9][^0-9][^0-9]*}/** w, <del> deny @{PROC}/sys/[^k]** w, # deny /proc/sys except /proc/sys/k* (effectively /proc/sys/kernel) <del> deny @{PROC}/sys/kernel/{?,??,[^s][^h][^m]**} w, # deny everything except shm* in /proc/sys/kernel/ <del> deny @{PROC}/sysrq-trigger rwklx, <del> deny @{PROC}/mem rwklx, <del> deny @{PROC}/kmem rwklx, <del> deny @{PROC}/kcore rwklx, <del> <del> deny mount, <del> <del> deny /sys/[^f]*/** wklx, <del> deny /sys/f[^s]*/** wklx, <del> deny /sys/fs/[^c]*/** wklx, <del> deny /sys/fs/c[^g]*/** wklx, <del> deny /sys/fs/cg[^r]*/** wklx, <del> deny /sys/firmware/efi/efivars/** rwklx, <del> deny /sys/kernel/security/** rwklx, <del> <del>{{if ge .MajorVersion 2}}{{if ge .MinorVersion 8}} <del> # suppress ptrace denials when using 'docker ps' or using 'ps' inside a container <del> ptrace (trace,read) peer=docker-default, <del>{{end}}{{end}} <del>{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}} <del> # docker daemon confinement requires explict allow rule for signal <del> signal (receive) set=(kill,term) peer={{.ExecPath}}, <del>{{end}}{{end}} <del>} <del>` <del> <del>func generateProfile(out io.Writer) error { <del> compiled, err := template.New("apparmor_profile").Parse(baseTemplate) <del> if err != nil { <del> return err <del> } <del> data := &data{ <del> Name: "docker-default", <del> } <del> if tunablesExists() { <del> data.Imports = append(data.Imports, "#include <tunables/global>") <del> } else { <del> data.Imports = append(data.Imports, "@{PROC}=/proc/") <del> } <del> if abstractionsExists() { <del> data.InnerImports = append(data.InnerImports, "#include <abstractions/base>") <del> } <del> data.MajorVersion, data.MinorVersion, err = aaparser.GetVersion() <del> if err != nil { <del> return err <del> } <del> data.ExecPath, err = exec.LookPath("docker") <del> if err != nil { <del> return err <del> } <del> if err := compiled.Execute(out, data); err != nil { <del> return err <del> } <del> return nil <del>} <del> <del>// check if the tunables/global exist <del>func tunablesExists() bool { <del> _, err := os.Stat("/etc/apparmor.d/tunables/global") <del> return err == nil <del>} <del> <del>// check if abstractions/base exist <del>func abstractionsExists() bool { <del> _, err := os.Stat("/etc/apparmor.d/abstractions/base") <del> return err == nil <del>} <del> <del>func installAppArmorProfile() error { <del> if !apparmor.IsEnabled() { <del> return nil <del> } <del> <del> // Make sure /etc/apparmor.d exists <del> if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0755); err != nil { <del> return err <del> } <del> <del> f, err := os.OpenFile(apparmorProfilePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) <del> if err != nil { <del> return err <del> } <del> if err := generateProfile(f); err != nil { <del> f.Close() <del> return err <del> } <del> f.Close() <del> <del> if err := aaparser.LoadProfile(apparmorProfilePath); err != nil { <del> return err <del> } <del> <del> return nil <del>} <del> <del>func hasAppArmorProfileLoaded(profile string) error { <del> file, err := os.Open("/sys/kernel/security/apparmor/profiles") <del> if err != nil { <del> return err <del> } <del> r := bufio.NewReader(file) <del> for { <del> p, err := r.ReadString('\n') <del> if err != nil { <del> return err <del> } <del> if strings.HasPrefix(p, profile+" ") { <del> return nil <del> } <del> } <del>} <ide><path>daemon/execdriver/native/driver.go <ide> import ( <ide> "github.com/docker/docker/pkg/reexec" <ide> sysinfo "github.com/docker/docker/pkg/system" <ide> "github.com/docker/docker/pkg/term" <add> aaprofile "github.com/docker/docker/profiles/apparmor" <ide> "github.com/opencontainers/runc/libcontainer" <ide> "github.com/opencontainers/runc/libcontainer/apparmor" <ide> "github.com/opencontainers/runc/libcontainer/cgroups/systemd" <ide> import ( <ide> const ( <ide> DriverName = "native" <ide> Version = "0.2" <add> <add> defaultApparmorProfile = "docker-default" <ide> ) <ide> <ide> // Driver contains all information for native driver, <ide> func NewDriver(root string, options []string) (*Driver, error) { <ide> } <ide> <ide> if apparmor.IsEnabled() { <del> if err := installAppArmorProfile(); err != nil { <del> apparmorProfiles := []string{"docker-default"} <add> if err := aaprofile.InstallDefault(defaultApparmorProfile); err != nil { <add> apparmorProfiles := []string{defaultApparmorProfile} <ide> <ide> // Allow daemon to run if loading failed, but are active <ide> // (possibly through another run, manually, or via system startup) <ide> for _, policy := range apparmorProfiles { <del> if err := hasAppArmorProfileLoaded(policy); err != nil { <add> if err := aaprofile.IsLoaded(policy); err != nil { <ide> return nil, fmt.Errorf("AppArmor enabled on system but the %s profile could not be loaded.", policy) <ide> } <ide> } <ide><path>profiles/apparmor/apparmor.go <add>// +build linux <add> <add>package apparmor <add> <add>import ( <add> "bufio" <add> "io" <add> "os" <add> "path" <add> "strings" <add> "text/template" <add> <add> "github.com/docker/docker/pkg/aaparser" <add>) <add> <add>var ( <add> // profileDirectory is the file store for apparmor profiles and macros. <add> profileDirectory = "/etc/apparmor.d" <add> // defaultProfilePath is the default path for the apparmor profile to be saved. <add> defaultProfilePath = path.Join(profileDirectory, "docker") <add>) <add> <add>// profileData holds information about the given profile for generation. <add>type profileData struct { <add> // Name is profile name. <add> Name string <add> // ExecPath is the path to the docker binary. <add> ExecPath string <add> // Imports defines the apparmor functions to import, before defining the profile. <add> Imports []string <add> // InnerImports defines the apparmor functions to import in the profile. <add> InnerImports []string <add> // MajorVersion is the apparmor_parser major version. <add> MajorVersion int <add> // MinorVersion is the apparmor_parser minor version. <add> MinorVersion int <add>} <add> <add>// generateDefault creates an apparmor profile from ProfileData. <add>func (p *profileData) generateDefault(out io.Writer) error { <add> compiled, err := template.New("apparmor_profile").Parse(baseTemplate) <add> if err != nil { <add> return err <add> } <add> if macroExists("tunables/global") { <add> p.Imports = append(p.Imports, "#include <tunables/global>") <add> } else { <add> p.Imports = append(p.Imports, "@{PROC}=/proc/") <add> } <add> if macroExists("abstractions/base") { <add> p.InnerImports = append(p.InnerImports, "#include <abstractions/base>") <add> } <add> if err := compiled.Execute(out, p); err != nil { <add> return err <add> } <add> return nil <add>} <add> <add>// macrosExists checks if the passed macro exists. <add>func macroExists(m string) bool { <add> _, err := os.Stat(path.Join(profileDirectory, m)) <add> return err == nil <add>} <add> <add>// InstallDefault generates a default profile and installs it in the <add>// ProfileDirectory with `apparmor_parser`. <add>func InstallDefault(name string) error { <add> // Make sure the path where they want to save the profile exists <add> if err := os.MkdirAll(profileDirectory, 0755); err != nil { <add> return err <add> } <add> <add> p := profileData{ <add> Name: name, <add> } <add> <add> f, err := os.OpenFile(defaultProfilePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) <add> if err != nil { <add> return err <add> } <add> if err := p.generateDefault(f); err != nil { <add> f.Close() <add> return err <add> } <add> f.Close() <add> <add> if err := aaparser.LoadProfile(defaultProfilePath); err != nil { <add> return err <add> } <add> <add> return nil <add>} <add> <add>// IsLoaded checks if a passed profile as been loaded into the kernel. <add>func IsLoaded(name string) error { <add> file, err := os.Open("/sys/kernel/security/apparmor/profiles") <add> if err != nil { <add> return err <add> } <add> r := bufio.NewReader(file) <add> for { <add> p, err := r.ReadString('\n') <add> if err != nil { <add> return err <add> } <add> if strings.HasPrefix(p, name+" ") { <add> return nil <add> } <add> } <add>} <ide><path>profiles/apparmor/template.go <add>// +build linux <add> <add>package apparmor <add> <add>// baseTemplate defines the default apparmor profile for containers. <add>const baseTemplate = ` <add>{{range $value := .Imports}} <add>{{$value}} <add>{{end}} <add> <add>profile {{.Name}} flags=(attach_disconnected,mediate_deleted) { <add>{{range $value := .InnerImports}} <add> {{$value}} <add>{{end}} <add> <add> network, <add> capability, <add> file, <add> umount, <add> <add> deny @{PROC}/* w, # deny write for all files directly in /proc (not in a subdir) <add> # deny write to files not in /proc/<number>/** or /proc/sys/** <add> deny @{PROC}/{[^1-9],[^1-9][^0-9],[^1-9s][^0-9y][^0-9s],[^1-9][^0-9][^0-9][^0-9]*}/** w, <add> deny @{PROC}/sys/[^k]** w, # deny /proc/sys except /proc/sys/k* (effectively /proc/sys/kernel) <add> deny @{PROC}/sys/kernel/{?,??,[^s][^h][^m]**} w, # deny everything except shm* in /proc/sys/kernel/ <add> deny @{PROC}/sysrq-trigger rwklx, <add> deny @{PROC}/mem rwklx, <add> deny @{PROC}/kmem rwklx, <add> deny @{PROC}/kcore rwklx, <add> <add> deny mount, <add> <add> deny /sys/[^f]*/** wklx, <add> deny /sys/f[^s]*/** wklx, <add> deny /sys/fs/[^c]*/** wklx, <add> deny /sys/fs/c[^g]*/** wklx, <add> deny /sys/fs/cg[^r]*/** wklx, <add> deny /sys/firmware/efi/efivars/** rwklx, <add> deny /sys/kernel/security/** rwklx, <add> <add>{{if ge .MajorVersion 2}}{{if ge .MinorVersion 8}} <add> # suppress ptrace denials when using 'docker ps' or using 'ps' inside a container <add> ptrace (trace,read) peer=docker-default, <add>{{end}}{{end}} <add>{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}} <add> # docker daemon confinement requires explict allow rule for signal <add> signal (receive) set=(kill,term) peer={{.ExecPath}}, <add>{{end}}{{end}} <add>} <add>`
4
Javascript
Javascript
react partial sync
ee5cb5a880015c58a98f4cdcd3f3cc978196246d
<ide><path>Libraries/Renderer/implementations/ReactFabric-dev.fb.js <ide> function scheduleFibersWithFamiliesRecursively( <ide> if (staleFamilies.has(family)) { <ide> needsRemount = true; <ide> } else if (updatedFamilies.has(family)) { <del> needsRender = true; <add> if (tag === ClassComponent) { <add> needsRemount = true; <add> } else { <add> needsRender = true; <add> } <ide> } <ide> } <ide> } <ide> function commitNestedUnmounts(root, renderPriorityLevel) { <ide> } <ide> <ide> function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <ide> // Cut off the return pointers to disconnect it from the tree. Ideally, we <ide> // should clear the child pointer of the parent alternate to let this <ide> // get GC:ed but we don't know which for sure which parent is the current <ide> function detachFiber(current$$1) { <ide> current$$1.memoizedState = null; <ide> current$$1.updateQueue = null; <ide> current$$1.dependencies = null; <del> var alternate = current$$1.alternate; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <ide> if (alternate !== null) { <del> alternate.return = null; <del> alternate.child = null; <del> alternate.memoizedState = null; <del> alternate.updateQueue = null; <del> alternate.dependencies = null; <add> detachFiber(alternate); <ide> } <ide> } <ide> <ide><path>Libraries/Renderer/implementations/ReactFabric-dev.js <ide> function scheduleFibersWithFamiliesRecursively( <ide> if (staleFamilies.has(family)) { <ide> needsRemount = true; <ide> } else if (updatedFamilies.has(family)) { <del> needsRender = true; <add> if (tag === ClassComponent) { <add> needsRemount = true; <add> } else { <add> needsRender = true; <add> } <ide> } <ide> } <ide> } <ide> function commitNestedUnmounts(root, renderPriorityLevel) { <ide> } <ide> <ide> function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <ide> // Cut off the return pointers to disconnect it from the tree. Ideally, we <ide> // should clear the child pointer of the parent alternate to let this <ide> // get GC:ed but we don't know which for sure which parent is the current <ide> function detachFiber(current$$1) { <ide> current$$1.memoizedState = null; <ide> current$$1.updateQueue = null; <ide> current$$1.dependencies = null; <del> var alternate = current$$1.alternate; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <ide> if (alternate !== null) { <del> alternate.return = null; <del> alternate.child = null; <del> alternate.memoizedState = null; <del> alternate.updateQueue = null; <del> alternate.dependencies = null; <add> detachFiber(alternate); <ide> } <ide> } <ide> <ide><path>Libraries/Renderer/implementations/ReactFabric-prod.fb.js <ide> function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { <ide> createChildNodeSet(current$$1$jscomp$0.stateNode.containerInfo); <ide> } <ide> } <add>function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <add> current$$1.return = null; <add> current$$1.child = null; <add> current$$1.memoizedState = null; <add> current$$1.updateQueue = null; <add> current$$1.dependencies = null; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <add> null !== alternate && detachFiber(alternate); <add>} <ide> function commitWork(current$$1, finishedWork) { <ide> switch (finishedWork.tag) { <ide> case 0: <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> snapshot.sibling.return = snapshot.return; <ide> snapshot = snapshot.sibling; <ide> } <del> prevProps.return = null; <del> prevProps.child = null; <del> prevProps.memoizedState = null; <del> prevProps.updateQueue = null; <del> prevProps.dependencies = null; <del> var alternate = prevProps.alternate; <del> null !== alternate && <del> ((alternate.return = null), <del> (alternate.child = null), <del> (alternate.memoizedState = null), <del> (alternate.updateQueue = null), <del> (alternate.dependencies = null)); <add> detachFiber(prevProps); <ide> } <ide> nextEffect = nextEffect.nextEffect; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> case 3: <ide> var _updateQueue = current$$1$jscomp$0.updateQueue; <ide> if (null !== _updateQueue) { <del> alternate = null; <add> current$$1 = null; <ide> if (null !== current$$1$jscomp$0.child) <ide> switch (current$$1$jscomp$0.child.tag) { <ide> case 5: <del> alternate = <add> current$$1 = <ide> current$$1$jscomp$0.child.stateNode.canonical; <ide> break; <ide> case 1: <del> alternate = current$$1$jscomp$0.child.stateNode; <add> current$$1 = current$$1$jscomp$0.child.stateNode; <ide> } <ide> commitUpdateQueue( <ide> current$$1$jscomp$0, <ide> _updateQueue, <del> alternate, <add> current$$1, <ide> currentRef <ide> ); <ide> } <ide><path>Libraries/Renderer/implementations/ReactFabric-prod.js <ide> function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { <ide> createChildNodeSet(current$$1$jscomp$0.stateNode.containerInfo); <ide> } <ide> } <add>function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <add> current$$1.return = null; <add> current$$1.child = null; <add> current$$1.memoizedState = null; <add> current$$1.updateQueue = null; <add> current$$1.dependencies = null; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <add> null !== alternate && detachFiber(alternate); <add>} <ide> function commitWork(current$$1, finishedWork) { <ide> switch (finishedWork.tag) { <ide> case 0: <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> snapshot.sibling.return = snapshot.return; <ide> snapshot = snapshot.sibling; <ide> } <del> prevProps.return = null; <del> prevProps.child = null; <del> prevProps.memoizedState = null; <del> prevProps.updateQueue = null; <del> prevProps.dependencies = null; <del> var alternate = prevProps.alternate; <del> null !== alternate && <del> ((alternate.return = null), <del> (alternate.child = null), <del> (alternate.memoizedState = null), <del> (alternate.updateQueue = null), <del> (alternate.dependencies = null)); <add> detachFiber(prevProps); <ide> } <ide> nextEffect = nextEffect.nextEffect; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> case 3: <ide> var _updateQueue = current$$1$jscomp$0.updateQueue; <ide> if (null !== _updateQueue) { <del> alternate = null; <add> current$$1 = null; <ide> if (null !== current$$1$jscomp$0.child) <ide> switch (current$$1$jscomp$0.child.tag) { <ide> case 5: <del> alternate = <add> current$$1 = <ide> current$$1$jscomp$0.child.stateNode.canonical; <ide> break; <ide> case 1: <del> alternate = current$$1$jscomp$0.child.stateNode; <add> current$$1 = current$$1$jscomp$0.child.stateNode; <ide> } <ide> commitUpdateQueue( <ide> current$$1$jscomp$0, <ide> _updateQueue, <del> alternate, <add> current$$1, <ide> currentRef <ide> ); <ide> } <ide><path>Libraries/Renderer/implementations/ReactFabric-profiling.fb.js <ide> function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { <ide> createChildNodeSet(current$$1$jscomp$0.stateNode.containerInfo); <ide> } <ide> } <add>function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <add> current$$1.return = null; <add> current$$1.child = null; <add> current$$1.memoizedState = null; <add> current$$1.updateQueue = null; <add> current$$1.dependencies = null; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <add> null !== alternate && detachFiber(alternate); <add>} <ide> function commitWork(current$$1, finishedWork) { <ide> switch (finishedWork.tag) { <ide> case 0: <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> snapshot.sibling.return = snapshot.return; <ide> snapshot = snapshot.sibling; <ide> } <del> prevProps.return = null; <del> prevProps.child = null; <del> prevProps.memoizedState = null; <del> prevProps.updateQueue = null; <del> prevProps.dependencies = null; <del> var alternate = prevProps.alternate; <del> null !== alternate && <del> ((alternate.return = null), <del> (alternate.child = null), <del> (alternate.memoizedState = null), <del> (alternate.updateQueue = null), <del> (alternate.dependencies = null)); <add> detachFiber(prevProps); <ide> } <ide> nextEffect = nextEffect.nextEffect; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> ) { <ide> var effectTag$jscomp$0 = nextEffect.effectTag; <ide> if (effectTag$jscomp$0 & 36) { <del> current$$1 = effectTag; <add> prevProps = effectTag; <ide> var current$$1$jscomp$1 = nextEffect.alternate; <ide> currentRef = nextEffect; <del> alternate = current$$1$jscomp$0; <add> current$$1 = current$$1$jscomp$0; <ide> switch (currentRef.tag) { <ide> case 0: <ide> case 11: <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> currentRef, <ide> updateQueue, <ide> instance$jscomp$0, <del> alternate <add> current$$1 <ide> ); <ide> break; <ide> case 3: <ide> var _updateQueue = currentRef.updateQueue; <ide> if (null !== _updateQueue) { <del> current$$1 = null; <add> prevProps = null; <ide> if (null !== currentRef.child) <ide> switch (currentRef.child.tag) { <ide> case 5: <del> current$$1 = currentRef.child.stateNode.canonical; <add> prevProps = currentRef.child.stateNode.canonical; <ide> break; <ide> case 1: <del> current$$1 = currentRef.child.stateNode; <add> prevProps = currentRef.child.stateNode; <ide> } <ide> commitUpdateQueue( <ide> currentRef, <ide> _updateQueue, <del> current$$1, <del> alternate <add> prevProps, <add> current$$1 <ide> ); <ide> } <ide> break; <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> currentRef.treeBaseDuration, <ide> currentRef.actualStartTime, <ide> commitTime, <del> current$$1.memoizedInteractions <add> prevProps.memoizedInteractions <ide> ); <ide> break; <ide> case 13: <ide><path>Libraries/Renderer/implementations/ReactFabric-profiling.js <ide> function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { <ide> createChildNodeSet(current$$1$jscomp$0.stateNode.containerInfo); <ide> } <ide> } <add>function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <add> current$$1.return = null; <add> current$$1.child = null; <add> current$$1.memoizedState = null; <add> current$$1.updateQueue = null; <add> current$$1.dependencies = null; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <add> null !== alternate && detachFiber(alternate); <add>} <ide> function commitWork(current$$1, finishedWork) { <ide> switch (finishedWork.tag) { <ide> case 0: <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> snapshot.sibling.return = snapshot.return; <ide> snapshot = snapshot.sibling; <ide> } <del> prevProps.return = null; <del> prevProps.child = null; <del> prevProps.memoizedState = null; <del> prevProps.updateQueue = null; <del> prevProps.dependencies = null; <del> var alternate = prevProps.alternate; <del> null !== alternate && <del> ((alternate.return = null), <del> (alternate.child = null), <del> (alternate.memoizedState = null), <del> (alternate.updateQueue = null), <del> (alternate.dependencies = null)); <add> detachFiber(prevProps); <ide> } <ide> nextEffect = nextEffect.nextEffect; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> ) { <ide> var effectTag$jscomp$0 = nextEffect.effectTag; <ide> if (effectTag$jscomp$0 & 36) { <del> current$$1 = effectTag; <add> prevProps = effectTag; <ide> var current$$1$jscomp$1 = nextEffect.alternate; <ide> currentRef = nextEffect; <del> alternate = current$$1$jscomp$0; <add> current$$1 = current$$1$jscomp$0; <ide> switch (currentRef.tag) { <ide> case 0: <ide> case 11: <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> currentRef, <ide> updateQueue, <ide> instance$jscomp$0, <del> alternate <add> current$$1 <ide> ); <ide> break; <ide> case 3: <ide> var _updateQueue = currentRef.updateQueue; <ide> if (null !== _updateQueue) { <del> current$$1 = null; <add> prevProps = null; <ide> if (null !== currentRef.child) <ide> switch (currentRef.child.tag) { <ide> case 5: <del> current$$1 = currentRef.child.stateNode.canonical; <add> prevProps = currentRef.child.stateNode.canonical; <ide> break; <ide> case 1: <del> current$$1 = currentRef.child.stateNode; <add> prevProps = currentRef.child.stateNode; <ide> } <ide> commitUpdateQueue( <ide> currentRef, <ide> _updateQueue, <del> current$$1, <del> alternate <add> prevProps, <add> current$$1 <ide> ); <ide> } <ide> break; <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> currentRef.treeBaseDuration, <ide> currentRef.actualStartTime, <ide> commitTime, <del> current$$1.memoizedInteractions <add> prevProps.memoizedInteractions <ide> ); <ide> break; <ide> case 13: <ide><path>Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js <ide> function scheduleFibersWithFamiliesRecursively( <ide> if (staleFamilies.has(family)) { <ide> needsRemount = true; <ide> } else if (updatedFamilies.has(family)) { <del> needsRender = true; <add> if (tag === ClassComponent) { <add> needsRemount = true; <add> } else { <add> needsRender = true; <add> } <ide> } <ide> } <ide> } <ide> function commitNestedUnmounts(root, renderPriorityLevel) { <ide> } <ide> <ide> function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <ide> // Cut off the return pointers to disconnect it from the tree. Ideally, we <ide> // should clear the child pointer of the parent alternate to let this <ide> // get GC:ed but we don't know which for sure which parent is the current <ide> function detachFiber(current$$1) { <ide> current$$1.memoizedState = null; <ide> current$$1.updateQueue = null; <ide> current$$1.dependencies = null; <del> var alternate = current$$1.alternate; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <ide> if (alternate !== null) { <del> alternate.return = null; <del> alternate.child = null; <del> alternate.memoizedState = null; <del> alternate.updateQueue = null; <del> alternate.dependencies = null; <add> detachFiber(alternate); <ide> } <ide> } <ide> <ide><path>Libraries/Renderer/implementations/ReactNativeRenderer-dev.js <ide> function scheduleFibersWithFamiliesRecursively( <ide> if (staleFamilies.has(family)) { <ide> needsRemount = true; <ide> } else if (updatedFamilies.has(family)) { <del> needsRender = true; <add> if (tag === ClassComponent) { <add> needsRemount = true; <add> } else { <add> needsRender = true; <add> } <ide> } <ide> } <ide> } <ide> function commitNestedUnmounts(root, renderPriorityLevel) { <ide> } <ide> <ide> function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <ide> // Cut off the return pointers to disconnect it from the tree. Ideally, we <ide> // should clear the child pointer of the parent alternate to let this <ide> // get GC:ed but we don't know which for sure which parent is the current <ide> function detachFiber(current$$1) { <ide> current$$1.memoizedState = null; <ide> current$$1.updateQueue = null; <ide> current$$1.dependencies = null; <del> var alternate = current$$1.alternate; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <ide> if (alternate !== null) { <del> alternate.return = null; <del> alternate.child = null; <del> alternate.memoizedState = null; <del> alternate.updateQueue = null; <del> alternate.dependencies = null; <add> detachFiber(alternate); <ide> } <ide> } <ide> <ide><path>Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js <ide> function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { <ide> unmountHostComponents(current$$1$jscomp$0, renderPriorityLevel); <ide> } <ide> } <add>function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <add> current$$1.return = null; <add> current$$1.child = null; <add> current$$1.memoizedState = null; <add> current$$1.updateQueue = null; <add> current$$1.dependencies = null; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <add> null !== alternate && detachFiber(alternate); <add>} <ide> function isHostParent(fiber) { <ide> return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> commitWork(nextEffect.alternate, nextEffect); <ide> break; <ide> case 8: <del> prevProps = nextEffect; <del> unmountHostComponents(prevProps, current$$1); <del> prevProps.return = null; <del> prevProps.child = null; <del> prevProps.memoizedState = null; <del> prevProps.updateQueue = null; <del> prevProps.dependencies = null; <del> var alternate = prevProps.alternate; <del> null !== alternate && <del> ((alternate.return = null), <del> (alternate.child = null), <del> (alternate.memoizedState = null), <del> (alternate.updateQueue = null), <del> (alternate.dependencies = null)); <add> (prevProps = nextEffect), <add> unmountHostComponents(prevProps, current$$1), <add> detachFiber(prevProps); <ide> } <ide> nextEffect = nextEffect.nextEffect; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> case 3: <ide> var _updateQueue = current$$1$jscomp$0.updateQueue; <ide> if (null !== _updateQueue) { <del> alternate = null; <add> current$$1 = null; <ide> if (null !== current$$1$jscomp$0.child) <ide> switch (current$$1$jscomp$0.child.tag) { <ide> case 5: <del> alternate = current$$1$jscomp$0.child.stateNode; <add> current$$1 = current$$1$jscomp$0.child.stateNode; <ide> break; <ide> case 1: <del> alternate = current$$1$jscomp$0.child.stateNode; <add> current$$1 = current$$1$jscomp$0.child.stateNode; <ide> } <ide> commitUpdateQueue( <ide> current$$1$jscomp$0, <ide> _updateQueue, <del> alternate, <add> current$$1, <ide> currentRef <ide> ); <ide> } <ide><path>Libraries/Renderer/implementations/ReactNativeRenderer-prod.js <ide> function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { <ide> unmountHostComponents(current$$1$jscomp$0, renderPriorityLevel); <ide> } <ide> } <add>function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <add> current$$1.return = null; <add> current$$1.child = null; <add> current$$1.memoizedState = null; <add> current$$1.updateQueue = null; <add> current$$1.dependencies = null; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <add> null !== alternate && detachFiber(alternate); <add>} <ide> function isHostParent(fiber) { <ide> return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> commitWork(nextEffect.alternate, nextEffect); <ide> break; <ide> case 8: <del> prevProps = nextEffect; <del> unmountHostComponents(prevProps, current$$1); <del> prevProps.return = null; <del> prevProps.child = null; <del> prevProps.memoizedState = null; <del> prevProps.updateQueue = null; <del> prevProps.dependencies = null; <del> var alternate = prevProps.alternate; <del> null !== alternate && <del> ((alternate.return = null), <del> (alternate.child = null), <del> (alternate.memoizedState = null), <del> (alternate.updateQueue = null), <del> (alternate.dependencies = null)); <add> (prevProps = nextEffect), <add> unmountHostComponents(prevProps, current$$1), <add> detachFiber(prevProps); <ide> } <ide> nextEffect = nextEffect.nextEffect; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> case 3: <ide> var _updateQueue = current$$1$jscomp$0.updateQueue; <ide> if (null !== _updateQueue) { <del> alternate = null; <add> current$$1 = null; <ide> if (null !== current$$1$jscomp$0.child) <ide> switch (current$$1$jscomp$0.child.tag) { <ide> case 5: <del> alternate = current$$1$jscomp$0.child.stateNode; <add> current$$1 = current$$1$jscomp$0.child.stateNode; <ide> break; <ide> case 1: <del> alternate = current$$1$jscomp$0.child.stateNode; <add> current$$1 = current$$1$jscomp$0.child.stateNode; <ide> } <ide> commitUpdateQueue( <ide> current$$1$jscomp$0, <ide> _updateQueue, <del> alternate, <add> current$$1, <ide> currentRef <ide> ); <ide> } <ide><path>Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js <ide> function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { <ide> unmountHostComponents(current$$1$jscomp$0, renderPriorityLevel); <ide> } <ide> } <add>function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <add> current$$1.return = null; <add> current$$1.child = null; <add> current$$1.memoizedState = null; <add> current$$1.updateQueue = null; <add> current$$1.dependencies = null; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <add> null !== alternate && detachFiber(alternate); <add>} <ide> function isHostParent(fiber) { <ide> return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> commitWork(nextEffect.alternate, nextEffect); <ide> break; <ide> case 8: <del> prevProps = nextEffect; <del> unmountHostComponents(prevProps, current$$1); <del> prevProps.return = null; <del> prevProps.child = null; <del> prevProps.memoizedState = null; <del> prevProps.updateQueue = null; <del> prevProps.dependencies = null; <del> var alternate = prevProps.alternate; <del> null !== alternate && <del> ((alternate.return = null), <del> (alternate.child = null), <del> (alternate.memoizedState = null), <del> (alternate.updateQueue = null), <del> (alternate.dependencies = null)); <add> (prevProps = nextEffect), <add> unmountHostComponents(prevProps, current$$1), <add> detachFiber(prevProps); <ide> } <ide> nextEffect = nextEffect.nextEffect; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> ) { <ide> var effectTag$jscomp$0 = nextEffect.effectTag; <ide> if (effectTag$jscomp$0 & 36) { <del> current$$1 = effectTag; <add> prevProps = effectTag; <ide> var current$$1$jscomp$1 = nextEffect.alternate; <ide> currentRef = nextEffect; <del> alternate = current$$1$jscomp$0; <add> current$$1 = current$$1$jscomp$0; <ide> switch (currentRef.tag) { <ide> case 0: <ide> case 11: <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> currentRef, <ide> updateQueue, <ide> instance$jscomp$0, <del> alternate <add> current$$1 <ide> ); <ide> break; <ide> case 3: <ide> var _updateQueue = currentRef.updateQueue; <ide> if (null !== _updateQueue) { <del> current$$1 = null; <add> prevProps = null; <ide> if (null !== currentRef.child) <ide> switch (currentRef.child.tag) { <ide> case 5: <del> current$$1 = currentRef.child.stateNode; <add> prevProps = currentRef.child.stateNode; <ide> break; <ide> case 1: <del> current$$1 = currentRef.child.stateNode; <add> prevProps = currentRef.child.stateNode; <ide> } <ide> commitUpdateQueue( <ide> currentRef, <ide> _updateQueue, <del> current$$1, <del> alternate <add> prevProps, <add> current$$1 <ide> ); <ide> } <ide> break; <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> currentRef.treeBaseDuration, <ide> currentRef.actualStartTime, <ide> commitTime, <del> current$$1.memoizedInteractions <add> prevProps.memoizedInteractions <ide> ); <ide> break; <ide> case 13: <ide><path>Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js <ide> function commitUnmount(current$$1$jscomp$0, renderPriorityLevel) { <ide> unmountHostComponents(current$$1$jscomp$0, renderPriorityLevel); <ide> } <ide> } <add>function detachFiber(current$$1) { <add> var alternate = current$$1.alternate; <add> current$$1.return = null; <add> current$$1.child = null; <add> current$$1.memoizedState = null; <add> current$$1.updateQueue = null; <add> current$$1.dependencies = null; <add> current$$1.alternate = null; <add> current$$1.firstEffect = null; <add> current$$1.lastEffect = null; <add> current$$1.pendingProps = null; <add> current$$1.memoizedProps = null; <add> null !== alternate && detachFiber(alternate); <add>} <ide> function isHostParent(fiber) { <ide> return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> commitWork(nextEffect.alternate, nextEffect); <ide> break; <ide> case 8: <del> prevProps = nextEffect; <del> unmountHostComponents(prevProps, current$$1); <del> prevProps.return = null; <del> prevProps.child = null; <del> prevProps.memoizedState = null; <del> prevProps.updateQueue = null; <del> prevProps.dependencies = null; <del> var alternate = prevProps.alternate; <del> null !== alternate && <del> ((alternate.return = null), <del> (alternate.child = null), <del> (alternate.memoizedState = null), <del> (alternate.updateQueue = null), <del> (alternate.dependencies = null)); <add> (prevProps = nextEffect), <add> unmountHostComponents(prevProps, current$$1), <add> detachFiber(prevProps); <ide> } <ide> nextEffect = nextEffect.nextEffect; <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> ) { <ide> var effectTag$jscomp$0 = nextEffect.effectTag; <ide> if (effectTag$jscomp$0 & 36) { <del> current$$1 = effectTag; <add> prevProps = effectTag; <ide> var current$$1$jscomp$1 = nextEffect.alternate; <ide> currentRef = nextEffect; <del> alternate = current$$1$jscomp$0; <add> current$$1 = current$$1$jscomp$0; <ide> switch (currentRef.tag) { <ide> case 0: <ide> case 11: <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> currentRef, <ide> updateQueue, <ide> instance$jscomp$0, <del> alternate <add> current$$1 <ide> ); <ide> break; <ide> case 3: <ide> var _updateQueue = currentRef.updateQueue; <ide> if (null !== _updateQueue) { <del> current$$1 = null; <add> prevProps = null; <ide> if (null !== currentRef.child) <ide> switch (currentRef.child.tag) { <ide> case 5: <del> current$$1 = currentRef.child.stateNode; <add> prevProps = currentRef.child.stateNode; <ide> break; <ide> case 1: <del> current$$1 = currentRef.child.stateNode; <add> prevProps = currentRef.child.stateNode; <ide> } <ide> commitUpdateQueue( <ide> currentRef, <ide> _updateQueue, <del> current$$1, <del> alternate <add> prevProps, <add> current$$1 <ide> ); <ide> } <ide> break; <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> currentRef.treeBaseDuration, <ide> currentRef.actualStartTime, <ide> commitTime, <del> current$$1.memoizedInteractions <add> prevProps.memoizedInteractions <ide> ); <ide> break; <ide> case 13:
12
PHP
PHP
change access modifier on _stop() to protected
1d39b937858cb7bbaad299a208968c59c1a2f102
<ide><path>cake/libs/object.php <ide> public function dispatchMethod($method, $params = array()) { <ide> * @param $status see http://php.net/exit for values <ide> * @return void <ide> */ <del> public function _stop($status = 0) { <add> protected function _stop($status = 0) { <ide> exit($status); <ide> } <ide>
1
Text
Text
update instructions for translations
ffca835231869dcaa333c6b81fb72e045a4af07d
<ide><path>docs/style-guide-for-guide-articles.md <ide> The titles use a speacial YAML front matter syntax block as shown below. These c <ide> These are the specific front matter requirements: <ide> 1. The front matter block should be on the first line of the file. <ide> 2. The front matter block should not have whitespaces before and after the lines. <del>3. Each key value pair is separated by one space only <add>3. The `title` keyword and the string value after the colon (`:`) must only be separted by a single space. <add>4. If the article is a translation from the english version, the front matter block should also have a `titleLocale` keyword with appilicable translation for the english title. <ide> <ide> Here are some examples of properly named titles: <ide> <del>> [`src/pages/html/tables/index.md`](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/src/pages/html/tables/index.md) <add>> [`guide/english/javascript/loops/for-loop/index.md`](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/guide/english/javascript/loops/for-loop/index.md) <ide> <ide> ```markdown <ide> --- <del>title: Tables <add>title: For Loop <ide> --- <ide> ``` <ide> <del>> [`src/pages/css/borders/index.md`](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/src/pages/css/borders/index.md) <add>> [`guide/spanish/algorithms/binary-search-trees/index.md`](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/guide/spanish/algorithms/binary-search-trees/index.md) <ide> <del>```markdown <del>--- <del>title: Borders <del>--- <ide> ``` <del> <del>> [`src/pages/javascript/loops/for-loop/index.md`](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/src/pages/javascript/loops/for-loop/index.md) <del> <del>```markdown <ide> --- <del>title: For Loop <add>title: Binary Search Trees <add>localeTitle: Árboles binarios de búsqueda <ide> --- <ide> ``` <ide>
1
Java
Java
refine eclipselink sql logging
4308a0404cf5ed9c1813c3320e0d86dfc085f06f
<ide><path>spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java <ide> else if (getDatabase() != null) { <ide> PersistenceUnitProperties.DDL_DATABASE_GENERATION); <ide> } <ide> if (isShowSql()) { <del> jpaProperties.put(PersistenceUnitProperties.LOGGING_LEVEL, Level.FINE.toString()); <add> jpaProperties.put(PersistenceUnitProperties.CATEGORY_LOGGING_LEVEL_ + <add> org.eclipse.persistence.logging.SessionLog.SQL, Level.FINE.toString()); <ide> } <ide> <ide> return jpaProperties;
1
Ruby
Ruby
replace shallow mocks with ruby classes
f7bfb3db282f8333adb469b6d223b58523428d7d
<ide><path>activerecord/test/cases/fixtures_test.rb <ide> class TransactionalFixturesOnConnectionNotification < ActiveRecord::TestCase <ide> self.use_instantiated_fixtures = false <ide> <ide> def test_transaction_created_on_connection_notification <del> connection = stub(transaction_open?: false) <add> connection = Class.new do <add> attr_accessor :pool <add> <add> def transaction_open?; end <add> def begin_transaction(*args); end <add> def rollback_transaction(*args); end <add> end.new <add> <add> connection.pool = Class.new do <add> def lock_thread=(lock_thread); false; end <add> end.new <add> <ide> connection.expects(:begin_transaction).with(joinable: false) <del> pool = connection.stubs(:pool).returns(ActiveRecord::ConnectionAdapters::ConnectionPool.new(ActiveRecord::Base.connection_pool.spec)) <del> pool.stubs(:lock_thread=).with(false) <add> <ide> fire_connection_notification(connection) <ide> end <ide> <ide> def test_notification_established_transactions_are_rolled_back <del> # Mocha is not thread-safe so define our own stub to test <ide> connection = Class.new do <ide> attr_accessor :rollback_transaction_called <ide> attr_accessor :pool <add> <ide> def transaction_open?; true; end <ide> def begin_transaction(*args); end <ide> def rollback_transaction(*args) <ide> @rollback_transaction_called = true <ide> end <ide> end.new <add> <ide> connection.pool = Class.new do <ide> def lock_thread=(lock_thread); false; end <ide> end.new <add> <ide> fire_connection_notification(connection) <ide> teardown_fixtures <add> <ide> assert(connection.rollback_transaction_called, "Expected <mock connection>#rollback_transaction to be called but was not") <ide> end <ide> <ide><path>activerecord/test/cases/tasks/database_tasks_test.rb <ide> module ActiveRecord <ide> module DatabaseTasksSetupper <ide> def setup <del> @mysql_tasks, @postgresql_tasks, @sqlite_tasks = stub, stub, stub <add> @mysql_tasks, @postgresql_tasks, @sqlite_tasks = Array.new( <add> 3, <add> Class.new do <add> def create; end <add> def drop; end <add> def purge; end <add> def charset; end <add> def collation; end <add> def structure_dump(*); end <add> end.new <add> ) <ide> ActiveRecord::Tasks::MySQLDatabaseTasks.stubs(:new).returns @mysql_tasks <ide> ActiveRecord::Tasks::PostgreSQLDatabaseTasks.stubs(:new).returns @postgresql_tasks <ide> ActiveRecord::Tasks::SQLiteDatabaseTasks.stubs(:new).returns @sqlite_tasks <ide><path>activerecord/test/cases/tasks/mysql_rake_test.rb <ide> module ActiveRecord <ide> class MysqlDBCreateTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(create_database: true) <add> @connection = Class.new { def create_database(*); end }.new <ide> @configuration = { <ide> "adapter" => "mysql2", <ide> "database" => "my-app-db" <ide> def teardown <ide> end <ide> <ide> def test_raises_error <del> assert_raises(Mysql2::Error) do <add> assert_raises(Mysql2::Error, "Invalid permissions") do <ide> ActiveRecord::Tasks::DatabaseTasks.create @configuration <ide> end <ide> end <ide> end <ide> <ide> class MySQLDBDropTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(drop_database: true) <add> @connection = Class.new { def drop_database(name); true end }.new <ide> @configuration = { <ide> "adapter" => "mysql2", <ide> "database" => "my-app-db" <ide> def test_when_database_dropped_successfully_outputs_info_to_stdout <ide> <ide> class MySQLPurgeTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(recreate_database: true) <add> @connection = Class.new { def recreate_database(*); end }.new <ide> @configuration = { <ide> "adapter" => "mysql2", <ide> "database" => "test-db" <ide> def test_recreates_database_with_the_given_options <ide> <ide> class MysqlDBCharsetTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(create_database: true) <add> @connection = Class.new { def charset; end }.new <ide> @configuration = { <ide> "adapter" => "mysql2", <ide> "database" => "my-app-db" <ide> def test_db_retrieves_charset <ide> <ide> class MysqlDBCollationTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(create_database: true) <add> @connection = Class.new { def collation; end }.new <ide> @configuration = { <ide> "adapter" => "mysql2", <ide> "database" => "my-app-db" <ide><path>activerecord/test/cases/tasks/postgresql_rake_test.rb <ide> module ActiveRecord <ide> class PostgreSQLDBCreateTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(create_database: true) <add> @connection = Class.new { def create_database(*); end }.new <ide> @configuration = { <ide> "adapter" => "postgresql", <ide> "database" => "my-app-db" <ide> def test_create_when_database_exists_outputs_info_to_stderr <ide> <ide> class PostgreSQLDBDropTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(drop_database: true) <add> @connection = Class.new { def drop_database(*); end }.new <ide> @configuration = { <ide> "adapter" => "postgresql", <ide> "database" => "my-app-db" <ide> def test_when_database_dropped_successfully_outputs_info_to_stdout <ide> <ide> class PostgreSQLPurgeTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(create_database: true, drop_database: true) <add> @connection = Class.new do <add> def create_database(*); end <add> def drop_database(*); end <add> end.new <ide> @configuration = { <ide> "adapter" => "postgresql", <ide> "database" => "my-app-db" <ide> def test_establishes_connection <ide> <ide> class PostgreSQLDBCharsetTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(create_database: true) <add> @connection = Class.new { def create_database(*); end }.new <ide> @configuration = { <ide> "adapter" => "postgresql", <ide> "database" => "my-app-db" <ide> def test_db_retrieves_charset <ide> <ide> class PostgreSQLDBCollationTest < ActiveRecord::TestCase <ide> def setup <del> @connection = stub(create_database: true) <add> @connection = Class.new { def create_database(*); end }.new <ide> @configuration = { <ide> "adapter" => "postgresql", <ide> "database" => "my-app-db" <ide><path>activerecord/test/cases/tasks/sqlite_rake_test.rb <ide> def test_db_create_with_error_prints_message <ide> class SqliteDBDropTest < ActiveRecord::TestCase <ide> def setup <ide> @database = "db_create.sqlite3" <del> @path = stub(to_s: "/absolute/path", absolute?: true) <ide> @configuration = { <ide> "adapter" => "sqlite3", <ide> "database" => @database <ide> } <add> @path = Class.new do <add> def to_s; "/absolute/path" end <add> def absolute?; true end <add> end.new <ide> <ide> Pathname.stubs(:new).returns(@path) <ide> File.stubs(:join).returns("/former/relative/path") <ide> def test_when_db_dropped_successfully_outputs_info_to_stdout <ide> class SqliteDBCharsetTest < ActiveRecord::TestCase <ide> def setup <ide> @database = "db_create.sqlite3" <del> @connection = stub :connection <add> @connection = Class.new { def encoding; end }.new <ide> @configuration = { <ide> "adapter" => "sqlite3", <ide> "database" => @database
5
Go
Go
add a script to help reproduce #407
1ec6c223c9e3a22e9cf182d1d4d69f16a9d083f4
<ide><path>contrib/crashTest.go <add>package main <add> <add>import ( <add> "io" <add> "log" <add> "os" <add> "os/exec" <add> "time" <add>) <add> <add>const DOCKER_PATH = "/home/creack/dotcloud/docker/docker/docker" <add> <add>func runDaemon() (*exec.Cmd, error) { <add> cmd := exec.Command(DOCKER_PATH, "-d") <add> outPipe, err := cmd.StdoutPipe() <add> if err != nil { <add> return nil, err <add> } <add> errPipe, err := cmd.StderrPipe() <add> if err != nil { <add> return nil, err <add> } <add> if err := cmd.Start(); err != nil { <add> return nil, err <add> } <add> go func() { <add> io.Copy(os.Stdout, outPipe) <add> }() <add> go func() { <add> io.Copy(os.Stderr, errPipe) <add> }() <add> return cmd, nil <add>} <add> <add>func crashTest() error { <add> if err := exec.Command("/bin/bash", "-c", "while true; do true; done").Start(); err != nil { <add> return err <add> } <add> <add> for { <add> daemon, err := runDaemon() <add> if err != nil { <add> return err <add> } <add> time.Sleep(5000 * time.Millisecond) <add> go func() error { <add> for i := 0; i < 100; i++ { <add> go func() error { <add> cmd := exec.Command(DOCKER_PATH, "run", "base", "echo", "hello", "world") <add> log.Printf("%d", i) <add> outPipe, err := cmd.StdoutPipe() <add> if err != nil { <add> return err <add> } <add> inPipe, err := cmd.StdinPipe() <add> if err != nil { <add> return err <add> } <add> if err := cmd.Start(); err != nil { <add> return err <add> } <add> go func() { <add> io.Copy(os.Stdout, outPipe) <add> }() <add> // Expecting error, do not check <add> inPipe.Write([]byte("hello world!!!!!\n")) <add> go inPipe.Write([]byte("hello world!!!!!\n")) <add> go inPipe.Write([]byte("hello world!!!!!\n")) <add> inPipe.Close() <add> <add> if err := cmd.Wait(); err != nil { <add> return err <add> } <add> outPipe.Close() <add> return nil <add> }() <add> time.Sleep(250 * time.Millisecond) <add> } <add> return nil <add> }() <add> <add> time.Sleep(20 * time.Second) <add> if err := daemon.Process.Kill(); err != nil { <add> return err <add> } <add> } <add> return nil <add>} <add> <add>func main() { <add> if err := crashTest(); err != nil { <add> log.Println(err) <add> } <add>}
1
Text
Text
add header demarcation to action cable guide
41c3ebaf38eca7fb528c8439445ad52e815fb5b9
<ide><path>guides/source/action_cable_overview.md <ide> After reading this guide, you will know: <ide> * What Action Cable is and its integration on backend and frontend <ide> * How to setup Action Cable <ide> * How to setup channels <del>* Deployment and Architecture setup for running Action Cable <add>* Deployment and Architecture setup for running Action Cable <add> <add>-------------------------------------------------------------------------------- <ide> <ide> Introduction <ide> ------------
1
Javascript
Javascript
feature flag to revert
d34b457ce2a2cee1160dbc90b93312ff9850958c
<ide><path>packages/react-reconciler/src/ReactFiberClassComponent.js <ide> import { <ide> requestCurrentTime, <ide> computeExpirationForFiber, <ide> scheduleWork, <add> flushPassiveEffects, <ide> } from './ReactFiberScheduler'; <add>import {revertPassiveEffectsChange} from 'shared/ReactFeatureFlags'; <ide> <ide> const fakeInternalInstance = {}; <ide> const isArray = Array.isArray; <ide> const classComponentUpdater = { <ide> update.callback = callback; <ide> } <ide> <add> if (revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <ide> enqueueUpdate(fiber, update); <ide> scheduleWork(fiber, expirationTime); <ide> }, <ide> const classComponentUpdater = { <ide> update.callback = callback; <ide> } <ide> <add> if (revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <ide> enqueueUpdate(fiber, update); <ide> scheduleWork(fiber, expirationTime); <ide> }, <ide> const classComponentUpdater = { <ide> update.callback = callback; <ide> } <ide> <add> if (revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <ide> enqueueUpdate(fiber, update); <ide> scheduleWork(fiber, expirationTime); <ide> }, <ide><path>packages/react-reconciler/src/ReactFiberHooks.js <ide> import { <ide> import { <ide> scheduleWork, <ide> computeExpirationForFiber, <add> flushPassiveEffects, <ide> requestCurrentTime, <ide> warnIfNotCurrentlyActingUpdatesInDev, <ide> markRenderEventTime, <ide> import warning from 'shared/warning'; <ide> import getComponentName from 'shared/getComponentName'; <ide> import is from 'shared/objectIs'; <ide> import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork'; <add>import {revertPassiveEffectsChange} from 'shared/ReactFeatureFlags'; <ide> <ide> const {ReactCurrentDispatcher} = ReactSharedInternals; <ide> <ide> function dispatchAction<S, A>( <ide> lastRenderPhaseUpdate.next = update; <ide> } <ide> } else { <add> if (revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <add> <ide> const currentTime = requestCurrentTime(); <ide> const expirationTime = computeExpirationForFiber(currentTime, fiber); <ide> <ide><path>packages/react-reconciler/src/ReactFiberReconciler.js <ide> import { <ide> } from './ReactCurrentFiber'; <ide> import {StrictMode} from './ReactTypeOfMode'; <ide> import {Sync} from './ReactFiberExpirationTime'; <add>import {revertPassiveEffectsChange} from 'shared/ReactFeatureFlags'; <ide> <ide> type OpaqueRoot = FiberRoot; <ide> <ide> function scheduleRootUpdate( <ide> update.callback = callback; <ide> } <ide> <add> if (revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <ide> enqueueUpdate(current, update); <ide> scheduleWork(current, expirationTime); <ide> <ide> if (__DEV__) { <ide> id--; <ide> } <ide> if (currentHook !== null) { <add> if (revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <add> <ide> const newState = copyWithSet(currentHook.memoizedState, path, value); <ide> currentHook.memoizedState = newState; <ide> currentHook.baseState = newState; <ide> if (__DEV__) { <ide> <ide> // Support DevTools props for function components, forwardRef, memo, host components, etc. <ide> overrideProps = (fiber: Fiber, path: Array<string | number>, value: any) => { <add> if (revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <ide> fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); <ide> if (fiber.alternate) { <ide> fiber.alternate.pendingProps = fiber.pendingProps; <ide> if (__DEV__) { <ide> }; <ide> <ide> scheduleUpdate = (fiber: Fiber) => { <add> if (revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <ide> scheduleWork(fiber, Sync); <ide> }; <ide> <ide><path>packages/react-reconciler/src/ReactFiberScheduler.js <ide> import { <ide> enableProfilerTimer, <ide> disableYielding, <ide> enableSchedulerTracing, <add> revertPassiveEffectsChange, <ide> } from 'shared/ReactFeatureFlags'; <ide> import ReactSharedInternals from 'shared/ReactSharedInternals'; <ide> import invariant from 'shared/invariant'; <ide> export function flushInteractiveUpdates() { <ide> return; <ide> } <ide> flushPendingDiscreteUpdates(); <del> // If the discrete updates scheduled passive effects, flush them now so that <del> // they fire before the next serial event. <del> flushPassiveEffects(); <add> if (!revertPassiveEffectsChange) { <add> // If the discrete updates scheduled passive effects, flush them now so that <add> // they fire before the next serial event. <add> flushPassiveEffects(); <add> } <ide> } <ide> <ide> function resolveLocksOnRoot(root: FiberRoot, expirationTime: ExpirationTime) { <ide> export function interactiveUpdates<A, B, C, R>( <ide> // should explicitly call flushInteractiveUpdates. <ide> flushPendingDiscreteUpdates(); <ide> } <del> // TODO: Remove this call for the same reason as above. <del> flushPassiveEffects(); <add> if (!revertPassiveEffectsChange) { <add> // TODO: Remove this call for the same reason as above. <add> flushPassiveEffects(); <add> } <ide> return runWithPriority(UserBlockingPriority, fn.bind(null, a, b, c)); <ide> } <ide> <ide> function renderRoot( <ide> return commitRoot.bind(null, root); <ide> } <ide> <del> flushPassiveEffects(); <add> if (!revertPassiveEffectsChange) { <add> flushPassiveEffects(); <add> } <ide> <ide> // If the root or expiration time have changed, throw out the existing stack <ide> // and prepare a fresh one. Otherwise we'll continue where we left off. <ide><path>packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.internal.js <ide> describe('ReactHooksWithNoopRenderer', () => { <ide> expect(Scheduler).toFlushAndYield(['Step: 5, Shadow: 5']); <ide> expect(ReactNoop).toMatchRenderedOutput('5'); <ide> }); <add> <add> describe('revertPassiveEffectsChange', () => { <add> it('flushes serial effects before enqueueing work', () => { <add> jest.resetModules(); <add> <add> ReactFeatureFlags = require('shared/ReactFeatureFlags'); <add> ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false; <add> ReactFeatureFlags.enableSchedulerTracing = true; <add> ReactFeatureFlags.revertPassiveEffectsChange = true; <add> React = require('react'); <add> ReactNoop = require('react-noop-renderer'); <add> Scheduler = require('scheduler'); <add> SchedulerTracing = require('scheduler/tracing'); <add> useState = React.useState; <add> useEffect = React.useEffect; <add> act = ReactNoop.act; <add> <add> let _updateCount; <add> function Counter(props) { <add> const [count, updateCount] = useState(0); <add> _updateCount = updateCount; <add> useEffect(() => { <add> Scheduler.yieldValue(`Will set count to 1`); <add> updateCount(1); <add> }, []); <add> return <Text text={'Count: ' + count} />; <add> } <add> <add> ReactNoop.render(<Counter count={0} />, () => <add> Scheduler.yieldValue('Sync effect'), <add> ); <add> expect(Scheduler).toFlushAndYieldThrough(['Count: 0', 'Sync effect']); <add> expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]); <add> <add> // Enqueuing this update forces the passive effect to be flushed -- <add> // updateCount(1) happens first, so 2 wins. <add> act(() => _updateCount(2)); <add> expect(Scheduler).toHaveYielded(['Will set count to 1']); <add> expect(Scheduler).toFlushAndYield(['Count: 2']); <add> expect(ReactNoop.getChildren()).toEqual([span('Count: 2')]); <add> }); <add> }); <ide> }); <ide><path>packages/shared/ReactFeatureFlags.js <ide> export const enableEventAPI = false; <ide> <ide> // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107 <ide> export const enableJSXTransformAPI = false; <add> <add>// Temporary flag to revert the fix in #15650 <add>export const revertPassiveEffectsChange = false; <ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const warnAboutDeprecatedLifecycles = true; <ide> export const warnAboutDeprecatedSetNativeProps = true; <ide> export const enableEventAPI = false; <ide> export const enableJSXTransformAPI = false; <add>export const revertPassiveEffectsChange = false; <ide> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide><path>packages/shared/forks/ReactFeatureFlags.native-oss.js <ide> export const enableSchedulerDebugging = false; <ide> export const warnAboutDeprecatedSetNativeProps = false; <ide> export const enableEventAPI = false; <ide> export const enableJSXTransformAPI = false; <add>export const revertPassiveEffectsChange = false; <ide> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide><path>packages/shared/forks/ReactFeatureFlags.persistent.js <ide> export const enableSchedulerDebugging = false; <ide> export const warnAboutDeprecatedSetNativeProps = false; <ide> export const enableEventAPI = false; <ide> export const enableJSXTransformAPI = false; <add>export const revertPassiveEffectsChange = false; <ide> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.js <ide> export const enableSchedulerDebugging = false; <ide> export const warnAboutDeprecatedSetNativeProps = false; <ide> export const enableEventAPI = false; <ide> export const enableJSXTransformAPI = false; <add>export const revertPassiveEffectsChange = false; <ide> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.www.js <ide> export const disableJavaScriptURLs = false; <ide> export const disableYielding = false; <ide> export const enableEventAPI = true; <ide> export const enableJSXTransformAPI = true; <add>export const revertPassiveEffectsChange = false; <ide> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide><path>packages/shared/forks/ReactFeatureFlags.www.js <ide> export const { <ide> disableInputAttributeSyncing, <ide> warnAboutShorthandPropertyCollision, <ide> warnAboutDeprecatedSetNativeProps, <add> revertPassiveEffectsChange, <ide> } = require('ReactFeatureFlags'); <ide> <ide> // In www, we have experimental support for gathering data
12
PHP
PHP
fix doc block
f0430832ec658633882d21e5771bb5a0ebc3239d
<ide><path>src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php <ide> public function __construct(Application $app) <ide> * @return mixed <ide> * <ide> * @throws \Symfony\Component\HttpKernel\Exception\HttpException <del> * @throws \Illuminate\Foundation\Http\Exceptions\MaintenanceModeException <add> * @throws \Symfony\Component\HttpKernel\Exception\HttpException <ide> */ <ide> public function handle($request, Closure $next) <ide> {
1
Ruby
Ruby
use style consistent with surrounding code
29164f348e6aacf9e5f8cff6aeaa43fedcf98645
<ide><path>activesupport/lib/active_support/parameter_filter.rb <ide> def value_for_key(key, value, parents = [], original_params = nil) <ide> # If we don't pop the current parent it will be duplicated as we <ide> # process each array value. <ide> parents.pop if deep_regexps <del> value = value.map do |v| <del> value_for_key(key, v, parents, original_params) <del> end <add> value = value.map { |v| value_for_key(key, v, parents, original_params) } <ide> # Restore the parent stack after processing the array. <ide> parents.push(key) if deep_regexps <ide> elsif blocks.any?
1
Javascript
Javascript
remove unneeded scroll when we first load a page
ed7a10a8d54f283dfd5b9e2ea061cac0fff5f0b7
<ide><path>web/viewer.js <ide> var PDFView = { <ide> }, true); <ide> }, <ide> <del> setScale: function pdfViewSetScale(val, resetAutoSettings) { <add> setScale: function pdfViewSetScale(val, resetAutoSettings, noScroll) { <ide> if (val == this.currentScale) <ide> return; <ide> <ide> var pages = this.pages; <ide> for (var i = 0; i < pages.length; i++) <ide> pages[i].update(val * kCssUnits); <ide> <del> if (this.currentScale != val) <add> if (!noScroll && this.currentScale != val) <ide> this.pages[this.page - 1].scrollIntoView(); <ide> this.currentScale = val; <ide> <ide> var PDFView = { <ide> window.dispatchEvent(event); <ide> }, <ide> <del> parseScale: function pdfViewParseScale(value, resetAutoSettings) { <add> parseScale: function pdfViewParseScale(value, resetAutoSettings, noScroll) { <ide> if ('custom' == value) <ide> return; <ide> <ide> var scale = parseFloat(value); <ide> this.currentScaleValue = value; <ide> if (scale) { <del> this.setScale(scale, true); <add> this.setScale(scale, true, noScroll); <ide> return; <ide> } <ide> <ide> var PDFView = { <ide> currentPage.height * currentPage.scale / kCssUnits; <ide> switch (value) { <ide> case 'page-actual': <del> this.setScale(1, resetAutoSettings); <add> scale = 1; <ide> break; <ide> case 'page-width': <del> this.setScale(pageWidthScale, resetAutoSettings); <add> scale = pageWidthScale; <ide> break; <ide> case 'page-height': <del> this.setScale(pageHeightScale, resetAutoSettings); <add> scale = pageHeightScale; <ide> break; <ide> case 'page-fit': <del> this.setScale( <del> Math.min(pageWidthScale, pageHeightScale), resetAutoSettings); <add> scale = Math.min(pageWidthScale, pageHeightScale); <ide> break; <ide> case 'auto': <del> this.setScale(Math.min(1.0, pageWidthScale), resetAutoSettings); <add> scale = Math.min(1.0, pageWidthScale); <ide> break; <ide> } <add> this.setScale(scale, resetAutoSettings, noScroll); <ide> <ide> selectScaleOption(value); <ide> }, <ide> var PageView = function pageView(container, pdfPage, id, scale, <ide> } <ide> <ide> if (scale && scale !== PDFView.currentScale) <del> PDFView.parseScale(scale, true); <add> PDFView.parseScale(scale, true, true); <ide> else if (PDFView.currentScale === kUnknownScale) <del> PDFView.parseScale(kDefaultScale, true); <add> PDFView.parseScale(kDefaultScale, true, true); <ide> <ide> var boundingRect = [ <ide> this.viewport.convertToViewportPoint(x, y),
1
Javascript
Javascript
ensure valid global scope
7bef701324e47973fb4b234f424b8f1c5a6d91c2
<ide><path>dist/immutable.js <ide> */ <ide> function universalModule() { <ide> var module = {}; <add> var global = {}; <ide> var $Object = Object; <ide> <ide> function createClass(ctor, methods, staticMethods, superClass) { <ide><path>dist/immutable.min.js <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> */ <del>function t(){function t(t,e,r,n){var u;if(n){var o=n.prototype;u=i.create(o)}else u=t.prototype;return i.keys(e).forEach(function(t){u[t]=e[t]}),i.keys(r).forEach(function(e){t[e]=r[e]}),u.constructor=t,t.prototype=u,t}function e(t,e,r,n){return i.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}var n={},i=Object,u={};return u.createClass=t,u.superCall=e,u.defaultSuperCall=r,function(){"use strict";function t(t){return t.value=!1,t}function e(t){t&&(t.value=!0)}function r(){}function i(t,e){e=e||0;for(var r=Math.max(0,t.length-e),n=Array(r),i=0;r>i;i++)n[i]=t[i+e];return n}function o(t){return void 0===t.size&&(t.size=t.__iterate(a)),t.size}function s(t,e){return e>=0?+e:o(t)+ +e}function a(){return!0}function h(t,e,r){return(0===t||void 0!==r&&-r>=t)&&(void 0===e||void 0!==r&&e>=r)}function c(t,e){return _(t,e,0)}function f(t,e){return _(t,e,e)}function _(t,e,r){return void 0===t?r:0>t?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function l(t){return!(!t||!t[kr])}function v(t){return!(!t||!t[Ar])}function p(t){return!(!t||!t[Cr])}function d(t){return v(t)||p(t)}function y(t){return!(!t||!t[jr])}function m(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function g(){return{value:void 0,done:!0}}function w(t){return!!z(t)}function S(t){return t&&"function"==typeof t.next}function I(t){var e=z(t);return e&&e.call(t)}function z(t){var e=t&&(Lr&&t[Lr]||t[Tr]);return"function"==typeof e?e:void 0}function b(t){return t&&"number"==typeof t.length}function q(t){return!(!t||!t[Fr])}function M(){return en||(en=new Gr([]))}function D(t){var e=Array.isArray(t)?new Gr(t).fromEntrySeq():S(t)?new tn(t).fromEntrySeq():w(t)?new $r(t).fromEntrySeq():"object"==typeof t?new Zr(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function O(t){var e=x(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function E(t){var e=x(t)||"object"==typeof t&&new Zr(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t); <add>function t(){function t(t,e,r,n){var i;if(n){var o=n.prototype;i=u.create(o)}else i=t.prototype;return u.keys(e).forEach(function(t){i[t]=e[t]}),u.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return u.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}var n={},i={},u=Object,o={};return o.createClass=t,o.superCall=e,o.defaultSuperCall=r,function(){"use strict";function t(t){return t.value=!1,t}function e(t){t&&(t.value=!0)}function r(){}function i(t,e){e=e||0;for(var r=Math.max(0,t.length-e),n=Array(r),i=0;r>i;i++)n[i]=t[i+e];return n}function u(t){return void 0===t.size&&(t.size=t.__iterate(a)),t.size}function s(t,e){return e>=0?+e:u(t)+ +e}function a(){return!0}function h(t,e,r){return(0===t||void 0!==r&&-r>=t)&&(void 0===e||void 0!==r&&e>=r)}function c(t,e){return _(t,e,0)}function f(t,e){return _(t,e,e)}function _(t,e,r){return void 0===t?r:0>t?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function l(t){return!(!t||!t[kr])}function v(t){return!(!t||!t[Ar])}function p(t){return!(!t||!t[Cr])}function d(t){return v(t)||p(t)}function y(t){return!(!t||!t[jr])}function m(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function g(){return{value:void 0,done:!0}}function w(t){return!!z(t)}function S(t){return t&&"function"==typeof t.next}function I(t){var e=z(t);return e&&e.call(t)}function z(t){var e=t&&(Lr&&t[Lr]||t[Tr]);return"function"==typeof e?e:void 0}function b(t){return t&&"number"==typeof t.length}function q(t){return!(!t||!t[Fr])}function M(){return en||(en=new Gr([]))}function D(t){var e=Array.isArray(t)?new Gr(t).fromEntrySeq():S(t)?new tn(t).fromEntrySeq():w(t)?new $r(t).fromEntrySeq():"object"==typeof t?new Zr(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function O(t){var e=x(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function E(t){var e=x(t)||"object"==typeof t&&new Zr(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t); <ide> return e}function x(t){return b(t)?new Gr(t):S(t)?new tn(t):w(t)?new $r(t):void 0}function k(t,e,r,n){var i=t._cache;if(i){for(var u=i.length-1,o=0;u>=o;o++){var s=i[r?u-o:o];if(e(s[1],n?s[0]:o,t)===!1)return o+1}return o}return t.__iterateUncached(e,r)}function A(t,e,r,n){var i=t._cache;if(i){var u=i.length-1,o=0;return new Wr(function(){var t=i[r?u-o:o];return o++>u?g():m(e,n?t[0]:o-1,t[1])})}return t.__iteratorUncached(e,r)}function C(t,e){return t===e||t!==t&&e!==e?!0:t&&e?("function"==typeof t.valueOf&&"function"==typeof e.valueOf&&(t=t.valueOf(),e=e.valueOf()),"function"==typeof t.equals&&"function"==typeof e.equals?t.equals(e):t===e||t!==t&&e!==e):!1}function j(t,e){return e?K(e,t,"",{"":t}):R(t)}function K(t,e,r,n){return Array.isArray(e)?t.call(n,r,Vr(e).map(function(r,n){return K(t,r,n,e)})):U(e)?t.call(n,r,Hr(e).map(function(r,n){return K(t,r,n,e)})):e}function R(t){return Array.isArray(t)?Vr(t).map(R).toList():U(t)?Hr(t).map(R).toMap():t}function U(t){return t&&t.constructor===Object}function L(t){return t>>>1&1073741824|3221225471&t}function T(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){for(var r=0|t;t>4294967295;)t/=4294967295,r^=t;return L(r)}return"string"===e?t.length>pn?B(t):W(t):"function"==typeof t.hashCode?t.hashCode():P(t)}function B(t){var e=mn[t];return void 0===e&&(e=W(t),yn===dn&&(yn=0,mn={}),yn++,mn[t]=e),e}function W(t){for(var e=0,r=0;t.length>r;r++)e=31*e+t.charCodeAt(r)|0;return L(e)}function P(t){var e=_n&&_n.get(t);if(e)return e;if(e=t[vn])return e;if(!fn){if(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[vn])return e;if(e=J(t))return e}if(Object.isExtensible&&!Object.isExtensible(t))throw Error("Non-extensible objects are not allowed as keys.");if(e=++ln,1073741824&ln&&(ln=0),_n)_n.set(t,e);else if(fn)Object.defineProperty(t,vn,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments) <ide> },t.propertyIsEnumerable[vn]=e;else{if(!t.nodeType)throw Error("Unable to set a non-enumerable property on object.");t[vn]=e}return e}function J(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function H(t,e){if(!t)throw Error(e)}function N(t){H(1/0!==t,"Cannot perform this action with an infinite size.")}function V(t){var e=_e(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.contains(e)},e.contains=function(e){return t.has(e)},e.cacheResult=le,e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e.__iteratorUncached=function(e,r){if(e===Ur){var n=t.__iterator(e,r);return new Wr(function(){var t=n.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===Rr?Kr:Rr,r)},e}function Y(t,e,r){var n=_e(t);return n.size=t.size,n.has=function(e){return t.has(e)},n.get=function(n,i){var u=t.get(n,br);return u===br?i:e.call(r,u,n,t)},n.__iterateUncached=function(n,i){var u=this;return t.__iterate(function(t,i,o){return n(e.call(r,t,i,o),i,u)!==!1},i)},n.__iteratorUncached=function(n,i){var u=t.__iterator(Ur,i);return new Wr(function(){var i=u.next();if(i.done)return i;var o=i.value,s=o[0];return m(n,s,e.call(r,o[1],s,t),i)})},n}function Q(t,e){var r=_e(t);return r._iter=t,r.size=t.size,r.reverse=function(){return t},t.flip&&(r.flip=function(){var e=V(t);return e.reverse=function(){return t.flip()},e}),r.get=function(r,n){return t.get(e?r:-1-r,n)},r.has=function(r){return t.has(e?r:-1-r)},r.contains=function(e){return t.contains(e)},r.cacheResult=le,r.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},r.__iterator=function(e,r){return t.__iterator(e,!r)},r}function X(t,e,r,n){var i=_e(t);return n&&(i.has=function(n){var i=t.get(n,br);return i!==br&&!!e.call(r,i,n,t)},i.get=function(n,i){var u=t.get(n,br); <ide> return u!==br&&e.call(r,u,n,t)?u:i}),i.__iterateUncached=function(i,u){var o=this,s=0;return t.__iterate(function(t,u,a){return e.call(r,t,u,a)?(s++,i(t,n?u:s-1,o)):void 0},u),s},i.__iteratorUncached=function(i,u){var o=t.__iterator(Ur,u),s=0;return new Wr(function(){for(;;){var u=o.next();if(u.done)return u;var a=u.value,h=a[0],c=a[1];if(e.call(r,c,h,t))return m(i,n?h:s++,c,u)}})},i}function F(t,e,r){var n=zn().asMutable();return t.__iterate(function(i,u){n.update(e.call(r,i,u,t),0,function(t){return t+1})}),n.asImmutable()}function G(t,e,r){var n=v(t),i=zn().asMutable();t.__iterate(function(u,o){i.update(e.call(r,u,o,t),function(t){return t=t||[],t.push(n?[o,u]:u),t})});var u=fe(t);return i.map(function(e){return ae(t,u(e))})}function Z(t,e,r,n){var i=t.size;if(h(e,r,i))return t;var u=c(e,i),o=f(r,i);if(u!==u||o!==o)return Z(t.toSeq().cacheResult(),e,r,n);var a=o-u;0>a&&(a=0);var _=_e(t);return _.size=0===a?a:t.size&&a||void 0,!n&&q(t)&&a>=0&&(_.get=function(e,r){return e=s(this,e),e>=0&&a>e?t.get(e+u,r):r}),_.__iterateUncached=function(e,r){var i=this;if(0===a)return 0;if(r)return this.cacheResult().__iterate(e,r);var o=0,s=!0,h=0;return t.__iterate(function(t,r){return s&&(s=o++<u)?void 0:(h++,e(t,n?r:h-1,i)!==!1&&h!==a)}),h},_.__iteratorUncached=function(e,r){if(a&&r)return this.cacheResult().__iterator(e,r);var i=a&&t.__iterator(e,r),o=0,s=0;return new Wr(function(){for(;o++!==u;)i.next();if(++s>a)return g();var t=i.next();return n||e===Rr?t:e===Kr?m(e,s-1,void 0,t):m(e,s-1,t.value[1],t)})},_}function $(t,e,r){var n=_e(t);return n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var o=0;return t.__iterate(function(t,i,s){return e.call(r,t,i,s)&&++o&&n(t,i,u)}),o},n.__iteratorUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterator(n,i);var o=t.__iterator(Ur,i),s=!0;return new Wr(function(){if(!s)return g();var t=o.next();if(t.done)return t;var i=t.value,a=i[0],h=i[1];return e.call(r,h,a,u)?n===Ur?t:m(n,a,h,t):(s=!1,g())})},n}function te(t,e,r,n){var i=_e(t); <ide> return i.__iterateUncached=function(i,u){var o=this;if(u)return this.cacheResult().__iterate(i,u);var s=!0,a=0;return t.__iterate(function(t,u,h){return s&&(s=e.call(r,t,u,h))?void 0:(a++,i(t,n?u:a-1,o))}),a},i.__iteratorUncached=function(i,u){var o=this;if(u)return this.cacheResult().__iterator(i,u);var s=t.__iterator(Ur,u),a=!0,h=0;return new Wr(function(){var t,u,c;do{if(t=s.next(),t.done)return n||i===Rr?t:i===Kr?m(i,h++,void 0,t):m(i,h++,t.value[1],t);var f=t.value;u=f[0],c=f[1],a&&(a=e.call(r,c,u,o))}while(a);return i===Ur?t:m(i,u,c,t)})},i}function ee(t,e){var r=v(t),n=[t].concat(e).map(function(t){return l(t)?r&&(t=Or(t)):t=r?D(t):O(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===n.length)return t;if(1===n.length){var i=n[0];if(i===t||r&&v(i)||p(t)&&p(i))return i}var u=new Gr(n);return r?u=u.toKeyedSeq():p(t)||(u=u.toSetSeq()),u=u.flatten(!0),u.size=n.reduce(function(t,e){if(void 0!==t){var r=e.size;if(void 0!==r)return t+r}},0),u}function re(t,e,r){var n=_e(t);return n.__iterateUncached=function(n,i){function u(t,a){var h=this;t.__iterate(function(t,i){return(!e||e>a)&&l(t)?u(t,a+1):n(t,r?i:o++,h)===!1&&(s=!0),!s},i)}var o=0,s=!1;return u(t,0),o},n.__iteratorUncached=function(n,i){var u=t.__iterator(n,i),o=[],s=0;return new Wr(function(){for(;u;){var t=u.next();if(t.done===!1){var a=t.value;if(n===Ur&&(a=a[1]),e&&!(e>o.length)||!l(a))return r?t:m(n,s++,a,t);o.push(u),u=a.__iterator(n,i)}else u=o.pop()}return g()})},n}function ne(t,e,r){var n=fe(t);return t.toSeq().map(function(i,u){return n(e.call(r,i,u,t))}).flatten(!0)}function ie(t,e){var r=_e(t);return r.size=t.size&&2*t.size-1,r.__iterateUncached=function(r,n){var i=this,u=0;return t.__iterate(function(t){return(!u||r(e,u++,i)!==!1)&&r(t,u++,i)!==!1},n),u},r.__iteratorUncached=function(r,n){var i,u=t.__iterator(Rr,n),o=0;return new Wr(function(){return(!i||o%2)&&(i=u.next(),i.done)?i:o%2?m(r,o++,e):m(r,o++,i.value,i)})},r}function ue(t,e,r){e||(e=ve);var n=v(t),i=0,u=t.toSeq().map(function(e,n){return[n,e,i++,r?r(e,n,t):e]}).toArray(); <del>return u.sort(function(t,r){return e(t[3],r[3])||t[2]-r[2]}).forEach(n?function(t,e){u[e].length=2}:function(t,e){u[e]=t[1]}),n?Hr(u):p(t)?Vr(u):Qr(u)}function oe(t,e,r){if(e||(e=ve),r){var n=t.toSeq().map(function(e,n){return[e,r(e,n,t)]}).reduce(function(t,r){return se(e,t[1],r[1])?r:t});return n&&n[0]}return t.reduce(function(t,r){return se(e,t,r)?r:t})}function se(t,e,r){var n=t(r,e);return 0===n&&r!==e&&(void 0===r||null===r||r!==r)||n>0}function ae(t,e){return q(t)?e:t.constructor(e)}function he(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function ce(t){return N(t.size),o(t)}function fe(t){return v(t)?Or:p(t)?Er:xr}function _e(t){return Object.create((v(t)?Hr:p(t)?Vr:Qr).prototype)}function le(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Pr.prototype.cacheResult.call(this)}function ve(t,e){return t>e?1:e>t?-1:0}function pe(t){var e=I(t);if(!e){if(!b(t))throw new TypeError("Expected iterable or array-like: "+t);e=I(Dr(t))}return e}function de(t){return!(!t||!t[bn])}function ye(t,e){return m(t,e[0],e[1])}function me(t,e){return{node:t,index:0,__prev:e}}function ge(t,e,r,n){var i=Object.create(qn);return i.size=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function we(){return Un||(Un=ge(0))}function Se(e,r,n){var i,u;if(e._root){var o=t(qr),s=t(Mr);if(i=Ie(e._root,e.__ownerID,0,void 0,r,n,o,s),!s.value)return e;u=e.size+(o.value?n===br?-1:1:0)}else{if(n===br)return e;u=1,i=new Mn(e.__ownerID,[[r,n]])}return e.__ownerID?(e.size=u,e._root=i,e.__hash=void 0,e.__altered=!0,e):i?ge(u,i):we()}function Ie(t,r,n,i,u,o,s,a){return t?t.update(r,n,i,u,o,s,a):o===br?t:(e(a),e(s),new jn(r,i,[u,o]))}function ze(t){return t.constructor===jn||t.constructor===An}function be(t,e,r,n,i){if(t.keyHash===n)return new An(e,n,[t.entry,i]);var u,o=(0===r?t.keyHash:t.keyHash>>>r)&zr,s=(0===r?n:n>>>r)&zr,a=o===s?[be(t,e,r+Sr,n,i)]:(u=new jn(e,n,i),s>o?[t,u]:[u,t]);return new On(e,1<<o|1<<s,a)}function qe(t,e,n,i){t||(t=new r);for(var u=new jn(t,T(n),[n,i]),o=0;e.length>o;o++){var s=e[o]; <add>return u.sort(function(t,r){return e(t[3],r[3])||t[2]-r[2]}).forEach(n?function(t,e){u[e].length=2}:function(t,e){u[e]=t[1]}),n?Hr(u):p(t)?Vr(u):Qr(u)}function oe(t,e,r){if(e||(e=ve),r){var n=t.toSeq().map(function(e,n){return[e,r(e,n,t)]}).reduce(function(t,r){return se(e,t[1],r[1])?r:t});return n&&n[0]}return t.reduce(function(t,r){return se(e,t,r)?r:t})}function se(t,e,r){var n=t(r,e);return 0===n&&r!==e&&(void 0===r||null===r||r!==r)||n>0}function ae(t,e){return q(t)?e:t.constructor(e)}function he(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function ce(t){return N(t.size),u(t)}function fe(t){return v(t)?Or:p(t)?Er:xr}function _e(t){return Object.create((v(t)?Hr:p(t)?Vr:Qr).prototype)}function le(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Pr.prototype.cacheResult.call(this)}function ve(t,e){return t>e?1:e>t?-1:0}function pe(t){var e=I(t);if(!e){if(!b(t))throw new TypeError("Expected iterable or array-like: "+t);e=I(Dr(t))}return e}function de(t){return!(!t||!t[bn])}function ye(t,e){return m(t,e[0],e[1])}function me(t,e){return{node:t,index:0,__prev:e}}function ge(t,e,r,n){var i=Object.create(qn);return i.size=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function we(){return Un||(Un=ge(0))}function Se(e,r,n){var i,u;if(e._root){var o=t(qr),s=t(Mr);if(i=Ie(e._root,e.__ownerID,0,void 0,r,n,o,s),!s.value)return e;u=e.size+(o.value?n===br?-1:1:0)}else{if(n===br)return e;u=1,i=new Mn(e.__ownerID,[[r,n]])}return e.__ownerID?(e.size=u,e._root=i,e.__hash=void 0,e.__altered=!0,e):i?ge(u,i):we()}function Ie(t,r,n,i,u,o,s,a){return t?t.update(r,n,i,u,o,s,a):o===br?t:(e(a),e(s),new jn(r,i,[u,o]))}function ze(t){return t.constructor===jn||t.constructor===An}function be(t,e,r,n,i){if(t.keyHash===n)return new An(e,n,[t.entry,i]);var u,o=(0===r?t.keyHash:t.keyHash>>>r)&zr,s=(0===r?n:n>>>r)&zr,a=o===s?[be(t,e,r+Sr,n,i)]:(u=new jn(e,n,i),s>o?[t,u]:[u,t]);return new On(e,1<<o|1<<s,a)}function qe(t,e,n,i){t||(t=new r);for(var u=new jn(t,T(n),[n,i]),o=0;e.length>o;o++){var s=e[o]; <ide> u=u.update(t,0,void 0,s[0],s[1])}return u}function Me(t,e,r,n){for(var i=0,u=0,o=Array(r),s=0,a=1,h=e.length;h>s;s++,a<<=1){var c=e[s];void 0!==c&&s!==n&&(i|=a,o[u++]=c)}return new On(t,i,o)}function De(t,e,r,n,i){for(var u=0,o=Array(Ir),s=0;0!==r;s++,r>>>=1)o[s]=1&r?e[u++]:void 0;return o[n]=i,new xn(t,u+1,o)}function Oe(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i],o=Or(u);l(u)||(o=o.map(function(t){return j(t)})),n.push(o)}return xe(t,e,n)}function Ee(t){return function(e,r){return e&&e.mergeDeepWith&&l(r)?e.mergeDeepWith(t,r):t?t(e,r):r}}function xe(t,e,r){return r=r.filter(function(t){return 0!==t.size}),0===r.length?t:0===t.size&&1===r.length?t.constructor(r[0]):t.withMutations(function(t){for(var n=e?function(r,n){t.update(n,br,function(t){return t===br?r:e(t,r)})}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n)})}function ke(t,e,r,n){var i=t===br,u=e.next();if(u.done){var o=i?r:t,s=n(o);return s===o?t:s}H(i||t&&t.set,"invalid keyPath");var a=u.value,h=i?br:t.get(a,br),c=ke(h,e,r,n);return c===h?t:c===br?t.remove(a):(i?we():t).set(a,c)}function Ae(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function Ce(t,e,r,n){var u=n?t:i(t);return u[e]=r,u}function je(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),o=0,s=0;i>s;s++)s===e?(u[s]=r,o=-1):u[s]=t[s+o];return u}function Ke(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,o=0;n>o;o++)o===e&&(u=1),i[o]=t[o+u];return i}function Re(t){return!(!t||!t[Pn])}function Ue(t,e){function r(t,e,r){return 0===e?n(t,r):i(t,e,r)}function n(t,r){var n=r===s?a&&a.array:t&&t.array,i=r>u?0:u-r,h=o-r;return h>Ir&&(h=Ir),function(){if(i===h)return Yn;var t=e?--h:i++;return n&&n[t]}}function i(t,n,i){var s,a=t&&t.array,h=i>u?0:u-i>>n,c=(o-i>>n)+1;return c>Ir&&(c=Ir),function(){for(;;){if(s){var t=s();if(t!==Yn)return t;s=null}if(h===c)return Yn;var u=e?--c:h++;s=r(a&&a[u],n-Sr,i+(u<<n))}}}var u=t._origin,o=t._capacity,s=Ve(o),a=t._tail;return r(t._root,t._level,0) <ide> }function Le(t,e,r,n,i,u,o){var s=Object.create(Jn);return s.size=e-t,s._origin=t,s._capacity=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s.__hash=o,s.__altered=!1,s}function Te(){return Vn||(Vn=Le(0,0,Sr))}function Be(e,r,n){if(r=s(e,r),r>=e.size||0>r)return e.withMutations(function(t){0>r?He(t,r).set(0,n):He(t,0,r+1).set(r,n)});r+=e._origin;var i=e._tail,u=e._root,o=t(Mr);return r>=Ve(e._capacity)?i=We(i,e.__ownerID,0,r,n,o):u=We(u,e.__ownerID,e._level,r,n,o),o.value?e.__ownerID?(e._root=u,e._tail=i,e.__hash=void 0,e.__altered=!0,e):Le(e._origin,e._capacity,e._level,u,i):e}function We(t,r,n,i,u,o){var s=i>>>n&zr,a=t&&t.array.length>s;if(!a&&void 0===u)return t;var h;if(n>0){var c=t&&t.array[s],f=We(c,r,n-Sr,i,u,o);return f===c?t:(h=Pe(t,r),h.array[s]=f,h)}return a&&t.array[s]===u?t:(e(o),h=Pe(t,r),void 0===u&&s===h.array.length-1?h.array.pop():h.array[s]=u,h)}function Pe(t,e){return e&&t&&e===t.ownerID?t:new Hn(t?t.array.slice():[],e)}function Je(t,e){if(e>=Ve(t._capacity))return t._tail;if(1<<t._level+Sr>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&zr],n-=Sr;return r}}function He(t,e,n){var i=t.__ownerID||new r,u=t._origin,o=t._capacity,s=u+e,a=void 0===n?o:0>n?o+n:u+n;if(s===u&&a===o)return t;if(s>=a)return t.clear();for(var h=t._level,c=t._root,f=0;0>s+f;)c=new Hn(c&&c.array.length?[void 0,c]:[],i),h+=Sr,f+=1<<h;f&&(s+=f,u+=f,a+=f,o+=f);for(var _=Ve(o),l=Ve(a);l>=1<<h+Sr;)c=new Hn(c&&c.array.length?[c]:[],i),h+=Sr;var v=t._tail,p=_>l?Je(t,a-1):l>_?new Hn([],i):v;if(v&&l>_&&o>s&&v.array.length){c=Pe(c,i);for(var d=c,y=h;y>Sr;y-=Sr){var m=_>>>y&zr;d=d.array[m]=Pe(d.array[m],i)}d.array[_>>>Sr&zr]=v}if(o>a&&(p=p&&p.removeAfter(i,0,a)),s>=l)s-=l,a-=l,h=Sr,c=null,p=p&&p.removeBefore(i,0,s);else if(s>u||_>l){for(f=0;c;){var g=s>>>h&zr;if(g!==l>>>h&zr)break;g&&(f+=(1<<h)*g),h-=Sr,c=c.array[g]}c&&s>u&&(c=c.removeBefore(i,h,s-f)),c&&_>l&&(c=c.removeAfter(i,h,l-f)),f&&(s-=f,a-=f)}return t.__ownerID?(t.size=a-s,t._origin=s,t._capacity=a,t._level=h,t._root=c,t._tail=p,t.__hash=void 0,t.__altered=!0,t):Le(s,a,h,c,p) <ide> }function Ne(t,e,r){for(var n=[],i=0,u=0;r.length>u;u++){var o=r[u],s=Er(o);s.size>i&&(i=s.size),l(o)||(s=s.map(function(t){return j(t)})),n.push(s)}return i>t.size&&(t=t.setSize(i)),xe(t,e,n)}function Ve(t){return Ir>t?0:t-1>>>Sr<<Sr}function Ye(t){return de(t)&&y(t)}function Qe(t,e,r,n){var i=Object.create(Qn.prototype);return i.size=t?t.size:0,i._map=t,i._list=e,i.__ownerID=r,i.__hash=n,i}function Xe(){return Xn||(Xn=Qe(we(),Te()))}function Fe(t,e,r){var n,i,u=t._map,o=t._list,s=u.get(e),a=void 0!==s;if(r===br){if(!a)return t;o.size>=Ir&&o.size>=2*u.size?(i=o.filter(function(t,e){return void 0!==t&&s!==e}),n=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(n.__ownerID=i.__ownerID=t.__ownerID)):(n=u.remove(e),i=s===o.size-1?o.pop():o.set(s,void 0))}else if(a){if(r===o.get(s)[1])return t;n=u,i=o.set(s,[e,r])}else n=u.set(e,o.size),i=o.set(o.size,[e,r]);return t.__ownerID?(t.size=n.size,t._map=n,t._list=i,t.__hash=void 0,t):Qe(n,i)}function Ge(t){return!(!t||!t[Zn])}function Ze(t,e,r,n){var i=Object.create($n);return i.size=t,i._head=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function $e(){return ti||(ti=Ze(0))}function tr(t){return!(!t||!t[ri])}function er(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function rr(t,e){var r=Object.create(ni);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function nr(){return ii||(ii=rr(we()))}function ir(t){return tr(t)&&y(t)}function ur(t,e){var r=Object.create(oi);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function or(){return si||(si=ur(Xe()))}function sr(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function ar(t){return t._name||t.constructor.name}function hr(t,e){if(t===e)return!0;if(!l(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||v(t)!==v(e)||p(t)!==p(e)||y(t)!==y(e))return!1;if(0===t.size&&0===e.size)return!0;var r=!d(t);if(y(t)){var n=t.entries();return e.every(function(t,e){var i=n.next().value; <del>return i&&C(i[1],t)&&(r||C(i[0],e))})&&n.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)t.cacheResult();else{i=!0;var u=t;t=e,e=u}var o=!0,s=e.__iterate(function(e,n){return(r?t.has(e):i?C(e,t.get(n,br)):C(t.get(n,br),e))?void 0:(o=!1,!1)});return o&&t.size===s}function cr(t,e){var r=function(r){t.prototype[r]=e[r]};return Object.keys(e).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(r),t}function fr(t,e){return e}function _r(t,e){return[e,t]}function lr(t){return function(){return!t.apply(this,arguments)}}function vr(t){return function(){return-t.apply(this,arguments)}}function pr(t){return"string"==typeof t?JSON.stringify(t):t}function dr(t,e){return e>t?1:t>e?-1:0}function yr(t){if(1/0===t.size)return 0;var e=y(t),r=v(t),n=e?1:0,i=t.__iterate(r?e?function(t,e){n=31*n+gr(T(t),T(e))|0}:function(t,e){n=n+gr(T(t),T(e))|0}:e?function(t){n=31*n+T(t)|0}:function(t){n=n+T(t)|0});return mr(i,n)}function mr(t,e){return e=cn(e,3432918353),e=cn(e<<15|e>>>-15,461845907),e=cn(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=cn(e^e>>>16,2246822507),e=cn(e^e>>>13,3266489909),e=L(e^e>>>16)}function gr(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var wr="delete",Sr=5,Ir=1<<Sr,zr=Ir-1,br={},qr={value:!1},Mr={value:!1},Dr=function(t){return l(t)?t:Pr(t)};u.createClass(Dr,{},{});var Or=function(t){return v(t)?t:Hr(t)};u.createClass(Or,{},{},Dr);var Er=function(t){return p(t)?t:Vr(t)};u.createClass(Er,{},{},Dr);var xr=function(t){return l(t)&&!d(t)?t:Qr(t)};u.createClass(xr,{},{},Dr),Dr.isIterable=l,Dr.isKeyed=v,Dr.isIndexed=p,Dr.isAssociative=d,Dr.isOrdered=y,Dr.Keyed=Or,Dr.Indexed=Er,Dr.Set=xr;var kr="",Ar="",Cr="",jr="",Kr=0,Rr=1,Ur=2,Lr="function"==typeof Symbol&&Symbol.iterator,Tr="@@iterator",Br=Lr||Tr,Wr=function(t){this.next=t};u.createClass(Wr,{toString:function(){return"[Iterator]"}},{}),Wr.KEYS=Kr,Wr.VALUES=Rr,Wr.ENTRIES=Ur,Wr.prototype.inspect=Wr.prototype.toSource=function(){return""+this <del>},Wr.prototype[Br]=function(){return this};var Pr=function(t){return null===t||void 0===t?M():l(t)?t.toSeq():E(t)},Jr=Pr;u.createClass(Pr,{toSeq:function(){return this},toString:function(){return this.__toString("Seq {","}")},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},__iterate:function(t,e){return k(this,t,e,!0)},__iterator:function(t,e){return A(this,t,e,!0)}},{of:function(){return Jr(arguments)}},Dr);var Hr=function(t){return null===t||void 0===t?M().toKeyedSeq():l(t)?v(t)?t.toSeq():t.fromEntrySeq():D(t)},Nr=Hr;u.createClass(Hr,{toKeyedSeq:function(){return this},toSeq:function(){return this}},{of:function(){return Nr(arguments)}},Pr);var Vr=function(t){return null===t||void 0===t?M():l(t)?v(t)?t.entrySeq():t.toIndexedSeq():O(t)},Yr=Vr;u.createClass(Vr,{toIndexedSeq:function(){return this},toString:function(){return this.__toString("Seq [","]")},__iterate:function(t,e){return k(this,t,e,!1)},__iterator:function(t,e){return A(this,t,e,!1)}},{of:function(){return Yr(arguments)}},Pr);var Qr=function(t){return(null===t||void 0===t?M():l(t)?v(t)?t.entrySeq():t:O(t)).toSetSeq()},Xr=Qr;u.createClass(Qr,{toSetSeq:function(){return this}},{of:function(){return Xr(arguments)}},Pr),Pr.isSeq=q,Pr.Keyed=Hr,Pr.Set=Qr,Pr.Indexed=Vr;var Fr="";Pr.prototype[Fr]=!0;var Gr=function(t){this._array=t,this.size=t.length};u.createClass(Gr,{get:function(t,e){return this.has(t)?this._array[s(this,t)]:e},__iterate:function(t,e){for(var r=this._array,n=r.length-1,i=0;n>=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},__iterator:function(t,e){var r=this._array,n=r.length-1,i=0;return new Wr(function(){return i>n?g():m(t,i,r[e?n-i++:i++])})}},{},Vr);var Zr=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length};u.createClass(Zr,{get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var o=n[e?i-u:u]; <del>if(t(r[o],o,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this._object,n=this._keys,i=n.length-1,u=0;return new Wr(function(){var o=n[e?i-u:u];return u++>i?g():m(t,o,r[o])})}},{},Hr),Zr.prototype[jr]=!0;var $r=function(t){this._iterable=t,this.size=t.length||t.size};u.createClass($r,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=I(r),i=0;if(S(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=I(r);if(!S(n))return new Wr(g);var i=0;return new Wr(function(){var e=n.next();return e.done?e:m(t,i++,e.value)})}},{},Vr);var tn=function(t){this._iterator=t,this._iteratorCache=[]};u.createClass(tn,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;for(var u;!(u=r.next()).done;){var o=u.value;if(n[i]=o,t(o,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new Wr(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return m(t,i,n[i++])})}},{},Vr);var en,rn=function(){throw TypeError("Abstract")};u.createClass(rn,{},{},Dr);var nn=function(){u.defaultSuperCall(this,un.prototype,arguments)},un=nn;u.createClass(nn,{},{},rn);var on=function(){u.defaultSuperCall(this,sn.prototype,arguments)},sn=on;u.createClass(on,{},{},rn);var an=function(){u.defaultSuperCall(this,hn.prototype,arguments)},hn=an;u.createClass(an,{},{},rn),rn.Keyed=nn,rn.Indexed=on,rn.Set=an;var cn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){t=0|t,e=0|e;var r=65535&t,n=65535&e;return r*n+((t>>>16)*n+r*(e>>>16)<<16>>>0)|0},fn=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),_n="function"==typeof WeakMap&&new WeakMap,ln=0,vn="__immutablehash__";"function"==typeof Symbol&&(vn=Symbol(vn)); <del>var pn=16,dn=255,yn=0,mn={},gn=function(t,e){this._iter=t,this._useKeys=e,this.size=t.size};u.createClass(gn,{get:function(t,e){return this._iter.get(t,e)},has:function(t){return this._iter.has(t)},valueSeq:function(){return this._iter.valueSeq()},reverse:function(){var t=this,e=Q(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},map:function(t,e){var r=this,n=Y(this,t,e);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(t,e)}),n},__iterate:function(t,e){var r,n=this;return this._iter.__iterate(this._useKeys?function(e,r){return t(e,r,n)}:(r=e?ce(this):0,function(i){return t(i,e?--r:r++,n)}),e)},__iterator:function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var r=this._iter.__iterator(Rr,e),n=e?ce(this):0;return new Wr(function(){var i=r.next();return i.done?i:m(t,e?--n:n++,i.value,i)})}},{},Hr),gn.prototype[jr]=!0;var wn=function(t){this._iter=t,this.size=t.size};u.createClass(wn,{contains:function(t){return this._iter.contains(t)},__iterate:function(t,e){var r=this,n=0;return this._iter.__iterate(function(e){return t(e,n++,r)},e)},__iterator:function(t,e){var r=this._iter.__iterator(Rr,e),n=0;return new Wr(function(){var e=r.next();return e.done?e:m(t,n++,e.value,e)})}},{},Vr);var Sn=function(t){this._iter=t,this.size=t.size};u.createClass(Sn,{has:function(t){return this._iter.contains(t)},__iterate:function(t,e){var r=this;return this._iter.__iterate(function(e){return t(e,e,r)},e)},__iterator:function(t,e){var r=this._iter.__iterator(Rr,e);return new Wr(function(){var e=r.next();return e.done?e:m(t,e.value,e.value,e)})}},{},Qr);var In=function(t){this._iter=t,this.size=t.size};u.createClass(In,{entrySeq:function(){return this._iter.toSeq()},__iterate:function(t,e){var r=this;return this._iter.__iterate(function(e){return e?(he(e),t(e[1],e[0],r)):void 0},e)},__iterator:function(t,e){var r=this._iter.__iterator(Rr,e);return new Wr(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n)return he(n),t===Ur?e:m(t,n[0],n[1],e) <del>}})}},{},Hr),wn.prototype.cacheResult=gn.prototype.cacheResult=Sn.prototype.cacheResult=In.prototype.cacheResult=le;var zn=function(t){return null===t||void 0===t?we():de(t)?t:we().withMutations(function(e){var r=Or(t);N(r.size),r.forEach(function(t,r){return e.set(r,t)})})};u.createClass(zn,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,void 0,t,e):e},set:function(t,e){return Se(this,t,e)},setIn:function(t,e){return this.updateIn(t,br,function(){return e})},remove:function(t){return Se(this,t,br)},deleteIn:function(t){return this.updateIn(t,function(){return br})},update:function(t,e,r){return 1===arguments.length?t(this):this.updateIn([t],e,r)},updateIn:function(t,e,r){r||(r=e,e=void 0);var n=ke(this,pe(t),e,r);return n===br?void 0:n},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):we()},merge:function(){return Oe(this,void 0,arguments)},mergeWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Oe(this,t,e)},mergeIn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return this.updateIn(t,we(),function(t){return t.merge.apply(t,e)})},mergeDeep:function(){return Oe(this,Ee(void 0),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Oe(this,Ee(t),e)},mergeDeepIn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return this.updateIn(t,we(),function(t){return t.mergeDeep.apply(t,e)})},sort:function(t){return Qn(ue(this,t))},sortBy:function(t,e){return Qn(ue(this,e,t))},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new r)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new Rn(this,t,e)},__iterate:function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r) <del>},e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?ge(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{},nn),zn.isMap=de;var bn="",qn=zn.prototype;qn[bn]=!0,qn[wr]=qn.remove,qn.removeIn=qn.deleteIn;var Mn=function(t,e){this.ownerID=t,this.entries=e},Dn=Mn;u.createClass(Mn,{get:function(t,e,r,n){for(var i=this.entries,u=0,o=i.length;o>u;u++)if(C(r,i[u][0]))return i[u][1];return n},update:function(t,r,n,u,o,s,a){for(var h=o===br,c=this.entries,f=0,_=c.length;_>f&&!C(u,c[f][0]);f++);var l=_>f;if(l?c[f][1]===o:h)return this;if(e(a),(h||!l)&&e(s),!h||1!==c.length){if(!l&&!h&&c.length>=Ln)return qe(t,c,u,o);var v=t&&t===this.ownerID,p=v?c:i(c);return l?h?f===_-1?p.pop():p[f]=p.pop():p[f]=[u,o]:p.push([u,o]),v?(this.entries=p,this):new Dn(t,p)}}},{});var On=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},En=On;u.createClass(On,{get:function(t,e,r,n){void 0===e&&(e=T(r));var i=1<<((0===t?e:e>>>t)&zr),u=this.bitmap;return 0===(u&i)?n:this.nodes[Ae(u&i-1)].get(t+Sr,e,r,n)},update:function(t,e,r,n,i,u,o){void 0===r&&(r=T(n));var s=(0===e?r:r>>>e)&zr,a=1<<s,h=this.bitmap,c=0!==(h&a);if(!c&&i===br)return this;var f=Ae(h&a-1),_=this.nodes,l=c?_[f]:void 0,v=Ie(l,t,e+Sr,r,n,i,u,o);if(v===l)return this;if(!c&&v&&_.length>=Tn)return De(t,_,h,s,v);if(c&&!v&&2===_.length&&ze(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&ze(v))return v;var p=t&&t===this.ownerID,d=c?v?h:h^a:h|a,y=c?v?Ce(_,f,v,p):Ke(_,f,p):je(_,f,v,p);return p?(this.bitmap=d,this.nodes=y,this):new En(t,d,y)}},{});var xn=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},kn=xn;u.createClass(xn,{get:function(t,e,r,n){void 0===e&&(e=T(r));var i=(0===t?e:e>>>t)&zr,u=this.nodes[i];return u?u.get(t+Sr,e,r,n):n},update:function(t,e,r,n,i,u,o){void 0===r&&(r=T(n));var s=(0===e?r:r>>>e)&zr,a=i===br,h=this.nodes,c=h[s];if(a&&!c)return this;var f=Ie(c,t,e+Sr,r,n,i,u,o);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,Bn>_))return Me(t,h,_,s)}else _++;var l=t&&t===this.ownerID,v=Ce(h,s,f,l); <del>return l?(this.count=_,this.nodes=v,this):new kn(t,_,v)}},{});var An=function(t,e,r){this.ownerID=t,this.keyHash=e,this.entries=r},Cn=An;u.createClass(An,{get:function(t,e,r,n){for(var i=this.entries,u=0,o=i.length;o>u;u++)if(C(r,i[u][0]))return i[u][1];return n},update:function(t,r,n,u,o,s,a){void 0===n&&(n=T(u));var h=o===br;if(n!==this.keyHash)return h?this:(e(a),e(s),be(this,t,r,n,[u,o]));for(var c=this.entries,f=0,_=c.length;_>f&&!C(u,c[f][0]);f++);var l=_>f;if(l?c[f][1]===o:h)return this;if(e(a),(h||!l)&&e(s),h&&2===_)return new jn(t,this.keyHash,c[1^f]);var v=t&&t===this.ownerID,p=v?c:i(c);return l?h?f===_-1?p.pop():p[f]=p.pop():p[f]=[u,o]:p.push([u,o]),v?(this.entries=p,this):new Cn(t,this.keyHash,p)}},{});var jn=function(t,e,r){this.ownerID=t,this.keyHash=e,this.entry=r},Kn=jn;u.createClass(jn,{get:function(t,e,r,n){return C(r,this.entry[0])?this.entry[1]:n},update:function(t,r,n,i,u,o,s){var a=u===br,h=C(i,this.entry[0]);return(h?u===this.entry[1]:a)?this:(e(s),a?void e(o):h?t&&t===this.ownerID?(this.entry[1]=u,this):new Kn(t,this.keyHash,[i,u]):(e(o),be(this,t,r,T(i),[i,u])))}},{}),Mn.prototype.iterate=An.prototype.iterate=function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1},On.prototype.iterate=xn.prototype.iterate=function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];if(u&&u.iterate(t,e)===!1)return!1}},jn.prototype.iterate=function(t){return t(this.entry)};var Rn=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&me(t._root)};u.createClass(Rn,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return ye(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return ye(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return ye(t,u.entry);e=this._stack=me(u,e)}continue}e=this._stack=this._stack.__prev}return g()}},{},Wr);var Un,Ln=Ir/4,Tn=Ir/2,Bn=Ir/4,Wn=function(t){var e=Te();if(null===t||void 0===t)return e; <del>if(Re(t))return t;var r=Er(t),n=r.size;return 0===n?e:(N(n),n>0&&Ir>n?Le(0,n,Sr,null,new Hn(r.toArray())):e.withMutations(function(t){t.setSize(n),r.forEach(function(e,r){return t.set(r,e)})}))};u.createClass(Wn,{toString:function(){return this.__toString("List [","]")},get:function(t,e){if(t=s(this,t),0>t||t>=this.size)return e;t+=this._origin;var r=Je(this,t);return r&&r.array[t&zr]},set:function(t,e){return Be(this,t,e)},remove:function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=Sr,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Te()},push:function(){var t=arguments,e=this.size;return this.withMutations(function(r){He(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return He(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){He(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return He(this,1)},merge:function(){return Ne(this,void 0,arguments)},mergeWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Ne(this,t,e)},mergeDeep:function(){return Ne(this,Ee(void 0),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Ne(this,Ee(t),e)},setSize:function(t){return He(this,0,t)},slice:function(t,e){var r=this.size;return h(t,e,r)?this:He(this,c(t,r),f(e,r))},__iterator:function(t,e){var r=0,n=Ue(this,e);return new Wr(function(){var e=n();return e===Yn?g():m(t,r++,e)})},__iterate:function(t,e){for(var r,n=0,i=Ue(this,e);(r=i())!==Yn&&t(r,n++,this)!==!1;);return n},__ensureOwner:function(t){return t===this.__ownerID?this:t?Le(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{of:function(){return this(arguments)}},on),Wn.isList=Re;var Pn="",Jn=Wn.prototype;Jn[Pn]=!0,Jn[wr]=Jn.remove,Jn.setIn=qn.setIn,Jn.deleteIn=Jn.removeIn=qn.removeIn,Jn.update=qn.update,Jn.updateIn=qn.updateIn,Jn.mergeIn=qn.mergeIn,Jn.mergeDeepIn=qn.mergeDeepIn,Jn.withMutations=qn.withMutations,Jn.asMutable=qn.asMutable,Jn.asImmutable=qn.asImmutable,Jn.wasAltered=qn.wasAltered; <del>var Hn=function(t,e){this.array=t,this.ownerID=e},Nn=Hn;u.createClass(Hn,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&zr;if(n>=this.array.length)return new Nn([],t);var i,u=0===n;if(e>0){var o=this.array[n];if(i=o&&o.removeBefore(t,e-Sr,r),i===o&&u)return this}if(u&&!i)return this;var s=Pe(this,t);if(!u)for(var a=0;n>a;a++)s.array[a]=void 0;return i&&(s.array[n]=i),s},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&zr;if(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var o=this.array[n];if(i=o&&o.removeAfter(t,e-Sr,r),i===o&&u)return this}if(u&&!i)return this;var s=Pe(this,t);return u||s.array.pop(),i&&(s.array[n]=i),s}},{});var Vn,Yn={},Qn=function(t){return null===t||void 0===t?Xe():Ye(t)?t:Xe().withMutations(function(e){var r=Or(t);N(r.size),r.forEach(function(t,r){return e.set(r,t)})})};u.createClass(Qn,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var r=this._map.get(t);return void 0!==r?this._list.get(r)[1]:e},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):Xe()},set:function(t,e){return Fe(this,t,e)},remove:function(t){return Fe(this,t,br)},wasAltered:function(){return this._map.wasAltered()||this._list.wasAltered()},__iterate:function(t,e){var r=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._list.__ensureOwner(t);return t?Qe(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=r,this)}},{of:function(){return this(arguments)}},zn),Qn.isOrderedMap=Ye,Qn.prototype[jr]=!0,Qn.prototype[wr]=Qn.prototype.remove;var Xn,Fn=function(t){return null===t||void 0===t?$e():Ge(t)?t:$e().unshiftAll(t)},Gn=Fn;u.createClass(Fn,{toString:function(){return this.__toString("Stack [","]")},get:function(t,e){for(var r=this._head;r&&t--;)r=r.next; <del>return r?r.value:e},peek:function(){return this._head&&this._head.value},push:function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,r=arguments.length-1;r>=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Ze(t,e)},pushAll:function(t){if(t=Er(t),0===t.size)return this;N(t.size);var e=this.size,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.size=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):Ze(e,r)},pop:function(){return this.slice(1)},unshift:function(){return this.push.apply(this,arguments)},unshiftAll:function(t){return this.pushAll(t)},shift:function(){return this.pop.apply(this,arguments)},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):$e()},slice:function(t,e){if(h(t,e,this.size))return this;var r=c(t,this.size),n=f(e,this.size);if(n!==this.size)return u.superCall(this,Gn.prototype,"slice",[t,e]);for(var i=this.size-r,o=this._head;r--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):Ze(i,o)},__ensureOwner:function(t){return t===this.__ownerID?this:t?Ze(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},__iterate:function(t,e){if(e)return this.toSeq().cacheResult.__iterate(t,e);for(var r=0,n=this._head;n&&t(n.value,r++,this)!==!1;)n=n.next;return r},__iterator:function(t,e){if(e)return this.toSeq().cacheResult().__iterator(t,e);var r=0,n=this._head;return new Wr(function(){if(n){var e=n.value;return n=n.next,m(t,r++,e)}return g()})}},{of:function(){return this(arguments)}},on),Fn.isStack=Ge;var Zn="",$n=Fn.prototype;$n[Zn]=!0,$n.withMutations=qn.withMutations,$n.asMutable=qn.asMutable,$n.asImmutable=qn.asImmutable,$n.wasAltered=qn.wasAltered;var ti,ei=function(t){return null===t||void 0===t?nr():tr(t)?t:nr().withMutations(function(e){var r=xr(t); <del>N(r.size),r.forEach(function(t){return e.add(t)})})};u.createClass(ei,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},add:function(t){return er(this,this._map.set(t,!0))},remove:function(t){return er(this,this._map.remove(t))},clear:function(){return er(this,this._map.clear())},union:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0===this.size&&1===t.length?this.constructor(t[0]):this.withMutations(function(e){for(var r=0;t.length>r;r++)xr(t[r]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return xr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.remove(r)})})},subtract:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return xr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.remove(r)})})},merge:function(){return this.union.apply(this,arguments)},mergeWith:function(){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return this.union.apply(this,t)},sort:function(t){return ui(ue(this,t))},sortBy:function(t,e){return ui(ue(this,e,t))},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var r=this;return this._map.__iterate(function(e,n){return t(n,n,r)},e)},__iterator:function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)}},{of:function(){return this(arguments)},fromKeys:function(t){return this(Or(t).keySeq())}},an),ei.isSet=tr;var ri="",ni=ei.prototype;ni[ri]=!0,ni[wr]=ni.remove,ni.mergeDeep=ni.merge,ni.mergeDeepWith=ni.mergeWith,ni.withMutations=qn.withMutations,ni.asMutable=qn.asMutable,ni.asImmutable=qn.asImmutable,ni.__empty=nr,ni.__make=rr; <del>var ii,ui=function(t){return null===t||void 0===t?or():ir(t)?t:or().withMutations(function(e){var r=xr(t);N(r.size),r.forEach(function(t){return e.add(t)})})};u.createClass(ui,{toString:function(){return this.__toString("OrderedSet {","}")}},{of:function(){return this(arguments)},fromKeys:function(t){return this(Or(t).keySeq())}},ei),ui.isOrderedSet=ir;var oi=ui.prototype;oi[jr]=!0,oi.__empty=or,oi.__make=ur;var si,ai=function(t,e){var r=function(t){return this instanceof r?void(this._map=zn(t)):new r(t)},n=Object.keys(t),i=r.prototype=Object.create(hi);i.constructor=r,e&&(i._name=e),i._defaultValues=t,i._keys=n,i.size=n.length;try{n.forEach(function(t){Object.defineProperty(r.prototype,t,{get:function(){return this.get(t)},set:function(e){H(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})})}catch(u){}return r};u.createClass(ai,{toString:function(){return this.__toString(ar(this)+" {","}")},has:function(t){return this._defaultValues.hasOwnProperty(t)},get:function(t,e){if(!this.has(t))return e;var r=this._defaultValues[t];return this._map?this._map.get(t,r):r},clear:function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=Object.getPrototypeOf(this).constructor;return t._empty||(t._empty=sr(this,we()))},set:function(t,e){if(!this.has(t))throw Error('Cannot set unknown key "'+t+'" on '+ar(this));var r=this._map&&this._map.set(t,e);return this.__ownerID||r===this._map?this:sr(this,r)},remove:function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:sr(this,e)},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){var r=this;return Or(this._defaultValues).map(function(t,e){return r.get(e)}).__iterator(t,e)},__iterate:function(t,e){var r=this;return Or(this._defaultValues).map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?sr(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},nn);var hi=ai.prototype; <del>hi[wr]=hi.remove,hi.deleteIn=hi.removeIn=qn.removeIn,hi.merge=qn.merge,hi.mergeWith=qn.mergeWith,hi.mergeIn=qn.mergeIn,hi.mergeDeep=qn.mergeDeep,hi.mergeDeepWith=qn.mergeDeepWith,hi.mergeDeepIn=qn.mergeDeepIn,hi.setIn=qn.setIn,hi.update=qn.update,hi.updateIn=qn.updateIn,hi.withMutations=qn.withMutations,hi.asMutable=qn.asMutable,hi.asImmutable=qn.asImmutable;var ci=function(t,e,r){if(!(this instanceof fi))return new fi(t,e,r);if(H(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),r=void 0===r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,this.size=Math.max(0,Math.ceil((e-t)/r-1)+1),0===this.size){if(_i)return _i;_i=this}},fi=ci;u.createClass(ci,{toString:function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},get:function(t,e){return this.has(t)?this._start+s(this,t)*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.size>e&&e===Math.floor(e)},slice:function(t,e){return h(t,e,this.size)?this:(t=c(t,this.size),e=f(e,this.size),t>=e?new fi(0,0):new fi(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.size>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},__iterate:function(t,e){for(var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,u=0;r>=u;u++){if(t(i,u,this)===!1)return u+1;i+=e?-n:n}return u},__iterator:function(t,e){var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,u=0;return new Wr(function(){var o=i;return i+=e?-n:n,u>r?g():m(t,u++,o)})},equals:function(t){return t instanceof fi?this._start===t._start&&this._end===t._end&&this._step===t._step:hr(this,t)}},{},Vr);var _i,li=function(t,e){if(!(this instanceof vi))return new vi(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(pi)return pi;pi=this}},vi=li;u.createClass(li,{toString:function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]" <add>return i&&C(i[1],t)&&(r||C(i[0],e))})&&n.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)t.cacheResult();else{i=!0;var u=t;t=e,e=u}var o=!0,s=e.__iterate(function(e,n){return(r?t.has(e):i?C(e,t.get(n,br)):C(t.get(n,br),e))?void 0:(o=!1,!1)});return o&&t.size===s}function cr(t,e){var r=function(r){t.prototype[r]=e[r]};return Object.keys(e).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(r),t}function fr(t,e){return e}function _r(t,e){return[e,t]}function lr(t){return function(){return!t.apply(this,arguments)}}function vr(t){return function(){return-t.apply(this,arguments)}}function pr(t){return"string"==typeof t?JSON.stringify(t):t}function dr(t,e){return e>t?1:t>e?-1:0}function yr(t){if(1/0===t.size)return 0;var e=y(t),r=v(t),n=e?1:0,i=t.__iterate(r?e?function(t,e){n=31*n+gr(T(t),T(e))|0}:function(t,e){n=n+gr(T(t),T(e))|0}:e?function(t){n=31*n+T(t)|0}:function(t){n=n+T(t)|0});return mr(i,n)}function mr(t,e){return e=cn(e,3432918353),e=cn(e<<15|e>>>-15,461845907),e=cn(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=cn(e^e>>>16,2246822507),e=cn(e^e>>>13,3266489909),e=L(e^e>>>16)}function gr(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var wr="delete",Sr=5,Ir=1<<Sr,zr=Ir-1,br={},qr={value:!1},Mr={value:!1},Dr=function(t){return l(t)?t:Pr(t)};o.createClass(Dr,{},{});var Or=function(t){return v(t)?t:Hr(t)};o.createClass(Or,{},{},Dr);var Er=function(t){return p(t)?t:Vr(t)};o.createClass(Er,{},{},Dr);var xr=function(t){return l(t)&&!d(t)?t:Qr(t)};o.createClass(xr,{},{},Dr),Dr.isIterable=l,Dr.isKeyed=v,Dr.isIndexed=p,Dr.isAssociative=d,Dr.isOrdered=y,Dr.Keyed=Or,Dr.Indexed=Er,Dr.Set=xr;var kr="",Ar="",Cr="",jr="",Kr=0,Rr=1,Ur=2,Lr="function"==typeof Symbol&&Symbol.iterator,Tr="@@iterator",Br=Lr||Tr,Wr=function(t){this.next=t};o.createClass(Wr,{toString:function(){return"[Iterator]"}},{}),Wr.KEYS=Kr,Wr.VALUES=Rr,Wr.ENTRIES=Ur,Wr.prototype.inspect=Wr.prototype.toSource=function(){return""+this <add>},Wr.prototype[Br]=function(){return this};var Pr=function(t){return null===t||void 0===t?M():l(t)?t.toSeq():E(t)},Jr=Pr;o.createClass(Pr,{toSeq:function(){return this},toString:function(){return this.__toString("Seq {","}")},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},__iterate:function(t,e){return k(this,t,e,!0)},__iterator:function(t,e){return A(this,t,e,!0)}},{of:function(){return Jr(arguments)}},Dr);var Hr=function(t){return null===t||void 0===t?M().toKeyedSeq():l(t)?v(t)?t.toSeq():t.fromEntrySeq():D(t)},Nr=Hr;o.createClass(Hr,{toKeyedSeq:function(){return this},toSeq:function(){return this}},{of:function(){return Nr(arguments)}},Pr);var Vr=function(t){return null===t||void 0===t?M():l(t)?v(t)?t.entrySeq():t.toIndexedSeq():O(t)},Yr=Vr;o.createClass(Vr,{toIndexedSeq:function(){return this},toString:function(){return this.__toString("Seq [","]")},__iterate:function(t,e){return k(this,t,e,!1)},__iterator:function(t,e){return A(this,t,e,!1)}},{of:function(){return Yr(arguments)}},Pr);var Qr=function(t){return(null===t||void 0===t?M():l(t)?v(t)?t.entrySeq():t:O(t)).toSetSeq()},Xr=Qr;o.createClass(Qr,{toSetSeq:function(){return this}},{of:function(){return Xr(arguments)}},Pr),Pr.isSeq=q,Pr.Keyed=Hr,Pr.Set=Qr,Pr.Indexed=Vr;var Fr="";Pr.prototype[Fr]=!0;var Gr=function(t){this._array=t,this.size=t.length};o.createClass(Gr,{get:function(t,e){return this.has(t)?this._array[s(this,t)]:e},__iterate:function(t,e){for(var r=this._array,n=r.length-1,i=0;n>=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},__iterator:function(t,e){var r=this._array,n=r.length-1,i=0;return new Wr(function(){return i>n?g():m(t,i,r[e?n-i++:i++])})}},{},Vr);var Zr=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length};o.createClass(Zr,{get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var o=n[e?i-u:u]; <add>if(t(r[o],o,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this._object,n=this._keys,i=n.length-1,u=0;return new Wr(function(){var o=n[e?i-u:u];return u++>i?g():m(t,o,r[o])})}},{},Hr),Zr.prototype[jr]=!0;var $r=function(t){this._iterable=t,this.size=t.length||t.size};o.createClass($r,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=I(r),i=0;if(S(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=I(r);if(!S(n))return new Wr(g);var i=0;return new Wr(function(){var e=n.next();return e.done?e:m(t,i++,e.value)})}},{},Vr);var tn=function(t){this._iterator=t,this._iteratorCache=[]};o.createClass(tn,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;for(var u;!(u=r.next()).done;){var o=u.value;if(n[i]=o,t(o,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new Wr(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return m(t,i,n[i++])})}},{},Vr);var en,rn=function(){throw TypeError("Abstract")};o.createClass(rn,{},{},Dr);var nn=function(){o.defaultSuperCall(this,un.prototype,arguments)},un=nn;o.createClass(nn,{},{},rn);var on=function(){o.defaultSuperCall(this,sn.prototype,arguments)},sn=on;o.createClass(on,{},{},rn);var an=function(){o.defaultSuperCall(this,hn.prototype,arguments)},hn=an;o.createClass(an,{},{},rn),rn.Keyed=nn,rn.Indexed=on,rn.Set=an;var cn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){t=0|t,e=0|e;var r=65535&t,n=65535&e;return r*n+((t>>>16)*n+r*(e>>>16)<<16>>>0)|0},fn=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),_n="function"==typeof WeakMap&&new WeakMap,ln=0,vn="__immutablehash__";"function"==typeof Symbol&&(vn=Symbol(vn)); <add>var pn=16,dn=255,yn=0,mn={},gn=function(t,e){this._iter=t,this._useKeys=e,this.size=t.size};o.createClass(gn,{get:function(t,e){return this._iter.get(t,e)},has:function(t){return this._iter.has(t)},valueSeq:function(){return this._iter.valueSeq()},reverse:function(){var t=this,e=Q(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},map:function(t,e){var r=this,n=Y(this,t,e);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(t,e)}),n},__iterate:function(t,e){var r,n=this;return this._iter.__iterate(this._useKeys?function(e,r){return t(e,r,n)}:(r=e?ce(this):0,function(i){return t(i,e?--r:r++,n)}),e)},__iterator:function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var r=this._iter.__iterator(Rr,e),n=e?ce(this):0;return new Wr(function(){var i=r.next();return i.done?i:m(t,e?--n:n++,i.value,i)})}},{},Hr),gn.prototype[jr]=!0;var wn=function(t){this._iter=t,this.size=t.size};o.createClass(wn,{contains:function(t){return this._iter.contains(t)},__iterate:function(t,e){var r=this,n=0;return this._iter.__iterate(function(e){return t(e,n++,r)},e)},__iterator:function(t,e){var r=this._iter.__iterator(Rr,e),n=0;return new Wr(function(){var e=r.next();return e.done?e:m(t,n++,e.value,e)})}},{},Vr);var Sn=function(t){this._iter=t,this.size=t.size};o.createClass(Sn,{has:function(t){return this._iter.contains(t)},__iterate:function(t,e){var r=this;return this._iter.__iterate(function(e){return t(e,e,r)},e)},__iterator:function(t,e){var r=this._iter.__iterator(Rr,e);return new Wr(function(){var e=r.next();return e.done?e:m(t,e.value,e.value,e)})}},{},Qr);var In=function(t){this._iter=t,this.size=t.size};o.createClass(In,{entrySeq:function(){return this._iter.toSeq()},__iterate:function(t,e){var r=this;return this._iter.__iterate(function(e){return e?(he(e),t(e[1],e[0],r)):void 0},e)},__iterator:function(t,e){var r=this._iter.__iterator(Rr,e);return new Wr(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n)return he(n),t===Ur?e:m(t,n[0],n[1],e) <add>}})}},{},Hr),wn.prototype.cacheResult=gn.prototype.cacheResult=Sn.prototype.cacheResult=In.prototype.cacheResult=le;var zn=function(t){return null===t||void 0===t?we():de(t)?t:we().withMutations(function(e){var r=Or(t);N(r.size),r.forEach(function(t,r){return e.set(r,t)})})};o.createClass(zn,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,void 0,t,e):e},set:function(t,e){return Se(this,t,e)},setIn:function(t,e){return this.updateIn(t,br,function(){return e})},remove:function(t){return Se(this,t,br)},deleteIn:function(t){return this.updateIn(t,function(){return br})},update:function(t,e,r){return 1===arguments.length?t(this):this.updateIn([t],e,r)},updateIn:function(t,e,r){r||(r=e,e=void 0);var n=ke(this,pe(t),e,r);return n===br?void 0:n},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):we()},merge:function(){return Oe(this,void 0,arguments)},mergeWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Oe(this,t,e)},mergeIn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return this.updateIn(t,we(),function(t){return t.merge.apply(t,e)})},mergeDeep:function(){return Oe(this,Ee(void 0),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Oe(this,Ee(t),e)},mergeDeepIn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return this.updateIn(t,we(),function(t){return t.mergeDeep.apply(t,e)})},sort:function(t){return Qn(ue(this,t))},sortBy:function(t,e){return Qn(ue(this,e,t))},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new r)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new Rn(this,t,e)},__iterate:function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r) <add>},e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?ge(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{},nn),zn.isMap=de;var bn="",qn=zn.prototype;qn[bn]=!0,qn[wr]=qn.remove,qn.removeIn=qn.deleteIn;var Mn=function(t,e){this.ownerID=t,this.entries=e},Dn=Mn;o.createClass(Mn,{get:function(t,e,r,n){for(var i=this.entries,u=0,o=i.length;o>u;u++)if(C(r,i[u][0]))return i[u][1];return n},update:function(t,r,n,u,o,s,a){for(var h=o===br,c=this.entries,f=0,_=c.length;_>f&&!C(u,c[f][0]);f++);var l=_>f;if(l?c[f][1]===o:h)return this;if(e(a),(h||!l)&&e(s),!h||1!==c.length){if(!l&&!h&&c.length>=Ln)return qe(t,c,u,o);var v=t&&t===this.ownerID,p=v?c:i(c);return l?h?f===_-1?p.pop():p[f]=p.pop():p[f]=[u,o]:p.push([u,o]),v?(this.entries=p,this):new Dn(t,p)}}},{});var On=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},En=On;o.createClass(On,{get:function(t,e,r,n){void 0===e&&(e=T(r));var i=1<<((0===t?e:e>>>t)&zr),u=this.bitmap;return 0===(u&i)?n:this.nodes[Ae(u&i-1)].get(t+Sr,e,r,n)},update:function(t,e,r,n,i,u,o){void 0===r&&(r=T(n));var s=(0===e?r:r>>>e)&zr,a=1<<s,h=this.bitmap,c=0!==(h&a);if(!c&&i===br)return this;var f=Ae(h&a-1),_=this.nodes,l=c?_[f]:void 0,v=Ie(l,t,e+Sr,r,n,i,u,o);if(v===l)return this;if(!c&&v&&_.length>=Tn)return De(t,_,h,s,v);if(c&&!v&&2===_.length&&ze(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&ze(v))return v;var p=t&&t===this.ownerID,d=c?v?h:h^a:h|a,y=c?v?Ce(_,f,v,p):Ke(_,f,p):je(_,f,v,p);return p?(this.bitmap=d,this.nodes=y,this):new En(t,d,y)}},{});var xn=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},kn=xn;o.createClass(xn,{get:function(t,e,r,n){void 0===e&&(e=T(r));var i=(0===t?e:e>>>t)&zr,u=this.nodes[i];return u?u.get(t+Sr,e,r,n):n},update:function(t,e,r,n,i,u,o){void 0===r&&(r=T(n));var s=(0===e?r:r>>>e)&zr,a=i===br,h=this.nodes,c=h[s];if(a&&!c)return this;var f=Ie(c,t,e+Sr,r,n,i,u,o);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,Bn>_))return Me(t,h,_,s)}else _++;var l=t&&t===this.ownerID,v=Ce(h,s,f,l); <add>return l?(this.count=_,this.nodes=v,this):new kn(t,_,v)}},{});var An=function(t,e,r){this.ownerID=t,this.keyHash=e,this.entries=r},Cn=An;o.createClass(An,{get:function(t,e,r,n){for(var i=this.entries,u=0,o=i.length;o>u;u++)if(C(r,i[u][0]))return i[u][1];return n},update:function(t,r,n,u,o,s,a){void 0===n&&(n=T(u));var h=o===br;if(n!==this.keyHash)return h?this:(e(a),e(s),be(this,t,r,n,[u,o]));for(var c=this.entries,f=0,_=c.length;_>f&&!C(u,c[f][0]);f++);var l=_>f;if(l?c[f][1]===o:h)return this;if(e(a),(h||!l)&&e(s),h&&2===_)return new jn(t,this.keyHash,c[1^f]);var v=t&&t===this.ownerID,p=v?c:i(c);return l?h?f===_-1?p.pop():p[f]=p.pop():p[f]=[u,o]:p.push([u,o]),v?(this.entries=p,this):new Cn(t,this.keyHash,p)}},{});var jn=function(t,e,r){this.ownerID=t,this.keyHash=e,this.entry=r},Kn=jn;o.createClass(jn,{get:function(t,e,r,n){return C(r,this.entry[0])?this.entry[1]:n},update:function(t,r,n,i,u,o,s){var a=u===br,h=C(i,this.entry[0]);return(h?u===this.entry[1]:a)?this:(e(s),a?void e(o):h?t&&t===this.ownerID?(this.entry[1]=u,this):new Kn(t,this.keyHash,[i,u]):(e(o),be(this,t,r,T(i),[i,u])))}},{}),Mn.prototype.iterate=An.prototype.iterate=function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1},On.prototype.iterate=xn.prototype.iterate=function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];if(u&&u.iterate(t,e)===!1)return!1}},jn.prototype.iterate=function(t){return t(this.entry)};var Rn=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&me(t._root)};o.createClass(Rn,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return ye(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return ye(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return ye(t,u.entry);e=this._stack=me(u,e)}continue}e=this._stack=this._stack.__prev}return g()}},{},Wr);var Un,Ln=Ir/4,Tn=Ir/2,Bn=Ir/4,Wn=function(t){var e=Te();if(null===t||void 0===t)return e; <add>if(Re(t))return t;var r=Er(t),n=r.size;return 0===n?e:(N(n),n>0&&Ir>n?Le(0,n,Sr,null,new Hn(r.toArray())):e.withMutations(function(t){t.setSize(n),r.forEach(function(e,r){return t.set(r,e)})}))};o.createClass(Wn,{toString:function(){return this.__toString("List [","]")},get:function(t,e){if(t=s(this,t),0>t||t>=this.size)return e;t+=this._origin;var r=Je(this,t);return r&&r.array[t&zr]},set:function(t,e){return Be(this,t,e)},remove:function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=Sr,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Te()},push:function(){var t=arguments,e=this.size;return this.withMutations(function(r){He(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return He(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){He(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return He(this,1)},merge:function(){return Ne(this,void 0,arguments)},mergeWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Ne(this,t,e)},mergeDeep:function(){return Ne(this,Ee(void 0),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Ne(this,Ee(t),e)},setSize:function(t){return He(this,0,t)},slice:function(t,e){var r=this.size;return h(t,e,r)?this:He(this,c(t,r),f(e,r))},__iterator:function(t,e){var r=0,n=Ue(this,e);return new Wr(function(){var e=n();return e===Yn?g():m(t,r++,e)})},__iterate:function(t,e){for(var r,n=0,i=Ue(this,e);(r=i())!==Yn&&t(r,n++,this)!==!1;);return n},__ensureOwner:function(t){return t===this.__ownerID?this:t?Le(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{of:function(){return this(arguments)}},on),Wn.isList=Re;var Pn="",Jn=Wn.prototype;Jn[Pn]=!0,Jn[wr]=Jn.remove,Jn.setIn=qn.setIn,Jn.deleteIn=Jn.removeIn=qn.removeIn,Jn.update=qn.update,Jn.updateIn=qn.updateIn,Jn.mergeIn=qn.mergeIn,Jn.mergeDeepIn=qn.mergeDeepIn,Jn.withMutations=qn.withMutations,Jn.asMutable=qn.asMutable,Jn.asImmutable=qn.asImmutable,Jn.wasAltered=qn.wasAltered; <add>var Hn=function(t,e){this.array=t,this.ownerID=e},Nn=Hn;o.createClass(Hn,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&zr;if(n>=this.array.length)return new Nn([],t);var i,u=0===n;if(e>0){var o=this.array[n];if(i=o&&o.removeBefore(t,e-Sr,r),i===o&&u)return this}if(u&&!i)return this;var s=Pe(this,t);if(!u)for(var a=0;n>a;a++)s.array[a]=void 0;return i&&(s.array[n]=i),s},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&zr;if(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var o=this.array[n];if(i=o&&o.removeAfter(t,e-Sr,r),i===o&&u)return this}if(u&&!i)return this;var s=Pe(this,t);return u||s.array.pop(),i&&(s.array[n]=i),s}},{});var Vn,Yn={},Qn=function(t){return null===t||void 0===t?Xe():Ye(t)?t:Xe().withMutations(function(e){var r=Or(t);N(r.size),r.forEach(function(t,r){return e.set(r,t)})})};o.createClass(Qn,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var r=this._map.get(t);return void 0!==r?this._list.get(r)[1]:e},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):Xe()},set:function(t,e){return Fe(this,t,e)},remove:function(t){return Fe(this,t,br)},wasAltered:function(){return this._map.wasAltered()||this._list.wasAltered()},__iterate:function(t,e){var r=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._list.__ensureOwner(t);return t?Qe(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=r,this)}},{of:function(){return this(arguments)}},zn),Qn.isOrderedMap=Ye,Qn.prototype[jr]=!0,Qn.prototype[wr]=Qn.prototype.remove;var Xn,Fn=function(t){return null===t||void 0===t?$e():Ge(t)?t:$e().unshiftAll(t)},Gn=Fn;o.createClass(Fn,{toString:function(){return this.__toString("Stack [","]")},get:function(t,e){for(var r=this._head;r&&t--;)r=r.next; <add>return r?r.value:e},peek:function(){return this._head&&this._head.value},push:function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,r=arguments.length-1;r>=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Ze(t,e)},pushAll:function(t){if(t=Er(t),0===t.size)return this;N(t.size);var e=this.size,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.size=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):Ze(e,r)},pop:function(){return this.slice(1)},unshift:function(){return this.push.apply(this,arguments)},unshiftAll:function(t){return this.pushAll(t)},shift:function(){return this.pop.apply(this,arguments)},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):$e()},slice:function(t,e){if(h(t,e,this.size))return this;var r=c(t,this.size),n=f(e,this.size);if(n!==this.size)return o.superCall(this,Gn.prototype,"slice",[t,e]);for(var i=this.size-r,u=this._head;r--;)u=u.next;return this.__ownerID?(this.size=i,this._head=u,this.__hash=void 0,this.__altered=!0,this):Ze(i,u)},__ensureOwner:function(t){return t===this.__ownerID?this:t?Ze(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},__iterate:function(t,e){if(e)return this.toSeq().cacheResult.__iterate(t,e);for(var r=0,n=this._head;n&&t(n.value,r++,this)!==!1;)n=n.next;return r},__iterator:function(t,e){if(e)return this.toSeq().cacheResult().__iterator(t,e);var r=0,n=this._head;return new Wr(function(){if(n){var e=n.value;return n=n.next,m(t,r++,e)}return g()})}},{of:function(){return this(arguments)}},on),Fn.isStack=Ge;var Zn="",$n=Fn.prototype;$n[Zn]=!0,$n.withMutations=qn.withMutations,$n.asMutable=qn.asMutable,$n.asImmutable=qn.asImmutable,$n.wasAltered=qn.wasAltered;var ti,ei=function(t){return null===t||void 0===t?nr():tr(t)?t:nr().withMutations(function(e){var r=xr(t); <add>N(r.size),r.forEach(function(t){return e.add(t)})})};o.createClass(ei,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},add:function(t){return er(this,this._map.set(t,!0))},remove:function(t){return er(this,this._map.remove(t))},clear:function(){return er(this,this._map.clear())},union:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0===this.size&&1===t.length?this.constructor(t[0]):this.withMutations(function(e){for(var r=0;t.length>r;r++)xr(t[r]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return xr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.remove(r)})})},subtract:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return xr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.remove(r)})})},merge:function(){return this.union.apply(this,arguments)},mergeWith:function(){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return this.union.apply(this,t)},sort:function(t){return ui(ue(this,t))},sortBy:function(t,e){return ui(ue(this,e,t))},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var r=this;return this._map.__iterate(function(e,n){return t(n,n,r)},e)},__iterator:function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)}},{of:function(){return this(arguments)},fromKeys:function(t){return this(Or(t).keySeq())}},an),ei.isSet=tr;var ri="",ni=ei.prototype;ni[ri]=!0,ni[wr]=ni.remove,ni.mergeDeep=ni.merge,ni.mergeDeepWith=ni.mergeWith,ni.withMutations=qn.withMutations,ni.asMutable=qn.asMutable,ni.asImmutable=qn.asImmutable,ni.__empty=nr,ni.__make=rr; <add>var ii,ui=function(t){return null===t||void 0===t?or():ir(t)?t:or().withMutations(function(e){var r=xr(t);N(r.size),r.forEach(function(t){return e.add(t)})})};o.createClass(ui,{toString:function(){return this.__toString("OrderedSet {","}")}},{of:function(){return this(arguments)},fromKeys:function(t){return this(Or(t).keySeq())}},ei),ui.isOrderedSet=ir;var oi=ui.prototype;oi[jr]=!0,oi.__empty=or,oi.__make=ur;var si,ai=function(t,e){var r=function(t){return this instanceof r?void(this._map=zn(t)):new r(t)},n=Object.keys(t),i=r.prototype=Object.create(hi);i.constructor=r,e&&(i._name=e),i._defaultValues=t,i._keys=n,i.size=n.length;try{n.forEach(function(t){Object.defineProperty(r.prototype,t,{get:function(){return this.get(t)},set:function(e){H(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})})}catch(u){}return r};o.createClass(ai,{toString:function(){return this.__toString(ar(this)+" {","}")},has:function(t){return this._defaultValues.hasOwnProperty(t)},get:function(t,e){if(!this.has(t))return e;var r=this._defaultValues[t];return this._map?this._map.get(t,r):r},clear:function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=Object.getPrototypeOf(this).constructor;return t._empty||(t._empty=sr(this,we()))},set:function(t,e){if(!this.has(t))throw Error('Cannot set unknown key "'+t+'" on '+ar(this));var r=this._map&&this._map.set(t,e);return this.__ownerID||r===this._map?this:sr(this,r)},remove:function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:sr(this,e)},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){var r=this;return Or(this._defaultValues).map(function(t,e){return r.get(e)}).__iterator(t,e)},__iterate:function(t,e){var r=this;return Or(this._defaultValues).map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?sr(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},nn);var hi=ai.prototype; <add>hi[wr]=hi.remove,hi.deleteIn=hi.removeIn=qn.removeIn,hi.merge=qn.merge,hi.mergeWith=qn.mergeWith,hi.mergeIn=qn.mergeIn,hi.mergeDeep=qn.mergeDeep,hi.mergeDeepWith=qn.mergeDeepWith,hi.mergeDeepIn=qn.mergeDeepIn,hi.setIn=qn.setIn,hi.update=qn.update,hi.updateIn=qn.updateIn,hi.withMutations=qn.withMutations,hi.asMutable=qn.asMutable,hi.asImmutable=qn.asImmutable;var ci=function(t,e,r){if(!(this instanceof fi))return new fi(t,e,r);if(H(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),r=void 0===r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,this.size=Math.max(0,Math.ceil((e-t)/r-1)+1),0===this.size){if(_i)return _i;_i=this}},fi=ci;o.createClass(ci,{toString:function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},get:function(t,e){return this.has(t)?this._start+s(this,t)*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.size>e&&e===Math.floor(e)},slice:function(t,e){return h(t,e,this.size)?this:(t=c(t,this.size),e=f(e,this.size),t>=e?new fi(0,0):new fi(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.size>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},__iterate:function(t,e){for(var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,u=0;r>=u;u++){if(t(i,u,this)===!1)return u+1;i+=e?-n:n}return u},__iterator:function(t,e){var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,u=0;return new Wr(function(){var o=i;return i+=e?-n:n,u>r?g():m(t,u++,o)})},equals:function(t){return t instanceof fi?this._start===t._start&&this._end===t._end&&this._step===t._step:hr(this,t)}},{},Vr);var _i,li=function(t,e){if(!(this instanceof vi))return new vi(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(pi)return pi;pi=this}},vi=li;o.createClass(li,{toString:function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]" <ide> },get:function(t,e){return this.has(t)?this._value:e},contains:function(t){return C(this._value,t)},slice:function(t,e){var r=this.size;return h(t,e,r)?this:new vi(this._value,f(e,r)-c(t,r))},reverse:function(){return this},indexOf:function(t){return C(this._value,t)?0:-1},lastIndexOf:function(t){return C(this._value,t)?this.size:-1},__iterate:function(t){for(var e=0;this.size>e;e++)if(t(this._value,e,this)===!1)return e+1;return e},__iterator:function(t){var e=this,r=0;return new Wr(function(){return e.size>r?m(t,r++,e._value):g()})},equals:function(t){return t instanceof vi?C(this._value,t._value):hr(t)}},{},Vr);var pi;Dr.Iterator=Wr,cr(Dr,{toArray:function(){N(this.size);var t=Array(this.size||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toIndexedSeq:function(){return new wn(this)},toJS:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJS?t.toJS():t}).__toJS()},toJSON:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t}).__toJS()},toKeyedSeq:function(){return new gn(this,!0)},toMap:function(){return zn(this.toKeyedSeq())},toObject:function(){N(this.size);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toOrderedMap:function(){return Qn(this.toKeyedSeq())},toOrderedSet:function(){return ui(v(this)?this.valueSeq():this)},toSet:function(){return ei(v(this)?this.valueSeq():this)},toSetSeq:function(){return new Sn(this)},toSeq:function(){return p(this)?this.toIndexedSeq():v(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Fn(v(this)?this.valueSeq():this)},toList:function(){return Wn(v(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ae(this,ee(this,t))},contains:function(t){return this.some(function(e){return C(e,t)})},entries:function(){return this.__iterator(Ur)},every:function(t,e){N(this.size); <del>var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},filter:function(t,e){return ae(this,X(this,t,e,!0))},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},forEach:function(t,e){return N(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){N(this.size),t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!==n&&void 0!==n?n:""}),e},keys:function(){return this.__iterator(Kr)},map:function(t,e){return ae(this,Y(this,t,e))},reduce:function(t,e,r){N(this.size);var n,i;return arguments.length<2?i=!0:n=e,this.__iterate(function(e,u,o){i?(i=!1,n=e):n=t.call(r,n,e,u,o)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},reverse:function(){return ae(this,Q(this,!0))},slice:function(t,e){return ae(this,Z(this,t,e,!0))},some:function(t,e){return!this.every(lr(t),e)},sort:function(t){return ae(this,ue(this,t))},values:function(){return this.__iterator(Rr)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return o(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return F(this,t,e)},equals:function(t){return hr(this,t)},entrySeq:function(){var t=this;if(t._cache)return new Gr(t._cache);var e=t.toSeq().map(_r).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(lr(t),e)},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},first:function(){return this.find(a)},flatMap:function(t,e){return ae(this,ne(this,t,e))},flatten:function(t){return ae(this,re(this,t,!0))},fromEntrySeq:function(){return new In(this)},get:function(t,e){return this.find(function(e,r){return C(r,t)},void 0,e)},getIn:function(t,e){for(var r,n=this,i=pe(t);!(r=i.next()).done;){var u=r.value;if(n=n&&n.get?n.get(u,br):br,n===br)return e}return n},groupBy:function(t,e){return G(this,t,e)},has:function(t){return this.get(t,br)!==br <add>var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},filter:function(t,e){return ae(this,X(this,t,e,!0))},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},forEach:function(t,e){return N(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){N(this.size),t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!==n&&void 0!==n?n:""}),e},keys:function(){return this.__iterator(Kr)},map:function(t,e){return ae(this,Y(this,t,e))},reduce:function(t,e,r){N(this.size);var n,i;return arguments.length<2?i=!0:n=e,this.__iterate(function(e,u,o){i?(i=!1,n=e):n=t.call(r,n,e,u,o)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},reverse:function(){return ae(this,Q(this,!0))},slice:function(t,e){return ae(this,Z(this,t,e,!0))},some:function(t,e){return!this.every(lr(t),e)},sort:function(t){return ae(this,ue(this,t))},values:function(){return this.__iterator(Rr)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return u(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return F(this,t,e)},equals:function(t){return hr(this,t)},entrySeq:function(){var t=this;if(t._cache)return new Gr(t._cache);var e=t.toSeq().map(_r).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(lr(t),e)},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},first:function(){return this.find(a)},flatMap:function(t,e){return ae(this,ne(this,t,e))},flatten:function(t){return ae(this,re(this,t,!0))},fromEntrySeq:function(){return new In(this)},get:function(t,e){return this.find(function(e,r){return C(r,t)},void 0,e)},getIn:function(t,e){for(var r,n=this,i=pe(t);!(r=i.next()).done;){var u=r.value;if(n=n&&n.get?n.get(u,br):br,n===br)return e}return n},groupBy:function(t,e){return G(this,t,e)},has:function(t){return this.get(t,br)!==br <ide> },hasIn:function(t){return this.getIn(t,br)!==br},isSubset:function(t){return t="function"==typeof t.contains?t:Dr(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){return t.isSubset(this)},keySeq:function(){return this.toSeq().map(fr).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(t){return oe(this,t)},maxBy:function(t,e){return oe(this,e,t)},min:function(t){return oe(this,t?vr(t):dr)},minBy:function(t,e){return oe(this,e?vr(e):dr,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return ae(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return ae(this,te(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(lr(t),e)},sortBy:function(t,e){return ae(this,ue(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return ae(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return ae(this,$(this,t,e))},takeUntil:function(t,e){return this.takeWhile(lr(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=yr(this))}});var di=Dr.prototype;di[kr]=!0,di[Br]=di.values,di.__toJS=di.toArray,di.__toStringMapper=pr,di.inspect=di.toSource=function(){return""+this},di.chain=di.flatMap,function(){try{Object.defineProperty(di,"length",{get:function(){if(!Dr.noLengthWarning){var t;try{throw Error()}catch(e){t=e.stack}if(-1===t.indexOf("_wrapObject"))return console&&console.warn&&console.warn("iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. "+t),this.size}}})}catch(t){}}(),cr(Or,{flip:function(){return ae(this,V(this))},findKey:function(t,e){var r;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLastKey:function(t,e){return this.toSeq().reverse().findKey(t,e)},keyOf:function(t){return this.findKey(function(e){return C(e,t)})},lastKeyOf:function(t){return this.toSeq().reverse().keyOf(t) <ide> },mapEntries:function(t,e){var r=this,n=0;return ae(this,this.toSeq().map(function(i,u){return t.call(e,[u,i],n++,r)}).fromEntrySeq())},mapKeys:function(t,e){var r=this;return ae(this,this.toSeq().flip().map(function(n,i){return t.call(e,n,i,r)}).flip())}});var yi=Or.prototype;yi[Ar]=!0,yi[Br]=di.entries,yi.__toJS=di.toObject,yi.__toStringMapper=function(t,e){return e+": "+pr(t)},cr(Er,{toKeyedSeq:function(){return new gn(this,!1)},filter:function(t,e){return ae(this,X(this,t,e,!1))},findIndex:function(t,e){var r=this.toKeyedSeq().findKey(t,e);return void 0===r?-1:r},indexOf:function(t){var e=this.toKeyedSeq().keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.toKeyedSeq().lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return ae(this,Q(this,!1))},slice:function(t,e){return ae(this,Z(this,t,e,!1))},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=c(t,this.size);var n=this.slice(0,t);return ae(this,1===r?n:n.concat(i(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.toKeyedSeq().findLastKey(t,e);return void 0===r?-1:r},first:function(){return this.get(0)},flatten:function(t){return ae(this,re(this,t,!1))},get:function(t,e){return t=s(this,t),0>t||1/0===this.size||void 0!==this.size&&t>this.size?e:this.find(function(e,r){return r===t},void 0,e)},has:function(t){return t=s(this,t),t>=0&&(void 0!==this.size?1/0===this.size||this.size>t:-1!==this.indexOf(t))},interpose:function(t){return ae(this,ie(this,t))},last:function(){return this.get(-1)},skipWhile:function(t,e){return ae(this,te(this,t,e,!1))}}),Er.prototype[Cr]=!0,Er.prototype[jr]=!0,cr(xr,{get:function(t,e){return this.has(t)?t:e},contains:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}}),xr.prototype.has=di.contains,cr(Hr,Or.prototype),cr(Vr,Er.prototype),cr(Qr,xr.prototype),cr(nn,Or.prototype),cr(on,Er.prototype),cr(an,xr.prototype);var mi={Iterable:Dr,Seq:Pr,Collection:rn,Map:zn,OrderedMap:Qn,List:Wn,Stack:Fn,Set:ei,OrderedSet:ui,Record:ai,Range:ci,Repeat:li,is:C,fromJS:j}; <del>n.exports=mi}.call(global),n.exports}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide>\ No newline at end of file <add>n.exports=mi}.call(i),n.exports}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide>\ No newline at end of file <ide><path>resources/universal-module.js <ide> function universalModule() { <ide> var module = {}; <add> var global = {}; <ide> %MODULE% <ide> return module.exports; <ide> }
3
Javascript
Javascript
update spec name
53ea43001945f2cac87c8d0639aef984bb9f93b8
<ide><path>spec/path-watcher-spec.js <ide> tempCb.track() <ide> const fs = promisifySome(fsCb, ['writeFile', 'mkdir', 'symlink', 'appendFile', 'realpath']) <ide> const temp = promisifySome(tempCb, ['mkdir']) <ide> <del>describe('PathWatcher', function () { <add>describe('watchPath', function () { <ide> let subs <ide> <ide> beforeEach(function () {
1
Javascript
Javascript
accept animation.target.node=0 in gltf2loader
c2e03ce8162036e5856448264e9687912e98ee3e
<ide><path>examples/js/loaders/GLTF2Loader.js <ide> THREE.GLTF2Loader = ( function () { <ide> if ( sampler ) { <ide> <ide> var target = channel.target; <del> var name = target.node || target.id; // NOTE: target.id is deprecated. <add> var name = target.node !== undefined ? target.node : target.id; // NOTE: target.id is deprecated. <ide> var input = animation.parameters !== undefined ? animation.parameters[ sampler.input ] : sampler.input; <ide> var output = animation.parameters !== undefined ? animation.parameters[ sampler.output ] : sampler.output; <ide>
1
Javascript
Javascript
add deprecation warnings for a few ios components
174644846d7f0b2729d2a538695a42ae8c057946
<ide><path>Libraries/Components/TabBarIOS/TabBarIOS.android.js <ide> const StyleSheet = require('StyleSheet'); <ide> const TabBarItemIOS = require('TabBarItemIOS'); <ide> const View = require('View'); <ide> <add>let showedDeprecationWarning = false; <add> <ide> class DummyTabBarIOS extends React.Component<$FlowFixMeProps> { <ide> static Item = TabBarItemIOS; <ide> <add> componentDidMount() { <add> if (!showedDeprecationWarning) { <add> console.warn( <add> 'TabBarIOS and TabBarItemIOS are deprecated and will be removed in a future release. ' + <add> 'Please use react-native-tab-view instead.', <add> ); <add> <add> showedDeprecationWarning = true; <add> } <add> } <add> <ide> render() { <ide> return ( <ide> <View style={[this.props.style, styles.tabGroup]}> <ide><path>Libraries/Components/TabBarIOS/TabBarIOS.ios.js <ide> type Props = $ReadOnly<{| <ide> itemPositioning?: ?('fill' | 'center' | 'auto'), <ide> |}>; <ide> <add>let showedDeprecationWarning = false; <add> <ide> class TabBarIOS extends React.Component<Props> { <ide> static Item = TabBarItemIOS; <ide> <add> componentDidMount() { <add> if (!showedDeprecationWarning) { <add> console.warn( <add> 'TabBarIOS and TabBarItemIOS are deprecated and will be removed in a future release. ' + <add> 'Please use react-native-tab-view instead.', <add> ); <add> <add> showedDeprecationWarning = true; <add> } <add> } <add> <ide> render() { <ide> return ( <ide> <RCTTabBar <ide><path>Libraries/Components/TabBarIOS/TabBarItemIOS.android.js <ide> const React = require('React'); <ide> const View = require('View'); <ide> const StyleSheet = require('StyleSheet'); <ide> <add>let showedDeprecationWarning = false; <add> <ide> class DummyTab extends React.Component { <add> componentDidMount() { <add> if (!showedDeprecationWarning) { <add> console.warn( <add> 'TabBarIOS and TabBarItemIOS are deprecated and will be removed in a future release. ' + <add> 'Please use react-native-tab-view instead.', <add> ); <add> <add> showedDeprecationWarning = true; <add> } <add> } <add> <ide> render() { <ide> if (!this.props.selected) { <ide> return <View />; <ide><path>Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js <ide> <ide> 'use strict'; <ide> <del>const Image = require('Image'); <ide> const React = require('React'); <ide> const StaticContainer = require('StaticContainer.react'); <ide> const StyleSheet = require('StyleSheet'); <ide> type State = {| <ide> hasBeenSelected: boolean, <ide> |}; <ide> <add>let showedDeprecationWarning = false; <add> <ide> class TabBarItemIOS extends React.Component<Props, State> { <ide> state = { <ide> hasBeenSelected: false, <ide> class TabBarItemIOS extends React.Component<Props, State> { <ide> } <ide> } <ide> <add> componentDidMount() { <add> if (!showedDeprecationWarning) { <add> console.warn( <add> 'TabBarIOS and TabBarItemIOS are deprecated and will be removed in a future release. ' + <add> 'Please use react-native-tab-view instead.', <add> ); <add> <add> showedDeprecationWarning = true; <add> } <add> } <add> <ide> render() { <ide> const {style, children, ...props} = this.props; <ide> <ide><path>Libraries/Vibration/VibrationIOS.android.js <ide> const warning = require('fbjs/lib/warning'); <ide> <ide> const VibrationIOS = { <ide> vibrate: function() { <del> warning('VibrationIOS is not supported on this platform!'); <add> warning( <add> false, <add> 'VibrationIOS is deprecated, and will be removed. Use Vibration instead.', <add> ); <ide> }, <ide> }; <ide> <ide><path>Libraries/Vibration/VibrationIOS.ios.js <ide> * LICENSE file in the root directory of this source tree. <ide> * <ide> * @format <del> * @flow strict-local <ide> */ <ide> <ide> 'use strict'; <ide> <ide> const RCTVibration = require('NativeModules').Vibration; <ide> <ide> const invariant = require('fbjs/lib/invariant'); <add>const warning = require('fbjs/lib/warning'); <ide> <ide> /** <ide> * NOTE: `VibrationIOS` is being deprecated. Use `Vibration` instead. <ide> const VibrationIOS = { <ide> * @deprecated <ide> */ <ide> vibrate: function() { <add> warning( <add> false, <add> 'VibrationIOS is deprecated and will be removed. Please use Vibration instead.', <add> ); <ide> invariant(arguments[0] === undefined, 'Vibration patterns not supported.'); <ide> RCTVibration.vibrate(); <ide> }, <ide><path>RNTester/js/VibrationIOSExample.js <del>/** <del> * Copyright (c) Facebook, Inc. and its affiliates. <del> * <del> * This source code is licensed under the MIT license found in the <del> * LICENSE file in the root directory of this source tree. <del> * <del> * @format <del> * @flow strict-local <del> */ <del> <del>'use strict'; <del> <del>var React = require('react'); <del>var ReactNative = require('react-native'); <del>var {StyleSheet, View, Text, TouchableHighlight, VibrationIOS} = ReactNative; <del> <del>exports.framework = 'React'; <del>exports.title = 'VibrationIOS'; <del>exports.description = 'Vibration API for iOS'; <del>exports.examples = [ <del> { <del> title: 'VibrationIOS.vibrate()', <del> render() { <del> return ( <del> <TouchableHighlight <del> style={styles.wrapper} <del> onPress={() => VibrationIOS.vibrate()}> <del> <View style={styles.button}> <del> <Text>Vibrate</Text> <del> </View> <del> </TouchableHighlight> <del> ); <del> }, <del> }, <del>]; <del> <del>var styles = StyleSheet.create({ <del> wrapper: { <del> borderRadius: 5, <del> marginBottom: 5, <del> }, <del> button: { <del> backgroundColor: '#eeeeee', <del> padding: 10, <del> }, <del>});
7
Go
Go
remove unused canaccess() stub for windows
1fccb39316bf3a695fd13c05a2b0e2787dff64f1
<ide><path>pkg/idtools/idtools_windows.go <ide> const ( <ide> func mkdirAs(path string, _ os.FileMode, _ Identity, _, _ bool) error { <ide> return system.MkdirAll(path, 0) <ide> } <del> <del>// CanAccess takes a valid (existing) directory and a uid, gid pair and determines <del>// if that uid, gid pair has access (execute bit) to the directory <del>// Windows does not require/support this function, so always return true <del>func CanAccess(path string, identity Identity) bool { <del> return true <del>}
1
Python
Python
embed the tornado web server
47c1ed03f055b4d25d6c127c53d96b1701ffccfe
<add><path>celery/monitoring/__init__.py <del><path>celery/monitoring.py <ide> from carrot.connection import DjangoBrokerConnection <ide> <ide> from celery.events import EventReceiver <add>from celery.monitoring.web import WebServerThread <ide> <ide> HEARTBEAT_EXPIRE = 120 # Heartbeats must be at most 2 minutes apart. <ide> <ide> def __init__(self, logger, is_detached=False): <ide> def start(self): <ide> state = MonitorState() <ide> listener = MonitorListener(state) <add> webthread = WebServerThread() <add> webthread.start() <ide> <ide> listener.start() <ide><path>celery/monitoring/web.py <add>import threading <add> <add>from tornado import httpserver <add>from tornado import ioloop <add> <add> <add> <add>def handle_request(request): <add> message = "You requested %s\n" % request.uri <add> request.write("HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s" % ( <add> len(message), message)) <add> request.finish() <add> <add> <add>class WebServerThread(threading.Thread): <add> <add> def __init__(self): <add> super(WebServerThread, self).__init__() <add> self.setDaemon(True) <add> <add> def run(self): <add> http_server = httpserver.HTTPServer(handle_request) <add> http_server.listen(8888) <add> ioloop.IOLoop.instance().start()
2
Go
Go
enable v2 default push
770e9b6b819b495a933b2f467bf768a1b785d5ad
<ide><path>graph/pull.go <ide> func (s *TagStore) CmdPull(job *engine.Job) engine.Status { <ide> logName = utils.ImageReference(logName, tag) <ide> } <ide> <del> if len(repoInfo.Index.Mirrors) == 0 && ((repoInfo.Official && repoInfo.Index.Official) || endpoint.Version == registry.APIVersion2) { <add> if len(repoInfo.Index.Mirrors) == 0 && (repoInfo.Index.Official || endpoint.Version == registry.APIVersion2) { <ide> if repoInfo.Official { <ide> j := job.Eng.Job("trust_update_base") <ide> if err = j.Run(); err != nil { <ide><path>graph/push.go <ide> func (s *TagStore) CmdPush(job *engine.Job) engine.Status { <ide> return job.Errorf("Repository does not exist: %s", repoInfo.LocalName) <ide> } <ide> <del> if endpoint.Version == registry.APIVersion2 { <add> if repoInfo.Index.Official || endpoint.Version == registry.APIVersion2 { <ide> err := s.pushV2Repository(r, localRepo, job.Stdout, repoInfo, tag, sf) <ide> if err == nil { <ide> return engine.StatusOK
2
Ruby
Ruby
move lonely indifferent hash test
9578d574f3be8da966ee7355dfb1604936a103cb
<ide><path>activesupport/test/core_ext/hash_ext_test.rb <ide> def test_indifferent_merging_with_block <ide> assert_equal 5, merged[:b] <ide> end <ide> <add> def test_reverse_merge <add> hash = HashWithIndifferentAccess.new key: :old_value <add> hash.reverse_merge! key: :new_value <add> assert_equal :old_value, hash[:key] <add> end <add> <ide> def test_indifferent_reverse_merging <ide> hash = HashWithIndifferentAccess.new('some' => 'value', 'other' => 'value') <ide> hash.reverse_merge!(:some => 'noclobber', :another => 'clobber') <ide><path>activesupport/test/hash_with_indifferent_access_test.rb <del>require 'abstract_unit' <del>require 'active_support/hash_with_indifferent_access' <del> <del>class HashWithIndifferentAccessTest < ActiveSupport::TestCase <del> def test_reverse_merge <del> hash = HashWithIndifferentAccess.new key: :old_value <del> hash.reverse_merge! key: :new_value <del> assert_equal :old_value, hash[:key] <del> end <del> <del>end
2
Text
Text
move readme simplification
2dacad831e89977d3ac95ffa3c21b0ef2eb8d585
<ide><path>CONTRIBUTING.md <del>All pull requests to the `master` branch will be closed. <del>======================================================== <del> <del>Please submit all pull requests to the `develop` branch. <del> <del>Language translations will not be merged without unit tests. <del>============================================================ <del> <del>See [the British english unit tests](https://github.com/moment/moment/blob/develop/test/lang/en-gb.js) for an example. <del> <del>Submitting Issues <add>Submitting issues <ide> ================= <ide> <ide> If you are submitting a bug, please create a [jsfiddle](http://jsfiddle.net/) demonstrating the issue. <ide> <del>Contributing <del>============ <del> <del>To contribute, fork the library and install grunt and dependencies. <del> <del> npm install -g grunt-cli <del> npm install <del> <del>You can add tests to the files in `/test/moment` or add a new test file if you are adding a new feature. <del> <del>To run the tests, do `grunt` to run all tests. <del> <del>To check the filesize, you can use `grunt size`. <del> <del>To minify all the files, use `grunt release`. **But please don't include minified files in pull requests.** We'll minify them when we release. <del> <del>If your code passes the unit tests (including the ones you wrote), submit a pull request. <add>Contributing code <add>================= <ide> <del>Submitting pull requests <del>======================== <add>To contribute, fork the library and install grunt and dependencies. You need [node](http://nodejs.org/); use [nvm](https://github.com/creationix/nvm) or [nenv](https://github.com/ryuone/nenv) to install it. <ide> <del>Moment.js now uses [git-flow](https://github.com/nvie/gitflow). If you're not familiar with git-flow, please read up on it, you'll be glad you did. <add>```bash <add>git clone https://github.com/moment/moment.git <add>cd moment <add>npm install -g grunt-cli <add>npm install <add>git checkout develop # all patches against develop branch, please! <add>grunt # this runs tests and jshint <add>``` <ide> <del>When submitting new features, please create a new feature branch using `git flow feature start <name>` and submit the pull request to the `develop` branch. <add>Very important notes <add>==================== <ide> <del>Pull requests for enhancements for features should be submitted to the `develop` branch as well. <add> * **Pull pull requests to the `master` branch will be closed.** Please submit all pull requests to the `develop` branch. <add> * **Language translations will not be merged without unit tests.** See [the British English unit tests](https://github.com/moment/moment/blob/develop/test/lang/en-gb.js) for an example. <add> * **Do not include the minifiled files in your pull request.** Don't worrry, we'll build them when we cut a release. <ide> <del>When submitting a bugfix, please check if there is an existing bugfix branch. If the latest stable version is `1.5.0`, the bugfix branch would be `hotfix/1.5.1`. All pull requests for bug fixes should be on a `hotfix` branch, unless the bug fix depends on a new feature. <add>Grunt tasks <add>=========== <ide> <del>The `master` branch should always have the latest stable version. When bugfix or minor releases are needed, the develop/hotfix branch will be merged into master and released. <add>We use Grunt for managing the build. Here are some useful Grunt tasks: <ide> <add> * `grunt` The default task lints the code and runs the tests. You should make sure you do this before submitting a PR. <add> * `grunt nodeunit:all` Just run the tests. <add> * `grunt release` Build everything, including minified files <add> * `grunt release --embedLanguages=fr,ru` Build everything, and also create `moment-with-customLangs.js` and `moment-with-customLangs.min.js` containing just French and Russian. <add> * `grunt size` Print size statistics. <add><path>README.md <del><path>readme.md <del>[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url] [![Develop build Status][travis-image]][travis-url] [![Master build Status][travis-image-master]][travis-url] <add>[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url] [![Build Status][travis-image]][travis-url] <ide> <ide> A lightweight javascript date library for parsing, validating, manipulating, and formatting dates. <ide> <ide> Duplicate `Date` passed to `moment()` instead of referencing it. <ide> Changelog <ide> ========= <ide> <del>See [CHANGELOG.md](CHANGELOG.md). <add>See [the changelog](CHANGELOG.md). <ide> <del>For developers <del>============== <add>Contributing <add>============ <ide> <del>You need [node](http://nodejs.org/); use [nvm](https://github.com/creationix/nvm) or [nenv](https://github.com/ryuone/nenv) to install it. <del> <del>Then, in your shell <del> <del>```bash <del>git clone https://github.com/moment/moment.git <del>cd moment <del>npm install -g grunt-cli <del>npm install <del>git checkout develop # all patches against develop branch, please! <del>grunt # this runs tests and jshint <del>``` <add>See [the contributing guide](CONTRIBUTING.md). <ide> <ide> License <ide> ======= <ide> Moment.js is freely distributable under the terms of the [MIT license](LICENSE). <ide> <ide> [travis-url]: http://travis-ci.org/moment/moment <ide> [travis-image]: http://img.shields.io/travis/moment/moment/develop.svg?style=flat <del>[travis-image-master]: http://img.shields.io/travis/moment/moment/master.svg?style=flat
2
PHP
PHP
fix failing tests caused by cache/log changes
46a8a311004033e118896f496712fa09e27f50bb
<ide><path>lib/Cake/Console/Shell.php <ide> protected function _useLogger($enable = true) { <ide> 'types' => ['emergency', 'alert', 'critical', 'error', 'warning'], <ide> 'stream' => $this->stderr, <ide> ]); <del> Log::engine('stdout', $stdout); <del> Log::engine('stderr', $stderr); <add> Log::config('stdout', ['engine' => $stdout]); <add> Log::config('stderr', ['engine' => $stderr]); <ide> } <ide> } <ide><path>lib/Cake/Test/TestCase/Console/ShellTest.php <ide> public function testFileAndConsoleLogging() { <ide> ['write'], <ide> [['types' => 'error']] <ide> ); <del> Log::engine('console', $mock); <add> Log::config('console', ['engine' => $mock]); <ide> $mock->expects($this->once()) <ide> ->method('write') <ide> ->with('error', $this->Shell->testMessage); <ide> $this->Shell->log_something(); <ide> $this->assertTrue(file_exists(LOGS . 'error.log')); <ide> $contents = file_get_contents(LOGS . 'error.log'); <ide> $this->assertContains($this->Shell->testMessage, $contents); <add> <add> Log::drop('console'); <ide> } <ide> <ide> /** <ide><path>lib/Cake/Test/TestCase/Error/ErrorHandlerTest.php <ide> public function setUp() { <ide> $request->base = ''; <ide> Router::setRequestInfo($request); <ide> Configure::write('debug', 2); <add> <add> $this->_logger = $this->getMock('Cake\Log\LogInterface'); <add> Log::config('error_test', [ <add> 'engine' => $this->_logger <add> ]); <ide> } <ide> <ide> /** <ide> public function setUp() { <ide> */ <ide> public function tearDown() { <ide> parent::tearDown(); <add> Log::drop('error_test'); <ide> if ($this->_restoreError) { <ide> restore_error_handler(); <ide> } <ide> public function testErrorSuppressed() { <ide> public function testHandleErrorDebugOff() { <ide> Configure::write('debug', 0); <ide> Configure::write('Error.trace', false); <del> if (file_exists(LOGS . 'debug.log')) { <del> unlink(LOGS . 'debug.log'); <del> } <add> <add> $this->_logger->expects($this->once()) <add> ->method('write') <add> ->with('notice', 'Notice (8): Undefined variable: out in [' . __FILE__ . ', line 160]'); <ide> <ide> set_error_handler('Cake\Error\ErrorHandler::handleError'); <ide> $this->_restoreError = true; <ide> <ide> $out .= ''; <del> <del> $result = file(LOGS . 'debug.log'); <del> $this->assertEquals(1, count($result)); <del> $this->assertRegExp( <del> '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (Notice|Debug): Notice \(8\): Undefined variable:\s+out in \[.+ line \d+\]$/', <del> $result[0] <del> ); <del> if (file_exists(LOGS . 'debug.log')) { <del> unlink(LOGS . 'debug.log'); <del> } <ide> } <ide> <ide> /** <ide> public function testHandleErrorDebugOff() { <ide> public function testHandleErrorLoggingTrace() { <ide> Configure::write('debug', 0); <ide> Configure::write('Error.trace', true); <del> if (file_exists(LOGS . 'debug.log')) { <del> unlink(LOGS . 'debug.log'); <del> } <add> <add> $this->_logger->expects($this->once()) <add> ->method('write') <add> ->with('notice', $this->logicalAnd( <add> $this->stringContains('Notice (8): Undefined variable: out in '), <add> $this->stringContains('Trace:'), <add> $this->stringContains(__NAMESPACE__ . '\ErrorHandlerTest::testHandleErrorLoggingTrace()') <add> )); <ide> <ide> set_error_handler('Cake\Error\ErrorHandler::handleError'); <ide> $this->_restoreError = true; <ide> <ide> $out .= ''; <del> <del> $result = file(LOGS . 'debug.log'); <del> $this->assertRegExp( <del> '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (Notice|Debug): Notice \(8\): Undefined variable:\s+out in \[.+ line \d+\]$/', <del> $result[0] <del> ); <del> $this->assertRegExp('/^Trace:/', $result[1]); <del> $this->assertRegExp('/^' . preg_quote(__NAMESPACE__, '/') . '\\\ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[2]); <del> if (file_exists(LOGS . 'debug.log')) { <del> unlink(LOGS . 'debug.log'); <del> } <ide> } <ide> <ide> /** <ide> public function testHandleException() { <ide> * @return void <ide> */ <ide> public function testHandleExceptionLog() { <del> if (file_exists(LOGS . 'error.log')) { <del> unlink(LOGS . 'error.log'); <del> } <ide> Configure::write('Exception', [ <ide> 'handler' => 'Cake\Error\ErrorHandler::handleException', <ide> 'renderer' => 'Cake\Error\ExceptionRenderer', <ide> 'log' => true <ide> ]); <ide> $error = new Error\NotFoundException('Kaboom!'); <ide> <add> $this->_logger->expects($this->once()) <add> ->method('write') <add> ->with('error', $this->logicalAnd( <add> $this->stringContains('[Cake\Error\NotFoundException] Kaboom!'), <add> $this->stringContains('ErrorHandlerTest->testHandleExceptionLog') <add> )); <add> <ide> ob_start(); <ide> ErrorHandler::handleException($error); <ide> $result = ob_get_clean(); <ide> $this->assertRegExp('/Kaboom!/', $result, 'message missing.'); <del> <del> $log = file(LOGS . 'error.log'); <del> $this->assertContains('[Cake\Error\NotFoundException] Kaboom!', $log[0], 'message missing.'); <del> $this->assertContains('ErrorHandlerTest->testHandleExceptionLog', $log[2], 'Stack trace missing.'); <ide> } <ide> <ide> /** <ide> public function testHandleExceptionLog() { <ide> * @return void <ide> */ <ide> public function testHandleExceptionLogSkipping() { <del> if (file_exists(LOGS . 'error.log')) { <del> unlink(LOGS . 'error.log'); <del> } <ide> Configure::write('Exception', [ <ide> 'handler' => 'Cake\Error\ErrorHandler::handleException', <ide> 'renderer' => 'Cake\Error\ExceptionRenderer', <ide> public function testHandleExceptionLogSkipping() { <ide> $notFound = new Error\NotFoundException('Kaboom!'); <ide> $forbidden = new Error\ForbiddenException('Fooled you!'); <ide> <add> $this->_logger->expects($this->once()) <add> ->method('write') <add> ->with( <add> 'error', <add> $this->stringContains('[Cake\Error\ForbiddenException] Fooled you!') <add> ); <add> <ide> ob_start(); <ide> ErrorHandler::handleException($notFound); <ide> $result = ob_get_clean(); <ide> public function testHandleExceptionLogSkipping() { <ide> ErrorHandler::handleException($forbidden); <ide> $result = ob_get_clean(); <ide> $this->assertRegExp('/Fooled you!/', $result, 'message missing.'); <del> <del> $log = file(LOGS . 'error.log'); <del> $this->assertNotContains('[Cake\Error\NotFoundException] Kaboom!', $log[0], 'message should not be logged.'); <del> $this->assertContains('[Cake\Error\ForbiddenException] Fooled you!', $log[0], 'message missing.'); <ide> } <ide> <ide> /** <ide> public function testHandleFatalErrorPage() { <ide> * @return void <ide> */ <ide> public function testHandleFatalErrorLog() { <del> if (file_exists(LOGS . 'error.log')) { <del> unlink(LOGS . 'error.log'); <del> } <ide> Configure::write('Exception', [ <ide> 'handler' => 'Cake\Error\ErrorHandler::handleException', <ide> 'renderer' => 'Cake\Error\ExceptionRenderer', <ide> 'log' => true <ide> ]); <add> $this->_logger->expects($this->at(0)) <add> ->method('write') <add> ->with('error', $this->logicalAnd( <add> $this->stringContains(__FILE__ . ', line 341'), <add> $this->stringContains('Fatal Error (1)'), <add> $this->stringContains('Something wrong') <add> )); <add> $this->_logger->expects($this->at(1)) <add> ->method('write') <add> ->with('error', $this->stringContains('[Cake\Error\FatalErrorException] Something wrong')); <ide> <ide> ob_start(); <ide> ErrorHandler::handleFatalError(E_ERROR, 'Something wrong', __FILE__, __LINE__); <ide> ob_clean(); <del> <del> $log = file(LOGS . 'error.log'); <del> $this->assertContains(__FILE__, $log[0], 'missing filename'); <del> $this->assertContains('[Cake\Error\FatalErrorException] Something wrong', $log[1], 'message missing.'); <ide> } <ide> <ide> } <ide><path>lib/Cake/Test/TestCase/Network/Email/EmailTest.php <ide> use Cake\Core\Configure; <ide> use Cake\Core\Plugin; <ide> use Cake\Log\Log; <del>use Cake\Log\LogInterface; <ide> use Cake\Network\Email\Email; <ide> use Cake\TestSuite\TestCase; <ide> use Cake\Utility\File; <ide> public function setUp() { <ide> public function tearDown() { <ide> parent::tearDown(); <ide> App::build(); <add> Log::drop('email'); <ide> } <ide> <ide> /** <ide> public function testSendWithNoContentDispositionAttachments() { <ide> * @return void <ide> */ <ide> public function testSendWithLog() { <del> $path = CAKE . 'Test/TestApp/tmp/'; <ide> $log = $this->getMock('Cake\Log\Engine\BaseLog', ['write'], [['scopes' => 'email']]); <ide> <ide> $message = 'Logging This'; <ide> public function testSendWithLog() { <ide> ) <ide> ); <ide> <del> Log::engine('email', $log); <add> Log::config('email', ['engine' => $log]); <ide> <ide> $this->CakeEmail->transport('Debug'); <ide> $this->CakeEmail->to('me@cakephp.org'); <ide> public function testSendWithLog() { <ide> * @return void <ide> */ <ide> public function testSendWithLogAndScope() { <del> Configure::write('Log.email', array( <del> 'engine' => 'File', <del> 'path' => TMP, <del> 'file' => 'cake_test_emails', <del> 'scopes' => array('email') <del> )); <del> Log::reset(); <add> $message = 'Logging This'; <add> <add> $log = $this->getMock('Cake\Log\Engine\BaseLog', ['write'], ['scopes' => ['email']]); <add> $log->expects($this->once()) <add> ->method('write') <add> ->with( <add> 'debug', <add> $this->logicalAnd( <add> $this->stringContains($message), <add> $this->stringContains('cake@cakephp.org'), <add> $this->stringContains('me@cakephp.org') <add> ) <add> ); <add> <add> Log::config('email', [ <add> 'engine' => $log, <add> ]); <add> <ide> $this->CakeEmail->transport('Debug'); <ide> $this->CakeEmail->to('me@cakephp.org'); <ide> $this->CakeEmail->from('cake@cakephp.org'); <ide> $this->CakeEmail->subject('My title'); <ide> $this->CakeEmail->config(array('log' => array('scope' => 'email'))); <del> $result = $this->CakeEmail->send("Logging This"); <del> <del> $File = new File(TMP . 'cake_test_emails.log'); <del> $log = $File->read(); <del> $this->assertTrue(strpos($log, $result['headers']) !== false); <del> $this->assertTrue(strpos($log, $result['message']) !== false); <del> $File->delete(); <add> $this->CakeEmail->send($message); <ide> } <ide> <ide> /** <ide><path>lib/Cake/Test/TestCase/Utility/DebuggerTest.php <ide> public function testExportVarZero() { <ide> */ <ide> public function testLog() { <ide> $mock = $this->getMock('Cake\Log\Engine\BaseLog', ['write']); <del> Log::engine('test', $mock); <add> Log::config('test', ['engine' => $mock]); <ide> <ide> $mock->expects($this->at(0)) <ide> ->method('write') <ide><path>lib/Cake/Test/TestCase/View/ViewTest.php <ide> public function testElementCacheHelperNoCache() { <ide> */ <ide> public function testElementCache() { <ide> Cache::drop('test_view'); <del> Configure::write('Cache.test_view', [ <add> Cache::config('test_view', [ <ide> 'engine' => 'File', <ide> 'duration' => '+1 day', <ide> 'path' => CACHE . 'views/',
6
Ruby
Ruby
remove duplicate 'quote_column_name' definition
c5f53ca33366062da987706704c27e516fe8cc3b
<ide><path>activerecord/lib/active_record/connection_adapters/mysql_adapter.rb <ide> def quoted_false <ide> "0" <ide> end <ide> <del> def quote_column_name(name) <del> "`#{name}`" <del> end <del> <ide> <ide> # DATABASE STATEMENTS ====================================== <ide> <ide> def select(sql, name = nil) <ide> end <ide> end <ide> end <del>end <ide>\ No newline at end of file <add>end
1
Javascript
Javascript
fix the release script
c3a529325f67bec0d707e647e7b407a803f50725
<ide><path>scripts/release/publish-commands/publish-to-npm.js <ide> const push = async ({cwd, dry, version}) => { <ide> // Update the @next tag to also point to it (so @next doens't lag behind). <ide> if (!isPrerelease) { <ide> await execUnlessDry( <del> `npm dist-tag add ${project}@${packageVersion} next` <add> `npm dist-tag add ${project}@${packageVersion} next`, <add> {cwd: path, dry} <ide> ); <ide> } <ide> }
1
Python
Python
add xla support to ncf
f2b702a056ba08a2f2344425f116a673a302abdd
<ide><path>official/recommendation/data_preprocessing.py <ide> def deserialize(examples_serialized): <ide> items = tf.reshape(tf.decode_raw( <ide> features[movielens.ITEM_COLUMN], tf.uint16), (batch_size,)) <ide> <del> if params["use_tpu"]: <del> items = tf.cast(items, tf.int32) # TPU doesn't allow uint16 infeed. <add> if params["use_tpu"] or params["use_xla_for_gpu"]: <add> items = tf.cast(items, tf.int32) # TPU and XLA disallows uint16 infeed. <ide> <ide> if not training: <ide> dupe_mask = tf.reshape(tf.cast(tf.decode_raw( <ide><path>official/recommendation/data_test.py <ide> def test_end_to_end(self): <ide> with g.as_default(): <ide> input_fn, record_dir, batch_count = \ <ide> data_preprocessing.make_input_fn(ncf_dataset, True) <del> dataset = input_fn({"batch_size": BATCH_SIZE, "use_tpu": False}) <add> dataset = input_fn({"batch_size": BATCH_SIZE, "use_tpu": False, <add> "use_xla_for_gpu": False}) <ide> first_epoch = self.drain_dataset(dataset=dataset, g=g) <ide> user_inv_map = {v: k for k, v in ncf_dataset.user_map.items()} <ide> item_inv_map = {v: k for k, v in ncf_dataset.item_map.items()} <ide><path>official/recommendation/ncf_main.py <ide> import tensorflow as tf <ide> # pylint: enable=g-bad-import-order <ide> <add>from tensorflow.contrib.compiler import xla <ide> from official.datasets import movielens <ide> from official.recommendation import constants as rconst <ide> from official.recommendation import data_preprocessing <ide> def construct_estimator(num_gpus, model_dir, params, batch_size, <ide> distribution = distribution_utils.get_distribution_strategy(num_gpus=num_gpus) <ide> run_config = tf.estimator.RunConfig(train_distribute=distribution) <ide> params["eval_batch_size"] = eval_batch_size <del> estimator = tf.estimator.Estimator(model_fn=neumf_model.neumf_model_fn, <del> model_dir=model_dir, config=run_config, <del> params=params) <add> model_fn = neumf_model.neumf_model_fn <add> if params["use_xla_for_gpu"]: <add> tf.logging.info("Using XLA for GPU for training and evaluation.") <add> model_fn = xla.estimator_model_fn(model_fn) <add> estimator = tf.estimator.Estimator(model_fn=model_fn, model_dir=model_dir, <add> config=run_config, params=params) <ide> return estimator, estimator <ide> <ide> <ide> def run_ncf(_): <ide> "beta2": FLAGS.beta2, <ide> "epsilon": FLAGS.epsilon, <ide> "match_mlperf": FLAGS.ml_perf, <add> "use_xla_for_gpu": FLAGS.use_xla_for_gpu, <ide> }, batch_size=flags.FLAGS.batch_size, eval_batch_size=eval_batch_size) <ide> <ide> # Create hooks that log information about the training and metric values <ide> def eval_size_check(eval_batch_size): <ide> "not need to be set." <ide> )) <ide> <add> flags.DEFINE_bool( <add> name="use_xla_for_gpu", default=False, help=flags_core.help_wrap( <add> "If True, use XLA for the model function. Only works when using a " <add> "GPU. On TPUs, XLA is always used")) <add> <add> flags.mark_flags_as_mutual_exclusive(["use_xla_for_gpu", "tpu"]) <add> <ide> <ide> if __name__ == "__main__": <ide> tf.logging.set_verbosity(tf.logging.INFO) <ide><path>official/recommendation/neumf_model.py <ide> def neumf_model_fn(features, labels, mode, params): <ide> duplicate_mask = tf.cast(features[rconst.DUPLICATE_MASK], tf.float32) <ide> return compute_eval_loss_and_metrics( <ide> logits, softmax_logits, duplicate_mask, params["num_neg"], <del> params["match_mlperf"], params["use_tpu"]) <add> params["match_mlperf"], <add> use_tpu_spec=params["use_tpu"] or params["use_xla_for_gpu"]) <ide> <ide> elif mode == tf.estimator.ModeKeys.TRAIN: <ide> labels = tf.cast(labels, tf.int32) <ide> def compute_eval_loss_and_metrics(logits, # type: tf.Tensor <ide> duplicate_mask, # type: tf.Tensor <ide> num_training_neg, # type: int <ide> match_mlperf=False, # type: bool <del> use_tpu=False # type: bool <add> use_tpu_spec=False # type: bool <ide> ): <ide> # type: (...) -> tf.estimator.EstimatorSpec <ide> """Model evaluation with HR and NDCG metrics. <ide> def compute_eval_loss_and_metrics(logits, # type: tf.Tensor <ide> <ide> match_mlperf: Use the MLPerf reference convention for computing rank. <ide> <del> use_tpu: Should the evaluation be performed on a TPU. <add> use_tpu_spec: Should a TPUEstimatorSpec be returned instead of an <add> EstimatorSpec. Required for TPUs and if XLA is done on a GPU. Despite its <add> name, TPUEstimatorSpecs work with GPUs <ide> <ide> Returns: <ide> An EstimatorSpec for evaluation. <ide> def metric_fn(top_k_tensor, ndcg_tensor, weight_tensor): <ide> rconst.NDCG_KEY: tf.metrics.mean(ndcg_tensor, weights=weight_tensor), <ide> } <ide> <del> if use_tpu: <add> if use_tpu_spec: <ide> return tf.contrib.tpu.TPUEstimatorSpec( <ide> mode=tf.estimator.ModeKeys.EVAL, loss=cross_entropy, <ide> eval_metrics=(metric_fn, [in_top_k, ndcg, metric_weights]))
4
Ruby
Ruby
run the notes tests in isolation
f945d157f79af44e2096fcbc9aaa22e410919dca
<ide><path>railties/test/application/rake/notes_test.rb <ide> module ApplicationTests <ide> module RakeTests <ide> class RakeNotesTest < ActiveSupport::TestCase <add> include ActiveSupport::Testing::Isolation <add> <ide> def setup <ide> build_app <ide> require "rails/all" <add> super <ide> end <ide> <ide> def teardown <add> super <ide> teardown_app <ide> end <ide>
1
Text
Text
remove pypi version badge
df464c103efdc3f9672a33ceca9e13679796c999
<ide><path>README.md <ide> # Keras: Deep Learning library for TensorFlow and Theano <ide> <ide> [![Build Status](https://travis-ci.org/fchollet/keras.svg?branch=master)](https://travis-ci.org/fchollet/keras) <del>[![PyPI version](https://badge.fury.io/py/keras.svg)](https://badge.fury.io/py/keras) <ide> [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/fchollet/keras/blob/master/LICENSE) <ide> [![Join the chat at https://gitter.im/Keras-io/Lobby](https://badges.gitter.im/Keras-io/Lobby.svg)](https://gitter.im/Keras-io/Lobby) <ide>
1
Text
Text
ask contributors to update the documentation
74acfa394ff07870dee94cccaad008fcb1fa3cca
<ide><path>guides/source/contributing_to_ruby_on_rails.md <ide> You can invoke `test_jdbcmysql`, `test_jdbcsqlite3` or `test_jdbcpostgresql` als <ide> <ide> The test suite runs with warnings enabled. Ideally, Ruby on Rails should issue no warnings, but there may be a few, as well as some from third-party libraries. Please ignore (or fix!) them, if any, and submit patches that do not issue new warnings. <ide> <add>### Updating the Documentation <add> <add>The Ruby on Rails [guides](https://guides.rubyonrails.org/) provide a high-level overview of Rails' features, while the [API documentation](https://api.rubyonrails.org/) delves into specifics. <add> <add>If your PR adds a new feature, or changes how an existing feature behaves, check the relevant documentation, and update it or add to it as necessary. <add> <add>For example, if you modify Active Storage's image analyzer to add a new metadata field, you should update the [Analyzing Files](https://edgeguides.rubyonrails.org/active_storage_overview.html#analyzing-files) section of the Active Storage guide to reflect that. <add> <ide> ### Updating the CHANGELOG <ide> <ide> The CHANGELOG is an important part of every release. It keeps the list of changes for every Rails version. <ide> A CHANGELOG entry should summarize what was changed and should end with the auth <ide> Your name can be added directly after the last word if there are no code <ide> examples or multiple paragraphs. Otherwise, it's best to make a new paragraph. <ide> <add>### Ignoring Files Created by Your Editor / IDE <add> <add>Some editors and IDEs will create hidden files or folders inside the `rails` folder. Instead of manually excluding those from each commit or adding them to Rails' `.gitignore`, you should add them to your own [global gitignore file](https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer). <add> <ide> ### Updating the Gemfile.lock <ide> <ide> Some changes require dependency upgrades. In these cases, make sure you run `bundle update` to get the correct version of the dependency and commit the `Gemfile.lock` file within your changes.
1
PHP
PHP
allow escaping of blade echos using @ sign
cb93bf3df8d25c04939462f81b75ddb9e4e6faa0
<ide><path>src/Illuminate/View/Compilers/BladeCompiler.php <ide> protected function compileEchos($value) <ide> */ <ide> protected function compileRegularEchos($value) <ide> { <del> $pattern = sprintf('/%s\s*(.+?)\s*%s/s', $this->contentTags[0], $this->contentTags[1]); <add> $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s/s', $this->contentTags[0], $this->contentTags[1]); <ide> <del> return preg_replace($pattern, '<?php echo $1; ?>', $value); <add> $callback = function($matches) <add> { <add> return $matches[1] ? substr($matches[0], 1) : '<?php echo '.$matches[2].'; ?>'; <add> }; <add> <add> return preg_replace_callback($pattern, $callback, $value); <ide> } <ide> <ide> /** <ide><path>tests/View/ViewBladeCompilerTest.php <ide> public function testEchosAreCompiled() <ide> } <ide> <ide> <add> public function testEscapedWithAtEchosAreCompiled() <add> { <add> $compiler = new BladeCompiler($this->getFiles(), __DIR__); <add> $this->assertEquals('{{$name}}', $compiler->compileString('@{{$name}}')); <add> $this->assertEquals('{{ $name }}', $compiler->compileString('@{{ $name }}')); <add> $this->assertEquals('{{ <add> $name <add> }}', <add> $compiler->compileString('@{{ <add> $name <add> }}')); <add> } <add> <add> <ide> public function testReversedEchosAreCompiled() <ide> { <ide> $compiler = new BladeCompiler($this->getFiles(), __DIR__);
2
Ruby
Ruby
update the documentation for engine and railtie
542946a0c2e8a694eac58a9cf50c8b9c734b5ef2
<ide><path>railties/lib/rails/engine.rb <ide> module Rails <ide> # # lib/my_engine.rb <ide> # module MyEngine <ide> # class Engine < Rails::Engine <del> # engine_name :my_engine <ide> # end <ide> # end <ide> # <ide> module Rails <ide> # Example: <ide> # <ide> # class MyEngine < Rails::Engine <del> # # config.middleware is shared configururation <del> # config.middleware.use MyEngine::Middleware <del> # <ide> # # Add a load path for this specific Engine <ide> # config.load_paths << File.expand_path("../lib/some/path", __FILE__) <add> # <add> # initializer "my_engine.add_middleware" do |app| <add> # app.middlewares.use MyEngine::Middleware <add> # end <ide> # end <ide> # <ide> # == Paths <ide><path>railties/lib/rails/railtie.rb <ide> module Rails <ide> # # lib/my_gem/railtie.rb <ide> # module MyGem <ide> # class Railtie < Rails::Railtie <del> # railtie_name :mygem <ide> # end <ide> # end <ide> # <ide> module Rails <ide> # <ide> # module MyGem <ide> # class Railtie < Rails::Railtie <del> # railtie_name :mygem <ide> # end <ide> # end <del> # <del> # * Make sure your Gem loads the railtie.rb file if Rails is loaded first, an easy <del> # way to check is by checking for the Rails constant which will exist if Rails <del> # has started: <del> # <del> # # lib/my_gem.rb <del> # module MyGem <del> # require 'lib/my_gem/railtie' if defined?(Rails) <del> # end <del> # <del> # * Or instead of doing the require automatically, you can ask your users to require <del> # it for you in their Gemfile: <del> # <del> # # #{USER_RAILS_ROOT}/Gemfile <del> # gem "my_gem", :require_as => ["my_gem", "my_gem/railtie"] <ide> # <ide> # == Initializers <ide> # <ide> module Rails <ide> # end <ide> # <ide> # If specified, the block can also receive the application object, in case you <del> # need to access some application specific configuration: <add> # need to access some application specific configuration, like middleware: <ide> # <ide> # class MyRailtie < Rails::Railtie <ide> # initializer "my_railtie.configure_rails_initialization" do |app| <del> # if app.config.cache_classes <del> # # some initialization behavior <del> # end <add> # app.middlewares.use MyRailtie::Middleware <ide> # end <ide> # end <ide> # <ide> module Rails <ide> # # Customize the ORM <ide> # config.generators.orm :my_railtie_orm <ide> # <del> # # Add a middleware <del> # config.middlewares.use MyRailtie::Middleware <del> # <ide> # # Add a to_prepare block which is executed once in production <ide> # # and before which request in development <ide> # config.to_prepare do <ide> module Rails <ide> # By registering it: <ide> # <ide> # class MyRailtie < Railtie <del> # subscriber MyRailtie::Subscriber.new <add> # subscriber :my_gem, MyRailtie::Subscriber.new <ide> # end <ide> # <ide> # Take a look in Rails::Subscriber docs for more information.
2
Javascript
Javascript
add more info link for warnedmissingnativeanimated
f9ab788c6bcf886170259c132ea4f9ef39e6bfd3
<ide><path>Libraries/Animated/src/AnimatedImplementation.js <ide> function shouldUseNativeDriver(config: AnimationConfig | EventConfig): boolean { <ide> 'Animated: `useNativeDriver` is not supported because the native ' + <ide> 'animated module is missing. Falling back to JS-based animation. To ' + <ide> 'resolve this, add `RCTAnimation` module to this app, or remove ' + <del> '`useNativeDriver`.' <add> '`useNativeDriver`. ' + <add> 'More info: https://github.com/facebook/react-native/issues/11094#issuecomment-263240420' <ide> ); <ide> warnedMissingNativeAnimated = true; <ide> }
1
Text
Text
fix typo in activemodel changelog
aef6b7996741c21f7c95004017aeb805f8a4decb
<ide><path>activemodel/CHANGELOG.md <ide> * Validate multiple contexts on `valid?` and `invalid?` at once. <ide> <ide> Example: <del> <add> <ide> class Person <ide> include ActiveModel::Validations <del> <add> <ide> attr_reader :name, :title <ide> validates_presence_of :name, on: :create <ide> validates_presence_of :title, on: :update <ide> end <del> <add> <ide> person = Person.new <del> person.valid?([:create, :update]) # => true <add> person.valid?([:create, :update]) # => false <ide> person.errors.messages # => {:name=>["can't be blank"], :title=>["can't be blank"]} <ide> <ide> *Dmitry Polushkin*
1
Ruby
Ruby
improve language and examples in railtie docs
74b44dfb86365c805a6fe610da3764e00b4f96aa
<ide><path>railties/lib/rails/railtie.rb <ide> require 'active_support/inflector' <ide> <ide> module Rails <del> # Railtie is the core of the Rails Framework and provides several hooks to extend <add> # Railtie is the core of the Rails framework and provides several hooks to extend <ide> # Rails and/or modify the initialization process. <ide> # <ide> # Every major component of Rails (Action Mailer, Action Controller, <del> # Action View, Active Record and Active Resource) are all Railties, so each of <del> # them is responsible to set their own initialization. This makes, for example, <del> # Rails absent of any Active Record hook, allowing any other ORM framework to hook in. <add> # Action View, Active Record and Active Resource) is a Railtie. Each of <add> # them is responsible for their own initialization. This makes Rails itself <add> # absent of any component hooks, allowing other components to be used in <add> # place of any of the Rails defaults. <ide> # <ide> # Developing a Rails extension does _not_ require any implementation of <ide> # Railtie, but if you need to interact with the Rails framework during <del> # or after boot, then Railtie is what you need to do that interaction. <add> # or after boot, then Railtie is needed. <ide> # <del> # For example, the following would need you to implement Railtie in your <del> # plugin: <add> # For example, an extension doing any of the following would require Railtie: <ide> # <ide> # * creating initializers <del> # * configuring a Rails framework or the Application, like setting a generator <del> # * adding Rails config.* keys to the environment <del> # * setting up a subscriber to the Rails +ActiveSupport::Notifications+ <del> # * adding rake tasks into rails <add> # * configuring a Rails framework for the application, like setting a generator <add> # * adding config.* keys to the environment <add> # * setting up a subscriber with ActiveSupport::Notifications <add> # * adding rake tasks <ide> # <ide> # == Creating your Railtie <ide> # <del> # Implementing Railtie in your Rails extension is done by creating a class <del> # Railtie that has your extension name and making sure that this gets loaded <del> # during boot time of the Rails stack. <add> # To extend Rails using Railtie, create a Railtie class which inherits <add> # from Rails::Railtie within your extension's namespace. This class must be <add> # loaded during the Rails boot process. <ide> # <del> # You can do this however you wish, but here is an example if you want to provide <del> # it for a gem that can be used with or without Rails: <add> # The following example demonstrates an extension which can be used with or without Rails. <ide> # <del> # * Create a file (say, lib/my_gem/railtie.rb) which contains class Railtie inheriting from <del> # Rails::Railtie and is namespaced to your gem: <del> # <del> # # lib/my_gem/railtie.rb <del> # module MyGem <del> # class Railtie < Rails::Railtie <del> # end <add> # # lib/my_gem/railtie.rb <add> # module MyGem <add> # class Railtie < Rails::Railtie <ide> # end <add> # end <ide> # <del> # * Require your own gem as well as rails in this file: <del> # <del> # # lib/my_gem/railtie.rb <del> # require 'my_gem' <del> # require 'rails' <del> # <del> # module MyGem <del> # class Railtie < Rails::Railtie <del> # end <del> # end <add> # # lib/my_gem.rb <add> # require 'my_gem/railtie' if defined?(Rails) <ide> # <ide> # == Initializers <ide> #
1
Ruby
Ruby
use #remove_possible_method instead
1c2dc92aaeee1b5247957f626343e767418c3780
<ide><path>activesupport/lib/active_support/core_ext/class/attribute.rb <ide> def #{name} <ide> val <ide> end <ide> <del> remove_method :#{name} if method_defined?(:#{name}) <add> remove_possible_method :#{name} <ide> def #{name} <ide> defined?(@#{name}) ? @#{name} : self.class.#{name} <ide> end
1